summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rwxr-xr-xclasses/api.php2
-rwxr-xr-xclasses/article.php23
-rw-r--r--classes/digest.php9
-rwxr-xr-xclasses/feeds.php6
-rwxr-xr-xclasses/handler/public.php10
-rwxr-xr-xclasses/pluginhost.php7
-rw-r--r--classes/pref/prefs.php58
7 files changed, 49 insertions, 66 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/article.php b/classes/article.php
index dd1470caa..acd83694c 100755
--- a/classes/article.php
+++ b/classes/article.php
@@ -343,6 +343,7 @@ class Article extends Handler_Protected {
}
$rv = [
+ 'formatted' => '',
'entries' => []
];
@@ -358,12 +359,24 @@ class Article extends Handler_Protected {
// this is highly approximate
$enc["filename"] = basename($enc["content_url"]);
- PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_ENCLOSURE_ENTRY,
- function ($result) use (&$enc) {
- $enc = $result;
+ $rendered_enc = "";
+ PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ENCLOSURE,
+ function ($result) use (&$rendered_enc) {
+ $rendered_enc = $result;
},
- $enc, $id);
- array_push($rv['entries'], $enc);
+ $enc, $id, $rv);
+
+ if ($rendered_enc) {
+ $rv['formatted'] .= $rendered_enc;
+ } else {
+ PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_ENCLOSURE_ENTRY,
+ function ($result) use (&$enc) {
+ $enc = $result;
+ },
+ $enc, $id, $rv);
+
+ array_push($rv['entries'], $enc);
+ }
}
return $rv;
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 d50c5a706..5121c8491 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -51,11 +51,11 @@ class PluginHost {
const HOOK_FORMAT_ENCLOSURES = "hook_format_enclosures"; // hook__format_enclosures($rv, $result, $id, $always_display_enclosures, $article_content, $hide_images) (byref)
const HOOK_SUBSCRIBE_FEED = "hook_subscribe_feed"; // hook_subscribe_feed($contents, $url, $auth_login, $auth_pass) (byref)
const HOOK_HEADLINES_BEFORE = "hook_headlines_before"; // hook_headlines_before($feed, $is_cat, $qfh_ret)
- const HOOK_RENDER_ENCLOSURE = "hook_render_enclosure"; // hook_render_enclosure($entry, $hide_images)
+ const HOOK_RENDER_ENCLOSURE = "hook_render_enclosure"; // hook_render_enclosure($entry, $id, $rv)
const HOOK_ARTICLE_FILTER_ACTION = "hook_article_filter_action"; // hook_article_filter_action($article, $action)
const HOOK_ARTICLE_EXPORT_FEED = "hook_article_export_feed"; // hook_article_export_feed($line, $feed, $is_cat, $owner_uid) (byref)
const HOOK_MAIN_TOOLBAR_BUTTON = "hook_main_toolbar_button"; // hook_main_toolbar_button()
- const HOOK_ENCLOSURE_ENTRY = "hook_enclosure_entry"; // hook_enclosure_entry($row, $id) (byref)
+ const HOOK_ENCLOSURE_ENTRY = "hook_enclosure_entry"; // hook_enclosure_entry($entry, $id, $rv) (byref)
const HOOK_FORMAT_ARTICLE = "hook_format_article"; // hook_format_article($html, $row)
const HOOK_FORMAT_ARTICLE_CDM = "hook_format_article_cdm"; /* RIP */
const HOOK_FEED_BASIC_INFO = "hook_feed_basic_info"; // hook_feed_basic_info($basic_info, $fetch_url, $owner_uid, $feed_id, $auth_login, $auth_pass) (byref)
@@ -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 2ea2e9f01..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'>
@@ -712,59 +705,50 @@ class Pref_Prefs extends Handler_Protected {
array_push($listed_boolean_prefs, $pref_name);
- $is_checked = ($value == "true") ? "checked=\"checked\"" : "";
-
if ($pref_name == "PURGE_UNREAD_ARTICLES" && FORCE_ARTICLE_PURGE != 0) {
- $is_disabled = "disabled=\"1\"";
- $is_checked = "checked=\"checked\"";
+ $is_disabled = true;
+ $is_checked = true;
} else {
- $is_disabled = "";
+ $is_disabled = false;
+ $is_checked = ($value == "true");
}
- print "<input type='checkbox' name='$pref_name' $is_checked $is_disabled
- dojoType='dijit.form.CheckBox' id='CB_$pref_name' value='1'>";
+ print \Controls\checkbox_tag($pref_name, $is_checked, "true",
+ ["disabled" => $is_disabled], "CB_$pref_name");
} else if (in_array($pref_name, ['FRESH_ARTICLE_MAX_AGE',
'PURGE_OLD_DAYS', 'LONG_DATE_FORMAT', 'SHORT_DATE_FORMAT'])) {
- $regexp = ($type_name == 'integer') ? 'regexp="^\d*$"' : '';
-
if ($pref_name == "PURGE_OLD_DAYS" && FORCE_ARTICLE_PURGE != 0) {
- $is_disabled = "disabled='1'";
+ $attributes = ["disabled" => true, "required" => true];
$value = FORCE_ARTICLE_PURGE;
} else {
- $is_disabled = "";
+ $attributes = ["required" => true];
}
if ($type_name == 'integer')
- print "<input dojoType=\"dijit.form.NumberSpinner\"
- required='1' $is_disabled
- name=\"$pref_name\" value=\"$value\">";
+ print \Controls\number_spinner_tag($pref_name, $value, $attributes);
else
- print "<input dojoType=\"dijit.form.TextBox\"
- required='1' $regexp $is_disabled
- name=\"$pref_name\" value=\"$value\">";
+ print \Controls\input_tag($pref_name, $value, "text", $attributes);
} else if ($pref_name == "SSL_CERT_SERIAL") {
- print "<input dojoType='dijit.form.ValidationTextBox'
- id='SSL_CERT_SERIAL' readonly='1'
- name=\"$pref_name\" value=\"$value\">";
+ print \Controls\input_tag($pref_name, $value, "text", ["readonly" => true], "SSL_CERT_SERIAL");
$cert_serial = htmlspecialchars(get_ssl_certificate_id());
- $has_serial = ($cert_serial) ? "false" : "true";
+ $has_serial = ($cert_serial) ? true : false;
- print "<button dojoType='dijit.form.Button' disabled='$has_serial'
- onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '$cert_serial')\">" .
- __('Register') . "</button>";
+ print \Controls\button_tag(__('Register'), "", [
+ "disabled" => !$has_serial,
+ "onclick" => "dijit.byId('SSL_CERT_SERIAL').attr('value', '$cert_serial')"]);
- print "<button dojoType='dijit.form.Button' class='alt-danger'
- onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '')\">" .
- __('Clear') . "</button>";
+ print \Controls\button_tag(__('Clear'), "", [
+ "class" => "alt-danger",
+ "onclick" => "dijit.byId('SSL_CERT_SERIAL').attr('value', '')"]);
- print "<button dojoType='dijit.form.Button' class='alt-info'
- onclick='window.open(\"https://tt-rss.org/wiki/SSL%20Certificate%20Authentication\")'>
- <i class='material-icons'>help</i> ".__("More info...")."</button>";
+ print \Controls\button_tag(\Controls\icon("help") . " " . __("More info..."), "", [
+ "class" => "alt-info",
+ "onclick" => "window.open('https://tt-rss.org/wiki/SSL%20Certificate%20Authentication')"]);
} else if ($pref_name == 'DIGEST_PREFERRED_TIME') {
print "<input dojoType=\"dijit.form.ValidationTextBox\"