Changeset 4315b00 in github
- Timestamp:
- Dec 10, 2007 11:20:01 PM (5 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 338551d
- Parents:
- deb3026
- Files:
-
- 1 added
- 8 edited
- 1 moved
-
CHANGELOG (modified) (1 diff)
-
index.php (modified) (1 diff)
-
program/js/app.js (modified) (2 diffs)
-
program/js/editor.js (modified) (1 diff)
-
program/js/editor_images.js (added)
-
program/js/tiny_mce/themes/advanced/css/editor_popup.css (moved) (moved from skins/default/editor_popup.css)
-
program/js/tiny_mce/themes/advanced/editor_template_src.js (modified) (1 diff)
-
program/steps/mail/compose.inc (modified) (49 diffs)
-
program/steps/mail/sendmail.inc (modified) (2 diffs)
-
program/steps/settings/edit_identity.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
rdeb3026 r4315b00 5 5 ---------- 6 6 - Upgrade to TinyMCE 2.1.3 7 - Allow inserting image attachments into HTML messages while composing 7 8 8 9 2007/12/10 (thomasb) -
index.php
rfba1f5a r4315b00 284 284 include('program/steps/mail/upload.inc'); 285 285 286 if ($_action=='compose' || $_action=='remove-attachment' )286 if ($_action=='compose' || $_action=='remove-attachment' || $_action=='display-attachment') 287 287 include('program/steps/mail/compose.inc'); 288 288 -
program/js/app.js
rfba1f5a r4315b00 831 831 if (!this.check_compose_input()) 832 832 break; 833 833 834 834 // Reset the auto-save timer 835 835 self.clearTimeout(this.save_timer); … … 1885 1885 this.upload_file = function(form) 1886 1886 { 1887 1888 1887 if (!form) 1889 1888 return false; -
program/js/editor.js
r8094288 r4315b00 30 30 extended_valid_elements : 'font[face|size|color|style],span[id|class|align|style]', 31 31 content_css : skin_path + '/editor_content.css', 32 popups_css : skin_path + '/editor_popup.css',33 e ditor_css : skin_path + '/editor_ui.css'32 editor_css : skin_path + '/editor_ui.css', 33 external_image_list_url : 'program/js/editor_images.js' 34 34 }); 35 35 } -
program/js/tiny_mce/themes/advanced/editor_template_src.js
rdeb3026 r4315b00 1421 1421 _insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) { 1422 1422 tinyMCE.execCommand("mceInsertContent", false, tinyMCE.createTagHTML('img', { 1423 src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings ['base_href'], src), // Force absolute1423 src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, src), // Force absolute 1424 1424 mce_src : src, 1425 1425 alt : alt, -
program/steps/mail/compose.inc
rfba1f5a r4315b00 31 31 // remove an attachment 32 32 if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs)) 33 {33 { 34 34 $id = $regs[1]; 35 35 if (is_array($_SESSION['compose']['attachments'][$id])) 36 {36 { 37 37 @unlink($_SESSION['compose']['attachments'][$id]['path']); 38 38 $_SESSION['compose']['attachments'][$id] = NULL; … … 40 40 $OUTPUT->send(); 41 41 exit; 42 } 43 } 44 42 } 43 } 44 45 if ($_action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs)) 46 { 47 $id = $regs[1]; 48 if (is_array($_SESSION['compose']['attachments'][$id])) 49 { 50 $apath = $_SESSION['compose']['attachments'][$id]['path']; 51 header('Content-Type: ' . $_SESSION['compose']['attachments'][$id]['mimetype']); 52 header('Content-Length: ' . filesize($apath)); 53 readfile($apath); 54 } 55 exit; 56 } 45 57 46 58 $MESSAGE_FORM = NULL; … … 53 65 54 66 if (!is_array($_SESSION['compose']) || $_SESSION['compose']['id'] != get_input_value('_id', RCUBE_INPUT_GET)) 55 {67 { 56 68 rcmail_compose_cleanup(); 57 69 $_SESSION['compose'] = array('id' => uniqid(rand())); 58 }70 } 59 71 60 72 // add some labels to client … … 75 87 76 88 if (!empty($msg_uid)) 77 {89 { 78 90 // similar as in program/steps/mail/show.inc 79 91 $MESSAGE = array('UID' => $msg_uid); … … 84 96 85 97 if ($compose_mode == RCUBE_COMPOSE_REPLY) 86 {98 { 87 99 $_SESSION['compose']['reply_uid'] = $msg_uid; 88 100 $_SESSION['compose']['reply_msgid'] = $MESSAGE['headers']->messageID; … … 91 103 if (!empty($_GET['_all'])) 92 104 $MESSAGE['reply_all'] = 1; 93 }105 } 94 106 else if ($compose_mode == RCUBE_COMPOSE_FORWARD) 95 {107 { 96 108 $_SESSION['compose']['forward_uid'] = $msg_uid; 97 }109 } 98 110 else if ($compose_mode == RCUBE_COMPOSE_DRAFT) 99 {111 { 100 112 $_SESSION['compose']['draft_uid'] = $msg_uid; 101 } 102 103 } 113 } 114 } 104 115 105 116 /****** compose mode functions ********/ … … 107 118 108 119 function rcmail_compose_headers($attrib) 109 {120 { 110 121 global $IMAP, $MESSAGE, $DB, $compose_mode; 111 122 static $sa_recipients = array(); … … 117 128 118 129 switch ($part) 119 {130 { 120 131 case 'from': 121 132 return rcmail_compose_header_from($attrib); … … 133 144 case 'cc': 134 145 if (!$fname) 135 {146 { 136 147 $fname = '_cc'; 137 148 $header = 'cc'; 138 }149 } 139 150 case 'bcc': 140 151 if (!$fname) 141 {152 { 142 153 $fname = '_bcc'; 143 154 $header = 'bcc'; 144 }155 } 145 156 146 157 $allow_attrib = array('id', 'class', 'style', 'cols', 'rows', 'tabindex'); … … 153 164 $allow_attrib = array('id', 'class', 'style', 'size', 'tabindex'); 154 165 $field_type = 'textfield'; 155 break; 156 157 } 166 break; 167 } 158 168 159 169 if ($fname && !empty($_POST[$fname])) … … 161 171 162 172 else if ($header && $compose_mode == RCUBE_COMPOSE_REPLY) 163 {173 { 164 174 // get recipent address(es) out of the message headers 165 175 if ($header=='to' && !empty($MESSAGE['headers']->replyto)) … … 171 181 // add recipent of original message if reply to all 172 182 else if ($header=='cc' && !empty($MESSAGE['reply_all'])) 173 {183 { 174 184 if ($v = $MESSAGE['headers']->to) 175 185 $fvalue .= $v; … … 177 187 if ($v = $MESSAGE['headers']->cc) 178 188 $fvalue .= (!empty($fvalue) ? ', ' : '') . $v; 179 }189 } 180 190 181 191 // split recipients and put them back together in a unique way 182 192 if (!empty($fvalue)) 183 {193 { 184 194 $to_addresses = $IMAP->decode_address_list($fvalue); 185 195 $fvalue = ''; 186 196 foreach ($to_addresses as $addr_part) 197 { 198 if (!empty($addr_part['mailto']) && !in_array($addr_part['mailto'], $sa_recipients) && (!$MESSAGE['FROM'] || !in_array($addr_part['mailto'], $MESSAGE['FROM']))) 187 199 { 188 if (!empty($addr_part['mailto']) && !in_array($addr_part['mailto'], $sa_recipients) && (!$MESSAGE['FROM'] || !in_array($addr_part['mailto'], $MESSAGE['FROM'])))189 {190 200 $fvalue .= (strlen($fvalue) ? ', ':'').$addr_part['string']; 191 201 $sa_recipients[] = $addr_part['mailto']; 192 }193 202 } 194 203 } 195 204 } 205 } 196 206 else if ($header && $compose_mode == RCUBE_COMPOSE_DRAFT) 197 {207 { 198 208 // get drafted headers 199 209 if ($header=='to' && !empty($MESSAGE['headers']->to)) … … 205 215 if ($header=='bcc' && !empty($MESSAGE['headers']->bcc)) 206 216 $fvalue = $IMAP->decode_header($MESSAGE['headers']->bcc); 207 }217 } 208 218 209 219 210 220 if ($fname && $field_type) 211 {221 { 212 222 // pass the following attributes to the form class 213 223 $field_attrib = array('name' => $fname); … … 219 229 $input = new $field_type($field_attrib); 220 230 $out = $input->show($fvalue); 221 }231 } 222 232 223 233 if ($form_start) … … 225 235 226 236 return $out; 227 }237 } 228 238 229 239 230 240 231 241 function rcmail_compose_header_from($attrib) 232 {242 { 233 243 global $IMAP, $MESSAGE, $DB, $USER, $OUTPUT, $compose_mode; 234 244 … … 242 252 $a_recipients = array(); 243 253 if ($compose_mode == RCUBE_COMPOSE_REPLY && is_object($MESSAGE['headers'])) 244 {254 { 245 255 $MESSAGE['FROM'] = array(); 246 256 247 257 $a_to = $IMAP->decode_address_list($MESSAGE['headers']->to); 248 258 foreach ($a_to as $addr) 249 {259 { 250 260 if (!empty($addr['mailto'])) 251 261 $a_recipients[] = $addr['mailto']; 252 }262 } 253 263 254 264 if (!empty($MESSAGE['headers']->cc)) 255 {265 { 256 266 $a_cc = $IMAP->decode_address_list($MESSAGE['headers']->cc); 257 267 foreach ($a_cc as $addr) 258 {268 { 259 269 if (!empty($addr['mailto'])) 260 270 $a_recipients[] = $addr['mailto']; 261 }262 }263 }271 } 272 } 273 } 264 274 265 275 // get this user's identities … … 267 277 268 278 if ($DB->num_rows($sql_result)) 269 {279 { 270 280 $from_id = 0; 271 281 $a_signatures = array(); … … 275 285 276 286 while ($sql_arr = $DB->fetch_assoc($sql_result)) 277 {287 { 278 288 $identity_id = $sql_arr['identity_id']; 279 289 $select_from->add(format_email_recipient($sql_arr['email'], $sql_arr['name']), $identity_id); … … 281 291 // add signature to array 282 292 if (!empty($sql_arr['signature'])) 283 {293 { 284 294 $a_signatures[$identity_id]['text'] = $sql_arr['signature']; 285 295 $a_signatures[$identity_id]['is_html'] = ($sql_arr['html_signature'] == 1) ? true : false; 286 296 if ($a_signatures[$identity_id]['is_html']) 287 {297 { 288 298 $h2t = new html2text($a_signatures[$identity_id]['text'], false, false); 289 299 $plainTextPart = $h2t->get_text(); 290 300 $a_signatures[$identity_id]['plain_text'] = trim($plainTextPart); 291 }292 301 } 302 } 293 303 294 304 // set identity if it's one of the reply-message recipients … … 301 311 if ($compose_mode == RCUBE_COMPOSE_DRAFT && strstr($MESSAGE['headers']->from, $sql_arr['email'])) 302 312 $from_id = $sql_arr['identity_id']; 303 }313 } 304 314 305 315 // overwrite identity selection with post parameter … … 311 321 // add signatures to client 312 322 $OUTPUT->set_env('signatures', $a_signatures); 313 }323 } 314 324 else 315 {325 { 316 326 $input_from = new textfield($field_attrib); 317 327 $out = $input_from->show($_POST['_from']); 318 }328 } 319 329 320 330 if ($form_start) … … 322 332 323 333 return $out; 324 } 325 326 334 } 335 327 336 328 337 function rcmail_compose_body($attrib) 329 {338 { 330 339 global $CONFIG, $OUTPUT, $MESSAGE, $compose_mode; 331 340 … … 458 467 459 468 return $out; 460 }469 } 461 470 462 471 463 472 function rcmail_create_reply_body($body, $bodyIsHtml) 464 {473 { 465 474 global $IMAP, $MESSAGE; 466 475 … … 475 484 // add > to each line 476 485 for($n=0; $n<sizeof($a_lines); $n++) 477 {486 { 478 487 if (strpos($a_lines[$n], '>')===0) 479 488 $a_lines[$n] = '>'.$a_lines[$n]; 480 489 else 481 490 $a_lines[$n] = '> '.$a_lines[$n]; 482 }491 } 483 492 484 493 $body = join("\n", $a_lines); … … 499 508 else 500 509 { 501 $prefix = sprintf("<br><br>On %s, %s wrote:<br><blockquote type=\"cite\" " .502 "style=\"padding-left: 5px; border-left: #1010ff 2px solid; " .503 "margin-left: 5px; width: 100%%\">",504 $MESSAGE['headers']->date,505 $IMAP->decode_header($MESSAGE['headers']->from));506 507 $suffix = "</blockquote>";510 $prefix = sprintf("<br><br>On %s, %s wrote:<br><blockquote type=\"cite\" " . 511 "style=\"padding-left: 5px; border-left: #1010ff 2px solid; " . 512 "margin-left: 5px; width: 100%%\">", 513 $MESSAGE['headers']->date, 514 $IMAP->decode_header($MESSAGE['headers']->from)); 515 516 $suffix = "</blockquote>"; 508 517 } 509 518 510 519 return $prefix.$body.$suffix; 511 }520 } 512 521 513 522 514 523 function rcmail_create_forward_body($body, $bodyIsHtml) 515 {524 { 516 525 global $IMAP, $MESSAGE; 517 526 … … 529 538 else 530 539 { 531 $prefix = sprintf(540 $prefix = sprintf( 532 541 "<br><br>-------- Original Message --------" . 533 542 "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tbody>" . … … 548 557 549 558 return $prefix.$body; 550 }559 } 551 560 552 561 553 562 function rcmail_create_draft_body($body, $bodyIsHtml) 554 {563 { 555 564 global $IMAP, $MESSAGE; 556 565 … … 561 570 562 571 return $body; 563 }572 } 564 573 565 574 566 575 function rcmail_write_compose_attachments(&$message) 567 {576 { 568 577 global $IMAP, $CONFIG; 569 578 … … 574 583 575 584 foreach ($message['parts'] as $pid => $part) 576 {585 { 577 586 if ($part->ctype_primary != 'message' && $part->ctype_primary != 'text' && 578 587 ($part->disposition=='attachment' || $part->disposition=='inline' || $part->headers['content-id'] || 579 588 (empty($part->disposition) && $part->filename))) 580 {589 { 581 590 $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); 582 591 if ($fp = fopen($tmp_path, 'w')) 583 {592 { 584 593 fwrite($fp, $IMAP->get_message_part($message['UID'], $pid, $part->encoding)); 585 594 fclose($fp); … … 590 599 'path' => $tmp_path 591 600 ); 592 }593 }594 }601 } 602 } 603 } 595 604 596 605 $_SESSION['compose']['forward_attachments'] = TRUE; 597 }606 } 598 607 599 608 600 609 function rcmail_compose_subject($attrib) 601 {610 { 602 611 global $CONFIG, $MESSAGE, $compose_mode; 603 612 … … 616 625 // create a reply-subject 617 626 else if ($compose_mode == RCUBE_COMPOSE_REPLY) 618 {627 { 619 628 if (eregi('^re:', $MESSAGE['subject'])) 620 629 $subject = $MESSAGE['subject']; 621 630 else 622 631 $subject = 'Re: '.$MESSAGE['subject']; 623 }632 } 624 633 625 634 // create a forward-subject 626 635 else if ($compose_mode == RCUBE_COMPOSE_FORWARD) 627 {636 { 628 637 if (eregi('^fwd:', $MESSAGE['subject'])) 629 638 $subject = $MESSAGE['subject']; 630 639 else 631 640 $subject = 'Fwd: '.$MESSAGE['subject']; 632 }641 } 633 642 634 643 // creeate a draft-subject … … 641 650 642 651 return $out; 643 }652 } 644 653 645 654 646 655 function rcmail_compose_attachment_list($attrib) 647 {656 { 648 657 global $OUTPUT, $CONFIG; 649 658 … … 658 667 659 668 if (is_array($_SESSION['compose']['attachments'])) 660 {669 { 661 670 if ($attrib['deleteicon']) 662 671 $button = sprintf('<img src="%s%s" alt="%s" border="0" style="padding-right:2px;vertical-align:middle" />', … … 675 684 $button, 676 685 Q($a_prop['name'])); 677 }686 } 678 687 679 688 $OUTPUT->add_gui_object('attachmentlist', $attrib['id']); … … 681 690 $out .= '</ul>'; 682 691 return $out; 683 } 684 692 } 685 693 686 694 687 695 function rcmail_compose_attachment_form($attrib) 688 {696 { 689 697 global $OUTPUT, $SESS_HIDDEN_FIELD; 690 698 … … 714 722 $OUTPUT->add_gui_object('uploadbox', $attrib['id']); 715 723 return $out; 716 }724 } 717 725 718 726 719 727 function rcmail_compose_attachment_field($attrib) 720 {728 { 721 729 // allow the following attributes to be added to the <input> tag 722 730 $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'size')); … … 724 732 $out = '<input type="file" name="_attachments[]"'. $attrib_str . " />"; 725 733 return $out; 726 }734 } 727 735 728 736 729 737 function rcmail_priority_selector($attrib) 730 {738 { 731 739 list($form_start, $form_end) = get_form_tags($attrib); 732 740 unset($attrib['form']); … … 749 757 750 758 return $out; 751 }759 } 752 760 753 761 754 762 function rcmail_receipt_checkbox($attrib) 755 {763 { 756 764 list($form_start, $form_end) = get_form_tags($attrib); 757 765 unset($attrib['form']); … … 769 777 770 778 return $out; 771 }779 } 772 780 773 781 … … 790 798 $compose_mode == RCUBE_COMPOSE_FORWARD || 791 799 $compose_mode == RCUBE_COMPOSE_DRAFT) 792 {800 { 793 801 $hasHtml = rcmail_has_html_part($MESSAGE['parts']); 794 802 $useHtml = ($hasHtml && $CONFIG['htmleditor']); 795 }803 } 796 804 797 805 $selector = ''; … … 800 808 $attrib['onchange'] = 'return rcmail_toggle_editor(this)'; 801 809 foreach ($choices as $value => $text) 802 {810 { 803 811 $checked = ''; 804 812 if ((($value == 'html') && $useHtml) || … … 814 822 $attrib['id'], 815 823 rcube_label($text)); 816 }824 } 817 825 818 826 return $selector; … … 821 829 822 830 function get_form_tags($attrib) 823 {831 { 824 832 global $CONFIG, $OUTPUT, $MESSAGE_FORM, $SESS_HIDDEN_FIELD; 825 833 826 834 $form_start = ''; 827 835 if (!strlen($MESSAGE_FORM)) 828 {836 { 829 837 $hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); 830 838 $hiddenfields->add(array('name' => '_action', 'value' => 'send')); … … 833 841 $form_start .= "\n$SESS_HIDDEN_FIELD\n"; 834 842 $form_start .= $hiddenfields->show(); 835 }843 } 836 844 837 845 $form_end = (strlen($MESSAGE_FORM) && !strlen($attrib['form'])) ? '</form>' : ''; … … 844 852 845 853 return array($form_start, $form_end); 846 }854 } 847 855 848 856 … … 860 868 )); 861 869 862 863 870 /****** get contacts for this user and add them to client scripts ********/ 864 871 … … 869 876 870 877 if ($result = $CONTACTS->list_records()) 871 {878 { 872 879 $a_contacts = array(); 873 880 while ($sql_arr = $result->iterate()) … … 876 883 877 884 $OUTPUT->set_env('contacts', $a_contacts); 878 } 879 885 } 880 886 881 887 parse_template('compose'); -
program/steps/mail/sendmail.inc
rfba1f5a r4315b00 249 249 // add stored attachments, if any 250 250 if (is_array($_SESSION['compose']['attachments'])) 251 foreach ($_SESSION['compose']['attachments'] as $attachment) 252 $MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], true, 'base64', 'attachment', $message_charset); 251 foreach ($_SESSION['compose']['attachments'] as $id => $attachment) 252 { 253 $dispurl = '/\ssrc\s*=\s*[\'"]?\S+display-attachment\S+file=rcmfile' . $id . '[\'"]?/'; 254 $match = preg_match($dispurl, $message_body); 255 if ($isHtml && ($match > 0)) 256 { 257 $message_body = preg_replace($dispurl, ' src="'.$attachment['name'].'"', $message_body); 258 $MAIL_MIME->setHTMLBody($message_body); 259 $MAIL_MIME->addHTMLImage($attachment['path'], $attachment['mimetype'], $attachment['name']); 260 } 261 else 262 { 263 $MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], true, 'base64', 'attachment', $message_charset); 264 } 265 } 253 266 254 267 // add submitted attachments … … 383 396 } 384 397 385 386 398 ?> -
program/steps/settings/edit_identity.inc
rfba1f5a r4315b00 44 44 "apply_source_formatting : true," . 45 45 "content_css : '\$__skin_path' + '/editor_content.css'," . 46 "popups_css : '\$__skin_path' + '/editor_popups.css'," .47 46 "editor_css : '\$__skin_path' + '/editor_ui.css'," . 48 47 "theme : 'advanced'," .
Note: See TracChangeset
for help on using the changeset viewer.
