Completed
Push — master ( 477aa2...0a4bb5 )
by Angus
06:22
created
application/controllers/TitleHistory.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 			$this->body_data['totalPages']  = $historyData['totalPages'];
24 24
 			$this->body_data['titleID']     = (int) $titleID;
25 25
 
26
-			if($page > $this->body_data['totalPages'] && $page > 1) redirect("/history/{$titleID}/1");
26
+			if($page > $this->body_data['totalPages'] && $page > 1) {
27
+				redirect("/history/{$titleID}/1");
28
+			}
27 29
 
28 30
 			$this->_render_page("TitleHistory");
29 31
 
Please login to merge, or discard this patch.
_scripts/generate_foolslide.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php declare(strict_types=1);
2 2
 
3
-if(!extension_loaded('gd')) die('GD ext is required to run this!');
3
+if(!extension_loaded('gd')) {
4
+	die('GD ext is required to run this!');
5
+}
4 6
 
5 7
 chdir(dirname(__FILE__).'/../'); //Just to make things easier, change dir to project root.
6 8
 
@@ -9,7 +11,7 @@  discard block
 block discarded – undo
9 11
 	private $className;
10 12
 
11 13
 	public function __construct() {
12
-		if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3){
14
+		if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3) {
13 15
 			$this->baseURL   = rtrim($_SERVER['argv'][1], '/');
14 16
 			$this->className = $_SERVER['argv'][2];
15 17
 
@@ -98,7 +100,9 @@  discard block
 block discarded – undo
98 100
 		$baseFile = file_get_contents($baseFileName);
99 101
 
100 102
 		$parse = parse_url($this->baseURL);
101
-		if(strpos($baseFile, $parse['host']) !== false) die("Domain already exists in userscript?");
103
+		if(strpos($baseFile, $parse['host']) !== false) {
104
+			die("Domain already exists in userscript?");
105
+		}
102 106
 
103 107
 		preg_match('/\@updated      ([0-9\-]+)[\r\n]+.*?\@version      ([0-9\.]+)/s', $baseFile, $matches);
104 108
 
@@ -188,7 +192,9 @@  discard block
 block discarded – undo
188 192
 			}
189 193
 		}
190 194
 
191
-		if(empty($titleArr)) die("API isn't returning any titles?");
195
+		if(empty($titleArr)) {
196
+			die("API isn't returning any titles?");
197
+		}
192 198
 		return $titleArr;
193 199
 	}
194 200
 }
Please login to merge, or discard this patch.
application/core/MY_Log.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@  discard block
 block discarded – undo
67 67
 		// detect and register all PHP errors in this log hence forth
68 68
 		ErrorHandler::register($this->log);
69 69
 
70
-		if ($this->config['introspection_processor'])
71
-		{
70
+		if ($this->config['introspection_processor']) {
72 71
 			// add controller and line number info to each log message
73 72
 			// 2 = depth in the stacktrace to ignore. This gives us the file
74 73
 			// making the call to log_message();
@@ -76,10 +75,8 @@  discard block
 block discarded – undo
76 75
 		}
77 76
 
78 77
 		// decide which handler(s) to use
79
-		foreach ($this->config['handlers'] as $value)
80
-		{
81
-			switch ($value)
82
-			{
78
+		foreach ($this->config['handlers'] as $value) {
79
+			switch ($value) {
83 80
 				case 'file':
84 81
 					$handler = new RotatingFileHandler($this->config['file_logfile']);
85 82
 					$formatter = new LineFormatter(null, null, $config['file_multiline']);
@@ -140,35 +137,28 @@  discard block
 block discarded – undo
140 137
 	 * @param $msg
141 138
 	 * @return bool
142 139
 	 */
143
-	public function write_log($level = 'error', $msg)
144
-	{
140
+	public function write_log($level = 'error', $msg) {
145 141
 		$level = strtoupper($level);
146 142
 
147 143
 		// verify error level
148
-		if (!isset($this->_levels[$level]))
149
-		{
144
+		if (!isset($this->_levels[$level])) {
150 145
 			$this->log->addError('unknown error level: ' . $level);
151 146
 			$level = 'ALL';
152 147
 		}
153 148
 
154 149
 		// filter out anything in $this->config['exclusion_list']
155
-		if (!empty($this->config['exclusion_list']))
156
-		{
157
-			foreach ($this->config['exclusion_list'] as $findme)
158
-			{
150
+		if (!empty($this->config['exclusion_list'])) {
151
+			foreach ($this->config['exclusion_list'] as $findme) {
159 152
 				$pos = strpos($msg, $findme);
160
-				if ($pos !== false)
161
-				{
153
+				if ($pos !== false) {
162 154
 					// just exit now - we don't want to log this error
163 155
 					return true;
164 156
 				}
165 157
 			}
166 158
 		}
167 159
 
168
-		if ($this->_levels[$level] <= $this->config['threshold'])
169
-		{
170
-			switch ($level)
171
-			{
160
+		if ($this->_levels[$level] <= $this->config['threshold']) {
161
+			switch ($level) {
172 162
 				case 'ERROR':
173 163
 					$this->log->addError($msg);
174 164
 					break;
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_Sites_Model.php 1 patch
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -125,7 +125,9 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	final public function isValidTitleURL(string $title_url) : bool {
127 127
 		$success = (bool) preg_match($this->titleFormat, $title_url);
128
-		if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}");
128
+		if(!$success) {
129
+			log_message('error', "Invalid Title URL ({$this->site}): {$title_url}");
130
+		}
129 131
 		return $success;
130 132
 	}
131 133
 
@@ -139,7 +141,9 @@  discard block
 block discarded – undo
139 141
 	 */
140 142
 	final public function isValidChapter(string $chapter) : bool {
141 143
 		$success = (bool) preg_match($this->chapterFormat, $chapter);
142
-		if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}");
144
+		if(!$success) {
145
+			log_message('error', "Invalid Chapter ({$this->site}): {$chapter}");
146
+		}
143 147
 		return $success;
144 148
 	}
145 149
 
@@ -168,14 +172,20 @@  discard block
 block discarded – undo
168 172
 			//curl_setopt($ch, CURLOPT_VERBOSE, 1);
169 173
 			curl_setopt($ch, CURLOPT_HEADER, 1);
170 174
 
171
-			if($follow_redirect)        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
175
+			if($follow_redirect) {
176
+				curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
177
+			}
172 178
 
173 179
 			if($cookies = $this->cache->get("cloudflare_{$this->site}")) {
174 180
 				$cookie_string .= "; {$cookies}";
175 181
 			}
176 182
 
177
-			if(!empty($cookie_string))  curl_setopt($ch, CURLOPT_COOKIE, $cookie_string);
178
-			if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path);
183
+			if(!empty($cookie_string)) {
184
+				curl_setopt($ch, CURLOPT_COOKIE, $cookie_string);
185
+			}
186
+			if(!empty($cookiejar_path)) {
187
+				curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path);
188
+			}
179 189
 
180 190
 			//Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff.
181 191
 			curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
@@ -206,7 +216,9 @@  discard block
 block discarded – undo
206 216
 			$body        = substr($response, $header_size);
207 217
 			curl_close($ch);
208 218
 
209
-			if($status_code === 503) $refresh = $this->handleCloudFlare($url, $body);
219
+			if($status_code === 503) {
220
+				$refresh = $this->handleCloudFlare($url, $body);
221
+			}
210 222
 		}
211 223
 
212 224
 		return [
@@ -312,7 +324,9 @@  discard block
 block discarded – undo
312 324
 								'nodes_chapter' => $nodes_chapter->item(0)
313 325
 							];
314 326
 
315
-							if(is_callable($extraCall)) $extraCall($xpath, $returnData);
327
+							if(is_callable($extraCall)) {
328
+								$extraCall($xpath, $returnData);
329
+							}
316 330
 
317 331
 							return $returnData;
318 332
 						} else {
@@ -326,7 +340,9 @@  discard block
 block discarded – undo
326 340
 						$noChaptersCall($data, $xpath, $returnData);
327 341
 
328 342
 						if(is_array($returnData)) {
329
-							if(is_callable($extraCall) && is_array($returnData)) $extraCall($xpath, $returnData);
343
+							if(is_callable($extraCall) && is_array($returnData)) {
344
+								$extraCall($xpath, $returnData);
345
+							}
330 346
 						} else {
331 347
 							log_message('error', "{$this->site} : {$title_url} | canHaveNoChapters set, but doesn't match possible checks! XPath is probably broken.");
332 348
 						}
@@ -461,8 +477,12 @@  discard block
 block discarded – undo
461 477
 		$status = FALSE;
462 478
 
463 479
 		//Make sure we have a volume element
464
-		if(count($oldChapterSegments) === 1) array_unshift($oldChapterSegments, 'v0');
465
-		if(count($newChapterSegments) === 1) array_unshift($newChapterSegments, 'v0');
480
+		if(count($oldChapterSegments) === 1) {
481
+			array_unshift($oldChapterSegments, 'v0');
482
+		}
483
+		if(count($newChapterSegments) === 1) {
484
+			array_unshift($newChapterSegments, 'v0');
485
+		}
466 486
 
467 487
 		$oldCount = count($oldChapterSegments);
468 488
 		$newCount = count($newChapterSegments);
@@ -475,8 +495,12 @@  discard block
 block discarded – undo
475 495
 				$newVolume = substr(array_shift($newChapterSegments), 1);
476 496
 
477 497
 				//Forcing volume to 0 as TBD might not be the latest (although it can be, but that is covered by other checks)
478
-				if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $oldVolume = 0;
479
-				if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $newVolume = 0;
498
+				if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) {
499
+					$oldVolume = 0;
500
+				}
501
+				if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) {
502
+					$newVolume = 0;
503
+				}
480 504
 
481 505
 				$oldVolume = floatval($oldVolume);
482 506
 				$newVolume = floatval($newVolume);
Please login to merge, or discard this patch.
application/models/Auth_Model.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
 			if($query->num_rows() > 0) {
133 133
 				//username exists, grab email
134 134
 				$email = $query->row('email');
135
-			}else{
135
+			} else {
136 136
 				//username doesn't exist, return FALSE
137 137
 				$email = NULL;
138 138
 			}
Please login to merge, or discard this patch.
application/controllers/User/Auth/Signup.php 1 patch
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
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
 			$this->body_data['form_email'] = array(
60 60
 					'name'        => 'email',
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
 	//This continued signup occurs after the user clicks the verification link in their email.
87 87
 	private function _continue_signup($verificationCode) : void {
88 88
 		//check if validation is valid, if so return email, if not redirect to signup
89
-		if(!($email = $this->Auth->verificationCheck($verificationCode))) redirect('user/signup');
89
+		if(!($email = $this->Auth->verificationCheck($verificationCode))) {
90
+			redirect('user/signup');
91
+		}
90 92
 
91 93
 		//validation is valid, proceed as normal
92 94
 		$this->form_validation->set_rules('username',         'Username',           'required|min_length[4]|max_length[15]|valid_username|is_unique_username');
@@ -110,14 +112,15 @@  discard block
 block discarded – undo
110 112
 				$this->Auth->verificationComplete($email);
111 113
 
112 114
 				redirect('help');
113
-			} else { //@codeCoverageIgnore
115
+			} else {
116
+//@codeCoverageIgnore
114 117
 				//Signup failed.
115 118
 				$isValid = FALSE;
116 119
 			}
117 120
 		}
118 121
 
119 122
 		//signup wasn't valid, failed, or this is a fresh signup attempt
120
-		if(!$isValid){
123
+		if(!$isValid) {
121 124
 			//display the create user form
122 125
 			$this->body_data['verificationCode'] = $verificationCode;
123 126
 
Please login to merge, or discard this patch.
application/controllers/User/Auth/Forgot_Password.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,11 +83,13 @@
 block discarded – undo
83 83
 				if ($change) {
84 84
 					//password changed successfully, redirect to login
85 85
 					redirect('user/login', 'refresh');
86
-				} else { //@codeCoverageIgnore
86
+				} else {
87
+//@codeCoverageIgnore
87 88
 					//password changed unsuccessfully, refresh page.
88 89
 					redirect('user/reset_password/'.$code, 'refresh');
89 90
 				}
90
-			} else { //@codeCoverageIgnore
91
+			} else {
92
+//@codeCoverageIgnore
91 93
 				//form is invalid OR first-time viewing page
92 94
 				$this->body_data['reset_code']    = $code;
93 95
 				$this->body_data['form_password'] = array(
Please login to merge, or discard this patch.
application/libraries/MY_Form_validation.php 1 patch
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
 	public function valid_password(string $password) : bool {
44 44
 		if(!($isValid = $this->min_length($password, $this->CI->config->item('min_password_length', 'ion_auth')))) {
45 45
 			$this->set_message('valid_password', 'The password is too short!');
46
-		}
47
-		elseif(!($isValid = $this->max_length($password, $this->CI->config->item('max_password_length', 'ion_auth')))) {
46
+		} elseif(!($isValid = $this->max_length($password, $this->CI->config->item('max_password_length', 'ion_auth')))) {
48 47
 			$this->set_message('valid_password', 'The password is too long!');
49 48
 		}
50 49
 		return $isValid;
@@ -108,7 +107,7 @@  discard block
 block discarded – undo
108 107
 	 */
109 108
 	public function isRuleValid(string $ruleName) : bool {
110 109
 		$isValid = FALSE;
111
-		if(is_string($ruleName) && $this->has_rule($ruleName)){
110
+		if(is_string($ruleName) && $this->has_rule($ruleName)) {
112 111
 			$isValid = !array_key_exists($ruleName, $this->error_array());
113 112
 		}
114 113
 		return $isValid;
Please login to merge, or discard this patch.
application/core/MY_Config.php 1 patch
Braces   +11 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,46 +13,36 @@  discard block
 block discarded – undo
13 13
 	 * @param	bool	$fail_gracefully	Whether to just return FALSE or display an error message
14 14
 	 * @return	bool	TRUE if the file was loaded correctly or FALSE on failure
15 15
 	 */
16
-	public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
17
-	{
16
+	public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) {
18 17
 		$file = ($file === '') ? 'config' : str_replace('.php', '', $file);
19 18
 		$loaded = FALSE;
20 19
 
21
-		foreach ($this->_config_paths as $path)
22
-		{
23
-			foreach (array($file, '_secure'.DIRECTORY_SEPARATOR.$file, ENVIRONMENT.DIRECTORY_SEPARATOR.$file) as $location)
24
-			{
20
+		foreach ($this->_config_paths as $path) {
21
+			foreach (array($file, '_secure'.DIRECTORY_SEPARATOR.$file, ENVIRONMENT.DIRECTORY_SEPARATOR.$file) as $location) {
25 22
 				$file_path = $path.'config/'.$location.'.php';
26
-				if (in_array($file_path, $this->is_loaded, TRUE))
27
-				{
23
+				if (in_array($file_path, $this->is_loaded, TRUE)) {
28 24
 					return TRUE;
29 25
 				}
30 26
 
31
-				if ( ! file_exists($file_path))
32
-				{
27
+				if ( ! file_exists($file_path)) {
33 28
 					continue;
34 29
 				}
35 30
 
36 31
 				include($file_path);
37 32
 
38
-				if ( ! isset($config) OR ! is_array($config))
39
-				{
40
-					if ($fail_gracefully === TRUE)
41
-					{
33
+				if ( ! isset($config) OR ! is_array($config)) {
34
+					if ($fail_gracefully === TRUE) {
42 35
 						return FALSE;
43 36
 					}
44 37
 
45 38
 					show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.');
46 39
 				}
47 40
 
48
-				if ($use_sections === TRUE)
49
-				{
41
+				if ($use_sections === TRUE) {
50 42
 					$this->config[$file] = isset($this->config[$file])
51 43
 						? array_merge($this->config[$file], $config)
52 44
 						: $config;
53
-				}
54
-				else
55
-				{
45
+				} else {
56 46
 					$this->config = array_merge($this->config, $config);
57 47
 				}
58 48
 
@@ -63,12 +53,9 @@  discard block
 block discarded – undo
63 53
 			}
64 54
 		}
65 55
 
66
-		if ($loaded === TRUE)
67
-		{
56
+		if ($loaded === TRUE) {
68 57
 			return TRUE;
69
-		}
70
-		elseif ($fail_gracefully === TRUE)
71
-		{
58
+		} elseif ($fail_gracefully === TRUE) {
72 59
 			return FALSE;
73 60
 		}
74 61
 
Please login to merge, or discard this patch.