Changeset 3468 in subversion


Ignore:
Timestamp:
Apr 2, 2010 9:53:39 AM (3 years ago)
Author:
alec
Message:
  • Added optional (max_recipients) support to restrict total number of recipients per message (#1484542)
Location:
trunk/roundcubemail
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r3435 r3468  
    22=========================== 
    33 
     4- Added optional (max_recipients) support to restrict total number of recipients per message (#1484542) 
    45- Re-organize editor buttons, add blockquote and search buttons 
    56- Make possible to write inside or after a quoted html message (#1485476) 
  • trunk/roundcubemail/config/main.inc.php.dist

    r3415 r3468  
    180180// How many seconds must pass between emails sent by a user 
    181181$rcmail_config['sendmail_delay'] = 0; 
     182 
     183// Maximum number of recipients per message. Default: 0 (no limit) 
     184$rcmail_config['max_recipients'] = 0;  
    182185 
    183186// add this user-agent to message headers when sending 
  • trunk/roundcubemail/program/localization/en_US/messages.inc

    r3458 r3468  
    112112$messages['smtperror'] = 'SMTP Error: $msg'; 
    113113$messages['emailformaterror'] = 'Incorrect e-mail address: $email'; 
     114$messages['toomanyrecipients'] = 'Too many recipients. Reduce the number of recipients to $max.'; 
    114115 
    115116?> 
  • trunk/roundcubemail/program/localization/pl_PL/messages.inc

    r3408 r3468  
    155155$messages['notuploadedwarning'] = 'Nie wszystkie załĠ
    156156czniki zostały pobrane. Poczekaj lub anuluj pobieranie.'; 
     157$messages['toomanyrecipients'] = 'Zbyt wielu odbiorców. Zmniejsz ich liczbę do $max.'; 
    157158 
    158159?> 
  • trunk/roundcubemail/program/steps/mail/sendmail.inc

    r3446 r3468  
    150150} 
    151151 
    152 // parse email address input 
    153 function rcmail_email_input_format($mailto) 
    154 { 
    155   global $EMAIL_FORMAT_ERROR; 
     152// parse email address input (and count addresses) 
     153function rcmail_email_input_format($mailto, $count=false) 
     154{ 
     155  global $EMAIL_FORMAT_ERROR, $RECIPIENT_COUNT; 
    156156 
    157157  $regexp = array('/[,;]\s*[\r\n]+/', '/[\r\n]+/', '/[,;]\s*$/m', '/;/', '/(\S{1})(<\S+@\S+>)/U'); 
     
    198198  } 
    199199 
     200  if ($count) { 
     201    $RECIPIENT_COUNT += count($result); 
     202  } 
     203 
    200204  return implode(', ', $result); 
    201205} 
     
    213217 
    214218$EMAIL_FORMAT_ERROR = NULL; 
    215  
    216 $mailto = rcmail_email_input_format(get_input_value('_to', RCUBE_INPUT_POST, TRUE, $message_charset)); 
    217 $mailcc = rcmail_email_input_format(get_input_value('_cc', RCUBE_INPUT_POST, TRUE, $message_charset)); 
    218 $mailbcc = rcmail_email_input_format(get_input_value('_bcc', RCUBE_INPUT_POST, TRUE, $message_charset)); 
     219$RECIPIENT_COUNT = 0; 
     220 
     221$mailto = rcmail_email_input_format(get_input_value('_to', RCUBE_INPUT_POST, TRUE, $message_charset), true); 
     222$mailcc = rcmail_email_input_format(get_input_value('_cc', RCUBE_INPUT_POST, TRUE, $message_charset), true); 
     223$mailbcc = rcmail_email_input_format(get_input_value('_bcc', RCUBE_INPUT_POST, TRUE, $message_charset), true); 
    219224 
    220225if ($EMAIL_FORMAT_ERROR) { 
     
    298303  $headers['Bcc'] = $mailbcc; 
    299304   
    300 if (!empty($identity_arr['bcc'])) 
     305if (!empty($identity_arr['bcc'])) { 
    301306  $headers['Bcc'] = ($headers['Bcc'] ? $headers['Bcc'].', ' : '') . $identity_arr['bcc']; 
     307  $RECIPIENT_COUNT ++; 
     308} 
     309 
     310if (($max_recipients = (int) $RCMAIL->config->get('max_recipients')) > 0) { 
     311  if ($RECIPIENT_COUNT > $max_recipients) { 
     312    $OUTPUT->show_message('toomanyrecipients', 'error', array('max' => $max_recipients)); 
     313    $OUTPUT->send('iframe'); 
     314  } 
     315} 
    302316 
    303317// add subject 
     
    360374 
    361375 
    362 $isHtmlVal = strtolower(get_input_value('_is_html', RCUBE_INPUT_POST)); 
    363 $isHtml = ($isHtmlVal == "1"); 
     376$isHtml = (bool) get_input_value('_is_html', RCUBE_INPUT_POST); 
    364377 
    365378// fetch message body 
Note: See TracChangeset for help on using the changeset viewer.