Replaced argv/argc with replacement functions

This commit is contained in:
Michael 2021-07-25 13:08:22 +00:00
parent 9cc4682e0a
commit 0c0abd9238
23 changed files with 136 additions and 138 deletions

View File

@ -545,10 +545,10 @@ function api_get_user(App $a, $contact_id = null)
} }
// $called_api is the API path exploded on / and is expected to have at least 2 elements // $called_api is the API path exploded on / and is expected to have at least 2 elements
if (is_null($user) && ($a->argc > (count($called_api) - 1)) && (count($called_api) > 0)) { if (is_null($user) && (DI::args()->getArgc() > (count($called_api) - 1)) && (count($called_api) > 0)) {
$argid = count($called_api); $argid = count($called_api);
if (!empty($a->argv[$argid])) { if (!empty(DI::args()->getArgv()[$argid])) {
$data = explode(".", $a->argv[$argid]); $data = explode(".", DI::args()->getArgv()[$argid]);
if (count($data) > 1) { if (count($data) > 1) {
list($user, $null) = $data; list($user, $null) = $data;
} }
@ -1021,7 +1021,7 @@ function api_statuses_mediap($type)
} }
$txt = HTML::toBBCode($txt); $txt = HTML::toBBCode($txt);
$a->argv[1] = $user_info['screen_name']; //should be set to username? DI::args()->getArgv()[1] = $user_info['screen_name']; //should be set to username?
$picture = wall_upload_post($a, false); $picture = wall_upload_post($a, false);
@ -1883,7 +1883,7 @@ function api_statuses_show($type)
} }
// params // params
$id = intval($a->argv[3] ?? 0); $id = intval(DI::args()->getArgv()[3] ?? 0);
if ($id == 0) { if ($id == 0) {
$id = intval($_REQUEST['id'] ?? 0); $id = intval($_REQUEST['id'] ?? 0);
@ -1891,7 +1891,7 @@ function api_statuses_show($type)
// Hotot workaround // Hotot workaround
if ($id == 0) { if ($id == 0) {
$id = intval($a->argv[4] ?? 0); $id = intval(DI::args()->getArgv()[4] ?? 0);
} }
Logger::log('API: api_statuses_show: ' . $id); Logger::log('API: api_statuses_show: ' . $id);
@ -1962,7 +1962,7 @@ function api_conversation_show($type)
} }
// params // params
$id = intval($a->argv[3] ?? 0); $id = intval(DI::args()->getArgv()[3] ?? 0);
$since_id = intval($_REQUEST['since_id'] ?? 0); $since_id = intval($_REQUEST['since_id'] ?? 0);
$max_id = intval($_REQUEST['max_id'] ?? 0); $max_id = intval($_REQUEST['max_id'] ?? 0);
$count = intval($_REQUEST['count'] ?? 20); $count = intval($_REQUEST['count'] ?? 20);
@ -1976,7 +1976,7 @@ function api_conversation_show($type)
// Hotot workaround // Hotot workaround
if ($id == 0) { if ($id == 0) {
$id = intval($a->argv[4] ?? 0); $id = intval(DI::args()->getArgv()[4] ?? 0);
} }
Logger::info(API_LOG_PREFIX . '{subaction}', ['module' => 'api', 'action' => 'conversation', 'subaction' => 'show', 'id' => $id]); Logger::info(API_LOG_PREFIX . '{subaction}', ['module' => 'api', 'action' => 'conversation', 'subaction' => 'show', 'id' => $id]);
@ -2045,7 +2045,7 @@ function api_statuses_repeat($type)
api_get_user($a); api_get_user($a);
// params // params
$id = intval($a->argv[3] ?? 0); $id = intval(DI::args()->getArgv()[3] ?? 0);
if ($id == 0) { if ($id == 0) {
$id = intval($_REQUEST['id'] ?? 0); $id = intval($_REQUEST['id'] ?? 0);
@ -2053,7 +2053,7 @@ function api_statuses_repeat($type)
// Hotot workaround // Hotot workaround
if ($id == 0) { if ($id == 0) {
$id = intval($a->argv[4] ?? 0); $id = intval(DI::args()->getArgv()[4] ?? 0);
} }
Logger::log('API: api_statuses_repeat: '.$id); Logger::log('API: api_statuses_repeat: '.$id);
@ -2128,7 +2128,7 @@ function api_statuses_destroy($type)
api_get_user($a); api_get_user($a);
// params // params
$id = intval($a->argv[3] ?? 0); $id = intval(DI::args()->getArgv()[3] ?? 0);
if ($id == 0) { if ($id == 0) {
$id = intval($_REQUEST['id'] ?? 0); $id = intval($_REQUEST['id'] ?? 0);
@ -2136,7 +2136,7 @@ function api_statuses_destroy($type)
// Hotot workaround // Hotot workaround
if ($id == 0) { if ($id == 0) {
$id = intval($a->argv[4] ?? 0); $id = intval(DI::args()->getArgv()[4] ?? 0);
} }
Logger::log('API: api_statuses_destroy: '.$id); Logger::log('API: api_statuses_destroy: '.$id);
@ -2329,16 +2329,16 @@ function api_favorites_create_destroy($type)
// for versioned api. // for versioned api.
/// @TODO We need a better global soluton /// @TODO We need a better global soluton
$action_argv_id = 2; $action_argv_id = 2;
if (count($a->argv) > 1 && $a->argv[1] == "1.1") { if (count(DI::args()->getArgv()) > 1 && DI::args()->getArgv()[1] == "1.1") {
$action_argv_id = 3; $action_argv_id = 3;
} }
if ($a->argc <= $action_argv_id) { if (DI::args()->getArgc() <= $action_argv_id) {
throw new BadRequestException("Invalid request."); throw new BadRequestException("Invalid request.");
} }
$action = str_replace("." . $type, "", $a->argv[$action_argv_id]); $action = str_replace("." . $type, "", DI::args()->getArgv()[$action_argv_id]);
if ($a->argc == $action_argv_id + 2) { if (DI::args()->getArgc() == $action_argv_id + 2) {
$itemid = intval($a->argv[$action_argv_id + 1] ?? 0); $itemid = intval(DI::args()->getArgv()[$action_argv_id + 1] ?? 0);
} else { } else {
$itemid = intval($_REQUEST['id'] ?? 0); $itemid = intval($_REQUEST['id'] ?? 0);
} }
@ -5616,7 +5616,7 @@ function api_friendica_activity($type)
if (api_user() === false) { if (api_user() === false) {
throw new ForbiddenException(); throw new ForbiddenException();
} }
$verb = strtolower($a->argv[3]); $verb = strtolower(DI::args()->getArgv()[3]);
$verb = preg_replace("|\..*$|", "", $verb); $verb = preg_replace("|\..*$|", "", $verb);
$id = $_REQUEST['id'] ?? 0; $id = $_REQUEST['id'] ?? 0;
@ -5664,7 +5664,7 @@ function api_friendica_notification($type)
if (api_user() === false) { if (api_user() === false) {
throw new ForbiddenException(); throw new ForbiddenException();
} }
if ($a->argc!==3) { if (DI::args()->getArgc()!==3) {
throw new BadRequestException("Invalid argument count"); throw new BadRequestException("Invalid argument count");
} }
@ -5709,7 +5709,7 @@ function api_friendica_notification_seen($type)
if (api_user() === false || $user_info === false) { if (api_user() === false || $user_info === false) {
throw new ForbiddenException(); throw new ForbiddenException();
} }
if ($a->argc !== 4) { if (DI::args()->getArgc() !== 4) {
throw new BadRequestException("Invalid argument count"); throw new BadRequestException("Invalid argument count");
} }

View File

@ -44,7 +44,7 @@ function cal_init(App $a)
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.')); throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
} }
if ($a->argc < 2) { if (DI::args()->getArgc() < 2) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.')); throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
} }
@ -52,11 +52,11 @@ function cal_init(App $a)
// if it's a json request abort here becaus we don't // if it's a json request abort here becaus we don't
// need the widget data // need the widget data
if (!empty($a->argv[2]) && ($a->argv[2] === 'json')) { if (!empty(DI::args()->getArgv()[2]) && (DI::args()->getArgv()[2] === 'json')) {
return; return;
} }
$owner = User::getOwnerDataByNick($a->argv[1]); $owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
if (empty($owner)) { if (empty($owner)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
} }
@ -73,7 +73,7 @@ function cal_init(App $a)
function cal_content(App $a) function cal_content(App $a)
{ {
$owner = User::getOwnerDataByNick($a->argv[1]); $owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
if (empty($owner)) { if (empty($owner)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
} }
@ -101,9 +101,9 @@ function cal_content(App $a)
$ignored = (!empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0); $ignored = (!empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0);
$format = 'ical'; $format = 'ical';
if ($a->argc == 4 && $a->argv[2] == 'export') { if (DI::args()->getArgc() == 4 && DI::args()->getArgv()[2] == 'export') {
$mode = 'export'; $mode = 'export';
$format = $a->argv[3]; $format = DI::args()->getArgv()[3];
} }
// Setup permissions structures // Setup permissions structures
@ -172,7 +172,7 @@ function cal_content(App $a)
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59); $finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
if (!empty($a->argv[2]) && ($a->argv[2] === 'json')) { if (!empty(DI::args()->getArgv()[2]) && (DI::args()->getArgv()[2] === 'json')) {
if (!empty($_GET['start'])) { if (!empty($_GET['start'])) {
$start = $_GET['start']; $start = $_GET['start'];
} }
@ -220,7 +220,7 @@ function cal_content(App $a)
// transform the event in a usable array // transform the event in a usable array
$events = Event::prepareListForTemplate($r); $events = Event::prepareListForTemplate($r);
if (!empty($a->argv[2]) && ($a->argv[2] === 'json')) { if (!empty(DI::args()->getArgv()[2]) && (DI::args()->getArgv()[2] === 'json')) {
echo json_encode($events); echo json_encode($events);
exit(); exit();
} }

View File

@ -37,19 +37,18 @@ use Friendica\Module\ActivityPub\Objects;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Protocol\ActivityPub; use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\DFRN; use Friendica\Protocol\DFRN;
use Friendica\Util\Strings;
function display_init(App $a) function display_init(App $a)
{ {
if (ActivityPub::isRequest()) { if (ActivityPub::isRequest()) {
Objects::rawContent(['guid' => $a->argv[1] ?? null]); Objects::rawContent(['guid' => DI::args()->getArgv()[1] ?? null]);
} }
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) { if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
return; return;
} }
$nick = (($a->argc > 1) ? $a->argv[1] : ''); $nick = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
$item = null; $item = null;
$item_user = local_user(); $item_user = local_user();
@ -57,12 +56,12 @@ function display_init(App $a)
$fields = ['uri-id', 'parent-uri-id', 'author-id', 'author-link', 'body', 'uid', 'guid', 'gravity']; $fields = ['uri-id', 'parent-uri-id', 'author-id', 'author-link', 'body', 'uid', 'guid', 'gravity'];
// If there is only one parameter, then check if this parameter could be a guid // If there is only one parameter, then check if this parameter could be a guid
if ($a->argc == 2) { if (DI::args()->getArgc() == 2) {
$nick = ''; $nick = '';
// Does the local user have this item? // Does the local user have this item?
if (local_user()) { if (local_user()) {
$item = Post::selectFirstForUser(local_user(), $fields, ['guid' => $a->argv[1], 'uid' => local_user()]); $item = Post::selectFirstForUser(local_user(), $fields, ['guid' => DI::args()->getArgv()[1], 'uid' => local_user()]);
if (DBA::isResult($item)) { if (DBA::isResult($item)) {
$nick = $a->user['nickname']; $nick = $a->user['nickname'];
} }
@ -70,7 +69,7 @@ function display_init(App $a)
// Is this item private but could be visible to the remove visitor? // Is this item private but could be visible to the remove visitor?
if (!DBA::isResult($item) && remote_user()) { if (!DBA::isResult($item) && remote_user()) {
$item = Post::selectFirst($fields, ['guid' => $a->argv[1], 'private' => Item::PRIVATE, 'origin' => true]); $item = Post::selectFirst($fields, ['guid' => DI::args()->getArgv()[1], 'private' => Item::PRIVATE, 'origin' => true]);
if (DBA::isResult($item)) { if (DBA::isResult($item)) {
if (!Contact::isFollower(remote_user(), $item['uid'])) { if (!Contact::isFollower(remote_user(), $item['uid'])) {
$item = null; $item = null;
@ -82,10 +81,10 @@ function display_init(App $a)
// Is it an item with uid=0? // Is it an item with uid=0?
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
$item = Post::selectFirstForUser(local_user(), $fields, ['guid' => $a->argv[1], 'private' => [Item::PUBLIC, Item::UNLISTED], 'uid' => 0]); $item = Post::selectFirstForUser(local_user(), $fields, ['guid' => DI::args()->getArgv()[1], 'private' => [Item::PUBLIC, Item::UNLISTED], 'uid' => 0]);
} }
} elseif ($a->argc >= 3 && $nick == 'feed-item') { } elseif (DI::args()->getArgc() >= 3 && $nick == 'feed-item') {
$uri_id = $a->argv[2]; $uri_id = DI::args()->getArgv()[2];
if (substr($uri_id, -5) == '.atom') { if (substr($uri_id, -5) == '.atom') {
$uri_id = substr($uri_id, 0, -5); $uri_id = substr($uri_id, 0, -5);
} }
@ -96,8 +95,8 @@ function display_init(App $a)
return; return;
} }
if ($a->argc >= 3 && $nick == 'feed-item') { if (DI::args()->getArgc() >= 3 && $nick == 'feed-item') {
displayShowFeed($item['uri-id'], $item['uid'], $a->argc > 3 && $a->argv[3] == 'conversation.atom'); displayShowFeed($item['uri-id'], $item['uid'], DI::args()->getArgc() > 3 && DI::args()->getArgv()[3] == 'conversation.atom');
} }
if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) { if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
@ -185,14 +184,14 @@ function display_content(App $a, $update = false, $update_uid = 0)
$parent_uri_id = $item['parent-uri-id']; $parent_uri_id = $item['parent-uri-id'];
} }
} else { } else {
$uri_id = (($a->argc > 2) ? $a->argv[2] : 0); $uri_id = ((DI::args()->getArgc() > 2) ? DI::args()->getArgv()[2] : 0);
$parent_uri_id = $uri_id; $parent_uri_id = $uri_id;
if ($a->argc == 2) { if (DI::args()->getArgc() == 2) {
$fields = ['uri-id', 'parent-uri-id', 'uid']; $fields = ['uri-id', 'parent-uri-id', 'uid'];
if (local_user()) { if (local_user()) {
$condition = ['guid' => $a->argv[1], 'uid' => local_user()]; $condition = ['guid' => DI::args()->getArgv()[1], 'uid' => local_user()];
$item = Post::selectFirstForUser(local_user(), $fields, $condition); $item = Post::selectFirstForUser(local_user(), $fields, $condition);
if (DBA::isResult($item)) { if (DBA::isResult($item)) {
$uri_id = $item['uri-id']; $uri_id = $item['uri-id'];
@ -201,7 +200,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
} }
if (($parent_uri_id == 0) && remote_user()) { if (($parent_uri_id == 0) && remote_user()) {
$item = Post::selectFirst($fields, ['guid' => $a->argv[1], 'private' => Item::PRIVATE, 'origin' => true]); $item = Post::selectFirst($fields, ['guid' => DI::args()->getArgv()[1], 'private' => Item::PRIVATE, 'origin' => true]);
if (DBA::isResult($item) && Contact::isFollower(remote_user(), $item['uid'])) { if (DBA::isResult($item) && Contact::isFollower(remote_user(), $item['uid'])) {
$uri_id = $item['uri-id']; $uri_id = $item['uri-id'];
$parent_uri_id = $item['parent-uri-id']; $parent_uri_id = $item['parent-uri-id'];
@ -209,7 +208,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
} }
if ($parent_uri_id == 0) { if ($parent_uri_id == 0) {
$condition = ['private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $a->argv[1], 'uid' => 0]; $condition = ['private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => DI::args()->getArgv()[1], 'uid' => 0];
$item = Post::selectFirstForUser(local_user(), $fields, $condition); $item = Post::selectFirstForUser(local_user(), $fields, $condition);
if (DBA::isResult($item)) { if (DBA::isResult($item)) {
$uri_id = $item['uri-id']; $uri_id = $item['uri-id'];

View File

@ -38,7 +38,7 @@ function editpost_content(App $a)
return; return;
} }
$post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); $post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0);
if (!$post_id) { if (!$post_id) {
notice(DI::l10n()->t('Item not found')); notice(DI::l10n()->t('Item not found'));

View File

@ -51,7 +51,7 @@ function events_init(App $a)
// If it's a json request abort here because we don't // If it's a json request abort here because we don't
// need the widget data // need the widget data
if ($a->argc > 1 && $a->argv[1] === 'json') { if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] === 'json') {
return; return;
} }
@ -237,20 +237,20 @@ function events_content(App $a)
return Login::form(); return Login::form();
} }
if ($a->argc == 1) { if (DI::args()->getArgc() == 1) {
$_SESSION['return_path'] = DI::args()->getCommand(); $_SESSION['return_path'] = DI::args()->getCommand();
} }
if (($a->argc > 2) && ($a->argv[1] === 'ignore') && intval($a->argv[2])) { if ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[1] === 'ignore') && intval(DI::args()->getArgv()[2])) {
q("UPDATE `event` SET `ignore` = 1 WHERE `id` = %d AND `uid` = %d", q("UPDATE `event` SET `ignore` = 1 WHERE `id` = %d AND `uid` = %d",
intval($a->argv[2]), intval(DI::args()->getArgv()[2]),
intval(local_user()) intval(local_user())
); );
} }
if (($a->argc > 2) && ($a->argv[1] === 'unignore') && intval($a->argv[2])) { if ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[1] === 'unignore') && intval(DI::args()->getArgv()[2])) {
q("UPDATE `event` SET `ignore` = 0 WHERE `id` = %d AND `uid` = %d", q("UPDATE `event` SET `ignore` = 0 WHERE `id` = %d AND `uid` = %d",
intval($a->argv[2]), intval(DI::args()->getArgv()[2]),
intval(local_user()) intval(local_user())
); );
} }
@ -288,27 +288,27 @@ function events_content(App $a)
$m = 0; $m = 0;
$ignored = !empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0; $ignored = !empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0;
if ($a->argc > 1) { if (DI::args()->getArgc() > 1) {
if ($a->argc > 2 && $a->argv[1] == 'event') { if (DI::args()->getArgc() > 2 && DI::args()->getArgv()[1] == 'event') {
$mode = 'edit'; $mode = 'edit';
$event_id = intval($a->argv[2]); $event_id = intval(DI::args()->getArgv()[2]);
} }
if ($a->argc > 2 && $a->argv[1] == 'drop') { if (DI::args()->getArgc() > 2 && DI::args()->getArgv()[1] == 'drop') {
$mode = 'drop'; $mode = 'drop';
$event_id = intval($a->argv[2]); $event_id = intval(DI::args()->getArgv()[2]);
} }
if ($a->argc > 2 && $a->argv[1] == 'copy') { if (DI::args()->getArgc() > 2 && DI::args()->getArgv()[1] == 'copy') {
$mode = 'copy'; $mode = 'copy';
$event_id = intval($a->argv[2]); $event_id = intval(DI::args()->getArgv()[2]);
} }
if ($a->argv[1] === 'new') { if (DI::args()->getArgv()[1] === 'new') {
$mode = 'new'; $mode = 'new';
$event_id = 0; $event_id = 0;
} }
if ($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) { if (DI::args()->getArgc() > 2 && intval(DI::args()->getArgv()[1]) && intval(DI::args()->getArgv()[2])) {
$mode = 'view'; $mode = 'view';
$y = intval($a->argv[1]); $y = intval(DI::args()->getArgv()[1]);
$m = intval($a->argv[2]); $m = intval(DI::args()->getArgv()[2]);
} }
} }
@ -337,7 +337,7 @@ function events_content(App $a)
$start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0); $start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59); $finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
if ($a->argc > 1 && $a->argv[1] === 'json') { if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] === 'json') {
if (!empty($_GET['start'])) { if (!empty($_GET['start'])) {
$start = $_GET['start']; $start = $_GET['start'];
} }
@ -389,7 +389,7 @@ function events_content(App $a)
$events = Event::prepareListForTemplate($r); $events = Event::prepareListForTemplate($r);
} }
if ($a->argc > 1 && $a->argv[1] === 'json') { if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] === 'json') {
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode($events); echo json_encode($events);
exit(); exit();

View File

@ -24,7 +24,7 @@ function fbrowser_content(App $a)
exit(); exit();
} }
if ($a->argc == 1) { if (DI::args()->getArgc() == 1) {
exit(); exit();
} }
@ -38,14 +38,14 @@ function fbrowser_content(App $a)
$o = ''; $o = '';
switch ($a->argv[1]) { switch (DI::args()->getArgv()[1]) {
case "image": case "image":
$path = ['' => DI::l10n()->t('Photos')]; $path = ['' => DI::l10n()->t('Photos')];
$albums = false; $albums = false;
$sql_extra = ""; $sql_extra = "";
$sql_extra2 = " ORDER BY created DESC LIMIT 0, 10"; $sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";
if ($a->argc==2) { if (DI::args()->getArgc()==2) {
$photos = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' ", $photos = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' ",
intval(local_user()), intval(local_user()),
DBA::escape(Photo::CONTACT_PHOTOS), DBA::escape(Photo::CONTACT_PHOTOS),
@ -55,8 +55,8 @@ function fbrowser_content(App $a)
$albums = array_column($photos, 'album'); $albums = array_column($photos, 'album');
} }
if ($a->argc == 3) { if (DI::args()->getArgc() == 3) {
$album = $a->argv[2]; $album = DI::args()->getArgv()[2];
$sql_extra = sprintf("AND `album` = '%s' ", DBA::escape($album)); $sql_extra = sprintf("AND `album` = '%s' ", DBA::escape($album));
$sql_extra2 = ""; $sql_extra2 = "";
$path[$album] = $album; $path[$album] = $album;
@ -109,7 +109,7 @@ function fbrowser_content(App $a)
break; break;
case "file": case "file":
if ($a->argc==2) { if (DI::args()->getArgc()==2) {
$files = q("SELECT `id`, `filename`, `filetype` FROM `attach` WHERE `uid` = %d ", $files = q("SELECT `id`, `filename`, `filetype` FROM `attach` WHERE `uid` = %d ",
intval(local_user()) intval(local_user())
); );

View File

@ -92,8 +92,8 @@ function lostpass_post(App $a)
function lostpass_content(App $a) function lostpass_content(App $a)
{ {
if ($a->argc > 1) { if (DI::args()->getArgc() > 1) {
$pwdreset_token = $a->argv[1]; $pwdreset_token = DI::args()->getArgv()[1];
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'pwdreset_time', 'language'], ['pwdreset' => hash('sha256', $pwdreset_token)]); $user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'pwdreset_time', 'language'], ['pwdreset' => hash('sha256', $pwdreset_token)]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {

View File

@ -23,11 +23,10 @@ use Friendica\App;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Security\Login; use Friendica\Module\Security\Login;
use Friendica\Util\Strings;
function oexchange_init(App $a) { function oexchange_init(App $a) {
if (($a->argc > 1) && ($a->argv[1] === 'xrd')) { if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'xrd')) {
$tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl'); $tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl');
$o = Renderer::replaceMacros($tpl, ['$base' => DI::baseUrl()]); $o = Renderer::replaceMacros($tpl, ['$base' => DI::baseUrl()]);
@ -43,7 +42,7 @@ function oexchange_content(App $a) {
return $o; return $o;
} }
if (($a->argc > 1) && $a->argv[1] === 'done') { if ((DI::args()->getArgc() > 1) && DI::args()->getArgv()[1] === 'done') {
return; return;
} }

View File

@ -62,8 +62,8 @@ function photos_init(App $a) {
Nav::setSelected('home'); Nav::setSelected('home');
if ($a->argc > 1) { if (DI::args()->getArgc() > 1) {
$owner = User::getOwnerDataByNick($a->argv[1]); $owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
$is_owner = (local_user() && (local_user() == $owner['uid'])); $is_owner = (local_user() && (local_user() == $owner['uid']));
@ -134,7 +134,7 @@ function photos_init(App $a) {
function photos_post(App $a) function photos_post(App $a)
{ {
$user = User::getByNickname($a->argv[1]); $user = User::getByNickname(DI::args()->getArgv()[1]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
} }
@ -185,11 +185,11 @@ function photos_post(App $a)
$str_contact_allow .= $aclFormatter->toString(Contact::getPublicIdByUserId($page_owner_uid)); $str_contact_allow .= $aclFormatter->toString(Contact::getPublicIdByUserId($page_owner_uid));
} }
if ($a->argc > 3 && $a->argv[2] === 'album') { if (DI::args()->getArgc() > 3 && DI::args()->getArgv()[2] === 'album') {
if (!Strings::isHex($a->argv[3])) { if (!Strings::isHex(DI::args()->getArgv()[3])) {
DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album'); DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
} }
$album = hex2bin($a->argv[3]); $album = hex2bin(DI::args()->getArgv()[3]);
if ($album === DI::l10n()->t('Profile Photos') || $album === Photo::CONTACT_PHOTOS || $album === DI::l10n()->t(Photo::CONTACT_PHOTOS)) { if ($album === DI::l10n()->t('Profile Photos') || $album === Photo::CONTACT_PHOTOS || $album === DI::l10n()->t(Photo::CONTACT_PHOTOS)) {
DI::baseUrl()->redirect($_SESSION['photo_return']); DI::baseUrl()->redirect($_SESSION['photo_return']);
@ -209,7 +209,7 @@ function photos_post(App $a)
// Check if the user has responded to a delete confirmation query // Check if the user has responded to a delete confirmation query
if (!empty($_REQUEST['canceled'])) { if (!empty($_REQUEST['canceled'])) {
DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album/' . $a->argv[3]); DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album/' . DI::args()->getArgv()[3]);
} }
// RENAME photo album // RENAME photo album
@ -269,19 +269,19 @@ function photos_post(App $a)
DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album'); DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
} }
if ($a->argc > 3 && $a->argv[2] === 'image') { if (DI::args()->getArgc() > 3 && DI::args()->getArgv()[2] === 'image') {
// Check if the user has responded to a delete confirmation query for a single photo // Check if the user has responded to a delete confirmation query for a single photo
if (!empty($_POST['canceled'])) { if (!empty($_POST['canceled'])) {
DI::baseUrl()->redirect('photos/' . $a->argv[1] . '/image/' . $a->argv[3]); DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1] . '/image/' . DI::args()->getArgv()[3]);
} }
if (!empty($_POST['delete'])) { if (!empty($_POST['delete'])) {
// same as above but remove single photo // same as above but remove single photo
if ($visitor) { if ($visitor) {
$condition = ['contact-id' => $visitor, 'uid' => $page_owner_uid, 'resource-id' => $a->argv[3]]; $condition = ['contact-id' => $visitor, 'uid' => $page_owner_uid, 'resource-id' => DI::args()->getArgv()[3]];
} else { } else {
$condition = ['uid' => local_user(), 'resource-id' => $a->argv[3]]; $condition = ['uid' => local_user(), 'resource-id' => DI::args()->getArgv()[3]];
} }
$photo = DBA::selectFirst('photo', ['resource-id'], $condition); $photo = DBA::selectFirst('photo', ['resource-id'], $condition);
@ -295,22 +295,22 @@ function photos_post(App $a)
Photo::clearAlbumCache($page_owner_uid); Photo::clearAlbumCache($page_owner_uid);
} else { } else {
notice(DI::l10n()->t('Failed to delete the photo.')); notice(DI::l10n()->t('Failed to delete the photo.'));
DI::baseUrl()->redirect('photos/' . $a->argv[1] . '/image/' . $a->argv[3]); DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1] . '/image/' . DI::args()->getArgv()[3]);
} }
DI::baseUrl()->redirect('photos/' . $a->argv[1]); DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1]);
return; // NOTREACHED return; // NOTREACHED
} }
} }
if ($a->argc > 2 && (!empty($_POST['desc']) || !empty($_POST['newtag']) || isset($_POST['albname']))) { if (DI::args()->getArgc() > 2 && (!empty($_POST['desc']) || !empty($_POST['newtag']) || isset($_POST['albname']))) {
$desc = !empty($_POST['desc']) ? Strings::escapeTags(trim($_POST['desc'])) : ''; $desc = !empty($_POST['desc']) ? Strings::escapeTags(trim($_POST['desc'])) : '';
$rawtags = !empty($_POST['newtag']) ? Strings::escapeTags(trim($_POST['newtag'])) : ''; $rawtags = !empty($_POST['newtag']) ? Strings::escapeTags(trim($_POST['newtag'])) : '';
$item_id = !empty($_POST['item_id']) ? intval($_POST['item_id']) : 0; $item_id = !empty($_POST['item_id']) ? intval($_POST['item_id']) : 0;
$albname = !empty($_POST['albname']) ? trim($_POST['albname']) : ''; $albname = !empty($_POST['albname']) ? trim($_POST['albname']) : '';
$origaname = !empty($_POST['origaname']) ? Strings::escapeTags(trim($_POST['origaname'])) : ''; $origaname = !empty($_POST['origaname']) ? Strings::escapeTags(trim($_POST['origaname'])) : '';
$resource_id = $a->argv[3]; $resource_id = DI::args()->getArgv()[3];
if (!strlen($albname)) { if (!strlen($albname)) {
$albname = DateTimeFormat::localNow('Y'); $albname = DateTimeFormat::localNow('Y');
@ -815,7 +815,7 @@ function photos_content(App $a)
// photos/name/image/xxxxx/edit // photos/name/image/xxxxx/edit
// photos/name/image/xxxxx/drop // photos/name/image/xxxxx/drop
$user = User::getByNickname($a->argv[1]); $user = User::getByNickname(DI::args()->getArgv()[1]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
} }
@ -836,17 +836,17 @@ function photos_content(App $a)
// Parse arguments // Parse arguments
$datum = null; $datum = null;
if ($a->argc > 3) { if (DI::args()->getArgc() > 3) {
$datatype = $a->argv[2]; $datatype = DI::args()->getArgv()[2];
$datum = $a->argv[3]; $datum = DI::args()->getArgv()[3];
} elseif (($a->argc > 2) && ($a->argv[2] === 'upload')) { } elseif ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[2] === 'upload')) {
$datatype = 'upload'; $datatype = 'upload';
} else { } else {
$datatype = 'summary'; $datatype = 'summary';
} }
if ($a->argc > 4) { if (DI::args()->getArgc() > 4) {
$cmd = $a->argv[4]; $cmd = DI::args()->getArgv()[4];
} else { } else {
$cmd = 'view'; $cmd = 'view';
} }

View File

@ -35,7 +35,7 @@ function poco_init(App $a) {
throw new \Friendica\Network\HTTPException\ForbiddenException(); throw new \Friendica\Network\HTTPException\ForbiddenException();
} }
if ($a->argc > 1) { if (DI::args()->getArgc() > 1) {
// Only the system mode is supported // Only the system mode is supported
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }

View File

@ -50,8 +50,8 @@ function hub_post_return()
function pubsub_init(App $a) function pubsub_init(App $a)
{ {
$nick = (($a->argc > 1) ? Strings::escapeTags(trim($a->argv[1])) : ''); $nick = ((DI::args()->getArgc() > 1) ? Strings::escapeTags(trim(DI::args()->getArgv()[1])) : '');
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 ); $contact_id = ((DI::args()->getArgc() > 2) ? intval(DI::args()->getArgv()[2]) : 0 );
if ($_SERVER['REQUEST_METHOD'] === 'GET') { if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$hub_mode = Strings::escapeTags(trim($_GET['hub_mode'] ?? '')); $hub_mode = Strings::escapeTags(trim($_GET['hub_mode'] ?? ''));
@ -110,8 +110,8 @@ function pubsub_post(App $a)
Logger::log('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . DI::args()->getCommand() . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']); Logger::log('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . DI::args()->getCommand() . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
Logger::log('Data: ' . $xml, Logger::DATA); Logger::log('Data: ' . $xml, Logger::DATA);
$nick = (($a->argc > 1) ? Strings::escapeTags(trim($a->argv[1])) : ''); $nick = ((DI::args()->getArgc() > 1) ? Strings::escapeTags(trim(DI::args()->getArgv()[1])) : '');
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 ); $contact_id = ((DI::args()->getArgc() > 2) ? intval(DI::args()->getArgv()[2]) : 0 );
$importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]); $importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
if (!DBA::isResult($importer)) { if (!DBA::isResult($importer)) {

View File

@ -66,9 +66,9 @@ function pubsubhubbub_init(App $a) {
Logger::log("$hub_mode request from " . $_SERVER['REMOTE_ADDR']); Logger::log("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
if ($a->argc > 1) { if (DI::args()->getArgc() > 1) {
// Normally the url should now contain the nick name as last part of the url // Normally the url should now contain the nick name as last part of the url
$nick = $a->argv[1]; $nick = DI::args()->getArgv()[1];
} else { } else {
// Get the nick name from the topic as a fallback // Get the nick name from the topic as a fallback
$nick = $hub_topic; $nick = $hub_topic;

View File

@ -35,10 +35,9 @@ function redir_init(App $a) {
} }
$url = $_GET['url'] ?? ''; $url = $_GET['url'] ?? '';
$quiet = !empty($_GET['quiet']) ? '&quiet=1' : '';
if ($a->argc > 1 && intval($a->argv[1])) { if (DI::args()->getArgc() > 1 && intval(DI::args()->getArgv()[1])) {
$cid = intval($a->argv[1]); $cid = intval(DI::args()->getArgv()[1]);
} else { } else {
$cid = 0; $cid = 0;
} }

View File

@ -42,7 +42,7 @@ function salmon_post(App $a, $xml = '') {
Logger::log('new salmon ' . $xml, Logger::DATA); Logger::log('new salmon ' . $xml, Logger::DATA);
$nick = (($a->argc > 1) ? Strings::escapeTags(trim($a->argv[1])) : ''); $nick = ((DI::args()->getArgc() > 1) ? Strings::escapeTags(trim(DI::args()->getArgv()[1])) : '');
$importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]); $importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
if (! DBA::isResult($importer)) { if (! DBA::isResult($importer)) {

View File

@ -66,14 +66,14 @@ function settings_post(App $a)
return; return;
} }
if (($a->argc > 1) && ($a->argv[1] == 'addon')) { if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] == 'addon')) {
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/addon', 'settings_addon'); BaseModule::checkFormSecurityTokenRedirectOnError('/settings/addon', 'settings_addon');
Hook::callAll('addon_settings_post', $_POST); Hook::callAll('addon_settings_post', $_POST);
return; return;
} }
if (($a->argc > 1) && ($a->argv[1] == 'connectors')) { if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] == 'connectors')) {
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/connectors', 'settings_connectors'); BaseModule::checkFormSecurityTokenRedirectOnError('/settings/connectors', 'settings_connectors');
if (!empty($_POST['general-submit'])) { if (!empty($_POST['general-submit'])) {
@ -150,7 +150,7 @@ function settings_post(App $a)
return; return;
} }
if (($a->argc > 1) && ($a->argv[1] === 'features')) { if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'features')) {
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/features', 'settings_features'); BaseModule::checkFormSecurityTokenRedirectOnError('/settings/features', 'settings_features');
foreach ($_POST as $k => $v) { foreach ($_POST as $k => $v) {
if (strpos($k, 'feature_') === 0) { if (strpos($k, 'feature_') === 0) {
@ -418,11 +418,11 @@ function settings_content(App $a)
return; return;
} }
if (($a->argc > 1) && ($a->argv[1] === 'oauth')) { if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'oauth')) {
if (($a->argc > 3) && ($a->argv[2] === 'delete')) { if ((DI::args()->getArgc() > 3) && (DI::args()->getArgv()[2] === 'delete')) {
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/oauth', 'settings_oauth', 't'); BaseModule::checkFormSecurityTokenRedirectOnError('/settings/oauth', 'settings_oauth', 't');
DBA::delete('application-token', ['application-id' => $a->argv[3], 'uid' => local_user()]); DBA::delete('application-token', ['application-id' => DI::args()->getArgv()[3], 'uid' => local_user()]);
DI::baseUrl()->redirect('settings/oauth/', true); DI::baseUrl()->redirect('settings/oauth/', true);
return; return;
} }
@ -443,7 +443,7 @@ function settings_content(App $a)
return $o; return $o;
} }
if (($a->argc > 1) && ($a->argv[1] === 'addon')) { if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'addon')) {
$addon_settings_forms = []; $addon_settings_forms = [];
foreach (DI::dba()->selectToArray('hook', ['file', 'function'], ['hook' => 'addon_settings']) as $hook) { foreach (DI::dba()->selectToArray('hook', ['file', 'function'], ['hook' => 'addon_settings']) as $hook) {
@ -462,7 +462,7 @@ function settings_content(App $a)
return $o; return $o;
} }
if (($a->argc > 1) && ($a->argv[1] === 'features')) { if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'features')) {
$arr = []; $arr = [];
$features = Feature::get(); $features = Feature::get();
@ -484,7 +484,7 @@ function settings_content(App $a)
return $o; return $o;
} }
if (($a->argc > 1) && ($a->argv[1] === 'connectors')) { if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'connectors')) {
$accept_only_sharer = intval(DI::pConfig()->get(local_user(), 'system', 'accept_only_sharer')); $accept_only_sharer = intval(DI::pConfig()->get(local_user(), 'system', 'accept_only_sharer'));
$disable_cw = intval(DI::pConfig()->get(local_user(), 'system', 'disable_cw')); $disable_cw = intval(DI::pConfig()->get(local_user(), 'system', 'disable_cw'));
$no_intelligent_shortening = intval(DI::pConfig()->get(local_user(), 'system', 'no_intelligent_shortening')); $no_intelligent_shortening = intval(DI::pConfig()->get(local_user(), 'system', 'no_intelligent_shortening'));

View File

@ -22,11 +22,12 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\Post; use Friendica\Model\Post;
function share_init(App $a) { function share_init(App $a) {
$post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); $post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0);
if (!$post_id || !local_user()) { if (!$post_id || !local_user()) {
exit(); exit();

View File

@ -49,7 +49,7 @@ function tagger_content(App $a) {
return; return;
} }
$item_id = (($a->argc > 1) ? Strings::escapeTags(trim($a->argv[1])) : 0); $item_id = ((DI::args()->getArgc() > 1) ? Strings::escapeTags(trim(DI::args()->getArgv()[1])) : 0);
Logger::log('tagger: tag ' . $term . ' item ' . $item_id); Logger::log('tagger: tag ' . $term . ' item ' . $item_id);

View File

@ -88,12 +88,12 @@ function tagrm_content(App $a)
// NOTREACHED // NOTREACHED
} }
if ($a->argc == 3) { if (DI::args()->getArgc()== 3) {
update_tags($a->argv[1], [Strings::escapeTags(trim(hex2bin($a->argv[2])))]); update_tags(DI::args()->getArgv()[1], [Strings::escapeTags(trim(hex2bin(DI::args()->getArgv()[2])))]);
DI::baseUrl()->redirect($photo_return); DI::baseUrl()->redirect($photo_return);
} }
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); $item_id = ((DI::args()->getArgc()> 1) ? intval(DI::args()->getArgv()[1]) : 0);
if (!$item_id) { if (!$item_id) {
DI::baseUrl()->redirect($photo_return); DI::baseUrl()->redirect($photo_return);
// NOTREACHED // NOTREACHED

View File

@ -29,14 +29,14 @@ use Friendica\Module\Contact;
function update_contact_content(App $a) function update_contact_content(App $a)
{ {
if (!empty($a->argv[1]) && (!empty($_GET['force']) || !DI::pConfig()->get(local_user(), 'system', 'no_auto_update'))) { if (!empty(DI::args()->getArgv()[1]) && (!empty($_GET['force']) || !DI::pConfig()->get(local_user(), 'system', 'no_auto_update'))) {
if (!empty($_GET['item'])) { if (!empty($_GET['item'])) {
$item = Post::selectFirst(['parent'], ['id' => $_GET['item']]); $item = Post::selectFirst(['parent'], ['id' => $_GET['item']]);
$parentid = $item['parent'] ?? 0; $parentid = $item['parent'] ?? 0;
} else { } else {
$parentid = 0; $parentid = 0;
} }
$text = Contact::getConversationsHMTL($a, $a->argv[1], true, $parentid); $text = Contact::getConversationsHMTL($a, DI::args()->getArgv()[1], true, $parentid);
} else { } else {
$text = ''; $text = '';
} }

View File

@ -42,8 +42,8 @@ function videos_init(App $a)
Nav::setSelected('home'); Nav::setSelected('home');
if ($a->argc > 1) { if (DI::args()->getArgc() > 1) {
$owner = User::getOwnerDataByNick($a->argv[1]); $owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
if (empty($owner)) { if (empty($owner)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
} }
@ -64,7 +64,7 @@ function videos_init(App $a)
function videos_post(App $a) function videos_post(App $a)
{ {
$user = User::getByNickname($a->argv[1]); $user = User::getByNickname(DI::args()->getArgv()[1]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
} }
@ -73,7 +73,7 @@ function videos_post(App $a)
DI::baseUrl()->redirect('videos/' . $user['nickname']); DI::baseUrl()->redirect('videos/' . $user['nickname']);
} }
if (($a->argc == 2) && !empty($_POST['delete']) && !empty($_POST['id'])) { if ((DI::args()->getArgc() == 2) && !empty($_POST['delete']) && !empty($_POST['id'])) {
$video_id = $_POST['id']; $video_id = $_POST['id'];
if (Attach::exists(['id' => $video_id, 'uid' => local_user()])) { if (Attach::exists(['id' => $video_id, 'uid' => local_user()])) {
@ -105,7 +105,7 @@ function videos_content(App $a)
// videos/name/video/xxxxx // videos/name/video/xxxxx
// videos/name/video/xxxxx/edit // videos/name/video/xxxxx/edit
$user = User::getByNickname($a->argv[1]); $user = User::getByNickname(DI::args()->getArgv()[1]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
} }
@ -127,9 +127,9 @@ function videos_content(App $a)
// //
// Parse arguments // Parse arguments
// //
if ($a->argc > 3) { if (DI::args()->getArgc() > 3) {
$datatype = $a->argv[2]; $datatype = DI::args()->getArgv()[2];
} elseif(($a->argc > 2) && ($a->argv[2] === 'upload')) { } elseif((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[2] === 'upload')) {
$datatype = 'upload'; $datatype = 'upload';
} else { } else {
$datatype = 'summary'; $datatype = 'summary';

View File

@ -31,8 +31,8 @@ function wall_attach_post(App $a) {
$r_json = (!empty($_GET['response']) && $_GET['response']=='json'); $r_json = (!empty($_GET['response']) && $_GET['response']=='json');
if ($a->argc > 1) { if (DI::args()->getArgc() > 1) {
$nick = $a->argv[1]; $nick = DI::args()->getArgv()[1];
$r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1", $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
DBA::escape($nick) DBA::escape($nick)
); );

View File

@ -43,9 +43,9 @@ function wall_upload_post(App $a, $desktopmode = true)
$r_json = (!empty($_GET['response']) && $_GET['response'] == 'json'); $r_json = (!empty($_GET['response']) && $_GET['response'] == 'json');
$album = trim($_GET['album'] ?? ''); $album = trim($_GET['album'] ?? '');
if ($a->argc > 1) { if (DI::args()->getArgc() > 1) {
if (empty($_FILES['media'])) { if (empty($_FILES['media'])) {
$nick = $a->argv[1]; $nick = DI::args()->getArgv()[1];
$user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['nickname' => $nick, 'blocked' => false]); $user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['nickname' => $nick, 'blocked' => false]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
if ($r_json) { if ($r_json) {

View File

@ -39,7 +39,7 @@ function wallmessage_post(App $a) {
$subject = (!empty($_REQUEST['subject']) ? Strings::escapeTags(trim($_REQUEST['subject'])) : ''); $subject = (!empty($_REQUEST['subject']) ? Strings::escapeTags(trim($_REQUEST['subject'])) : '');
$body = (!empty($_REQUEST['body']) ? Strings::escapeHtml(trim($_REQUEST['body'])) : ''); $body = (!empty($_REQUEST['body']) ? Strings::escapeHtml(trim($_REQUEST['body'])) : '');
$recipient = (($a->argc > 1) ? Strings::escapeTags($a->argv[1]) : ''); $recipient = ((DI::args()->getArgc() > 1) ? Strings::escapeTags(DI::args()->getArgv()[1]) : '');
if ((! $recipient) || (! $body)) { if ((! $recipient) || (! $body)) {
return; return;
} }
@ -97,7 +97,7 @@ function wallmessage_content(App $a) {
return; return;
} }
$recipient = (($a->argc > 1) ? $a->argv[1] : ''); $recipient = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
if (!$recipient) { if (!$recipient) {
notice(DI::l10n()->t('No recipient.')); notice(DI::l10n()->t('No recipient.'));