}
function renamecat() {
- $title = db_escape_string($_REQUEST['title']);
- $id = db_escape_string($_REQUEST['id']);
+ $title = db_escape_string($this->link, $_REQUEST['title']);
+ $id = db_escape_string($this->link, $_REQUEST['id']);
if ($title) {
db_query($this->link, "UPDATE ttrss_feed_categories SET
$items = array();
- $result = db_query($this->link, "SELECT id, title, collapsed FROM ttrss_feed_categories
+ $result = db_query($this->link, "SELECT id, title FROM ttrss_feed_categories
WHERE owner_uid = " . $_SESSION["uid"] . " AND parent_cat = '$cat_id' ORDER BY order_id, title");
while ($line = db_fetch_assoc($result)) {
$cat['name'] = $line['title'];
$cat['items'] = array();
$cat['checkbox'] = false;
- $cat['hidden'] = sql_bool_to_bool($line['collapsed']);
$cat['type'] = 'category';
$cat['unread'] = 0;
$cat['child_unread'] = 0;
$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);
if ($_REQUEST['mode'] == 2) {
if ($enable_cats) {
- $cat_hidden = get_pref($this->link, "_COLLAPSED_SPECIAL");
- $cat = $this->feedlist_init_cat(-1, $cat_hidden);
+ $cat = $this->feedlist_init_cat(-1);
} else {
$cat['items'] = array();
}
if (db_num_rows($result) > 0) {
if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
- $cat_hidden = get_pref($this->link, "_COLLAPSED_LABELS");
- $cat = $this->feedlist_init_cat(-2, $cat_hidden);
+ $cat = $this->feedlist_init_cat(-2);
} else {
$cat['items'] = array();
}
while ($line = db_fetch_assoc($result)) {
- $label_id = -$line['id'] - 11;
- $count = getFeedUnread($this->link, $label_id);
+ $label_id = label_to_feed_id($line['id']);
- $feed = $this->feedlist_init_feed($label_id, false, $count);
+ $feed = $this->feedlist_init_feed($label_id, false, 0);
$feed['fg_color'] = $line['fg_color'];
$feed['bg_color'] = $line['bg_color'];
$show_empty_cats = $_REQUEST['mode'] != 2 && !$search &&
get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS');
- $result = db_query($this->link, "SELECT id, title, collapsed FROM ttrss_feed_categories
+ $result = db_query($this->link, "SELECT id, title FROM ttrss_feed_categories
WHERE owner_uid = " . $_SESSION["uid"] . " AND parent_cat IS NULL ORDER BY order_id, title");
while ($line = db_fetch_assoc($result)) {
$cat['name'] = $line['title'];
$cat['items'] = array();
$cat['checkbox'] = false;
- $cat['hidden'] = sql_bool_to_bool($line['collapsed']);
$cat['type'] = 'category';
$cat['unread'] = 0;
$cat['child_unread'] = 0;
$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);
$cat['bare_id'] = 0;
$cat['name'] = __("Uncategorized");
$cat['items'] = array();
- $cat['hidden'] = get_pref($this->link, "_COLLAPSED_UNCAT");
$cat['type'] = 'category';
$cat['checkbox'] = false;
$cat['unread'] = 0;
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,
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();
if ($item_id != 'root') {
if ($parent_id && $parent_id != 'root') {
$parent_bare_id = substr($parent_id, strpos($parent_id, ':')+1);
- $parent_qpart = db_escape_string($parent_bare_id);
+ $parent_qpart = db_escape_string($this->link, $parent_bare_id);
} else {
$parent_qpart = 'NULL';
}
if (strpos($id, "FEED") === 0) {
$cat_id = ($item_id != "root") ?
- db_escape_string($bare_item_id) : "NULL";
+ db_escape_string($this->link, $bare_item_id) : "NULL";
$cat_qpart = ($cat_id != 0) ? "cat_id = '$cat_id'" :
"cat_id = NULL";
$nest_level+1);
if ($item_id != 'root') {
- $parent_qpart = db_escape_string($bare_id);
+ $parent_qpart = db_escape_string($this->link, $bare_id);
} else {
$parent_qpart = 'NULL';
}
}
function removeicon() {
- $feed_id = db_escape_string($_REQUEST["feed_id"]);
+ $feed_id = db_escape_string($this->link, $_REQUEST["feed_id"]);
$result = db_query($this->link, "SELECT id FROM ttrss_feeds
WHERE id = '$feed_id' AND owner_uid = ". $_SESSION["uid"]);
}
function uploadicon() {
+ header("Content-type: text/html");
+
$icon_file = $_FILES['icon_file']['tmp_name'];
- $feed_id = db_escape_string($_REQUEST["feed_id"]);
+ $feed_id = db_escape_string($this->link, $_REQUEST["feed_id"]);
if (is_file($icon_file) && $feed_id) {
if (filesize($icon_file) < 20000) {
global $purge_intervals;
global $update_intervals;
- $feed_id = db_escape_string($_REQUEST["id"]);
+ $feed_id = db_escape_string($this->link, $_REQUEST["id"]);
$result = db_query($this->link,
"SELECT * FROM ttrss_feeds WHERE id = '$feed_id' AND
print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"private\" id=\"private\"
$checked> <label for=\"private\">".__('Hide from Popular feeds')."</label>";
- $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
-
- if ($rtl_content) {
- $checked = "checked=\"1\"";
- } else {
- $checked = "";
- }
-
- print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"
- $checked> <label for=\"rtl_content\">".__('Right-to-left content')."</label>";
-
$include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest"));
if ($include_in_digest) {
name=\"always_display_enclosures\"
$checked> <label for=\"always_display_enclosures\">".__('Always display image attachments')."</label>";
+ $hide_images = sql_bool_to_bool(db_fetch_result($result, 0, "hide_images"));
+
+ if ($hide_images) {
+ $checked = "checked=\"1\"";
+ } else {
+ $checked = "";
+ }
+
+ print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"hide_images\"
+ name=\"hide_images\"
+ $checked> <label for=\"hide_images\">".
+ __('Do not embed images')."</label>";
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
name=\"mark_unread_on_update\"
$checked> <label for=\"mark_unread_on_update\">".__('Mark updated articles as unread')."</label>";
- $update_on_checksum_change = sql_bool_to_bool(db_fetch_result($result, 0, "update_on_checksum_change"));
-
- if ($update_on_checksum_change) {
- $checked = "checked";
- } else {
- $checked = "";
- }
-
- print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"update_on_checksum_change\"
- name=\"update_on_checksum_change\"
- $checked> <label for=\"update_on_checksum_change\">".__('Mark posts as updated on content change')."</label>";
-
print "</div>";
/* Icon */
global $purge_intervals;
global $update_intervals;
- $feed_ids = db_escape_string($_REQUEST["ids"]);
+ $feed_ids = db_escape_string($this->link, $_REQUEST["ids"]);
print "<div class=\"dialogNotice\">" . __("Enable the options you wish to apply using checkboxes on the right:") . "</div>";
print " "; $this->batch_edit_cbox("private", "private_l");
- print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"
- dojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"rtl_content_l\" for=\"rtl_content\">".__('Right-to-left content')."</label>";
-
- print " "; $this->batch_edit_cbox("rtl_content", "rtl_content_l");
-
print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"include_in_digest\"
name=\"include_in_digest\"
dojoType=\"dijit.form.CheckBox\"> <label id=\"include_in_digest_l\" class='insensitive' for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
print " "; $this->batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l");
+ print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"hide_images\"
+ name=\"hide_images\"
+ dojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"hide_images_l\"
+ for=\"hide_images\">".
+ __('Do not embed images')."</label>";
+
+ print " "; $this->batch_edit_cbox("hide_images", "hide_images_l");
+
print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"cache_images\"
name=\"cache_images\"
dojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"cache_images_l\"
print " "; $this->batch_edit_cbox("mark_unread_on_update", "mark_unread_on_update_l");
- print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"update_on_checksum_change\"
- name=\"update_on_checksum_change\"
- dojoType=\"dijit.form.CheckBox\"> <label id=\"update_on_checksum_change_l\" class='insensitive' for=\"update_on_checksum_change\">".__('Mark posts as updated on content change')."</label>";
-
- print " "; $this->batch_edit_cbox("update_on_checksum_change", "update_on_checksum_change_l");
-
print "</div>";
print "<div class='dlgButtons'>
function editsaveops($batch) {
- $feed_title = db_escape_string(trim($_POST["title"]));
- $feed_link = db_escape_string(trim($_POST["feed_url"]));
- $upd_intl = (int) db_escape_string($_POST["update_interval"]);
- $purge_intl = (int) db_escape_string($_POST["purge_interval"]);
- $feed_id = (int) db_escape_string($_POST["id"]); /* editSave */
- $feed_ids = db_escape_string($_POST["ids"]); /* batchEditSave */
- $cat_id = (int) db_escape_string($_POST["cat_id"]);
- $auth_login = db_escape_string(trim($_POST["auth_login"]));
- $auth_pass = db_escape_string(trim($_POST["auth_pass"]));
- $private = checkbox_to_sql_bool(db_escape_string($_POST["private"]));
- $rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"]));
+ $feed_title = db_escape_string($this->link, trim($_POST["title"]));
+ $feed_link = db_escape_string($this->link, trim($_POST["feed_url"]));
+ $upd_intl = (int) db_escape_string($this->link, $_POST["update_interval"]);
+ $purge_intl = (int) db_escape_string($this->link, $_POST["purge_interval"]);
+ $feed_id = (int) db_escape_string($this->link, $_POST["id"]); /* editSave */
+ $feed_ids = db_escape_string($this->link, $_POST["ids"]); /* batchEditSave */
+ $cat_id = (int) db_escape_string($this->link, $_POST["cat_id"]);
+ $auth_login = db_escape_string($this->link, trim($_POST["auth_login"]));
+ $auth_pass = db_escape_string($this->link, trim($_POST["auth_pass"]));
+ $private = checkbox_to_sql_bool(db_escape_string($this->link, $_POST["private"]));
$include_in_digest = checkbox_to_sql_bool(
- db_escape_string($_POST["include_in_digest"]));
+ db_escape_string($this->link, $_POST["include_in_digest"]));
$cache_images = checkbox_to_sql_bool(
- db_escape_string($_POST["cache_images"]));
- $cache_content = checkbox_to_sql_bool(
- db_escape_string($_POST["cache_content"]));
-
+ db_escape_string($this->link, $_POST["cache_images"]));
+ $hide_images = checkbox_to_sql_bool(
+ db_escape_string($this->link, $_POST["hide_images"]));
$always_display_enclosures = checkbox_to_sql_bool(
- db_escape_string($_POST["always_display_enclosures"]));
+ db_escape_string($this->link, $_POST["always_display_enclosures"]));
$mark_unread_on_update = checkbox_to_sql_bool(
- db_escape_string($_POST["mark_unread_on_update"]));
-
- $update_on_checksum_change = checkbox_to_sql_bool(
- db_escape_string($_POST["update_on_checksum_change"]));
+ db_escape_string($this->link, $_POST["mark_unread_on_update"]));
if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
if ($cat_id && $cat_id != 0) {
auth_login = '$auth_login',
auth_pass = '$auth_pass',
private = $private,
- rtl_content = $rtl_content,
cache_images = $cache_images,
- cache_content = $cache_content,
+ hide_images = $hide_images,
include_in_digest = $include_in_digest,
always_display_enclosures = $always_display_enclosures,
- mark_unread_on_update = $mark_unread_on_update,
- update_on_checksum_change = $update_on_checksum_change
+ mark_unread_on_update = $mark_unread_on_update
WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
} else {
$qpart = "mark_unread_on_update = $mark_unread_on_update";
break;
- case "update_on_checksum_change":
- $qpart = "update_on_checksum_change = $update_on_checksum_change";
- break;
-
case "cache_images":
$qpart = "cache_images = $cache_images";
break;
- case "cache_content":
- $qpart = "cache_content = $cache_content";
- break;
-
- case "rtl_content":
- $qpart = "rtl_content = $rtl_content";
+ case "hide_images":
+ $qpart = "hide_images = $hide_images";
break;
case "cat_id":
function resetPubSub() {
- $ids = db_escape_string($_REQUEST["ids"]);
+ $ids = db_escape_string($this->link, $_REQUEST["ids"]);
db_query($this->link, "UPDATE ttrss_feeds SET pubsub_state = 0 WHERE id IN ($ids)
AND owner_uid = " . $_SESSION["uid"]);
function remove() {
- $ids = split(",", db_escape_string($_REQUEST["ids"]));
+ $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;
}
function clear() {
- $id = db_escape_string($_REQUEST["id"]);
+ $id = db_escape_string($this->link, $_REQUEST["id"]);
$this->clear_feed_articles($this->link, $id);
}
function rescore() {
require_once "rssfuncs.php";
- $ids = split(",", db_escape_string($_REQUEST["ids"]));
+ $ids = split(",", db_escape_string($this->link, $_REQUEST["ids"]));
foreach ($ids as $id) {
}
function categorize() {
- $ids = split(",", db_escape_string($_REQUEST["ids"]));
+ $ids = split(",", db_escape_string($this->link, $_REQUEST["ids"]));
- $cat_id = db_escape_string($_REQUEST["cat_id"]);
+ $cat_id = db_escape_string($this->link, $_REQUEST["cat_id"]);
if ($cat_id == 0) {
$cat_id_qpart = 'NULL';
}
function removeCat() {
- $ids = split(",", db_escape_string($_REQUEST["ids"]));
+ $ids = split(",", db_escape_string($this->link, $_REQUEST["ids"]));
foreach ($ids as $id) {
$this->remove_feed_category($this->link, $id, $_SESSION["uid"]);
}
}
function addCat() {
- $feed_cat = db_escape_string(trim($_REQUEST["cat"]));
+ $feed_cat = db_escape_string($this->link, trim($_REQUEST["cat"]));
add_feed_category($this->link, $feed_cat);
}
__("Inactive feeds") . "</button>";
}
- $feed_search = db_escape_string($_REQUEST["search"]);
+ $feed_search = db_escape_string($this->link, $_REQUEST["search"]);
if (array_key_exists("search", $_REQUEST)) {
$_SESSION["prefs_feed_search"] = $feed_search;
print "</div>"; #container
}
- private function feedlist_init_cat($cat_id, $hidden = false) {
+ private function feedlist_init_cat($cat_id) {
$obj = array();
$cat_id = (int) $cat_id;
$obj['name'] = getCategoryTitle($this->link, $cat_id);
$obj['type'] = 'category';
$obj['unread'] = (int) $cat_unread;
- $obj['hidden'] = $hidden;
$obj['bare_id'] = $cat_id;
return $obj;
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) {
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
}
}