X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Feditpeopletag.php;h=45c8adaa7d59fc933a4ec70ddb157c5dfebfdc0f;hb=79c40bc73b41147fbc98eb03c590f9d4383c32d1;hp=3a66458c9eb739d91177db3b1bf4639500f51440;hpb=c74adb54013816f1945b33d06fc0f48f0cf007e5;p=quix0rs-gnu-social.git diff --git a/actions/editpeopletag.php b/actions/editpeopletag.php index 3a66458c9e..45c8adaa7d 100644 --- a/actions/editpeopletag.php +++ b/actions/editpeopletag.php @@ -40,7 +40,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @link http://status.net/ */ -class EditpeopletagAction extends OwnerDesignAction +class EditpeopletagAction extends Action { var $msg, $confirm, $confirm_args=array(); @@ -67,11 +67,14 @@ class EditpeopletagAction extends OwnerDesignAction 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'); - $tagger_arg = $this->arg('tagger'); + if (common_config('singleuser', 'enabled')) { + $tagger_arg = User::singleUserNickname(); + } else { + $tagger_arg = $this->arg('tagger'); + } $tag_arg = $this->arg('tag'); $tagger = common_canonical_nickname($tagger_arg); @@ -84,43 +87,38 @@ class EditpeopletagAction extends OwnerDesignAction 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(); @@ -260,7 +258,7 @@ class EditpeopletagAction extends OwnerDesignAction return; } else if (Profile_list::descriptionTooLong($description)) { $this->showForm(sprintf( - // TRANS: Client error shown when providing too long a description when editing a people tag. + // TRANS: Client error shown when providing too long a description when editing a list. // TRANS: %d is the maximum number of allowed characters. _m('Description is too long (maximum %d character).', 'Description is too long (maximum %d characters).', @@ -279,6 +277,14 @@ class EditpeopletagAction extends OwnerDesignAction 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); @@ -293,7 +299,7 @@ class EditpeopletagAction extends OwnerDesignAction if (!$result) { common_log_db_error($this->group, 'UPDATE', __FILE__); - // TRANS: TRANS: Server error displayed when updating a list fails. + // TRANS: Server error displayed when updating a list fails. $this->serverError(_('Could not update list.')); } @@ -303,22 +309,13 @@ class EditpeopletagAction extends OwnerDesignAction 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, 'tag' => $tag)), 303); } else { - // TRANS: Edit people tag form success message. + // TRANS: Edit list form success message. $this->showForm(_('Options saved.')); } }