Replaced argv/argc with replacement functions
This commit is contained in:
parent
42454b3cf7
commit
f878d2e463
9 changed files with 25 additions and 25 deletions
|
@ -181,7 +181,7 @@ function advancedcontentfilter_module() {}
|
||||||
|
|
||||||
function advancedcontentfilter_init(App $a)
|
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();
|
$slim = new \Slim\App();
|
||||||
|
|
||||||
require __DIR__ . '/src/middlewares.php';
|
require __DIR__ . '/src/middlewares.php';
|
||||||
|
@ -196,10 +196,10 @@ function advancedcontentfilter_init(App $a)
|
||||||
function advancedcontentfilter_content(App $a)
|
function advancedcontentfilter_content(App $a)
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
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'];
|
$lang = $a->user['language'];
|
||||||
|
|
||||||
$default_dir = 'addon/advancedcontentfilter/doc/';
|
$default_dir = 'addon/advancedcontentfilter/doc/';
|
||||||
|
|
|
@ -43,14 +43,14 @@ function buffer_content(App $a)
|
||||||
require_once "mod/settings.php";
|
require_once "mod/settings.php";
|
||||||
settings_init($a);
|
settings_init($a);
|
||||||
|
|
||||||
if (isset($a->argv[1])) {
|
if (isset(DI::args()->getArgv()[1])) {
|
||||||
switch ($a->argv[1]) {
|
switch (DI::args()->getArgv()[1]) {
|
||||||
case "connect":
|
case "connect":
|
||||||
$o = buffer_connect($a);
|
$o = buffer_connect($a);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$o = print_r($a->argv, true);
|
$o = print_r(DI::args()->getArgv(), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -142,12 +142,12 @@ function catavatar_module() {}
|
||||||
*/
|
*/
|
||||||
function catavatar_content(App $a)
|
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.
|
throw new NotFoundException(); // this should be catched on index and show default "not found" page.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_numeric($a->argv[1])) {
|
if (is_numeric(DI::args()->getArgv()[1])) {
|
||||||
$uid = intval($a->argv[1]);
|
$uid = intval(DI::args()->getArgv()[1]);
|
||||||
$condition = ['uid' => $uid,
|
$condition = ['uid' => $uid,
|
||||||
'account_expired' => false, 'account_removed' => false];
|
'account_expired' => false, 'account_removed' => false];
|
||||||
$user = DBA::selectFirst('user', ['email'], $condition);
|
$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']))));
|
$seed = DI::pConfig()->get($uid, "catavatar", "seed", md5(trim(strtolower($user['email']))));
|
||||||
} elseif (!empty($a->argv[1])) {
|
} elseif (!empty(DI::args()->getArgv()[1])) {
|
||||||
$seed = $a->argv[1];
|
$seed = DI::args()->getArgv()[1];
|
||||||
} else {
|
} else {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$size = 0;
|
$size = 0;
|
||||||
if ($a->argc == 3) {
|
if (DI::args()->getArgc() == 3) {
|
||||||
$size = intval($a->argv[2]);
|
$size = intval(DI::args()->getArgv()[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...Or start generation
|
// ...Or start generation
|
||||||
|
|
|
@ -111,7 +111,7 @@ function forumdirectory_content(App $a)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
if (in_array('small', $a->argv)) {
|
if (in_array('small', DI::args()->getArgv())) {
|
||||||
$photo = 'thumb';
|
$photo = 'thumb';
|
||||||
} else {
|
} else {
|
||||||
$photo = 'photo';
|
$photo = 'photo';
|
||||||
|
|
|
@ -88,11 +88,11 @@ function ifttt_settings_post()
|
||||||
|
|
||||||
function ifttt_post(App $a)
|
function ifttt_post(App $a)
|
||||||
{
|
{
|
||||||
if ($a->argc != 2) {
|
if (DI::args()->getArgc() != 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$nickname = $a->argv[1];
|
$nickname = DI::args()->getArgv()[1];
|
||||||
|
|
||||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]);
|
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]);
|
||||||
if (!DBA::isResult($user)) {
|
if (!DBA::isResult($user)) {
|
||||||
|
|
|
@ -58,13 +58,13 @@ function pumpio_content(App $a)
|
||||||
require_once("mod/settings.php");
|
require_once("mod/settings.php");
|
||||||
settings_init($a);
|
settings_init($a);
|
||||||
|
|
||||||
if (isset($a->argv[1])) {
|
if (isset(DI::args()->getArgv()[1])) {
|
||||||
switch ($a->argv[1]) {
|
switch (DI::args()->getArgv()[1]) {
|
||||||
case "connect":
|
case "connect":
|
||||||
$o = pumpio_connect($a);
|
$o = pumpio_connect($a);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$o = print_r($a->argv, true);
|
$o = print_r(DI::args()->getArgv(), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -41,8 +41,8 @@ function tumblr_content(App $a)
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($a->argv[1])) {
|
if (isset(DI::args()->getArgv()[1])) {
|
||||||
switch ($a->argv[1]) {
|
switch (DI::args()->getArgv()[1]) {
|
||||||
case "connect":
|
case "connect":
|
||||||
$o = tumblr_connect($a);
|
$o = tumblr_connect($a);
|
||||||
break;
|
break;
|
||||||
|
@ -52,7 +52,7 @@ function tumblr_content(App $a)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$o = print_r($a->argv, true);
|
$o = print_r(DI::args()->getArgv(), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -317,8 +317,8 @@ function windowsphonepush_content(App $a)
|
||||||
// Login with the specified Network credentials (like in api.php)
|
// Login with the specified Network credentials (like in api.php)
|
||||||
windowsphonepush_login($a);
|
windowsphonepush_login($a);
|
||||||
|
|
||||||
$path = $a->argv[0];
|
$path = DI::args()->getArgv()[0];
|
||||||
$path2 = $a->argv[1];
|
$path2 = DI::args()->getArgv()[1];
|
||||||
if ($path == "windowsphonepush") {
|
if ($path == "windowsphonepush") {
|
||||||
switch ($path2) {
|
switch ($path2) {
|
||||||
case "show_settings":
|
case "show_settings":
|
||||||
|
|
|
@ -170,7 +170,7 @@ function xmpp_converse(App $a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($a->argv[0], ["delegation", "logout"])) {
|
if (in_array(DI::args()->getArgv()[0], ["delegation", "logout"])) {
|
||||||
$additional_commands = "converse.user.logout();\n";
|
$additional_commands = "converse.user.logout();\n";
|
||||||
} else {
|
} else {
|
||||||
$additional_commands = "";
|
$additional_commands = "";
|
||||||
|
|
Loading…
Reference in a new issue