@@ -121,7 +121,7 @@ |
||
| 121 | 121 | * @param string $file Configuration file name |
| 122 | 122 | * @param bool $use_sections Whether configuration values should be loaded into their own section |
| 123 | 123 | * @param bool $fail_gracefully Whether to just return FALSE or display an error message |
| 124 | - * @return bool TRUE if the file was loaded correctly or FALSE on failure |
|
| 124 | + * @return boolean|null TRUE if the file was loaded correctly or FALSE on failure |
|
| 125 | 125 | */ |
| 126 | 126 | public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) |
| 127 | 127 | { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @var array |
| 64 | 64 | */ |
| 65 | - public $is_loaded = array(); |
|
| 65 | + public $is_loaded = array(); |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * List of paths to search when trying to load a config file. |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @used-by CI_Loader |
| 71 | 71 | * @var array |
| 72 | 72 | */ |
| 73 | - public $_config_paths = array(APPPATH); |
|
| 73 | + public $_config_paths = array(APPPATH); |
|
| 74 | 74 | |
| 75 | 75 | // -------------------------------------------------------------------- |
| 76 | 76 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function __construct() |
| 85 | 85 | { |
| 86 | - $this->config =& get_config(); |
|
| 86 | + $this->config = & get_config(); |
|
| 87 | 87 | |
| 88 | 88 | // Set the base_url automatically if none was provided |
| 89 | 89 | if (empty($this->config['base_url'])) |
@@ -93,16 +93,14 @@ discard block |
||
| 93 | 93 | if (strpos($_SERVER['SERVER_ADDR'], ':') !== FALSE) |
| 94 | 94 | { |
| 95 | 95 | $server_addr = '['.$_SERVER['SERVER_ADDR'].']'; |
| 96 | - } |
|
| 97 | - else |
|
| 96 | + } else |
|
| 98 | 97 | { |
| 99 | 98 | $server_addr = $_SERVER['SERVER_ADDR']; |
| 100 | 99 | } |
| 101 | 100 | |
| 102 | 101 | $base_url = (is_https() ? 'https' : 'http').'://'.$server_addr |
| 103 | 102 | .substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME']))); |
| 104 | - } |
|
| 105 | - else |
|
| 103 | + } else |
|
| 106 | 104 | { |
| 107 | 105 | $base_url = 'http://localhost/'; |
| 108 | 106 | } |
@@ -160,8 +158,7 @@ discard block |
||
| 160 | 158 | $this->config[$file] = isset($this->config[$file]) |
| 161 | 159 | ? array_merge($this->config[$file], $config) |
| 162 | 160 | : $config; |
| 163 | - } |
|
| 164 | - else |
|
| 161 | + } else |
|
| 165 | 162 | { |
| 166 | 163 | $this->config = array_merge($this->config, $config); |
| 167 | 164 | } |
@@ -176,8 +173,7 @@ discard block |
||
| 176 | 173 | if ($loaded === TRUE) |
| 177 | 174 | { |
| 178 | 175 | return TRUE; |
| 179 | - } |
|
| 180 | - elseif ($fail_gracefully === TRUE) |
|
| 176 | + } elseif ($fail_gracefully === TRUE) |
|
| 181 | 177 | { |
| 182 | 178 | return FALSE; |
| 183 | 179 | } |
@@ -217,8 +213,7 @@ discard block |
||
| 217 | 213 | if ( ! isset($this->config[$item])) |
| 218 | 214 | { |
| 219 | 215 | return NULL; |
| 220 | - } |
|
| 221 | - elseif (trim($this->config[$item]) === '') |
|
| 216 | + } elseif (trim($this->config[$item]) === '') |
|
| 222 | 217 | { |
| 223 | 218 | return ''; |
| 224 | 219 | } |
@@ -249,8 +244,7 @@ discard block |
||
| 249 | 244 | if ($protocol === '') |
| 250 | 245 | { |
| 251 | 246 | $base_url = substr($base_url, strpos($base_url, '//')); |
| 252 | - } |
|
| 253 | - else |
|
| 247 | + } else |
|
| 254 | 248 | { |
| 255 | 249 | $base_url = $protocol.substr($base_url, strpos($base_url, '://')); |
| 256 | 250 | } |
@@ -272,16 +266,14 @@ discard block |
||
| 272 | 266 | if (($offset = strpos($uri, '?')) !== FALSE) |
| 273 | 267 | { |
| 274 | 268 | $uri = substr($uri, 0, $offset).$suffix.substr($uri, $offset); |
| 275 | - } |
|
| 276 | - else |
|
| 269 | + } else |
|
| 277 | 270 | { |
| 278 | 271 | $uri .= $suffix; |
| 279 | 272 | } |
| 280 | 273 | } |
| 281 | 274 | |
| 282 | 275 | return $base_url.$this->slash_item('index_page').$uri; |
| 283 | - } |
|
| 284 | - elseif (strpos($uri, '?') === FALSE) |
|
| 276 | + } elseif (strpos($uri, '?') === FALSE) |
|
| 285 | 277 | { |
| 286 | 278 | $uri = '?'.$uri; |
| 287 | 279 | } |
@@ -312,8 +304,7 @@ discard block |
||
| 312 | 304 | if ($protocol === '') |
| 313 | 305 | { |
| 314 | 306 | $base_url = substr($base_url, strpos($base_url, '//')); |
| 315 | - } |
|
| 316 | - else |
|
| 307 | + } else |
|
| 317 | 308 | { |
| 318 | 309 | $base_url = $protocol.substr($base_url, strpos($base_url, '://')); |
| 319 | 310 | } |
@@ -342,8 +333,7 @@ discard block |
||
| 342 | 333 | $uri = implode('/', $uri); |
| 343 | 334 | } |
| 344 | 335 | return trim($uri, '/'); |
| 345 | - } |
|
| 346 | - elseif (is_array($uri)) |
|
| 336 | + } elseif (is_array($uri)) |
|
| 347 | 337 | { |
| 348 | 338 | return http_build_query($uri); |
| 349 | 339 | } |
@@ -1,40 +1,40 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * CodeIgniter |
|
| 4 | - * |
|
| 5 | - * An open source application development framework for PHP |
|
| 6 | - * |
|
| 7 | - * This content is released under the MIT License (MIT) |
|
| 8 | - * |
|
| 9 | - * Copyright (c) 2014 - 2015, British Columbia Institute of Technology |
|
| 10 | - * |
|
| 11 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 12 | - * of this software and associated documentation files (the "Software"), to deal |
|
| 13 | - * in the Software without restriction, including without limitation the rights |
|
| 14 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 15 | - * copies of the Software, and to permit persons to whom the Software is |
|
| 16 | - * furnished to do so, subject to the following conditions: |
|
| 17 | - * |
|
| 18 | - * The above copyright notice and this permission notice shall be included in |
|
| 19 | - * all copies or substantial portions of the Software. |
|
| 20 | - * |
|
| 21 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 22 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 23 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 24 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 25 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 26 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
| 27 | - * THE SOFTWARE. |
|
| 28 | - * |
|
| 29 | - * @package CodeIgniter |
|
| 30 | - * @author EllisLab Dev Team |
|
| 31 | - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) |
|
| 32 | - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) |
|
| 33 | - * @license http://opensource.org/licenses/MIT MIT License |
|
| 34 | - * @link http://codeigniter.com |
|
| 35 | - * @since Version 1.0.0 |
|
| 36 | - * @filesource |
|
| 37 | - */ |
|
| 3 | + * CodeIgniter |
|
| 4 | + * |
|
| 5 | + * An open source application development framework for PHP |
|
| 6 | + * |
|
| 7 | + * This content is released under the MIT License (MIT) |
|
| 8 | + * |
|
| 9 | + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology |
|
| 10 | + * |
|
| 11 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 12 | + * of this software and associated documentation files (the "Software"), to deal |
|
| 13 | + * in the Software without restriction, including without limitation the rights |
|
| 14 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 15 | + * copies of the Software, and to permit persons to whom the Software is |
|
| 16 | + * furnished to do so, subject to the following conditions: |
|
| 17 | + * |
|
| 18 | + * The above copyright notice and this permission notice shall be included in |
|
| 19 | + * all copies or substantial portions of the Software. |
|
| 20 | + * |
|
| 21 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 22 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 23 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 24 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 25 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 26 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
| 27 | + * THE SOFTWARE. |
|
| 28 | + * |
|
| 29 | + * @package CodeIgniter |
|
| 30 | + * @author EllisLab Dev Team |
|
| 31 | + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) |
|
| 32 | + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) |
|
| 33 | + * @license http://opensource.org/licenses/MIT MIT License |
|
| 34 | + * @link http://codeigniter.com |
|
| 35 | + * @since Version 1.0.0 |
|
| 36 | + * @filesource |
|
| 37 | + */ |
|
| 38 | 38 | defined('BASEPATH') OR exit('No direct script access allowed'); |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | * and displays it using the specified template. |
| 149 | 149 | * |
| 150 | 150 | * @param string $heading Page heading |
| 151 | - * @param string|string[] $message Error message |
|
| 151 | + * @param string $message Error message |
|
| 152 | 152 | * @param string $template Template name |
| 153 | 153 | * @param int $status_code (default: 500) |
| 154 | 154 | * |
@@ -251,7 +251,7 @@ |
||
| 251 | 251 | if (FALSE !== strpos($filepath, '/')) |
| 252 | 252 | { |
| 253 | 253 | $x = explode('/', $filepath); |
| 254 | - $filepath = $x[count($x)-2].'/'.end($x); |
|
| 254 | + $filepath = $x[count($x) - 2].'/'.end($x); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | $template = 'html'.DIRECTORY_SEPARATOR.'error_php'; |
@@ -122,8 +122,7 @@ discard block |
||
| 122 | 122 | { |
| 123 | 123 | $heading = 'Not Found'; |
| 124 | 124 | $message = 'The controller/method pair you requested was not found.'; |
| 125 | - } |
|
| 126 | - else |
|
| 125 | + } else |
|
| 127 | 126 | { |
| 128 | 127 | $heading = '404 Page Not Found'; |
| 129 | 128 | $message = 'The page you requested was not found.'; |
@@ -166,8 +165,7 @@ discard block |
||
| 166 | 165 | { |
| 167 | 166 | $message = "\t".(is_array($message) ? implode("\n\t", $message) : $message); |
| 168 | 167 | $template = 'cli'.DIRECTORY_SEPARATOR.$template; |
| 169 | - } |
|
| 170 | - else |
|
| 168 | + } else |
|
| 171 | 169 | { |
| 172 | 170 | set_status_header($status_code); |
| 173 | 171 | $message = '<p>'.(is_array($message) ? implode('</p><p>', $message) : $message).'</p>'; |
@@ -204,8 +202,7 @@ discard block |
||
| 204 | 202 | if (is_cli()) |
| 205 | 203 | { |
| 206 | 204 | $templates_path .= 'cli'.DIRECTORY_SEPARATOR; |
| 207 | - } |
|
| 208 | - else |
|
| 205 | + } else |
|
| 209 | 206 | { |
| 210 | 207 | set_status_header(500); |
| 211 | 208 | $templates_path .= 'html'.DIRECTORY_SEPARATOR; |
@@ -255,8 +252,7 @@ discard block |
||
| 255 | 252 | } |
| 256 | 253 | |
| 257 | 254 | $template = 'html'.DIRECTORY_SEPARATOR.'error_php'; |
| 258 | - } |
|
| 259 | - else |
|
| 255 | + } else |
|
| 260 | 256 | { |
| 261 | 257 | $template = 'cli'.DIRECTORY_SEPARATOR.'error_php'; |
| 262 | 258 | } |
@@ -160,7 +160,7 @@ |
||
| 160 | 160 | * Runs a particular hook |
| 161 | 161 | * |
| 162 | 162 | * @param array $data Hook details |
| 163 | - * @return bool TRUE on success or FALSE on failure |
|
| 163 | + * @return boolean|null TRUE on success or FALSE on failure |
|
| 164 | 164 | */ |
| 165 | 165 | protected function _run_hook($data) |
| 166 | 166 | { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @var array |
| 64 | 64 | */ |
| 65 | - public $hooks = array(); |
|
| 65 | + public $hooks = array(); |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Array with class objects to use hooks methods |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function __construct() |
| 89 | 89 | { |
| 90 | - $CFG =& load_class('Config', 'core'); |
|
| 90 | + $CFG = & load_class('Config', 'core'); |
|
| 91 | 91 | log_message('info', 'Hooks Class Initialized'); |
| 92 | 92 | |
| 93 | 93 | // If hooks are not enabled in the config file |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - $this->hooks =& $hook; |
|
| 117 | + $this->hooks = & $hook; |
|
| 118 | 118 | $this->enabled = TRUE; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // Determine and class and/or function names |
| 209 | - $class = empty($data['class']) ? FALSE : $data['class']; |
|
| 210 | - $function = empty($data['function']) ? FALSE : $data['function']; |
|
| 211 | - $params = isset($data['params']) ? $data['params'] : ''; |
|
| 209 | + $class = empty($data['class']) ? FALSE : $data['class']; |
|
| 210 | + $function = empty($data['function']) ? FALSE : $data['function']; |
|
| 211 | + $params = isset($data['params']) ? $data['params'] : ''; |
|
| 212 | 212 | |
| 213 | 213 | if (empty($function)) |
| 214 | 214 | { |
@@ -143,8 +143,7 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | $this->_run_hook($val); |
| 145 | 145 | } |
| 146 | - } |
|
| 147 | - else |
|
| 146 | + } else |
|
| 148 | 147 | { |
| 149 | 148 | $this->_run_hook($this->hooks[$which]); |
| 150 | 149 | } |
@@ -172,8 +171,7 @@ discard block |
||
| 172 | 171 | : $data(); |
| 173 | 172 | |
| 174 | 173 | return TRUE; |
| 175 | - } |
|
| 176 | - elseif ( ! is_array($data)) |
|
| 174 | + } elseif ( ! is_array($data)) |
|
| 177 | 175 | { |
| 178 | 176 | return FALSE; |
| 179 | 177 | } |
@@ -227,13 +225,11 @@ discard block |
||
| 227 | 225 | if (method_exists($this->_objects[$class], $function)) |
| 228 | 226 | { |
| 229 | 227 | $this->_objects[$class]->$function($params); |
| 230 | - } |
|
| 231 | - else |
|
| 228 | + } else |
|
| 232 | 229 | { |
| 233 | 230 | return $this->_in_progress = FALSE; |
| 234 | 231 | } |
| 235 | - } |
|
| 236 | - else |
|
| 232 | + } else |
|
| 237 | 233 | { |
| 238 | 234 | class_exists($class, FALSE) OR require_once($filepath); |
| 239 | 235 | |
@@ -246,8 +242,7 @@ discard block |
||
| 246 | 242 | $this->_objects[$class] = new $class(); |
| 247 | 243 | $this->_objects[$class]->$function($params); |
| 248 | 244 | } |
| 249 | - } |
|
| 250 | - else |
|
| 245 | + } else |
|
| 251 | 246 | { |
| 252 | 247 | function_exists($function) OR require_once($filepath); |
| 253 | 248 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | /** |
| 234 | 234 | * Fetch an item from the GET array |
| 235 | 235 | * |
| 236 | - * @param mixed $index Index for item to be fetched from $_GET |
|
| 236 | + * @param string $index Index for item to be fetched from $_GET |
|
| 237 | 237 | * @param bool $xss_clean Whether to apply XSS filtering |
| 238 | 238 | * @return mixed |
| 239 | 239 | */ |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | /** |
| 248 | 248 | * Fetch an item from the POST array |
| 249 | 249 | * |
| 250 | - * @param mixed $index Index for item to be fetched from $_POST |
|
| 250 | + * @param string $index Index for item to be fetched from $_POST |
|
| 251 | 251 | * @param bool $xss_clean Whether to apply XSS filtering |
| 252 | 252 | * @return mixed |
| 253 | 253 | */ |
@@ -307,9 +307,9 @@ discard block |
||
| 307 | 307 | /** |
| 308 | 308 | * Fetch an item from the SERVER array |
| 309 | 309 | * |
| 310 | - * @param mixed $index Index for item to be fetched from $_SERVER |
|
| 310 | + * @param string $index Index for item to be fetched from $_SERVER |
|
| 311 | 311 | * @param bool $xss_clean Whether to apply XSS filtering |
| 312 | - * @return mixed |
|
| 312 | + * @return string |
|
| 313 | 313 | */ |
| 314 | 314 | public function server($index, $xss_clean = NULL) |
| 315 | 315 | { |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | * Allows read access to protected properties |
| 878 | 878 | * |
| 879 | 879 | * @param string $name |
| 880 | - * @return mixed |
|
| 880 | + * @return string|null |
|
| 881 | 881 | */ |
| 882 | 882 | public function __get($name) |
| 883 | 883 | { |
@@ -137,17 +137,17 @@ |
||
| 137 | 137 | */ |
| 138 | 138 | public function __construct() |
| 139 | 139 | { |
| 140 | - $this->_allow_get_array = (config_item('allow_get_array') === TRUE); |
|
| 141 | - $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); |
|
| 142 | - $this->_enable_csrf = (config_item('csrf_protection') === TRUE); |
|
| 143 | - $this->_standardize_newlines = (bool) config_item('standardize_newlines'); |
|
| 140 | + $this->_allow_get_array = (config_item('allow_get_array') === TRUE); |
|
| 141 | + $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); |
|
| 142 | + $this->_enable_csrf = (config_item('csrf_protection') === TRUE); |
|
| 143 | + $this->_standardize_newlines = (bool) config_item('standardize_newlines'); |
|
| 144 | 144 | |
| 145 | - $this->security =& load_class('Security', 'core'); |
|
| 145 | + $this->security = & load_class('Security', 'core'); |
|
| 146 | 146 | |
| 147 | 147 | // Do we need the UTF-8 class? |
| 148 | 148 | if (UTF8_ENABLED === TRUE) |
| 149 | 149 | { |
| 150 | - $this->uni =& load_class('Utf8', 'core'); |
|
| 150 | + $this->uni = & load_class('Utf8', 'core'); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // Sanitize global arrays |
@@ -196,29 +196,30 @@ discard block |
||
| 196 | 196 | if (isset($array[$index])) |
| 197 | 197 | { |
| 198 | 198 | $value = $array[$index]; |
| 199 | - } |
|
| 200 | - elseif (($count = preg_match_all('/(?:^[^\[]+)|\[[^]]*\]/', $index, $matches)) > 1) // Does the index contain array notation |
|
| 199 | + } elseif (($count = preg_match_all('/(?:^[^\[]+)|\[[^]]*\]/', $index, $matches)) > 1) { |
|
| 200 | + // Does the index contain array notation |
|
| 201 | 201 | { |
| 202 | 202 | $value = $array; |
| 203 | + } |
|
| 203 | 204 | for ($i = 0; $i < $count; $i++) |
| 204 | 205 | { |
| 205 | 206 | $key = trim($matches[0][$i], '[]'); |
| 206 | - if ($key === '') // Empty notation will return the value as array |
|
| 207 | + if ($key === '') { |
|
| 208 | + // Empty notation will return the value as array |
|
| 207 | 209 | { |
| 208 | 210 | break; |
| 209 | 211 | } |
| 212 | + } |
|
| 210 | 213 | |
| 211 | 214 | if (isset($value[$key])) |
| 212 | 215 | { |
| 213 | 216 | $value = $value[$key]; |
| 214 | - } |
|
| 215 | - else |
|
| 217 | + } else |
|
| 216 | 218 | { |
| 217 | 219 | return NULL; |
| 218 | 220 | } |
| 219 | 221 | } |
| 220 | - } |
|
| 221 | - else |
|
| 222 | + } else |
|
| 222 | 223 | { |
| 223 | 224 | return NULL; |
| 224 | 225 | } |
@@ -401,8 +402,7 @@ discard block |
||
| 401 | 402 | if ( ! is_numeric($expire)) |
| 402 | 403 | { |
| 403 | 404 | $expire = time() - 86500; |
| 404 | - } |
|
| 405 | - else |
|
| 405 | + } else |
|
| 406 | 406 | { |
| 407 | 407 | $expire = ($expire > 0) ? time() + $expire : 0; |
| 408 | 408 | } |
@@ -448,8 +448,7 @@ discard block |
||
| 448 | 448 | if ( ! $this->valid_ip($spoof)) |
| 449 | 449 | { |
| 450 | 450 | $spoof = NULL; |
| 451 | - } |
|
| 452 | - else |
|
| 451 | + } else |
|
| 453 | 452 | { |
| 454 | 453 | break; |
| 455 | 454 | } |
@@ -502,8 +501,7 @@ discard block |
||
| 502 | 501 | } |
| 503 | 502 | |
| 504 | 503 | $sprintf = '%016b%016b%016b%016b%016b%016b%016b%016b'; |
| 505 | - } |
|
| 506 | - else |
|
| 504 | + } else |
|
| 507 | 505 | { |
| 508 | 506 | $ip = explode('.', $this->ip_address); |
| 509 | 507 | $sprintf = '%08b%08b%08b%08b'; |
@@ -523,8 +521,7 @@ discard block |
||
| 523 | 521 | { |
| 524 | 522 | $netaddr[$i] = intval($netaddr[$i], 16); |
| 525 | 523 | } |
| 526 | - } |
|
| 527 | - else |
|
| 524 | + } else |
|
| 528 | 525 | { |
| 529 | 526 | $netaddr = explode('.', $netaddr); |
| 530 | 527 | } |
@@ -605,8 +602,7 @@ discard block |
||
| 605 | 602 | if ($this->_allow_get_array === FALSE) |
| 606 | 603 | { |
| 607 | 604 | $_GET = array(); |
| 608 | - } |
|
| 609 | - elseif (is_array($_GET)) |
|
| 605 | + } elseif (is_array($_GET)) |
|
| 610 | 606 | { |
| 611 | 607 | foreach ($_GET as $key => $val) |
| 612 | 608 | { |
@@ -642,8 +638,7 @@ discard block |
||
| 642 | 638 | if (($cookie_key = $this->_clean_input_keys($key)) !== FALSE) |
| 643 | 639 | { |
| 644 | 640 | $_COOKIE[$cookie_key] = $this->_clean_input_data($val); |
| 645 | - } |
|
| 646 | - else |
|
| 641 | + } else |
|
| 647 | 642 | { |
| 648 | 643 | unset($_COOKIE[$key]); |
| 649 | 644 | } |
@@ -729,8 +724,7 @@ discard block |
||
| 729 | 724 | if ($fatal === TRUE) |
| 730 | 725 | { |
| 731 | 726 | return FALSE; |
| 732 | - } |
|
| 733 | - else |
|
| 727 | + } else |
|
| 734 | 728 | { |
| 735 | 729 | set_status_header(503); |
| 736 | 730 | echo 'Disallowed Key Characters.'; |
@@ -885,8 +879,7 @@ discard block |
||
| 885 | 879 | { |
| 886 | 880 | isset($this->_raw_input_stream) OR $this->_raw_input_stream = file_get_contents('php://input'); |
| 887 | 881 | return $this->_raw_input_stream; |
| 888 | - } |
|
| 889 | - elseif ($name === 'ip_address') |
|
| 882 | + } elseif ($name === 'ip_address') |
|
| 890 | 883 | { |
| 891 | 884 | return $this->ip_address; |
| 892 | 885 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @param string $library Library name |
| 186 | 186 | * @param array $params Optional parameters to pass to the library class constructor |
| 187 | 187 | * @param string $object_name An optional object name to assign to |
| 188 | - * @return object |
|
| 188 | + * @return CI_Loader |
|
| 189 | 189 | */ |
| 190 | 190 | public function library($library, $params = NULL, $object_name = NULL) |
| 191 | 191 | { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @param string $model Model name |
| 230 | 230 | * @param string $name An optional object name to assign to |
| 231 | 231 | * @param bool $db_conn An optional database connection configuration to initialize |
| 232 | - * @return object |
|
| 232 | + * @return CI_Loader |
|
| 233 | 233 | */ |
| 234 | 234 | public function model($model, $name = '', $db_conn = FALSE) |
| 235 | 235 | { |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | /** |
| 330 | 330 | * Database Loader |
| 331 | 331 | * |
| 332 | - * @param mixed $params Database configuration options |
|
| 332 | + * @param string|boolean $params Database configuration options |
|
| 333 | 333 | * @param bool $return Whether to return the database object |
| 334 | 334 | * @param bool $query_builder Whether to enable Query Builder |
| 335 | 335 | * (overrides the configuration setting) |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | * An associative array or object containing values |
| 486 | 486 | * to be set, or a value's name if string |
| 487 | 487 | * @param string $val Value to set, only used if $vars is a string |
| 488 | - * @return object |
|
| 488 | + * @return CI_Loader |
|
| 489 | 489 | */ |
| 490 | 490 | public function vars($vars, $val = '') |
| 491 | 491 | { |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | * Helper Loader |
| 558 | 558 | * |
| 559 | 559 | * @param string|string[] $helpers Helper name(s) |
| 560 | - * @return object |
|
| 560 | + * @return CI_Loader |
|
| 561 | 561 | */ |
| 562 | 562 | public function helper($helpers = array()) |
| 563 | 563 | { |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | * |
| 629 | 629 | * @uses CI_Loader::helper() |
| 630 | 630 | * @param string|string[] $helpers Helper name(s) |
| 631 | - * @return object |
|
| 631 | + * @return CI_Loader |
|
| 632 | 632 | */ |
| 633 | 633 | public function helpers($helpers = array()) |
| 634 | 634 | { |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | * |
| 645 | 645 | * @param string|string[] $files List of language file names to load |
| 646 | 646 | * @param string Language name |
| 647 | - * @return object |
|
| 647 | + * @return CI_Loader |
|
| 648 | 648 | */ |
| 649 | 649 | public function language($files, $lang = '') |
| 650 | 650 | { |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | * |
| 732 | 732 | * @param string $path Path to add |
| 733 | 733 | * @param bool $view_cascade (default: TRUE) |
| 734 | - * @return object |
|
| 734 | + * @return CI_Loader |
|
| 735 | 735 | */ |
| 736 | 736 | public function add_package_path($path, $view_cascade = TRUE) |
| 737 | 737 | { |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | * added path will be removed removed. |
| 776 | 776 | * |
| 777 | 777 | * @param string $path Path to remove |
| 778 | - * @return object |
|
| 778 | + * @return CI_Loader |
|
| 779 | 779 | */ |
| 780 | 780 | public function remove_package_path($path = '') |
| 781 | 781 | { |
@@ -1061,7 +1061,7 @@ discard block |
||
| 1061 | 1061 | * @used-by CI_Loader::_ci_load_library() |
| 1062 | 1062 | * @uses CI_Loader::_ci_init_library() |
| 1063 | 1063 | * |
| 1064 | - * @param string $library Library name to load |
|
| 1064 | + * @param string $library_name Library name to load |
|
| 1065 | 1065 | * @param string $file_path Path to the library filename, relative to libraries/ |
| 1066 | 1066 | * @param mixed $params Optional parameters to pass to the class constructor |
| 1067 | 1067 | * @param string $object_name Optional object name to assign to |
@@ -63,63 +63,63 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @var array |
| 65 | 65 | */ |
| 66 | - protected $_ci_view_paths = array(VIEWPATH => TRUE); |
|
| 66 | + protected $_ci_view_paths = array(VIEWPATH => TRUE); |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * List of paths to load libraries from |
| 70 | 70 | * |
| 71 | 71 | * @var array |
| 72 | 72 | */ |
| 73 | - protected $_ci_library_paths = array(APPPATH, BASEPATH); |
|
| 73 | + protected $_ci_library_paths = array(APPPATH, BASEPATH); |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * List of paths to load models from |
| 77 | 77 | * |
| 78 | 78 | * @var array |
| 79 | 79 | */ |
| 80 | - protected $_ci_model_paths = array(APPPATH); |
|
| 80 | + protected $_ci_model_paths = array(APPPATH); |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * List of paths to load helpers from |
| 84 | 84 | * |
| 85 | 85 | * @var array |
| 86 | 86 | */ |
| 87 | - protected $_ci_helper_paths = array(APPPATH, BASEPATH); |
|
| 87 | + protected $_ci_helper_paths = array(APPPATH, BASEPATH); |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * List of cached variables |
| 91 | 91 | * |
| 92 | 92 | * @var array |
| 93 | 93 | */ |
| 94 | - protected $_ci_cached_vars = array(); |
|
| 94 | + protected $_ci_cached_vars = array(); |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * List of loaded classes |
| 98 | 98 | * |
| 99 | 99 | * @var array |
| 100 | 100 | */ |
| 101 | - protected $_ci_classes = array(); |
|
| 101 | + protected $_ci_classes = array(); |
|
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * List of loaded models |
| 105 | 105 | * |
| 106 | 106 | * @var array |
| 107 | 107 | */ |
| 108 | - protected $_ci_models = array(); |
|
| 108 | + protected $_ci_models = array(); |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * List of loaded helpers |
| 112 | 112 | * |
| 113 | 113 | * @var array |
| 114 | 114 | */ |
| 115 | - protected $_ci_helpers = array(); |
|
| 115 | + protected $_ci_helpers = array(); |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * List of class name mappings |
| 119 | 119 | * |
| 120 | 120 | * @var array |
| 121 | 121 | */ |
| 122 | - protected $_ci_varmap = array( |
|
| 122 | + protected $_ci_varmap = array( |
|
| 123 | 123 | 'unit_test' => 'unit', |
| 124 | 124 | 'user_agent' => 'agent' |
| 125 | 125 | ); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | public function __construct() |
| 137 | 137 | { |
| 138 | 138 | $this->_ci_ob_level = ob_get_level(); |
| 139 | - $this->_ci_classes =& is_loaded(); |
|
| 139 | + $this->_ci_classes = & is_loaded(); |
|
| 140 | 140 | |
| 141 | 141 | log_message('info', 'Loader Class Initialized'); |
| 142 | 142 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | return $this; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - $CI =& get_instance(); |
|
| 272 | + $CI = & get_instance(); |
|
| 273 | 273 | if (isset($CI->$name)) |
| 274 | 274 | { |
| 275 | 275 | throw new RuntimeException('The model name you are loading is the name of a resource that is already being used: '.$name); |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | public function database($params = '', $return = FALSE, $query_builder = NULL) |
| 341 | 341 | { |
| 342 | 342 | // Grab the super object |
| 343 | - $CI =& get_instance(); |
|
| 343 | + $CI = & get_instance(); |
|
| 344 | 344 | |
| 345 | 345 | // Do we even need to load the database class? |
| 346 | 346 | if ($return === FALSE && $query_builder === NULL && isset($CI->db) && is_object($CI->db) && ! empty($CI->db->conn_id)) |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | $CI->db = ''; |
| 361 | 361 | |
| 362 | 362 | // Load the DB class |
| 363 | - $CI->db =& DB($params, $query_builder); |
|
| 363 | + $CI->db = & DB($params, $query_builder); |
|
| 364 | 364 | return $this; |
| 365 | 365 | } |
| 366 | 366 | |
@@ -375,12 +375,12 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public function dbutil($db = NULL, $return = FALSE) |
| 377 | 377 | { |
| 378 | - $CI =& get_instance(); |
|
| 378 | + $CI = & get_instance(); |
|
| 379 | 379 | |
| 380 | 380 | if ( ! is_object($db) OR ! ($db instanceof CI_DB)) |
| 381 | 381 | { |
| 382 | 382 | class_exists('CI_DB', FALSE) OR $this->database(); |
| 383 | - $db =& $CI->db; |
|
| 383 | + $db = & $CI->db; |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | require_once(BASEPATH.'database/DB_utility.php'); |
@@ -407,11 +407,11 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | public function dbforge($db = NULL, $return = FALSE) |
| 409 | 409 | { |
| 410 | - $CI =& get_instance(); |
|
| 410 | + $CI = & get_instance(); |
|
| 411 | 411 | if ( ! is_object($db) OR ! ($db instanceof CI_DB)) |
| 412 | 412 | { |
| 413 | 413 | class_exists('CI_DB', FALSE) OR $this->database(); |
| 414 | - $db =& $CI->db; |
|
| 414 | + $db = & $CI->db; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | require_once(BASEPATH.'database/DB_forge.php'); |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | $this->_ci_view_paths = array($path.'views/' => $view_cascade) + $this->_ci_view_paths; |
| 745 | 745 | |
| 746 | 746 | // Add config file path |
| 747 | - $config =& $this->_ci_get_component('config'); |
|
| 747 | + $config = & $this->_ci_get_component('config'); |
|
| 748 | 748 | $config->_config_paths[] = $path; |
| 749 | 749 | |
| 750 | 750 | return $this; |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | */ |
| 780 | 780 | public function remove_package_path($path = '') |
| 781 | 781 | { |
| 782 | - $config =& $this->_ci_get_component('config'); |
|
| 782 | + $config = & $this->_ci_get_component('config'); |
|
| 783 | 783 | |
| 784 | 784 | if ($path === '') |
| 785 | 785 | { |
@@ -880,12 +880,12 @@ discard block |
||
| 880 | 880 | |
| 881 | 881 | // This allows anything loaded using $this->load (views, files, etc.) |
| 882 | 882 | // to become accessible from within the Controller and Model functions. |
| 883 | - $_ci_CI =& get_instance(); |
|
| 883 | + $_ci_CI = & get_instance(); |
|
| 884 | 884 | foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var) |
| 885 | 885 | { |
| 886 | 886 | if ( ! isset($this->$_ci_key)) |
| 887 | 887 | { |
| 888 | - $this->$_ci_key =& $_ci_CI->$_ci_key; |
|
| 888 | + $this->$_ci_key = & $_ci_CI->$_ci_key; |
|
| 889 | 889 | } |
| 890 | 890 | } |
| 891 | 891 | |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | // return a new instance of the object |
| 1023 | 1023 | if ($object_name !== NULL) |
| 1024 | 1024 | { |
| 1025 | - $CI =& get_instance(); |
|
| 1025 | + $CI = & get_instance(); |
|
| 1026 | 1026 | if ( ! isset($CI->$object_name)) |
| 1027 | 1027 | { |
| 1028 | 1028 | return $this->_ci_init_library($class, '', $params, $object_name); |
@@ -1083,7 +1083,7 @@ discard block |
||
| 1083 | 1083 | // return a new instance of the object |
| 1084 | 1084 | if ($object_name !== NULL) |
| 1085 | 1085 | { |
| 1086 | - $CI =& get_instance(); |
|
| 1086 | + $CI = & get_instance(); |
|
| 1087 | 1087 | if ( ! isset($CI->$object_name)) |
| 1088 | 1088 | { |
| 1089 | 1089 | return $this->_ci_init_library($library_name, $prefix, $params, $object_name); |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | } |
| 1227 | 1227 | |
| 1228 | 1228 | // Don't overwrite existing properties |
| 1229 | - $CI =& get_instance(); |
|
| 1229 | + $CI = & get_instance(); |
|
| 1230 | 1230 | if (isset($CI->$object_name)) |
| 1231 | 1231 | { |
| 1232 | 1232 | if ($CI->$object_name instanceof $class_name) |
@@ -1359,7 +1359,7 @@ discard block |
||
| 1359 | 1359 | */ |
| 1360 | 1360 | protected function &_ci_get_component($component) |
| 1361 | 1361 | { |
| 1362 | - $CI =& get_instance(); |
|
| 1362 | + $CI = & get_instance(); |
|
| 1363 | 1363 | return $CI->$component; |
| 1364 | 1364 | } |
| 1365 | 1365 | |
@@ -192,16 +192,14 @@ discard block |
||
| 192 | 192 | if (empty($library)) |
| 193 | 193 | { |
| 194 | 194 | return $this; |
| 195 | - } |
|
| 196 | - elseif (is_array($library)) |
|
| 195 | + } elseif (is_array($library)) |
|
| 197 | 196 | { |
| 198 | 197 | foreach ($library as $key => $value) |
| 199 | 198 | { |
| 200 | 199 | if (is_int($key)) |
| 201 | 200 | { |
| 202 | 201 | $this->library($value, $params); |
| 203 | - } |
|
| 204 | - else |
|
| 202 | + } else |
|
| 205 | 203 | { |
| 206 | 204 | $this->library($key, $params, $value); |
| 207 | 205 | } |
@@ -236,8 +234,7 @@ discard block |
||
| 236 | 234 | if (empty($model)) |
| 237 | 235 | { |
| 238 | 236 | return $this; |
| 239 | - } |
|
| 240 | - elseif (is_array($model)) |
|
| 237 | + } elseif (is_array($model)) |
|
| 241 | 238 | { |
| 242 | 239 | foreach ($model as $key => $value) |
| 243 | 240 | { |
@@ -303,8 +300,7 @@ discard block |
||
| 303 | 300 | { |
| 304 | 301 | throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model"); |
| 305 | 302 | } |
| 306 | - } |
|
| 307 | - elseif ( ! class_exists('CI_Model', FALSE)) |
|
| 303 | + } elseif ( ! class_exists('CI_Model', FALSE)) |
|
| 308 | 304 | { |
| 309 | 305 | require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php'); |
| 310 | 306 | } |
@@ -343,8 +339,7 @@ discard block |
||
| 343 | 339 | { |
| 344 | 340 | throw new RuntimeException('Unable to locate the model you have specified: '.$model); |
| 345 | 341 | } |
| 346 | - } |
|
| 347 | - elseif ( ! is_subclass_of($model, 'CI_Model')) |
|
| 342 | + } elseif ( ! is_subclass_of($model, 'CI_Model')) |
|
| 348 | 343 | { |
| 349 | 344 | throw new RuntimeException("Class ".$model." already exists and doesn't extend CI_Model"); |
| 350 | 345 | } |
@@ -455,8 +450,7 @@ discard block |
||
| 455 | 450 | require_once($driver_path); |
| 456 | 451 | $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; |
| 457 | 452 | } |
| 458 | - } |
|
| 459 | - else |
|
| 453 | + } else |
|
| 460 | 454 | { |
| 461 | 455 | $class = 'CI_DB_'.$db->dbdriver.'_forge'; |
| 462 | 456 | } |
@@ -724,8 +718,7 @@ discard block |
||
| 724 | 718 | } |
| 725 | 719 | |
| 726 | 720 | return $this; |
| 727 | - } |
|
| 728 | - elseif (empty($library)) |
|
| 721 | + } elseif (empty($library)) |
|
| 729 | 722 | { |
| 730 | 723 | return FALSE; |
| 731 | 724 | } |
@@ -818,8 +811,7 @@ discard block |
||
| 818 | 811 | array_shift($this->_ci_helper_paths); |
| 819 | 812 | array_shift($this->_ci_view_paths); |
| 820 | 813 | array_pop($config->_config_paths); |
| 821 | - } |
|
| 822 | - else |
|
| 814 | + } else |
|
| 823 | 815 | { |
| 824 | 816 | $path = rtrim($path, '/').'/'; |
| 825 | 817 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -881,8 +873,7 @@ discard block |
||
| 881 | 873 | { |
| 882 | 874 | $_ci_x = explode('/', $_ci_path); |
| 883 | 875 | $_ci_file = end($_ci_x); |
| 884 | - } |
|
| 885 | - else |
|
| 876 | + } else |
|
| 886 | 877 | { |
| 887 | 878 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
| 888 | 879 | $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; |
@@ -952,8 +943,7 @@ discard block |
||
| 952 | 943 | if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) |
| 953 | 944 | { |
| 954 | 945 | echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
| 955 | - } |
|
| 956 | - else |
|
| 946 | + } else |
|
| 957 | 947 | { |
| 958 | 948 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
| 959 | 949 | } |
@@ -980,8 +970,7 @@ discard block |
||
| 980 | 970 | if (ob_get_level() > $this->_ci_ob_level + 1) |
| 981 | 971 | { |
| 982 | 972 | ob_end_flush(); |
| 983 | - } |
|
| 984 | - else |
|
| 973 | + } else |
|
| 985 | 974 | { |
| 986 | 975 | $_ci_CI->output->append_output(ob_get_contents()); |
| 987 | 976 | @ob_end_clean(); |
@@ -1019,8 +1008,7 @@ discard block |
||
| 1019 | 1008 | |
| 1020 | 1009 | // Get the filename from the path |
| 1021 | 1010 | $class = substr($class, $last_slash); |
| 1022 | - } |
|
| 1023 | - else |
|
| 1011 | + } else |
|
| 1024 | 1012 | { |
| 1025 | 1013 | $subdir = ''; |
| 1026 | 1014 | } |
@@ -1138,8 +1126,7 @@ discard block |
||
| 1138 | 1126 | if (class_exists($prefix.$library_name, FALSE)) |
| 1139 | 1127 | { |
| 1140 | 1128 | return $this->_ci_init_library($library_name, $prefix, $params, $object_name); |
| 1141 | - } |
|
| 1142 | - else |
|
| 1129 | + } else |
|
| 1143 | 1130 | { |
| 1144 | 1131 | log_message('debug', $path.' exists, but does not declare '.$prefix.$library_name); |
| 1145 | 1132 | } |
@@ -1159,8 +1146,7 @@ discard block |
||
| 1159 | 1146 | { |
| 1160 | 1147 | $prefix = config_item('subclass_prefix'); |
| 1161 | 1148 | break; |
| 1162 | - } |
|
| 1163 | - else |
|
| 1149 | + } else |
|
| 1164 | 1150 | { |
| 1165 | 1151 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
| 1166 | 1152 | } |
@@ -1207,8 +1193,7 @@ discard block |
||
| 1207 | 1193 | { |
| 1208 | 1194 | include($path.'config/'.strtolower($class).'.php'); |
| 1209 | 1195 | $found = TRUE; |
| 1210 | - } |
|
| 1211 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1196 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1212 | 1197 | { |
| 1213 | 1198 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
| 1214 | 1199 | $found = TRUE; |
@@ -1218,8 +1203,7 @@ discard block |
||
| 1218 | 1203 | { |
| 1219 | 1204 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
| 1220 | 1205 | $found = TRUE; |
| 1221 | - } |
|
| 1222 | - elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1206 | + } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1223 | 1207 | { |
| 1224 | 1208 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
| 1225 | 1209 | $found = TRUE; |
@@ -1410,8 +1394,7 @@ discard block |
||
| 1410 | 1394 | if ( ! is_array($filename)) |
| 1411 | 1395 | { |
| 1412 | 1396 | return array(strtolower(str_replace(array($extension, '.php'), '', $filename).$extension)); |
| 1413 | - } |
|
| 1414 | - else |
|
| 1397 | + } else |
|
| 1415 | 1398 | { |
| 1416 | 1399 | foreach ($filename as $key => $val) |
| 1417 | 1400 | { |
@@ -285,7 +285,7 @@ |
||
| 285 | 285 | /** |
| 286 | 286 | * Get Header |
| 287 | 287 | * |
| 288 | - * @param string $header_name |
|
| 288 | + * @param string $header |
|
| 289 | 289 | * @return string |
| 290 | 290 | */ |
| 291 | 291 | public function get_header($header) |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @var array |
| 78 | 78 | */ |
| 79 | - public $mimes = array(); |
|
| 79 | + public $mimes = array(); |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Mime-type for the current page |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @var array |
| 113 | 113 | */ |
| 114 | - protected $_profiler_sections = array(); |
|
| 114 | + protected $_profiler_sections = array(); |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * Parse markers flag |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | 141 | // Get mime types for later |
| 142 | - $this->mimes =& get_mimes(); |
|
| 142 | + $this->mimes = & get_mimes(); |
|
| 143 | 143 | |
| 144 | 144 | log_message('info', 'Output Class Initialized'); |
| 145 | 145 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | // Is this extension supported? |
| 238 | 238 | if (isset($this->mimes[$extension])) |
| 239 | 239 | { |
| 240 | - $mime_type =& $this->mimes[$extension]; |
|
| 240 | + $mime_type = & $this->mimes[$extension]; |
|
| 241 | 241 | |
| 242 | 242 | if (is_array($mime_type)) |
| 243 | 243 | { |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | { |
| 307 | 307 | if (strncasecmp($header, $headers[$i], $l = strlen($header)) === 0) |
| 308 | 308 | { |
| 309 | - return trim(substr($headers[$i], $l+1)); |
|
| 309 | + return trim(substr($headers[$i], $l + 1)); |
|
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | |
@@ -407,13 +407,13 @@ discard block |
||
| 407 | 407 | // Note: We use load_class() because we can't use $CI =& get_instance() |
| 408 | 408 | // since this function is sometimes called by the caching mechanism, |
| 409 | 409 | // which happens before the CI super object is available. |
| 410 | - $BM =& load_class('Benchmark', 'core'); |
|
| 411 | - $CFG =& load_class('Config', 'core'); |
|
| 410 | + $BM = & load_class('Benchmark', 'core'); |
|
| 411 | + $CFG = & load_class('Config', 'core'); |
|
| 412 | 412 | |
| 413 | 413 | // Grab the super object if we can. |
| 414 | 414 | if (class_exists('CI_Controller', FALSE)) |
| 415 | 415 | { |
| 416 | - $CI =& get_instance(); |
|
| 416 | + $CI = & get_instance(); |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | // -------------------------------------------------------------------- |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | // Set the output data |
| 422 | 422 | if ($output === '') |
| 423 | 423 | { |
| 424 | - $output =& $this->final_output; |
|
| 424 | + $output = & $this->final_output; |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | // -------------------------------------------------------------------- |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | */ |
| 543 | 543 | public function _write_cache($output) |
| 544 | 544 | { |
| 545 | - $CI =& get_instance(); |
|
| 545 | + $CI = & get_instance(); |
|
| 546 | 546 | $path = $CI->config->item('cache_path'); |
| 547 | 547 | $cache_path = ($path === '') ? APPPATH.'cache/' : $path; |
| 548 | 548 | |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | */ |
| 727 | 727 | public function delete_cache($uri = '') |
| 728 | 728 | { |
| 729 | - $CI =& get_instance(); |
|
| 729 | + $CI = & get_instance(); |
|
| 730 | 730 | $cache_path = $CI->config->item('cache_path'); |
| 731 | 731 | if ($cache_path === '') |
| 732 | 732 | { |
@@ -481,8 +481,7 @@ discard block |
||
| 481 | 481 | { |
| 482 | 482 | header('Content-Encoding: gzip'); |
| 483 | 483 | header('Content-Length: '.strlen($output)); |
| 484 | - } |
|
| 485 | - else |
|
| 484 | + } else |
|
| 486 | 485 | { |
| 487 | 486 | // User agent doesn't support gzip compression, |
| 488 | 487 | // so we'll have to decompress our cache |
@@ -522,8 +521,7 @@ discard block |
||
| 522 | 521 | if (method_exists($CI, '_output')) |
| 523 | 522 | { |
| 524 | 523 | $CI->_output($output); |
| 525 | - } |
|
| 526 | - else |
|
| 524 | + } else |
|
| 527 | 525 | { |
| 528 | 526 | echo $output; // Send it to the browser! |
| 529 | 527 | } |
@@ -561,8 +559,7 @@ discard block |
||
| 561 | 559 | if (is_array($cache_query_string)) |
| 562 | 560 | { |
| 563 | 561 | $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string))); |
| 564 | - } |
|
| 565 | - else |
|
| 562 | + } else |
|
| 566 | 563 | { |
| 567 | 564 | $uri .= '?'.$_SERVER['QUERY_STRING']; |
| 568 | 565 | } |
@@ -610,8 +607,7 @@ discard block |
||
| 610 | 607 | } |
| 611 | 608 | |
| 612 | 609 | flock($fp, LOCK_UN); |
| 613 | - } |
|
| 614 | - else |
|
| 610 | + } else |
|
| 615 | 611 | { |
| 616 | 612 | log_message('error', 'Unable to secure a file lock for file at: '.$cache_path); |
| 617 | 613 | return; |
@@ -626,8 +622,7 @@ discard block |
||
| 626 | 622 | |
| 627 | 623 | // Send HTTP cache-control headers to browser to match file cache settings. |
| 628 | 624 | $this->set_cache_header($_SERVER['REQUEST_TIME'], $expire); |
| 629 | - } |
|
| 630 | - else |
|
| 625 | + } else |
|
| 631 | 626 | { |
| 632 | 627 | @unlink($cache_path); |
| 633 | 628 | log_message('error', 'Unable to write the complete cache content at: '.$cache_path); |
@@ -658,8 +653,7 @@ discard block |
||
| 658 | 653 | if (is_array($cache_query_string)) |
| 659 | 654 | { |
| 660 | 655 | $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string))); |
| 661 | - } |
|
| 662 | - else |
|
| 656 | + } else |
|
| 663 | 657 | { |
| 664 | 658 | $uri .= '?'.$_SERVER['QUERY_STRING']; |
| 665 | 659 | } |
@@ -697,8 +691,7 @@ discard block |
||
| 697 | 691 | @unlink($filepath); |
| 698 | 692 | log_message('debug', 'Cache file has expired. File deleted.'); |
| 699 | 693 | return FALSE; |
| 700 | - } |
|
| 701 | - else |
|
| 694 | + } else |
|
| 702 | 695 | { |
| 703 | 696 | // Or else send the HTTP cache control headers. |
| 704 | 697 | $this->set_cache_header($last_modified, $expire); |
@@ -748,8 +741,7 @@ discard block |
||
| 748 | 741 | if (is_array($cache_query_string)) |
| 749 | 742 | { |
| 750 | 743 | $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string))); |
| 751 | - } |
|
| 752 | - else |
|
| 744 | + } else |
|
| 753 | 745 | { |
| 754 | 746 | $uri .= '?'.$_SERVER['QUERY_STRING']; |
| 755 | 747 | } |
@@ -787,8 +779,7 @@ discard block |
||
| 787 | 779 | { |
| 788 | 780 | $this->set_status_header(304); |
| 789 | 781 | exit; |
| 790 | - } |
|
| 791 | - else |
|
| 782 | + } else |
|
| 792 | 783 | { |
| 793 | 784 | header('Pragma: public'); |
| 794 | 785 | header('Cache-Control: max-age='.$max_age.', public'); |
@@ -69,6 +69,7 @@ |
||
| 69 | 69 | * Constructor |
| 70 | 70 | * |
| 71 | 71 | * @param object &$db |
| 72 | + * @param CI_DB_driver $db |
|
| 72 | 73 | * @return void |
| 73 | 74 | */ |
| 74 | 75 | public function __construct(&$db) |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | public function __construct(&$db) |
| 75 | 75 | { |
| 76 | 76 | // Assign the main CI object to $this->CI and load the file helper since we use it a lot |
| 77 | - $this->CI =& get_instance(); |
|
| 78 | - $this->db =& $db; |
|
| 77 | + $this->CI = & get_instance(); |
|
| 78 | + $this->db = & $db; |
|
| 79 | 79 | $this->CI->load->helper('file'); |
| 80 | 80 | |
| 81 | 81 | $this->check_path(); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | { |
| 195 | 195 | if ($segment_one === '') |
| 196 | 196 | { |
| 197 | - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); |
|
| 197 | + $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | if ($segment_two === '') |
@@ -1,40 +1,40 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * CodeIgniter |
|
| 4 | - * |
|
| 5 | - * An open source application development framework for PHP |
|
| 6 | - * |
|
| 7 | - * This content is released under the MIT License (MIT) |
|
| 8 | - * |
|
| 9 | - * Copyright (c) 2014 - 2015, British Columbia Institute of Technology |
|
| 10 | - * |
|
| 11 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 12 | - * of this software and associated documentation files (the "Software"), to deal |
|
| 13 | - * in the Software without restriction, including without limitation the rights |
|
| 14 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 15 | - * copies of the Software, and to permit persons to whom the Software is |
|
| 16 | - * furnished to do so, subject to the following conditions: |
|
| 17 | - * |
|
| 18 | - * The above copyright notice and this permission notice shall be included in |
|
| 19 | - * all copies or substantial portions of the Software. |
|
| 20 | - * |
|
| 21 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 22 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 23 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 24 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 25 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 26 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
| 27 | - * THE SOFTWARE. |
|
| 28 | - * |
|
| 29 | - * @package CodeIgniter |
|
| 30 | - * @author EllisLab Dev Team |
|
| 31 | - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) |
|
| 32 | - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) |
|
| 33 | - * @license http://opensource.org/licenses/MIT MIT License |
|
| 34 | - * @link http://codeigniter.com |
|
| 35 | - * @since Version 1.0.0 |
|
| 36 | - * @filesource |
|
| 37 | - */ |
|
| 3 | + * CodeIgniter |
|
| 4 | + * |
|
| 5 | + * An open source application development framework for PHP |
|
| 6 | + * |
|
| 7 | + * This content is released under the MIT License (MIT) |
|
| 8 | + * |
|
| 9 | + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology |
|
| 10 | + * |
|
| 11 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 12 | + * of this software and associated documentation files (the "Software"), to deal |
|
| 13 | + * in the Software without restriction, including without limitation the rights |
|
| 14 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 15 | + * copies of the Software, and to permit persons to whom the Software is |
|
| 16 | + * furnished to do so, subject to the following conditions: |
|
| 17 | + * |
|
| 18 | + * The above copyright notice and this permission notice shall be included in |
|
| 19 | + * all copies or substantial portions of the Software. |
|
| 20 | + * |
|
| 21 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 22 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 23 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 24 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 25 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 26 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
| 27 | + * THE SOFTWARE. |
|
| 28 | + * |
|
| 29 | + * @package CodeIgniter |
|
| 30 | + * @author EllisLab Dev Team |
|
| 31 | + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) |
|
| 32 | + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) |
|
| 33 | + * @license http://opensource.org/licenses/MIT MIT License |
|
| 34 | + * @link http://codeigniter.com |
|
| 35 | + * @since Version 1.0.0 |
|
| 36 | + * @filesource |
|
| 37 | + */ |
|
| 38 | 38 | defined('BASEPATH') OR exit('No direct script access allowed'); |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -372,7 +372,7 @@ |
||
| 372 | 372 | * @param string $table Table name |
| 373 | 373 | * @param bool $if_not_exists Whether to add 'IF NOT EXISTS' condition |
| 374 | 374 | * @param array $attributes Associative array of table attributes |
| 375 | - * @return mixed |
|
| 375 | + * @return boolean|string |
|
| 376 | 376 | */ |
| 377 | 377 | protected function _create_table($table, $if_not_exists, $attributes) |
| 378 | 378 | { |
@@ -58,28 +58,28 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @var array |
| 60 | 60 | */ |
| 61 | - public $fields = array(); |
|
| 61 | + public $fields = array(); |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * Keys data |
| 65 | 65 | * |
| 66 | 66 | * @var array |
| 67 | 67 | */ |
| 68 | - public $keys = array(); |
|
| 68 | + public $keys = array(); |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Primary Keys data |
| 72 | 72 | * |
| 73 | 73 | * @var array |
| 74 | 74 | */ |
| 75 | - public $primary_keys = array(); |
|
| 75 | + public $primary_keys = array(); |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * Database character set |
| 79 | 79 | * |
| 80 | 80 | * @var string |
| 81 | 81 | */ |
| 82 | - public $db_char_set = ''; |
|
| 82 | + public $db_char_set = ''; |
|
| 83 | 83 | |
| 84 | 84 | // -------------------------------------------------------------------- |
| 85 | 85 | |
@@ -88,28 +88,28 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @var string |
| 90 | 90 | */ |
| 91 | - protected $_create_database = 'CREATE DATABASE %s'; |
|
| 91 | + protected $_create_database = 'CREATE DATABASE %s'; |
|
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * DROP DATABASE statement |
| 95 | 95 | * |
| 96 | 96 | * @var string |
| 97 | 97 | */ |
| 98 | - protected $_drop_database = 'DROP DATABASE %s'; |
|
| 98 | + protected $_drop_database = 'DROP DATABASE %s'; |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * CREATE TABLE statement |
| 102 | 102 | * |
| 103 | 103 | * @var string |
| 104 | 104 | */ |
| 105 | - protected $_create_table = "%s %s (%s\n)"; |
|
| 105 | + protected $_create_table = "%s %s (%s\n)"; |
|
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * CREATE TABLE IF statement |
| 109 | 109 | * |
| 110 | 110 | * @var string |
| 111 | 111 | */ |
| 112 | - protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS'; |
|
| 112 | + protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS'; |
|
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * CREATE TABLE keys flag |
@@ -119,42 +119,42 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @var bool |
| 121 | 121 | */ |
| 122 | - protected $_create_table_keys = FALSE; |
|
| 122 | + protected $_create_table_keys = FALSE; |
|
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * DROP TABLE IF EXISTS statement |
| 126 | 126 | * |
| 127 | 127 | * @var string |
| 128 | 128 | */ |
| 129 | - protected $_drop_table_if = 'DROP TABLE IF EXISTS'; |
|
| 129 | + protected $_drop_table_if = 'DROP TABLE IF EXISTS'; |
|
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * RENAME TABLE statement |
| 133 | 133 | * |
| 134 | 134 | * @var string |
| 135 | 135 | */ |
| 136 | - protected $_rename_table = 'ALTER TABLE %s RENAME TO %s;'; |
|
| 136 | + protected $_rename_table = 'ALTER TABLE %s RENAME TO %s;'; |
|
| 137 | 137 | |
| 138 | 138 | /** |
| 139 | 139 | * UNSIGNED support |
| 140 | 140 | * |
| 141 | 141 | * @var bool|array |
| 142 | 142 | */ |
| 143 | - protected $_unsigned = TRUE; |
|
| 143 | + protected $_unsigned = TRUE; |
|
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * NULL value representation in CREATE/ALTER TABLE statements |
| 147 | 147 | * |
| 148 | 148 | * @var string |
| 149 | 149 | */ |
| 150 | - protected $_null = ''; |
|
| 150 | + protected $_null = ''; |
|
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * DEFAULT value representation in CREATE/ALTER TABLE statements |
| 154 | 154 | * |
| 155 | 155 | * @var string |
| 156 | 156 | */ |
| 157 | - protected $_default = ' DEFAULT '; |
|
| 157 | + protected $_default = ' DEFAULT '; |
|
| 158 | 158 | |
| 159 | 159 | // -------------------------------------------------------------------- |
| 160 | 160 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function __construct(&$db) |
| 168 | 168 | { |
| 169 | - $this->db =& $db; |
|
| 169 | + $this->db = & $db; |
|
| 170 | 170 | log_message('info', 'Database Forge Class Initialized'); |
| 171 | 171 | } |
| 172 | 172 | |
@@ -183,8 +183,7 @@ discard block |
||
| 183 | 183 | if ($this->_create_database === FALSE) |
| 184 | 184 | { |
| 185 | 185 | return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; |
| 186 | - } |
|
| 187 | - elseif ( ! $this->db->query(sprintf($this->_create_database, $db_name, $this->db->char_set, $this->db->dbcollat))) |
|
| 186 | + } elseif ( ! $this->db->query(sprintf($this->_create_database, $db_name, $this->db->char_set, $this->db->dbcollat))) |
|
| 188 | 187 | { |
| 189 | 188 | return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; |
| 190 | 189 | } |
@@ -210,8 +209,7 @@ discard block |
||
| 210 | 209 | if ($this->_drop_database === FALSE) |
| 211 | 210 | { |
| 212 | 211 | return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; |
| 213 | - } |
|
| 214 | - elseif ( ! $this->db->query(sprintf($this->_drop_database, $db_name))) |
|
| 212 | + } elseif ( ! $this->db->query(sprintf($this->_drop_database, $db_name))) |
|
| 215 | 213 | { |
| 216 | 214 | return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; |
| 217 | 215 | } |
@@ -258,8 +256,7 @@ discard block |
||
| 258 | 256 | if ($primary === TRUE) |
| 259 | 257 | { |
| 260 | 258 | $this->primary_keys[] = $key; |
| 261 | - } |
|
| 262 | - else |
|
| 259 | + } else |
|
| 263 | 260 | { |
| 264 | 261 | $this->keys[] = $key; |
| 265 | 262 | } |
@@ -289,8 +286,7 @@ discard block |
||
| 289 | 286 | ) |
| 290 | 287 | )); |
| 291 | 288 | $this->add_key('id', TRUE); |
| 292 | - } |
|
| 293 | - else |
|
| 289 | + } else |
|
| 294 | 290 | { |
| 295 | 291 | if (strpos($field, ' ') === FALSE) |
| 296 | 292 | { |
@@ -324,8 +320,7 @@ discard block |
||
| 324 | 320 | if ($table === '') |
| 325 | 321 | { |
| 326 | 322 | show_error('A table name is required for that operation.'); |
| 327 | - } |
|
| 328 | - else |
|
| 323 | + } else |
|
| 329 | 324 | { |
| 330 | 325 | $table = $this->db->dbprefix.$table; |
| 331 | 326 | } |
@@ -381,8 +376,7 @@ discard block |
||
| 381 | 376 | if ($this->db->table_exists($table)) |
| 382 | 377 | { |
| 383 | 378 | return TRUE; |
| 384 | - } |
|
| 385 | - else |
|
| 379 | + } else |
|
| 386 | 380 | { |
| 387 | 381 | $if_not_exists = FALSE; |
| 388 | 382 | } |
@@ -502,8 +496,7 @@ discard block |
||
| 502 | 496 | { |
| 503 | 497 | return TRUE; |
| 504 | 498 | } |
| 505 | - } |
|
| 506 | - else |
|
| 499 | + } else |
|
| 507 | 500 | { |
| 508 | 501 | $sql = sprintf($this->_drop_table_if, $this->db->escape_identifiers($table)); |
| 509 | 502 | } |
@@ -527,8 +520,7 @@ discard block |
||
| 527 | 520 | { |
| 528 | 521 | show_error('A table name is required for that operation.'); |
| 529 | 522 | return FALSE; |
| 530 | - } |
|
| 531 | - elseif ($this->_rename_table === FALSE) |
|
| 523 | + } elseif ($this->_rename_table === FALSE) |
|
| 532 | 524 | { |
| 533 | 525 | return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; |
| 534 | 526 | } |
@@ -740,8 +732,7 @@ discard block |
||
| 740 | 732 | if (isset($attributes['AFTER'])) |
| 741 | 733 | { |
| 742 | 734 | $field['after'] = $attributes['AFTER']; |
| 743 | - } |
|
| 744 | - elseif (isset($attributes['FIRST'])) |
|
| 735 | + } elseif (isset($attributes['FIRST'])) |
|
| 745 | 736 | { |
| 746 | 737 | $field['first'] = (bool) $attributes['FIRST']; |
| 747 | 738 | } |
@@ -754,13 +745,11 @@ discard block |
||
| 754 | 745 | if ($attributes['NULL'] === TRUE) |
| 755 | 746 | { |
| 756 | 747 | $field['null'] = empty($this->_null) ? '' : ' '.$this->_null; |
| 757 | - } |
|
| 758 | - else |
|
| 748 | + } else |
|
| 759 | 749 | { |
| 760 | 750 | $field['null'] = ' NOT NULL'; |
| 761 | 751 | } |
| 762 | - } |
|
| 763 | - elseif ($create_table === TRUE) |
|
| 752 | + } elseif ($create_table === TRUE) |
|
| 764 | 753 | { |
| 765 | 754 | $field['null'] = ' NOT NULL'; |
| 766 | 755 | } |
@@ -864,8 +853,7 @@ discard block |
||
| 864 | 853 | { |
| 865 | 854 | $field['unsigned'] = ' UNSIGNED'; |
| 866 | 855 | return; |
| 867 | - } |
|
| 868 | - elseif (is_string($key) && strcasecmp($attributes['TYPE'], $key) === 0) |
|
| 856 | + } elseif (is_string($key) && strcasecmp($attributes['TYPE'], $key) === 0) |
|
| 869 | 857 | { |
| 870 | 858 | $field['type'] = $key; |
| 871 | 859 | return; |
@@ -903,8 +891,7 @@ discard block |
||
| 903 | 891 | // Override the NULL attribute if that's our default |
| 904 | 892 | $attributes['NULL'] = TRUE; |
| 905 | 893 | $field['null'] = empty($this->_null) ? '' : ' '.$this->_null; |
| 906 | - } |
|
| 907 | - else |
|
| 894 | + } else |
|
| 908 | 895 | { |
| 909 | 896 | $field['default'] = $this->_default.$this->db->escape($attributes['DEFAULT']); |
| 910 | 897 | } |
@@ -998,8 +985,7 @@ discard block |
||
| 998 | 985 | continue; |
| 999 | 986 | } |
| 1000 | 987 | } |
| 1001 | - } |
|
| 1002 | - elseif ( ! isset($this->fields[$this->keys[$i]])) |
|
| 988 | + } elseif ( ! isset($this->fields[$this->keys[$i]])) |
|
| 1003 | 989 | { |
| 1004 | 990 | unset($this->keys[$i]); |
| 1005 | 991 | continue; |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | * |
| 453 | 453 | * Generates the FROM portion of the query |
| 454 | 454 | * |
| 455 | - * @param mixed $from can be a string or array |
|
| 455 | + * @param string $from can be a string or array |
|
| 456 | 456 | * @return CI_DB_query_builder |
| 457 | 457 | */ |
| 458 | 458 | public function from($from) |
@@ -595,6 +595,8 @@ discard block |
||
| 595 | 595 | * @param mixed |
| 596 | 596 | * @param mixed |
| 597 | 597 | * @param bool |
| 598 | + * @param integer $value |
|
| 599 | + * @param boolean $escape |
|
| 598 | 600 | * @return CI_DB_query_builder |
| 599 | 601 | */ |
| 600 | 602 | public function where($key, $value = NULL, $escape = NULL) |
@@ -1138,7 +1140,7 @@ discard block |
||
| 1138 | 1140 | * @param string $key |
| 1139 | 1141 | * @param string $value |
| 1140 | 1142 | * @param bool $escape |
| 1141 | - * @return object |
|
| 1143 | + * @return CI_DB_query_builder |
|
| 1142 | 1144 | */ |
| 1143 | 1145 | public function having($key, $value = NULL, $escape = NULL) |
| 1144 | 1146 | { |
@@ -1155,7 +1157,7 @@ discard block |
||
| 1155 | 1157 | * @param string $key |
| 1156 | 1158 | * @param string $value |
| 1157 | 1159 | * @param bool $escape |
| 1158 | - * @return object |
|
| 1160 | + * @return CI_DB_query_builder |
|
| 1159 | 1161 | */ |
| 1160 | 1162 | public function or_having($key, $value = NULL, $escape = NULL) |
| 1161 | 1163 | { |
@@ -1277,6 +1279,7 @@ discard block |
||
| 1277 | 1279 | * @param mixed |
| 1278 | 1280 | * @param string |
| 1279 | 1281 | * @param bool |
| 1282 | + * @param boolean $escape |
|
| 1280 | 1283 | * @return CI_DB_query_builder |
| 1281 | 1284 | */ |
| 1282 | 1285 | public function set($key, $value = '', $escape = NULL) |
@@ -1504,6 +1507,7 @@ discard block |
||
| 1504 | 1507 | * @param mixed |
| 1505 | 1508 | * @param string |
| 1506 | 1509 | * @param bool |
| 1510 | + * @param boolean $escape |
|
| 1507 | 1511 | * @return CI_DB_query_builder |
| 1508 | 1512 | */ |
| 1509 | 1513 | public function set_insert_batch($key, $value = '', $escape = NULL) |
@@ -1704,6 +1708,7 @@ discard block |
||
| 1704 | 1708 | * @param string the table name |
| 1705 | 1709 | * @param array the insert keys |
| 1706 | 1710 | * @param array the insert values |
| 1711 | + * @param string $table |
|
| 1707 | 1712 | * @return string |
| 1708 | 1713 | */ |
| 1709 | 1714 | protected function _replace($table, $keys, $values) |
@@ -1812,7 +1817,8 @@ discard block |
||
| 1812 | 1817 | * chosen to be update. |
| 1813 | 1818 | * |
| 1814 | 1819 | * @param string the table to update data on |
| 1815 | - * @return bool |
|
| 1820 | + * @param string $table |
|
| 1821 | + * @return string|boolean |
|
| 1816 | 1822 | */ |
| 1817 | 1823 | protected function _validate_update($table) |
| 1818 | 1824 | { |
@@ -56,119 +56,119 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @var bool |
| 58 | 58 | */ |
| 59 | - protected $return_delete_sql = FALSE; |
|
| 59 | + protected $return_delete_sql = FALSE; |
|
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * Reset DELETE data flag |
| 63 | 63 | * |
| 64 | 64 | * @var bool |
| 65 | 65 | */ |
| 66 | - protected $reset_delete_data = FALSE; |
|
| 66 | + protected $reset_delete_data = FALSE; |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * QB SELECT data |
| 70 | 70 | * |
| 71 | 71 | * @var array |
| 72 | 72 | */ |
| 73 | - protected $qb_select = array(); |
|
| 73 | + protected $qb_select = array(); |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * QB DISTINCT flag |
| 77 | 77 | * |
| 78 | 78 | * @var bool |
| 79 | 79 | */ |
| 80 | - protected $qb_distinct = FALSE; |
|
| 80 | + protected $qb_distinct = FALSE; |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * QB FROM data |
| 84 | 84 | * |
| 85 | 85 | * @var array |
| 86 | 86 | */ |
| 87 | - protected $qb_from = array(); |
|
| 87 | + protected $qb_from = array(); |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * QB JOIN data |
| 91 | 91 | * |
| 92 | 92 | * @var array |
| 93 | 93 | */ |
| 94 | - protected $qb_join = array(); |
|
| 94 | + protected $qb_join = array(); |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * QB WHERE data |
| 98 | 98 | * |
| 99 | 99 | * @var array |
| 100 | 100 | */ |
| 101 | - protected $qb_where = array(); |
|
| 101 | + protected $qb_where = array(); |
|
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * QB GROUP BY data |
| 105 | 105 | * |
| 106 | 106 | * @var array |
| 107 | 107 | */ |
| 108 | - protected $qb_groupby = array(); |
|
| 108 | + protected $qb_groupby = array(); |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * QB HAVING data |
| 112 | 112 | * |
| 113 | 113 | * @var array |
| 114 | 114 | */ |
| 115 | - protected $qb_having = array(); |
|
| 115 | + protected $qb_having = array(); |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * QB keys |
| 119 | 119 | * |
| 120 | 120 | * @var array |
| 121 | 121 | */ |
| 122 | - protected $qb_keys = array(); |
|
| 122 | + protected $qb_keys = array(); |
|
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * QB LIMIT data |
| 126 | 126 | * |
| 127 | 127 | * @var int |
| 128 | 128 | */ |
| 129 | - protected $qb_limit = FALSE; |
|
| 129 | + protected $qb_limit = FALSE; |
|
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * QB OFFSET data |
| 133 | 133 | * |
| 134 | 134 | * @var int |
| 135 | 135 | */ |
| 136 | - protected $qb_offset = FALSE; |
|
| 136 | + protected $qb_offset = FALSE; |
|
| 137 | 137 | |
| 138 | 138 | /** |
| 139 | 139 | * QB ORDER BY data |
| 140 | 140 | * |
| 141 | 141 | * @var array |
| 142 | 142 | */ |
| 143 | - protected $qb_orderby = array(); |
|
| 143 | + protected $qb_orderby = array(); |
|
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * QB data sets |
| 147 | 147 | * |
| 148 | 148 | * @var array |
| 149 | 149 | */ |
| 150 | - protected $qb_set = array(); |
|
| 150 | + protected $qb_set = array(); |
|
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * QB aliased tables list |
| 154 | 154 | * |
| 155 | 155 | * @var array |
| 156 | 156 | */ |
| 157 | - protected $qb_aliased_tables = array(); |
|
| 157 | + protected $qb_aliased_tables = array(); |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * QB WHERE group started flag |
| 161 | 161 | * |
| 162 | 162 | * @var bool |
| 163 | 163 | */ |
| 164 | - protected $qb_where_group_started = FALSE; |
|
| 164 | + protected $qb_where_group_started = FALSE; |
|
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | 167 | * QB WHERE group count |
| 168 | 168 | * |
| 169 | 169 | * @var int |
| 170 | 170 | */ |
| 171 | - protected $qb_where_group_count = 0; |
|
| 171 | + protected $qb_where_group_count = 0; |
|
| 172 | 172 | |
| 173 | 173 | // Query Builder Caching variables |
| 174 | 174 | |
@@ -177,84 +177,84 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @var bool |
| 179 | 179 | */ |
| 180 | - protected $qb_caching = FALSE; |
|
| 180 | + protected $qb_caching = FALSE; |
|
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | 183 | * QB Cache exists list |
| 184 | 184 | * |
| 185 | 185 | * @var array |
| 186 | 186 | */ |
| 187 | - protected $qb_cache_exists = array(); |
|
| 187 | + protected $qb_cache_exists = array(); |
|
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | 190 | * QB Cache SELECT data |
| 191 | 191 | * |
| 192 | 192 | * @var array |
| 193 | 193 | */ |
| 194 | - protected $qb_cache_select = array(); |
|
| 194 | + protected $qb_cache_select = array(); |
|
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | 197 | * QB Cache FROM data |
| 198 | 198 | * |
| 199 | 199 | * @var array |
| 200 | 200 | */ |
| 201 | - protected $qb_cache_from = array(); |
|
| 201 | + protected $qb_cache_from = array(); |
|
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | 204 | * QB Cache JOIN data |
| 205 | 205 | * |
| 206 | 206 | * @var array |
| 207 | 207 | */ |
| 208 | - protected $qb_cache_join = array(); |
|
| 208 | + protected $qb_cache_join = array(); |
|
| 209 | 209 | |
| 210 | 210 | /** |
| 211 | 211 | * QB Cache WHERE data |
| 212 | 212 | * |
| 213 | 213 | * @var array |
| 214 | 214 | */ |
| 215 | - protected $qb_cache_where = array(); |
|
| 215 | + protected $qb_cache_where = array(); |
|
| 216 | 216 | |
| 217 | 217 | /** |
| 218 | 218 | * QB Cache GROUP BY data |
| 219 | 219 | * |
| 220 | 220 | * @var array |
| 221 | 221 | */ |
| 222 | - protected $qb_cache_groupby = array(); |
|
| 222 | + protected $qb_cache_groupby = array(); |
|
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | 225 | * QB Cache HAVING data |
| 226 | 226 | * |
| 227 | 227 | * @var array |
| 228 | 228 | */ |
| 229 | - protected $qb_cache_having = array(); |
|
| 229 | + protected $qb_cache_having = array(); |
|
| 230 | 230 | |
| 231 | 231 | /** |
| 232 | 232 | * QB Cache ORDER BY data |
| 233 | 233 | * |
| 234 | 234 | * @var array |
| 235 | 235 | */ |
| 236 | - protected $qb_cache_orderby = array(); |
|
| 236 | + protected $qb_cache_orderby = array(); |
|
| 237 | 237 | |
| 238 | 238 | /** |
| 239 | 239 | * QB Cache data sets |
| 240 | 240 | * |
| 241 | 241 | * @var array |
| 242 | 242 | */ |
| 243 | - protected $qb_cache_set = array(); |
|
| 243 | + protected $qb_cache_set = array(); |
|
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * QB No Escape data |
| 247 | 247 | * |
| 248 | 248 | * @var array |
| 249 | 249 | */ |
| 250 | - protected $qb_no_escape = array(); |
|
| 250 | + protected $qb_no_escape = array(); |
|
| 251 | 251 | |
| 252 | 252 | /** |
| 253 | 253 | * QB Cache No Escape data |
| 254 | 254 | * |
| 255 | 255 | * @var array |
| 256 | 256 | */ |
| 257 | - protected $qb_cache_no_escape = array(); |
|
| 257 | + protected $qb_cache_no_escape = array(); |
|
| 258 | 258 | |
| 259 | 259 | // -------------------------------------------------------------------- |
| 260 | 260 | |
@@ -2605,9 +2605,9 @@ discard block |
||
| 2605 | 2605 | |
| 2606 | 2606 | foreach (array_unique($this->qb_cache_exists) as $val) // select, from, etc. |
| 2607 | 2607 | { |
| 2608 | - $qb_variable = 'qb_'.$val; |
|
| 2609 | - $qb_cache_var = 'qb_cache_'.$val; |
|
| 2610 | - $qb_new = $this->$qb_cache_var; |
|
| 2608 | + $qb_variable = 'qb_'.$val; |
|
| 2609 | + $qb_cache_var = 'qb_cache_'.$val; |
|
| 2610 | + $qb_new = $this->$qb_cache_var; |
|
| 2611 | 2611 | |
| 2612 | 2612 | for ($i = 0, $c = count($this->$qb_variable); $i < $c; $i++) |
| 2613 | 2613 | { |
@@ -474,8 +474,7 @@ discard block |
||
| 474 | 474 | $this->qb_cache_exists[] = 'from'; |
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | - } |
|
| 478 | - else |
|
| 477 | + } else |
|
| 479 | 478 | { |
| 480 | 479 | $val = trim($val); |
| 481 | 480 | |
@@ -518,8 +517,7 @@ discard block |
||
| 518 | 517 | if ( ! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'), TRUE)) |
| 519 | 518 | { |
| 520 | 519 | $type = ''; |
| 521 | - } |
|
| 522 | - else |
|
| 520 | + } else |
|
| 523 | 521 | { |
| 524 | 522 | $type .= ' '; |
| 525 | 523 | } |
@@ -556,12 +554,10 @@ discard block |
||
| 556 | 554 | elseif ($escape === TRUE && preg_match("/([\[\]\w\.'-]+)(\s*[^\"\[`'\w]+\s*)(.+)/i", $cond, $match)) |
| 557 | 555 | { |
| 558 | 556 | $cond = ' ON '.$this->protect_identifiers($match[1]).$match[2].$this->protect_identifiers($match[3]); |
| 559 | - } |
|
| 560 | - elseif ( ! $this->_has_operator($cond)) |
|
| 557 | + } elseif ( ! $this->_has_operator($cond)) |
|
| 561 | 558 | { |
| 562 | 559 | $cond = ' USING ('.($escape ? $this->escape_identifiers($cond) : $cond).')'; |
| 563 | - } |
|
| 564 | - else |
|
| 560 | + } else |
|
| 565 | 561 | { |
| 566 | 562 | $cond = ' ON '.$cond; |
| 567 | 563 | } |
@@ -666,13 +662,11 @@ discard block |
||
| 666 | 662 | { |
| 667 | 663 | $k .= ' = '; |
| 668 | 664 | } |
| 669 | - } |
|
| 670 | - elseif ( ! $this->_has_operator($k)) |
|
| 665 | + } elseif ( ! $this->_has_operator($k)) |
|
| 671 | 666 | { |
| 672 | 667 | // value appears not to have been set, assign the test to IS NULL |
| 673 | 668 | $k .= ' IS NULL'; |
| 674 | - } |
|
| 675 | - elseif (preg_match('/\s*(!?=|<>|IS(?:\s+NOT)?)\s*$/i', $k, $match, PREG_OFFSET_CAPTURE)) |
|
| 669 | + } elseif (preg_match('/\s*(!?=|<>|IS(?:\s+NOT)?)\s*$/i', $k, $match, PREG_OFFSET_CAPTURE)) |
|
| 676 | 670 | { |
| 677 | 671 | $k = substr($k, 0, $match[0][1]).($match[1][0] === '=' ? ' IS NULL' : ' IS NOT NULL'); |
| 678 | 672 | } |
@@ -801,8 +795,7 @@ discard block |
||
| 801 | 795 | { |
| 802 | 796 | $where_in[] = $this->escape($value); |
| 803 | 797 | } |
| 804 | - } |
|
| 805 | - else |
|
| 798 | + } else |
|
| 806 | 799 | { |
| 807 | 800 | $where_in = array_values($values); |
| 808 | 801 | } |
@@ -944,16 +937,13 @@ discard block |
||
| 944 | 937 | if ($side === 'none') |
| 945 | 938 | { |
| 946 | 939 | $like_statement = "{$prefix} {$k} {$not} LIKE '{$v}'"; |
| 947 | - } |
|
| 948 | - elseif ($side === 'before') |
|
| 940 | + } elseif ($side === 'before') |
|
| 949 | 941 | { |
| 950 | 942 | $like_statement = "{$prefix} {$k} {$not} LIKE '%{$v}'"; |
| 951 | - } |
|
| 952 | - elseif ($side === 'after') |
|
| 943 | + } elseif ($side === 'after') |
|
| 953 | 944 | { |
| 954 | 945 | $like_statement = "{$prefix} {$k} {$not} LIKE '{$v}%'"; |
| 955 | - } |
|
| 956 | - else |
|
| 946 | + } else |
|
| 957 | 947 | { |
| 958 | 948 | $like_statement = "{$prefix} {$k} {$not} LIKE '%{$v}%'"; |
| 959 | 949 | } |
@@ -1184,12 +1174,10 @@ discard block |
||
| 1184 | 1174 | $orderby = ctype_digit((string) $orderby) |
| 1185 | 1175 | ? sprintf($this->_random_keyword[1], $orderby) |
| 1186 | 1176 | : $this->_random_keyword[0]; |
| 1187 | - } |
|
| 1188 | - elseif (empty($orderby)) |
|
| 1177 | + } elseif (empty($orderby)) |
|
| 1189 | 1178 | { |
| 1190 | 1179 | return $this; |
| 1191 | - } |
|
| 1192 | - elseif ($direction !== '') |
|
| 1180 | + } elseif ($direction !== '') |
|
| 1193 | 1181 | { |
| 1194 | 1182 | $direction = in_array($direction, array('ASC', 'DESC'), TRUE) ? ' '.$direction : ''; |
| 1195 | 1183 | } |
@@ -1199,8 +1187,7 @@ discard block |
||
| 1199 | 1187 | if ($escape === FALSE) |
| 1200 | 1188 | { |
| 1201 | 1189 | $qb_orderby[] = array('field' => $orderby, 'direction' => $direction, 'escape' => FALSE); |
| 1202 | - } |
|
| 1203 | - else |
|
| 1190 | + } else |
|
| 1204 | 1191 | { |
| 1205 | 1192 | $qb_orderby = array(); |
| 1206 | 1193 | foreach (explode(',', $orderby) as $field) |
@@ -1646,8 +1633,7 @@ discard block |
||
| 1646 | 1633 | if ($table !== '') |
| 1647 | 1634 | { |
| 1648 | 1635 | $this->qb_from[0] = $table; |
| 1649 | - } |
|
| 1650 | - elseif ( ! isset($this->qb_from[0])) |
|
| 1636 | + } elseif ( ! isset($this->qb_from[0])) |
|
| 1651 | 1637 | { |
| 1652 | 1638 | return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; |
| 1653 | 1639 | } |
@@ -1824,8 +1810,7 @@ discard block |
||
| 1824 | 1810 | if ($table !== '') |
| 1825 | 1811 | { |
| 1826 | 1812 | $this->qb_from = array($this->protect_identifiers($table, TRUE, NULL, FALSE)); |
| 1827 | - } |
|
| 1828 | - elseif ( ! isset($this->qb_from[0])) |
|
| 1813 | + } elseif ( ! isset($this->qb_from[0])) |
|
| 1829 | 1814 | { |
| 1830 | 1815 | return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; |
| 1831 | 1816 | } |
@@ -1995,8 +1980,7 @@ discard block |
||
| 1995 | 1980 | } |
| 1996 | 1981 | |
| 1997 | 1982 | $table = $this->qb_from[0]; |
| 1998 | - } |
|
| 1999 | - else |
|
| 1983 | + } else |
|
| 2000 | 1984 | { |
| 2001 | 1985 | $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); |
| 2002 | 1986 | } |
@@ -2028,8 +2012,7 @@ discard block |
||
| 2028 | 2012 | } |
| 2029 | 2013 | |
| 2030 | 2014 | $table = $this->qb_from[0]; |
| 2031 | - } |
|
| 2032 | - else |
|
| 2015 | + } else |
|
| 2033 | 2016 | { |
| 2034 | 2017 | $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); |
| 2035 | 2018 | } |
@@ -2102,8 +2085,7 @@ discard block |
||
| 2102 | 2085 | } |
| 2103 | 2086 | |
| 2104 | 2087 | $table = $this->qb_from[0]; |
| 2105 | - } |
|
| 2106 | - elseif (is_array($table)) |
|
| 2088 | + } elseif (is_array($table)) |
|
| 2107 | 2089 | { |
| 2108 | 2090 | empty($where) && $reset_data = FALSE; |
| 2109 | 2091 | |
@@ -2113,8 +2095,7 @@ discard block |
||
| 2113 | 2095 | } |
| 2114 | 2096 | |
| 2115 | 2097 | return; |
| 2116 | - } |
|
| 2117 | - else |
|
| 2098 | + } else |
|
| 2118 | 2099 | { |
| 2119 | 2100 | $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); |
| 2120 | 2101 | } |
@@ -2259,16 +2240,14 @@ discard block |
||
| 2259 | 2240 | if ($select_override !== FALSE) |
| 2260 | 2241 | { |
| 2261 | 2242 | $sql = $select_override; |
| 2262 | - } |
|
| 2263 | - else |
|
| 2243 | + } else |
|
| 2264 | 2244 | { |
| 2265 | 2245 | $sql = ( ! $this->qb_distinct) ? 'SELECT ' : 'SELECT DISTINCT '; |
| 2266 | 2246 | |
| 2267 | 2247 | if (count($this->qb_select) === 0) |
| 2268 | 2248 | { |
| 2269 | 2249 | $sql .= '*'; |
| 2270 | - } |
|
| 2271 | - else |
|
| 2250 | + } else |
|
| 2272 | 2251 | { |
| 2273 | 2252 | // Cycle through the "select" portion of the query and prep each column name. |
| 2274 | 2253 | // The reason we protect identifiers here rather than in the select() function |
@@ -2333,8 +2312,7 @@ discard block |
||
| 2333 | 2312 | if (is_string($this->{$qb_key}[$i])) |
| 2334 | 2313 | { |
| 2335 | 2314 | continue; |
| 2336 | - } |
|
| 2337 | - elseif ($this->{$qb_key}[$i]['escape'] === FALSE) |
|
| 2315 | + } elseif ($this->{$qb_key}[$i]['escape'] === FALSE) |
|
| 2338 | 2316 | { |
| 2339 | 2317 | $this->{$qb_key}[$i] = $this->{$qb_key}[$i]['condition']; |
| 2340 | 2318 | continue; |
@@ -2449,8 +2427,7 @@ discard block |
||
| 2449 | 2427 | } |
| 2450 | 2428 | |
| 2451 | 2429 | return $this->qb_orderby = "\nORDER BY ".implode(', ', $this->qb_orderby); |
| 2452 | - } |
|
| 2453 | - elseif (is_string($this->qb_orderby)) |
|
| 2430 | + } elseif (is_string($this->qb_orderby)) |
|
| 2454 | 2431 | { |
| 2455 | 2432 | return $this->qb_orderby; |
| 2456 | 2433 | } |
@@ -2597,15 +2574,16 @@ discard block |
||
| 2597 | 2574 | if (count($this->qb_cache_exists) === 0) |
| 2598 | 2575 | { |
| 2599 | 2576 | return; |
| 2600 | - } |
|
| 2601 | - elseif (in_array('select', $this->qb_cache_exists, TRUE)) |
|
| 2577 | + } elseif (in_array('select', $this->qb_cache_exists, TRUE)) |
|
| 2602 | 2578 | { |
| 2603 | 2579 | $qb_no_escape = $this->qb_cache_no_escape; |
| 2604 | 2580 | } |
| 2605 | 2581 | |
| 2606 | - foreach (array_unique($this->qb_cache_exists) as $val) // select, from, etc. |
|
| 2582 | + foreach (array_unique($this->qb_cache_exists) as $val) { |
|
| 2583 | + // select, from, etc. |
|
| 2607 | 2584 | { |
| 2608 | 2585 | $qb_variable = 'qb_'.$val; |
| 2586 | + } |
|
| 2609 | 2587 | $qb_cache_var = 'qb_cache_'.$val; |
| 2610 | 2588 | $qb_new = $this->$qb_cache_var; |
| 2611 | 2589 | |