X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=classes%2Fpref%2Ffilters.php;h=4dbee5906fa9a2a049dead55071de5588cd560e6;hb=1ffe3391f902c4baa984982f19e61a0e45de21ff;hp=7a403975b3dd57a10d58359ee254f5f39f2bc0aa;hpb=b895510f5c7473ef2d871d813fdff0ef9c6e86fd;p=tt-rss.git diff --git a/classes/pref/filters.php b/classes/pref/filters.php index 7a403975..4dbee590 100644 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -9,7 +9,7 @@ class Pref_Filters extends Handler_Protected { } function filtersortreset() { - db_query($this->link, "UPDATE ttrss_filters2 + $this->dbh->query("UPDATE ttrss_filters2 SET order_id = 0 WHERE owner_uid = " . $_SESSION["uid"]); return; } @@ -31,7 +31,7 @@ class Pref_Filters extends Handler_Protected { if ($filter_id > 0) { - db_query($this->link, "UPDATE ttrss_filters2 SET + $this->dbh->query("UPDATE ttrss_filters2 SET order_id = $index WHERE id = '$filter_id' AND owner_uid = " .$_SESSION["uid"]); @@ -49,16 +49,16 @@ class Pref_Filters extends Handler_Protected { $filter["enabled"] = true; $filter["match_any_rule"] = sql_bool_to_bool( - checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["match_any_rule"]))); + checkbox_to_sql_bool($this->dbh->escape_string($_REQUEST["match_any_rule"]))); $filter["inverse"] = sql_bool_to_bool( - checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["inverse"]))); + checkbox_to_sql_bool($this->dbh->escape_string($_REQUEST["inverse"]))); $filter["rules"] = array(); - $result = db_query($this->link, "SELECT id,name FROM ttrss_filter_types"); + $result = $this->dbh->query("SELECT id,name FROM ttrss_filter_types"); $filter_types = array(); - while ($line = db_fetch_assoc($result)) { + while ($line = $this->dbh->fetch_assoc($result)) { $filter_types[$line["id"]] = $line["name"]; } @@ -83,9 +83,9 @@ class Pref_Filters extends Handler_Protected { } } - $feed_title = getFeedTitle($this->link, $feed); + $feed_title = getFeedTitle($feed); - $qfh_ret = queryFeedHeadlines($this->link, -4, 30, "", false, false, false, + $qfh_ret = queryFeedHeadlines(-4, 30, "", false, false, false, "date_entered DESC", 0, $_SESSION["uid"], $filter); $result = $qfh_ret[0]; @@ -98,10 +98,10 @@ class Pref_Filters extends Handler_Protected { print "
"; print ""; - while ($line = db_fetch_assoc($result)) { + while ($line = $this->dbh->fetch_assoc($result)) { $entry_timestamp = strtotime($line["updated"]); - $entry_tags = get_article_tags($this->link, $line["id"], $_SESSION["uid"]); + $entry_tags = get_article_tags($line["id"], $_SESSION["uid"]); $content_preview = truncate_string( strip_tags($line["content_preview"]), 100, '...'); @@ -158,7 +158,7 @@ class Pref_Filters extends Handler_Protected { $filter_search = $_SESSION["prefs_filter_search"]; - $result = db_query($this->link, "SELECT *, + $result = $this->dbh->query("SELECT *, (SELECT action_param FROM ttrss_filters2_actions WHERE filter_id = ttrss_filters2.id ORDER BY id LIMIT 1) AS action_param, (SELECT action_id FROM ttrss_filters2_actions @@ -169,14 +169,14 @@ class Pref_Filters extends Handler_Protected { (SELECT reg_exp FROM ttrss_filters2_rules WHERE filter_id = ttrss_filters2.id ORDER BY id LIMIT 1) AS reg_exp FROM ttrss_filters2 WHERE - owner_uid = ".$_SESSION["uid"]." ORDER BY order_id"); + owner_uid = ".$_SESSION["uid"]." ORDER BY order_id, title"); $action_id = -1; $folder = array(); $folder['items'] = array(); - while ($line = db_fetch_assoc($result)) { + while ($line = $this->dbh->fetch_assoc($result)) { /* if ($action_id != $line["action_id"]) { if (count($folder['items']) > 0) { @@ -194,10 +194,10 @@ class Pref_Filters extends Handler_Protected { $match_ok = false; if ($filter_search) { - $rules_result = db_query($this->link, + $rules_result = $this->dbh->query( "SELECT reg_exp FROM ttrss_filters2_rules WHERE filter_id = ".$line["id"]); - while ($rule_line = db_fetch_assoc($rules_result)) { + while ($rule_line = $this->dbh->fetch_assoc($rules_result)) { if (mb_strpos($rule_line['reg_exp'], $filter_search) !== false) { $match_ok = true; break; @@ -206,13 +206,13 @@ class Pref_Filters extends Handler_Protected { } if ($line['action_id'] == 7) { - $label_result = db_query($this->link, "SELECT fg_color, bg_color - FROM ttrss_labels2 WHERE caption = '".db_escape_string($this->link, $line['action_param'])."' AND + $label_result = $this->dbh->query("SELECT fg_color, bg_color + FROM ttrss_labels2 WHERE caption = '".$this->dbh->escape_string($line['action_param'])."' AND owner_uid = " . $_SESSION["uid"]); - if (db_num_rows($label_result) > 0) { - $fg_color = db_fetch_result($label_result, 0, "fg_color"); - $bg_color = db_fetch_result($label_result, 0, "bg_color"); + if ($this->dbh->num_rows($label_result) > 0) { + $fg_color = $this->dbh->fetch_result($label_result, 0, "fg_color"); + $bg_color = $this->dbh->fetch_result($label_result, 0, "bg_color"); $name[1] = "α" . $name[1]; } @@ -248,15 +248,15 @@ class Pref_Filters extends Handler_Protected { function edit() { - $filter_id = db_escape_string($this->link, $_REQUEST["id"]); + $filter_id = $this->dbh->escape_string($_REQUEST["id"]); - $result = db_query($this->link, + $result = $this->dbh->query( "SELECT * FROM ttrss_filters2 WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]); - $enabled = sql_bool_to_bool(db_fetch_result($result, 0, "enabled")); - $match_any_rule = sql_bool_to_bool(db_fetch_result($result, 0, "match_any_rule")); - $inverse = sql_bool_to_bool(db_fetch_result($result, 0, "inverse")); - $title = htmlspecialchars(db_fetch_result($result, 0, "title")); + $enabled = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "enabled")); + $match_any_rule = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "match_any_rule")); + $inverse = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "inverse")); + $title = htmlspecialchars($this->dbh->fetch_result($result, 0, "title")); print ""; @@ -294,10 +294,10 @@ class Pref_Filters extends Handler_Protected { print "