Fixes standards
This commit is contained in:
parent
61f1a4d14d
commit
19019381e6
|
@ -51,26 +51,26 @@ class Retweet extends BaseApi
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = ['uri-id', 'network', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink'];
|
$fields = ['uri-id', 'network', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink'];
|
||||||
$item = Post::selectFirst($fields, ['id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED]]);
|
$item = Post::selectFirst($fields, ['id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED]]);
|
||||||
|
|
||||||
if (DBA::isResult($item) && !empty($item['body'])) {
|
if (DBA::isResult($item) && !empty($item['body'])) {
|
||||||
if (in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::TWITTER])) {
|
if (in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::TWITTER])) {
|
||||||
if (!Item::performActivity($id, 'announce', $uid)) {
|
if (!Item::performActivity($id, 'announce', $uid)) {
|
||||||
throw new InternalServerErrorException();
|
throw new InternalServerErrorException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$item_id = $id;
|
$item_id = $id;
|
||||||
} else {
|
} else {
|
||||||
if (strpos($item['body'], "[/share]") !== false) {
|
if (strpos($item['body'], "[/share]") !== false) {
|
||||||
$pos = strpos($item['body'], "[share");
|
$pos = strpos($item['body'], "[share");
|
||||||
$post = substr($item['body'], $pos);
|
$post = substr($item['body'], $pos);
|
||||||
} else {
|
} else {
|
||||||
$post = BBCode::getShareOpeningTag($item['author-name'], $item['author-link'], $item['author-avatar'], $item['plink'], $item['created'], $item['guid']);
|
$post = BBCode::getShareOpeningTag($item['author-name'], $item['author-link'], $item['author-avatar'], $item['plink'], $item['created'], $item['guid']);
|
||||||
|
|
||||||
if (!empty($item['title'])) {
|
if (!empty($item['title'])) {
|
||||||
$post .= '[h3]' . $item['title'] . "[/h3]\n";
|
$post .= '[h3]' . $item['title'] . "[/h3]\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$post .= $item['body'];
|
$post .= $item['body'];
|
||||||
$post .= "[/share]";
|
$post .= "[/share]";
|
||||||
}
|
}
|
||||||
|
@ -83,13 +83,13 @@ class Retweet extends BaseApi
|
||||||
if (empty($item['app']) && !empty(self::getCurrentApplication()['name'])) {
|
if (empty($item['app']) && !empty(self::getCurrentApplication()['name'])) {
|
||||||
$item['app'] = self::getCurrentApplication()['name'];
|
$item['app'] = self::getCurrentApplication()['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$item_id = Item::insert($item, true);
|
$item_id = Item::insert($item, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ForbiddenException();
|
throw new ForbiddenException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$status_info = DI::twitterStatus()->createFromItemId($item_id, $uid)->toArray();
|
$status_info = DI::twitterStatus()->createFromItemId($item_id, $uid)->toArray();
|
||||||
|
|
||||||
DI::apiResponse()->exit('status', ['status' => $status_info], $this->parameters['extension'] ?? null);
|
DI::apiResponse()->exit('status', ['status' => $status_info], $this->parameters['extension'] ?? null);
|
||||||
|
|
|
@ -101,7 +101,7 @@ class Update extends BaseApi
|
||||||
if (!empty($request['lat']) && !empty($request['long'])) {
|
if (!empty($request['lat']) && !empty($request['long'])) {
|
||||||
$item['coord'] = sprintf("%s %s", $request['lat'], $request['long']);
|
$item['coord'] = sprintf("%s %s", $request['lat'], $request['long']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$item['allow_cid'] = $owner['allow_cid'];
|
$item['allow_cid'] = $owner['allow_cid'];
|
||||||
$item['allow_gid'] = $owner['allow_gid'];
|
$item['allow_gid'] = $owner['allow_gid'];
|
||||||
$item['deny_cid'] = $owner['deny_cid'];
|
$item['deny_cid'] = $owner['deny_cid'];
|
||||||
|
|
Loading…
Reference in a new issue