";
$reply['content'] .= __("Originally from:");
$reply['content'] .= " ";
- $tmp_line = db_fetch_assoc($tmp_result);
+ $tmp_line = $this->dbh->fetch_assoc($tmp_result);
$reply['content'] .= "
" .
@@ -757,18 +757,18 @@ class Feeds extends Handler_Protected {
$reply['content'] .= "";
- $result = db_query("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds
+ $result = $this->dbh->query("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds
WHERE owner_uid = " . $_SESSION['uid']);
- $last_updated = db_fetch_result($result, 0, "last_updated");
+ $last_updated = $this->dbh->fetch_result($result, 0, "last_updated");
$last_updated = make_local_datetime($last_updated, false);
$reply['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated);
- $result = db_query("SELECT COUNT(id) AS num_errors
+ $result = $this->dbh->query("SELECT COUNT(id) AS num_errors
FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
- $num_errors = db_fetch_result($result, 0, "num_errors");
+ $num_errors = $this->dbh->fetch_result($result, 0, "num_errors");
if ($num_errors > 0) {
$reply['content'] .= "
";
@@ -786,7 +786,7 @@ class Feeds extends Handler_Protected {
}
function catchupAll() {
- db_query("UPDATE ttrss_user_entries SET
+ $this->dbh->query("UPDATE ttrss_user_entries SET
last_read = NOW(), unread = false WHERE unread = true AND owner_uid = " . $_SESSION["uid"]);
ccache_zero_all($_SESSION["uid"]);
}
@@ -798,17 +798,17 @@ class Feeds extends Handler_Protected {
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("0", $timing_info);
- $omode = db_escape_string($_REQUEST["omode"]);
+ $omode = $this->dbh->escape_string($_REQUEST["omode"]);
- $feed = db_escape_string($_REQUEST["feed"]);
- $method = db_escape_string($_REQUEST["m"]);
- $view_mode = db_escape_string($_REQUEST["view_mode"]);
+ $feed = $this->dbh->escape_string($_REQUEST["feed"]);
+ $method = $this->dbh->escape_string($_REQUEST["m"]);
+ $view_mode = $this->dbh->escape_string($_REQUEST["view_mode"]);
$limit = 30;
@$cat_view = $_REQUEST["cat"] == "true";
- @$next_unread_feed = db_escape_string($_REQUEST["nuf"]);
- @$offset = db_escape_string($_REQUEST["skip"]);
- @$vgroup_last_feed = db_escape_string($_REQUEST["vgrlf"]);
- $order_by = db_escape_string($_REQUEST["order_by"]);
+ @$next_unread_feed = $this->dbh->escape_string($_REQUEST["nuf"]);
+ @$offset = $this->dbh->escape_string($_REQUEST["skip"]);
+ @$vgroup_last_feed = $this->dbh->escape_string($_REQUEST["vgrlf"]);
+ $order_by = $this->dbh->escape_string($_REQUEST["order_by"]);
if (is_numeric($feed)) $feed = (int) $feed;
@@ -824,17 +824,17 @@ class Feeds extends Handler_Protected {
if ($feed < LABEL_BASE_INDEX) {
$label_feed = feed_to_label_id($feed);
- $result = db_query("SELECT id FROM ttrss_labels2 WHERE
+ $result = $this->dbh->query("SELECT id FROM ttrss_labels2 WHERE
id = '$label_feed' AND owner_uid = " . $_SESSION['uid']);
} else if (!$cat_view && is_numeric($feed) && $feed > 0) {
- $result = db_query("SELECT id FROM ttrss_feeds WHERE
+ $result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE
id = '$feed' AND owner_uid = " . $_SESSION['uid']);
} else if ($cat_view && is_numeric($feed) && $feed > 0) {
- $result = db_query("SELECT id FROM ttrss_feed_categories WHERE
+ $result = $this->dbh->query("SELECT id FROM ttrss_feed_categories WHERE
id = '$feed' AND owner_uid = " . $_SESSION['uid']);
}
- if ($result && db_num_rows($result) == 0) {
+ if ($result && $this->dbh->num_rows($result) == 0) {
print json_encode($this->generate_error_feed(__("Feed not found.")));
return;
}
@@ -851,13 +851,13 @@ class Feeds extends Handler_Protected {
/* bump login timestamp if needed */
if (time() - $_SESSION["last_login_update"] > 3600) {
- db_query("UPDATE ttrss_users SET last_login = NOW() WHERE id = " .
+ $this->dbh->query("UPDATE ttrss_users SET last_login = NOW() WHERE id = " .
$_SESSION["uid"]);
$_SESSION["last_login_update"] = time();
}
if (!$cat_view && is_numeric($feed) && $feed > 0) {
- db_query("UPDATE ttrss_feeds SET last_viewed = NOW()
+ $this->dbh->query("UPDATE ttrss_feeds SET last_viewed = NOW()
WHERE id = '$feed' AND owner_uid = ".$_SESSION["uid"]);
}
@@ -924,18 +924,18 @@ class Feeds extends Handler_Protected {
$reply['headlines']['content'] .= "";
- $result = db_query("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds
+ $result = $this->dbh->query("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds
WHERE owner_uid = " . $_SESSION['uid']);
- $last_updated = db_fetch_result($result, 0, "last_updated");
+ $last_updated = $this->dbh->fetch_result($result, 0, "last_updated");
$last_updated = make_local_datetime($last_updated, false);
$reply['headlines']['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated);
- $result = db_query("SELECT COUNT(id) AS num_errors
+ $result = $this->dbh->query("SELECT COUNT(id) AS num_errors
FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
- $num_errors = db_fetch_result($result, 0, "num_errors");
+ $num_errors = $this->dbh->fetch_result($result, 0, "num_errors");
if ($num_errors > 0) {
$reply['headlines']['content'] .= "
";
@@ -1044,7 +1044,7 @@ class Feeds extends Handler_Protected {
function feedBrowser() {
if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return;
- $browser_search = db_escape_string($_REQUEST["search"]);
+ $browser_search = $this->dbh->escape_string($_REQUEST["search"]);
print "";
print "";
@@ -1092,7 +1092,7 @@ class Feeds extends Handler_Protected {
}
function search() {
- $this->params = explode(":", db_escape_string($_REQUEST["param"]), 2);
+ $this->params = explode(":", $this->dbh->escape_string($_REQUEST["param"]), 2);
$active_feed_id = sprintf("%d", $this->params[0]);
$is_cat = $this->params[1] != "false";
diff --git a/classes/handler/public.php b/classes/handler/public.php
index 5af416adc..439cc7d4d 100644
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -28,8 +28,8 @@ class Handler_Public extends Handler {
$result = $qfh_ret[0];
- if (db_num_rows($result) != 0) {
- $ts = strtotime(db_fetch_result($result, 0, "date_entered"));
+ if ($this->dbh->num_rows($result) != 0) {
+ $ts = strtotime($this->dbh->fetch_result($result, 0, "date_entered"));
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $ts) {
@@ -74,7 +74,7 @@ class Handler_Public extends Handler {
$tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
- while ($line = db_fetch_assoc($result)) {
+ while ($line = $this->dbh->fetch_assoc($result)) {
$tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']), true);
$tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
@@ -151,7 +151,7 @@ class Handler_Public extends Handler {
$feed['articles'] = array();
- while ($line = db_fetch_assoc($result)) {
+ while ($line = $this->dbh->fetch_assoc($result)) {
$article = array();
$article['id'] = $line['link'];
@@ -201,13 +201,13 @@ class Handler_Public extends Handler {
}
function getUnread() {
- $login = db_escape_string($_REQUEST["login"]);
+ $login = $this->dbh->escape_string($_REQUEST["login"]);
$fresh = $_REQUEST["fresh"] == "1";
- $result = db_query("SELECT id FROM ttrss_users WHERE login = '$login'");
+ $result = $this->dbh->query("SELECT id FROM ttrss_users WHERE login = '$login'");
- if (db_num_rows($result) == 1) {
- $uid = db_fetch_result($result, 0, "id");
+ if ($this->dbh->num_rows($result) == 1) {
+ $uid = $this->dbh->fetch_result($result, 0, "id");
print getGlobalUnread($uid);
@@ -223,16 +223,16 @@ class Handler_Public extends Handler {
}
function getProfiles() {
- $login = db_escape_string($_REQUEST["login"]);
+ $login = $this->dbh->escape_string($_REQUEST["login"]);
- $result = db_query("SELECT * FROM ttrss_settings_profiles,ttrss_users
+ $result = $this->dbh->query("SELECT * FROM ttrss_settings_profiles,ttrss_users
WHERE ttrss_users.id = ttrss_settings_profiles.owner_uid AND login = '$login' ORDER BY title");
print "