@@ -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 |
@@ -37,7 +37,9 @@ discard block |
||
37 | 37 | // fallback on HTTP parameters |
38 | 38 | if ($input) { |
39 | 39 | $input = json_decode($input, true); |
40 | - if ($input) $_REQUEST = $input; |
|
40 | + if ($input) { |
|
41 | + $_REQUEST = $input; |
|
42 | + } |
|
41 | 43 | } |
42 | 44 | } else { |
43 | 45 | // Accept JSON only |
@@ -54,7 +56,9 @@ discard block |
||
54 | 56 | |
55 | 57 | startup_gettext(); |
56 | 58 | |
57 | - if (!init_plugins()) return; |
|
59 | + if (!init_plugins()) { |
|
60 | + return; |
|
61 | + } |
|
58 | 62 | |
59 | 63 | if ($_SESSION["uid"]) { |
60 | 64 | if (!validate_session()) { |
@@ -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"); |
@@ -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 |
@@ -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"); |
@@ -37,7 +37,9 @@ |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | function validate_session() { |
40 | - if (SINGLE_USER_MODE) return true; |
|
40 | + if (SINGLE_USER_MODE) { |
|
41 | + return true; |
|
42 | + } |
|
41 | 43 | |
42 | 44 | if (isset($_SESSION["ref_schema_version"]) && $_SESSION["ref_schema_version"] != session_get_schema_version()) { |
43 | 45 | $_SESSION["login_error_msg"] = |
@@ -18,7 +18,9 @@ discard block |
||
18 | 18 | libxml_use_internal_errors(true); |
19 | 19 | |
20 | 20 | // separate test because this is included before sanity checks |
21 | - if (function_exists("mb_internal_encoding")) mb_internal_encoding("UTF-8"); |
|
21 | + if (function_exists("mb_internal_encoding")) { |
|
22 | + mb_internal_encoding("UTF-8"); |
|
23 | + } |
|
22 | 24 | |
23 | 25 | date_default_timezone_set('UTC'); |
24 | 26 | if (defined('E_DEPRECATED')) { |
@@ -194,8 +196,9 @@ discard block |
||
194 | 196 | $fetch_last_modified = ""; |
195 | 197 | $fetch_effective_url = ""; |
196 | 198 | |
197 | - if (!is_array($fetch_domain_hits)) |
|
198 | - $fetch_domain_hits = []; |
|
199 | + if (!is_array($fetch_domain_hits)) { |
|
200 | + $fetch_domain_hits = []; |
|
201 | + } |
|
199 | 202 | |
200 | 203 | if (!is_array($options)) { |
201 | 204 | |
@@ -237,8 +240,9 @@ discard block |
||
237 | 240 | $url = ltrim($url, ' '); |
238 | 241 | $url = str_replace(' ', '%20', $url); |
239 | 242 | |
240 | - if (strpos($url, "//") === 0) |
|
241 | - $url = 'http:' . $url; |
|
243 | + if (strpos($url, "//") === 0) { |
|
244 | + $url = 'http:' . $url; |
|
245 | + } |
|
242 | 246 | |
243 | 247 | $url_host = parse_url($url, PHP_URL_HOST); |
244 | 248 | $fetch_domain_hits[$url_host] += 1; |
@@ -256,14 +260,17 @@ discard block |
||
256 | 260 | |
257 | 261 | $curl_http_headers = []; |
258 | 262 | |
259 | - if ($last_modified && !$post_query) |
|
260 | - array_push($curl_http_headers, "If-Modified-Since: $last_modified"); |
|
263 | + if ($last_modified && !$post_query) { |
|
264 | + array_push($curl_http_headers, "If-Modified-Since: $last_modified"); |
|
265 | + } |
|
261 | 266 | |
262 | - if ($http_accept) |
|
263 | - array_push($curl_http_headers, "Accept: " . $http_accept); |
|
267 | + if ($http_accept) { |
|
268 | + array_push($curl_http_headers, "Accept: " . $http_accept); |
|
269 | + } |
|
264 | 270 | |
265 | - if (count($curl_http_headers) > 0) |
|
266 | - curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_http_headers); |
|
271 | + if (count($curl_http_headers) > 0) { |
|
272 | + curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_http_headers); |
|
273 | + } |
|
267 | 274 | |
268 | 275 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout ? $timeout : FILE_FETCH_CONNECT_TIMEOUT); |
269 | 276 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout ? $timeout : FILE_FETCH_TIMEOUT); |
@@ -277,8 +284,9 @@ discard block |
||
277 | 284 | SELF_USER_AGENT); |
278 | 285 | curl_setopt($ch, CURLOPT_ENCODING, ""); |
279 | 286 | |
280 | - if ($http_referrer) |
|
281 | - curl_setopt($ch, CURLOPT_REFERER, $http_referrer); |
|
287 | + if ($http_referrer) { |
|
288 | + curl_setopt($ch, CURLOPT_REFERER, $http_referrer); |
|
289 | + } |
|
282 | 290 | |
283 | 291 | if ($max_size) { |
284 | 292 | curl_setopt($ch, CURLOPT_NOPROGRESS, false); |
@@ -307,8 +315,9 @@ discard block |
||
307 | 315 | curl_setopt($ch, CURLOPT_POSTFIELDS, $post_query); |
308 | 316 | } |
309 | 317 | |
310 | - if ($login && $pass) |
|
311 | - curl_setopt($ch, CURLOPT_USERPWD, "$login:$pass"); |
|
318 | + if ($login && $pass) { |
|
319 | + curl_setopt($ch, CURLOPT_USERPWD, "$login:$pass"); |
|
320 | + } |
|
312 | 321 | |
313 | 322 | $ret = @curl_exec($ch); |
314 | 323 | |
@@ -367,7 +376,9 @@ discard block |
||
367 | 376 | if ($is_gzipped) { |
368 | 377 | $tmp = @gzdecode($contents); |
369 | 378 | |
370 | - if ($tmp) $contents = $tmp; |
|
379 | + if ($tmp) { |
|
380 | + $contents = $tmp; |
|
381 | + } |
|
371 | 382 | } |
372 | 383 | |
373 | 384 | return $contents; |
@@ -400,14 +411,17 @@ discard block |
||
400 | 411 | 'protocol_version'=> 1.1) |
401 | 412 | ); |
402 | 413 | |
403 | - if (!$post_query && $last_modified) |
|
404 | - array_push($context_options['http']['header'], "If-Modified-Since: $last_modified"); |
|
414 | + if (!$post_query && $last_modified) { |
|
415 | + array_push($context_options['http']['header'], "If-Modified-Since: $last_modified"); |
|
416 | + } |
|
405 | 417 | |
406 | - if ($http_accept) |
|
407 | - array_push($context_options['http']['header'], "Accept: $http_accept"); |
|
418 | + if ($http_accept) { |
|
419 | + array_push($context_options['http']['header'], "Accept: $http_accept"); |
|
420 | + } |
|
408 | 421 | |
409 | - if ($http_referrer) |
|
410 | - array_push($context_options['http']['header'], "Referer: $http_referrer"); |
|
422 | + if ($http_referrer) { |
|
423 | + array_push($context_options['http']['header'], "Referer: $http_referrer"); |
|
424 | + } |
|
411 | 425 | |
412 | 426 | if (defined('_HTTP_PROXY')) { |
413 | 427 | $context_options['http']['request_fulluri'] = true; |
@@ -464,7 +478,9 @@ discard block |
||
464 | 478 | if ($is_gzipped) { |
465 | 479 | $tmp = @gzdecode($data); |
466 | 480 | |
467 | - if ($tmp) $data = $tmp; |
|
481 | + if ($tmp) { |
|
482 | + $data = $tmp; |
|
483 | + } |
|
468 | 484 | } |
469 | 485 | |
470 | 486 | return $data; |
@@ -474,7 +490,9 @@ discard block |
||
474 | 490 | |
475 | 491 | function initialize_user_prefs($uid, $profile = false) { |
476 | 492 | |
477 | - if (get_schema_version() < 63) $profile_qpart = ""; |
|
493 | + if (get_schema_version() < 63) { |
|
494 | + $profile_qpart = ""; |
|
495 | + } |
|
478 | 496 | |
479 | 497 | $pdo = DB::pdo(); |
480 | 498 | $in_nested_tr = false; |
@@ -487,7 +505,9 @@ discard block |
||
487 | 505 | |
488 | 506 | $sth = $pdo->query("SELECT pref_name,def_value FROM ttrss_prefs"); |
489 | 507 | |
490 | - if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null; |
|
508 | + if (!is_numeric($profile) || !$profile || get_schema_version() < 63) { |
|
509 | + $profile = null; |
|
510 | + } |
|
491 | 511 | |
492 | 512 | $u_sth = $pdo->prepare("SELECT pref_name |
493 | 513 | FROM ttrss_user_prefs WHERE owner_uid = :uid AND |
@@ -520,7 +540,9 @@ discard block |
||
520 | 540 | } |
521 | 541 | } |
522 | 542 | |
523 | - if (!$in_nested_tr) $pdo->commit(); |
|
543 | + if (!$in_nested_tr) { |
|
544 | + $pdo->commit(); |
|
545 | + } |
|
524 | 546 | |
525 | 547 | } |
526 | 548 | |
@@ -680,7 +702,9 @@ discard block |
||
680 | 702 | |
681 | 703 | function load_user_plugins($owner_uid, $pluginhost = false) { |
682 | 704 | |
683 | - if (!$pluginhost) $pluginhost = PluginHost::getInstance(); |
|
705 | + if (!$pluginhost) { |
|
706 | + $pluginhost = PluginHost::getInstance(); |
|
707 | + } |
|
684 | 708 | |
685 | 709 | if ($owner_uid && SCHEMA_VERSION >= 100) { |
686 | 710 | $plugins = get_pref("_ENABLED_PLUGINS", $owner_uid); |
@@ -702,7 +726,9 @@ discard block |
||
702 | 726 | startup_gettext(); |
703 | 727 | load_user_plugins($_SESSION["uid"]); |
704 | 728 | } else { |
705 | - if (!validate_session()) $_SESSION["uid"] = false; |
|
729 | + if (!validate_session()) { |
|
730 | + $_SESSION["uid"] = false; |
|
731 | + } |
|
706 | 732 | |
707 | 733 | if (!$_SESSION["uid"]) { |
708 | 734 | |
@@ -797,13 +823,19 @@ discard block |
||
797 | 823 | function make_local_datetime($timestamp, $long, $owner_uid = false, |
798 | 824 | $no_smart_dt = false, $eta_min = false) { |
799 | 825 | |
800 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
801 | - if (!$timestamp) $timestamp = '1970-01-01 0:00'; |
|
826 | + if (!$owner_uid) { |
|
827 | + $owner_uid = $_SESSION['uid']; |
|
828 | + } |
|
829 | + if (!$timestamp) { |
|
830 | + $timestamp = '1970-01-01 0:00'; |
|
831 | + } |
|
802 | 832 | |
803 | 833 | global $utc_tz; |
804 | 834 | global $user_tz; |
805 | 835 | |
806 | - if (!$utc_tz) $utc_tz = new DateTimeZone('UTC'); |
|
836 | + if (!$utc_tz) { |
|
837 | + $utc_tz = new DateTimeZone('UTC'); |
|
838 | + } |
|
807 | 839 | |
808 | 840 | $timestamp = substr($timestamp, 0, 19); |
809 | 841 | |
@@ -815,7 +847,9 @@ discard block |
||
815 | 847 | if ($user_tz_string != 'Automatic') { |
816 | 848 | |
817 | 849 | try { |
818 | - if (!$user_tz) $user_tz = new DateTimeZone($user_tz_string); |
|
850 | + if (!$user_tz) { |
|
851 | + $user_tz = new DateTimeZone($user_tz_string); |
|
852 | + } |
|
819 | 853 | } catch (Exception $e) { |
820 | 854 | $user_tz = $utc_tz; |
821 | 855 | } |
@@ -831,26 +865,30 @@ discard block |
||
831 | 865 | return smart_date_time($user_timestamp, |
832 | 866 | $tz_offset, $owner_uid, $eta_min); |
833 | 867 | } else { |
834 | - if ($long) |
|
835 | - $format = get_pref('LONG_DATE_FORMAT', $owner_uid); |
|
836 | - else |
|
837 | - $format = get_pref('SHORT_DATE_FORMAT', $owner_uid); |
|
868 | + if ($long) { |
|
869 | + $format = get_pref('LONG_DATE_FORMAT', $owner_uid); |
|
870 | + } else { |
|
871 | + $format = get_pref('SHORT_DATE_FORMAT', $owner_uid); |
|
872 | + } |
|
838 | 873 | |
839 | 874 | return date($format, $user_timestamp); |
840 | 875 | } |
841 | 876 | } |
842 | 877 | |
843 | 878 | function smart_date_time($timestamp, $tz_offset = 0, $owner_uid = false, $eta_min = false) { |
844 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
879 | + if (!$owner_uid) { |
|
880 | + $owner_uid = $_SESSION['uid']; |
|
881 | + } |
|
845 | 882 | |
846 | 883 | if ($eta_min && time() + $tz_offset - $timestamp < 3600) { |
847 | 884 | return T_sprintf("%d min", date("i", time() + $tz_offset - $timestamp)); |
848 | 885 | } else if (date("Y.m.d", $timestamp) == date("Y.m.d", time() + $tz_offset)) { |
849 | 886 | $format = get_pref('SHORT_DATE_FORMAT', $owner_uid); |
850 | - if (strpos((strtolower($format)), "a") === false) |
|
851 | - return date("G:i", $timestamp); |
|
852 | - else |
|
853 | - return date("g:i a", $timestamp); |
|
887 | + if (strpos((strtolower($format)), "a") === false) { |
|
888 | + return date("G:i", $timestamp); |
|
889 | + } else { |
|
890 | + return date("g:i a", $timestamp); |
|
891 | + } |
|
854 | 892 | } else if (date("Y", $timestamp) == date("Y", time() + $tz_offset)) { |
855 | 893 | $format = get_pref('SHORT_DATE_FORMAT', $owner_uid); |
856 | 894 | return date($format, $timestamp); |
@@ -1261,8 +1299,9 @@ discard block |
||
1261 | 1299 | |
1262 | 1300 | if ($src) { |
1263 | 1301 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_IFRAME_WHITELISTED) as $plugin) { |
1264 | - if ($plugin->hook_iframe_whitelisted($src)) |
|
1265 | - return true; |
|
1302 | + if ($plugin->hook_iframe_whitelisted($src)) { |
|
1303 | + return true; |
|
1304 | + } |
|
1266 | 1305 | } |
1267 | 1306 | } |
1268 | 1307 | |
@@ -1270,9 +1309,13 @@ discard block |
||
1270 | 1309 | } |
1271 | 1310 | |
1272 | 1311 | function sanitize($str, $force_remove_images = false, $owner = false, $site_url = false, $highlight_words = false, $article_id = false) { |
1273 | - if (!$owner) $owner = $_SESSION["uid"]; |
|
1312 | + if (!$owner) { |
|
1313 | + $owner = $_SESSION["uid"]; |
|
1314 | + } |
|
1274 | 1315 | |
1275 | - $res = trim($str); if (!$res) return ''; |
|
1316 | + $res = trim($str); if (!$res) { |
|
1317 | + return ''; |
|
1318 | + } |
|
1276 | 1319 | |
1277 | 1320 | $doc = new DOMDocument(); |
1278 | 1321 | $doc->loadHTML('<?xml encoding="UTF-8">' . $res); |
@@ -1334,13 +1377,15 @@ discard block |
||
1334 | 1377 | |
1335 | 1378 | if ($entry->nodeName == 'source') { |
1336 | 1379 | |
1337 | - if ($entry->parentNode && $entry->parentNode->parentNode) |
|
1338 | - $entry->parentNode->parentNode->replaceChild($p, $entry->parentNode); |
|
1380 | + if ($entry->parentNode && $entry->parentNode->parentNode) { |
|
1381 | + $entry->parentNode->parentNode->replaceChild($p, $entry->parentNode); |
|
1382 | + } |
|
1339 | 1383 | |
1340 | 1384 | } else if ($entry->nodeName == 'img') { |
1341 | 1385 | |
1342 | - if ($entry->parentNode) |
|
1343 | - $entry->parentNode->replaceChild($p, $entry); |
|
1386 | + if ($entry->parentNode) { |
|
1387 | + $entry->parentNode->replaceChild($p, $entry); |
|
1388 | + } |
|
1344 | 1389 | |
1345 | 1390 | } |
1346 | 1391 | } |
@@ -1376,7 +1421,9 @@ discard block |
||
1376 | 1421 | 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'time', |
1377 | 1422 | 'tr', 'track', 'tt', 'u', 'ul', 'var', 'wbr', 'video', 'xml:namespace' ); |
1378 | 1423 | |
1379 | - if ($_SESSION['hasSandbox']) $allowed_elements[] = 'iframe'; |
|
1424 | + if ($_SESSION['hasSandbox']) { |
|
1425 | + $allowed_elements[] = 'iframe'; |
|
1426 | + } |
|
1380 | 1427 | |
1381 | 1428 | $disallowed_attributes = array('id', 'style', 'class'); |
1382 | 1429 | |
@@ -1416,7 +1463,9 @@ discard block |
||
1416 | 1463 | $text = mb_substr($text, $pos + mb_strlen($word)); |
1417 | 1464 | } |
1418 | 1465 | |
1419 | - if (!empty($text)) $fragment->appendChild(new DomText($text)); |
|
1466 | + if (!empty($text)) { |
|
1467 | + $fragment->appendChild(new DomText($text)); |
|
1468 | + } |
|
1420 | 1469 | |
1421 | 1470 | $child->parentNode->replaceChild($fragment, $child); |
1422 | 1471 | } |
@@ -1697,8 +1746,9 @@ discard block |
||
1697 | 1746 | } else { |
1698 | 1747 | $output = ""; |
1699 | 1748 | |
1700 | - for ($i = 0; $i < $length; $i++) |
|
1701 | - $output .= chr(mt_rand(0, 255)); |
|
1749 | + for ($i = 0; $i < $length; $i++) { |
|
1750 | + $output .= chr(mt_rand(0, 255)); |
|
1751 | + } |
|
1702 | 1752 | |
1703 | 1753 | return $output; |
1704 | 1754 | } |
@@ -1769,14 +1819,19 @@ discard block |
||
1769 | 1819 | } |
1770 | 1820 | |
1771 | 1821 | function get_theme_path($theme) { |
1772 | - if ($theme == "default.php") |
|
1773 | - return "css/default.css"; |
|
1822 | + if ($theme == "default.php") { |
|
1823 | + return "css/default.css"; |
|
1824 | + } |
|
1774 | 1825 | |
1775 | 1826 | $check = "themes/$theme"; |
1776 | - if (file_exists($check)) return $check; |
|
1827 | + if (file_exists($check)) { |
|
1828 | + return $check; |
|
1829 | + } |
|
1777 | 1830 | |
1778 | 1831 | $check = "themes.local/$theme"; |
1779 | - if (file_exists($check)) return $check; |
|
1832 | + if (file_exists($check)) { |
|
1833 | + return $check; |
|
1834 | + } |
|
1780 | 1835 | } |
1781 | 1836 | |
1782 | 1837 | function theme_exists($theme) { |
@@ -1840,7 +1895,9 @@ discard block |
||
1840 | 1895 | function send_local_file($filename) { |
1841 | 1896 | if (file_exists($filename)) { |
1842 | 1897 | |
1843 | - if (is_writable($filename)) touch($filename); |
|
1898 | + if (is_writable($filename)) { |
|
1899 | + touch($filename); |
|
1900 | + } |
|
1844 | 1901 | |
1845 | 1902 | $tmppluginhost = new PluginHost(); |
1846 | 1903 | |
@@ -1848,7 +1905,9 @@ discard block |
||
1848 | 1905 | $tmppluginhost->load_data(); |
1849 | 1906 | |
1850 | 1907 | foreach ($tmppluginhost->get_hooks(PluginHost::HOOK_SEND_LOCAL_FILE) as $plugin) { |
1851 | - if ($plugin->hook_send_local_file($filename)) return true; |
|
1908 | + if ($plugin->hook_send_local_file($filename)) { |
|
1909 | + return true; |
|
1910 | + } |
|
1852 | 1911 | } |
1853 | 1912 | |
1854 | 1913 | $mimetype = mime_content_type($filename); |
@@ -1856,8 +1915,9 @@ discard block |
||
1856 | 1915 | // this is hardly ideal but 1) only media is cached in images/ and 2) seemingly only mp4 |
1857 | 1916 | // video files are detected as octet-stream by mime_content_type() |
1858 | 1917 | |
1859 | - if ($mimetype == "application/octet-stream") |
|
1860 | - $mimetype = "video/mp4"; |
|
1918 | + if ($mimetype == "application/octet-stream") { |
|
1919 | + $mimetype = "video/mp4"; |
|
1920 | + } |
|
1861 | 1921 | |
1862 | 1922 | header("Content-type: $mimetype"); |
1863 | 1923 | |
@@ -1880,7 +1940,9 @@ discard block |
||
1880 | 1940 | |
1881 | 1941 | foreach ($files as $file) { |
1882 | 1942 | $file_ts = filemtime($file); |
1883 | - if ($file_ts > $ts) $ts = $file_ts; |
|
1943 | + if ($file_ts > $ts) { |
|
1944 | + $ts = $file_ts; |
|
1945 | + } |
|
1884 | 1946 | } |
1885 | 1947 | |
1886 | 1948 | return $ts; |
@@ -1893,8 +1955,9 @@ discard block |
||
1893 | 1955 | function get_version(&$git_commit = false, &$git_timestamp = false) { |
1894 | 1956 | global $ttrss_version; |
1895 | 1957 | |
1896 | - if (isset($ttrss_version)) |
|
1897 | - return $ttrss_version; |
|
1958 | + if (isset($ttrss_version)) { |
|
1959 | + return $ttrss_version; |
|
1960 | + } |
|
1898 | 1961 | |
1899 | 1962 | $ttrss_version = "UNKNOWN (Unsupported)"; |
1900 | 1963 |
@@ -155,11 +155,12 @@ discard block |
||
155 | 155 | |
156 | 156 | $color = strtolower($color); |
157 | 157 | |
158 | - if (isset($htmlcolors[$color])) |
|
159 | - return $htmlcolors[$color]; |
|
160 | - else |
|
161 | - return $color; |
|
162 | -} |
|
158 | + if (isset($htmlcolors[$color])) { |
|
159 | + return $htmlcolors[$color]; |
|
160 | + } else { |
|
161 | + return $color; |
|
162 | + } |
|
163 | + } |
|
163 | 164 | |
164 | 165 | ### RGB >> HSL |
165 | 166 | function _color_rgb2hsl($rgb) { |
@@ -171,9 +172,15 @@ discard block |
||
171 | 172 | } |
172 | 173 | $h = 0; |
173 | 174 | if ($delta > 0) { |
174 | - if ($max == $r && $max != $g) $h += ($g - $b) / $delta; |
|
175 | - if ($max == $g && $max != $b) $h += (2 + ($b - $r) / $delta); |
|
176 | - if ($max == $b && $max != $r) $h += (4 + ($r - $g) / $delta); |
|
175 | + if ($max == $r && $max != $g) { |
|
176 | + $h += ($g - $b) / $delta; |
|
177 | + } |
|
178 | + if ($max == $g && $max != $b) { |
|
179 | + $h += (2 + ($b - $r) / $delta); |
|
180 | + } |
|
181 | + if ($max == $b && $max != $r) { |
|
182 | + $h += (4 + ($r - $g) / $delta); |
|
183 | + } |
|
177 | 184 | $h /= 6; |
178 | 185 | } return array($h, $s, $l); |
179 | 186 | } |
@@ -191,19 +198,26 @@ discard block |
||
191 | 198 | ### Helper function for _color_hsl2rgb(). |
192 | 199 | function _color_hue2rgb($m1, $m2, $h) { |
193 | 200 | $h = ($h < 0) ? $h + 1 : (($h > 1) ? $h - 1 : $h); |
194 | - if ($h * 6 < 1) return $m1 + ($m2 - $m1) * $h * 6; |
|
195 | - if ($h * 2 < 1) return $m2; |
|
196 | - if ($h * 3 < 2) return $m1 + ($m2 - $m1) * (0.66666 - $h) * 6; |
|
201 | + if ($h * 6 < 1) { |
|
202 | + return $m1 + ($m2 - $m1) * $h * 6; |
|
203 | + } |
|
204 | + if ($h * 2 < 1) { |
|
205 | + return $m2; |
|
206 | + } |
|
207 | + if ($h * 3 < 2) { |
|
208 | + return $m1 + ($m2 - $m1) * (0.66666 - $h) * 6; |
|
209 | + } |
|
197 | 210 | return $m1; |
198 | 211 | } |
199 | 212 | |
200 | 213 | ### Convert a hex color into an RGB triplet. |
201 | 214 | function _color_unpack($hex, $normalize = false) { |
202 | 215 | |
203 | - if (strpos($hex, '#') !== 0) |
|
204 | - $hex = _resolve_htmlcolor($hex); |
|
205 | - else |
|
206 | - $hex = substr($hex, 1); |
|
216 | + if (strpos($hex, '#') !== 0) { |
|
217 | + $hex = _resolve_htmlcolor($hex); |
|
218 | + } else { |
|
219 | + $hex = substr($hex, 1); |
|
220 | + } |
|
207 | 221 | |
208 | 222 | if (strlen($hex) == 4) { |
209 | 223 | $hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3]; |
@@ -246,12 +260,20 @@ discard block |
||
246 | 260 | $del_G = ((($var_Max - $var_G ) / 6 ) + ($del_Max / 2 ) ) / $del_Max; |
247 | 261 | $del_B = ((($var_Max - $var_B ) / 6 ) + ($del_Max / 2 ) ) / $del_Max; |
248 | 262 | |
249 | - if ($var_R == $var_Max) $h = $del_B - $del_G; |
|
250 | - else if ($var_G == $var_Max) $h = (1 / 3 ) + $del_R - $del_B; |
|
251 | - else if ($var_B == $var_Max) $h = (2 / 3 ) + $del_G - $del_R; |
|
252 | - |
|
253 | - if ($h < 0) $h++; |
|
254 | - if ($h > 1) $h--; |
|
263 | + if ($var_R == $var_Max) { |
|
264 | + $h = $del_B - $del_G; |
|
265 | + } else if ($var_G == $var_Max) { |
|
266 | + $h = (1 / 3 ) + $del_R - $del_B; |
|
267 | + } else if ($var_B == $var_Max) { |
|
268 | + $h = (2 / 3 ) + $del_G - $del_R; |
|
269 | + } |
|
270 | + |
|
271 | + if ($h < 0) { |
|
272 | + $h++; |
|
273 | + } |
|
274 | + if ($h > 1) { |
|
275 | + $h--; |
|
276 | + } |
|
255 | 277 | } |
256 | 278 | |
257 | 279 | return array($h, $s, $v); |
@@ -271,12 +293,7 @@ discard block |
||
271 | 293 | $var_2 = $v * (1 - $s * ($var_H - $var_i ) ); |
272 | 294 | $var_3 = $v * (1 - $s * (1 - ($var_H - $var_i ) ) ); |
273 | 295 | |
274 | - if ($var_i == 0) { $var_R = $v ; $var_G = $var_3 ; $var_B = $var_1 ; } |
|
275 | - else if ($var_i == 1) { $var_R = $var_2 ; $var_G = $v ; $var_B = $var_1 ; } |
|
276 | - else if ($var_i == 2) { $var_R = $var_1 ; $var_G = $v ; $var_B = $var_3 ; } |
|
277 | - else if ($var_i == 3) { $var_R = $var_1 ; $var_G = $var_2 ; $var_B = $v ; } |
|
278 | - else if ($var_i == 4) { $var_R = $var_3 ; $var_G = $var_1 ; $var_B = $v ; } |
|
279 | - else { $var_R = $v ; $var_G = $var_1 ; $var_B = $var_2 ; } |
|
296 | + if ($var_i == 0) { $var_R = $v ; $var_G = $var_3 ; $var_B = $var_1 ; } else if ($var_i == 1) { $var_R = $var_2 ; $var_G = $v ; $var_B = $var_1 ; } else if ($var_i == 2) { $var_R = $var_1 ; $var_G = $v ; $var_B = $var_3 ; } else if ($var_i == 3) { $var_R = $var_1 ; $var_G = $var_2 ; $var_B = $v ; } else if ($var_i == 4) { $var_R = $var_3 ; $var_G = $var_1 ; $var_B = $v ; } else { $var_R = $v ; $var_G = $var_1 ; $var_B = $var_2 ; } |
|
280 | 297 | |
281 | 298 | $r = $var_R * 255; |
282 | 299 | $g = $var_G * 255; |
@@ -299,10 +316,11 @@ discard block |
||
299 | 316 | $ico = new floIcon(); |
300 | 317 | @$ico->readICO($imageFile); |
301 | 318 | |
302 | - if(count($ico->images)==0) |
|
303 | - return false; |
|
304 | - else |
|
305 | - $img = @$ico->images[count($ico->images)-1]->getImageResource(); |
|
319 | + if(count($ico->images)==0) { |
|
320 | + return false; |
|
321 | + } else { |
|
322 | + $img = @$ico->images[count($ico->images)-1]->getImageResource(); |
|
323 | + } |
|
306 | 324 | |
307 | 325 | } else { |
308 | 326 | return false; |
@@ -312,7 +330,9 @@ discard block |
||
312 | 330 | $img = @imagecreatefromstring(file_get_contents($imageFile)); |
313 | 331 | } |
314 | 332 | |
315 | - if (!$img) return false; |
|
333 | + if (!$img) { |
|
334 | + return false; |
|
335 | + } |
|
316 | 336 | |
317 | 337 | for($x = 0; $x < $size[0]; $x += $granularity) { |
318 | 338 | for($y = 0; $y < $size[1]; $y += $granularity) { |
@@ -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 | }); |