@@ -201,29 +201,30 @@ discard block |
||
| 201 | 201 | if (isset($array[$index])) |
| 202 | 202 | { |
| 203 | 203 | $value = $array[$index]; |
| 204 | - } |
|
| 205 | - elseif (($count = preg_match_all('/(?:^[^\[]+)|\[[^]]*\]/', $index, $matches)) > 1) // Does the index contain array notation |
|
| 204 | + } elseif (($count = preg_match_all('/(?:^[^\[]+)|\[[^]]*\]/', $index, $matches)) > 1) { |
|
| 205 | + // Does the index contain array notation |
|
| 206 | 206 | { |
| 207 | 207 | $value = $array; |
| 208 | + } |
|
| 208 | 209 | for ($i = 0; $i < $count; $i++) |
| 209 | 210 | { |
| 210 | 211 | $key = trim($matches[0][$i], '[]'); |
| 211 | - if ($key === '') // Empty notation will return the value as array |
|
| 212 | + if ($key === '') { |
|
| 213 | + // Empty notation will return the value as array |
|
| 212 | 214 | { |
| 213 | 215 | break; |
| 214 | 216 | } |
| 217 | + } |
|
| 215 | 218 | |
| 216 | 219 | if (isset($value[$key])) |
| 217 | 220 | { |
| 218 | 221 | $value = $value[$key]; |
| 219 | - } |
|
| 220 | - else |
|
| 222 | + } else |
|
| 221 | 223 | { |
| 222 | 224 | return NULL; |
| 223 | 225 | } |
| 224 | 226 | } |
| 225 | - } |
|
| 226 | - else |
|
| 227 | + } else |
|
| 227 | 228 | { |
| 228 | 229 | return NULL; |
| 229 | 230 | } |
@@ -421,8 +422,7 @@ discard block |
||
| 421 | 422 | if ( ! is_numeric($expire)) |
| 422 | 423 | { |
| 423 | 424 | $expire = time() - 86500; |
| 424 | - } |
|
| 425 | - else |
|
| 425 | + } else |
|
| 426 | 426 | { |
| 427 | 427 | $expire = ($expire > 0) ? time() + $expire : 0; |
| 428 | 428 | } |
@@ -432,8 +432,7 @@ discard block |
||
| 432 | 432 | { |
| 433 | 433 | $samesite = ucfirst(strtolower($samesite)); |
| 434 | 434 | in_array($samesite, array('Lax', 'Strict', 'None'), TRUE) OR $samesite = 'Lax'; |
| 435 | - } |
|
| 436 | - else |
|
| 435 | + } else |
|
| 437 | 436 | { |
| 438 | 437 | $samesite = 'Lax'; |
| 439 | 438 | } |
@@ -524,8 +523,7 @@ discard block |
||
| 524 | 523 | if ( ! $this->valid_ip($spoof)) |
| 525 | 524 | { |
| 526 | 525 | $spoof = NULL; |
| 527 | - } |
|
| 528 | - else |
|
| 526 | + } else |
|
| 529 | 527 | { |
| 530 | 528 | break; |
| 531 | 529 | } |
@@ -578,8 +576,7 @@ discard block |
||
| 578 | 576 | } |
| 579 | 577 | |
| 580 | 578 | $sprintf = '%016b%016b%016b%016b%016b%016b%016b%016b'; |
| 581 | - } |
|
| 582 | - else |
|
| 579 | + } else |
|
| 583 | 580 | { |
| 584 | 581 | $ip = explode('.', $this->ip_address); |
| 585 | 582 | $sprintf = '%08b%08b%08b%08b'; |
@@ -599,8 +596,7 @@ discard block |
||
| 599 | 596 | { |
| 600 | 597 | $netaddr[$j] = intval($netaddr[$j], 16); |
| 601 | 598 | } |
| 602 | - } |
|
| 603 | - else |
|
| 599 | + } else |
|
| 604 | 600 | { |
| 605 | 601 | $netaddr = explode('.', $netaddr); |
| 606 | 602 | } |
@@ -687,8 +683,7 @@ discard block |
||
| 687 | 683 | if ($this->_allow_get_array === FALSE) |
| 688 | 684 | { |
| 689 | 685 | $_GET = array(); |
| 690 | - } |
|
| 691 | - elseif (is_array($_GET)) |
|
| 686 | + } elseif (is_array($_GET)) |
|
| 692 | 687 | { |
| 693 | 688 | foreach ($_GET as $key => $val) |
| 694 | 689 | { |
@@ -724,8 +719,7 @@ discard block |
||
| 724 | 719 | if (($cookie_key = $this->_clean_input_keys($key)) !== FALSE) |
| 725 | 720 | { |
| 726 | 721 | $_COOKIE[$cookie_key] = $this->_clean_input_data($val); |
| 727 | - } |
|
| 728 | - else |
|
| 722 | + } else |
|
| 729 | 723 | { |
| 730 | 724 | unset($_COOKIE[$key]); |
| 731 | 725 | } |
@@ -815,8 +809,7 @@ discard block |
||
| 815 | 809 | if ($fatal === TRUE) |
| 816 | 810 | { |
| 817 | 811 | return FALSE; |
| 818 | - } |
|
| 819 | - else |
|
| 812 | + } else |
|
| 820 | 813 | { |
| 821 | 814 | set_status_header(503); |
| 822 | 815 | echo 'Disallowed Key Characters.'; |
@@ -855,8 +848,7 @@ discard block |
||
| 855 | 848 | if (function_exists('apache_request_headers')) |
| 856 | 849 | { |
| 857 | 850 | $this->headers = apache_request_headers(); |
| 858 | - } |
|
| 859 | - else |
|
| 851 | + } else |
|
| 860 | 852 | { |
| 861 | 853 | isset($_SERVER['CONTENT_TYPE']) && $this->headers['Content-Type'] = $_SERVER['CONTENT_TYPE']; |
| 862 | 854 | |
@@ -985,8 +977,7 @@ discard block |
||
| 985 | 977 | { |
| 986 | 978 | isset($this->_raw_input_stream) OR $this->_raw_input_stream = file_get_contents('php://input'); |
| 987 | 979 | return $this->_raw_input_stream; |
| 988 | - } |
|
| 989 | - elseif ($name === 'ip_address') |
|
| 980 | + } elseif ($name === 'ip_address') |
|
| 990 | 981 | { |
| 991 | 982 | return $this->ip_address; |
| 992 | 983 | } |
@@ -332,19 +332,16 @@ discard block |
||
| 332 | 332 | if ($reflection->hasMethod('set_'.$key)) |
| 333 | 333 | { |
| 334 | 334 | $this->{'set_'.$key}($config[$key]); |
| 335 | - } |
|
| 336 | - else |
|
| 335 | + } else |
|
| 337 | 336 | { |
| 338 | 337 | $this->$key = $config[$key]; |
| 339 | 338 | } |
| 340 | - } |
|
| 341 | - else |
|
| 339 | + } else |
|
| 342 | 340 | { |
| 343 | 341 | $this->$key = $defaults[$key]; |
| 344 | 342 | } |
| 345 | 343 | } |
| 346 | - } |
|
| 347 | - else |
|
| 344 | + } else |
|
| 348 | 345 | { |
| 349 | 346 | foreach ($config as $key => &$value) |
| 350 | 347 | { |
@@ -353,8 +350,7 @@ discard block |
||
| 353 | 350 | if ($reflection->hasMethod('set_'.$key)) |
| 354 | 351 | { |
| 355 | 352 | $this->{'set_'.$key}($value); |
| 356 | - } |
|
| 357 | - else |
|
| 353 | + } else |
|
| 358 | 354 | { |
| 359 | 355 | $this->$key = $value; |
| 360 | 356 | } |
@@ -416,9 +412,11 @@ discard block |
||
| 416 | 412 | } |
| 417 | 413 | |
| 418 | 414 | // Was the file able to be uploaded? If not, determine the reason why. |
| 419 | - if ( ! file_exists($_file['tmp_name'])) // modified by ci-phpunit-test |
|
| 415 | + if ( ! file_exists($_file['tmp_name'])) { |
|
| 416 | + // modified by ci-phpunit-test |
|
| 420 | 417 | { |
| 421 | 418 | $error = isset($_file['error']) ? $_file['error'] : 4; |
| 419 | + } |
|
| 422 | 420 | |
| 423 | 421 | switch ($error) |
| 424 | 422 | { |
@@ -483,8 +481,7 @@ discard block |
||
| 483 | 481 | if (strpos($this->_file_name_override, '.') === FALSE) |
| 484 | 482 | { |
| 485 | 483 | $this->file_name .= $this->file_ext; |
| 486 | - } |
|
| 487 | - else |
|
| 484 | + } else |
|
| 488 | 485 | { |
| 489 | 486 | // An extension was provided, let's have it! |
| 490 | 487 | $this->file_ext = $this->get_extension($this->_file_name_override); |
@@ -882,8 +879,7 @@ discard block |
||
| 882 | 879 | if (in_array($this->file_type, $png_mimes)) |
| 883 | 880 | { |
| 884 | 881 | $this->file_type = 'image/png'; |
| 885 | - } |
|
| 886 | - elseif (in_array($this->file_type, $jpeg_mimes)) |
|
| 882 | + } elseif (in_array($this->file_type, $jpeg_mimes)) |
|
| 887 | 883 | { |
| 888 | 884 | $this->file_type = 'image/jpeg'; |
| 889 | 885 | } |
@@ -1149,9 +1145,12 @@ discard block |
||
| 1149 | 1145 | |
| 1150 | 1146 | if (function_exists('getimagesize') && @getimagesize($file) !== FALSE) |
| 1151 | 1147 | { |
| 1152 | - if (($file = @fopen($file, 'rb')) === FALSE) // "b" to force binary |
|
| 1148 | + if (($file = @fopen($file, 'rb')) === FALSE) { |
|
| 1149 | + // "b" to force binary |
|
| 1153 | 1150 | { |
| 1154 | - return FALSE; // Couldn't open the file, return FALSE |
|
| 1151 | + return FALSE; |
|
| 1152 | + } |
|
| 1153 | + // Couldn't open the file, return FALSE |
|
| 1155 | 1154 | } |
| 1156 | 1155 | |
| 1157 | 1156 | $opening_bytes = fread($file, 256); |
@@ -1270,9 +1269,11 @@ discard block |
||
| 1270 | 1269 | if (function_exists('finfo_file')) |
| 1271 | 1270 | { |
| 1272 | 1271 | $finfo = @finfo_open(FILEINFO_MIME); |
| 1273 | - if ($finfo !== FALSE) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system |
|
| 1272 | + if ($finfo !== FALSE) { |
|
| 1273 | + // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system |
|
| 1274 | 1274 | { |
| 1275 | 1275 | $mime = @finfo_file($finfo, $file['tmp_name']); |
| 1276 | + } |
|
| 1276 | 1277 | finfo_close($finfo); |
| 1277 | 1278 | |
| 1278 | 1279 | /* According to the comments section of the PHP manual page, |
@@ -1357,10 +1358,12 @@ discard block |
||
| 1357 | 1358 | if (function_exists('mime_content_type')) |
| 1358 | 1359 | { |
| 1359 | 1360 | $this->file_type = @mime_content_type($file['tmp_name']); |
| 1360 | - if (strlen($this->file_type) > 0) // It's possible that mime_content_type() returns FALSE or an empty string |
|
| 1361 | + if (strlen($this->file_type) > 0) { |
|
| 1362 | + // It's possible that mime_content_type() returns FALSE or an empty string |
|
| 1361 | 1363 | { |
| 1362 | 1364 | return; |
| 1363 | 1365 | } |
| 1366 | + } |
|
| 1364 | 1367 | } |
| 1365 | 1368 | |
| 1366 | 1369 | $this->file_type = $file['type']; |