Passed
Pull Request — master (#4)
by
unknown
04:42
created
classes/pref/filters.php 1 patch
Braces   +28 added lines, -16 removed lines patch added patch discarded remove patch
@@ -99,12 +99,16 @@  discard block
 block discarded – undo
99 99
 			}
100 100
 		}
101 101
 
102
-		if (count($scope_qparts) == 0) $scope_qparts = ["true"];
102
+		if (count($scope_qparts) == 0) {
103
+			$scope_qparts = ["true"];
104
+		}
103 105
 
104 106
 		$glue = $filter['match_any_rule'] ? " OR " : " AND ";
105 107
 		$scope_qpart = join($glue, $scope_qparts);
106 108
 
107
-		if (!$scope_qpart) $scope_qpart = "true";
109
+		if (!$scope_qpart) {
110
+			$scope_qpart = "true";
111
+		}
108 112
 
109 113
 		$rv = array();
110 114
 
@@ -209,10 +213,11 @@  discard block
 block discarded – undo
209 213
 						$feed_id = (int)substr($feed_id, 4);
210 214
 						array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id));
211 215
 					} else {
212
-						if ($feed_id)
213
-							array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
214
-						else
215
-							array_push($feeds_fmt, __("All feeds"));
216
+						if ($feed_id) {
217
+													array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
218
+						} else {
219
+													array_push($feeds_fmt, __("All feeds"));
220
+						}
216 221
 					}
217 222
 				}
218 223
 
@@ -540,10 +545,11 @@  discard block
 block discarded – undo
540 545
 				$feed_id = (int)substr($feed_id, 4);
541 546
 				array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id));
542 547
 			} else {
543
-				if ($feed_id)
544
-					array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
545
-				else
546
-					array_push($feeds_fmt, __("All feeds"));
548
+				if ($feed_id) {
549
+									array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
550
+				} else {
551
+									array_push($feeds_fmt, __("All feeds"));
552
+				}
547 553
 			}
548 554
 		}
549 555
 
@@ -582,8 +588,9 @@  discard block
 block discarded – undo
582 588
 			$title = __($row["description"]);
583 589
 
584 590
 			if ($action["action_id"] == 4 || $action["action_id"] == 6 ||
585
-				$action["action_id"] == 7)
586
-				$title .= ": ".$action["action_param"];
591
+				$action["action_id"] == 7) {
592
+							$title .= ": ".$action["action_param"];
593
+			}
587 594
 
588 595
 			if ($action["action_id"] == 9) {
589 596
 				list ($pfclass, $pfaction) = explode(":", $action["action_param"]);
@@ -1168,11 +1175,16 @@  discard block
 block discarded – undo
1168 1175
 				$num_actions -= 1;
1169 1176
 			}
1170 1177
 
1171
-			if ($match_any_rule) $title .= " (".__("matches any rule").")";
1172
-			if ($inverse) $title .= " (".__("inverse").")";
1178
+			if ($match_any_rule) {
1179
+				$title .= " (".__("matches any rule").")";
1180
+			}
1181
+			if ($inverse) {
1182
+				$title .= " (".__("inverse").")";
1183
+			}
1173 1184
 
1174
-			if ($num_actions > 0)
1175
-				$actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions);
1185
+			if ($num_actions > 0) {
1186
+							$actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions);
1187
+			}
1176 1188
 
1177 1189
 			return [$title, $actions];
1178 1190
 		}
Please login to merge, or discard this patch.
classes/logger/sql.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,9 @@
 block discarded – undo
24 24
 			];
25 25
 
26 26
 			foreach ($server_params as $n => $p) {
27
-				if (isset($_SERVER[$p]))
28
-					$context .= "\n$n: ".$_SERVER[$p];
27
+				if (isset($_SERVER[$p])) {
28
+									$context .= "\n$n: ".$_SERVER[$p];
29
+				}
29 30
 			}
30 31
 
31 32
 			// passed error message may contain invalid unicode characters, failing to insert an error here
Please login to merge, or discard this patch.
classes/labels.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -176,12 +176,16 @@
 block discarded – undo
176 176
 
177 177
 		}
178 178
 
179
-		if (!$tr_in_progress) $pdo->commit();
179
+		if (!$tr_in_progress) {
180
+			$pdo->commit();
181
+		}
180 182
 	}
181 183
 
182 184
 	public static function create($caption, $fg_color = '', $bg_color = '', $owner_uid = false) {
183 185
 
184
-		if (!$owner_uid) $owner_uid = $_SESSION['uid'];
186
+		if (!$owner_uid) {
187
+			$owner_uid = $_SESSION['uid'];
188
+		}
185 189
 
186 190
 		$pdo = Db::pdo();
187 191
 
Please login to merge, or discard this patch.
classes/debug.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
 	public static function log($message, $level = 0) {
38 38
 
39
-		if (!Debug::$enabled || Debug::$loglevel < $level) return false;
39
+		if (!Debug::$enabled || Debug::$loglevel < $level) {
40
+			return false;
41
+		}
40 42
 
41 43
 		$ts = strftime("%H:%M:%S", time());
42 44
 		if (function_exists('posix_getpid')) {
@@ -73,8 +75,9 @@  discard block
 block discarded – undo
73 75
 
74 76
 				fclose($fp);
75 77
 
76
-				if (Debug::$quiet)
77
-					return;
78
+				if (Debug::$quiet) {
79
+									return;
80
+				}
78 81
 
79 82
 			} else {
80 83
 				user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING);
Please login to merge, or discard this patch.
classes/feeditem/common.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -186,8 +186,9 @@
 block discarded – undo
186 186
 			$cat = clean(trim(mb_strtolower($srccat)));
187 187
 
188 188
 			// we don't support numeric tags
189
-			if (is_numeric($cat))
190
-				$cat = 't:'.$cat;
189
+			if (is_numeric($cat)) {
190
+							$cat = 't:'.$cat;
191
+			}
191 192
 
192 193
 			$cat = preg_replace('/[,\'\"]/', "", $cat);
193 194
 
Please login to merge, or discard this patch.
include/colors.php 1 patch
Braces   +51 added lines, -31 removed lines patch added patch discarded remove patch
@@ -157,11 +157,12 @@  discard block
 block discarded – undo
157 157
 
158 158
 	$color = strtolower($color);
159 159
 
160
-	if (isset($htmlcolors[$color]))
161
-		return $htmlcolors[$color];
162
-	else
163
-		return $color;
164
-}
160
+	if (isset($htmlcolors[$color])) {
161
+			return $htmlcolors[$color];
162
+	} else {
163
+			return $color;
164
+	}
165
+	}
165 166
 
166 167
 ### RGB >> HSL
167 168
 function _color_rgb2hsl($rgb) {
@@ -173,9 +174,15 @@  discard block
 block discarded – undo
173 174
 	}
174 175
 	$h = 0;
175 176
 	if ($delta > 0) {
176
-		if ($max == $r && $max != $g) $h += ($g - $b) / $delta;
177
-		if ($max == $g && $max != $b) $h += (2 + ($b - $r) / $delta);
178
-		if ($max == $b && $max != $r) $h += (4 + ($r - $g) / $delta);
177
+		if ($max == $r && $max != $g) {
178
+			$h += ($g - $b) / $delta;
179
+		}
180
+		if ($max == $g && $max != $b) {
181
+			$h += (2 + ($b - $r) / $delta);
182
+		}
183
+		if ($max == $b && $max != $r) {
184
+			$h += (4 + ($r - $g) / $delta);
185
+		}
179 186
 		$h /= 6;
180 187
 	} return array($h, $s, $l);
181 188
 }
@@ -193,19 +200,26 @@  discard block
 block discarded – undo
193 200
 ### Helper function for _color_hsl2rgb().
194 201
 function _color_hue2rgb($m1, $m2, $h) {
195 202
 	$h = ($h < 0) ? $h + 1 : (($h > 1) ? $h - 1 : $h);
196
-	if ($h * 6 < 1) return $m1 + ($m2 - $m1) * $h * 6;
197
-	if ($h * 2 < 1) return $m2;
198
-	if ($h * 3 < 2) return $m1 + ($m2 - $m1) * (0.66666 - $h) * 6;
203
+	if ($h * 6 < 1) {
204
+		return $m1 + ($m2 - $m1) * $h * 6;
205
+	}
206
+	if ($h * 2 < 1) {
207
+		return $m2;
208
+	}
209
+	if ($h * 3 < 2) {
210
+		return $m1 + ($m2 - $m1) * (0.66666 - $h) * 6;
211
+	}
199 212
 	return $m1;
200 213
 }
201 214
 
202 215
 ### Convert a hex color into an RGB triplet.
203 216
 function _color_unpack($hex, $normalize = false) {
204 217
 
205
-	if (strpos($hex, '#') !== 0)
206
-		$hex = _resolve_htmlcolor($hex);
207
-	else
208
-		$hex = substr($hex, 1);
218
+	if (strpos($hex, '#') !== 0) {
219
+			$hex = _resolve_htmlcolor($hex);
220
+	} else {
221
+			$hex = substr($hex, 1);
222
+	}
209 223
 
210 224
 	if (strlen($hex) == 4) {
211 225
 		$hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3];
@@ -248,12 +262,20 @@  discard block
 block discarded – undo
248 262
 		$del_G = ((($var_Max - $var_G ) / 6 ) + ($del_Max / 2 ) ) / $del_Max;
249 263
 		$del_B = ((($var_Max - $var_B ) / 6 ) + ($del_Max / 2 ) ) / $del_Max;
250 264
 
251
-		if      ($var_R == $var_Max) $h = $del_B - $del_G;
252
-		else if ($var_G == $var_Max) $h = (1 / 3 ) + $del_R - $del_B;
253
-		else if ($var_B == $var_Max) $h = (2 / 3 ) + $del_G - $del_R;
265
+		if      ($var_R == $var_Max) {
266
+			$h = $del_B - $del_G;
267
+		} else if ($var_G == $var_Max) {
268
+			$h = (1 / 3 ) + $del_R - $del_B;
269
+		} else if ($var_B == $var_Max) {
270
+			$h = (2 / 3 ) + $del_G - $del_R;
271
+		}
254 272
 
255
-		if ($h < 0) $h++;
256
-		if ($h > 1) $h--;
273
+		if ($h < 0) {
274
+			$h++;
275
+		}
276
+		if ($h > 1) {
277
+			$h--;
278
+		}
257 279
 	}
258 280
 
259 281
 	return array($h, $s, $v);
@@ -273,12 +295,7 @@  discard block
 block discarded – undo
273 295
 		$var_2 = $v * (1 - $s * ($var_H - $var_i ) );
274 296
 		$var_3 = $v * (1 - $s * (1 - ($var_H - $var_i ) ) );
275 297
 
276
-		if       ($var_i == 0) { $var_R = $v     ; $var_G = $var_3  ; $var_B = $var_1 ; }
277
-		else if  ($var_i == 1) { $var_R = $var_2 ; $var_G = $v      ; $var_B = $var_1 ; }
278
-		else if  ($var_i == 2) { $var_R = $var_1 ; $var_G = $v      ; $var_B = $var_3 ; }
279
-		else if  ($var_i == 3) { $var_R = $var_1 ; $var_G = $var_2  ; $var_B = $v     ; }
280
-		else if  ($var_i == 4) { $var_R = $var_3 ; $var_G = $var_1  ; $var_B = $v     ; }
281
-		else                   { $var_R = $v     ; $var_G = $var_1  ; $var_B = $var_2 ; }
298
+		if       ($var_i == 0) { $var_R = $v     ; $var_G = $var_3  ; $var_B = $var_1 ; } else if  ($var_i == 1) { $var_R = $var_2 ; $var_G = $v      ; $var_B = $var_1 ; } else if  ($var_i == 2) { $var_R = $var_1 ; $var_G = $v      ; $var_B = $var_3 ; } else if  ($var_i == 3) { $var_R = $var_1 ; $var_G = $var_2  ; $var_B = $v     ; } else if  ($var_i == 4) { $var_R = $var_3 ; $var_G = $var_1  ; $var_B = $v     ; } else                   { $var_R = $v     ; $var_G = $var_1  ; $var_B = $var_2 ; }
282 299
 
283 300
 		$r = $var_R * 255;
284 301
 		$g = $var_G * 255;
@@ -301,10 +318,11 @@  discard block
 block discarded – undo
301 318
 			$ico = new floIcon();
302 319
 			@$ico->readICO($imageFile);
303 320
 
304
-			if(count($ico->images)==0)
305
-				return false;
306
-			else
307
-				$img = @$ico->images[count($ico->images)-1]->getImageResource();
321
+			if(count($ico->images)==0) {
322
+							return false;
323
+			} else {
324
+							$img = @$ico->images[count($ico->images)-1]->getImageResource();
325
+			}
308 326
 
309 327
 		} else {
310 328
 			return false;
@@ -314,7 +332,9 @@  discard block
 block discarded – undo
314 332
 		$img = @imagecreatefromstring(file_get_contents($imageFile));
315 333
 	}
316 334
 
317
-	if (!$img) return false;
335
+	if (!$img) {
336
+		return false;
337
+	}
318 338
 
319 339
 	for($x = 0; $x < $size[0]; $x += $granularity) {
320 340
 		for($y = 0; $y < $size[1]; $y += $granularity) {
Please login to merge, or discard this patch.
include/controls.php 1 patch
Braces   +24 added lines, -15 removed lines patch added patch discarded remove patch
@@ -110,17 +110,19 @@  discard block
 block discarded – undo
110 110
 
111 111
 		while ($line = $sth->fetch()) {
112 112
 
113
-			for ($i = 0; $i < $nest_level; $i++)
114
-				$line["title"] = " - ".$line["title"];
113
+			for ($i = 0; $i < $nest_level; $i++) {
114
+							$line["title"] = " - ".$line["title"];
115
+			}
115 116
 
116 117
 			$is_selected = in_array("CAT:".$line["id"], $default_ids) ? "selected=\"1\"" : "";
117 118
 
118 119
 			printf("<option $is_selected value='CAT:%d'>%s</option>",
119 120
 				$line["id"], htmlspecialchars($line["title"]));
120 121
 
121
-			if ($line["num_children"] > 0)
122
-				print_feed_multi_select($id, $default_ids, $attributes,
122
+			if ($line["num_children"] > 0) {
123
+							print_feed_multi_select($id, $default_ids, $attributes,
123 124
 					$include_all_feeds, $line["id"], $nest_level + 1);
125
+			}
124 126
 
125 127
 			$f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
126 128
 					WHERE cat_id = ? AND owner_uid = ? ORDER BY title");
@@ -132,8 +134,9 @@  discard block
 block discarded – undo
132 134
 
133 135
 				$fline["title"] = " + ".$fline["title"];
134 136
 
135
-				for ($i = 0; $i < $nest_level; $i++)
136
-					$fline["title"] = " - ".$fline["title"];
137
+				for ($i = 0; $i < $nest_level; $i++) {
138
+									$fline["title"] = " - ".$fline["title"];
139
+				}
137 140
 
138 141
 				printf("<option $is_selected value='%d'>%s</option>",
139 142
 					$fline["id"], htmlspecialchars($fline["title"]));
@@ -155,8 +158,9 @@  discard block
 block discarded – undo
155 158
 
156 159
 				$fline["title"] = " + ".$fline["title"];
157 160
 
158
-				for ($i = 0; $i < $nest_level; $i++)
159
-					$fline["title"] = " - ".$fline["title"];
161
+				for ($i = 0; $i < $nest_level; $i++) {
162
+									$fline["title"] = " - ".$fline["title"];
163
+				}
160 164
 
161 165
 				printf("<option $is_selected value='%d'>%s</option>",
162 166
 					$fline["id"], htmlspecialchars($fline["title"]));
@@ -214,16 +218,19 @@  discard block
 block discarded – undo
214 218
 			$is_selected = "";
215 219
 		}
216 220
 
217
-		for ($i = 0; $i < $nest_level; $i++)
218
-			$line["title"] = " - ".$line["title"];
221
+		for ($i = 0; $i < $nest_level; $i++) {
222
+					$line["title"] = " - ".$line["title"];
223
+		}
219 224
 
220
-		if ($line["title"])
221
-			printf("<option $is_selected value='%d'>%s</option>",
225
+		if ($line["title"]) {
226
+					printf("<option $is_selected value='%d'>%s</option>",
222 227
 				$line["id"], htmlspecialchars($line["title"]));
228
+		}
223 229
 
224
-		if ($line["num_children"] > 0)
225
-			print_feed_cat_select($id, $default_id, $attributes,
230
+		if ($line["num_children"] > 0) {
231
+					print_feed_cat_select($id, $default_id, $attributes,
226 232
 				$include_all_cats, $line["id"], $nest_level + 1);
233
+		}
227 234
 	}
228 235
 
229 236
 	if (!$root_id) {
@@ -312,8 +319,10 @@  discard block
 block discarded – undo
312 319
 
313 320
 		}
314 321
 
315
-		if ($entry) $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\"
322
+		if ($entry) {
323
+			$entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\"
316 324
 				href=\"$url\">".basename($url)."</a>";
325
+		}
317 326
 
318 327
 		$entry .= "</div>";
319 328
 
Please login to merge, or discard this patch.
include/functions.php 1 patch
Braces   +125 added lines, -64 removed lines patch added patch discarded remove patch
@@ -197,8 +197,9 @@  discard block
 block discarded – undo
197 197
 	$fetch_last_modified = "";
198 198
 	$fetch_effective_url = "";
199 199
 
200
-	if (!is_array($fetch_domain_hits))
201
-		$fetch_domain_hits = [];
200
+	if (!is_array($fetch_domain_hits)) {
201
+			$fetch_domain_hits = [];
202
+	}
202 203
 
203 204
 	if (!is_array($options)) {
204 205
 
@@ -229,8 +230,9 @@  discard block
 block discarded – undo
229 230
 	$url = ltrim($url, ' ');
230 231
 	$url = str_replace(' ', '%20', $url);
231 232
 
232
-	if (strpos($url, "//") === 0)
233
-		$url = 'http:' . $url;
233
+	if (strpos($url, "//") === 0) {
234
+			$url = 'http:' . $url;
235
+	}
234 236
 
235 237
 	$url_host = parse_url($url, PHP_URL_HOST);
236 238
 	$fetch_domain_hits[$url_host] += 1;
@@ -248,14 +250,17 @@  discard block
 block discarded – undo
248 250
 
249 251
 		$curl_http_headers = [];
250 252
 
251
-		if ($last_modified && !$post_query)
252
-			array_push($curl_http_headers, "If-Modified-Since: $last_modified");
253
+		if ($last_modified && !$post_query) {
254
+					array_push($curl_http_headers, "If-Modified-Since: $last_modified");
255
+		}
253 256
 
254
-		if ($http_accept)
255
-			array_push($curl_http_headers, "Accept: " . $http_accept);
257
+		if ($http_accept) {
258
+					array_push($curl_http_headers, "Accept: " . $http_accept);
259
+		}
256 260
 
257
-		if (count($curl_http_headers) > 0)
258
-			curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_http_headers);
261
+		if (count($curl_http_headers) > 0) {
262
+					curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_http_headers);
263
+		}
259 264
 
260 265
 		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout ? $timeout : FILE_FETCH_CONNECT_TIMEOUT);
261 266
 		curl_setopt($ch, CURLOPT_TIMEOUT, $timeout ? $timeout : FILE_FETCH_TIMEOUT);
@@ -269,8 +274,9 @@  discard block
 block discarded – undo
269 274
 			SELF_USER_AGENT);
270 275
 		curl_setopt($ch, CURLOPT_ENCODING, "");
271 276
 
272
-		if  ($http_referrer)
273
-			curl_setopt($ch, CURLOPT_REFERER, $http_referrer);
277
+		if  ($http_referrer) {
278
+					curl_setopt($ch, CURLOPT_REFERER, $http_referrer);
279
+		}
274 280
 
275 281
 		if ($max_size) {
276 282
 			curl_setopt($ch, CURLOPT_NOPROGRESS, false);
@@ -299,8 +305,9 @@  discard block
 block discarded – undo
299 305
 			curl_setopt($ch, CURLOPT_POSTFIELDS, $post_query);
300 306
 		}
301 307
 
302
-		if ($login && $pass)
303
-			curl_setopt($ch, CURLOPT_USERPWD, "$login:$pass");
308
+		if ($login && $pass) {
309
+					curl_setopt($ch, CURLOPT_USERPWD, "$login:$pass");
310
+		}
304 311
 
305 312
 		$ret = @curl_exec($ch);
306 313
 
@@ -359,7 +366,9 @@  discard block
 block discarded – undo
359 366
 		if ($is_gzipped) {
360 367
 			$tmp = @gzdecode($contents);
361 368
 
362
-			if ($tmp) $contents = $tmp;
369
+			if ($tmp) {
370
+				$contents = $tmp;
371
+			}
363 372
 		}
364 373
 
365 374
 		return $contents;
@@ -392,14 +401,17 @@  discard block
 block discarded – undo
392 401
 					'protocol_version'=> 1.1)
393 402
 			  );
394 403
 
395
-		if (!$post_query && $last_modified)
396
-			array_push($context_options['http']['header'], "If-Modified-Since: $last_modified");
404
+		if (!$post_query && $last_modified) {
405
+					array_push($context_options['http']['header'], "If-Modified-Since: $last_modified");
406
+		}
397 407
 
398
-		if ($http_accept)
399
-			array_push($context_options['http']['header'], "Accept: $http_accept");
408
+		if ($http_accept) {
409
+					array_push($context_options['http']['header'], "Accept: $http_accept");
410
+		}
400 411
 
401
-		if ($http_referrer)
402
-			array_push($context_options['http']['header'], "Referer: $http_referrer");
412
+		if ($http_referrer) {
413
+					array_push($context_options['http']['header'], "Referer: $http_referrer");
414
+		}
403 415
 
404 416
 		if (defined('_HTTP_PROXY')) {
405 417
 			$context_options['http']['request_fulluri'] = true;
@@ -456,7 +468,9 @@  discard block
 block discarded – undo
456 468
 		if ($is_gzipped) {
457 469
 			$tmp = @gzdecode($data);
458 470
 
459
-			if ($tmp) $data = $tmp;
471
+			if ($tmp) {
472
+				$data = $tmp;
473
+			}
460 474
 		}
461 475
 
462 476
 		return $data;
@@ -466,7 +480,9 @@  discard block
 block discarded – undo
466 480
 
467 481
 function initialize_user_prefs($uid, $profile = false) {
468 482
 
469
-	if (get_schema_version() < 63) $profile_qpart = "";
483
+	if (get_schema_version() < 63) {
484
+		$profile_qpart = "";
485
+	}
470 486
 
471 487
 	$pdo = DB::pdo();
472 488
 	$in_nested_tr = false;
@@ -479,7 +495,9 @@  discard block
 block discarded – undo
479 495
 
480 496
 	$sth = $pdo->query("SELECT pref_name,def_value FROM ttrss_prefs");
481 497
 
482
-	if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null;
498
+	if (!is_numeric($profile) || !$profile || get_schema_version() < 63) {
499
+		$profile = null;
500
+	}
483 501
 
484 502
 	$u_sth = $pdo->prepare("SELECT pref_name
485 503
         FROM ttrss_user_prefs WHERE owner_uid = :uid AND
@@ -512,7 +530,9 @@  discard block
 block discarded – undo
512 530
 		}
513 531
 	}
514 532
 
515
-	if (!$in_nested_tr) $pdo->commit();
533
+	if (!$in_nested_tr) {
534
+		$pdo->commit();
535
+	}
516 536
 
517 537
 }
518 538
 
@@ -672,7 +692,9 @@  discard block
 block discarded – undo
672 692
 
673 693
 function load_user_plugins($owner_uid, $pluginhost = false) {
674 694
 
675
-	if (!$pluginhost) $pluginhost = PluginHost::getInstance();
695
+	if (!$pluginhost) {
696
+		$pluginhost = PluginHost::getInstance();
697
+	}
676 698
 
677 699
 	if ($owner_uid && SCHEMA_VERSION >= 100) {
678 700
 		$plugins = get_pref("_ENABLED_PLUGINS", $owner_uid);
@@ -694,7 +716,9 @@  discard block
 block discarded – undo
694 716
 		startup_gettext();
695 717
 		load_user_plugins($_SESSION["uid"]);
696 718
 	} else {
697
-		if (!validate_session()) $_SESSION["uid"] = false;
719
+		if (!validate_session()) {
720
+			$_SESSION["uid"] = false;
721
+		}
698 722
 
699 723
 		if (!$_SESSION["uid"]) {
700 724
 
@@ -789,13 +813,19 @@  discard block
 block discarded – undo
789 813
 function make_local_datetime($timestamp, $long, $owner_uid = false,
790 814
 				$no_smart_dt = false, $eta_min = false) {
791 815
 
792
-	if (!$owner_uid) $owner_uid = $_SESSION['uid'];
793
-	if (!$timestamp) $timestamp = '1970-01-01 0:00';
816
+	if (!$owner_uid) {
817
+		$owner_uid = $_SESSION['uid'];
818
+	}
819
+	if (!$timestamp) {
820
+		$timestamp = '1970-01-01 0:00';
821
+	}
794 822
 
795 823
 	global $utc_tz;
796 824
 	global $user_tz;
797 825
 
798
-	if (!$utc_tz) $utc_tz = new DateTimeZone('UTC');
826
+	if (!$utc_tz) {
827
+		$utc_tz = new DateTimeZone('UTC');
828
+	}
799 829
 
800 830
 	$timestamp = substr($timestamp, 0, 19);
801 831
 
@@ -807,7 +837,9 @@  discard block
 block discarded – undo
807 837
 	if ($user_tz_string != 'Automatic') {
808 838
 
809 839
 		try {
810
-			if (!$user_tz) $user_tz = new DateTimeZone($user_tz_string);
840
+			if (!$user_tz) {
841
+				$user_tz = new DateTimeZone($user_tz_string);
842
+			}
811 843
 		} catch (Exception $e) {
812 844
 			$user_tz = $utc_tz;
813 845
 		}
@@ -823,26 +855,30 @@  discard block
 block discarded – undo
823 855
 		return smart_date_time($user_timestamp,
824 856
 			$tz_offset, $owner_uid, $eta_min);
825 857
 	} else {
826
-		if ($long)
827
-			$format = get_pref('LONG_DATE_FORMAT', $owner_uid);
828
-		else
829
-			$format = get_pref('SHORT_DATE_FORMAT', $owner_uid);
858
+		if ($long) {
859
+					$format = get_pref('LONG_DATE_FORMAT', $owner_uid);
860
+		} else {
861
+					$format = get_pref('SHORT_DATE_FORMAT', $owner_uid);
862
+		}
830 863
 
831 864
 		return date($format, $user_timestamp);
832 865
 	}
833 866
 }
834 867
 
835 868
 function smart_date_time($timestamp, $tz_offset = 0, $owner_uid = false, $eta_min = false) {
836
-	if (!$owner_uid) $owner_uid = $_SESSION['uid'];
869
+	if (!$owner_uid) {
870
+		$owner_uid = $_SESSION['uid'];
871
+	}
837 872
 
838 873
 	if ($eta_min && time() + $tz_offset - $timestamp < 3600) {
839 874
 		return T_sprintf("%d min", date("i", time() + $tz_offset - $timestamp));
840 875
 	} else if (date("Y.m.d", $timestamp) == date("Y.m.d", time() + $tz_offset)) {
841 876
 		$format = get_pref('SHORT_DATE_FORMAT', $owner_uid);
842
-		if (strpos((strtolower($format)), "a") === false)
843
-			return date("G:i", $timestamp);
844
-		else
845
-			return date("g:i a", $timestamp);
877
+		if (strpos((strtolower($format)), "a") === false) {
878
+					return date("G:i", $timestamp);
879
+		} else {
880
+					return date("g:i a", $timestamp);
881
+		}
846 882
 	} else if (date("Y", $timestamp) == date("Y", time() + $tz_offset)) {
847 883
 		$format = get_pref('SHORT_DATE_FORMAT', $owner_uid);
848 884
 		return date($format, $timestamp);
@@ -1252,8 +1288,9 @@  discard block
 block discarded – undo
1252 1288
 
1253 1289
 	if ($src) {
1254 1290
 		foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_IFRAME_WHITELISTED) as $plugin) {
1255
-			if ($plugin->hook_iframe_whitelisted($src))
1256
-				return true;
1291
+			if ($plugin->hook_iframe_whitelisted($src)) {
1292
+							return true;
1293
+			}
1257 1294
 		}
1258 1295
 	}
1259 1296
 
@@ -1261,9 +1298,13 @@  discard block
 block discarded – undo
1261 1298
 }
1262 1299
 
1263 1300
 function sanitize($str, $force_remove_images = false, $owner = false, $site_url = false, $highlight_words = false, $article_id = false) {
1264
-	if (!$owner) $owner = $_SESSION["uid"];
1301
+	if (!$owner) {
1302
+		$owner = $_SESSION["uid"];
1303
+	}
1265 1304
 
1266
-	$res = trim($str); if (!$res) return '';
1305
+	$res = trim($str); if (!$res) {
1306
+		return '';
1307
+	}
1267 1308
 
1268 1309
 	$doc = new DOMDocument();
1269 1310
 	$doc->loadHTML('<?xml encoding="UTF-8">' . $res);
@@ -1325,13 +1366,15 @@  discard block
 block discarded – undo
1325 1366
 
1326 1367
 			if ($entry->nodeName == 'source') {
1327 1368
 
1328
-				if ($entry->parentNode && $entry->parentNode->parentNode)
1329
-					$entry->parentNode->parentNode->replaceChild($p, $entry->parentNode);
1369
+				if ($entry->parentNode && $entry->parentNode->parentNode) {
1370
+									$entry->parentNode->parentNode->replaceChild($p, $entry->parentNode);
1371
+				}
1330 1372
 
1331 1373
 			} else if ($entry->nodeName == 'img') {
1332 1374
 
1333
-				if ($entry->parentNode)
1334
-					$entry->parentNode->replaceChild($p, $entry);
1375
+				if ($entry->parentNode) {
1376
+									$entry->parentNode->replaceChild($p, $entry);
1377
+				}
1335 1378
 
1336 1379
 			}
1337 1380
 		}
@@ -1367,7 +1410,9 @@  discard block
 block discarded – undo
1367 1410
 		'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'time',
1368 1411
 		'tr', 'track', 'tt', 'u', 'ul', 'var', 'wbr', 'video', 'xml:namespace' );
1369 1412
 
1370
-	if ($_SESSION['hasSandbox']) $allowed_elements[] = 'iframe';
1413
+	if ($_SESSION['hasSandbox']) {
1414
+		$allowed_elements[] = 'iframe';
1415
+	}
1371 1416
 
1372 1417
 	$disallowed_attributes = array('id', 'style', 'class');
1373 1418
 
@@ -1407,7 +1452,9 @@  discard block
 block discarded – undo
1407 1452
 					$text = mb_substr($text, $pos + mb_strlen($word));
1408 1453
 				}
1409 1454
 
1410
-				if (!empty($text)) $fragment->appendChild(new DomText($text));
1455
+				if (!empty($text)) {
1456
+					$fragment->appendChild(new DomText($text));
1457
+				}
1411 1458
 
1412 1459
 				$child->parentNode->replaceChild($fragment, $child);
1413 1460
 			}
@@ -1598,8 +1645,9 @@  discard block
 block discarded – undo
1598 1645
 	} else {
1599 1646
 		$output = "";
1600 1647
 
1601
-		for ($i = 0; $i < $length; $i++)
1602
-			$output .= chr(mt_rand(0, 255));
1648
+		for ($i = 0; $i < $length; $i++) {
1649
+					$output .= chr(mt_rand(0, 255));
1650
+		}
1603 1651
 
1604 1652
 		return $output;
1605 1653
 	}
@@ -1669,15 +1717,20 @@  discard block
 block discarded – undo
1669 1717
 }
1670 1718
 
1671 1719
 function get_theme_path($theme) {
1672
-	if ($theme == "default.php")
1673
-		return "css/default.css";
1720
+	if ($theme == "default.php") {
1721
+			return "css/default.css";
1722
+	}
1674 1723
 
1675 1724
 	$check = "themes/$theme";
1676
-	if (file_exists($check)) return $check;
1725
+	if (file_exists($check)) {
1726
+		return $check;
1727
+	}
1677 1728
 
1678 1729
 	$check = "themes.local/$theme";
1679
-	if (file_exists($check)) return $check;
1680
-}
1730
+	if (file_exists($check)) {
1731
+		return $check;
1732
+	}
1733
+	}
1681 1734
 
1682 1735
 function theme_exists($theme) {
1683 1736
 	return file_exists("themes/$theme") || file_exists("themes.local/$theme");
@@ -1733,7 +1786,9 @@  discard block
 block discarded – undo
1733 1786
 function send_local_file($filename) {
1734 1787
 	if (file_exists($filename)) {
1735 1788
 
1736
-		if (is_writable($filename)) touch($filename);
1789
+		if (is_writable($filename)) {
1790
+			touch($filename);
1791
+		}
1737 1792
 
1738 1793
 		$tmppluginhost = new PluginHost();
1739 1794
 
@@ -1741,7 +1796,9 @@  discard block
 block discarded – undo
1741 1796
 		$tmppluginhost->load_data();
1742 1797
 
1743 1798
 		foreach ($tmppluginhost->get_hooks(PluginHost::HOOK_SEND_LOCAL_FILE) as $plugin) {
1744
-			if ($plugin->hook_send_local_file($filename)) return true;
1799
+			if ($plugin->hook_send_local_file($filename)) {
1800
+				return true;
1801
+			}
1745 1802
 		}
1746 1803
 
1747 1804
 		$mimetype = mime_content_type($filename);
@@ -1749,8 +1806,9 @@  discard block
 block discarded – undo
1749 1806
 		// this is hardly ideal but 1) only media is cached in images/ and 2) seemingly only mp4
1750 1807
 		// video files are detected as octet-stream by mime_content_type()
1751 1808
 
1752
-		if ($mimetype == "application/octet-stream")
1753
-			$mimetype = "video/mp4";
1809
+		if ($mimetype == "application/octet-stream") {
1810
+					$mimetype = "video/mp4";
1811
+		}
1754 1812
 
1755 1813
 		header("Content-type: $mimetype");
1756 1814
 
@@ -1773,7 +1831,9 @@  discard block
 block discarded – undo
1773 1831
 
1774 1832
 	foreach ($files as $file) {
1775 1833
 		$file_ts = filemtime($file);
1776
-		if ($file_ts > $ts) $ts = $file_ts;
1834
+		if ($file_ts > $ts) {
1835
+			$ts = $file_ts;
1836
+		}
1777 1837
 	}
1778 1838
 
1779 1839
 	return $ts;
@@ -1786,8 +1846,9 @@  discard block
 block discarded – undo
1786 1846
 function get_version(&$git_commit = false, &$git_timestamp = false) {
1787 1847
 	global $ttrss_version;
1788 1848
 
1789
-	if (isset($ttrss_version))
1790
-		return $ttrss_version;
1849
+	if (isset($ttrss_version)) {
1850
+			return $ttrss_version;
1851
+	}
1791 1852
 
1792 1853
 	$ttrss_version = "UNKNOWN (Unsupported)";
1793 1854
 
Please login to merge, or discard this patch.
include/sessions.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
 }
36 36
 
37 37
 function validate_session() {
38
-	if (SINGLE_USER_MODE) return true;
38
+	if (SINGLE_USER_MODE) {
39
+		return true;
40
+	}
39 41
 
40 42
 	if (isset($_SESSION["ref_schema_version"]) && $_SESSION["ref_schema_version"] != session_get_schema_version()) {
41 43
 		$_SESSION["login_error_msg"] =
Please login to merge, or discard this patch.