X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapiusershow.php;h=fbd4d605988604e03c23e9505165aca8d19e1874;hb=daf73f8231887efc16f2a36e532c8aa21db8d7af;hp=442efc194366bd424a995a83756125356e4abbcb;hpb=57dfad64beae100187dcaf3c205645e89611e115;p=quix0rs-gnu-social.git diff --git a/actions/apiusershow.php b/actions/apiusershow.php index 442efc1943..fbd4d60598 100644 --- a/actions/apiusershow.php +++ b/actions/apiusershow.php @@ -21,6 +21,9 @@ * * @category API * @package StatusNet + * @author Dan Moore + * @author Evan Prodromou + * @author mac65 * @author Zach Copley * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 @@ -31,7 +34,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/api.php'; +require_once INSTALLDIR . '/lib/apiprivateauth.php'; /** * Ouputs information for a user, specified by ID or screen name. @@ -39,15 +42,15 @@ require_once INSTALLDIR.'/lib/api.php'; * * @category API * @package StatusNet + * @author Dan Moore + * @author Evan Prodromou + * @author mac65 * @author Zach Copley * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - -class ApiUserShowAction extends ApiAction +class ApiUserShowAction extends ApiPrivateAuthAction { - var $user = null; - /** * Take arguments for running * @@ -56,7 +59,6 @@ class ApiUserShowAction extends ApiAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -83,40 +85,54 @@ class ApiUserShowAction extends ApiAction * * @return void */ - function handle($args) { parent::handle($args); if (empty($this->user)) { - $this->clientError(_('Not found.'), 404, $this->format); + // TRANS: Client error displayed when requesting user information for a non-existing user. + $this->clientError(_('User not found.'), 404, $this->format); return; } if (!in_array($this->format, array('xml', 'json'))) { - $this->clientError(_('API method not found!'), $code = 404); + // TRANS: Client error displayed when trying to handle an unknown API method. + $this->clientError(_('API method not found.'), $code = 404); return; } $profile = $this->user->getProfile(); if (empty($profile)) { + // TRANS: Client error displayed when requesting user information for a user without a profile. $this->clientError(_('User has no profile.')); return; } - $twitter_user = $this->twitter_user_array($this->user->getProfile(), true); + $twitter_user = $this->twitterUserArray($this->user->getProfile(), true); if ($this->format == 'xml') { - $this->init_document('xml'); - $this->show_twitter_xml_user($twitter_user); - $this->end_document('xml'); + $this->initDocument('xml'); + $this->showTwitterXmlUser($twitter_user, 'user', true); + $this->endDocument('xml'); } elseif ($this->format == 'json') { - $this->init_document('json'); - $this->show_json_objects($twitter_user); - $this->end_document('json'); + $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; + } }