@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | class Backend extends Handler { |
3 | 3 | public 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 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | foreach ($info as $section => $hotkeys) { |
42 | 42 | |
43 | 43 | if ($cur_section) print "<li> </li>"; |
44 | - print "<li><h3>" . $section . "</h3></li>"; |
|
44 | + print "<li><h3>".$section."</h3></li>"; |
|
45 | 45 | $cur_section = $section; |
46 | 46 | |
47 | 47 | foreach ($hotkeys as $action => $description) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | foreach ($omap[$action] as $sequence) { |
51 | 51 | if (strpos($sequence, "|") !== FALSE) { |
52 | 52 | $sequence = substr($sequence, |
53 | - strpos($sequence, "|")+1, |
|
53 | + strpos($sequence, "|") + 1, |
|
54 | 54 | strlen($sequence)); |
55 | 55 | } else { |
56 | 56 | $keys = explode(" ", $sequence); |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | foreach (str_split($keys[$i]) as $c) { |
62 | 62 | switch ($c) { |
63 | 63 | case '*': |
64 | - $tmp .= __('Shift') . '+'; |
|
64 | + $tmp .= __('Shift').'+'; |
|
65 | 65 | break; |
66 | 66 | case '^': |
67 | - $tmp .= __('Ctrl') . '+'; |
|
67 | + $tmp .= __('Ctrl').'+'; |
|
68 | 68 | break; |
69 | 69 | default: |
70 | 70 | $tmp .= $c; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | - public static function get_all_labels($owner_uid) { |
|
40 | + public static function get_all_labels($owner_uid) { |
|
41 | 41 | $rv = array(); |
42 | 42 | |
43 | 43 | $pdo = Db::pdo(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | } |
72 | 72 | |
73 | - public static function clear_cache($id) { |
|
73 | + public static function clear_cache($id) { |
|
74 | 74 | |
75 | 75 | $pdo = Db::pdo(); |
76 | 76 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | Labels::clear_cache($id); |
99 | 99 | } |
100 | 100 | |
101 | - public static function add_article($id, $label, $owner_uid) { |
|
101 | + public static function add_article($id, $label, $owner_uid) { |
|
102 | 102 | |
103 | 103 | $label_id = Labels::find_id($label, $owner_uid); |
104 | 104 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | if (!$tr_in_progress) $pdo->commit(); |
172 | 172 | } |
173 | 173 | |
174 | - public static function create($caption, $fg_color = '', $bg_color = '', $owner_uid = false) { |
|
174 | + public static function create($caption, $fg_color = '', $bg_color = '', $owner_uid = false) { |
|
175 | 175 | |
176 | 176 | if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
177 | 177 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | private $dir; |
4 | 4 | |
5 | 5 | public function __construct($dir) { |
6 | - $this->dir = CACHE_DIR . "/" . clean_filename($dir); |
|
6 | + $this->dir = CACHE_DIR."/".clean_filename($dir); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | public function getDir() { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function getFullPath($filename) { |
42 | 42 | $filename = clean_filename($filename); |
43 | 43 | |
44 | - return $this->dir . "/" . $filename; |
|
44 | + return $this->dir."/".$filename; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function put($filename, $data) { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | public function getUrl($filename) { |
76 | - return get_self_url_prefix() . "/public.php?op=cached_url&file=" . basename($this->dir) . "/" . $filename; |
|
76 | + return get_self_url_prefix()."/public.php?op=cached_url&file=".basename($this->dir)."/".$filename; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // check for locally cached (media) URLs and rewrite to local versions |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | if (!$res) return ''; |
86 | 86 | |
87 | 87 | $doc = new DOMDocument(); |
88 | - if ($doc->loadHTML('<?xml encoding="UTF-8">' . $res)) { |
|
88 | + if ($doc->loadHTML('<?xml encoding="UTF-8">'.$res)) { |
|
89 | 89 | $xpath = new DOMXPath($doc); |
90 | 90 | $cache = new DiskCache("images"); |
91 | 91 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | public static function expire() { |
129 | - $dirs = array_filter(glob(CACHE_DIR . "/*"), "is_dir"); |
|
129 | + $dirs = array_filter(glob(CACHE_DIR."/*"), "is_dir"); |
|
130 | 130 | |
131 | 131 | foreach ($dirs as $cache_dir) { |
132 | 132 | $num_deleted = 0; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | if ($files) { |
138 | 138 | foreach ($files as $file) { |
139 | - if (time() - filemtime($file) > 86400*CACHE_MAX_DAYS) { |
|
139 | + if (time() - filemtime($file) > 86400 * CACHE_MAX_DAYS) { |
|
140 | 140 | unlink($file); |
141 | 141 | |
142 | 142 | ++$num_deleted; |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | if ($k != "feed" && isset($v)) { |
8 | 8 | $x = strip_tags(is_array($v) ? implode(",", $v) : $v); |
9 | 9 | |
10 | - $tmp .= sha1("$k:" . sha1($x)); |
|
10 | + $tmp .= sha1("$k:".sha1($x)); |
|
11 | 11 | } |
12 | 12 | } |
13 | 13 | |
14 | - return sha1(implode(",", $pluginhost->get_plugin_names()) . $tmp); |
|
14 | + return sha1(implode(",", $pluginhost->get_plugin_names()).$tmp); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // Strips utf8mb4 characters (i.e. emoji) for mysql |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | //update_rss_feed($line["id"], true); |
138 | 138 | |
139 | 139 | if ($tline = $usth->fetch()) { |
140 | - Debug::log(" => " . $tline["last_updated"] . ", " . $tline["id"] . " " . $tline["owner_uid"]); |
|
140 | + Debug::log(" => ".$tline["last_updated"].", ".$tline["id"]." ".$tline["owner_uid"]); |
|
141 | 141 | |
142 | 142 | if (array_search($tline["owner_uid"], $batch_owners) === FALSE) |
143 | 143 | array_push($batch_owners, $tline["owner_uid"]); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | |
324 | 324 | $date_feed_processed = date('Y-m-d H:i'); |
325 | 325 | |
326 | - $cache_filename = CACHE_DIR . "/feeds/" . sha1($fetch_url) . ".xml"; |
|
326 | + $cache_filename = CACHE_DIR."/feeds/".sha1($fetch_url).".xml"; |
|
327 | 327 | |
328 | 328 | $pluginhost = new PluginHost(); |
329 | 329 | $user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | Debug::log("running HOOK_FETCH_FEED handlers...", Debug::$LOG_VERBOSE); |
341 | 341 | |
342 | 342 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_FETCH_FEED) as $plugin) { |
343 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
343 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
344 | 344 | $start = microtime(true); |
345 | 345 | $feed_data = $plugin->hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, 0, $auth_login, $auth_pass); |
346 | 346 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | $feed_data = trim($feed_data); |
403 | 403 | |
404 | 404 | Debug::log("fetch done.", Debug::$LOG_VERBOSE); |
405 | - Debug::log("source last modified: " . $fetch_last_modified, Debug::$LOG_VERBOSE); |
|
405 | + Debug::log("source last modified: ".$fetch_last_modified, Debug::$LOG_VERBOSE); |
|
406 | 406 | |
407 | 407 | if ($feed_data && $fetch_last_modified != $stored_last_modified) { |
408 | 408 | $sth = $pdo->prepare("UPDATE ttrss_feeds SET last_modified = ? WHERE id = ?"); |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | } |
411 | 411 | |
412 | 412 | // cache vanilla feed data for re-use |
413 | - if ($feed_data && !$auth_pass && !$auth_login && is_writable(CACHE_DIR . "/feeds")) { |
|
413 | + if ($feed_data && !$auth_pass && !$auth_login && is_writable(CACHE_DIR."/feeds")) { |
|
414 | 414 | $new_rss_hash = sha1($feed_data); |
415 | 415 | |
416 | 416 | if ($new_rss_hash != $rss_hash) { |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | $feed_data_checksum = md5($feed_data); |
446 | 446 | |
447 | 447 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_FETCHED) as $plugin) { |
448 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
448 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
449 | 449 | $start = microtime(true); |
450 | 450 | $feed_data = $plugin->hook_feed_fetched($feed_data, $fetch_url, $owner_uid, $feed); |
451 | 451 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | // We use local pluginhost here because we need to load different per-user feed plugins |
468 | 468 | |
469 | 469 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_PARSED) as $plugin) { |
470 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
470 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
471 | 471 | $start = microtime(true); |
472 | 472 | $plugin->hook_feed_parsed($rss); |
473 | 473 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
@@ -499,14 +499,14 @@ discard block |
||
499 | 499 | $site_url = mb_substr(rewrite_relative_url($fetch_url, clean($rss->get_link())), 0, 245); |
500 | 500 | |
501 | 501 | Debug::log("site_url: $site_url", Debug::$LOG_VERBOSE); |
502 | - Debug::log("feed_title: " . clean($rss->get_title()), Debug::$LOG_VERBOSE); |
|
502 | + Debug::log("feed_title: ".clean($rss->get_title()), Debug::$LOG_VERBOSE); |
|
503 | 503 | |
504 | 504 | if ($favicon_needs_check || $force_refetch) { |
505 | 505 | |
506 | 506 | /* terrible hack: if we crash on floicon shit here, we won't check |
507 | 507 | * the icon avgcolor again (unless the icon got updated) */ |
508 | 508 | |
509 | - $favicon_file = ICONS_DIR . "/$feed.ico"; |
|
509 | + $favicon_file = ICONS_DIR."/$feed.ico"; |
|
510 | 510 | $favicon_modified = @filemtime($favicon_file); |
511 | 511 | |
512 | 512 | Debug::log("checking favicon...", Debug::$LOG_VERBOSE); |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | |
528 | 528 | $favicon_color = calculate_avg_color($favicon_file); |
529 | 529 | |
530 | - $favicon_colorstring = ",favicon_avg_color = " . $pdo->quote($favicon_color); |
|
530 | + $favicon_colorstring = ",favicon_avg_color = ".$pdo->quote($favicon_color); |
|
531 | 531 | |
532 | 532 | } else if ($favicon_avg_color == 'fail') { |
533 | 533 | Debug::log("floicon failed on this file, not trying to recalculate avg color", Debug::$LOG_VERBOSE); |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | print_r($filters); |
547 | 547 | } |
548 | 548 | |
549 | - Debug::log("" . count($filters) . " filters loaded.", Debug::$LOG_VERBOSE); |
|
549 | + Debug::log("".count($filters)." filters loaded.", Debug::$LOG_VERBOSE); |
|
550 | 550 | |
551 | 551 | $items = $rss->get_items(); |
552 | 552 | |
@@ -588,13 +588,13 @@ discard block |
||
588 | 588 | |
589 | 589 | $entry_guid = "$owner_uid,$entry_guid"; |
590 | 590 | |
591 | - $entry_guid_hashed = 'SHA1:' . sha1($entry_guid); |
|
591 | + $entry_guid_hashed = 'SHA1:'.sha1($entry_guid); |
|
592 | 592 | |
593 | 593 | Debug::log("guid $entry_guid / $entry_guid_hashed", Debug::$LOG_VERBOSE); |
594 | 594 | |
595 | - $entry_timestamp = (int)$item->get_date(); |
|
595 | + $entry_timestamp = (int) $item->get_date(); |
|
596 | 596 | |
597 | - Debug::log("orig date: " . $item->get_date(), Debug::$LOG_VERBOSE); |
|
597 | + Debug::log("orig date: ".$item->get_date(), Debug::$LOG_VERBOSE); |
|
598 | 598 | |
599 | 599 | $entry_title = strip_tags($item->get_title()); |
600 | 600 | |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | Debug::log("link $entry_link", Debug::$LOG_VERBOSE); |
607 | 607 | Debug::log("language $entry_language", Debug::$LOG_VERBOSE); |
608 | 608 | |
609 | - if (!$entry_title) $entry_title = date("Y-m-d H:i:s", $entry_timestamp);; |
|
609 | + if (!$entry_title) $entry_title = date("Y-m-d H:i:s", $entry_timestamp); ; |
|
610 | 610 | |
611 | 611 | $entry_content = $item->get_content(); |
612 | 612 | if (!$entry_content) $entry_content = $item->get_description(); |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | Debug::log("looking for tags...", Debug::$LOG_VERBOSE); |
628 | 628 | |
629 | 629 | $entry_tags = $item->get_categories(); |
630 | - Debug::log("tags found: " . join(", ", $entry_tags), Debug::$LOG_VERBOSE); |
|
630 | + Debug::log("tags found: ".join(", ", $entry_tags), Debug::$LOG_VERBOSE); |
|
631 | 631 | |
632 | 632 | Debug::log("done collecting data.", Debug::$LOG_VERBOSE); |
633 | 633 | |
@@ -692,14 +692,14 @@ discard block |
||
692 | 692 | Debug::log("hash differs, applying plugin filters:", Debug::$LOG_VERBOSE); |
693 | 693 | |
694 | 694 | foreach ($pluginhost->get_hooks(PluginHost::HOOK_ARTICLE_FILTER) as $plugin) { |
695 | - Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); |
|
695 | + Debug::log("... ".get_class($plugin), Debug::$LOG_VERBOSE); |
|
696 | 696 | |
697 | 697 | $start = microtime(true); |
698 | 698 | $article = $plugin->hook_article_filter($article); |
699 | 699 | |
700 | 700 | Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); |
701 | 701 | |
702 | - $entry_plugin_data .= mb_strtolower(get_class($plugin)) . ","; |
|
702 | + $entry_plugin_data .= mb_strtolower(get_class($plugin)).","; |
|
703 | 703 | } |
704 | 704 | |
705 | 705 | if (Debug::get_loglevel() >= 3) { |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | Debug::log("applying plugin filter actions...", Debug::$LOG_VERBOSE); |
773 | 773 | |
774 | 774 | foreach ($plugin_filter_names as $pfn) { |
775 | - list($pfclass,$pfaction) = explode(":", $pfn["param"]); |
|
775 | + list($pfclass, $pfaction) = explode(":", $pfn["param"]); |
|
776 | 776 | |
777 | 777 | if (isset($plugin_filter_actions[$pfclass])) { |
778 | 778 | $plugin = $pluginhost->get_plugin($pfclass); |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | $entry_current_hash, |
868 | 868 | $date_feed_processed, |
869 | 869 | $entry_comments, |
870 | - (int)$num_comments, |
|
870 | + (int) $num_comments, |
|
871 | 871 | $entry_plugin_data, |
872 | 872 | "$entry_language", |
873 | 873 | "$entry_author"]); |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | ":content" => "$entry_content", |
980 | 980 | ":content_hash" => $entry_current_hash, |
981 | 981 | ":updated" => $entry_timestamp_fmt, |
982 | - ":num_comments" => (int)$num_comments, |
|
982 | + ":num_comments" => (int) $num_comments, |
|
983 | 983 | ":plugin_data" => $entry_plugin_data, |
984 | 984 | ":author" => "$entry_author", |
985 | 985 | ":lang" => $entry_language, |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | |
988 | 988 | if (DB_TYPE == "pgsql") { |
989 | 989 | $params[":ts_lang"] = $feed_language; |
990 | - $params[":ts_content"] = mb_substr(strip_tags($entry_title . " " . $entry_content), 0, 900000); |
|
990 | + $params[":ts_content"] = mb_substr(strip_tags($entry_title." ".$entry_content), 0, 900000); |
|
991 | 991 | } |
992 | 992 | |
993 | 993 | $sth->execute($params); |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | foreach ($enclosures as $enc) { |
1068 | 1068 | $enc_url = $enc[0]; |
1069 | 1069 | $enc_type = $enc[1]; |
1070 | - $enc_dur = (int)$enc[2]; |
|
1070 | + $enc_dur = (int) $enc[2]; |
|
1071 | 1071 | $enc_title = $enc[3]; |
1072 | 1072 | $enc_width = intval($enc[4]); |
1073 | 1073 | $enc_height = intval($enc[5]); |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | $esth->execute([$enc_url, $enc_type, $entry_ref_id]); |
1076 | 1076 | |
1077 | 1077 | if (!$esth->fetch()) { |
1078 | - $usth->execute([$enc_url, $enc_type, (string)$enc_title, $enc_dur, $entry_ref_id, $enc_width, $enc_height]); |
|
1078 | + $usth->execute([$enc_url, $enc_type, (string) $enc_title, $enc_dur, $entry_ref_id, $enc_width, $enc_height]); |
|
1079 | 1079 | } |
1080 | 1080 | } |
1081 | 1081 | |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | $filtered_tags = array_unique($filtered_tags); |
1110 | 1110 | |
1111 | 1111 | if (Debug::get_loglevel() >= Debug::$LOG_VERBOSE) { |
1112 | - Debug::log("filtered tags: " . implode(", ", $filtered_tags), Debug::$LOG_VERBOSE); |
|
1112 | + Debug::log("filtered tags: ".implode(", ", $filtered_tags), Debug::$LOG_VERBOSE); |
|
1113 | 1113 | |
1114 | 1114 | } |
1115 | 1115 | |
@@ -1297,11 +1297,11 @@ discard block |
||
1297 | 1297 | $num_deleted = 0; |
1298 | 1298 | |
1299 | 1299 | if (is_writable(LOCK_DIRECTORY)) { |
1300 | - $files = glob(LOCK_DIRECTORY . "/*.lock"); |
|
1300 | + $files = glob(LOCK_DIRECTORY."/*.lock"); |
|
1301 | 1301 | |
1302 | 1302 | if ($files) { |
1303 | 1303 | foreach ($files as $file) { |
1304 | - if (!file_is_locked(basename($file)) && time() - filemtime($file) > 86400*2) { |
|
1304 | + if (!file_is_locked(basename($file)) && time() - filemtime($file) > 86400 * 2) { |
|
1305 | 1305 | unlink($file); |
1306 | 1306 | ++$num_deleted; |
1307 | 1307 | } |
@@ -1516,7 +1516,7 @@ discard block |
||
1516 | 1516 | public static function check_feed_favicon($site_url, $feed) { |
1517 | 1517 | # print "FAVICON [$site_url]: $favicon_url\n"; |
1518 | 1518 | |
1519 | - $icon_file = ICONS_DIR . "/$feed.ico"; |
|
1519 | + $icon_file = ICONS_DIR."/$feed.ico"; |
|
1520 | 1520 | |
1521 | 1521 | if (!file_exists($icon_file)) { |
1522 | 1522 | $favicon_url = RSSUtils::get_favicon_url($site_url); |
@@ -1570,14 +1570,14 @@ discard block |
||
1570 | 1570 | |
1571 | 1571 | public static function is_gzipped($feed_data) { |
1572 | 1572 | return strpos(substr($feed_data, 0, 3), |
1573 | - "\x1f" . "\x8b" . "\x08", 0) === 0; |
|
1573 | + "\x1f"."\x8b"."\x08", 0) === 0; |
|
1574 | 1574 | } |
1575 | 1575 | |
1576 | 1576 | public static function load_filters($feed_id, $owner_uid) { |
1577 | 1577 | $filters = array(); |
1578 | 1578 | |
1579 | 1579 | $feed_id = (int) $feed_id; |
1580 | - $cat_id = (int)Feeds::getFeedCategory($feed_id); |
|
1580 | + $cat_id = (int) Feeds::getFeedCategory($feed_id); |
|
1581 | 1581 | |
1582 | 1582 | if ($cat_id == 0) |
1583 | 1583 | $null_cat_qpart = "cat_id IS NULL OR"; |
@@ -194,12 +194,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
319 | 319 | } |
320 | 320 | |
321 | 321 | public 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 | public 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 |
||
348 | 348 | } |
349 | 349 | |
350 | 350 | public 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 |
||
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 |
||
495 | 495 | } |
496 | 496 | |
497 | 497 | // handled by classes/pluginhandler.php, requires valid session |
498 | - public function get_method_url($sender, $method, $params) { |
|
499 | - return get_self_url_prefix() . "/backend.php?" . |
|
498 | + public 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 |
||
508 | 508 | } |
509 | 509 | |
510 | 510 | // WARNING: endpoint in public.php, exposed to unauthenticated users |
511 | - public function get_public_method_url($sender, $method, $params) { |
|
511 | + public 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 |
||
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 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $cat_title = htmlspecialchars($row['title']); |
71 | 71 | |
72 | 72 | if ($include_settings) { |
73 | - $order_id = (int)$row["order_id"]; |
|
73 | + $order_id = (int) $row["order_id"]; |
|
74 | 74 | $ttrss_specific_qpart = "ttrssSortOrder=\"$order_id\""; |
75 | 75 | } |
76 | 76 | } else { |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | $site_url = htmlspecialchars($fline["site_url"]); |
104 | 104 | |
105 | 105 | if ($include_settings) { |
106 | - $update_interval = (int)$fline["update_interval"]; |
|
107 | - $order_id = (int)$fline["order_id"]; |
|
106 | + $update_interval = (int) $fline["update_interval"]; |
|
107 | + $order_id = (int) $fline["order_id"]; |
|
108 | 108 | |
109 | 109 | $ttrss_specific_qpart = "ttrssSortOrder=\"$order_id\" ttrssUpdateInterval=\"$update_interval\""; |
110 | 110 | } else { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | if (!isset($_REQUEST["debug"])) { |
132 | 132 | header("Content-type: application/xml+opml"); |
133 | - header("Content-Disposition: attachment; filename=" . $name ); |
|
133 | + header("Content-Disposition: attachment; filename=".$name); |
|
134 | 134 | } else { |
135 | 135 | header("Content-type: text/xml"); |
136 | 136 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | $out .= "<opml version=\"1.0\">"; |
141 | 141 | $out .= "<head> |
142 | - <dateCreated>" . date("r", time()) . "</dateCreated> |
|
142 | + <dateCreated>" . date("r", time())."</dateCreated> |
|
143 | 143 | <title>Tiny Tiny RSS Feed Export</title> |
144 | 144 | </head>"; |
145 | 145 | $out .= "<body>"; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | foreach (json_decode($tmp_line["match_on"], true) as $feed_id) { |
215 | 215 | |
216 | 216 | if (strpos($feed_id, "CAT:") === 0) { |
217 | - $feed_id = (int)substr($feed_id, 4); |
|
217 | + $feed_id = (int) substr($feed_id, 4); |
|
218 | 218 | if ($feed_id) { |
219 | 219 | array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]); |
220 | 220 | } else { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | } else { |
224 | 224 | if ($feed_id) { |
225 | - array_push($match, [Feeds::getFeedTitle((int)$feed_id), false, false]); |
|
225 | + array_push($match, [Feeds::getFeedTitle((int) $feed_id), false, false]); |
|
226 | 226 | } else { |
227 | 227 | array_push($match, [0, false, true]); |
228 | 228 | } |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | list ($name, $is_cat, $is_id) = $match; |
410 | 410 | |
411 | 411 | if ($is_id) { |
412 | - array_push($match_on, ($is_cat ? "CAT:" : "") . $name); |
|
412 | + array_push($match_on, ($is_cat ? "CAT:" : "").$name); |
|
413 | 413 | } else { |
414 | 414 | |
415 | 415 | if (!$is_cat) { |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | $reg_exp = $rule["reg_exp"]; |
441 | - $filter_type = (int)$rule["filter_type"]; |
|
441 | + $filter_type = (int) $rule["filter_type"]; |
|
442 | 442 | $inverse = bool_to_sql_bool($rule["inverse"]); |
443 | 443 | $match_on = json_encode($match_on); |
444 | 444 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | |
473 | 473 | $cat_filter = bool_to_sql_bool($rule["cat_filter"]); |
474 | 474 | $reg_exp = $rule["reg_exp"]; |
475 | - $filter_type = (int)$rule["filter_type"]; |
|
475 | + $filter_type = (int) $rule["filter_type"]; |
|
476 | 476 | $inverse = bool_to_sql_bool($rule["inverse"]); |
477 | 477 | |
478 | 478 | $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | |
486 | 486 | foreach ($filter["actions"] as $action) { |
487 | 487 | |
488 | - $action_id = (int)$action["action_id"]; |
|
488 | + $action_id = (int) $action["action_id"]; |
|
489 | 489 | $action_param = $action["action_param"]; |
490 | 490 | |
491 | 491 | $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_actions |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | } |
586 | 586 | |
587 | 587 | if (is_uploaded_file($_FILES['opml_file']['tmp_name'])) { |
588 | - $tmp_file = tempnam(CACHE_DIR . '/upload', 'opml'); |
|
588 | + $tmp_file = tempnam(CACHE_DIR.'/upload', 'opml'); |
|
589 | 589 | |
590 | 590 | $result = move_uploaded_file($_FILES['opml_file']['tmp_name'], |
591 | 591 | $tmp_file); |
@@ -623,10 +623,10 @@ discard block |
||
623 | 623 | print "$msg<br/>"; |
624 | 624 | } |
625 | 625 | |
626 | - public static function opml_publish_url(){ |
|
626 | + public static function opml_publish_url() { |
|
627 | 627 | |
628 | 628 | $url_path = get_self_url_prefix(); |
629 | - $url_path .= "/opml.php?op=publish&key=" . |
|
629 | + $url_path .= "/opml.php?op=publish&key=". |
|
630 | 630 | Feeds::get_feed_access_key('OPML:Publish', false, $_SESSION["uid"]); |
631 | 631 | |
632 | 632 | return $url_path; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ### HSL >> RGB |
184 | 184 | function _color_hsl2rgb($hsl) { |
185 | 185 | $h = $hsl[0]; $s = $hsl[1]; $l = $hsl[2]; |
186 | - $m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l*$s; |
|
186 | + $m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l * $s; |
|
187 | 187 | $m1 = $l * 2 - $m2; |
188 | 188 | return array(_color_hue2rgb($m1, $m2, $h + 0.33333), |
189 | 189 | _color_hue2rgb($m1, $m2, $h), |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $hex = substr($hex, 1); |
209 | 209 | |
210 | 210 | if (strlen($hex) == 4) { |
211 | - $hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3]; |
|
211 | + $hex = $hex[1].$hex[1].$hex[2].$hex[2].$hex[3].$hex[3]; |
|
212 | 212 | } |
213 | 213 | $c = hexdec($hex); |
214 | 214 | for ($i = 16; $i >= 0; $i -= 8) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | function _color_pack($rgb, $normalize = false) { |
221 | 221 | foreach ($rgb as $k => $v) { |
222 | 222 | $out |= (($v * ($normalize ? 255 : 1)) << (16 - $k * 8)); |
223 | - }return '#'. str_pad(dechex($out), 6, 0, STR_PAD_LEFT); |
|
223 | + }return '#'.str_pad(dechex($out), 6, 0, STR_PAD_LEFT); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | function rgb2hsl($arr) { |
@@ -244,13 +244,13 @@ discard block |
||
244 | 244 | } else { |
245 | 245 | $s = $del_Max / $var_Max; |
246 | 246 | |
247 | - $del_R = ((($var_Max - $var_R ) / 6 ) + ($del_Max / 2 ) ) / $del_Max; |
|
248 | - $del_G = ((($var_Max - $var_G ) / 6 ) + ($del_Max / 2 ) ) / $del_Max; |
|
249 | - $del_B = ((($var_Max - $var_B ) / 6 ) + ($del_Max / 2 ) ) / $del_Max; |
|
247 | + $del_R = ((($var_Max - $var_R) / 6) + ($del_Max / 2)) / $del_Max; |
|
248 | + $del_G = ((($var_Max - $var_G) / 6) + ($del_Max / 2)) / $del_Max; |
|
249 | + $del_B = ((($var_Max - $var_B) / 6) + ($del_Max / 2)) / $del_Max; |
|
250 | 250 | |
251 | - if ($var_R == $var_Max) $h = $del_B - $del_G; |
|
252 | - else if ($var_G == $var_Max) $h = (1 / 3 ) + $del_R - $del_B; |
|
253 | - else if ($var_B == $var_Max) $h = (2 / 3 ) + $del_G - $del_R; |
|
251 | + if ($var_R == $var_Max) $h = $del_B - $del_G; |
|
252 | + else if ($var_G == $var_Max) $h = (1 / 3) + $del_R - $del_B; |
|
253 | + else if ($var_B == $var_Max) $h = (2 / 3) + $del_G - $del_R; |
|
254 | 254 | |
255 | 255 | if ($h < 0) $h++; |
256 | 256 | if ($h > 1) $h--; |
@@ -264,21 +264,21 @@ discard block |
||
264 | 264 | $s = $arr[1]; |
265 | 265 | $v = $arr[2]; |
266 | 266 | |
267 | - if($s == 0) { |
|
267 | + if ($s == 0) { |
|
268 | 268 | $r = $g = $B = $v * 255; |
269 | 269 | } else { |
270 | 270 | $var_H = $h * 6; |
271 | - $var_i = floor($var_H ); |
|
272 | - $var_1 = $v * (1 - $s ); |
|
273 | - $var_2 = $v * (1 - $s * ($var_H - $var_i ) ); |
|
274 | - $var_3 = $v * (1 - $s * (1 - ($var_H - $var_i ) ) ); |
|
275 | - |
|
276 | - if ($var_i == 0) { $var_R = $v ; $var_G = $var_3 ; $var_B = $var_1 ; } |
|
277 | - else if ($var_i == 1) { $var_R = $var_2 ; $var_G = $v ; $var_B = $var_1 ; } |
|
278 | - else if ($var_i == 2) { $var_R = $var_1 ; $var_G = $v ; $var_B = $var_3 ; } |
|
279 | - else if ($var_i == 3) { $var_R = $var_1 ; $var_G = $var_2 ; $var_B = $v ; } |
|
280 | - else if ($var_i == 4) { $var_R = $var_3 ; $var_G = $var_1 ; $var_B = $v ; } |
|
281 | - else { $var_R = $v ; $var_G = $var_1 ; $var_B = $var_2 ; } |
|
271 | + $var_i = floor($var_H); |
|
272 | + $var_1 = $v * (1 - $s); |
|
273 | + $var_2 = $v * (1 - $s * ($var_H - $var_i)); |
|
274 | + $var_3 = $v * (1 - $s * (1 - ($var_H - $var_i))); |
|
275 | + |
|
276 | + if ($var_i == 0) { $var_R = $v; $var_G = $var_3; $var_B = $var_1; } |
|
277 | + else if ($var_i == 1) { $var_R = $var_2; $var_G = $v; $var_B = $var_1; } |
|
278 | + else if ($var_i == 2) { $var_R = $var_1; $var_G = $v; $var_B = $var_3; } |
|
279 | + else if ($var_i == 3) { $var_R = $var_1; $var_G = $var_2; $var_B = $v; } |
|
280 | + else if ($var_i == 4) { $var_R = $var_3; $var_G = $var_1; $var_B = $v; } |
|
281 | + else { $var_R = $v; $var_G = $var_1; $var_B = $var_2; } |
|
282 | 282 | |
283 | 283 | $r = $var_R * 255; |
284 | 284 | $g = $var_G * 255; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | function colorPalette($imageFile, $numColors, $granularity = 5) { |
291 | - $granularity = max(1, abs((int)$granularity)); |
|
291 | + $granularity = max(1, abs((int) $granularity)); |
|
292 | 292 | $colors = array(); |
293 | 293 | |
294 | 294 | $size = @getimagesize($imageFile); |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | $ico = new floIcon(); |
302 | 302 | @$ico->readICO($imageFile); |
303 | 303 | |
304 | - if(count($ico->images)==0) |
|
304 | + if (count($ico->images) == 0) |
|
305 | 305 | return false; |
306 | 306 | else |
307 | - $img = @$ico->images[count($ico->images)-1]->getImageResource(); |
|
307 | + $img = @$ico->images[count($ico->images) - 1]->getImageResource(); |
|
308 | 308 | |
309 | 309 | } else { |
310 | 310 | return false; |
@@ -316,17 +316,17 @@ discard block |
||
316 | 316 | |
317 | 317 | if (!$img) return false; |
318 | 318 | |
319 | - for($x = 0; $x < $size[0]; $x += $granularity) { |
|
320 | - for($y = 0; $y < $size[1]; $y += $granularity) { |
|
319 | + for ($x = 0; $x < $size[0]; $x += $granularity) { |
|
320 | + for ($y = 0; $y < $size[1]; $y += $granularity) { |
|
321 | 321 | $thisColor = imagecolorat($img, $x, $y); |
322 | 322 | $rgb = imagecolorsforindex($img, $thisColor); |
323 | 323 | $red = round(round(($rgb['red'] / 0x33)) * 0x33); |
324 | 324 | $green = round(round(($rgb['green'] / 0x33)) * 0x33); |
325 | 325 | $blue = round(round(($rgb['blue'] / 0x33)) * 0x33); |
326 | 326 | $thisRGB = sprintf('%02X%02X%02X', $red, $green, $blue); |
327 | - if(array_key_exists($thisRGB, $colors)) { |
|
327 | + if (array_key_exists($thisRGB, $colors)) { |
|
328 | 328 | $colors[$thisRGB]++; |
329 | - } else{ |
|
329 | + } else { |
|
330 | 330 | $colors[$thisRGB] = 1; |
331 | 331 | } |
332 | 332 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | define('LABEL_BASE_INDEX', -1024); |
6 | 6 | define('PLUGIN_FEED_BASE_INDEX', -128); |
7 | 7 | |
8 | -define('COOKIE_LIFETIME_LONG', 86400*365); |
|
8 | +define('COOKIE_LIFETIME_LONG', 86400 * 365); |
|
9 | 9 | |
10 | 10 | $fetch_last_error = false; |
11 | 11 | $fetch_last_error_code = false; |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | // feed limit for one update batch |
58 | 58 | define_default('DAEMON_SLEEP_INTERVAL', 120); |
59 | 59 | // default sleep interval between feed updates (sec) |
60 | -define_default('MAX_CACHE_FILE_SIZE', 64*1024*1024); |
|
60 | +define_default('MAX_CACHE_FILE_SIZE', 64 * 1024 * 1024); |
|
61 | 61 | // do not cache files larger than that (bytes) |
62 | -define_default('MAX_DOWNLOAD_FILE_SIZE', 16*1024*1024); |
|
62 | +define_default('MAX_DOWNLOAD_FILE_SIZE', 16 * 1024 * 1024); |
|
63 | 63 | // do not download general files larger than that (bytes) |
64 | 64 | define_default('CACHE_MAX_DAYS', 7); |
65 | 65 | // max age in days for various automatically cached (temporary) files |
66 | -define_default('MAX_CONDITIONAL_INTERVAL', 3600*12); |
|
66 | +define_default('MAX_CONDITIONAL_INTERVAL', 3600 * 12); |
|
67 | 67 | // max interval between forced unconditional updates for servers |
68 | 68 | // not complying with http if-modified-since (seconds) |
69 | 69 | define_default('MAX_FETCH_REQUESTS_PER_HOST', 25); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | require_once 'db-prefs.php'; |
158 | 158 | require_once 'controls.php'; |
159 | 159 | |
160 | -define('SELF_USER_AGENT', 'Tiny Tiny RSS/' . get_version() . ' (http://tt-rss.org/)'); |
|
160 | +define('SELF_USER_AGENT', 'Tiny Tiny RSS/'.get_version().' (http://tt-rss.org/)'); |
|
161 | 161 | ini_set('user_agent', SELF_USER_AGENT); |
162 | 162 | |
163 | 163 | $schema_version = false; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | if (!is_array($options)) { |
202 | 202 | |
203 | 203 | // falling back on compatibility shim |
204 | - $option_names = [ "url", "type", "login", "pass", "post_query", "timeout", "last_modified", "useragent" ]; |
|
204 | + $option_names = ["url", "type", "login", "pass", "post_query", "timeout", "last_modified", "useragent"]; |
|
205 | 205 | $tmp = []; |
206 | 206 | |
207 | 207 | for ($i = 0; $i < func_num_args(); $i++) { |
@@ -228,13 +228,13 @@ discard block |
||
228 | 228 | $url = str_replace(' ', '%20', $url); |
229 | 229 | |
230 | 230 | if (strpos($url, "//") === 0) |
231 | - $url = 'http:' . $url; |
|
231 | + $url = 'http:'.$url; |
|
232 | 232 | |
233 | 233 | $url_host = parse_url($url, PHP_URL_HOST); |
234 | 234 | $fetch_domain_hits[$url_host] += 1; |
235 | 235 | |
236 | 236 | if ($fetch_domain_hits[$url_host] > MAX_FETCH_REQUESTS_PER_HOST) { |
237 | - user_error("Exceeded fetch request quota for $url_host: " . $fetch_domain_hits[$url_host], E_USER_WARNING); |
|
237 | + user_error("Exceeded fetch request quota for $url_host: ".$fetch_domain_hits[$url_host], E_USER_WARNING); |
|
238 | 238 | #return false; |
239 | 239 | } |
240 | 240 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | array_push($curl_http_headers, "If-Modified-Since: $last_modified"); |
251 | 251 | |
252 | 252 | if ($http_accept) |
253 | - array_push($curl_http_headers, "Accept: " . $http_accept); |
|
253 | + array_push($curl_http_headers, "Accept: ".$http_accept); |
|
254 | 254 | |
255 | 255 | if (count($curl_http_headers) > 0) |
256 | 256 | curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_http_headers); |
@@ -263,11 +263,10 @@ discard block |
||
263 | 263 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
264 | 264 | curl_setopt($ch, CURLOPT_HEADER, true); |
265 | 265 | curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); |
266 | - curl_setopt($ch, CURLOPT_USERAGENT, $useragent ? $useragent : |
|
267 | - SELF_USER_AGENT); |
|
266 | + curl_setopt($ch, CURLOPT_USERAGENT, $useragent ? $useragent : SELF_USER_AGENT); |
|
268 | 267 | curl_setopt($ch, CURLOPT_ENCODING, ""); |
269 | 268 | |
270 | - if ($http_referrer) |
|
269 | + if ($http_referrer) |
|
271 | 270 | curl_setopt($ch, CURLOPT_REFERER, $http_referrer); |
272 | 271 | |
273 | 272 | if ($max_size) { |
@@ -276,7 +275,7 @@ discard block |
||
276 | 275 | |
277 | 276 | // holy shit closures in php |
278 | 277 | // download & upload are *expected* sizes respectively, could be zero |
279 | - curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curl_handle, $download_size, $downloaded, $upload_size, $uploaded) use( &$max_size) { |
|
278 | + curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curl_handle, $download_size, $downloaded, $upload_size, $uploaded) use(&$max_size) { |
|
280 | 279 | Debug::log("[curl progressfunction] $downloaded $max_size", Debug::$LOG_EXTENDED); |
281 | 280 | |
282 | 281 | return ($downloaded > $max_size) ? 1 : 0; // if max size is set, abort when exceeding it |
@@ -336,7 +335,7 @@ discard block |
||
336 | 335 | if ($http_code != 200 || $type && strpos($fetch_last_content_type, "$type") === false) { |
337 | 336 | |
338 | 337 | if (curl_errno($ch) != 0) { |
339 | - $fetch_last_error .= "; " . curl_errno($ch) . " " . curl_error($ch); |
|
338 | + $fetch_last_error .= "; ".curl_errno($ch)." ".curl_error($ch); |
|
340 | 339 | } |
341 | 340 | |
342 | 341 | $fetch_last_error_content = $contents; |
@@ -345,7 +344,7 @@ discard block |
||
345 | 344 | } |
346 | 345 | |
347 | 346 | if (!$contents) { |
348 | - $fetch_last_error = curl_errno($ch) . " " . curl_error($ch); |
|
347 | + $fetch_last_error = curl_errno($ch)." ".curl_error($ch); |
|
349 | 348 | curl_close($ch); |
350 | 349 | return false; |
351 | 350 | } |
@@ -365,7 +364,7 @@ discard block |
||
365 | 364 | |
366 | 365 | $fetch_curl_used = false; |
367 | 366 | |
368 | - if ($login && $pass){ |
|
367 | + if ($login && $pass) { |
|
369 | 368 | $url_parts = array(); |
370 | 369 | |
371 | 370 | preg_match("/(^[^:]*):\/\/(.*)/", $url, $url_parts); |
@@ -373,7 +372,7 @@ discard block |
||
373 | 372 | $pass = urlencode($pass); |
374 | 373 | |
375 | 374 | if ($url_parts[1] && $url_parts[2]) { |
376 | - $url = $url_parts[1] . "://$login:$pass@" . $url_parts[2]; |
|
375 | + $url = $url_parts[1]."://$login:$pass@".$url_parts[2]; |
|
377 | 376 | } |
378 | 377 | } |
379 | 378 | |
@@ -441,7 +440,7 @@ discard block |
||
441 | 440 | $error = error_get_last(); |
442 | 441 | |
443 | 442 | if ($error['message'] != $old_error['message']) { |
444 | - $fetch_last_error .= "; " . $error["message"]; |
|
443 | + $fetch_last_error .= "; ".$error["message"]; |
|
445 | 444 | } |
446 | 445 | |
447 | 446 | $fetch_last_error_content = $data; |
@@ -516,15 +515,15 @@ discard block |
||
516 | 515 | |
517 | 516 | function get_ssl_certificate_id() { |
518 | 517 | if ($_SERVER["REDIRECT_SSL_CLIENT_M_SERIAL"]) { |
519 | - return sha1($_SERVER["REDIRECT_SSL_CLIENT_M_SERIAL"] . |
|
520 | - $_SERVER["REDIRECT_SSL_CLIENT_V_START"] . |
|
521 | - $_SERVER["REDIRECT_SSL_CLIENT_V_END"] . |
|
518 | + return sha1($_SERVER["REDIRECT_SSL_CLIENT_M_SERIAL"]. |
|
519 | + $_SERVER["REDIRECT_SSL_CLIENT_V_START"]. |
|
520 | + $_SERVER["REDIRECT_SSL_CLIENT_V_END"]. |
|
522 | 521 | $_SERVER["REDIRECT_SSL_CLIENT_S_DN"]); |
523 | 522 | } |
524 | 523 | if ($_SERVER["SSL_CLIENT_M_SERIAL"]) { |
525 | - return sha1($_SERVER["SSL_CLIENT_M_SERIAL"] . |
|
526 | - $_SERVER["SSL_CLIENT_V_START"] . |
|
527 | - $_SERVER["SSL_CLIENT_V_END"] . |
|
524 | + return sha1($_SERVER["SSL_CLIENT_M_SERIAL"]. |
|
525 | + $_SERVER["SSL_CLIENT_V_START"]. |
|
526 | + $_SERVER["SSL_CLIENT_V_END"]. |
|
528 | 527 | $_SERVER["SSL_CLIENT_S_DN"]); |
529 | 528 | } |
530 | 529 | return ""; |
@@ -659,7 +658,7 @@ discard block |
||
659 | 658 | function logout_user() { |
660 | 659 | @session_destroy(); |
661 | 660 | if (isset($_COOKIE[session_name()])) { |
662 | - setcookie(session_name(), '', time()-42000, '/'); |
|
661 | + setcookie(session_name(), '', time() - 42000, '/'); |
|
663 | 662 | } |
664 | 663 | session_commit(); |
665 | 664 | } |
@@ -743,7 +742,7 @@ discard block |
||
743 | 742 | |
744 | 743 | function truncate_string($str, $max_len, $suffix = '…') { |
745 | 744 | if (mb_strlen($str, "utf-8") > $max_len) { |
746 | - return mb_substr($str, 0, $max_len, "utf-8") . $suffix; |
|
745 | + return mb_substr($str, 0, $max_len, "utf-8").$suffix; |
|
747 | 746 | } else { |
748 | 747 | return $str; |
749 | 748 | } |
@@ -753,7 +752,7 @@ discard block |
||
753 | 752 | $startString = mb_substr($original, 0, $position, "UTF-8"); |
754 | 753 | $endString = mb_substr($original, $position + $length, mb_strlen($original), "UTF-8"); |
755 | 754 | |
756 | - $out = $startString . $replacement . $endString; |
|
755 | + $out = $startString.$replacement.$endString; |
|
757 | 756 | |
758 | 757 | return $out; |
759 | 758 | } |
@@ -891,9 +890,9 @@ discard block |
||
891 | 890 | } |
892 | 891 | |
893 | 892 | function file_is_locked($filename) { |
894 | - if (file_exists(LOCK_DIRECTORY . "/$filename")) { |
|
893 | + if (file_exists(LOCK_DIRECTORY."/$filename")) { |
|
895 | 894 | if (function_exists('flock')) { |
896 | - $fp = @fopen(LOCK_DIRECTORY . "/$filename", "r"); |
|
895 | + $fp = @fopen(LOCK_DIRECTORY."/$filename", "r"); |
|
897 | 896 | if ($fp) { |
898 | 897 | if (flock($fp, LOCK_EX | LOCK_NB)) { |
899 | 898 | flock($fp, LOCK_UN); |
@@ -914,11 +913,11 @@ discard block |
||
914 | 913 | |
915 | 914 | |
916 | 915 | function make_lockfile($filename) { |
917 | - $fp = fopen(LOCK_DIRECTORY . "/$filename", "w"); |
|
916 | + $fp = fopen(LOCK_DIRECTORY."/$filename", "w"); |
|
918 | 917 | |
919 | 918 | if ($fp && flock($fp, LOCK_EX | LOCK_NB)) { |
920 | 919 | $stat_h = fstat($fp); |
921 | - $stat_f = stat(LOCK_DIRECTORY . "/$filename"); |
|
920 | + $stat_f = stat(LOCK_DIRECTORY."/$filename"); |
|
922 | 921 | |
923 | 922 | if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { |
924 | 923 | if ($stat_h["ino"] != $stat_f["ino"] || |
@@ -929,7 +928,7 @@ discard block |
||
929 | 928 | } |
930 | 929 | |
931 | 930 | if (function_exists('posix_getpid')) { |
932 | - fwrite($fp, posix_getpid() . "\n"); |
|
931 | + fwrite($fp, posix_getpid()."\n"); |
|
933 | 932 | } |
934 | 933 | return $fp; |
935 | 934 | } else { |
@@ -938,10 +937,10 @@ discard block |
||
938 | 937 | } |
939 | 938 | |
940 | 939 | function make_stampfile($filename) { |
941 | - $fp = fopen(LOCK_DIRECTORY . "/$filename", "w"); |
|
940 | + $fp = fopen(LOCK_DIRECTORY."/$filename", "w"); |
|
942 | 941 | |
943 | 942 | if (flock($fp, LOCK_EX | LOCK_NB)) { |
944 | - fwrite($fp, time() . "\n"); |
|
943 | + fwrite($fp, time()."\n"); |
|
945 | 944 | flock($fp, LOCK_UN); |
946 | 945 | fclose($fp); |
947 | 946 | return true; |
@@ -991,7 +990,7 @@ discard block |
||
991 | 990 | $params["is_default_pw"] = Pref_Prefs::isdefaultpassword(); |
992 | 991 | $params["label_base_index"] = (int) LABEL_BASE_INDEX; |
993 | 992 | |
994 | - $theme = get_pref( "USER_CSS_THEME", false, false); |
|
993 | + $theme = get_pref("USER_CSS_THEME", false, false); |
|
995 | 994 | $params["theme"] = theme_exists($theme) ? $theme : ""; |
996 | 995 | |
997 | 996 | $params["plugins"] = implode(", ", PluginHost::getInstance()->get_plugin_names()); |
@@ -1215,13 +1214,13 @@ discard block |
||
1215 | 1214 | } |
1216 | 1215 | } |
1217 | 1216 | |
1218 | - if (file_exists(LOCK_DIRECTORY . "/update_daemon.lock")) { |
|
1217 | + if (file_exists(LOCK_DIRECTORY."/update_daemon.lock")) { |
|
1219 | 1218 | |
1220 | 1219 | $data['daemon_is_running'] = (int) file_is_locked("update_daemon.lock"); |
1221 | 1220 | |
1222 | 1221 | if (time() - $_SESSION["daemon_stamp_check"] > 30) { |
1223 | 1222 | |
1224 | - $stamp = (int) @file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); |
|
1223 | + $stamp = (int) @file_get_contents(LOCK_DIRECTORY."/update_daemon.stamp"); |
|
1225 | 1224 | |
1226 | 1225 | if ($stamp) { |
1227 | 1226 | $stamp_delta = time() - $stamp; |
@@ -1264,7 +1263,7 @@ discard block |
||
1264 | 1263 | $res = trim($str); if (!$res) return ''; |
1265 | 1264 | |
1266 | 1265 | $doc = new DOMDocument(); |
1267 | - $doc->loadHTML('<?xml encoding="UTF-8">' . $res); |
|
1266 | + $doc->loadHTML('<?xml encoding="UTF-8">'.$res); |
|
1268 | 1267 | $xpath = new DOMXPath($doc); |
1269 | 1268 | |
1270 | 1269 | $rewrite_base_url = $site_url ? $site_url : get_self_url_prefix(); |
@@ -1363,7 +1362,7 @@ discard block |
||
1363 | 1362 | 'ol', 'p', 'picture', 'pre', 'q', 'ruby', 'rp', 'rt', 's', 'samp', 'section', |
1364 | 1363 | 'small', 'source', 'span', 'strike', 'strong', 'sub', 'summary', |
1365 | 1364 | 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'time', |
1366 | - 'tr', 'track', 'tt', 'u', 'ul', 'var', 'wbr', 'video', 'xml:namespace' ); |
|
1365 | + 'tr', 'track', 'tt', 'u', 'ul', 'var', 'wbr', 'video', 'xml:namespace'); |
|
1367 | 1366 | |
1368 | 1367 | if ($_SESSION['hasSandbox']) $allowed_elements[] = 'iframe'; |
1369 | 1368 | |
@@ -1498,8 +1497,8 @@ discard block |
||
1498 | 1497 | |
1499 | 1498 | // this returns SELF_URL_PATH sans ending slash |
1500 | 1499 | function get_self_url_prefix() { |
1501 | - if (strrpos(SELF_URL_PATH, "/") === strlen(SELF_URL_PATH)-1) { |
|
1502 | - return substr(SELF_URL_PATH, 0, strlen(SELF_URL_PATH)-1); |
|
1500 | + if (strrpos(SELF_URL_PATH, "/") === strlen(SELF_URL_PATH) - 1) { |
|
1501 | + return substr(SELF_URL_PATH, 0, strlen(SELF_URL_PATH) - 1); |
|
1503 | 1502 | } else { |
1504 | 1503 | return SELF_URL_PATH; |
1505 | 1504 | } |
@@ -1508,11 +1507,11 @@ discard block |
||
1508 | 1507 | /* TODO: This needs to use bcrypt */ |
1509 | 1508 | function encrypt_password($pass, $salt = '', $mode2 = false) { |
1510 | 1509 | if ($salt && $mode2) { |
1511 | - return "MODE2:" . hash('sha256', $salt . $pass); |
|
1510 | + return "MODE2:".hash('sha256', $salt.$pass); |
|
1512 | 1511 | } else if ($salt) { |
1513 | - return "SHA1X:" . sha1("$salt:$pass"); |
|
1512 | + return "SHA1X:".sha1("$salt:$pass"); |
|
1514 | 1513 | } else { |
1515 | - return "SHA1:" . sha1($pass); |
|
1514 | + return "SHA1:".sha1($pass); |
|
1516 | 1515 | } |
1517 | 1516 | } |
1518 | 1517 | |
@@ -1523,7 +1522,7 @@ discard block |
||
1523 | 1522 | } |
1524 | 1523 | |
1525 | 1524 | function build_url($parts) { |
1526 | - return $parts['scheme'] . "://" . $parts['host'] . $parts['path']; |
|
1525 | + return $parts['scheme']."://".$parts['host'].$parts['path']; |
|
1527 | 1526 | } |
1528 | 1527 | |
1529 | 1528 | function cleanup_url_path($path) { |
@@ -1567,7 +1566,7 @@ discard block |
||
1567 | 1566 | $dir = dirname($parts['path']); |
1568 | 1567 | $dir !== '/' && $dir .= '/'; |
1569 | 1568 | } |
1570 | - $parts['path'] = $dir . $rel_url; |
|
1569 | + $parts['path'] = $dir.$rel_url; |
|
1571 | 1570 | $parts['path'] = cleanup_url_path($parts['path']); |
1572 | 1571 | |
1573 | 1572 | return build_url($parts); |
@@ -1654,12 +1653,12 @@ discard block |
||
1654 | 1653 | |
1655 | 1654 | for ($i = 0; $i < $l10n->total; $i++) { |
1656 | 1655 | $orig = $l10n->get_original_string($i); |
1657 | - if(strpos($orig, "\000") !== FALSE) { // Plural forms |
|
1656 | + if (strpos($orig, "\000") !== FALSE) { // Plural forms |
|
1658 | 1657 | $key = explode(chr(0), $orig); |
1659 | 1658 | print T_js_decl($key[0], _ngettext($key[0], $key[1], 1)); // Singular |
1660 | 1659 | print T_js_decl($key[1], _ngettext($key[0], $key[1], 2)); // Plural |
1661 | 1660 | } else { |
1662 | - $translation = _dgettext($domain,$orig); |
|
1661 | + $translation = _dgettext($domain, $orig); |
|
1663 | 1662 | print T_js_decl($orig, $translation); |
1664 | 1663 | } |
1665 | 1664 | } |
@@ -1715,7 +1714,7 @@ discard block |
||
1715 | 1714 | if (file_exists($filename)) { |
1716 | 1715 | $ext = pathinfo($filename, PATHINFO_EXTENSION); |
1717 | 1716 | |
1718 | - return "data:image/$ext;base64," . base64_encode(file_get_contents($filename)); |
|
1717 | + return "data:image/$ext;base64,".base64_encode(file_get_contents($filename)); |
|
1719 | 1718 | } else { |
1720 | 1719 | return ""; |
1721 | 1720 | } |
@@ -1752,7 +1751,7 @@ discard block |
||
1752 | 1751 | |
1753 | 1752 | header("Content-type: $mimetype"); |
1754 | 1753 | |
1755 | - $stamp = gmdate("D, d M Y H:i:s", filemtime($filename)) . " GMT"; |
|
1754 | + $stamp = gmdate("D, d M Y H:i:s", filemtime($filename))." GMT"; |
|
1756 | 1755 | header("Last-Modified: $stamp", true); |
1757 | 1756 | |
1758 | 1757 | return readfile($filename); |
@@ -1762,7 +1761,7 @@ discard block |
||
1762 | 1761 | } |
1763 | 1762 | |
1764 | 1763 | function arr_qmarks($arr) { |
1765 | - return str_repeat('?,', count($arr) - 1) . '?'; |
|
1764 | + return str_repeat('?,', count($arr) - 1).'?'; |
|
1766 | 1765 | } |
1767 | 1766 | |
1768 | 1767 | function get_scripts_timestamp() { |
@@ -1797,7 +1796,7 @@ discard block |
||
1797 | 1796 | } else if (PHP_OS === "Darwin") { |
1798 | 1797 | $ttrss_version = "UNKNOWN (Unsupported, Darwin)"; |
1799 | 1798 | } else if (file_exists("$root_dir/version_static.txt")) { |
1800 | - $ttrss_version = trim(file_get_contents("$root_dir/version_static.txt")) . " (Unsupported)"; |
|
1799 | + $ttrss_version = trim(file_get_contents("$root_dir/version_static.txt"))." (Unsupported)"; |
|
1801 | 1800 | } else if (is_dir("$root_dir/.git")) { |
1802 | 1801 | $rc = 0; |
1803 | 1802 | $output = []; |
@@ -1815,10 +1814,10 @@ discard block |
||
1815 | 1814 | $git_commit = $commit; |
1816 | 1815 | $git_timestamp = $timestamp; |
1817 | 1816 | |
1818 | - $ttrss_version = strftime("%y.%m", $timestamp) . "-$commit"; |
|
1817 | + $ttrss_version = strftime("%y.%m", $timestamp)."-$commit"; |
|
1819 | 1818 | } |
1820 | 1819 | } else { |
1821 | - user_error("Unable to determine version (using $root_dir): " . implode("\n", $output), E_USER_WARNING); |
|
1820 | + user_error("Unable to determine version (using $root_dir): ".implode("\n", $output), E_USER_WARNING); |
|
1822 | 1821 | } |
1823 | 1822 | } |
1824 | 1823 |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | return true; |
79 | 79 | } |
80 | 80 | |
81 | -function ttrss_open () { |
|
81 | +function ttrss_open() { |
|
82 | 82 | return true; |
83 | 83 | } |
84 | 84 | |
85 | -function ttrss_read ($id){ |
|
85 | +function ttrss_read($id) { |
|
86 | 86 | global $session_expire; |
87 | 87 | |
88 | 88 | $sth = Db::pdo()->prepare("SELECT data FROM ttrss_sessions WHERE id=?"); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | -function ttrss_write ($id, $data) { |
|
104 | +function ttrss_write($id, $data) { |
|
105 | 105 | global $session_expire; |
106 | 106 | |
107 | 107 | $data = base64_encode($data); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | return true; |
122 | 122 | } |
123 | 123 | |
124 | -function ttrss_close () { |
|
124 | +function ttrss_close() { |
|
125 | 125 | return true; |
126 | 126 | } |
127 | 127 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | return true; |
133 | 133 | } |
134 | 134 | |
135 | -function ttrss_gc () { |
|
136 | - Db::pdo()->query("DELETE FROM ttrss_sessions WHERE expire < " . time()); |
|
135 | +function ttrss_gc() { |
|
136 | + Db::pdo()->query("DELETE FROM ttrss_sessions WHERE expire < ".time()); |
|
137 | 137 | |
138 | 138 | return true; |
139 | 139 | } |