diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-07-01 22:13:35 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-07-01 22:13:35 +0000 |
commit | 9e1c8ededcea32fa55854fa08eef227ffcf8a593 (patch) | |
tree | 0cfdb5dc510850dab92548aa519d790ef6d1aa0e /modules | |
parent | ef29077044df8735be7fdaeed7c32181eee0ed29 (diff) | |
download | brdo-9e1c8ededcea32fa55854fa08eef227ffcf8a593.tar.gz brdo-9e1c8ededcea32fa55854fa08eef227ffcf8a593.tar.bz2 |
#119196 by douggreen: apply file API common sense (permissions, file API functions instead of custom code) to files handled by color.module
Diffstat (limited to 'modules')
-rw-r--r-- | modules/color/color.module | 15 |
1 files changed, 10 insertions, 5 deletions
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; } |