@@ -160,8 +160,7 @@ discard block |
||
| 160 | 160 | $exit_status = $status_code + 9; // 9 is EXIT__AUTO_MIN |
| 161 | 161 | |
| 162 | 162 | $status_code = 500; |
| 163 | - } |
|
| 164 | - else |
|
| 163 | + } else |
|
| 165 | 164 | { |
| 166 | 165 | $exit_status = 1; // EXIT_ERROR |
| 167 | 166 | } |
@@ -256,8 +255,7 @@ discard block |
||
| 256 | 255 | if (isset($stati[$code])) |
| 257 | 256 | { |
| 258 | 257 | $text = $stati[$code]; |
| 259 | - } |
|
| 260 | - else |
|
| 258 | + } else |
|
| 261 | 259 | { |
| 262 | 260 | show_error('No status text available. Please check your status code number or supply your own message text.', 500); |
| 263 | 261 | } |
@@ -327,8 +325,7 @@ discard block |
||
| 327 | 325 | if (file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) |
| 328 | 326 | { |
| 329 | 327 | require($file_path); |
| 330 | - } |
|
| 331 | - elseif ( ! $found) |
|
| 328 | + } elseif ( ! $found) |
|
| 332 | 329 | { |
| 333 | 330 | set_status_header(503); |
| 334 | 331 | echo 'The configuration file does not exist.'; |
@@ -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']; |
@@ -331,19 +331,16 @@ discard block |
||
| 331 | 331 | if ($reflection->hasMethod('set_'.$key)) |
| 332 | 332 | { |
| 333 | 333 | $this->{'set_'.$key}($config[$key]); |
| 334 | - } |
|
| 335 | - else |
|
| 334 | + } else |
|
| 336 | 335 | { |
| 337 | 336 | $this->$key = $config[$key]; |
| 338 | 337 | } |
| 339 | - } |
|
| 340 | - else |
|
| 338 | + } else |
|
| 341 | 339 | { |
| 342 | 340 | $this->$key = $defaults[$key]; |
| 343 | 341 | } |
| 344 | 342 | } |
| 345 | - } |
|
| 346 | - else |
|
| 343 | + } else |
|
| 347 | 344 | { |
| 348 | 345 | foreach ($config as $key => &$value) |
| 349 | 346 | { |
@@ -352,8 +349,7 @@ discard block |
||
| 352 | 349 | if ($reflection->hasMethod('set_'.$key)) |
| 353 | 350 | { |
| 354 | 351 | $this->{'set_'.$key}($value); |
| 355 | - } |
|
| 356 | - else |
|
| 352 | + } else |
|
| 357 | 353 | { |
| 358 | 354 | $this->$key = $value; |
| 359 | 355 | } |
@@ -415,9 +411,11 @@ discard block |
||
| 415 | 411 | } |
| 416 | 412 | |
| 417 | 413 | // Was the file able to be uploaded? If not, determine the reason why. |
| 418 | - if ( ! file_exists($_file['tmp_name'])) // modified by ci-phpunit-test |
|
| 414 | + if ( ! file_exists($_file['tmp_name'])) { |
|
| 415 | + // modified by ci-phpunit-test |
|
| 419 | 416 | { |
| 420 | 417 | $error = isset($_file['error']) ? $_file['error'] : 4; |
| 418 | + } |
|
| 421 | 419 | |
| 422 | 420 | switch ($error) |
| 423 | 421 | { |
@@ -482,8 +480,7 @@ discard block |
||
| 482 | 480 | if (strpos($this->_file_name_override, '.') === FALSE) |
| 483 | 481 | { |
| 484 | 482 | $this->file_name .= $this->file_ext; |
| 485 | - } |
|
| 486 | - else |
|
| 483 | + } else |
|
| 487 | 484 | { |
| 488 | 485 | // An extension was provided, let's have it! |
| 489 | 486 | $this->file_ext = $this->get_extension($this->_file_name_override); |
@@ -881,8 +878,7 @@ discard block |
||
| 881 | 878 | if (in_array($this->file_type, $png_mimes)) |
| 882 | 879 | { |
| 883 | 880 | $this->file_type = 'image/png'; |
| 884 | - } |
|
| 885 | - elseif (in_array($this->file_type, $jpeg_mimes)) |
|
| 881 | + } elseif (in_array($this->file_type, $jpeg_mimes)) |
|
| 886 | 882 | { |
| 887 | 883 | $this->file_type = 'image/jpeg'; |
| 888 | 884 | } |
@@ -1148,9 +1144,12 @@ discard block |
||
| 1148 | 1144 | |
| 1149 | 1145 | if (function_exists('getimagesize') && @getimagesize($file) !== FALSE) |
| 1150 | 1146 | { |
| 1151 | - if (($file = @fopen($file, 'rb')) === FALSE) // "b" to force binary |
|
| 1147 | + if (($file = @fopen($file, 'rb')) === FALSE) { |
|
| 1148 | + // "b" to force binary |
|
| 1152 | 1149 | { |
| 1153 | - return FALSE; // Couldn't open the file, return FALSE |
|
| 1150 | + return FALSE; |
|
| 1151 | + } |
|
| 1152 | + // Couldn't open the file, return FALSE |
|
| 1154 | 1153 | } |
| 1155 | 1154 | |
| 1156 | 1155 | $opening_bytes = fread($file, 256); |
@@ -1269,9 +1268,11 @@ discard block |
||
| 1269 | 1268 | if (function_exists('finfo_file')) |
| 1270 | 1269 | { |
| 1271 | 1270 | $finfo = @finfo_open(FILEINFO_MIME); |
| 1272 | - if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system |
|
| 1271 | + if (is_resource($finfo)) { |
|
| 1272 | + // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system |
|
| 1273 | 1273 | { |
| 1274 | 1274 | $mime = @finfo_file($finfo, $file['tmp_name']); |
| 1275 | + } |
|
| 1275 | 1276 | finfo_close($finfo); |
| 1276 | 1277 | |
| 1277 | 1278 | /* According to the comments section of the PHP manual page, |
@@ -1356,10 +1357,12 @@ discard block |
||
| 1356 | 1357 | if (function_exists('mime_content_type')) |
| 1357 | 1358 | { |
| 1358 | 1359 | $this->file_type = @mime_content_type($file['tmp_name']); |
| 1359 | - if (strlen($this->file_type) > 0) // It's possible that mime_content_type() returns FALSE or an empty string |
|
| 1360 | + if (strlen($this->file_type) > 0) { |
|
| 1361 | + // It's possible that mime_content_type() returns FALSE or an empty string |
|
| 1360 | 1362 | { |
| 1361 | 1363 | return; |
| 1362 | 1364 | } |
| 1365 | + } |
|
| 1363 | 1366 | } |
| 1364 | 1367 | |
| 1365 | 1368 | $this->file_type = $file['type']; |
@@ -34,16 +34,14 @@ discard block |
||
| 34 | 34 | if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== FALSE) |
| 35 | 35 | { |
| 36 | 36 | $method = 'refresh'; |
| 37 | - } |
|
| 38 | - elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) |
|
| 37 | + } elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) |
|
| 39 | 38 | { |
| 40 | 39 | if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') |
| 41 | 40 | { |
| 42 | 41 | $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') |
| 43 | 42 | ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get |
| 44 | 43 | : 307; |
| 45 | - } |
|
| 46 | - else |
|
| 44 | + } else |
|
| 47 | 45 | { |
| 48 | 46 | $code = 302; |
| 49 | 47 | } |
@@ -68,8 +66,7 @@ discard block |
||
| 68 | 66 | if ( ! TestCase::isTestingEnv()) |
| 69 | 67 | { |
| 70 | 68 | exit; |
| 71 | - } |
|
| 72 | - else |
|
| 69 | + } else |
|
| 73 | 70 | { |
| 74 | 71 | while (ob_get_level() > 1) |
| 75 | 72 | { |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | if ($filename === '' OR $data === '') |
| 39 | 39 | { |
| 40 | 40 | return; |
| 41 | - } |
|
| 42 | - elseif ($data === NULL) |
|
| 41 | + } elseif ($data === NULL) |
|
| 43 | 42 | { |
| 44 | 43 | if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) |
| 45 | 44 | { |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | $filepath = $filename; |
| 50 | 49 | $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); |
| 51 | 50 | $filename = end($filename); |
| 52 | - } |
|
| 53 | - else |
|
| 51 | + } else |
|
| 54 | 52 | { |
| 55 | 53 | $filesize = strlen($data); |
| 56 | 54 | } |
@@ -137,8 +135,7 @@ discard block |
||
| 137 | 135 | if ( ! TestCase::isTestingEnv()) |
| 138 | 136 | { |
| 139 | 137 | exit($data); |
| 140 | - } |
|
| 141 | - else |
|
| 138 | + } else |
|
| 142 | 139 | { |
| 143 | 140 | echo($data); |
| 144 | 141 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
@@ -155,8 +152,7 @@ discard block |
||
| 155 | 152 | if ( ! TestCase::isTestingEnv()) |
| 156 | 153 | { |
| 157 | 154 | exit; |
| 158 | - } |
|
| 159 | - else |
|
| 155 | + } else |
|
| 160 | 156 | { |
| 161 | 157 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
| 162 | 158 | } |