@@ -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 | } |
@@ -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 | } |
@@ -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 | /** |
@@ -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 | { |
@@ -313,8 +310,7 @@ discard block |
||
313 | 310 | { |
314 | 311 | throw new RuntimeException('Unable to locate the model you have specified: '.$model); |
315 | 312 | } |
316 | - } |
|
317 | - elseif ( ! is_subclass_of($model, 'CI_Model')) |
|
313 | + } elseif ( ! is_subclass_of($model, 'CI_Model')) |
|
318 | 314 | { |
319 | 315 | throw new RuntimeException("Class ".$model." already exists and doesn't extend CI_Model"); |
320 | 316 | } |
@@ -425,8 +421,7 @@ discard block |
||
425 | 421 | require_once($driver_path); |
426 | 422 | $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; |
427 | 423 | } |
428 | - } |
|
429 | - else |
|
424 | + } else |
|
430 | 425 | { |
431 | 426 | $class = 'CI_DB_'.$db->dbdriver.'_forge'; |
432 | 427 | } |
@@ -694,8 +689,7 @@ discard block |
||
694 | 689 | } |
695 | 690 | |
696 | 691 | return $this; |
697 | - } |
|
698 | - elseif (empty($library)) |
|
692 | + } elseif (empty($library)) |
|
699 | 693 | { |
700 | 694 | return FALSE; |
701 | 695 | } |
@@ -788,8 +782,7 @@ discard block |
||
788 | 782 | array_shift($this->_ci_helper_paths); |
789 | 783 | array_shift($this->_ci_view_paths); |
790 | 784 | array_pop($config->_config_paths); |
791 | - } |
|
792 | - else |
|
785 | + } else |
|
793 | 786 | { |
794 | 787 | $path = rtrim($path, '/').'/'; |
795 | 788 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -851,8 +844,7 @@ discard block |
||
851 | 844 | { |
852 | 845 | $_ci_x = explode('/', $_ci_path); |
853 | 846 | $_ci_file = end($_ci_x); |
854 | - } |
|
855 | - else |
|
847 | + } else |
|
856 | 848 | { |
857 | 849 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
858 | 850 | $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; |
@@ -922,8 +914,7 @@ discard block |
||
922 | 914 | if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) |
923 | 915 | { |
924 | 916 | echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
925 | - } |
|
926 | - else |
|
917 | + } else |
|
927 | 918 | { |
928 | 919 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
929 | 920 | } |
@@ -950,8 +941,7 @@ discard block |
||
950 | 941 | if (ob_get_level() > $this->_ci_ob_level + 1) |
951 | 942 | { |
952 | 943 | ob_end_flush(); |
953 | - } |
|
954 | - else |
|
944 | + } else |
|
955 | 945 | { |
956 | 946 | $_ci_CI->output->append_output(ob_get_contents()); |
957 | 947 | @ob_end_clean(); |
@@ -989,8 +979,7 @@ discard block |
||
989 | 979 | |
990 | 980 | // Get the filename from the path |
991 | 981 | $class = substr($class, $last_slash); |
992 | - } |
|
993 | - else |
|
982 | + } else |
|
994 | 983 | { |
995 | 984 | $subdir = ''; |
996 | 985 | } |
@@ -1108,8 +1097,7 @@ discard block |
||
1108 | 1097 | if (class_exists($prefix.$library_name, FALSE)) |
1109 | 1098 | { |
1110 | 1099 | return $this->_ci_init_library($library_name, $prefix, $params, $object_name); |
1111 | - } |
|
1112 | - else |
|
1100 | + } else |
|
1113 | 1101 | { |
1114 | 1102 | log_message('debug', $path.' exists, but does not declare '.$prefix.$library_name); |
1115 | 1103 | } |
@@ -1129,8 +1117,7 @@ discard block |
||
1129 | 1117 | { |
1130 | 1118 | $prefix = config_item('subclass_prefix'); |
1131 | 1119 | break; |
1132 | - } |
|
1133 | - else |
|
1120 | + } else |
|
1134 | 1121 | { |
1135 | 1122 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
1136 | 1123 | } |
@@ -1177,8 +1164,7 @@ discard block |
||
1177 | 1164 | { |
1178 | 1165 | include($path.'config/'.strtolower($class).'.php'); |
1179 | 1166 | $found = TRUE; |
1180 | - } |
|
1181 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1167 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1182 | 1168 | { |
1183 | 1169 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
1184 | 1170 | $found = TRUE; |
@@ -1188,8 +1174,7 @@ discard block |
||
1188 | 1174 | { |
1189 | 1175 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
1190 | 1176 | $found = TRUE; |
1191 | - } |
|
1192 | - elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1177 | + } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1193 | 1178 | { |
1194 | 1179 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
1195 | 1180 | $found = TRUE; |
@@ -1380,8 +1365,7 @@ discard block |
||
1380 | 1365 | if ( ! is_array($filename)) |
1381 | 1366 | { |
1382 | 1367 | return array(strtolower(str_replace(array($extension, '.php'), '', $filename).$extension)); |
1383 | - } |
|
1384 | - else |
|
1368 | + } else |
|
1385 | 1369 | { |
1386 | 1370 | foreach ($filename as $key => $val) |
1387 | 1371 | { |
@@ -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 === '') |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * |
452 | 452 | * This is just a dummy method that all drivers will override. |
453 | 453 | * |
454 | - * @return mixed |
|
454 | + * @return boolean |
|
455 | 455 | */ |
456 | 456 | public function db_connect() |
457 | 457 | { |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | /** |
464 | 464 | * Persistent database connection |
465 | 465 | * |
466 | - * @return mixed |
|
466 | + * @return boolean |
|
467 | 467 | */ |
468 | 468 | public function db_pconnect() |
469 | 469 | { |
@@ -508,6 +508,7 @@ discard block |
||
508 | 508 | * Set client character set |
509 | 509 | * |
510 | 510 | * @param string |
511 | + * @param string $charset |
|
511 | 512 | * @return bool |
512 | 513 | */ |
513 | 514 | public function db_set_charset($charset) |
@@ -768,6 +769,7 @@ discard block |
||
768 | 769 | * not require all the features of the main query() function. |
769 | 770 | * |
770 | 771 | * @param string the sql query |
772 | + * @param string $sql |
|
771 | 773 | * @return mixed |
772 | 774 | */ |
773 | 775 | public function simple_query($sql) |
@@ -968,6 +970,7 @@ discard block |
||
968 | 970 | * |
969 | 971 | * @param string the sql statement |
970 | 972 | * @param array an array of bind data |
973 | + * @param string $sql |
|
971 | 974 | * @return string |
972 | 975 | */ |
973 | 976 | public function compile_binds($sql, $binds) |
@@ -1032,6 +1035,7 @@ discard block |
||
1032 | 1035 | * Determines if a query is a "write" type. |
1033 | 1036 | * |
1034 | 1037 | * @param string An SQL query string |
1038 | + * @param string $sql |
|
1035 | 1039 | * @return bool |
1036 | 1040 | */ |
1037 | 1041 | public function is_write_type($sql) |
@@ -1168,6 +1172,7 @@ discard block |
||
1168 | 1172 | * Platform-dependant string escape |
1169 | 1173 | * |
1170 | 1174 | * @param string |
1175 | + * @param string $str |
|
1171 | 1176 | * @return string |
1172 | 1177 | */ |
1173 | 1178 | protected function _escape_str($str) |
@@ -1461,6 +1466,7 @@ discard block |
||
1461 | 1466 | * @param string the table name |
1462 | 1467 | * @param array the insert keys |
1463 | 1468 | * @param array the insert values |
1469 | + * @param string $table |
|
1464 | 1470 | * @return string |
1465 | 1471 | */ |
1466 | 1472 | protected function _insert($table, $keys, $values) |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @var string |
94 | 94 | */ |
95 | - public $dbdriver = 'mysqli'; |
|
95 | + public $dbdriver = 'mysqli'; |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * Sub-driver |
@@ -107,63 +107,63 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @var string |
109 | 109 | */ |
110 | - public $dbprefix = ''; |
|
110 | + public $dbprefix = ''; |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Character set |
114 | 114 | * |
115 | 115 | * @var string |
116 | 116 | */ |
117 | - public $char_set = 'utf8'; |
|
117 | + public $char_set = 'utf8'; |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Collation |
121 | 121 | * |
122 | 122 | * @var string |
123 | 123 | */ |
124 | - public $dbcollat = 'utf8_general_ci'; |
|
124 | + public $dbcollat = 'utf8_general_ci'; |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Encryption flag/data |
128 | 128 | * |
129 | 129 | * @var mixed |
130 | 130 | */ |
131 | - public $encrypt = FALSE; |
|
131 | + public $encrypt = FALSE; |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Swap Prefix |
135 | 135 | * |
136 | 136 | * @var string |
137 | 137 | */ |
138 | - public $swap_pre = ''; |
|
138 | + public $swap_pre = ''; |
|
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Database port |
142 | 142 | * |
143 | 143 | * @var int |
144 | 144 | */ |
145 | - public $port = ''; |
|
145 | + public $port = ''; |
|
146 | 146 | |
147 | 147 | /** |
148 | 148 | * Persistent connection flag |
149 | 149 | * |
150 | 150 | * @var bool |
151 | 151 | */ |
152 | - public $pconnect = FALSE; |
|
152 | + public $pconnect = FALSE; |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Connection ID |
156 | 156 | * |
157 | 157 | * @var object|resource |
158 | 158 | */ |
159 | - public $conn_id = FALSE; |
|
159 | + public $conn_id = FALSE; |
|
160 | 160 | |
161 | 161 | /** |
162 | 162 | * Result ID |
163 | 163 | * |
164 | 164 | * @var object|resource |
165 | 165 | */ |
166 | - public $result_id = FALSE; |
|
166 | + public $result_id = FALSE; |
|
167 | 167 | |
168 | 168 | /** |
169 | 169 | * Debug flag |
@@ -172,21 +172,21 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @var bool |
174 | 174 | */ |
175 | - public $db_debug = FALSE; |
|
175 | + public $db_debug = FALSE; |
|
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Benchmark time |
179 | 179 | * |
180 | 180 | * @var int |
181 | 181 | */ |
182 | - public $benchmark = 0; |
|
182 | + public $benchmark = 0; |
|
183 | 183 | |
184 | 184 | /** |
185 | 185 | * Executed queries count |
186 | 186 | * |
187 | 187 | * @var int |
188 | 188 | */ |
189 | - public $query_count = 0; |
|
189 | + public $query_count = 0; |
|
190 | 190 | |
191 | 191 | /** |
192 | 192 | * Bind marker |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @var string |
197 | 197 | */ |
198 | - public $bind_marker = '?'; |
|
198 | + public $bind_marker = '?'; |
|
199 | 199 | |
200 | 200 | /** |
201 | 201 | * Save queries flag |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @var bool |
206 | 206 | */ |
207 | - public $save_queries = TRUE; |
|
207 | + public $save_queries = TRUE; |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * Queries list |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @see CI_DB_driver::$save_queries |
213 | 213 | * @var string[] |
214 | 214 | */ |
215 | - public $queries = array(); |
|
215 | + public $queries = array(); |
|
216 | 216 | |
217 | 217 | /** |
218 | 218 | * Query times |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @var array |
223 | 223 | */ |
224 | - public $query_times = array(); |
|
224 | + public $query_times = array(); |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * Data cache |
@@ -230,28 +230,28 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @var array |
232 | 232 | */ |
233 | - public $data_cache = array(); |
|
233 | + public $data_cache = array(); |
|
234 | 234 | |
235 | 235 | /** |
236 | 236 | * Transaction enabled flag |
237 | 237 | * |
238 | 238 | * @var bool |
239 | 239 | */ |
240 | - public $trans_enabled = TRUE; |
|
240 | + public $trans_enabled = TRUE; |
|
241 | 241 | |
242 | 242 | /** |
243 | 243 | * Strict transaction mode flag |
244 | 244 | * |
245 | 245 | * @var bool |
246 | 246 | */ |
247 | - public $trans_strict = TRUE; |
|
247 | + public $trans_strict = TRUE; |
|
248 | 248 | |
249 | 249 | /** |
250 | 250 | * Transaction depth level |
251 | 251 | * |
252 | 252 | * @var int |
253 | 253 | */ |
254 | - protected $_trans_depth = 0; |
|
254 | + protected $_trans_depth = 0; |
|
255 | 255 | |
256 | 256 | /** |
257 | 257 | * Transaction status flag |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @var bool |
262 | 262 | */ |
263 | - protected $_trans_status = TRUE; |
|
263 | + protected $_trans_status = TRUE; |
|
264 | 264 | |
265 | 265 | /** |
266 | 266 | * Transaction failure flag |
@@ -269,28 +269,28 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @var bool |
271 | 271 | */ |
272 | - protected $_trans_failure = FALSE; |
|
272 | + protected $_trans_failure = FALSE; |
|
273 | 273 | |
274 | 274 | /** |
275 | 275 | * Cache On flag |
276 | 276 | * |
277 | 277 | * @var bool |
278 | 278 | */ |
279 | - public $cache_on = FALSE; |
|
279 | + public $cache_on = FALSE; |
|
280 | 280 | |
281 | 281 | /** |
282 | 282 | * Cache directory path |
283 | 283 | * |
284 | 284 | * @var bool |
285 | 285 | */ |
286 | - public $cachedir = ''; |
|
286 | + public $cachedir = ''; |
|
287 | 287 | |
288 | 288 | /** |
289 | 289 | * Cache auto-delete flag |
290 | 290 | * |
291 | 291 | * @var bool |
292 | 292 | */ |
293 | - public $cache_autodel = FALSE; |
|
293 | + public $cache_autodel = FALSE; |
|
294 | 294 | |
295 | 295 | /** |
296 | 296 | * DB Cache object |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @var bool |
307 | 307 | */ |
308 | - protected $_protect_identifiers = TRUE; |
|
308 | + protected $_protect_identifiers = TRUE; |
|
309 | 309 | |
310 | 310 | /** |
311 | 311 | * List of reserved identifiers |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @var string[] |
316 | 316 | */ |
317 | - protected $_reserved_identifiers = array('*'); |
|
317 | + protected $_reserved_identifiers = array('*'); |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Identifier escape character |
@@ -711,8 +711,8 @@ discard block |
||
711 | 711 | } |
712 | 712 | |
713 | 713 | // Load and instantiate the result driver |
714 | - $driver = $this->load_rdriver(); |
|
715 | - $RES = new $driver($this); |
|
714 | + $driver = $this->load_rdriver(); |
|
715 | + $RES = new $driver($this); |
|
716 | 716 | |
717 | 717 | // Is query caching enabled? If so, we'll serialize the |
718 | 718 | // result object and save it to a cache file. |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | // result object, so we'll have to compile the data |
726 | 726 | // and save it) |
727 | 727 | $CR = new CI_DB_result($this); |
728 | - $CR->result_object = $RES->result_object(); |
|
729 | - $CR->result_array = $RES->result_array(); |
|
730 | - $CR->num_rows = $RES->num_rows(); |
|
728 | + $CR->result_object = $RES->result_object(); |
|
729 | + $CR->result_array = $RES->result_array(); |
|
730 | + $CR->num_rows = $RES->num_rows(); |
|
731 | 731 | |
732 | 732 | // Reset these since cached objects can not utilize resource IDs. |
733 | - $CR->conn_id = NULL; |
|
734 | - $CR->result_id = NULL; |
|
733 | + $CR->conn_id = NULL; |
|
734 | + $CR->result_id = NULL; |
|
735 | 735 | |
736 | 736 | $this->CACHE->write($sql, $CR); |
737 | 737 | } |
@@ -1553,17 +1553,17 @@ discard block |
||
1553 | 1553 | ? '\s+'.preg_quote(trim(sprintf($this->_like_escape_str, $this->_like_escape_chr)), '/') |
1554 | 1554 | : ''; |
1555 | 1555 | $_operators = array( |
1556 | - '\s*(?:<|>|!)?=\s*', // =, <=, >=, != |
|
1557 | - '\s*<>?\s*', // <, <> |
|
1558 | - '\s*>\s*', // > |
|
1559 | - '\s+IS NULL', // IS NULL |
|
1560 | - '\s+IS NOT NULL', // IS NOT NULL |
|
1561 | - '\s+EXISTS\s*\([^\)]+\)', // EXISTS(sql) |
|
1562 | - '\s+NOT EXISTS\s*\([^\)]+\)', // NOT EXISTS(sql) |
|
1563 | - '\s+BETWEEN\s+', // BETWEEN value AND value |
|
1564 | - '\s+IN\s*\([^\)]+\)', // IN(list) |
|
1565 | - '\s+NOT IN\s*\([^\)]+\)', // NOT IN (list) |
|
1566 | - '\s+LIKE\s+\S.*('.$_les.')?', // LIKE 'expr'[ ESCAPE '%s'] |
|
1556 | + '\s*(?:<|>|!)?=\s*', // =, <=, >=, != |
|
1557 | + '\s*<>?\s*', // <, <> |
|
1558 | + '\s*>\s*', // > |
|
1559 | + '\s+IS NULL', // IS NULL |
|
1560 | + '\s+IS NOT NULL', // IS NOT NULL |
|
1561 | + '\s+EXISTS\s*\([^\)]+\)', // EXISTS(sql) |
|
1562 | + '\s+NOT EXISTS\s*\([^\)]+\)', // NOT EXISTS(sql) |
|
1563 | + '\s+BETWEEN\s+', // BETWEEN value AND value |
|
1564 | + '\s+IN\s*\([^\)]+\)', // IN(list) |
|
1565 | + '\s+NOT IN\s*\([^\)]+\)', // NOT IN (list) |
|
1566 | + '\s+LIKE\s+\S.*('.$_les.')?', // LIKE 'expr'[ ESCAPE '%s'] |
|
1567 | 1567 | '\s+NOT LIKE\s+\S.*('.$_les.')?' // NOT LIKE 'expr'[ ESCAPE '%s'] |
1568 | 1568 | ); |
1569 | 1569 | |
@@ -1731,7 +1731,7 @@ discard block |
||
1731 | 1731 | */ |
1732 | 1732 | public function display_error($error = '', $swap = '', $native = FALSE) |
1733 | 1733 | { |
1734 | - $LANG =& load_class('Lang', 'core'); |
|
1734 | + $LANG = & load_class('Lang', 'core'); |
|
1735 | 1735 | $LANG->load('db'); |
1736 | 1736 | |
1737 | 1737 | $heading = $LANG->line('db_error_heading'); |
@@ -1769,7 +1769,7 @@ discard block |
||
1769 | 1769 | } |
1770 | 1770 | } |
1771 | 1771 | |
1772 | - $error =& load_class('Exceptions', 'core'); |
|
1772 | + $error = & load_class('Exceptions', 'core'); |
|
1773 | 1773 | echo $error->show_error($heading, $message, 'error_db'); |
1774 | 1774 | exit(8); // EXIT_DATABASE |
1775 | 1775 | } |
@@ -599,8 +599,7 @@ discard block |
||
599 | 599 | { |
600 | 600 | log_message('error', 'Invalid query: '.$sql); |
601 | 601 | return ($this->db_debug) ? $this->display_error('db_invalid_query') : FALSE; |
602 | - } |
|
603 | - elseif ( ! is_bool($return_object)) |
|
602 | + } elseif ( ! is_bool($return_object)) |
|
604 | 603 | { |
605 | 604 | $return_object = ! $this->is_write_type($sql); |
606 | 605 | } |
@@ -975,13 +974,11 @@ discard block |
||
975 | 974 | if (empty($binds) OR empty($this->bind_marker) OR strpos($sql, $this->bind_marker) === FALSE) |
976 | 975 | { |
977 | 976 | return $sql; |
978 | - } |
|
979 | - elseif ( ! is_array($binds)) |
|
977 | + } elseif ( ! is_array($binds)) |
|
980 | 978 | { |
981 | 979 | $binds = array($binds); |
982 | 980 | $bind_count = 1; |
983 | - } |
|
984 | - else |
|
981 | + } else |
|
985 | 982 | { |
986 | 983 | // Make sure we're using numeric keys |
987 | 984 | $binds = array_values($binds); |
@@ -1005,8 +1002,7 @@ discard block |
||
1005 | 1002 | { |
1006 | 1003 | return $sql; |
1007 | 1004 | } |
1008 | - } |
|
1009 | - elseif (($c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', $sql, $matches, PREG_OFFSET_CAPTURE)) !== $bind_count) |
|
1005 | + } elseif (($c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', $sql, $matches, PREG_OFFSET_CAPTURE)) !== $bind_count) |
|
1010 | 1006 | { |
1011 | 1007 | return $sql; |
1012 | 1008 | } |
@@ -1093,16 +1089,13 @@ discard block |
||
1093 | 1089 | { |
1094 | 1090 | $str = array_map(array(&$this, 'escape'), $str); |
1095 | 1091 | return $str; |
1096 | - } |
|
1097 | - elseif (is_string($str) OR (is_object($str) && method_exists($str, '__toString'))) |
|
1092 | + } elseif (is_string($str) OR (is_object($str) && method_exists($str, '__toString'))) |
|
1098 | 1093 | { |
1099 | 1094 | return "'".$this->escape_str($str)."'"; |
1100 | - } |
|
1101 | - elseif (is_bool($str)) |
|
1095 | + } elseif (is_bool($str)) |
|
1102 | 1096 | { |
1103 | 1097 | return ($str === FALSE) ? 0 : 1; |
1104 | - } |
|
1105 | - elseif ($str === NULL) |
|
1098 | + } elseif ($str === NULL) |
|
1106 | 1099 | { |
1107 | 1100 | return 'NULL'; |
1108 | 1101 | } |
@@ -1253,12 +1246,10 @@ discard block |
||
1253 | 1246 | if (isset($row['table_name'])) |
1254 | 1247 | { |
1255 | 1248 | $key = 'table_name'; |
1256 | - } |
|
1257 | - elseif (isset($row['TABLE_NAME'])) |
|
1249 | + } elseif (isset($row['TABLE_NAME'])) |
|
1258 | 1250 | { |
1259 | 1251 | $key = 'TABLE_NAME'; |
1260 | - } |
|
1261 | - else |
|
1252 | + } else |
|
1262 | 1253 | { |
1263 | 1254 | /* We have no other choice but to just get the first element's key. |
1264 | 1255 | * Due to array_shift() accepting its argument by reference, if |
@@ -1321,12 +1312,10 @@ discard block |
||
1321 | 1312 | if (isset($row['column_name'])) |
1322 | 1313 | { |
1323 | 1314 | $key = 'column_name'; |
1324 | - } |
|
1325 | - elseif (isset($row['COLUMN_NAME'])) |
|
1315 | + } elseif (isset($row['COLUMN_NAME'])) |
|
1326 | 1316 | { |
1327 | 1317 | $key = 'COLUMN_NAME'; |
1328 | - } |
|
1329 | - else |
|
1318 | + } else |
|
1330 | 1319 | { |
1331 | 1320 | // We have no other choice but to just get the first element's key. |
1332 | 1321 | $key = key($row); |
@@ -1382,8 +1371,7 @@ discard block |
||
1382 | 1371 | if ($this->_escape_char === '' OR empty($item) OR in_array($item, $this->_reserved_identifiers)) |
1383 | 1372 | { |
1384 | 1373 | return $item; |
1385 | - } |
|
1386 | - elseif (is_array($item)) |
|
1374 | + } elseif (is_array($item)) |
|
1387 | 1375 | { |
1388 | 1376 | foreach ($item as $key => $value) |
1389 | 1377 | { |
@@ -1410,8 +1398,7 @@ discard block |
||
1410 | 1398 | $this->_escape_char[0], |
1411 | 1399 | $this->_escape_char[1] |
1412 | 1400 | ); |
1413 | - } |
|
1414 | - else |
|
1401 | + } else |
|
1415 | 1402 | { |
1416 | 1403 | $preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char, '/'); |
1417 | 1404 | $preg_ec[2] = $preg_ec[3] = $this->_escape_char; |
@@ -1679,8 +1666,7 @@ discard block |
||
1679 | 1666 | if ( ! class_exists('CI_DB_Cache', FALSE)) |
1680 | 1667 | { |
1681 | 1668 | require_once(BASEPATH.'database/DB_cache.php'); |
1682 | - } |
|
1683 | - elseif (is_object($this->CACHE)) |
|
1669 | + } elseif (is_object($this->CACHE)) |
|
1684 | 1670 | { |
1685 | 1671 | return TRUE; |
1686 | 1672 | } |
@@ -1739,8 +1725,7 @@ discard block |
||
1739 | 1725 | if ($native === TRUE) |
1740 | 1726 | { |
1741 | 1727 | $message = (array) $error; |
1742 | - } |
|
1743 | - else |
|
1728 | + } else |
|
1744 | 1729 | { |
1745 | 1730 | $message = is_array($error) ? $error : array(str_replace('%s', $swap, $LANG->line($error))); |
1746 | 1731 | } |
@@ -1843,15 +1828,13 @@ discard block |
||
1843 | 1828 | ? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4)) |
1844 | 1829 | : substr($item, $offset); |
1845 | 1830 | $item = substr($item, 0, $offset); |
1846 | - } |
|
1847 | - elseif ($offset = strrpos($item, ' ')) |
|
1831 | + } elseif ($offset = strrpos($item, ' ')) |
|
1848 | 1832 | { |
1849 | 1833 | $alias = ($protect_identifiers) |
1850 | 1834 | ? ' '.$this->escape_identifiers(substr($item, $offset + 1)) |
1851 | 1835 | : substr($item, $offset); |
1852 | 1836 | $item = substr($item, 0, $offset); |
1853 | - } |
|
1854 | - else |
|
1837 | + } else |
|
1855 | 1838 | { |
1856 | 1839 | $alias = ''; |
1857 | 1840 | } |
@@ -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; |
@@ -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 | /** |