From c17d7b671d245061cf716fe876b5bf7194febddc Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 17 Dec 2009 14:38:14 +0800 Subject: [PATCH] Set returnto when redirected to login of a private install (for 0.9.x) Can't use returnToArgs() because we don't have an action object yet. --- index.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/index.php b/index.php index 997ee6197f..47cde87409 100644 --- a/index.php +++ b/index.php @@ -278,6 +278,20 @@ function main() && !preg_match('/rss$/', $action) && !preg_match('/^Api/', $action) ) { + // set returnto + $rargs =& common_copy_args($args); + unset($rargs['action']); + if (common_config('site', 'fancy')) { + unset($rargs['p']); + } + if (array_key_exists('submit', $rargs)) { + unset($rargs['submit']); + } + foreach (array_keys($_COOKIE) as $cookie) { + unset($rargs[$cookie]); + } + common_set_returnto(common_local_url($action, $rargs)); + common_redirect(common_local_url('login')); return; }