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

git-svn-id: http://svn.automattic.com/wordpress/trunk@5867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2007-08-14 02:58:33 +00:00
parent 638d5e6e39
commit dc1c54a35c
4 changed files with 28 additions and 19 deletions

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() {
}
}
?>
?>