1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 01:25:56 +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

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');