Ignore:
Timestamp:
Sep 4, 2008, 3:28:34 AM (16 years ago)
Author:
rvelices
Message:
  • bug 854: better checks of directory creations ( local_data_dir, templates_c, tmp etc...)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_mail.inc.php

    r2479 r2497  
    796796    global $conf, $user, $lang_info;
    797797    $dir = $conf['local_data_dir'].'/tmp';
    798     @mkdir( $dir );
    799     $filename = $dir.'/mail.'.$user['username'].'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme'];
    800     if ($args['content_format'] == 'text/plain')
    801     {
    802       $filename .= '.txt';
    803     }
    804     else
    805     {
    806       $filename .= '.html';
    807     }
    808     $file = fopen($filename, 'w+');
    809     fwrite($file, $to ."\n");
    810     fwrite($file, $subject ."\n");
    811     fwrite($file, $headers);
    812     fwrite($file, $content);
    813     fclose($file);
     798    if ( mkgetdir( $dir,  MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR) )
     799    {
     800      $filename = $dir.'/mail.'.$user['username'].'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme'];
     801      if ($args['content_format'] == 'text/plain')
     802      {
     803        $filename .= '.txt';
     804      }
     805      else
     806      {
     807        $filename .= '.html';
     808      }
     809      $file = fopen($filename, 'w+');
     810      fwrite($file, $to ."\n");
     811      fwrite($file, $subject ."\n");
     812      fwrite($file, $headers);
     813      fwrite($file, $content);
     814      fclose($file);
     815    }
    814816    return $result;
    815817}
Note: See TracChangeset for help on using the changeset viewer.