Changeset:
0de8f79338ac
https://sourceforge.net/p/mrbs/hg-code/ci/0de8f79338acc2d568fa97665ff6a421ffe16a02
Author:
John Beranek <[email protected]>
Date:
Wed Oct 05 08:57:52 2016 +0100
Log message:
Removed code duplication
diffstat:
web/Themes/default/header.inc | 5 +----
web/mincals.inc | 10 ++++++----
web/mrbs_auth.inc | 6 ++++--
web/session/session_cookie.inc | 4 ++--
web/session/session_http.inc | 2 +-
web/session/session_php.inc | 4 ++--
web/session/session_wordpress.inc | 4 ++--
7 files changed, 18 insertions(+), 17 deletions(-)
diffs (159 lines):
diff -r 093dca6a5284 -r 0de8f79338ac web/Themes/default/header.inc
--- a/web/Themes/default/header.inc Wed Oct 05 08:21:32 2016 +0100
+++ b/web/Themes/default/header.inc Wed Oct 05 08:57:52 2016 +0100
@@ -211,9 +211,6 @@
function print_theme_header($day, $month, $year, $area, $room, $simple=false)
{
global $search_str, $locale_warning;
- global $PHP_SELF;
-
- $page = basename($PHP_SELF, ".php");
// Need to set the timezone before we can use date()
get_area_settings($area);
@@ -241,7 +238,7 @@
// Put the filename in as a class to aid styling.
// (Use a class rather than id to avoid specificity problems)
- echo "<body class=\"non_js ".htmlspecialchars($page)."\">\n";
+ echo "<body class=\"non_js ".htmlspecialchars(this_page('.php'))."\">\n";
if (!$simple)
{
diff -r 093dca6a5284 -r 0de8f79338ac web/mincals.inc
--- a/web/mincals.inc Wed Oct 05 08:21:32 2016 +0100
+++ b/web/mincals.inc Wed Oct 05 08:57:52 2016 +0100
@@ -51,9 +51,11 @@
if (!isset($weekstarts)) $weekstarts = 0;
$s = "";
+
+ $page = this_page();
// For the week view we will need to know the start of the week that
should be highlighted
- if (preg_match("/week/i", basename($PHP_SELF)))
+ if (preg_match("/week/i", $page))
{
// First of all work out how many days we have to skip back to the
@@ -178,7 +180,7 @@
// then work out whether to mark it as the current day/week/month
- if (preg_match("/day/i", basename($PHP_SELF))) // DAY
VIEW
+ if (preg_match("/day/i", $page)) // DAY VIEW
{
if (($d == $this->day) and ($this->h))
{
@@ -186,7 +188,7 @@
}
}
- elseif (preg_match("/week/i", basename($PHP_SELF))) //
WEEK VIEW
+ elseif (preg_match("/week/i", $page)) // WEEK VIEW
{
// work out current time and if we're up to 7 days after the
// start of the week to be highlighted then mark it as the
@@ -203,7 +205,7 @@
}
}
- elseif (preg_match("/month/i", basename($PHP_SELF))) //
MONTH VIEW
+ elseif (preg_match("/month/i", $page)) // MONTH VIEW
{
if ($this->h)
{
diff -r 093dca6a5284 -r 0de8f79338ac web/mrbs_auth.inc
--- a/web/mrbs_auth.inc Wed Oct 05 08:21:32 2016 +0100
+++ b/web/mrbs_auth.inc Wed Oct 05 08:57:52 2016 +0100
@@ -90,11 +90,13 @@
global $page_level, $max_level;
global $day, $month, $year, $area, $room;
global $PHP_SELF;
+
+ $page = this_page();
// Get the minimum authorisation level for this page
- if (isset($page_level[basename($PHP_SELF)]))
+ if (isset($page_level[$page]))
{
- $required_level = $page_level[basename($PHP_SELF)];
+ $required_level = $page_level[$page];
}
elseif (isset($max_level))
{
diff -r 093dca6a5284 -r 0de8f79338ac web/session/session_cookie.inc
--- a/web/session/session_cookie.inc Wed Oct 05 08:21:32 2016 +0100
+++ b/web/session/session_cookie.inc Wed Oct 05 08:57:52 2016 +0100
@@ -207,7 +207,7 @@
echo "<p>".get_vocab("norights")."</p>\n";
- $TargetURL = basename($PHP_SELF);
+ $TargetURL = this_page();
if (isset($QUERY_STRING))
{
$TargetURL = $TargetURL . "?" . $QUERY_STRING;
@@ -308,7 +308,7 @@
{
global $PHP_SELF, $QUERY_STRING, $user_list_link, $day, $month, $year;
- $TargetURL = basename($PHP_SELF);
+ $TargetURL = this_page();
if (isset($url_base) && ($url_base !== ''))
{
$TargetURL = $url_base . '/' . $TargetURL;
diff -r 093dca6a5284 -r 0de8f79338ac web/session/session_http.inc
--- a/web/session/session_http.inc Wed Oct 05 08:21:32 2016 +0100
+++ b/web/session/session_http.inc Wed Oct 05 08:57:52 2016 +0100
@@ -81,7 +81,7 @@
{
global $PHP_SELF, $QUERY_STRING, $user_list_link, $day, $month, $year;
- $TargetURL = basename($PHP_SELF);
+ $TargetURL = this_page();
if (isset($url_base) && ($url_base !== ''))
{
$TargetURL = $url_base . '/' . $TargetURL;
diff -r 093dca6a5284 -r 0de8f79338ac web/session/session_php.inc
--- a/web/session/session_php.inc Wed Oct 05 08:21:32 2016 +0100
+++ b/web/session/session_php.inc Wed Oct 05 08:57:52 2016 +0100
@@ -217,7 +217,7 @@
echo "<p>".get_vocab("norights")."</p>\n";
- $TargetURL = basename($PHP_SELF);
+ $TargetURL = this_page();
if (isset($QUERY_STRING))
{
$TargetURL = $TargetURL . "?" . $QUERY_STRING;
@@ -248,7 +248,7 @@
{
global $PHP_SELF, $QUERY_STRING, $user_list_link, $day, $month, $year;
- $TargetURL = basename($PHP_SELF);
+ $TargetURL = this_page();
if (isset($url_base) && ($url_base !== ''))
{
$TargetURL = $url_base . '/' . $TargetURL;
diff -r 093dca6a5284 -r 0de8f79338ac web/session/session_wordpress.inc
--- a/web/session/session_wordpress.inc Wed Oct 05 08:21:32 2016 +0100
+++ b/web/session/session_wordpress.inc Wed Oct 05 08:57:52 2016 +0100
@@ -138,7 +138,7 @@
echo "<p>".get_vocab("norights")."</p>\n";
- $TargetURL = basename($PHP_SELF);
+ $TargetURL = this_page();
if (isset($QUERY_STRING))
{
$TargetURL = $TargetURL . "?" . $QUERY_STRING;
@@ -166,7 +166,7 @@
{
global $PHP_SELF, $QUERY_STRING, $user_list_link, $day, $month, $year;
- $TargetURL = basename($PHP_SELF);
+ $TargetURL = this_page();
if (isset($url_base) && ($url_base !== ''))
{
$TargetURL = $url_base . '/' . $TargetURL;
------------------------------------------------------------------------------
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