Changeset 4591de7 in github
- Timestamp:
- Mar 10, 2011 3:21:21 PM (2 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 3e63a0b8
- Parents:
- 8381ec1
- Files:
-
- 10 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcmail.php (modified) (1 diff)
-
program/include/rcube_session.php (modified) (1 diff)
-
program/js/app.js (modified) (3 diffs)
-
program/js/editor_images.js (modified) (1 diff)
-
program/steps/addressbook/save.inc (modified) (2 diffs)
-
program/steps/mail/attachments.inc (modified) (2 diffs)
-
program/steps/mail/compose.inc (modified) (11 diffs)
-
program/steps/mail/func.inc (modified) (1 diff)
-
program/steps/mail/sendmail.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
r8381ec1 r4591de7 2 2 =========================== 3 3 4 - Allow multiple concurrent compose sessions 4 5 - Force names of unique constraints in PostgreSQL DDL 5 6 - Add code for prevention from IMAP connection hangs when server closes socket unexpectedly -
program/include/rcmail.php
rae39c47 r4591de7 1079 1079 1080 1080 // before closing the database connection, write session data 1081 if ($_SERVER['REMOTE_ADDR']) 1081 if ($_SERVER['REMOTE_ADDR']) { 1082 $this->session->cleanup(); 1082 1083 session_write_close(); 1084 } 1083 1085 1084 1086 // write performance stats to logs/console -
program/include/rcube_session.php
rc294eaa r4591de7 189 189 190 190 return true; 191 } 192 193 194 /** 195 * Cleanup session data before saving 196 */ 197 public function cleanup() 198 { 199 // current compose information is stored in $_SESSION['compose'], move it to $_SESSION['compose_data'] 200 if ($_SESSION['compose']) { 201 $_SESSION['compose_data'][$_SESSION['compose']['id']] = $_SESSION['compose']; 202 $this->remove('compose'); 203 } 191 204 } 192 205 -
program/js/app.js
rd7167e9 r4591de7 228 228 } 229 229 else if (this.env.action == 'compose') { 230 this.env.compose_commands = ['send-attachment', 'remove-attachment', 'send', ' toggle-editor'];230 this.env.compose_commands = ['send-attachment', 'remove-attachment', 'send', 'cancel', 'toggle-editor']; 231 231 232 232 if (this.env.drafts_mailbox) … … 3271 3271 { 3272 3272 if (name && this.env.attachments[name]) 3273 this.http_post('remove-attachment', '_file='+urlencode(name));3273 this.http_post('remove-attachment', { _id:this.env.compose_id, _file:name }); 3274 3274 3275 3275 return true; … … 5409 5409 5410 5410 form.target = frame_name; 5411 form.action = this.url(action, { _ uploadid:ts });5411 form.action = this.url(action, { _id:this.env.compose_id||'', _uploadid:ts }); 5412 5412 form.setAttribute('enctype', 'multipart/form-data'); 5413 5413 form.submit(); -
program/js/editor_images.js
r01ffe03 r4591de7 8 8 var att = rc_client.env.attachments[id]; 9 9 if (att.complete && att.mimetype.indexOf('image/') == 0) 10 tinyMCEImageList.push([att.name, rc_client.env.comm_path+'&_action=display-attachment&_file='+id ]);10 tinyMCEImageList.push([att.name, rc_client.env.comm_path+'&_action=display-attachment&_file='+id+'&_id='+rc_client.env.compose_id]); 11 11 } 12 12 }; -
program/steps/addressbook/save.inc
rb8f14ce r4591de7 58 58 'name' => $_FILES['_photo']['name'], 59 59 'mimetype' => 'image/' . $imageprop['type'], 60 'group' => 'contact', 60 61 )); 61 62 } … … 157 158 158 159 // cleanup session data 159 $RCMAIL->plugins->exec_hook('attachments_cleanup', array( ));160 $RCMAIL->plugins->exec_hook('attachments_cleanup', array('group' => 'contact')); 160 161 $RCMAIL->session->remove('contacts'); 161 162 } -
program/steps/mail/attachments.inc
rf5e7b353 r4591de7 20 20 */ 21 21 22 23 $COMPOSE_ID = get_input_value('_id', RCUBE_INPUT_GPC); 24 $_SESSION['compose'] = $_SESSION['compose_data'][$COMPOSE_ID]; 22 25 23 26 if (!$_SESSION['compose']) { … … 85 88 'size' => $_FILES['_attachments']['size'][$i], 86 89 'name' => $_FILES['_attachments']['name'][$i], 87 'mimetype' => rc_mime_content_type($filepath, $_FILES['_attachments']['name'][$i], $_FILES['_attachments']['type'][$i]) 90 'mimetype' => rc_mime_content_type($filepath, $_FILES['_attachments']['name'][$i], $_FILES['_attachments']['type'][$i]), 91 'group' => $COMPOSE_ID, 88 92 ); 89 93 -
program/steps/mail/compose.inc
rda142bb r4591de7 29 29 $MESSAGE = NULL; 30 30 31 $COMPOSE_ID = get_input_value('_id', RCUBE_INPUT_GET); 32 $_SESSION['compose'] = $_SESSION['compose_data'][$COMPOSE_ID]; 33 31 34 // Nothing below is called during message composition, only at "new/forward/reply/draft" initialization or 32 35 // if a compose-ID is given (i.e. when the compose step is opened in a new window/tab). 33 // Since there are many ways to leave the compose page improperly, it seems necessary to clean-up an old 34 // compose when a "new/forward/reply/draft" is called - otherwise the old session attachments will appear 35 36 $MESSAGE_ID = get_input_value('_id', RCUBE_INPUT_GET); 37 if (!is_array($_SESSION['compose']) || $_SESSION['compose']['id'] != $MESSAGE_ID) 38 { 39 rcmail_compose_cleanup(); 40 36 if (!is_array($_SESSION['compose'])) 37 { 41 38 // Infinite redirect prevention in case of broken session (#1487028) 42 if ($ MESSAGE_ID)39 if ($COMPOSE_ID) 43 40 raise_error(array('code' => 500, 'type' => 'php', 44 41 'file' => __FILE__, 'line' => __LINE__, … … 82 79 $filename = basename($attach); 83 80 $attachment = array( 81 'group' => $COMPOSE_ID, 84 82 'name' => $filename, 85 83 'mimetype' => rc_mime_content_type($attach, $filename), 86 'path' => $attach 84 'path' => $attach, 87 85 ); 88 86 } … … 116 114 'autocompletechars'); 117 115 116 $OUTPUT->set_env('compose_id', $COMPOSE_ID); 117 118 118 // add config parameters to client script 119 119 if (!empty($CONFIG['drafts_mbox'])) { … … 128 128 129 129 // get reference message and set compose mode 130 if ($msg_uid = $_SESSION['compose']['param']['reply_uid']) 130 if ($msg_uid = $_SESSION['compose']['param']['draft_uid']) { 131 $RCMAIL->imap->set_mailbox($CONFIG['drafts_mbox']); 132 $compose_mode = RCUBE_COMPOSE_DRAFT; 133 } 134 else if ($msg_uid = $_SESSION['compose']['param']['reply_uid']) 131 135 $compose_mode = RCUBE_COMPOSE_REPLY; 132 136 else if ($msg_uid = $_SESSION['compose']['param']['forward_uid']) … … 134 138 else if ($msg_uid = $_SESSION['compose']['param']['uid']) 135 139 $compose_mode = RCUBE_COMPOSE_EDIT; 136 else if ($msg_uid = $_SESSION['compose']['param']['draft_uid']) {137 $RCMAIL->imap->set_mailbox($CONFIG['drafts_mbox']);138 $compose_mode = RCUBE_COMPOSE_DRAFT;139 }140 140 141 141 $config_show_sig = $RCMAIL->config->get('show_sig', 1); … … 621 621 $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; 622 622 $body = preg_replace('#\./program/blocked\.gif#', 623 $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'] ,623 $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$_SESSION['compose']['id'], 624 624 $body); 625 625 } … … 922 922 $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; 923 923 if ($bodyIsHtml && ($part->content_id || $part->content_location)) { 924 $url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'] ;924 $url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$_SESSION['compose']['id']; 925 925 if ($part->content_id) 926 926 $cid_map['cid:'.$part->content_id] = $url; … … 947 947 if ($attachment = rcmail_save_attachment($message, $pid)) { 948 948 $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; 949 $url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'] ;949 $url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$_SESSION['compose']['id']; 950 950 if ($part->content_id) 951 951 $cid_map['cid:'.$part->content_id] = $url; … … 981 981 982 982 $attachment = array( 983 'group' => $_SESSION['compose']['id'], 983 984 'name' => $part->filename ? $part->filename : 'Part_'.$pid.'.'.$part->ctype_secondary, 984 985 'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, … … 1007 1008 1008 1009 $attachment = array( 1010 'group' => $_SESSION['compose']['id'], 1009 1011 'name' => rcmail_basename($path), 1010 1012 'mimetype' => $mimetype ? $mimetype : rc_mime_content_type($path, $name), … … 1324 1326 $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task)); 1325 1327 $hiddenfields->add(array('name' => '_action', 'value' => 'send')); 1328 $hiddenfields->add(array('name' => '_id', 'value' => $_SESSION['compose']['id'])); 1326 1329 1327 1330 $form_start = empty($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : ''; -
program/steps/mail/func.inc
r29c5422 r4591de7 1420 1420 * clear message composing settings 1421 1421 */ 1422 function rcmail_compose_cleanup( )1423 { 1424 if (!isset($_SESSION['compose ']))1422 function rcmail_compose_cleanup($id) 1423 { 1424 if (!isset($_SESSION['compose_data'][$id])) 1425 1425 return; 1426 1426 1427 1427 $rcmail = rcmail::get_instance(); 1428 $rcmail->plugins->exec_hook('attachments_cleanup', array( ));1429 $rcmail->session->remove('compose');1428 $rcmail->plugins->exec_hook('attachments_cleanup', array('group' => $id)); 1429 unset($_SESSION['compose_data'][$id]); 1430 1430 } 1431 1431 -
program/steps/mail/sendmail.inc
re8d5bdc r4591de7 26 26 27 27 $savedraft = !empty($_POST['_draft']) ? true : false; 28 29 $COMPOSE_ID = get_input_value('_id', RCUBE_INPUT_GPC); 30 $_SESSION['compose'] = $_SESSION['compose_data'][$COMPOSE_ID]; 28 31 29 32 /****** checks ********/ … … 703 706 // remember new draft-uid 704 707 $draftuids = $IMAP->search_once($CONFIG['drafts_mbox'], 'HEADER Message-ID '.$msgid, true); 705 $_SESSION['compose']['param'][' _draft_uid'] = $draftuids[0];708 $_SESSION['compose']['param']['draft_uid'] = $draftuids[0]; 706 709 707 710 // display success … … 719 722 else 720 723 { 721 rcmail_compose_cleanup( );724 rcmail_compose_cleanup($COMPOSE_ID); 722 725 723 726 if ($store_folder && !$saved)
Note: See TracChangeset
for help on using the changeset viewer.
