aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r--include/functions.inc.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 06847b550..eb4d4adec 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -967,4 +967,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));
+}
+
?>