public function __construct()
 {
     parent::__construct();
     // Not an admin and not allowed to see files
     if ($this->current_user->group !== 'admin' and !array_key_exists('files', $this->permissions)) {
         $this->load->language('files/files');
         show_error(lang('files.no_permissions'));
     }
     ci()->admin_theme = $this->theme_m->get_admin();
     // Using a bad slug? Weak
     if (empty($this->admin_theme->slug)) {
         show_error('This site has been set to use an admin theme that does not exist.');
     }
     // make a constant as this is used in a lot of places
     defined('ADMIN_THEME') or define('ADMIN_THEME', $this->admin_theme->slug);
     // Prepare Asset library
     $this->asset->set_theme(ADMIN_THEME);
     // Set the location of assets
     $this->config->set_item('asset_dir', dirname($this->admin_theme->web_path) . '/');
     $this->config->set_item('asset_url', BASE_URL . dirname($this->admin_theme->web_path) . '/');
     $this->config->set_item('theme_asset_dir', dirname($this->admin_theme->web_path) . '/');
     $this->config->set_item('theme_asset_url', BASE_URL . dirname($this->admin_theme->web_path) . '/');
     $this->load->model('files/file_folders_m');
     $this->load->model('files/file_m');
     $this->lang->load('files/files');
     $this->lang->load('wysiwyg');
     $this->lang->load('buttons');
     $this->template->set_theme(ADMIN_THEME)->set_layout('wysiwyg', 'admin')->enable_parser(FALSE)->set('editor_path', config_item('asset_dir') . 'js/ckeditor/')->append_metadata(css('wysiwyg.css', 'wysiwyg'))->append_metadata(css('jquery/ui-lightness/jquery-ui.css'))->append_metadata(js('jquery/jquery.min.js'))->append_metadata(js('plugins.js'))->append_metadata(js('jquery/jquery-ui.min.js'))->append_metadata(js('wysiwyg.js', 'wysiwyg'));
 }
Example #2
0
 function S($name, $value = '', $options = null)
 {
     $this->load->driver('cache', array('adapter' => 'redis', 'backup' => 'file'));
     if ($this->cache->redis->is_supported()) {
         if ('' === $value) {
             // 获取缓存
             return $this->cache->redis->get($name);
         } elseif (is_null($value)) {
             // 删除缓存
             return $this->cache->redis->delete($name);
         } else {
             // 缓存数据
             $expire = is_numeric($options) ? $options : config_item('cache_time');
             return $this->cache->redis->save($name, $value, $expire);
         }
     }
     if ('' === $value) {
         // 获取缓存
         return $this->cache->get($name);
     } elseif (is_null($value)) {
         // 删除缓存
         return $this->cache->delete($name);
     } else {
         // 缓存数据
         $expire = is_numeric($options) ? $options : NULL;
         return $this->cache->save($name, $value, $expire);
     }
 }
 public function up()
 {
     $fields = ['name' => ['type' => 'varchar', 'constraint' => 255], 'id' => ['type' => 'int', 'constraint' => 9, 'auto_increment' => true, 'unsigned' => true], 'created_on' => ['type' => 'datetime'], 'modified_on' => ['type' => 'datetime'], 'age' => ['type' => 'int', 'constraint' => 2]];
     $this->dbforge->add_field($fields);
     $this->dbforge->add_key('id', true);
     $this->dbforge->create_table('rabbits', true, config_item('migration_create_table_attr'));
 }
 function create_authd_post()
 {
     // Validation Rules
     $this->form_validation->set_rules('address', 'Address', 'required');
     $this->form_validation->set_rules('title', 'Title', 'required');
     $this->form_validation->set_rules('locality', 'City', 'required');
     // Passes Validation
     if ($this->form_validation->run() == true) {
         if ($this->input->post('site_id')) {
             $site_id = $this->input->post('site_id');
         } else {
             $site_id = config_item('site_id');
         }
         $content_data = array('site_id' => $site_id, 'parent_id' => $this->input->post('parent_id'), 'category_id' => $this->input->post('category_id'), 'module' => 'places', 'type' => 'place', 'source' => $this->input->post('source'), 'order' => 0, 'user_id' => $this->oauth_user_id, 'title' => $this->input->post('title'), 'title_url' => form_title_url($this->input->post('title'), $this->input->post('title_url')), 'content' => $this->input->post('content'), 'details' => $this->input->post('details'), 'access' => $this->input->post('access'), 'comments_allow' => config_item('places_comments_allow'), 'geo_lat' => $this->input->post('geo_lat'), 'geo_long' => $this->input->post('geo_long'), 'viewed' => 'Y', 'approval' => 'Y', 'status' => form_submit_publish($this->input->post('status')));
         $activity_data = array('title' => $this->input->post('title'), 'address' => $this->input->post('address'), 'locality' => $this->input->post('locality'), 'region' => $this->input->post('region'), 'geo_lat' => $this->input->post('geo_lat'), 'geo_long' => $this->input->post('geo_long'));
         // Insert
         $result = $this->social_igniter->add_content($content_data, $activity_data);
         if ($result) {
             // Process Tags
             if ($this->input->post('tags')) {
                 $this->social_tools->process_tags($this->input->post('tags'), $result['content']->content_id);
             }
             // Add Place
             $place_data = array('content_id' => $result['content']->content_id, 'address' => $this->input->post('address'), 'district' => $this->input->post('district'), 'locality' => $this->input->post('locality'), 'region' => $this->input->post('region'), 'country' => $this->input->post('country'), 'postal' => $this->input->post('postal'));
             $place = $this->social_tools->add_place($place_data);
             $message = array('status' => 'success', 'message' => 'Awesome we created your place', 'data' => $result['content'], 'activity' => $result['activity'], 'place' => $place);
         } else {
             $message = array('status' => 'error', 'message' => 'Oops we were unable to create your place');
         }
     } else {
         $message = array('status' => 'error', 'message' => validation_errors());
     }
     $this->response($message, 200);
 }
Example #5
0
 function index()
 {
     $per_page = (int) $this->input->get_post('per_page');
     $cupage = config_item('site_page_num');
     //每页显示个数
     $return_arr = array('total_rows' => true);
     $where = array();
     //	if($this->user_info->key != 'root'){
     $where['status >='] = 0;
     $where['gid !='] = 1;
     //	}
     $title = htmlspecialchars($this->input->get_post("title"));
     $like = array();
     $string = '';
     if ($title = trim($title)) {
         $like['title'] = $title;
         $string .= "title=" . $title;
     }
     $options = array('page' => $cupage, 'per_page' => $per_page, 'like' => $like, 'where' => $where, 'order' => 'gid desc');
     $lc_list = $this->model->getAll($options, $return_arr);
     //查询所有信息
     $url = admin_base_url('user/group?');
     $page = $this->sharepage->showPage($url, $return_arr['total_rows'], $cupage);
     $data = array('lc_list' => $lc_list, 'page' => $page, 'title' => $title, 'totals' => $return_arr['total_rows']);
     $this->_template('admin/user/grouplist', $data);
 }
/**
* Class registry
*
* This function acts as a singleton.  If the requested class does not
* exist it is instantiated and set to a static variable.  If it has
* previously been instantiated the variable is returned.
*
* @access	public
* @param	string	the class name being requested
* @param	bool	optional flag that lets classes get loaded but not instantiated
* @return	object
*/
function &load_class($class, $instantiate = TRUE)
{
    static $objects = array();
    // Does the class exist?  If so, we're done...
    if (isset($objects[$class])) {
        return $objects[$class];
    }
    // If the requested class does not exist in the application/libraries
    // folder we'll load the native class from the system/libraries folder.
    if (file_exists(APPPATH . 'libraries/' . config_item('subclass_prefix') . $class . EXT)) {
        require BASEPATH . 'libraries/' . $class . EXT;
        require APPPATH . 'libraries/' . config_item('subclass_prefix') . $class . EXT;
        $is_subclass = TRUE;
    } else {
        if (file_exists(APPPATH . 'libraries/' . $class . EXT)) {
            require APPPATH . 'libraries/' . $class . EXT;
            $is_subclass = FALSE;
        } else {
            require BASEPATH . 'libraries/' . $class . EXT;
            $is_subclass = FALSE;
        }
    }
    if ($instantiate == FALSE) {
        $objects[$class] = TRUE;
        return $objects[$class];
    }
    if ($is_subclass == TRUE) {
        $name = config_item('subclass_prefix') . $class;
        $objects[$class] =& new $name();
        return $objects[$class];
    }
    $name = $class != 'Controller' ? 'CI_' . $class : $class;
    $objects[$class] =& new $name();
    return $objects[$class];
}
Example #7
0
 public function check_lang()
 {
     $result = array('title' => lang('ionize_title_check_lang'), 'status' => 'success', 'message' => lang('ionize_message_check_ok'));
     // Get the languages : DB + config/language.php
     $db_languages = Settings::get_languages();
     $config_available_languages = config_item('available_languages');
     // Check differences between DB and config/language.php file
     $result_status = TRUE;
     foreach ($db_languages as $lang) {
         if (!array_key_exists($lang['lang'], $config_available_languages)) {
             $result_status = FALSE;
         }
     }
     // Correct if needed
     if ($result_status == FALSE) {
         // Default language
         $def_lang = '';
         // Available languages array
         $available_languages = array();
         foreach ($db_languages as $l) {
             // Set default lang code
             if ($l['def'] == '1') {
                 $def_lang = $l['lang'];
             }
             $available_languages[$l['lang']] = $l['name'];
         }
         $this->config_model->change('language.php', 'default_lang_code', $def_lang);
         if (!empty($available_languages)) {
             $this->config_model->change('language.php', 'available_languages', $available_languages);
         }
         $result['message'] = lang('ionize_message_check_corrected');
     }
     $this->xhr_output($result);
 }
Example #8
0
    public function send_to_email($name, $age, $email)
    {
        try {
            $subject = "[KepoAbis.com] Happy Birthday " . $name;
            $from = "*****@*****.**";
            $to = $email;
            $message = "<p><strong>HAPPY BIRTHDAY " . $name . " yang ke-" . $age . "</strong></p>";
            $message .= "<br><p>Semoga tercapai segala cita-citanya :D</p><br><br>";
            $message .= "<strong>Best Regards,<br>\n\t\t\t\t\t\tHaamill Productions</strong>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<br>Jalan Pelita RT 02/09 No. 69 Kel. Tengah, Kec. Kramat Jati, Jakarta Timur 13540, Indonesia\n\t\t\t\t\t\t<br><a href='http://kepoabis.com'>KepoAbis.com</a> by Haamill Productions\n\t\t\t\t\t\t<br>Phone: 085697309204\n\t\t\t\t\t\t<br>Email: hi@kepoabis.com or contact@kepoabis.com";
            $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
				<html xmlns="http://www.w3.org/1999/xhtml">
				<head>
				    <meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
				    <title>' . html_escape($subject) . '</title>
				    <style type="text/css">
				        body {
				            font-family: Arial, Verdana, Helvetica, sans-serif;
				            font-size: 16px;
				        }
				    </style>
				</head>
				<body>
					<p>' . $message . '</p>
				</body>
				</html>';
            //$body = $this->email->full_html($subject, $message);
            $result = $this->email->from($from)->to($to)->subject($subject)->message($body)->send();
            echo $result . "<br>" . $message;
        } catch (Exception $e) {
            print_r($e->getMessage());
        }
    }
 public function up()
 {
     $this->load->config('install');
     $this->load->library('installer');
     // Add New Design Settings
     $this->installer->install_settings('design', config_item('design_settings'), TRUE);
 }
 /**
  * CSRF Verify
  *
  * @return	CI_Security
  */
 public function csrf_verify()
 {
     // If it's not a POST request we will set the CSRF cookie
     if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') {
         return $this->csrf_set_cookie();
     }
     // Check if URI has been whitelisted from CSRF checks
     if ($exclude_uris = config_item('csrf_exclude_uris')) {
         $uri = load_class('URI', 'core');
         foreach ($exclude_uris as $excluded) {
             if (preg_match('#^' . $excluded . '$#i' . (UTF8_ENABLED ? 'u' : ''), $uri->uri_string())) {
                 return $this;
             }
         }
     }
     // Do the tokens exist in both the _POST and _COOKIE arrays?
     if (!isset($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]) or $_POST[$this->_csrf_token_name] !== $_COOKIE[$this->_csrf_cookie_name]) {
         $this->csrf_show_error();
     }
     // We kill this since we're done and we don't want to polute the _POST array
     unset($_POST[$this->_csrf_token_name]);
     // Regenerate on every submission?
     if (config_item('csrf_regenerate')) {
         // Nothing should last forever
         unset($_COOKIE[$this->_csrf_cookie_name]);
         $this->_csrf_hash = NULL;
     }
     $this->_csrf_set_hash();
     $this->csrf_set_cookie();
     log_message('info', 'CSRF token verified');
     return $this;
 }
Example #11
0
 private function _error_view_path()
 {
     if (!($_template_path = config_item('error_views_path'))) {
         $_template_path = VIEWPATH . '/errors/';
     }
     return str_replace(VIEWPATH, '', $_template_path);
 }
 function index()
 {
     // Get Users
     $users = $this->social_auth->get_users('active', 1);
     $users_view = NULL;
     // Title Stuff
     $this->data['page_title'] = 'Users';
     $this->data['sub_title'] = 'Manage';
     // Users View Loop
     foreach ($users as $user) {
         $this->data['user_id'] = $user->user_id;
         $this->data['name'] = $user->name;
         $this->data['avatar'] = $this->social_igniter->profile_image($user->user_id, $user->image, $user->email);
         $this->data['profile'] = base_url() . 'profile/' . $user->username;
         $this->data['created_on'] = format_datetime('SIMPLE_ABBR', $user->created_on);
         $this->data['last_login'] = format_datetime('SIMPLE_TIME_ABBR', $user->last_login);
         // Alerts
         $this->data['user_alerts'] = item_alerts_user($user);
         // Actions
         $this->data['user_state'] = item_user_state($user->active);
         $this->data['user_edit'] = base_url() . 'users/manage/' . $user->user_id;
         $this->data['user_delete'] = base_url() . 'api/users/destroy/id/' . $user->user_id;
         // View
         $users_view .= $this->load->view(config_item('dashboard_theme') . '/partials/item_users.php', $this->data, true);
     }
     // Final Output
     $this->data['users_view'] = $users_view;
     $this->data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message');
     $this->render('dashboard_wide');
 }
Example #13
0
 /**
  * A standardized method for hasing a password before storing
  * in the database.
  *
  * @param $password
  * @return bool|mixed|string
  */
 public static function hashPassword($password)
 {
     if (!config_item('auth.hash_cost')) {
         get_instance()->load->config('auth');
     }
     return password_hash($password, PASSWORD_DEFAULT, ['cost' => config_item('auth.hash_cost')]);
 }
Example #14
0
 /**
  * Form Declaration
  *
  * Creates the opening portion of the form.
  *
  * @param       string      the URI segments of the form destination
  * @param       array       a key/value pair of attributes
  * @param       array       a key/value pair hidden data
  * @return      string
  */
 function form_open($action = '', $attributes = array(), $hidden = array())
 {
     $CI =& get_instance();
     // If no action is provided then set to the current url
     if (!$action) {
         // Modified by Deepak Patil <*****@*****.**>, 23-FEB-2015.
         //$action = $CI->config->site_url($CI->uri->uri_string());
         $action = CURRENT_URL;
         //
     } elseif (strpos($action, '://') === FALSE) {
         $action = $CI->config->site_url($action);
     }
     $attributes = _attributes_to_string($attributes);
     if (stripos($attributes, 'method=') === FALSE) {
         $attributes .= ' method="post"';
     }
     if (stripos($attributes, 'accept-charset=') === FALSE) {
         $attributes .= ' accept-charset="' . strtolower(config_item('charset')) . '"';
     }
     $form = '<form action="' . $action . '"' . $attributes . ">\n";
     // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
     // Modified by Deepak Patil <*****@*****.**>, 04-NOV-2011.
     //if ($CI->config->item('csrf_protection') === TRUE && strpos($action, $CI->config->base_url()) !== FALSE && ! stripos($form, 'method="get"'))
     // Aways add the hidden value for protecting AJAX requests, when the global configuration option 'csrf_protection' is off.
     if (strpos($action, $CI->config->base_url()) !== FALSE && !stripos($form, 'method="get"')) {
         $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
     }
     if (is_array($hidden)) {
         foreach ($hidden as $name => $value) {
             $form .= '<input type="hidden" name="' . $name . '" value="' . form_prep($value) . '" style="display:none;" />' . "\n";
         }
     }
     return $form;
 }
Example #15
0
 function ip_address()
 {
     $ING =& get_instance();
     if ($ING->input->fetch_ip_address() !== FALSE) {
         return $ING->input->fetch_ip_address();
     }
     $proxy_ips = config_item('proxy_ips');
     if (!empty($proxy_ips)) {
         $proxy_ips = explode(',', str_replace(' ', '', $proxy_ips));
         foreach (array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT_IP') as $header) {
             if (($spoof = server($header)) !== FALSE) {
                 // Some proxies typically list the whole chain of IP
                 // addresses through which the client has reached us.
                 // e.g. client_ip, proxy_ip1, proxy_ip2, etc.
                 if (strpos($spoof, ',') !== FALSE) {
                     $spoof = explode(',', $spoof, 2);
                     $spoof = $spoof[0];
                 }
                 if (!valid_ip($spoof)) {
                     $spoof = FALSE;
                 } else {
                     break;
                 }
             }
         }
         $ING->input->set_ip_address($spoof !== FALSE && in_array($_SERVER['REMOTE_ADDR'], $proxy_ips, TRUE) ? $spoof : $_SERVER['REMOTE_ADDR']);
     } else {
         $ING->input->set_ip_address($_SERVER['REMOTE_ADDR']);
     }
     if (!valid_ip($ING->input->fetch_ip_address())) {
         $ING->input->set_ip_address('0.0.0.0');
     }
     return $ING->input->fetch_ip_address();
 }
Example #16
0
 function month()
 {
     $per_page = (int) $this->input->get_post('per_page');
     $cupage = config_item('site_page_num');
     //每页显示个数
     $day = date('Y-m', strtotime('-1 month'));
     $child = $this->getAllChild();
     $sellerids = join(array_keys($child['seller']), "','");
     $agentids = join(array_keys($child['agent']), "','");
     $sql = "select s_month,sentcount,agentid,'代理' as type from t_statistic_agent_m where s_month='{$day}' and agentid  in('{$agentids}') union all select * from (select s_month,sum(sentcount) as sentcount ,sellerid,'商户' from t_statistic_seller_m where s_month='{$day}' and sellerid in ('{$sellerids}') group by sellerid,s_month) m order by s_month desc,type,agentid";
     $count = "select count(*) as c from ({$sql}) as m";
     $query = $this->db->query($count);
     $total_rows = $query->first_row()->c;
     $limit = " limit {$per_page} ,{$cupage}";
     $query = $this->db->query($sql . $limit);
     $rt = $query->result();
     foreach ($rt as $k => $v) {
         if (empty($v->agentid)) {
             unset($rt[$k]);
             continue;
         }
         if ($v->type == '代理') {
             $rt[$k]->agentname = $child['agent'][$v->agentid];
         } else {
             $rt[$k]->agentname = $child['seller'][$v->agentid];
         }
     }
     $url = base_url('admin/agent/statistic/month?');
     $page = $this->sharepage->showPage($url, $total_rows, $cupage);
     $this->_template('admin/agent/month', array('lc_list' => $rt, 'page' => $page, 'totals' => $total_rows));
 }
Example #17
0
 public function get_postdata($valid = TRUE)
 {
     $_POST or exit('Oops.. Acesso Negado!');
     if ($valid) {
         $this->validate_fields();
     }
     $this->config->load('form_validation');
     foreach (config_item($this->router->class) as $key => $val) {
         $field = $val['field'];
         $data[$field] = $this->input->post($field, TRUE);
         // Data para formato YYYY-MM-DD
         if (strpos($field, 'date') !== FALSE) {
             $data[$field] = date_db($data[$field]);
         }
         // Remove Campos de Senha
         if (strpos($field, 'password') !== FALSE) {
             unset($data[$field]);
         }
         // Valor padrão para campo Status
         if ($field == 'status' && $data[$field] === NULL) {
             $data[$field] = 0;
         }
     }
     return $data;
 }
function initLang()
{
    $CI =& get_instance();
    $CI->lang->is_loaded = array();
    $CI->lang->language = array();
    $languages = array('es' => 'spanish', 'pt-br' => 'portuguese-br', 'en' => 'english', 'zh-cn' => 'zh-CN');
    $langId = $CI->session->userdata('langId');
    if ($langId === false) {
        $CI->load->library('user_agent');
        foreach ($languages as $key => $value) {
            // Trato de setear el idioma del browser
            if ($CI->agent->accept_lang($key)) {
                $langId = $key;
                break;
            }
        }
        if ($langId === false) {
            $langId = config_item('langId');
        }
    }
    if (!in_array($langId, array_keys($languages))) {
        $langId = config_item('langId');
    }
    $langName = element($langId, $languages, config_item('langId'));
    $CI->config->set_item('language', $langName);
    $CI->config->set_item('langId', $langId);
    $CI->session->set_userdata('langId', $langId);
    $CI->lang->load('default', $langName);
    $CI->lang->load(config_item('siteId'), $langName);
}
 public function __construct()
 {
     parent::__construct();
     $this->load->model('visual_themes')->library('template');
     // Determine the current visual theme.
     if ($this->input->get('theme') != '' && $this->input->method() == 'get' && !$this->input->is_ajax_request()) {
         $theme = (string) $this->input->get('theme');
         $this->visual_themes->set_current($theme);
         parse_str(parse_url(CURRENT_URL, PHP_URL_QUERY), $query);
         unset($query['theme']);
         redirect(http_build_url(current_url(), array('query' => http_build_query($query))));
     }
     $this->template->set_theme($this->visual_themes->get_current());
     $default_title = config_item('default_title');
     $default_description = config_item('default_description');
     $default_keywords = config_item('default_keywords');
     if ($default_title != '') {
         $this->template->title($default_title);
     }
     if ($default_description != '') {
         $this->template->set_metadata('description', $default_description);
     }
     if ($default_keywords != '') {
         $this->template->set_metadata('keywords', $default_keywords);
     }
     $this->template->set_breadcrumb('<i class="fa fa-home"></i> ' . $this->lang->line('ui_home'), site_url());
 }
Example #20
0
 /**
  * Database Loader
  *
  * @access    public
  * @param    string    the DB credentials
  * @param    bool    whether to return the DB object
  * @param    bool    whether to enable active record (this allows us to override the config setting)
  * @return    object
  */
 function database($params = '', $return = FALSE, $active_record = NULL)
 {
     /* if ( ! class_exists('CI_DB_active_record'))
             {
                 @include(APPPATH.'libraries/My_DB_active_rec'.EXT);
             }
             // call the parent method to retain the CI functionality
             parent::database($params, $return, $active_record);
     */
     // Do we even need to load the database class?
     if (class_exists('CI_DB') and $return == FALSE and $active_record == FALSE) {
         return FALSE;
     }
     require_once BASEPATH . 'database/DB' . EXT;
     // Load the DB class
     $db =& DB($params, $active_record);
     $my_driver = config_item('subclass_prefix') . 'DB_' . $db->dbdriver . '_driver';
     $my_driver_file = APPPATH . 'libraries/' . $my_driver . EXT;
     if (file_exists($my_driver_file)) {
         require_once $my_driver_file;
         $db = new $my_driver(get_object_vars($db));
     }
     if ($return === TRUE) {
         return $db;
     }
     // Grab the super object
     $CI =& get_instance();
     // Initialize the db variable.  Needed to prevent
     // reference errors with some configurations
     $CI->db = '';
     $CI->db = $db;
     // Assign the DB object to any existing models
     $this->_ci_assign_to_models();
 }
Example #21
0
 public function __construct()
 {
     parent::__construct();
     // Load classes
     $this->load->model('copythis/copythis_model', 'copythis');
     $this->lang->load('copythis', config_item('selected_lang'));
 }
Example #22
0
 /**
  * The key creator is only available if there is no current encryption key.
  * If for some reason you'd like to use this controller and you already
  * have an encryption key set in config/config, comment out lines 27 and 28.
  */
 public function __construct()
 {
     parent::__construct();
     if (!empty(config_item('encryption_key'))) {
         show_404();
     }
 }
Example #23
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('Admin_model');
     //每页条数
     $this->page_size = config_item('page_size');
 }
Example #24
0
 /**
  * Start admin page
  */
 public function index()
 {
     // Set view data
     $this->data['pageTitle'] = lang('dashboard');
     // Load the view
     $this->load->view('themes/' . config_item('admin_theme') . '/index', $this->data);
 }
 private function _set_routing()
 {
     if (common::config_item('enable_query_strings') === TRUE and isset($_GET[config_item('controller_trigger')])) {
         $this->query_string = TRUE;
         $this->set_directory(trim($this->uri->_filter_uri($_GET[config_item('directory_trigger')])));
         $this->set_class(trim($this->uri->_filter_uri($_GET[config_item('controller_trigger')])));
         if (isset($_GET[config_item('function_trigger')])) {
             $this->set_method(trim($this->uri->_filter_uri($_GET[config_item('function_trigger')])));
         }
         return;
     }
     $this->default_controller = (!isset($this->routes['default_controller']) or $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);
     $this->uri->_fetch_uri_string();
     if ($this->uri->uri_string == '') {
         if ($this->default_controller === FALSE) {
             throw new Exception("Unable to determine what should be displayed. A default route has not been specified in the routing file.");
         }
         $segments = $this->_validate_request(explode('/', $this->default_controller));
         $this->set_class($segments[1]);
         $this->set_method($this->routes['index_method']);
         // index
         $this->uri->rsegments = $segments;
         $this->uri->_reindex_segments();
         //log_message('debug', "No URI present. Default controller set.");
         return;
     }
     unset($this->routes['default_controller']);
     $this->uri->_remove_url_suffix();
     $this->uri->_explode_segments();
     $this->_parse_routes();
     $this->uri->_reindex_segments();
 }
Example #26
0
 function listing()
 {
     if (!$this->safety->allowByControllerName(__METHOD__)) {
         return errorForbidden();
     }
     $page = (int) $this->input->get('page');
     if ($page == 0) {
         $page = 1;
     }
     $statusId = $this->input->get('statusId');
     if ($statusId === false) {
         $statusId = '';
     }
     $tag = null;
     $tagId = $this->input->get('tagId');
     if ($tagId != null) {
         $tag = $this->Tags_Model->get($tagId);
     }
     $user = null;
     $userId = $this->input->get('userId');
     if ($userId != null) {
         $user = $this->Users_Model->get($userId);
     }
     $feedSuggest = $this->input->get('feedSuggest') == 'on';
     $filters = array('search' => $this->input->get('search'), 'statusId' => $statusId, 'countryId' => $this->input->get('countryId'), 'langId' => $this->input->get('langId'), 'tagId' => $tagId, 'userId' => $userId, 'feedSuggest' => $feedSuggest);
     $query = $this->Feeds_Model->selectToList($page, config_item('pageSize'), $filters, array(array('orderBy' => $this->input->get('orderBy'), 'orderDir' => $this->input->get('orderDir'))));
     $this->load->view('pageHtml', array('view' => 'includes/crList', 'meta' => array('title' => lang('Edit feeds')), 'list' => array('showId' => true, 'urlList' => strtolower(__CLASS__) . '/listing', 'urlEdit' => strtolower(__CLASS__) . '/edit/%s', 'urlAdd' => strtolower(__CLASS__) . '/add', 'columns' => array('feedName' => lang('Name'), 'feedDescription' => lang('Description'), 'statusName' => lang('Status'), 'countryName' => lang('Country'), 'langName' => lang('Language'), 'feedUrl' => lang('Url'), 'feedLink' => lang('Link'), 'feedLastEntryDate' => array('class' => 'datetime', 'value' => lang('Last entry')), 'feedLastScan' => array('class' => 'datetime', 'value' => lang('Last update')), 'feedCountUsers' => array('class' => 'numeric', 'value' => lang('Users')), 'feedCountEntries' => array('class' => 'numeric', 'value' => lang('Entries'))), 'foundRows' => $query['foundRows'], 'data' => $query['data'], 'filters' => array('statusId' => array('type' => 'dropdown', 'label' => lang('Status'), 'value' => $statusId, 'source' => $this->Status_Model->selectToDropdown(), 'appendNullOption' => true), 'countryId' => array('type' => 'dropdown', 'label' => lang('Country'), 'value' => $this->input->get('countryId'), 'source' => $this->Countries_Model->selectToDropdown(), 'appendNullOption' => true), 'langId' => array('type' => 'dropdown', 'label' => lang('Language'), 'value' => $this->input->get('langId'), 'source' => $this->Languages_Model->selectToDropdown(), 'appendNullOption' => true), 'tagId' => array('type' => 'typeahead', 'label' => 'Tags', 'source' => base_url('search/tags?onlyWithFeeds=true'), 'value' => array('id' => element('tagId', $tag), 'text' => element('tagName', $tag)), 'multiple' => false, 'placeholder' => 'tags'), 'userId' => array('type' => 'typeahead', 'label' => lang('User'), 'source' => base_url('search/users/'), 'value' => array('id' => element('userId', $user), 'text' => element('userFirstName', $user) . ' ' . element('userLastName', $user)), 'multiple' => false, 'placeholder' => lang('User')), 'feedSuggest' => array('type' => 'checkbox', 'label' => lang('Only feed suggest'), 'checked' => $feedSuggest)), 'sort' => array('feedId' => '#', 'feedName' => lang('Name'), 'feedLastEntryDate' => lang('Last entry'), 'feedLastScan' => lang('Last update'), 'feedCountUsers' => lang('Count users'), 'feedCountEntries' => lang('Count entries')))));
 }
 /**
  * Class constructor - setup paging and keyboard shortcuts as well as
  * load various libraries
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->load->library('template');
     $this->load->library('assets');
     $this->load->library('ui/contexts');
     // Pagination config
     $this->pager = array('full_tag_open' => '<div class="pagination pagination-right"><ul>', 'full_tag_close' => '</ul></div>', 'next_link' => '&rarr;', 'prev_link' => '&larr;', 'next_tag_open' => '<li>', 'next_tag_close' => '</li>', 'prev_tag_open' => '<li>', 'prev_tag_close' => '</li>', 'first_tag_open' => '<li>', 'first_tag_close' => '</li>', 'last_tag_open' => '<li>', 'last_tag_close' => '</li>', 'cur_tag_open' => '<li class="active"><a href="#">', 'cur_tag_close' => '</a></li>', 'num_tag_open' => '<li>', 'num_tag_close' => '</li>');
     $this->limit = $this->settings_lib->item('site.list_limit');
     // load the keyboard shortcut keys
     $shortcut_data = array('shortcuts' => config_item('ui.current_shortcuts'), 'shortcut_keys' => $this->settings_lib->find_all_by('module', 'core.ui'));
     Template::set('shortcut_data', $shortcut_data);
     // Profiler Bar?
     if (ENVIRONMENT == 'development') {
         if ($this->settings_lib->item('site.show_profiler') and has_permission('Bonfire.Profiler.View')) {
             // Profiler bar?
             if (!$this->input->is_cli_request() and !$this->input->is_ajax_request()) {
                 $this->load->library('Console');
                 $this->output->enable_profiler(TRUE);
             }
         }
     }
     // Basic setup
     Template::set_theme($this->config->item('template.admin_theme'), 'junk');
 }
Example #28
0
 function index()
 {
     $per_page = (int) $this->input->get_post('per_page');
     $cupage = config_item('site_page_num');
     //每页显示个数
     $return_arr = array('total_rows' => true);
     if ($this->user_info->key == 'root') {
         $where['status >='] = -1;
     } else {
         $where['status >='] = 0;
     }
     $loginname = htmlspecialchars($this->input->get_post("loginname"));
     $like = array();
     $string = '';
     if ($loginname = trim($loginname)) {
         $like['loginname'] = $loginname;
         $string .= "loginname=" . $loginname;
     }
     $options = array('page' => $cupage, 'per_page' => $per_page, 'where' => $where, 'like' => $like, 'order' => "logintime desc,lid desc");
     $lc_list = $this->userlog_model->getAll($options, $return_arr);
     //查询所有信息
     $url = admin_base_url('user/userlog?') . $string;
     $page = $this->sharepage->showPage($url, $return_arr['total_rows'], $cupage);
     $data = array('lc_list' => $lc_list, 'page' => $page, 'loginname' => $loginname, 'totals' => $return_arr['total_rows']);
     $this->_template('admin/user/userlog', $data);
 }
Example #29
0
 function form_open($action = '', $attributes = array(), $hidden = array())
 {
     $CI =& get_instance();
     // If no action is provided then set to the current url
     if (!$action) {
         $action = current_url($action);
     } elseif (strpos($action, '://') === FALSE) {
         $action = if_secure_site_url($action);
     }
     $attributes = _attributes_to_string($attributes);
     if (stripos($attributes, 'method=') === FALSE) {
         $attributes .= ' method="post"';
     }
     if (stripos($attributes, 'accept-charset=') === FALSE) {
         $attributes .= ' accept-charset="' . strtolower(config_item('charset')) . '"';
     }
     $form = '<form action="' . $action . '"' . $attributes . ">\n";
     // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
     if ($CI->config->item('csrf_protection') === TRUE && strpos($action, if_secure_base_url()) !== FALSE && !stripos($form, 'method="get"')) {
         $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
     }
     // Add MY CSRF token if MY CSRF library is loaded
     if ($CI->load->is_loaded('tokens') && strpos($action, if_secure_base_url()) !== FALSE && !stripos($form, 'method="get"')) {
         $hidden[$CI->tokens->name] = $CI->tokens->token();
     }
     if (is_array($hidden)) {
         foreach ($hidden as $name => $value) {
             $form .= '<input type="hidden" name="' . $name . '" value="' . html_escape($value) . '" style="display:none;" />' . "\n";
         }
     }
     return $form;
 }
Example #30
0
 function saveEntitiesSearch($entityTypeId = null, $onlyUpdates = false)
 {
     $onlyUpdates = $onlyUpdates == 'true';
     $deleteEntitySearch = $onlyUpdates != true;
     if ($entityTypeId == 'null') {
         $entityTypeId = null;
     }
     if ($entityTypeId == null || $entityTypeId == config_item('entityTypeUser')) {
         $this->load->model('Users_Model');
         $this->Users_Model->saveUsersSearch($deleteEntitySearch, $onlyUpdates);
     }
     if ($entityTypeId == null || $entityTypeId == config_item('entityTypeTag')) {
         $this->load->model('Tags_Model');
         $this->Tags_Model->saveTagsSearch($deleteEntitySearch, $onlyUpdates);
     }
     if ($entityTypeId == null || $entityTypeId == config_item('entityTypeFeed')) {
         $this->load->model('Feeds_Model');
         $this->Feeds_Model->saveFeedsSearch($deleteEntitySearch, $onlyUpdates);
     }
     if ($entityTypeId == null || $entityTypeId == config_item('entityTypeEntry')) {
         $this->load->model('Entries_Model');
         $this->Entries_Model->saveEntriesSearch($deleteEntitySearch, $onlyUpdates);
     }
     return loadViewAjax(true, array('msg' => lang('Data updated successfully')));
 }