. * * @category API * @package GNUSocial * @author Hannes Mannerheim * @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/ */ if (!defined('GNUSOCIAL')) { exit(1); } /** * Ouputs information for a user, specified by ID or screen name. * The user's most recent status will be returned inline. */ class ApiExternalProfileShowAction extends ApiPrivateAuthAction { /** * Take arguments for running * * @param array $args $_REQUEST args * * @return boolean success flag * */ function prepare($args) { parent::prepare($args); $profileurl = urldecode($this->arg('profileurl')); $this->profile = Profile::staticGet('profileurl', $profileurl); return true; } /** * Handle the request * * Check the format and show the user info * * @param array $args $_REQUEST data (unused) * * @return void */ function handle($args) { parent::handle($args); if (empty($this->profile)) { // TRANS: Client error displayed when requesting profile information for a non-existing profile. $this->clientError(_('Profile not found.'), 404, 'json'); return; } $twitter_user = $this->twitterUserArray($this->profile, true); $this->initDocument('json'); $this->showJsonObjects($twitter_user); $this->endDocument('json'); } /** * Return true if read only. * * MAY override * * @param array $args other arguments * * @return boolean is read only action? */ function isReadOnly($args) { return true; } }