Exemple #1
0
 function __construct($time = 0, $tz = '')
 {
     //static $initCount;
     //$initCount++;
     //echo "<h2>init $initCount</h2>";
     if (strlen($time) == 0) {
         $ts = 0;
     }
     if (!$time) {
         $time = time();
     }
     if (is_array($time)) {
         $time = $time[0];
     }
     parent::__construct();
     $this->setTimestamp($time);
     $CI =& ci_get_instance();
     if (!$tz) {
         $tz = $CI->app_conf->get('timezone');
     }
     if ($tz) {
         $this->setTimezone($tz);
     }
     $this->weekStartsOn = $CI->app_conf->get('week_starts');
     $time_format = $CI->app_conf->get('time_format');
     if ($time_format) {
         $this->timeFormat = $time_format;
     }
     $date_format = $CI->app_conf->get('date_format');
     if ($date_format) {
         $this->dateFormat = $date_format;
     }
 }
Exemple #2
0
 /**
  * Constructor
  *
  * Grabs the CI super object instance so we can access it.
  *
  */
 function __construct()
 {
     // Assign the main database object to $this->db
     $CI =& ci_get_instance();
     $this->db =& $CI->db;
     log_message('debug', "Database Forge Class Initialized");
 }
Exemple #3
0
 /**
  * Constructor
  *
  * Grabs the CI super object instance so we can access it.
  *
  */
 function __construct(&$db)
 {
     // Assign the main CI object to $this->CI
     // and load the file helper since we use it a lot
     $this->CI =& ci_get_instance();
     $this->db =& $db;
     $this->CI->load->helper('file');
 }
Exemple #4
0
 function __construct()
 {
     $this->conf = array('model' => 'User_model', 'path' => 'admin/users', 'entity' => 'user', 'export' => 'users');
     parent::__construct(User_model::LEVEL_ADMIN);
     $CI =& ci_get_instance();
     if ($CI->app_conf->get('login_with') != 'username') {
         unset($this->{$this->model}->validation['username']);
     }
 }
 function get_cookie($index = '', $xss_clean = FALSE)
 {
     $CI =& ci_get_instance();
     $prefix = '';
     if (!isset($_COOKIE[$index]) && config_item('cookie_prefix') != '') {
         $prefix = config_item('cookie_prefix');
     }
     return $CI->input->cookie($prefix . $index, $xss_clean);
 }
Exemple #6
0
 function transport_email($msg, $u)
 {
     $CI =& ci_get_instance();
     $subj = $msg->subject;
     $body = join("\n", $msg->body);
     $CI->hc_email->setSubject($subj);
     $CI->hc_email->setBody($body);
     $CI->hc_email->sendToOne($u->email);
 }
 function lang($line, $id = '')
 {
     $CI =& ci_get_instance();
     $line = $CI->lang->line($line);
     if ($id != '') {
         $line = '<label for="' . $id . '">' . $line . "</label>";
     }
     return $line;
 }
Exemple #8
0
 public function get_modules()
 {
     $CI =& ci_get_instance();
     $modules = $CI->config->get_modules();
     if (!is_array($modules)) {
         $modules = array();
     }
     $modules = array_merge(array('ci_core'), $modules);
     return $modules;
 }
Exemple #9
0
 public function init()
 {
     $CI =& ci_get_instance();
     $this->db = $CI->db;
     $this->config = $CI->config;
     if ($this->db->table_exists('conf')) {
         $this->with_db = TRUE;
         $this->saved = $this->_get_all();
     }
     $this->config->load('settings', TRUE);
     $this->config->load('conf', TRUE);
 }
Exemple #10
0
 /**
  * Constructor
  *
  * Loads the calendar language file and sets the default time reference
  */
 public function __construct($config = array())
 {
     $this->CI =& ci_get_instance();
     if (!in_array('calendar_lang.php', $this->CI->lang->is_loaded, TRUE)) {
         $this->CI->lang->load('calendar');
     }
     $this->local_time = time();
     if (count($config) > 0) {
         $this->initialize($config);
     }
     log_message('debug', "Calendar Class Initialized");
 }
 /**
  * Constructor
  */
 public function __construct($rules = array())
 {
     $this->CI =& ci_get_instance();
     // Validation rules can be stored in a config file.
     $this->_config_rules = $rules;
     // Automatically load the form helper
     $this->CI->load->helper('form');
     // Set the character encoding in MB.
     if (function_exists('mb_internal_encoding')) {
         mb_internal_encoding($this->CI->config->item('charset'));
     }
     log_message('debug', "Form Validation Class Initialized");
 }
Exemple #12
0
 function trigger($event, $payload)
 {
     $CI =& ci_get_instance();
     $check_events = array();
     $check_events[] = $event;
     /* also check events for all objects */
     list($class, $short_event) = explode('.', $event);
     if ($class != '*') {
         $generic_event = '*.' . $short_event;
         $check_events[] = $generic_event;
     }
     foreach ($check_events as $this_event) {
         if (!isset($this->events[$this_event])) {
             continue;
         }
         $args = func_get_args();
         array_shift($args);
         reset($this->events[$this_event]);
         foreach ($this->events[$this_event] as $call) {
             if (is_callable($call)) {
                 call_user_func_array($call, $args);
                 //					$call( $args );
             } else {
                 if ($CI->load->module_file($call['file'])) {
                     if (!class_exists($call['class'])) {
                         // if class doesn't exist check that the function is callable
                         // could be just a helper function
                         if (is_callable($call['method'])) {
                             if (isset($call['attr'])) {
                                 $args[] = $call['attr'];
                             }
                             call_user_func_array($call['method'], $args);
                         }
                         continue;
                     }
                     $class = new $call['class']();
                     if (!is_callable(array($class, $call['method']))) {
                         unset($class);
                         continue;
                     }
                     if (isset($call['attr'])) {
                         $args[] = $call['attr'];
                     }
                     call_user_func_array(array($class, $call['method']), $args);
                     unset($class);
                 } else {
                 }
             }
         }
     }
 }
Exemple #13
0
 /**
  * Fetch the encryption key
  *
  * Returns it as MD5 in order to have an exact-length 128 bit key.
  * Mcrypt is sensitive to keys that are not the correct length
  *
  * @access	public
  * @param	string
  * @return	string
  */
 function get_key($key = '')
 {
     if ($key == '') {
         if ($this->encryption_key != '') {
             return $this->encryption_key;
         }
         $CI =& ci_get_instance();
         $key = $CI->config->item('encryption_key');
         if ($key == FALSE) {
             show_error('In order to use the encryption class requires that you set an encryption key in your config file.');
         }
     }
     return md5($key);
 }
 function __construct()
 {
     parent::__construct();
     if (defined('NTS_DEVELOPMENT')) {
         if (!($this->input->is_ajax_request() or $this->is_module())) {
             $this->output->enable_profiler(TRUE);
         }
     }
     $this->load->database();
     $ri = HC_Lib::ri();
     if (!$this->is_setup()) {
         $setup_redirect = 'setup';
         if ($ri) {
             $setup_redirect = $ri . '/setup';
         }
         $this->redirect($setup_redirect);
         exit;
     }
     $this->load->library(array('session', 'hc_modules'));
     /* add module models paths for autoloading */
     $extensions = HC_App::extensions();
     $acl = HC_App::acl();
     $look_in_dirs = $this->config->look_in_dirs();
     foreach ($look_in_dirs as $ldir) {
         if (class_exists('Datamapper')) {
             Datamapper::add_model_path($ldir);
         }
         $this->load->add_package_path($ldir);
         $extensions->add_dir($ldir);
         $acl->add_dir($ldir);
     }
     $extensions->init();
     $acl->init();
     /* reload config paths */
     $app_conf = HC_App::app_conf();
     $this->load->library('hc_modules');
     /* events and notifiers */
     $this->load->library(array('hc_events', 'hc_email'));
     $this->hc_email->from = $app_conf->get('email_from');
     $this->hc_email->fromName = $app_conf->get('email_from_name');
     // conf
     $this->load->library('hc_auth', NULL, 'auth');
     $user = $this->auth->user();
     $acl->set_user($user);
     $CI =& ci_get_instance();
     $current_url = $CI->config->site_url($CI->uri->uri_string());
     $this->session->set_flashdata('referrer', $current_url);
     $this->layout = new HC_View_Layout();
 }
Exemple #15
0
 function module_dir($module)
 {
     $return = NULL;
     $CI =& ci_get_instance();
     $modules_locations = $CI->config->item('modules_locations');
     reset($modules_locations);
     foreach ($modules_locations as $ml) {
         $mod_dir = $ml . $module;
         if (file_exists($mod_dir)) {
             $return = $mod_dir;
             break;
         }
     }
     return $return;
 }
Exemple #16
0
 public function __construct($config = array())
 {
     $this->CI =& ci_get_instance();
     if (isset($config['query_toggle_count'])) {
         $this->_query_toggle_count = (int) $config['query_toggle_count'];
         unset($config['query_toggle_count']);
     }
     // default all sections to display
     foreach ($this->_available_sections as $section) {
         if (!isset($config[$section])) {
             $this->_compile_[$section] = TRUE;
         }
     }
     $this->set_sections($config);
 }
 function hc_format_price($amount, $calculated_price = '')
 {
     $CI =& ci_get_instance();
     $before_sign = $CI->app_conf->get('currency_sign_before');
     $currency_format = $CI->app_conf->get('currency_format');
     list($dec_point, $thousand_sep) = explode('||', $currency_format);
     $after_sign = $CI->app_conf->get('currency_sign_after');
     $amount = number_format($amount, 2, $dec_point, $thousand_sep);
     $return = $before_sign . $amount . $after_sign;
     if (strlen($calculated_price) && $amount != $calculated_price) {
         $calc_format = $before_sign . number_format($calculated_price, 2, $dec_point, $thousand_sep) . $after_sign;
         $return = $return . ' <span style="text-decoration: line-through;">' . $calc_format . '</span>';
     }
     return $return;
 }
Exemple #18
0
 /**
  * Session Constructor
  *
  * The constructor runs the session routines automatically
  * whenever the class is instantiated.
  */
 public function __construct($params = array())
 {
     log_message('debug', "Session Class Initialized");
     // Set the super object to a local variable for use throughout the class
     $this->CI =& ci_get_instance();
     // Set all the session preferences, which can either be set
     // manually via the $params array above or via the config file
     foreach (array('sess_encrypt_cookie', 'sess_use_database', 'sess_table_name', 'sess_expiration', 'sess_expire_on_close', 'sess_match_ip', 'sess_match_useragent', 'sess_cookie_name', 'cookie_path', 'cookie_domain', 'cookie_secure', 'sess_time_to_update', 'time_reference', 'cookie_prefix', 'encryption_key') as $key) {
         $this->{$key} = isset($params[$key]) ? $params[$key] : $this->CI->config->item($key);
     }
     if ($this->encryption_key == '') {
         show_error('In order to use the Session class you are required to set an encryption key in your config file.');
     }
     // Load the string helper so we can use the strip_slashes() function
     $this->CI->load->helper('string');
     // Do we need encryption? If so, load the encryption class
     if ($this->sess_encrypt_cookie == TRUE) {
         $this->CI->load->library('encrypt');
     }
     // Are we using a database?  If so, load it
     if ($this->sess_use_database === TRUE and $this->sess_table_name != '') {
         $this->CI->load->database();
     }
     // Set the "now" time.  Can either be GMT or server time, based on the
     // config prefs.  We use this to set the "last activity" time
     $this->now = $this->_get_time();
     // Set the session length. If the session expiration is
     // set to zero we'll set the expiration two years from now.
     if ($this->sess_expiration == 0) {
         $this->sess_expiration = 60 * 60 * 24 * 365 * 2;
     }
     // Set the cookie name
     $this->sess_cookie_name = $this->cookie_prefix . $this->sess_cookie_name;
     // Run the Session routine. If a session doesn't exist we'll
     // create a new one.  If it does, we'll update it.
     if (!$this->sess_read()) {
         $this->sess_create();
     } else {
         $this->sess_update();
     }
     // Delete 'old' flashdata (from last request)
     $this->_flashdata_sweep();
     // Mark all new flashdata as old (data will be deleted before next request)
     $this->_flashdata_mark();
     // Delete expired sessions if necessary
     $this->_sess_gc();
     log_message('debug', "Session routines successfully run");
 }
Exemple #19
0
 public function get_staff()
 {
     $CI =& ci_get_instance();
     $working_levels = $CI->app_conf->get('working_levels');
     $this->clear();
     /* get those users who can be assigned to shifts */
     $this->where('active', self::STATUS_ACTIVE);
     if ($working_levels) {
         if (!is_array($working_levels)) {
             $working_levels = array($working_levels);
         }
         $this->where_in('level', $working_levels);
     }
     $return = $this->get()->all;
     return $return;
 }
Exemple #20
0
 public function up()
 {
     if (!$this->db->table_exists('notes')) {
         $this->dbforge->add_field(array('id' => array('type' => 'INT', 'null' => FALSE, 'unsigned' => TRUE, 'auto_increment' => TRUE), 'content' => array('type' => 'TEXT', 'null' => FALSE), 'created' => array('type' => 'INT', 'null' => TRUE), 'author_id' => array('type' => 'INT', 'null' => TRUE)));
         $this->dbforge->add_key('id', TRUE);
         $this->dbforge->create_table('notes');
     }
     /* check if relationships required */
     $CI =& ci_get_instance();
     $modules_conf = $CI->config->item('modules');
     if (isset($modules_conf['notes']['relations']) && is_array($modules_conf['notes']['relations'])) {
         foreach ($modules_conf['notes']['relations'] as $rel) {
             if (!$this->db->field_exists($rel, 'notes')) {
                 $this->dbforge->add_column('notes', array($rel => array('type' => 'INT', 'null' => TRUE)));
             }
         }
     }
 }
Exemple #21
0
 public function attempt($identity, $password, $remember = FALSE)
 {
     $CI =& ci_get_instance();
     $login_with = $CI->app_conf->get('login_with');
     if ($login_with != 'username') {
         $identity_name = 'email';
     } else {
         $identity_name = 'username';
     }
     $where = array($identity_name => $identity);
     $this->auth_model->from_array($where);
     if ($this->auth_model->check_password($password)) {
         $this->login($this->auth_model->id);
         return TRUE;
     } else {
         return FALSE;
     }
 }
 public function log($object, $keep_log = array())
 {
     if (!$keep_log) {
         return;
     }
     $log_changes = array();
     $changes = $object->get_changes();
     reset($changes);
     foreach ($changes as $property_name => $old_value) {
         if (in_array($property_name, $keep_log)) {
             $log_changes[$property_name] = $old_value;
         }
     }
     if (!$log_changes) {
         return;
     }
     $CI =& ci_get_instance();
     $user_id = isset($CI->auth) && $CI->auth ? $CI->auth->check() : -1;
     $defaults = array('user_id' => $user_id, 'action_time' => time(), 'object_class' => $object->my_class(), 'object_id' => $object->id);
     /*
     		if( $log )
     		{
     			foreach( $log as $k => $v )
     				$defaults[$k] = $v;
     		}
     */
     /* JUST CREATED */
     if (array_key_exists('id', $log_changes)) {
         $this->clear();
         $this->from_array($defaults);
         $this->property_name = 'id';
         $this->old_value = NULL;
         $this->save();
     } else {
         foreach ($log_changes as $property_name => $old_value) {
             $this->clear();
             $this->from_array($defaults);
             $this->property_name = $property_name;
             $this->old_value = $old_value;
             $this->save();
         }
     }
     return TRUE;
 }
 /**
  * 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.)
  * @param	bool	return loaded array of translations
  * @param 	bool	add suffix to $langfile
  * @param 	string	alternative path to look for language file
  * @return	mixed
  */
 function load($langfile = '', $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '')
 {
     $langfile = str_replace('.php', '', $langfile);
     if ($add_suffix == TRUE) {
         $langfile = str_replace('_lang.', '', $langfile) . '_lang';
     }
     $langfile .= '.php';
     if (in_array($langfile, $this->is_loaded, TRUE)) {
         return;
     }
     $config =& get_config();
     if ($idiom == '') {
         $deft_lang = !isset($config['language']) ? 'english' : $config['language'];
         $idiom = $deft_lang == '' ? 'english' : $deft_lang;
     }
     // Determine where the language file is and load it
     if ($alt_path != '' && file_exists($alt_path . 'language/' . $idiom . '/' . $langfile)) {
         include $alt_path . 'language/' . $idiom . '/' . $langfile;
     } else {
         $found = FALSE;
         foreach (ci_get_instance()->load->get_package_paths(TRUE) as $package_path) {
             if (file_exists($package_path . 'language/' . $idiom . '/' . $langfile)) {
                 include $package_path . 'language/' . $idiom . '/' . $langfile;
                 $found = TRUE;
                 break;
             }
         }
         if ($found !== TRUE) {
             show_error('Unable to load the requested language file: language/' . $idiom . '/' . $langfile);
         }
     }
     if (!isset($lang)) {
         log_message('error', 'Language file contains no data: language/' . $idiom . '/' . $langfile);
         return;
     }
     if ($return == TRUE) {
         return $lang;
     }
     $this->is_loaded[] = $langfile;
     $this->language = array_merge($this->language, $lang);
     unset($lang);
     log_message('debug', 'Language file loaded: language/' . $idiom . '/' . $langfile);
     return TRUE;
 }
Exemple #24
0
 private function _send($timeoff, $relations = NULL)
 {
     $CI =& ci_get_instance();
     $staff = NULL;
     if ($relations && isset($relations['user'])) {
         $staff = $relations['user'];
     } else {
         $timeoff->user->get();
         if ($timeoff->user->exists()) {
             $staff = $timeoff->user;
         } else {
             $timeoff->user = new User_model();
             if ($timeoff->user_id) {
                 $timeoff->user->get_by_id($timeoff->user_id);
             }
         }
         $staff = $timeoff->user->get_clone();
     }
     $staff_view = $staff->title();
     /* compile message */
     $text = $timeoff->view_text();
     // a hack to overcome the wrong staff problem for new timeoffs
     $text['user'][1] = $staff_view;
     $msg = new stdClass();
     $msg->subject = lang('timeoff') . ': ' . $timeoff->prop_text('status');
     $msg->body = array();
     foreach ($text as $ta) {
         $msg->body[] = $ta[0] . ': ' . $ta[1];
     }
     $msg_id = $CI->hc_notifier->add_message($msg);
     $group_id = 'save_timeoff';
     $CI->hc_notifier->enqueue_message($msg_id, $staff, $group_id);
     // send to all admins too
     $um = new User_model();
     $um->where_in('level', array(USER_MODEL::LEVEL_MANAGER, USER_MODEL::LEVEL_ADMIN))->where('active', USER_MODEL::STATUS_ACTIVE);
     $um->get();
     foreach ($um as $u) {
         $CI->hc_notifier->enqueue_message($msg_id, $u, $group_id);
     }
 }
Exemple #25
0
 function __get($child)
 {
     if (!isset($this->lib_name)) {
         $this->lib_name = get_class($this);
     }
     // The class will be prefixed with the parent lib
     $child_class = $this->lib_name . '_' . $child;
     // Remove the CI_ prefix and lowercase
     $lib_name = ucfirst(strtolower(str_replace('CI_', '', $this->lib_name)));
     $driver_name = strtolower(str_replace('CI_', '', $child_class));
     if (in_array($driver_name, array_map('strtolower', $this->valid_drivers))) {
         // check and see if the driver is in a separate file
         if (!class_exists($child_class)) {
             // check application path first
             foreach (ci_get_instance()->load->get_package_paths(TRUE) as $path) {
                 // loves me some nesting!
                 foreach (array(ucfirst($driver_name), $driver_name) as $class) {
                     $filepath = $path . 'libraries/' . $lib_name . '/drivers/' . $class . '.php';
                     if (file_exists($filepath)) {
                         include_once $filepath;
                         break;
                     }
                 }
             }
             // it's a valid driver, but the file simply can't be found
             if (!class_exists($child_class)) {
                 log_message('error', "Unable to load the requested driver: " . $child_class);
                 show_error("Unable to load the requested driver: " . $child_class);
             }
         }
         $obj = new $child_class();
         $obj->decorate($this);
         $this->{$child} = $obj;
         return $this->{$child};
     }
     // The requested driver isn't valid!
     log_message('error', "Invalid driver requested: " . $child_class);
     show_error("Invalid driver requested: " . $child_class);
 }
 function __construct()
 {
     $this->subject = '';
     $this->body = '';
     $this->error = '';
     $this->disabled = false;
     $this->mail = new ntsPHPMailer();
     $this->mail->CharSet = 'utf-8';
     /* from, from name, and debug settings */
     $CI =& ci_get_instance();
     $this->disabled = false;
     //		$this->from = $CI->app_conf->get('email_sent_from');
     //		$this->fromName = $CI->app_conf->get('email_sent_from_name');
     $this->debug = false;
     /* logger */
     $loggerFile = dirname(__FILE__) . '/ntsEmailLogger.php';
     if (file_exists($loggerFile)) {
         $this->logger = true;
         include_once $loggerFile;
     } else {
         $this->logger = false;
     }
 }
Exemple #27
0
 function _send($toArray = array())
 {
     if ($this->disabled) {
         return true;
     }
     $this->mail->SetLanguage('en', dirname(__FILE__) . '/');
     $this->mail->From = $this->from;
     $this->mail->FromName = $this->fromName;
     $this->mail->IsHTML(true);
     $text = $this->getBody();
     $this->mail->Subject = $this->getSubject();
     $this->mail->Body = nl2br($text);
     $this->mail->AltBody = strip_tags($text);
     if ($this->logger) {
         $log = new ntsEmailLogger();
         $log->setParam('from_email', $this->mail->From);
         $log->setParam('from_name', $this->mail->FromName);
         $log->setParam('subject', $this->mail->Subject);
         $log->setParam('body', $this->mail->Body);
         $log->setParam('alt_body', $this->mail->AltBody);
     }
     reset($toArray);
     if (defined('NTS_DEVELOPMENT') && NTS_DEVELOPMENT) {
         $msg = array();
         $msg[] = 'Email to ' . join(', ', $toArray);
         $msg[] = $this->getSubject();
         $msg[] = nl2br($this->getBody());
         $msg = join('<br>', $msg);
         $CI =& ci_get_instance();
         $CI->session->add_flashdata('debug_message', $msg);
     } elseif ($this->debug) {
         echo '<PRE>';
         echo "<BR>-------------------------------------------<BR>";
         foreach ($toArray as $to) {
             echo "To:<BR><I>{$to}</I><BR>";
         }
         echo "====<BR>";
         echo "From:<BR><I>{$this->from}</I> <B>{$this->fromName}</B><BR>";
         echo 'Subj:<BR><I>' . $this->getSubject() . '</I><BR>';
         echo 'Msg:<BR><I>' . $text . '</I><BR>';
         echo "<BR>-------------------------------------------<BR>";
         if ($attachements = $this->mail->GetAttachments()) {
             echo "Attachements:<BR>";
             foreach ($attachements as $att) {
                 echo $att[1];
                 echo "<BR>-------------------------------------------<BR>";
                 echo $att[0] . '<br>';
                 echo "<BR>===========================================<BR>";
             }
         }
         echo '</PRE>';
     } else {
         //			$this->mail->WordWrap = 50; // set word wrap to 50 characters
         $this->mail->ClearAddresses();
         foreach ($toArray as $to) {
             $this->mail->AddAddress($to);
         }
         if (!$this->mail->Send()) {
             $errTxt = "Mailer Error: " . $this->mail->ErrorInfo;
             //				ntsView::addAnnounce( $errTxt, 'error' );
             $this->error = $errTxt;
             return false;
         }
     }
     /* add log */
     if ($this->logger) {
         reset($toArray);
         foreach ($toArray as $to) {
             $log->setParam('to_email', $to);
             $log->add();
         }
     }
     return true;
 }
Exemple #28
0
/* --------------------------------------------------------------------
 * LOAD THE DATAMAPPER BOOTSTRAP FILE
 * --------------------------------------------------------------------
 */
require_once NTS_SYSTEM_APPPATH . 'third_party/datamapper/bootstrap.php';
/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 *
 */
require_once BASEPATH . 'core/CodeIgniter_.php';
/* if ajax display it and exit */
$CI =& ci_get_instance();
if ($CI->input->wants_json()) {
    $CI->output->set_content_type('application/json');
    $already_out = $CI->output->get_output();
    echo $already_out;
    hc_ci_before_exit();
    exit;
}
if ($CI->input->is_ajax_request()) {
    if ($CI->input->post()) {
        $return = array();
        $already_out = $CI->output->get_output();
        if (strlen($already_out)) {
            $return = array('html' => $already_out);
            $CI->output->set_content_type('application/json');
            $CI->output->set_output(json_encode($return));
Exemple #29
0
 /**
  * Assign Libraries
  *
  * Assigns required CodeIgniter libraries to DataMapper.
  *
  * @ignore
  */
 protected function _dmz_assign_libraries()
 {
     static $CI;
     if ($CI || ($CI =& ci_get_instance())) {
         // make sure these exists to not trip __get()
         $this->load = NULL;
         $this->config = NULL;
         $this->lang = NULL;
         // access to the loader
         $this->load =& $CI->load;
         // to the config
         $this->config =& $CI->config;
         // and the language class
         $this->lang =& $CI->lang;
     }
 }
Exemple #30
0
 function &_get_validation_object()
 {
     $CI =& ci_get_instance();
     // We set this as a variable since we're returning by reference.
     $return = FALSE;
     if (FALSE !== ($object = $CI->load->is_loaded('form_validation'))) {
         if (!isset($CI->{$object}) or !is_object($CI->{$object})) {
             return $return;
         }
         return $CI->{$object};
     }
     return $return;
 }