summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-22 14:41:09 +0300
committerAndrew Dolgov <[email protected]>2021-02-22 14:41:09 +0300
commitbe4e7b13403666fc477d4b563ea8c075d0fd2022 (patch)
tree38eee4a6d7a5f0c4ecc3b37f997c385559c1d2a8 /classes
parent043ef3dad68f774598e1b172ecb0f5ea75f112af (diff)
fix several issues reported by phpstan
Diffstat (limited to 'classes')
-rwxr-xr-xclasses/api.php2
-rw-r--r--classes/digest.php9
-rwxr-xr-xclasses/feeds.php6
-rwxr-xr-xclasses/handler/public.php10
-rwxr-xr-xclasses/pluginhost.php3
-rw-r--r--classes/pref/prefs.php7
6 files changed, 8 insertions, 29 deletions
diff --git a/classes/api.php b/classes/api.php
index 03eea1927..5677cb908 100755
--- a/classes/api.php
+++ b/classes/api.php
@@ -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);
diff --git a/classes/digest.php b/classes/digest.php
index 77eb92c54..e0c23d705 100644
--- a/classes/digest.php
+++ b/classes/digest.php
@@ -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);
}
-
}
diff --git a/classes/feeds.php b/classes/feeds.php
index 63b84edae..b59504c03 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -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";
diff --git a/classes/handler/public.php b/classes/handler/public.php
index b0ce2306d..3910cf7c1 100755
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -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();
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index a05938111..5121c8491 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -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 {
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index a26281fee..adb249dac 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -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'>