@@ -69,28 +69,28 @@ |
||
69 | 69 | */ |
70 | 70 | switch (ENVIRONMENT) |
71 | 71 | { |
72 | - case 'testing': |
|
73 | - case 'development': |
|
74 | - error_reporting(-1); |
|
75 | - ini_set('display_errors', 1); |
|
76 | - break; |
|
77 | - |
|
78 | - case 'production': |
|
79 | - ini_set('display_errors', 0); |
|
80 | - if (version_compare(PHP_VERSION, '5.3', '>=')) |
|
81 | - { |
|
82 | - error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
|
83 | - } |
|
84 | - else |
|
85 | - { |
|
86 | - error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); |
|
87 | - } |
|
88 | - break; |
|
89 | - |
|
90 | - default: |
|
91 | - header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
|
92 | - echo 'The application environment is not set correctly.'; |
|
93 | - exit(1); // EXIT_ERROR |
|
72 | + case 'testing': |
|
73 | + case 'development': |
|
74 | + error_reporting(-1); |
|
75 | + ini_set('display_errors', 1); |
|
76 | + break; |
|
77 | + |
|
78 | + case 'production': |
|
79 | + ini_set('display_errors', 0); |
|
80 | + if (version_compare(PHP_VERSION, '5.3', '>=')) |
|
81 | + { |
|
82 | + error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
|
83 | + } |
|
84 | + else |
|
85 | + { |
|
86 | + error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); |
|
87 | + } |
|
88 | + break; |
|
89 | + |
|
90 | + default: |
|
91 | + header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
|
92 | + echo 'The application environment is not set correctly.'; |
|
93 | + exit(1); // EXIT_ERROR |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /* |
@@ -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 | { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | // Load the mime types |
75 | - $mimes =& get_mimes(); |
|
75 | + $mimes = & get_mimes(); |
|
76 | 76 | |
77 | 77 | // Only change the default MIME if we can find one |
78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | if (TestCase::isTestingEnv()) |
119 | 119 | { |
120 | - $CI =& get_instance(); |
|
120 | + $CI = & get_instance(); |
|
121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -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 | } |
@@ -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 | { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | // Load the mime types |
75 | - $mimes =& get_mimes(); |
|
75 | + $mimes = & get_mimes(); |
|
76 | 76 | |
77 | 77 | // Only change the default MIME if we can find one |
78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | if (TestCase::isTestingEnv()) |
119 | 119 | { |
120 | - $CI =& get_instance(); |
|
120 | + $CI = & get_instance(); |
|
121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -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 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | // Load the mime types |
75 | - $mimes =& get_mimes(); |
|
75 | + $mimes = & get_mimes(); |
|
76 | 76 | |
77 | 77 | // Only change the default MIME if we can find one |
78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | if (TestCase::isTestingEnv()) |
119 | 119 | { |
120 | - $CI =& get_instance(); |
|
120 | + $CI = & get_instance(); |
|
121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -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 | } |
@@ -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 | { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | // Load the mime types |
75 | - $mimes =& get_mimes(); |
|
75 | + $mimes = & get_mimes(); |
|
76 | 76 | |
77 | 77 | // Only change the default MIME if we can find one |
78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | if (TestCase::isTestingEnv()) |
119 | 119 | { |
120 | - $CI =& get_instance(); |
|
120 | + $CI = & get_instance(); |
|
121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -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 | } |
@@ -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 | { |