@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * This method is called once in CI_Controller. |
| 141 | 141 | * |
| 142 | 142 | * @param array |
| 143 | - * @return object |
|
| 143 | + * @return CI_Loader |
|
| 144 | 144 | */ |
| 145 | 145 | public function initialize() |
| 146 | 146 | { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | * @param string the name of the class |
| 190 | 190 | * @param mixed the optional parameters |
| 191 | 191 | * @param string an optional object name |
| 192 | - * @return void |
|
| 192 | + * @return null|false |
|
| 193 | 193 | */ |
| 194 | 194 | public function library($library = '', $params = NULL, $object_name = NULL) |
| 195 | 195 | { |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | * @param string |
| 413 | 413 | * @param array |
| 414 | 414 | * @param bool |
| 415 | - * @return void |
|
| 415 | + * @return string|null |
|
| 416 | 416 | */ |
| 417 | 417 | public function view($view, $vars = array(), $return = FALSE) |
| 418 | 418 | { |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | * @param string the name of the class |
| 607 | 607 | * @param mixed the optional parameters |
| 608 | 608 | * @param string an optional object name |
| 609 | - * @return void |
|
| 609 | + * @return false|null |
|
| 610 | 610 | */ |
| 611 | 611 | public function driver($library = '', $params = NULL, $object_name = NULL) |
| 612 | 612 | { |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | * variables made available to view files |
| 737 | 737 | * |
| 738 | 738 | * @param array |
| 739 | - * @return void |
|
| 739 | + * @return string|null |
|
| 740 | 740 | */ |
| 741 | 741 | protected function _ci_load($_ci_data) |
| 742 | 742 | { |
@@ -874,6 +874,7 @@ discard block |
||
| 874 | 874 | * @param string the item that is being loaded |
| 875 | 875 | * @param mixed any additional parameters |
| 876 | 876 | * @param string an optional object name |
| 877 | + * @param string $class |
|
| 877 | 878 | * @return void |
| 878 | 879 | */ |
| 879 | 880 | protected function _ci_load_class($class, $params = NULL, $object_name = NULL) |
@@ -1002,6 +1003,7 @@ discard block |
||
| 1002 | 1003 | * @param string |
| 1003 | 1004 | * @param bool |
| 1004 | 1005 | * @param string an optional object name |
| 1006 | + * @param string $class |
|
| 1005 | 1007 | * @return null |
| 1006 | 1008 | */ |
| 1007 | 1009 | protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL) |
@@ -1109,7 +1111,7 @@ discard block |
||
| 1109 | 1111 | * libraries, and helpers to be loaded automatically. |
| 1110 | 1112 | * |
| 1111 | 1113 | * @param array |
| 1112 | - * @return void |
|
| 1114 | + * @return false|null |
|
| 1113 | 1115 | */ |
| 1114 | 1116 | private function _ci_autoloader() |
| 1115 | 1117 | { |
@@ -1207,6 +1209,7 @@ discard block |
||
| 1207 | 1209 | * Get a reference to a specific library or model |
| 1208 | 1210 | * |
| 1209 | 1211 | * @param string |
| 1212 | + * @param string $component |
|
| 1210 | 1213 | * @return bool |
| 1211 | 1214 | */ |
| 1212 | 1215 | protected function &_ci_get_component($component) |
@@ -1224,6 +1227,7 @@ discard block |
||
| 1224 | 1227 | * |
| 1225 | 1228 | * @param mixed |
| 1226 | 1229 | * @param string |
| 1230 | + * @param string $extension |
|
| 1227 | 1231 | * @return array |
| 1228 | 1232 | */ |
| 1229 | 1233 | protected function _ci_prep_filename($filename, $extension) |
@@ -42,28 +42,28 @@ discard block |
||
| 42 | 42 | * @var array |
| 43 | 43 | * @access protected |
| 44 | 44 | */ |
| 45 | - protected $_ci_view_paths = array(); |
|
| 45 | + protected $_ci_view_paths = array(); |
|
| 46 | 46 | /** |
| 47 | 47 | * List of paths to load libraries from |
| 48 | 48 | * |
| 49 | 49 | * @var array |
| 50 | 50 | * @access protected |
| 51 | 51 | */ |
| 52 | - protected $_ci_library_paths = array(); |
|
| 52 | + protected $_ci_library_paths = array(); |
|
| 53 | 53 | /** |
| 54 | 54 | * List of paths to load models from |
| 55 | 55 | * |
| 56 | 56 | * @var array |
| 57 | 57 | * @access protected |
| 58 | 58 | */ |
| 59 | - protected $_ci_model_paths = array(); |
|
| 59 | + protected $_ci_model_paths = array(); |
|
| 60 | 60 | /** |
| 61 | 61 | * List of paths to load helpers from |
| 62 | 62 | * |
| 63 | 63 | * @var array |
| 64 | 64 | * @access protected |
| 65 | 65 | */ |
| 66 | - protected $_ci_helper_paths = array(); |
|
| 66 | + protected $_ci_helper_paths = array(); |
|
| 67 | 67 | /** |
| 68 | 68 | * List of loaded base classes |
| 69 | 69 | * Set by the controller class |
@@ -71,49 +71,49 @@ discard block |
||
| 71 | 71 | * @var array |
| 72 | 72 | * @access protected |
| 73 | 73 | */ |
| 74 | - protected $_base_classes = array(); // Set by the controller class |
|
| 74 | + protected $_base_classes = array(); // Set by the controller class |
|
| 75 | 75 | /** |
| 76 | 76 | * List of cached variables |
| 77 | 77 | * |
| 78 | 78 | * @var array |
| 79 | 79 | * @access protected |
| 80 | 80 | */ |
| 81 | - protected $_ci_cached_vars = array(); |
|
| 81 | + protected $_ci_cached_vars = array(); |
|
| 82 | 82 | /** |
| 83 | 83 | * List of loaded classes |
| 84 | 84 | * |
| 85 | 85 | * @var array |
| 86 | 86 | * @access protected |
| 87 | 87 | */ |
| 88 | - protected $_ci_classes = array(); |
|
| 88 | + protected $_ci_classes = array(); |
|
| 89 | 89 | /** |
| 90 | 90 | * List of loaded files |
| 91 | 91 | * |
| 92 | 92 | * @var array |
| 93 | 93 | * @access protected |
| 94 | 94 | */ |
| 95 | - protected $_ci_loaded_files = array(); |
|
| 95 | + protected $_ci_loaded_files = array(); |
|
| 96 | 96 | /** |
| 97 | 97 | * List of loaded models |
| 98 | 98 | * |
| 99 | 99 | * @var array |
| 100 | 100 | * @access protected |
| 101 | 101 | */ |
| 102 | - protected $_ci_models = array(); |
|
| 102 | + protected $_ci_models = array(); |
|
| 103 | 103 | /** |
| 104 | 104 | * List of loaded helpers |
| 105 | 105 | * |
| 106 | 106 | * @var array |
| 107 | 107 | * @access protected |
| 108 | 108 | */ |
| 109 | - protected $_ci_helpers = array(); |
|
| 109 | + protected $_ci_helpers = array(); |
|
| 110 | 110 | /** |
| 111 | 111 | * List of class name mappings |
| 112 | 112 | * |
| 113 | 113 | * @var array |
| 114 | 114 | * @access protected |
| 115 | 115 | */ |
| 116 | - protected $_ci_varmap = array('unit_test' => 'unit', |
|
| 116 | + protected $_ci_varmap = array('unit_test' => 'unit', |
|
| 117 | 117 | 'user_agent' => 'agent'); |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function __construct() |
| 125 | 125 | { |
| 126 | - $this->_ci_ob_level = ob_get_level(); |
|
| 126 | + $this->_ci_ob_level = ob_get_level(); |
|
| 127 | 127 | $this->_ci_library_paths = array(APPPATH, BASEPATH); |
| 128 | 128 | $this->_ci_helper_paths = array(APPPATH, BASEPATH); |
| 129 | 129 | $this->_ci_model_paths = array(APPPATH); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $this->_ci_classes = array(); |
| 148 | 148 | $this->_ci_loaded_files = array(); |
| 149 | 149 | $this->_ci_models = array(); |
| 150 | - $this->_base_classes =& is_loaded(); |
|
| 150 | + $this->_base_classes = & is_loaded(); |
|
| 151 | 151 | |
| 152 | 152 | $this->_ci_autoloader(); |
| 153 | 153 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | return; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - $CI =& get_instance(); |
|
| 269 | + $CI = & get_instance(); |
|
| 270 | 270 | if (isset($CI->$name)) |
| 271 | 271 | { |
| 272 | 272 | show_error('The model name you are loading is the name of a resource that is already being used: '.$name); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | public function database($params = '', $return = FALSE, $active_record = NULL) |
| 324 | 324 | { |
| 325 | 325 | // Grab the super object |
| 326 | - $CI =& get_instance(); |
|
| 326 | + $CI = & get_instance(); |
|
| 327 | 327 | |
| 328 | 328 | // Do we even need to load the database class? |
| 329 | 329 | if (class_exists('CI_DB') AND $return == FALSE AND $active_record == NULL AND isset($CI->db) AND is_object($CI->db)) |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | $CI->db = ''; |
| 344 | 344 | |
| 345 | 345 | // Load the DB class |
| 346 | - $CI->db =& DB($params, $active_record); |
|
| 346 | + $CI->db = & DB($params, $active_record); |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | // -------------------------------------------------------------------- |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | $this->database(); |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - $CI =& get_instance(); |
|
| 363 | + $CI = & get_instance(); |
|
| 364 | 364 | |
| 365 | 365 | // for backwards compatibility, load dbforge so we can extend dbutils off it |
| 366 | 366 | // this use is deprecated and strongly discouraged |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | $this->database(); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - $CI =& get_instance(); |
|
| 390 | + $CI = & get_instance(); |
|
| 391 | 391 | |
| 392 | 392 | require_once(BASEPATH.'database/DB_forge.php'); |
| 393 | 393 | require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_forge.php'); |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | */ |
| 568 | 568 | public function language($file = array(), $lang = '') |
| 569 | 569 | { |
| 570 | - $CI =& get_instance(); |
|
| 570 | + $CI = & get_instance(); |
|
| 571 | 571 | |
| 572 | 572 | if ( ! is_array($file)) |
| 573 | 573 | { |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | */ |
| 593 | 593 | public function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) |
| 594 | 594 | { |
| 595 | - $CI =& get_instance(); |
|
| 595 | + $CI = & get_instance(); |
|
| 596 | 596 | $CI->config->load($file, $use_sections, $fail_gracefully); |
| 597 | 597 | } |
| 598 | 598 | |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | * @param boolean |
| 643 | 643 | * @return void |
| 644 | 644 | */ |
| 645 | - public function add_package_path($path, $view_cascade=TRUE) |
|
| 645 | + public function add_package_path($path, $view_cascade = TRUE) |
|
| 646 | 646 | { |
| 647 | 647 | $path = rtrim($path, '/').'/'; |
| 648 | 648 | |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | $this->_ci_view_paths = array($path.'views/' => $view_cascade) + $this->_ci_view_paths; |
| 654 | 654 | |
| 655 | 655 | // Add config file path |
| 656 | - $config =& $this->_ci_get_component('config'); |
|
| 656 | + $config = & $this->_ci_get_component('config'); |
|
| 657 | 657 | array_unshift($config->_config_paths, $path); |
| 658 | 658 | } |
| 659 | 659 | |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | */ |
| 687 | 687 | public function remove_package_path($path = '', $remove_config_path = TRUE) |
| 688 | 688 | { |
| 689 | - $config =& $this->_ci_get_component('config'); |
|
| 689 | + $config = & $this->_ci_get_component('config'); |
|
| 690 | 690 | |
| 691 | 691 | if ($path == '') |
| 692 | 692 | { |
@@ -783,12 +783,12 @@ discard block |
||
| 783 | 783 | // This allows anything loaded using $this->load (views, files, etc.) |
| 784 | 784 | // to become accessible from within the Controller and Model functions. |
| 785 | 785 | |
| 786 | - $_ci_CI =& get_instance(); |
|
| 786 | + $_ci_CI = & get_instance(); |
|
| 787 | 787 | foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var) |
| 788 | 788 | { |
| 789 | 789 | if ( ! isset($this->$_ci_key)) |
| 790 | 790 | { |
| 791 | - $this->$_ci_key =& $_ci_CI->$_ci_key; |
|
| 791 | + $this->$_ci_key = & $_ci_CI->$_ci_key; |
|
| 792 | 792 | } |
| 793 | 793 | } |
| 794 | 794 | |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | // do a little string replacement, changing the short tags |
| 825 | 825 | // to standard PHP echo statements. |
| 826 | 826 | |
| 827 | - if ((bool) @ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE) |
|
| 827 | + if ((bool)@ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE) |
|
| 828 | 828 | { |
| 829 | 829 | echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
| 830 | 830 | } |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | // return a new instance of the object |
| 920 | 920 | if ( ! is_null($object_name)) |
| 921 | 921 | { |
| 922 | - $CI =& get_instance(); |
|
| 922 | + $CI = & get_instance(); |
|
| 923 | 923 | if ( ! isset($CI->$object_name)) |
| 924 | 924 | { |
| 925 | 925 | return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name); |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | // return a new instance of the object |
| 959 | 959 | if ( ! is_null($object_name)) |
| 960 | 960 | { |
| 961 | - $CI =& get_instance(); |
|
| 961 | + $CI = & get_instance(); |
|
| 962 | 962 | if ( ! isset($CI->$object_name)) |
| 963 | 963 | { |
| 964 | 964 | return $this->_ci_init_class($class, '', $params, $object_name); |
@@ -1021,24 +1021,24 @@ discard block |
||
| 1021 | 1021 | // We test for both uppercase and lowercase, for servers that |
| 1022 | 1022 | // are case-sensitive with regard to file names. Check for environment |
| 1023 | 1023 | // first, global next |
| 1024 | - if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php')) |
|
| 1024 | + if (defined('ENVIRONMENT') AND file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php')) |
|
| 1025 | 1025 | { |
| 1026 | - include($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
|
| 1026 | + include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
|
| 1027 | 1027 | break; |
| 1028 | 1028 | } |
| 1029 | - elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1029 | + elseif (defined('ENVIRONMENT') AND file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1030 | 1030 | { |
| 1031 | - include($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
|
| 1031 | + include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
|
| 1032 | 1032 | break; |
| 1033 | 1033 | } |
| 1034 | - elseif (file_exists($path .'config/'.strtolower($class).'.php')) |
|
| 1034 | + elseif (file_exists($path.'config/'.strtolower($class).'.php')) |
|
| 1035 | 1035 | { |
| 1036 | - include($path .'config/'.strtolower($class).'.php'); |
|
| 1036 | + include($path.'config/'.strtolower($class).'.php'); |
|
| 1037 | 1037 | break; |
| 1038 | 1038 | } |
| 1039 | - elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1039 | + elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1040 | 1040 | { |
| 1041 | - include($path .'config/'.ucfirst(strtolower($class)).'.php'); |
|
| 1041 | + include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
|
| 1042 | 1042 | break; |
| 1043 | 1043 | } |
| 1044 | 1044 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | $this->_ci_classes[$class] = $classvar; |
| 1090 | 1090 | |
| 1091 | 1091 | // Instantiate the class |
| 1092 | - $CI =& get_instance(); |
|
| 1092 | + $CI = & get_instance(); |
|
| 1093 | 1093 | if ($config !== NULL) |
| 1094 | 1094 | { |
| 1095 | 1095 | $CI->$classvar = new $name($config); |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | // Load any custom config file |
| 1140 | 1140 | if (count($autoload['config']) > 0) |
| 1141 | 1141 | { |
| 1142 | - $CI =& get_instance(); |
|
| 1142 | + $CI = & get_instance(); |
|
| 1143 | 1143 | foreach ($autoload['config'] as $key => $val) |
| 1144 | 1144 | { |
| 1145 | 1145 | $CI->config->load($val); |
@@ -1211,7 +1211,7 @@ discard block |
||
| 1211 | 1211 | */ |
| 1212 | 1212 | protected function &_ci_get_component($component) |
| 1213 | 1213 | { |
| 1214 | - $CI =& get_instance(); |
|
| 1214 | + $CI = & get_instance(); |
|
| 1215 | 1215 | return $CI->$component; |
| 1216 | 1216 | } |
| 1217 | 1217 | |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -695,8 +697,7 @@ discard block |
||
| 695 | 697 | $void = array_shift($this->_ci_helper_paths); |
| 696 | 698 | $void = array_shift($this->_ci_view_paths); |
| 697 | 699 | $void = array_shift($config->_config_paths); |
| 698 | - } |
|
| 699 | - else |
|
| 700 | + } else |
|
| 700 | 701 | { |
| 701 | 702 | $path = rtrim($path, '/').'/'; |
| 702 | 703 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -753,8 +754,7 @@ discard block |
||
| 753 | 754 | { |
| 754 | 755 | $_ci_x = explode('/', $_ci_path); |
| 755 | 756 | $_ci_file = end($_ci_x); |
| 756 | - } |
|
| 757 | - else |
|
| 757 | + } else |
|
| 758 | 758 | { |
| 759 | 759 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
| 760 | 760 | $_ci_file = ($_ci_ext == '') ? $_ci_view.'.php' : $_ci_view; |
@@ -827,8 +827,7 @@ discard block |
||
| 827 | 827 | if ((bool) @ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE) |
| 828 | 828 | { |
| 829 | 829 | echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
| 830 | - } |
|
| 831 | - else |
|
| 830 | + } else |
|
| 832 | 831 | { |
| 833 | 832 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
| 834 | 833 | } |
@@ -856,8 +855,7 @@ discard block |
||
| 856 | 855 | if (ob_get_level() > $this->_ci_ob_level + 1) |
| 857 | 856 | { |
| 858 | 857 | ob_end_flush(); |
| 859 | - } |
|
| 860 | - else |
|
| 858 | + } else |
|
| 861 | 859 | { |
| 862 | 860 | $_ci_CI->output->append_output(ob_get_contents()); |
| 863 | 861 | @ob_end_clean(); |
@@ -1025,18 +1023,15 @@ discard block |
||
| 1025 | 1023 | { |
| 1026 | 1024 | include($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
| 1027 | 1025 | break; |
| 1028 | - } |
|
| 1029 | - elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1026 | + } elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1030 | 1027 | { |
| 1031 | 1028 | include($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
| 1032 | 1029 | break; |
| 1033 | - } |
|
| 1034 | - elseif (file_exists($path .'config/'.strtolower($class).'.php')) |
|
| 1030 | + } elseif (file_exists($path .'config/'.strtolower($class).'.php')) |
|
| 1035 | 1031 | { |
| 1036 | 1032 | include($path .'config/'.strtolower($class).'.php'); |
| 1037 | 1033 | break; |
| 1038 | - } |
|
| 1039 | - elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1034 | + } elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1040 | 1035 | { |
| 1041 | 1036 | include($path .'config/'.ucfirst(strtolower($class)).'.php'); |
| 1042 | 1037 | break; |
@@ -1050,17 +1045,14 @@ discard block |
||
| 1050 | 1045 | if (class_exists('CI_'.$class)) |
| 1051 | 1046 | { |
| 1052 | 1047 | $name = 'CI_'.$class; |
| 1053 | - } |
|
| 1054 | - elseif (class_exists(config_item('subclass_prefix').$class)) |
|
| 1048 | + } elseif (class_exists(config_item('subclass_prefix').$class)) |
|
| 1055 | 1049 | { |
| 1056 | 1050 | $name = config_item('subclass_prefix').$class; |
| 1057 | - } |
|
| 1058 | - else |
|
| 1051 | + } else |
|
| 1059 | 1052 | { |
| 1060 | 1053 | $name = $class; |
| 1061 | 1054 | } |
| 1062 | - } |
|
| 1063 | - else |
|
| 1055 | + } else |
|
| 1064 | 1056 | { |
| 1065 | 1057 | $name = $prefix.$class; |
| 1066 | 1058 | } |
@@ -1079,8 +1071,7 @@ discard block |
||
| 1079 | 1071 | if (is_null($object_name)) |
| 1080 | 1072 | { |
| 1081 | 1073 | $classvar = ( ! isset($this->_ci_varmap[$class])) ? $class : $this->_ci_varmap[$class]; |
| 1082 | - } |
|
| 1083 | - else |
|
| 1074 | + } else |
|
| 1084 | 1075 | { |
| 1085 | 1076 | $classvar = $object_name; |
| 1086 | 1077 | } |
@@ -1093,8 +1084,7 @@ discard block |
||
| 1093 | 1084 | if ($config !== NULL) |
| 1094 | 1085 | { |
| 1095 | 1086 | $CI->$classvar = new $name($config); |
| 1096 | - } |
|
| 1097 | - else |
|
| 1087 | + } else |
|
| 1098 | 1088 | { |
| 1099 | 1089 | $CI->$classvar = new $name; |
| 1100 | 1090 | } |
@@ -1116,8 +1106,7 @@ discard block |
||
| 1116 | 1106 | if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php')) |
| 1117 | 1107 | { |
| 1118 | 1108 | include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'); |
| 1119 | - } |
|
| 1120 | - else |
|
| 1109 | + } else |
|
| 1121 | 1110 | { |
| 1122 | 1111 | include(APPPATH.'config/autoload.php'); |
| 1123 | 1112 | } |
@@ -1231,8 +1220,7 @@ discard block |
||
| 1231 | 1220 | if ( ! is_array($filename)) |
| 1232 | 1221 | { |
| 1233 | 1222 | return array(strtolower(str_replace('.php', '', str_replace($extension, '', $filename)).$extension)); |
| 1234 | - } |
|
| 1235 | - else |
|
| 1223 | + } else |
|
| 1236 | 1224 | { |
| 1237 | 1225 | foreach ($filename as $key => $val) |
| 1238 | 1226 | { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @access public |
| 135 | 135 | * @param string |
| 136 | - * @return void |
|
| 136 | + * @return CI_Output |
|
| 137 | 137 | */ |
| 138 | 138 | function set_output($output) |
| 139 | 139 | { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @access public |
| 153 | 153 | * @param string |
| 154 | - * @return void |
|
| 154 | + * @return CI_Output |
|
| 155 | 155 | */ |
| 156 | 156 | function append_output($output) |
| 157 | 157 | { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @access public |
| 181 | 181 | * @param string |
| 182 | 182 | * @param bool |
| 183 | - * @return void |
|
| 183 | + * @return null|CI_Output |
|
| 184 | 184 | */ |
| 185 | 185 | function set_header($header, $replace = TRUE) |
| 186 | 186 | { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @access public |
| 208 | 208 | * @param string extension of the file we're outputting |
| 209 | - * @return void |
|
| 209 | + * @return CI_Output |
|
| 210 | 210 | */ |
| 211 | 211 | function set_content_type($mime_type) |
| 212 | 212 | { |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @access public |
| 243 | 243 | * @param int the status code |
| 244 | 244 | * @param string |
| 245 | - * @return void |
|
| 245 | + * @return CI_Output |
|
| 246 | 246 | */ |
| 247 | 247 | function set_status_header($code = 200, $text = '') |
| 248 | 248 | { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * |
| 259 | 259 | * @access public |
| 260 | 260 | * @param bool |
| 261 | - * @return void |
|
| 261 | + * @return CI_Output |
|
| 262 | 262 | */ |
| 263 | 263 | function enable_profiler($val = TRUE) |
| 264 | 264 | { |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | * @access public |
| 278 | 278 | * @param array |
| 279 | - * @return void |
|
| 279 | + * @return CI_Output |
|
| 280 | 280 | */ |
| 281 | 281 | function set_profiler_sections($sections) |
| 282 | 282 | { |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @access public |
| 297 | 297 | * @param integer |
| 298 | - * @return void |
|
| 298 | + * @return CI_Output |
|
| 299 | 299 | */ |
| 300 | 300 | function cache($time) |
| 301 | 301 | { |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | * |
| 320 | 320 | * @access public |
| 321 | 321 | * @param string |
| 322 | - * @return mixed |
|
| 322 | + * @return boolean|null |
|
| 323 | 323 | */ |
| 324 | 324 | function _display($output = '') |
| 325 | 325 | { |
@@ -456,6 +456,7 @@ discard block |
||
| 456 | 456 | * |
| 457 | 457 | * @access public |
| 458 | 458 | * @param string |
| 459 | + * @param string $output |
|
| 459 | 460 | * @return void |
| 460 | 461 | */ |
| 461 | 462 | function _write_cache($output) |
@@ -509,7 +510,7 @@ discard block |
||
| 509 | 510 | * @access public |
| 510 | 511 | * @param object config class |
| 511 | 512 | * @param object uri class |
| 512 | - * @return void |
|
| 513 | + * @return boolean |
|
| 513 | 514 | */ |
| 514 | 515 | function _display_cache(&$CFG, &$URI) |
| 515 | 516 | { |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | // Get mime types for later |
| 97 | 97 | if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) |
| 98 | 98 | { |
| 99 | - include APPPATH.'config/'.ENVIRONMENT.'/mimes.php'; |
|
| 99 | + include APPPATH.'config/'.ENVIRONMENT.'/mimes.php'; |
|
| 100 | 100 | } |
| 101 | 101 | else |
| 102 | 102 | { |
@@ -41,35 +41,35 @@ discard block |
||
| 41 | 41 | * @var int |
| 42 | 42 | * @access protected |
| 43 | 43 | */ |
| 44 | - protected $cache_expiration = 0; |
|
| 44 | + protected $cache_expiration = 0; |
|
| 45 | 45 | /** |
| 46 | 46 | * List of server headers |
| 47 | 47 | * |
| 48 | 48 | * @var array |
| 49 | 49 | * @access protected |
| 50 | 50 | */ |
| 51 | - protected $headers = array(); |
|
| 51 | + protected $headers = array(); |
|
| 52 | 52 | /** |
| 53 | 53 | * List of mime types |
| 54 | 54 | * |
| 55 | 55 | * @var array |
| 56 | 56 | * @access protected |
| 57 | 57 | */ |
| 58 | - protected $mime_types = array(); |
|
| 58 | + protected $mime_types = array(); |
|
| 59 | 59 | /** |
| 60 | 60 | * Determines wether profiler is enabled |
| 61 | 61 | * |
| 62 | 62 | * @var book |
| 63 | 63 | * @access protected |
| 64 | 64 | */ |
| 65 | - protected $enable_profiler = FALSE; |
|
| 65 | + protected $enable_profiler = FALSE; |
|
| 66 | 66 | /** |
| 67 | 67 | * Determines if output compression is enabled |
| 68 | 68 | * |
| 69 | 69 | * @var bool |
| 70 | 70 | * @access protected |
| 71 | 71 | */ |
| 72 | - protected $_zlib_oc = FALSE; |
|
| 72 | + protected $_zlib_oc = FALSE; |
|
| 73 | 73 | /** |
| 74 | 74 | * List of profiler sections |
| 75 | 75 | * |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @var bool |
| 84 | 84 | * @access protected |
| 85 | 85 | */ |
| 86 | - protected $parse_exec_vars = TRUE; |
|
| 86 | + protected $parse_exec_vars = TRUE; |
|
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * Constructor |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | // Is this extension supported? |
| 218 | 218 | if (isset($this->mime_types[$extension])) |
| 219 | 219 | { |
| 220 | - $mime_type =& $this->mime_types[$extension]; |
|
| 220 | + $mime_type = & $this->mime_types[$extension]; |
|
| 221 | 221 | |
| 222 | 222 | if (is_array($mime_type)) |
| 223 | 223 | { |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | // Grab the super object if we can. |
| 332 | 332 | if (class_exists('CI_Controller')) |
| 333 | 333 | { |
| 334 | - $CI =& get_instance(); |
|
| 334 | + $CI = & get_instance(); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | // -------------------------------------------------------------------- |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | // Set the output data |
| 340 | 340 | if ($output == '') |
| 341 | 341 | { |
| 342 | - $output =& $this->final_output; |
|
| 342 | + $output = & $this->final_output; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | // -------------------------------------------------------------------- |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | if ($this->parse_exec_vars === TRUE) |
| 363 | 363 | { |
| 364 | - $memory = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB'; |
|
| 364 | + $memory = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage() / 1024 / 1024, 2).'MB'; |
|
| 365 | 365 | |
| 366 | 366 | $output = str_replace('{elapsed_time}', $elapsed, $output); |
| 367 | 367 | $output = str_replace('{memory_usage}', $memory, $output); |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | } |
| 443 | 443 | else |
| 444 | 444 | { |
| 445 | - echo $output; // Send it to the browser! |
|
| 445 | + echo $output; // Send it to the browser! |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | log_message('debug', "Final output sent to browser"); |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | */ |
| 461 | 461 | function _write_cache($output) |
| 462 | 462 | { |
| 463 | - $CI =& get_instance(); |
|
| 463 | + $CI = & get_instance(); |
|
| 464 | 464 | $path = $CI->config->item('cache_path'); |
| 465 | 465 | |
| 466 | 466 | $cache_path = ($path == '') ? APPPATH.'cache/' : $path; |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | return; |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - $uri = $CI->config->item('base_url'). |
|
| 474 | + $uri = $CI->config->item('base_url'). |
|
| 475 | 475 | $CI->config->item('index_page'). |
| 476 | 476 | $CI->uri->uri_string(); |
| 477 | 477 | |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | $cache_path = ($CFG->item('cache_path') == '') ? APPPATH.'cache/' : $CFG->item('cache_path'); |
| 517 | 517 | |
| 518 | 518 | // Build the file path. The file name is an MD5 hash of the full URI |
| 519 | - $uri = $CFG->item('base_url'). |
|
| 519 | + $uri = $CFG->item('base_url'). |
|
| 520 | 520 | $CFG->item('index_page'). |
| 521 | 521 | $URI->uri_string; |
| 522 | 522 | |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -97,8 +99,7 @@ discard block |
||
| 97 | 99 | if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) |
| 98 | 100 | { |
| 99 | 101 | include APPPATH.'config/'.ENVIRONMENT.'/mimes.php'; |
| 100 | - } |
|
| 101 | - else |
|
| 102 | + } else |
|
| 102 | 103 | { |
| 103 | 104 | include APPPATH.'config/mimes.php'; |
| 104 | 105 | } |
@@ -158,8 +159,7 @@ discard block |
||
| 158 | 159 | if ($this->final_output == '') |
| 159 | 160 | { |
| 160 | 161 | $this->final_output = $output; |
| 161 | - } |
|
| 162 | - else |
|
| 162 | + } else |
|
| 163 | 163 | { |
| 164 | 164 | $this->final_output .= $output; |
| 165 | 165 | } |
@@ -425,8 +425,7 @@ discard block |
||
| 425 | 425 | $output = preg_replace("|</body>.*?</html>|is", '', $output); |
| 426 | 426 | $output .= $CI->profiler->run(); |
| 427 | 427 | $output .= '</body></html>'; |
| 428 | - } |
|
| 429 | - else |
|
| 428 | + } else |
|
| 430 | 429 | { |
| 431 | 430 | $output .= $CI->profiler->run(); |
| 432 | 431 | } |
@@ -439,8 +438,7 @@ discard block |
||
| 439 | 438 | if (method_exists($CI, '_output')) |
| 440 | 439 | { |
| 441 | 440 | $CI->_output($output); |
| 442 | - } |
|
| 443 | - else |
|
| 441 | + } else |
|
| 444 | 442 | { |
| 445 | 443 | echo $output; // Send it to the browser! |
| 446 | 444 | } |
@@ -489,8 +487,7 @@ discard block |
||
| 489 | 487 | { |
| 490 | 488 | fwrite($fp, $expire.'TS--->'.$output); |
| 491 | 489 | flock($fp, LOCK_UN); |
| 492 | - } |
|
| 493 | - else |
|
| 490 | + } else |
|
| 494 | 491 | { |
| 495 | 492 | log_message('error', "Unable to secure a file lock for file at: ".$cache_path); |
| 496 | 493 | return; |
@@ -576,7 +576,7 @@ |
||
| 576 | 576 | * things like j a v a s c r i p t |
| 577 | 577 | * |
| 578 | 578 | * @param type |
| 579 | - * @return type |
|
| 579 | + * @return string |
|
| 580 | 580 | */ |
| 581 | 581 | protected function _compact_exploded_words($matches) |
| 582 | 582 | { |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | * @var string |
| 33 | 33 | * @access protected |
| 34 | 34 | */ |
| 35 | - protected $_xss_hash = ''; |
|
| 35 | + protected $_xss_hash = ''; |
|
| 36 | 36 | /** |
| 37 | 37 | * Random Hash for Cross Site Request Forgery Protection Cookie |
| 38 | 38 | * |
| 39 | 39 | * @var string |
| 40 | 40 | * @access protected |
| 41 | 41 | */ |
| 42 | - protected $_csrf_hash = ''; |
|
| 42 | + protected $_csrf_hash = ''; |
|
| 43 | 43 | /** |
| 44 | 44 | * Expiration time for Cross Site Request Forgery Protection Cookie |
| 45 | 45 | * Defaults to two hours (in seconds) |
@@ -47,21 +47,21 @@ discard block |
||
| 47 | 47 | * @var int |
| 48 | 48 | * @access protected |
| 49 | 49 | */ |
| 50 | - protected $_csrf_expire = 7200; |
|
| 50 | + protected $_csrf_expire = 7200; |
|
| 51 | 51 | /** |
| 52 | 52 | * Token name for Cross Site Request Forgery Protection Cookie |
| 53 | 53 | * |
| 54 | 54 | * @var string |
| 55 | 55 | * @access protected |
| 56 | 56 | */ |
| 57 | - protected $_csrf_token_name = 'ci_csrf_token'; |
|
| 57 | + protected $_csrf_token_name = 'ci_csrf_token'; |
|
| 58 | 58 | /** |
| 59 | 59 | * Cookie name for Cross Site Request Forgery Protection Cookie |
| 60 | 60 | * |
| 61 | 61 | * @var string |
| 62 | 62 | * @access protected |
| 63 | 63 | */ |
| 64 | - protected $_csrf_cookie_name = 'ci_csrf_token'; |
|
| 64 | + protected $_csrf_cookie_name = 'ci_csrf_token'; |
|
| 65 | 65 | /** |
| 66 | 66 | * List of never allowed strings |
| 67 | 67 | * |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | public function __construct() |
| 102 | 102 | { |
| 103 | 103 | // CSRF config |
| 104 | - foreach(array('csrf_expire', 'csrf_token_name', 'csrf_cookie_name') as $key) |
|
| 104 | + foreach (array('csrf_expire', 'csrf_token_name', 'csrf_cookie_name') as $key) |
|
| 105 | 105 | { |
| 106 | 106 | if (FALSE !== ($val = config_item($key))) |
| 107 | 107 | { |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | else |
| 356 | 356 | { |
| 357 | - $str = str_replace(array('<?', '?'.'>'), array('<?', '?>'), $str); |
|
| 357 | + $str = str_replace(array('<?', '?'.'>'), array('<?', '?>'), $str); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /* |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $str = preg_replace("#<(/*)(script|xss)(.*?)\>#si", '[removed]', $str); |
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | - while($original != $str); |
|
| 410 | + while ($original != $str); |
|
| 411 | 411 | |
| 412 | 412 | unset($original); |
| 413 | 413 | |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | if ($is_image === TRUE) |
| 460 | 460 | { |
| 461 | - return ($str == $converted_string) ? TRUE: FALSE; |
|
| 461 | + return ($str == $converted_string) ? TRUE : FALSE; |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | log_message('debug', "XSS Filtering completed"); |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | * @param string |
| 501 | 501 | * @return string |
| 502 | 502 | */ |
| 503 | - public function entity_decode($str, $charset='UTF-8') |
|
| 503 | + public function entity_decode($str, $charset = 'UTF-8') |
|
| 504 | 504 | { |
| 505 | 505 | if (stristr($str, '&') === FALSE) |
| 506 | 506 | { |
@@ -543,17 +543,17 @@ discard block |
||
| 543 | 543 | '?', |
| 544 | 544 | "%20", |
| 545 | 545 | "%22", |
| 546 | - "%3c", // < |
|
| 547 | - "%253c", // < |
|
| 548 | - "%3e", // > |
|
| 549 | - "%0e", // > |
|
| 550 | - "%28", // ( |
|
| 551 | - "%29", // ) |
|
| 552 | - "%2528", // ( |
|
| 553 | - "%26", // & |
|
| 554 | - "%24", // $ |
|
| 555 | - "%3f", // ? |
|
| 556 | - "%3b", // ; |
|
| 546 | + "%3c", // < |
|
| 547 | + "%253c", // < |
|
| 548 | + "%3e", // > |
|
| 549 | + "%0e", // > |
|
| 550 | + "%28", // ( |
|
| 551 | + "%29", // ) |
|
| 552 | + "%2528", // ( |
|
| 553 | + "%26", // & |
|
| 554 | + "%24", // $ |
|
| 555 | + "%3f", // ? |
|
| 556 | + "%3b", // ; |
|
| 557 | 557 | "%3d" // = |
| 558 | 558 | ); |
| 559 | 559 | |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | $attribs = array(); |
| 620 | 620 | |
| 621 | 621 | // find occurrences of illegal attribute strings without quotes |
| 622 | - preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*([^\s]*)/is", $str, $matches, PREG_SET_ORDER); |
|
| 622 | + preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*([^\s]*)/is", $str, $matches, PREG_SET_ORDER); |
|
| 623 | 623 | |
| 624 | 624 | foreach ($matches as $attr) |
| 625 | 625 | { |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | // find occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes) |
| 630 | - preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is", $str, $matches, PREG_SET_ORDER); |
|
| 630 | + preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is", $str, $matches, PREG_SET_ORDER); |
|
| 631 | 631 | |
| 632 | 632 | foreach ($matches as $attr) |
| 633 | 633 | { |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | * Just as above, adds a semicolon if missing. |
| 798 | 798 | * |
| 799 | 799 | */ |
| 800 | - $str = preg_replace('#(&\#x?)([0-9A-F]+);?#i',"\\1\\2;",$str); |
|
| 800 | + $str = preg_replace('#(&\#x?)([0-9A-F]+);?#i', "\\1\\2;", $str); |
|
| 801 | 801 | |
| 802 | 802 | /* |
| 803 | 803 | * Un-Protect GET variables in URLs |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | |
| 3 | 5 | // ------------------------------------------------------------------------ |
| 4 | 6 | |
@@ -59,8 +61,7 @@ discard block |
||
| 59 | 61 | if ($download == "") |
| 60 | 62 | { |
| 61 | 63 | return $str; |
| 62 | - } |
|
| 63 | - else |
|
| 64 | + } else |
|
| 64 | 65 | { |
| 65 | 66 | echo $str; |
| 66 | 67 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * Generates the SELECT portion of the query |
| 71 | 71 | * |
| 72 | 72 | * @param string |
| 73 | - * @return object |
|
| 73 | + * @return CI_DB_active_record |
|
| 74 | 74 | */ |
| 75 | 75 | public function select($select = '*', $escape = NULL) |
| 76 | 76 | { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @param string the field |
| 110 | 110 | * @param string an alias |
| 111 | - * @return object |
|
| 111 | + * @return CI_DB_active_record |
|
| 112 | 112 | */ |
| 113 | 113 | public function select_max($select = '', $alias = '') |
| 114 | 114 | { |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @param string the field |
| 126 | 126 | * @param string an alias |
| 127 | - * @return object |
|
| 127 | + * @return CI_DB_active_record |
|
| 128 | 128 | */ |
| 129 | 129 | public function select_min($select = '', $alias = '') |
| 130 | 130 | { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @param string the field |
| 142 | 142 | * @param string an alias |
| 143 | - * @return object |
|
| 143 | + * @return CI_DB_active_record |
|
| 144 | 144 | */ |
| 145 | 145 | public function select_avg($select = '', $alias = '') |
| 146 | 146 | { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * |
| 157 | 157 | * @param string the field |
| 158 | 158 | * @param string an alias |
| 159 | - * @return object |
|
| 159 | + * @return CI_DB_active_record |
|
| 160 | 160 | */ |
| 161 | 161 | public function select_sum($select = '', $alias = '') |
| 162 | 162 | { |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * |
| 176 | 176 | * @param string the field |
| 177 | 177 | * @param string an alias |
| 178 | - * @return object |
|
| 178 | + * @return CI_DB_active_record |
|
| 179 | 179 | */ |
| 180 | 180 | protected function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX') |
| 181 | 181 | { |
@@ -215,6 +215,7 @@ discard block |
||
| 215 | 215 | * Determines the alias name based on the table |
| 216 | 216 | * |
| 217 | 217 | * @param string |
| 218 | + * @param string $item |
|
| 218 | 219 | * @return string |
| 219 | 220 | */ |
| 220 | 221 | protected function _create_alias_from_table($item) |
@@ -235,7 +236,7 @@ discard block |
||
| 235 | 236 | * Sets a flag which tells the query string compiler to add DISTINCT |
| 236 | 237 | * |
| 237 | 238 | * @param bool |
| 238 | - * @return object |
|
| 239 | + * @return CI_DB_active_record |
|
| 239 | 240 | */ |
| 240 | 241 | public function distinct($val = TRUE) |
| 241 | 242 | { |
@@ -251,7 +252,8 @@ discard block |
||
| 251 | 252 | * Generates the FROM portion of the query |
| 252 | 253 | * |
| 253 | 254 | * @param mixed can be a string or array |
| 254 | - * @return object |
|
| 255 | + * @param string $from |
|
| 256 | + * @return CI_DB_active_record |
|
| 255 | 257 | */ |
| 256 | 258 | public function from($from) |
| 257 | 259 | { |
@@ -305,7 +307,7 @@ discard block |
||
| 305 | 307 | * @param string |
| 306 | 308 | * @param string the join condition |
| 307 | 309 | * @param string the type of join |
| 308 | - * @return object |
|
| 310 | + * @return CI_DB_active_record |
|
| 309 | 311 | */ |
| 310 | 312 | public function join($table, $cond, $type = '') |
| 311 | 313 | { |
@@ -359,7 +361,7 @@ discard block |
||
| 359 | 361 | * |
| 360 | 362 | * @param mixed |
| 361 | 363 | * @param mixed |
| 362 | - * @return object |
|
| 364 | + * @return CI_DB_active_record |
|
| 363 | 365 | */ |
| 364 | 366 | public function where($key, $value = NULL, $escape = TRUE) |
| 365 | 367 | { |
@@ -376,7 +378,7 @@ discard block |
||
| 376 | 378 | * |
| 377 | 379 | * @param mixed |
| 378 | 380 | * @param mixed |
| 379 | - * @return object |
|
| 381 | + * @return CI_DB_active_record |
|
| 380 | 382 | */ |
| 381 | 383 | public function or_where($key, $value = NULL, $escape = TRUE) |
| 382 | 384 | { |
@@ -393,7 +395,8 @@ discard block |
||
| 393 | 395 | * @param mixed |
| 394 | 396 | * @param mixed |
| 395 | 397 | * @param string |
| 396 | - * @return object |
|
| 398 | + * @param boolean $escape |
|
| 399 | + * @return CI_DB_active_record |
|
| 397 | 400 | */ |
| 398 | 401 | protected function _where($key, $value = NULL, $type = 'AND ', $escape = NULL) |
| 399 | 402 | { |
@@ -460,7 +463,7 @@ discard block |
||
| 460 | 463 | * |
| 461 | 464 | * @param string The field to search |
| 462 | 465 | * @param array The values searched on |
| 463 | - * @return object |
|
| 466 | + * @return null|CI_DB_active_record |
|
| 464 | 467 | */ |
| 465 | 468 | public function where_in($key = NULL, $values = NULL) |
| 466 | 469 | { |
@@ -477,7 +480,7 @@ discard block |
||
| 477 | 480 | * |
| 478 | 481 | * @param string The field to search |
| 479 | 482 | * @param array The values searched on |
| 480 | - * @return object |
|
| 483 | + * @return null|CI_DB_active_record |
|
| 481 | 484 | */ |
| 482 | 485 | public function or_where_in($key = NULL, $values = NULL) |
| 483 | 486 | { |
@@ -494,7 +497,7 @@ discard block |
||
| 494 | 497 | * |
| 495 | 498 | * @param string The field to search |
| 496 | 499 | * @param array The values searched on |
| 497 | - * @return object |
|
| 500 | + * @return null|CI_DB_active_record |
|
| 498 | 501 | */ |
| 499 | 502 | public function where_not_in($key = NULL, $values = NULL) |
| 500 | 503 | { |
@@ -511,7 +514,7 @@ discard block |
||
| 511 | 514 | * |
| 512 | 515 | * @param string The field to search |
| 513 | 516 | * @param array The values searched on |
| 514 | - * @return object |
|
| 517 | + * @return null|CI_DB_active_record |
|
| 515 | 518 | */ |
| 516 | 519 | public function or_where_not_in($key = NULL, $values = NULL) |
| 517 | 520 | { |
@@ -529,7 +532,7 @@ discard block |
||
| 529 | 532 | * @param array The values searched on |
| 530 | 533 | * @param boolean If the statement would be IN or NOT IN |
| 531 | 534 | * @param string |
| 532 | - * @return object |
|
| 535 | + * @return null|CI_DB_active_record |
|
| 533 | 536 | */ |
| 534 | 537 | protected function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ') |
| 535 | 538 | { |
@@ -576,7 +579,7 @@ discard block |
||
| 576 | 579 | * |
| 577 | 580 | * @param mixed |
| 578 | 581 | * @param mixed |
| 579 | - * @return object |
|
| 582 | + * @return CI_DB_active_record |
|
| 580 | 583 | */ |
| 581 | 584 | public function like($field, $match = '', $side = 'both') |
| 582 | 585 | { |
@@ -593,7 +596,7 @@ discard block |
||
| 593 | 596 | * |
| 594 | 597 | * @param mixed |
| 595 | 598 | * @param mixed |
| 596 | - * @return object |
|
| 599 | + * @return CI_DB_active_record |
|
| 597 | 600 | */ |
| 598 | 601 | public function not_like($field, $match = '', $side = 'both') |
| 599 | 602 | { |
@@ -610,7 +613,7 @@ discard block |
||
| 610 | 613 | * |
| 611 | 614 | * @param mixed |
| 612 | 615 | * @param mixed |
| 613 | - * @return object |
|
| 616 | + * @return CI_DB_active_record |
|
| 614 | 617 | */ |
| 615 | 618 | public function or_like($field, $match = '', $side = 'both') |
| 616 | 619 | { |
@@ -627,7 +630,7 @@ discard block |
||
| 627 | 630 | * |
| 628 | 631 | * @param mixed |
| 629 | 632 | * @param mixed |
| 630 | - * @return object |
|
| 633 | + * @return CI_DB_active_record |
|
| 631 | 634 | */ |
| 632 | 635 | public function or_not_like($field, $match = '', $side = 'both') |
| 633 | 636 | { |
@@ -645,7 +648,7 @@ discard block |
||
| 645 | 648 | * @param mixed |
| 646 | 649 | * @param mixed |
| 647 | 650 | * @param string |
| 648 | - * @return object |
|
| 651 | + * @return CI_DB_active_record |
|
| 649 | 652 | */ |
| 650 | 653 | protected function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '') |
| 651 | 654 | { |
@@ -698,7 +701,7 @@ discard block |
||
| 698 | 701 | * GROUP BY |
| 699 | 702 | * |
| 700 | 703 | * @param string |
| 701 | - * @return object |
|
| 704 | + * @return CI_DB_active_record |
|
| 702 | 705 | */ |
| 703 | 706 | public function group_by($by) |
| 704 | 707 | { |
@@ -734,7 +737,7 @@ discard block |
||
| 734 | 737 | * |
| 735 | 738 | * @param string |
| 736 | 739 | * @param string |
| 737 | - * @return object |
|
| 740 | + * @return CI_DB_active_record |
|
| 738 | 741 | */ |
| 739 | 742 | public function having($key, $value = '', $escape = TRUE) |
| 740 | 743 | { |
@@ -750,7 +753,7 @@ discard block |
||
| 750 | 753 | * |
| 751 | 754 | * @param string |
| 752 | 755 | * @param string |
| 753 | - * @return object |
|
| 756 | + * @return CI_DB_active_record |
|
| 754 | 757 | */ |
| 755 | 758 | public function or_having($key, $value = '', $escape = TRUE) |
| 756 | 759 | { |
@@ -766,7 +769,7 @@ discard block |
||
| 766 | 769 | * |
| 767 | 770 | * @param string |
| 768 | 771 | * @param string |
| 769 | - * @return object |
|
| 772 | + * @return CI_DB_active_record |
|
| 770 | 773 | */ |
| 771 | 774 | protected function _having($key, $value = '', $type = 'AND ', $escape = TRUE) |
| 772 | 775 | { |
@@ -812,7 +815,7 @@ discard block |
||
| 812 | 815 | * |
| 813 | 816 | * @param string |
| 814 | 817 | * @param string direction: asc or desc |
| 815 | - * @return object |
|
| 818 | + * @return CI_DB_active_record |
|
| 816 | 819 | */ |
| 817 | 820 | public function order_by($orderby, $direction = '') |
| 818 | 821 | { |
@@ -867,7 +870,7 @@ discard block |
||
| 867 | 870 | * |
| 868 | 871 | * @param integer the limit value |
| 869 | 872 | * @param integer the offset value |
| 870 | - * @return object |
|
| 873 | + * @return CI_DB_active_record |
|
| 871 | 874 | */ |
| 872 | 875 | public function limit($value, $offset = '') |
| 873 | 876 | { |
@@ -887,7 +890,7 @@ discard block |
||
| 887 | 890 | * Sets the OFFSET value |
| 888 | 891 | * |
| 889 | 892 | * @param integer the offset value |
| 890 | - * @return object |
|
| 893 | + * @return CI_DB_active_record |
|
| 891 | 894 | */ |
| 892 | 895 | public function offset($offset) |
| 893 | 896 | { |
@@ -903,7 +906,7 @@ discard block |
||
| 903 | 906 | * @param mixed |
| 904 | 907 | * @param string |
| 905 | 908 | * @param boolean |
| 906 | - * @return object |
|
| 909 | + * @return CI_DB_active_record |
|
| 907 | 910 | */ |
| 908 | 911 | public function set($key, $value = '', $escape = TRUE) |
| 909 | 912 | { |
@@ -969,7 +972,7 @@ discard block |
||
| 969 | 972 | * returned by an Active Record query. |
| 970 | 973 | * |
| 971 | 974 | * @param string |
| 972 | - * @return string |
|
| 975 | + * @return integer |
|
| 973 | 976 | */ |
| 974 | 977 | public function count_all_results($table = '') |
| 975 | 978 | { |
@@ -1096,7 +1099,7 @@ discard block |
||
| 1096 | 1099 | * @param mixed |
| 1097 | 1100 | * @param string |
| 1098 | 1101 | * @param boolean |
| 1099 | - * @return object |
|
| 1102 | + * @return null|CI_DB_active_record |
|
| 1100 | 1103 | */ |
| 1101 | 1104 | public function set_insert_batch($key, $value = '', $escape = TRUE) |
| 1102 | 1105 | { |
@@ -2016,138 +2016,138 @@ |
||
| 2016 | 2016 | |
| 2017 | 2017 | |
| 2018 | 2018 | /** |
| 2019 | - * Insert__Update_Batch |
|
| 2020 | - * |
|
| 2021 | - * Compiles an on duplicate key update string and runs the query |
|
| 2022 | - * |
|
| 2023 | - * @since 1.6.2 |
|
| 2024 | - * @access public |
|
| 2025 | - * @param string the table to retrieve the results from |
|
| 2026 | - * @param array an associative array of update value |
|
| 2027 | - * @return object */ |
|
| 2028 | - public function insert_update_batch($table = '', $set = NULL) |
|
| 2029 | - { |
|
| 2030 | - if ( ! is_null($set)) |
|
| 2031 | - { |
|
| 2032 | - $this->set($set); |
|
| 2033 | - } |
|
| 2034 | - |
|
| 2035 | - if (count($this->ar_set) == 0) |
|
| 2036 | - { |
|
| 2037 | - if ($this->db_debug) |
|
| 2038 | - { |
|
| 2039 | - return $this->display_error('db_must_use_set'); |
|
| 2040 | - } |
|
| 2041 | - return FALSE; |
|
| 2042 | - } |
|
| 2043 | - |
|
| 2044 | - if ($table == '') |
|
| 2045 | - { |
|
| 2046 | - if ( ! isset($this->ar_from[0])) |
|
| 2047 | - { |
|
| 2048 | - if ($this->db_debug) |
|
| 2049 | - { |
|
| 2050 | - return $this->display_error('db_must_set_table'); |
|
| 2051 | - } |
|
| 2052 | - return FALSE; |
|
| 2053 | - } |
|
| 2019 | + * Insert__Update_Batch |
|
| 2020 | + * |
|
| 2021 | + * Compiles an on duplicate key update string and runs the query |
|
| 2022 | + * |
|
| 2023 | + * @since 1.6.2 |
|
| 2024 | + * @access public |
|
| 2025 | + * @param string the table to retrieve the results from |
|
| 2026 | + * @param array an associative array of update value |
|
| 2027 | + * @return object */ |
|
| 2028 | + public function insert_update_batch($table = '', $set = NULL) |
|
| 2029 | + { |
|
| 2030 | + if ( ! is_null($set)) |
|
| 2031 | + { |
|
| 2032 | + $this->set($set); |
|
| 2033 | + } |
|
| 2034 | + |
|
| 2035 | + if (count($this->ar_set) == 0) |
|
| 2036 | + { |
|
| 2037 | + if ($this->db_debug) |
|
| 2038 | + { |
|
| 2039 | + return $this->display_error('db_must_use_set'); |
|
| 2040 | + } |
|
| 2041 | + return FALSE; |
|
| 2042 | + } |
|
| 2043 | + |
|
| 2044 | + if ($table == '') |
|
| 2045 | + { |
|
| 2046 | + if ( ! isset($this->ar_from[0])) |
|
| 2047 | + { |
|
| 2048 | + if ($this->db_debug) |
|
| 2049 | + { |
|
| 2050 | + return $this->display_error('db_must_set_table'); |
|
| 2051 | + } |
|
| 2052 | + return FALSE; |
|
| 2053 | + } |
|
| 2054 | 2054 | |
| 2055 | - $table = $this->ar_from[0]; |
|
| 2056 | - } |
|
| 2055 | + $table = $this->ar_from[0]; |
|
| 2056 | + } |
|
| 2057 | 2057 | |
| 2058 | 2058 | |
| 2059 | 2059 | // $sql = $this->_insert_update_batch($this->_protect_identifiers($this->dbprefix.$table), $this->ar_set ); |
| 2060 | 2060 | for ($i = 1, $total = count($this->ar_set); $i < $total; $i++) |
| 2061 | 2061 | { |
| 2062 | 2062 | |
| 2063 | - $sql = $this->_insert_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_set[$this->_protect_identifiers($i)]); |
|
| 2063 | + $sql = $this->_insert_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_set[$this->_protect_identifiers($i)]); |
|
| 2064 | 2064 | |
| 2065 | 2065 | //echo $sql; |
| 2066 | 2066 | |
| 2067 | 2067 | $this->query($sql); |
| 2068 | 2068 | } |
| 2069 | 2069 | |
| 2070 | - $this->_reset_write(); |
|
| 2071 | - return $this->query($sql); |
|
| 2072 | - } |
|
| 2070 | + $this->_reset_write(); |
|
| 2071 | + return $this->query($sql); |
|
| 2072 | + } |
|
| 2073 | 2073 | |
| 2074 | 2074 | |
| 2075 | 2075 | |
| 2076 | 2076 | /** |
| 2077 | - * Insert_On_Duplicate_Update_Batch |
|
| 2078 | - * |
|
| 2079 | - * Compiles batch insert strings and runs the queries |
|
| 2080 | - * MODIFIED to do a MySQL 'ON DUPLICATE KEY UPDATE' |
|
| 2081 | - * |
|
| 2082 | - * @access public |
|
| 2083 | - * @param string the table to retrieve the results from |
|
| 2084 | - * @param array an associative array of insert values |
|
| 2085 | - * @return object |
|
| 2086 | - */ |
|
| 2087 | - function insert_on_duplicate_update_batch($table = '', $set = NULL) |
|
| 2088 | - { |
|
| 2089 | - if ( ! is_null($set)) |
|
| 2090 | - { |
|
| 2091 | - $this->set_insert_batch($set); |
|
| 2092 | - } |
|
| 2077 | + * Insert_On_Duplicate_Update_Batch |
|
| 2078 | + * |
|
| 2079 | + * Compiles batch insert strings and runs the queries |
|
| 2080 | + * MODIFIED to do a MySQL 'ON DUPLICATE KEY UPDATE' |
|
| 2081 | + * |
|
| 2082 | + * @access public |
|
| 2083 | + * @param string the table to retrieve the results from |
|
| 2084 | + * @param array an associative array of insert values |
|
| 2085 | + * @return object |
|
| 2086 | + */ |
|
| 2087 | + function insert_on_duplicate_update_batch($table = '', $set = NULL) |
|
| 2088 | + { |
|
| 2089 | + if ( ! is_null($set)) |
|
| 2090 | + { |
|
| 2091 | + $this->set_insert_batch($set); |
|
| 2092 | + } |
|
| 2093 | 2093 | |
| 2094 | - if (count($this->ar_set) == 0) |
|
| 2095 | - { |
|
| 2096 | - if ($this->db_debug) |
|
| 2097 | - { |
|
| 2098 | - //No valid data array. Folds in cases where keys and values did not match up |
|
| 2099 | - return $this->display_error('db_must_use_set'); |
|
| 2100 | - } |
|
| 2101 | - return FALSE; |
|
| 2102 | - } |
|
| 2103 | - |
|
| 2104 | - if ($table == '') |
|
| 2105 | - { |
|
| 2106 | - if ( ! isset($this->ar_from[0])) |
|
| 2107 | - { |
|
| 2108 | - if ($this->db_debug) |
|
| 2109 | - { |
|
| 2110 | - return $this->display_error('db_must_set_table'); |
|
| 2111 | - } |
|
| 2112 | - return FALSE; |
|
| 2113 | - } |
|
| 2114 | - |
|
| 2115 | - $table = $this->ar_from[0]; |
|
| 2116 | - } |
|
| 2117 | - // Batch this baby |
|
| 2118 | - for ($i = 0, $total = count($this->ar_set); $i < $total; $i = $i + 500) |
|
| 2119 | - { |
|
| 2120 | - $sql = $this->_insert_on_duplicate_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_keys, array_slice($this->ar_set, $i, 500)); |
|
| 2121 | - |
|
| 2122 | - // echo $sql; |
|
| 2123 | - $this->query($sql); |
|
| 2124 | - } |
|
| 2125 | - $this->_reset_write(); |
|
| 2126 | - return TRUE; |
|
| 2127 | - } |
|
| 2094 | + if (count($this->ar_set) == 0) |
|
| 2095 | + { |
|
| 2096 | + if ($this->db_debug) |
|
| 2097 | + { |
|
| 2098 | + //No valid data array. Folds in cases where keys and values did not match up |
|
| 2099 | + return $this->display_error('db_must_use_set'); |
|
| 2100 | + } |
|
| 2101 | + return FALSE; |
|
| 2102 | + } |
|
| 2103 | + |
|
| 2104 | + if ($table == '') |
|
| 2105 | + { |
|
| 2106 | + if ( ! isset($this->ar_from[0])) |
|
| 2107 | + { |
|
| 2108 | + if ($this->db_debug) |
|
| 2109 | + { |
|
| 2110 | + return $this->display_error('db_must_set_table'); |
|
| 2111 | + } |
|
| 2112 | + return FALSE; |
|
| 2113 | + } |
|
| 2114 | + |
|
| 2115 | + $table = $this->ar_from[0]; |
|
| 2116 | + } |
|
| 2117 | + // Batch this baby |
|
| 2118 | + for ($i = 0, $total = count($this->ar_set); $i < $total; $i = $i + 500) |
|
| 2119 | + { |
|
| 2120 | + $sql = $this->_insert_on_duplicate_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_keys, array_slice($this->ar_set, $i, 500)); |
|
| 2121 | + |
|
| 2122 | + // echo $sql; |
|
| 2123 | + $this->query($sql); |
|
| 2124 | + } |
|
| 2125 | + $this->_reset_write(); |
|
| 2126 | + return TRUE; |
|
| 2127 | + } |
|
| 2128 | 2128 | |
| 2129 | 2129 | |
| 2130 | 2130 | |
| 2131 | 2131 | |
| 2132 | 2132 | /** |
| 2133 | - * Insert_on_duplicate_update_batch statement |
|
| 2134 | - * |
|
| 2135 | - * Generates a platform-specific insert string from the supplied data |
|
| 2136 | - * MODIFIED to include ON DUPLICATE UPDATE |
|
| 2137 | - * |
|
| 2138 | - * @access public |
|
| 2139 | - * @param string the table name |
|
| 2140 | - * @param array the insert keys |
|
| 2141 | - * @param array the insert values |
|
| 2142 | - * @return string |
|
| 2143 | - */ |
|
| 2144 | - function _insert_on_duplicate_update_batch($table, $keys, $values) |
|
| 2145 | - { |
|
| 2146 | - foreach($keys as $key) |
|
| 2147 | - $update_fields[] = $key.'=VALUES('.$key.')'; |
|
| 2133 | + * Insert_on_duplicate_update_batch statement |
|
| 2134 | + * |
|
| 2135 | + * Generates a platform-specific insert string from the supplied data |
|
| 2136 | + * MODIFIED to include ON DUPLICATE UPDATE |
|
| 2137 | + * |
|
| 2138 | + * @access public |
|
| 2139 | + * @param string the table name |
|
| 2140 | + * @param array the insert keys |
|
| 2141 | + * @param array the insert values |
|
| 2142 | + * @return string |
|
| 2143 | + */ |
|
| 2144 | + function _insert_on_duplicate_update_batch($table, $keys, $values) |
|
| 2145 | + { |
|
| 2146 | + foreach($keys as $key) |
|
| 2147 | + $update_fields[] = $key.'=VALUES('.$key.')'; |
|
| 2148 | 2148 | |
| 2149 | - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values)." ON DUPLICATE KEY UPDATE ".implode(', ', $update_fields); |
|
| 2150 | - } |
|
| 2149 | + return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values)." ON DUPLICATE KEY UPDATE ".implode(', ', $update_fields); |
|
| 2150 | + } |
|
| 2151 | 2151 | |
| 2152 | 2152 | |
| 2153 | 2153 | /** |
@@ -28,26 +28,26 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | class CI_DB_active_record extends CI_DB_driver { |
| 30 | 30 | |
| 31 | - var $ar_select = array(); |
|
| 32 | - var $ar_distinct = FALSE; |
|
| 31 | + var $ar_select = array(); |
|
| 32 | + var $ar_distinct = FALSE; |
|
| 33 | 33 | var $ar_from = array(); |
| 34 | 34 | var $ar_join = array(); |
| 35 | - var $ar_where = array(); |
|
| 35 | + var $ar_where = array(); |
|
| 36 | 36 | var $ar_like = array(); |
| 37 | - var $ar_groupby = array(); |
|
| 37 | + var $ar_groupby = array(); |
|
| 38 | 38 | var $ar_having = array(); |
| 39 | 39 | var $ar_keys = array(); |
| 40 | 40 | var $ar_limit = FALSE; |
| 41 | 41 | var $ar_offset = FALSE; |
| 42 | 42 | var $ar_order = FALSE; |
| 43 | 43 | var $ar_orderby = array(); |
| 44 | - var $ar_set = array(); |
|
| 44 | + var $ar_set = array(); |
|
| 45 | 45 | var $ar_wherein = array(); |
| 46 | - var $ar_aliased_tables = array(); |
|
| 47 | - var $ar_store_array = array(); |
|
| 46 | + var $ar_aliased_tables = array(); |
|
| 47 | + var $ar_store_array = array(); |
|
| 48 | 48 | |
| 49 | 49 | // Active Record Caching variables |
| 50 | - var $ar_caching = FALSE; |
|
| 50 | + var $ar_caching = FALSE; |
|
| 51 | 51 | var $ar_cache_exists = array(); |
| 52 | 52 | var $ar_cache_select = array(); |
| 53 | 53 | var $ar_cache_from = array(); |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | var $ar_cache_groupby = array(); |
| 58 | 58 | var $ar_cache_having = array(); |
| 59 | 59 | var $ar_cache_orderby = array(); |
| 60 | - var $ar_cache_set = array(); |
|
| 60 | + var $ar_cache_set = array(); |
|
| 61 | 61 | |
| 62 | - var $ar_no_escape = array(); |
|
| 63 | - var $ar_cache_no_escape = array(); |
|
| 62 | + var $ar_no_escape = array(); |
|
| 63 | + var $ar_cache_no_escape = array(); |
|
| 64 | 64 | |
| 65 | 65 | // -------------------------------------------------------------------- |
| 66 | 66 | |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | $prefix = (count($this->ar_where) == 0) ? '' : $type; |
| 554 | 554 | |
| 555 | - $where_in = $prefix . $this->_protect_identifiers($key) . $not . " IN (" . implode(", ", $this->ar_wherein) . ") "; |
|
| 555 | + $where_in = $prefix.$this->_protect_identifiers($key).$not." IN (".implode(", ", $this->ar_wherein).") "; |
|
| 556 | 556 | |
| 557 | 557 | $this->ar_where[] = $where_in; |
| 558 | 558 | if ($this->ar_caching === TRUE) |
@@ -871,11 +871,11 @@ discard block |
||
| 871 | 871 | */ |
| 872 | 872 | public function limit($value, $offset = '') |
| 873 | 873 | { |
| 874 | - $this->ar_limit = (int) $value; |
|
| 874 | + $this->ar_limit = (int)$value; |
|
| 875 | 875 | |
| 876 | 876 | if ($offset != '') |
| 877 | 877 | { |
| 878 | - $this->ar_offset = (int) $offset; |
|
| 878 | + $this->ar_offset = (int)$offset; |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | return $this; |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | $this->from($table); |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | - $sql = $this->_compile_select($this->_count_string . $this->_protect_identifiers('numrows')); |
|
| 982 | + $sql = $this->_compile_select($this->_count_string.$this->_protect_identifiers('numrows')); |
|
| 983 | 983 | |
| 984 | 984 | $query = $this->query($sql); |
| 985 | 985 | $this->_reset_select(); |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | $row = $query->row(); |
| 993 | - return (int) $row->numrows; |
|
| 993 | + return (int)$row->numrows; |
|
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | // -------------------------------------------------------------------- |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | |
| 1124 | 1124 | if ($escape === FALSE) |
| 1125 | 1125 | { |
| 1126 | - $this->ar_set[] = '('.implode(',', $row).')'; |
|
| 1126 | + $this->ar_set[] = '('.implode(',', $row).')'; |
|
| 1127 | 1127 | } |
| 1128 | 1128 | else |
| 1129 | 1129 | { |
@@ -1134,7 +1134,7 @@ discard block |
||
| 1134 | 1134 | $clean[] = $this->escape($value); |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | - $this->ar_set[] = '('.implode(',', $clean).')'; |
|
| 1137 | + $this->ar_set[] = '('.implode(',', $clean).')'; |
|
| 1138 | 1138 | } |
| 1139 | 1139 | } |
| 1140 | 1140 | |
@@ -1942,8 +1942,8 @@ discard block |
||
| 1942 | 1942 | |
| 1943 | 1943 | foreach ($this->ar_cache_exists as $val) |
| 1944 | 1944 | { |
| 1945 | - $ar_variable = 'ar_'.$val; |
|
| 1946 | - $ar_cache_var = 'ar_cache_'.$val; |
|
| 1945 | + $ar_variable = 'ar_'.$val; |
|
| 1946 | + $ar_cache_var = 'ar_cache_'.$val; |
|
| 1947 | 1947 | |
| 1948 | 1948 | if (count($this->$ar_cache_var) == 0) |
| 1949 | 1949 | { |
@@ -2143,7 +2143,7 @@ discard block |
||
| 2143 | 2143 | */ |
| 2144 | 2144 | function _insert_on_duplicate_update_batch($table, $keys, $values) |
| 2145 | 2145 | { |
| 2146 | - foreach($keys as $key) |
|
| 2146 | + foreach ($keys as $key) |
|
| 2147 | 2147 | $update_fields[] = $key.'=VALUES('.$key.')'; |
| 2148 | 2148 | |
| 2149 | 2149 | return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values)." ON DUPLICATE KEY UPDATE ".implode(', ', $update_fields); |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -273,8 +275,7 @@ discard block |
||
| 273 | 275 | } |
| 274 | 276 | } |
| 275 | 277 | |
| 276 | - } |
|
| 277 | - else |
|
| 278 | + } else |
|
| 278 | 279 | { |
| 279 | 280 | $val = trim($val); |
| 280 | 281 | |
@@ -316,8 +317,7 @@ discard block |
||
| 316 | 317 | if ( ! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'))) |
| 317 | 318 | { |
| 318 | 319 | $type = ''; |
| 319 | - } |
|
| 320 | - else |
|
| 320 | + } else |
|
| 321 | 321 | { |
| 322 | 322 | $type .= ' '; |
| 323 | 323 | } |
@@ -431,8 +431,7 @@ discard block |
||
| 431 | 431 | { |
| 432 | 432 | $k .= ' = '; |
| 433 | 433 | } |
| 434 | - } |
|
| 435 | - else |
|
| 434 | + } else |
|
| 436 | 435 | { |
| 437 | 436 | $k = $this->_protect_identifiers($k, FALSE, $escape); |
| 438 | 437 | } |
@@ -665,12 +664,10 @@ discard block |
||
| 665 | 664 | if ($side == 'before') |
| 666 | 665 | { |
| 667 | 666 | $like_statement = $prefix." $k $not LIKE '%{$v}'"; |
| 668 | - } |
|
| 669 | - elseif ($side == 'after') |
|
| 667 | + } elseif ($side == 'after') |
|
| 670 | 668 | { |
| 671 | 669 | $like_statement = $prefix." $k $not LIKE '{$v}%'"; |
| 672 | - } |
|
| 673 | - else |
|
| 670 | + } else |
|
| 674 | 671 | { |
| 675 | 672 | $like_statement = $prefix." $k $not LIKE '%{$v}%'"; |
| 676 | 673 | } |
@@ -820,8 +817,7 @@ discard block |
||
| 820 | 817 | { |
| 821 | 818 | $orderby = ''; // Random results want or don't need a field name |
| 822 | 819 | $direction = $this->_random_keyword; |
| 823 | - } |
|
| 824 | - elseif (trim($direction) != '') |
|
| 820 | + } elseif (trim($direction) != '') |
|
| 825 | 821 | { |
| 826 | 822 | $direction = (in_array(strtoupper(trim($direction)), array('ASC', 'DESC'), TRUE)) ? ' '.$direction : ' ASC'; |
| 827 | 823 | } |
@@ -842,8 +838,7 @@ discard block |
||
| 842 | 838 | } |
| 843 | 839 | |
| 844 | 840 | $orderby = implode(', ', $temp); |
| 845 | - } |
|
| 846 | - else if ($direction != $this->_random_keyword) |
|
| 841 | + } else if ($direction != $this->_random_keyword) |
|
| 847 | 842 | { |
| 848 | 843 | $orderby = $this->_protect_identifiers($orderby); |
| 849 | 844 | } |
@@ -919,8 +914,7 @@ discard block |
||
| 919 | 914 | if ($escape === FALSE) |
| 920 | 915 | { |
| 921 | 916 | $this->ar_set[$this->_protect_identifiers($k)] = $v; |
| 922 | - } |
|
| 923 | - else |
|
| 917 | + } else |
|
| 924 | 918 | { |
| 925 | 919 | $this->ar_set[$this->_protect_identifiers($k, FALSE, TRUE)] = $this->escape($v); |
| 926 | 920 | } |
@@ -1124,8 +1118,7 @@ discard block |
||
| 1124 | 1118 | if ($escape === FALSE) |
| 1125 | 1119 | { |
| 1126 | 1120 | $this->ar_set[] = '('.implode(',', $row).')'; |
| 1127 | - } |
|
| 1128 | - else |
|
| 1121 | + } else |
|
| 1129 | 1122 | { |
| 1130 | 1123 | $clean = array(); |
| 1131 | 1124 | |
@@ -1398,8 +1391,7 @@ discard block |
||
| 1398 | 1391 | if ($k2 == $index) |
| 1399 | 1392 | { |
| 1400 | 1393 | $index_set = TRUE; |
| 1401 | - } |
|
| 1402 | - else |
|
| 1394 | + } else |
|
| 1403 | 1395 | { |
| 1404 | 1396 | $not[] = $k.'-'.$v; |
| 1405 | 1397 | } |
@@ -1407,8 +1399,7 @@ discard block |
||
| 1407 | 1399 | if ($escape === FALSE) |
| 1408 | 1400 | { |
| 1409 | 1401 | $clean[$this->_protect_identifiers($k2)] = $v2; |
| 1410 | - } |
|
| 1411 | - else |
|
| 1402 | + } else |
|
| 1412 | 1403 | { |
| 1413 | 1404 | $clean[$this->_protect_identifiers($k2)] = $this->escape($v2); |
| 1414 | 1405 | } |
@@ -1449,8 +1440,7 @@ discard block |
||
| 1449 | 1440 | } |
| 1450 | 1441 | |
| 1451 | 1442 | $table = $this->ar_from[0]; |
| 1452 | - } |
|
| 1453 | - else |
|
| 1443 | + } else |
|
| 1454 | 1444 | { |
| 1455 | 1445 | $table = $this->_protect_identifiers($table, TRUE, NULL, FALSE); |
| 1456 | 1446 | } |
@@ -1488,8 +1478,7 @@ discard block |
||
| 1488 | 1478 | } |
| 1489 | 1479 | |
| 1490 | 1480 | $table = $this->ar_from[0]; |
| 1491 | - } |
|
| 1492 | - else |
|
| 1481 | + } else |
|
| 1493 | 1482 | { |
| 1494 | 1483 | $table = $this->_protect_identifiers($table, TRUE, NULL, FALSE); |
| 1495 | 1484 | } |
@@ -1531,8 +1520,7 @@ discard block |
||
| 1531 | 1520 | } |
| 1532 | 1521 | |
| 1533 | 1522 | $table = $this->ar_from[0]; |
| 1534 | - } |
|
| 1535 | - elseif (is_array($table)) |
|
| 1523 | + } elseif (is_array($table)) |
|
| 1536 | 1524 | { |
| 1537 | 1525 | foreach ($table as $single_table) |
| 1538 | 1526 | { |
@@ -1541,8 +1529,7 @@ discard block |
||
| 1541 | 1529 | |
| 1542 | 1530 | $this->_reset_write(); |
| 1543 | 1531 | return; |
| 1544 | - } |
|
| 1545 | - else |
|
| 1532 | + } else |
|
| 1546 | 1533 | { |
| 1547 | 1534 | $table = $this->_protect_identifiers($table, TRUE, NULL, FALSE); |
| 1548 | 1535 | } |
@@ -1679,16 +1666,14 @@ discard block |
||
| 1679 | 1666 | if ($select_override !== FALSE) |
| 1680 | 1667 | { |
| 1681 | 1668 | $sql = $select_override; |
| 1682 | - } |
|
| 1683 | - else |
|
| 1669 | + } else |
|
| 1684 | 1670 | { |
| 1685 | 1671 | $sql = ( ! $this->ar_distinct) ? 'SELECT ' : 'SELECT DISTINCT '; |
| 1686 | 1672 | |
| 1687 | 1673 | if (count($this->ar_select) == 0) |
| 1688 | 1674 | { |
| 1689 | 1675 | $sql .= '*'; |
| 1690 | - } |
|
| 1691 | - else |
|
| 1676 | + } else |
|
| 1692 | 1677 | { |
| 1693 | 1678 | // Cycle through the "select" portion of the query and prep each column name. |
| 1694 | 1679 | // The reason we protect identifiers here rather then in the select() function |
@@ -2143,8 +2128,9 @@ discard block |
||
| 2143 | 2128 | */ |
| 2144 | 2129 | function _insert_on_duplicate_update_batch($table, $keys, $values) |
| 2145 | 2130 | { |
| 2146 | - foreach($keys as $key) |
|
| 2147 | - $update_fields[] = $key.'=VALUES('.$key.')'; |
|
| 2131 | + foreach($keys as $key) { |
|
| 2132 | + $update_fields[] = $key.'=VALUES('.$key.')'; |
|
| 2133 | + } |
|
| 2148 | 2134 | |
| 2149 | 2135 | return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values)." ON DUPLICATE KEY UPDATE ".implode(', ', $update_fields); |
| 2150 | 2136 | } |
@@ -32,6 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * Grabs the CI super object instance so we can access it. |
| 34 | 34 | * |
| 35 | + * @param CI_DB_driver $db |
|
| 35 | 36 | */ |
| 36 | 37 | function __construct(&$db) |
| 37 | 38 | { |
@@ -115,6 +116,7 @@ discard block |
||
| 115 | 116 | * |
| 116 | 117 | * @access public |
| 117 | 118 | * @return bool |
| 119 | + * @param CI_DB_result $object |
|
| 118 | 120 | */ |
| 119 | 121 | function write($sql, $object) |
| 120 | 122 | { |
@@ -156,7 +158,7 @@ discard block |
||
| 156 | 158 | * Delete cache files within a particular directory |
| 157 | 159 | * |
| 158 | 160 | * @access public |
| 159 | - * @return bool |
|
| 161 | + * @return boolean|null |
|
| 160 | 162 | */ |
| 161 | 163 | function delete($segment_one = '', $segment_two = '') |
| 162 | 164 | { |
@@ -181,7 +183,7 @@ discard block |
||
| 181 | 183 | * Delete all existing cache files |
| 182 | 184 | * |
| 183 | 185 | * @access public |
| 184 | - * @return bool |
|
| 186 | + * @return boolean|null |
|
| 185 | 187 | */ |
| 186 | 188 | function delete_all() |
| 187 | 189 | { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | class CI_DB_Cache { |
| 26 | 26 | |
| 27 | 27 | var $CI; |
| 28 | - var $db; // allows passing of db object so that multiple database connections and returned db objects can be supported |
|
| 28 | + var $db; // allows passing of db object so that multiple database connections and returned db objects can be supported |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Constructor |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | // Assign the main CI object to $this->CI |
| 39 | 39 | // and load the file helper since we use it a lot |
| 40 | - $this->CI =& get_instance(); |
|
| 41 | - $this->db =& $db; |
|
| 40 | + $this->CI = & get_instance(); |
|
| 41 | + $this->db = & $db; |
|
| 42 | 42 | $this->CI->load->helper('file'); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Add a trailing slash to the path if needed |
| 67 | - $path = preg_replace("/(.+?)\/*$/", "\\1/", $path); |
|
| 67 | + $path = preg_replace("/(.+?)\/*$/", "\\1/", $path); |
|
| 68 | 68 | |
| 69 | 69 | if ( ! is_dir($path) OR ! is_really_writable($path)) |
| 70 | 70 | { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | { |
| 163 | 163 | if ($segment_one == '') |
| 164 | 164 | { |
| 165 | - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); |
|
| 165 | + $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | if ($segment_two == '') |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /* |
| 3 | 5 | | ------------------------------------------------------------------- |
| 4 | 6 | | AUTO-LOADER |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @access private Called by the constructor |
| 100 | 100 | * @param mixed |
| 101 | - * @return void |
|
| 101 | + * @return boolean |
|
| 102 | 102 | */ |
| 103 | 103 | function initialize() |
| 104 | 104 | { |
@@ -164,7 +164,9 @@ discard block |
||
| 164 | 164 | * @access public |
| 165 | 165 | * @param string |
| 166 | 166 | * @param string |
| 167 | - * @return resource |
|
| 167 | + * @param string $charset |
|
| 168 | + * @param string $collation |
|
| 169 | + * @return boolean |
|
| 168 | 170 | */ |
| 169 | 171 | function db_set_charset($charset, $collation) |
| 170 | 172 | { |
@@ -490,7 +492,7 @@ discard block |
||
| 490 | 492 | * Start Transaction |
| 491 | 493 | * |
| 492 | 494 | * @access public |
| 493 | - * @return void |
|
| 495 | + * @return false|null |
|
| 494 | 496 | */ |
| 495 | 497 | function trans_start($test_mode = FALSE) |
| 496 | 498 | { |
@@ -573,6 +575,7 @@ discard block |
||
| 573 | 575 | * @access public |
| 574 | 576 | * @param string the sql statement |
| 575 | 577 | * @param array an array of bind data |
| 578 | + * @param boolean $binds |
|
| 576 | 579 | * @return string |
| 577 | 580 | */ |
| 578 | 581 | function compile_binds($sql, $binds) |
@@ -633,7 +636,7 @@ discard block |
||
| 633 | 636 | * |
| 634 | 637 | * @access public |
| 635 | 638 | * @param integer The number of decimal places |
| 636 | - * @return integer |
|
| 639 | + * @return string |
|
| 637 | 640 | */ |
| 638 | 641 | function elapsed_time($decimals = 6) |
| 639 | 642 | { |
@@ -1040,7 +1043,7 @@ discard block |
||
| 1040 | 1043 | * Enable Query Caching |
| 1041 | 1044 | * |
| 1042 | 1045 | * @access public |
| 1043 | - * @return void |
|
| 1046 | + * @return boolean |
|
| 1044 | 1047 | */ |
| 1045 | 1048 | function cache_on() |
| 1046 | 1049 | { |
@@ -1054,7 +1057,7 @@ discard block |
||
| 1054 | 1057 | * Disable Query Caching |
| 1055 | 1058 | * |
| 1056 | 1059 | * @access public |
| 1057 | - * @return void |
|
| 1060 | + * @return boolean |
|
| 1058 | 1061 | */ |
| 1059 | 1062 | function cache_off() |
| 1060 | 1063 | { |
@@ -1069,7 +1072,7 @@ discard block |
||
| 1069 | 1072 | * Delete the cache files associated with a particular URI |
| 1070 | 1073 | * |
| 1071 | 1074 | * @access public |
| 1072 | - * @return void |
|
| 1075 | + * @return boolean|null |
|
| 1073 | 1076 | */ |
| 1074 | 1077 | function cache_delete($segment_one = '', $segment_two = '') |
| 1075 | 1078 | { |
@@ -1086,7 +1089,7 @@ discard block |
||
| 1086 | 1089 | * Delete All cache files |
| 1087 | 1090 | * |
| 1088 | 1091 | * @access public |
| 1089 | - * @return void |
|
| 1092 | + * @return boolean|null |
|
| 1090 | 1093 | */ |
| 1091 | 1094 | function cache_delete_all() |
| 1092 | 1095 | { |
@@ -1104,7 +1107,7 @@ discard block |
||
| 1104 | 1107 | * Initialize the Cache Class |
| 1105 | 1108 | * |
| 1106 | 1109 | * @access private |
| 1107 | - * @return void |
|
| 1110 | + * @return boolean |
|
| 1108 | 1111 | */ |
| 1109 | 1112 | function _cache_init() |
| 1110 | 1113 | { |
@@ -40,16 +40,16 @@ discard block |
||
| 40 | 40 | var $dbcollat = 'utf8_general_ci'; |
| 41 | 41 | var $autoinit = TRUE; // Whether to automatically initialize the DB |
| 42 | 42 | var $swap_pre = ''; |
| 43 | - var $port = ''; |
|
| 43 | + var $port = ''; |
|
| 44 | 44 | var $pconnect = FALSE; |
| 45 | - var $conn_id = FALSE; |
|
| 45 | + var $conn_id = FALSE; |
|
| 46 | 46 | var $result_id = FALSE; |
| 47 | 47 | var $db_debug = FALSE; |
| 48 | 48 | var $benchmark = 0; |
| 49 | 49 | var $query_count = 0; |
| 50 | 50 | var $bind_marker = '?'; |
| 51 | - var $save_queries = TRUE; |
|
| 52 | - var $queries = array(); |
|
| 51 | + var $save_queries = TRUE; |
|
| 52 | + var $queries = array(); |
|
| 53 | 53 | var $query_times = array(); |
| 54 | 54 | var $data_cache = array(); |
| 55 | 55 | var $trans_enabled = TRUE; |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | var $CACHE; // The cache class object |
| 63 | 63 | |
| 64 | 64 | // Private variables |
| 65 | - var $_protect_identifiers = TRUE; |
|
| 66 | - var $_reserved_identifiers = array('*'); // Identifiers that should NOT be escaped |
|
| 65 | + var $_protect_identifiers = TRUE; |
|
| 66 | + var $_reserved_identifiers = array('*'); // Identifiers that should NOT be escaped |
|
| 67 | 67 | |
| 68 | 68 | // These are use with Oracle |
| 69 | 69 | var $stmt_id; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // Verify table prefix and replace if necessary |
| 263 | - if ( ($this->dbprefix != '' AND $this->swap_pre != '') AND ($this->dbprefix != $this->swap_pre) ) |
|
| 263 | + if (($this->dbprefix != '' AND $this->swap_pre != '') AND ($this->dbprefix != $this->swap_pre)) |
|
| 264 | 264 | { |
| 265 | 265 | $sql = preg_replace("/(\W)".$this->swap_pre."(\S+?)/", "\\1".$this->dbprefix."\\2", $sql); |
| 266 | 266 | } |
@@ -369,21 +369,21 @@ discard block |
||
| 369 | 369 | |
| 370 | 370 | // Load and instantiate the result driver |
| 371 | 371 | |
| 372 | - $driver = $this->load_rdriver(); |
|
| 373 | - $RES = new $driver(); |
|
| 374 | - $RES->conn_id = $this->conn_id; |
|
| 375 | - $RES->result_id = $this->result_id; |
|
| 372 | + $driver = $this->load_rdriver(); |
|
| 373 | + $RES = new $driver(); |
|
| 374 | + $RES->conn_id = $this->conn_id; |
|
| 375 | + $RES->result_id = $this->result_id; |
|
| 376 | 376 | |
| 377 | 377 | if ($this->dbdriver == 'oci8') |
| 378 | 378 | { |
| 379 | 379 | $RES->stmt_id = $this->stmt_id; |
| 380 | 380 | $RES->curs_id = NULL; |
| 381 | - $RES->limit_used = $this->limit_used; |
|
| 382 | - $this->stmt_id = FALSE; |
|
| 381 | + $RES->limit_used = $this->limit_used; |
|
| 382 | + $this->stmt_id = FALSE; |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | // oci8 vars must be set before calling this |
| 386 | - $RES->num_rows = $RES->num_rows(); |
|
| 386 | + $RES->num_rows = $RES->num_rows(); |
|
| 387 | 387 | |
| 388 | 388 | // Is query caching enabled? If so, we'll serialize the |
| 389 | 389 | // result object and save it to a cache file. |
@@ -396,13 +396,13 @@ discard block |
||
| 396 | 396 | // result object, so we'll have to compile the data |
| 397 | 397 | // and save it) |
| 398 | 398 | $CR = new CI_DB_result(); |
| 399 | - $CR->num_rows = $RES->num_rows(); |
|
| 400 | - $CR->result_object = $RES->result_object(); |
|
| 401 | - $CR->result_array = $RES->result_array(); |
|
| 399 | + $CR->num_rows = $RES->num_rows(); |
|
| 400 | + $CR->result_object = $RES->result_object(); |
|
| 401 | + $CR->result_array = $RES->result_array(); |
|
| 402 | 402 | |
| 403 | 403 | // Reset these since cached objects can not utilize resource IDs. |
| 404 | - $CR->conn_id = NULL; |
|
| 405 | - $CR->result_id = NULL; |
|
| 404 | + $CR->conn_id = NULL; |
|
| 405 | + $CR->result_id = NULL; |
|
| 406 | 406 | |
| 407 | 407 | $this->CACHE->write($sql, $CR); |
| 408 | 408 | } |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | // The count of bind should be 1 less then the count of segments |
| 594 | 594 | // If there are more bind arguments trim it down |
| 595 | 595 | if (count($binds) >= count($segments)) { |
| 596 | - $binds = array_slice($binds, 0, count($segments)-1); |
|
| 596 | + $binds = array_slice($binds, 0, count($segments) - 1); |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | // Construct the binded query |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | */ |
| 1156 | 1156 | function display_error($error = '', $swap = '', $native = FALSE) |
| 1157 | 1157 | { |
| 1158 | - $LANG =& load_class('Lang', 'core'); |
|
| 1158 | + $LANG = & load_class('Lang', 'core'); |
|
| 1159 | 1159 | $LANG->load('db'); |
| 1160 | 1160 | |
| 1161 | 1161 | $heading = $LANG->line('db_error_heading'); |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | } |
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | - $error =& load_class('Exceptions', 'core'); |
|
| 1190 | + $error = & load_class('Exceptions', 'core'); |
|
| 1191 | 1191 | echo $error->show_error($heading, $message, 'error_db'); |
| 1192 | 1192 | exit; |
| 1193 | 1193 | } |
@@ -1282,7 +1282,7 @@ discard block |
||
| 1282 | 1282 | // with an alias. While we're at it, we will escape the components |
| 1283 | 1283 | if (strpos($item, '.') !== FALSE) |
| 1284 | 1284 | { |
| 1285 | - $parts = explode('.', $item); |
|
| 1285 | + $parts = explode('.', $item); |
|
| 1286 | 1286 | |
| 1287 | 1287 | // Does the first segment of the exploded item match |
| 1288 | 1288 | // one of the aliases previously identified? If so, |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -140,8 +142,7 @@ discard block |
||
| 140 | 142 | $this->display_error('db_unable_to_select', $this->database); |
| 141 | 143 | } |
| 142 | 144 | return FALSE; |
| 143 | - } |
|
| 144 | - else |
|
| 145 | + } else |
|
| 145 | 146 | { |
| 146 | 147 | // We've selected the DB. Now we set the character set |
| 147 | 148 | if ( ! $this->db_set_charset($this->char_set, $this->dbcollat)) |
@@ -223,8 +224,7 @@ discard block |
||
| 223 | 224 | if (in_array($this->dbdriver, $driver_version_exceptions)) |
| 224 | 225 | { |
| 225 | 226 | return $sql; |
| 226 | - } |
|
| 227 | - else |
|
| 227 | + } else |
|
| 228 | 228 | { |
| 229 | 229 | $query = $this->query($sql); |
| 230 | 230 | return $query->row('ver'); |
@@ -683,12 +683,10 @@ discard block |
||
| 683 | 683 | if (is_string($str)) |
| 684 | 684 | { |
| 685 | 685 | $str = "'".$this->escape_str($str)."'"; |
| 686 | - } |
|
| 687 | - elseif (is_bool($str)) |
|
| 686 | + } elseif (is_bool($str)) |
|
| 688 | 687 | { |
| 689 | 688 | $str = ($str === FALSE) ? 0 : 1; |
| 690 | - } |
|
| 691 | - elseif (is_null($str)) |
|
| 689 | + } elseif (is_null($str)) |
|
| 692 | 690 | { |
| 693 | 691 | $str = 'NULL'; |
| 694 | 692 | } |
@@ -772,8 +770,7 @@ discard block |
||
| 772 | 770 | if (isset($row['TABLE_NAME'])) |
| 773 | 771 | { |
| 774 | 772 | $retval[] = $row['TABLE_NAME']; |
| 775 | - } |
|
| 776 | - else |
|
| 773 | + } else |
|
| 777 | 774 | { |
| 778 | 775 | $retval[] = array_shift($row); |
| 779 | 776 | } |
@@ -839,8 +836,7 @@ discard block |
||
| 839 | 836 | if (isset($row['COLUMN_NAME'])) |
| 840 | 837 | { |
| 841 | 838 | $retval[] = $row['COLUMN_NAME']; |
| 842 | - } |
|
| 843 | - else |
|
| 839 | + } else |
|
| 844 | 840 | { |
| 845 | 841 | $retval[] = current($row); |
| 846 | 842 | } |
@@ -940,8 +936,7 @@ discard block |
||
| 940 | 936 | if ( ! is_array($where)) |
| 941 | 937 | { |
| 942 | 938 | $dest = array($where); |
| 943 | - } |
|
| 944 | - else |
|
| 939 | + } else |
|
| 945 | 940 | { |
| 946 | 941 | $dest = array(); |
| 947 | 942 | foreach ($where as $key => $val) |
@@ -1011,8 +1006,7 @@ discard block |
||
| 1011 | 1006 | return $this->display_error('db_unsupported_function'); |
| 1012 | 1007 | } |
| 1013 | 1008 | return FALSE; |
| 1014 | - } |
|
| 1015 | - else |
|
| 1009 | + } else |
|
| 1016 | 1010 | { |
| 1017 | 1011 | $args = (func_num_args() > 1) ? array_splice(func_get_args(), 1) : null; |
| 1018 | 1012 | |
@@ -1163,8 +1157,7 @@ discard block |
||
| 1163 | 1157 | if ($native == TRUE) |
| 1164 | 1158 | { |
| 1165 | 1159 | $message = $error; |
| 1166 | - } |
|
| 1167 | - else |
|
| 1160 | + } else |
|
| 1168 | 1161 | { |
| 1169 | 1162 | $message = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error; |
| 1170 | 1163 | } |
@@ -229,6 +229,7 @@ |
||
| 229 | 229 | * |
| 230 | 230 | * @access public |
| 231 | 231 | * @return object |
| 232 | + * @param string $type |
|
| 232 | 233 | */ |
| 233 | 234 | public function custom_row_object($n, $type) |
| 234 | 235 | { |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | class CI_DB_result { |
| 30 | 30 | |
| 31 | - var $conn_id = NULL; |
|
| 32 | - var $result_id = NULL; |
|
| 33 | - var $result_array = array(); |
|
| 34 | - var $result_object = array(); |
|
| 35 | - var $custom_result_object = array(); |
|
| 36 | - var $current_row = 0; |
|
| 31 | + var $conn_id = NULL; |
|
| 32 | + var $result_id = NULL; |
|
| 33 | + var $result_array = array(); |
|
| 34 | + var $result_object = array(); |
|
| 35 | + var $custom_result_object = array(); |
|
| 36 | + var $current_row = 0; |
|
| 37 | 37 | var $num_rows = 0; |
| 38 | 38 | var $row_data = NULL; |
| 39 | 39 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | { |
| 332 | 332 | return $result; |
| 333 | 333 | } |
| 334 | - return $result[count($result) -1]; |
|
| 334 | + return $result[count($result) - 1]; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | // -------------------------------------------------------------------- |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -47,9 +49,13 @@ discard block |
||
| 47 | 49 | */ |
| 48 | 50 | public function result($type = 'object') |
| 49 | 51 | { |
| 50 | - if ($type == 'array') return $this->result_array(); |
|
| 51 | - else if ($type == 'object') return $this->result_object(); |
|
| 52 | - else return $this->custom_result_object($type); |
|
| 52 | + if ($type == 'array') { |
|
| 53 | + return $this->result_array(); |
|
| 54 | + } else if ($type == 'object') { |
|
| 55 | + return $this->result_object(); |
|
| 56 | + } else { |
|
| 57 | + return $this->custom_result_object($type); |
|
| 58 | + } |
|
| 53 | 59 | } |
| 54 | 60 | |
| 55 | 61 | // -------------------------------------------------------------------- |
@@ -185,9 +191,13 @@ discard block |
||
| 185 | 191 | $n = 0; |
| 186 | 192 | } |
| 187 | 193 | |
| 188 | - if ($type == 'object') return $this->row_object($n); |
|
| 189 | - else if ($type == 'array') return $this->row_array($n); |
|
| 190 | - else return $this->custom_row_object($n, $type); |
|
| 194 | + if ($type == 'object') { |
|
| 195 | + return $this->row_object($n); |
|
| 196 | + } else if ($type == 'array') { |
|
| 197 | + return $this->row_array($n); |
|
| 198 | + } else { |
|
| 199 | + return $this->custom_row_object($n, $type); |
|
| 200 | + } |
|
| 191 | 201 | } |
| 192 | 202 | |
| 193 | 203 | // -------------------------------------------------------------------- |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @access public |
| 150 | 150 | * @param string |
| 151 | 151 | * @param string |
| 152 | - * @return resource |
|
| 152 | + * @return boolean |
|
| 153 | 153 | */ |
| 154 | 154 | function db_set_charset($charset, $collation) |
| 155 | 155 | { |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | * |
| 382 | 382 | * @access public |
| 383 | 383 | * @param string |
| 384 | - * @return string |
|
| 384 | + * @return integer |
|
| 385 | 385 | */ |
| 386 | 386 | function count_all($table = '') |
| 387 | 387 | { |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | * |
| 451 | 451 | * @access public |
| 452 | 452 | * @param string the table name |
| 453 | - * @return object |
|
| 453 | + * @return string |
|
| 454 | 454 | */ |
| 455 | 455 | function _field_data($table) |
| 456 | 456 | { |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | * |
| 536 | 536 | * @access public |
| 537 | 537 | * @param type |
| 538 | - * @return type |
|
| 538 | + * @return string |
|
| 539 | 539 | */ |
| 540 | 540 | function _from_tables($tables) |
| 541 | 541 | { |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | return 0; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
| 393 | + $query = $this->query($this->_count_string.$this->_protect_identifiers('numrows')." FROM ".$this->_protect_identifiers($table, TRUE, NULL, FALSE)); |
|
| 394 | 394 | |
| 395 | 395 | if ($query->num_rows() == 0) |
| 396 | 396 | { |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | $row = $query->row(); |
| 401 | 401 | $this->_reset_select(); |
| 402 | - return (int) $row->numrows; |
|
| 402 | + return (int)$row->numrows; |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | // -------------------------------------------------------------------- |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | { |
| 506 | 506 | if (strpos($item, '.'.$id) !== FALSE) |
| 507 | 507 | { |
| 508 | - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); |
|
| 508 | + $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item); |
|
| 509 | 509 | |
| 510 | 510 | // remove duplicates if the user already included the escape |
| 511 | 511 | return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); |
@@ -627,11 +627,11 @@ discard block |
||
| 627 | 627 | |
| 628 | 628 | $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; |
| 629 | 629 | |
| 630 | - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; |
|
| 630 | + $orderby = (count($orderby) >= 1) ? ' ORDER BY '.implode(", ", $orderby) : ''; |
|
| 631 | 631 | |
| 632 | 632 | $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); |
| 633 | 633 | |
| 634 | - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; |
|
| 634 | + $sql .= ($where != '' AND count($where) >= 1) ? " WHERE ".implode(" ", $where) : ''; |
|
| 635 | 635 | |
| 636 | 636 | $sql .= $orderby.$limit; |
| 637 | 637 | |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | function _update_batch($table, $values, $index, $where = NULL) |
| 656 | 656 | { |
| 657 | 657 | $ids = array(); |
| 658 | - $where = ($where != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : ''; |
|
| 658 | + $where = ($where != '' AND count($where) >= 1) ? implode(" ", $where).' AND ' : ''; |
|
| 659 | 659 | |
| 660 | 660 | foreach ($values as $key => $val) |
| 661 | 661 | { |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -74,8 +76,7 @@ discard block |
||
| 74 | 76 | if (isset($this->auto_commit) && ! $this->auto_commit) |
| 75 | 77 | { |
| 76 | 78 | cubrid_set_autocommit($conn, CUBRID_AUTOCOMMIT_FALSE); |
| 77 | - } |
|
| 78 | - else |
|
| 79 | + } else |
|
| 79 | 80 | { |
| 80 | 81 | cubrid_set_autocommit($conn, CUBRID_AUTOCOMMIT_TRUE); |
| 81 | 82 | $this->auto_commit = TRUE; |
@@ -330,8 +331,7 @@ discard block |
||
| 330 | 331 | if (function_exists('cubrid_real_escape_string') AND is_resource($this->conn_id)) |
| 331 | 332 | { |
| 332 | 333 | $str = cubrid_real_escape_string($str, $this->conn_id); |
| 333 | - } |
|
| 334 | - else |
|
| 334 | + } else |
|
| 335 | 335 | { |
| 336 | 336 | $str = addslashes($str); |
| 337 | 337 | } |
@@ -515,8 +515,7 @@ discard block |
||
| 515 | 515 | if (strpos($item, '.') !== FALSE) |
| 516 | 516 | { |
| 517 | 517 | $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; |
| 518 | - } |
|
| 519 | - else |
|
| 518 | + } else |
|
| 520 | 519 | { |
| 521 | 520 | $str = $this->_escape_char.$item.$this->_escape_char; |
| 522 | 521 | } |
@@ -762,8 +761,7 @@ discard block |
||
| 762 | 761 | if ($offset == 0) |
| 763 | 762 | { |
| 764 | 763 | $offset = ''; |
| 765 | - } |
|
| 766 | - else |
|
| 764 | + } else |
|
| 767 | 765 | { |
| 768 | 766 | $offset .= ", "; |
| 769 | 767 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * List databases |
| 29 | 29 | * |
| 30 | 30 | * @access private |
| 31 | - * @return array |
|
| 31 | + * @return string|false |
|
| 32 | 32 | */ |
| 33 | 33 | function _list_databases() |
| 34 | 34 | { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @access private |
| 58 | 58 | * @param string the table name |
| 59 | - * @return object |
|
| 59 | + * @return boolean |
|
| 60 | 60 | * @link http://www.cubrid.org/manual/840/en/Optimize%20Database |
| 61 | 61 | */ |
| 62 | 62 | function _optimize_table($table) |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @access private |
| 78 | 78 | * @param string the table name |
| 79 | - * @return object |
|
| 79 | + * @return boolean |
|
| 80 | 80 | * @link http://www.cubrid.org/manual/840/en/Checking%20Database%20Consistency |
| 81 | 81 | */ |
| 82 | 82 | function _repair_table($table) |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | // connected database. |
| 40 | 40 | if ($this->conn_id) |
| 41 | 41 | { |
| 42 | - return "SELECT '" . $this->database . "'"; |
|
| 42 | + return "SELECT '".$this->database."'"; |
|
| 43 | 43 | } |
| 44 | 44 | else |
| 45 | 45 | { |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -40,8 +42,7 @@ discard block |
||
| 40 | 42 | if ($this->conn_id) |
| 41 | 43 | { |
| 42 | 44 | return "SELECT '" . $this->database . "'"; |
| 43 | - } |
|
| 44 | - else |
|
| 45 | + } else |
|
| 45 | 46 | { |
| 46 | 47 | return FALSE; |
| 47 | 48 | } |