Completed
Push — master ( 646b8b...a5c38a )
by Angus
08:02
created
public/index.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
  * Different environments will require different levels of error reporting.
64 64
  * By default development will show errors but testing and live will hide them.
65 65
  */
66
-switch (ENVIRONMENT)
66
+switch(ENVIRONMENT)
67 67
 {
68 68
 	case 'development':
69 69
 		error_reporting(-1);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	case 'testing':
80 80
 	case 'production':
81 81
 		ini_set('display_errors', 0);
82
-		if (version_compare(PHP_VERSION, '5.3', '>='))
82
+		if(version_compare(PHP_VERSION, '5.3', '>='))
83 83
 		{
84 84
 			error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
85 85
 		}
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
  */
198 198
 
199 199
 // Set the current directory correctly for CLI requests
200
-if (defined('STDIN'))
200
+if(defined('STDIN'))
201 201
 {
202 202
 	chdir(dirname(__FILE__));
203 203
 }
204 204
 
205
-if (($_temp = realpath($system_path)) !== FALSE)
205
+if(($_temp = realpath($system_path)) !== FALSE)
206 206
 {
207 207
 	$system_path = $_temp.DIRECTORY_SEPARATOR;
208 208
 }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 }
218 218
 
219 219
 // Is the system path correct?
220
-if ( ! is_dir($system_path))
220
+if(!is_dir($system_path))
221 221
 {
222 222
 	header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
223 223
 	echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 define('SYSDIR', basename(BASEPATH));
243 243
 
244 244
 // The path to the "application" directory
245
-if (is_dir($application_folder))
245
+if(is_dir($application_folder))
246 246
 {
247
-	if (($_temp = realpath($application_folder)) !== FALSE)
247
+	if(($_temp = realpath($application_folder)) !== FALSE)
248 248
 	{
249 249
 		$application_folder = $_temp;
250 250
 	}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		);
258 258
 	}
259 259
 }
260
-elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
260
+elseif(is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
261 261
 {
262 262
 	$application_folder = BASEPATH.strtr(
263 263
 			trim($application_folder, '/\\'),
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
 define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
276 276
 
277 277
 // The path to the "views" directory
278
-if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
278
+if(!isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
279 279
 {
280 280
 	$view_folder = APPPATH.'views';
281 281
 }
282
-elseif (is_dir($view_folder))
282
+elseif(is_dir($view_folder))
283 283
 {
284
-	if (($_temp = realpath($view_folder)) !== FALSE)
284
+	if(($_temp = realpath($view_folder)) !== FALSE)
285 285
 	{
286 286
 		$view_folder = $_temp;
287 287
 	}
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		);
295 295
 	}
296 296
 }
297
-elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
297
+elseif(is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
298 298
 {
299 299
 	$view_folder = APPPATH.strtr(
300 300
 			trim($view_folder, '/\\'),
Please login to merge, or discard this patch.
Braces   +18 added lines, -45 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@  discard block
 block discarded – undo
63 63
  * Different environments will require different levels of error reporting.
64 64
  * By default development will show errors but testing and live will hide them.
65 65
  */
66
-switch (ENVIRONMENT)
67
-{
66
+switch (ENVIRONMENT) {
68 67
 	case 'development':
69 68
 		error_reporting(-1);
70 69
 		ini_set('display_errors', 1);
@@ -79,12 +78,9 @@  discard block
 block discarded – undo
79 78
 	case 'testing':
80 79
 	case 'production':
81 80
 		ini_set('display_errors', 0);
82
-		if (version_compare(PHP_VERSION, '5.3', '>='))
83
-		{
81
+		if (version_compare(PHP_VERSION, '5.3', '>=')) {
84 82
 			error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
85
-		}
86
-		else
87
-		{
83
+		} else {
88 84
 			error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
89 85
 		}
90 86
 		break;
@@ -197,17 +193,13 @@  discard block
 block discarded – undo
197 193
  */
198 194
 
199 195
 // Set the current directory correctly for CLI requests
200
-if (defined('STDIN'))
201
-{
196
+if (defined('STDIN')) {
202 197
 	chdir(dirname(__FILE__));
203 198
 }
204 199
 
205
-if (($_temp = realpath($system_path)) !== FALSE)
206
-{
200
+if (($_temp = realpath($system_path)) !== FALSE) {
207 201
 	$system_path = $_temp.DIRECTORY_SEPARATOR;
208
-}
209
-else
210
-{
202
+} else {
211 203
 	// Ensure there's a trailing slash
212 204
 	$system_path = strtr(
213 205
 		               rtrim($system_path, '/\\'),
@@ -217,8 +209,7 @@  discard block
 block discarded – undo
217 209
 }
218 210
 
219 211
 // Is the system path correct?
220
-if ( ! is_dir($system_path))
221
-{
212
+if ( ! is_dir($system_path)) {
222 213
 	header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
223 214
 	echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
224 215
 	exit(3); // EXIT_CONFIG
@@ -242,31 +233,23 @@  discard block
 block discarded – undo
242 233
 define('SYSDIR', basename(BASEPATH));
243 234
 
244 235
 // The path to the "application" directory
245
-if (is_dir($application_folder))
246
-{
247
-	if (($_temp = realpath($application_folder)) !== FALSE)
248
-	{
236
+if (is_dir($application_folder)) {
237
+	if (($_temp = realpath($application_folder)) !== FALSE) {
249 238
 		$application_folder = $_temp;
250
-	}
251
-	else
252
-	{
239
+	} else {
253 240
 		$application_folder = strtr(
254 241
 			rtrim($application_folder, '/\\'),
255 242
 			'/\\',
256 243
 			DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
257 244
 		);
258 245
 	}
259
-}
260
-elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
261
-{
246
+} elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) {
262 247
 	$application_folder = BASEPATH.strtr(
263 248
 			trim($application_folder, '/\\'),
264 249
 			'/\\',
265 250
 			DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
266 251
 		);
267
-}
268
-else
269
-{
252
+} else {
270 253
 	header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
271 254
 	echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
272 255
 	exit(3); // EXIT_CONFIG
@@ -275,35 +258,25 @@  discard block
 block discarded – undo
275 258
 define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
276 259
 
277 260
 // The path to the "views" directory
278
-if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
279
-{
261
+if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) {
280 262
 	$view_folder = APPPATH.'views';
281
-}
282
-elseif (is_dir($view_folder))
283
-{
284
-	if (($_temp = realpath($view_folder)) !== FALSE)
285
-	{
263
+} elseif (is_dir($view_folder)) {
264
+	if (($_temp = realpath($view_folder)) !== FALSE) {
286 265
 		$view_folder = $_temp;
287
-	}
288
-	else
289
-	{
266
+	} else {
290 267
 		$view_folder = strtr(
291 268
 			rtrim($view_folder, '/\\'),
292 269
 			'/\\',
293 270
 			DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
294 271
 		);
295 272
 	}
296
-}
297
-elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
298
-{
273
+} elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) {
299 274
 	$view_folder = APPPATH.strtr(
300 275
 			trim($view_folder, '/\\'),
301 276
 			'/\\',
302 277
 			DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
303 278
 		);
304
-}
305
-else
306
-{
279
+} else {
307 280
 	header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
308 281
 	echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
309 282
 	exit(3); // EXIT_CONFIG
Please login to merge, or discard this patch.
application/views/User/Forgot_Password.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
 			<div class="row">
21 21
 				<div class="col-xs-12 col-md-12">
22
-					<?=form_submit($form_submit);?>
22
+					<?=form_submit($form_submit); ?>
23 23
 				</div>
24 24
 			</div>
25 25
 		</form>
Please login to merge, or discard this patch.
application/views/User/Login.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
 				<div class="row">
27 27
 					<div class="col-xs-6 col-sm-6 col-md-6">
28
-						<?=form_submit($form_submit);?>
28
+						<?=form_submit($form_submit); ?>
29 29
 					</div>
30 30
 					<div class="col-xs-6 col-sm-6 col-md-6">
31 31
 						<a href="<?=base_url('user/signup')?>" class="btn btn-lg btn-primary btn-block">Create an account</a>
Please login to merge, or discard this patch.
application/views/errors/html/error_php.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@
 block discarded – undo
11 11
 <p>Filename: <?php echo $filepath; ?></p>
12 12
 <p>Line Number: <?php echo $line; ?></p>
13 13
 
14
-<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
14
+<?php if(defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
15 15
 
16 16
 	<p>Backtrace:</p>
17
-	<?php foreach (debug_backtrace() as $error): ?>
17
+	<?php foreach(debug_backtrace() as $error): ?>
18 18
 
19
-		<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
19
+		<?php if(isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
20 20
 
21 21
 			<p style="margin-left:10px">
22 22
 			File: <?php echo $error['file'] ?><br />
Please login to merge, or discard this patch.
application/views/errors/html/error_exception.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@
 block discarded – undo
11 11
 <p>Filename: <?php echo $exception->getFile(); ?></p>
12 12
 <p>Line Number: <?php echo $exception->getLine(); ?></p>
13 13
 
14
-<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
14
+<?php if(defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
15 15
 
16 16
 	<p>Backtrace:</p>
17
-	<?php foreach ($exception->getTrace() as $error): ?>
17
+	<?php foreach($exception->getTrace() as $error): ?>
18 18
 
19
-		<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
19
+		<?php if(isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
20 20
 
21 21
 			<p style="margin-left:10px">
22 22
 			File: <?php echo $error['file']; ?><br />
Please login to merge, or discard this patch.
application/views/errors/cli/error_php.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
 Filename:    <?php echo $filepath, "\n"; ?>
8 8
 Line Number: <?php echo $line; ?>
9 9
 
10
-<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
10
+<?php if(defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
11 11
 
12 12
 Backtrace:
13
-<?php	foreach (debug_backtrace() as $error): ?>
14
-<?php		if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
13
+<?php	foreach(debug_backtrace() as $error): ?>
14
+<?php		if(isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
15 15
 	File: <?php echo $error['file'], "\n"; ?>
16 16
 	Line: <?php echo $error['line'], "\n"; ?>
17 17
 	Function: <?php echo $error['function'], "\n\n"; ?>
Please login to merge, or discard this patch.
application/views/errors/cli/error_exception.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
 Filename:    <?php echo $exception->getFile(), "\n"; ?>
8 8
 Line Number: <?php echo $exception->getLine(); ?>
9 9
 
10
-<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
10
+<?php if(defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
11 11
 
12 12
 Backtrace:
13
-<?php	foreach ($exception->getTrace() as $error): ?>
14
-<?php		if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
13
+<?php	foreach($exception->getTrace() as $error): ?>
14
+<?php		if(isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
15 15
 	File: <?php echo $error['file'], "\n"; ?>
16 16
 	Line: <?php echo $error['line'], "\n"; ?>
17 17
 	Function: <?php echo $error['function'], "\n\n"; ?>
Please login to merge, or discard this patch.
application/core/MY_Controller.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 	protected $footer_data = array();
7 7
 	public    $global_data = array();
8 8
 
9
-	public function __construct(){
9
+	public function __construct() {
10 10
 		parent::__construct();
11 11
 
12 12
 		//FIXME: This is pretty much a phpUnit hack. Without it phpUnit fails here. We need a proper way to fake user/admin testing.
@@ -80,7 +80,9 @@  discard block
 block discarded – undo
80 80
 	public function __construct() {
81 81
 		parent::__construct();
82 82
 
83
-		if($this->ion_auth->logged_in()) redirect('/');
83
+		if($this->ion_auth->logged_in()) {
84
+			redirect('/');
85
+		}
84 86
 	}
85 87
 }
86 88
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 	protected $footer_data = array();
7 7
 	public    $global_data = array();
8 8
 
9
-	public function __construct(){
9
+	public function __construct() {
10 10
 		parent::__construct();
11 11
 
12 12
 		//FIXME: This is pretty much a phpUnit hack. Without it phpUnit fails here. We need a proper way to fake user/admin testing.
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 
18 18
 		$this->global_data['theme'] = $this->User_Options->get('theme');
19 19
 		if(ENVIRONMENT === 'production') {
20
-			$this->global_data['compiled_css_path'] = function () {
20
+			$this->global_data['compiled_css_path'] = function() {
21 21
 				$css_path = "css/main.{$this->global_data['theme']}";
22
-				return asset_url() . $css_path . filemtime(APPPATH . "../public/assets/{$css_path}.css") . '.css';
22
+				return asset_url().$css_path.filemtime(APPPATH."../public/assets/{$css_path}.css").'.css';
23 23
 			};
24 24
 
25 25
 			$js_path = 'js/compiled.min';
26
-			$this->global_data['compiled_js_path'] = asset_url() . $js_path . filemtime(APPPATH . "../public/assets/{$js_path}.js") . '.js';
26
+			$this->global_data['compiled_js_path'] = asset_url().$js_path.filemtime(APPPATH."../public/assets/{$js_path}.js").'.js';
27 27
 		}
28 28
 	}
29 29
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$json = is_array($json_input) ? json_encode($json_input) : $json_input;
55 55
 
56 56
 		$this->output->set_content_type('application/json', 'utf-8');
57
-		$this->_render_content($json ?? '{}','json', $download, $filenamePrefix);
57
+		$this->_render_content($json ?? '{}', 'json', $download, $filenamePrefix);
58 58
 	}
59 59
 	public function _render_content(string $content, string $filenameExt, bool $download = FALSE, string $filenamePrefix = 'tracker') : void {
60 60
 		if($download) {
Please login to merge, or discard this patch.
application/models/User_Model.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
 			if($query->num_rows() > 0) {
72 72
 				//username exists, grab email
73 73
 				$email = $query->row('email');
74
-			}else{
74
+			} else {
75 75
 				//username doesn't exist, return FALSE
76 76
 				$email = FALSE;
77 77
 			}
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			if($query->num_rows() > 0) {
77 77
 				//username exists, grab email
78 78
 				$email = $query->row('email');
79
-			}else{
79
+			} else {
80 80
 				//username doesn't exist, return FALSE
81 81
 				$email = FALSE;
82 82
 			}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	public function get_new_api_key() : string {
109 109
 		$api_key = NULL;
110 110
 		if($this->logged_in()) {
111
-			$api_key = substr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", mt_rand(0, 51), 1) . substr(md5((string) time()), 1);
111
+			$api_key = substr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", mt_rand(0, 51), 1).substr(md5((string) time()), 1);
112 112
 
113 113
 			$this->db->where('id', $this->id);
114 114
 			$this->db->update('auth_users', ['api_key' => $api_key]);
Please login to merge, or discard this patch.