. /** * ActivityPub implementation for GNU social * * @package GNUsocial * @author Diogo Cordeiro * @copyright 2018-2019 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later * @link http://www.gnu.org/software/social/ */ defined('GNUSOCIAL') || die(); /** * Notice (Local notices only) * * @category Plugin * @package GNUsocial * @author Diogo Cordeiro * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ class apNoticeAction extends ManagedAction { protected $needLogin = false; protected $canPost = true; /** * Handle the Notice request * * @return void * @throws EmptyPkeyValueException * @throws InvalidUrlException * @throws ServerException * @author Diogo Cordeiro */ protected function handle() { try { $notice = Notice::getByID($this->trimmed('id')); } catch (Exception $e) { ActivityPubReturn::error('Invalid Activity URI.', 404); } if (!$notice->isLocal()) { // We have no authority on the requested activity. ActivityPubReturn::error("This is not a local activity.", 403); } $res = Activitypub_notice::notice_to_array($notice); ActivityPubReturn::answer($res); } }