}
// $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);
- if (!empty($a->argv[$argid])) {
- $data = explode(".", $a->argv[$argid]);
+ if (!empty(DI::args()->getArgv()[$argid])) {
+ $data = explode(".", DI::args()->getArgv()[$argid]);
if (count($data) > 1) {
list($user, $null) = $data;
}
}
$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);
}
// params
- $id = intval($a->argv[3] ?? 0);
+ $id = intval(DI::args()->getArgv()[3] ?? 0);
if ($id == 0) {
$id = intval($_REQUEST['id'] ?? 0);
// Hotot workaround
if ($id == 0) {
- $id = intval($a->argv[4] ?? 0);
+ $id = intval(DI::args()->getArgv()[4] ?? 0);
}
Logger::log('API: api_statuses_show: ' . $id);
}
// params
- $id = intval($a->argv[3] ?? 0);
+ $id = intval(DI::args()->getArgv()[3] ?? 0);
$since_id = intval($_REQUEST['since_id'] ?? 0);
$max_id = intval($_REQUEST['max_id'] ?? 0);
$count = intval($_REQUEST['count'] ?? 20);
// Hotot workaround
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]);
api_get_user($a);
// params
- $id = intval($a->argv[3] ?? 0);
+ $id = intval(DI::args()->getArgv()[3] ?? 0);
if ($id == 0) {
$id = intval($_REQUEST['id'] ?? 0);
// Hotot workaround
if ($id == 0) {
- $id = intval($a->argv[4] ?? 0);
+ $id = intval(DI::args()->getArgv()[4] ?? 0);
}
Logger::log('API: api_statuses_repeat: '.$id);
api_get_user($a);
// params
- $id = intval($a->argv[3] ?? 0);
+ $id = intval(DI::args()->getArgv()[3] ?? 0);
if ($id == 0) {
$id = intval($_REQUEST['id'] ?? 0);
// Hotot workaround
if ($id == 0) {
- $id = intval($a->argv[4] ?? 0);
+ $id = intval(DI::args()->getArgv()[4] ?? 0);
}
Logger::log('API: api_statuses_destroy: '.$id);
// for versioned api.
/// @TODO We need a better global soluton
$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;
}
- if ($a->argc <= $action_argv_id) {
+ if (DI::args()->getArgc() <= $action_argv_id) {
throw new BadRequestException("Invalid request.");
}
- $action = str_replace("." . $type, "", $a->argv[$action_argv_id]);
- if ($a->argc == $action_argv_id + 2) {
- $itemid = intval($a->argv[$action_argv_id + 1] ?? 0);
+ $action = str_replace("." . $type, "", DI::args()->getArgv()[$action_argv_id]);
+ if (DI::args()->getArgc() == $action_argv_id + 2) {
+ $itemid = intval(DI::args()->getArgv()[$action_argv_id + 1] ?? 0);
} else {
$itemid = intval($_REQUEST['id'] ?? 0);
}
if (api_user() === false) {
throw new ForbiddenException();
}
- $verb = strtolower($a->argv[3]);
+ $verb = strtolower(DI::args()->getArgv()[3]);
$verb = preg_replace("|\..*$|", "", $verb);
$id = $_REQUEST['id'] ?? 0;
if (api_user() === false) {
throw new ForbiddenException();
}
- if ($a->argc!==3) {
+ if (DI::args()->getArgc()!==3) {
throw new BadRequestException("Invalid argument count");
}
if (api_user() === false || $user_info === false) {
throw new ForbiddenException();
}
- if ($a->argc !== 4) {
+ if (DI::args()->getArgc() !== 4) {
throw new BadRequestException("Invalid argument count");
}
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.'));
}
// if it's a json request abort here becaus we don't
// 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;
}
- $owner = User::getOwnerDataByNick($a->argv[1]);
+ $owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
if (empty($owner)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
function cal_content(App $a)
{
- $owner = User::getOwnerDataByNick($a->argv[1]);
+ $owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
if (empty($owner)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
$ignored = (!empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0);
$format = 'ical';
- if ($a->argc == 4 && $a->argv[2] == 'export') {
+ if (DI::args()->getArgc() == 4 && DI::args()->getArgv()[2] == 'export') {
$mode = 'export';
- $format = $a->argv[3];
+ $format = DI::args()->getArgv()[3];
}
// Setup permissions structures
$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'])) {
$start = $_GET['start'];
}
// transform the event in a usable array
$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);
exit();
}
use Friendica\Network\HTTPException;
use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\DFRN;
-use Friendica\Util\Strings;
function display_init(App $a)
{
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()) {
return;
}
- $nick = (($a->argc > 1) ? $a->argv[1] : '');
+ $nick = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
$item = null;
$item_user = local_user();
$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 ($a->argc == 2) {
+ if (DI::args()->getArgc() == 2) {
$nick = '';
// Does the local user have this item?
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)) {
$nick = $a->user['nickname'];
}
// Is this item private but could be visible to the remove visitor?
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 (!Contact::isFollower(remote_user(), $item['uid'])) {
$item = null;
// Is it an item with uid=0?
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') {
- $uri_id = $a->argv[2];
+ } elseif (DI::args()->getArgc() >= 3 && $nick == 'feed-item') {
+ $uri_id = DI::args()->getArgv()[2];
if (substr($uri_id, -5) == '.atom') {
$uri_id = substr($uri_id, 0, -5);
}
return;
}
- if ($a->argc >= 3 && $nick == 'feed-item') {
- displayShowFeed($item['uri-id'], $item['uid'], $a->argc > 3 && $a->argv[3] == 'conversation.atom');
+ if (DI::args()->getArgc() >= 3 && $nick == 'feed-item') {
+ 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')) {
$parent_uri_id = $item['parent-uri-id'];
}
} 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;
- if ($a->argc == 2) {
+ if (DI::args()->getArgc() == 2) {
$fields = ['uri-id', 'parent-uri-id', 'uid'];
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);
if (DBA::isResult($item)) {
$uri_id = $item['uri-id'];
}
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'])) {
$uri_id = $item['uri-id'];
$parent_uri_id = $item['parent-uri-id'];
}
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);
if (DBA::isResult($item)) {
$uri_id = $item['uri-id'];
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) {
notice(DI::l10n()->t('Item not found'));
// If it's a json request abort here because we don't
// need the widget data
- if ($a->argc > 1 && $a->argv[1] === 'json') {
+ if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] === 'json') {
return;
}
return Login::form();
}
- if ($a->argc == 1) {
+ if (DI::args()->getArgc() == 1) {
$_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",
- intval($a->argv[2]),
+ intval(DI::args()->getArgv()[2]),
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",
- intval($a->argv[2]),
+ intval(DI::args()->getArgv()[2]),
intval(local_user())
);
}
$m = 0;
$ignored = !empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0;
- if ($a->argc > 1) {
- if ($a->argc > 2 && $a->argv[1] == 'event') {
+ if (DI::args()->getArgc() > 1) {
+ if (DI::args()->getArgc() > 2 && DI::args()->getArgv()[1] == 'event') {
$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';
- $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';
- $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';
$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';
- $y = intval($a->argv[1]);
- $m = intval($a->argv[2]);
+ $y = intval(DI::args()->getArgv()[1]);
+ $m = intval(DI::args()->getArgv()[2]);
}
}
$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);
- if ($a->argc > 1 && $a->argv[1] === 'json') {
+ if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] === 'json') {
if (!empty($_GET['start'])) {
$start = $_GET['start'];
}
$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');
echo json_encode($events);
exit();
exit();
}
- if ($a->argc == 1) {
+ if (DI::args()->getArgc() == 1) {
exit();
}
$o = '';
- switch ($a->argv[1]) {
+ switch (DI::args()->getArgv()[1]) {
case "image":
$path = ['' => DI::l10n()->t('Photos')];
$albums = false;
$sql_extra = "";
$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' ",
intval(local_user()),
DBA::escape(Photo::CONTACT_PHOTOS),
$albums = array_column($photos, 'album');
}
- if ($a->argc == 3) {
- $album = $a->argv[2];
+ if (DI::args()->getArgc() == 3) {
+ $album = DI::args()->getArgv()[2];
$sql_extra = sprintf("AND `album` = '%s' ", DBA::escape($album));
$sql_extra2 = "";
$path[$album] = $album;
break;
case "file":
- if ($a->argc==2) {
+ if (DI::args()->getArgc()==2) {
$files = q("SELECT `id`, `filename`, `filetype` FROM `attach` WHERE `uid` = %d ",
intval(local_user())
);
function lostpass_content(App $a)
{
- if ($a->argc > 1) {
- $pwdreset_token = $a->argv[1];
+ if (DI::args()->getArgc() > 1) {
+ $pwdreset_token = DI::args()->getArgv()[1];
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'pwdreset_time', 'language'], ['pwdreset' => hash('sha256', $pwdreset_token)]);
if (!DBA::isResult($user)) {
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Module\Security\Login;
-use Friendica\Util\Strings;
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');
$o = Renderer::replaceMacros($tpl, ['$base' => DI::baseUrl()]);
return $o;
}
- if (($a->argc > 1) && $a->argv[1] === 'done') {
+ if ((DI::args()->getArgc() > 1) && DI::args()->getArgv()[1] === 'done') {
return;
}
Nav::setSelected('home');
- if ($a->argc > 1) {
- $owner = User::getOwnerDataByNick($a->argv[1]);
+ if (DI::args()->getArgc() > 1) {
+ $owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
$is_owner = (local_user() && (local_user() == $owner['uid']));
function photos_post(App $a)
{
- $user = User::getByNickname($a->argv[1]);
+ $user = User::getByNickname(DI::args()->getArgv()[1]);
if (!DBA::isResult($user)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
$str_contact_allow .= $aclFormatter->toString(Contact::getPublicIdByUserId($page_owner_uid));
}
- if ($a->argc > 3 && $a->argv[2] === 'album') {
- if (!Strings::isHex($a->argv[3])) {
+ if (DI::args()->getArgc() > 3 && DI::args()->getArgv()[2] === 'album') {
+ if (!Strings::isHex(DI::args()->getArgv()[3])) {
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)) {
DI::baseUrl()->redirect($_SESSION['photo_return']);
// Check if the user has responded to a delete confirmation query
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
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
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'])) {
// same as above but remove single photo
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 {
- $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::clearAlbumCache($page_owner_uid);
} else {
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
}
}
- 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'])) : '';
$rawtags = !empty($_POST['newtag']) ? Strings::escapeTags(trim($_POST['newtag'])) : '';
$item_id = !empty($_POST['item_id']) ? intval($_POST['item_id']) : 0;
$albname = !empty($_POST['albname']) ? trim($_POST['albname']) : '';
$origaname = !empty($_POST['origaname']) ? Strings::escapeTags(trim($_POST['origaname'])) : '';
- $resource_id = $a->argv[3];
+ $resource_id = DI::args()->getArgv()[3];
if (!strlen($albname)) {
$albname = DateTimeFormat::localNow('Y');
// photos/name/image/xxxxx/edit
// photos/name/image/xxxxx/drop
- $user = User::getByNickname($a->argv[1]);
+ $user = User::getByNickname(DI::args()->getArgv()[1]);
if (!DBA::isResult($user)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
// Parse arguments
$datum = null;
- if ($a->argc > 3) {
- $datatype = $a->argv[2];
- $datum = $a->argv[3];
- } elseif (($a->argc > 2) && ($a->argv[2] === 'upload')) {
+ if (DI::args()->getArgc() > 3) {
+ $datatype = DI::args()->getArgv()[2];
+ $datum = DI::args()->getArgv()[3];
+ } elseif ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[2] === 'upload')) {
$datatype = 'upload';
} else {
$datatype = 'summary';
}
- if ($a->argc > 4) {
- $cmd = $a->argv[4];
+ if (DI::args()->getArgc() > 4) {
+ $cmd = DI::args()->getArgv()[4];
} else {
$cmd = 'view';
}
throw new \Friendica\Network\HTTPException\ForbiddenException();
}
- if ($a->argc > 1) {
+ if (DI::args()->getArgc() > 1) {
// Only the system mode is supported
throw new \Friendica\Network\HTTPException\NotFoundException();
}
function pubsub_init(App $a)
{
- $nick = (($a->argc > 1) ? Strings::escapeTags(trim($a->argv[1])) : '');
- $contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 );
+ $nick = ((DI::args()->getArgc() > 1) ? Strings::escapeTags(trim(DI::args()->getArgv()[1])) : '');
+ $contact_id = ((DI::args()->getArgc() > 2) ? intval(DI::args()->getArgv()[2]) : 0 );
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$hub_mode = Strings::escapeTags(trim($_GET['hub_mode'] ?? ''));
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);
- $nick = (($a->argc > 1) ? Strings::escapeTags(trim($a->argv[1])) : '');
- $contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 );
+ $nick = ((DI::args()->getArgc() > 1) ? Strings::escapeTags(trim(DI::args()->getArgv()[1])) : '');
+ $contact_id = ((DI::args()->getArgc() > 2) ? intval(DI::args()->getArgv()[2]) : 0 );
$importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
if (!DBA::isResult($importer)) {
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
- $nick = $a->argv[1];
+ $nick = DI::args()->getArgv()[1];
} else {
// Get the nick name from the topic as a fallback
$nick = $hub_topic;
}
$url = $_GET['url'] ?? '';
- $quiet = !empty($_GET['quiet']) ? '&quiet=1' : '';
- if ($a->argc > 1 && intval($a->argv[1])) {
- $cid = intval($a->argv[1]);
+ if (DI::args()->getArgc() > 1 && intval(DI::args()->getArgv()[1])) {
+ $cid = intval(DI::args()->getArgv()[1]);
} else {
$cid = 0;
}
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]);
if (! DBA::isResult($importer)) {
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');
Hook::callAll('addon_settings_post', $_POST);
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');
if (!empty($_POST['general-submit'])) {
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');
foreach ($_POST as $k => $v) {
if (strpos($k, 'feature_') === 0) {
return;
}
- if (($a->argc > 1) && ($a->argv[1] === 'oauth')) {
- if (($a->argc > 3) && ($a->argv[2] === 'delete')) {
+ if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'oauth')) {
+ if ((DI::args()->getArgc() > 3) && (DI::args()->getArgv()[2] === 'delete')) {
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);
return;
}
return $o;
}
- if (($a->argc > 1) && ($a->argv[1] === 'addon')) {
+ if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'addon')) {
$addon_settings_forms = [];
foreach (DI::dba()->selectToArray('hook', ['file', 'function'], ['hook' => 'addon_settings']) as $hook) {
return $o;
}
- if (($a->argc > 1) && ($a->argv[1] === 'features')) {
+ if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'features')) {
$arr = [];
$features = Feature::get();
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'));
$disable_cw = intval(DI::pConfig()->get(local_user(), 'system', 'disable_cw'));
$no_intelligent_shortening = intval(DI::pConfig()->get(local_user(), 'system', 'no_intelligent_shortening'));
use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Post;
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()) {
exit();
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);
// NOTREACHED
}
- if ($a->argc == 3) {
- update_tags($a->argv[1], [Strings::escapeTags(trim(hex2bin($a->argv[2])))]);
+ if (DI::args()->getArgc()== 3) {
+ update_tags(DI::args()->getArgv()[1], [Strings::escapeTags(trim(hex2bin(DI::args()->getArgv()[2])))]);
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) {
DI::baseUrl()->redirect($photo_return);
// NOTREACHED
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'])) {
$item = Post::selectFirst(['parent'], ['id' => $_GET['item']]);
$parentid = $item['parent'] ?? 0;
} else {
$parentid = 0;
}
- $text = Contact::getConversationsHMTL($a, $a->argv[1], true, $parentid);
+ $text = Contact::getConversationsHMTL($a, DI::args()->getArgv()[1], true, $parentid);
} else {
$text = '';
}
Nav::setSelected('home');
- if ($a->argc > 1) {
- $owner = User::getOwnerDataByNick($a->argv[1]);
+ if (DI::args()->getArgc() > 1) {
+ $owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
if (empty($owner)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
function videos_post(App $a)
{
- $user = User::getByNickname($a->argv[1]);
+ $user = User::getByNickname(DI::args()->getArgv()[1]);
if (!DBA::isResult($user)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
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'];
if (Attach::exists(['id' => $video_id, 'uid' => local_user()])) {
// videos/name/video/xxxxx
// videos/name/video/xxxxx/edit
- $user = User::getByNickname($a->argv[1]);
+ $user = User::getByNickname(DI::args()->getArgv()[1]);
if (!DBA::isResult($user)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
//
// Parse arguments
//
- if ($a->argc > 3) {
- $datatype = $a->argv[2];
- } elseif(($a->argc > 2) && ($a->argv[2] === 'upload')) {
+ if (DI::args()->getArgc() > 3) {
+ $datatype = DI::args()->getArgv()[2];
+ } elseif((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[2] === 'upload')) {
$datatype = 'upload';
} else {
$datatype = 'summary';
$r_json = (!empty($_GET['response']) && $_GET['response']=='json');
- if ($a->argc > 1) {
- $nick = $a->argv[1];
+ if (DI::args()->getArgc() > 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",
DBA::escape($nick)
);
$r_json = (!empty($_GET['response']) && $_GET['response'] == 'json');
$album = trim($_GET['album'] ?? '');
- if ($a->argc > 1) {
+ if (DI::args()->getArgc() > 1) {
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]);
if (!DBA::isResult($user)) {
if ($r_json) {
$subject = (!empty($_REQUEST['subject']) ? Strings::escapeTags(trim($_REQUEST['subject'])) : '');
$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)) {
return;
}
return;
}
- $recipient = (($a->argc > 1) ? $a->argv[1] : '');
+ $recipient = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
if (!$recipient) {
notice(DI::l10n()->t('No recipient.'));