namespace Friendica\Module;
use Friendica\BaseModule;
+use Friendica\DI;
use Friendica\Model\Item;
+use Friendica\Core\Session;
use Friendica\Network\HTTPException;
use Friendica\Util\Strings;
*/
class Like extends BaseModule
{
- public static function rawContent()
+ public static function rawContent(array $parameters = [])
{
- if (!local_user() && !remote_user()) {
+ if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException();
}
$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);
// Decide how to return. If we were called with a 'return' argument,
// then redirect back to the calling page. If not, just quietly end
- $returnPath = defaults($_REQUEST, 'return', '');
+ $returnPath = $_REQUEST['return'] ?? '';
if (!empty($returnPath)) {
$rand = '_=' . time();
$rand = "?$rand";
}
- $app->internalRedirect($returnPath . $rand);
+ DI::baseUrl()->redirect($returnPath . $rand);
}
}
}