@@ -258,9 +258,12 @@ discard block |
||
258 | 258 | <?php endforeach; ?> |
259 | 259 | </table> |
260 | 260 | |
261 | - <?php else : ?> |
|
261 | + <?php else { |
|
262 | + : ?> |
|
262 | 263 | |
263 | - <?php echo $sections['console']; ?> |
|
264 | + <?php echo $sections['console']; |
|
265 | +} |
|
266 | +?> |
|
264 | 267 | |
265 | 268 | <?php endif; ?> |
266 | 269 | </div> |
@@ -289,9 +292,12 @@ discard block |
||
289 | 292 | <?php endforeach; ?> |
290 | 293 | </table> |
291 | 294 | |
292 | - <?php else : ?> |
|
295 | + <?php else { |
|
296 | + : ?> |
|
293 | 297 | |
294 | - <?php echo $sections['console']; ?> |
|
298 | + <?php echo $sections['console']; |
|
299 | +} |
|
300 | +?> |
|
295 | 301 | |
296 | 302 | <?php endif; ?> |
297 | 303 | </div> |
@@ -310,9 +316,12 @@ discard block |
||
310 | 316 | <?php endforeach; ?> |
311 | 317 | </table> |
312 | 318 | |
313 | - <?php else : ?> |
|
319 | + <?php else { |
|
320 | + : ?> |
|
314 | 321 | |
315 | - <?php echo $sections['benchmarks']; ?> |
|
322 | + <?php echo $sections['benchmarks']; |
|
323 | +} |
|
324 | +?> |
|
316 | 325 | |
317 | 326 | <?php endif; ?> |
318 | 327 | </div> |
@@ -333,9 +342,12 @@ discard block |
||
333 | 342 | <?php endforeach; ?> |
334 | 343 | </table> |
335 | 344 | |
336 | - <?php else : ?> |
|
345 | + <?php else { |
|
346 | + : ?> |
|
337 | 347 | |
338 | - <?php echo $sections['queries']; ?> |
|
348 | + <?php echo $sections['queries']; |
|
349 | +} |
|
350 | +?> |
|
339 | 351 | |
340 | 352 | <?php endif; ?> |
341 | 353 | </div> |
@@ -395,8 +407,11 @@ discard block |
||
395 | 407 | <?php foreach ($sections[$section] as $key => $val) : ?> |
396 | 408 | <tr><td class="hilight"><?php echo $key ?></td><td><?php echo htmlspecialchars($val) ?></td></tr> |
397 | 409 | <?php endforeach; ?> |
398 | - <?php else : ?> |
|
399 | - <tr><td><?php echo $sections[$section]; ?></td></tr> |
|
410 | + <?php else { |
|
411 | + : ?> |
|
412 | + <tr><td><?php echo $sections[$section]; |
|
413 | +} |
|
414 | +?></td></tr> |
|
400 | 415 | <?php endif; ?> |
401 | 416 | </table> |
402 | 417 | <?php endif; ?> |
@@ -423,20 +438,26 @@ discard block |
||
423 | 438 | <?php endforeach; ?> |
424 | 439 | </table> |
425 | 440 | |
426 | - <?php else : ?> |
|
441 | + <?php else { |
|
442 | + : ?> |
|
427 | 443 | |
428 | - <?php echo $sections['files']; ?> |
|
444 | + <?php echo $sections['files']; |
|
445 | +} |
|
446 | +?> |
|
429 | 447 | |
430 | 448 | <?php endif; ?> |
431 | 449 | </div> |
432 | 450 | <?php endif; ?> |
433 | 451 | |
434 | 452 | |
435 | -<?php else: ?> |
|
453 | +<?php else { |
|
454 | + : ?> |
|
436 | 455 | |
437 | 456 | <p class="ci-profiler-box"><?php echo lang('profiler_no_profiles') ?></p> |
438 | 457 | |
439 | -<?php endif; ?> |
|
458 | +<?php endif; |
|
459 | +} |
|
460 | +?> |
|
440 | 461 | |
441 | 462 | </div> <!-- /codeigniter_profiler --> |
442 | 463 | </div> |
443 | 464 | \ No newline at end of file |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | Load Time |
197 | 197 | </a> |
198 | 198 | <a href="#" id="ci-profiler-menu-memory" onclick="ci_profiler_bar.show('ci-profiler-memory', 'ci-profiler-menu-memory'); return false;"> |
199 | - <span><?php echo (! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).' MB' ?></span> |
|
199 | + <span><?php echo ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage() / 1024 / 1024, 2).' MB' ?></span> |
|
200 | 200 | Memory Used |
201 | 201 | </a> |
202 | 202 | <?php endif; ?> |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | <?php $append = ($section == 'get' || $section == 'post') ? '_data' : '' ?> |
386 | 386 | <a href="#" onclick="ci_profiler_bar.toggle_data_table('<?php echo $section ?>'); return false;"> |
387 | - <h2><?php echo lang('profiler_' . $section . $append) ?></h2> |
|
387 | + <h2><?php echo lang('profiler_'.$section.$append) ?></h2> |
|
388 | 388 | </a> |
389 | 389 | |
390 | 390 |
@@ -49,20 +49,20 @@ discard block |
||
49 | 49 | ini_set('display_errors', 1); |
50 | 50 | |
51 | 51 | // Load our autoloader |
52 | -require __DIR__ .'/../vendor/autoload.php'; |
|
52 | +require __DIR__.'/../vendor/autoload.php'; |
|
53 | 53 | |
54 | 54 | // Load configuration |
55 | 55 | require 'build_config.php'; |
56 | 56 | |
57 | 57 | // Folder definitions |
58 | -define('BUILDBASE', __DIR__ .'/'); |
|
58 | +define('BUILDBASE', __DIR__.'/'); |
|
59 | 59 | |
60 | 60 | // Don't stop script exectuion on 404... |
61 | 61 | function show_404($page = '', $log_error = TRUE) {} |
62 | 62 | |
63 | 63 | // Make sure we have access to CI() object. |
64 | 64 | ob_start(); |
65 | - require( BUILDBASE .'../index.php' ); |
|
65 | + require(BUILDBASE.'../index.php'); |
|
66 | 66 | ob_end_clean(); |
67 | 67 | |
68 | 68 | //-------------------------------------------------------------------- |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | |
74 | 74 | if (empty($release)) |
75 | 75 | { |
76 | - $release = CLI::prompt("Which script", array_keys($config['builds']) ); |
|
76 | + $release = CLI::prompt("Which script", array_keys($config['builds'])); |
|
77 | 77 | } |
78 | 78 | |
79 | -if (! array_key_exists($release, $config['builds'])) |
|
79 | +if ( ! array_key_exists($release, $config['builds'])) |
|
80 | 80 | { |
81 | - CLI::error('Invalid build specified: '. $release); |
|
81 | + CLI::error('Invalid build specified: '.$release); |
|
82 | 82 | exit(1); |
83 | 83 | } |
84 | 84 | |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | $class_name = $config['builds'][$release]; |
90 | 90 | |
91 | 91 | |
92 | -if (! file_exists(BUILDBASE ."scripts/{$class_name}.php")) |
|
92 | +if ( ! file_exists(BUILDBASE."scripts/{$class_name}.php")) |
|
93 | 93 | { |
94 | - CLI::error('Unable to find build script: '. $class_name .'.php'); |
|
94 | + CLI::error('Unable to find build script: '.$class_name.'.php'); |
|
95 | 95 | exit(1); |
96 | 96 | } |
97 | 97 | |
98 | -require BUILDBASE ."lib/BaseBuilder.php"; |
|
99 | -require BUILDBASE ."scripts/{$class_name}.php"; |
|
98 | +require BUILDBASE."lib/BaseBuilder.php"; |
|
99 | +require BUILDBASE."scripts/{$class_name}.php"; |
|
100 | 100 | |
101 | -$builder = new $class_name( $config['destinations'][$release], get_instance() ); |
|
101 | +$builder = new $class_name($config['destinations'][$release], get_instance()); |
|
102 | 102 | |
103 | -if (! is_object($builder)) |
|
103 | +if ( ! is_object($builder)) |
|
104 | 104 | { |
105 | - CLI::error('Unable to make new class: '. $class_name); |
|
105 | + CLI::error('Unable to make new class: '.$class_name); |
|
106 | 106 | exit(1); |
107 | 107 | } |
108 | 108 | |
@@ -118,4 +118,4 @@ discard block |
||
118 | 118 | $end_time = microtime(true); |
119 | 119 | $elapsed_time = number_format($end_time - $start_time, 4); |
120 | 120 | |
121 | -CLI::write('Done in '. $elapsed_time .' seconds', 'green'); |
|
122 | 121 | \ No newline at end of file |
122 | +CLI::write('Done in '.$elapsed_time.' seconds', 'green'); |
|
123 | 123 | \ No newline at end of file |
@@ -11,7 +11,7 @@ |
||
11 | 11 | $config['builds'] = [ |
12 | 12 | 'release' => 'SprintRelease', |
13 | 13 | 'postCreateProject' => 'InitialCleanup', |
14 | - 'publishSubTrees' => 'SubTreeSplit' |
|
14 | + 'publishSubTrees' => 'SubTreeSplit' |
|
15 | 15 | ]; |
16 | 16 | |
17 | 17 | //-------------------------------------------------------------------- |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | |
17 | 17 | protected $ignore_files = ['.', '..', '.git', 'vendor', '.idea', '.travis.yml', 'build']; |
18 | 18 | |
19 | - public function __construct($destination, $ci=null) |
|
19 | + public function __construct($destination, $ci = null) |
|
20 | 20 | { |
21 | 21 | parent::__construct($ci); |
22 | 22 | |
23 | - $this->source_path = realpath(BUILDBASE .'../'); |
|
23 | + $this->source_path = realpath(BUILDBASE.'../'); |
|
24 | 24 | |
25 | 25 | if (empty($this->source_path)) |
26 | 26 | { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $this->cleanTestsFolder(); |
47 | 47 | |
48 | 48 | CLI::write("\tRemoving application modules..."); |
49 | - $this->cleanFolder($this->dest_path .'/application/modules', ['index.html', '.htaccess']); |
|
49 | + $this->cleanFolder($this->dest_path.'/application/modules', ['index.html', '.htaccess']); |
|
50 | 50 | |
51 | 51 | CLI::write("\tGenerating default encryption key for config file..."); |
52 | 52 | $this->generateEncryptionKey(); |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | private function cleanTempFiles() |
62 | 62 | { |
63 | 63 | // Remove Log Files |
64 | - $this->cleanFolder($this->dest_path .'/application/logs', ['index.html', '.htaccess']); |
|
64 | + $this->cleanFolder($this->dest_path.'/application/logs', ['index.html', '.htaccess']); |
|
65 | 65 | |
66 | 66 | // Cache Files |
67 | - $this->cleanFolder($this->dest_path .'/application/cache', ['index.html', '.htaccess']); |
|
67 | + $this->cleanFolder($this->dest_path.'/application/cache', ['index.html', '.htaccess']); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | //-------------------------------------------------------------------- |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | public function cleanTestsFolder() |
73 | 73 | { |
74 | 74 | // Remove coverage Files |
75 | - $this->cleanFolder($this->dest_path .'/tests/_output', ['.gitignore']); |
|
75 | + $this->cleanFolder($this->dest_path.'/tests/_output', ['.gitignore']); |
|
76 | 76 | |
77 | 77 | // Remove our Acceptance tests |
78 | - $this->cleanFolder($this->dest_path .'/tests/acceptance/myth'); |
|
79 | - rmdir($this->dest_path .'/tests/acceptance/myth'); |
|
78 | + $this->cleanFolder($this->dest_path.'/tests/acceptance/myth'); |
|
79 | + rmdir($this->dest_path.'/tests/acceptance/myth'); |
|
80 | 80 | |
81 | 81 | // Remove our Unit tests |
82 | - $this->cleanFolder($this->dest_path .'/tests/unit/myth'); |
|
83 | - rmdir($this->dest_path .'/tests/unit/myth'); |
|
82 | + $this->cleanFolder($this->dest_path.'/tests/unit/myth'); |
|
83 | + rmdir($this->dest_path.'/tests/unit/myth'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | //-------------------------------------------------------------------- |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | $length = 16; |
95 | 95 | |
96 | 96 | $this->ci->load->library('Encryption'); |
97 | - $key = bin2hex( $this->ci->encryption->create_key( $length ) ); |
|
97 | + $key = bin2hex($this->ci->encryption->create_key($length)); |
|
98 | 98 | |
99 | 99 | $replace = "hex2bin( '$key' )"; |
100 | 100 | |
101 | 101 | $kit = new FileKit(); |
102 | 102 | |
103 | - $kit->replaceIn(BUILDBASE .'../application/config/config.php', "'PLEASE_CHANGE_ME!'", $replace); |
|
103 | + $kit->replaceIn(BUILDBASE.'../application/config/config.php', "'PLEASE_CHANGE_ME!'", $replace); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | //-------------------------------------------------------------------- |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | public function __construct($destination) |
19 | 19 | { |
20 | - $this->source_path = realpath(BUILDBASE .'../'); |
|
20 | + $this->source_path = realpath(BUILDBASE .'../'); |
|
21 | 21 | |
22 | 22 | if (empty($this->source_path)) |
23 | 23 | { |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | public function __construct($destination) |
19 | 19 | { |
20 | - $this->source_path = realpath(BUILDBASE .'../'); |
|
20 | + $this->source_path = realpath(BUILDBASE .'../'); |
|
21 | 21 | |
22 | 22 | if (empty($this->source_path)) |
23 | 23 | { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | public function __construct($destination) |
19 | 19 | { |
20 | - $this->source_path = realpath(BUILDBASE .'../'); |
|
20 | + $this->source_path = realpath(BUILDBASE.'../'); |
|
21 | 21 | |
22 | 22 | if (empty($this->source_path)) |
23 | 23 | { |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | exit(1); |
26 | 26 | } |
27 | 27 | |
28 | - $this->dest_path = BUILDBASE . $destination; |
|
29 | - $this->dest_path = rtrim($this->dest_path, '/ ') .'/'. date('Y-m-d'); |
|
28 | + $this->dest_path = BUILDBASE.$destination; |
|
29 | + $this->dest_path = rtrim($this->dest_path, '/ ').'/'.date('Y-m-d'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | //-------------------------------------------------------------------- |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | $this->cleanTestsFolder(); |
52 | 52 | |
53 | 53 | CLI::write("\tRemoving application modules..."); |
54 | - $this->cleanFolder($this->dest_path .'/application/modules', ['index.html', '.htaccess']); |
|
54 | + $this->cleanFolder($this->dest_path.'/application/modules', ['index.html', '.htaccess']); |
|
55 | 55 | |
56 | 56 | CLI::write("\tCompressing files..."); |
57 | - $this->compressFolder($this->dest_path, $this->dest_path .'/Sprint_'. date('Y-m-d') .'.zip'); |
|
57 | + $this->compressFolder($this->dest_path, $this->dest_path.'/Sprint_'.date('Y-m-d').'.zip'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | //-------------------------------------------------------------------- |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | private function cleanTempFiles() |
67 | 67 | { |
68 | 68 | // Remove Log Files |
69 | - $this->cleanFolder($this->dest_path .'/application/logs', ['index.html', '.htaccess']); |
|
69 | + $this->cleanFolder($this->dest_path.'/application/logs', ['index.html', '.htaccess']); |
|
70 | 70 | |
71 | 71 | // Cache Files |
72 | - $this->cleanFolder($this->dest_path .'/application/cache', ['index.html', '.htaccess']); |
|
72 | + $this->cleanFolder($this->dest_path.'/application/cache', ['index.html', '.htaccess']); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | //-------------------------------------------------------------------- |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | public function cleanTestsFolder() |
78 | 78 | { |
79 | 79 | // Remove coverage Files |
80 | - $this->cleanFolder($this->dest_path .'/tests/_output', ['.gitignore']); |
|
80 | + $this->cleanFolder($this->dest_path.'/tests/_output', ['.gitignore']); |
|
81 | 81 | |
82 | 82 | // Remove our Acceptance tests |
83 | - $this->cleanFolder($this->dest_path .'/tests/acceptance/myth'); |
|
84 | - rmdir($this->dest_path .'/tests/acceptance/myth'); |
|
83 | + $this->cleanFolder($this->dest_path.'/tests/acceptance/myth'); |
|
84 | + rmdir($this->dest_path.'/tests/acceptance/myth'); |
|
85 | 85 | |
86 | 86 | // Remove our Unit tests |
87 | - $this->cleanFolder($this->dest_path .'/tests/unit/myth'); |
|
88 | - rmdir($this->dest_path .'/tests/unit/myth'); |
|
87 | + $this->cleanFolder($this->dest_path.'/tests/unit/myth'); |
|
88 | + rmdir($this->dest_path.'/tests/unit/myth'); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | //-------------------------------------------------------------------- |
@@ -12,12 +12,12 @@ |
||
12 | 12 | */ |
13 | 13 | class SubTreeSplit extends BaseBuilder { |
14 | 14 | |
15 | - public function run() |
|
16 | - { |
|
15 | + public function run() |
|
16 | + { |
|
17 | 17 | |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | - //-------------------------------------------------------------------- |
|
20 | + //-------------------------------------------------------------------- |
|
21 | 21 | |
22 | 22 | |
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | */ |
58 | 58 | $domain = ! empty($_SERVER['HTTP_HOST']) ? strtolower($_SERVER['HTTP_HOST']) : 'cli'; |
59 | 59 | |
60 | - /** |
|
61 | - * A simple method to automatically determine the environment that |
|
62 | - * the script is running on. Modify to support your needs. |
|
63 | - * |
|
64 | - * To handle Travis-ci testing, we check for an environment |
|
65 | - * variable called TRAVIS which is set in the .travis.yml file. |
|
66 | - * This allows a database-specific setup for Travis testing. |
|
67 | - */ |
|
68 | - if (isset($_ENV['TRAVIS'])) |
|
69 | - { |
|
70 | - define('ENVIRONMENT', 'travis'); |
|
71 | - } |
|
72 | - else if (isset($_ENV['TESTING'])) |
|
73 | - { |
|
74 | - define('ENVIRONMENT', 'testing'); |
|
75 | - } |
|
76 | - else if (strpos($domain, '.dev') !== false || $domain == 'cli') |
|
77 | - { |
|
78 | - define('ENVIRONMENT', 'development'); |
|
79 | - } |
|
80 | - else { |
|
81 | - define('ENVIRONMENT', 'production'); |
|
82 | - } |
|
60 | + /** |
|
61 | + * A simple method to automatically determine the environment that |
|
62 | + * the script is running on. Modify to support your needs. |
|
63 | + * |
|
64 | + * To handle Travis-ci testing, we check for an environment |
|
65 | + * variable called TRAVIS which is set in the .travis.yml file. |
|
66 | + * This allows a database-specific setup for Travis testing. |
|
67 | + */ |
|
68 | + if (isset($_ENV['TRAVIS'])) |
|
69 | + { |
|
70 | + define('ENVIRONMENT', 'travis'); |
|
71 | + } |
|
72 | + else if (isset($_ENV['TESTING'])) |
|
73 | + { |
|
74 | + define('ENVIRONMENT', 'testing'); |
|
75 | + } |
|
76 | + else if (strpos($domain, '.dev') !== false || $domain == 'cli') |
|
77 | + { |
|
78 | + define('ENVIRONMENT', 'development'); |
|
79 | + } |
|
80 | + else { |
|
81 | + define('ENVIRONMENT', 'production'); |
|
82 | + } |
|
83 | 83 | |
84 | 84 | /* |
85 | 85 | *--------------------------------------------------------------- |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | switch (ENVIRONMENT) |
93 | 93 | { |
94 | 94 | case 'development': |
95 | - case 'travis': |
|
95 | + case 'travis': |
|
96 | 96 | case 'testing': |
97 | 97 | error_reporting(-1); |
98 | 98 | ini_set('display_errors', 1); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * Include the path if the folder is not in the same directory |
151 | 151 | * as this file. |
152 | 152 | */ |
153 | - $myth_folder = 'myth'; |
|
153 | + $myth_folder = 'myth'; |
|
154 | 154 | |
155 | 155 | /* |
156 | 156 | *--------------------------------------------------------------- |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | // Name of the "system folder" |
268 | 268 | define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/')); |
269 | 269 | |
270 | - // Path to the myth folder |
|
271 | - define('MYTHPATH', rtrim( str_replace('\\', '/', $myth_folder), '/ ') .'/' ); |
|
270 | + // Path to the myth folder |
|
271 | + define('MYTHPATH', rtrim( str_replace('\\', '/', $myth_folder), '/ ') .'/' ); |
|
272 | 272 | |
273 | 273 | // The path to the "application" folder |
274 | 274 | if (is_dir($application_folder)) |
@@ -92,7 +92,7 @@ |
||
92 | 92 | switch (ENVIRONMENT) |
93 | 93 | { |
94 | 94 | case 'development': |
95 | - case 'travis': |
|
95 | + case 'travis': |
|
96 | 96 | case 'testing': |
97 | 97 | error_reporting(-1); |
98 | 98 | ini_set('display_errors', 1); |
@@ -268,7 +268,7 @@ |
||
268 | 268 | define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/')); |
269 | 269 | |
270 | 270 | // Path to the myth folder |
271 | - define('MYTHPATH', rtrim( str_replace('\\', '/', $myth_folder), '/ ') .'/' ); |
|
271 | + define('MYTHPATH', rtrim(str_replace('\\', '/', $myth_folder), '/ ').'/'); |
|
272 | 272 | |
273 | 273 | // The path to the "application" folder |
274 | 274 | if (is_dir($application_folder)) |
@@ -68,16 +68,13 @@ discard block |
||
68 | 68 | if (isset($_ENV['TRAVIS'])) |
69 | 69 | { |
70 | 70 | define('ENVIRONMENT', 'travis'); |
71 | - } |
|
72 | - else if (isset($_ENV['TESTING'])) |
|
71 | + } else if (isset($_ENV['TESTING'])) |
|
73 | 72 | { |
74 | 73 | define('ENVIRONMENT', 'testing'); |
75 | - } |
|
76 | - else if (strpos($domain, '.dev') !== false || $domain == 'cli') |
|
74 | + } else if (strpos($domain, '.dev') !== false || $domain == 'cli') |
|
77 | 75 | { |
78 | 76 | define('ENVIRONMENT', 'development'); |
79 | - } |
|
80 | - else { |
|
77 | + } else { |
|
81 | 78 | define('ENVIRONMENT', 'production'); |
82 | 79 | } |
83 | 80 | |
@@ -103,8 +100,7 @@ discard block |
||
103 | 100 | if (version_compare(PHP_VERSION, '5.3', '>=')) |
104 | 101 | { |
105 | 102 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
106 | - } |
|
107 | - else |
|
103 | + } else |
|
108 | 104 | { |
109 | 105 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); |
110 | 106 | } |
@@ -235,8 +231,7 @@ discard block |
||
235 | 231 | if (($_temp = realpath($system_path)) !== FALSE) |
236 | 232 | { |
237 | 233 | $system_path = $_temp.'/'; |
238 | - } |
|
239 | - else |
|
234 | + } else |
|
240 | 235 | { |
241 | 236 | // Ensure there's a trailing slash |
242 | 237 | $system_path = rtrim($system_path, '/').'/'; |
@@ -279,8 +274,7 @@ discard block |
||
279 | 274 | } |
280 | 275 | |
281 | 276 | define('APPPATH', $application_folder.DIRECTORY_SEPARATOR); |
282 | - } |
|
283 | - else |
|
277 | + } else |
|
284 | 278 | { |
285 | 279 | if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
286 | 280 | { |
@@ -298,14 +292,12 @@ discard block |
||
298 | 292 | if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
299 | 293 | { |
300 | 294 | $view_folder = APPPATH.$view_folder; |
301 | - } |
|
302 | - elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
|
295 | + } elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
|
303 | 296 | { |
304 | 297 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
305 | 298 | echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
306 | 299 | exit(3); // EXIT_CONFIG |
307 | - } |
|
308 | - else |
|
300 | + } else |
|
309 | 301 | { |
310 | 302 | $view_folder = APPPATH.'views'; |
311 | 303 | } |
@@ -314,8 +306,7 @@ discard block |
||
314 | 306 | if (($_temp = realpath($view_folder)) !== FALSE) |
315 | 307 | { |
316 | 308 | $view_folder = $_temp.DIRECTORY_SEPARATOR; |
317 | - } |
|
318 | - else |
|
309 | + } else |
|
319 | 310 | { |
320 | 311 | $view_folder = rtrim($view_folder, '/\\').DIRECTORY_SEPARATOR; |
321 | 312 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function setRealm($realm) |
76 | 76 | { |
77 | - $this->realm = $realm; |
|
77 | + $this->realm = $realm; |
|
78 | 78 | return $this; |
79 | 79 | } |
80 | 80 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | 'password' => $password |
117 | 117 | ]; |
118 | 118 | |
119 | - $user = $this->validate($data, true); |
|
119 | + $user = $this->validate($data, true); |
|
120 | 120 | |
121 | 121 | $this->user = $user; |
122 | 122 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function checkIPBlacklist() |
274 | 274 | { |
275 | - $blacklist = explode(',', config_item('api.ip_blacklist')); |
|
275 | + $blacklist = explode(',', config_item('api.ip_blacklist')); |
|
276 | 276 | |
277 | 277 | array_walk($blacklist, function (&$item, $key) { |
278 | 278 | $item = trim($item); |
@@ -145,8 +145,7 @@ |
||
145 | 145 | if ($this->ci->input->server('PHP_AUTH_DIGEST')) |
146 | 146 | { |
147 | 147 | $digest_string = $this->ci->input->server('PHP_AUTH_DIGEST'); |
148 | - } |
|
149 | - elseif ($this->ci->input->server('HTTP_AUTHORIZATION')) |
|
148 | + } elseif ($this->ci->input->server('HTTP_AUTHORIZATION')) |
|
150 | 149 | { |
151 | 150 | $digest_string = $this->ci->input->server('HTTP_AUTHORIZATION'); |
152 | 151 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | //-------------------------------------------------------------------- |
48 | 48 | |
49 | - public function __construct($ci=null) |
|
49 | + public function __construct($ci = null) |
|
50 | 50 | { |
51 | 51 | parent::__construct($ci); |
52 | 52 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | // so request authorization by the client. |
113 | 113 | if (empty($username) || empty($password)) |
114 | 114 | { |
115 | - $this->ci->output->set_header('WWW-Authenticate: Basic realm="'. config_item('api.realm') .'"'); |
|
115 | + $this->ci->output->set_header('WWW-Authenticate: Basic realm="'.config_item('api.realm').'"'); |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | // No digest string? Then you're done. Go home. |
163 | 163 | if (empty($digest_string)) |
164 | 164 | { |
165 | - $this->ci->output->set_header( sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque) ); |
|
165 | + $this->ci->output->set_header(sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque)); |
|
166 | 166 | return false; |
167 | 167 | } |
168 | 168 | |
@@ -172,30 +172,30 @@ discard block |
||
172 | 172 | preg_match_all('@(username|nonce|uri|nc|cnonce|qop|response)=[\'"]?([^\'",]+)@', $digest_string, $matches); |
173 | 173 | $digest = (empty($matches[1]) || empty($matches[2])) ? array() : array_combine($matches[1], $matches[2]); |
174 | 174 | |
175 | - if (! array_key_exists('username', $digest)) |
|
175 | + if ( ! array_key_exists('username', $digest)) |
|
176 | 176 | { |
177 | - $this->ci->output->set_header( sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque) ); |
|
177 | + $this->ci->output->set_header(sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque)); |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
181 | 181 | // Grab the user that corresponds to that "username" |
182 | 182 | // exact field determined in the api config file - api.auth_field setting. |
183 | - $user = $this->user_model->as_array()->find_by( config_item('api.auth_field'), $digest['username'] ); |
|
183 | + $user = $this->user_model->as_array()->find_by(config_item('api.auth_field'), $digest['username']); |
|
184 | 184 | |
185 | 185 | // If the user is throttled due to too many invalid logins |
186 | 186 | // or the system is under attack, kick them back. |
187 | 187 | |
188 | 188 | // If throttling time is above zero, we can't allow |
189 | 189 | // logins now. |
190 | - if ($time = (int)$this->isThrottled($user) > 0) |
|
190 | + if ($time = (int) $this->isThrottled($user) > 0) |
|
191 | 191 | { |
192 | 192 | $this->error = sprintf(lang('api.throttled'), $time); |
193 | 193 | return false; |
194 | 194 | } |
195 | 195 | |
196 | - if (! $user) |
|
196 | + if ( ! $user) |
|
197 | 197 | { |
198 | - $this->ci->output->set_header( sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque) ); |
|
198 | + $this->ci->output->set_header(sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque)); |
|
199 | 199 | $this->ci->login_model->recordLoginAttempt($this->ci->input->ip_address()); |
200 | 200 | return false; |
201 | 201 | } |
@@ -205,16 +205,16 @@ discard block |
||
205 | 205 | |
206 | 206 | if ($digest['qop'] == 'auth') |
207 | 207 | { |
208 | - $A2 = md5( strtoupper( $_SERVER['REQUEST_METHOD'] ) .':'. $digest['uri'] ); |
|
208 | + $A2 = md5(strtoupper($_SERVER['REQUEST_METHOD']).':'.$digest['uri']); |
|
209 | 209 | } else { |
210 | 210 | $body = file_get_contents('php://input'); |
211 | - $A2 = md5( strtoupper( $_SERVER['REQUEST_METHOD'] ) .':'. $digest['uri'] .':'. md5($body) ); |
|
211 | + $A2 = md5(strtoupper($_SERVER['REQUEST_METHOD']).':'.$digest['uri'].':'.md5($body)); |
|
212 | 212 | } |
213 | - $valid_response = md5($A1 .':'. $digest['nonce'].':'. $digest['nc'] .':'. $digest['cnonce'] .':'. $digest['qop'] .':'. $A2); |
|
213 | + $valid_response = md5($A1.':'.$digest['nonce'].':'.$digest['nc'].':'.$digest['cnonce'].':'.$digest['qop'].':'.$A2); |
|
214 | 214 | |
215 | 215 | if ($digest['response'] != $valid_response) |
216 | 216 | { |
217 | - $this->ci->output->set_header( sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque) ); |
|
217 | + $this->ci->output->set_header(sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque)); |
|
218 | 218 | $this->ci->login_model->recordLoginAttempt($this->ci->input->ip_address(), $user['id']); |
219 | 219 | return false; |
220 | 220 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | break; |
253 | 253 | } |
254 | 254 | |
255 | - if (! $user) |
|
255 | + if ( ! $user) |
|
256 | 256 | { |
257 | 257 | $this->user = null; |
258 | 258 | return $user; |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | { |
281 | 281 | $blacklist = explode(',', config_item('api.ip_blacklist')); |
282 | 282 | |
283 | - array_walk($blacklist, function (&$item, $key) { |
|
283 | + array_walk($blacklist, function(&$item, $key) { |
|
284 | 284 | $item = trim($item); |
285 | 285 | }); |
286 | 286 | |
287 | 287 | if (in_array($this->ci->input->ip_address(), $blacklist)) |
288 | 288 | { |
289 | - throw new \Exception( lang('api.ip_denied'), 401); |
|
289 | + throw new \Exception(lang('api.ip_denied'), 401); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | return true; |
@@ -305,13 +305,13 @@ discard block |
||
305 | 305 | |
306 | 306 | array_push($whitelist, '127.0.0.1', '0.0.0.0'); |
307 | 307 | |
308 | - array_walk($whitelist, function (&$item, $key) { |
|
308 | + array_walk($whitelist, function(&$item, $key) { |
|
309 | 309 | $item = trim($item); |
310 | 310 | }); |
311 | 311 | |
312 | - if (! in_array($this->ci->input->ip_address(), $whitelist)) |
|
312 | + if ( ! in_array($this->ci->input->ip_address(), $whitelist)) |
|
313 | 313 | { |
314 | - throw new \Exception( lang('api.ip_denied'), 401); |
|
314 | + throw new \Exception(lang('api.ip_denied'), 401); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | return true; |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @return bool|mixed|void |
370 | 370 | */ |
371 | - public function login($credentials, $remember=false) |
|
371 | + public function login($credentials, $remember = false) |
|
372 | 372 | { |
373 | - throw new \BadMethodCallException( lang('api.unused_method') ); |
|
373 | + throw new \BadMethodCallException(lang('api.unused_method')); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | //-------------------------------------------------------------------- |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | */ |
386 | 386 | public function logout() |
387 | 387 | { |
388 | - throw new \BadMethodCallException( lang('api.unused_method') ); |
|
388 | + throw new \BadMethodCallException(lang('api.unused_method')); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | //-------------------------------------------------------------------- |
@@ -55,11 +55,11 @@ |
||
55 | 55 | $time = date('Y-m-d H:00:00'); |
56 | 56 | |
57 | 57 | $query = $this->db->select('id') |
58 | - ->where('user_id', (int)$user_id) |
|
58 | + ->where('user_id', (int) $user_id) |
|
59 | 59 | ->where('created_on >=', $time) |
60 | 60 | ->get($this->table_name); |
61 | 61 | |
62 | - return (int)$query->num_rows(); |
|
62 | + return (int) $query->num_rows(); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | //-------------------------------------------------------------------- |