X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fprofileformaction.php;h=51c89a922ea9b57ac7ae73952b546b2c21a59b18;hb=7f9ab683b259fc93d507eb705c84af0cfd2fae5b;hp=8a934666e3adbc8678979acf087e614fe1c54674;hpb=745e35ac1fcee01298db09a8649f79f410138652;p=quix0rs-gnu-social.git diff --git a/lib/profileformaction.php b/lib/profileformaction.php index 8a934666e3..51c89a922e 100644 --- a/lib/profileformaction.php +++ b/lib/profileformaction.php @@ -41,7 +41,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @link http://status.net/ */ -class ProfileFormAction extends Action +class ProfileFormAction extends RedirectingAction { var $profile = null; @@ -60,7 +60,16 @@ class ProfileFormAction extends Action $this->checkSessionToken(); if (!common_logged_in()) { - $this->clientError(_('Not logged in.')); + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $this->clientError(_('Not logged in.')); + } else { + // Redirect to login. + common_set_returnto($this->selfUrl()); + $user = common_current_user(); + if (Event::handle('RedirectToLogin', array($this, $user))) { + common_redirect(common_local_url('login'), 303); + } + } return false; } @@ -97,30 +106,7 @@ class ProfileFormAction extends Action if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->handlePost(); - $this->returnToArgs(); - } - } - - /** - * Return to the calling page based on hidden arguments - * - * @return void - */ - - function returnToArgs() - { - foreach ($this->args as $k => $v) { - if ($k == 'returnto-action') { - $action = $v; - } else if (substr($k, 0, 9) == 'returnto-') { - $args[substr($k, 9)] = $v; - } - } - - if ($action) { - common_redirect(common_local_url($action, $args), 303); - } else { - $this->clientError(_("No return-to arguments.")); + $this->returnToPrevious(); } }