1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-02-10 16:01:33 +00:00

fix various issues reported by static analysis

update gitlab-ci config
This commit is contained in:
Andrew Dolgov
2017-04-26 15:29:22 +03:00
parent b49bb441f4
commit 7b55001eee
20 changed files with 142 additions and 160 deletions
+6 -4
View File
@@ -1,5 +1,4 @@
<?php
class API extends Handler {
const API_LEVEL = 14;
@@ -309,7 +308,7 @@ class API extends Handler {
get_feed_access_key(-2, false);
$p = new pubsubhubbub\publisher\Publisher(PUBSUBHUBBUB_HUB);
$pubsub_result = $p->publish_update($rss_link);
$p->publish_update($rss_link);
}
}
@@ -418,7 +417,7 @@ class API extends Handler {
$feed_id = (int) $this->dbh->escape_string($_REQUEST["feed_id"]);
if (!ini_get("open_basedir")) {
update_rss_feed($feed_id, true);
update_rss_feed($feed_id);
}
$this->wrap(self::STATUS_OK, array("status" => "OK"));
@@ -658,6 +657,9 @@ class API extends Handler {
return $feeds;
}
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
static function api_get_headlines($feed_id, $limit, $offset,
$filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order,
$include_attachments, $since_id,
@@ -677,7 +679,7 @@ class API extends Handler {
if (!$cache_images && time() - $last_updated > 120) {
include "rssfuncs.php";
update_rss_feed($feed_id, true, true);
update_rss_feed($feed_id, true);
} else {
db_query("UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
WHERE id = '$feed_id'");
+1 -1
View File
@@ -361,7 +361,7 @@ class Article extends Handler_Protected {
$labels = get_article_labels($id, $_SESSION["uid"]);
array_push($reply["info-for-headlines"],
array("id" => $id, "labels" => format_article_labels($labels, $id)));
array("id" => $id, "labels" => format_article_labels($labels)));
}
}
+6
View File
@@ -6,10 +6,16 @@ class Auth_Base {
$this->dbh = Db::get();
}
/**
* @SuppressWarnings(unused)
*/
function check_password($owner_uid, $password) {
return false;
}
/**
* @SuppressWarnings(unused)
*/
function authenticate($login, $password) {
return false;
}
-3
View File
@@ -23,8 +23,6 @@ class Db_Prefs {
}
function cache() {
$profile = false;
$user_id = $_SESSION["uid"];
@$profile = $_SESSION["profile"];
@@ -129,7 +127,6 @@ class Db_Prefs {
@$profile = $_SESSION["profile"];
} else {
$user_id = sprintf("%d", $user_id);
$prefs_cache = false;
}
if ($profile) {
+7 -7
View File
@@ -13,7 +13,7 @@ class Feeds extends Handler_Protected {
private function format_headline_subtoolbar($feed_site_url, $feed_title,
$feed_id, $is_cat, $search,
$view_mode, $error, $feed_last_updated) {
$error, $feed_last_updated) {
$catchup_sel_link = "catchupSelection()";
@@ -153,7 +153,7 @@ class Feeds extends Handler_Protected {
}
private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view,
$next_unread_feed, $offset, $vgr_last_feed = false,
$offset, $vgr_last_feed = false,
$override_order = false, $include_children = false, $check_first_id = false,
$skip_first_id_check = false) {
@@ -203,7 +203,7 @@ class Feeds extends Handler_Protected {
if (!$cache_images && time() - $last_updated > 120) {
include "rssfuncs.php";
update_rss_feed($feed, true, true);
update_rss_feed($feed, true);
} else {
$this->dbh->query("UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
WHERE id = '$feed'");
@@ -306,7 +306,7 @@ class Feeds extends Handler_Protected {
$reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url,
$feed_title,
$feed, $cat_view, $search, $view_mode,
$feed, $cat_view, $search,
$last_error, $last_updated);
$headlines_count = is_numeric($result) ? 0 : $this->dbh->num_rows($result);
@@ -361,7 +361,7 @@ class Feeds extends Handler_Protected {
if (!is_array($labels)) $labels = get_article_labels($id);
$labels_str = "<span class=\"HLLCTR-$id\">";
$labels_str .= format_article_labels($labels, $id);
$labels_str .= format_article_labels($labels);
$labels_str .= "</span>";
if (count($topmost_article_ids) < 3) {
@@ -937,7 +937,7 @@ class Feeds extends Handler_Protected {
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("04", $timing_info);
$ret = $this->format_headlines_list($feed, $method,
$view_mode, $limit, $cat_view, $next_unread_feed, $offset,
$view_mode, $limit, $cat_view, $offset,
$vgroup_last_feed, $override_order, true, $check_first_id, $skip_first_id_check);
//$topmost_article_ids = $ret[0];
@@ -1231,7 +1231,7 @@ class Feeds extends Handler_Protected {
if ($do_update) {
include "rssfuncs.php";
update_rss_feed($feed_id, true, true);
update_rss_feed($feed_id, true);
}
?></pre>
+3
View File
@@ -1,6 +1,9 @@
<?php
class Logger_Syslog {
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function log_error($errno, $errstr, $file, $line, $context) {
switch ($errno) {
+8 -15
View File
@@ -251,7 +251,7 @@ class Opml extends Handler_Protected {
// Import
private function opml_import_feed($doc, $node, $cat_id, $owner_uid) {
private function opml_import_feed($node, $cat_id, $owner_uid) {
$attrs = $node->attributes;
$feed_title = $this->dbh->escape_string(mb_substr($attrs->getNamedItem('text')->nodeValue, 0, 250));
@@ -284,7 +284,7 @@ class Opml extends Handler_Protected {
}
}
private function opml_import_label($doc, $node, $owner_uid) {
private function opml_import_label($node, $owner_uid) {
$attrs = $node->attributes;
$label_name = $this->dbh->escape_string($attrs->getNamedItem('label-name')->nodeValue);
@@ -301,7 +301,7 @@ class Opml extends Handler_Protected {
}
}
private function opml_import_preference($doc, $node, $owner_uid) {
private function opml_import_preference($node) {
$attrs = $node->attributes;
$pref_name = $this->dbh->escape_string($attrs->getNamedItem('pref-name')->nodeValue);
@@ -315,7 +315,7 @@ class Opml extends Handler_Protected {
}
}
private function opml_import_filter($doc, $node, $owner_uid) {
private function opml_import_filter($node) {
$attrs = $node->attributes;
$filter_type = $this->dbh->escape_string($attrs->getNamedItem('filter-type')->nodeValue);
@@ -386,8 +386,6 @@ class Opml extends Handler_Protected {
}
private function opml_import_category($doc, $root_node, $owner_uid, $parent_id) {
$body = $doc->getElementsByTagName('body');
$default_cat_id = (int) get_feed_category('Imported feeds', false);
if ($root_node) {
@@ -442,16 +440,16 @@ class Opml extends Handler_Protected {
switch ($cat_title) {
case "tt-rss-prefs":
$this->opml_import_preference($doc, $node, $owner_uid);
$this->opml_import_preference($node);
break;
case "tt-rss-labels":
$this->opml_import_label($doc, $node, $owner_uid);
$this->opml_import_label($node, $owner_uid);
break;
case "tt-rss-filters":
$this->opml_import_filter($doc, $node, $owner_uid);
$this->opml_import_filter($node);
break;
default:
$this->opml_import_feed($doc, $node, $dst_cat_id, $owner_uid);
$this->opml_import_feed($node, $dst_cat_id, $owner_uid);
}
}
}
@@ -461,19 +459,14 @@ class Opml extends Handler_Protected {
function opml_import($owner_uid) {
if (!$owner_uid) return;
$debug = isset($_REQUEST["debug"]);
$doc = false;
# if ($debug) $doc = DOMDocument::load("/tmp/test.opml");
if ($_FILES['opml_file']['error'] != 0) {
print_error(T_sprintf("Upload failed with error code %d",
$_FILES['opml_file']['error']));
return;
}
$tmp_file = false;
if (is_uploaded_file($_FILES['opml_file']['tmp_name'])) {
$tmp_file = tempnam(CACHE_DIR . '/upload', 'opml');
+3
View File
@@ -22,6 +22,9 @@ class Plugin {
return array();
}
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function is_public_method($method) {
return false;
}
+1 -1
View File
@@ -288,7 +288,7 @@ class PluginHost {
}
}
function load_data($force = false) {
function load_data() {
if ($this->owner_uid) {
$result = $this->dbh->query("SELECT name, content FROM ttrss_plugin_storage
WHERE owner_uid = '".$this->owner_uid."'");
+1 -1
View File
@@ -130,7 +130,7 @@ class Pref_Filters extends Handler_Protected {
while ($line = db_fetch_assoc($result)) {
$rc = get_article_filters(array($filter), $line['title'], $line['content'], $line['link'],
false, $line['author'], explode(",", $line['tag_cache']));
$line['author'], explode(",", $line['tag_cache']));
if (count($rc) > 0) {
-1
View File
@@ -251,7 +251,6 @@ class Pref_Users extends Handler_Protected {
$login = db_fetch_result($result, 0, "login");
$email = db_fetch_result($result, 0, "email");
$salt = db_fetch_result($result, 0, "salt");
$new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
$tmp_user_pwd = make_password(8);
+1 -1
View File
@@ -453,7 +453,7 @@ class RPC extends Handler_Protected {
$search_query = $this->dbh->escape_string($_REQUEST['search_query']);
$search_lang = $this->dbh->escape_string($_REQUEST['search_lang']);
catchup_feed($feed_id, $is_cat, false, false, $mode, [$search_query, $search_lang]);
catchup_feed($feed_id, $is_cat, false, $mode, [$search_query, $search_lang]);
print json_encode(array("message" => "UPDATE_COUNTERS"));
}