@@ -65,17 +65,17 @@ |
||
65 | 65 | */ |
66 | 66 | public function __construct() |
67 | 67 | { |
68 | - self::$instance =& $this; |
|
68 | + self::$instance = & $this; |
|
69 | 69 | |
70 | 70 | // Assign all the class objects that were instantiated by the |
71 | 71 | // bootstrap file (CodeIgniter.php) to local class variables |
72 | 72 | // so that CI can run as one big super object. |
73 | 73 | foreach (is_loaded() as $var => $class) |
74 | 74 | { |
75 | - $this->$var =& load_class($class); |
|
75 | + $this->$var = & load_class($class); |
|
76 | 76 | } |
77 | 77 | |
78 | - $this->load =& load_class('Loader', 'core'); |
|
78 | + $this->load = & load_class('Loader', 'core'); |
|
79 | 79 | $this->load->initialize(); |
80 | 80 | log_message('info', 'Controller Class Initialized'); |
81 | 81 | } |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @var array |
55 | 55 | */ |
56 | - public $language = array(); |
|
56 | + public $language = array(); |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * List of loaded language files |
60 | 60 | * |
61 | 61 | * @var array |
62 | 62 | */ |
63 | - public $is_loaded = array(); |
|
63 | + public $is_loaded = array(); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Class constructor |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | if (empty($idiom) OR ! preg_match('/^[a-z_-]+$/i', $idiom)) |
110 | 110 | { |
111 | - $config =& get_config(); |
|
111 | + $config = & get_config(); |
|
112 | 112 | $idiom = empty($config['language']) ? 'english' : $config['language']; |
113 | 113 | } |
114 | 114 |
@@ -266,8 +266,7 @@ |
||
266 | 266 | if ($reduce_linebreaks === TRUE) |
267 | 267 | { |
268 | 268 | $table['#<p>\n*</p>#'] = ''; |
269 | - } |
|
270 | - else |
|
269 | + } else |
|
271 | 270 | { |
272 | 271 | // If we have empty paragraph tags we add a non-breaking space |
273 | 272 | // otherwise most browsers won't treat them as true paragraphs |
@@ -113,7 +113,7 @@ |
||
113 | 113 | */ |
114 | 114 | public function __construct() |
115 | 115 | { |
116 | - $config =& get_config(); |
|
116 | + $config = & get_config(); |
|
117 | 117 | |
118 | 118 | $this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/'; |
119 | 119 | $this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '') |
@@ -129,8 +129,7 @@ discard block |
||
129 | 129 | if (is_numeric($config['log_threshold'])) |
130 | 130 | { |
131 | 131 | $this->_threshold = (int) $config['log_threshold']; |
132 | - } |
|
133 | - elseif (is_array($config['log_threshold'])) |
|
132 | + } elseif (is_array($config['log_threshold'])) |
|
134 | 133 | { |
135 | 134 | $this->_threshold = 0; |
136 | 135 | $this->_threshold_array = array_flip($config['log_threshold']); |
@@ -198,8 +197,7 @@ discard block |
||
198 | 197 | $microtime_short = sprintf("%06d", ($microtime_full - floor($microtime_full)) * 1000000); |
199 | 198 | $date = new DateTime(date('Y-m-d H:i:s.'.$microtime_short, $microtime_full)); |
200 | 199 | $date = $date->format($this->_date_fmt); |
201 | - } |
|
202 | - else |
|
200 | + } else |
|
203 | 201 | { |
204 | 202 | $date = date($this->_date_fmt); |
205 | 203 | } |
@@ -62,21 +62,21 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @var array |
64 | 64 | */ |
65 | - public $routes = array(); |
|
65 | + public $routes = array(); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Current class name |
69 | 69 | * |
70 | 70 | * @var string |
71 | 71 | */ |
72 | - public $class = ''; |
|
72 | + public $class = ''; |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * Current method name |
76 | 76 | * |
77 | 77 | * @var string |
78 | 78 | */ |
79 | - public $method = 'index'; |
|
79 | + public $method = 'index'; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Sub-directory that contains the requested controller class |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function __construct($routing = NULL) |
125 | 125 | { |
126 | - $this->config =& load_class('Config', 'core'); |
|
127 | - $this->uri =& load_class('URI', 'core'); |
|
126 | + $this->config = & load_class('Config', 'core'); |
|
127 | + $this->uri = & load_class('URI', 'core'); |
|
128 | 128 | |
129 | 129 | $this->enable_query_strings = ( ! is_cli() && $this->config->item('enable_query_strings') === TRUE); |
130 | 130 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | if (is_array($routing)) |
137 | 137 | { |
138 | 138 | empty($routing['controller']) OR $this->set_class($routing['controller']); |
139 | - empty($routing['function']) OR $this->set_method($routing['function']); |
|
139 | + empty($routing['function']) OR $this->set_method($routing['function']); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | log_message('info', 'Router Class Initialized'); |
@@ -211,8 +211,7 @@ discard block |
||
211 | 211 | 1 => $this->class, |
212 | 212 | 2 => $this->method |
213 | 213 | ); |
214 | - } |
|
215 | - else |
|
214 | + } else |
|
216 | 215 | { |
217 | 216 | $this->_set_default_controller(); |
218 | 217 | } |
@@ -226,8 +225,7 @@ discard block |
||
226 | 225 | if ($this->uri->uri_string !== '') |
227 | 226 | { |
228 | 227 | $this->_parse_routes(); |
229 | - } |
|
230 | - else |
|
228 | + } else |
|
231 | 229 | { |
232 | 230 | $this->_set_default_controller(); |
233 | 231 | } |
@@ -269,8 +267,7 @@ discard block |
||
269 | 267 | if (isset($segments[1])) |
270 | 268 | { |
271 | 269 | $this->set_method($segments[1]); |
272 | - } |
|
273 | - else |
|
270 | + } else |
|
274 | 271 | { |
275 | 272 | $segments[1] = 'index'; |
276 | 273 | } |
@@ -385,8 +382,7 @@ discard block |
||
385 | 382 | if (isset($val[$http_verb])) |
386 | 383 | { |
387 | 384 | $val = $val[$http_verb]; |
388 | - } |
|
389 | - else |
|
385 | + } else |
|
390 | 386 | { |
391 | 387 | continue; |
392 | 388 | } |
@@ -489,8 +485,7 @@ discard block |
||
489 | 485 | if ($append !== TRUE OR empty($this->directory)) |
490 | 486 | { |
491 | 487 | $this->directory = str_replace('.', '', trim($dir, '/')).'/'; |
492 | - } |
|
493 | - else |
|
488 | + } else |
|
494 | 489 | { |
495 | 490 | $this->directory .= str_replace('.', '', trim($dir, '/')).'/'; |
496 | 491 | } |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @var array |
55 | 55 | */ |
56 | - public $filename_bad_chars = array( |
|
56 | + public $filename_bad_chars = array( |
|
57 | 57 | '../', '<!--', '-->', '<', '>', |
58 | 58 | "'", '"', '&', '$', '#', |
59 | 59 | '{', '}', '[', ']', '=', |
60 | 60 | ';', '?', '%20', '%22', |
61 | - '%3c', // < |
|
62 | - '%253c', // < |
|
63 | - '%3e', // > |
|
64 | - '%0e', // > |
|
65 | - '%28', // ( |
|
66 | - '%29', // ) |
|
67 | - '%2528', // ( |
|
68 | - '%26', // & |
|
69 | - '%24', // $ |
|
70 | - '%3f', // ? |
|
71 | - '%3b', // ; |
|
61 | + '%3c', // < |
|
62 | + '%253c', // < |
|
63 | + '%3e', // > |
|
64 | + '%0e', // > |
|
65 | + '%28', // ( |
|
66 | + '%29', // ) |
|
67 | + '%2528', // ( |
|
68 | + '%26', // & |
|
69 | + '%24', // $ |
|
70 | + '%3f', // ? |
|
71 | + '%3b', // ; |
|
72 | 72 | '%3d' // = |
73 | 73 | ); |
74 | 74 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @var int |
109 | 109 | */ |
110 | - protected $_csrf_expire = 7200; |
|
110 | + protected $_csrf_expire = 7200; |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * CSRF Token name |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @var string |
118 | 118 | */ |
119 | - protected $_csrf_token_name = 'ci_csrf_token'; |
|
119 | + protected $_csrf_token_name = 'ci_csrf_token'; |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * CSRF Cookie name |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @var string |
127 | 127 | */ |
128 | - protected $_csrf_cookie_name = 'ci_csrf_token'; |
|
128 | + protected $_csrf_cookie_name = 'ci_csrf_token'; |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * List of never allowed strings |
132 | 132 | * |
133 | 133 | * @var array |
134 | 134 | */ |
135 | - protected $_never_allowed_str = array( |
|
135 | + protected $_never_allowed_str = array( |
|
136 | 136 | 'document.cookie' => '[removed]', |
137 | 137 | 'document.write' => '[removed]', |
138 | 138 | '.parentNode' => '[removed]', |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | */ |
796 | 796 | protected function _sanitize_naughty_html($matches) |
797 | 797 | { |
798 | - static $naughty_tags = array( |
|
798 | + static $naughty_tags = array( |
|
799 | 799 | 'alert', 'prompt', 'confirm', 'applet', 'audio', 'basefont', 'base', 'behavior', 'bgsound', |
800 | 800 | 'blink', 'body', 'embed', 'expression', 'form', 'frameset', 'frame', 'head', 'html', 'ilayer', |
801 | 801 | 'iframe', 'input', 'button', 'select', 'isindex', 'layer', 'link', 'meta', 'keygen', 'object', |
@@ -225,10 +225,12 @@ discard block |
||
225 | 225 | |
226 | 226 | // Do the tokens exist in both the _POST and _COOKIE arrays? |
227 | 227 | if ( ! isset($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]) |
228 | - OR $_POST[$this->_csrf_token_name] !== $_COOKIE[$this->_csrf_cookie_name]) // Do the tokens match? |
|
228 | + OR $_POST[$this->_csrf_token_name] !== $_COOKIE[$this->_csrf_cookie_name]) { |
|
229 | + // Do the tokens match? |
|
229 | 230 | { |
230 | 231 | $this->csrf_show_error(); |
231 | 232 | } |
233 | + } |
|
232 | 234 | |
233 | 235 | // We kill this since we're done and we don't want to polute the _POST array |
234 | 236 | unset($_POST[$this->_csrf_token_name]); |
@@ -421,8 +423,7 @@ discard block |
||
421 | 423 | // closing tags every so often so we skip those and only |
422 | 424 | // do the long opening tags. |
423 | 425 | $str = preg_replace('/<\?(php)/i', '<?\\1', $str); |
424 | - } |
|
425 | - else |
|
426 | + } else |
|
426 | 427 | { |
427 | 428 | $str = str_replace(array('<?', '?'.'>'), array('<?', '?>'), $str); |
428 | 429 | } |
@@ -599,8 +600,7 @@ discard block |
||
599 | 600 | { |
600 | 601 | // The cast is required to avoid TypeError |
601 | 602 | return random_bytes((int) $length); |
602 | - } |
|
603 | - catch (Exception $e) |
|
603 | + } catch (Exception $e) |
|
604 | 604 | { |
605 | 605 | // If random_bytes() can't do the job, we can't either ... |
606 | 606 | // There's no point in using fallbacks. |
@@ -854,8 +854,7 @@ discard block |
||
854 | 854 | ) |
855 | 855 | { |
856 | 856 | $attributes[] = 'xss=removed'; |
857 | - } |
|
858 | - else |
|
857 | + } else |
|
859 | 858 | { |
860 | 859 | $attributes[] = $attribute[0][0]; |
861 | 860 | } |
@@ -1237,6 +1237,7 @@ |
||
1237 | 1237 | * Valid Email |
1238 | 1238 | * |
1239 | 1239 | * @param string |
1240 | + * @param string $str |
|
1240 | 1241 | * @return bool |
1241 | 1242 | */ |
1242 | 1243 | public function valid_email($str) |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function __construct() |
100 | 100 | { |
101 | - $this->config =& load_class('Config', 'core'); |
|
101 | + $this->config = & load_class('Config', 'core'); |
|
102 | 102 | |
103 | 103 | // If query strings are enabled, we don't need to parse any segments. |
104 | 104 | // However, they don't make sense under CLI. |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | |
559 | 559 | if ($where === 'trailing') |
560 | 560 | { |
561 | - $leading = ''; |
|
561 | + $leading = ''; |
|
562 | 562 | } |
563 | 563 | elseif ($where === 'leading') |
564 | 564 | { |
565 | - $trailing = ''; |
|
565 | + $trailing = ''; |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | return $leading.$this->$which($n).$trailing; |
@@ -110,8 +110,7 @@ discard block |
||
110 | 110 | if (is_cli()) |
111 | 111 | { |
112 | 112 | $uri = $this->_parse_argv(); |
113 | - } |
|
114 | - else |
|
113 | + } else |
|
115 | 114 | { |
116 | 115 | $protocol = $this->config->item('uri_protocol'); |
117 | 116 | empty($protocol) && $protocol = 'REQUEST_URI'; |
@@ -212,8 +211,7 @@ discard block |
||
212 | 211 | if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) |
213 | 212 | { |
214 | 213 | $uri = (string) substr($uri, strlen($_SERVER['SCRIPT_NAME'])); |
215 | - } |
|
216 | - elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) |
|
214 | + } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) |
|
217 | 215 | { |
218 | 216 | $uri = (string) substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); |
219 | 217 | } |
@@ -226,8 +224,7 @@ discard block |
||
226 | 224 | $query = explode('?', $query, 2); |
227 | 225 | $uri = $query[0]; |
228 | 226 | $_SERVER['QUERY_STRING'] = isset($query[1]) ? $query[1] : ''; |
229 | - } |
|
230 | - else |
|
227 | + } else |
|
231 | 228 | { |
232 | 229 | $_SERVER['QUERY_STRING'] = $query; |
233 | 230 | } |
@@ -259,8 +256,7 @@ discard block |
||
259 | 256 | if (trim($uri, '/') === '') |
260 | 257 | { |
261 | 258 | return ''; |
262 | - } |
|
263 | - elseif (strncmp($uri, '/', 1) === 0) |
|
259 | + } elseif (strncmp($uri, '/', 1) === 0) |
|
264 | 260 | { |
265 | 261 | $uri = explode('?', $uri, 2); |
266 | 262 | $_SERVER['QUERY_STRING'] = isset($uri[1]) ? $uri[1] : ''; |
@@ -456,8 +452,7 @@ discard block |
||
456 | 452 | if ($i % 2) |
457 | 453 | { |
458 | 454 | $retval[$lastval] = $seg; |
459 | - } |
|
460 | - else |
|
455 | + } else |
|
461 | 456 | { |
462 | 457 | $retval[$seg] = NULL; |
463 | 458 | $lastval = $seg; |
@@ -559,8 +554,7 @@ discard block |
||
559 | 554 | if ($where === 'trailing') |
560 | 555 | { |
561 | 556 | $leading = ''; |
562 | - } |
|
563 | - elseif ($where === 'leading') |
|
557 | + } elseif ($where === 'leading') |
|
564 | 558 | { |
565 | 559 | $trailing = ''; |
566 | 560 | } |
@@ -67,8 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | define('UTF8_ENABLED', TRUE); |
69 | 69 | log_message('debug', 'UTF-8 Support Enabled'); |
70 | - } |
|
71 | - else |
|
70 | + } else |
|
72 | 71 | { |
73 | 72 | define('UTF8_ENABLED', FALSE); |
74 | 73 | log_message('debug', 'UTF-8 Support Disabled'); |
@@ -94,8 +93,7 @@ discard block |
||
94 | 93 | if (MB_ENABLED) |
95 | 94 | { |
96 | 95 | $str = mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
97 | - } |
|
98 | - elseif (ICONV_ENABLED) |
|
96 | + } elseif (ICONV_ENABLED) |
|
99 | 97 | { |
100 | 98 | $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str); |
101 | 99 | } |
@@ -137,8 +135,7 @@ discard block |
||
137 | 135 | if (MB_ENABLED) |
138 | 136 | { |
139 | 137 | return mb_convert_encoding($str, 'UTF-8', $encoding); |
140 | - } |
|
141 | - elseif (ICONV_ENABLED) |
|
138 | + } elseif (ICONV_ENABLED) |
|
142 | 139 | { |
143 | 140 | return @iconv($encoding, 'UTF-8', $str); |
144 | 141 | } |
@@ -73,13 +73,11 @@ discard block |
||
73 | 73 | { |
74 | 74 | trigger_error('hash_equals(): Expected known_string to be a string, '.strtolower(gettype($known_string)).' given', E_USER_WARNING); |
75 | 75 | return FALSE; |
76 | - } |
|
77 | - elseif ( ! is_string($user_string)) |
|
76 | + } elseif ( ! is_string($user_string)) |
|
78 | 77 | { |
79 | 78 | trigger_error('hash_equals(): Expected user_string to be a string, '.strtolower(gettype($user_string)).' given', E_USER_WARNING); |
80 | 79 | return FALSE; |
81 | - } |
|
82 | - elseif (($length = strlen($known_string)) !== strlen($user_string)) |
|
80 | + } elseif (($length = strlen($known_string)) !== strlen($user_string)) |
|
83 | 81 | { |
84 | 82 | return FALSE; |
85 | 83 | } |
@@ -135,8 +133,7 @@ discard block |
||
135 | 133 | if (is_string($iterations) && is_numeric($iterations)) |
136 | 134 | { |
137 | 135 | $iterations = (int) $iterations; |
138 | - } |
|
139 | - else |
|
136 | + } else |
|
140 | 137 | { |
141 | 138 | trigger_error('hash_pbkdf2() expects parameter 4 to be long, '.$type.' given', E_USER_WARNING); |
142 | 139 | return NULL; |
@@ -159,8 +156,7 @@ discard block |
||
159 | 156 | if (is_string($length) && is_numeric($length)) |
160 | 157 | { |
161 | 158 | $length = (int) $length; |
162 | - } |
|
163 | - else |
|
159 | + } else |
|
164 | 160 | { |
165 | 161 | trigger_error('hash_pbkdf2() expects parameter 5 to be long, '.$type.' given', E_USER_WARNING); |
166 | 162 | return NULL; |
@@ -113,18 +113,15 @@ discard block |
||
113 | 113 | { |
114 | 114 | trigger_error('password_hash(): Provided salt is too short: '.$saltlen.' expecting 22', E_USER_WARNING); |
115 | 115 | return NULL; |
116 | - } |
|
117 | - elseif ( ! isset($options['salt'])) |
|
116 | + } elseif ( ! isset($options['salt'])) |
|
118 | 117 | { |
119 | 118 | if (defined('MCRYPT_DEV_URANDOM')) |
120 | 119 | { |
121 | 120 | $options['salt'] = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM); |
122 | - } |
|
123 | - elseif (function_exists('openssl_random_pseudo_bytes')) |
|
121 | + } elseif (function_exists('openssl_random_pseudo_bytes')) |
|
124 | 122 | { |
125 | 123 | $options['salt'] = openssl_random_pseudo_bytes(16); |
126 | - } |
|
127 | - elseif (DIRECTORY_SEPARATOR === '/' && (is_readable($dev = '/dev/arandom') OR is_readable($dev = '/dev/urandom'))) |
|
124 | + } elseif (DIRECTORY_SEPARATOR === '/' && (is_readable($dev = '/dev/arandom') OR is_readable($dev = '/dev/urandom'))) |
|
128 | 125 | { |
129 | 126 | if (($fp = fopen($dev, 'rb')) === FALSE) |
130 | 127 | { |
@@ -147,16 +144,14 @@ discard block |
||
147 | 144 | } |
148 | 145 | |
149 | 146 | fclose($fp); |
150 | - } |
|
151 | - else |
|
147 | + } else |
|
152 | 148 | { |
153 | 149 | log_message('error', 'compat/password: No CSPRNG available.'); |
154 | 150 | return FALSE; |
155 | 151 | } |
156 | 152 | |
157 | 153 | $options['salt'] = str_replace('+', '.', rtrim(base64_encode($options['salt']), '=')); |
158 | - } |
|
159 | - elseif ( ! preg_match('#^[a-zA-Z0-9./]+$#D', $options['salt'])) |
|
154 | + } elseif ( ! preg_match('#^[a-zA-Z0-9./]+$#D', $options['salt'])) |
|
160 | 155 | { |
161 | 156 | $options['salt'] = str_replace('+', '.', rtrim(base64_encode($options['salt']), '=')); |
162 | 157 | } |
@@ -189,8 +184,7 @@ discard block |
||
189 | 184 | if ($algo !== $info['algo']) |
190 | 185 | { |
191 | 186 | return TRUE; |
192 | - } |
|
193 | - elseif ($algo === 1) |
|
187 | + } elseif ($algo === 1) |
|
194 | 188 | { |
195 | 189 | $options['cost'] = isset($options['cost']) ? (int) $options['cost'] : 10; |
196 | 190 | return ($info['options']['cost'] !== $options['cost']); |