Completed
Push — master ( 3a6730...bad5d9 )
by Angus
03:21
created
application/models/Auth_Model.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 
73 73
 	/**
74 74
 	 * @param string $verificationCode
75
-	 * @return mixed
75
+	 * @return string
76 76
 	 */
77 77
 	public function verification_check(string $verificationCode) {
78 78
 		//user is trying to validate their email for signup, check if verification code is still valid/exists
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,9 +77,9 @@
 block discarded – undo
77 77
 	public function verification_check(string $verificationCode) {
78 78
 		//user is trying to validate their email for signup, check if verification code is still valid/exists
79 79
 		$query = $this->db->select('email, verification_code_time')
80
-		                  ->from('auth_signup_verification')
81
-		                  ->where(array('verification_code' => $verificationCode))
82
-		                  ->get();
80
+						  ->from('auth_signup_verification')
81
+						  ->where(array('verification_code' => $verificationCode))
82
+						  ->get();
83 83
 
84 84
 		$return = FALSE;
85 85
 		if($query->num_rows() > 0) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed');
1
+<?php declare(strict_types = 1); defined('BASEPATH') or exit('No direct script access allowed');
2 2
 
3 3
 class Auth_Model extends CI_Model {
4 4
 	public function __construct() {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 			}
61 61
 
62 62
 			$success = TRUE;
63
-		} catch (Exception $e) {
63
+		} catch(Exception $e) {
64 64
 			//echo 'Caught exception: ',  $e->getMessage(), "\n";
65 65
 
66 66
 			//revert verification
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				//TODO: Remove from DB, send user error that verification expired.
92 92
 			} else {
93 93
 				//not expired, verification is valid, return email
94
-				$return =  $result->email;
94
+				$return = $result->email;
95 95
 			}
96 96
 		}
97 97
 		return $return;
Please login to merge, or discard this patch.
application/models/Tracker_Model.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -88,6 +88,9 @@
 block discarded – undo
88 88
 		return $arr;
89 89
 	}
90 90
 
91
+	/**
92
+	 * @return string
93
+	 */
91 94
 	public function getSiteDataFromURL(string $site_url) {
92 95
 		$query = $this->db->select('id, site_class')
93 96
 		                  ->from('tracker_sites')
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed');
1
+<?php declare(strict_types = 1); defined('BASEPATH') OR exit('No direct script access allowed');
2 2
 
3 3
 class Tracker_Model extends CI_Model {
4 4
 	public $sites;
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 			];
50 50
 		}
51 51
 		if($query->num_rows() > 0) {
52
-			foreach ($query->result() as $row) {
53
-				$is_unread     = intval($row->latest_chapter == $row->current_chapter ? '1' : '0');
52
+			foreach($query->result() as $row) {
53
+				$is_unread = intval($row->latest_chapter == $row->current_chapter ? '1' : '0');
54 54
 				$arr[$row->category]['unread_count'] = (($arr[$row->category]['unread_count'] ?? 0) + !$is_unread);
55 55
 				$arr[$row->category]['manga'][] = [
56 56
 					'id' => $row->id,
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 			}
80 80
 
81 81
 			//NOTE: This does not sort in the same way as tablesorter, but it works better.
82
-			foreach (array_keys($arr) as $category) {
83
-				usort($arr[$category]['manga'], function ($a, $b) {
82
+			foreach(array_keys($arr) as $category) {
83
+				usort($arr[$category]['manga'], function($a, $b) {
84 84
 					return strtolower("{$a['new_chapter_exists']} - {$a['title_data']['title']}") <=> strtolower("{$b['new_chapter_exists']} - {$b['title_data']['title']}");
85 85
 				});
86 86
 			}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		                  ->get();
227 227
 
228 228
 		if($query->num_rows() > 0) {
229
-			foreach ($query->result() as $row) {
229
+			foreach($query->result() as $row) {
230 230
 				print "> {$row->title} <{$row->site_class}>"; //Print this prior to doing anything so we can more easily find out if something went wrong
231 231
 				$titleData = $this->sites->{$row->site_class}->getTitleData($row->title_url);
232 232
 				if(!is_null($titleData['latest_chapter'])) {
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
 		$arr = [];
263 263
 		if($query->num_rows() > 0) {
264
-			foreach ($query->result() as $row) {
264
+			foreach($query->result() as $row) {
265 265
 				$arr[$row->category][] = [
266 266
 					'site'            => $row->site,
267 267
 					'title_url'       => $row->title_url,
Please login to merge, or discard this patch.
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 
91 91
 	public function getSiteDataFromURL(string $site_url) {
92 92
 		$query = $this->db->select('id, site_class')
93
-		                  ->from('tracker_sites')
94
-		                  ->where('site', $site_url)
95
-		                  ->get();
93
+						  ->from('tracker_sites')
94
+						  ->where('site', $site_url)
95
+						  ->get();
96 96
 
97 97
 		if($query->num_rows() > 0) {
98 98
 			$siteData = $query->row();
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 
104 104
 	public function getTitleID(string $titleURL, int $siteID) {
105 105
 		$query = $this->db->select('id')
106
-		                  ->from('tracker_titles')
107
-		                  ->where('title_url', $titleURL)
108
-		                  ->where('site_id', $siteID)
109
-		                  ->get();
106
+						  ->from('tracker_titles')
107
+						  ->where('title_url', $titleURL)
108
+						  ->where('site_id', $siteID)
109
+						  ->get();
110 110
 
111 111
 		if($query->num_rows() > 0) {
112 112
 			$titleID = $query->row('id');
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 			}
141 141
 			if($this->db->select('*')->where('user_id', $userID)->where('title_id', $titleID)->get('tracker_chapters')->num_rows() > 0) {
142 142
 				$success = $this->db->set(['current_chapter' => $chapter, 'last_updated' => NULL])
143
-				                    ->where('user_id', $userID)
144
-				                    ->where('title_id', $titleID)
145
-				                    ->update('tracker_chapters');
143
+									->where('user_id', $userID)
144
+									->where('title_id', $titleID)
145
+									->update('tracker_chapters');
146 146
 			} else {
147 147
 				$success = $this->db->insert('tracker_chapters', [
148 148
 					'user_id'         => $userID,
@@ -157,31 +157,31 @@  discard block
 block discarded – undo
157 157
 
158 158
 	public function updateTrackerByID(int $userID, int $chapterID, string $chapter) : bool {
159 159
 		$success = $this->db->set(['current_chapter' => $chapter, 'last_updated' => NULL])
160
-		                    ->where('user_id', $userID)
161
-		                    ->where('id', $chapterID)
162
-		                    ->update('tracker_chapters');
160
+							->where('user_id', $userID)
161
+							->where('id', $chapterID)
162
+							->update('tracker_chapters');
163 163
 
164 164
 		return (bool) $success;
165 165
 	}
166 166
 
167 167
 	public function deleteTrackerByID(int $userID, int $chapterID) {
168 168
 		$success = $this->db->where('user_id', $userID)
169
-		                    ->where('id', $chapterID)
170
-		                    ->delete('tracker_chapters');
169
+							->where('id', $chapterID)
170
+							->delete('tracker_chapters');
171 171
 
172 172
 		return (bool) $success;
173 173
 	}
174 174
 	private function updateTitleById(int $id, string $latestChapter) {
175 175
 		//FIXME: Really not too happy with how we're doing history stuff here, it just feels messy.
176 176
 		$query = $this->db->select('latest_chapter, last_updated')
177
-		                  ->from('tracker_titles')
178
-		                  ->where('id', $id)
179
-		                  ->get();
177
+						  ->from('tracker_titles')
178
+						  ->where('id', $id)
179
+						  ->get();
180 180
 		$row = $query->row();
181 181
 
182 182
 		$success = $this->db->set(['latest_chapter' => $latestChapter]) //last_updated gets updated via a trigger if something changes
183
-		                    ->where('id', $id)
184
-		                    ->update('tracker_titles');
183
+							->where('id', $id)
184
+							->update('tracker_titles');
185 185
 
186 186
 		//Update History
187 187
 		$this->History->updateTitleHistory($id, $row->latest_chapter, $row->last_updated);
@@ -190,16 +190,16 @@  discard block
 block discarded – undo
190 190
 	}
191 191
 	private function updateTitleDataById(int $id, array $titleData) {
192 192
 		$success = $this->db->set($titleData)
193
-		                    ->where('id', $id)
194
-		                    ->update('tracker_titles');
193
+							->where('id', $id)
194
+							->update('tracker_titles');
195 195
 
196 196
 		return (bool) $success;
197 197
 	}
198 198
 	private function addTitle(string $titleURL, int $siteID) {
199 199
 		$query = $this->db->select('site, site_class')
200
-		                  ->from('tracker_sites')
201
-		                  ->where('id', $siteID)
202
-		                  ->get();
200
+						  ->from('tracker_sites')
201
+						  ->where('id', $siteID)
202
+						  ->get();
203 203
 
204 204
 		$titleData = $this->sites->{$query->row()->site_class}->getTitleData($titleURL);
205 205
 		$this->db->insert('tracker_titles', array_merge($titleData, ['title_url' => $titleURL, 'site_id' => $siteID]));
@@ -224,18 +224,18 @@  discard block
 block discarded – undo
224 224
 		                      tracker_titles.last_updated,
225 225
 		                      from_unixtime(MAX(auth_users.last_login)) AS timestamp
226 226
 		                  ')
227
-		                  ->from('tracker_titles')
228
-		                  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
229
-		                  ->join('tracker_chapters', 'tracker_titles.id = tracker_chapters.title_id', 'left')
230
-		                  ->join('auth_users', 'tracker_chapters.user_id = auth_users.id', 'left')
231
-		                  ->where('tracker_sites.status = "enabled"')
232
-		                  ->where('(`complete` = "N" AND (`latest_chapter` = NULL OR `last_checked` < DATE_SUB(NOW(), INTERVAL 12 HOUR)))', NULL, FALSE) //TODO: Each title should have specific interval time?
233
-		                  ->or_where('(`complete` = "Y" AND `last_checked` < DATE_SUB(NOW(), INTERVAL 1 WEEK))', NULL, FALSE)
234
-		                  ->group_by('tracker_titles.id')
235
-		                  ->having('timestamp IS NOT NULL')
236
-		                  ->having('timestamp > DATE_SUB(NOW(), INTERVAL 120 HOUR)')
237
-		                  ->order_by('tracker_titles.title', 'ASC')
238
-		                  ->get();
227
+						  ->from('tracker_titles')
228
+						  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
229
+						  ->join('tracker_chapters', 'tracker_titles.id = tracker_chapters.title_id', 'left')
230
+						  ->join('auth_users', 'tracker_chapters.user_id = auth_users.id', 'left')
231
+						  ->where('tracker_sites.status = "enabled"')
232
+						  ->where('(`complete` = "N" AND (`latest_chapter` = NULL OR `last_checked` < DATE_SUB(NOW(), INTERVAL 12 HOUR)))', NULL, FALSE) //TODO: Each title should have specific interval time?
233
+						  ->or_where('(`complete` = "Y" AND `last_checked` < DATE_SUB(NOW(), INTERVAL 1 WEEK))', NULL, FALSE)
234
+						  ->group_by('tracker_titles.id')
235
+						  ->having('timestamp IS NOT NULL')
236
+						  ->having('timestamp > DATE_SUB(NOW(), INTERVAL 120 HOUR)')
237
+						  ->order_by('tracker_titles.title', 'ASC')
238
+						  ->get();
239 239
 
240 240
 		if($query->num_rows() > 0) {
241 241
 			foreach ($query->result() as $row) {
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 						//Make sure last_checked is always updated on successful run.
249 249
 						//CHECK: Is there a reason we aren't just doing this in updateTitleById?
250 250
 						$this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE)
251
-						         ->where('id', $row->id)
252
-						         ->update('tracker_titles');
251
+								 ->where('id', $row->id)
252
+								 ->update('tracker_titles');
253 253
 
254 254
 						//Update History
255 255
 						$this->History->updateTitleHistory((int) $row->id, $titleData['latest_chapter'], $titleData['last_updated']);
@@ -362,9 +362,9 @@  discard block
 block discarded – undo
362 362
 	}
363 363
 	public function setCategoryTrackerByID(int $userID, int $chapterID, string $category) : bool {
364 364
 		$success = $this->db->set(['category' => $category, 'last_updated' => NULL])
365
-		                    ->where('user_id', $userID)
366
-		                    ->where('id', $chapterID)
367
-		                    ->update('tracker_chapters');
365
+							->where('user_id', $userID)
366
+							->where('id', $chapterID)
367
+							->update('tracker_chapters');
368 368
 
369 369
 		return (bool) $success;
370 370
 	}
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
 		$success = FALSE;
375 375
 		if(preg_match("/^[a-z0-9-_,]{0,255}$/", $tag_string)) {
376 376
 			$success = $this->db->set(['tags' => $tag_string, 'last_updated' => NULL])
377
-			                    ->where('user_id', $userID)
378
-			                    ->where('id', $chapterID)
379
-			                    ->update('tracker_chapters');
377
+								->where('user_id', $userID)
378
+								->where('id', $chapterID)
379
+								->update('tracker_chapters');
380 380
 		}
381 381
 
382 382
 		return (bool) $success;
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 		$usedCategories = [];
387 387
 
388 388
 		$query = $this->db->distinct()
389
-		                  ->select('category')
390
-		                  ->from('tracker_chapters')
391
-		                  ->get();
389
+						  ->select('category')
390
+						  ->from('tracker_chapters')
391
+						  ->get();
392 392
 
393 393
 		return array_column($query->result_array(), 'category');
394 394
 	}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed');
1
+<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed');
2 2
 
3 3
 class User_Model extends CI_Model {
4 4
 	public $id;
Please login to merge, or discard this patch.
application/models/User_Options_Model.php 4 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	/**
74 74
 	 * Get user option, or default option if it does not exist.
75 75
 	 * @param string $option
76
-	 * @return mixed Returns option value as STRING, or FALSE if option does not exist.
76
+	 * @return string Returns option value as STRING, or FALSE if option does not exist.
77 77
 	 */
78 78
 	public function get(string $option) {
79 79
 		return $this->get_by_userid($option, (int) $this->User->id);
@@ -135,6 +135,9 @@  discard block
 block discarded – undo
135 135
 		return $success;
136 136
 	}
137 137
 
138
+	/**
139
+	 * @return string
140
+	 */
138 141
 	private function get_db(string $option, int $userID) {
139 142
 		//This function assumes we've already done some basic validation.
140 143
 		$query = $this->db->select('value_str, value_int')
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -138,10 +138,10 @@
 block discarded – undo
138 138
 	private function get_db(string $option, int $userID) {
139 139
 		//This function assumes we've already done some basic validation.
140 140
 		$query = $this->db->select('value_str, value_int')
141
-		                  ->from('user_options')
142
-		                  ->where('user_id', $userID)
143
-		                  ->where('name',    $option)
144
-		                  ->limit(1);
141
+						  ->from('user_options')
142
+						  ->where('user_id', $userID)
143
+						  ->where('name',    $option)
144
+						  ->limit(1);
145 145
 		return $query->get()->row_array();
146 146
 	}
147 147
 	private function set_db(string $option, $value) : bool {}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed');
1
+<?php declare(strict_types = 1); defined('BASEPATH') or exit('No direct script access allowed');
2 2
 
3 3
 class User_Options_Model extends CI_Model {
4 4
 	public $options = array(
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		$query = $this->db->select('value_str, value_int')
141 141
 		                  ->from('user_options')
142 142
 		                  ->where('user_id', $userID)
143
-		                  ->where('name',    $option)
143
+		                  ->where('name', $option)
144 144
 		                  ->limit(1);
145 145
 		return $query->get()->row_array();
146 146
 	}
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 			);
180 180
 			//FIXME: Get a better solution than str_replace for removing special characters
181 181
 			$elements = array();
182
-			foreach (array_values($this->options[$option]['valid_options']) as $valid_option) {
182
+			foreach(array_values($this->options[$option]['valid_options']) as $valid_option) {
183 183
 				$elements[$option.'_'.str_replace(',', '_', $valid_option)] = array_merge($base_attributes, array(
184 184
 					'value' => $valid_option
185 185
 				));
Please login to merge, or discard this patch.
Braces   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,9 @@  discard block
 block discarded – undo
94 94
 			}
95 95
 
96 96
 			//Overall fallback method.
97
-			if(!isset($value)) $value = $this->options[$option]['default'];
97
+			if(!isset($value)) {
98
+				$value = $this->options[$option]['default'];
99
+			}
98 100
 		} else {
99 101
 			$value = FALSE;
100 102
 		}
@@ -165,7 +167,10 @@  discard block
 block discarded – undo
165 167
 				//This should never happen.
166 168
 				break;
167 169
 		}
168
-		if(!isset($value)) $value = FALSE; //FIXME: This won't play nice with BOOL type false?
170
+		if(!isset($value)) {
171
+			$value = FALSE;
172
+		}
173
+		//FIXME: This won't play nice with BOOL type false?
169 174
 
170 175
 		return $value;
171 176
 	}
Please login to merge, or discard this patch.
application/tests/libraries/MY_Form_validation_test.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -144,6 +144,10 @@
 block discarded – undo
144 144
 	}
145 145
 
146 146
 	//utility functions
147
+
148
+	/**
149
+	 * @param string $field
150
+	 */
147 151
 	function get_error_message(/*str*/$field, /*obj*/ $customObj = FALSE) {
148 152
 		$obj = $customObj ?: $this->form_validation;
149 153
 		$error_messages = ReflectionHelper::getPrivateProperty(
Please login to merge, or discard this patch.
public/index.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -210,10 +210,10 @@
 block discarded – undo
210 210
 {
211 211
 	// Ensure there's a trailing slash
212 212
 	$system_path = strtr(
213
-		               rtrim($system_path, '/\\'),
214
-		               '/\\',
215
-		               DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
216
-	               ).DIRECTORY_SEPARATOR;
213
+					   rtrim($system_path, '/\\'),
214
+					   '/\\',
215
+					   DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
216
+				   ).DIRECTORY_SEPARATOR;
217 217
 }
218 218
 
219 219
 // Is the system path correct?
Please login to merge, or discard this patch.
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/tests/controllers/User/Auth/Login_test.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	public function test_index_logged_in() {
10 10
 		//user is already logged in, redirect to dashboard
11 11
 		$this->request->setCallablePreConstructor(
12
-			function () {
12
+			function() {
13 13
 				$ion_auth = $this->getMock_ion_auth_logged_in();
14 14
 				load_class_instance('ion_auth', $ion_auth);
15 15
 			}
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		$this->markTestIncomplete('This test is broken for now.');
31 31
 
32 32
 		$this->request->setCallable(
33
-			function ($CI) {
33
+			function($CI) {
34 34
 				$validation = $this->getDouble(
35 35
 					'CI_Form_validation',
36 36
 					['set_rules' => NULL, 'run' => TRUE]
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			}
45 45
 		);
46 46
 		$this->request->addCallable(
47
-			function ($CI) {
47
+			function($CI) {
48 48
 				$user = $this->getDouble(
49 49
 					'User_Model',
50 50
 					['find_email_from_identity' => 'foobar']
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 			}
57 57
 		);
58 58
 		$this->request->addCallable(
59
-			function ($CI) {
59
+			function($CI) {
60 60
 				$auth = $this->getDouble(
61 61
 					'Ion_auth_model',
62 62
 					['login' => TRUE]
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		$this->markTestIncomplete('This test is broken for now.');
78 78
 
79 79
 		$this->request->setCallable(
80
-			function ($CI) {
80
+			function($CI) {
81 81
 				$validation = $this->getDouble(
82 82
 					'CI_Form_validation',
83 83
 					['set_rules' => NULL, 'run' => TRUE]
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			}
92 92
 		);
93 93
 		$this->request->addCallable(
94
-			function ($CI) {
94
+			function($CI) {
95 95
 				$user = $this->getDouble(
96 96
 					'User_Model',
97 97
 					['find_email_from_identity' => 'foobar']
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 			}
104 104
 		);
105 105
 		$this->request->addCallable(
106
-			function ($CI) {
106
+			function($CI) {
107 107
 				$auth = $this->getDouble(
108 108
 					'Ion_auth_model',
109 109
 					['login' => TRUE]
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			}
116 116
 		);
117 117
 		$this->request->addCallable(
118
-			function ($CI) {
118
+			function($CI) {
119 119
 				// Get mock object
120 120
 				$session = $this->getDouble(
121 121
 					'CI_Session',
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	public function test_login_validation_fail() {
135 135
 		//user isn't logged in, validation failed, this is happens on the first time loading the page
136 136
 		$this->request->setCallable(
137
-			function ($CI) {
137
+			function($CI) {
138 138
 				// Get mock object
139 139
 				$validation = $this->getDouble(
140 140
 					'CI_Form_validation',
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	public function test_login_validation_pass_but_login_fail() {
157 157
 		//user isn't logged in, tried to login, validation succeeded but login failed
158 158
 		$this->request->setCallable(
159
-			function ($CI) {
159
+			function($CI) {
160 160
 				// Get mock object
161 161
 				$validation = $this->getDouble(
162 162
 					'CI_Form_validation',
Please login to merge, or discard this patch.
application/tests/controllers/User/Auth/Signup_test.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 		$this->assertResponseCode(200);
7 7
 
8 8
 		$this->request->setCallable(
9
-			function ($CI) {
9
+			function($CI) {
10 10
 				$auth = $this->getDouble('Auth_Model', ['verification_check' => 'foobar']);
11 11
 				$this->verifyInvokedOnce($auth, 'verification_check');
12 12
 				$CI->Auth = $auth;
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	public function test_index_logged_in() {
20 20
 		//user is already logged in, redirect to dashboard
21 21
 		$this->request->setCallablePreConstructor(
22
-			function () {
22
+			function() {
23 23
 				$ion_auth = $this->getMock_ion_auth_logged_in();
24 24
 				load_class_instance('ion_auth', $ion_auth);
25 25
 			}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
 	public function test_signup_p1_validation_pass_verification_pass() {
39 39
 		$this->request->setCallable(
40
-			function ($CI) {
40
+			function($CI) {
41 41
 				$validation = $this->getDouble(
42 42
 					'CI_Form_validation',
43 43
 					['set_rules' => NULL, 'run' => TRUE]
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			}
52 52
 		);
53 53
 		$this->request->addCallable(
54
-				function ($CI) {
54
+				function($CI) {
55 55
 					$auth = $this->getDouble('Auth_Model', ['verification_start' => TRUE]);
56 56
 					$this->verifyInvokedOnce($auth, 'verification_start');
57 57
 					$CI->Auth = $auth;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	}
66 66
 	public function test_signup_p1_validation_pass_verification_fail() {
67 67
 		$this->request->setCallable(
68
-				function ($CI) {
68
+				function($CI) {
69 69
 					$validation = $this->getDouble(
70 70
 							'CI_Form_validation',
71 71
 							['set_rules' => NULL, 'run' => TRUE]
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 				}
80 80
 		);
81 81
 		$this->request->addCallable(
82
-				function ($CI) {
82
+				function($CI) {
83 83
 					$auth = $this->getDouble('Auth_Model', ['verification_start' => FALSE]);
84 84
 					$this->verifyInvokedOnce($auth, 'verification_start');
85 85
 					$CI->Auth = $auth;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 	public function test_signup_p1_validation_fail() {
95 95
 		$this->request->setCallable(
96
-			function ($CI) {
96
+			function($CI) {
97 97
 				$validation = $this->getDouble(
98 98
 					'CI_Form_validation',
99 99
 					['set_rules' => NULL, 'run' => FALSE, 'set_value' => '']
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 		//form was valid, and register was successful, user is redirected to dashboard
116 116
 
117 117
 		$this->request->setCallable(
118
-			function ($CI) {
118
+			function($CI) {
119 119
 				$auth = $this->getDouble('Auth_Model', ['verification_check' => '[email protected]']);
120 120
 				$this->verifyInvokedOnce($auth, 'verification_check');
121 121
 				$CI->Auth = $auth;
122 122
 			}
123 123
 		);
124 124
 		$this->request->addCallable(
125
-			function ($CI) {
125
+			function($CI) {
126 126
 				$validation = $this->getDouble(
127 127
 					'CI_Form_validation',
128 128
 					['set_rules' => NULL, 'run' => TRUE]
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			}
137 137
 		);
138 138
 		$this->request->addCallable(
139
-			function ($CI) {
139
+			function($CI) {
140 140
 				$auth = $this->getDouble(
141 141
 					'Ion_auth_model',
142 142
 					['register' => TRUE]
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 	public function test_signup_p2_verification_pass_validation_pass_register_fail() {
155 155
 		//form was valid, and register was unsuccessful, reshow form
156 156
 		$this->request->setCallable(
157
-			function ($CI) {
157
+			function($CI) {
158 158
 				$auth = $this->getDouble('Auth_Model', ['verification_check' => '[email protected]']);
159 159
 				$this->verifyInvokedOnce($auth, 'verification_check');
160 160
 				$CI->Auth = $auth;
161 161
 			}
162 162
 		);
163 163
 		$this->request->addCallable(
164
-			function ($CI) {
164
+			function($CI) {
165 165
 				$validation = $this->getDouble(
166 166
 					'CI_Form_validation',
167 167
 					['set_rules' => NULL, 'run' => TRUE, 'set_value' => 'foobar']
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 			}
177 177
 		);
178 178
 		$this->request->addCallable(
179
-			function ($CI) {
179
+			function($CI) {
180 180
 				$auth = $this->getDouble(
181 181
 					'Ion_auth_model',
182 182
 					['register' => FALSE, 'errors' => FALSE, 'logged_in' => FALSE]
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 	public function test_signup_p2_verification_pass_validation_fail() {
195 195
 		//validation failed, this is probably the first time the user visits the page, show form
196 196
 		$this->request->setCallable(
197
-			function ($CI) {
197
+			function($CI) {
198 198
 				$auth = $this->getDouble('Auth_Model', ['verification_check' => '[email protected]']);
199 199
 				$this->verifyInvokedOnce($auth, 'verification_check');
200 200
 				$CI->Auth = $auth;
201 201
 			}
202 202
 		);
203 203
 		$this->request->addCallable(
204
-			function ($CI) {
204
+			function($CI) {
205 205
 				$validation = $this->getDouble(
206 206
 					'CI_Form_validation',
207 207
 					['set_rules' => NULL, 'run' => FALSE, 'set_value' => '']
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	public function test_signup_p2_verification_fail() {
223 223
 		//validation failed, this is probably the first time the user visits the page, show form
224 224
 		$this->request->setCallable(
225
-			function ($CI) {
225
+			function($CI) {
226 226
 				$auth = $this->getDouble('Auth_Model', ['verification_check' => FALSE]);
227 227
 				$this->verifyInvokedOnce($auth, 'verification_check');
228 228
 				$CI->Auth = $auth;
Please login to merge, or discard this patch.
application/tests/controllers/User/Auth/Forgot_Password_test.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 
21 21
 		$this->request->setCallablePreConstructor(
22
-			function () {
22
+			function() {
23 23
 				$ion_auth = $this->getMock_ion_auth_logged_in();
24 24
 				load_class_instance('ion_auth', $ion_auth);
25 25
 			}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	public function test_forgot_password_validation_pass() {
39 39
 		//user isn't logged in, form is valid, user is shown success page regardless of if email is used
40 40
 		$this->request->setCallable(
41
-			function ($CI) {
41
+			function($CI) {
42 42
 				$validation = $this->getDouble(
43 43
 					'CI_Form_validation',
44 44
 					['set_rules' => NULL, 'run' => TRUE]
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			}
53 53
 		);
54 54
 		$this->request->addCallable(
55
-			function ($CI) {
55
+			function($CI) {
56 56
 				$auth = $this->getDouble(
57 57
 					'Ion_auth_model',
58 58
 					['forgotten_password' => TRUE, 'row' => (object) ['email' => '[email protected]'], 'logged_in' => FALSE]
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	public function test_forgot_password_validation_fail() {
73 73
 		//user isn't logged in, form is invalid, this is usually the case when first viewing the page
74 74
 		$this->request->setCallable(
75
-			function ($CI) {
75
+			function($CI) {
76 76
 				$validation = $this->getDouble(
77 77
 					'CI_Form_validation',
78 78
 					['set_rules' => NULL, 'run' => FALSE]
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	public function test_reset_password_user_pass_validation_pass_change_fail() {
94 94
 		//reset code is valid, form is invalid (or new)
95 95
 		$this->request->addCallable(
96
-			function ($CI) {
96
+			function($CI) {
97 97
 				$auth = $this->getDouble(
98 98
 					'Ion_auth_model',
99 99
 					['forgotten_password_check' => TRUE, 'reset_password' => FALSE]
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			}
106 106
 		);
107 107
 		$this->request->addCallable(
108
-			function ($CI) {
108
+			function($CI) {
109 109
 				$validation = $this->getDouble(
110 110
 					'CI_Form_validation',
111 111
 					['set_rules' => NULL, 'run' => TRUE]
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	public function test_reset_password_user_pass_validation_pass_change_pass() {
127 127
 		//reset code is valid, form is valid, password change was successful, redirect to login
128 128
 		$this->request->addCallable(
129
-			function ($CI) {
129
+			function($CI) {
130 130
 				$auth = $this->getDouble(
131 131
 					'Ion_auth_model',
132 132
 					['forgotten_password_check' => TRUE, 'reset_password' => TRUE]
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 			}
139 139
 		);
140 140
 		$this->request->addCallable(
141
-			function ($CI) {
141
+			function($CI) {
142 142
 				$validation = $this->getDouble(
143 143
 					'CI_Form_validation',
144 144
 					['set_rules' => NULL, 'run' => TRUE]
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	public function test_reset_password_user_pass_validation_fail() {
160 160
 		//reset code is valid, form is valid, password change was unsuccessful, send back to reset_password page
161 161
 		$this->request->setCallable(
162
-			function ($CI) {
162
+			function($CI) {
163 163
 				$auth = $this->getDouble(
164 164
 					'Ion_auth_model',
165 165
 					['forgotten_password_check' => TRUE, 'logged_in' => FALSE]
Please login to merge, or discard this patch.
application/tests/controllers/IndexC_test.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
 	public function test_APPPATH() {
15 15
 		$actual   = realpath(APPPATH);
16
-		$expected = realpath(__DIR__ . '/../..');
16
+		$expected = realpath(__DIR__.'/../..');
17 17
 		$this->assertEquals(
18 18
 			$expected,
19 19
 			$actual,
Please login to merge, or discard this patch.