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