. * * @category Plugin * @package GNUsocial * @author Diogo Cordeiro * @copyright 2018 Free Software Foundation http://fsf.org * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link https://www.gnu.org/software/social/ */ if (!defined('GNUSOCIAL')) { exit(1); } /** * Notice (Local notices only) * * @category Plugin * @package GNUsocial * @author Diogo Cordeiro * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://www.gnu.org/software/social/ */ class apNoticeAction extends ManagedAction { protected $needLogin = false; protected $canPost = true; /** * Handle the Notice request * * @author Diogo Cordeiro * @return void */ protected function handle() { try { $notice = Notice::getByID($this->trimmed('id')); } catch (Exception $e) { ActivityPubReturn::error('Invalid Notice URI.', 404); } if (!$notice->isLocal()) { ActivityPubReturn::error("This is not a local notice.", 403); } $res = Activitypub_notice::notice_to_array($notice); ActivityPubReturn::answer($res); } }