From f878d2e4630a4ee1b014e063f4c09d6ce184f43f Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 25 Jul 2021 12:29:43 +0000 Subject: [PATCH] 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 636e0fce..d7af3eee 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 be8e7495..deaccfd0 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 6ba21499..144148e7 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 530239fd..bf15ab62 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 a0cc1ae8..67ffdd85 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 be2c5587..a74aa4fa 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 4be767f9..83c0419f 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 12bc5c99..c5ff6965 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 81adec84..392dbe0e 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 = ""; -- 2.39.5