* @link http://status.net/
*/
-if (!defined('STATUSNET')) {
- exit(1);
-}
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
/**
* Takes parameters:
*/
class EditMirrorAction extends BaseMirrorAction
{
-
/**
* Check pre-requisites and instantiate attributes
*
*
* @return boolean success flag
*/
- function prepare($args)
+ protected function prepare(array $args=array())
{
parent::prepare($args);
$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'));
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();
}