Use opendir instead of dir. Props nbachiyski. fixes #4450

git-svn-id: https://develop.svn.wordpress.org/trunk@5867 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2007-08-14 02:58:33 +00:00
parent 9d8324b07b
commit 3e5d2230d2
4 changed files with 28 additions and 19 deletions
+7 -5
View File
@@ -1103,9 +1103,9 @@ function make_site_theme_from_default($theme_name, $template) {
// Copy files from the default theme to the site theme.
//$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');
$theme_dir = @ dir("$default_dir");
$theme_dir = @ opendir("$default_dir");
if ($theme_dir) {
while(($theme_file = $theme_dir->read()) !== false) {
while(($theme_file = readdir( $theme_dir )) !== false) {
if (is_dir("$default_dir/$theme_file"))
continue;
if (! @copy("$default_dir/$theme_file", "$site_dir/$theme_file"))
@@ -1113,6 +1113,7 @@ function make_site_theme_from_default($theme_name, $template) {
chmod("$site_dir/$theme_file", 0777);
}
}
@closedir($theme_dir);
// Rewrite the theme header.
$stylelines = explode("\n", implode('', file("$site_dir/style.css")));
@@ -1136,9 +1137,9 @@ function make_site_theme_from_default($theme_name, $template) {
return false;
}
$images_dir = @ dir("$default_dir/images");
$images_dir = @ opendir("$default_dir/images");
if ($images_dir) {
while(($image = $images_dir->read()) !== false) {
while(($image = readdir($images_dir)) !== false) {
if (is_dir("$default_dir/images/$image"))
continue;
if (! @copy("$default_dir/images/$image", "$site_dir/images/$image"))
@@ -1146,6 +1147,7 @@ function make_site_theme_from_default($theme_name, $template) {
chmod("$site_dir/images/$image", 0777);
}
}
@closedir($images_dir);
}
// Create a site theme from the default theme.
@@ -1232,4 +1234,4 @@ function maybe_disable_automattic_widgets() {
}
}
?>
?>