diff --git a/classes/pref/filters.php b/classes/pref/filters.php index eb7c87746..62f6fc1a0 100755 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -2,7 +2,7 @@ class Pref_Filters extends Handler_Protected { function csrf_ignore($method) { - $csrf_ignored = array("index", "getfiltertree", "edit", "newfilter", "newrule", + $csrf_ignored = array("index", "getfiltertree", "newrule", "newaction", "savefilterorder"); return array_search($method, $csrf_ignored) !== false; @@ -313,24 +313,30 @@ class Pref_Filters extends Handler_Protected { function edit() { - $filter_id = clean($_REQUEST["id"]); + $filter_id = (int) clean($_REQUEST["id"] ?? 0); $sth = $this->pdo->prepare("SELECT * FROM ttrss_filters2 WHERE id = ? AND owner_uid = ?"); $sth->execute([$filter_id, $_SESSION['uid']]); - if ($row = $sth->fetch()) { + if (empty($filter_id) || $row = $sth->fetch()) { - $enabled = $row["enabled"]; - $match_any_rule = $row["match_any_rule"]; - $inverse = $row["inverse"]; - $title = htmlspecialchars($row["title"]); + $enabled = $row["enabled"] ?? true; + $match_any_rule = $row["match_any_rule"] ?? false; + $inverse = $row["inverse"] ?? false; + $title = htmlspecialchars($row["title"] ?? ""); - print "
"; + print ""; } } @@ -736,7 +731,7 @@ class Pref_Filters extends Handler_Protected { dojoType=\"dijit.MenuItem\">".__('None').""; print ""; - print "