thomascube
2005-11-06 10a699759d4f106f29c077a6d65d3b8d212825e5
program/steps/mail/compose.inc
@@ -32,6 +32,10 @@
  $_SESSION['compose'] = array('id' => uniqid(rand()));
// add some labels to client
rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'sendingmessage');
if ($_GET['_reply_uid'] || $_GET['_forward_uid'])
  {
  $msg_uid = $_GET['_reply_uid'] ? $_GET['_reply_uid'] : $_GET['_forward_uid'];
@@ -83,17 +87,15 @@
      // pass the following attributes to the form class
      $field_attrib = array('name' => '_from');
      foreach ($attrib as $attr => $value)
        if (in_array($attr, array('id', 'class', 'style', 'size')))
        if (in_array($attr, array('id', 'class', 'style', 'size', 'tabindex')))
          $field_attrib[$attr] = $value;
    
      // get this user's identities
      $sql_result = $DB->query(sprintf("SELECT identity_id, name, email
                                        FROM   %s
                                        WHERE  user_id=%d
                                        AND    del!='1'
                                        ORDER BY `default` DESC, name ASC",
                                       get_table_name('identities'),
                                       $_SESSION['user_id']));
      $sql_result = $DB->query("SELECT identity_id, name, email
                                FROM   ".get_table_name('identities')." WHERE  user_id=?
                                AND    del<>'1'
                                ORDER BY ".$DB->quoteIdentifier('default')." DESC, name ASC",
                                $_SESSION['user_id']);
                                   
      if ($DB->num_rows($sql_result))
        {        
@@ -123,14 +125,11 @@
      if (!empty($_GET['_to']) && preg_match('/[0-9]+,?/', $_GET['_to']))
        {
        $a_recipients = array();
        $sql_result = $DB->query(sprintf("SELECT name, email
                                          FROM   %s
                                          WHERE  user_id=%d
                                          AND    del!='1'
                                          AND    contact_id IN (%s)",
                                         get_table_name('contacts'),
                                         $_SESSION['user_id'],
                                         $_GET['_to']));
        $sql_result = $DB->query("SELECT name, email
                                  FROM ".get_table_name('contacts')." WHERE user_id=?
                                  AND    del<>'1'
                                  AND    contact_id IN (".$_GET['_to'].")",
                                  $_SESSION['user_id']);
                                         
        while ($sql_arr = $DB->fetch_assoc($sql_result))
          $a_recipients[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);
@@ -151,14 +150,14 @@
      if (!$fname)
        $fname = '_bcc';
        
      $allow_attrib = array('id', 'class', 'style', 'cols', 'rows', 'wrap');
      $allow_attrib = array('id', 'class', 'style', 'cols', 'rows', 'wrap', 'tabindex');
      $field_type = 'textarea';            
      break;
    case 'replyto':
    case 'reply-to':
      $fname = '_replyto';
      $allow_attrib = array('id', 'class', 'style', 'size');
      $allow_attrib = array('id', 'class', 'style', 'size', 'tabindex');
      $field_type = 'textfield';
      break;
    
@@ -403,11 +402,21 @@
    
  // create a reply-subject
  else if (isset($REPLY_MESSAGE['subject']))
    $subject = 'Re: '.$REPLY_MESSAGE['subject'];
    {
    if (eregi('^re:', $REPLY_MESSAGE['subject']))
      $subject = $REPLY_MESSAGE['subject'];
    else
      $subject = 'Re: '.$REPLY_MESSAGE['subject'];
    }
  // create a forward-subject
  else if (isset($FORWARD_MESSAGE['subject']))
    $subject = 'Fwd: '.$FORWARD_MESSAGE['subject'];
    {
    if (eregi('^fwd:', $REPLY_MESSAGE['subject']))
      $subject = $FORWARD_MESSAGE['subject'];
    else
      $subject = 'Fwd: '.$FORWARD_MESSAGE['subject'];
    }
  
  $out = $form_start ? "$form_start\n" : '';
@@ -499,7 +508,7 @@
                       rcube_label('normal'),
                       rcube_label('high'),
                       rcube_label('highest')),
                 array(1, 2, 0, 4, 5));
                 array(5, 4, 0, 2, 1));
                 
  $sel = isset($_POST['_priority']) ? $_POST['_priority'] : 0;
@@ -549,12 +558,9 @@
/****** get contacts for this user and add them to client scripts ********/
$sql_result = $DB->query(sprintf("SELECT name, email
                                  FROM   %s
                                  WHERE  user_id=%d
                                  AND    del!='1'",
                                 get_table_name('contacts'),
                                 $_SESSION['user_id']));
$sql_result = $DB->query("SELECT name, email
                          FROM ".get_table_name('contacts')." WHERE  user_id=?
                          AND  del<>'1'",$_SESSION['user_id']);
                                   
if ($DB->num_rows($sql_result))
  {