Coding styles / "require_once" for removed file removed
This commit is contained in:
parent
af18e2f2a9
commit
7c15d0160a
7 changed files with 13 additions and 17 deletions
|
@ -152,4 +152,4 @@ class Photo extends BaseFactory
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ class Create extends BaseApi
|
||||||
$uid = BaseApi::getCurrentUserID();
|
$uid = BaseApi::getCurrentUserID();
|
||||||
|
|
||||||
// params
|
// params
|
||||||
$name = $request['name'] ?? '';
|
$name = $request['name'] ?? '';
|
||||||
$json = json_decode($request['json'], true);
|
$json = json_decode($request['json'], true);
|
||||||
$users = $json['user'];
|
$users = $json['user'];
|
||||||
|
|
||||||
// error if no name specified
|
// error if no name specified
|
||||||
|
@ -66,14 +66,14 @@ class Create extends BaseApi
|
||||||
|
|
||||||
// add members
|
// add members
|
||||||
$erroraddinguser = false;
|
$erroraddinguser = false;
|
||||||
$errorusers = [];
|
$errorusers = [];
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
$cid = $user['cid'];
|
$cid = $user['cid'];
|
||||||
if (DBA::exists('contact', ['id' => $cid, 'uid' => $uid])) {
|
if (DBA::exists('contact', ['id' => $cid, 'uid' => $uid])) {
|
||||||
Group::addMember($gid, $cid);
|
Group::addMember($gid, $cid);
|
||||||
} else {
|
} else {
|
||||||
$erroraddinguser = true;
|
$erroraddinguser = true;
|
||||||
$errorusers[] = $cid;
|
$errorusers[] = $cid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,20 +57,18 @@ class Show extends BaseApi
|
||||||
$grps = [];
|
$grps = [];
|
||||||
foreach ($groups as $rr) {
|
foreach ($groups as $rr) {
|
||||||
$members = Contact\Group::getById($rr['id']);
|
$members = Contact\Group::getById($rr['id']);
|
||||||
$users = [];
|
$users = [];
|
||||||
|
|
||||||
if ($type == 'xml') {
|
if ($type == 'xml') {
|
||||||
$user_element = 'users';
|
$user_element = 'users';
|
||||||
$k = 0;
|
$k = 0;
|
||||||
foreach ($members as $member) {
|
foreach ($members as $member) {
|
||||||
$user = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
|
$users[$k++.':user'] = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
|
||||||
$users[$k++.':user'] = $user;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$user_element = 'user';
|
$user_element = 'user';
|
||||||
foreach ($members as $member) {
|
foreach ($members as $member) {
|
||||||
$user = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
|
$users[] = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
|
||||||
$users[] = $user;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$grps[] = ['name' => $rr['name'], 'gid' => $rr['id'], $user_element => $users];
|
$grps[] = ['name' => $rr['name'], 'gid' => $rr['id'], $user_element => $users];
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Photo extends BaseApi
|
||||||
throw new HTTPException\BadRequestException('No photo id.');
|
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'];
|
$photo_id = $request['photo_id'];
|
||||||
|
|
||||||
// prepare json/xml output with data from database for the requested photo
|
// prepare json/xml output with data from database for the requested photo
|
||||||
|
|
|
@ -118,14 +118,14 @@ class Update extends BaseApi
|
||||||
$result = false;
|
$result = false;
|
||||||
if (count($updated_fields) > 0) {
|
if (count($updated_fields) > 0) {
|
||||||
$nothingtodo = false;
|
$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 {
|
} else {
|
||||||
$nothingtodo = true;
|
$nothingtodo = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_FILES['media'])) {
|
if (!empty($_FILES['media'])) {
|
||||||
$nothingtodo = false;
|
$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)) {
|
if (!empty($photo)) {
|
||||||
$data = ['photo' => $this->friendicaPhoto->createFromId($photo['resource_id'], null, $uid, $type)];
|
$data = ['photo' => $this->friendicaPhoto->createFromId($photo['resource_id'], null, $uid, $type)];
|
||||||
$this->response->exit('photo_update', $data, $this->parameters['extension'] ?? null);
|
$this->response->exit('photo_update', $data, $this->parameters['extension'] ?? null);
|
||||||
|
|
|
@ -57,7 +57,7 @@ class UpdateProfileImage extends BaseApi
|
||||||
}
|
}
|
||||||
|
|
||||||
// output for client
|
// 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();
|
$user_info = DI::twitterUser()->createFromUserId($uid, $skip_status)->toArray();
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,6 @@ use Friendica\Util\Arrays;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Monolog\Handler\TestHandler;
|
use Monolog\Handler\TestHandler;
|
||||||
|
|
||||||
require_once __DIR__ . '/../../include/api.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the API functions.
|
* Tests for the API functions.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue