$filter = array();
$filter["enabled"] = true;
- $filter["match_any_rule"] = sql_bool_to_bool(
- checkbox_to_sql_bool($_REQUEST["match_any_rule"]));
- $filter["inverse"] = sql_bool_to_bool(
- checkbox_to_sql_bool($_REQUEST["inverse"]));
+ $filter["match_any_rule"] = checkbox_to_sql_bool($_REQUEST["match_any_rule"]);
+ $filter["inverse"] = checkbox_to_sql_bool($_REQUEST["inverse"]);
$filter["rules"] = array();
$filter["actions"] = array("dummy-action");
//while ($found < $limit && $offset < $limit * 1000 && time() - $started < ini_get("max_execution_time") * 0.7) {
- $sth = $this->pdo->prepare("SELECT ttrss_entries.id,
- ttrss_entries.title,
- ttrss_feeds.id AS feed_id,
- ttrss_feeds.title AS feed_title,
- ttrss_feed_categories.id AS cat_id,
- content,
- date_entered,
- link,
- author,
- tag_cache
- FROM
- ttrss_entries, ttrss_user_entries
- LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)
- LEFT JOIN ttrss_feed_categories ON (ttrss_feeds.cat_id = ttrss_feed_categories.id)
- WHERE
- ref_id = ttrss_entries.id AND
- ($scope_qpart) AND
- ttrss_user_entries.owner_uid = ?
- ORDER BY date_entered DESC LIMIT ?OFFSET ?");
-
- $sth->execute([$_SESSION['uid'], $limit, $offset]);;
-
- while ($line = $sth->fetch()) {
-
- $rc = RSSUtils::get_article_filters(array($filter), $line['title'], $line['content'], $line['link'],
- $line['author'], explode(",", $line['tag_cache']));
-
- if (count($rc) > 0) {
-
- $line["content_preview"] = truncate_string(strip_tags($line["content"]), 200, '…');
-
- foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
- $line = $p->hook_query_headlines($line, 100);
- }
+ $sth = $this->pdo->prepare("SELECT ttrss_entries.id,
+ ttrss_entries.title,
+ ttrss_feeds.id AS feed_id,
+ ttrss_feeds.title AS feed_title,
+ ttrss_feed_categories.id AS cat_id,
+ content,
+ date_entered,
+ link,
+ author,
+ tag_cache
+ FROM
+ ttrss_entries, ttrss_user_entries
+ LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)
+ LEFT JOIN ttrss_feed_categories ON (ttrss_feeds.cat_id = ttrss_feed_categories.id)
+ WHERE
+ ref_id = ttrss_entries.id AND
+ ($scope_qpart) AND
+ ttrss_user_entries.owner_uid = ?
+ ORDER BY date_entered DESC LIMIT $limit OFFSET $offset");
+
+ $sth->execute([$_SESSION['uid']]);
- $content_preview = $line["content_preview"];
+ while ($line = $sth->fetch()) {
- $tmp = "<tr style='margin-top : 5px'>";
+ $rc = RSSUtils::get_article_filters(array($filter), $line['title'], $line['content'], $line['link'],
+ $line['author'], explode(",", $line['tag_cache']));
- #$tmp .= "<td width='5%' align='center'><input dojoType=\"dijit.form.CheckBox\"
- # checked=\"1\" disabled=\"1\" type=\"checkbox\"></td>";
+ if (count($rc) > 0) {
- $id = $line['id'];
- $tmp .= "<td width='5%' align='center'><img style='cursor : pointer' title='".__("Preview article")."'
- src='images/information.png' onclick='openArticlePopup($id)'></td><td>";
+ $line["content_preview"] = truncate_string(strip_tags($line["content"]), 200, '…');
- /*foreach ($filter['rules'] as $rule) {
- $reg_exp = str_replace('/', '\/', $rule["reg_exp"]);
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
+ $line = $p->hook_query_headlines($line, 100);
+ }
- $line["title"] = preg_replace("/($reg_exp)/i",
- "<span class=\"highlight\">$1</span>", $line["title"]);
+ $content_preview = $line["content_preview"];
- $content_preview = preg_replace("/($reg_exp)/i",
- "<span class=\"highlight\">$1</span>", $content_preview);
- }*/
+ $tmp = "<tr style='margin-top : 5px'>";
- $tmp .= "<strong>" . $line["title"] . "</strong><br/>";
- $tmp .= $line['feed_title'] . ", " . mb_substr($line["date_entered"], 0, 16);
- $tmp .= "<div class='insensitive'>" . $content_preview . "</div>";
- $tmp .= "</td></tr>";
+ #$tmp .= "<td width='5%' align='center'><input dojoType=\"dijit.form.CheckBox\"
+ # checked=\"1\" disabled=\"1\" type=\"checkbox\"></td>";
- array_push($rv, $tmp);
+ $id = $line['id'];
+ $tmp .= "<td width='5%' align='center'><img style='cursor : pointer' title='".__("Preview article")."'
+ src='images/information.png' onclick='openArticlePopup($id)'></td><td>";
- /*array_push($rv, array("title" => $line["title"],
- "content" => $content_preview,
- "date" => $line["date_entered"],
- "feed" => $line["feed_title"])); */
+ /*foreach ($filter['rules'] as $rule) {
+ $reg_exp = str_replace('/', '\/', $rule["reg_exp"]);
+
+ $line["title"] = preg_replace("/($reg_exp)/i",
+ "<span class=\"highlight\">$1</span>", $line["title"]);
+
+ $content_preview = preg_replace("/($reg_exp)/i",
+ "<span class=\"highlight\">$1</span>", $content_preview);
+ }*/
+
+ $tmp .= "<strong>" . $line["title"] . "</strong><br/>";
+ $tmp .= $line['feed_title'] . ", " . mb_substr($line["date_entered"], 0, 16);
+ $tmp .= "<div class='insensitive'>" . $content_preview . "</div>";
+ $tmp .= "</td></tr>";
+
+ array_push($rv, $tmp);
+
+ /*array_push($rv, array("title" => $line["title"],
+ "content" => $content_preview,
+ "date" => $line["date_entered"],
+ "feed" => $line["feed_title"])); */
- }
}
+ }
//$offset += $limit;
//}
} else {
- $where = sql_bool_to_bool($line["cat_filter"]) ?
+ $where = $line["cat_filter"] ?
Feeds::getCategoryTitle($line["cat_id"]) :
($line["feed_id"] ?
Feeds::getFeedTitle($line["feed_id"]) : __("All feeds"));
# $where = $line["cat_id"] . "/" . $line["feed_id"];
- $inverse = sql_bool_to_bool($line["inverse"]) ? "inverse" : "";
+ $inverse = $line["inverse"] ? "inverse" : "";
$rv .= "<span class='$inverse'>" . T_sprintf("%s on %s in %s %s",
htmlspecialchars($line["reg_exp"]),
$line["field"],
$where,
- sql_bool_to_bool($line["inverse"]) ? __("(inverse)") : "") . "</span>";
+ $line["inverse"] ? __("(inverse)") : "") . "</span>";
}
return $rv;
$filter['name'] = $name[0];
$filter['param'] = $name[1];
$filter['checkbox'] = false;
- $filter['enabled'] = sql_bool_to_bool($line["enabled"]);
+ $filter['enabled'] = $line["enabled"];
$filter['rules'] = $this->getfilterrules_concise($line['id']);
if (!$filter_search || $match_ok) {
if ($row = $sth->fetch()) {
- $enabled = sql_bool_to_bool($row["enabled"]);
- $match_any_rule = sql_bool_to_bool($row["match_any_rule"]);
- $inverse = sql_bool_to_bool($row["inverse"]);
+ $enabled = $row["enabled"];
+ $match_any_rule = $row["match_any_rule"];
+ $inverse = $row["inverse"];
$title = htmlspecialchars($row["title"]);
print "<form id=\"filter_edit_form\" onsubmit='return false'>";
if ($line["match_on"]) {
$line["feed_id"] = json_decode($line["match_on"], true);
} else {
- if (sql_bool_to_bool($line["cat_filter"])) {
+ if ($line["cat_filter"]) {
$feed_id = "CAT:" . (int)$line["cat_id"];
} else {
$feed_id = (int)$line["feed_id"];
unset($line["cat_id"]);
unset($line["filter_id"]);
unset($line["id"]);
- if (!sql_bool_to_bool($line["inverse"])) unset($line["inverse"]);
+ if (!$line["inverse"]) unset($line["inverse"]);
unset($line["match_on"]);
$data = htmlspecialchars(json_encode($line));
if ($rule) {
$reg_exp = trim($rule["reg_exp"]);
- $inverse = isset($rule["inverse"]) ? "true" : "false";
+ $inverse = isset($rule["inverse"]) ? 1 : 0;
$filter_type = (int)trim($rule["filter_type"]);
$match_on = json_encode($rule["feed_id"]);
print "<button dojoType=\"dijit.form.Button\" onclick=\"return removeSelectedFilters()\">".
__('Remove')."</button> ";
- if (defined('_ENABLE_FEED_DEBUGGING')) {
- print "<button dojoType=\"dijit.form.Button\" onclick=\"rescore_all_feeds()\">".
- __('Rescore articles')."</button> ";
- }
-
print "</div>"; # toolbar
print "</div>"; # toolbar-frame
print "<div id=\"pref-filter-content\" dojoType=\"dijit.layout.ContentPane\" region=\"center\">";
$title = $row["title"];
$num_rules = $row["num_rules"];
$num_actions = $row["num_actions"];
- $match_any_rule = sql_bool_to_bool($row["match_any_rule"]);
+ $match_any_rule = $row["match_any_rule"];
if (!$title) $title = __("[No caption]");