summaryrefslogtreecommitdiff
path: root/classes/pref
diff options
context:
space:
mode:
Diffstat (limited to 'classes/pref')
-rw-r--r--classes/pref/feeds.php63
-rw-r--r--classes/pref/filters.php77
-rw-r--r--classes/pref/prefs.php16
-rw-r--r--classes/pref/users.php4
4 files changed, 85 insertions, 75 deletions
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php
index d2dc6f7c3..d70c1a26a 100644
--- a/classes/pref/feeds.php
+++ b/classes/pref/feeds.php
@@ -55,6 +55,7 @@ class Pref_Feeds extends Handler_Protected {
$cat['unread'] = 0;
$cat['child_unread'] = 0;
$cat['auxcounter'] = 0;
+ $cat['parent_id'] = $cat_id;
$cat['items'] = $this->get_category_items($line['id']);
@@ -395,7 +396,7 @@ class Pref_Feeds extends Handler_Protected {
# print_r($data['items']);
if (is_array($data) && is_array($data['items'])) {
- $cat_order_id = 0;
+# $cat_order_id = 0;
$data_map = array();
$root_item = false;
@@ -494,7 +495,7 @@ class Pref_Feeds extends Handler_Protected {
$feed_id = $this->dbh->escape_string($_REQUEST["feed_id"]);
if (is_file($icon_file) && $feed_id) {
- if (filesize($icon_file) < 20000) {
+ if (filesize($icon_file) < 65535) {
$result = $this->dbh->query("SELECT id FROM ttrss_feeds
WHERE id = '$feed_id' AND owner_uid = ". $_SESSION["uid"]);
@@ -572,8 +573,9 @@ class Pref_Feeds extends Handler_Protected {
$last_error = $this->dbh->fetch_result($result, 0, "last_error");
if ($last_error) {
- print "&nbsp;<span title=\"".htmlspecialchars($last_error)."\"
- class=\"feed_error\">(error)</span>";
+ print "&nbsp;<img src=\"images/error.png\" alt=\"(error)\"
+ style=\"vertical-align : middle\"
+ title=\"".htmlspecialchars($last_error)."\">";
}
@@ -736,9 +738,9 @@ class Pref_Feeds extends Handler_Protected {
<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">
<input type=\"hidden\" name=\"feed_id\" value=\"$feed_id\">
<input type=\"hidden\" name=\"method\" value=\"uploadicon\">
- <button dojoType=\"dijit.form.Button\" onclick=\"return uploadFeedIcon();\"
+ <button class=\"small\" dojoType=\"dijit.form.Button\" onclick=\"return uploadFeedIcon();\"
type=\"submit\">".__('Replace')."</button>
- <button dojoType=\"dijit.form.Button\" onclick=\"return removeFeedIcon($feed_id);\"
+ <button class=\"small\" dojoType=\"dijit.form.Button\" onclick=\"return removeFeedIcon($feed_id);\"
type=\"submit\">".__('Remove')."</button>
</form>";
@@ -792,31 +794,10 @@ class Pref_Feeds extends Handler_Protected {
print "<div class=\"dlgSec\">".__("Feed")."</div>";
print "<div class=\"dlgSecCont\">";
- /* Title */
-
- print "<input dojoType=\"dijit.form.ValidationTextBox\"
- disabled=\"1\" style=\"font-size : 16px; width : 20em;\" required=\"1\"
- name=\"title\" value=\"\">";
-
- $this->batch_edit_cbox("title");
-
- /* Feed URL */
-
- print "<br/>";
-
- print __('URL:') . " ";
- print "<input dojoType=\"dijit.form.ValidationTextBox\" disabled=\"1\"
- required=\"1\" regExp='^(http|https)://.*' style=\"width : 20em\"
- name=\"feed_url\" value=\"\">";
-
- $this->batch_edit_cbox("feed_url");
-
/* Category */
if (get_pref('ENABLE_FEED_CATS')) {
- print "<br/>";
-
print __('Place in category:') . " ";
print_feed_cat_select("cat_id", false,
@@ -862,7 +843,7 @@ class Pref_Feeds extends Handler_Protected {
$this->batch_edit_cbox("auth_login");
- print "<br/><input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\"
+ print "<hr/> <input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\"
placeHolder=\"".__("Password")."\" disabled=\"1\"
value=\"\">";
@@ -982,7 +963,7 @@ class Pref_Feeds extends Handler_Protected {
if (!$batch) {
- $result = $this->dbh->query("UPDATE ttrss_feeds SET
+ $this->dbh->query("UPDATE ttrss_feeds SET
$category_qpart
title = '$feed_title', feed_url = '$feed_link',
update_interval = '$upd_intl',
@@ -1279,13 +1260,18 @@ class Pref_Feeds extends Handler_Protected {
$interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)";
}
- $result = $this->dbh->query("SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE
+ // could be performance-intensive and prevent feeds pref-panel from showing
+ if (!defined('_DISABLE_INACTIVE_FEEDS') || !_DISABLE_INACTIVE_FEEDS) {
+ $result = $this->dbh->query("SELECT COUNT(*) AS num_inactive FROM ttrss_feeds WHERE
(SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
ttrss_entries.id = ref_id AND
ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart AND
ttrss_feeds.owner_uid = ".$_SESSION["uid"]);
- $num_inactive = $this->dbh->fetch_result($result, 0, "num_inactive");
+ $num_inactive = $this->dbh->fetch_result($result, 0, "num_inactive");
+ } else {
+ $num_inactive = 0;
+ }
if ($num_inactive > 0) {
$inactive_button = "<button dojoType=\"dijit.form.Button\"
@@ -1492,15 +1478,6 @@ class Pref_Feeds extends Handler_Protected {
print "</p>";
- print_warning(__("You can disable all articles shared by unique URLs here."));
-
- print "<p>";
-
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return clearArticleAccessKeys()\">".
- __('Unshare all articles')."</button> ";
-
- print "</p>";
-
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
"hook_prefs_tab_section", "prefFeedsPublishedGenerated");
@@ -1602,8 +1579,6 @@ class Pref_Feeds extends Handler_Protected {
# class needed for selectTableRows()
print "<tr class=\"placeholder\" $this_row_id>";
- $edit_title = htmlspecialchars($line["title"]);
-
# id needed for selectTableRows()
print "<td width='5%' align='center'><input
onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
@@ -1668,8 +1643,6 @@ class Pref_Feeds extends Handler_Protected {
# class needed for selectTableRows()
print "<tr class=\"placeholder\" $this_row_id>";
- $edit_title = htmlspecialchars($line["title"]);
-
# id needed for selectTableRows()
print "<td width='5%' align='center'><input
onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
@@ -1920,7 +1893,7 @@ class Pref_Feeds extends Handler_Protected {
AND owner_uid = " . $owner_uid);
if ($this->dbh->num_rows($result) == 1) {
- $key = $this->dbh->escape_string(sha1(uniqid(rand(), true)));
+ $key = $this->dbh->escape_string(uniqid(base_convert(rand(), 10, 36)));
$this->dbh->query("UPDATE ttrss_access_keys SET access_key = '$key'
WHERE feed_id = '$feed_id' AND is_cat = $sql_is_cat
diff --git a/classes/pref/filters.php b/classes/pref/filters.php
index bcc7b5aec..170c1a527 100644
--- a/classes/pref/filters.php
+++ b/classes/pref/filters.php
@@ -88,7 +88,6 @@ class Pref_Filters extends Handler_Protected {
$result = $qfh_ret[0];
- $articles = array();
$found = 0;
print __("Articles matching this filter:");
@@ -97,12 +96,13 @@ class Pref_Filters extends Handler_Protected {
print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
while ($line = $this->dbh->fetch_assoc($result)) {
+ $line["content_preview"] = truncate_string(strip_tags($line["content"]), 100, '...');
- $entry_timestamp = strtotime($line["updated"]);
- $entry_tags = get_article_tags($line["id"], $_SESSION["uid"]);
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
+ $line = $p->hook_query_headlines($line, 100);
+ }
- $content_preview = truncate_string(
- strip_tags($line["content_preview"]), 100, '...');
+ $content_preview = $line["content_preview"];
if ($line["feed_title"])
$feed_title = $line["feed_title"];
@@ -147,6 +147,40 @@ class Pref_Filters extends Handler_Protected {
}
+ private function getfilterrules_concise($filter_id) {
+ $result = $this->dbh->query("SELECT reg_exp,
+ inverse,
+ feed_id,
+ cat_id,
+ cat_filter,
+ ttrss_filter_types.description AS field
+ FROM
+ ttrss_filters2_rules, ttrss_filter_types
+ WHERE
+ filter_id = '$filter_id' AND filter_type = ttrss_filter_types.id");
+
+ $rv = "";
+
+ while ($line = $this->dbh->fetch_assoc($result)) {
+
+ $where = sql_bool_to_bool($line["cat_filter"]) ?
+ getCategoryTitle($line["cat_id"]) :
+ ($line["feed_id"] ?
+ getFeedTitle($line["feed_id"]) : __("All feeds"));
+
+# $where = $line["cat_id"] . "/" . $line["feed_id"];
+
+ $inverse = sql_bool_to_bool($line["inverse"]) ? "inverse" : "";
+
+ $rv .= "<span class='$inverse'>" . T_sprintf("%s on %s in %s %s",
+ strip_tags($line["reg_exp"]),
+ $line["field"],
+ $where,
+ sql_bool_to_bool($line["inverse"]) ? __("(inverse)") : "") . "</span>";
+ }
+
+ return $rv;
+ }
function getfiltertree() {
$root = array();
@@ -170,24 +204,11 @@ class Pref_Filters extends Handler_Protected {
owner_uid = ".$_SESSION["uid"]." ORDER BY order_id, title");
- $action_id = -1;
$folder = array();
$folder['items'] = array();
while ($line = $this->dbh->fetch_assoc($result)) {
- /* if ($action_id != $line["action_id"]) {
- if (count($folder['items']) > 0) {
- array_push($root['items'], $folder);
- }
-
- $folder = array();
- $folder['id'] = $line["action_id"];
- $folder['name'] = __($line["action_name"]);
- $folder['items'] = array();
- $action_id = $line["action_id"];
- } */
-
$name = $this->getFilterName($line["id"]);
$match_ok = false;
@@ -223,6 +244,7 @@ class Pref_Filters extends Handler_Protected {
$filter['param'] = $name[1];
$filter['checkbox'] = false;
$filter['enabled'] = sql_bool_to_bool($line["enabled"]);
+ $filter['rules'] = $this->getfilterrules_concise($line['id']);
if (!$filter_search || $match_ok) {
array_push($folder['items'], $filter);
@@ -429,8 +451,11 @@ class Pref_Filters extends Handler_Protected {
WHERE id = ".(int)$rule["filter_type"]);
$filter_type = $this->dbh->fetch_result($result, 0, "description");
- return T_sprintf("%s on %s in %s %s", strip_tags($rule["reg_exp"]),
- $filter_type, $feed, isset($rule["inverse"]) ? __("(inverse)") : "");
+ $inverse = isset($rule["inverse"]) ? "inverse" : "";
+
+ return "<span class='filterRule $inverse'>" .
+ T_sprintf("%s on %s in %s %s", strip_tags($rule["reg_exp"]),
+ $filter_type, $feed, isset($rule["inverse"]) ? __("(inverse)") : "") . "</span>";
}
function printRuleName() {
@@ -467,7 +492,7 @@ class Pref_Filters extends Handler_Protected {
$inverse = checkbox_to_sql_bool($this->dbh->escape_string($_REQUEST["inverse"]));
$title = $this->dbh->escape_string($_REQUEST["title"]);
- $result = $this->dbh->query("UPDATE ttrss_filters2 SET enabled = $enabled,
+ $this->dbh->query("UPDATE ttrss_filters2 SET enabled = $enabled,
match_any_rule = $match_any_rule,
inverse = $inverse,
title = '$title'
@@ -585,14 +610,15 @@ class Pref_Filters extends Handler_Protected {
$enabled = checkbox_to_sql_bool($_REQUEST["enabled"]);
$match_any_rule = checkbox_to_sql_bool($_REQUEST["match_any_rule"]);
$title = $this->dbh->escape_string($_REQUEST["title"]);
+ $inverse = checkbox_to_sql_bool($_REQUEST["inverse"]);
$this->dbh->query("BEGIN");
/* create base filter */
$result = $this->dbh->query("INSERT INTO ttrss_filters2
- (owner_uid, match_any_rule, enabled, title) VALUES
- (".$_SESSION["uid"].",$match_any_rule,$enabled, '$title')");
+ (owner_uid, match_any_rule, enabled, title, inverse) VALUES
+ (".$_SESSION["uid"].",$match_any_rule,$enabled, '$title', $inverse)");
$result = $this->dbh->query("SELECT MAX(id) AS id FROM ttrss_filters2
WHERE owner_uid = ".$_SESSION["uid"]);
@@ -870,6 +896,11 @@ class Pref_Filters extends Handler_Protected {
print "<div class=\"dlgButtons\">";
+ print "<div style=\"float : left\">
+ <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/wiki/ContentFilters\">".__("Wiki: Filters")."</a>
+ </div>";
+
+
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterNewRuleDlg').execute()\">".
($rule ? __("Save rule") : __('Add rule'))."</button> ";
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index 32071e3b3..571237239 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -181,7 +181,8 @@ class Pref_Prefs extends Handler_Protected {
global $access_level_names;
$prefs_blacklist = array("STRIP_UNSAFE_TAGS", "REVERSE_HEADLINES",
- "SORT_HEADLINES_BY_FEED_DATE", "DEFAULT_ARTICLE_LIMIT");
+ "SORT_HEADLINES_BY_FEED_DATE", "DEFAULT_ARTICLE_LIMIT",
+ "FEEDS_SORT_BY_UNREAD");
/* "FEEDS_SORT_BY_UNREAD", "HIDE_READ_FEEDS", "REVERSE_HEADLINES" */
@@ -765,7 +766,9 @@ class Pref_Prefs extends Handler_Protected {
dojoType=\"dijit.form.CheckBox\" $checked
type=\"checkbox\"></td>";
- print "<td>$name</td>";
+ $plugin_icon = $checked ? "plugin.png" : "plugin_disabled.png";
+
+ print "<td><label><img src='images/$plugin_icon' alt=''> $name</label></td>";
print "<td>" . htmlspecialchars($about[1]);
if (@$about[4]) {
print " &mdash; <a target=\"_blank\" class=\"visibleLink\"
@@ -818,11 +821,13 @@ class Pref_Prefs extends Handler_Protected {
print "<tr class='$rowclass'>";
+ $plugin_icon = $checked ? "plugin.png" : "plugin_disabled.png";
+
print "<td align='center'><input id='FPCHK-$name' name='plugins[]' value='$name' onclick='toggleSelectRow2(this);'
dojoType=\"dijit.form.CheckBox\" $checked $disabled
type=\"checkbox\"></td>";
- print "<td><label for='FPCHK-$name'>$name</label></td>";
+ print "<td><label for='FPCHK-$name'><img src='images/$plugin_icon' alt=''> $name</label></td>";
print "<td><label for='FPCHK-$name'>" . htmlspecialchars($about[1]) . "</label>";
if (@$about[4]) {
print " &mdash; <a target=\"_blank\" class=\"visibleLink\"
@@ -883,8 +888,9 @@ class Pref_Prefs extends Handler_Protected {
if (!$otp_enabled) {
$secret = $base32->encode(sha1($this->dbh->fetch_result($result, 0, "salt")));
- $topt = new \OTPHP\TOTP($secret);
- print QRcode::png($topt->provisioning_uri($login));
+ print QRcode::png("otpauth://totp/".urlencode($login).
+ "?secret=$secret&issuer=".urlencode("Tiny Tiny RSS"));
+
}
}
diff --git a/classes/pref/users.php b/classes/pref/users.php
index 8a0202483..a5d48ac96 100644
--- a/classes/pref/users.php
+++ b/classes/pref/users.php
@@ -258,7 +258,7 @@ class Pref_Users extends Handler_Protected {
$pwd_hash = encrypt_password($tmp_user_pwd, $new_salt, true);
- db_query("UPDATE ttrss_users SET pwd_hash = '$pwd_hash', salt = '$new_salt'
+ db_query("UPDATE ttrss_users SET pwd_hash = '$pwd_hash', salt = '$new_salt', otp_enabled = false
WHERE id = '$uid'");
if ($show_password) {
@@ -418,7 +418,7 @@ class Pref_Users extends Handler_Protected {
$onclick = "onclick='editUser($uid, event)' title='".__('Click to edit')."'";
- print "<td $onclick>" . $line["login"] . "</td>";
+ print "<td $onclick><img src='images/user.png' class='markedPic' alt=''> " . $line["login"] . "</td>";
if (!$line["email"]) $line["email"] = "&nbsp;";