X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Feditpeopletag.php;h=0fbba5622430640a6bfa3e0f2078a348f2514dd9;hb=dd8e17a3874aa99063b62b51e9a637a5abb0b923;hp=546d9910ba1dd23239f05248e76c4582cef1fd92;hpb=eb6b4628b95f1bb770b01df86eacab756f28364b;p=quix0rs-gnu-social.git diff --git a/actions/editpeopletag.php b/actions/editpeopletag.php index 546d9910ba..0fbba56224 100644 --- a/actions/editpeopletag.php +++ b/actions/editpeopletag.php @@ -60,14 +60,13 @@ class EditpeopletagAction extends Action * Prepare to run */ - function prepare($args) + function prepare(array $args = array()) { parent::prepare($args); if (!common_logged_in()) { // TRANS: Error message displayed when trying to perform an action that requires a logged in user. $this->clientError(_('Not logged in.')); - return false; } $id = $this->arg('id'); @@ -88,43 +87,38 @@ class EditpeopletagAction extends Action if ($tagger_arg != $tagger || $tag_arg != $tag) { $args = array('tagger' => $tagger, 'tag' => $tag); common_redirect(common_local_url('editpeopletag', $args), 301); - return false; } $user = null; if ($id) { - $this->peopletag = Profile_list::staticGet('id', $id); + $this->peopletag = Profile_list::getKV('id', $id); if (!empty($this->peopletag)) { - $user = User::staticGet('id', $this->peopletag->tagger); + $user = User::getKV('id', $this->peopletag->tagger); } } else { if (!$tagger) { // TRANS: Error message displayed when trying to perform an action that requires a tagging user or ID. $this->clientError(_('No tagger or ID.'), 404); - return false; } - $user = User::staticGet('nickname', $tagger); + $user = User::getKV('nickname', $tagger); $this->peopletag = Profile_list::pkeyGet(array('tagger' => $user->id, 'tag' => $tag)); } if (!$this->peopletag) { // TRANS: Client error displayed when referring to a non-existing list. $this->clientError(_('No such list.'), 404); - return false; } if (!$user) { // This should not be happening // TRANS: Client error displayed when referring to non-local user. $this->clientError(_('Not a local user.'), 404); - return false; } if ($current->id != $user->id) { // TRANS: Client error displayed when reting to edit a tag that was not self-created. $this->clientError(_('You must be the creator of the tag to edit it.'), 404); - return false; } $this->tagger = $user->getProfile(); @@ -141,9 +135,9 @@ class EditpeopletagAction extends Action * * @return void */ - function handle($args) + function handle() { - parent::handle($args); + parent::handle(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->trySave(); } else { @@ -283,6 +277,14 @@ class EditpeopletagAction extends Action return; } + // We tested $delete && !$confirm earlier so confirmation is required before getting here + if ($delete) { + // This might take quite a bit of time. + $this->peopletag->delete(); + // send home. + common_redirect(common_local_url('all', array('nickname' => $this->tagger->getNickname())), 303); + } + $this->peopletag->query('BEGIN'); $orig = clone($this->peopletag); @@ -307,15 +309,6 @@ class EditpeopletagAction extends Action Profile_tag_subscription::cleanup($this->peopletag); } - if ($delete) { - // This might take quite a bit of time. - $this->peopletag->delete(); - // send home. - common_redirect(common_local_url('all', - array('nickname' => $this->tagger->nickname)), - 303); - } - if ($tag != $orig->tag) { common_redirect(common_local_url('editpeopletag', array('tagger' => $this->tagger->nickname,