$cdata = self::getPublicAndUserContactID($contact['id'], $contact['uid']);
- DI::notification()->deleteForUserByVerb($contact['uid'], Activity::FOLLOW, ['actor-id' => $cdata['public']]);
+ DI::notification()->deleteForUserByVerb($contact['uid'], Activity::FOLLOW, ['actor-id' => $contact['public']]);
}
/**
} else {
$ret = [];
foreach ($mails as $mail) {
- $ret[] = $this->directMessage->createFromMailId($mail['id'], $uid, $request['getText'] ?? '');
+ $ret[] = $this->directMessage->createFromMailId($mail['id'], $uid, $this->getRequestValue($request, 'getText', ''));
}
$success = ['success' => true, 'search_results' => $ret];
}
// params
// error if no gid specified
- if ($request['gid'] == 0 || $request['name'] == "") {
+ if ($request['gid'] == 0 || $request['name'] == '') {
throw new BadRequestException('gid or name not specified');
}
throw new BadRequestException('Invalid argument count');
}
- $id = intval($request['id'] ?? 0);
+ $id = intval($this->getRequestValue($request, 'id', 0));
$include_entities = $this->getRequestValue($request, 'include_entities', false);
$start = max(0, ($page - 1) * $count);
if ($id == 0) {
- $id = $request['id'] ?? 0;
+ $id = $this->getRequestValue($request, 'id', 0);
}
Logger::info(BaseApi::LOG_PREFIX . '{subaction}', ['module' => 'api', 'action' => 'conversation', 'subaction' => 'show', 'id' => $id]);
if (($this->parameters['extension'] ?? '') == 'xml') {
$hash = [
'remaining-hits' => '150',
- '@attributes' => ["type" => "integer"],
+ '@attributes' => ['type' => 'integer'],
'hourly-limit' => '150',
- '@attributes2' => ["type" => "integer"],
+ '@attributes2' => ['type' => 'integer'],
'reset-time' => DateTimeFormat::utc('now + 1 hour', DateTimeFormat::ATOM),
- '@attributes3' => ["type" => "datetime"],
+ '@attributes3' => ['type' => 'datetime'],
'reset_time_in_seconds' => strtotime('now + 1 hour'),
- '@attributes4' => ["type" => "integer"],
+ '@attributes4' => ['type' => 'integer'],
];
} else {
$hash = [
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
$uid = BaseApi::getCurrentUserID();
- $this->getMessages($request, $uid, ["`parent-uri` = ?", $request['uri'] ?? '']);
+ $this->getMessages($request, $uid, ["`parent-uri` = ?", $this->getRequestValue($request, 'uri', '')]);
}
}
$id = $this->getRequestValue($request, 'id', 0);
$id = $this->getRequestValue($this->parameters, 'id', $id);
- $verbose = $this->getRequestValue($request, 'friendica_verbose', false);
-
- $parenturi = $request['friendica_parenturi'] ?? '';
+ $verbose = $this->getRequestValue($request, 'friendica_verbose', false);
+ $parenturi = $this->getRequestValue($request, 'friendica_parenturi', '');
// error if no id or parenturi specified (for clients posting parent-uri as well)
if ($verbose && $id == 0 && $parenturi == "") {
return;
}
- $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, 0);
+ $cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), 0);
if (empty($cid)) {
throw new NotFoundException('Recipient not found');
}
$id = Mail::send($cdata['user'], $request['text'], $sub, $replyto);
if ($id > -1) {
- $ret = $this->directMessage->createFromMailId($id, $uid, $request['getText'] ?? '');
+ $ret = $this->directMessage->createFromMailId($id, $uid, $this->getRequestValue($request, 'getText', ''));
} else {
$ret = ['error' => $id];
}
$params['order'] = ['id'];
}
- $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, 0);
+ $cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), 0);
if (!empty($cid)) {
$cdata = Contact::getPublicAndUserContactID($cid, $uid);
if (!empty($cdata['user'])) {
$ret = [];
foreach ($ids as $id) {
- $ret[] = $this->directMessage->createFromMailId($id, $uid, $request['getText'] ?? '');
+ $ret[] = $this->directMessage->createFromMailId($id, $uid, $this->getRequestValue($request, 'getText', ''));
}
self::setLinkHeader();
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- $id = $request['id'] ?? 0;
+ $id = $this->getRequestValue($request, 'id', 0);
if (empty($id)) {
throw new BadRequestException('Item id not specified');
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- $id = $request['id'] ?? 0;
+ $id = $this->getRequestValue($request, 'id', 0);
if (empty($id)) {
throw new BadRequestException('Item id not specified');
$uid = BaseApi::getCurrentUserID();
// Expected value for user_id parameter: public/user contact id
- $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid);
+ $cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), $uid);
$cursor = $this->getRequestValue($request, 'cursor', -1);
$stringify_ids = $this->getRequestValue($request, 'stringify_ids', false);
$count = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT);
$uid = BaseApi::getCurrentUserID();
// Expected value for user_id parameter: public/user contact id
- $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid);
+ $cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), $uid);
$cursor = $this->getRequestValue($request, 'cursor', -1);
$skip_status = $this->getRequestValue($request, 'skip_status', false);
$include_user_entities = $this->getRequestValue($request, 'include_user_entities', false);
$uid = BaseApi::getCurrentUserID();
// Expected value for user_id parameter: public/user contact id
- $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid);
+ $cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), $uid);
$cursor = $this->getRequestValue($request, 'cursor', -1);
$stringify_ids = $this->getRequestValue($request, 'stringify_ids', false);
$count = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT);
$uid = BaseApi::getCurrentUserID();
// Expected value for user_id parameter: public/user contact id
- $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid);
+ $cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), $uid);
$cursor = $this->getRequestValue($request, 'cursor', -1);
$skip_status = $this->getRequestValue($request, 'skip_status', false);
$include_user_entities = $this->getRequestValue($request, 'include_user_entities', false);
throw new HTTPException\NotFoundException('Error Processing Request');
}
- $contact_id = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, 0);
+ $contact_id = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), 0);
if (empty($contact_id)) {
Logger::notice(BaseApi::LOG_PREFIX . 'No user_id specified', ['module' => 'api', 'action' => 'friendships_destroy']);
self::checkAllowedScope(self::SCOPE_READ);
$uid = BaseApi::getCurrentUserID();
- $source_cid = BaseApi::getContactIDForSearchterm($request['source_screen_name'] ?? '', '', $request['source_id'] ?? 0, $uid);
-
- $target_cid = BaseApi::getContactIDForSearchterm($request['target_screen_name'] ?? '', '', $request['target_id'] ?? 0, $uid);
+ $source_cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'source_screen_name', ''), '', $this->getRequestValue($request, 'source_id', 0), $uid);
+ $target_cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'target_screen_name', ''), '', $this->getRequestValue($request, 'target_id', 0), $uid);
$source = Contact::getById($source_cid);
if (empty($source)) {
Logger::info('api_statuses_user_timeline', ['api_user' => $uid, '_REQUEST' => $request]);
- $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid);
+ $cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), $uid);
$count = $this->getRequestValue($request, 'count', 20, 1, 100);
$page = $this->getRequestValue($request, 'page', 1, 1);
$since_id = $this->getRequestValue($request, 'since_id', 0, 0);
$uid = BaseApi::getCurrentUserID();
if (empty($this->parameters['id'])) {
- $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid);
+ $cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), $uid);
} else {
$cid = (int)$this->parameters['id'];
}
{
protected function rawContent(array $request = [])
{
- $last_update = $request['last_update'] ?? '';
+ $last_update = $this->getRequestValue($request, 'last_update', '');
$nocache = !empty($request['nocache']) && local_user();
$type = null;