summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-12-03 09:35:59 +0300
committerAndrew Dolgov <[email protected]>2017-12-03 09:35:59 +0300
commit187abfe732fe62cf4b30847665dab30903d00d99 (patch)
tree1a0b4084e8b6a38bd6cf937368819b737747e995 /classes
parent8ff3cbb32e8fcae1e8ce7d83e5718f43afaacdb8 (diff)
main classes: remove sql_bool_to_bool() kludge
Diffstat (limited to 'classes')
-rw-r--r--classes/article.php8
-rwxr-xr-xclasses/feeds.php12
-rw-r--r--classes/handler/public.php7
-rw-r--r--classes/opml.php9
-rwxr-xr-xclasses/pref/feeds.php14
-rw-r--r--classes/pref/prefs.php4
-rw-r--r--classes/rssutils.php14
7 files changed, 30 insertions, 38 deletions
diff --git a/classes/article.php b/classes/article.php
index 869e746cf..0352e1b9e 100644
--- a/classes/article.php
+++ b/classes/article.php
@@ -8,6 +8,8 @@ class Article extends Handler_Protected {
}
function redirect() {
+ $id = $_REQUEST['id'];
+
$sth = $this->pdo->prepare("SELECT link FROM ttrss_entries, ttrss_user_entries
WHERE id = ? AND id = ref_id AND owner_uid = ?
LIMIT 1");
@@ -601,7 +603,7 @@ class Article extends Handler_Protected {
unset($line["tag_cache"]);
$line["content"] = sanitize($line["content"],
- sql_bool_to_bool($line['hide_images']),
+ $line['hide_images'],
$owner_uid, $line["site_url"], false, $line["id"]);
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE) as $p) {
@@ -754,9 +756,9 @@ class Article extends Handler_Protected {
if (!$zoom_mode) {
$rv['content'] .= Article::format_article_enclosures($id,
- sql_bool_to_bool($line["always_display_enclosures"]),
+ $line["always_display_enclosures"],
$line["content"],
- sql_bool_to_bool($line["hide_images"]));
+ $line["hide_images"]);
}
$rv['content'] .= "</div>";
diff --git a/classes/feeds.php b/classes/feeds.php
index f2244ae89..ffb2fc5c8 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -199,7 +199,7 @@ class Feeds extends Handler_Protected {
if ($row = $sth->fetch()) {
$last_updated = strtotime($row["last_updated"]);
- $cache_images = sql_bool_to_bool($row["cache_images"]);
+ $cache_images = $row["cache_images"];
if (!$cache_images && time() - $last_updated > 120) {
RSSUtils::update_rss_feed($feed, true);
@@ -360,12 +360,12 @@ class Feeds extends Handler_Protected {
$class = "";
- if (sql_bool_to_bool($line["unread"])) {
+ if ($line["unread"]) {
$class .= " Unread";
++$num_unread;
}
- if (sql_bool_to_bool($line["marked"])) {
+ if ($line["marked"]) {
$marked_pic = "<img
src=\"images/mark_set.png\"
class=\"markedPic\" alt=\"Unstar article\"
@@ -378,7 +378,7 @@ class Feeds extends Handler_Protected {
onclick='toggleMark($id)'>";
}
- if (sql_bool_to_bool($line["published"])) {
+ if ($line["published"]) {
$published_pic = "<img src=\"images/pub_set.png\"
class=\"pubPic\"
alt=\"Unpublish article\" onclick='togglePub($id)'>";
@@ -528,7 +528,7 @@ class Feeds extends Handler_Protected {
$tags = false;
$line["content"] = sanitize($line["content"],
- sql_bool_to_bool($line['hide_images']), false, $entry_site_url, $highlight_words, $line["id"]);
+ $line['hide_images'], false, $entry_site_url, $highlight_words, $line["id"]);
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) {
$line = $p->hook_render_article_cdm($line);
@@ -690,7 +690,7 @@ class Feeds extends Handler_Protected {
$tmp_content .= "<div class=\"cdmIntermediate\">";
- $always_display_enclosures = sql_bool_to_bool($line["always_display_enclosures"]);
+ $always_display_enclosures = $line["always_display_enclosures"];
$tmp_content .= Article::format_article_enclosures($id, $always_display_enclosures, $line["content"], sql_bool_to_bool($line["hide_images"]));
$tmp_content .= "</div>"; // cdmIntermediate
diff --git a/classes/handler/public.php b/classes/handler/public.php
index f36ee8b1a..8b513df67 100644
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -15,14 +15,11 @@ class Handler_Public extends Handler {
if (!$limit) $limit = 60;
$date_sort_field = "date_entered DESC, updated DESC";
- $date_check_field = "date_entered";
if ($feed == -2 && !$is_cat) {
$date_sort_field = "last_published DESC";
- $date_check_field = "last_published";
} else if ($feed == -1 && !$is_cat) {
$date_sort_field = "last_marked DESC";
- $date_check_field = "last_marked";
}
switch ($order) {
@@ -295,7 +292,7 @@ class Handler_Public extends Handler {
function rss() {
$feed = $_REQUEST["id"];
$key = $_REQUEST["key"];
- $is_cat = sql_bool_to_bool($_REQUEST["is_cat"]);
+ $is_cat = $_REQUEST["is_cat"];
$limit = (int)$_REQUEST["limit"];
$offset = (int)$_REQUEST["offset"];
@@ -305,7 +302,7 @@ class Handler_Public extends Handler {
$start_ts = $_REQUEST["ts"];
$format = $_REQUEST['format'];
- $orig_guid = sql_bool_to_bool($_REQUEST["orig_guid"]);
+ $orig_guid = $_REQUEST["orig_guid"];
if (!$format) $format = 'atom';
diff --git a/classes/opml.php b/classes/opml.php
index 5f70558b6..98ea21a5c 100644
--- a/classes/opml.php
+++ b/classes/opml.php
@@ -173,10 +173,6 @@ class Opml extends Handler_Protected {
$sth->execute([$owner_uid]);
while ($line = $sth->fetch()) {
- foreach (array('enabled', 'match_any_rule', 'inverse') as $b) {
- $line[$b] = sql_bool_to_bool($line[$b]);
- }
-
$line["rules"] = array();
$line["actions"] = array();
@@ -188,7 +184,7 @@ class Opml extends Handler_Protected {
unset($tmp_line["id"]);
unset($tmp_line["filter_id"]);
- $cat_filter = sql_bool_to_bool($tmp_line["cat_filter"]);
+ $cat_filter = $tmp_line["cat_filter"];
if (!$tmp_line["match_on"]) {
if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) {
@@ -222,9 +218,6 @@ class Opml extends Handler_Protected {
unset($tmp_line["match_on"]);
}
- $tmp_line["cat_filter"] = sql_bool_to_bool($tmp_line["cat_filter"]);
- $tmp_line["inverse"] = sql_bool_to_bool($tmp_line["inverse"]);
-
unset($tmp_line["feed_id"]);
unset($tmp_line["cat_id"]);
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php
index fcd2aedad..9f7ada244 100755
--- a/classes/pref/feeds.php
+++ b/classes/pref/feeds.php
@@ -510,7 +510,7 @@ class Pref_Feeds extends Handler_Protected {
print '<div dojoType="dijit.layout.TabContainer" style="height : 450px">
<div dojoType="dijit.layout.ContentPane" title="'.__('General').'">';
- $auth_pass_encrypted = sql_bool_to_bool($row["auth_pass_encrypted"]);
+ $auth_pass_encrypted = $row["auth_pass_encrypted"];
$title = htmlspecialchars($row["title"]);
@@ -644,7 +644,7 @@ class Pref_Feeds extends Handler_Protected {
//print "<div class=\"dlgSec\">".__("Options")."</div>";
print "<div class=\"dlgSecSimple\">";
- $private = sql_bool_to_bool($row["private"]);
+ $private = $row["private"];
if ($private) {
$checked = "checked=\"1\"";
@@ -655,7 +655,7 @@ class Pref_Feeds extends Handler_Protected {
print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"private\" id=\"private\"
$checked>&nbsp;<label for=\"private\">".__('Hide from Popular feeds')."</label>";
- $include_in_digest = sql_bool_to_bool($row["include_in_digest"]);
+ $include_in_digest = $row["include_in_digest"];
if ($include_in_digest) {
$checked = "checked=\"1\"";
@@ -668,7 +668,7 @@ class Pref_Feeds extends Handler_Protected {
$checked>&nbsp;<label for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
- $always_display_enclosures = sql_bool_to_bool($row["always_display_enclosures"]);
+ $always_display_enclosures = $row["always_display_enclosures"];
if ($always_display_enclosures) {
$checked = "checked";
@@ -680,7 +680,7 @@ class Pref_Feeds extends Handler_Protected {
name=\"always_display_enclosures\"
$checked>&nbsp;<label for=\"always_display_enclosures\">".__('Always display image attachments')."</label>";
- $hide_images = sql_bool_to_bool($row["hide_images"]);
+ $hide_images = $row["hide_images"];
if ($hide_images) {
$checked = "checked=\"1\"";
@@ -693,7 +693,7 @@ class Pref_Feeds extends Handler_Protected {
$checked>&nbsp;<label for=\"hide_images\">".
__('Do not embed images')."</label>";
- $cache_images = sql_bool_to_bool($row["cache_images"]);
+ $cache_images = $row["cache_images"];
if ($cache_images) {
$checked = "checked=\"1\"";
@@ -706,7 +706,7 @@ class Pref_Feeds extends Handler_Protected {
$checked>&nbsp;<label for=\"cache_images\">".
__('Cache media')."</label>";
- $mark_unread_on_update = sql_bool_to_bool($row["mark_unread_on_update"]);
+ $mark_unread_on_update = $row["mark_unread_on_update"];
if ($mark_unread_on_update) {
$checked = "checked";
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index ab39b1e28..ff778cbce 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -207,7 +207,7 @@ class Pref_Prefs extends Handler_Protected {
$email = htmlspecialchars($row["email"]);
$full_name = htmlspecialchars($row["full_name"]);
- $otp_enabled = sql_bool_to_bool($row["otp_enabled"]);
+ $otp_enabled = $row["otp_enabled"];
print "<tr><td width=\"40%\">".__('Full name')."</td>";
print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" name=\"full_name\" required=\"1\"
@@ -864,7 +864,7 @@ class Pref_Prefs extends Handler_Protected {
$base32 = new Base32();
$login = $row["login"];
- $otp_enabled = sql_bool_to_bool($row["otp_enabled"]);
+ $otp_enabled = $row["otp_enabled"];
if (!$otp_enabled) {
$secret = $base32->encode(sha1($row["salt"]));
diff --git a/classes/rssutils.php b/classes/rssutils.php
index a511a74c8..696b8604c 100644
--- a/classes/rssutils.php
+++ b/classes/rssutils.php
@@ -221,7 +221,7 @@ class RSSUtils {
$owner_uid = $row["owner_uid"];
- $auth_pass_encrypted = sql_bool_to_bool($row["auth_pass_encrypted"]);
+ $auth_pass_encrypted = $row["auth_pass_encrypted"];
$auth_login = $row["auth_login"];
$auth_pass = $row["auth_pass"];
@@ -341,8 +341,8 @@ class RSSUtils {
if ($row = $sth->fetch()) {
$owner_uid = $row["owner_uid"];
- $mark_unread_on_update = sql_bool_to_bool($row["mark_unread_on_update"]);
- $auth_pass_encrypted = sql_bool_to_bool($row["auth_pass_encrypted"]);
+ $mark_unread_on_update = $row["mark_unread_on_update"];
+ $auth_pass_encrypted = $row["auth_pass_encrypted"];
$sth = $pdo->prepare("UPDATE ttrss_feeds SET last_update_started = NOW()
WHERE id = ?");
@@ -358,7 +358,7 @@ class RSSUtils {
$stored_last_modified = $row["last_modified"];
$last_unconditional = $row["last_unconditional"];
- $cache_images = sql_bool_to_bool($row["cache_images"]);
+ $cache_images = $row["cache_images"];
$fetch_url = $row["feed_url"];
$feed_language = mb_strtolower($row["feed_language"]);
if (!$feed_language) $feed_language = 'english';
@@ -515,7 +515,7 @@ class RSSUtils {
$sth->execute([$feed]);
if ($row = $sth->fetch()) {
- $favicon_needs_check = sql_bool_to_bool($row["favicon_needs_check"]);
+ $favicon_needs_check = $row["favicon_needs_check"];
$favicon_avg_color = $row["favicon_avg_color"];
$owner_uid = $row["owner_uid"];
} else {
@@ -883,7 +883,7 @@ class RSSUtils {
$entry_current_hash,
$date_feed_processed,
$entry_comments,
- $num_comments,
+ (int)$num_comments,
$entry_plugin_data,
$entry_language,
$entry_author]);
@@ -995,7 +995,7 @@ class RSSUtils {
WHERE id = ?");
$sth->execute([$entry_title, $entry_content, $entry_current_hash, $entry_timestamp_fmt,
- $num_comments, $entry_plugin_data, $entry_author, $entry_language, $ref_id]);
+ (int)$num_comments, $entry_plugin_data, $entry_author, $entry_language, $ref_id]);
// update aux data
$sth = $pdo->prepare("UPDATE ttrss_user_entries