- Timestamp:
- Jul 24, 2007, 9:16:02 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1_7/include/functions.inc.php
r1990 r2072 1285 1285 1286 1286 /** 1287 * Return is "file_name" argument is candidate to1288 * compute script_basename value1289 *1290 * @param string file_name1291 *1292 * @return boolean is candidate or not?1293 */1294 function is_script_basename($file_name)1295 {1296 $file_name = basename($file_name);1297 return !empty($file_name);1298 }1299 1300 /**1301 1287 * Return basename of the current script 1302 1288 * Lower case convertion is applied on return value … … 1309 1295 function script_basename() 1310 1296 { 1311 if (is_script_basename($_SERVER['SCRIPT_NAME'])) 1312 { 1313 $file_name = $_SERVER['SCRIPT_NAME']; 1314 } 1315 else if (is_script_basename($_SERVER['SCRIPT_FILENAME'])) 1316 { 1317 $file_name = $_SERVER['SCRIPT_FILENAME']; 1318 } 1319 else 1320 { 1321 $file_name = ''; 1322 } 1323 1324 // $_SERVER return lower string following var and systems 1325 return basename(strtolower($file_name), '.php'); 1297 global $conf; 1298 1299 foreach (array('SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF') as $value) 1300 { 1301 $continue = !empty($_SERVER[$value]); 1302 if ($continue) 1303 { 1304 $filename = strtolower($_SERVER[$value]); 1305 1306 if ($conf['php_extension_in_urls']) 1307 { 1308 $continue = get_extension($filename) === 'php'; 1309 } 1310 1311 if ($continue) 1312 { 1313 $basename = basename($filename, '.php'); 1314 $continue = !empty($basename); 1315 } 1316 1317 if ($continue) 1318 { 1319 return $basename; 1320 } 1321 } 1322 } 1323 1324 return ''; 1326 1325 } 1327 1326
Note: See TracChangeset
for help on using the changeset viewer.