X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapiexternalprofileshow.php;h=2fe7450034f404adb108798abb4eb01d4d4c841f;hb=0e52570bdce5f504c3e0ca6ed8a6cd381a0cd39f;hp=2acc97f48f9dcd3ccd1325504155190ae9ad147b;hpb=34a6624452e8b7f60b40181441c6ea2c8158379a;p=quix0rs-gnu-social.git diff --git a/actions/apiexternalprofileshow.php b/actions/apiexternalprofileshow.php index 2acc97f48f..2fe7450034 100644 --- a/actions/apiexternalprofileshow.php +++ b/actions/apiexternalprofileshow.php @@ -20,7 +20,7 @@ * along with this program. If not, see . * * @category API - * @package GNUSocial + * @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/ @@ -42,13 +42,23 @@ class ApiExternalProfileShowAction extends ApiPrivateAuthAction * @return boolean success flag * */ - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); + if ($this->format !== 'json') { + $this->clientError('This method currently only serves JSON.', 415); + } + $profileurl = urldecode($this->arg('profileurl')); - $this->profile = Profile::staticGet('profileurl', $profileurl); + // TODO: Make this more ... unique! + $this->profile = Profile::getKV('profileurl', $profileurl); + + if (!($this->profile instanceof Profile)) { + // TRANS: Client error displayed when requesting profile information for a non-existing profile. + $this->clientError(_('Profile not found.'), 404); + } return true; } @@ -62,15 +72,9 @@ class ApiExternalProfileShowAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) + protected function handle() { - 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; - } + parent::handle(); $twitter_user = $this->twitterUserArray($this->profile, true); @@ -88,7 +92,7 @@ class ApiExternalProfileShowAction extends ApiPrivateAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) + function isReadOnly(array $args=array()) { return true; }