Completed
Push — development ( 67765c...7029e6 )
by Andrij
18:12
created

Lib_admin::init_settings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/*
0 ignored issues
show
introduced by
You must use "/**" style comments for a file comment
Loading history...
4
 * Image CMS
5
 * lib_admin.php
6
 *
7
 */
8
if (!defined('BASEPATH')) {
9
    exit('No direct script access allowed');
10
}
11
12
class Lib_admin
13
{
0 ignored issues
show
introduced by
Opening brace of a class must be on the same line as the definition
Loading history...
14
15
    public $CI;
16
17
    public function __construct() {
18
        $this->CI = & get_instance();
19
    }
20
21
    /**
22
     * 	Initiating the basic parameters for administrator
0 ignored issues
show
introduced by
Function comment short description must start with exactly one space
Loading history...
23
     *  Loads libraries
24
     */
25
    public function init_settings() {
26
27
        $this->CI->config->set_item('langs', ['russian', 'english']);
28
29
        $this->CI->load->library('DX_Auth');
30
31
        # Load admin model
0 ignored issues
show
Coding Style introduced by
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Loading history...
introduced by
Perl-style comments are not allowed; use "// Comment" instead
Loading history...
32
        $this->CI->load->model('cms_admin');
33
34
        # Set default admin template
0 ignored issues
show
Coding Style introduced by
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Loading history...
introduced by
Perl-style comments are not allowed; use "// Comment" instead
Loading history...
35
        $this->CI->config->set_item('template', 'administrator');
36
37
        $this->CI->load->library('form_validation');
38
        $this->CI->load->library('template');
39
        $this->CI->load->helper('javascript');
40
        $this->CI->load->helper('admin');
41
        $this->CI->load->helper('component');
42
    }
43
44
    /**
45
     * Use this function to write empty value in db insted of 0
46
     *
47
     * @access public
48
     * @return string
49
     */
50
    public function db_post($data) {
51
        return ($this->CI->input->post($data)) ? $this->CI->input->post($data) : $data = '';
52
    }
53
54
    public function log($message) {
55
        $data = [
56
                 'user_id'  => $this->CI->dx_auth->get_user_id(),
57
                 'username' => $this->CI->dx_auth->get_username(),
58
                 'message'  => $message,
59
                 'date'     => time(),
60
                ];
61
62
        $this->CI->db->insert('logs', $data);
63
    }
64
65
}
66
67
/* End of lib_admin.php */