@@ -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 | /* |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * NOTE: If you change these, also change the error_reporting() code below |
55 | 55 | */ |
56 | 56 | // This is needed for @runInSeparateProcess |
57 | -if (! defined('ENVIRONMENT')) |
|
57 | +if(!defined('ENVIRONMENT')) |
|
58 | 58 | { |
59 | 59 | define('ENVIRONMENT', 'testing'); |
60 | 60 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * Different environments will require different levels of error reporting. |
68 | 68 | * By default development will show errors but testing and live will hide them. |
69 | 69 | */ |
70 | -switch (ENVIRONMENT) |
|
70 | +switch(ENVIRONMENT) |
|
71 | 71 | { |
72 | 72 | case 'testing': |
73 | 73 | case 'development': |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | case 'production': |
79 | 79 | ini_set('display_errors', 0); |
80 | - if (version_compare(PHP_VERSION, '5.3', '>=')) |
|
80 | + if(version_compare(PHP_VERSION, '5.3', '>=')) |
|
81 | 81 | { |
82 | 82 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
83 | 83 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | chdir(dirname(__FILE__)); |
201 | 201 | // } |
202 | 202 | |
203 | - if (($_temp = realpath($system_path)) !== FALSE) |
|
203 | + if(($_temp = realpath($system_path)) !== FALSE) |
|
204 | 204 | { |
205 | 205 | $system_path = $_temp.'/'; |
206 | 206 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | // Is the system path correct? |
214 | - if ( ! is_dir($system_path)) |
|
214 | + if(!is_dir($system_path)) |
|
215 | 215 | { |
216 | 216 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
217 | 217 | echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME); |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/')); |
237 | 237 | |
238 | 238 | // The path to the "application" folder |
239 | - if (is_dir($application_folder)) |
|
239 | + if(is_dir($application_folder)) |
|
240 | 240 | { |
241 | - if (($_temp = realpath($application_folder)) !== FALSE) |
|
241 | + if(($_temp = realpath($application_folder)) !== FALSE) |
|
242 | 242 | { |
243 | 243 | $application_folder = $_temp; |
244 | 244 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | } |
248 | 248 | else |
249 | 249 | { |
250 | - if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
|
250 | + if(!is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
|
251 | 251 | { |
252 | 252 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
253 | 253 | echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | // The path to the "views" folder |
261 | - if ( ! is_dir($view_folder)) |
|
261 | + if(!is_dir($view_folder)) |
|
262 | 262 | { |
263 | - if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
|
263 | + if(!empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
|
264 | 264 | { |
265 | 265 | $view_folder = APPPATH.$view_folder; |
266 | 266 | } |
267 | - elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
|
267 | + elseif(!is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
|
268 | 268 | { |
269 | 269 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
270 | 270 | echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | - if (($_temp = realpath($view_folder)) !== FALSE) |
|
279 | + if(($_temp = realpath($view_folder)) !== FALSE) |
|
280 | 280 | { |
281 | 281 | $view_folder = $_temp.DIRECTORY_SEPARATOR; |
282 | 282 | } |
@@ -327,5 +327,5 @@ discard block |
||
327 | 327 | * Added for CI PHPUnit Test |
328 | 328 | * ------------------------------------------------------------------- |
329 | 329 | */ |
330 | -require __DIR__ . '/_ci_phpunit_test/CIPHPUnitTest.php'; |
|
330 | +require __DIR__.'/_ci_phpunit_test/CIPHPUnitTest.php'; |
|
331 | 331 | CIPHPUnitTest::init(); |
@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | * NOTE: If you change these, also change the error_reporting() code below |
55 | 55 | */ |
56 | 56 | // This is needed for @runInSeparateProcess |
57 | -if (! defined('ENVIRONMENT')) |
|
58 | -{ |
|
57 | +if (! defined('ENVIRONMENT')) { |
|
59 | 58 | define('ENVIRONMENT', 'testing'); |
60 | 59 | } |
61 | 60 | |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | * Different environments will require different levels of error reporting. |
68 | 67 | * By default development will show errors but testing and live will hide them. |
69 | 68 | */ |
70 | -switch (ENVIRONMENT) |
|
71 | -{ |
|
69 | +switch (ENVIRONMENT) { |
|
72 | 70 | case 'testing': |
73 | 71 | case 'development': |
74 | 72 | error_reporting(-1); |
@@ -77,12 +75,9 @@ discard block |
||
77 | 75 | |
78 | 76 | case 'production': |
79 | 77 | ini_set('display_errors', 0); |
80 | - if (version_compare(PHP_VERSION, '5.3', '>=')) |
|
81 | - { |
|
78 | + if (version_compare(PHP_VERSION, '5.3', '>=')) { |
|
82 | 79 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
83 | - } |
|
84 | - else |
|
85 | - { |
|
80 | + } else { |
|
86 | 81 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); |
87 | 82 | } |
88 | 83 | break; |
@@ -200,19 +195,15 @@ discard block |
||
200 | 195 | chdir(dirname(__FILE__)); |
201 | 196 | // } |
202 | 197 | |
203 | - if (($_temp = realpath($system_path)) !== FALSE) |
|
204 | - { |
|
198 | + if (($_temp = realpath($system_path)) !== FALSE) { |
|
205 | 199 | $system_path = $_temp.'/'; |
206 | - } |
|
207 | - else |
|
208 | - { |
|
200 | + } else { |
|
209 | 201 | // Ensure there's a trailing slash |
210 | 202 | $system_path = rtrim($system_path, '/').'/'; |
211 | 203 | } |
212 | 204 | |
213 | 205 | // Is the system path correct? |
214 | - if ( ! is_dir($system_path)) |
|
215 | - { |
|
206 | + if ( ! is_dir($system_path)) { |
|
216 | 207 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
217 | 208 | echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME); |
218 | 209 | exit(3); // EXIT_CONFIG |
@@ -236,19 +227,14 @@ discard block |
||
236 | 227 | define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/')); |
237 | 228 | |
238 | 229 | // The path to the "application" folder |
239 | - if (is_dir($application_folder)) |
|
240 | - { |
|
241 | - if (($_temp = realpath($application_folder)) !== FALSE) |
|
242 | - { |
|
230 | + if (is_dir($application_folder)) { |
|
231 | + if (($_temp = realpath($application_folder)) !== FALSE) { |
|
243 | 232 | $application_folder = $_temp; |
244 | 233 | } |
245 | 234 | |
246 | 235 | define('APPPATH', $application_folder.DIRECTORY_SEPARATOR); |
247 | - } |
|
248 | - else |
|
249 | - { |
|
250 | - if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
|
251 | - { |
|
236 | + } else { |
|
237 | + if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) { |
|
252 | 238 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
253 | 239 | echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
254 | 240 | exit(3); // EXIT_CONFIG |
@@ -258,30 +244,21 @@ discard block |
||
258 | 244 | } |
259 | 245 | |
260 | 246 | // The path to the "views" folder |
261 | - if ( ! is_dir($view_folder)) |
|
262 | - { |
|
263 | - if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
|
264 | - { |
|
247 | + if ( ! is_dir($view_folder)) { |
|
248 | + if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) { |
|
265 | 249 | $view_folder = APPPATH.$view_folder; |
266 | - } |
|
267 | - elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
|
268 | - { |
|
250 | + } elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) { |
|
269 | 251 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
270 | 252 | echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
271 | 253 | exit(3); // EXIT_CONFIG |
272 | - } |
|
273 | - else |
|
274 | - { |
|
254 | + } else { |
|
275 | 255 | $view_folder = APPPATH.'views'; |
276 | 256 | } |
277 | 257 | } |
278 | 258 | |
279 | - if (($_temp = realpath($view_folder)) !== FALSE) |
|
280 | - { |
|
259 | + if (($_temp = realpath($view_folder)) !== FALSE) { |
|
281 | 260 | $view_folder = $_temp.DIRECTORY_SEPARATOR; |
282 | - } |
|
283 | - else |
|
284 | - { |
|
261 | + } else { |
|
285 | 262 | $view_folder = rtrim($view_folder, '/\\').DIRECTORY_SEPARATOR; |
286 | 263 | } |
287 | 264 |
@@ -60,49 +60,49 @@ discard block |
||
60 | 60 | |
61 | 61 | $ci_drivers = array('Session', 'Cache'); |
62 | 62 | |
63 | - if (strpos($class, 'Mock_') === 0) |
|
63 | + if(strpos($class, 'Mock_') === 0) |
|
64 | 64 | { |
65 | 65 | $class = strtolower(str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class)); |
66 | 66 | } |
67 | - elseif (strpos($class, 'CI_') === 0) |
|
67 | + elseif(strpos($class, 'CI_') === 0) |
|
68 | 68 | { |
69 | 69 | $subclass = substr($class, 3); |
70 | 70 | |
71 | - if (in_array($subclass, $ci_core)) |
|
71 | + if(in_array($subclass, $ci_core)) |
|
72 | 72 | { |
73 | 73 | $dir = SYSTEM_PATH.'core'.DIRECTORY_SEPARATOR; |
74 | 74 | $class = $subclass; |
75 | 75 | } |
76 | - elseif (in_array($subclass, $ci_libraries)) |
|
76 | + elseif(in_array($subclass, $ci_libraries)) |
|
77 | 77 | { |
78 | 78 | $dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR; |
79 | 79 | $class = ($subclass === 'Driver_Library') ? 'Driver' : $subclass; |
80 | 80 | } |
81 | - elseif (in_array($subclass, $ci_drivers)) |
|
81 | + elseif(in_array($subclass, $ci_drivers)) |
|
82 | 82 | { |
83 | 83 | $dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR.$subclass.DIRECTORY_SEPARATOR; |
84 | 84 | $class = $subclass; |
85 | 85 | } |
86 | - elseif (in_array(($parent = strtok($subclass, '_')), $ci_drivers)) { |
|
86 | + elseif(in_array(($parent = strtok($subclass, '_')), $ci_drivers)) { |
|
87 | 87 | $dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR.$parent.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR; |
88 | 88 | $class = $subclass; |
89 | 89 | } |
90 | - elseif (preg_match('/^CI_DB_(.+)_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 4) |
|
90 | + elseif(preg_match('/^CI_DB_(.+)_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 4) |
|
91 | 91 | { |
92 | 92 | $driver_path = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR; |
93 | 93 | $dir = $driver_path.$m[1].DIRECTORY_SEPARATOR.'subdrivers'.DIRECTORY_SEPARATOR; |
94 | 94 | $file = $dir.$m[1].'_'.$m[2].'_'.$m[3].'.php'; |
95 | 95 | } |
96 | - elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 3) |
|
96 | + elseif(preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 3) |
|
97 | 97 | { |
98 | 98 | $driver_path = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR; |
99 | 99 | $dir = $driver_path.$m[1].DIRECTORY_SEPARATOR; |
100 | 100 | $file = $dir.$m[1].'_'.$m[2].'.php'; |
101 | 101 | } |
102 | - elseif (strpos($class, 'CI_DB') === 0) |
|
102 | + elseif(strpos($class, 'CI_DB') === 0) |
|
103 | 103 | { |
104 | 104 | $dir = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR; |
105 | - $file = $dir.str_replace(array('CI_DB','active_record'), array('DB', 'active_rec'), $subclass).'.php'; |
|
105 | + $file = $dir.str_replace(array('CI_DB', 'active_record'), array('DB', 'active_rec'), $subclass).'.php'; |
|
106 | 106 | } |
107 | 107 | else |
108 | 108 | { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $file = isset($file) ? $file : $dir.$class.'.php'; |
114 | 114 | |
115 | - if ( ! file_exists($file)) |
|
115 | + if(!file_exists($file)) |
|
116 | 116 | { |
117 | 117 | return FALSE; |
118 | 118 | } |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | // $mock_table = new Mock_Libraries_Table(); // Will load ./mocks/libraries/table.php |
12 | 12 | // $mock_database_driver = new Mock_Database_Driver(); // Will load ./mocks/database/driver.php |
13 | 13 | // and so on... |
14 | -function autoload($class) |
|
15 | -{ |
|
14 | +function autoload($class) { |
|
16 | 15 | $dir = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR; |
17 | 16 | |
18 | 17 | $ci_core = array( |
@@ -60,60 +59,42 @@ discard block |
||
60 | 59 | |
61 | 60 | $ci_drivers = array('Session', 'Cache'); |
62 | 61 | |
63 | - if (strpos($class, 'Mock_') === 0) |
|
64 | - { |
|
62 | + if (strpos($class, 'Mock_') === 0) { |
|
65 | 63 | $class = strtolower(str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class)); |
66 | - } |
|
67 | - elseif (strpos($class, 'CI_') === 0) |
|
68 | - { |
|
64 | + } elseif (strpos($class, 'CI_') === 0) { |
|
69 | 65 | $subclass = substr($class, 3); |
70 | 66 | |
71 | - if (in_array($subclass, $ci_core)) |
|
72 | - { |
|
67 | + if (in_array($subclass, $ci_core)) { |
|
73 | 68 | $dir = SYSTEM_PATH.'core'.DIRECTORY_SEPARATOR; |
74 | 69 | $class = $subclass; |
75 | - } |
|
76 | - elseif (in_array($subclass, $ci_libraries)) |
|
77 | - { |
|
70 | + } elseif (in_array($subclass, $ci_libraries)) { |
|
78 | 71 | $dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR; |
79 | 72 | $class = ($subclass === 'Driver_Library') ? 'Driver' : $subclass; |
80 | - } |
|
81 | - elseif (in_array($subclass, $ci_drivers)) |
|
82 | - { |
|
73 | + } elseif (in_array($subclass, $ci_drivers)) { |
|
83 | 74 | $dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR.$subclass.DIRECTORY_SEPARATOR; |
84 | 75 | $class = $subclass; |
85 | - } |
|
86 | - elseif (in_array(($parent = strtok($subclass, '_')), $ci_drivers)) { |
|
76 | + } elseif (in_array(($parent = strtok($subclass, '_')), $ci_drivers)) { |
|
87 | 77 | $dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR.$parent.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR; |
88 | 78 | $class = $subclass; |
89 | - } |
|
90 | - elseif (preg_match('/^CI_DB_(.+)_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 4) |
|
91 | - { |
|
79 | + } elseif (preg_match('/^CI_DB_(.+)_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 4) { |
|
92 | 80 | $driver_path = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR; |
93 | 81 | $dir = $driver_path.$m[1].DIRECTORY_SEPARATOR.'subdrivers'.DIRECTORY_SEPARATOR; |
94 | 82 | $file = $dir.$m[1].'_'.$m[2].'_'.$m[3].'.php'; |
95 | - } |
|
96 | - elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 3) |
|
97 | - { |
|
83 | + } elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 3) { |
|
98 | 84 | $driver_path = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR; |
99 | 85 | $dir = $driver_path.$m[1].DIRECTORY_SEPARATOR; |
100 | 86 | $file = $dir.$m[1].'_'.$m[2].'.php'; |
101 | - } |
|
102 | - elseif (strpos($class, 'CI_DB') === 0) |
|
103 | - { |
|
87 | + } elseif (strpos($class, 'CI_DB') === 0) { |
|
104 | 88 | $dir = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR; |
105 | 89 | $file = $dir.str_replace(array('CI_DB','active_record'), array('DB', 'active_rec'), $subclass).'.php'; |
106 | - } |
|
107 | - else |
|
108 | - { |
|
90 | + } else { |
|
109 | 91 | $class = strtolower($class); |
110 | 92 | } |
111 | 93 | } |
112 | 94 | |
113 | 95 | $file = isset($file) ? $file : $dir.$class.'.php'; |
114 | 96 | |
115 | - if ( ! file_exists($file)) |
|
116 | - { |
|
97 | + if ( ! file_exists($file)) { |
|
117 | 98 | return FALSE; |
118 | 99 | } |
119 | 100 |
@@ -8,8 +8,7 @@ discard block |
||
8 | 8 | * @link https://github.com/kenjis/ci-phpunit-test |
9 | 9 | */ |
10 | 10 | |
11 | -class Mock_Libraries_Email |
|
12 | -{ |
|
11 | +class Mock_Libraries_Email { |
|
13 | 12 | private $data = []; |
14 | 13 | |
15 | 14 | /** |
@@ -17,43 +16,35 @@ discard block |
||
17 | 16 | */ |
18 | 17 | public $return_send = TRUE; |
19 | 18 | |
20 | - public function initialize() |
|
21 | - { |
|
19 | + public function initialize() { |
|
22 | 20 | |
23 | 21 | } |
24 | 22 | |
25 | - public function from($from) |
|
26 | - { |
|
23 | + public function from($from) { |
|
27 | 24 | $this->data['from'] = $from; |
28 | 25 | } |
29 | 26 | |
30 | - public function to($to) |
|
31 | - { |
|
27 | + public function to($to) { |
|
32 | 28 | $this->data['to'] = $to; |
33 | 29 | } |
34 | 30 | |
35 | - public function bcc($bcc) |
|
36 | - { |
|
31 | + public function bcc($bcc) { |
|
37 | 32 | $this->data['bcc'] = $bcc; |
38 | 33 | } |
39 | 34 | |
40 | - public function subject($subject) |
|
41 | - { |
|
35 | + public function subject($subject) { |
|
42 | 36 | $this->data['subject'] = $subject; |
43 | 37 | } |
44 | 38 | |
45 | - public function message($message) |
|
46 | - { |
|
39 | + public function message($message) { |
|
47 | 40 | $this->data['message'] = $message; |
48 | 41 | } |
49 | 42 | |
50 | - public function send() |
|
51 | - { |
|
43 | + public function send() { |
|
52 | 44 | return $this->return_send; |
53 | 45 | } |
54 | 46 | |
55 | - public function _get_data() |
|
56 | - { |
|
47 | + public function _get_data() { |
|
57 | 48 | return $this->data; |
58 | 49 | } |
59 | 50 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php defined('BASEPATH') OR exit('No direct script access allowed'); |
2 | 2 | |
3 | -class About extends MY_Controller |
|
4 | -{ |
|
3 | +class About extends MY_Controller { |
|
5 | 4 | public function __construct() { |
6 | 5 | parent::__construct(); |
7 | 6 | } |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * Rate Limiter Configuration |
@@ -16,13 +16,13 @@ |
||
16 | 16 | $usedCategories = $this->Tracker->getUsedCategories($this->User->id); |
17 | 17 | |
18 | 18 | //NOTE: The checkbox validation is handled in run() |
19 | - $this->form_validation->set_rules('category_custom_1_text', 'Custom Category 1 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
20 | - $this->form_validation->set_rules('category_custom_2_text', 'Custom Category 2 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
21 | - $this->form_validation->set_rules('category_custom_3_text', 'Custom Category 3 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
22 | - $this->form_validation->set_rules('default_series_category', 'Default Series Category', 'required|is_valid_option_value[default_series_category]'); |
|
19 | + $this->form_validation->set_rules('category_custom_1_text', 'Custom Category 1 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
20 | + $this->form_validation->set_rules('category_custom_2_text', 'Custom Category 2 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
21 | + $this->form_validation->set_rules('category_custom_3_text', 'Custom Category 3 Text', 'trim|regex_match[/^[a-zA-Z0-9-_\\s]{0,16}$/]'); |
|
22 | + $this->form_validation->set_rules('default_series_category', 'Default Series Category', 'required|is_valid_option_value[default_series_category]'); |
|
23 | 23 | $this->form_validation->set_rules('enable_live_countdown_timer', 'Enable Live Countdown Timer', 'required|is_valid_option_value[enable_live_countdown_timer]'); |
24 | 24 | |
25 | - if ($isValid = $this->form_validation->run() === TRUE) { |
|
25 | + if($isValid = $this->form_validation->run() === TRUE) { |
|
26 | 26 | foreach($customCategories as $categoryK => $category) { |
27 | 27 | if(!in_array($categoryK, $usedCategories)) { |
28 | 28 | $this->User_Options->set($category, $this->input->post($category) ? 'enabled' : 'disabled'); |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | $this->header_data['page'] = "forgot_password"; |
17 | 17 | |
18 | 18 | //TODO (RESEARCH): Should we allow username here too? |
19 | - $this->form_validation->set_rules('email', 'Email', 'required|valid_email', array( |
|
19 | + $this->form_validation->set_rules('email', 'Email', 'required|valid_email', array( |
|
20 | 20 | 'required' => 'Please enter your email.', |
21 | 21 | 'valid_email' => 'The email your entered is invalid.' |
22 | 22 | )); |
23 | 23 | |
24 | - if ($this->form_validation->run() === TRUE) { |
|
24 | + if($this->form_validation->run() === TRUE) { |
|
25 | 25 | //form is valid |
26 | 26 | |
27 | 27 | $identity = $this->ion_auth->where('email', $this->input->post('email'))->users()->row(); |
@@ -71,21 +71,21 @@ discard block |
||
71 | 71 | $this->header_data['page'] = "reset-password"; |
72 | 72 | |
73 | 73 | $user = $this->ion_auth->forgotten_password_check($code); |
74 | - if ($user) { |
|
74 | + if($user) { |
|
75 | 75 | //code is valid, show reset form or process reset |
76 | 76 | $min_password_length = $this->config->item('min_password_length', 'ion_auth'); |
77 | 77 | $max_password_length = $this->config->item('max_password_length', 'ion_auth'); |
78 | - $this->form_validation->set_rules('new_password', "Password", 'required|min_length['.$min_password_length.']|max_length['.$max_password_length.']'); |
|
78 | + $this->form_validation->set_rules('new_password', "Password", 'required|min_length['.$min_password_length.']|max_length['.$max_password_length.']'); |
|
79 | 79 | $this->form_validation->set_rules('new_password_confirm', "Password Confirm", 'required|matches[password]'); |
80 | 80 | |
81 | - if ($this->form_validation->run() === TRUE) { |
|
81 | + if($this->form_validation->run() === TRUE) { |
|
82 | 82 | //form is valid, process the password reset request |
83 | 83 | //TODO (Reaearch): The original ion_auth auth.php sent the userid to the form, then matched it on return, is there any point to this? |
84 | 84 | |
85 | 85 | $identity = $user->{'email'}; |
86 | 86 | $change = $this->ion_auth->reset_password($identity, $this->input->post('new_password')); |
87 | 87 | |
88 | - if ($change) { |
|
88 | + if($change) { |
|
89 | 89 | //password changed successfully, redirect to login |
90 | 90 | $this->session->set_flashdata('notices', $this->ion_auth->messages()); |
91 | 91 | redirect("user/login", 'refresh'); |
@@ -89,12 +89,14 @@ |
||
89 | 89 | //password changed successfully, redirect to login |
90 | 90 | $this->session->set_flashdata('notices', $this->ion_auth->messages()); |
91 | 91 | redirect("user/login", 'refresh'); |
92 | - } else { //@codeCoverageIgnore |
|
92 | + } else { |
|
93 | +//@codeCoverageIgnore |
|
93 | 94 | //password changed unsuccessfully, refresh page. |
94 | 95 | $this->session->set_flashdata('notices', $this->ion_auth->errors()); |
95 | 96 | redirect('user/reset_password/'.$code, 'refresh'); |
96 | 97 | } |
97 | - } else { //@codeCoverageIgnore |
|
98 | + } else { |
|
99 | +//@codeCoverageIgnore |
|
98 | 100 | //form is invalid OR first-time viewing page |
99 | 101 | $this->global_data['notices'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('notices'); |
100 | 102 |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * Rate Limiter Configuration |
@@ -15,17 +15,17 @@ discard block |
||
15 | 15 | $this->header_data['title'] = "Login"; |
16 | 16 | $this->header_data['page'] = "login"; |
17 | 17 | |
18 | - $this->form_validation->set_rules('identity', 'Identity', 'required|max_length[254]', array( |
|
18 | + $this->form_validation->set_rules('identity', 'Identity', 'required|max_length[254]', array( |
|
19 | 19 | 'required' => 'Please enter your username or email.', |
20 | 20 | 'max_length' => 'Invalid username.' |
21 | 21 | |
22 | 22 | )); |
23 | - $this->form_validation->set_rules('password', 'Password', 'required|max_length[64]', array( |
|
23 | + $this->form_validation->set_rules('password', 'Password', 'required|max_length[64]', array( |
|
24 | 24 | 'required' => 'Please enter your password.', |
25 | 25 | 'max_length' => 'Invalid password.' |
26 | 26 | )); |
27 | 27 | |
28 | - if ($isValid = $this->form_validation->run() === TRUE) { |
|
28 | + if($isValid = $this->form_validation->run() === TRUE) { |
|
29 | 29 | //form is valid |
30 | 30 | |
31 | 31 | //check if identity is email, if not then attempt to use grab from DB |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $this->body_data['notices'] = validation_errors() ? validation_errors() : $this->session->flashdata('notices'); |
64 | 64 | //$errors = $this->form_validation->error_array(); |
65 | 65 | |
66 | - $this->body_data['form_create'] = array ( |
|
66 | + $this->body_data['form_create'] = array( |
|
67 | 67 | 'action' => 'user/login', |
68 | 68 | |
69 | 69 | 'role' => 'form' |
@@ -46,7 +46,8 @@ |
||
46 | 46 | $this->session->keep_flashdata('referred_from'); |
47 | 47 | if($prevURL = $this->session->flashdata('referred_from')) { |
48 | 48 | redirect($prevURL); |
49 | - } else { //@codeCoverageIgnore |
|
49 | + } else { |
|
50 | +//@codeCoverageIgnore |
|
50 | 51 | redirect('/'); //TODO (CHECK): Should this be refresh? |
51 | 52 | } //@codeCoverageIgnore |
52 | 53 | } else { |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('BASEPATH') OR exit('No direct script access allowed'); |
|
1 | +<?php defined('BASEPATH') or exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * Rate Limiter Configuration |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | 'is_unique_email' => 'Email already exists.' |
42 | 42 | )); |
43 | 43 | |
44 | - if ($isValid = $this->form_validation->run() === TRUE) { |
|
44 | + if($isValid = $this->form_validation->run() === TRUE) { |
|
45 | 45 | $email = $this->Auth->parse_email($this->input->post('email')); |
46 | 46 | |
47 | 47 | $this->body_data['email'] = $email; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | //login wasn't valid, failed, or this is a fresh login attempt |
57 | - if(!$isValid){ |
|
57 | + if(!$isValid) { |
|
58 | 58 | //display the email validation form |
59 | 59 | |
60 | 60 | $this->global_data['notices'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message'))); |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | if(!($email = $this->Auth->verification_check($verificationCode))) redirect('user/signup'); |
93 | 93 | |
94 | 94 | //validation is valid, proceed as normal |
95 | - $this->form_validation->set_rules('username', 'Username', 'required|min_length[4]|max_length[15]|valid_username|is_unique_username'); |
|
96 | - $this->form_validation->set_rules('password', 'Password', 'required|valid_password'); |
|
97 | - $this->form_validation->set_rules('password_confirm', 'Confirm Password', 'required|matches[password]'); |
|
98 | - $this->form_validation->set_rules('terms', 'Terms & Conditions', 'required'); |
|
95 | + $this->form_validation->set_rules('username', 'Username', 'required|min_length[4]|max_length[15]|valid_username|is_unique_username'); |
|
96 | + $this->form_validation->set_rules('password', 'Password', 'required|valid_password'); |
|
97 | + $this->form_validation->set_rules('password_confirm', 'Confirm Password', 'required|matches[password]'); |
|
98 | + $this->form_validation->set_rules('terms', 'Terms & Conditions', 'required'); |
|
99 | 99 | //TODO: timezone |
100 | 100 | //TODO: receive email |
101 | 101 | |
102 | - if ($isValid = $this->form_validation->run() === TRUE) { |
|
102 | + if($isValid = $this->form_validation->run() === TRUE) { |
|
103 | 103 | $username = $this->input->post('username'); |
104 | 104 | $password = $this->input->post('password'); |
105 | 105 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | //signup wasn't valid, failed, or this is a fresh signup attempt |
126 | - if(!$isValid){ |
|
126 | + if(!$isValid) { |
|
127 | 127 | //display the create user form |
128 | 128 | |
129 | 129 | $this->global_data['notices'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message'))); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | //login wasn't valid, failed, or this is a fresh login attempt |
57 | - if(!$isValid){ |
|
57 | + if(!$isValid) { |
|
58 | 58 | //display the email validation form |
59 | 59 | |
60 | 60 | $this->global_data['notices'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message'))); |
@@ -89,7 +89,9 @@ discard block |
||
89 | 89 | //This continued signup occurs after the user clicks the verification link in their email. |
90 | 90 | private function _continue_signup($verificationCode) { |
91 | 91 | //check if validation is valid, if so return email, if not redirect to signup |
92 | - if(!($email = $this->Auth->verification_check($verificationCode))) redirect('user/signup'); |
|
92 | + if(!($email = $this->Auth->verification_check($verificationCode))) { |
|
93 | + redirect('user/signup'); |
|
94 | + } |
|
93 | 95 | |
94 | 96 | //validation is valid, proceed as normal |
95 | 97 | $this->form_validation->set_rules('username', 'Username', 'required|min_length[4]|max_length[15]|valid_username|is_unique_username'); |
@@ -113,7 +115,8 @@ discard block |
||
113 | 115 | $this->Auth->verification_complete($email); |
114 | 116 | |
115 | 117 | redirect('help'); |
116 | - } else { //@codeCoverageIgnore |
|
118 | + } else { |
|
119 | +//@codeCoverageIgnore |
|
117 | 120 | //Signup failed. |
118 | 121 | |
119 | 122 | $this->session->set_flashdata('notices', $this->ion_auth->errors()); |
@@ -123,7 +126,7 @@ discard block |
||
123 | 126 | } |
124 | 127 | |
125 | 128 | //signup wasn't valid, failed, or this is a fresh signup attempt |
126 | - if(!$isValid){ |
|
129 | + if(!$isValid) { |
|
127 | 130 | //display the create user form |
128 | 131 | |
129 | 132 | $this->global_data['notices'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message'))); |
@@ -68,7 +68,7 @@ |
||
68 | 68 | public function report_bug() { |
69 | 69 | $this->load->library('user_agent'); |
70 | 70 | if($this->output->is_custom_header_set()) { $this->output->reset_status_header(); return; } |
71 | - $this->form_validation->set_rules('bug[url]', 'Bug [URL]', 'required'); |
|
71 | + $this->form_validation->set_rules('bug[url]', 'Bug [URL]', 'required'); |
|
72 | 72 | $this->form_validation->set_rules('bug[text]', 'Bug [Text]', 'required'); |
73 | 73 | |
74 | 74 | if($this->form_validation->run() === TRUE) { |