X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FLike.php;h=ca382475082c6871bcb4305e3e62a00020d07cdf;hb=2d217129b9fb2e4379b728b01ec73fc0be8c58ff;hp=cc450dd9d0d381e2f7c2df211eb04ff1cc727135;hpb=1de3960e267a8d298348fbca18cf1be1f6a20f7a;p=friendica.git diff --git a/src/Module/Like.php b/src/Module/Like.php index cc450dd9d0..ca38247508 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)) { 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']); } }