summaryrefslogtreecommitdiff
path: root/classes/pref
diff options
context:
space:
mode:
Diffstat (limited to 'classes/pref')
-rw-r--r--classes/pref/feeds.php20
-rw-r--r--classes/pref/filters.php42
-rw-r--r--classes/pref/prefs.php23
-rw-r--r--classes/pref/users.php6
4 files changed, 59 insertions, 32 deletions
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php
index ceda13374..a6811f3fc 100644
--- a/classes/pref/feeds.php
+++ b/classes/pref/feeds.php
@@ -55,7 +55,7 @@ class Pref_Feeds extends Handler_Protected {
$cat['items'] = $this->get_category_items($line['id']);
- $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
+ $cat['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
if (count($cat['items']) > 0 || $show_empty_cats)
array_push($items, $cat);
@@ -134,7 +134,7 @@ class Pref_Feeds extends Handler_Protected {
while ($line = db_fetch_assoc($result)) {
- $label_id = -$line['id'] - 11;
+ $label_id = label_to_feed_id($line['id']);
$feed = $this->feedlist_init_feed($label_id, false, 0);
@@ -172,7 +172,7 @@ class Pref_Feeds extends Handler_Protected {
$cat['items'] = $this->get_category_items($line['id']);
- $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
+ $cat['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
if (count($cat['items']) > 0 || $show_empty_cats)
array_push($root['items'], $cat);
@@ -214,13 +214,13 @@ class Pref_Feeds extends Handler_Protected {
array_push($cat['items'], $feed);
}
- $cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
+ $cat['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
if (count($cat['items']) > 0 || $show_empty_cats)
array_push($root['items'], $cat);
$root['param'] += count($cat['items']);
- $root['param'] = T_sprintf('(%d feeds)', $root['param']);
+ $root['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
} else {
$feed_result = db_query($this->link, "SELECT id, title, last_error,
@@ -245,7 +245,7 @@ class Pref_Feeds extends Handler_Protected {
array_push($root['items'], $feed);
}
- $root['param'] = T_sprintf('(%d feeds)', count($root['items']));
+ $root['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
}
$fl = array();
@@ -1012,7 +1012,7 @@ class Pref_Feeds extends Handler_Protected {
$ids = split(",", db_escape_string($this->link, $_REQUEST["ids"]));
foreach ($ids as $id) {
- $this->remove_feed($this->link, $id, $_SESSION["uid"]);
+ Pref_Feeds::remove_feed($this->link, $id, $_SESSION["uid"]);
}
return;
@@ -1657,7 +1657,7 @@ class Pref_Feeds extends Handler_Protected {
ccache_remove($link, $id, $owner_uid, true);
}
- private function remove_feed($link, $id, $owner_uid) {
+ static function remove_feed($link, $id, $owner_uid) {
if ($id > 0) {
@@ -1700,8 +1700,8 @@ class Pref_Feeds extends Handler_Protected {
ccache_remove($link, $id, $owner_uid);
} else {
- label_remove($link, -11-$id, $owner_uid);
- ccache_remove($link, -11-$id, $owner_uid);
+ label_remove($link, feed_to_label_id($id), $owner_uid);
+ //ccache_remove($link, $id, $owner_uid); don't think labels are cached
}
}
diff --git a/classes/pref/filters.php b/classes/pref/filters.php
index c97628e51..883ff0ebd 100644
--- a/classes/pref/filters.php
+++ b/classes/pref/filters.php
@@ -14,6 +14,9 @@ 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"])));
+ $filter["inverse"] = sql_bool_to_bool(
+ checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["inverse"])));
+
$filter["rules"] = array();
$result = db_query($this->link, "SELECT id,name FROM ttrss_filter_types");
@@ -214,6 +217,7 @@ class Pref_Filters extends Handler_Protected {
$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"));
print "<form id=\"filter_edit_form\" onsubmit='return false'>";
@@ -257,6 +261,7 @@ class Pref_Filters extends Handler_Protected {
unset($line["cat_id"]);
unset($line["filter_id"]);
unset($line["id"]);
+ if (!sql_bool_to_bool($line["inverse"])) unset($line["inverse"]);
$data = htmlspecialchars(json_encode($line));
@@ -330,6 +335,15 @@ class Pref_Filters extends Handler_Protected {
print "<br/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"match_any_rule\" id=\"match_any_rule\" $checked>
<label for=\"match_any_rule\">".__('Match any rule')."</label>";
+ if ($inverse) {
+ $checked = "checked=\"1\"";
+ } else {
+ $checked = "";
+ }
+
+ print "<br/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\" $checked>
+ <label for=\"inverse\">".__('Inverse matching')."</label>";
+
print "<p/>";
print "<div class=\"dlgButtons\">";
@@ -372,7 +386,8 @@ class Pref_Filters extends Handler_Protected {
WHERE id = ".(int)$rule["filter_type"]);
$filter_type = db_fetch_result($result, 0, "description");
- return T_sprintf("%s on %s in %s", strip_tags($rule["reg_exp"]), $filter_type, $feed);
+ return T_sprintf("%s on %s in %s %s", strip_tags($rule["reg_exp"]),
+ $filter_type, $feed, isset($rule["inverse"]) ? __("(inverse)") : "");
}
function printRuleName() {
@@ -406,9 +421,11 @@ class Pref_Filters extends Handler_Protected {
$filter_id = db_escape_string($this->link, $_REQUEST["id"]);
$enabled = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["enabled"]));
$match_any_rule = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["match_any_rule"]));
+ $inverse = checkbox_to_sql_bool(db_escape_string($this->link, $_REQUEST["inverse"]));
$result = db_query($this->link, "UPDATE ttrss_filters2 SET enabled = $enabled,
- match_any_rule = $match_any_rule
+ match_any_rule = $match_any_rule,
+ inverse = $inverse
WHERE id = '$filter_id'
AND owner_uid = ". $_SESSION["uid"]);
@@ -458,6 +475,8 @@ class Pref_Filters extends Handler_Protected {
if ($rule) {
$reg_exp = strip_tags(db_escape_string($this->link, trim($rule["reg_exp"])));
+ $inverse = isset($rule["inverse"]) ? "true" : "false";
+
$filter_type = (int) db_escape_string($this->link, trim($rule["filter_type"]));
$feed_id = db_escape_string($this->link, trim($rule["feed_id"]));
@@ -477,8 +496,8 @@ class Pref_Filters extends Handler_Protected {
}
$query = "INSERT INTO ttrss_filters2_rules
- (filter_id, reg_exp,filter_type,feed_id,cat_id,cat_filter) VALUES
- ('$filter_id', '$reg_exp', '$filter_type', $feed_id, $cat_id, $cat_filter)";
+ (filter_id, reg_exp,filter_type,feed_id,cat_id,cat_filter,inverse) VALUES
+ ('$filter_id', '$reg_exp', '$filter_type', $feed_id, $cat_id, $cat_filter, $inverse)";
db_query($this->link, $query);
}
@@ -710,10 +729,8 @@ class Pref_Filters extends Handler_Protected {
print "<br/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"match_any_rule\" id=\"match_any_rule\">
<label for=\"match_any_rule\">".__('Match any rule')."</label>";
- print "<p/>";
-
-/* print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\">
- <label for=\"inverse\">".__('Inverse match')."</label><hr/>"; */
+ print "<br/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\">
+ <label for=\"inverse\">".__('Inverse matching')."</label>";
// print "</div>";
@@ -739,10 +756,12 @@ class Pref_Filters extends Handler_Protected {
$reg_exp = htmlspecialchars($rule["reg_exp"]);
$filter_type = $rule["filter_type"];
$feed_id = $rule["feed_id"];
+ $inverse_checked = isset($rule["inverse"]) ? "checked" : "";
} else {
$reg_exp = "";
$filter_type = 1;
$feed_id = 0;
+ $inverse_checked = "";
}
if (strpos($feed_id, "CAT:") === 0) {
@@ -773,6 +792,11 @@ class Pref_Filters extends Handler_Protected {
style=\"font-size : 16px; width : 20em;\"
name=\"reg_exp\" value=\"$reg_exp\"/>";
+ print "<hr/>";
+ print "<input id=\"filterDlg_inverse\" dojoType=\"dijit.form.CheckBox\"
+ name=\"inverse\" $inverse_checked/>";
+ print "<label for=\"filterDlg_inverse\">".__("Inverse regular expression matching")."</label>";
+
print "<hr/>" . __("on field") . " ";
print_select_hash("filter_type", $filter_type, $filter_types,
'dojoType="dijit.form.Select"');
@@ -885,6 +909,8 @@ class Pref_Filters extends Handler_Protected {
unset($line["cat_id"]);
}
+ if (!sql_bool_to_bool($line["inverse"])) unset($line["inverse"]);
+
if ($count < 2) {
array_push($titles, $this->getRuleName($line));
} else {
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index 4fb8650a2..45bbba424 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -121,8 +121,9 @@ class Pref_Prefs extends Handler_Protected {
global $access_level_names;
- $prefs_blacklist = array("HIDE_READ_FEEDS", "FEEDS_SORT_BY_UNREAD",
- "STRIP_UNSAFE_TAGS");
+ $prefs_blacklist = array("STRIP_UNSAFE_TAGS");
+
+ /* "FEEDS_SORT_BY_UNREAD", "HIDE_READ_FEEDS", "REVERSE_HEADLINES" */
$profile_blacklist = array("ALLOW_DUPLICATE_POSTS", "PURGE_OLD_DAYS",
"PURGE_UNREAD_ARTICLES", "DIGEST_ENABLE", "DIGEST_CATCHUP",
@@ -233,7 +234,7 @@ class Pref_Prefs extends Handler_Protected {
</script>";
if ($otp_enabled) {
- print_notice("Changing your current password will disable OTP.");
+ print_notice(__("Changing your current password will disable OTP."));
}
print "<table width=\"100%\" class=\"prefPrefsList\">";
@@ -266,7 +267,7 @@ class Pref_Prefs extends Handler_Protected {
if ($otp_enabled) {
- print_notice("One time passwords are currently enabled. Enter your current password below to disable.");
+ print_notice(__("One time passwords are currently enabled. Enter your current password below to disable."));
print "<form dojoType=\"dijit.form.Form\">";
@@ -401,7 +402,7 @@ class Pref_Prefs extends Handler_Protected {
print '<div dojoType="dijit.layout.ContentPane" region="center" style="overflow-y : auto">';
if ($_SESSION["profile"]) {
- print_notice("Some preferences are only available in default profile.");
+ print_notice(__("Some preferences are only available in default profile."));
}
if ($_SESSION["profile"]) {
@@ -412,10 +413,12 @@ class Pref_Prefs extends Handler_Protected {
$profile_qpart = "profile IS NULL";
}
- if ($_SESSION["prefs_show_advanced"])
+ /* if ($_SESSION["prefs_show_advanced"])
$access_query = "true";
else
- $access_query = "(access_level = 0 AND section_id != 3)";
+ $access_query = "(access_level = 0 AND section_id != 3)"; */
+
+ $access_query = 'true';
$result = db_query($this->link, "SELECT DISTINCT
ttrss_user_prefs.pref_name,short_desc,help_text,value,type_name,
@@ -602,7 +605,7 @@ class Pref_Prefs extends Handler_Protected {
print "&nbsp;";
- $checked = $_SESSION["prefs_show_advanced"] ? "checked='1'" : "";
+ /* $checked = $_SESSION["prefs_show_advanced"] ? "checked='1'" : "";
print "<input onclick='toggleAdvancedPrefs()'
id='prefs_show_advanced'
@@ -610,7 +613,7 @@ class Pref_Prefs extends Handler_Protected {
$checked
type=\"checkbox\"></input>
<label for='prefs_show_advanced'>" .
- __("Show additional preferences") . "</label>";
+ __("Show additional preferences") . "</label>"; */
global $pluginhost;
$pluginhost->run_hooks($pluginhost::HOOK_PREFS_TAB_SECTION,
@@ -626,7 +629,7 @@ class Pref_Prefs extends Handler_Protected {
print "<h2>".__("Plugins")."</h2>";
- print_notice("You will need to reload Tiny Tiny RSS for plugin changes to take effect.");
+ print_notice(__("You will need to reload Tiny Tiny RSS for plugin changes to take effect."));
print "<form dojoType=\"dijit.form.Form\" id=\"changePluginsForm\">";
diff --git a/classes/pref/users.php b/classes/pref/users.php
index 51493a273..4055bca45 100644
--- a/classes/pref/users.php
+++ b/classes/pref/users.php
@@ -288,11 +288,9 @@ class Pref_Users extends Handler_Protected {
WHERE id = '$uid'");
if ($show_password) {
- print T_sprintf("Changed password of user <b>%s</b>
- to <b>%s</b>", $login, $tmp_user_pwd);
+ print T_sprintf("Changed password of user <b>%s</b> to <b>%s</b>", $login, $tmp_user_pwd);
} else {
- print T_sprintf("Sending new password of user <b>%s</b>
- to <b>%s</b>", $login, $email);
+ print T_sprintf("Sending new password of user <b>%s</b> to <b>%s</b>", $login, $email);
}
require_once 'classes/ttrssmailer.php';