';
- $feed_id = $this->dbh->escape_string($_REQUEST["id"]);
+ $feed_id = $_REQUEST["id"];
- $result = $this->dbh->query(
+ $result = db_query(
"SELECT * FROM ttrss_feeds WHERE id = '$feed_id' AND
owner_uid = " . $_SESSION["uid"]);
- $auth_pass_encrypted = sql_bool_to_bool($this->dbh->fetch_result($result, 0,
+ $auth_pass_encrypted = sql_bool_to_bool(db_fetch_result($result, 0,
"auth_pass_encrypted"));
- $title = htmlspecialchars($this->dbh->fetch_result($result,
+ $title = htmlspecialchars(db_fetch_result($result,
0, "title"));
print_hidden("id", "$feed_id");
@@ -563,8 +567,8 @@ class Pref_Feeds extends Handler_Protected {
/* Feed URL */
- $feed_url = $this->dbh->fetch_result($result, 0, "feed_url");
- $feed_url = htmlspecialchars($this->dbh->fetch_result($result,
+ $feed_url = db_fetch_result($result, 0, "feed_url");
+ $feed_url = htmlspecialchars(db_fetch_result($result,
0, "feed_url"));
print "
";
@@ -575,7 +579,7 @@ class Pref_Feeds extends Handler_Protected {
regExp='^(http|https)://.*' style=\"width : 20em\"
name=\"feed_url\" value=\"$feed_url\">";
- $last_error = $this->dbh->fetch_result($result, 0, "last_error");
+ $last_error = db_fetch_result($result, 0, "last_error");
if ($last_error) {
print "
dbh->fetch_result($result, 0, "cat_id");
+ $cat_id = db_fetch_result($result, 0, "cat_id");
print "
";
@@ -601,7 +605,7 @@ class Pref_Feeds extends Handler_Protected {
/* FTS Stemming Language */
if (DB_TYPE == "pgsql") {
- $feed_language = $this->dbh->fetch_result($result, 0, "feed_language");
+ $feed_language = db_fetch_result($result, 0, "feed_language");
print "
";
@@ -617,14 +621,14 @@ class Pref_Feeds extends Handler_Protected {
/* Update Interval */
- $update_interval = $this->dbh->fetch_result($result, 0, "update_interval");
+ $update_interval = db_fetch_result($result, 0, "update_interval");
print_select_hash("update_interval", $update_interval, $update_intervals,
'dojoType="dijit.form.Select"');
/* Purge intl */
- $purge_interval = $this->dbh->fetch_result($result, 0, "purge_interval");
+ $purge_interval = db_fetch_result($result, 0, "purge_interval");
print "
";
print __('Article purging:') . " ";
@@ -635,8 +639,8 @@ class Pref_Feeds extends Handler_Protected {
print "
";
- $auth_login = htmlspecialchars($this->dbh->fetch_result($result, 0, "auth_login"));
- $auth_pass = $this->dbh->fetch_result($result, 0, "auth_pass");
+ $auth_login = htmlspecialchars(db_fetch_result($result, 0, "auth_login"));
+ $auth_pass = db_fetch_result($result, 0, "auth_pass");
if ($auth_pass_encrypted && function_exists("mcrypt_decrypt")) {
require_once "crypt.php";
@@ -680,7 +684,7 @@ class Pref_Feeds extends Handler_Protected {
//print "
";
- $private = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "private"));
+ $private = sql_bool_to_bool(db_fetch_result($result, 0, "private"));
if ($private) {
$checked = "checked=\"1\"";
@@ -691,7 +695,7 @@ class Pref_Feeds extends Handler_Protected {
print "
";
- $include_in_digest = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "include_in_digest"));
+ $include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest"));
if ($include_in_digest) {
$checked = "checked=\"1\"";
@@ -704,7 +708,7 @@ class Pref_Feeds extends Handler_Protected {
$checked>
";
- $always_display_enclosures = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "always_display_enclosures"));
+ $always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures"));
if ($always_display_enclosures) {
$checked = "checked";
@@ -716,7 +720,7 @@ class Pref_Feeds extends Handler_Protected {
name=\"always_display_enclosures\"
$checked>
";
- $hide_images = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "hide_images"));
+ $hide_images = sql_bool_to_bool(db_fetch_result($result, 0, "hide_images"));
if ($hide_images) {
$checked = "checked=\"1\"";
@@ -729,7 +733,7 @@ class Pref_Feeds extends Handler_Protected {
$checked>
";
- $cache_images = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "cache_images"));
+ $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
if ($cache_images) {
$checked = "checked=\"1\"";
@@ -742,7 +746,7 @@ class Pref_Feeds extends Handler_Protected {
$checked>
";
- $mark_unread_on_update = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "mark_unread_on_update"));
+ $mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update"));
if ($mark_unread_on_update) {
$checked = "checked";
@@ -809,7 +813,7 @@ class Pref_Feeds extends Handler_Protected {
global $purge_intervals;
global $update_intervals;
- $feed_ids = $this->dbh->escape_string($_REQUEST["ids"]);
+ $feed_ids = $_REQUEST["ids"];
print_notice("Enable the options you wish to apply using checkboxes on the right:");
@@ -958,31 +962,31 @@ class Pref_Feeds extends Handler_Protected {
function editsaveops($batch) {
- $feed_title = $this->dbh->escape_string(trim($_POST["title"]));
- $feed_link = $this->dbh->escape_string(trim($_POST["feed_url"]));
- $upd_intl = (int) $this->dbh->escape_string($_POST["update_interval"]);
- $purge_intl = (int) $this->dbh->escape_string($_POST["purge_interval"]);
- $feed_id = (int) $this->dbh->escape_string($_POST["id"]); /* editSave */
- $feed_ids = $this->dbh->escape_string($_POST["ids"]); /* batchEditSave */
- $cat_id = (int) $this->dbh->escape_string($_POST["cat_id"]);
- $auth_login = $this->dbh->escape_string(trim($_POST["auth_login"]));
+ $feed_title = trim($_POST["title"]);
+ $feed_link = trim($_POST["feed_url"]);
+ $upd_intl = (int) $_POST["update_interval"];
+ $purge_intl = (int) $_POST["purge_interval"];
+ $feed_id = (int) $_POST["id"]; /* editSave */
+ $feed_ids = $_POST["ids"]; /* batchEditSave */
+ $cat_id = (int) $_POST["cat_id"];
+ $auth_login = trim($_POST["auth_login"]);
$auth_pass = trim($_POST["auth_pass"]);
- $private = checkbox_to_sql_bool($this->dbh->escape_string($_POST["private"]));
+ $private = checkbox_to_sql_bool($_POST["private"]);
$include_in_digest = checkbox_to_sql_bool(
- $this->dbh->escape_string($_POST["include_in_digest"]));
+ $_POST["include_in_digest"]);
$cache_images = checkbox_to_sql_bool(
- $this->dbh->escape_string($_POST["cache_images"]));
+ $_POST["cache_images"]);
$hide_images = checkbox_to_sql_bool(
- $this->dbh->escape_string($_POST["hide_images"]));
+ $_POST["hide_images"]);
$always_display_enclosures = checkbox_to_sql_bool(
- $this->dbh->escape_string($_POST["always_display_enclosures"]));
+ $_POST["always_display_enclosures"]);
$mark_unread_on_update = checkbox_to_sql_bool(
- $this->dbh->escape_string($_POST["mark_unread_on_update"]));
+ $_POST["mark_unread_on_update"]);
- $feed_language = $this->dbh->escape_string(trim($_POST["feed_language"]));
+ $feed_language = trim($_POST["feed_language"]);
- $auth_pass = $this->dbh->escape_string($auth_pass);
+ $auth_pass = $auth_pass;
if (get_pref('ENABLE_FEED_CATS')) {
if ($cat_id && $cat_id != 0) {
@@ -1008,7 +1012,7 @@ class Pref_Feeds extends Handler_Protected {
$reset_basic_info = $orig_feed_url != $feed_link;
- $this->dbh->query("UPDATE ttrss_feeds SET
+ db_query("UPDATE ttrss_feeds SET
$category_qpart
title = '$feed_title', feed_url = '$feed_link',
update_interval = '$upd_intl',
@@ -1041,7 +1045,7 @@ class Pref_Feeds extends Handler_Protected {
}
}
- $this->dbh->query("BEGIN");
+ db_query("BEGIN");
foreach (array_keys($feed_data) as $k) {
@@ -1107,21 +1111,21 @@ class Pref_Feeds extends Handler_Protected {
}
if ($qpart) {
- $this->dbh->query(
+ db_query(
"UPDATE ttrss_feeds SET $qpart WHERE id IN ($feed_ids)
AND owner_uid = " . $_SESSION["uid"]);
print "
";
}
}
- $this->dbh->query("COMMIT");
+ db_query("COMMIT");
}
return;
}
function remove() {
- $ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
+ $ids = explode(",", $_REQUEST["ids"]);
foreach ($ids as $id) {
Pref_Feeds::remove_feed($id, $_SESSION["uid"]);
@@ -1131,18 +1135,18 @@ class Pref_Feeds extends Handler_Protected {
}
function clear() {
- $id = $this->dbh->escape_string($_REQUEST["id"]);
+ $id = $_REQUEST["id"];
$this->clear_feed_articles($id);
}
function rescore() {
- $ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
+ $ids = explode(",", $_REQUEST["ids"]);
foreach ($ids as $id) {
$filters = load_filters($id, $_SESSION["uid"], 6);
- $result = $this->dbh->query("SELECT
+ $result = db_query("SELECT
title, content, link, ref_id, author,".
SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated
FROM
@@ -1153,7 +1157,7 @@ class Pref_Feeds extends Handler_Protected {
$scores = array();
- while ($line = $this->dbh->fetch_assoc($result)) {
+ while ($line = db_fetch_assoc($result)) {
$tags = Article::get_article_tags($line["ref_id"]);
@@ -1170,15 +1174,15 @@ class Pref_Feeds extends Handler_Protected {
foreach (array_keys($scores) as $s) {
if ($s > 1000) {
- $this->dbh->query("UPDATE ttrss_user_entries SET score = '$s',
+ db_query("UPDATE ttrss_user_entries SET score = '$s',
marked = true WHERE
ref_id IN (" . join(',', $scores[$s]) . ")");
} else if ($s < -500) {
- $this->dbh->query("UPDATE ttrss_user_entries SET score = '$s',
+ db_query("UPDATE ttrss_user_entries SET score = '$s',
unread = false WHERE
ref_id IN (" . join(',', $scores[$s]) . ")");
} else {
- $this->dbh->query("UPDATE ttrss_user_entries SET score = '$s' WHERE
+ db_query("UPDATE ttrss_user_entries SET score = '$s' WHERE
ref_id IN (" . join(',', $scores[$s]) . ")");
}
}
@@ -1190,16 +1194,16 @@ class Pref_Feeds extends Handler_Protected {
function rescoreAll() {
- $result = $this->dbh->query(
+ $result = db_query(
"SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']);
- while ($feed_line = $this->dbh->fetch_assoc($result)) {
+ while ($feed_line = db_fetch_assoc($result)) {
$id = $feed_line["id"];
$filters = load_filters($id, $_SESSION["uid"], 6);
- $tmp_result = $this->dbh->query("SELECT
+ $tmp_result = db_query("SELECT
title, content, link, ref_id, author,".
SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated
FROM
@@ -1210,7 +1214,7 @@ class Pref_Feeds extends Handler_Protected {
$scores = array();
- while ($line = $this->dbh->fetch_assoc($tmp_result)) {
+ while ($line = db_fetch_assoc($tmp_result)) {
$tags = Article::get_article_tags($line["ref_id"]);
@@ -1227,11 +1231,11 @@ class Pref_Feeds extends Handler_Protected {
foreach (array_keys($scores) as $s) {
if ($s > 1000) {
- $this->dbh->query("UPDATE ttrss_user_entries SET score = '$s',
+ db_query("UPDATE ttrss_user_entries SET score = '$s',
marked = true WHERE
ref_id IN (" . join(',', $scores[$s]) . ")");
} else {
- $this->dbh->query("UPDATE ttrss_user_entries SET score = '$s' WHERE
+ db_query("UPDATE ttrss_user_entries SET score = '$s' WHERE
ref_id IN (" . join(',', $scores[$s]) . ")");
}
}
@@ -1242,9 +1246,9 @@ class Pref_Feeds extends Handler_Protected {
}
function categorize() {
- $ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
+ $ids = explode(",", $_REQUEST["ids"]);
- $cat_id = $this->dbh->escape_string($_REQUEST["cat_id"]);
+ $cat_id = $_REQUEST["cat_id"];
if ($cat_id == 0) {
$cat_id_qpart = 'NULL';
@@ -1252,28 +1256,28 @@ class Pref_Feeds extends Handler_Protected {
$cat_id_qpart = "'$cat_id'";
}
- $this->dbh->query("BEGIN");
+ db_query("BEGIN");
foreach ($ids as $id) {
- $this->dbh->query("UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
+ db_query("UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
WHERE id = '$id'
AND owner_uid = " . $_SESSION["uid"]);
}
- $this->dbh->query("COMMIT");
+ db_query("COMMIT");
}
function removeCat() {
- $ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
+ $ids = explode(",", $_REQUEST["ids"]);
foreach ($ids as $id) {
$this->remove_feed_category($id, $_SESSION["uid"]);
}
}
function addCat() {
- $feed_cat = $this->dbh->escape_string(trim($_REQUEST["cat"]));
+ $feed_cat = trim($_REQUEST["cat"]);
add_feed_category($feed_cat);
}
@@ -1283,10 +1287,10 @@ class Pref_Feeds extends Handler_Protected {
print "
";
print "
";
- $result = $this->dbh->query("SELECT COUNT(id) AS num_errors
+ $result = db_query("SELECT COUNT(id) AS num_errors
FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
- $num_errors = $this->dbh->fetch_result($result, 0, "num_errors");
+ $num_errors = db_fetch_result($result, 0, "num_errors");
if ($num_errors > 0) {
@@ -1301,7 +1305,7 @@ class Pref_Feeds extends Handler_Protected {
onclick=\"showInactiveFeeds()\">" .
__("Inactive feeds") . "";
- $feed_search = $this->dbh->escape_string($_REQUEST["search"]);
+ $feed_search = $_REQUEST["search"];
if (array_key_exists("search", $_REQUEST)) {
$_SESSION["prefs_feed_search"] = $feed_search;
@@ -1568,7 +1572,7 @@ class Pref_Feeds extends Handler_Protected {
$interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)";
}
- $result = $this->dbh->query("SELECT ttrss_feeds.title, ttrss_feeds.site_url,
+ $result = db_query("SELECT ttrss_feeds.title, ttrss_feeds.site_url,
ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article
FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE
(SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
@@ -1599,7 +1603,7 @@ class Pref_Feeds extends Handler_Protected {
$lnum = 1;
- while ($line = $this->dbh->fetch_assoc($result)) {
+ while ($line = db_fetch_assoc($result)) {
$feed_id = $line["id"];
$this_row_id = "id=\"FUPDD-$feed_id\"";
@@ -1643,7 +1647,7 @@ class Pref_Feeds extends Handler_Protected {
}
function feedsWithErrors() {
- $result = $this->dbh->query("SELECT id,title,feed_url,last_error,site_url
+ $result = db_query("SELECT id,title,feed_url,last_error,site_url
FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
print "
";
@@ -1663,7 +1667,7 @@ class Pref_Feeds extends Handler_Protected {
$lnum = 1;
- while ($line = $this->dbh->fetch_assoc($result)) {
+ while ($line = db_fetch_assoc($result)) {
$feed_id = $line["id"];
$this_row_id = "id=\"FERDD-$feed_id\"";
@@ -1717,14 +1721,14 @@ class Pref_Feeds extends Handler_Protected {
private function clear_feed_articles($id) {
if ($id != 0) {
- $result = $this->dbh->query("DELETE FROM ttrss_user_entries
+ $result = db_query("DELETE FROM ttrss_user_entries
WHERE feed_id = '$id' AND marked = false AND owner_uid = " . $_SESSION["uid"]);
} else {
- $result = $this->dbh->query("DELETE FROM ttrss_user_entries
+ $result = db_query("DELETE FROM ttrss_user_entries
WHERE feed_id IS NULL AND marked = false AND owner_uid = " . $_SESSION["uid"]);
}
- $result = $this->dbh->query("DELETE FROM ttrss_entries WHERE
+ $result = db_query("DELETE FROM ttrss_entries WHERE
(SELECT COUNT(int_id) FROM ttrss_user_entries WHERE ref_id = id) = 0");
CCache::update($id, $_SESSION['uid']);
@@ -1732,7 +1736,7 @@ class Pref_Feeds extends Handler_Protected {
private function remove_feed_category($id, $owner_uid) {
- $this->dbh->query("DELETE FROM ttrss_feed_categories
+ db_query("DELETE FROM ttrss_feed_categories
WHERE id = '$id' AND owner_uid = $owner_uid");
CCache::remove($id, $owner_uid, true);
@@ -1751,7 +1755,7 @@ class Pref_Feeds extends Handler_Protected {
$result = db_query("SELECT feed_url FROM ttrss_feeds WHERE id = $id
AND owner_uid = $owner_uid");
- $feed_url = db_escape_string(db_fetch_result($result, 0, "feed_url"));
+ $feed_url = db_fetch_result($result, 0, "feed_url");
$result = db_query("SELECT id FROM ttrss_archived_feeds
WHERE feed_url = '$feed_url' AND owner_uid = $owner_uid");
@@ -1848,17 +1852,17 @@ class Pref_Feeds extends Handler_Protected {
}
function batchAddFeeds() {
- $cat_id = $this->dbh->escape_string($_REQUEST['cat']);
+ $cat_id = $_REQUEST['cat'];
$feeds = explode("\n", $_REQUEST['feeds']);
- $login = $this->dbh->escape_string($_REQUEST['login']);
+ $login = $_REQUEST['login'];
$pass = trim($_REQUEST['pass']);
foreach ($feeds as $feed) {
- $feed = $this->dbh->escape_string(trim($feed));
+ $feed = trim($feed);
if (validate_feed_url($feed)) {
- $this->dbh->query("BEGIN");
+ db_query("BEGIN");
if ($cat_id == "0" || !$cat_id) {
$cat_qpart = "NULL";
@@ -1866,21 +1870,21 @@ class Pref_Feeds extends Handler_Protected {
$cat_qpart = "'$cat_id'";
}
- $result = $this->dbh->query(
+ $result = db_query(
"SELECT id FROM ttrss_feeds
WHERE feed_url = '$feed' AND owner_uid = ".$_SESSION["uid"]);
- $pass = $this->dbh->escape_string($pass);
+ $pass = $pass;
- if ($this->dbh->num_rows($result) == 0) {
- $result = $this->dbh->query(
+ if (db_num_rows($result) == 0) {
+ $result = db_query(
"INSERT INTO ttrss_feeds
(owner_uid,feed_url,title,cat_id,auth_login,auth_pass,update_method,auth_pass_encrypted)
VALUES ('".$_SESSION["uid"]."', '$feed',
'[Unknown]', $cat_qpart, '$login', '$pass', 0, false)");
}
- $this->dbh->query("COMMIT");
+ db_query("COMMIT");
}
}
}
@@ -1895,8 +1899,8 @@ class Pref_Feeds extends Handler_Protected {
}
function regenFeedKey() {
- $feed_id = $this->dbh->escape_string($_REQUEST['id']);
- $is_cat = $this->dbh->escape_string($_REQUEST['is_cat']) == "true";
+ $feed_id = $_REQUEST['id'];
+ $is_cat = $_REQUEST['is_cat'] == "true";
$new_key = $this->update_feed_access_key($feed_id, $is_cat);
@@ -1909,14 +1913,14 @@ class Pref_Feeds extends Handler_Protected {
$sql_is_cat = bool_to_sql_bool($is_cat);
- $result = $this->dbh->query("SELECT access_key FROM ttrss_access_keys
+ $result = db_query("SELECT access_key FROM ttrss_access_keys
WHERE feed_id = '$feed_id' AND is_cat = $sql_is_cat
AND owner_uid = " . $owner_uid);
- if ($this->dbh->num_rows($result) == 1) {
- $key = $this->dbh->escape_string(uniqid_short());
+ if (db_num_rows($result) == 1) {
+ $key = uniqid_short();
- $this->dbh->query("UPDATE ttrss_access_keys SET access_key = '$key'
+ db_query("UPDATE ttrss_access_keys SET access_key = '$key'
WHERE feed_id = '$feed_id' AND is_cat = $sql_is_cat
AND owner_uid = " . $owner_uid);
@@ -1929,7 +1933,7 @@ class Pref_Feeds extends Handler_Protected {
// Silent
function clearKeys() {
- $this->dbh->query("DELETE FROM ttrss_access_keys WHERE
+ db_query("DELETE FROM ttrss_access_keys WHERE
owner_uid = " . $_SESSION["uid"]);
}
@@ -1954,13 +1958,13 @@ 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
+ $result = db_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"]);
- print (int) $this->dbh->fetch_result($result, 0, "num_inactive");
+ print (int) db_fetch_result($result, 0, "num_inactive");
}
static function subscribe_to_feed_url() {