From ed74c43f18998d6e3469203dd71109d519fd4f2e Mon Sep 17 00:00:00 2001 From: wn_ Date: Tue, 14 Dec 2021 12:06:32 +0000 Subject: Handle the admin user not having any entries in 'Feeds::_get_global_unread'. --- classes/feeds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes/feeds.php') diff --git a/classes/feeds.php b/classes/feeds.php index a9afb70f2..3c0578782 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -1359,7 +1359,7 @@ class Feeds extends Handler_Protected { $sth->execute([$user_id]); $row = $sth->fetch(); - return $row["count"]; + return $row["count"] ?? 0; } static function _get_cat_title(int $cat_id): string { -- cgit v1.2.3 From ddc81b2c8979904bd042efd0412d93fb7c821903 Mon Sep 17 00:00:00 2001 From: wn_ Date: Tue, 14 Dec 2021 12:47:25 +0000 Subject: Add a note on why ed74c43f18 was needed. --- classes/feeds.php | 1 + 1 file changed, 1 insertion(+) (limited to 'classes/feeds.php') diff --git a/classes/feeds.php b/classes/feeds.php index 3c0578782..2a4fe4993 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -1359,6 +1359,7 @@ class Feeds extends Handler_Protected { $sth->execute([$user_id]); $row = $sth->fetch(); + // Handle 'SUM()' returning null if there are no articles/results (e.g. admin user with no feeds) return $row["count"] ?? 0; } -- cgit v1.2.3 From 0726a9d820855f96dccf873e6279f74479800efb Mon Sep 17 00:00:00 2001 From: wn_ Date: Tue, 14 Dec 2021 12:50:53 +0000 Subject: Handle another potential 'SUM()' null situation in Feeds. --- classes/feeds.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'classes/feeds.php') diff --git a/classes/feeds.php b/classes/feeds.php index 2a4fe4993..62fd6a5b3 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -955,7 +955,8 @@ class Feeds extends Handler_Protected { $sth->execute([$owner_uid, $feed]); $row = $sth->fetch(); - return $row["count"]; + // Handle 'SUM()' returning null if there are no results + return $row["count"] ?? 0; } else if ($n_feed == -1) { $match_part = "marked = true"; -- cgit v1.2.3 From 720b31879634f21ea7db85f49d6f07ec7d7344bc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 14 Dec 2021 21:53:45 +0300 Subject: * fox.form.Select: add several properties allowing it to better imitate other controls like DropDownButton, etc. * rework several main toolbar items to use fox.form.Select instead of other controls * replace HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM with HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2 because of markup change (option instead of menuitem) * PluginHost: add some explicit typecasts to make intellephense shut up --- classes/feeds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes/feeds.php') diff --git a/classes/feeds.php b/classes/feeds.php index 62fd6a5b3..503108e41 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -133,7 +133,7 @@ class Feeds extends Handler_Protected { $reply['vfeed_group_enabled'] = $vfeed_group_enabled; $plugin_menu_items = ""; - PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM, + PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2, function ($result) use (&$plugin_menu_items) { $plugin_menu_items .= $result; }, -- cgit v1.2.3 From 6971ca08b24dfb6d96568a3f20d211240bbab59c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 23 Dec 2021 17:32:27 +0300 Subject: remove deprecated LOG_ constants --- classes/feeds.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'classes/feeds.php') diff --git a/classes/feeds.php b/classes/feeds.php index 503108e41..65027cb9e 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -718,7 +718,7 @@ class Feeds extends Handler_Protected {
@@ -2134,7 +2134,7 @@ class Feeds extends Handler_Protected { $owner_uid = $row["owner_uid"]; if (Config::get(Config::FORCE_ARTICLE_PURGE) != 0) { - Debug::log("purge_feed: FORCE_ARTICLE_PURGE is set, overriding interval to " . Config::get(Config::FORCE_ARTICLE_PURGE), Debug::$LOG_VERBOSE); + Debug::log("purge_feed: FORCE_ARTICLE_PURGE is set, overriding interval to " . Config::get(Config::FORCE_ARTICLE_PURGE), Debug::LOG_VERBOSE); $purge_unread = true; $purge_interval = Config::get(Config::FORCE_ARTICLE_PURGE); } else { @@ -2143,10 +2143,10 @@ class Feeds extends Handler_Protected { $purge_interval = (int) $purge_interval; - Debug::log("purge_feed: interval $purge_interval days for feed $feed_id, owner: $owner_uid, purge unread: $purge_unread", Debug::$LOG_VERBOSE); + Debug::log("purge_feed: interval $purge_interval days for feed $feed_id, owner: $owner_uid, purge unread: $purge_unread", Debug::LOG_VERBOSE); if ($purge_interval <= 0) { - Debug::log("purge_feed: purging disabled for this feed, nothing to do.", Debug::$LOG_VERBOSE); + Debug::log("purge_feed: purging disabled for this feed, nothing to do.", Debug::LOG_VERBOSE); return null; } @@ -2179,10 +2179,10 @@ class Feeds extends Handler_Protected { $rows_deleted = $sth->rowCount(); - Debug::log("purge_feed: deleted $rows_deleted articles.", Debug::$LOG_VERBOSE); + Debug::log("purge_feed: deleted $rows_deleted articles.", Debug::LOG_VERBOSE); } else { - Debug::log("purge_feed: owner of $feed_id not found", Debug::$LOG_VERBOSE); + Debug::log("purge_feed: owner of $feed_id not found", Debug::LOG_VERBOSE); } return $rows_deleted; -- cgit v1.2.3 From c3482fbe6b22885f5619df02387de09be0886cfe Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 6 Jan 2022 10:37:03 +0300 Subject: generate a warning if plugin-generated content of HOOK_ARTICLE_BUTTON or _LEFT_BUTTON can't be parsed as valid XML --- classes/feeds.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'classes/feeds.php') diff --git a/classes/feeds.php b/classes/feeds.php index 65027cb9e..2c37d659a 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -254,6 +254,10 @@ class Feeds extends Handler_Protected { $line["buttons_left"] .= $button_doc->saveXML($button_doc->firstChild); } + } else if ($result) { + user_error(get_class($plugin) . + " plugin: content provided in HOOK_ARTICLE_LEFT_BUTTON is not valid XML: " . + Errors::libxml_last_error() . " $result", E_USER_WARNING); } }, $line); @@ -273,6 +277,10 @@ class Feeds extends Handler_Protected { $line["buttons"] .= $button_doc->saveXML($button_doc->firstChild); } + } else if ($result) { + user_error(get_class($plugin) . + " plugin: content provided in HOOK_ARTICLE_BUTTON is not valid XML: " . + Errors::libxml_last_error() . " $result", E_USER_WARNING); } }, $line); -- cgit v1.2.3