X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FSubMirror%2Factions%2Feditmirror.php;h=d3d79966b9b4e130c203c4ea0b46ce891a9d00b2;hb=1635d459ec1988104f28f3346c45ee5aebbfcc1a;hp=0f8b037325adf2ed1a95769ba7bd0bd3996f3c90;hpb=cc62afe5b990c33296b9ada1906783ca44352aa8;p=quix0rs-gnu-social.git diff --git a/plugins/SubMirror/actions/editmirror.php b/plugins/SubMirror/actions/editmirror.php index 0f8b037325..d3d79966b9 100644 --- a/plugins/SubMirror/actions/editmirror.php +++ b/plugins/SubMirror/actions/editmirror.php @@ -26,9 +26,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); } /** * Takes parameters: @@ -47,7 +45,6 @@ if (!defined('STATUSNET')) { */ class EditMirrorAction extends BaseMirrorAction { - /** * Check pre-requisites and instantiate attributes * @@ -55,7 +52,7 @@ class EditMirrorAction extends BaseMirrorAction * * @return boolean success flag */ - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); @@ -64,8 +61,9 @@ class EditMirrorAction extends BaseMirrorAction $this->mirror = SubMirror::pkeyGet(array('subscriber' => $this->user->id, 'subscribed' => $this->profile->id)); - if (!$this->mirror) { - $this->clientError(_m("Requested invalid profile to edit.")); + if (!$this->mirror instanceof SubMirror) { + // TRANS: Client error displayed when trying to edit an object that is not a feed mirror. + $this->clientError(_m('Requested invalid profile to edit.')); } $this->style = $this->validateStyle($this->trimmed('style')); @@ -83,21 +81,22 @@ class EditMirrorAction extends BaseMirrorAction if (in_array($style, $allowed)) { return $style; } else { - $this->clientError(_m("Bad form data.")); + // TRANS: Client error displayed when providing invalid input when editing a mirror. + $this->clientError(_m('Bad form data.')); } } - function saveMirror() + protected function saveMirror() { $mirror = SubMirror::getMirror($this->user, $this->profile); if (!$mirror) { // TRANS: Client error thrown when a mirror request is made and no result is retrieved. - $this->clientError(_m('Requested edit of missing mirror.')); + $this->clientError(_m('The mirror request failed, because no result was retrieved.')); } if ($this->delete) { $mirror->delete(); - $oprofile = Ostatus_profile::staticGet('profile_id', $this->profile->id); + $oprofile = Ostatus_profile::getKV('profile_id', $this->profile->id); if ($oprofile) { $oprofile->garbageCollect(); }