Changeset 5521 in subversion


Ignore:
Timestamp:
Dec 1, 2011 6:06:27 AM (18 months ago)
Author:
alec
Message:
  • Simplified compose session data handling, no need for session->cleanup()
Location:
trunk/roundcubemail/program
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcmail.php

    r5418 r5521  
    12291229    // before closing the database connection, write session data 
    12301230    if ($_SERVER['REMOTE_ADDR'] && is_object($this->session)) { 
    1231       $this->session->cleanup(); 
    12321231      session_write_close(); 
    12331232    } 
  • trunk/roundcubemail/program/include/rcube_session.php

    r5414 r5521  
    322322    foreach ($this->gc_handlers as $fct) 
    323323      call_user_func($fct); 
    324   } 
    325  
    326  
    327   /** 
    328    * Cleanup session data before saving 
    329    */ 
    330   public function cleanup() 
    331   { 
    332     // current compose information is stored in $_SESSION['compose'], move it to $_SESSION['compose_data_<ID>'] 
    333     if ($compose_id = $_SESSION['compose']['id']) { 
    334       $_SESSION['compose_data_'.$compose_id] = $_SESSION['compose']; 
    335       $this->remove('compose'); 
    336     } 
    337324  } 
    338325 
  • trunk/roundcubemail/program/steps/mail/compose.inc

    r5427 r5521  
    2626define('RCUBE_COMPOSE_EDIT', 0x0109); 
    2727 
    28 $MESSAGE_FORM = NULL; 
    29 $MESSAGE = NULL; 
    30  
    31 $COMPOSE_ID = get_input_value('_id', RCUBE_INPUT_GET); 
    32 $_SESSION['compose'] = $_SESSION['compose_data_'.$COMPOSE_ID]; 
     28$MESSAGE_FORM = null; 
     29$MESSAGE      = null; 
     30$COMPOSE_ID   = get_input_value('_id', RCUBE_INPUT_GET); 
     31$COMPOSE      = null; 
     32 
     33if ($COMPOSE_ID && $_SESSION['compose_data_'.$COMPOSE_ID]) 
     34  $COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID]; 
    3335 
    3436// give replicated session storage some time to synchronize 
    3537$retries = 0; 
    36 while ($COMPOSE_ID && !is_array($_SESSION['compose']) && $RCMAIL->db->is_replicated() && $retries++ < 5) { 
     38while ($COMPOSE_ID && !is_array($COMPOSE) && $RCMAIL->db->is_replicated() && $retries++ < 5) { 
    3739  usleep(500000); 
    3840  $RCMAIL->session->reload(); 
    39   $_SESSION['compose'] = $_SESSION['compose_data_'.$COMPOSE_ID]; 
     41  if ($_SESSION['compose_data_'.$COMPOSE_ID]) 
     42    $COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID]; 
    4043} 
    4144 
    4245// Nothing below is called during message composition, only at "new/forward/reply/draft" initialization or 
    4346// if a compose-ID is given (i.e. when the compose step is opened in a new window/tab). 
    44 if (!is_array($_SESSION['compose'])) 
     47if (!is_array($COMPOSE)) 
    4548{ 
    4649  // Infinite redirect prevention in case of broken session (#1487028) 
     
    5053      'message' => "Invalid compose ID"), true, true); 
    5154 
    52   $_SESSION['compose'] = array( 
    53     'id' => uniqid(mt_rand()), 
    54     'param' => request2param(RCUBE_INPUT_GET), 
     55  $COMPOSE_ID = uniqid(mt_rand()); 
     56  $_SESSION['compose_data_'.$COMPOSE_ID] = array( 
     57    'id'      => $COMPOSE_ID, 
     58    'param'   => request2param(RCUBE_INPUT_GET), 
    5559    'mailbox' => $IMAP->get_mailbox_name(), 
    5660  ); 
     61  $COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID]; 
    5762 
    5863  // process values like "mailto:foo@bar.com?subject=new+message&cc=another" 
    59   if ($_SESSION['compose']['param']['to']) { 
     64  if ($COMPOSE['param']['to']) { 
    6065    // #1486037: remove "mailto:" prefix 
    61     $_SESSION['compose']['param']['to'] = preg_replace('/^mailto:/i', '', $_SESSION['compose']['param']['to']); 
    62     $mailto = explode('?', $_SESSION['compose']['param']['to']); 
     66    $COMPOSE['param']['to'] = preg_replace('/^mailto:/i', '', $COMPOSE['param']['to']); 
     67    $mailto = explode('?', $COMPOSE['param']['to']); 
    6368    if (count($mailto) > 1) { 
    64       $_SESSION['compose']['param']['to'] = $mailto[0]; 
     69      $COMPOSE['param']['to'] = $mailto[0]; 
    6570      parse_str($mailto[1], $query); 
    6671      foreach ($query as $f => $val) 
    67         $_SESSION['compose']['param'][$f] = $val; 
     72        $COMPOSE['param'][$f] = $val; 
    6873    } 
    6974  } 
    7075 
    7176  // select folder where to save the sent message 
    72   $_SESSION['compose']['param']['sent_mbox'] = $RCMAIL->config->get('sent_mbox'); 
     77  $COMPOSE['param']['sent_mbox'] = $RCMAIL->config->get('sent_mbox'); 
    7378 
    7479  // pipe compose parameters thru plugins 
    75   $plugin = $RCMAIL->plugins->exec_hook('message_compose', $_SESSION['compose']); 
    76   $_SESSION['compose']['param'] = array_merge($_SESSION['compose']['param'], $plugin['param']); 
     80  $plugin = $RCMAIL->plugins->exec_hook('message_compose', $COMPOSE); 
     81  $COMPOSE['param'] = array_merge($COMPOSE['param'], $plugin['param']); 
    7782 
    7883  // add attachments listed by message_compose hook 
     
    101106      if ($attachment['status'] && !$attachment['abort']) { 
    102107        unset($attachment['data'], $attachment['status'], $attachment['abort']); 
    103         $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; 
     108        $COMPOSE['attachments'][$attachment['id']] = $attachment; 
    104109      } 
    105110    } 
     
    107112 
    108113  // check if folder for saving sent messages exists and is subscribed (#1486802) 
    109   if ($sent_folder = $_SESSION['compose']['param']['sent_mbox']) { 
     114  if ($sent_folder = $COMPOSE['param']['sent_mbox']) { 
    110115    rcmail_check_sent_folder($sent_folder, true); 
    111116  } 
    112117 
    113118  // redirect to a unique URL with all parameters stored in session 
    114   $OUTPUT->redirect(array('_action' => 'compose', '_id' => $_SESSION['compose']['id'])); 
     119  $OUTPUT->redirect(array('_action' => 'compose', '_id' => $COMPOSE['id'])); 
    115120} 
    116121 
     
    122127    'fileuploaderror'); 
    123128 
    124 $OUTPUT->set_env('compose_id', $COMPOSE_ID); 
     129$OUTPUT->set_env('compose_id', $COMPOSE['id']); 
    125130 
    126131// add config parameters to client script 
     
    136141 
    137142// get reference message and set compose mode 
    138 if ($msg_uid = $_SESSION['compose']['param']['draft_uid']) { 
     143if ($msg_uid = $COMPOSE['param']['draft_uid']) { 
    139144  $RCMAIL->imap->set_mailbox($CONFIG['drafts_mbox']); 
    140145  $compose_mode = RCUBE_COMPOSE_DRAFT; 
    141146} 
    142 else if ($msg_uid = $_SESSION['compose']['param']['reply_uid']) 
     147else if ($msg_uid = $COMPOSE['param']['reply_uid']) 
    143148  $compose_mode = RCUBE_COMPOSE_REPLY; 
    144 else if ($msg_uid = $_SESSION['compose']['param']['forward_uid']) 
     149else if ($msg_uid = $COMPOSE['param']['forward_uid']) 
    145150  $compose_mode = RCUBE_COMPOSE_FORWARD; 
    146 else if ($msg_uid = $_SESSION['compose']['param']['uid']) 
     151else if ($msg_uid = $COMPOSE['param']['uid']) 
    147152  $compose_mode = RCUBE_COMPOSE_EDIT; 
    148153 
     
    176181  if ($compose_mode == RCUBE_COMPOSE_REPLY) 
    177182  { 
    178     $_SESSION['compose']['reply_uid'] = $msg_uid; 
    179     $_SESSION['compose']['reply_msgid'] = $MESSAGE->headers->messageID; 
    180     $_SESSION['compose']['references']  = trim($MESSAGE->headers->references . " " . $MESSAGE->headers->messageID); 
    181  
    182     if (!empty($_SESSION['compose']['param']['all'])) 
    183       $MESSAGE->reply_all = $_SESSION['compose']['param']['all']; 
     183    $COMPOSE['reply_uid'] = $msg_uid; 
     184    $COMPOSE['reply_msgid'] = $MESSAGE->headers->messageID; 
     185    $COMPOSE['references']  = trim($MESSAGE->headers->references . " " . $MESSAGE->headers->messageID); 
     186 
     187    if (!empty($COMPOSE['param']['all'])) 
     188      $MESSAGE->reply_all = $COMPOSE['param']['all']; 
    184189 
    185190    $OUTPUT->set_env('compose_mode', 'reply'); 
    186191 
    187192    // Save the sent message in the same folder of the message being replied to 
    188     if ($RCMAIL->config->get('reply_same_folder') && ($sent_folder = $_SESSION['compose']['mailbox']) 
     193    if ($RCMAIL->config->get('reply_same_folder') && ($sent_folder = $COMPOSE['mailbox']) 
    189194      && rcmail_check_sent_folder($sent_folder, false) 
    190195    ) { 
    191       $_SESSION['compose']['param']['sent_mbox'] = $sent_folder; 
     196      $COMPOSE['param']['sent_mbox'] = $sent_folder; 
    192197    } 
    193198  } 
     
    200205 
    201206      if ($info['type'] == 'reply') 
    202         $_SESSION['compose']['reply_uid'] = $info['uid']; 
     207        $COMPOSE['reply_uid'] = $info['uid']; 
    203208      else if ($info['type'] == 'forward') 
    204         $_SESSION['compose']['forward_uid'] = $info['uid']; 
    205  
    206       $_SESSION['compose']['mailbox'] = $info['folder']; 
     209        $COMPOSE['forward_uid'] = $info['uid']; 
     210 
     211      $COMPOSE['mailbox'] = $info['folder']; 
    207212 
    208213      // Save the sent message in the same folder of the message being replied to 
     
    210215        && rcmail_check_sent_folder($sent_folder, false) 
    211216      ) { 
    212         $_SESSION['compose']['param']['sent_mbox'] = $sent_folder; 
     217        $COMPOSE['param']['sent_mbox'] = $sent_folder; 
    213218      } 
    214219    } 
    215220 
    216221    if ($MESSAGE->headers->in_reply_to) 
    217       $_SESSION['compose']['reply_msgid'] = '<'.$MESSAGE->headers->in_reply_to.'>'; 
    218  
    219     $_SESSION['compose']['references']  = $MESSAGE->headers->references; 
     222      $COMPOSE['reply_msgid'] = '<'.$MESSAGE->headers->in_reply_to.'>'; 
     223 
     224    $COMPOSE['references']  = $MESSAGE->headers->references; 
    220225  } 
    221226  else if ($compose_mode == RCUBE_COMPOSE_FORWARD) 
    222227  { 
    223     $_SESSION['compose']['forward_uid'] = $msg_uid; 
     228    $COMPOSE['forward_uid'] = $msg_uid; 
    224229    $OUTPUT->set_env('compose_mode', 'forward'); 
    225230 
    226     if (!empty($_SESSION['compose']['param']['attachment'])) 
     231    if (!empty($COMPOSE['param']['attachment'])) 
    227232      $MESSAGE->forward_attachment = true; 
    228233  } 
     
    248253  $MESSAGE->compose['from'] = get_input_value('_from', RCUBE_INPUT_POST); 
    249254} 
    250 else if (!empty($_SESSION['compose']['param']['from'])) { 
    251   $MESSAGE->compose['from'] = $_SESSION['compose']['param']['from']; 
     255else if (!empty($COMPOSE['param']['from'])) { 
     256  $MESSAGE->compose['from'] = $COMPOSE['param']['from']; 
    252257} 
    253258else if (count($MESSAGE->identities)) { 
     
    341346 
    342347  // we have a set of recipients stored is session 
    343   if ($header == 'to' && ($mailto_id = $_SESSION['compose']['param']['mailto']) 
    344       && $_SESSION['mailto'][$mailto_id] 
     348  if ($header == 'to' && ($mailto_id = $COMPOSE['param']['mailto']) 
     349      && $COMPOSE[$mailto_id] 
    345350  ) { 
    346     $fvalue = urldecode($_SESSION['mailto'][$mailto_id]); 
     351    $fvalue = urldecode($COMPOSE[$mailto_id]); 
    347352    $decode_header = false; 
    348353  } 
     
    350355    $fvalue = get_input_value('_'.$header, RCUBE_INPUT_POST, TRUE); 
    351356  } 
    352   else if (!empty($_SESSION['compose']['param'][$header])) { 
    353     $fvalue = $_SESSION['compose']['param'][$header]; 
     357  else if (!empty($COMPOSE['param'][$header])) { 
     358    $fvalue = $COMPOSE['param'][$header]; 
    354359  } 
    355360  else if ($compose_mode == RCUBE_COMPOSE_REPLY) { 
     
    531536 
    532537      // add signature to array 
    533       if (!empty($sql_arr['signature']) && empty($_SESSION['compose']['param']['nosig'])) 
     538      if (!empty($sql_arr['signature']) && empty($COMPOSE['param']['nosig'])) 
    534539      { 
    535540        $a_signatures[$identity_id]['text'] = $sql_arr['signature']; 
     
    585590function rcmail_prepare_message_body() 
    586591{ 
    587   global $RCMAIL, $MESSAGE, $compose_mode, $LINE_LENGTH, $HTML_MODE; 
     592  global $RCMAIL, $MESSAGE, $COMPOSE, $compose_mode, $LINE_LENGTH, $HTML_MODE; 
    588593 
    589594  // use posted message body 
     
    592597    $isHtml = (bool) get_input_value('_is_html', RCUBE_INPUT_POST); 
    593598  } 
    594   else if ($_SESSION['compose']['param']['body']) { 
    595     $body = $_SESSION['compose']['param']['body']; 
     599  else if ($COMPOSE['param']['body']) { 
     600    $body = $COMPOSE['param']['body']; 
    596601    $isHtml = false; 
    597602  } 
     
    600605    $isHtml = rcmail_compose_editor_mode(); 
    601606    $body = ''; 
    602     if (empty($_SESSION['compose']['attachments'])) 
     607    if (empty($COMPOSE['attachments'])) 
    603608      rcmail_write_forward_attachment($MESSAGE); 
    604609  } 
     
    663668  if ($isHtml && preg_match('#<img src="\./program/blocked\.gif"#', $body)) { 
    664669    if ($attachment = rcmail_save_image('program/blocked.gif', 'image/gif')) { 
    665       $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; 
     670      $COMPOSE['attachments'][$attachment['id']] = $attachment; 
    666671      $body = preg_replace('#\./program/blocked\.gif#', 
    667         $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$_SESSION['compose']['id'], 
     672        $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$COMPOSE['id'], 
    668673        $body); 
    669674    } 
     
    849854function rcmail_create_forward_body($body, $bodyIsHtml) 
    850855{ 
    851   global $RCMAIL, $MESSAGE; 
     856  global $RCMAIL, $MESSAGE, $COMPOSE; 
    852857 
    853858  // add attachments 
    854   if (!isset($_SESSION['compose']['forward_attachments']) && is_array($MESSAGE->mime_parts)) 
     859  if (!isset($COMPOSE['forward_attachments']) && is_array($MESSAGE->mime_parts)) 
    855860    $cid_map = rcmail_write_compose_attachments($MESSAGE, $bodyIsHtml); 
    856861 
     
    911916function rcmail_create_draft_body($body, $bodyIsHtml) 
    912917{ 
    913   global $MESSAGE, $OUTPUT; 
     918  global $MESSAGE, $OUTPUT, $COMPOSE; 
    914919 
    915920  /** 
     
    917922   * sizeof($MESSAGE->mime_parts can be 1 - e.g. attachment, but no text! 
    918923   */ 
    919   if (empty($_SESSION['compose']['forward_attachments']) 
     924  if (empty($COMPOSE['forward_attachments']) 
    920925      && is_array($MESSAGE->mime_parts) 
    921926      && count($MESSAGE->mime_parts) > 0) 
     
    955960function rcmail_write_compose_attachments(&$message, $bodyIsHtml) 
    956961{ 
    957   global $RCMAIL; 
     962  global $RCMAIL, $COMPOSE; 
    958963 
    959964  $cid_map = $messages = array(); 
     
    977982 
    978983      if (!$skip && ($attachment = rcmail_save_attachment($message, $pid))) { 
    979         $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; 
     984        $COMPOSE['attachments'][$attachment['id']] = $attachment; 
    980985        if ($bodyIsHtml && ($part->content_id || $part->content_location)) { 
    981           $url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$_SESSION['compose']['id']; 
     986          $url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$COMPOSE['id']; 
    982987          if ($part->content_id) 
    983988            $cid_map['cid:'.$part->content_id] = $url; 
     
    989994  } 
    990995 
    991   $_SESSION['compose']['forward_attachments'] = true; 
     996  $COMPOSE['forward_attachments'] = true; 
    992997 
    993998  return $cid_map; 
     
    9971002function rcmail_write_inline_attachments(&$message) 
    9981003{ 
    999   global $RCMAIL; 
     1004  global $RCMAIL, $COMPOSE; 
    10001005 
    10011006  $cid_map = array(); 
     
    10031008    if (($part->content_id || $part->content_location) && $part->filename) { 
    10041009      if ($attachment = rcmail_save_attachment($message, $pid)) { 
    1005         $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; 
    1006         $url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$_SESSION['compose']['id']; 
     1010        $COMPOSE['attachments'][$attachment['id']] = $attachment; 
     1011        $url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$COMPOSE['id']; 
    10071012        if ($part->content_id) 
    10081013          $cid_map['cid:'.$part->content_id] = $url; 
     
    10191024function rcmail_write_forward_attachment(&$message) 
    10201025{ 
    1021   global $RCMAIL; 
     1026  global $RCMAIL, $COMPOSE; 
    10221027 
    10231028  if (strlen($message->subject)) { 
     
    10461051 
    10471052  $attachment = array( 
    1048     'group' => $_SESSION['compose']['id'], 
     1053    'group' => $COMPOSE['id'], 
    10491054    'name' => $name, 
    10501055    'mimetype' => 'message/rfc822', 
     
    10581063  if ($attachment['status']) { 
    10591064    unset($attachment['data'], $attachment['status'], $attachment['content_id'], $attachment['abort']); 
    1060     $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; 
     1065    $COMPOSE['attachments'][$attachment['id']] = $attachment; 
    10611066    return true; 
    10621067  } else if ($path) { 
     
    10701075function rcmail_save_attachment(&$message, $pid) 
    10711076{ 
     1077  global $COMPOSE; 
     1078 
    10721079  $rcmail = rcmail::get_instance(); 
    10731080  $part = $message->mime_parts[$pid]; 
     
    10901097 
    10911098  $attachment = array( 
    1092     'group' => $_SESSION['compose']['id'], 
     1099    'group' => $COMPOSE['id'], 
    10931100    'name' => $part->filename ? $part->filename : 'Part_'.$pid.'.'.$part->ctype_secondary, 
    10941101    'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, 
     
    11131120function rcmail_save_image($path, $mimetype='') 
    11141121{ 
     1122  global $COMPOSE; 
     1123 
    11151124  // handle attachments in memory 
    11161125  $data = file_get_contents($path); 
    11171126 
    11181127  $attachment = array( 
    1119     'group' => $_SESSION['compose']['id'], 
     1128    'group' => $COMPOSE['id'], 
    11201129    'name' => rcmail_basename($path), 
    11211130    'mimetype' => $mimetype ? $mimetype : rc_mime_content_type($path, $name), 
     
    11461155function rcmail_compose_subject($attrib) 
    11471156{ 
    1148   global $MESSAGE, $compose_mode; 
    1149    
     1157  global $MESSAGE, $COMPOSE, $compose_mode; 
     1158 
    11501159  list($form_start, $form_end) = get_form_tags($attrib); 
    11511160  unset($attrib['form']); 
    1152    
     1161 
    11531162  $attrib['name'] = '_subject'; 
    11541163  $attrib['spellcheck'] = 'true'; 
     
    11791188    $subject = $MESSAGE->subject; 
    11801189  } 
    1181   else if (!empty($_SESSION['compose']['param']['subject'])) { 
    1182     $subject = $_SESSION['compose']['param']['subject']; 
    1183   } 
    1184    
     1190  else if (!empty($COMPOSE['param']['subject'])) { 
     1191    $subject = $COMPOSE['param']['subject']; 
     1192  } 
     1193 
    11851194  $out = $form_start ? "$form_start\n" : ''; 
    11861195  $out .= $textfield->show($subject); 
     
    11931202function rcmail_compose_attachment_list($attrib) 
    11941203{ 
    1195   global $OUTPUT, $CONFIG; 
    1196    
     1204  global $OUTPUT, $CONFIG, $COMPOSE; 
     1205 
    11971206  // add ID if not given 
    11981207  if (!$attrib['id']) 
    11991208    $attrib['id'] = 'rcmAttachmentList'; 
    1200    
     1209 
    12011210  $out = "\n"; 
    12021211  $jslist = array(); 
    12031212 
    1204   if (is_array($_SESSION['compose']['attachments'])) 
    1205   { 
     1213  if (is_array($COMPOSE['attachments'])) { 
    12061214    if ($attrib['deleteicon']) { 
    12071215      $button = html::img(array( 
     
    12131221      $button = Q(rcube_label('delete')); 
    12141222 
    1215     foreach ($_SESSION['compose']['attachments'] as $id => $a_prop) 
     1223    foreach ($COMPOSE['attachments'] as $id => $a_prop) 
    12161224    { 
    12171225      if (empty($a_prop)) 
    12181226        continue; 
    1219        
     1227 
    12201228      $out .= html::tag('li', array('id' => 'rcmfile'.$id), 
    12211229        html::a(array( 
     
    12301238 
    12311239  if ($attrib['deleteicon']) 
    1232     $_SESSION['compose']['deleteicon'] = $CONFIG['skin_path'] . $attrib['deleteicon']; 
     1240    $COMPOSE['deleteicon'] = $CONFIG['skin_path'] . $attrib['deleteicon']; 
    12331241  if ($attrib['cancelicon']) 
    12341242    $OUTPUT->set_env('cancelicon', $CONFIG['skin_path'] . $attrib['cancelicon']); 
     
    13981406function rcmail_store_target_selection($attrib) 
    13991407{ 
     1408  global $COMPOSE; 
     1409 
    14001410  $attrib['name'] = '_store_target'; 
    14011411  $select = rcmail_mailbox_select(array_merge($attrib, array( 
     
    14041414    'folder_rights' => 'w', 
    14051415  ))); 
    1406   return $select->show($_SESSION['compose']['param']['sent_mbox'], $attrib); 
     1416  return $select->show($COMPOSE['param']['sent_mbox'], $attrib); 
    14071417} 
    14081418 
     
    14301440function get_form_tags($attrib) 
    14311441{ 
    1432   global $RCMAIL, $MESSAGE_FORM; 
     1442  global $RCMAIL, $MESSAGE_FORM, $COMPOSE; 
    14331443 
    14341444  $form_start = ''; 
     
    14371447    $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task)); 
    14381448    $hiddenfields->add(array('name' => '_action', 'value' => 'send')); 
    1439     $hiddenfields->add(array('name' => '_id', 'value' => $_SESSION['compose']['id'])); 
     1449    $hiddenfields->add(array('name' => '_id', 'value' => $COMPOSE['id'])); 
    14401450 
    14411451    $form_start = empty($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : ''; 
  • trunk/roundcubemail/program/steps/mail/func.inc

    r5509 r5521  
    14391439  $rcmail->plugins->exec_hook('attachments_cleanup', array('group' => $id)); 
    14401440  $rcmail->session->remove('compose_data_'.$id); 
    1441   $rcmail->session->remove('compose'); 
    14421441} 
    14431442 
  • trunk/roundcubemail/program/steps/mail/sendmail.inc

    r5401 r5521  
    2828 
    2929$COMPOSE_ID = get_input_value('_id', RCUBE_INPUT_GPC); 
    30 $_SESSION['compose'] = $_SESSION['compose_data_'.$COMPOSE_ID]; 
     30$COMPOSE    =& $_SESSION['compose_data_'.$COMPOSE_ID]; 
    3131 
    3232/****** checks ********/ 
    3333 
    34 if (!isset($_SESSION['compose']['id'])) { 
     34if (!isset($COMPOSE['id'])) { 
    3535  raise_error(array('code' => 500, 'type' => 'php', 
    3636    'file' => __FILE__, 'line' => __LINE__, 
     
    341341  $headers['Mail-Followup-To'] = rcmail_email_input_format(get_input_value('_followupto', RCUBE_INPUT_POST, TRUE, $message_charset)); 
    342342} 
    343 if (!empty($_SESSION['compose']['reply_msgid'])) { 
    344   $headers['In-Reply-To'] = $_SESSION['compose']['reply_msgid']; 
     343if (!empty($COMPOSE['reply_msgid'])) { 
     344  $headers['In-Reply-To'] = $COMPOSE['reply_msgid']; 
    345345} 
    346346 
    347347// remember reply/forward UIDs in special headers 
    348 if (!empty($_SESSION['compose']['reply_uid']) && $savedraft) { 
    349   $headers['X-Draft-Info'] = array('type' => 'reply', 'uid' => $_SESSION['compose']['reply_uid']); 
    350 } 
    351 else if (!empty($_SESSION['compose']['forward_uid']) && $savedraft) { 
    352   $headers['X-Draft-Info'] = array('type' => 'forward', 'uid' => $_SESSION['compose']['forward_uid']); 
    353 } 
    354  
    355 if (!empty($_SESSION['compose']['references'])) { 
    356   $headers['References'] = $_SESSION['compose']['references']; 
     348if (!empty($COMPOSE['reply_uid']) && $savedraft) { 
     349  $headers['X-Draft-Info'] = array('type' => 'reply', 'uid' => $COMPOSE['reply_uid']); 
     350} 
     351else if (!empty($COMPOSE['forward_uid']) && $savedraft) { 
     352  $headers['X-Draft-Info'] = array('type' => 'forward', 'uid' => $COMPOSE['forward_uid']); 
     353} 
     354 
     355if (!empty($COMPOSE['references'])) { 
     356  $headers['References'] = $COMPOSE['references']; 
    357357} 
    358358 
     
    375375 
    376376if (is_array($headers['X-Draft-Info'])) { 
    377   $headers['X-Draft-Info'] = rcmail_draftinfo_encode($headers['X-Draft-Info'] + array('folder' => $_SESSION['compose']['mailbox'])); 
     377  $headers['X-Draft-Info'] = rcmail_draftinfo_encode($headers['X-Draft-Info'] + array('folder' => $COMPOSE['mailbox'])); 
    378378} 
    379379if (!empty($CONFIG['useragent'])) { 
     
    415415  // Check spelling before send 
    416416  if ($CONFIG['spellcheck_before_send'] && $CONFIG['enable_spellcheck'] 
    417     && empty($_SESSION['compose']['spell_checked']) && !empty($message_body) 
     417    && empty($COMPOSE['spell_checked']) && !empty($message_body) 
    418418  ) { 
    419419    $spellchecker = new rcube_spellchecker(get_input_value('_lang', RCUBE_INPUT_GPC)); 
    420420    $spell_result = $spellchecker->check($message_body, $isHtml); 
    421421 
    422     $_SESSION['compose']['spell_checked'] = true; 
     422    $COMPOSE['spell_checked'] = true; 
    423423 
    424424    if (!$spell_result) { 
     
    459459// Check if we have enough memory to handle the message in it 
    460460// It's faster than using files, so we'll do this if we only can 
    461 if (is_array($_SESSION['compose']['attachments']) && $CONFIG['smtp_server'] 
     461if (is_array($COMPOSE['attachments']) && $CONFIG['smtp_server'] 
    462462  && ($mem_limit = parse_bytes(ini_get('memory_limit')))) 
    463463{ 
    464464  $memory = function_exists('memory_get_usage') ? memory_get_usage() : 16*1024*1024; // safe value: 16MB 
    465465 
    466   foreach ($_SESSION['compose']['attachments'] as $id => $attachment) 
     466  foreach ($COMPOSE['attachments'] as $id => $attachment) 
    467467    $memory += $attachment['size']; 
    468468 
     
    528528 
    529529// add stored attachments, if any 
    530 if (is_array($_SESSION['compose']['attachments'])) 
     530if (is_array($COMPOSE['attachments'])) 
    531531{ 
    532   foreach ($_SESSION['compose']['attachments'] as $id => $attachment) { 
     532  foreach ($COMPOSE['attachments'] as $id => $attachment) { 
    533533    // This hook retrieves the attachment contents from the file storage backend 
    534534    $attachment = $RCMAIL->plugins->exec_hook('attachment_get', $attachment); 
     
    627627 
    628628  // set replied/forwarded flag 
    629   if ($_SESSION['compose']['reply_uid']) 
    630     $IMAP->set_flag($_SESSION['compose']['reply_uid'], 'ANSWERED', $_SESSION['compose']['mailbox']); 
    631   else if ($_SESSION['compose']['forward_uid']) 
    632     $IMAP->set_flag($_SESSION['compose']['forward_uid'], 'FORWARDED', $_SESSION['compose']['mailbox']); 
     629  if ($COMPOSE['reply_uid']) 
     630    $IMAP->set_flag($COMPOSE['reply_uid'], 'ANSWERED', $COMPOSE['mailbox']); 
     631  else if ($COMPOSE['forward_uid']) 
     632    $IMAP->set_flag($COMPOSE['forward_uid'], 'FORWARDED', $COMPOSE['mailbox']); 
    633633 
    634634} // End of SMTP Delivery Block 
     
    730730    $saved     = $draftuids[0]; 
    731731  } 
    732   $_SESSION['compose']['param']['draft_uid'] = $saved; 
     732  $COMPOSE['param']['draft_uid'] = $saved; 
    733733 
    734734  // display success 
Note: See TracChangeset for help on using the changeset viewer.