return $data;
}
-}
\ No newline at end of file
+}
$uid = BaseApi::getCurrentUserID();
// params
- $name = $request['name'] ?? '';
- $json = json_decode($request['json'], true);
+ $name = $request['name'] ?? '';
+ $json = json_decode($request['json'], true);
$users = $json['user'];
// error if no name specified
// add members
$erroraddinguser = false;
- $errorusers = [];
+ $errorusers = [];
foreach ($users as $user) {
$cid = $user['cid'];
if (DBA::exists('contact', ['id' => $cid, 'uid' => $uid])) {
Group::addMember($gid, $cid);
} else {
$erroraddinguser = true;
- $errorusers[] = $cid;
+ $errorusers[] = $cid;
}
}
$grps = [];
foreach ($groups as $rr) {
$members = Contact\Group::getById($rr['id']);
- $users = [];
+ $users = [];
if ($type == 'xml') {
$user_element = 'users';
- $k = 0;
+ $k = 0;
foreach ($members as $member) {
- $user = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
- $users[$k++.':user'] = $user;
+ $users[$k++.':user'] = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
}
} else {
$user_element = 'user';
foreach ($members as $member) {
- $user = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
- $users[] = $user;
+ $users[] = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
}
}
$grps[] = ['name' => $rr['name'], 'gid' => $rr['id'], $user_element => $users];
throw new HTTPException\BadRequestException('No photo id.');
}
- $scale = (!empty($request['scale']) ? intval($request['scale']) : false);
+ $scale = (!empty($request['scale']) ? intval($request['scale']) : false);
$photo_id = $request['photo_id'];
// prepare json/xml output with data from database for the requested photo
$result = false;
if (count($updated_fields) > 0) {
$nothingtodo = false;
- $result = Photo::update($updated_fields, ['uid' => $uid, 'resource-id' => $photo_id, 'album' => $album]);
+ $result = Photo::update($updated_fields, ['uid' => $uid, 'resource-id' => $photo_id, 'album' => $album]);
} else {
$nothingtodo = true;
}
if (!empty($_FILES['media'])) {
$nothingtodo = false;
- $photo = Photo::upload($uid, $_FILES['media'], $album, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc, $photo_id);
+ $photo = Photo::upload($uid, $_FILES['media'], $album, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc, $photo_id);
if (!empty($photo)) {
$data = ['photo' => $this->friendicaPhoto->createFromId($photo['resource_id'], null, $uid, $type)];
$this->response->exit('photo_update', $data, $this->parameters['extension'] ?? null);
}
// output for client
- $skip_status = $request['skip_status'] ?? false;
+ $skip_status = filter_var($request['skip_status'] ?? false, FILTER_VALIDATE_BOOLEAN);
$user_info = DI::twitterUser()->createFromUserId($uid, $skip_status)->toArray();
use Friendica\Util\DateTimeFormat;
use Monolog\Handler\TestHandler;
-require_once __DIR__ . '/../../include/api.php';
-
/**
* Tests for the API functions.
*