Merge branch 'master' of git.fakecake.org:tt-rss

This commit is contained in:
Andrew Dolgov 2017-04-27 00:24:29 +03:00
commit 7f4a24f868
55 changed files with 145 additions and 177 deletions

View File

@ -6,9 +6,8 @@ class Af_Comics_Template extends Af_ComicFilter {
} }
function process(&$article) { function process(&$article) {
$owner_uid = $article["owner_uid"]; //$owner_uid = $article["owner_uid"];
return false; return false;
} }
} }
?>

View File

@ -3,4 +3,3 @@ abstract class Af_ComicFilter {
public abstract function supported(); public abstract function supported();
public abstract function process(&$article); public abstract function process(&$article);
} }
?>

View File

@ -6,17 +6,12 @@ class Af_Comics_Cad extends Af_ComicFilter {
} }
function process(&$article) { function process(&$article) {
$owner_uid = $article["owner_uid"];
if (strpos($article["link"], "cad-comic.com/cad/") !== FALSE) { if (strpos($article["link"], "cad-comic.com/cad/") !== FALSE) {
if (strpos($article["title"], "News:") === FALSE) { if (strpos($article["title"], "News:") === FALSE) {
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML(fetch_file_contents($article["link"]));
$basenode = false; if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
if ($doc) {
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$basenode = $xpath->query('(//img[contains(@src, "/comics/cad-")])')->item(0); $basenode = $xpath->query('(//img[contains(@src, "/comics/cad-")])')->item(0);
@ -33,4 +28,3 @@ class Af_Comics_Cad extends Af_ComicFilter {
return false; return false;
} }
} }
?>

View File

@ -6,8 +6,6 @@ class Af_Comics_ComicClass extends Af_ComicFilter {
} }
function process(&$article) { function process(&$article) {
$owner_uid = $article["owner_uid"];
if (strpos($article["guid"], "loadingartist.com") !== FALSE) { if (strpos($article["guid"], "loadingartist.com") !== FALSE) {
// lol at people who block clients by user agent // lol at people who block clients by user agent
@ -18,11 +16,8 @@ class Af_Comics_ComicClass extends Af_ComicFilter {
"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML($res);
$basenode = false; if (@$doc->loadHTML($res)) {
if ($doc) {
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$basenode = $xpath->query('//div[@class="comic"]')->item(0); $basenode = $xpath->query('//div[@class="comic"]')->item(0);
@ -37,4 +32,3 @@ class Af_Comics_ComicClass extends Af_ComicFilter {
return false; return false;
} }
} }
?>

View File

@ -7,8 +7,6 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
} }
function process(&$article) { function process(&$article) {
$owner_uid = $article["owner_uid"];
if (strpos($article["guid"], "bunicomic.com") !== FALSE || if (strpos($article["guid"], "bunicomic.com") !== FALSE ||
strpos($article["guid"], "buttersafe.com") !== FALSE || strpos($article["guid"], "buttersafe.com") !== FALSE ||
strpos($article["guid"], "extrafabulouscomics.com") !== FALSE || strpos($article["guid"], "extrafabulouscomics.com") !== FALSE ||
@ -23,11 +21,8 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML($res);
$basenode = false; if (@$doc->loadHTML($res)) {
if ($doc) {
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$basenode = $xpath->query('//div[@id="comic"]')->item(0); $basenode = $xpath->query('//div[@id="comic"]')->item(0);
@ -42,4 +37,3 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
return false; return false;
} }
} }
?>

View File

@ -6,7 +6,6 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter {
} }
function process(&$article) { function process(&$article) {
$owner_uid = $article["owner_uid"];
if (strpos($article["guid"], "darklegacycomics.com") !== FALSE) { if (strpos($article["guid"], "darklegacycomics.com") !== FALSE) {
@ -20,11 +19,8 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter {
$res = $fetch_last_error_content; $res = $fetch_last_error_content;
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML($res);
$basenode = false; if (@$doc->loadHTML($res)) {
if ($doc) {
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$basenode = $xpath->query('//div[@class="comic"]')->item(0); $basenode = $xpath->query('//div[@class="comic"]')->item(0);
@ -40,4 +36,3 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter {
return false; return false;
} }
} }
?>

View File

@ -19,30 +19,11 @@ class Af_Comics_Dilbert extends Af_ComicFilter {
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML($res); @$doc->loadHTML($res);
$basenode = false;
if ($doc) { if ($doc) {
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$basenode = $xpath->query('//img[contains(@class, "img-comic")]')->item(0); $basenode = $xpath->query('//img[contains(@class, "img-comic")]')->item(0);
/* $entries = $xpath->query('(//img[@src])'); // we might also check for img[@class='strip'] I guess...
$matches = array();
foreach ($entries as $entry) {
if (preg_match("/dyn\/str_strip\/.*strip\.gif$/", $entry->getAttribute("src"), $matches)) {
$entry->setAttribute("src",
rewrite_relative_url("http://dilbert.com/",
$matches[0]));
$basenode = $entry;
break;
}
} */
if ($basenode) { if ($basenode) {
$article["content"] = $doc->saveXML($basenode); $article["content"] = $doc->saveXML($basenode);
} }
@ -54,4 +35,3 @@ class Af_Comics_Dilbert extends Af_ComicFilter {
return false; return false;
} }
} }
?>

View File

@ -6,16 +6,12 @@ class Af_Comics_Explosm extends Af_ComicFilter {
} }
function process(&$article) { function process(&$article) {
$owner_uid = $article["owner_uid"];
if (strpos($article["link"], "explosm.net/comics") !== FALSE) { if (strpos($article["link"], "explosm.net/comics") !== FALSE) {
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML(fetch_file_contents($article["link"]));
$basenode = false; if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
if ($doc) {
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$basenode = $xpath->query('(//img[@id="main-comic"])')->item(0); $basenode = $xpath->query('(//img[@id="main-comic"])')->item(0);
@ -30,4 +26,3 @@ class Af_Comics_Explosm extends Af_ComicFilter {
return false; return false;
} }
} }
?>

View File

@ -8,16 +8,13 @@ class Af_Comics_Pa extends Af_ComicFilter {
function process(&$article) { function process(&$article) {
if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "Comic:") !== FALSE) { if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "Comic:") !== FALSE) {
if ($debug_enabled) { /*if ($debug_enabled) {
_debug("af_pennyarcade: Processing comic"); _debug("af_pennyarcade: Processing comic");
} }*/
$doc = new DOMDocument(); $doc = new DOMDocument();
$doc->loadHTML(fetch_file_contents($article["link"]));
$basenode = false; if ($doc->loadHTML(fetch_file_contents($article["link"]))) {
if ($doc) {
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0); $basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0);
@ -30,13 +27,12 @@ class Af_Comics_Pa extends Af_ComicFilter {
} }
if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "News Post:") !== FALSE) { if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "News Post:") !== FALSE) {
if ($debug_enabled) { /*if ($debug_enabled) {
_debug("af_pennyarcade: Processing news post"); _debug("af_pennyarcade: Processing news post");
} }*/
$doc = new DOMDocument(); $doc = new DOMDocument();
$doc->loadHTML(fetch_file_contents($article["link"]));
if ($doc) { if ($doc->loadHTML(fetch_file_contents($article["link"]))) {
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$entries = $xpath->query('(//div[@class="post"])'); $entries = $xpath->query('(//div[@class="post"])');
@ -76,4 +72,3 @@ class Af_Comics_Pa extends Af_ComicFilter {
return false; return false;
} }
} }
?>

View File

@ -13,9 +13,8 @@ class Af_Comics_Pvp extends Af_ComicFilter {
"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML($res);
if ($doc) { if (@$doc->loadHTML($res)) {
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$basenode = $xpath->query('//section[@class="comic-art"]')->item(0); $basenode = $xpath->query('//section[@class="comic-art"]')->item(0);
@ -30,4 +29,3 @@ class Af_Comics_Pvp extends Af_ComicFilter {
return false; return false;
} }
} }
?>

View File

@ -15,11 +15,8 @@ class Af_Comics_Tfd extends Af_ComicFilter {
if (!$res) return $article; if (!$res) return $article;
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML(fetch_file_contents($article["link"]));
$basenode = false; if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
if ($doc) {
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0); $basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0);
@ -33,4 +30,3 @@ class Af_Comics_Tfd extends Af_ComicFilter {
return false; return false;
} }
} }
?>

View File

@ -10,11 +10,8 @@ class Af_Comics_Twp extends Af_ComicFilter {
if (strpos($article["link"], "threewordphrase.com") !== FALSE) { if (strpos($article["link"], "threewordphrase.com") !== FALSE) {
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML(fetch_file_contents($article["link"]));
$basenode = false; if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
if ($doc) {
$xpath = new DOMXpath($doc); $xpath = new DOMXpath($doc);
$basenode = $xpath->query("//td/center/img")->item(0); $basenode = $xpath->query("//td/center/img")->item(0);
@ -30,4 +27,3 @@ class Af_Comics_Twp extends Af_ComicFilter {
return false; return false;
} }
} }
?>

View File

@ -34,4 +34,3 @@ class Af_Comics_Whomp extends Af_ComicFilter {
return false; return false;
} }
} }
?>

View File

@ -63,18 +63,18 @@ class Af_Comics extends Plugin {
} }
function hook_article_filter($article) { function hook_article_filter($article) {
$owner_uid = $article["owner_uid"];
foreach ($this->filters as $f) { foreach ($this->filters as $f) {
if ($f->process($article)) if ($f->process($article))
break; break;
} }
return $article; return $article;
} }
// GoComics dropped feed support so it needs to be handled when fetching the feed. // GoComics dropped feed support so it needs to be handled when fetching the feed.
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass) { function hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass) {
if ($auth_login || $auth_pass) if ($auth_login || $auth_pass)
return $feed_data; return $feed_data;
@ -144,4 +144,3 @@ class Af_Comics extends Plugin {
} }
} }
?>

View File

@ -49,4 +49,3 @@ class Af_Fsckportal extends Plugin {
} }
} }
?>

View File

@ -43,4 +43,3 @@ class Af_Lang_Detect extends Plugin {
} }
} }
?>

View File

@ -64,6 +64,8 @@ require_once __DIR__ . '/Text/LanguageDetect/ISO639.php';
* @version Release: @package_version@ * @version Release: @package_version@
* @link http://pear.php.net/package/Text_LanguageDetect/ * @link http://pear.php.net/package/Text_LanguageDetect/
* @todo allow users to generate their own language models * @todo allow users to generate their own language models
*
* @SuppressWarnings(PHPMD)
*/ */
class Text_LanguageDetect class Text_LanguageDetect
{ {
@ -1704,5 +1706,3 @@ class Text_LanguageDetect
} }
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
?>

View File

@ -25,6 +25,8 @@
* @copyright 2011 Christian Weiske <cweiske@php.net> * @copyright 2011 Christian Weiske <cweiske@php.net>
* @license http://www.debian.org/misc/bsd.license BSD * @license http://www.debian.org/misc/bsd.license BSD
* @link http://www.loc.gov/standards/iso639-2/php/code_list.php * @link http://www.loc.gov/standards/iso639-2/php/code_list.php
*
* @SuppressWarnings(PHPMD)
*/ */
class Text_LanguageDetect_ISO639 class Text_LanguageDetect_ISO639
{ {
@ -337,5 +339,3 @@ class Text_LanguageDetect_ISO639
return self::$code3ToName[$code]; return self::$code3ToName[$code];
} }
} }
?>

View File

@ -345,5 +345,3 @@ class Text_LanguageDetect_Parser extends Text_LanguageDetect
} }
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
?>

View File

@ -322,4 +322,3 @@ class Af_Psql_Trgm extends Plugin {
} }
} }
?>

View File

@ -128,6 +128,9 @@ class Af_Readability extends Plugin {
$this->host->set($this, "enabled_feeds", $enabled_feeds); $this->host->set($this, "enabled_feeds", $enabled_feeds);
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function hook_article_filter_action($article, $action) { function hook_article_filter_action($article, $action) {
return $this->process_article($article); return $this->process_article($article);
} }
@ -146,7 +149,7 @@ class Af_Readability extends Plugin {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, SELF_USER_AGENT); curl_setopt($ch, CURLOPT_USERAGENT, SELF_USER_AGENT);
@$result = curl_exec($ch); @curl_exec($ch);
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); $content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
if (strpos($content_type, "text/html") === FALSE) if (strpos($content_type, "text/html") === FALSE)
@ -243,4 +246,3 @@ class Af_Readability extends Plugin {
} }
} }
?>

View File

@ -73,6 +73,9 @@ class Af_RedditImgur extends Plugin {
echo __("Configuration saved"); echo __("Configuration saved");
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
private function inline_stuff($article, &$doc, $xpath, $debug = false) { private function inline_stuff($article, &$doc, $xpath, $debug = false) {
$entries = $xpath->query('(//a[@href]|//img[@src])'); $entries = $xpath->query('(//a[@href]|//img[@src])');
@ -442,13 +445,16 @@ class Af_RedditImgur extends Plugin {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("open_basedir")); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("open_basedir"));
curl_setopt($ch, CURLOPT_USERAGENT, $useragent); curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
@$result = curl_exec($ch); @curl_exec($ch);
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); $content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
} }
return $content_type; return $content_type;
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
private function readability($article, $url, $doc, $xpath, $debug = false) { private function readability($article, $url, $doc, $xpath, $debug = false) {
if (!defined('NO_CURL') && function_exists("curl_init") && $this->host->get($this, "enable_readability") && if (!defined('NO_CURL') && function_exists("curl_init") && $this->host->get($this, "enable_readability") &&
@ -510,4 +516,3 @@ class Af_RedditImgur extends Plugin {
return $article; return $article;
} }
} }
?>

View File

@ -80,4 +80,3 @@ class Af_Tumblr_1280 extends Plugin {
} }
} }
?>

View File

@ -82,4 +82,3 @@ class Af_Unburn extends Plugin {
} }
} }
?>

View File

@ -14,6 +14,9 @@ class Af_Youtube_Embed extends Plugin {
$host->add_hook($host::HOOK_RENDER_ENCLOSURE, $this); $host->add_hook($host::HOOK_RENDER_ENCLOSURE, $this);
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function hook_render_enclosure($entry, $hide_images) { function hook_render_enclosure($entry, $hide_images) {
$matches = array(); $matches = array();
@ -37,4 +40,3 @@ class Af_Youtube_Embed extends Plugin {
} }
} }
?>

View File

@ -80,7 +80,7 @@ class Af_Zz_ImgProxy extends Plugin {
if (function_exists("imagecreate") && !isset($_REQUEST["text"])) { if (function_exists("imagecreate") && !isset($_REQUEST["text"])) {
$img = imagecreate(450, 75); $img = imagecreate(450, 75);
$bg = imagecolorallocate($img, 255, 255, 255); /*$bg =*/ imagecolorallocate($img, 255, 255, 255);
$textcolor = imagecolorallocate($img, 255, 0, 0); $textcolor = imagecolorallocate($img, 255, 0, 0);
imagerectangle($img, 0, 0, 450-1, 75-1, $textcolor); imagerectangle($img, 0, 0, 450-1, 75-1, $textcolor);
@ -143,6 +143,9 @@ class Af_Zz_ImgProxy extends Plugin {
return $url; return $url;
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function hook_render_article_cdm($article, $api_mode = false) { function hook_render_article_cdm($article, $api_mode = false) {
$need_saving = false; $need_saving = false;

View File

@ -90,4 +90,3 @@ class Af_Zz_ImgSetSizes extends Plugin {
} }
} }
?>

View File

@ -21,4 +21,3 @@ class Af_Zz_NoAutoPlay extends Plugin {
} }
} }
?>

View File

@ -21,4 +21,3 @@ class Af_Zz_VidMute extends Plugin {
} }
} }
?>

View File

@ -34,7 +34,9 @@ class Auth_Remote extends Plugin implements IAuthModule {
return ""; return "";
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function authenticate($login, $password) { function authenticate($login, $password) {
$try_login = db_escape_string($_SERVER["REMOTE_USER"]); $try_login = db_escape_string($_SERVER["REMOTE_USER"]);
@ -43,7 +45,6 @@ class Auth_Remote extends Plugin implements IAuthModule {
if (!$try_login) $try_login = db_escape_string($_SERVER["PHP_AUTH_USER"]); if (!$try_login) $try_login = db_escape_string($_SERVER["PHP_AUTH_USER"]);
if (!$try_login) $try_login = $this->get_login_by_ssl_certificate(); if (!$try_login) $try_login = $this->get_login_by_ssl_certificate();
# if (!$try_login) $try_login = "test_qqq";
if ($try_login) { if ($try_login) {
$user_id = $this->base->auto_create_user($try_login, $password); $user_id = $this->base->auto_create_user($try_login, $password);
@ -84,5 +85,3 @@ class Auth_Remote extends Plugin implements IAuthModule {
} }
} }
?>

View File

@ -54,4 +54,3 @@ class Auto_Assign_Labels extends Plugin {
return 2; return 2;
} }
} }
?>

View File

@ -51,4 +51,3 @@ class Bookmarklets extends Plugin {
} }
} }
?>

View File

@ -11,10 +11,16 @@ class Cache_Starred_Images extends Plugin implements IHandler {
true); true);
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function csrf_ignore($method) { function csrf_ignore($method) {
return false; return false;
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function before($method) { function before($method) {
return true; return true;
} }
@ -88,6 +94,9 @@ class Cache_Starred_Images extends Plugin implements IHandler {
} }
} }
/**
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
function hook_house_keeping() { function hook_house_keeping() {
$files = glob($this->cache_dir . "/*.{png,mp4}", GLOB_BRACE); $files = glob($this->cache_dir . "/*.{png,mp4}", GLOB_BRACE);
@ -112,6 +121,9 @@ class Cache_Starred_Images extends Plugin implements IHandler {
} }
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes, $article_id) { function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes, $article_id) {
$xpath = new DOMXpath($doc); $xpath = new DOMXpath($doc);
@ -162,6 +174,9 @@ class Cache_Starred_Images extends Plugin implements IHandler {
} }
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function cache_article_images($content, $site_url, $owner_uid, $article_id) { function cache_article_images($content, $site_url, $owner_uid, $article_id) {
libxml_use_internal_errors(true); libxml_use_internal_errors(true);
@ -211,4 +226,3 @@ class Cache_Starred_Images extends Plugin implements IHandler {
return 2; return 2;
} }
} }
?>

View File

@ -14,6 +14,9 @@ class Close_Button extends Plugin {
"fox"); "fox");
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function hook_article_button($line) { function hook_article_button($line) {
if (!get_pref("COMBINED_DISPLAY_MODE")) { if (!get_pref("COMBINED_DISPLAY_MODE")) {
$rv = "<img src=\"plugins/close_button/button.png\" $rv = "<img src=\"plugins/close_button/button.png\"
@ -30,4 +33,3 @@ class Close_Button extends Plugin {
} }
} }
?>

View File

@ -55,4 +55,3 @@ class Embed_Original extends Plugin {
} }
} }
?>

View File

@ -38,4 +38,3 @@ class GoogleReaderKeys extends Plugin {
} }
} }
?>

View File

@ -91,6 +91,9 @@ class Import_Export extends Plugin implements IHandler {
return in_array($method, array("exportget")); return in_array($method, array("exportget"));
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function before($method) { function before($method) {
return $_SESSION["uid"] != false; return $_SESSION["uid"] != false;
} }
@ -99,6 +102,9 @@ class Import_Export extends Plugin implements IHandler {
return true; return true;
} }
/**
* @SuppressWarnings(unused)
*/
function exportget() { function exportget() {
$exportname = CACHE_DIR . "/export/" . $exportname = CACHE_DIR . "/export/" .
sha1($_SESSION['uid'] . $_SESSION['login']) . ".xml"; sha1($_SESSION['uid'] . $_SESSION['login']) . ".xml";
@ -469,4 +475,3 @@ class Import_Export extends Plugin implements IHandler {
} }
} }
?>

View File

@ -25,6 +25,9 @@ class Instances extends Plugin implements IHandler {
$host->add_hook($host::HOOK_UPDATE_TASK, $this); $host->add_hook($host::HOOK_UPDATE_TASK, $this);
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function hook_update_task($args) { function hook_update_task($args) {
_debug("Get linked feeds..."); _debug("Get linked feeds...");
$this->get_linked_feeds(); $this->get_linked_feeds();
@ -134,6 +137,9 @@ class Instances extends Plugin implements IHandler {
return file_get_contents(dirname(__FILE__) . "/instances.js"); return file_get_contents(dirname(__FILE__) . "/instances.js");
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function hook_prefs_tabs($args) { function hook_prefs_tabs($args) {
if ($_SESSION["access_level"] >= 10 || SINGLE_USER_MODE) { if ($_SESSION["access_level"] >= 10 || SINGLE_USER_MODE) {
?><div id="instanceConfigTab" dojoType="dijit.layout.ContentPane" ?><div id="instanceConfigTab" dojoType="dijit.layout.ContentPane"
@ -148,6 +154,9 @@ class Instances extends Plugin implements IHandler {
return array_search($method, $csrf_ignored) !== false; return array_search($method, $csrf_ignored) !== false;
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function before($method) { function before($method) {
if ($_SESSION["uid"]) { if ($_SESSION["uid"]) {
if ($_SESSION["access_level"] < 10) { if ($_SESSION["access_level"] < 10) {
@ -171,7 +180,7 @@ class Instances extends Plugin implements IHandler {
} }
function add() { function add() {
$id = db_escape_string($_REQUEST["id"]); //$id = db_escape_string($_REQUEST["id"]);
$access_url = db_escape_string($_REQUEST["access_url"]); $access_url = db_escape_string($_REQUEST["access_url"]);
$access_key = db_escape_string($_REQUEST["access_key"]); $access_key = db_escape_string($_REQUEST["access_key"]);
@ -449,4 +458,3 @@ class Instances extends Plugin implements IHandler {
} }
} }
?>

View File

@ -225,4 +225,3 @@ class Mail extends Plugin {
} }
} }
?>

View File

@ -32,12 +32,11 @@ class MailTo extends Plugin {
require_once "lib/MiniTemplator.class.php"; require_once "lib/MiniTemplator.class.php";
$tpl = new MiniTemplator; $tpl = new MiniTemplator;
$tpl_t = new MiniTemplator;
$tpl->readTemplateFromFile("templates/email_article_template.txt"); $tpl->readTemplateFromFile("templates/email_article_template.txt");
$tpl->setVariable('USER_NAME', $_SESSION["name"], true); $tpl->setVariable('USER_NAME', $_SESSION["name"], true);
$tpl->setVariable('USER_EMAIL', $user_email, true); //$tpl->setVariable('USER_EMAIL', $user_email, true);
$tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true); $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
@ -91,4 +90,3 @@ class MailTo extends Plugin {
} }
} }
?>

View File

@ -40,4 +40,3 @@ class Mark_Button extends Plugin {
} }
} }
?>

View File

@ -14,6 +14,9 @@ class No_Iframes extends Plugin {
$host->add_hook($host::HOOK_SANITIZE, $this); $host->add_hook($host::HOOK_SANITIZE, $this);
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes) { function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes) {
$xpath = new DOMXpath($doc); $xpath = new DOMXpath($doc);
@ -32,4 +35,3 @@ class No_Iframes extends Plugin {
} }
} }
?>

View File

@ -22,4 +22,3 @@ class No_Title_Counters extends Plugin {
} }
} }
?>

View File

@ -22,4 +22,3 @@ class No_URL_Hashes extends Plugin {
} }
} }
?>

View File

@ -73,4 +73,3 @@ class Note extends Plugin {
} }
} }
?>

View File

@ -105,4 +105,3 @@ class NSFW extends Plugin {
} }
} }
?>

View File

@ -62,4 +62,3 @@ class Search_Sphinx extends Plugin {
return 2; return 2;
} }
} }
?>

View File

@ -973,6 +973,10 @@ class SphinxClient
return pack ( "N", $t2 ); return pack ( "N", $t2 );
} }
/**
* @SuppressWarnings(unused)
*/
/// add query to multi-query batch /// add query to multi-query batch
/// returns index into results array from RunQueries() call /// returns index into results array from RunQueries() call
function AddQuery ( $query, $index="*", $comment="" ) function AddQuery ( $query, $index="*", $comment="" )

View File

@ -78,7 +78,7 @@ class Share extends Plugin {
function shareArticle() { function shareArticle() {
$param = db_escape_string($_REQUEST['param']); $param = db_escape_string($_REQUEST['param']);
$result = db_query("SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '$param' $result = db_query("SELECT uuid FROM ttrss_user_entries WHERE int_id = '$param'
AND owner_uid = " . $_SESSION['uid']); AND owner_uid = " . $_SESSION['uid']);
if (db_num_rows($result) == 0) { if (db_num_rows($result) == 0) {
@ -86,7 +86,6 @@ class Share extends Plugin {
} else { } else {
$uuid = db_fetch_result($result, 0, "uuid"); $uuid = db_fetch_result($result, 0, "uuid");
$ref_id = db_fetch_result($result, 0, "ref_id");
if (!$uuid) { if (!$uuid) {
$uuid = db_escape_string(uniqid_short()); $uuid = db_escape_string(uniqid_short());
@ -128,4 +127,3 @@ class Share extends Plugin {
} }
} }
?>

View File

@ -26,4 +26,3 @@ class Shorten_Expanded extends Plugin {
} }
} }
?>

View File

@ -28,4 +28,3 @@ class Swap_JK extends Plugin {
} }
} }
?>

View File

@ -20,12 +20,18 @@ class VF_Shared extends Plugin {
return 2; return 2;
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function get_unread($feed_id) { function get_unread($feed_id) {
$result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and unread = true and uuid != ''"); $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and unread = true and uuid != ''");
return db_fetch_result($result, 0, "count"); return db_fetch_result($result, 0, "count");
} }
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function get_total($feed_id) { function get_total($feed_id) {
$result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and uuid != ''"); $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and uuid != ''");
@ -34,6 +40,9 @@ class VF_Shared extends Plugin {
//function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false) { //function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false) {
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function get_headlines($feed_id, $options) { function get_headlines($feed_id, $options) {
/*$qfh_ret = queryFeedHeadlines(-4, /*$qfh_ret = queryFeedHeadlines(-4,
$options['limit'], $options['limit'],
@ -72,4 +81,3 @@ class VF_Shared extends Plugin {
} }
} }
?>

View File

@ -1,3 +1,5 @@
#!/bin/sh -e #!/bin/sh
set -e
exec find . -name "*.php" -not -path "*/lib/*" -print0 | xargs -0 -n1 php -l exec find . -name "*.php" -not -path "*/lib/*" -print0 | xargs -0 -n1 php -l

View File

@ -9,6 +9,11 @@
<!-- phpmd author is a bit weird i guess --> <!-- phpmd author is a bit weird i guess -->
<!-- <rule ref="rulesets/cleancode.xml">
<exclude name="BooleanArgumentFlag" />
<exclude name="ElseExpression" />
</rule> -->
<rule ref="rulesets/unusedcode.xml" /> <rule ref="rulesets/unusedcode.xml" />
</ruleset> </ruleset>

View File

@ -1,7 +1,8 @@
#!/bin/sh -i -e #!/bin/sh
phpmd include,classes text utils/gitlab-ci/phpmd-ruleset.xml set -e
phpmd include,classes,plugins text utils/gitlab-ci/phpmd-ruleset.xml
FILES=$(ls -dm *.php | tr -d " "| tr -d "\n") FILES=$(ls -dm *.php | tr -d " "| tr -d "\n")
phpmd $FILES text utils/gitlab-ci/phpmd-ruleset.xml phpmd $FILES text utils/gitlab-ci/phpmd-ruleset.xml