From 368819685909c0fa027cfee288cce8c40917380c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Tue, 14 Mar 2023 00:34:50 +0100 Subject: [PATCH] create workaround for not working php Strings:getBytesFromShorthand i created a js-function which converts integer, k, m and g to MB Just remove this code, when we found out, why Strings is in some files not working. --- mod/photos.php | 6 ++++++ src/Content/Conversation.php | 8 +++++--- src/Module/Post/Edit.php | 4 ++-- src/Object/Post.php | 2 ++ view/templates/item/compose.tpl | 5 +++-- view/theme/frio/js/dropzone-frio.js | 24 ++++++++++++++++++++++ view/theme/frio/templates/comment_item.tpl | 5 +++-- view/theme/frio/templates/head.tpl | 3 ++- view/theme/frio/templates/jot.tpl | 5 +++-- 9 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 view/theme/frio/js/dropzone-frio.js diff --git a/mod/photos.php b/mod/photos.php index 440aae92eb..97c0fb22e6 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1141,6 +1141,8 @@ function photos_content(App $a) '$qcomment' => $qcomment, '$rand_num' => Crypto::randomDigits(12), // Dropzone + //'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')); + // Strings::getBytresFromShorthand not working, so just workaround in template and serve the bare value '$max_imagesize' => DI::config()->get('system', 'maximagesize'), ]); } @@ -1198,6 +1200,8 @@ function photos_content(App $a) '$qcomment' => $qcomment, '$rand_num' => Crypto::randomDigits(12), // Dropzone + //'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')); + // Strings::getBytresFromShorthand not working, so just workaround in template and serve the bare value '$max_imagesize' => DI::config()->get('system', 'maximagesize'), ]); } @@ -1274,6 +1278,8 @@ function photos_content(App $a) '$qcomment' => $qcomment, '$rand_num' => Crypto::randomDigits(12), // Dropzone + //'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')); + // Strings::getBytresFromShorthand not working, so just workaround in template and serve the bare value '$max_imagesize' => DI::config()->get('system', 'maximagesize'), ]); } diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index 586b0bc540..8460f94232 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -35,6 +35,7 @@ use Friendica\Core\Renderer; use Friendica\Core\Session\Capability\IHandleUserSessions; use Friendica\Core\Theme; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Item as ItemModel; use Friendica\Model\Post; @@ -408,10 +409,11 @@ class Conversation '$compose_link_title' => $this->l10n->t('Open Compose page'), '$always_open_compose' => $this->pConfig->get($this->session->getLocalUserId(), 'frio', 'always_open_compose', false), + // Dropzone - //'$max_imagesize' => DI::config()->get('system', 'maximagesize'), - // DI::config.. does not work here, so it is set to a manual value - '$max_imagesize' => 600000, + //'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')); + // Strings::getBytresFromShorthand not working, so just workaround in template and serve the bare value + '$max_imagesize' => DI::config()->get('system', 'maximagesize'), ]); diff --git a/src/Module/Post/Edit.php b/src/Module/Post/Edit.php index d5b27d648f..3e47889b21 100644 --- a/src/Module/Post/Edit.php +++ b/src/Module/Post/Edit.php @@ -185,9 +185,9 @@ class Edit extends BaseModule '$compose_link_title' => $this->t('Open Compose page'), // Dropzone - //'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')); //'$max_imagesize' => \Friendica\\Util\\Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')); - // both not working, so just workaround here until fixed + //'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')); + // both not working, so just workaround in template and serve the bare value '$max_imagesize' => DI::config()->get('system', 'maximagesize'), ]); diff --git a/src/Object/Post.php b/src/Object/Post.php index 59617573e0..9e569c6a16 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -1070,6 +1070,8 @@ class Post '$indent' => $indent, '$rand_num' => Crypto::randomDigits(12), // Dropzone + //'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')); + // Strings::getBytresFromShorthand not working, so just workaround in template and serve the bare value '$max_imagesize' => DI::config()->get('system', 'maximagesize'), ]); } diff --git a/view/templates/item/compose.tpl b/view/templates/item/compose.tpl index 3db9a64f55..226014ff9a 100644 --- a/view/templates/item/compose.tpl +++ b/view/templates/item/compose.tpl @@ -96,11 +96,12 @@ {{/if}} - + + {{* Include the strings which are needed for some js functions (e.g. translation) They are loaded into the html so that js functions can use them *}} diff --git a/view/theme/frio/templates/jot.tpl b/view/theme/frio/templates/jot.tpl index 2d20fef442..7076910946 100644 --- a/view/theme/frio/templates/jot.tpl +++ b/view/theme/frio/templates/jot.tpl @@ -180,11 +180,12 @@ can load different content into the jot modal (e.g. the item edit jot)