Get the CI singleton
public static get_instance ( ) : object | ||
return | object |
function on_before_validate($values) { if ($values['username'] == "" || $values['username'] == NULL) { $this->password_in_clear = $password = $this->random_password(); $ci = CI_Controller::get_instance(); $ci->load->helper('url'); $ci->load->library('session'); $ci->load->library('extemplate'); $ci->load->library("email"); $ci->load->config('tank_auth', TRUE); $hasher = new PasswordHash($ci->config->item('phpass_hash_strength', 'tank_auth'), $ci->config->item('phpass_hash_portable', 'tank_auth')); $hashed_password = $hasher->HashPassword($password); $values["password"] = $hashed_password; $values["created"] = datetime_now(); $values['username'] = trim($values['email']); $values["last_ip"] = $_SERVER['REMOTE_ADDR']; $data = $values; $data['site_name'] = 'http://www.ressphere.com'; $data['password'] = $this->password_in_clear; if ($ci->config->item('email_account_details')) { base::_begin_send_email('Welcome to', $data['email'], $data, $ci); } } return parent::on_before_validate($values); }
function get_admin_field($field = 'id', $id = FALSE) { $uid = $id && is_numeric($id) ? $id : $_SESSION['auth_admin']; $CI = CI_Controller::get_instance(); $CI->load->model('admin_model'); return $CI->admin_model->get_field($field, $uid); }
/** * Render banner into template * @access public * @param int $id is id entity (brand, category, product, page) .... for main id = 0 * @param string $group * @return boolean * @author L.Andriy <*****@*****.**> * @copyright (c) 2013, ImageCMS */ public function render($id = 0, $group = 0) { if ($this->no_install === false) { return false; } $type = $this->core->core_data['data_type']; $lang = $this->get_main_lang('identif'); $painting = $type . '_' . (int) $id; $hash = 'baners' . $type . $id . \CI_Controller::get_instance()->config->item('template'); if ($cache = Cache_html::get_html($hash)) { \CMSFactory\assetManager::create()->registerScript('jquery.cycle.all.min'); echo $cache; } else { $banners = $this->banner_model->get_all_banner($lang, $group); foreach ($banners as $banner) { $data = unserialize($banner['where_show']); if ((in_array($painting, $data) || in_array($type . '_0', $data)) && $banner['active'] && (time() < $banner['active_to'] or $banner['active_to'] == '-1')) { $ban[] = $banner; } } if (count($ban) > 0) { $tpl = $this->banner_model->get_settings_tpl() ? $type . '_slider' : 'slider'; ob_start(); \CMSFactory\assetManager::create()->registerStyle('style')->registerScript('jquery.cycle.all.min')->setData(array('banners' => $ban))->render($tpl, TRUE); $baners_view = ob_get_clean(); Cache_html::set_html($baners_view, $hash); echo $baners_view; } else { return FALSE; } } }
public function __construct() { if (defined('FCPATH')) { //Get CI instance $this->ci = CI_Controller::get_instance(); //Load database configuration from CodeIgniter $this->db = $this->ci->db; //Database connection information $connectionOptions = array('user' => $this->db->username, 'password' => $this->db->password, 'host' => $this->db->hostname, 'dbname' => $this->db->database); } elseif (ENVIRONMENT === 'development') { include_once str_replace("/", DIRECTORY_SEPARATOR, APPPATH) . 'config' . DIRECTORY_SEPARATOR . 'development' . DIRECTORY_SEPARATOR . 'database.php'; $connectionOptions = array('user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database']); } $connectionOptions['driver'] = 'pdo_mysql'; $connectionOptions['charset'] = 'utf8'; $connectionOptions['driverOptions'] = array(1002 => 'SET NAMES utf8'); $config = new Configuration(); //Set up caches $cache = new ArrayCache(); $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); //Set up Annotation $driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/Entities')); $config->setMetadataDriverImpl($driverImpl); //Proxy configuration $config->setProxyDir(APPPATH . '/models/proxies'); $config->setProxyNamespace('Proxies'); $config->setAutoGenerateProxyClasses(TRUE); // Create EntityManager $this->em = EntityManager::create($connectionOptions, $config); //Fix the problem: "unknown database type enum requested" $platform = $this->em->getConnection()->getDatabasePlatform(); $platform->registerDoctrineTypeMapping('enum', 'string'); }
/** * */ function __construct() { date_default_timezone_set('Asia/Calcutta'); $ci = CI_Controller::get_instance(); $ci->load->Model('Email_settings/Mdl_email_settings'); //load email settings model $smtp = $ci->Mdl_email_settings->toArray(); //get object valeus in array $config = array(); $config['protocol'] = 'smtp'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['smtp_host'] = $smtp['smtp_host']; $config['smtp_pass'] = $smtp['smtp_pass']; // email's password - set smtp values $config['smtp_user'] = $smtp['smtp_user']; $config['smtp_port'] = $smtp['smtp_port']; //gmail port 465 (ssl) and 587 (TSL) required $config['smtp_timeout'] = 300; //smtp timeout in seconds $config['wordwrap'] = TRUE; $config['wrapchars'] = 76; $config['mailtype'] = 'html'; $config['charset'] = 'utf-8'; $config['validate'] = TRUE; $config['priority'] = 3; $config['crif'] = "\r\n"; $config['newline'] = "\r\n"; $config['bcc_batch_mode'] = TRUE; $config['bcc_batch_size'] = 200; parent::__construct($config); }
static function load($model) { if (!isset(self::$models[$model])) { CI_Controller::get_instance()->load->model($model); self::$models[$model] = CI_Controller::get_instance()->{$model}; } return self::$models[$model]; }
/** * * @param string $filePath file name or path to file * @param array $data data for template * @return html */ public function display($filePath, array $data = array()) { $filePath = strpos($filePath, '.tpl') === FALSE ? $filePath .= '.tpl' : $filePath; $fullPath = $this->tComponentPath . '/assets/' . $filePath; $fullPath = str_replace(array('/', '//', '\\', '\\\\'), DIRECTORY_SEPARATOR, $fullPath); if (count($data) > 0) { \CI_Controller::get_instance()->template->add_array($data); } \CI_Controller::get_instance()->template->display('file:' . $fullPath); }
public static function get_CI() { if (Yupii::$CI == NULL) { $f = CI_Controller::get_instance(); if ($f == NULL) { $f = new CI_Controller(); } Yupii::$CI = $f->get_instance(); } return Yupii::$CI; }
public function edit_record($table, $rules = '') { $ci = CI_Controller::get_instance(); $rules = str_replace('%7C', '|', $rules); $this->form_validation->set_rules('value', 'given', $rules); if ($_SESSION['role'] == 1) { if ($this->form_validation->run() == FALSE) { $this->output->set_content_type('application/json'); echo strip_tags(validation_errors()); } else { $pk = $this->input->post('pk'); $name = $this->input->post('name'); $value = $this->input->post('value'); $this->helper_model->edit_global_record($table, $pk, $name, $value); } } else { /*---------------------------------------* *In this section we will see if * we have to give some permissions to * un authorized members or not... *----------------------------------------- */ switch ($table) { case "cities": if ($this->form_validation->run() == FALSE) { $this->output->set_content_type('application/json'); echo strip_tags(validation_errors()); } else { $pk = $this->input->post('pk'); $name = $this->input->post('name'); $value = $this->input->post('value'); $this->helper_model->edit_global_record($table, $pk, $name, $value); } break; case "products": if ($this->form_validation->run() == FALSE) { $this->output->set_content_type('application/json'); echo strip_tags(validation_errors()); } else { $pk = $this->input->post('pk'); $name = $this->input->post('name'); $value = $this->input->post('value'); $this->helper_model->edit_global_record($table, $pk, $name, $value); } break; default: $this->output->set_content_type('application/json'); echo "No Accessibility! Please contact your system administrator"; break; } } }
public function __construct() { /* assign the application instance */ self::$APP = CI_Controller::get_instance(); global $LANG, $CFG; /* re-assign language and config for modules */ if (!is_a($LANG, 'MX_Lang')) { $LANG = new MX_Lang(); } if (!is_a($CFG, 'MX_Config')) { $CFG = new MX_Config(); } }
public function __construct() { /* assign the application instance */ self::$APP = CI_Controller::get_instance(); global $LANG, $CFG; /* re-assign language and config for modules */ if (!$LANG instanceof HMVC_Lang) { $LANG = new HMVC_Lang(); } if (!$CFG instanceof HMVC_Config) { $CFG = new HMVC_Config(); } }
/** * Returns an instance of CodeIgniter. * * @return \CI_Controller */ public function getCodeIgniter() { $this->setPathConstants(); $this->prepareEnvironment(); $this->defineConstants(); $this->loadCommonClasses(); $this->setCharacterSets(); $this->setConfigurations(); $this->loadCoreClasses(); // Loads the get_instance.php for loading libraries require 'get_instance.php'; $ci = \CI_Controller::get_instance(); return empty($ci) ? new \CI_Controller() : $ci; }
public function __construct() { self::$APP = CI_Controller::get_instance(); /* assign the core loader */ self::$APP->load = new MX_Loader; /* re-assign language and config for modules */ if ( ! is_a(self::$APP->lang, 'MX_Lang')) self::$APP->lang = new MX_Lang; if ( ! is_a(self::$APP->config, 'MX_Config')) self::$APP->config = new MX_Config; /* autoload module items */ self::$APP->load->_autoloader(array()); }
public function __construct() { /* assign the application instance */ self::$APP = CI_Controller::get_instance(); global $LANG, $CFG; /* re-assign language and config for modules */ // Modified by Ivan Tcholakov, 28-SEP-2012. //if ( ! is_a($LANG, 'MX_Lang')) $LANG = new MX_Lang; //if ( ! is_a($CFG, 'MX_Config')) $CFG = new MX_Config; if (@(!is_a($LANG, 'MX_Lang'))) { $LANG = new MX_Lang(); } if (@(!is_a($CFG, 'MX_Config'))) { $CFG = new MX_Config(); } // }
public function __construct() { /* assign the application instance */ self::$APP = CI_Controller::get_instance(); global $LANG, $CFG; /* re-assign language and config for modules */ if (!is_a($LANG, 'MX_Lang')) { $LANG = new MX_Lang(); } if (!is_a($CFG, 'MX_Config')) { $CFG = new MX_Config(); } /* assign the core loader */ self::$APP->load = new MX_Loader(); /* autoload module items */ self::$APP->load->_autoloader(array()); }
public function __construct() { /* assign the application instance */ self::$APP = CI_Controller::get_instance(); // Removed by Deepak Patil <*****@*****.**>, 19-NOV-2013. /* global $LANG, $CFG; // Re-assign language and config for modules. // Modified by Deepak Patil <*****@*****.**>, 21-OCT-2013. //if ( ! is_a($LANG, 'MX_Lang')) $LANG = new MX_Lang; //if ( ! is_a($CFG, 'MX_Config')) $CFG = new MX_Config; if ( @ ! is_a($LANG, 'MX_Lang')) $LANG = new MX_Lang; if ( @ ! is_a($CFG, 'Core_Config')) $CFG = new Core_Config; // */ }
public static function get_html($file) { self::$path = PUBPATH . 'system/cache/templates_c/HTML/'; if (!\CI_Controller::get_instance()->config->item('tpl_force_compile')) { $file = $file . MY_Controller::getCurrentLocale(); $file = self::$path . md5($file) . '.html'; if (file_exists($file)) { if (time() - filemtime($file) > \CI_Controller::get_instance()->config->item('tpl_compiled_ttl')) { @unlink($file); return false; } else { return file_get_contents($file); } } else { return false; } } else { return false; } }
function include_editable_libs() { $libs = '<link href="' . css() . "editable.css" . '" rel="stylesheet">'; $libs .= '<script src="' . js() . "bootstrap-editable.min.js" . '"></script>'; if ($_SESSION['role'] == 1) { //echo $libs; } else { /*---------------------------------------* *In this section we will see if * we have to give some permissions to * un authorized members or not... *----------------------------------------- */ $ci = CI_Controller::get_instance(); if ($ci->router->fetch_class() == 'routes') { //echo $libs; } } }
/** * Return formated path for css * @return string * @access private * @copyright ImageCMS (c) 2013, Kaero <*****@*****.**> */ private function buildStylePath($fileName) { if (!$this->template) { $this->template = \CI_Controller::get_instance()->config->item('template'); } $moduleName = $this->getTrace(); $path = sprintf('templates/%s/%s/css/%s.css', $this->template, $moduleName, $fileName); if (file_exists($path)) { $url = $path; } else { $url = $this->getModuleFilePath(array(sprintf('%s/assets/css/%s.css', $moduleName, $fileName), sprintf('%s/assets/css/%s.css', \CI::$APP->uri->segment(4), $fileName)), false); } return str_replace(MAINSITE, '', $url); }
function __construct() { parent::__construct(CI_Controller::get_instance()); $this->is_logged_in(); }
/** * Load a language file * * @access public * @param mixed the name of the language file to be loaded. Can be an array * @param string the language (english, etc.) * @return mixed */ public function load($module = 'main') { $this->_init(); if (strstr(uri_string(), 'admin')) { $lang = $this->getAdminLocale(); if (!$module) { $module = 'admin'; } } else { if (strstr($_SERVER['REQUEST_URI'], 'install')) { $lang = $this->ci->session->userdata('language'); } else { $languageFront = $this->getFrontLangCode(MY_Controller::getCurrentLocale()); $lang = $languageFront[1]; } } // var_dumps_exit($lang); // $lang = 'de_DE'; // $module = 'translator'; if ($module == 'main') { $this->addDomain(correctUrl('./application/language/main/' . $lang), getMoFileName('main'), $lang); $template_name = \CI_Controller::get_instance()->config->item('template'); $this->addDomain('templates/' . $template_name . '/language/' . $template_name . '/', getMoFileName($template_name), $lang); } else { if ($module == 'admin') { $this->addDomain(correctUrl('./application/language/main/' . $lang), getMoFileName('main'), $lang); } // if (MAINSITE && $module == 'admin') { // $this->addDomain(MAINSITE . '/application/modules/' . $module . '/language', getMoFileName($module), $lang); // } else { // var_dumps_exit(getMoFileName($module)); // var_dumps_exit(correctUrl('./application/modules/' . $module . '/language/' . $lang)); $this->addDomain(correctUrl('./application/modules/' . $module . '/language/' . $lang), getMoFileName($module), $lang); // } } }
/** * Reference to the CI_Controller method. * * Returns current CI instance object * * @return object * * modified by ci-phpunit-test */ function &get_instance() { if (!CIPHPUnitTest::wiredesignzHmvcInstalled()) { return CI_Controller::get_instance(); } else { return CI::$APP; } }
public function __construct() { // Load the global object self::$CI =& CI_Controller::get_instance(); }
function isAllow($ctrl, $ssctrl = "*") { return CI_Controller::get_instance()->acl->isAllow($ctrl, $ssctrl); }
* This file is part of Jorani. * * Jorani is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Jorani is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jorani. If not, see <http://www.gnu.org/licenses/>. */ CI_Controller::get_instance()->load->helper('language'); $this->lang->load('users', $language); $this->lang->load('datatable', $language); ?> <table cellpadding="0" cellspacing="0" border="0" class="display" id="employees" width="100%"> <thead> <tr> <th><?php echo lang('users_employees_thead_id'); ?> </th> <th><?php echo lang('users_employees_thead_firstname'); ?> </th> <th><?php
/** * Utility function (internal use only) : über fast CI instance getter * @method CI * @return CI_Controller */ function CI() { static $CI; isset($CI) or $CI = CI_Controller::get_instance(); return $CI; }
public static function sess() { return CI_Controller::get_instance()->session; }
<?php CI_Controller::get_instance()->load->view(strtolower(Crudderconfig::DEFAULT_PAGES_SET) . '/' . 'templates/avoid_cache'); ?> <!DOCTYPE html> <html> <head> <title>Crudder: CRUD library for CodeIgniter</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Crudder-specific; this avoids bootstrapping the main app application by default if the constant PAGES_SET is not set for BOOTSTRAPPED --> <?php if (defined("PAGES_SET") && PAGES_SET == "BOOTSTRAPPED" || !defined("PAGES_SET")) { ?> <!-- Bootstrap --> <link href="/css/bootstrap.min.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> <!-- plugins-specific --> <!-- (none) --> <?php
/** * Reference to the CI_Controller method. * * Returns current CI instance object * * @return object */ function &get_instance() { return CI_Controller::get_instance(); }
/** * Return formated path for css * @return string * @access private * @copyright ImageCMS (c) 2013, Kaero <*****@*****.**> */ private function buildStylePath($tpl) { if (!$this->template) { $this->template = \CI_Controller::get_instance()->config->item('template'); } if (file_exists('templates/' . $this->template . '/' . $this->getTrace() . '/css/' . $tpl . '.css')) { $url = sprintf('templates/%s/%s/css/%s.css', $this->template, $this->getTrace(), $tpl); } elseif (file_exists(sprintf('%smodules/%s/assets/css/%s.css', APPPATH, $this->getTrace(), $tpl))) { $url = sprintf('%smodules/%s/assets/css/%s.css', APPPATH, $this->getTrace(), $tpl); } elseif (file_exists(sprintf('%smodules/%s/assets/css/%s.css', APPPATH, \CI::$APP->uri->segment(4), $tpl))) { $url = sprintf('%smodules/%s/assets/css/%s.css', APPPATH, \CI::$APP->uri->segment(4), $tpl); } return str_replace(MAINSITE, '', $url); }