Changeset:
ed6b8df3484d
https://sourceforge.net/p/mrbs/hg-code/ci/ed6b8df3484d53821622f6acbd112fe98ab7ca24
Author:
Campbell Morrison <[email protected]>
Date:
Tue Feb 21 10:29:41 2017 +0000
Log message:
Restructured - made $returl a parameter of printLoginForm()
diffstat:
web/session/session_php.inc | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
diffs (108 lines):
diff -r 18e45693368d -r ed6b8df3484d web/session/session_php.inc
--- a/web/session/session_php.inc Tue Feb 21 10:07:44 2017 +0000
+++ b/web/session/session_php.inc Tue Feb 21 10:29:41 2017 +0000
@@ -13,7 +13,8 @@
* *
\*****************************************************************************/
-global $PHP_SELF, $auth;
+global $PHP_SELF, $HTTP_REFERER;
+global $auth;
// Get non-standard form variables
$Action = get_form_var('Action', 'string');
@@ -22,6 +23,14 @@
$target_url = get_form_var('target_url', 'string');
$returl = get_form_var('returl', 'string');
+// We need to preserve the original calling page, so that it's there when we
eventually get to the
+// target_url (especially if that's edit_entry.php). If this is the first
time through then $HTTP_REFERER
+// holds the original caller. If this is the second time through we will
have stored it in $returl.
+if (!isset($returl))
+{
+ $returl = isset($HTTP_REFERER) ? $HTTP_REFERER : '';
+}
+
if (isset($cookie_path_override))
{
$cookie_path = $cookie_path_override;
@@ -101,7 +110,7 @@
{
print_header(0, 0, 0, 0, "");
echo "<p>".get_vocab('unknown_user')."</p>\n";
- printLoginForm(this_page(), $target_url);
+ printLoginForm(this_page(), $target_url, $returl);
exit();
}
}
@@ -140,11 +149,8 @@
Display the login form. Used by two routines below.
Will eventually return to $target_url.
*/
-function printLoginForm($action, $target_url)
+function printLoginForm($action, $target_url, $returl)
{
- global $HTTP_REFERER;
- global $returl;
-
$html = '';
$html .= "<form class=\"form_general\" id=\"logon\" method=\"post\"".
@@ -170,13 +176,7 @@
$html .= "<input type=\"password\" id=\"NewUserPassword\"
name=\"NewUserPassword\">\n";
$html .= "</div>\n";
- // We need to preserve the original calling page, so that it's there when we
eventually get
- // to the target_url (especially if that's edit_entry.php). If this is the
first time through then $HTTP_REFERER holds
- // the original caller. If this is the second time through we will have
stored it in $returl.
- if (!isset($returl))
- {
- $returl = isset($HTTP_REFERER) ? $HTTP_REFERER : "";
- }
+
$html .= "<input type=\"hidden\" name=\"returl\" value=\"" .
htmlspecialchars($returl) . "\">\n";
$html .= "<input type=\"hidden\" name=\"target_url\" value=\"" .
htmlspecialchars($target_url) . "\">\n";
$html .= "<input type=\"hidden\" name=\"Action\" value=\"SetName\">\n";
@@ -203,10 +203,11 @@
if (isset($Action) && ($Action == "QueryName"))
{
print_header(0, 0, 0, 0, "");
- printLoginForm(this_page(), $target_url);
+ printLoginForm(this_page(), $target_url, $returl);
exit();
}
+
/* authGet()
*
* Request the user name/password
@@ -216,6 +217,7 @@
function authGet()
{
global $PHP_SELF, $QUERY_STRING;
+ global $returl;
print_header(0, 0, 0, 0, "");
@@ -226,11 +228,12 @@
{
$target_url = $target_url . "?" . $QUERY_STRING;
}
- printLoginForm(this_page(), $target_url);
+ printLoginForm(this_page(), $target_url, $returl);
exit();
}
+
function getUserName()
{
if (isset($_SESSION["UserName"]) && ($_SESSION["UserName"] !== ''))
@@ -241,6 +244,7 @@
return NULL;
}
+
// Print the logon entry on the top banner.
function PrintLogonBox()
{
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits