diff options
author | rub <rub@piwigo.org> | 2007-04-29 15:54:31 +0000 |
---|---|---|
committer | rub <rub@piwigo.org> | 2007-04-29 15:54:31 +0000 |
commit | 933749789c403c811add7277c5e92a88902c4f78 (patch) | |
tree | e1b5f981bca0587eeb749d2c3ae1e1e12e83a195 | |
parent | 8192a92ff45765f34fc9645a2bd9753437da360a (diff) |
Issue 0000529:
Enhance computing method of script_basename function.
http://forum.phpwebgallery.net/viewtopic.php?pid=58258#p58258
Merge BSF 1988:1989 into branch-1_7
git-svn-id: http://piwigo.org/svn/branches/branch-1_7@1990 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | include/functions.inc.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index 69174ea4d..becace1a4 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -1284,6 +1284,20 @@ function hash_from_query($query, $keyname) } /** + * Return is "file_name" argument is candidate to + * compute script_basename value + * + * @param string file_name + * + * @return boolean is candidate or not? + */ +function is_script_basename($file_name) +{ + $file_name = basename($file_name); + return !empty($file_name); +} + +/** * Return basename of the current script * Lower case convertion is applied on return value * Return value is without file extention ".php" @@ -1294,11 +1308,11 @@ function hash_from_query($query, $keyname) */ function script_basename() { - if (!empty($_SERVER['SCRIPT_NAME'])) + if (is_script_basename($_SERVER['SCRIPT_NAME'])) { $file_name = $_SERVER['SCRIPT_NAME']; } - else if (!empty($_SERVER['SCRIPT_FILENAME'])) + else if (is_script_basename($_SERVER['SCRIPT_FILENAME'])) { $file_name = $_SERVER['SCRIPT_FILENAME']; } |