X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapiusershow.php;h=fbd4d605988604e03c23e9505165aca8d19e1874;hb=b26eccf33cf69c04a96d5d6d3eddc0ef68ffd4b1;hp=b3a939b431b2ab2427d1637d6f90d8df7160f4bd;hpb=4e9ec0d0e1aeb43b432f4692b4819beb9408ad3b;p=quix0rs-gnu-social.git diff --git a/actions/apiusershow.php b/actions/apiusershow.php index b3a939b431..fbd4d60598 100644 --- a/actions/apiusershow.php +++ b/actions/apiusershow.php @@ -34,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. @@ -49,8 +49,7 @@ require_once INSTALLDIR . '/lib/api.php'; * @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 { /** * Take arguments for running @@ -60,7 +59,6 @@ class ApiUserShowAction extends ApiAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -87,24 +85,26 @@ 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; } @@ -113,14 +113,26 @@ class ApiUserShowAction extends ApiAction if ($this->format == 'xml') { $this->initDocument('xml'); - $this->showTwitterXmlUser($twitter_user); + $this->showTwitterXmlUser($twitter_user, 'user', true); $this->endDocument('xml'); } elseif ($this->format == '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; + } }