summaryrefslogtreecommitdiff
path: root/lib/profileformaction.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-07-12 14:21:57 -0700
committerBrion Vibber <brion@pobox.com>2010-07-12 14:21:57 -0700
commitcd29d3d646379aa9a1352035973c8e379cc7f42b (patch)
treee064c5292c546e6df8eaad9609a56150f69c62c3 /lib/profileformaction.php
parentbd8506eee883ecd424fdf3d7e545c10c754df6ff (diff)
parent1b3b7f9a422f6b703ec36d43e2283f91a9835f3b (diff)
Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib/profileformaction.php')
-rw-r--r--lib/profileformaction.php38
1 files changed, 12 insertions, 26 deletions
diff --git a/lib/profileformaction.php b/lib/profileformaction.php
index 8a934666e..51c89a922 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();
}
}