Changeset 597170f in github for program/steps/mail/compose.inc


Ignore:
Timestamp:
Oct 4, 2005 4:28:01 PM (8 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
42b1135
Parents:
6dc0269
Message:

Added new languages, hierarchical folder tree and attachments in forwarded messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/steps/mail/compose.inc

    r30233b8 r597170f  
    121121       
    122122      // we have contact id's as get parameters 
    123       if (strlen($_GET['_to']) && preg_match('/[0-9]+,?/', $_GET['_to'])) 
     123      if (!empty($_GET['_to']) && preg_match('/[0-9]+,?/', $_GET['_to'])) 
    124124        { 
    125125        $a_recipients = array(); 
     
    139139          $fvalue = join(', ', $a_recipients); 
    140140        } 
    141       else if (strlen($_GET['_to'])) 
     141      else if (!empty($_GET['_to'])) 
    142142        $fvalue = $_GET['_to']; 
    143143         
     
    166166     
    167167     
    168   if ($fname && $_POST[$fname]) 
     168  if ($fname && !empty($_POST[$fname])) 
    169169    $fvalue = $_POST[$fname]; 
    170170  else if ($header && is_object($REPLY_MESSAGE['headers'])) 
     
    283283   
    284284  // use posted message body 
    285   if ($_POST['_message']) 
     285  if (!empty($_POST['_message'])) 
    286286    $body = stripslashes($_POST['_message']); 
    287287     
     
    353353                   $IMAP->decode_header($FORWARD_MESSAGE['headers']->to)); 
    354354 
     355  // add attachments 
     356  if (!isset($_SESSION['compose']['forward_attachments']) && is_array($FORWARD_MESSAGE['parts']) && sizeof($FORWARD_MESSAGE['parts'])>1) 
     357    { 
     358    $temp_dir = rcmail_create_compose_tempdir(); 
     359 
     360    if (!is_array($_SESSION['compose']['attachments'])) 
     361      $_SESSION['compose']['attachments'] = array(); 
     362   
     363    foreach ($FORWARD_MESSAGE['parts'] as $part) 
     364      { 
     365      if ($part->disposition != 'attachment') 
     366        continue; 
     367 
     368      $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); 
     369      if ($fp = fopen($tmp_path, 'w')) 
     370        { 
     371        fwrite($fp, $IMAP->mime_decode($part->body, $part->headers['content-transfer-encoding'])); 
     372        fclose($fp); 
     373 
     374        $_SESSION['compose']['attachments'][] = array('name' => $part->d_parameters['filename'], 
     375                                                      'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, 
     376                                                      'path' => $tmp_path); 
     377        } 
     378      } 
     379 
     380    $_SESSION['compose']['forward_attachments'] = TRUE; 
     381    } 
     382 
    355383  return $prefix.$body; 
    356384  } 
     
    371399 
    372400  // use subject from post 
    373   if ($_POST['_subject']) 
     401  if (isset($_POST['_subject'])) 
    374402    $subject = stripslashes($_POST['_subject']); 
    375403     
     
    474502                 array(1, 2, 0, 4, 5)); 
    475503                  
    476   $sel = $_POST['_priority'] ? $_POST['_priority'] : 0; 
     504  $sel = isset($_POST['_priority']) ? $_POST['_priority'] : 0; 
    477505 
    478506  $out = $form_start ? "$form_start\n" : ''; 
     
    494522    $hiddenfields->add(array('name' => '_action', 'value' => 'send')); 
    495523     
    496     $form_start = !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; 
     524    $form_start = empty($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; 
    497525    $form_start .= "\n$SESS_HIDDEN_FIELD\n"; 
    498526    $form_start .= $hiddenfields->show(); 
     
    500528     
    501529  $form_end = (strlen($MESSAGE_FORM) && !strlen($attrib['form'])) ? '</form>' : ''; 
    502   $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form'; 
     530  $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form'; 
    503531   
    504532  if (!strlen($MESSAGE_FORM)) 
Note: See TracChangeset for help on using the changeset viewer.