Passed
Branch master (de5173)
by Cody
11:03
created
classes/mailer.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 				return 0;
39 39
 		}
40 40
 
41
-		$headers = [ "From: $from_combined", "Content-Type: text/plain; charset=UTF-8" ];
41
+		$headers = ["From: $from_combined", "Content-Type: text/plain; charset=UTF-8"];
42 42
 
43 43
 		return mail($to_combined, $subject, $message, implode("\r\n", array_merge($headers, $additional_headers)));
44 44
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 		$from_combined = $from_name ? "$from_name <$from_address>" : $from_address;
20 20
 		$to_combined = $to_name ? "$to_name <$to_address>" : $to_address;
21 21
 
22
-		if (defined('_LOG_SENT_MAIL') && _LOG_SENT_MAIL)
23
-			Logger::get()->log("Sending mail from $from_combined to $to_combined [$subject]: $message");
22
+		if (defined('_LOG_SENT_MAIL') && _LOG_SENT_MAIL) {
23
+					Logger::get()->log("Sending mail from $from_combined to $to_combined [$subject]: $message");
24
+		}
24 25
 
25 26
 		// HOOK_SEND_MAIL plugin instructions:
26 27
 		// 1. return 1 or true if mail is handled
@@ -31,11 +32,13 @@  discard block
 block discarded – undo
31 32
 		foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEND_MAIL) as $p) {
32 33
 			$rc = $p->hook_send_mail($this, $params);
33 34
 
34
-			if ($rc == 1)
35
-				return $rc;
35
+			if ($rc == 1) {
36
+							return $rc;
37
+			}
36 38
 
37
-			if ($rc == -1)
38
-				return 0;
39
+			if ($rc == -1) {
40
+							return 0;
41
+			}
39 42
 		}
40 43
 
41 44
 		$headers = [ "From: $from_combined", "Content-Type: text/plain; charset=UTF-8" ];
Please login to merge, or discard this patch.
classes/pluginhost.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 					!is_dir(__DIR__."/../plugins.local/$class_file")) continue;
195 195
 
196 196
 			// try system plugin directory first
197
-			$file = __DIR__ . "/../plugins/$class_file/init.php";
198
-			$vendor_dir = __DIR__ . "/../plugins/$class_file/vendor";
197
+			$file = __DIR__."/../plugins/$class_file/init.php";
198
+			$vendor_dir = __DIR__."/../plugins/$class_file/vendor";
199 199
 
200 200
 			if (!file_exists($file)) {
201
-				$file = __DIR__ . "/../plugins.local/$class_file/init.php";
202
-				$vendor_dir = __DIR__ . "/../plugins.local/$class_file/vendor";
201
+				$file = __DIR__."/../plugins.local/$class_file/init.php";
202
+				$vendor_dir = __DIR__."/../plugins.local/$class_file/vendor";
203 203
 			}
204 204
 
205 205
 			if (!isset($this->plugins[$class])) {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 								list ($namespace, $class_name) = explode('\\', $class, 2);
218 218
 
219 219
 								if ($namespace && $class_name) {
220
-									$class_file = "$vendor_dir/$namespace/" . str_replace('\\', '/', $class_name) . ".php";
220
+									$class_file = "$vendor_dir/$namespace/".str_replace('\\', '/', $class_name).".php";
221 221
 
222 222
 									if (file_exists($class_file))
223 223
 										require_once $class_file;
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 					$plugin_api = $plugin->api_version();
232 232
 
233 233
 					if ($plugin_api < PluginHost::API_VERSION) {
234
-						user_error("Plugin $class is not compatible with current API version (need: " . PluginHost::API_VERSION . ", got: $plugin_api)", E_USER_WARNING);
234
+						user_error("Plugin $class is not compatible with current API version (need: ".PluginHost::API_VERSION.", got: $plugin_api)", E_USER_WARNING);
235 235
 						continue;
236 236
 					}
237 237
 
238
-					if (file_exists(dirname($file) . "/locale")) {
239
-						_bindtextdomain($class, dirname($file) . "/locale");
238
+					if (file_exists(dirname($file)."/locale")) {
239
+						_bindtextdomain($class, dirname($file)."/locale");
240 240
 						_bind_textdomain_codeset($class, "UTF-8");
241 241
 					}
242 242
 
@@ -319,13 +319,13 @@  discard block
 block discarded – undo
319 319
 	}
320 320
 
321 321
 	function del_command($command) {
322
-		$command = "-" . strtolower($command);
322
+		$command = "-".strtolower($command);
323 323
 
324 324
 		unset($this->commands[$command]);
325 325
 	}
326 326
 
327 327
 	function lookup_command($command) {
328
-		$command = "-" . strtolower($command);
328
+		$command = "-".strtolower($command);
329 329
 
330 330
 		if (is_array($this->commands[$command])) {
331 331
 			return $this->commands[$command]["class"];
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	}
349 349
 
350 350
 	function load_data() {
351
-		if ($this->owner_uid)  {
351
+		if ($this->owner_uid) {
352 352
 			$sth = $this->pdo->prepare("SELECT name, content FROM ttrss_plugin_storage
353 353
 				WHERE owner_uid = ?");
354 354
 			$sth->execute([$this->owner_uid]);
@@ -375,13 +375,13 @@  discard block
 block discarded – undo
375 375
 			if ($sth->fetch()) {
376 376
 				$sth = $this->pdo->prepare("UPDATE ttrss_plugin_storage SET content = ?
377 377
 					WHERE owner_uid= ? AND name = ?");
378
-				$sth->execute([(string)$content, $this->owner_uid, $plugin]);
378
+				$sth->execute([(string) $content, $this->owner_uid, $plugin]);
379 379
 
380 380
 			} else {
381 381
 				$sth = $this->pdo->prepare("INSERT INTO ttrss_plugin_storage
382 382
 					(name,owner_uid,content) VALUES
383 383
 					(?, ?, ?)");
384
-				$sth->execute([$plugin, $this->owner_uid, (string)$content]);
384
+				$sth->execute([$plugin, $this->owner_uid, (string) $content]);
385 385
 			}
386 386
 
387 387
 			$this->pdo->commit();
@@ -495,8 +495,8 @@  discard block
 block discarded – undo
495 495
 	}
496 496
 
497 497
 	// handled by classes/pluginhandler.php, requires valid session
498
-	function get_method_url($sender, $method, $params)  {
499
-		return get_self_url_prefix() . "/backend.php?" .
498
+	function get_method_url($sender, $method, $params) {
499
+		return get_self_url_prefix()."/backend.php?".
500 500
 			http_build_query(
501 501
 				array_merge(
502 502
 					[
@@ -508,9 +508,9 @@  discard block
 block discarded – undo
508 508
 	}
509 509
 
510 510
 	// WARNING: endpoint in public.php, exposed to unauthenticated users
511
-	function get_public_method_url($sender, $method, $params)  {
511
+	function get_public_method_url($sender, $method, $params) {
512 512
 		if ($sender->is_public_method($method)) {
513
-			return get_self_url_prefix() . "/public.php?" .
513
+			return get_self_url_prefix()."/public.php?".
514 514
 				http_build_query(
515 515
 					array_merge(
516 516
 						[
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 						],
521 521
 						$params));
522 522
 		} else {
523
-			user_error("get_public_method_url: requested method '$method' of '" . get_class($sender) . "' is private.");
523
+			user_error("get_public_method_url: requested method '$method' of '".get_class($sender)."' is private.");
524 524
 		}
525 525
 	}
526 526
 }
Please login to merge, or discard this patch.
Braces   +36 added lines, -17 removed lines patch added patch discarded remove patch
@@ -82,8 +82,9 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 	public static function getInstance() {
85
-		if (self::$instance == null)
86
-			self::$instance = new self();
85
+		if (self::$instance == null) {
86
+					self::$instance = new self();
87
+		}
87 88
 
88 89
 		return self::$instance;
89 90
 	}
@@ -191,7 +192,9 @@  discard block
 block discarded – undo
191 192
 			$class_file = strtolower(clean_filename($class));
192 193
 
193 194
 			if (!is_dir(__DIR__."/../plugins/$class_file") &&
194
-					!is_dir(__DIR__."/../plugins.local/$class_file")) continue;
195
+					!is_dir(__DIR__."/../plugins.local/$class_file")) {
196
+				continue;
197
+			}
195 198
 
196 199
 			// try system plugin directory first
197 200
 			$file = __DIR__ . "/../plugins/$class_file/init.php";
@@ -203,7 +206,9 @@  discard block
 block discarded – undo
203 206
 			}
204 207
 
205 208
 			if (!isset($this->plugins[$class])) {
206
-				if (file_exists($file)) require_once $file;
209
+				if (file_exists($file)) {
210
+					require_once $file;
211
+				}
207 212
 
208 213
 				if (class_exists($class) && is_subclass_of($class, "Plugin")) {
209 214
 
@@ -219,8 +224,9 @@  discard block
 block discarded – undo
219 224
 								if ($namespace && $class_name) {
220 225
 									$class_file = "$vendor_dir/$namespace/" . str_replace('\\', '/', $class_name) . ".php";
221 226
 
222
-									if (file_exists($class_file))
223
-										require_once $class_file;
227
+									if (file_exists($class_file)) {
228
+																			require_once $class_file;
229
+									}
224 230
 								}
225 231
 							}
226 232
 						});
@@ -245,18 +251,24 @@  discard block
 block discarded – undo
245 251
 					switch ($kind) {
246 252
 					case $this::KIND_SYSTEM:
247 253
 						if ($this->is_system($plugin)) {
248
-							if (!$skip_init) $plugin->init($this);
254
+							if (!$skip_init) {
255
+								$plugin->init($this);
256
+							}
249 257
 							$this->register_plugin($class, $plugin);
250 258
 						}
251 259
 						break;
252 260
 					case $this::KIND_USER:
253 261
 						if (!$this->is_system($plugin)) {
254
-							if (!$skip_init) $plugin->init($this);
262
+							if (!$skip_init) {
263
+								$plugin->init($this);
264
+							}
255 265
 							$this->register_plugin($class, $plugin);
256 266
 						}
257 267
 						break;
258 268
 					case $this::KIND_ALL:
259
-						if (!$skip_init) $plugin->init($this);
269
+						if (!$skip_init) {
270
+							$plugin->init($this);
271
+						}
260 272
 						$this->register_plugin($class, $plugin);
261 273
 						break;
262 274
 					}
@@ -367,8 +379,9 @@  discard block
 block discarded – undo
367 379
 				owner_uid= ? AND name = ?");
368 380
 			$sth->execute([$this->owner_uid, $plugin]);
369 381
 
370
-			if (!isset($this->storage[$plugin]))
371
-				$this->storage[$plugin] = array();
382
+			if (!isset($this->storage[$plugin])) {
383
+							$this->storage[$plugin] = array();
384
+			}
372 385
 
373 386
 			$content = serialize($this->storage[$plugin]);
374 387
 
@@ -391,12 +404,15 @@  discard block
 block discarded – undo
391 404
 	function set($sender, $name, $value, $sync = true) {
392 405
 		$idx = get_class($sender);
393 406
 
394
-		if (!isset($this->storage[$idx]))
395
-			$this->storage[$idx] = array();
407
+		if (!isset($this->storage[$idx])) {
408
+					$this->storage[$idx] = array();
409
+		}
396 410
 
397 411
 		$this->storage[$idx][$name] = $value;
398 412
 
399
-		if ($sync) $this->save_data(get_class($sender));
413
+		if ($sync) {
414
+			$this->save_data(get_class($sender));
415
+		}
400 416
 	}
401 417
 
402 418
 	function get($sender, $name, $default_value = false) {
@@ -433,7 +449,9 @@  discard block
 block discarded – undo
433 449
 
434 450
 	// cat_id: only -1 is supported (Special)
435 451
 	function add_feed($cat_id, $title, $icon, $sender) {
436
-		if (!$this->feeds[$cat_id]) $this->feeds[$cat_id] = array();
452
+		if (!$this->feeds[$cat_id]) {
453
+			$this->feeds[$cat_id] = array();
454
+		}
437 455
 
438 456
 		$id = count($this->feeds[$cat_id]);
439 457
 
@@ -479,8 +497,9 @@  discard block
 block discarded – undo
479 497
 	function add_filter_action($sender, $action_name, $action_desc) {
480 498
 		$sender_class = get_class($sender);
481 499
 
482
-		if (!isset($this->plugin_actions[$sender_class]))
483
-			$this->plugin_actions[$sender_class] = array();
500
+		if (!isset($this->plugin_actions[$sender_class])) {
501
+					$this->plugin_actions[$sender_class] = array();
502
+		}
484 503
 
485 504
 		array_push($this->plugin_actions[$sender_class],
486 505
 			array("action" => $action_name, "description" => $action_desc, "sender" => $sender));
Please login to merge, or discard this patch.
classes/db/prefs.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		if ($type_name == "bool") {
103 103
 			return $value == "true";
104 104
 		} else if ($type_name == "integer") {
105
-			return (int)$value;
105
+			return (int) $value;
106 106
 		} else {
107 107
 			return $value;
108 108
 		}
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 					$value = "false";
150 150
 				}
151 151
 			} else if ($type_name == "integer") {
152
-				$value = (int)$value;
152
+				$value = (int) $value;
153 153
 			}
154 154
 
155 155
 			if ($pref_name == 'USER_TIMEZONE' && $value == '') {
Please login to merge, or discard this patch.
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 		$this->pdo = Db::pdo();
9 9
 		$this->cache = array();
10 10
 
11
-		if ($_SESSION["uid"]) $this->cache();
11
+		if ($_SESSION["uid"]) {
12
+			$this->cache();
13
+		}
12 14
 	}
13 15
 
14 16
 	private function __clone() {
@@ -16,8 +18,9 @@  discard block
 block discarded – undo
16 18
 	}
17 19
 
18 20
 	public static function get() {
19
-		if (self::$instance == null)
20
-			self::$instance = new self();
21
+		if (self::$instance == null) {
22
+					self::$instance = new self();
23
+		}
21 24
 
22 25
 		return self::$instance;
23 26
 	}
@@ -26,7 +29,9 @@  discard block
 block discarded – undo
26 29
 		$user_id = $_SESSION["uid"];
27 30
 		@$profile = $_SESSION["profile"];
28 31
 
29
-		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null;
32
+		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) {
33
+			$profile = null;
34
+		}
30 35
 
31 36
 		$sth = $this->pdo->prepare("SELECT
32 37
 			value,ttrss_prefs_types.type_name as type_name,ttrss_prefs.pref_name AS pref_name
@@ -65,7 +70,9 @@  discard block
 block discarded – undo
65 70
 			return $this->convert($tuple["value"], $tuple["type"]);
66 71
 		}
67 72
 
68
-		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null;
73
+		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) {
74
+			$profile = null;
75
+		}
69 76
 
70 77
 		$sth = $this->pdo->prepare("SELECT
71 78
 			value,ttrss_prefs_types.type_name as type_name
@@ -109,7 +116,9 @@  discard block
 block discarded – undo
109 116
 	}
110 117
 
111 118
 	function write($pref_name, $value, $user_id = false, $strip_tags = true) {
112
-		if ($strip_tags) $value = strip_tags($value);
119
+		if ($strip_tags) {
120
+			$value = strip_tags($value);
121
+		}
113 122
 
114 123
 		if (!$user_id) {
115 124
 			$user_id = $_SESSION["uid"];
@@ -118,7 +127,9 @@  discard block
 block discarded – undo
118 127
 			$profile = null;
119 128
 		}
120 129
 
121
-		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null;
130
+		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) {
131
+			$profile = null;
132
+		}
122 133
 
123 134
 		$type_name = "";
124 135
 		$current_value = "";
@@ -134,8 +145,9 @@  discard block
 block discarded – undo
134 145
 				WHERE pref_name = ? AND type_id = ttrss_prefs_types.id");
135 146
 			$sth->execute([$pref_name]);
136 147
 
137
-			if ($row = $sth->fetch())
138
-				$type_name = $row["type_name"];
148
+			if ($row = $sth->fetch()) {
149
+							$type_name = $row["type_name"];
150
+			}
139 151
 
140 152
 		} else if ($current_value == $value) {
141 153
 			return;
Please login to merge, or discard this patch.
classes/db/mysqli.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 			return $this->link;
16 16
 		} else {
17
-			print("Unable to connect to database (as $user to $host, database $db): " . mysqli_connect_error());
17
+			print("Unable to connect to database (as $user to $host, database $db): ".mysqli_connect_error());
18 18
 			exit(102);
19 19
 		}
20 20
 	}
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 			$this->last_error = @mysqli_error($this->link);
32 32
 
33 33
 			@mysqli_query($this->link, "ROLLBACK");
34
-			user_error("Query $query failed: " . ($this->link ? $this->last_error : "No connection"),
34
+			user_error("Query $query failed: ".($this->link ? $this->last_error : "No connection"),
35 35
 				$die_on_error ? E_USER_ERROR : E_USER_WARNING);
36 36
 		}
37 37
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,10 +4,11 @@  discard block
 block discarded – undo
4 4
 	private $last_error;
5 5
 
6 6
 	function connect($host, $user, $pass, $db, $port) {
7
-		if ($port)
8
-			$this->link = mysqli_connect($host, $user, $pass, $db, $port);
9
-		else
10
-			$this->link = mysqli_connect($host, $user, $pass, $db);
7
+		if ($port) {
8
+					$this->link = mysqli_connect($host, $user, $pass, $db, $port);
9
+		} else {
10
+					$this->link = mysqli_connect($host, $user, $pass, $db);
11
+		}
11 12
 
12 13
 		if ($this->link) {
13 14
 			$this->init();
@@ -20,7 +21,9 @@  discard block
 block discarded – undo
20 21
 	}
21 22
 
22 23
 	function escape_string($s, $strip_tags = true) {
23
-		if ($strip_tags) $s = strip_tags($s);
24
+		if ($strip_tags) {
25
+			$s = strip_tags($s);
26
+		}
24 27
 
25 28
 		return mysqli_real_escape_string($this->link, $s);
26 29
 	}
Please login to merge, or discard this patch.
classes/db/pgsql.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@  discard block
 block discarded – undo
15 15
 		}
16 16
 
17 17
 		if (is_numeric($port) && $port > 0) {
18
-			$string = "$string port=" . $port;
18
+			$string = "$string port=".$port;
19 19
 		}
20 20
 
21 21
 		$this->link = pg_connect($string);
22 22
 
23 23
 		if (!$this->link) {
24
-			print("Unable to connect to database (as $user to $host, database $db):" . pg_last_error());
24
+			print("Unable to connect to database (as $user to $host, database $db):".pg_last_error());
25 25
 			exit(102);
26 26
 		}
27 27
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 			@pg_query($this->link, "ROLLBACK");
46 46
 			$query = htmlspecialchars($query); // just in case
47
-			user_error("Query $query failed: " . ($this->link ? $this->last_error : "No connection"),
47
+			user_error("Query $query failed: ".($this->link ? $this->last_error : "No connection"),
48 48
 				$die_on_error ? E_USER_ERROR : E_USER_WARNING);
49 49
 		}
50 50
 		return $result;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@
 block discarded – undo
31 31
 	}
32 32
 
33 33
 	function escape_string($s, $strip_tags = true) {
34
-		if ($strip_tags) $s = strip_tags($s);
34
+		if ($strip_tags) {
35
+			$s = strip_tags($s);
36
+		}
35 37
 
36 38
 		return pg_escape_string($s);
37 39
 	}
Please login to merge, or discard this patch.
classes/api.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -597,7 +597,7 @@
 block discarded – undo
597 597
 								"title" => $line["title"],
598 598
 								"unread" => $unread,
599 599
 								"is_cat" => true,
600
-                                "order_id" => (int) $line["order_id"]
600
+								"order_id" => (int) $line["order_id"]
601 601
 							);
602 602
 						array_push($feeds, $row);
603 603
 					}
Please login to merge, or discard this patch.
Switch Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -218,16 +218,16 @@  discard block
 block discarded – undo
218 218
 
219 219
 			$override_order = false;
220 220
 			switch (clean($_REQUEST["order_by"])) {
221
-				case "title":
222
-					$override_order = "ttrss_entries.title, date_entered, updated";
223
-					break;
224
-				case "date_reverse":
225
-					$override_order = "score DESC, date_entered, updated";
226
-					$skip_first_id_check = true;
227
-					break;
228
-				case "feed_dates":
229
-					$override_order = "updated DESC";
230
-					break;
221
+			case "title":
222
+				$override_order = "ttrss_entries.title, date_entered, updated";
223
+				break;
224
+			case "date_reverse":
225
+				$override_order = "score DESC, date_entered, updated";
226
+				$skip_first_id_check = true;
227
+				break;
228
+			case "feed_dates":
229
+				$override_order = "updated DESC";
230
+				break;
231 231
 			}
232 232
 
233 233
 			/* do not rely on params below */
@@ -259,32 +259,32 @@  discard block
 block discarded – undo
259 259
 		$set_to = "";
260 260
 
261 261
 		switch ($field_raw) {
262
-			case 0:
263
-				$field = "marked";
264
-				$additional_fields = ",last_marked = NOW()";
265
-				break;
266
-			case 1:
267
-				$field = "published";
268
-				$additional_fields = ",last_published = NOW()";
269
-				break;
270
-			case 2:
271
-				$field = "unread";
272
-				$additional_fields = ",last_read = NOW()";
273
-				break;
274
-			case 3:
275
-				$field = "note";
262
+		case 0:
263
+			$field = "marked";
264
+			$additional_fields = ",last_marked = NOW()";
265
+			break;
266
+		case 1:
267
+			$field = "published";
268
+			$additional_fields = ",last_published = NOW()";
269
+			break;
270
+		case 2:
271
+			$field = "unread";
272
+			$additional_fields = ",last_read = NOW()";
273
+			break;
274
+		case 3:
275
+			$field = "note";
276 276
 		};
277 277
 
278 278
 		switch ($mode) {
279
-			case 1:
280
-				$set_to = "true";
281
-				break;
282
-			case 0:
283
-				$set_to = "false";
284
-				break;
285
-			case 2:
286
-				$set_to = "NOT $field";
287
-				break;
279
+		case 1:
280
+			$set_to = "true";
281
+			break;
282
+		case 0:
283
+			$set_to = "false";
284
+			break;
285
+		case 2:
286
+			$set_to = "NOT $field";
287
+			break;
288 288
 		}
289 289
 
290 290
 		if ($field == "note") $set_to = $this->pdo->quote($data);
Please login to merge, or discard this patch.
Spacing   +21 added lines, -22 removed lines patch added patch discarded remove patch
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 		}
75 75
 
76 76
 		if (get_pref("ENABLE_API_ACCESS", $uid)) {
77
-			if (authenticate_user($login, $password, false,  Auth_Base::AUTH_SERVICE_API)) {               // try login with normal password
77
+			if (authenticate_user($login, $password, false, Auth_Base::AUTH_SERVICE_API)) {               // try login with normal password
78 78
 				$this->wrap(self::STATUS_OK, array("session_id" => session_id(),
79 79
 					"api_level" => self::API_LEVEL));
80 80
 			} else if (authenticate_user($login, $password_base64, false, Auth_Base::AUTH_SERVICE_API)) { // else try with base64_decoded password
81
-				$this->wrap(self::STATUS_OK,	array("session_id" => session_id(),
81
+				$this->wrap(self::STATUS_OK, array("session_id" => session_id(),
82 82
 					"api_level" => self::API_LEVEL));
83 83
 			} else {                                                         // else we are not logged in
84 84
 				user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 			}
170 170
 		}
171 171
 
172
-		foreach (array(-2,-1,0) as $cat_id) {
172
+		foreach (array(-2, -1, 0) as $cat_id) {
173 173
 			if ($include_empty || !$this->isCategoryEmpty($cat_id)) {
174 174
 				$unread = getFeedUnread($cat_id, true);
175 175
 
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 
191 191
 			if (is_numeric($feed_id)) $feed_id = (int) $feed_id;
192 192
 
193
-			$limit = (int)clean($_REQUEST["limit"]);
193
+			$limit = (int) clean($_REQUEST["limit"]);
194 194
 
195 195
 			if (!$limit || $limit >= 200) $limit = 200;
196 196
 
197
-			$offset = (int)clean($_REQUEST["skip"]);
197
+			$offset = (int) clean($_REQUEST["skip"]);
198 198
 			$filter = clean($_REQUEST["filter"]);
199 199
 			$is_cat = API::param_to_bool(clean($_REQUEST["is_cat"]));
200 200
 			$show_excerpt = API::param_to_bool(clean($_REQUEST["show_excerpt"]));
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 			/* all_articles, unread, adaptive, marked, updated */
203 203
 			$view_mode = clean($_REQUEST["view_mode"]);
204 204
 			$include_attachments = API::param_to_bool(clean($_REQUEST["include_attachments"]));
205
-			$since_id = (int)clean($_REQUEST["since_id"]);
205
+			$since_id = (int) clean($_REQUEST["since_id"]);
206 206
 			$include_nested = API::param_to_bool(clean($_REQUEST["include_nested"]));
207 207
 			$sanitize_content = !isset($_REQUEST["sanitize"]) ||
208 208
 				API::param_to_bool($_REQUEST["sanitize"]);
209 209
 			$force_update = API::param_to_bool(clean($_REQUEST["force_update"]));
210 210
 			$has_sandbox = API::param_to_bool(clean($_REQUEST["has_sandbox"]));
211
-			$excerpt_length = (int)clean($_REQUEST["excerpt_length"]);
212
-			$check_first_id = (int)clean($_REQUEST["check_first_id"]);
211
+			$excerpt_length = (int) clean($_REQUEST["excerpt_length"]);
212
+			$check_first_id = (int) clean($_REQUEST["check_first_id"]);
213 213
 			$include_header = API::param_to_bool(clean($_REQUEST["include_header"]));
214 214
 
215 215
 			$_SESSION['hasSandbox'] = $has_sandbox;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		$article_ids = explode(",", clean($_REQUEST["article_ids"]));
254 254
 		$mode = (int) clean($_REQUEST["mode"]);
255 255
 		$data = clean($_REQUEST["data"]);
256
-		$field_raw = (int)clean($_REQUEST["field"]);
256
+		$field_raw = (int) clean($_REQUEST["field"]);
257 257
 
258 258
 		$field = "";
259 259
 		$set_to = "";
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 					"updated" => (int) strtotime($line["updated"]),
361 361
 					"feed_id" => $line["feed_id"],
362 362
 					"attachments" => $attachments,
363
-					"score" => (int)$line["score"],
363
+					"score" => (int) $line["score"],
364 364
 					"feed_title" => $line["feed_title"],
365 365
 					"note" => $line["note"],
366 366
 					"lang" => $line["lang"]
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	}
435 435
 
436 436
 	function getLabels() {
437
-		$article_id = (int)clean($_REQUEST['article_id']);
437
+		$article_id = (int) clean($_REQUEST['article_id']);
438 438
 
439 439
 		$rv = array();
440 440
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 			}
460 460
 
461 461
 			array_push($rv, array(
462
-				"id" => (int)Labels::label_to_feed_id($line['id']),
462
+				"id" => (int) Labels::label_to_feed_id($line['id']),
463 463
 				"caption" => $line['caption'],
464 464
 				"fg_color" => $line['fg_color'],
465 465
 				"bg_color" => $line['bg_color'],
@@ -644,10 +644,10 @@  discard block
 block discarded – undo
644 644
 					$row = array(
645 645
 							"feed_url" => $line["feed_url"],
646 646
 							"title" => $line["title"],
647
-							"id" => (int)$line["id"],
648
-							"unread" => (int)$unread,
647
+							"id" => (int) $line["id"],
648
+							"unread" => (int) $unread,
649 649
 							"has_icon" => $has_icon,
650
-							"cat_id" => (int)$line["cat_id"],
650
+							"cat_id" => (int) $line["cat_id"],
651 651
 							"last_updated" => (int) strtotime($line["last_updated"]),
652 652
 							"order_id" => (int) $line["order_id"],
653 653
 						);
@@ -748,12 +748,12 @@  discard block
 block discarded – undo
748 748
 					if (!is_array($labels)) $labels = Article::get_article_labels($line["id"]);
749 749
 
750 750
 					$headline_row = array(
751
-						"id" => (int)$line["id"],
751
+						"id" => (int) $line["id"],
752 752
 						"guid" => $line["guid"],
753 753
 						"unread" => API::param_to_bool($line["unread"]),
754 754
 						"marked" => API::param_to_bool($line["marked"]),
755 755
 						"published" => API::param_to_bool($line["published"]),
756
-						"updated" => (int)strtotime($line["updated"]),
756
+						"updated" => (int) strtotime($line["updated"]),
757 757
 						"is_updated" => $is_updated,
758 758
 						"title" => $line["title"],
759 759
 						"link" => $line["link"],
@@ -786,17 +786,16 @@  discard block
 block discarded – undo
786 786
 
787 787
 					$headline_row["labels"] = $labels;
788 788
 
789
-					$headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] :
790
-						$feed_title;
789
+					$headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : $feed_title;
791 790
 
792
-					$headline_row["comments_count"] = (int)$line["num_comments"];
791
+					$headline_row["comments_count"] = (int) $line["num_comments"];
793 792
 					$headline_row["comments_link"] = $line["comments"];
794 793
 
795 794
 					$headline_row["always_display_attachments"] = API::param_to_bool($line["always_display_enclosures"]);
796 795
 
797 796
 					$headline_row["author"] = $line["author"];
798 797
 
799
-					$headline_row["score"] = (int)$line["score"];
798
+					$headline_row["score"] = (int) $line["score"];
800 799
 					$headline_row["note"] = $line["note"];
801 800
 					$headline_row["lang"] = $line["lang"];
802 801
 
@@ -858,7 +857,7 @@  discard block
 block discarded – undo
858 857
 		$_REQUEST['mode'] = 2;
859 858
 		$_REQUEST['force_show_empty'] = $include_empty;
860 859
 
861
-		if ($pf){
860
+		if ($pf) {
862 861
 			$data = $pf->makefeedtree();
863 862
 			$this->wrap(self::STATUS_OK, array("categories" => $data));
864 863
 		} else {
Please login to merge, or discard this 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 3 patches
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -126,14 +126,14 @@
 block discarded – undo
126 126
 										$tmp = '';
127 127
 										foreach (str_split($keys[$i]) as $c) {
128 128
 											switch ($c) {
129
-												case '*':
130
-													$tmp .= __('Shift') . '+';
131
-													break;
132
-												case '^':
133
-													$tmp .= __('Ctrl') . '+';
134
-													break;
135
-												default:
136
-													$tmp .= $c;
129
+											case '*':
130
+												$tmp .= __('Shift') . '+';
131
+												break;
132
+											case '^':
133
+												$tmp .= __('Ctrl') . '+';
134
+												break;
135
+											default:
136
+												$tmp .= $c;
137 137
 											}
138 138
 										}
139 139
 										$keys[$i] = $tmp;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 class Backend extends Handler {
3 3
 	function loading() {
4 4
 		header("Content-type: text/html");
5
-		print __("Loading, please wait...") . " " .
5
+		print __("Loading, please wait...")." ".
6 6
 			"<img src='images/indicator_tiny.gif'>";
7 7
 	}
8 8
 
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
 
35 35
 		print "<ul class='panel panel-scrollable hotkeys-help' style='height : 300px'>";
36 36
 
37
-		print "<h2>" . __("Keyboard Shortcuts") . "</h2>";
37
+		print "<h2>".__("Keyboard Shortcuts")."</h2>";
38 38
 
39 39
 		foreach ($info as $section => $hotkeys) {
40 40
 
41 41
 			print "<li><hr></li>";
42
-			print "<li><h3>" . $section . "</h3></li>";
42
+			print "<li><h3>".$section."</h3></li>";
43 43
 
44 44
 			foreach ($hotkeys as $action => $description) {
45 45
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 					foreach ($omap[$action] as $sequence) {
48 48
 						if (strpos($sequence, "|") !== FALSE) {
49 49
 							$sequence = substr($sequence,
50
-								strpos($sequence, "|")+1,
50
+								strpos($sequence, "|") + 1,
51 51
 								strlen($sequence));
52 52
 						} else {
53 53
 							$keys = explode(" ", $sequence);
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 									foreach (str_split($keys[$i]) as $c) {
59 59
 										switch ($c) {
60 60
 										case '*':
61
-											$tmp .= __('Shift') . '+';
61
+											$tmp .= __('Shift').'+';
62 62
 											break;
63 63
 										case '^':
64
-											$tmp .= __('Ctrl') . '+';
64
+											$tmp .= __('Ctrl').'+';
65 65
 											break;
66 66
 										default:
67 67
 											$tmp .= $c;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			foreach ($info as $section => $hotkeys) {
108 108
 
109 109
 				if ($cur_section) print "<li>&nbsp;</li>";
110
-				print "<li><h3>" . $section . "</h3></li>";
110
+				print "<li><h3>".$section."</h3></li>";
111 111
 				$cur_section = $section;
112 112
 
113 113
 				foreach ($hotkeys as $action => $description) {
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 						foreach ($omap[$action] as $sequence) {
117 117
 							if (strpos($sequence, "|") !== FALSE) {
118 118
 								$sequence = substr($sequence,
119
-									strpos($sequence, "|")+1,
119
+									strpos($sequence, "|") + 1,
120 120
 									strlen($sequence));
121 121
 							} else {
122 122
 								$keys = explode(" ", $sequence);
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 										foreach (str_split($keys[$i]) as $c) {
128 128
 											switch ($c) {
129 129
 												case '*':
130
-													$tmp .= __('Shift') . '+';
130
+													$tmp .= __('Shift').'+';
131 131
 													break;
132 132
 												case '^':
133
-													$tmp .= __('Ctrl') . '+';
133
+													$tmp .= __('Ctrl').'+';
134 134
 													break;
135 135
 												default:
136 136
 													$tmp .= $c;
Please login to merge, or discard this 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/system.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 					$line[$k] = htmlspecialchars($v);
61 61
 				}
62 62
 
63
-				print "<td class='errno'>" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")</td>";
64
-				print "<td class='filename'>" . $line["filename"] . ":" . $line["lineno"] . "</td>";
65
-				print "<td class='errstr'>" . $line["errstr"] . "<hr/>" . nl2br($line["context"]) . "</td>";
66
-				print "<td class='login'>" . $line["login"] . "</td>";
63
+				print "<td class='errno'>".Logger::$errornames[$line["errno"]]." (".$line["errno"].")</td>";
64
+				print "<td class='filename'>".$line["filename"].":".$line["lineno"]."</td>";
65
+				print "<td class='errstr'>".$line["errstr"]."<hr/>".nl2br($line["context"])."</td>";
66
+				print "<td class='login'>".$line["login"]."</td>";
67 67
 
68
-				print "<td class='timestamp'>" .
68
+				print "<td class='timestamp'>".
69 69
 					make_local_datetime(
70
-					$line["created_at"], false) . "</td>";
70
+					$line["created_at"], false)."</td>";
71 71
 
72 72
 				print "</tr>";
73 73
 			}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		ob_end_clean();
91 91
 
92 92
 		print "<div class='phpinfo'>";
93
-		print preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $info);
93
+		print preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $info);
94 94
 		print "</div>";
95 95
 
96 96
 		print "</div>";
Please login to merge, or discard this patch.
classes/pref/prefs.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1060,8 +1060,8 @@
 block discarded – undo
1060 1060
 		$authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]);
1061 1061
 
1062 1062
 		if ($authenticator &&
1063
-                method_exists($authenticator, "check_password") &&
1064
-                $authenticator->check_password($_SESSION["uid"], "password")) {
1063
+				method_exists($authenticator, "check_password") &&
1064
+				$authenticator->check_password($_SESSION["uid"], "password")) {
1065 1065
 
1066 1066
 			return true;
1067 1067
 		}
Please login to merge, or discard this patch.
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -170,22 +170,22 @@
 block discarded – undo
170 170
 			$value = $_POST[$pref_name];
171 171
 
172 172
 			switch ($pref_name) {
173
-				case 'DIGEST_PREFERRED_TIME':
174
-					if (get_pref('DIGEST_PREFERRED_TIME') != $value) {
173
+			case 'DIGEST_PREFERRED_TIME':
174
+				if (get_pref('DIGEST_PREFERRED_TIME') != $value) {
175 175
 
176
-						$sth = $this->pdo->prepare("UPDATE ttrss_users SET
176
+					$sth = $this->pdo->prepare("UPDATE ttrss_users SET
177 177
 						last_digest_sent = NULL WHERE id = ?");
178
-						$sth->execute([$_SESSION['uid']]);
178
+					$sth->execute([$_SESSION['uid']]);
179 179
 
180
-					}
181
-					break;
182
-				case 'USER_LANGUAGE':
183
-					if (!$need_reload) $need_reload = $_SESSION["language"] != $value;
184
-					break;
185
-
186
-				case 'USER_CSS_THEME':
187
-					if (!$need_reload) $need_reload = get_pref($pref_name) != $value;
188
-					break;
180
+				}
181
+				break;
182
+			case 'USER_LANGUAGE':
183
+				if (!$need_reload) $need_reload = $_SESSION["language"] != $value;
184
+				break;
185
+
186
+			case 'USER_CSS_THEME':
187
+				if (!$need_reload) $need_reload = get_pref($pref_name) != $value;
188
+				break;
189 189
 			}
190 190
 
191 191
 			set_pref($pref_name, $value);
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			"ENABLE_API_ACCESS" => array(__("Enable API"), __("Allows accessing this account through the API")),
83 83
 			"ENABLE_FEED_CATS" => array(__("Enable categories")),
84 84
 			"FEEDS_SORT_BY_UNREAD" => array(__("Sort feeds by unread articles count"), ""),
85
-			"FRESH_ARTICLE_MAX_AGE" => array(__("Maximum age of fresh articles"), "<strong>" . __("hours") . "</strong>"),
85
+			"FRESH_ARTICLE_MAX_AGE" => array(__("Maximum age of fresh articles"), "<strong>".__("hours")."</strong>"),
86 86
 			"HIDE_READ_FEEDS" => array(__("Hide read feeds")),
87 87
 			"HIDE_READ_SHOWS_SPECIAL" => array(__("Always show special feeds"), __("While hiding read feeds")),
88 88
 			"LONG_DATE_FORMAT" => array(__("Long date format"), __("Syntax is identical to PHP <a href='http://php.net/manual/function.date.php'>date()</a> function.")),
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
 			if ($_SESSION["auth_module"] == "auth_internal") {
405 405
 
406
-				print "<div dojoType='dijit.layout.ContentPane' title=\"" . __('App passwords') . "\">";
406
+				print "<div dojoType='dijit.layout.ContentPane' title=\"".__('App passwords')."\">";
407 407
 
408 408
 				print_notice("You can create separate passwords for API clients. Using one is required if you enable OTP.");
409 409
 
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
 
416 416
 				print "<button style='float : left' class='alt-primary' dojoType='dijit.form.Button'
417 417
 					onclick=\"Helpers.AppPasswords.generate()\">" .
418
-					__('Generate new password') . "</button> ";
418
+					__('Generate new password')."</button> ";
419 419
 
420 420
 				print "<button style='float : left' class='alt-danger' dojoType='dijit.form.Button'
421 421
 					onclick=\"Helpers.AppPasswords.removeSelected()\">" .
422
-					__('Remove selected passwords') . "</button>";
422
+					__('Remove selected passwords')."</button>";
423 423
 
424 424
 				print "</div>"; # content pane
425 425
 			}
@@ -474,13 +474,13 @@  discard block
 block discarded – undo
474 474
 					print_notice("You will need to generate app passwords for the API clients if you enable OTP.");
475 475
 
476 476
 					if (function_exists("imagecreatefromstring")) {
477
-						print "<h3>" . __("Scan the following code by the Authenticator application or copy the key manually") . "</h3>";
477
+						print "<h3>".__("Scan the following code by the Authenticator application or copy the key manually")."</h3>";
478 478
 
479 479
 						$csrf_token = $_SESSION["csrf_token"];
480 480
 						print "<img alt='otp qr-code' src='backend.php?op=pref-prefs&method=otpqrcode&csrf_token=$csrf_token'>";
481 481
 					} else {
482 482
 						print_error("PHP GD functions are required to generate QR codes.");
483
-						print "<h3>" . __("Use the following OTP key with a compatible Authenticator application") . "</h3>";
483
+						print "<h3>".__("Use the following OTP key with a compatible Authenticator application")."</h3>";
484 484
 					}
485 485
 
486 486
 					print "<form dojoType='dijit.form.Form' id='changeOtpForm'>";
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 					print "<fieldset class='prefs'>";
648 648
 
649 649
 					print "<label for='CB_$pref_name'>";
650
-					print $item['short_desc'] . ":";
650
+					print $item['short_desc'].":";
651 651
 					print "</label>";
652 652
 
653 653
 					$value = $item['value'];
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 						print "</select>";
685 685
 
686 686
 						print " <button dojoType=\"dijit.form.Button\" class='alt-info'
687
-							onclick=\"Helpers.customizeCSS()\">" . __('Customize') . "</button>";
687
+							onclick=\"Helpers.customizeCSS()\">" . __('Customize')."</button>";
688 688
 
689 689
 						print " <button dojoType='dijit.form.Button' onclick='window.open(\"https://tt-rss.org/wiki/Themes\")'>
690 690
 							<i class='material-icons'>open_in_new</i> ".__("More themes...")."</button>";
@@ -747,12 +747,12 @@  discard block
 block discarded – undo
747 747
 						$has_serial = ($cert_serial) ? "false" : "true";
748 748
 
749 749
 						print "<button dojoType='dijit.form.Button' disabled='$has_serial'
750
-							onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '$cert_serial')\">" .
751
-							__('Register') . "</button>";
750
+							onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '$cert_serial')\">".
751
+							__('Register')."</button>";
752 752
 
753 753
 						print "<button dojoType='dijit.form.Button' class='alt-danger'
754 754
 							onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '')\">" .
755
-							__('Clear') . "</button>";
755
+							__('Clear')."</button>";
756 756
 
757 757
 						print "<button dojoType='dijit.form.Button' class='alt-info'
758 758
 							onclick='window.open(\"https://tt-rss.org/wiki/SSL%20Certificate%20Authentication\")'>
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 							id=\"$pref_name\" regexp=\"[012]?\d:\d\d\" placeHolder=\"12:00\"
764 764
 							name=\"$pref_name\" value=\"$value\">";
765 765
 
766
-						$item['help_text'] .= ". " . T_sprintf("Current server time: %s", date("H:i"));
766
+						$item['help_text'] .= ". ".T_sprintf("Current server time: %s", date("H:i"));
767 767
 					} else {
768 768
 						$regexp = ($type_name == 'integer') ? 'regexp="^\d*$"' : '';
769 769
 
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 			print_warning("Your PHP configuration has open_basedir restrictions enabled. Some plugins relying on CURL for functionality may not work correctly.");
850 850
 		}
851 851
 
852
-		$feed_handler_whitelist = [ "Af_Comics" ];
852
+		$feed_handler_whitelist = ["Af_Comics"];
853 853
 
854 854
 		$feed_handlers = array_merge(
855 855
 			PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FEED_FETCHED),
@@ -861,9 +861,9 @@  discard block
 block discarded – undo
861 861
 
862 862
 		if (count($feed_handlers) > 0) {
863 863
 			print_error(
864
-				T_sprintf("The following plugins use per-feed content hooks. This may cause excessive data usage and origin server load resulting in a ban of your instance: <b>%s</b>" ,
864
+				T_sprintf("The following plugins use per-feed content hooks. This may cause excessive data usage and origin server load resulting in a ban of your instance: <b>%s</b>",
865 865
 					implode(", ", array_map(function($plugin) { return get_class($plugin); }, $feed_handlers))
866
-				) . " (<a href='https://tt-rss.org/wiki/FeedHandlerPlugins' target='_blank'>".__("More info...")."</a>)"
866
+				)." (<a href='https://tt-rss.org/wiki/FeedHandlerPlugins' target='_blank'>".__("More info...")."</a>)"
867 867
 			);
868 868
 		}
869 869
 
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 					<label class='checkbox description text-muted' id='PLABEL-$name'>
893 893
 						<input disabled='1'
894 894
 							dojoType='dijit.form.CheckBox' $checked type='checkbox'>
895
-						".htmlspecialchars($about[1]). "</label>";
895
+						".htmlspecialchars($about[1])."</label>";
896 896
 
897 897
 					if (@$about[4]) {
898 898
 						print "<button dojoType='dijit.form.Button' class='alt-info'
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 		print "<div dojoType='fox.Toolbar'>";
1160 1160
 
1161 1161
 		print "<div dojoType='fox.form.DropDownButton'>".
1162
-				"<span>" . __('Select')."</span>";
1162
+				"<span>".__('Select')."</span>";
1163 1163
 		print "<div dojoType='dijit.Menu' style='display: none'>";
1164 1164
 		print "<div onclick=\"Tables.select('pref-profiles-list', true)\"
1165 1165
 			dojoType='dijit.MenuItem'>".__('All')."</div>";
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 			$is_active = "";
1198 1198
 		}
1199 1199
 
1200
-		print "<td width='100%'><span>" . __("Default profile") . " $is_active</span></td>";
1200
+		print "<td width='100%'><span>".__("Default profile")." $is_active</span></td>";
1201 1201
 
1202 1202
 		print "</tr>";
1203 1203
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 
1220 1220
 			print "<td><span dojoType='dijit.InlineEditBox'
1221 1221
 				width='300px' autoSave='false'
1222
-				profile-id='$profile_id'>" . $edit_title .
1222
+				profile-id='$profile_id'>".$edit_title.
1223 1223
 				"<script type='dojo/method' event='onChange' args='item'>
1224 1224
 					var elem = this;
1225 1225
 					dojo.xhrPost({
@@ -1268,13 +1268,13 @@  discard block
 block discarded – undo
1268 1268
 
1269 1269
 	private function appPasswordList() {
1270 1270
 		print "<div dojoType='fox.Toolbar'>";
1271
-		print "<div dojoType='fox.form.DropDownButton'>" .
1272
-			"<span>" . __('Select') . "</span>";
1271
+		print "<div dojoType='fox.form.DropDownButton'>".
1272
+			"<span>".__('Select')."</span>";
1273 1273
 		print "<div dojoType='dijit.Menu' style='display: none'>";
1274 1274
 		print "<div onclick=\"Tables.select('app-password-list', true)\"
1275
-				dojoType=\"dijit.MenuItem\">" . __('All') . "</div>";
1275
+				dojoType=\"dijit.MenuItem\">" . __('All')."</div>";
1276 1276
 		print "<div onclick=\"Tables.select('app-password-list', false)\"
1277
-				dojoType=\"dijit.MenuItem\">" . __('None') . "</div>";
1277
+				dojoType=\"dijit.MenuItem\">" . __('None')."</div>";
1278 1278
 		print "</div></div>";
1279 1279
 		print "</div>"; #toolbar
1280 1280
 
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 
1300 1300
 			print "<td align='center'>
1301 1301
 						<input onclick='Tables.onRowChecked(this)' dojoType='dijit.form.CheckBox' type='checkbox'></td>";
1302
-			print "<td>" . htmlspecialchars($row["title"]) . "</td>";
1302
+			print "<td>".htmlspecialchars($row["title"])."</td>";
1303 1303
 
1304 1304
 			print "<td align='right' class='text-muted'>";
1305 1305
 			print make_local_datetime($row['created'], false);
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 	private function encryptAppPassword($password) {
1320 1320
 		$salt = substr(bin2hex(get_random_bytes(24)), 0, 24);
1321 1321
 
1322
-		return "SSHA-512:".hash('sha512', $salt . $password). ":$salt";
1322
+		return "SSHA-512:".hash('sha512', $salt.$password).":$salt";
1323 1323
 	}
1324 1324
 
1325 1325
 	function deleteAppPassword() {
Please login to merge, or discard this 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.