Changeset 1914


Ignore:
Timestamp:
Mar 16, 2007, 1:08:25 PM (17 years ago)
Author:
rub
Message:

Fix bug: Don't invoke mail function when there aren't recipient.

File:
1 edited

Legend:

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

    r1912 r1914  
    66// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net         |
    77// +-----------------------------------------------------------------------+
    8 // | branch        : BSF (Best So Far)
    9 // | file          : $RCSfile$
     8// | file          : $Id$
    109// | last update   : $Date$
    1110// | last modifier : $Author$
     
    291290  }
    292291
    293   $keyargs_content_admin_info = array
    294   (
    295     get_l10n_args('Connected user: %s', $user['username']),
    296     get_l10n_args('IP: %s', $_SERVER['REMOTE_ADDR']),
    297     get_l10n_args('Browser: %s', $_SERVER['HTTP_USER_AGENT'])
    298   );
    299 
    300   switch_lang_to($conf['default_language']);
    301 
    302   $return = pwg_mail
    303   (
    304     '',
    305     array
     292  if (count($admins) > 0)
     293  {
     294    $keyargs_content_admin_info = array
    306295    (
    307       'Bcc' => $admins,
    308       'subject' => '['.$conf['gallery_title'].'] '.l10n_args($keyargs_subject),
    309       'content' =>
    310          l10n_args($keyargs_content)."\n\n"
    311         .l10n_args($keyargs_content_admin_info)."\n",
    312       'content_format' => 'text/plain'
    313     )
    314   ) and $return;
    315 
    316   switch_lang_back();
     296      get_l10n_args('Connected user: %s', $user['username']),
     297      get_l10n_args('IP: %s', $_SERVER['REMOTE_ADDR']),
     298      get_l10n_args('Browser: %s', $_SERVER['HTTP_USER_AGENT'])
     299    );
     300
     301    switch_lang_to($conf['default_language']);
     302
     303    $return = pwg_mail
     304    (
     305      '',
     306      array
     307      (
     308        'Bcc' => $admins,
     309        'subject' => '['.$conf['gallery_title'].'] '.l10n_args($keyargs_subject),
     310        'content' =>
     311           l10n_args($keyargs_content)."\n\n"
     312          .l10n_args($keyargs_content_admin_info)."\n",
     313        'content_format' => 'text/plain'
     314      )
     315    ) and $return;
     316
     317    switch_lang_back();
     318  }
    317319
    318320  return $return;
     
    400402      }
    401403
    402       switch_lang_to($elem['language']);
    403 
    404       $mail_template = get_mail_template($email_format, $elem);
    405       $mail_template->set_filename($tpl_shortname,
    406         (IN_ADMIN ? 'admin/' : '').$tpl_shortname.'.tpl');
    407       $mail_template->assign_vars($assign_vars);
    408 
    409       $return = pwg_mail
    410       (
    411         '',
    412         array
     404      if (count($Bcc) > 0)
     405      {
     406        switch_lang_to($elem['language']);
     407
     408        $mail_template = get_mail_template($email_format, $elem);
     409        $mail_template->set_filename($tpl_shortname,
     410          (IN_ADMIN ? 'admin/' : '').$tpl_shortname.'.tpl');
     411        $mail_template->assign_vars($assign_vars);
     412
     413        $return = pwg_mail
    413414        (
    414           'Bcc' => $Bcc,
    415           'subject' => l10n_args($keyargs_subject),
    416           'email_format' => $email_format,
    417           'content' => $mail_template->parse($tpl_shortname, true),
    418           'content_format' => $email_format,
    419           'template' => $elem['template'],
    420           'theme' => $elem['theme']
    421         )
    422       ) and $return;
    423 
    424       switch_lang_back();
     415          '',
     416          array
     417          (
     418            'Bcc' => $Bcc,
     419            'subject' => l10n_args($keyargs_subject),
     420            'email_format' => $email_format,
     421            'content' => $mail_template->parse($tpl_shortname, true),
     422            'content_format' => $email_format,
     423            'template' => $elem['template'],
     424            'theme' => $elem['theme']
     425          )
     426        ) and $return;
     427
     428        switch_lang_back();
     429      }
    425430    }
    426431  }
     
    452457  global $conf, $conf_mail, $lang_info, $page;
    453458
     459  if (empty($to) and empty($args['Cc']) and empty($args['Bcc']))
     460  {
     461    return true;
     462  }
     463 
    454464  if (!isset($conf_mail))
    455465  {
Note: See TracChangeset for help on using the changeset viewer.