. * * @category Plugin * @package GNUsocial * @author Diogo Cordeiro * @author Daniel Supernault * @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); } /** * Actor's profile (Local users 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 apActorProfileAction extends ManagedAction { protected $needLogin = false; protected $canPost = true; /** * Handle the Actor Profile request * * @author Diogo Cordeiro * @return void */ protected function handle() { if (!empty($id = $this->trimmed('id'))) { try { $profile = Profile::getByID($id); } catch (Exception $e) { ActivityPubReturn::error('Invalid Actor URI.', 404); } unset($id); } else { try { $profile = User::getByNickname($this->trimmed('nickname'))->getProfile(); } catch (Exception $e) { ActivityPubReturn::error('Invalid username.', 404); } } if (!$profile->isLocal()) { ActivityPubReturn::error("This is not a local user.", 403); } $res = Activitypub_profile::profile_to_array($profile); ActivityPubReturn::answer($res); } }