From f3f49cf80f2441d576d825f116afdb5a66bb7c54 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 2 Feb 2021 10:58:10 +0100 Subject: fix php8 issues --- Zotlabs/Lib/Apps.php | 2 +- Zotlabs/Web/HTTPSig.php | 10 ++++++---- include/markdown.php | 9 ++++++--- include/permissions.php | 2 +- include/plugin.php | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 05b2ba177..d77a3fda2 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -307,7 +307,7 @@ class Apps { } } } - if($ret) { + if(isset($ret)) { if($translate) self::translate_system_apps($ret); diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php index 0b3e2bf2e..7c3903682 100644 --- a/Zotlabs/Web/HTTPSig.php +++ b/Zotlabs/Web/HTTPSig.php @@ -161,6 +161,8 @@ class HTTPSig { logger('verified: ' . $x, LOGGER_DEBUG); + $fetched_key = ''; + if(! $x) { // try again, ignoring the local actor (xchan) cache and refetching the key @@ -244,7 +246,7 @@ class HTTPSig { } - function convertKey($key) { + static function convertKey($key) { if(strstr($key,'RSA ')) { return rsatopem($key); @@ -267,7 +269,7 @@ class HTTPSig { * false if no pub key found, otherwise return the pub key */ - function get_activitystreams_key($id) { + static function get_activitystreams_key($id) { // remove fragment @@ -298,7 +300,7 @@ class HTTPSig { } - function get_webfinger_key($id) { + static function get_webfinger_key($id) { $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s'", dbesc(str_replace('acct:','',$id)), @@ -333,7 +335,7 @@ class HTTPSig { return (($key['public_key']) ? $key : false); } - function get_zotfinger_key($id) { + static function get_zotfinger_key($id) { $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' and hubloc_network = 'zot6'", dbesc(str_replace('acct:','',$id)), diff --git a/include/markdown.php b/include/markdown.php index 0bfe595b8..013d57c29 100644 --- a/include/markdown.php +++ b/include/markdown.php @@ -213,6 +213,11 @@ function bb_to_markdown_share($match) { } +function bb_to_markdown_transform_tags($match) { + return '#'. str_replace(' ', '_', $match[3]); +} + + /** * @brief Convert bbcode to Markdown. * @@ -226,8 +231,7 @@ function bb_to_markdown($Text, $options = []) { * Transform #tags, strip off the [url] and replace spaces with underscore */ - $Text = preg_replace_callback('/#\[([zu])rl\=(.*?)\](.*?)\[\/[(zu)]rl\]/i', - create_function('$match', 'return \'#\'. str_replace(\' \', \'_\', $match[3]);'), $Text); + $Text = preg_replace_callback('/#\[([zu])rl\=(.*?)\](.*?)\[\/[(zu)]rl\]/i', 'bb_to_markdown_transform_tags', $Text); $Text = preg_replace('/#\^\[([zu])rl\=(.*?)\](.*?)\[\/([zu])rl\]/i', '[$1rl=$2]$3[/$4rl]', $Text); @@ -282,7 +286,6 @@ function bb_to_markdown($Text, $options = []) { return $Text; } - /** * @brief Convert a HTML text into Markdown. * diff --git a/include/permissions.php b/include/permissions.php index ca8ff6e93..c7eee11f4 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -279,7 +279,7 @@ function perm_is_allowed($uid, $observer_xchan, $permission, $check_siteblock = // First find out what the channel owner declared permissions to be. - $channel_perm = \Zotlabs\Access\PermissionLimits::Get($uid,$permission); + $channel_perm = intval(\Zotlabs\Access\PermissionLimits::Get($uid,$permission)); $r = q("select channel_pageflags, channel_moved, channel_hash from channel where channel_id = %d limit 1", intval($uid) diff --git a/include/plugin.php b/include/plugin.php index c789ad522..269903373 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -912,7 +912,7 @@ function script_path() { // Some proxy setups may require using http_host - if(intval(App::$config['system']['script_path_use_http_host'])) + if(isset(App::$config['system']['script_path_use_http_host']) && intval(App::$config['system']['script_path_use_http_host'])) $server_var = 'HTTP_HOST'; else $server_var = 'SERVER_NAME'; -- cgit v1.2.3