diff options
author | rub <rub@piwigo.org> | 2007-04-29 15:52:41 +0000 |
---|---|---|
committer | rub <rub@piwigo.org> | 2007-04-29 15:52:41 +0000 |
commit | 24bbf9758d94fd0f30b1034abd2718fc1a55ebc8 (patch) | |
tree | 1f85b32f2067955fa49c1e41fb18ab5716b3dbad /include | |
parent | 877564c8c55195fa878d5453b1b3824f1b4842b0 (diff) |
Issue 0000529:
Enhance computing method of script_basename function.
http://forum.phpwebgallery.net/viewtopic.php?pid=58258#p58258
git-svn-id: http://piwigo.org/svn/trunk@1989 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-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']; } |