From 7c6f7bb0aa50f42fd697fbe82dc9b8b5931a3a52 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 3 Dec 2017 23:08:04 +0300 Subject: [PATCH] fix some minor issues found by code analyzer --- classes/db/mysqli.php | 2 +- classes/db/prefs.php | 6 ------ classes/feeds.php | 17 ++++------------- classes/pluginhost.php | 2 -- classes/pref/feeds.php | 18 ------------------ classes/pref/filters.php | 8 -------- classes/pref/prefs.php | 1 - classes/rssutils.php | 2 -- 8 files changed, 5 insertions(+), 51 deletions(-) diff --git a/classes/db/mysqli.php b/classes/db/mysqli.php index 817b48c0..a05b121f 100644 --- a/classes/db/mysqli.php +++ b/classes/db/mysqli.php @@ -65,7 +65,7 @@ class Db_Mysqli implements IDb { } function last_error() { - return mysqli_error(); + return mysqli_error($this->link); } function last_query_error() { diff --git a/classes/db/prefs.php b/classes/db/prefs.php index e704a135..64238bc7 100644 --- a/classes/db/prefs.php +++ b/classes/db/prefs.php @@ -118,12 +118,6 @@ class Db_Prefs { $user_id = sprintf("%d", $user_id); } - if ($profile) { - $profile_qpart = "AND profile = '$profile'"; - } else { - $profile_qpart = "AND profile IS NULL"; - } - if (!$profile || get_schema_version() < 63) $profile = null; $type_name = ""; diff --git a/classes/feeds.php b/classes/feeds.php index b52b580f..983a8551 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -64,7 +64,7 @@ class Feeds extends Handler_Protected { $target = "target=\"_blank\""; $reply .= "". - truncate_string($feed_title, 30).""; + truncate_string(strip_tags($feed_title), 30).""; if ($error) { $error = htmlspecialchars($error); @@ -72,7 +72,7 @@ class Feeds extends Handler_Protected { } } else { - $reply .= $feed_title; + $reply .= strip_tags($feed_title); } $reply .= ""; @@ -440,11 +440,8 @@ class Feeds extends Handler_Protected { if ($vfeed_group_enabled) { if ($feed_id != $vgroup_last_feed && $line["feed_title"]) { - $cur_feed_title = $line["feed_title"]; $vgroup_last_feed = $feed_id; - $cur_feed_title = htmlspecialchars($cur_feed_title); - $vf_catchup_link = "".__('mark feed as read').""; $reply['content'] .= "
". @@ -572,7 +569,7 @@ class Feeds extends Handler_Protected { $tmp_content .= "
"; - if ($highlight_words && count($highlight_words > 0)) { + if ($highlight_words && count($highlight_words) > 0) { foreach ($highlight_words as $word) { $line["title"] = preg_replace("/(\Q$word\E)/i", "$1", $line["title"]); @@ -1540,13 +1537,7 @@ class Feeds extends Handler_Protected { $url = key($feedUrls); } - if ($cat_id == "0" || !$cat_id) { - $cat_qpart = "NULL"; - } else { - $cat_qpart = "'$cat_id'"; - } - - if (!(int)$cat_id) $cat_id = null; + if (!$cat_id) $cat_id = null; $sth = $pdo->prepare("SELECT id FROM ttrss_feeds WHERE feed_url = ? AND owner_uid = ?"); diff --git a/classes/pluginhost.php b/classes/pluginhost.php index f07e2bbf..f9d5bc29 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -279,8 +279,6 @@ class PluginHost { } else { return false; } - - return false; } function get_commands() { diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 5b7e52ac..05f6b8c8 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1212,24 +1212,6 @@ class Pref_Feeds extends Handler_Protected { print $error_button; print $inactive_button; - if (defined('_ENABLE_FEED_DEBUGGING')) { - - print ""; - - } - print ""; # toolbar //print ''; diff --git a/classes/pref/filters.php b/classes/pref/filters.php index e1c2e776..1ff9a372 100755 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -762,12 +762,6 @@ class Pref_Filters extends Handler_Protected { function index() { - $sort = $_REQUEST["sort"]; - - if (!$sort || $sort == "undefined") { - $sort = "reg_exp"; - } - $filter_search = $_REQUEST["search"]; if (array_key_exists("search", $_REQUEST)) { @@ -780,8 +774,6 @@ class Pref_Filters extends Handler_Protected { print "
"; print "
"; - $filter_search = $_REQUEST["search"]; - if (array_key_exists("search", $_REQUEST)) { $_SESSION["prefs_filter_search"] = $filter_search; } else { diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index 03563d8b..5d999bf3 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -99,7 +99,6 @@ class Pref_Prefs extends Handler_Protected { foreach (array_keys($_POST) as $pref_name) { - $pref_name = $pref_name; $value = $_POST[$pref_name]; if ($pref_name == 'DIGEST_PREFERRED_TIME') { diff --git a/classes/rssutils.php b/classes/rssutils.php index c9e6bc0e..bd599147 100644 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -492,8 +492,6 @@ class RSSUtils { $rss = new FeedParser($feed_data); $rss->init(); - $feed = $feed; - if (!$rss->error()) { // We use local pluginhost here because we need to load different per-user feed plugins