aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/common.inc.php2
-rw-r--r--include/filter.inc.php4
-rw-r--r--include/functions.inc.php36
-rw-r--r--include/functions_calendar.inc.php2
-rw-r--r--include/section_init.inc.php4
5 files changed, 42 insertions, 6 deletions
diff --git a/include/common.inc.php b/include/common.inc.php
index 2f160a4bb..e07f34a5b 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -177,7 +177,7 @@ if ($conf['gallery_locked'])
}
if ($user['is_the_guest'] and !$conf['guest_access']
- and !in_array( basename($_SERVER['SCRIPT_FILENAME']),
+ and !in_array( script_basename(),
array('identification.php',
'password.php',
'register.php'
diff --git a/include/filter.inc.php b/include/filter.inc.php
index cca046050..f5ea3cd4f 100644
--- a/include/filter.inc.php
+++ b/include/filter.inc.php
@@ -34,13 +34,13 @@ $filter = array();
$filter['enabled'] =
- (in_array(basename($_SERVER['SCRIPT_FILENAME']), $conf['filter_pages'])) and
+ (in_array(script_basename(), $conf['filter_pages'])) and
(
(isset($_GET['filter']) and ($_GET['filter'] == 'start')) or
pwg_get_session_var('filter_enabled', false)
);
-if (in_array(basename($_SERVER['SCRIPT_FILENAME']), $conf['filter_pages']))
+if (in_array(script_basename(), $conf['filter_pages']))
{
if (isset($_GET['filter']))
{
diff --git a/include/functions.inc.php b/include/functions.inc.php
index f9fbaf88f..e5d26f63e 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -1108,4 +1108,40 @@ SELECT param,value
}
}
}
+
+/**
+ * Return basename of the current script
+ * Return value are chnage to loawer case
+ *
+ * @param void
+ *
+ * @return script basename
+ */
+function script_basename()
+{
+ if (!empty($_SERVER['SCRIPT_NAME']))
+ {
+ $file_name = $_SERVER['SCRIPT_NAME'];
+ }
+ else if (!empty($_SERVER['PHP_SELF']))
+ {
+ $file_name = $_SERVER['PHP_SELF'];
+ }
+ else if (!empty($_SERVER['SCRIPT_FILENAME']))
+ {
+ $file_name = $_SERVER['SCRIPT_FILENAME'];
+ }
+ else if (!empty($_SERVER['PATH_TRANSLATED']))
+ {
+ $file_name = $_SERVER['PATH_TRANSLATED'];
+ }
+ else
+ {
+ $file_name = '';
+ }
+
+ // $_SERVER return lower string following var ans systems
+ return basename(strtolower($file_name));
+}
+
?>
diff --git a/include/functions_calendar.inc.php b/include/functions_calendar.inc.php
index 3bb70ed35..cca864218 100644
--- a/include/functions_calendar.inc.php
+++ b/include/functions_calendar.inc.php
@@ -186,7 +186,7 @@ WHERE id IN (' . implode(',',$page['items']) .')';
//echo ('<pre>'. var_export($calendar, true) . '</pre>');
$must_show_list = true; // true until calendar generates its own display
- if (basename($_SERVER['SCRIPT_FILENAME']) != 'picture.php')
+ if (script_basename() != 'picture.php')
{
$template->assign_block_vars('calendar', array());
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index 68fe8d452..622be2e07 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -86,7 +86,7 @@ $tokens = explode(
// );
$next_token = 0;
-if (basename($_SERVER['SCRIPT_FILENAME']) == 'picture.php')
+if (script_basename() == 'picture.php')
{ // the first token must be the identifier for the picture
if ( isset($_GET['image_id'])
and isset($_GET['cat']) and is_numeric($_GET['cat']) )
@@ -706,7 +706,7 @@ if (isset($page['chronology_field']))
$page['cat_nb_images'] = isset($page['items']) ? count($page['items']) : 0;
-if (basename($_SERVER['SCRIPT_FILENAME']) == 'picture.php'
+if (script_basename() == 'picture.php'
and !isset($page['image_id']) )
{
if ( !empty($page['items']) )