X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FLike.php;h=727aa5ddfe1389d31aa23579841e9c8224e7f4a9;hb=3f523a88b0af4e2a73b29917da33d221abef9647;hp=cc450dd9d0d381e2f7c2df211eb04ff1cc727135;hpb=f59ea2af55aea17beeda1f93ad9ea91f12b1b84d;p=friendica.git diff --git a/src/Module/Like.php b/src/Module/Like.php index cc450dd9d0..727aa5ddfe 100644 --- a/src/Module/Like.php +++ b/src/Module/Like.php @@ -1,8 +1,29 @@ . + * + */ namespace Friendica\Module; use Friendica\BaseModule; +use Friendica\Core\System; +use Friendica\DI; use Friendica\Model\Item; use Friendica\Core\Session; use Friendica\Network\HTTPException; @@ -13,7 +34,7 @@ use Friendica\Util\Strings; */ class Like extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { if (!Session::isAuthenticated()) { throw new HTTPException\ForbiddenException(); @@ -25,12 +46,12 @@ class Like extends BaseModule $verb = 'like'; } - $app = self::getApp(); + $app = DI::app(); // @TODO: Replace with parameter from router $itemId = (($app->argc > 1) ? Strings::escapeTags(trim($app->argv[1])) : 0); - if (!Item::performLike($itemId, $verb)) { + if (!Item::performActivity($itemId, $verb, local_user())) { throw new HTTPException\BadRequestException(); } @@ -46,7 +67,9 @@ class Like extends BaseModule $rand = "?$rand"; } - $app->internalRedirect($returnPath . $rand); + DI::baseUrl()->redirect($returnPath . $rand); } + + System::jsonExit(['status' => 'OK']); } }