1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-01-17 03:09:15 +00:00

fix several issues reported by phpstan

This commit is contained in:
Andrew Dolgov
2021-02-22 14:41:09 +03:00
parent 043ef3dad6
commit be4e7b1340
16 changed files with 35 additions and 54 deletions

View File

@@ -292,7 +292,7 @@ class API extends Handler {
$sanitize_content = !isset($_REQUEST["sanitize"]) ||
self::_param_to_bool($_REQUEST["sanitize"]);
if ($article_ids) {
if (count($article_ids) > 0) {
$article_qmarks = arr_qmarks($article_ids);

View File

@@ -1,12 +1,6 @@
<?php
class Digest
{
/**
* Send by mail a digest of last articles.
*
* @return boolean Return false if digests are not enabled.
*/
static function send_headlines_digests() {
$user_limit = 15; // amount of users to process (e.g. emails to send out)
@@ -81,9 +75,7 @@ class Digest
}
}
}
Debug::log("All done.");
}
static function prepare_headlines_digest($user_id, $days = 1, $limit = 1000) {
@@ -210,5 +202,4 @@ class Digest
return array($tmp, $headlines_count, $affected_ids, $tmp_t);
}
}

View File

@@ -1067,22 +1067,16 @@ class Feeds extends Handler_Protected {
switch ($id) {
case 0:
return "archive";
break;
case -1:
return "star";
break;
case -2:
return "rss_feed";
break;
case -3:
return "whatshot";
break;
case -4:
return "inbox";
break;
case -6:
return "restore";
break;
default:
if ($id < LABEL_BASE_INDEX) {
return "label";

View File

@@ -146,9 +146,9 @@ class Handler_Public extends Handler {
$tpl->addBlock('enclosure');
}
} else {
$tpl->setVariable('ARTICLE_ENCLOSURE_URL', null, true);
$tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', null, true);
$tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', null, true);
$tpl->setVariable('ARTICLE_ENCLOSURE_URL', "", true);
$tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', "", true);
$tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', "", true);
}
list ($og_image, $og_stream) = Article::_get_image($enclosures, $line['content'], $feed_site_url);
@@ -207,8 +207,8 @@ class Handler_Public extends Handler {
$article['content'] = Sanitizer::sanitize($line["content"], false, $owner_uid, $feed_site_url, false, $line["id"]);
$article['updated'] = date('c', strtotime($line["updated"]));
if ($line['note']) $article['note'] = $line['note'];
if ($article['author']) $article['author'] = $line['author'];
if (!empty($line['note'])) $article['note'] = $line['note'];
if (!empty($line['author'])) $article['author'] = $line['author'];
if (count($line["tags"]) > 0) {
$article['tags'] = array();

View File

@@ -108,8 +108,9 @@ class PluginHost {
return false;
}
// needed for compatibility with API 2 (?)
function get_dbh() {
return Db::get();
return false;
}
function get_pdo(): PDO {

View File

@@ -311,13 +311,6 @@ class Pref_Prefs extends Handler_Protected {
<input dojoType='dijit.form.ValidationTextBox' name='email' required='1' value="<?= $email ?>">
</fieldset>
<?php if (!SINGLE_USER_MODE && !empty($_SESSION["hide_hello"])) { ?>
<fieldset>
<label><?= __('Access level:') ?></label>
<?= $access_level_names[$row["access_level"]] ?>
</fieldset>
<?php } ?>
<hr/>
<button dojoType='dijit.form.Button' type='submit' class='alt-primary'>