]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix some minor issues found by code analyzer
authorAndrew Dolgov <noreply@fakecake.org>
Sun, 3 Dec 2017 20:08:04 +0000 (23:08 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Sun, 3 Dec 2017 20:08:04 +0000 (23:08 +0300)
classes/db/mysqli.php
classes/db/prefs.php
classes/feeds.php
classes/pluginhost.php
classes/pref/feeds.php
classes/pref/filters.php
classes/pref/prefs.php
classes/rssutils.php

index 817b48c0ce89bbd915423c2135b9dbd7bc938ad5..a05b121fcf694bfa73d3ee89b8ff5d03c66644c6 100644 (file)
@@ -65,7 +65,7 @@ class Db_Mysqli implements IDb {
        }
 
        function last_error() {
-               return mysqli_error();
+               return mysqli_error($this->link);
        }
 
        function last_query_error() {
index e704a135a613ee7a5815a805c6376f7fe2da007d..64238bc7853ace398d7ac66b137e139ca946bd9c 100644 (file)
@@ -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 = "";
index b52b580f423061b101cdc9ce4fa7f17099c05ffe..983a8551258938a85dd7fe422e3dcc370c8c755b 100755 (executable)
@@ -64,7 +64,7 @@ class Feeds extends Handler_Protected {
 
                        $target = "target=\"_blank\"";
                        $reply .= "<a title=\"$last_updated\" $target href=\"$feed_site_url\">".
-                               truncate_string($feed_title, 30)."</a>";
+                               truncate_string(strip_tags($feed_title), 30)."</a>";
 
                        if ($error) {
                                $error = htmlspecialchars($error);
@@ -72,7 +72,7 @@ class Feeds extends Handler_Protected {
                        }
 
                } else {
-                       $reply .= $feed_title;
+                       $reply .= strip_tags($feed_title);
                }
 
                $reply .= "</span>";
@@ -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 = "<a class='catchup' onclick='catchupFeedInGroup($feed_id);' href='#'>".__('mark feed as read')."</a>";
 
                         $reply['content'] .= "<div data-feed-id='$feed_id' id='FTITLE-$feed_id' class='cdmFeedTitle'>".
@@ -572,7 +569,7 @@ class Feeds extends Handler_Protected {
 
                 $tmp_content .= "</div>";
 
-                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",
                             "<span class=\"highlight\">$1</span>", $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 = ?");
index f07e2bbf4593e41e05bcf1e292b7e25d9c87b36e..f9d5bc29aa7c36945c85a0e8c098ad28abc1d94f 100644 (file)
@@ -279,8 +279,6 @@ class PluginHost {
                } else {
                        return false;
                }
-
-               return false;
        }
 
        function get_commands() {
index 5b7e52ac094aa633f8776063bf1081a02b7797f8..05f6b8c8f94aab3ff6c0a4e263948b6d0cc3c173 100755 (executable)
@@ -1212,24 +1212,6 @@ class Pref_Feeds extends Handler_Protected {
                print $error_button;
                print $inactive_button;
 
-               if (defined('_ENABLE_FEED_DEBUGGING')) {
-
-                       print "<select id=\"feedActionChooser\" onchange=\"feedActionChange()\">
-                               <option value=\"facDefault\" selected>".__('More actions...')."</option>";
-
-                       if (FORCE_ARTICLE_PURGE == 0) {
-                               print
-                                       "<option value=\"facPurge\">".__('Manual purge')."</option>";
-                       }
-
-                       print "
-                               <option value=\"facClear\">".__('Clear feed data')."</option>
-                               <option value=\"facRescore\">".__('Rescore articles')."</option>";
-
-                       print "</select>";
-
-               }
-
                print "</div>"; # toolbar
 
                //print '</div>';
index e1c2e776d3dc8e6a6358d7b29f04b804c832367e..1ff9a372382b06f77df20217f227ece143428533 100755 (executable)
@@ -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 "<div id=\"pref-filter-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">";
                print "<div id=\"pref-filter-toolbar\" dojoType=\"dijit.Toolbar\">";
 
-               $filter_search = $_REQUEST["search"];
-
                if (array_key_exists("search", $_REQUEST)) {
                        $_SESSION["prefs_filter_search"] = $filter_search;
                } else {
index 03563d8b093d220058d70a5884eb25d34d44d4a4..5d999bf3dc4b7b1e054d5c1db9c09daee55a59fb 100644 (file)
@@ -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') {
index c9e6bc0ea156462f4038465c42a61df5430154c8..bd59914727645a5568a17099df92941f55102d5e 100644 (file)
@@ -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