filters: remove sql_bool_to_bool()
checkbox_to_sql_bool: return ints (???)
This commit is contained in:
parent
b431d52520
commit
8ff3cbb32e
2 changed files with 13 additions and 15 deletions
|
@ -52,10 +52,8 @@ class Pref_Filters extends Handler_Protected {
|
||||||
$filter = array();
|
$filter = array();
|
||||||
|
|
||||||
$filter["enabled"] = true;
|
$filter["enabled"] = true;
|
||||||
$filter["match_any_rule"] = sql_bool_to_bool(
|
$filter["match_any_rule"] = checkbox_to_sql_bool($_REQUEST["match_any_rule"]);
|
||||||
checkbox_to_sql_bool($_REQUEST["match_any_rule"]));
|
$filter["inverse"] = checkbox_to_sql_bool($_REQUEST["inverse"]);
|
||||||
$filter["inverse"] = sql_bool_to_bool(
|
|
||||||
checkbox_to_sql_bool($_REQUEST["inverse"]));
|
|
||||||
|
|
||||||
$filter["rules"] = array();
|
$filter["rules"] = array();
|
||||||
$filter["actions"] = array("dummy-action");
|
$filter["actions"] = array("dummy-action");
|
||||||
|
@ -252,7 +250,7 @@ class Pref_Filters extends Handler_Protected {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$where = sql_bool_to_bool($line["cat_filter"]) ?
|
$where = $line["cat_filter"] ?
|
||||||
Feeds::getCategoryTitle($line["cat_id"]) :
|
Feeds::getCategoryTitle($line["cat_id"]) :
|
||||||
($line["feed_id"] ?
|
($line["feed_id"] ?
|
||||||
Feeds::getFeedTitle($line["feed_id"]) : __("All feeds"));
|
Feeds::getFeedTitle($line["feed_id"]) : __("All feeds"));
|
||||||
|
@ -260,13 +258,13 @@ class Pref_Filters extends Handler_Protected {
|
||||||
|
|
||||||
# $where = $line["cat_id"] . "/" . $line["feed_id"];
|
# $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",
|
$rv .= "<span class='$inverse'>" . T_sprintf("%s on %s in %s %s",
|
||||||
htmlspecialchars($line["reg_exp"]),
|
htmlspecialchars($line["reg_exp"]),
|
||||||
$line["field"],
|
$line["field"],
|
||||||
$where,
|
$where,
|
||||||
sql_bool_to_bool($line["inverse"]) ? __("(inverse)") : "") . "</span>";
|
$line["inverse"] ? __("(inverse)") : "") . "</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $rv;
|
return $rv;
|
||||||
|
@ -335,7 +333,7 @@ class Pref_Filters extends Handler_Protected {
|
||||||
$filter['name'] = $name[0];
|
$filter['name'] = $name[0];
|
||||||
$filter['param'] = $name[1];
|
$filter['param'] = $name[1];
|
||||||
$filter['checkbox'] = false;
|
$filter['checkbox'] = false;
|
||||||
$filter['enabled'] = sql_bool_to_bool($line["enabled"]);
|
$filter['enabled'] = $line["enabled"];
|
||||||
$filter['rules'] = $this->getfilterrules_concise($line['id']);
|
$filter['rules'] = $this->getfilterrules_concise($line['id']);
|
||||||
|
|
||||||
if (!$filter_search || $match_ok) {
|
if (!$filter_search || $match_ok) {
|
||||||
|
@ -364,9 +362,9 @@ class Pref_Filters extends Handler_Protected {
|
||||||
|
|
||||||
if ($row = $sth->fetch()) {
|
if ($row = $sth->fetch()) {
|
||||||
|
|
||||||
$enabled = sql_bool_to_bool($row["enabled"]);
|
$enabled = $row["enabled"];
|
||||||
$match_any_rule = sql_bool_to_bool($row["match_any_rule"]);
|
$match_any_rule = $row["match_any_rule"];
|
||||||
$inverse = sql_bool_to_bool($row["inverse"]);
|
$inverse = $row["inverse"];
|
||||||
$title = htmlspecialchars($row["title"]);
|
$title = htmlspecialchars($row["title"]);
|
||||||
|
|
||||||
print "<form id=\"filter_edit_form\" onsubmit='return false'>";
|
print "<form id=\"filter_edit_form\" onsubmit='return false'>";
|
||||||
|
@ -413,7 +411,7 @@ class Pref_Filters extends Handler_Protected {
|
||||||
if ($line["match_on"]) {
|
if ($line["match_on"]) {
|
||||||
$line["feed_id"] = json_decode($line["match_on"], true);
|
$line["feed_id"] = json_decode($line["match_on"], true);
|
||||||
} else {
|
} else {
|
||||||
if (sql_bool_to_bool($line["cat_filter"])) {
|
if ($line["cat_filter"]) {
|
||||||
$feed_id = "CAT:" . (int)$line["cat_id"];
|
$feed_id = "CAT:" . (int)$line["cat_id"];
|
||||||
} else {
|
} else {
|
||||||
$feed_id = (int)$line["feed_id"];
|
$feed_id = (int)$line["feed_id"];
|
||||||
|
@ -426,7 +424,7 @@ class Pref_Filters extends Handler_Protected {
|
||||||
unset($line["cat_id"]);
|
unset($line["cat_id"]);
|
||||||
unset($line["filter_id"]);
|
unset($line["filter_id"]);
|
||||||
unset($line["id"]);
|
unset($line["id"]);
|
||||||
if (!sql_bool_to_bool($line["inverse"])) unset($line["inverse"]);
|
if (!$line["inverse"]) unset($line["inverse"]);
|
||||||
unset($line["match_on"]);
|
unset($line["match_on"]);
|
||||||
|
|
||||||
$data = htmlspecialchars(json_encode($line));
|
$data = htmlspecialchars(json_encode($line));
|
||||||
|
@ -1139,7 +1137,7 @@ class Pref_Filters extends Handler_Protected {
|
||||||
$title = $row["title"];
|
$title = $row["title"];
|
||||||
$num_rules = $row["num_rules"];
|
$num_rules = $row["num_rules"];
|
||||||
$num_actions = $row["num_actions"];
|
$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]");
|
if (!$title) $title = __("[No caption]");
|
||||||
|
|
||||||
|
|
|
@ -1053,7 +1053,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkbox_to_sql_bool($val) {
|
function checkbox_to_sql_bool($val) {
|
||||||
return ($val == "on") ? true : false;
|
return ($val == "on") ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function uniqid_short() {
|
function uniqid_short() {
|
||||||
|
|
Loading…
Reference in a new issue