$cat['unread'] = 0;
$cat['child_unread'] = 0;
$cat['auxcounter'] = 0;
+ $cat['parent_id'] = $cat_id;
$cat['items'] = $this->get_category_items($line['id']);
- $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
+ $num_children = $this->calculate_children_count($cat);
+ $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', $num_children), $num_children);
- if (count($cat['items']) > 0 || $show_empty_cats)
+ if ($num_children > 0 || $show_empty_cats)
array_push($items, $cat);
}
$cat['items'] = $this->get_category_items($line['id']);
- $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
+ $num_children = $this->calculate_children_count($cat);
+ $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', $num_children), $num_children);
- if (count($cat['items']) > 0 || $show_empty_cats)
+ if ($num_children > 0 || $show_empty_cats)
array_push($root['items'], $cat);
$root['param'] += count($cat['items']);
if (count($cat['items']) > 0 || $show_empty_cats)
array_push($root['items'], $cat);
- $root['param'] += count($cat['items']);
- $root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
+ $num_children = $this->calculate_children_count($root);
+ $root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', $num_children), $num_children);
} else {
$feed_result = $this->dbh->query("SELECT id, title, last_error,
# 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;
$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"]);
$last_error = $this->dbh->fetch_result($result, 0, "last_error");
if ($last_error) {
- print " <span title=\"".htmlspecialchars($last_error)."\"
- class=\"feed_error\">(error)</span>";
+ print " <img src=\"images/error.png\" alt=\"(error)\"
+ style=\"vertical-align : middle\"
+ title=\"".htmlspecialchars($last_error)."\">";
}
<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>";
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,
$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=\"\">";
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',
$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\"
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");
# 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\"
# 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\"
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
owner_uid = " . $_SESSION["uid"]);
}
+ private function calculate_children_count($cat) {
+ $c = 0;
+
+ foreach ($cat['items'] as $child) {
+ if ($child['type'] == 'category') {
+ $c += $this->calculate_children_count($child);
+ } else {
+ $c += 1;
+ }
+ }
+
+ return $c;
+ }
}
?>