From 08c9152abdfa90da09931bdcc6e6c81ea243434c Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 1 Feb 2021 22:58:55 +0000 Subject: fix getting mimetype via getimagesize() and do not default to image/jpeg yet if it could not be found --- include/photo/photo_driver.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 97871e139..87b1d96fe 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -69,7 +69,7 @@ function photo_factory($data, $type = null) { * @return null|string Guessed mimetype */ function guess_image_type($filename, $data = '') { - + if($data) $headers = (is_array($data) ? $data['header'] : $data); @@ -135,9 +135,10 @@ function guess_image_type($filename, $data = '') { } } - if(is_null($type) && strpos($filename, 'http') === false) { + if(is_null($type) && strpos($filename, 'http') === 0) { $size = getimagesize($filename); - $type = ((array_key_exists($size['mime'], $types)) ? $size['mime'] : 'image/jpeg'); + if (array_key_exists($size['mime'], $types)) + $type = $size['mime']; } if(is_null($type)) { -- cgit v1.2.3 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 --- include/markdown.php | 9 ++++++--- include/permissions.php | 2 +- include/plugin.php | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'include') 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 From e312c381d897866b15179fd301d9979b46f2f678 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 2 Feb 2021 11:47:38 +0100 Subject: import_xchan() $arr photo structure has changed --- include/html2bbcode.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/html2bbcode.php b/include/html2bbcode.php index c916421b8..173ea63bd 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -87,6 +87,9 @@ function deletenode(&$doc, $node) function html2bbcode($message) { + if(!$message) + return; + $message = str_replace("\r", "", $message); $message = str_replace(array( -- cgit v1.2.3