Changeset:
f86a6a7f12c1
https://sourceforge.net/p/mrbs/hg-code/ci/f86a6a7f12c188734c2569ee6a88b2729afd9845
Author:
Campbell Morrison <[email protected]>
Date:
Tue Feb 21 14:18:48 2017 +0000
Log message:
Restructured
diffstat:
web/session/session_joomla.inc | 32 +++++++++++++++++++-------------
web/session/session_wordpress.inc | 25 +++++++++++++++----------
2 files changed, 34 insertions(+), 23 deletions(-)
diffs (176 lines):
diff -r 80a2abed20b6 -r f86a6a7f12c1 web/session/session_joomla.inc
--- a/web/session/session_joomla.inc Tue Feb 21 14:03:54 2017 +0000
+++ b/web/session/session_joomla.inc Tue Feb 21 14:18:48 2017 +0000
@@ -6,8 +6,7 @@
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
-global $PHP_SELF, $auth;
-
+global $auth;
// Get non-standard form variables
$Action = get_form_var('Action', 'string');
@@ -16,6 +15,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 : '';
+}
+
/*
Target of the form with sets the URL argument "Action=SetName".
Will eventually return to URL argument "target_url=whatever".
@@ -37,7 +44,7 @@
{
print_header(0, 0, 0, 0, "");
echo "<p>".get_vocab('unknown_user')."</p>\n";
- printLoginForm($target_url);
+ printLoginForm(this_page(), $target_url, $returl);
exit();
}
}
@@ -71,12 +78,10 @@
Display the login form. Used by two routines below.
Will eventually return to $target_url.
*/
-function printLoginForm($target_url)
+function printLoginForm($action, $target_url, $returl)
{
- global $PHP_SELF, $HTTP_REFERER;
- global $returl;
?>
-<form class="form_general" id="logon" method="post" action="<?php echo
htmlspecialchars(basename($PHP_SELF)) ?>">
+<form class="form_general" id="logon" method="post" action="<?php echo
htmlspecialchars($action) ?>">
<fieldset>
<legend><?php echo get_vocab("please_login") ?></legend>
<div>
@@ -117,7 +122,7 @@
if (isset($Action) && ($Action == "QueryName"))
{
print_header(0, 0, 0, 0, "");
- printLoginForm($target_url);
+ printLoginForm(this_page(), $target_url, $returl);
exit();
}
@@ -129,18 +134,19 @@
*/
function authGet()
{
- global $PHP_SELF, $QUERY_STRING;
+ global $QUERY_STRING;
+ global $returl;
print_header(0, 0, 0, 0, "");
echo "<p>".get_vocab("norights")."</p>\n";
- $target_url = basename($PHP_SELF);
+ $target_url = this_page();
if (isset($QUERY_STRING))
{
$target_url = $target_url . "?" . $QUERY_STRING;
}
- printLoginForm($target_url);
+ printLoginForm(this_page(), $target_url, $returl);
exit();
}
@@ -153,9 +159,9 @@
// Print the logon entry on the top banner.
function PrintLogonBox()
{
- global $PHP_SELF, $QUERY_STRING, $user_list_link, $day, $month, $year;
+ global $QUERY_STRING, $user_list_link, $day, $month, $year;
- $target_url = basename($PHP_SELF);
+ $target_url = this_page();
if (isset($url_base) && ($url_base !== ''))
{
$target_url = $url_base . '/' . $target_url;
diff -r 80a2abed20b6 -r f86a6a7f12c1 web/session/session_wordpress.inc
--- a/web/session/session_wordpress.inc Tue Feb 21 14:03:54 2017 +0000
+++ b/web/session/session_wordpress.inc Tue Feb 21 14:18:48 2017 +0000
@@ -10,6 +10,13 @@
$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 : '';
+}
/*
Target of the form with sets the URL argument "Action=QueryName".
@@ -18,7 +25,7 @@
if (isset($Action) && ($Action == "QueryName"))
{
print_header(0, 0, 0, 0, "");
- printLoginForm($target_url);
+ printLoginForm(this_page(), $target_url, $returl);
exit();
}
@@ -45,7 +52,7 @@
$errors = $wp_user; // $errors is a WordPress global
print_header(0, 0, 0, 0, "");
echo "<p>" . apply_filters ('login_errors',
$wp_user->get_error_message()) . "</p>\n";
- printLoginForm($target_url);
+ printLoginForm(this_page(), $target_url, $returl);
exit();
}
}
@@ -81,14 +88,11 @@
Display the login form. Used by two routines below.
Will eventually return to $target_url.
*/
-function printLoginForm($target_url)
+function printLoginForm($action, $target_url, $returl)
{
- global $HTTP_REFERER;
- global $returl;
-
// __() and esc_attr__() are WordPress functions
- echo '<form class="form_general" id="logon" method="post" action="' .
htmlspecialchars(this_page()) . "\">\n";
+ echo '<form class="form_general" id="logon" method="post" action="' .
htmlspecialchars($action) . "\">\n";
echo "<fieldset>\n";
echo '<legend>' . get_vocab("please_login") . "</legend>\n";
echo "<div>\n";
@@ -131,7 +135,8 @@
*/
function authGet()
{
- global $PHP_SELF, $QUERY_STRING;
+ global $QUERY_STRING;
+ global $returl;
print_header(0, 0, 0, 0, "");
@@ -142,7 +147,7 @@
{
$target_url = $target_url . "?" . $QUERY_STRING;
}
- printLoginForm($target_url);
+ printLoginForm(this_page(), $target_url, $returl);
exit();
}
@@ -163,7 +168,7 @@
// Print the logon entry on the top banner.
function PrintLogonBox()
{
- global $PHP_SELF, $QUERY_STRING, $user_list_link, $day, $month, $year;
+ global $QUERY_STRING, $user_list_link, $day, $month, $year;
$target_url = this_page();
if (isset($url_base) && ($url_base !== ''))
------------------------------------------------------------------------------
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