White spaces
This commit is contained in:
parent
0e15715088
commit
dc48f9b8f0
6 changed files with 19 additions and 18 deletions
|
@ -91,9 +91,9 @@ class Photo extends BaseFactory
|
||||||
$link = $this->baseUrl->get() . '/photo/' . $data['resource-id'] . '-' . $photo['scale'] . Images::getExtensionByMimeType($data['type']);
|
$link = $this->baseUrl->get() . '/photo/' . $data['resource-id'] . '-' . $photo['scale'] . Images::getExtensionByMimeType($data['type']);
|
||||||
if ($type == 'xml') {
|
if ($type == 'xml') {
|
||||||
$data['links'][$photo['scale'] . ':link']['@attributes'] = [
|
$data['links'][$photo['scale'] . ':link']['@attributes'] = [
|
||||||
'type' => $data['type'],
|
'type' => $data['type'],
|
||||||
'scale' => $photo['scale'],
|
'scale' => $photo['scale'],
|
||||||
'href' => $link
|
'href' => $link
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$data['link'][$id] = $link;
|
$data['link'][$id] = $link;
|
||||||
|
@ -108,6 +108,7 @@ class Photo extends BaseFactory
|
||||||
if ($with_posts) {
|
if ($with_posts) {
|
||||||
// retrieve item element for getting activities (like, dislike etc.) related to photo
|
// retrieve item element for getting activities (like, dislike etc.) related to photo
|
||||||
$condition = ['uid' => $uid, 'resource-id' => $photo_id];
|
$condition = ['uid' => $uid, 'resource-id' => $photo_id];
|
||||||
|
|
||||||
$item = Post::selectFirst(['id', 'uid', 'uri', 'uri-id', 'parent', 'allow_cid', 'deny_cid', 'allow_gid', 'deny_gid'], $condition);
|
$item = Post::selectFirst(['id', 'uid', 'uri', 'uri-id', 'parent', 'allow_cid', 'deny_cid', 'allow_gid', 'deny_gid'], $condition);
|
||||||
}
|
}
|
||||||
if (!empty($item)) {
|
if (!empty($item)) {
|
||||||
|
@ -147,7 +148,7 @@ class Photo extends BaseFactory
|
||||||
} elseif ($with_posts) {
|
} elseif ($with_posts) {
|
||||||
$data['friendica_activities'] = [];
|
$data['friendica_activities'] = [];
|
||||||
$data['friendica_comments'] = [];
|
$data['friendica_comments'] = [];
|
||||||
$data['rights_mismatch'] = false;
|
$data['rights_mismatch'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Show extends BaseApi
|
||||||
{
|
{
|
||||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||||
$uid = BaseApi::getCurrentUserID();
|
$uid = BaseApi::getCurrentUserID();
|
||||||
$type = $this->getRequestValue($this->parameters, 'extension', 'json');
|
$type = $this->getRequestValue($this->parameters, 'extension', 'json');
|
||||||
|
|
||||||
// params
|
// params
|
||||||
$gid = $this->getRequestValue($request, 'gid', 0);
|
$gid = $this->getRequestValue($request, 'gid', 0);
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Create extends BaseApi
|
||||||
$uid = BaseApi::getCurrentUserID();
|
$uid = BaseApi::getCurrentUserID();
|
||||||
$type = $this->getRequestValue($this->parameters, 'extension', 'json');
|
$type = $this->getRequestValue($this->parameters, 'extension', 'json');
|
||||||
|
|
||||||
// input params
|
// input params
|
||||||
$desc = $this->getRequestValue($request, 'desc');
|
$desc = $this->getRequestValue($request, 'desc');
|
||||||
$album = $this->getRequestValue($request, 'album');
|
$album = $this->getRequestValue($request, 'album');
|
||||||
$allow_cid = $this->getRequestValue($request, 'allow_cid');
|
$allow_cid = $this->getRequestValue($request, 'allow_cid');
|
||||||
|
|
|
@ -96,22 +96,22 @@ class Update extends BaseApi
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($allow_cid)) {
|
if (!is_null($allow_cid)) {
|
||||||
$allow_cid = trim($allow_cid);
|
$allow_cid = trim($allow_cid);
|
||||||
$updated_fields['allow_cid'] = $allow_cid;
|
$updated_fields['allow_cid'] = $allow_cid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($deny_cid)) {
|
if (!is_null($deny_cid)) {
|
||||||
$deny_cid = trim($deny_cid);
|
$deny_cid = trim($deny_cid);
|
||||||
$updated_fields['deny_cid'] = $deny_cid;
|
$updated_fields['deny_cid'] = $deny_cid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($allow_gid)) {
|
if (!is_null($allow_gid)) {
|
||||||
$allow_gid = trim($allow_gid);
|
$allow_gid = trim($allow_gid);
|
||||||
$updated_fields['allow_gid'] = $allow_gid;
|
$updated_fields['allow_gid'] = $allow_gid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($deny_gid)) {
|
if (!is_null($deny_gid)) {
|
||||||
$deny_gid = trim($deny_gid);
|
$deny_gid = trim($deny_gid);
|
||||||
$updated_fields['deny_gid'] = $deny_gid;
|
$updated_fields['deny_gid'] = $deny_gid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,36 +37,36 @@ class UpdateProfileImage extends BaseApi
|
||||||
{
|
{
|
||||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||||
$uid = BaseApi::getCurrentUserID();
|
$uid = BaseApi::getCurrentUserID();
|
||||||
|
|
||||||
// get mediadata from image or media (Twitter call api/account/update_profile_image provides image)
|
// get mediadata from image or media (Twitter call api/account/update_profile_image provides image)
|
||||||
if (!empty($_FILES['image'])) {
|
if (!empty($_FILES['image'])) {
|
||||||
$media = $_FILES['image'];
|
$media = $_FILES['image'];
|
||||||
} elseif (!empty($_FILES['media'])) {
|
} elseif (!empty($_FILES['media'])) {
|
||||||
$media = $_FILES['media'];
|
$media = $_FILES['media'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// error if image data is missing
|
// error if image data is missing
|
||||||
if (empty($media)) {
|
if (empty($media)) {
|
||||||
throw new HTTPException\BadRequestException('no media data submitted');
|
throw new HTTPException\BadRequestException('no media data submitted');
|
||||||
}
|
}
|
||||||
|
|
||||||
// save new profile image
|
// save new profile image
|
||||||
$resource_id = Photo::uploadAvatar($uid, $media);
|
$resource_id = Photo::uploadAvatar($uid, $media);
|
||||||
if (empty($resource_id)) {
|
if (empty($resource_id)) {
|
||||||
throw new HTTPException\InternalServerErrorException('image upload failed');
|
throw new HTTPException\InternalServerErrorException('image upload failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
// output for client
|
// output for client
|
||||||
$skip_status = $this->getRequestValue($request, 'skip_status', false);
|
$skip_status = $this->getRequestValue($request, 'skip_status', false);
|
||||||
|
|
||||||
$user_info = DI::twitterUser()->createFromUserId($uid, $skip_status)->toArray();
|
$user_info = DI::twitterUser()->createFromUserId($uid, $skip_status)->toArray();
|
||||||
|
|
||||||
// "verified" isn't used here in the standard
|
// "verified" isn't used here in the standard
|
||||||
unset($user_info['verified']);
|
unset($user_info['verified']);
|
||||||
|
|
||||||
// "uid" is only needed for some internal stuff, so remove it from here
|
// "uid" is only needed for some internal stuff, so remove it from here
|
||||||
unset($user_info['uid']);
|
unset($user_info['uid']);
|
||||||
|
|
||||||
$this->response->exit('user', ['user' => $user_info], $this->parameters['extension'] ?? null);
|
$this->response->exit('user', ['user' => $user_info], $this->parameters['extension'] ?? null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Tweets extends BaseApi
|
||||||
|
|
||||||
$data['status'] = [];
|
$data['status'] = [];
|
||||||
|
|
||||||
$count = $this->getRequestValue($request, 'count', 15);
|
$count = $this->getRequestValue($request, 'count', 20, 1, 100);
|
||||||
$count = $this->getRequestValue($request, 'rpp', $count);
|
$count = $this->getRequestValue($request, 'rpp', $count);
|
||||||
$since_id = $this->getRequestValue($request, 'since_id', 0, 0);
|
$since_id = $this->getRequestValue($request, 'since_id', 0, 0);
|
||||||
$max_id = $this->getRequestValue($request, 'max_id', 0, 0);
|
$max_id = $this->getRequestValue($request, 'max_id', 0, 0);
|
||||||
|
|
Loading…
Reference in a new issue