ExiteCMS v8 : Development Documentation
CodeIgniter Change History
20090911 - Vendor branch merge of CodeIgniter v1.7.2. No additional code changes
20090829 - Vendor branch merge of CodeIgniter v1.7.1. SVN Revision 1736 for PHP 5.3 compatibility
20090227 - Vendor branch merge of CodeIgniter v1.7.1. No additional code changes
20090110 - Vendor branch merge of CodeIgniter v1.7.0.
CodeIgniter Core Code Modifications
The following changes have been made to the CI framework code:
- /system/codeigniter/Base4.php
- Modified to allow our Loader class extension to work with PHP4
Index: codeigniter/Base4.php =================================================================== --- codeigniter/Base4.php (revision 26) +++ codeigniter/Base4.php (working copy) @@ -38,14 +38,14 @@ * @author ExpressionEngine Dev Team * @link http://codeigniter.com/user_guide/ */ - class CI_Base extends CI_Loader { + class CI_Base extends CMS_Loader { function CI_Base() { // This allows syntax like $this->load->foo() to work - parent::CI_Loader(); + parent::CMS_Loader(); $this->load =& $this; - + // This allows resources used within controller constructors to work global $OBJ; $OBJ = $this->load; // Do NOT use a reference.
- Modified to allow our Loader class extension to work with PHP4
- /system/database/DB.php
- Make it possible to extend the Active record class
Index: trunk/system/database/DB.php =================================================================== --- trunk/system/database/DB.php (revision 384) +++ trunk/system/database/DB.php (revision 429) @@ -124,8 +124,21 @@ require_once(BASEPATH.'database/DB_active_rec'.EXT); - if ( ! class_exists('CI_DB')) + // ** start ExiteCMS modifications + if ( file_exists(APPPATH.'libraries/'.config_item('subclass_prefix').'DB_active_rec'.EXT) ) { - eval('class CI_DB extends CI_DB_active_record { }'); + require_once(APPPATH.'libraries/'.config_item('subclass_prefix').'DB_active_rec'.EXT); + if ( ! class_exists('CI_DB')) + { + eval('class CI_DB extends '.config_item('subclass_prefix').'DB_active_record { }'); + } } + else + { + if ( ! class_exists('CI_DB')) + { + eval('class CI_DB extends CI_DB_active_record { }'); + } + } + // ** end ExiteCMS modifications } else
- Make it possible to extend the Active record class
- /system/database/DB_driver.php
- Add extra code to be able to have query statistics per SQL command
Index: database/DB_driver.php =================================================================== --- database/DB_driver.php (revision 3) +++ database/DB_driver.php (working copy) @@ -61,6 +65,10 @@ var $cache_autodel = FALSE; var $CACHE; // The cache class object + // ** start ExiteCMS modifications + var $query_types = array(); // Track queries based on type + // ** end ExiteCMS modifications + // Private variables var $_protect_identifiers = TRUE; var $_reserved_identifiers = array('*'); // Identifiers that should NOT be escaped @@ -88,9 +96,17 @@ } } + // ** start ExiteCMS modifications + $this->query_types['selects'] = 0; + $this->query_types['inserts'] = 0; + $this->query_types['updates'] = 0; + $this->query_types['deletes'] = 0; + $this->query_types['others'] = 0; + // ** end ExiteCMS modifications + log_message('debug', 'Database Driver Class Initialized'); } - + // -------------------------------------------------------------------- /** @@ -335,10 +351,17 @@ { $this->query_times[] = ($em + $es) - ($sm + $ss); } - + // Increment the query counter $this->query_count++; - + + // ** start ExiteCMS modifications + list($qtype) = explode(' ', $sql); + $qtype = $qtype . 's'; + if (!isset($this->query_types[strtolower($qtype)])) $qtype = 'others'; + $this->query_types[strtolower($qtype)]++; + // ** end ExiteCMS modifications + // Was the query a "write" type? // If so we'll simply return true if ($this->is_write_type($sql) === TRUE) - Code modification to allow a custom DB_result library to be loaded if available
Index: trunk/system/database/DB_driver.php =================================================================== --- trunk/system/database/DB_driver.php (revision 368) +++ trunk/system/database/DB_driver.php (revision 413) @@ -440,4 +440,6 @@ * @access public * @return string the name of the result class + * + * NOTE: Modified by ExiteCMS to allow loading of a custom DB_result library */ function load_rdriver() @@ -447,5 +449,13 @@ if ( ! class_exists($driver)) { - include_once(BASEPATH.'database/DB_result'.EXT); + $db_result = APPPATH.'libraries/'.config_item('subclass_prefix').'DB_result'.EXT; + if ( file_exists($db_result) ) + { + include_once($db_result); + } + else + { + include_once(BASEPATH.'database/DB_result'.EXT); + } include_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result'.EXT); }
- Add extra code to be able to have query statistics per SQL command
- /system/database/DB_forge.php
- Removed the is_array($key) section to make the add_key method comply with the docs
Index: DB_forge.php =================================================================== --- DB_forge.php (revision 176) +++ DB_forge.php (working copy) @@ -97,7 +97,10 @@ */ function add_key($key = '', $primary = FALSE) { - if (is_array($key)) +/* + * ExiteCMS: fix to make sure add_key() does what the manual says... + * + * if (is_array($key)) { foreach($key as $one) { @@ -106,7 +109,7 @@ return; } - +*/ if ($key == '') { show_error('Key information is required for that operation.');
- Removed the is_array($key) section to make the add_key method comply with the docs
- /system/libraries/Form_validation.php
- Added a fix to allow our 'required_if' validation method to work
Index: /trunk/system/libraries/Form_validation.php =================================================================== --- /trunk/system/libraries/Form_validation.php (revision 368) +++ /trunk/system/libraries/Form_validation.php (revision 439) @@ -474,13 +474,19 @@ $cycles++; } return; } // -------------------------------------------------------------------- // If the field is blank, but NOT required, no further tests are necessary $callback = FALSE; - if ( ! in_array('required', $rules) AND is_null($postdata)) + + // ** EXITECMS MODIFICATION ** Allow our conditional required to work ** + if ( strpos($row['rules'],'required_if[') !== FALSE ) + { + $callback = TRUE; + } + elseif ( ! in_array('required', $rules) AND is_null($postdata)) { // Before we bail out, does the rule contain a callback?
- Added a fix to allow our 'required_if' validation method to work
