@@ -1060,8 +1060,8 @@ |
||
| 1060 | 1060 | $authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]); |
| 1061 | 1061 | |
| 1062 | 1062 | if ($authenticator && |
| 1063 | - method_exists($authenticator, "check_password") && |
|
| 1064 | - $authenticator->check_password($_SESSION["uid"], "password")) { |
|
| 1063 | + method_exists($authenticator, "check_password") && |
|
| 1064 | + $authenticator->check_password($_SESSION["uid"], "password")) { |
|
| 1065 | 1065 | |
| 1066 | 1066 | return true; |
| 1067 | 1067 | } |
@@ -1573,8 +1573,8 @@ |
||
| 1573 | 1573 | static function remove_feed($id, $owner_uid) { |
| 1574 | 1574 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_UNSUBSCRIBE_FEED) as $p) { |
| 1575 | 1575 | if (! $p->hook_unsubscribe_feed($id, $owner_uid)) { |
| 1576 | - user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
|
| 1577 | - return; |
|
| 1576 | + user_error("Feed $id (owner: $owner_uid) not removed due to plugin error (HOOK_UNSUBSCRIBE_FEED).", E_USER_WARNING); |
|
| 1577 | + return; |
|
| 1578 | 1578 | } |
| 1579 | 1579 | } |
| 1580 | 1580 | |
@@ -78,17 +78,17 @@ discard block |
||
| 78 | 78 | $scope_inner_qparts = []; |
| 79 | 79 | foreach ($rule["feed_id"] as $feed_id) { |
| 80 | 80 | |
| 81 | - if (strpos($feed_id, "CAT:") === 0) { |
|
| 82 | - $cat_id = (int) substr($feed_id, 4); |
|
| 83 | - array_push($scope_inner_qparts, "cat_id = " . $this->pdo->quote($cat_id)); |
|
| 84 | - } else if ($feed_id > 0) { |
|
| 85 | - array_push($scope_inner_qparts, "feed_id = " . $this->pdo->quote($feed_id)); |
|
| 86 | - } |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - if (count($scope_inner_qparts) > 0) { |
|
| 90 | - array_push($scope_qparts, "(" . implode(" OR ", $scope_inner_qparts) . ")"); |
|
| 91 | - } |
|
| 81 | + if (strpos($feed_id, "CAT:") === 0) { |
|
| 82 | + $cat_id = (int) substr($feed_id, 4); |
|
| 83 | + array_push($scope_inner_qparts, "cat_id = " . $this->pdo->quote($cat_id)); |
|
| 84 | + } else if ($feed_id > 0) { |
|
| 85 | + array_push($scope_inner_qparts, "feed_id = " . $this->pdo->quote($feed_id)); |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + if (count($scope_inner_qparts) > 0) { |
|
| 90 | + array_push($scope_qparts, "(" . implode(" OR ", $scope_inner_qparts) . ")"); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | 93 | array_push($filter["rules"], $rule); |
| 94 | 94 | |
@@ -196,32 +196,32 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | while ($line = $sth->fetch()) { |
| 198 | 198 | |
| 199 | - if ($line["match_on"]) { |
|
| 200 | - $feeds = json_decode($line["match_on"], true); |
|
| 201 | - $feeds_fmt = []; |
|
| 199 | + if ($line["match_on"]) { |
|
| 200 | + $feeds = json_decode($line["match_on"], true); |
|
| 201 | + $feeds_fmt = []; |
|
| 202 | 202 | |
| 203 | - foreach ($feeds as $feed_id) { |
|
| 203 | + foreach ($feeds as $feed_id) { |
|
| 204 | 204 | |
| 205 | - if (strpos($feed_id, "CAT:") === 0) { |
|
| 206 | - $feed_id = (int)substr($feed_id, 4); |
|
| 207 | - array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 208 | - } else { |
|
| 209 | - if ($feed_id) |
|
| 210 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 211 | - else |
|
| 212 | - array_push($feeds_fmt, __("All feeds")); |
|
| 213 | - } |
|
| 214 | - } |
|
| 205 | + if (strpos($feed_id, "CAT:") === 0) { |
|
| 206 | + $feed_id = (int)substr($feed_id, 4); |
|
| 207 | + array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 208 | + } else { |
|
| 209 | + if ($feed_id) |
|
| 210 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 211 | + else |
|
| 212 | + array_push($feeds_fmt, __("All feeds")); |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - $where = implode(", ", $feeds_fmt); |
|
| 216 | + $where = implode(", ", $feeds_fmt); |
|
| 217 | 217 | |
| 218 | - } else { |
|
| 218 | + } else { |
|
| 219 | 219 | |
| 220 | - $where = $line["cat_filter"] ? |
|
| 221 | - Feeds::getCategoryTitle($line["cat_id"]) : |
|
| 222 | - ($line["feed_id"] ? |
|
| 223 | - Feeds::getFeedTitle($line["feed_id"]) : __("All feeds")); |
|
| 224 | - } |
|
| 220 | + $where = $line["cat_filter"] ? |
|
| 221 | + Feeds::getCategoryTitle($line["cat_id"]) : |
|
| 222 | + ($line["feed_id"] ? |
|
| 223 | + Feeds::getFeedTitle($line["feed_id"]) : __("All feeds")); |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | 226 | # $where = $line["cat_id"] . "/" . $line["feed_id"]; |
| 227 | 227 | |
@@ -527,18 +527,18 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | foreach ($feeds as $feed_id) { |
| 529 | 529 | |
| 530 | - if (strpos($feed_id, "CAT:") === 0) { |
|
| 531 | - $feed_id = (int)substr($feed_id, 4); |
|
| 532 | - array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 533 | - } else { |
|
| 534 | - if ($feed_id) |
|
| 535 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 536 | - else |
|
| 537 | - array_push($feeds_fmt, __("All feeds")); |
|
| 538 | - } |
|
| 539 | - } |
|
| 540 | - |
|
| 541 | - $feed = implode(", ", $feeds_fmt); |
|
| 530 | + if (strpos($feed_id, "CAT:") === 0) { |
|
| 531 | + $feed_id = (int)substr($feed_id, 4); |
|
| 532 | + array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
|
| 533 | + } else { |
|
| 534 | + if ($feed_id) |
|
| 535 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
| 536 | + else |
|
| 537 | + array_push($feeds_fmt, __("All feeds")); |
|
| 538 | + } |
|
| 539 | + } |
|
| 540 | + |
|
| 541 | + $feed = implode(", ", $feeds_fmt); |
|
| 542 | 542 | |
| 543 | 543 | $sth = $this->pdo->prepare("SELECT description FROM ttrss_filter_types |
| 544 | 544 | WHERE id = ?"); |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | class Dlg extends Handler_Protected { |
| 3 | 3 | private $param; |
| 4 | - private $params; |
|
| 4 | + private $params; |
|
| 5 | 5 | |
| 6 | - function before($method) { |
|
| 6 | + function before($method) { |
|
| 7 | 7 | if (parent::before($method)) { |
| 8 | 8 | header("Content-Type: text/html"); # required for iframe |
| 9 | 9 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $tags[$line["tag_name"]] = $line["count"]; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if(count($tags) == 0 ){ return; } |
|
| 111 | + if(count($tags) == 0 ){ return; } |
|
| 112 | 112 | |
| 113 | 113 | ksort($tags); |
| 114 | 114 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | function defaultPasswordWarning() { |
| 195 | 195 | |
| 196 | - print_warning(__("You are using default tt-rss password. Please change it in the Preferences (Personal data / Authentication).")); |
|
| 196 | + print_warning(__("You are using default tt-rss password. Please change it in the Preferences (Personal data / Authentication).")); |
|
| 197 | 197 | |
| 198 | 198 | print "<footer class='text-center'>"; |
| 199 | 199 | print "<button dojoType='dijit.form.Button' onclick=\"document.location.href = 'prefs.php'\">". |
@@ -1,86 +1,86 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Debug { |
| 3 | 3 | public static $LOG_DISABLED = -1; |
| 4 | - public static $LOG_NORMAL = 0; |
|
| 5 | - public static $LOG_VERBOSE = 1; |
|
| 6 | - public static $LOG_EXTENDED = 2; |
|
| 4 | + public static $LOG_NORMAL = 0; |
|
| 5 | + public static $LOG_VERBOSE = 1; |
|
| 6 | + public static $LOG_EXTENDED = 2; |
|
| 7 | 7 | |
| 8 | - private static $enabled = false; |
|
| 9 | - private static $quiet = false; |
|
| 10 | - private static $logfile = false; |
|
| 11 | - private static $loglevel = 0; |
|
| 8 | + private static $enabled = false; |
|
| 9 | + private static $quiet = false; |
|
| 10 | + private static $logfile = false; |
|
| 11 | + private static $loglevel = 0; |
|
| 12 | 12 | |
| 13 | 13 | public static function set_logfile($logfile) { |
| 14 | - Debug::$logfile = $logfile; |
|
| 15 | - } |
|
| 14 | + Debug::$logfile = $logfile; |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - public static function enabled() { |
|
| 18 | - return Debug::$enabled; |
|
| 19 | - } |
|
| 17 | + public static function enabled() { |
|
| 18 | + return Debug::$enabled; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public static function set_enabled($enable) { |
|
| 22 | - Debug::$enabled = $enable; |
|
| 23 | - } |
|
| 21 | + public static function set_enabled($enable) { |
|
| 22 | + Debug::$enabled = $enable; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public static function set_quiet($quiet) { |
|
| 26 | - Debug::$quiet = $quiet; |
|
| 27 | - } |
|
| 25 | + public static function set_quiet($quiet) { |
|
| 26 | + Debug::$quiet = $quiet; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - public static function set_loglevel($level) { |
|
| 30 | - Debug::$loglevel = $level; |
|
| 31 | - } |
|
| 29 | + public static function set_loglevel($level) { |
|
| 30 | + Debug::$loglevel = $level; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - public static function get_loglevel() { |
|
| 34 | - return Debug::$loglevel; |
|
| 35 | - } |
|
| 33 | + public static function get_loglevel() { |
|
| 34 | + return Debug::$loglevel; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - public static function log($message, $level = 0) { |
|
| 37 | + public static function log($message, $level = 0) { |
|
| 38 | 38 | |
| 39 | - if (!Debug::$enabled || Debug::$loglevel < $level) return false; |
|
| 39 | + if (!Debug::$enabled || Debug::$loglevel < $level) return false; |
|
| 40 | 40 | |
| 41 | - $ts = strftime("%H:%M:%S", time()); |
|
| 42 | - if (function_exists('posix_getpid')) { |
|
| 43 | - $ts = "$ts/" . posix_getpid(); |
|
| 44 | - } |
|
| 41 | + $ts = strftime("%H:%M:%S", time()); |
|
| 42 | + if (function_exists('posix_getpid')) { |
|
| 43 | + $ts = "$ts/" . posix_getpid(); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - if (Debug::$logfile) { |
|
| 47 | - $fp = fopen(Debug::$logfile, 'a+'); |
|
| 46 | + if (Debug::$logfile) { |
|
| 47 | + $fp = fopen(Debug::$logfile, 'a+'); |
|
| 48 | 48 | |
| 49 | - if ($fp) { |
|
| 50 | - $locked = false; |
|
| 49 | + if ($fp) { |
|
| 50 | + $locked = false; |
|
| 51 | 51 | |
| 52 | - if (function_exists("flock")) { |
|
| 53 | - $tries = 0; |
|
| 52 | + if (function_exists("flock")) { |
|
| 53 | + $tries = 0; |
|
| 54 | 54 | |
| 55 | - // try to lock logfile for writing |
|
| 56 | - while ($tries < 5 && !$locked = flock($fp, LOCK_EX | LOCK_NB)) { |
|
| 57 | - sleep(1); |
|
| 58 | - ++$tries; |
|
| 59 | - } |
|
| 55 | + // try to lock logfile for writing |
|
| 56 | + while ($tries < 5 && !$locked = flock($fp, LOCK_EX | LOCK_NB)) { |
|
| 57 | + sleep(1); |
|
| 58 | + ++$tries; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - if (!$locked) { |
|
| 62 | - fclose($fp); |
|
| 63 | - user_error("Unable to lock debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
| 64 | - return; |
|
| 65 | - } |
|
| 66 | - } |
|
| 61 | + if (!$locked) { |
|
| 62 | + fclose($fp); |
|
| 63 | + user_error("Unable to lock debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
| 64 | + return; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - fputs($fp, "[$ts] $message\n"); |
|
| 68 | + fputs($fp, "[$ts] $message\n"); |
|
| 69 | 69 | |
| 70 | - if (function_exists("flock")) { |
|
| 71 | - flock($fp, LOCK_UN); |
|
| 72 | - } |
|
| 70 | + if (function_exists("flock")) { |
|
| 71 | + flock($fp, LOCK_UN); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - fclose($fp); |
|
| 74 | + fclose($fp); |
|
| 75 | 75 | |
| 76 | - if (Debug::$quiet) |
|
| 77 | - return; |
|
| 76 | + if (Debug::$quiet) |
|
| 77 | + return; |
|
| 78 | 78 | |
| 79 | - } else { |
|
| 80 | - user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
| 81 | - } |
|
| 82 | - } |
|
| 79 | + } else { |
|
| 80 | + user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
| 81 | + } |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - print "[$ts] $message\n"; |
|
| 85 | - } |
|
| 84 | + print "[$ts] $message\n"; |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | \ No newline at end of file |
@@ -702,7 +702,7 @@ |
||
| 702 | 702 | $entry_plugin_data .= mb_strtolower(get_class($plugin)) . ","; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | - if (Debug::get_loglevel() >= 3) { |
|
| 705 | + if (Debug::get_loglevel() >= 3) { |
|
| 706 | 706 | print "processed content: "; |
| 707 | 707 | print htmlspecialchars($article["content"]); |
| 708 | 708 | print "\n"; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | array_push($rv, [ "label" => $title, "value" => $id ]); |
| 287 | 287 | } |
| 288 | - } |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | 290 | print json_encode($rv); |
| 291 | 291 | } |
@@ -358,37 +358,37 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | $enclosures = Article::get_article_enclosures($line["id"]); |
| 360 | 360 | |
| 361 | - header("Content-Type: text/html"); |
|
| 361 | + header("Content-Type: text/html"); |
|
| 362 | 362 | |
| 363 | - $rv .= "<!DOCTYPE html> |
|
| 363 | + $rv .= "<!DOCTYPE html> |
|
| 364 | 364 | <html><head> |
| 365 | 365 | <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> |
| 366 | 366 | <title>".$line["title"]."</title>". |
| 367 | - stylesheet_tag("css/default.css")." |
|
| 367 | + stylesheet_tag("css/default.css")." |
|
| 368 | 368 | <link rel='shortcut icon' type='image/png' href='images/favicon.png'> |
| 369 | 369 | <link rel='icon' type='image/png' sizes='72x72' href='images/favicon-72px.png'>"; |
| 370 | 370 | |
| 371 | - $rv .= "<meta property='og:title' content=\"".htmlspecialchars(html_entity_decode($line["title"], ENT_NOQUOTES | ENT_HTML401))."\"/>\n"; |
|
| 372 | - $rv .= "<meta property='og:description' content=\"". |
|
| 373 | - htmlspecialchars( |
|
| 374 | - truncate_string( |
|
| 375 | - preg_replace("/[\r\n\t]/", "", |
|
| 371 | + $rv .= "<meta property='og:title' content=\"".htmlspecialchars(html_entity_decode($line["title"], ENT_NOQUOTES | ENT_HTML401))."\"/>\n"; |
|
| 372 | + $rv .= "<meta property='og:description' content=\"". |
|
| 373 | + htmlspecialchars( |
|
| 374 | + truncate_string( |
|
| 375 | + preg_replace("/[\r\n\t]/", "", |
|
| 376 | 376 | preg_replace("/ {1,}/", " ", |
| 377 | 377 | strip_tags(html_entity_decode($line["content"], ENT_NOQUOTES | ENT_HTML401)) |
| 378 | 378 | ) |
| 379 | 379 | ), 500, "...") |
| 380 | 380 | )."\"/>\n"; |
| 381 | 381 | |
| 382 | - $rv .= "</head>"; |
|
| 382 | + $rv .= "</head>"; |
|
| 383 | 383 | |
| 384 | - list ($og_image, $og_stream) = Article::get_article_image($enclosures, $line['content'], $line["site_url"]); |
|
| 384 | + list ($og_image, $og_stream) = Article::get_article_image($enclosures, $line['content'], $line["site_url"]); |
|
| 385 | 385 | |
| 386 | - if ($og_image) { |
|
| 387 | - $rv .= "<meta property='og:image' content=\"" . htmlspecialchars($og_image) . "\"/>"; |
|
| 388 | - } |
|
| 386 | + if ($og_image) { |
|
| 387 | + $rv .= "<meta property='og:image' content=\"" . htmlspecialchars($og_image) . "\"/>"; |
|
| 388 | + } |
|
| 389 | 389 | |
| 390 | - $rv .= "<body class='flat ttrss_utility ttrss_zoom'>"; |
|
| 391 | - $rv .= "<div class='container'>"; |
|
| 390 | + $rv .= "<body class='flat ttrss_utility ttrss_zoom'>"; |
|
| 391 | + $rv .= "<div class='container'>"; |
|
| 392 | 392 | |
| 393 | 393 | if ($line["link"]) { |
| 394 | 394 | $rv .= "<h1><a target='_blank' rel='noopener noreferrer' |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $owner_uid, true); |
| 411 | 411 | |
| 412 | 412 | $rv .= "<div>".$line['author']."</div>"; |
| 413 | - $rv .= "<div>$parsed_updated</div>"; |
|
| 413 | + $rv .= "<div>$parsed_updated</div>"; |
|
| 414 | 414 | |
| 415 | 415 | $rv .= "</div>"; # row |
| 416 | 416 | |
@@ -425,10 +425,10 @@ discard block |
||
| 425 | 425 | |
| 426 | 426 | $rv .= $line["content"]; |
| 427 | 427 | |
| 428 | - $rv .= Article::format_article_enclosures($id, |
|
| 429 | - $line["always_display_enclosures"], |
|
| 430 | - $line["content"], |
|
| 431 | - $line["hide_images"]); |
|
| 428 | + $rv .= Article::format_article_enclosures($id, |
|
| 429 | + $line["always_display_enclosures"], |
|
| 430 | + $line["content"], |
|
| 431 | + $line["hide_images"]); |
|
| 432 | 432 | |
| 433 | 433 | $rv .= "</div>"; # content |
| 434 | 434 | |
@@ -675,8 +675,8 @@ discard block |
||
| 675 | 675 | if ($sth->fetch()) { |
| 676 | 676 | $_SESSION["profile"] = $profile; |
| 677 | 677 | } else { |
| 678 | - $_SESSION["profile"] = null; |
|
| 679 | - } |
|
| 678 | + $_SESSION["profile"] = null; |
|
| 679 | + } |
|
| 680 | 680 | } |
| 681 | 681 | } else { |
| 682 | 682 | |
@@ -202,36 +202,36 @@ discard block |
||
| 202 | 202 | $cat_filter = $tmp_line["cat_filter"]; |
| 203 | 203 | |
| 204 | 204 | if (!$tmp_line["match_on"]) { |
| 205 | - if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) { |
|
| 206 | - $tmp_line["feed"] = Feeds::getFeedTitle( |
|
| 207 | - $cat_filter ? $tmp_line["cat_id"] : $tmp_line["feed_id"], |
|
| 208 | - $cat_filter); |
|
| 209 | - } else { |
|
| 210 | - $tmp_line["feed"] = ""; |
|
| 211 | - } |
|
| 212 | - } else { |
|
| 213 | - $match = []; |
|
| 214 | - foreach (json_decode($tmp_line["match_on"], true) as $feed_id) { |
|
| 215 | - |
|
| 216 | - if (strpos($feed_id, "CAT:") === 0) { |
|
| 217 | - $feed_id = (int)substr($feed_id, 4); |
|
| 218 | - if ($feed_id) { |
|
| 219 | - array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]); |
|
| 220 | - } else { |
|
| 221 | - array_push($match, [0, true, true]); |
|
| 222 | - } |
|
| 223 | - } else { |
|
| 224 | - if ($feed_id) { |
|
| 225 | - array_push($match, [Feeds::getFeedTitle((int)$feed_id), false, false]); |
|
| 226 | - } else { |
|
| 227 | - array_push($match, [0, false, true]); |
|
| 228 | - } |
|
| 229 | - } |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - $tmp_line["match"] = $match; |
|
| 233 | - unset($tmp_line["match_on"]); |
|
| 234 | - } |
|
| 205 | + if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) { |
|
| 206 | + $tmp_line["feed"] = Feeds::getFeedTitle( |
|
| 207 | + $cat_filter ? $tmp_line["cat_id"] : $tmp_line["feed_id"], |
|
| 208 | + $cat_filter); |
|
| 209 | + } else { |
|
| 210 | + $tmp_line["feed"] = ""; |
|
| 211 | + } |
|
| 212 | + } else { |
|
| 213 | + $match = []; |
|
| 214 | + foreach (json_decode($tmp_line["match_on"], true) as $feed_id) { |
|
| 215 | + |
|
| 216 | + if (strpos($feed_id, "CAT:") === 0) { |
|
| 217 | + $feed_id = (int)substr($feed_id, 4); |
|
| 218 | + if ($feed_id) { |
|
| 219 | + array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]); |
|
| 220 | + } else { |
|
| 221 | + array_push($match, [0, true, true]); |
|
| 222 | + } |
|
| 223 | + } else { |
|
| 224 | + if ($feed_id) { |
|
| 225 | + array_push($match, [Feeds::getFeedTitle((int)$feed_id), false, false]); |
|
| 226 | + } else { |
|
| 227 | + array_push($match, [0, false, true]); |
|
| 228 | + } |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + $tmp_line["match"] = $match; |
|
| 233 | + unset($tmp_line["match_on"]); |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | 236 | unset($tmp_line["feed_id"]); |
| 237 | 237 | unset($tmp_line["cat_id"]); |
@@ -403,28 +403,28 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | if ($rule["match"]) { |
| 405 | 405 | |
| 406 | - $match_on = []; |
|
| 406 | + $match_on = []; |
|
| 407 | 407 | |
| 408 | - foreach ($rule["match"] as $match) { |
|
| 409 | - list ($name, $is_cat, $is_id) = $match; |
|
| 408 | + foreach ($rule["match"] as $match) { |
|
| 409 | + list ($name, $is_cat, $is_id) = $match; |
|
| 410 | 410 | |
| 411 | - if ($is_id) { |
|
| 412 | - array_push($match_on, ($is_cat ? "CAT:" : "") . $name); |
|
| 413 | - } else { |
|
| 411 | + if ($is_id) { |
|
| 412 | + array_push($match_on, ($is_cat ? "CAT:" : "") . $name); |
|
| 413 | + } else { |
|
| 414 | 414 | |
| 415 | - if (!$is_cat) { |
|
| 416 | - $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds |
|
| 415 | + if (!$is_cat) { |
|
| 416 | + $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds |
|
| 417 | 417 | WHERE title = ? AND owner_uid = ?"); |
| 418 | 418 | |
| 419 | - $tsth->execute([$name, $_SESSION['uid']]); |
|
| 419 | + $tsth->execute([$name, $_SESSION['uid']]); |
|
| 420 | 420 | |
| 421 | - if ($row = $tsth->fetch()) { |
|
| 422 | - $match_id = $row['id']; |
|
| 421 | + if ($row = $tsth->fetch()) { |
|
| 422 | + $match_id = $row['id']; |
|
| 423 | 423 | |
| 424 | 424 | array_push($match_on, $match_id); |
| 425 | - } |
|
| 426 | - } else { |
|
| 427 | - $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feed_categories |
|
| 425 | + } |
|
| 426 | + } else { |
|
| 427 | + $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feed_categories |
|
| 428 | 428 | WHERE title = ? AND owner_uid = ?"); |
| 429 | 429 | $tsth->execute([$name, $_SESSION['uid']]); |
| 430 | 430 | |
@@ -433,33 +433,33 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | array_push($match_on, "CAT:$match_id"); |
| 435 | 435 | } |
| 436 | - } |
|
| 437 | - } |
|
| 438 | - } |
|
| 436 | + } |
|
| 437 | + } |
|
| 438 | + } |
|
| 439 | 439 | |
| 440 | - $reg_exp = $rule["reg_exp"]; |
|
| 441 | - $filter_type = (int)$rule["filter_type"]; |
|
| 442 | - $inverse = bool_to_sql_bool($rule["inverse"]); |
|
| 443 | - $match_on = json_encode($match_on); |
|
| 440 | + $reg_exp = $rule["reg_exp"]; |
|
| 441 | + $filter_type = (int)$rule["filter_type"]; |
|
| 442 | + $inverse = bool_to_sql_bool($rule["inverse"]); |
|
| 443 | + $match_on = json_encode($match_on); |
|
| 444 | 444 | |
| 445 | - $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules |
|
| 445 | + $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules |
|
| 446 | 446 | (feed_id,cat_id,match_on,filter_id,filter_type,reg_exp,cat_filter,inverse) |
| 447 | 447 | VALUES |
| 448 | 448 | (NULL, NULL, ?, ?, ?, ?, false, ?)"); |
| 449 | - $usth->execute([$match_on, $filter_id, $filter_type, $reg_exp, $inverse]); |
|
| 449 | + $usth->execute([$match_on, $filter_id, $filter_type, $reg_exp, $inverse]); |
|
| 450 | 450 | |
| 451 | - } else { |
|
| 451 | + } else { |
|
| 452 | 452 | |
| 453 | - if (!$rule["cat_filter"]) { |
|
| 454 | - $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds |
|
| 453 | + if (!$rule["cat_filter"]) { |
|
| 454 | + $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds |
|
| 455 | 455 | WHERE title = ? AND owner_uid = ?"); |
| 456 | 456 | |
| 457 | - $tsth->execute([$rule['feed'], $_SESSION['uid']]); |
|
| 457 | + $tsth->execute([$rule['feed'], $_SESSION['uid']]); |
|
| 458 | 458 | |
| 459 | - if ($row = $tsth->fetch()) { |
|
| 460 | - $feed_id = $row['id']; |
|
| 461 | - } |
|
| 462 | - } else { |
|
| 459 | + if ($row = $tsth->fetch()) { |
|
| 460 | + $feed_id = $row['id']; |
|
| 461 | + } |
|
| 462 | + } else { |
|
| 463 | 463 | $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feed_categories |
| 464 | 464 | WHERE title = ? AND owner_uid = ?"); |
| 465 | 465 | |
@@ -468,19 +468,19 @@ discard block |
||
| 468 | 468 | if ($row = $tsth->fetch()) { |
| 469 | 469 | $feed_id = $row['id']; |
| 470 | 470 | } |
| 471 | - } |
|
| 471 | + } |
|
| 472 | 472 | |
| 473 | - $cat_filter = bool_to_sql_bool($rule["cat_filter"]); |
|
| 474 | - $reg_exp = $rule["reg_exp"]; |
|
| 475 | - $filter_type = (int)$rule["filter_type"]; |
|
| 476 | - $inverse = bool_to_sql_bool($rule["inverse"]); |
|
| 473 | + $cat_filter = bool_to_sql_bool($rule["cat_filter"]); |
|
| 474 | + $reg_exp = $rule["reg_exp"]; |
|
| 475 | + $filter_type = (int)$rule["filter_type"]; |
|
| 476 | + $inverse = bool_to_sql_bool($rule["inverse"]); |
|
| 477 | 477 | |
| 478 | - $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules |
|
| 478 | + $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules |
|
| 479 | 479 | (feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter,inverse) |
| 480 | 480 | VALUES |
| 481 | 481 | (?, ?, ?, ?, ?, ?, ?)"); |
| 482 | - $usth->execute([$feed_id, $cat_id, $filter_id, $filter_type, $reg_exp, $cat_filter, $inverse]); |
|
| 483 | - } |
|
| 482 | + $usth->execute([$feed_id, $cat_id, $filter_id, $filter_type, $reg_exp, $cat_filter, $inverse]); |
|
| 483 | + } |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | foreach ($filter["actions"] as $action) { |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | $sth = $this->pdo->prepare("SELECT link FROM ttrss_entries, ttrss_user_entries |
| 14 | 14 | WHERE id = ? AND id = ref_id AND owner_uid = ? |
| 15 | 15 | LIMIT 1"); |
| 16 | - $sth->execute([$id, $_SESSION['uid']]); |
|
| 16 | + $sth->execute([$id, $_SESSION['uid']]); |
|
| 17 | 17 | |
| 18 | 18 | if ($row = $sth->fetch()) { |
| 19 | 19 | $article_url = $row['link']; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | $sth = $pdo->prepare("SELECT int_id FROM ttrss_user_entries WHERE |
| 141 | 141 | ref_id = ? AND owner_uid = ? LIMIT 1"); |
| 142 | - $sth->execute([$ref_id, $owner_uid]); |
|
| 142 | + $sth->execute([$ref_id, $owner_uid]); |
|
| 143 | 143 | |
| 144 | 144 | if ($row = $sth->fetch()) { |
| 145 | 145 | $int_id = $row['int_id']; |
@@ -678,22 +678,22 @@ discard block |
||
| 678 | 678 | |
| 679 | 679 | static function purge_orphans() { |
| 680 | 680 | |
| 681 | - // purge orphaned posts in main content table |
|
| 681 | + // purge orphaned posts in main content table |
|
| 682 | 682 | |
| 683 | - if (DB_TYPE == "mysql") |
|
| 684 | - $limit_qpart = "LIMIT 5000"; |
|
| 685 | - else |
|
| 686 | - $limit_qpart = ""; |
|
| 683 | + if (DB_TYPE == "mysql") |
|
| 684 | + $limit_qpart = "LIMIT 5000"; |
|
| 685 | + else |
|
| 686 | + $limit_qpart = ""; |
|
| 687 | 687 | |
| 688 | - $pdo = Db::pdo(); |
|
| 689 | - $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
|
| 688 | + $pdo = Db::pdo(); |
|
| 689 | + $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
|
| 690 | 690 | NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id) $limit_qpart"); |
| 691 | 691 | |
| 692 | - if (Debug::enabled()) { |
|
| 693 | - $rows = $res->rowCount(); |
|
| 694 | - Debug::log("Purged $rows orphaned posts."); |
|
| 695 | - } |
|
| 696 | - } |
|
| 692 | + if (Debug::enabled()) { |
|
| 693 | + $rows = $res->rowCount(); |
|
| 694 | + Debug::log("Purged $rows orphaned posts."); |
|
| 695 | + } |
|
| 696 | + } |
|
| 697 | 697 | |
| 698 | 698 | static function catchupArticlesById($ids, $cmode, $owner_uid = false) { |
| 699 | 699 | |