diff -wBurp /home/fantomas/trans/drupal-5.7/includes/file.inc includes/file.inc --- /home/fantomas/trans/drupal-5.7/includes/file.inc 2008-01-07 04:00:22.000000000 +0300 +++ includes/file.inc 2008-07-04 11:08:22.000000000 +0400 @@ -143,7 +144,7 @@ function file_check_path(&$path) { } // Check if path is a possible dir/file. - $filename = basename($path); + $filename = drupal_basename($path); $path = dirname($path); if (file_check_directory($path)) { return $filename; @@ -221,8 +221,7 @@ function file_check_upload($source = 'up // Begin building file object. $file = new stdClass(); - $file->filename = trim(basename($_FILES["files"]["name"][$source]), '.'); - + $file->filename = trim(drupal_basename($_FILES["files"]["name"][$source]), '.'); // Create temporary name/path for newly uploaded files. On Windows, tempnam() // requires an absolute path, so we use realpath(). $file->filepath = tempnam(realpath(file_directory_temp()), 'tmp_'); @@ -283,7 +282,7 @@ function file_check_location($source, $d } else { // This file does not yet exist - $source = realpath(dirname($source)) .'/'. basename($source); + $source = realpath(dirname($source)) .'/'. drupal_basename($source); } $directory = realpath($directory); if ($directory && strpos($source, $directory) !== 0) { @@ -341,7 +340,7 @@ function file_copy(&$source, $dest = 0, } // If the destination file is not specified then use the filename of the source file. - $basename = $basename ? $basename : basename($source); + $basename = $basename ? $basename : drupal_basename($source); $dest = $directory .'/'. $basename; // Make sure source and destination filenames are not the same, makes no sense @@ -648,7 +647,7 @@ function file_scan_directory($dir, $mask } elseif ($depth >= $min_depth && ereg($mask, $file)) { $filename = "$dir/$file"; - $basename = basename($file); + $basename = drupal_basename($file); $name = substr($basename, 0, strrpos($basename, '.')); $files[$$key] = new stdClass(); $files[$$key]->filename = $filename; @@ -734,3 +733,12 @@ function file_upload_max_size() { } return $max_size; } + +function drupal_basename($path,$prefix = '') { + $path = preg_replace('|^.+[\\/]|', '', $path); + if ($prefix) { + $path = preg_replace('|'. preg_quote($prefix) .'$|', '', $path); + } + return $path; +} + \ В конце файла нет новой строки diff -wBurp /home/fantomas/trans/drupal-5.7/includes/theme.inc includes/theme.inc --- /home/fantomas/trans/drupal-5.7/includes/theme.inc 2007-05-31 09:52:42.000000000 +0400 +++ includes/theme.inc 2008-07-04 10:59:35.000000000 +0400 @@ -59,7 +59,7 @@ function init_theme() { // File is a style; loads its CSS. // Set theme to its template/theme drupal_add_css($themes[$theme]->filename, 'theme'); - $theme = basename(dirname($themes[$theme]->description)); + $theme = drupal_basename(dirname($themes[$theme]->description)); } else { // File is a template/theme @@ -76,7 +76,7 @@ function init_theme() { elseif (strpos($themes[$theme]->description, '.engine')) { // file is a template; include its engine include_once './' . $themes[$theme]->description; - $theme_engine = basename($themes[$theme]->description, '.engine'); + $theme_engine = drupal_basename($themes[$theme]->description, '.engine'); if (function_exists($theme_engine .'_init')) { call_user_func($theme_engine .'_init', $themes[$theme]); }