From 9e1c8ededcea32fa55854fa08eef227ffcf8a593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Sun, 1 Jul 2007 22:13:35 +0000 Subject: #119196 by douggreen: apply file API common sense (permissions, file API functions instead of custom code) to files handled by color.module --- modules/color/color.module | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/color/color.module b/modules/color/color.module index f0866560e..90a17a67d 100644 --- a/modules/color/color.module +++ b/modules/color/color.module @@ -238,12 +238,10 @@ function color_scheme_form_submit($form, &$form_state) { // Prepare target locations for generated files $id = $theme .'-'. substr(md5(serialize($palette) . microtime()), 0, 8); - $paths['color'] = variable_get('file_directory_path', 'files') .'/color'; + $paths['color'] = file_directory_path() .'/color'; $paths['target'] = $paths['color'] .'/'. $id; foreach ($paths as $path) { - if (!is_dir($path)) { - mkdir($path); - } + file_check_directory($path, FILE_CREATE_DIRECTORY); } $paths['target'] = $paths['target'] .'/'; $paths['id'] = $id; @@ -259,7 +257,8 @@ function color_scheme_form_submit($form, &$form_state) { // Copy over neutral images foreach ($info['copy'] as $file) { $base = basename($file); - copy($paths['source'] . $file, $paths['target'] . $base); + $source = $paths['source'] . $file; + file_copy($source, $paths['target'] . $base); $paths['map'][$file] = $base; $paths['files'][] = $paths['target'] . $base; } @@ -350,6 +349,9 @@ function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette) { fwrite($file, $output); fclose($file); $paths['files'][] = $paths['stylesheet']; + + // Set standard file permissions for webserver-generated files + @chmod($paths['stylesheet'], 0664); } /** @@ -413,6 +415,9 @@ function _color_render_images($theme, &$info, &$paths, $palette) { imagedestroy($slice); $paths['files'][] = $image; + // Set standard file permissions for webserver-generated files + @chmod(realpath($image), 0664); + // Build before/after map of image paths. $paths['map'][$file] = $base; } -- cgit v1.2.3