Completed
Push — master ( 638578...37612c )
by Angus
02:53
created
application/models/Tracker/Tracker_Title_Model.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,9 +35,13 @@
 block discarded – undo
35 35
 			$titleID = $id;
36 36
 		} else {
37 37
 			//TODO: Check if title is valid URL!
38
-			if($create) $titleID = $this->addTitle($titleURL, $siteID);
38
+			if($create) {
39
+				$titleID = $this->addTitle($titleURL, $siteID);
40
+			}
41
+		}
42
+		if(!isset($titleID) || !$titleID) {
43
+			$titleID = 0;
39 44
 		}
40
-		if(!isset($titleID) || !$titleID) $titleID = 0;
41 45
 
42 46
 		return ($returnData && $titleID !== 0 ? $query->row_array() : $titleID);
43 47
 	}
Please login to merge, or discard this patch.
application/controllers/User/History.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 	}
7 7
 
8 8
 	public function index(int $page = 1) : void {
9
-		if($page === 0) redirect('user/history/1');
9
+		if($page === 0) {
10
+			redirect('user/history/1');
11
+		}
10 12
 
11 13
 		$this->header_data['title'] = "History";
12 14
 		$this->header_data['page']  = "history";
@@ -16,7 +18,9 @@  discard block
 block discarded – undo
16 18
 		$this->body_data['currentPage'] = (int) $page;
17 19
 		$this->body_data['totalPages']  = $historyData['totalPages'];
18 20
 
19
-		if($page > $this->body_data['totalPages'] && $page > 1) redirect('user/history/1');
21
+		if($page > $this->body_data['totalPages'] && $page > 1) {
22
+			redirect('user/history/1');
23
+		}
20 24
 
21 25
 		$this->_render_page('User/History');
22 26
 	}
Please login to merge, or discard this patch.
application/controllers/User/PublicList.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@
 block discarded – undo
60 60
 			$show_404 = TRUE;
61 61
 		}
62 62
 
63
-		if($show_404) show_404();
63
+		if($show_404) {
64
+			show_404();
65
+		}
64 66
 	}
65 67
 
66 68
 	private function _walk_recursive_remove (array $array, callable $callback) : array {
Please login to merge, or discard this patch.
application/controllers/User/Favourites.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 	}
7 7
 
8 8
 	public function index(int $page = 1) : void {
9
-		if($page === 0) redirect('user/favourites/1');
9
+		if($page === 0) {
10
+			redirect('user/favourites/1');
11
+		}
10 12
 
11 13
 		$this->header_data['title'] = "Favourites";
12 14
 		$this->header_data['page']  = "favourites";
@@ -16,7 +18,9 @@  discard block
 block discarded – undo
16 18
 		$this->body_data['currentPage'] = $page;
17 19
 		$this->body_data['totalPages']  = $favouriteData['totalPages'];
18 20
 
19
-		if($page > $this->body_data['totalPages'] && $page <= 1) redirect('user/favourites/1');
21
+		if($page > $this->body_data['totalPages'] && $page <= 1) {
22
+			redirect('user/favourites/1');
23
+		}
20 24
 
21 25
 		$this->_render_page('User/Favourites');
22 26
 	}
Please login to merge, or discard this patch.
application/helpers/generic_helper.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,18 +32,19 @@
 block discarded – undo
32 32
 	return $time_string;
33 33
 }
34 34
 
35
-if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917
35
+if (!function_exists('http_parse_headers')) {
36
+#http://www.php.net/manual/en/function.http-parse-headers.php#112917
36 37
 	function http_parse_headers (string $raw_headers) : array {
37 38
 		$headers = array(); // $headers = [];
38 39
 		foreach (explode("\n", $raw_headers) as $i => $h) {
39 40
 			$h = explode(':', $h, 2);
40
-			if (isset($h[1])){
41
-				if(!isset($headers[$h[0]])){
41
+			if (isset($h[1])) {
42
+				if(!isset($headers[$h[0]])) {
42 43
 					$headers[$h[0]] = trim($h[1]);
43
-				}else if(is_array($headers[$h[0]])){
44
+				} else if(is_array($headers[$h[0]])) {
44 45
 					$tmp = array_merge($headers[$h[0]],array(trim($h[1])));
45 46
 					$headers[$h[0]] = $tmp;
46
-				}else{
47
+				} else {
47 48
 					$tmp = array_merge(array($headers[$h[0]]),array(trim($h[1])));
48 49
 					$headers[$h[0]] = $tmp;
49 50
 				}
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_List_Model.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -114,11 +114,15 @@
 block discarded – undo
114 114
 
115 115
 							if($sortOrder == 'asc') {
116 116
 								$unreadSort = ($a_text <=> $b_text);
117
-								if($unreadSort) return $unreadSort;
117
+								if($unreadSort) {
118
+									return $unreadSort;
119
+								}
118 120
 								return $a_text2 <=> $b_text2;
119 121
 							} else {
120 122
 								$unreadSort = ($a_text <=> $b_text);
121
-								if($unreadSort) return $unreadSort;
123
+								if($unreadSort) {
124
+									return $unreadSort;
125
+								}
122 126
 								return $b_text2 <=> $a_text2;
123 127
 							}
124 128
 						});
Please login to merge, or discard this patch.
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.