From f878d2e4630a4ee1b014e063f4c09d6ce184f43f Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 25 Jul 2021 12:29:43 +0000 Subject: [PATCH 1/3] Replaced argv/argc with replacement functions --- advancedcontentfilter/advancedcontentfilter.php | 6 +++--- buffer/buffer.php | 6 +++--- catavatar/catavatar.php | 14 +++++++------- forumdirectory/forumdirectory.php | 2 +- ifttt/ifttt.php | 4 ++-- pumpio/pumpio.php | 6 +++--- tumblr/tumblr.php | 6 +++--- windowsphonepush/windowsphonepush.php | 4 ++-- xmpp/xmpp.php | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index 636e0fce2..d7af3eee2 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -181,7 +181,7 @@ function advancedcontentfilter_module() {} function advancedcontentfilter_init(App $a) { - if ($a->argc > 1 && $a->argv[1] == 'api') { + if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'api') { $slim = new \Slim\App(); require __DIR__ . '/src/middlewares.php'; @@ -196,10 +196,10 @@ function advancedcontentfilter_init(App $a) function advancedcontentfilter_content(App $a) { if (!local_user()) { - return Login::form('/' . implode('/', $a->argv)); + return Login::form('/' . implode('/', DI::args()->getArgv())); } - if ($a->argc > 1 && $a->argv[1] == 'help') { + if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'help') { $lang = $a->user['language']; $default_dir = 'addon/advancedcontentfilter/doc/'; diff --git a/buffer/buffer.php b/buffer/buffer.php index be8e74956..deaccfd07 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -43,14 +43,14 @@ function buffer_content(App $a) require_once "mod/settings.php"; settings_init($a); - if (isset($a->argv[1])) { - switch ($a->argv[1]) { + if (isset(DI::args()->getArgv()[1])) { + switch (DI::args()->getArgv()[1]) { case "connect": $o = buffer_connect($a); break; default: - $o = print_r($a->argv, true); + $o = print_r(DI::args()->getArgv(), true); break; } } else { diff --git a/catavatar/catavatar.php b/catavatar/catavatar.php index 6ba214991..144148e7e 100644 --- a/catavatar/catavatar.php +++ b/catavatar/catavatar.php @@ -142,12 +142,12 @@ function catavatar_module() {} */ function catavatar_content(App $a) { - if ($a->argc < 2 || $a->argc > 3) { + if (DI::args()->getArgc() < 2 || DI::args()->getArgc() > 3) { throw new NotFoundException(); // this should be catched on index and show default "not found" page. } - if (is_numeric($a->argv[1])) { - $uid = intval($a->argv[1]); + if (is_numeric(DI::args()->getArgv()[1])) { + $uid = intval(DI::args()->getArgv()[1]); $condition = ['uid' => $uid, 'account_expired' => false, 'account_removed' => false]; $user = DBA::selectFirst('user', ['email'], $condition); @@ -157,15 +157,15 @@ function catavatar_content(App $a) } $seed = DI::pConfig()->get($uid, "catavatar", "seed", md5(trim(strtolower($user['email'])))); - } elseif (!empty($a->argv[1])) { - $seed = $a->argv[1]; + } elseif (!empty(DI::args()->getArgv()[1])) { + $seed = DI::args()->getArgv()[1]; } else { throw new NotFoundException(); } $size = 0; - if ($a->argc == 3) { - $size = intval($a->argv[2]); + if (DI::args()->getArgc() == 3) { + $size = intval(DI::args()->getArgv()[2]); } // ...Or start generation diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 530239fd2..bf15ab62c 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -111,7 +111,7 @@ function forumdirectory_content(App $a) ); if (DBA::isResult($r)) { - if (in_array('small', $a->argv)) { + if (in_array('small', DI::args()->getArgv())) { $photo = 'thumb'; } else { $photo = 'photo'; diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php index a0cc1ae80..67ffdd858 100644 --- a/ifttt/ifttt.php +++ b/ifttt/ifttt.php @@ -88,11 +88,11 @@ function ifttt_settings_post() function ifttt_post(App $a) { - if ($a->argc != 2) { + if (DI::args()->getArgc() != 2) { return; } - $nickname = $a->argv[1]; + $nickname = DI::args()->getArgv()[1]; $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]); if (!DBA::isResult($user)) { diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index be2c5587b..a74aa4fa0 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -58,13 +58,13 @@ function pumpio_content(App $a) require_once("mod/settings.php"); settings_init($a); - if (isset($a->argv[1])) { - switch ($a->argv[1]) { + if (isset(DI::args()->getArgv()[1])) { + switch (DI::args()->getArgv()[1]) { case "connect": $o = pumpio_connect($a); break; default: - $o = print_r($a->argv, true); + $o = print_r(DI::args()->getArgv(), true); break; } } else { diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 4be767f9e..83c0419f3 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -41,8 +41,8 @@ function tumblr_content(App $a) return ''; } - if (isset($a->argv[1])) { - switch ($a->argv[1]) { + if (isset(DI::args()->getArgv()[1])) { + switch (DI::args()->getArgv()[1]) { case "connect": $o = tumblr_connect($a); break; @@ -52,7 +52,7 @@ function tumblr_content(App $a) break; default: - $o = print_r($a->argv, true); + $o = print_r(DI::args()->getArgv(), true); break; } } else { diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php index 12bc5c994..c5ff6965e 100644 --- a/windowsphonepush/windowsphonepush.php +++ b/windowsphonepush/windowsphonepush.php @@ -317,8 +317,8 @@ function windowsphonepush_content(App $a) // Login with the specified Network credentials (like in api.php) windowsphonepush_login($a); - $path = $a->argv[0]; - $path2 = $a->argv[1]; + $path = DI::args()->getArgv()[0]; + $path2 = DI::args()->getArgv()[1]; if ($path == "windowsphonepush") { switch ($path2) { case "show_settings": diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php index 81adec848..392dbe0e9 100644 --- a/xmpp/xmpp.php +++ b/xmpp/xmpp.php @@ -170,7 +170,7 @@ function xmpp_converse(App $a) return; } - if (in_array($a->argv[0], ["delegation", "logout"])) { + if (in_array(DI::args()->getArgv()[0], ["delegation", "logout"])) { $additional_commands = "converse.user.logout();\n"; } else { $additional_commands = ""; From cc8aeb11de5b4f5585c9deaece80781862df132e Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 25 Jul 2021 13:17:48 +0000 Subject: [PATCH 2/3] Updated messages.po --- advancedcontentfilter/lang/C/messages.po | 78 ++++++++++++------------ buffer/lang/C/messages.po | 2 +- catavatar/lang/C/messages.po | 20 +++--- ifttt/lang/C/messages.po | 2 +- pumpio/lang/C/messages.po | 6 +- tumblr/lang/C/messages.po | 28 ++++----- windowsphonepush/lang/C/messages.po | 2 +- xmpp/lang/C/messages.po | 2 +- 8 files changed, 70 insertions(+), 70 deletions(-) diff --git a/advancedcontentfilter/lang/C/messages.po b/advancedcontentfilter/lang/C/messages.po index 6ab34ba51..d285d071d 100644 --- a/advancedcontentfilter/lang/C/messages.po +++ b/advancedcontentfilter/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"POT-Creation-Date: 2021-07-25 13:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,32 +17,28 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/middlewares.php:49 -msgid "Method not found" -msgstr "" - -#: advancedcontentfilter.php:136 +#: advancedcontentfilter.php:153 #, php-format msgid "Filtered by rule: %s" msgstr "" -#: advancedcontentfilter.php:150 advancedcontentfilter.php:207 +#: advancedcontentfilter.php:167 advancedcontentfilter.php:224 msgid "Advanced Content Filter" msgstr "" -#: advancedcontentfilter.php:206 +#: advancedcontentfilter.php:223 msgid "Back to Addon Settings" msgstr "" -#: advancedcontentfilter.php:208 +#: advancedcontentfilter.php:225 msgid "Add a Rule" msgstr "" -#: advancedcontentfilter.php:209 +#: advancedcontentfilter.php:226 msgid "Help" msgstr "" -#: advancedcontentfilter.php:210 +#: advancedcontentfilter.php:227 msgid "" "Add and manage your personal content filter rules in this screen. Rules have " "a name and an arbitrary expression that will be matched against post data. " @@ -50,108 +46,112 @@ msgid "" "the help page." msgstr "" -#: advancedcontentfilter.php:211 +#: advancedcontentfilter.php:228 msgid "Your rules" msgstr "" -#: advancedcontentfilter.php:212 +#: advancedcontentfilter.php:229 msgid "" "You have no rules yet! Start adding one by clicking on the button above next " "to the title." msgstr "" -#: advancedcontentfilter.php:213 +#: advancedcontentfilter.php:230 msgid "Disabled" msgstr "" -#: advancedcontentfilter.php:214 +#: advancedcontentfilter.php:231 msgid "Enabled" msgstr "" -#: advancedcontentfilter.php:215 +#: advancedcontentfilter.php:232 msgid "Disable this rule" msgstr "" -#: advancedcontentfilter.php:216 +#: advancedcontentfilter.php:233 msgid "Enable this rule" msgstr "" -#: advancedcontentfilter.php:217 +#: advancedcontentfilter.php:234 msgid "Edit this rule" msgstr "" -#: advancedcontentfilter.php:218 +#: advancedcontentfilter.php:235 msgid "Edit the rule" msgstr "" -#: advancedcontentfilter.php:219 +#: advancedcontentfilter.php:236 msgid "Save this rule" msgstr "" -#: advancedcontentfilter.php:220 +#: advancedcontentfilter.php:237 msgid "Delete this rule" msgstr "" -#: advancedcontentfilter.php:221 +#: advancedcontentfilter.php:238 msgid "Rule" msgstr "" -#: advancedcontentfilter.php:222 +#: advancedcontentfilter.php:239 msgid "Close" msgstr "" -#: advancedcontentfilter.php:223 +#: advancedcontentfilter.php:240 msgid "Add new rule" msgstr "" -#: advancedcontentfilter.php:224 +#: advancedcontentfilter.php:241 msgid "Rule Name" msgstr "" -#: advancedcontentfilter.php:225 +#: advancedcontentfilter.php:242 msgid "Rule Expression" msgstr "" -#: advancedcontentfilter.php:226 +#: advancedcontentfilter.php:243 msgid "Cancel" msgstr "" -#: advancedcontentfilter.php:293 advancedcontentfilter.php:304 -#: advancedcontentfilter.php:315 advancedcontentfilter.php:349 -#: advancedcontentfilter.php:378 advancedcontentfilter.php:399 +#: advancedcontentfilter.php:310 advancedcontentfilter.php:321 +#: advancedcontentfilter.php:332 advancedcontentfilter.php:366 +#: advancedcontentfilter.php:395 advancedcontentfilter.php:416 msgid "You must be logged in to use this method" msgstr "" -#: advancedcontentfilter.php:319 advancedcontentfilter.php:353 -#: advancedcontentfilter.php:382 +#: advancedcontentfilter.php:336 advancedcontentfilter.php:370 +#: advancedcontentfilter.php:399 msgid "Invalid form security token, please refresh the page." msgstr "" -#: advancedcontentfilter.php:331 +#: advancedcontentfilter.php:348 msgid "The rule name and expression are required." msgstr "" -#: advancedcontentfilter.php:343 +#: advancedcontentfilter.php:360 msgid "Rule successfully added" msgstr "" -#: advancedcontentfilter.php:357 advancedcontentfilter.php:386 +#: advancedcontentfilter.php:374 advancedcontentfilter.php:403 msgid "Rule doesn't exist or doesn't belong to you." msgstr "" -#: advancedcontentfilter.php:372 +#: advancedcontentfilter.php:389 msgid "Rule successfully updated" msgstr "" -#: advancedcontentfilter.php:393 +#: advancedcontentfilter.php:410 msgid "Rule successfully deleted" msgstr "" -#: advancedcontentfilter.php:403 +#: advancedcontentfilter.php:420 msgid "Missing argument: guid." msgstr "" -#: advancedcontentfilter.php:411 +#: advancedcontentfilter.php:428 #, php-format msgid "Unknown post with guid: %s" msgstr "" + +#: src/middlewares.php:49 +msgid "Method not found" +msgstr "" diff --git a/buffer/lang/C/messages.po b/buffer/lang/C/messages.po index cd5087732..65ba7f4fa 100644 --- a/buffer/lang/C/messages.po +++ b/buffer/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"POT-Creation-Date: 2021-07-25 13:17+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/catavatar/lang/C/messages.po b/catavatar/lang/C/messages.po index e679dad8d..e6efdf771 100644 --- a/catavatar/lang/C/messages.po +++ b/catavatar/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"POT-Creation-Date: 2021-07-25 13:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,38 +17,38 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: catavatar.php:48 +#: catavatar.php:49 msgid "Use Cat as Avatar" msgstr "" -#: catavatar.php:49 +#: catavatar.php:50 msgid "More Random Cat!" msgstr "" -#: catavatar.php:50 +#: catavatar.php:51 msgid "Reset to email Cat" msgstr "" -#: catavatar.php:52 +#: catavatar.php:53 msgid "Cat Avatar Settings" msgstr "" -#: catavatar.php:53 +#: catavatar.php:54 msgid "Set default profile avatar or randomize the cat." msgstr "" -#: catavatar.php:78 +#: catavatar.php:72 msgid "The cat hadn't found itself." msgstr "" -#: catavatar.php:87 +#: catavatar.php:81 msgid "There was an error, the cat ran away." msgstr "" -#: catavatar.php:93 +#: catavatar.php:87 msgid "Profile Photos" msgstr "" -#: catavatar.php:108 +#: catavatar.php:97 msgid "Meow!" msgstr "" diff --git a/ifttt/lang/C/messages.po b/ifttt/lang/C/messages.po index c87c66a7d..f8f88f708 100644 --- a/ifttt/lang/C/messages.po +++ b/ifttt/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"POT-Creation-Date: 2021-07-25 13:17+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/pumpio/lang/C/messages.po b/pumpio/lang/C/messages.po index 1fe269e99..a0d0a55d2 100644 --- a/pumpio/lang/C/messages.po +++ b/pumpio/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"POT-Creation-Date: 2021-07-25 13:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -82,11 +82,11 @@ msgstr "" msgid "Save Settings" msgstr "" -#: pumpio.php:981 +#: pumpio.php:983 msgid "status" msgstr "" -#: pumpio.php:985 +#: pumpio.php:987 #, php-format msgid "%1$s likes %2$s's %3$s" msgstr "" diff --git a/tumblr/lang/C/messages.po b/tumblr/lang/C/messages.po index 5ca9ea58d..22292f373 100644 --- a/tumblr/lang/C/messages.po +++ b/tumblr/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:16+0100\n" +"POT-Creation-Date: 2021-07-25 13:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,54 +17,54 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: tumblr.php:39 +#: tumblr.php:40 msgid "Permission denied." msgstr "" -#: tumblr.php:69 tumblr.php:283 +#: tumblr.php:70 tumblr.php:284 msgid "Save Settings" msgstr "" -#: tumblr.php:71 +#: tumblr.php:72 msgid "Consumer Key" msgstr "" -#: tumblr.php:72 +#: tumblr.php:73 msgid "Consumer Secret" msgstr "" -#: tumblr.php:177 +#: tumblr.php:178 msgid "You are now authenticated to tumblr." msgstr "" -#: tumblr.php:178 +#: tumblr.php:179 msgid "return to the connector page" msgstr "" -#: tumblr.php:194 +#: tumblr.php:195 msgid "Post to Tumblr" msgstr "" -#: tumblr.php:224 tumblr.php:228 +#: tumblr.php:225 tumblr.php:229 msgid "Tumblr Export" msgstr "" -#: tumblr.php:232 +#: tumblr.php:233 msgid "(Re-)Authenticate your tumblr page" msgstr "" -#: tumblr.php:236 +#: tumblr.php:237 msgid "Enable Tumblr Post Addon" msgstr "" -#: tumblr.php:242 +#: tumblr.php:243 msgid "Post to Tumblr by default" msgstr "" -#: tumblr.php:263 +#: tumblr.php:264 msgid "Post to page:" msgstr "" -#: tumblr.php:277 +#: tumblr.php:278 msgid "You are not authenticated to tumblr" msgstr "" diff --git a/windowsphonepush/lang/C/messages.po b/windowsphonepush/lang/C/messages.po index 9beefa87c..0e0cf1f20 100644 --- a/windowsphonepush/lang/C/messages.po +++ b/windowsphonepush/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:16+0100\n" +"POT-Creation-Date: 2021-07-25 13:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/xmpp/lang/C/messages.po b/xmpp/lang/C/messages.po index 5304df2e6..2c7fab3a1 100644 --- a/xmpp/lang/C/messages.po +++ b/xmpp/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:16+0100\n" +"POT-Creation-Date: 2021-07-25 13:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From d902f6808d8c00c1abba103a2bedee379fce51f8 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 25 Jul 2021 17:28:07 +0000 Subject: [PATCH 3/3] Use globals instead of $a->data --- blockem/blockem.php | 12 +++++++++--- forumdirectory/forumdirectory.php | 12 +++++++++--- js_upload/js_upload.php | 19 ++++++++++++++----- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/blockem/blockem.php b/blockem/blockem.php index 1880b9be4..3183915c5 100644 --- a/blockem/blockem.php +++ b/blockem/blockem.php @@ -12,6 +12,8 @@ use Friendica\Core\Hook; use Friendica\DI; use Friendica\Util\Strings; +global $blockem_words; + function blockem_install() { Hook::register('prepare_body_content_filter', 'addon/blockem/blockem.php', 'blockem_prepare_body_content_filter'); @@ -141,6 +143,8 @@ function blockem_display_item(App $a, array &$b = null) function blockem_conversation_start(App $a, array &$b) { + global $blockem_words; + if (!local_user()) { return; } @@ -148,7 +152,7 @@ function blockem_conversation_start(App $a, array &$b) $words = DI::pConfig()->get(local_user(), 'blockem', 'words'); if ($words) { - $a->data['blockem'] = explode(',', $words); + $blockem_words = explode(',', $words); } DI::page()['htmlhead'] .= <<< EOT @@ -171,6 +175,8 @@ EOT; function blockem_item_photo_menu(App $a, array &$b) { + global $blockem_words; + if (!local_user() || $b['item']['self']) { return; } @@ -178,8 +184,8 @@ function blockem_item_photo_menu(App $a, array &$b) $blocked = false; $author = $b['item']['author-link']; - if (!empty($a->data['blockem'])) { - foreach($a->data['blockem'] as $bloke) { + if (!empty($blockem_words)) { + foreach($blockem_words as $bloke) { if (Strings::compareLink($bloke,$author)) { $blocked = true; break; diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index bf15ab62c..cf65bcc14 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -18,6 +18,8 @@ use Friendica\Model\Profile; use Friendica\Model\User; use Friendica\Util\Strings; +global $forumdirectory_search; + function forumdirectory_install() { Hook::register('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu'); @@ -42,13 +44,17 @@ function forumdirectory_init(App $a) function forumdirectory_post(App $a) { + global $forumdirectory_search; + if (!empty($_POST['search'])) { - $a->data['search'] = $_POST['search']; + $forumdirectory_search = $_POST['search']; } } function forumdirectory_content(App $a) { + global $forumdirectory_search; + if ((DI::config()->get('system', 'block_public')) && (!local_user()) && (!remote_user())) { notice(DI::l10n()->t('Public access denied.') . EOL); return; @@ -59,8 +65,8 @@ function forumdirectory_content(App $a) Nav::setSelected('directory'); - if (!empty($a->data['search'])) { - $search = Strings::escapeTags(trim($a->data['search'])); + if (!empty($forumdirectory_search)) { + $search = Strings::escapeTags(trim($forumdirectory_search)); } else { $search = (!empty($_GET['search']) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : ''); } diff --git a/js_upload/js_upload.php b/js_upload/js_upload.php index 6a86575fe..89f62ea4d 100644 --- a/js_upload/js_upload.php +++ b/js_upload/js_upload.php @@ -14,6 +14,9 @@ use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Util\Strings; +global $js_upload_jsonresponse; +global $js_upload_result; + function js_upload_install() { Hook::register('photo_upload_form', __FILE__, 'js_upload_form'); @@ -42,6 +45,8 @@ function js_upload_form(App $a, array &$b) function js_upload_post_init(App $a, &$b) { + global $js_upload_result, $js_upload_jsonresponse; + // list of valid extensions $allowedExtensions = ['jpeg', 'gif', 'png', 'jpg']; @@ -53,7 +58,7 @@ function js_upload_post_init(App $a, &$b) $result = $uploader->handleUpload(); // to pass data through iframe you will need to encode all html tags - $a->data['upload_jsonresponse'] = htmlspecialchars(json_encode($result), ENT_NOQUOTES); + $js_upload_jsonresponse = htmlspecialchars(json_encode($result), ENT_NOQUOTES); if (isset($result['error'])) { Logger::log('mod/photos.php: photos_post(): error uploading photo: ' . $result['error'], Logger::DEBUG); @@ -61,12 +66,14 @@ function js_upload_post_init(App $a, &$b) exit(); } - $a->data['upload_result'] = $result; + $js_upload_result = $result; } function js_upload_post_file(App $a, &$b) { - $result = $a->data['upload_result']; + global $js_upload_result; + + $result = $js_upload_result; $b['src'] = $result['path']; $b['filename'] = $result['filename']; @@ -76,9 +83,11 @@ function js_upload_post_file(App $a, &$b) function js_upload_post_end(App $a, &$b) { + global $js_upload_jsonresponse; + Logger::log('upload_post_end'); - if (!empty($a->data['upload_jsonresponse'])) { - echo $a->data['upload_jsonresponse']; + if (!empty($js_upload_jsonresponse)) { + echo $js_upload_jsonresponse; exit(); } }