From cfdbf02e6b4901850287d096b97fb38dbf5779d9 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 20 Nov 2023 21:52:40 +0000 Subject: the additional parameter has been deprecated there is no need to check the version anymore --- include/plugin.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/plugin.php b/include/plugin.php index 1a253d38f..eb761dc37 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -482,9 +482,13 @@ function call_hooks($name, &$data = null) { } $data = $checkhook['data']; } + $origfn = $hook[1]; - if($hook[0]) + + if($hook[0]) { @include_once($hook[0]); + } + if(preg_match('|^a:[0-9]+:{.*}$|s', $hook[1])) { $hook[1] = unserialize($hook[1]); } @@ -496,13 +500,12 @@ function call_hooks($name, &$data = null) { $hook[1] = explode('::',$hook[1]); } + if(is_callable($hook[1])) { $func = $hook[1]; - if($hook[3]) - $func($data); + $func($data); } else { - // Don't do any DB write calls if we're currently logging a possibly failed DB call. if(! DBA::$logging) { // The hook should be removed so we don't process it. -- cgit v1.2.3 From 33cb429e151766ec6cee7d050def380c487d88e0 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 20 Nov 2023 21:56:31 +0000 Subject: remove unused variable --- include/plugin.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/plugin.php b/include/plugin.php index eb761dc37..f1d501001 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -459,8 +459,6 @@ function insert_hook($hook, $fn, $version = 0, $priority = 0) { * @param[in,out] string|array &$data to transmit to the callback handler */ function call_hooks($name, &$data = null) { - $a = 0; - if (isset(App::$hooks[$name])) { foreach(App::$hooks[$name] as $hook) { -- cgit v1.2.3 From 1f18fed3a26fb1b88efb83ab1b0ce2b19ea433f4 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 21 Nov 2023 08:01:03 +0000 Subject: add additional observer and channel info to nav if applicable --- include/nav.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/include/nav.php b/include/nav.php index 737beaca2..9c67ade1f 100644 --- a/include/nav.php +++ b/include/nav.php @@ -21,7 +21,7 @@ function nav($template = 'default') { $is_owner = (((local_channel()) && ((App::$profile_uid == local_channel()) || (App::$profile_uid == 0))) ? true : false); $observer = App::get_observer(); $chans = []; - + $channel = []; if (local_channel()) { $channel = App::get_channel(); @@ -84,11 +84,23 @@ function nav($template = 'default') { $userinfo = []; if ($observer) { - $userinfo = [ - 'icon' => $observer['xchan_photo_s'] . '?rev=' . strtotime($observer['xchan_photo_date']), - 'addr' => $observer['xchan_addr'], - 'name' => $observer['xchan_name'], - ]; + $userinfo['icon'] = $observer['xchan_photo_s'] . '?rev=' . strtotime($observer['xchan_photo_date']); + $userinfo['icon_m'] = $observer['xchan_photo_m'] . '?rev=' . strtotime($observer['xchan_photo_date']); + $userinfo['icon_l'] = $observer['xchan_photo_l'] . '?rev=' . strtotime($observer['xchan_photo_date']); + $userinfo['icon_mime_type'] = $observer['xchan_photo_mimetype']; + $userinfo['addr'] = $observer['xchan_addr']; + $userinfo['url'] = $observer['xchan_url']; + $userinfo['forum'] = $observer['xchan_pubforum']; + $userinfo['name'] = $observer['xchan_name']; + } + + if ($channel) { + $userinfo['follow'] = sprintf($channel['xchan_follow'], urlencode(channel_reddress($channel))); + $userinfo['id'] = $channel['channel_id']; + $userinfo['nick'] = $channel['channel_address']; + $userinfo['location'] = $channel['channel_location']; + $userinfo['theme'] = $channel['channel_theme']; + $userinfo['timezone'] = $channel['channel_timezone']; } elseif (empty($_SESSION['authenticated'])) { -- cgit v1.2.3 From 1cfa81450cf0ce5691cdbade0a7ab4dfd76ea483 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 21 Nov 2023 08:07:40 +0000 Subject: remove follow (does not make any sense to add follow link of the logged in channel), add startpage --- include/nav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nav.php b/include/nav.php index 9c67ade1f..e4df7e4e5 100644 --- a/include/nav.php +++ b/include/nav.php @@ -95,12 +95,12 @@ function nav($template = 'default') { } if ($channel) { - $userinfo['follow'] = sprintf($channel['xchan_follow'], urlencode(channel_reddress($channel))); $userinfo['id'] = $channel['channel_id']; $userinfo['nick'] = $channel['channel_address']; $userinfo['location'] = $channel['channel_location']; $userinfo['theme'] = $channel['channel_theme']; $userinfo['timezone'] = $channel['channel_timezone']; + $userinfo['startpage'] = $channel['channel_startpage']; } elseif (empty($_SESSION['authenticated'])) { -- cgit v1.2.3