diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-09-04 01:28:34 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-09-04 01:28:34 +0000 |
commit | efa741187507b388476da9d9a8694c3602479e7c (patch) | |
tree | 01242504f325d8c97cb77afeca8f193ca288d147 /include/functions_mail.inc.php | |
parent | 4002f708e1b701a800b3d6968d12ab9a49c2d071 (diff) |
- bug 854: better checks of directory creations ( local_data_dir, templates_c, tmp etc...)
git-svn-id: http://piwigo.org/svn/trunk@2497 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions_mail.inc.php | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php index d965fc8c5..160ac1bfb 100644 --- a/include/functions_mail.inc.php +++ b/include/functions_mail.inc.php @@ -795,22 +795,24 @@ function pwg_send_mail($result, $to, $subject, $content, $headers) { global $conf, $user, $lang_info; $dir = $conf['local_data_dir'].'/tmp'; - @mkdir( $dir ); - $filename = $dir.'/mail.'.$user['username'].'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme']; - if ($args['content_format'] == 'text/plain') + if ( mkgetdir( $dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR) ) { - $filename .= '.txt'; - } - else - { - $filename .= '.html'; + $filename = $dir.'/mail.'.$user['username'].'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme']; + if ($args['content_format'] == 'text/plain') + { + $filename .= '.txt'; + } + else + { + $filename .= '.html'; + } + $file = fopen($filename, 'w+'); + fwrite($file, $to ."\n"); + fwrite($file, $subject ."\n"); + fwrite($file, $headers); + fwrite($file, $content); + fclose($file); } - $file = fopen($filename, 'w+'); - fwrite($file, $to ."\n"); - fwrite($file, $subject ."\n"); - fwrite($file, $headers); - fwrite($file, $content); - fclose($file); return $result; } add_event_handler('send_mail', 'pwg_send_mail_test', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 6);*/ |