Passed
Pull Request — master (#1)
by
unknown
04:51
created
classes/api.php 1 patch
Braces   +47 added lines, -28 removed lines patch added patch discarded remove patch
@@ -57,7 +57,9 @@  discard block
 block discarded – undo
57 57
 		$password = clean($_REQUEST["password"]);
58 58
 		$password_base64 = base64_decode(clean($_REQUEST["password"]));
59 59
 
60
-		if (SINGLE_USER_MODE) $login = "admin";
60
+		if (SINGLE_USER_MODE) {
61
+			$login = "admin";
62
+		}
61 63
 
62 64
 		$sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE login = ?");
63 65
 		$sth->execute([$login]);
@@ -134,10 +136,11 @@  discard block
 block discarded – undo
134 136
 
135 137
 		// TODO do not return empty categories, return Uncategorized and standard virtual cats
136 138
 
137
-		if ($enable_nested)
138
-			$nested_qpart = "parent_cat IS NULL";
139
-		else
140
-			$nested_qpart = "true";
139
+		if ($enable_nested) {
140
+					$nested_qpart = "parent_cat IS NULL";
141
+		} else {
142
+					$nested_qpart = "true";
143
+		}
141 144
 
142 145
 		$sth = $this->pdo->prepare("SELECT
143 146
 				id, title, order_id, (SELECT COUNT(id) FROM
@@ -156,8 +159,9 @@  discard block
 block discarded – undo
156 159
 			if ($include_empty || $line["num_feeds"] > 0 || $line["num_cats"] > 0) {
157 160
 				$unread = getFeedUnread($line["id"], true);
158 161
 
159
-				if ($enable_nested)
160
-					$unread += Feeds::getCategoryChildrenUnread($line["id"]);
162
+				if ($enable_nested) {
163
+									$unread += Feeds::getCategoryChildrenUnread($line["id"]);
164
+				}
161 165
 
162 166
 				if ($unread || !$unread_only) {
163 167
 					array_push($cats, array("id" => $line["id"],
@@ -188,11 +192,15 @@  discard block
 block discarded – undo
188 192
 		$feed_id = clean($_REQUEST["feed_id"]);
189 193
 		if ($feed_id !== "") {
190 194
 
191
-			if (is_numeric($feed_id)) $feed_id = (int) $feed_id;
195
+			if (is_numeric($feed_id)) {
196
+				$feed_id = (int) $feed_id;
197
+			}
192 198
 
193 199
 			$limit = (int)clean($_REQUEST["limit"]);
194 200
 
195
-			if (!$limit || $limit >= 200) $limit = 200;
201
+			if (!$limit || $limit >= 200) {
202
+				$limit = 200;
203
+			}
196 204
 
197 205
 			$offset = (int)clean($_REQUEST["skip"]);
198 206
 			$filter = clean($_REQUEST["filter"]);
@@ -287,7 +295,9 @@  discard block
 block discarded – undo
287 295
 				break;
288 296
 		}
289 297
 
290
-		if ($field == "note") $set_to = $this->pdo->quote($data);
298
+		if ($field == "note") {
299
+			$set_to = $this->pdo->quote($data);
300
+		}
291 301
 
292 302
 		if ($field && $set_to && count($article_ids) > 0) {
293 303
 
@@ -443,10 +453,11 @@  discard block
 block discarded – undo
443 453
 			WHERE owner_uid = ? ORDER BY caption");
444 454
 		$sth->execute([$_SESSION['uid']]);
445 455
 
446
-		if ($article_id)
447
-			$article_labels = Article::get_article_labels($article_id);
448
-		else
449
-			$article_labels = array();
456
+		if ($article_id) {
457
+					$article_labels = Article::get_article_labels($article_id);
458
+		} else {
459
+					$article_labels = array();
460
+		}
450 461
 
451 462
 		while ($line = $sth->fetch()) {
452 463
 
@@ -483,10 +494,11 @@  discard block
 block discarded – undo
483 494
 
484 495
 			foreach ($article_ids as $id) {
485 496
 
486
-				if ($assign)
487
-					Labels::add_article($id, $label, $_SESSION["uid"]);
488
-				else
489
-					Labels::remove_article($id, $label, $_SESSION["uid"]);
497
+				if ($assign) {
498
+									Labels::add_article($id, $label, $_SESSION["uid"]);
499
+				} else {
500
+									Labels::remove_article($id, $label, $_SESSION["uid"]);
501
+				}
490 502
 
491 503
 				++$num_updated;
492 504
 
@@ -738,14 +750,17 @@  discard block
 block discarded – undo
738 750
 						$label_cache = json_decode($label_cache, true);
739 751
 
740 752
 						if ($label_cache) {
741
-							if ($label_cache["no-labels"] == 1)
742
-								$labels = array();
743
-							else
744
-								$labels = $label_cache;
753
+							if ($label_cache["no-labels"] == 1) {
754
+															$labels = array();
755
+							} else {
756
+															$labels = $label_cache;
757
+							}
745 758
 						}
746 759
 					}
747 760
 
748
-					if (!is_array($labels)) $labels = Article::get_article_labels($line["id"]);
761
+					if (!is_array($labels)) {
762
+						$labels = Article::get_article_labels($line["id"]);
763
+					}
749 764
 
750 765
 					$headline_row = array(
751 766
 						"id" => (int)$line["id"],
@@ -763,11 +778,13 @@  discard block
 block discarded – undo
763 778
 
764 779
 					$enclosures = Article::get_article_enclosures($line['id']);
765 780
 
766
-					if ($include_attachments)
767
-						$headline_row['attachments'] = $enclosures;
781
+					if ($include_attachments) {
782
+											$headline_row['attachments'] = $enclosures;
783
+					}
768 784
 
769
-					if ($show_excerpt)
770
-						$headline_row["excerpt"] = $line["content_preview"];
785
+					if ($show_excerpt) {
786
+											$headline_row["excerpt"] = $line["content_preview"];
787
+					}
771 788
 
772 789
 					if ($show_content) {
773 790
 
@@ -782,7 +799,9 @@  discard block
 block discarded – undo
782 799
 					}
783 800
 
784 801
 					// unify label output to ease parsing
785
-					if ($labels["no-labels"] == 1) $labels = array();
802
+					if ($labels["no-labels"] == 1) {
803
+						$labels = array();
804
+					}
786 805
 
787 806
 					$headline_row["labels"] = $labels;
788 807
 
Please login to merge, or discard this patch.
classes/backend.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 		$omap = array();
28 28
 
29 29
 		foreach ($imap[1] as $sequence => $action) {
30
-			if (!isset($omap[$action])) $omap[$action] = array();
30
+			if (!isset($omap[$action])) {
31
+				$omap[$action] = array();
32
+			}
31 33
 
32 34
 			array_push($omap[$action], $sequence);
33 35
 		}
@@ -96,7 +98,9 @@  discard block
 block discarded – undo
96 98
 			$omap = array();
97 99
 
98 100
 			foreach ($imap[1] as $sequence => $action) {
99
-				if (!isset($omap[$action])) $omap[$action] = array();
101
+				if (!isset($omap[$action])) {
102
+					$omap[$action] = array();
103
+				}
100 104
 
101 105
 				array_push($omap[$action], $sequence);
102 106
 			}
@@ -106,7 +110,9 @@  discard block
 block discarded – undo
106 110
 			$cur_section = "";
107 111
 			foreach ($info as $section => $hotkeys) {
108 112
 
109
-				if ($cur_section) print "<li>&nbsp;</li>";
113
+				if ($cur_section) {
114
+					print "<li>&nbsp;</li>";
115
+				}
110 116
 				print "<li><h3>" . $section . "</h3></li>";
111 117
 				$cur_section = $section;
112 118
 
Please login to merge, or discard this patch.
classes/pref/prefs.php 1 patch
Braces   +28 added lines, -16 removed lines patch added patch discarded remove patch
@@ -160,7 +160,9 @@  discard block
 block discarded – undo
160 160
 		$boolean_prefs = explode(",", clean($_POST["boolean_prefs"]));
161 161
 
162 162
 		foreach ($boolean_prefs as $pref) {
163
-			if (!isset($_POST[$pref])) $_POST[$pref] = 'false';
163
+			if (!isset($_POST[$pref])) {
164
+				$_POST[$pref] = 'false';
165
+			}
164 166
 		}
165 167
 
166 168
 		$need_reload = false;
@@ -180,11 +182,15 @@  discard block
 block discarded – undo
180 182
 					}
181 183
 					break;
182 184
 				case 'USER_LANGUAGE':
183
-					if (!$need_reload) $need_reload = $_SESSION["language"] != $value;
185
+					if (!$need_reload) {
186
+						$need_reload = $_SESSION["language"] != $value;
187
+					}
184 188
 					break;
185 189
 
186 190
 				case 'USER_CSS_THEME':
187
-					if (!$need_reload) $need_reload = get_pref($pref_name) != $value;
191
+					if (!$need_reload) {
192
+						$need_reload = get_pref($pref_name) != $value;
193
+					}
188 194
 					break;
189 195
 			}
190 196
 
@@ -616,8 +622,9 @@  discard block
 block discarded – undo
616 622
 			$pref_name = $line["pref_name"];
617 623
 			$short_desc = $this->getShortDesc($pref_name);
618 624
 
619
-			if (!$short_desc)
620
-				continue;
625
+			if (!$short_desc) {
626
+							continue;
627
+			}
621 628
 
622 629
 			$prefs_available[$pref_name] = [
623 630
 				'type_name' => $line["type_name"],
@@ -669,7 +676,9 @@  discard block
 block discarded – undo
669 676
 						$themes = array_filter($themes, "theme_exists");
670 677
 						asort($themes);
671 678
 
672
-						if (!theme_exists($value)) $value = "default.php";
679
+						if (!theme_exists($value)) {
680
+							$value = "default.php";
681
+						}
673 682
 
674 683
 						print "<select name='$pref_name' id='$pref_name' dojoType='fox.form.Select'>";
675 684
 
@@ -728,14 +737,15 @@  discard block
 block discarded – undo
728 737
 							$disabled = "";
729 738
 						}
730 739
 
731
-						if ($type_name == 'integer')
732
-							print "<input dojoType=\"dijit.form.NumberSpinner\"
740
+						if ($type_name == 'integer') {
741
+													print "<input dojoType=\"dijit.form.NumberSpinner\"
733 742
 								required='1' $disabled
734 743
 								name=\"$pref_name\" value=\"$value\">";
735
-						else
736
-							print "<input dojoType=\"dijit.form.TextBox\"
744
+						} else {
745
+													print "<input dojoType=\"dijit.form.TextBox\"
737 746
 								required='1' $regexp $disabled
738 747
 								name=\"$pref_name\" value=\"$value\">";
748
+						}
739 749
 
740 750
 					} else if ($pref_name == "SSL_CERT_SERIAL") {
741 751
 
@@ -770,8 +780,9 @@  discard block
 block discarded – undo
770 780
 						print "<input dojoType=\"dijit.form.ValidationTextBox\" $regexp name=\"$pref_name\" value=\"$value\">";
771 781
 					}
772 782
 
773
-					if ($item['help_text'])
774
-						print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>";
783
+					if ($item['help_text']) {
784
+											print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>";
785
+					}
775 786
 
776 787
 					print "</fieldset>";
777 788
 				}
@@ -1113,10 +1124,11 @@  discard block
 block discarded – undo
1113 1124
 	}
1114 1125
 
1115 1126
 	function setplugins() {
1116
-		if (is_array(clean($_REQUEST["plugins"])))
1117
-			$plugins = join(",", clean($_REQUEST["plugins"]));
1118
-		else
1119
-			$plugins = "";
1127
+		if (is_array(clean($_REQUEST["plugins"]))) {
1128
+					$plugins = join(",", clean($_REQUEST["plugins"]));
1129
+		} else {
1130
+					$plugins = "";
1131
+		}
1120 1132
 
1121 1133
 		set_pref("_ENABLED_PLUGINS", $plugins);
1122 1134
 	}
Please login to merge, or discard this patch.
classes/pref/feeds.php 1 patch
Braces   +40 added lines, -26 removed lines patch added patch discarded remove patch
@@ -42,10 +42,11 @@  discard block
 block discarded – undo
42 42
 
43 43
 	private function get_category_items($cat_id) {
44 44
 
45
-		if (clean($_REQUEST['mode']) != 2)
46
-			$search = $_SESSION["prefs_feed_search"];
47
-		else
48
-			$search = "";
45
+		if (clean($_REQUEST['mode']) != 2) {
46
+					$search = $_SESSION["prefs_feed_search"];
47
+		} else {
48
+					$search = "";
49
+		}
49 50
 
50 51
 		// first one is set by API
51 52
 		$show_empty_cats = clean($_REQUEST['force_show_empty']) ||
@@ -76,8 +77,9 @@  discard block
 block discarded – undo
76 77
 			$num_children = $this->calculate_children_count($cat);
77 78
 			$cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
78 79
 
79
-			if ($num_children > 0 || $show_empty_cats)
80
-				array_push($items, $cat);
80
+			if ($num_children > 0 || $show_empty_cats) {
81
+							array_push($items, $cat);
82
+			}
81 83
 
82 84
 		}
83 85
 
@@ -117,10 +119,11 @@  discard block
 block discarded – undo
117 119
 
118 120
 	function makefeedtree() {
119 121
 
120
-		if (clean($_REQUEST['mode']) != 2)
121
-			$search = $_SESSION["prefs_feed_search"];
122
-		else
123
-			$search = "";
122
+		if (clean($_REQUEST['mode']) != 2) {
123
+					$search = $_SESSION["prefs_feed_search"];
124
+		} else {
125
+					$search = "";
126
+		}
124 127
 
125 128
 		$root = array();
126 129
 		$root['id'] = 'root';
@@ -231,8 +234,9 @@  discard block
 block discarded – undo
231 234
 				$num_children = $this->calculate_children_count($cat);
232 235
 				$cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
233 236
 
234
-				if ($num_children > 0 || $show_empty_cats)
235
-					array_push($root['items'], $cat);
237
+				if ($num_children > 0 || $show_empty_cats) {
238
+									array_push($root['items'], $cat);
239
+				}
236 240
 
237 241
 				$root['param'] += count($cat['items']);
238 242
 			}
@@ -279,8 +283,9 @@  discard block
 block discarded – undo
279 283
 
280 284
 			$cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
281 285
 
282
-			if (count($cat['items']) > 0 || $show_empty_cats)
283
-				array_push($root['items'], $cat);
286
+			if (count($cat['items']) > 0 || $show_empty_cats) {
287
+							array_push($root['items'], $cat);
288
+			}
284 289
 
285 290
 			$num_children = $this->calculate_children_count($root);
286 291
 			$root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
@@ -343,8 +348,9 @@  discard block
 block discarded – undo
343 348
 	private function process_category_order(&$data_map, $item_id, $parent_id = false, $nest_level = 0) {
344 349
 
345 350
 		$prefix = "";
346
-		for ($i = 0; $i < $nest_level; $i++)
347
-			$prefix .= "   ";
351
+		for ($i = 0; $i < $nest_level; $i++) {
352
+					$prefix .= "   ";
353
+		}
348 354
 
349 355
 		Debug::log("$prefix C: $item_id P: $parent_id");
350 356
 
@@ -409,8 +415,9 @@  discard block
 block discarded – undo
409 415
 		#file_put_contents("/tmp/saveorder.json", clean($_POST['payload']));
410 416
 		#$data = json_decode(file_get_contents("/tmp/saveorder.json"), true);
411 417
 
412
-		if (!is_array($data['items']))
413
-			$data['items'] = json_decode($data['items'], true);
418
+		if (!is_array($data['items'])) {
419
+					$data['items'] = json_decode($data['items'], true);
420
+		}
414 421
 
415 422
 #		print_r($data['items']);
416 423
 
@@ -499,7 +506,9 @@  discard block
 block discarded – undo
499 506
 			}
500 507
 		}
501 508
 
502
-		if (is_file($icon_file)) @unlink($icon_file);
509
+		if (is_file($icon_file)) {
510
+			@unlink($icon_file);
511
+		}
503 512
 
504 513
 		print $rc;
505 514
 		return;
@@ -595,8 +604,9 @@  discard block
 block discarded – undo
595 604
 			if (DB_TYPE == "pgsql") {
596 605
 				$feed_language = $row["feed_language"];
597 606
 
598
-				if (!$feed_language)
599
-					$feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE');
607
+				if (!$feed_language) {
608
+									$feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE');
609
+				}
600 610
 
601 611
 				print "<fieldset>";
602 612
 
@@ -1409,11 +1419,13 @@  discard block
 block discarded – undo
1409 1419
 		$obj = array();
1410 1420
 		$feed_id = (int) $feed_id;
1411 1421
 
1412
-		if (!$title)
1413
-			$title = Feeds::getFeedTitle($feed_id, false);
1422
+		if (!$title) {
1423
+					$title = Feeds::getFeedTitle($feed_id, false);
1424
+		}
1414 1425
 
1415
-		if ($unread === false)
1416
-			$unread = getFeedUnread($feed_id, false);
1426
+		if ($unread === false) {
1427
+					$unread = getFeedUnread($feed_id, false);
1428
+		}
1417 1429
 
1418 1430
 		$obj['id'] = 'FEED:' . $feed_id;
1419 1431
 		$obj['name'] = $title;
@@ -1743,7 +1755,9 @@  discard block
 block discarded – undo
1743 1755
 
1744 1756
 
1745 1757
 	private function update_feed_access_key($feed_id, $is_cat, $owner_uid = false) {
1746
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
1758
+		if (!$owner_uid) {
1759
+			$owner_uid = $_SESSION["uid"];
1760
+		}
1747 1761
 
1748 1762
 		// clear old value and generate new one
1749 1763
 		$sth = $this->pdo->prepare("DELETE FROM ttrss_access_keys
Please login to merge, or discard this patch.
classes/pref/filters.php 1 patch
Braces   +52 added lines, -25 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@  discard block
 block discarded – undo
21 21
 		#file_put_contents("/tmp/saveorder.json", clean($_POST['payload']));
22 22
 		#$data = json_decode(file_get_contents("/tmp/saveorder.json"), true);
23 23
 
24
-		if (!is_array($data['items']))
25
-			$data['items'] = json_decode($data['items'], true);
24
+		if (!is_array($data['items'])) {
25
+					$data['items'] = json_decode($data['items'], true);
26
+		}
26 27
 
27 28
 		$index = 0;
28 29
 
@@ -98,12 +99,16 @@  discard block
 block discarded – undo
98 99
 			}
99 100
 		}
100 101
 
101
-		if (count($scope_qparts) == 0) $scope_qparts = ["true"];
102
+		if (count($scope_qparts) == 0) {
103
+			$scope_qparts = ["true"];
104
+		}
102 105
 
103 106
 		$glue = $filter['match_any_rule'] ? " OR " :  " AND ";
104 107
 		$scope_qpart = join($glue, $scope_qparts);
105 108
 
106
-		if (!$scope_qpart) $scope_qpart = "true";
109
+		if (!$scope_qpart) {
110
+			$scope_qpart = "true";
111
+		}
107 112
 
108 113
 		$rv = array();
109 114
 
@@ -161,7 +166,9 @@  discard block
 block discarded – undo
161 166
 
162 167
 	function testFilter() {
163 168
 
164
-		if (isset($_REQUEST["offset"])) return $this->testFilterDo();
169
+		if (isset($_REQUEST["offset"])) {
170
+			return $this->testFilterDo();
171
+		}
165 172
 
166 173
 		//print __("Articles matching this filter:");
167 174
 
@@ -206,10 +213,11 @@  discard block
 block discarded – undo
206 213
                         $feed_id = (int)substr($feed_id, 4);
207 214
                         array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id));
208 215
                     } else {
209
-                        if ($feed_id)
210
-                            array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
211
-                        else
212
-                            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
+                        }
213 221
                     }
214 222
                 }
215 223
 
@@ -396,7 +404,9 @@  discard block
 block discarded – undo
396 404
 				unset($line["cat_id"]);
397 405
 				unset($line["filter_id"]);
398 406
 				unset($line["id"]);
399
-				if (!$line["inverse"]) unset($line["inverse"]);
407
+				if (!$line["inverse"]) {
408
+					unset($line["inverse"]);
409
+				}
400 410
 				unset($line["match_on"]);
401 411
 
402 412
 				$data = htmlspecialchars(json_encode($line));
@@ -518,12 +528,16 @@  discard block
 block discarded – undo
518 528
 	}
519 529
 
520 530
 	private function getRuleName($rule) {
521
-		if (!$rule) $rule = json_decode(clean($_REQUEST["rule"]), true);
531
+		if (!$rule) {
532
+			$rule = json_decode(clean($_REQUEST["rule"]), true);
533
+		}
522 534
 
523 535
 		$feeds = $rule["feed_id"];
524 536
 		$feeds_fmt = [];
525 537
 
526
-		if (!is_array($feeds)) $feeds = [$feeds];
538
+		if (!is_array($feeds)) {
539
+			$feeds = [$feeds];
540
+		}
527 541
 
528 542
 		foreach ($feeds as $feed_id) {
529 543
 
@@ -531,10 +545,11 @@  discard block
 block discarded – undo
531 545
                 $feed_id = (int)substr($feed_id, 4);
532 546
                 array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id));
533 547
             } else {
534
-                if ($feed_id)
535
-                    array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
536
-                else
537
-                    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
+                }
538 553
             }
539 554
         }
540 555
 
@@ -573,8 +588,9 @@  discard block
 block discarded – undo
573 588
 			$title = __($row["description"]);
574 589
 
575 590
 			if ($action["action_id"] == 4 || $action["action_id"] == 6 ||
576
-				$action["action_id"] == 7)
577
-				$title .= ": " . $action["action_param"];
591
+				$action["action_id"] == 7) {
592
+							$title .= ": " . $action["action_param"];
593
+			}
578 594
 
579 595
 			if ($action["action_id"] == 9) {
580 596
 				list ($pfclass, $pfaction) = explode(":", $action["action_param"]);
@@ -644,8 +660,12 @@  discard block
 block discarded – undo
644 660
 		$sth = $this->pdo->prepare("DELETE FROM ttrss_filters2_actions WHERE filter_id = ?");
645 661
 		$sth->execute([$filter_id]);
646 662
 
647
-		if (!is_array(clean($_REQUEST["rule"]))) $_REQUEST["rule"] = [];
648
-		if (!is_array(clean($_REQUEST["action"]))) $_REQUEST["action"] = [];
663
+		if (!is_array(clean($_REQUEST["rule"]))) {
664
+			$_REQUEST["rule"] = [];
665
+		}
666
+		if (!is_array(clean($_REQUEST["action"]))) {
667
+			$_REQUEST["action"] = [];
668
+		}
649 669
 
650 670
 		if ($filter_id) {
651 671
 			/* create rules */
@@ -1137,7 +1157,9 @@  discard block
 block discarded – undo
1137 1157
 			$match_any_rule = $row["match_any_rule"];
1138 1158
 			$inverse = $row["inverse"];
1139 1159
 
1140
-			if (!$title) $title = __("[No caption]");
1160
+			if (!$title) {
1161
+				$title = __("[No caption]");
1162
+			}
1141 1163
 
1142 1164
 			$title = sprintf(_ngettext("%s (%d rule)", "%s (%d rules)", (int) $num_rules), $title, $num_rules);
1143 1165
 
@@ -1153,11 +1175,16 @@  discard block
 block discarded – undo
1153 1175
 				$num_actions -= 1;
1154 1176
 			}
1155 1177
 
1156
-			if ($match_any_rule) $title .= " (" . __("matches any rule") . ")";
1157
-			if ($inverse) $title .= " (" . __("inverse") . ")";
1178
+			if ($match_any_rule) {
1179
+				$title .= " (" . __("matches any rule") . ")";
1180
+			}
1181
+			if ($inverse) {
1182
+				$title .= " (" . __("inverse") . ")";
1183
+			}
1158 1184
 
1159
-			if ($num_actions > 0)
1160
-				$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
+			}
1161 1188
 
1162 1189
 			return [$title, $actions];
1163 1190
 		}
Please login to merge, or discard this patch.
classes/pref/users.php 1 patch
Braces   +17 added lines, -10 removed lines patch added patch discarded remove patch
@@ -235,7 +235,10 @@  discard block
 block discarded – undo
235 235
 			$salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
236 236
 			$pwd_hash = encrypt_password($tmp_user_pwd, $salt, true);
237 237
 
238
-			if (!$login) return; // no blank usernames
238
+			if (!$login) {
239
+				return;
240
+			}
241
+			// no blank usernames
239 242
 
240 243
 			$sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE
241 244
 				login = ?");
@@ -294,10 +297,11 @@  discard block
 block discarded – undo
294 297
 
295 298
 				$message = T_sprintf("Changed password of user %s to %s", "<strong>$login</strong>", "<strong>$tmp_user_pwd</strong>");
296 299
 
297
-				if ($format_output)
298
-					print_notice($message);
299
-				else
300
-					print $message;
300
+				if ($format_output) {
301
+									print_notice($message);
302
+				} else {
303
+									print $message;
304
+				}
301 305
 
302 306
 			}
303 307
 		}
@@ -365,7 +369,9 @@  discard block
 block discarded – undo
365 369
 			$sort = $this->validate_field($sort,
366 370
 				["login", "access_level", "created", "num_feeds", "created", "last_login"], "login");
367 371
 
368
-			if ($sort != "login") $sort = "$sort DESC";
372
+			if ($sort != "login") {
373
+				$sort = "$sort DESC";
374
+			}
369 375
 
370 376
 			$sth = $this->pdo->prepare("SELECT
371 377
 					tu.id,
@@ -437,10 +443,11 @@  discard block
 block discarded – undo
437 443
 		}
438 444
 
439 445
 		function validate_field($string, $allowed, $default = "") {
440
-			if (in_array($string, $allowed))
441
-				return $string;
442
-			else
443
-				return $default;
446
+			if (in_array($string, $allowed)) {
447
+							return $string;
448
+			} else {
449
+							return $default;
450
+			}
444 451
 		}
445 452
 
446 453
 }
Please login to merge, or discard this patch.
classes/rpc.php 1 patch
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@  discard block
 block discarded – undo
11 11
 		$_SESSION["profile"] = (int) clean($_REQUEST["id"]);
12 12
 
13 13
 		// default value
14
-		if (!$_SESSION["profile"]) $_SESSION["profile"] = null;
14
+		if (!$_SESSION["profile"]) {
15
+			$_SESSION["profile"] = null;
16
+		}
15 17
 	}
16 18
 
17 19
 	function remprofiles() {
@@ -173,7 +175,9 @@  discard block
 block discarded – undo
173 175
 				if ($row = $sth->fetch()) {
174 176
 					$feed_id = $row["id"];
175 177
 				} else {
176
-					if (!$title) $title = '[Unknown]';
178
+					if (!$title) {
179
+						$title = '[Unknown]';
180
+					}
177 181
 
178 182
 					$sth = $this->pdo->prepare("INSERT INTO ttrss_feeds
179 183
 							(owner_uid,feed_url,site_url,title,cat_id,auth_login,auth_pass,update_method)
@@ -216,7 +220,9 @@  discard block
 block discarded – undo
216 220
 	private function archive_article($id, $owner_uid) {
217 221
 		$this->pdo->beginTransaction();
218 222
 
219
-		if (!$owner_uid) $owner_uid = $_SESSION['uid'];
223
+		if (!$owner_uid) {
224
+			$owner_uid = $_SESSION['uid'];
225
+		}
220 226
 
221 227
 		$sth = $this->pdo->prepare("SELECT feed_id FROM ttrss_user_entries
222 228
 			WHERE ref_id = ? AND owner_uid = ?");
@@ -278,8 +284,9 @@  discard block
 block discarded – undo
278 284
 			'seq' => $seq
279 285
 		];
280 286
 
281
-		if ($seq % 2 == 0)
282
-			$reply['runtime-info'] = make_runtime_info();
287
+		if ($seq % 2 == 0) {
288
+					$reply['runtime-info'] = make_runtime_info();
289
+		}
283 290
 
284 291
 		print json_encode($reply);
285 292
 	}
@@ -353,7 +360,9 @@  discard block
 block discarded – undo
353 360
 		$payload = json_decode(clean($_REQUEST["payload"]), false);
354 361
 		$mode = clean($_REQUEST["mode"]);
355 362
 
356
-		if (!$payload || !is_array($payload)) return;
363
+		if (!$payload || !is_array($payload)) {
364
+			return;
365
+		}
357 366
 
358 367
 		if ($mode == 1) {
359 368
 			foreach ($payload as $feed) {
Please login to merge, or discard this patch.
classes/logger.php 1 patch
Braces   +16 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,19 +22,23 @@  discard block
 block discarded – undo
22 22
 		32767		=> 'E_ALL');
23 23
 
24 24
 	function log_error($errno, $errstr, $file, $line, $context) {
25
-		if ($errno == E_NOTICE) return false;
26
-
27
-		if ($this->adapter)
28
-			return $this->adapter->log_error($errno, $errstr, $file, $line, $context);
29
-		else
25
+		if ($errno == E_NOTICE) {
30 26
 			return false;
27
+		}
28
+
29
+		if ($this->adapter) {
30
+					return $this->adapter->log_error($errno, $errstr, $file, $line, $context);
31
+		} else {
32
+					return false;
33
+		}
31 34
 	}
32 35
 
33 36
 	function log($string, $context = "") {
34
-		if ($this->adapter)
35
-			return $this->adapter->log_error(E_USER_NOTICE, $string, '', 0, $context);
36
-		else
37
-			return false;
37
+		if ($this->adapter) {
38
+					return $this->adapter->log_error(E_USER_NOTICE, $string, '', 0, $context);
39
+		} else {
40
+					return false;
41
+		}
38 42
 	}
39 43
 
40 44
 	private function __clone() {
@@ -58,8 +62,9 @@  discard block
 block discarded – undo
58 62
 	}
59 63
 
60 64
 	public static function get() {
61
-		if (self::$instance == null)
62
-			self::$instance = new self();
65
+		if (self::$instance == null) {
66
+					self::$instance = new self();
67
+		}
63 68
 
64 69
 		return self::$instance;
65 70
 	}
Please login to merge, or discard this patch.
classes/labels.php 1 patch
Braces   +24 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,11 +56,13 @@  discard block
 block discarded – undo
56 56
 	static function update_cache($owner_uid, $id, $labels = false, $force = false) {
57 57
 		$pdo = Db::pdo();
58 58
 
59
-		if ($force)
60
-			Labels::clear_cache($id);
59
+		if ($force) {
60
+					Labels::clear_cache($id);
61
+		}
61 62
 
62
-		if (!$labels)
63
-			$labels = Article::get_article_labels($id);
63
+		if (!$labels) {
64
+					$labels = Article::get_article_labels($id);
65
+		}
64 66
 
65 67
 		$labels = json_encode($labels);
66 68
 
@@ -84,7 +86,9 @@  discard block
 block discarded – undo
84 86
 
85 87
 		$label_id = Labels::find_id($label, $owner_uid);
86 88
 
87
-		if (!$label_id) return;
89
+		if (!$label_id) {
90
+			return;
91
+		}
88 92
 
89 93
 		$pdo = Db::pdo();
90 94
 
@@ -102,7 +106,9 @@  discard block
 block discarded – undo
102 106
 
103 107
 		$label_id = Labels::find_id($label, $owner_uid);
104 108
 
105
-		if (!$label_id) return;
109
+		if (!$label_id) {
110
+			return;
111
+		}
106 112
 
107 113
 		$pdo = Db::pdo();
108 114
 
@@ -128,7 +134,9 @@  discard block
 block discarded – undo
128 134
 	}
129 135
 
130 136
 	static function remove($id, $owner_uid) {
131
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
137
+		if (!$owner_uid) {
138
+			$owner_uid = $_SESSION["uid"];
139
+		}
132 140
 
133 141
 		$pdo = Db::pdo();
134 142
 		$tr_in_progress = false;
@@ -168,12 +176,16 @@  discard block
 block discarded – undo
168 176
 
169 177
 		}
170 178
 
171
-		if (!$tr_in_progress) $pdo->commit();
179
+		if (!$tr_in_progress) {
180
+			$pdo->commit();
181
+		}
172 182
 	}
173 183
 
174 184
 	static function create($caption, $fg_color = '', $bg_color = '', $owner_uid = false)	{
175 185
 
176
-		if (!$owner_uid) $owner_uid = $_SESSION['uid'];
186
+		if (!$owner_uid) {
187
+			$owner_uid = $_SESSION['uid'];
188
+		}
177 189
 
178 190
 		$pdo = Db::pdo();
179 191
 
@@ -198,7 +210,9 @@  discard block
 block discarded – undo
198 210
 			$result = $sth->rowCount();
199 211
 		}
200 212
 
201
-		if (!$tr_in_progress) $pdo->commit();
213
+		if (!$tr_in_progress) {
214
+			$pdo->commit();
215
+		}
202 216
 
203 217
 		return $result;
204 218
 	}
Please login to merge, or discard this patch.