@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | // 1) templates/register_notice.txt - displayed above the registration form |
5 | 5 | // 2) register_expire_do.php - contains user expiration queries when necessary |
6 | 6 | |
7 | - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
7 | + set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
8 | 8 | get_include_path()); |
9 | 9 | |
10 | 10 | require_once "autoload.php"; |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | |
26 | 26 | print '<?xml version="1.0" encoding="utf-8"?>'; |
27 | 27 | print "<feed xmlns=\"http://www.w3.org/2005/Atom\"> |
28 | - <id>".htmlspecialchars(SELF_URL_PATH . "/register.php")."</id> |
|
28 | + <id>".htmlspecialchars(SELF_URL_PATH."/register.php")."</id> |
|
29 | 29 | <title>Tiny Tiny RSS registration slots</title> |
30 | - <link rel=\"self\" href=\"".htmlspecialchars(SELF_URL_PATH . "/register.php?format=feed")."\"/> |
|
30 | + <link rel=\"self\" href=\"".htmlspecialchars(SELF_URL_PATH."/register.php?format=feed")."\"/> |
|
31 | 31 | <link rel=\"alternate\" href=\"".htmlspecialchars(SELF_URL_PATH)."\"/>"; |
32 | 32 | |
33 | 33 | if (ENABLE_REGISTRATION) { |
34 | - $result = db_query( "SELECT COUNT(*) AS cu FROM ttrss_users"); |
|
34 | + $result = db_query("SELECT COUNT(*) AS cu FROM ttrss_users"); |
|
35 | 35 | $num_users = db_fetch_result($result, 0, "cu"); |
36 | 36 | |
37 | 37 | $num_users = REG_MAX_USERS - $num_users; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | print "<entry> |
46 | 46 | <id>".htmlspecialchars(SELF_URL_PATH)."/register.php?$num_users"."</id> |
47 | - <link rel=\"alternate\" href=\"".htmlspecialchars(SELF_URL_PATH . "/register.php")."\"/>"; |
|
47 | + <link rel=\"alternate\" href=\"".htmlspecialchars(SELF_URL_PATH."/register.php")."\"/>"; |
|
48 | 48 | |
49 | 49 | print "<title>$num_users slots are currently available, registration $reg_suffix</title>"; |
50 | 50 | print "<summary>$num_users slots are currently available, registration $reg_suffix</summary>"; |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | /* Remove users which didn't login after receiving their registration information */ |
60 | 60 | |
61 | 61 | if (DB_TYPE == "pgsql") { |
62 | - db_query( "DELETE FROM ttrss_users WHERE last_login IS NULL |
|
62 | + db_query("DELETE FROM ttrss_users WHERE last_login IS NULL |
|
63 | 63 | AND created < NOW() - INTERVAL '1 day' AND access_level = 0"); |
64 | 64 | } else { |
65 | - db_query( "DELETE FROM ttrss_users WHERE last_login IS NULL |
|
65 | + db_query("DELETE FROM ttrss_users WHERE last_login IS NULL |
|
66 | 66 | AND created < DATE_SUB(NOW(), INTERVAL 1 DAY) AND access_level = 0"); |
67 | 67 | } |
68 | 68 | |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | if ($action == "check") { |
74 | 74 | header("Content-Type: application/xml"); |
75 | 75 | |
76 | - $login = trim(db_escape_string( $_REQUEST['login'])); |
|
76 | + $login = trim(db_escape_string($_REQUEST['login'])); |
|
77 | 77 | |
78 | - $result = db_query( "SELECT id FROM ttrss_users WHERE |
|
78 | + $result = db_query("SELECT id FROM ttrss_users WHERE |
|
79 | 79 | LOWER(login) = LOWER('$login')"); |
80 | 80 | |
81 | 81 | $is_registered = db_num_rows($result) > 0; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | ?> |
198 | 198 | |
199 | 199 | <?php if (REG_MAX_USERS > 0) { |
200 | - $result = db_query( "SELECT COUNT(*) AS cu FROM ttrss_users"); |
|
200 | + $result = db_query("SELECT COUNT(*) AS cu FROM ttrss_users"); |
|
201 | 201 | $num_users = db_fetch_result($result, 0, "cu"); |
202 | 202 | } ?> |
203 | 203 | |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | <?php } else if ($action == "do_register") { ?> |
242 | 242 | |
243 | 243 | <?php |
244 | - $login = mb_strtolower(trim(db_escape_string( $_REQUEST["login"]))); |
|
245 | - $email = trim(db_escape_string( $_REQUEST["email"])); |
|
246 | - $test = trim(db_escape_string( $_REQUEST["turing_test"])); |
|
244 | + $login = mb_strtolower(trim(db_escape_string($_REQUEST["login"]))); |
|
245 | + $email = trim(db_escape_string($_REQUEST["email"])); |
|
246 | + $test = trim(db_escape_string($_REQUEST["turing_test"])); |
|
247 | 247 | |
248 | 248 | if (!$login || !$email || !$test) { |
249 | 249 | print_error(__("Your registration information is incomplete.")); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | if ($test == "four" || $test == "4") { |
257 | 257 | |
258 | - $result = db_query( "SELECT id FROM ttrss_users WHERE |
|
258 | + $result = db_query("SELECT id FROM ttrss_users WHERE |
|
259 | 259 | login = '$login'"); |
260 | 260 | |
261 | 261 | $is_registered = db_num_rows($result) > 0; |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | $salt = substr(bin2hex(get_random_bytes(125)), 0, 250); |
273 | 273 | $pwd_hash = encrypt_password($password, $salt, true); |
274 | 274 | |
275 | - db_query( "INSERT INTO ttrss_users |
|
275 | + db_query("INSERT INTO ttrss_users |
|
276 | 276 | (login,pwd_hash,access_level,last_login, email, created, salt) |
277 | 277 | VALUES ('$login', '$pwd_hash', 0, null, '$email', NOW(), '$salt')"); |
278 | 278 | |
279 | - $result = db_query( "SELECT id FROM ttrss_users WHERE |
|
279 | + $result = db_query("SELECT id FROM ttrss_users WHERE |
|
280 | 280 | login = '$login' AND pwd_hash = '$pwd_hash'"); |
281 | 281 | |
282 | 282 | if (db_num_rows($result) != 1) { |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | $new_uid = db_fetch_result($result, 0, "id"); |
290 | 290 | |
291 | - initialize_user( $new_uid); |
|
291 | + initialize_user($new_uid); |
|
292 | 292 | |
293 | 293 | $reg_text = "Hi!\n". |
294 | 294 | "\n". |
@@ -18,7 +18,9 @@ discard block |
||
18 | 18 | |
19 | 19 | $action = $_REQUEST["action"]; |
20 | 20 | |
21 | - if (!init_plugins()) return; |
|
21 | + if (!init_plugins()) { |
|
22 | + return; |
|
23 | + } |
|
22 | 24 | |
23 | 25 | if ($_REQUEST["format"] == "feed") { |
24 | 26 | header("Content-Type: text/xml"); |
@@ -35,7 +37,9 @@ discard block |
||
35 | 37 | $num_users = db_fetch_result($result, 0, "cu"); |
36 | 38 | |
37 | 39 | $num_users = REG_MAX_USERS - $num_users; |
38 | - if ($num_users < 0) $num_users = 0; |
|
40 | + if ($num_users < 0) { |
|
41 | + $num_users = 0; |
|
42 | + } |
|
39 | 43 | $reg_suffix = "enabled"; |
40 | 44 | } else { |
41 | 45 | $num_users = 0; |
@@ -310,7 +314,9 @@ discard block |
||
310 | 314 | "subject" => "Registration information for Tiny Tiny RSS", |
311 | 315 | "message" => $reg_text]); |
312 | 316 | |
313 | - if (!$rc) print_error($mailer->error()); |
|
317 | + if (!$rc) { |
|
318 | + print_error($mailer->error()); |
|
319 | + } |
|
314 | 320 | |
315 | 321 | $reg_text = "Hi!\n". |
316 | 322 | "\n". |
@@ -324,7 +330,9 @@ discard block |
||
324 | 330 | "subject" => "Registration notice for Tiny Tiny RSS", |
325 | 331 | "message" => $reg_text]); |
326 | 332 | |
327 | - if (!$rc) print_error($mailer->error()); |
|
333 | + if (!$rc) { |
|
334 | + print_error($mailer->error()); |
|
335 | + } |
|
328 | 336 | |
329 | 337 | print_notice(__("Account created successfully.")); |
330 | 338 |
@@ -165,18 +165,18 @@ discard block |
||
165 | 165 | Debug::set_enabled(true); |
166 | 166 | |
167 | 167 | if (isset($options["log-level"])) { |
168 | - Debug::set_loglevel((int)$options["log-level"]); |
|
169 | - } |
|
168 | + Debug::set_loglevel((int)$options["log-level"]); |
|
169 | + } |
|
170 | 170 | |
171 | 171 | if (isset($options["log"])) { |
172 | 172 | Debug::set_quiet(isset($options['quiet'])); |
173 | 173 | Debug::set_logfile($options["log"]); |
174 | - Debug::log("Logging to " . $options["log"]); |
|
175 | - } else { |
|
176 | - if (isset($options['quiet'])) { |
|
174 | + Debug::log("Logging to " . $options["log"]); |
|
175 | + } else { |
|
176 | + if (isset($options['quiet'])) { |
|
177 | 177 | Debug::set_loglevel(Debug::$LOG_DISABLED); |
178 | - } |
|
179 | - } |
|
178 | + } |
|
179 | + } |
|
180 | 180 | |
181 | 181 | if (!isset($options["daemon"])) { |
182 | 182 | $lock_filename = "update.lock"; |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | if (isset($options["daemon"])) { |
230 | 230 | while (true) { |
231 | 231 | $quiet = (isset($options["quiet"])) ? "--quiet" : ""; |
232 | - $log = isset($options['log']) ? '--log '.$options['log'] : ''; |
|
233 | - $log_level = isset($options['log-level']) ? '--log-level '.$options['log-level'] : ''; |
|
232 | + $log = isset($options['log']) ? '--log '.$options['log'] : ''; |
|
233 | + $log_level = isset($options['log-level']) ? '--log-level '.$options['log-level'] : ''; |
|
234 | 234 | |
235 | 235 | passthru(PHP_EXECUTABLE . " " . $argv[0] ." --daemon-loop $quiet $log $log_level"); |
236 | 236 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | #!/usr/bin/env php |
2 | 2 | <?php |
3 | - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
3 | + set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
4 | 4 | get_include_path()); |
5 | 5 | |
6 | 6 | define('DISABLE_SESSIONS', true); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | "help"); |
89 | 89 | |
90 | 90 | foreach (PluginHost::getInstance()->get_commands() as $command => $data) { |
91 | - array_push($longopts, $command . $data["suffix"]); |
|
91 | + array_push($longopts, $command.$data["suffix"]); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | $options = getopt("", $longopts); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | exit; |
120 | 120 | } |
121 | 121 | |
122 | - if (count($options) == 0 || isset($options["help"]) ) { |
|
122 | + if (count($options) == 0 || isset($options["help"])) { |
|
123 | 123 | print "Tiny Tiny RSS data update script.\n\n"; |
124 | 124 | print "Options:\n"; |
125 | 125 | print " --feeds - update feeds\n"; |
@@ -165,13 +165,13 @@ discard block |
||
165 | 165 | Debug::set_enabled(true); |
166 | 166 | |
167 | 167 | if (isset($options["log-level"])) { |
168 | - Debug::set_loglevel((int)$options["log-level"]); |
|
168 | + Debug::set_loglevel((int) $options["log-level"]); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | if (isset($options["log"])) { |
172 | 172 | Debug::set_quiet(isset($options['quiet'])); |
173 | 173 | Debug::set_logfile($options["log"]); |
174 | - Debug::log("Logging to " . $options["log"]); |
|
174 | + Debug::log("Logging to ".$options["log"]); |
|
175 | 175 | } else { |
176 | 176 | if (isset($options['quiet'])) { |
177 | 177 | Debug::set_loglevel(Debug::$LOG_DISABLED); |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | if (isset($options["task"])) { |
188 | - Debug::log("Using task id " . $options["task"]); |
|
189 | - $lock_filename = $lock_filename . "-task_" . $options["task"]; |
|
188 | + Debug::log("Using task id ".$options["task"]); |
|
189 | + $lock_filename = $lock_filename."-task_".$options["task"]; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | if (isset($options["pidlock"])) { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | if (isset($options["force-update"])) { |
216 | 216 | Debug::log("marking all feeds as needing update..."); |
217 | 217 | |
218 | - $pdo->query( "UPDATE ttrss_feeds SET |
|
218 | + $pdo->query("UPDATE ttrss_feeds SET |
|
219 | 219 | last_update_started = '1970-01-01', last_updated = '1970-01-01'"); |
220 | 220 | } |
221 | 221 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $log = isset($options['log']) ? '--log '.$options['log'] : ''; |
233 | 233 | $log_level = isset($options['log-level']) ? '--log-level '.$options['log-level'] : ''; |
234 | 234 | |
235 | - passthru(PHP_EXECUTABLE . " " . $argv[0] ." --daemon-loop $quiet $log $log_level"); |
|
235 | + passthru(PHP_EXECUTABLE." ".$argv[0]." --daemon-loop $quiet $log $log_level"); |
|
236 | 236 | |
237 | 237 | // let's enforce a minimum spawn interval as to not forkbomb the host |
238 | 238 | $spawn_interval = max(60, DAEMON_SLEEP_INTERVAL); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | if (isset($options["cleanup-tags"])) { |
259 | - $rc = cleanup_tags( 14, 50000); |
|
259 | + $rc = cleanup_tags(14, 50000); |
|
260 | 260 | Debug::log("$rc tags deleted.\n"); |
261 | 261 | } |
262 | 262 | |
@@ -270,18 +270,18 @@ discard block |
||
270 | 270 | Debug::log("clearing existing indexes..."); |
271 | 271 | |
272 | 272 | if (DB_TYPE == "pgsql") { |
273 | - $sth = $pdo->query( "SELECT relname FROM |
|
273 | + $sth = $pdo->query("SELECT relname FROM |
|
274 | 274 | pg_catalog.pg_class WHERE relname LIKE 'ttrss_%' |
275 | 275 | AND relname NOT LIKE '%_pkey' |
276 | 276 | AND relkind = 'i'"); |
277 | 277 | } else { |
278 | - $sth = $pdo->query( "SELECT index_name,table_name FROM |
|
278 | + $sth = $pdo->query("SELECT index_name,table_name FROM |
|
279 | 279 | information_schema.statistics WHERE index_name LIKE 'ttrss_%'"); |
280 | 280 | } |
281 | 281 | |
282 | 282 | while ($line = $sth->fetch()) { |
283 | 283 | if (DB_TYPE == "pgsql") { |
284 | - $statement = "DROP INDEX " . $line["relname"]; |
|
284 | + $statement = "DROP INDEX ".$line["relname"]; |
|
285 | 285 | Debug::log($statement); |
286 | 286 | } else { |
287 | 287 | $statement = "ALTER TABLE ". |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | $pdo->query($statement); |
292 | 292 | } |
293 | 293 | |
294 | - Debug::log("reading indexes from schema for: " . DB_TYPE); |
|
294 | + Debug::log("reading indexes from schema for: ".DB_TYPE); |
|
295 | 295 | |
296 | - $fp = fopen("schema/ttrss_schema_" . DB_TYPE . ".sql", "r"); |
|
296 | + $fp = fopen("schema/ttrss_schema_".DB_TYPE.".sql", "r"); |
|
297 | 297 | if ($fp) { |
298 | 298 | while ($line = fgets($fp)) { |
299 | 299 | $matches = array(); |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | $filter = array(); |
337 | 337 | |
338 | 338 | if (sql_bool_to_bool($line["cat_filter"])) { |
339 | - $feed_id = "CAT:" . (int)$line["cat_id"]; |
|
339 | + $feed_id = "CAT:".(int) $line["cat_id"]; |
|
340 | 340 | } else { |
341 | - $feed_id = (int)$line["feed_id"]; |
|
341 | + $feed_id = (int) $line["feed_id"]; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | $filter["enabled"] = $line["enabled"] ? "on" : "off"; |
@@ -367,12 +367,12 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | if (isset($options["update-schema"])) { |
370 | - Debug::log("Checking for updates (" . DB_TYPE . ")..."); |
|
370 | + Debug::log("Checking for updates (".DB_TYPE.")..."); |
|
371 | 371 | |
372 | 372 | $updater = new DbUpdater(Db::pdo(), DB_TYPE, SCHEMA_VERSION); |
373 | 373 | |
374 | 374 | if ($updater->isUpdateRequired()) { |
375 | - Debug::log("Schema update required, version " . $updater->getSchemaVersion() . " to " . SCHEMA_VERSION); |
|
375 | + Debug::log("Schema update required, version ".$updater->getSchemaVersion()." to ".SCHEMA_VERSION); |
|
376 | 376 | |
377 | 377 | if (DB_TYPE == "mysql") |
378 | 378 | Debug::Log("READ THIS: Due to MySQL limitations, your database is not completely protected while updating.\n". |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | if (read_stdin() != 'yes') |
386 | 386 | exit; |
387 | 387 | |
388 | - Debug::log("Performing updates to version " . SCHEMA_VERSION); |
|
388 | + Debug::log("Performing updates to version ".SCHEMA_VERSION); |
|
389 | 389 | |
390 | 390 | for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) { |
391 | 391 | Debug::log("* Updating to version $i..."); |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | while (true) { |
429 | 429 | |
430 | 430 | while ($line = $sth->fetch()) { |
431 | - $tsvector_combined = mb_substr(strip_tags($line["title"] . " " . $line["content"]), 0, 1000000); |
|
431 | + $tsvector_combined = mb_substr(strip_tags($line["title"]." ".$line["content"]), 0, 1000000); |
|
432 | 432 | |
433 | 433 | $usth->execute([$tsvector_combined, $line['id']]); |
434 | 434 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | |
486 | 486 | PluginHost::getInstance()->run_commands($options); |
487 | 487 | |
488 | - if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) |
|
488 | + if (file_exists(LOCK_DIRECTORY."/$lock_filename")) |
|
489 | 489 | if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') |
490 | 490 | fclose($lock_handle); |
491 | - unlink(LOCK_DIRECTORY . "/$lock_filename"); |
|
491 | + unlink(LOCK_DIRECTORY."/$lock_filename"); |
@@ -59,8 +59,9 @@ discard block |
||
59 | 59 | return $tags_deleted; |
60 | 60 | } |
61 | 61 | |
62 | - if (!defined('PHP_EXECUTABLE')) |
|
63 | - define('PHP_EXECUTABLE', '/usr/bin/php'); |
|
62 | + if (!defined('PHP_EXECUTABLE')) { |
|
63 | + define('PHP_EXECUTABLE', '/usr/bin/php'); |
|
64 | + } |
|
64 | 65 | |
65 | 66 | $pdo = Db::pdo(); |
66 | 67 | |
@@ -249,8 +250,9 @@ discard block |
||
249 | 250 | |
250 | 251 | RSSUtils::update_daemon_common(isset($options["pidlock"]) ? 50 : DAEMON_FEED_LIMIT); |
251 | 252 | |
252 | - if (!isset($options["pidlock"]) || $options["task"] == 0) |
|
253 | - RSSUtils::housekeeping_common(true); |
|
253 | + if (!isset($options["pidlock"]) || $options["task"] == 0) { |
|
254 | + RSSUtils::housekeeping_common(true); |
|
255 | + } |
|
254 | 256 | |
255 | 257 | PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op); |
256 | 258 | } |
@@ -264,8 +266,9 @@ discard block |
||
264 | 266 | Debug::log("PLEASE BACKUP YOUR DATABASE BEFORE PROCEEDING!"); |
265 | 267 | Debug::log("Type 'yes' to continue."); |
266 | 268 | |
267 | - if (read_stdin() != 'yes') |
|
268 | - exit; |
|
269 | + if (read_stdin() != 'yes') { |
|
270 | + exit; |
|
271 | + } |
|
269 | 272 | |
270 | 273 | Debug::log("clearing existing indexes..."); |
271 | 274 | |
@@ -319,8 +322,9 @@ discard block |
||
319 | 322 | Debug::log("WARNING: this will remove all existing type2 filters."); |
320 | 323 | Debug::log("Type 'yes' to continue."); |
321 | 324 | |
322 | - if (read_stdin() != 'yes') |
|
323 | - exit; |
|
325 | + if (read_stdin() != 'yes') { |
|
326 | + exit; |
|
327 | + } |
|
324 | 328 | |
325 | 329 | Debug::log("converting filters..."); |
326 | 330 | |
@@ -374,16 +378,18 @@ discard block |
||
374 | 378 | if ($updater->isUpdateRequired()) { |
375 | 379 | Debug::log("Schema update required, version " . $updater->getSchemaVersion() . " to " . SCHEMA_VERSION); |
376 | 380 | |
377 | - if (DB_TYPE == "mysql") |
|
378 | - Debug::Log("READ THIS: Due to MySQL limitations, your database is not completely protected while updating.\n". |
|
381 | + if (DB_TYPE == "mysql") { |
|
382 | + Debug::Log("READ THIS: Due to MySQL limitations, your database is not completely protected while updating.\n". |
|
379 | 383 | "Errors may put it in an inconsistent state requiring manual rollback.\nBACKUP YOUR DATABASE BEFORE CONTINUING."); |
380 | - else |
|
381 | - Debug::log("WARNING: please backup your database before continuing."); |
|
384 | + } else { |
|
385 | + Debug::log("WARNING: please backup your database before continuing."); |
|
386 | + } |
|
382 | 387 | |
383 | 388 | Debug::log("Type 'yes' to continue."); |
384 | 389 | |
385 | - if (read_stdin() != 'yes') |
|
386 | - exit; |
|
390 | + if (read_stdin() != 'yes') { |
|
391 | + exit; |
|
392 | + } |
|
387 | 393 | |
388 | 394 | Debug::log("Performing updates to version " . SCHEMA_VERSION); |
389 | 395 | |
@@ -456,7 +462,9 @@ discard block |
||
456 | 462 | |
457 | 463 | $status = $about[3] ? "system" : "user"; |
458 | 464 | |
459 | - if (in_array($name, $enabled)) $name .= "*"; |
|
465 | + if (in_array($name, $enabled)) { |
|
466 | + $name .= "*"; |
|
467 | + } |
|
460 | 468 | |
461 | 469 | printf("%-50s %-10s v%.2f (by %s)\n%s\n\n", |
462 | 470 | $name, $status, $about[0], $about[2], $about[1]); |
@@ -469,8 +477,12 @@ discard block |
||
469 | 477 | if (isset($options["debug-feed"])) { |
470 | 478 | $feed = $options["debug-feed"]; |
471 | 479 | |
472 | - if (isset($options["force-refetch"])) $_REQUEST["force_refetch"] = true; |
|
473 | - if (isset($options["force-rehash"])) $_REQUEST["force_rehash"] = true; |
|
480 | + if (isset($options["force-refetch"])) { |
|
481 | + $_REQUEST["force_refetch"] = true; |
|
482 | + } |
|
483 | + if (isset($options["force-rehash"])) { |
|
484 | + $_REQUEST["force_rehash"] = true; |
|
485 | + } |
|
474 | 486 | |
475 | 487 | Debug::set_loglevel(Debug::$LOG_EXTENDED); |
476 | 488 | |
@@ -485,7 +497,8 @@ discard block |
||
485 | 497 | |
486 | 498 | PluginHost::getInstance()->run_commands($options); |
487 | 499 | |
488 | - if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) |
|
489 | - if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') |
|
500 | + if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) { |
|
501 | + if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') |
|
490 | 502 | fclose($lock_handle); |
503 | + } |
|
491 | 504 | unlink(LOCK_DIRECTORY . "/$lock_filename"); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
2 | + set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
3 | 3 | get_include_path()); |
4 | 4 | |
5 | 5 | $op = $_REQUEST["op"]; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | "fbexport", "logout", "pubsub"); |
17 | 17 | |
18 | 18 | if (array_search($op, $public_calls) !== false) { |
19 | - header("Location: public.php?" . $_SERVER['QUERY_STRING']); |
|
19 | + header("Location: public.php?".$_SERVER['QUERY_STRING']); |
|
20 | 20 | return; |
21 | 21 | } |
22 | 22 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | if (SINGLE_USER_MODE) { |
45 | - authenticate_user( "admin", null); |
|
45 | + authenticate_user("admin", null); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | if ($_SESSION["uid"]) { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | print error_json(6); |
52 | 52 | return; |
53 | 53 | } |
54 | - load_user_plugins( $_SESSION["uid"]); |
|
54 | + load_user_plugins($_SESSION["uid"]); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $purge_intervals = array( |
@@ -5,10 +5,11 @@ discard block |
||
5 | 5 | $op = $_REQUEST["op"]; |
6 | 6 | @$method = $_REQUEST['subop'] ? $_REQUEST['subop'] : $_REQUEST["method"]; |
7 | 7 | |
8 | - if (!$method) |
|
9 | - $method = 'index'; |
|
10 | - else |
|
11 | - $method = strtolower($method); |
|
8 | + if (!$method) { |
|
9 | + $method = 'index'; |
|
10 | + } else { |
|
11 | + $method = strtolower($method); |
|
12 | + } |
|
12 | 13 | |
13 | 14 | /* Public calls compatibility shim */ |
14 | 15 | |
@@ -33,7 +34,9 @@ discard block |
||
33 | 34 | |
34 | 35 | $script_started = microtime(true); |
35 | 36 | |
36 | - if (!init_plugins()) return; |
|
37 | + if (!init_plugins()) { |
|
38 | + return; |
|
39 | + } |
|
37 | 40 | |
38 | 41 | header("Content-Type: text/json; charset=utf-8"); |
39 | 42 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
2 | + set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
3 | 3 | get_include_path()); |
4 | 4 | |
5 | 5 | require_once "autoload.php"; |
@@ -14,7 +14,9 @@ |
||
14 | 14 | |
15 | 15 | $script_started = microtime(true); |
16 | 16 | |
17 | - if (!init_plugins()) return; |
|
17 | + if (!init_plugins()) { |
|
18 | + return; |
|
19 | + } |
|
18 | 20 | |
19 | 21 | if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) { |
20 | 22 | ob_start("ob_gzhandler"); |
@@ -33,6 +33,6 @@ |
||
33 | 33 | return Db::get()->last_query_error(); |
34 | 34 | } |
35 | 35 | |
36 | -function db_quote($str){ |
|
36 | +function db_quote($str) { |
|
37 | 37 | return Db::get()->quote($str); |
38 | 38 | } |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | function make_self_url() { |
18 | 18 | $proto = is_server_https() ? 'https' : 'http'; |
19 | 19 | |
20 | - return $proto . '://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; |
|
20 | + return $proto.'://'.$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | function make_self_url_path() { |
24 | 24 | $proto = is_server_https() ? 'https' : 'http'; |
25 | - $url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); |
|
25 | + $url_path = $proto.'://'.$_SERVER["HTTP_HOST"].parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); |
|
26 | 26 | |
27 | 27 | return $url_path; |
28 | 28 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | if (version_compare(PHP_VERSION, '5.6.0', '<')) { |
72 | - array_push($errors, "PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . "."); |
|
72 | + array_push($errors, "PHP version 5.6.0 or newer required. You're using ".PHP_VERSION."."); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if (!class_exists("UConverter")) { |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | array_push($errors, "Configuration file (config.php) has incorrect version. Update it with new options from config.php-dist and set CONFIG_VERSION to the correct value."); |
81 | 81 | } |
82 | 82 | |
83 | - if (!is_writable(CACHE_DIR . "/images")) { |
|
83 | + if (!is_writable(CACHE_DIR."/images")) { |
|
84 | 84 | array_push($errors, "Image cache is not writable (chmod -R 777 ".CACHE_DIR."/images)"); |
85 | 85 | } |
86 | 86 | |
87 | - if (!is_writable(CACHE_DIR . "/upload")) { |
|
87 | + if (!is_writable(CACHE_DIR."/upload")) { |
|
88 | 88 | array_push($errors, "Upload cache is not writable (chmod -R 777 ".CACHE_DIR."/upload)"); |
89 | 89 | } |
90 | 90 | |
91 | - if (!is_writable(CACHE_DIR . "/export")) { |
|
91 | + if (!is_writable(CACHE_DIR."/export")) { |
|
92 | 92 | array_push($errors, "Data export cache is not writable (chmod -R 777 ".CACHE_DIR."/export)"); |
93 | 93 | } |
94 | 94 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | if (isset($_SERVER["HTTP_HOST"]) && |
126 | 126 | (!defined('_SKIP_SELF_URL_PATH_CHECKS') || !_SKIP_SELF_URL_PATH_CHECKS) && |
127 | - SELF_URL_PATH != $ref_self_url_path && SELF_URL_PATH != mb_substr($ref_self_url_path, 0, mb_strlen($ref_self_url_path)-1)) { |
|
127 | + SELF_URL_PATH != $ref_self_url_path && SELF_URL_PATH != mb_substr($ref_self_url_path, 0, mb_strlen($ref_self_url_path) - 1)) { |
|
128 | 128 | array_push($errors, |
129 | 129 | "Please set SELF_URL_PATH to the correct value detected for your server: <b>$ref_self_url_path</b>"); |
130 | 130 | } |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | array_push($bad_tables_fmt, sprintf("%s (%s)", $bt['table_name'], $bt['engine'])); |
188 | 188 | } |
189 | 189 | |
190 | - $msg = "<p>The following tables use an unsupported MySQL engine: <b>" . |
|
191 | - implode(", ", $bad_tables_fmt) . "</b>.</p>"; |
|
190 | + $msg = "<p>The following tables use an unsupported MySQL engine: <b>". |
|
191 | + implode(", ", $bad_tables_fmt)."</b>.</p>"; |
|
192 | 192 | |
193 | 193 | $msg .= "<p>The only supported engine on MySQL is InnoDB. MyISAM lacks functionality to run |
194 | 194 | tt-rss. |
@@ -88,7 +88,7 @@ |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | if (SINGLE_USER_MODE && class_exists("PDO")) { |
91 | - $pdo = DB::pdo(); |
|
91 | + $pdo = DB::pdo(); |
|
92 | 92 | |
93 | 93 | $res = $pdo->query("SELECT id FROM ttrss_users WHERE id = 1"); |
94 | 94 |
@@ -15,9 +15,9 @@ |
||
15 | 15 | // 3. plugin classes are loaded by PluginHandler from plugins.local/ and plugins/ (TODO: use generic autoloader?) |
16 | 16 | |
17 | 17 | if ($namespace && $class_name) { |
18 | - $class_file = "$root_dir/vendor/$namespace/" . str_replace('\\', '/', $class_name) . ".php"; |
|
18 | + $class_file = "$root_dir/vendor/$namespace/".str_replace('\\', '/', $class_name).".php"; |
|
19 | 19 | } else { |
20 | - $class_file = "$root_dir/classes/" . str_replace("_", "/", strtolower($class)) . ".php"; |
|
20 | + $class_file = "$root_dir/classes/".str_replace("_", "/", strtolower($class)).".php"; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | if (file_exists($class_file)) |
@@ -5,8 +5,9 @@ discard block |
||
5 | 5 | $namespace = ''; |
6 | 6 | $class_name = $class; |
7 | 7 | |
8 | - if (strpos($class, '\\') !== FALSE) |
|
9 | - list ($namespace, $class_name) = explode('\\', $class, 2); |
|
8 | + if (strpos($class, '\\') !== FALSE) { |
|
9 | + list ($namespace, $class_name) = explode('\\', $class, 2); |
|
10 | + } |
|
10 | 11 | |
11 | 12 | $root_dir = dirname(__DIR__); // we're in tt-rss/include |
12 | 13 | |
@@ -20,7 +21,8 @@ discard block |
||
20 | 21 | $class_file = "$root_dir/classes/" . str_replace("_", "/", strtolower($class)) . ".php"; |
21 | 22 | } |
22 | 23 | |
23 | - if (file_exists($class_file)) |
|
24 | - include $class_file; |
|
24 | + if (file_exists($class_file)) { |
|
25 | + include $class_file; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | }); |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <?php # This file has been generated at: Thu Nov 22 22:14:43 MSK 2018 |
2 | 2 | define('GENERATED_CONFIG_CHECK', 26); |
3 | -$required_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'SPHINX_SERVER', 'SPHINX_INDEX', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'CHECK_FOR_UPDATES', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?> |
|
3 | +$required_defines = array('DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'SPHINX_SERVER', 'SPHINX_INDEX', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'CHECK_FOR_UPDATES', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?> |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | $pdo = DB::pdo(); |
78 | 78 | |
79 | - print_r(in_array("CAT:6",$default_ids)); |
|
79 | + print_r(in_array("CAT:6", $default_ids)); |
|
80 | 80 | |
81 | 81 | if (!$root_id) { |
82 | 82 | print "<select multiple=\true\" id=\"$id\" name=\"$id\" $attributes>"; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | while ($line = $sth->fetch()) { |
103 | 103 | |
104 | 104 | for ($i = 0; $i < $nest_level; $i++) |
105 | - $line["title"] = " - " . $line["title"]; |
|
105 | + $line["title"] = " - ".$line["title"]; |
|
106 | 106 | |
107 | 107 | $is_selected = in_array("CAT:".$line["id"], $default_ids) ? "selected=\"1\"" : ""; |
108 | 108 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | if ($line["num_children"] > 0) |
113 | 113 | print_feed_multi_select($id, $default_ids, $attributes, |
114 | - $include_all_feeds, $line["id"], $nest_level+1); |
|
114 | + $include_all_feeds, $line["id"], $nest_level + 1); |
|
115 | 115 | |
116 | 116 | $f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds |
117 | 117 | WHERE cat_id = ? AND owner_uid = ? ORDER BY title"); |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | while ($fline = $f_sth->fetch()) { |
122 | 122 | $is_selected = (in_array($fline["id"], $default_ids)) ? "selected=\"1\"" : ""; |
123 | 123 | |
124 | - $fline["title"] = " + " . $fline["title"]; |
|
124 | + $fline["title"] = " + ".$fline["title"]; |
|
125 | 125 | |
126 | 126 | for ($i = 0; $i < $nest_level; $i++) |
127 | - $fline["title"] = " - " . $fline["title"]; |
|
127 | + $fline["title"] = " - ".$fline["title"]; |
|
128 | 128 | |
129 | 129 | printf("<option $is_selected value='%d'>%s</option>", |
130 | 130 | $fline["id"], htmlspecialchars($fline["title"])); |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | while ($fline = $f_sth->fetch()) { |
145 | 145 | $is_selected = in_array($fline["id"], $default_ids) ? "selected=\"1\"" : ""; |
146 | 146 | |
147 | - $fline["title"] = " + " . $fline["title"]; |
|
147 | + $fline["title"] = " + ".$fline["title"]; |
|
148 | 148 | |
149 | 149 | for ($i = 0; $i < $nest_level; $i++) |
150 | - $fline["title"] = " - " . $fline["title"]; |
|
150 | + $fline["title"] = " - ".$fline["title"]; |
|
151 | 151 | |
152 | 152 | printf("<option $is_selected value='%d'>%s</option>", |
153 | 153 | $fline["id"], htmlspecialchars($fline["title"])); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | for ($i = 0; $i < $nest_level; $i++) |
207 | - $line["title"] = " - " . $line["title"]; |
|
207 | + $line["title"] = " - ".$line["title"]; |
|
208 | 208 | |
209 | 209 | if ($line["title"]) |
210 | 210 | printf("<option $is_selected value='%d'>%s</option>", |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | if ($line["num_children"] > 0) |
214 | 214 | print_feed_cat_select($id, $default_id, $attributes, |
215 | - $include_all_cats, $line["id"], $nest_level+1); |
|
215 | + $include_all_cats, $line["id"], $nest_level + 1); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | if (!$root_id) { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $query = ""; |
246 | 246 | |
247 | 247 | if (!(strpos($filename, "?") === FALSE)) { |
248 | - $query = substr($filename, strpos($filename, "?")+1); |
|
248 | + $query = substr($filename, strpos($filename, "?") + 1); |
|
249 | 249 | $filename = substr($filename, 0, strpos($filename, "?")); |
250 | 250 | } |
251 | 251 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | if ($entry) $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\" |
303 | - href=\"$url\">" . basename($url) . "</a>"; |
|
303 | + href=\"$url\">".basename($url)."</a>"; |
|
304 | 304 | |
305 | 305 | $entry .= "</div>"; |
306 | 306 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | WHERE owner_uid = ? ORDER BY caption"); |
320 | 320 | $sth->execute([$_SESSION['uid']]); |
321 | 321 | |
322 | - print "<select default=\"$value\" name=\"" . htmlspecialchars($name) . |
|
322 | + print "<select default=\"$value\" name=\"".htmlspecialchars($name). |
|
323 | 323 | "\" $attributes>"; |
324 | 324 | |
325 | 325 | while ($line = $sth->fetch()) { |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $issel = ($line["caption"] == $value) ? "selected=\"1\"" : ""; |
328 | 328 | |
329 | 329 | print "<option value=\"".htmlspecialchars($line["caption"])."\" |
330 | - $issel>" . htmlspecialchars($line["caption"]) . "</option>"; |
|
330 | + $issel>".htmlspecialchars($line["caption"])."</option>"; |
|
331 | 331 | |
332 | 332 | } |
333 | 333 |
@@ -1,14 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function print_select($id, $default, $values, $attributes = "", $name = "") { |
4 | - if (!$name) $name = $id; |
|
4 | + if (!$name) { |
|
5 | + $name = $id; |
|
6 | + } |
|
5 | 7 | |
6 | 8 | print "<select name=\"$name\" id=\"$id\" $attributes>"; |
7 | 9 | foreach ($values as $v) { |
8 | - if ($v == $default) |
|
9 | - $sel = "selected=\"1\""; |
|
10 | - else |
|
11 | - $sel = ""; |
|
10 | + if ($v == $default) { |
|
11 | + $sel = "selected=\"1\""; |
|
12 | + } else { |
|
13 | + $sel = ""; |
|
14 | + } |
|
12 | 15 | |
13 | 16 | $v = trim($v); |
14 | 17 | |
@@ -18,14 +21,17 @@ discard block |
||
18 | 21 | } |
19 | 22 | |
20 | 23 | function print_select_hash($id, $default, $values, $attributes = "", $name = "") { |
21 | - if (!$name) $name = $id; |
|
24 | + if (!$name) { |
|
25 | + $name = $id; |
|
26 | + } |
|
22 | 27 | |
23 | 28 | print "<select name=\"$name\" id='$id' $attributes>"; |
24 | 29 | foreach (array_keys($values) as $v) { |
25 | - if ($v == $default) |
|
26 | - $sel = 'selected="selected"'; |
|
27 | - else |
|
28 | - $sel = ""; |
|
30 | + if ($v == $default) { |
|
31 | + $sel = 'selected="selected"'; |
|
32 | + } else { |
|
33 | + $sel = ""; |
|
34 | + } |
|
29 | 35 | |
30 | 36 | $v = trim($v); |
31 | 37 | |
@@ -53,10 +59,11 @@ discard block |
||
53 | 59 | function print_radio($id, $default, $true_is, $values, $attributes = "") { |
54 | 60 | foreach ($values as $v) { |
55 | 61 | |
56 | - if ($v == $default) |
|
57 | - $sel = "checked"; |
|
58 | - else |
|
59 | - $sel = ""; |
|
62 | + if ($v == $default) { |
|
63 | + $sel = "checked"; |
|
64 | + } else { |
|
65 | + $sel = ""; |
|
66 | + } |
|
60 | 67 | |
61 | 68 | if ($v == $true_is) { |
62 | 69 | $sel .= " value=\"1\""; |
@@ -88,7 +95,9 @@ discard block |
||
88 | 95 | |
89 | 96 | if (get_pref('ENABLE_FEED_CATS')) { |
90 | 97 | |
91 | - if (!$root_id) $root_id = null; |
|
98 | + if (!$root_id) { |
|
99 | + $root_id = null; |
|
100 | + } |
|
92 | 101 | |
93 | 102 | $sth = $pdo->prepare("SELECT id,title, |
94 | 103 | (SELECT COUNT(id) FROM ttrss_feed_categories AS c2 WHERE |
@@ -101,17 +110,19 @@ discard block |
||
101 | 110 | |
102 | 111 | while ($line = $sth->fetch()) { |
103 | 112 | |
104 | - for ($i = 0; $i < $nest_level; $i++) |
|
105 | - $line["title"] = " - " . $line["title"]; |
|
113 | + for ($i = 0; $i < $nest_level; $i++) { |
|
114 | + $line["title"] = " - " . $line["title"]; |
|
115 | + } |
|
106 | 116 | |
107 | 117 | $is_selected = in_array("CAT:".$line["id"], $default_ids) ? "selected=\"1\"" : ""; |
108 | 118 | |
109 | 119 | printf("<option $is_selected value='CAT:%d'>%s</option>", |
110 | 120 | $line["id"], htmlspecialchars($line["title"])); |
111 | 121 | |
112 | - if ($line["num_children"] > 0) |
|
113 | - print_feed_multi_select($id, $default_ids, $attributes, |
|
122 | + if ($line["num_children"] > 0) { |
|
123 | + print_feed_multi_select($id, $default_ids, $attributes, |
|
114 | 124 | $include_all_feeds, $line["id"], $nest_level+1); |
125 | + } |
|
115 | 126 | |
116 | 127 | $f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds |
117 | 128 | WHERE cat_id = ? AND owner_uid = ? ORDER BY title"); |
@@ -123,8 +134,9 @@ discard block |
||
123 | 134 | |
124 | 135 | $fline["title"] = " + " . $fline["title"]; |
125 | 136 | |
126 | - for ($i = 0; $i < $nest_level; $i++) |
|
127 | - $fline["title"] = " - " . $fline["title"]; |
|
137 | + for ($i = 0; $i < $nest_level; $i++) { |
|
138 | + $fline["title"] = " - " . $fline["title"]; |
|
139 | + } |
|
128 | 140 | |
129 | 141 | printf("<option $is_selected value='%d'>%s</option>", |
130 | 142 | $fline["id"], htmlspecialchars($fline["title"])); |
@@ -146,8 +158,9 @@ discard block |
||
146 | 158 | |
147 | 159 | $fline["title"] = " + " . $fline["title"]; |
148 | 160 | |
149 | - for ($i = 0; $i < $nest_level; $i++) |
|
150 | - $fline["title"] = " - " . $fline["title"]; |
|
161 | + for ($i = 0; $i < $nest_level; $i++) { |
|
162 | + $fline["title"] = " - " . $fline["title"]; |
|
163 | + } |
|
151 | 164 | |
152 | 165 | printf("<option $is_selected value='%d'>%s</option>", |
153 | 166 | $fline["id"], htmlspecialchars($fline["title"])); |
@@ -182,7 +195,9 @@ discard block |
||
182 | 195 | |
183 | 196 | $pdo = DB::pdo(); |
184 | 197 | |
185 | - if (!$root_id) $root_id = null; |
|
198 | + if (!$root_id) { |
|
199 | + $root_id = null; |
|
200 | + } |
|
186 | 201 | |
187 | 202 | $sth = $pdo->prepare("SELECT id,title, |
188 | 203 | (SELECT COUNT(id) FROM ttrss_feed_categories AS c2 WHERE |
@@ -203,16 +218,19 @@ discard block |
||
203 | 218 | $is_selected = ""; |
204 | 219 | } |
205 | 220 | |
206 | - for ($i = 0; $i < $nest_level; $i++) |
|
207 | - $line["title"] = " - " . $line["title"]; |
|
221 | + for ($i = 0; $i < $nest_level; $i++) { |
|
222 | + $line["title"] = " - " . $line["title"]; |
|
223 | + } |
|
208 | 224 | |
209 | - if ($line["title"]) |
|
210 | - printf("<option $is_selected value='%d'>%s</option>", |
|
225 | + if ($line["title"]) { |
|
226 | + printf("<option $is_selected value='%d'>%s</option>", |
|
211 | 227 | $line["id"], htmlspecialchars($line["title"])); |
228 | + } |
|
212 | 229 | |
213 | - if ($line["num_children"] > 0) |
|
214 | - print_feed_cat_select($id, $default_id, $attributes, |
|
230 | + if ($line["num_children"] > 0) { |
|
231 | + print_feed_cat_select($id, $default_id, $attributes, |
|
215 | 232 | $include_all_cats, $line["id"], $nest_level+1); |
233 | + } |
|
216 | 234 | } |
217 | 235 | |
218 | 236 | if (!$root_id) { |
@@ -251,7 +269,9 @@ discard block |
||
251 | 269 | |
252 | 270 | $timestamp = filemtime($filename); |
253 | 271 | |
254 | - if ($query) $timestamp .= "&$query"; |
|
272 | + if ($query) { |
|
273 | + $timestamp .= "&$query"; |
|
274 | + } |
|
255 | 275 | |
256 | 276 | return "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n"; |
257 | 277 | } |
@@ -299,8 +319,10 @@ discard block |
||
299 | 319 | |
300 | 320 | } |
301 | 321 | |
302 | - if ($entry) $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\" |
|
322 | + if ($entry) { |
|
323 | + $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\" |
|
303 | 324 | href=\"$url\">" . basename($url) . "</a>"; |
325 | + } |
|
304 | 326 | |
305 | 327 | $entry .= "</div>"; |
306 | 328 |