Changeset 9800a82 in github
- Timestamp:
- May 6, 2010 3:39:57 AM (3 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 69729855
- Parents:
- 1f019c8
- Location:
- program
- Files:
-
- 3 edited
-
js/app.js (modified) (3 diffs)
-
steps/mail/func.inc (modified) (55 diffs)
-
steps/mail/list.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/js/app.js
r1f019c8 r9800a82 166 166 if (this.gui_objects.messagelist) { 167 167 168 this.message_list = new rcube_list_widget(this.gui_objects.messagelist, 169 {multiselect:true, multiexpand:true, draggable:true, keyboard:true, 170 column_movable:this.env.col_movable, column_fixed:0, dblclick_time:this.dblclick_time}); 168 this.message_list = new rcube_list_widget(this.gui_objects.messagelist, { 169 multiselect:true, multiexpand:true, draggable:true, keyboard:true, 170 column_movable:this.env.col_movable, column_fixed:0, dblclick_time:this.dblclick_time 171 }); 171 172 this.message_list.row_init = function(o){ p.init_message_row(o); }; 172 173 this.message_list.addEventListener('dblclick', function(o){ p.msglist_dbl_click(o); }); … … 187 188 188 189 // load messages 189 if (this.env.messagecount) 190 this.command('list'); 190 this.command('list'); 191 191 } 192 192 … … 247 247 else if (this.env.action == 'print') 248 248 window.print(); 249 250 if (this.env.messagecount) {251 this.enable_command('select-all', 'select-none', 'expunge', true);252 this.enable_command('expand-all', 'expand-unread', 'collapse-all', this.env.threading);253 }254 255 if (this.purge_mailbox_test())256 this.enable_command('purge', true);257 258 this.set_page_buttons();259 249 260 250 // get unread count for each mailbox -
program/steps/mail/func.inc
rb62c486 r9800a82 89 89 { 90 90 $search_request = md5($mbox_name.$_SESSION['search_filter']); 91 91 92 92 $IMAP->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $_SESSION['sort_col']); 93 93 $_SESSION['search'][$search_request] = $IMAP->get_search_set(); 94 94 $OUTPUT->set_env('search_request', $search_request); 95 95 } 96 96 97 97 $search_mods = $RCMAIL->config->get('search_mods', $SEARCH_MODS_DEFAULT); 98 98 $OUTPUT->set_env('search_mods', $search_mods); 99 100 // make sure the message count is refreshed (for default view) 101 $IMAP->messagecount($mbox_name, $IMAP->threading ? 'THREADS' : 'ALL', true); 102 } 103 99 } 100 104 101 // set current mailbox and some other vars in client environment 105 102 $OUTPUT->set_env('mailbox', $mbox_name); … … 166 163 // save some variables for use in ajax list 167 164 $_SESSION['list_attrib'] = $attrib; 168 165 169 166 $mbox = $IMAP->get_mailbox_name(); 170 167 $delim = $IMAP->get_hierarchy_delimiter(); … … 176 173 177 174 $skin_path = $_SESSION['skin_path'] = $CONFIG['skin_path']; 178 $message_count = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); 179 175 180 176 // set client env 181 177 $OUTPUT->add_gui_object('messagelist', $attrib['id']); 182 178 $OUTPUT->set_env('autoexpand_threads', intval($CONFIG['autoexpand_threads'])); 183 $OUTPUT->set_env('messagecount', $message_count);184 $OUTPUT->set_env('current_page', $IMAP->list_page);185 $OUTPUT->set_env('pagecount', ceil($message_count/$IMAP->page_size));186 179 $OUTPUT->set_env('sort_col', $_SESSION['sort_col']); 187 180 $OUTPUT->set_env('sort_order', $_SESSION['sort_order']); 188 181 189 182 if ($attrib['messageicon']) 190 183 $OUTPUT->set_env('messageicon', $skin_path . $attrib['messageicon']); … … 207 200 if ($attrib['unreadchildrenicon']) 208 201 $OUTPUT->set_env('unreadchildrenicon', $skin_path . $attrib['unreadchildrenicon']); 209 202 210 203 $OUTPUT->set_env('messages', array()); 211 204 $OUTPUT->set_env('coltypes', $a_show_cols); 212 213 if (!$message_count) 214 $OUTPUT->show_message('nomessagesfound', 'notice'); 215 205 216 206 $OUTPUT->include_script('list.js'); 217 207 218 208 $thead = ''; 219 209 foreach (rcmail_message_list_head($attrib, $a_show_cols) as $cell) 220 210 $thead .= html::tag('td', array('class' => $cell['className'], 'id' => $cell['id']), $cell['html']); 221 211 222 212 return html::tag('table', 223 213 $attrib, … … 243 233 $mbox = $IMAP->get_mailbox_name(); 244 234 $delim = $IMAP->get_hierarchy_delimiter(); 245 235 246 236 // show 'to' instead of 'from' in sent/draft messages 247 237 if ((strpos($mbox.$delim, $CONFIG['sent_mbox'].$delim)===0 || strpos($mbox.$delim, $CONFIG['drafts_mbox'].$delim)===0) … … 250 240 251 241 $thead = $head_replace ? rcmail_message_list_head($_SESSION['list_attrib'], $a_show_cols) : NULL; 252 242 253 243 $OUTPUT->command('set_message_coltypes', $a_show_cols, $thead); 254 244 … … 270 260 $a_msg_cols = array(); 271 261 $a_msg_flags = array(); 272 262 273 263 if (empty($header)) 274 264 continue; … … 293 283 else 294 284 $cont = Q($header->$col); 295 285 296 286 $a_msg_cols[$col] = $cont; 297 287 } … … 347 337 // define sortable columns 348 338 $a_sort_cols = array('subject', 'date', 'from', 'to', 'size', 'cc'); 349 339 350 340 if (!empty($attrib['optionsmenuicon'])) 351 341 $list_menu = html::a( … … 392 382 { 393 383 global $OUTPUT; 394 384 395 385 if (empty($attrib['id'])) 396 386 $attrib['id'] = 'rcmailcontentwindow'; … … 408 398 { 409 399 global $IMAP, $OUTPUT; 410 400 411 401 if (!$attrib['id']) 412 402 $attrib['id'] = 'rcmcountdisplay'; … … 429 419 430 420 $OUTPUT->add_gui_object('quotadisplay', $attrib['id']); 431 421 432 422 $quota = rcmail_quota_content($attrib); 433 423 434 424 if (is_array($quota)) { 435 425 $OUTPUT->add_script('$(document).ready(function(){ … … 437 427 $quota = ''; 438 428 } 439 429 440 430 return html::span($attrib, $quota); 441 431 } … … 458 448 if (!isset($quota['percent'])) 459 449 $quota['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100)); 460 450 461 451 $quota_result = sprintf('%s / %s (%.0f%%)', 462 452 show_bytes($quota['used'] * 1024), show_bytes($quota['total'] * 1024), … … 484 474 function rcmail_get_messagecount_text($count=NULL, $page=NULL) 485 475 { 486 global $ IMAP, $MESSAGE;487 476 global $RCMAIL, $IMAP, $MESSAGE; 477 488 478 if (isset($MESSAGE->index)) 489 479 { … … 495 485 if ($page===NULL) 496 486 $page = $IMAP->list_page; 497 487 498 488 $start_msg = ($page-1) * $IMAP->page_size + 1; 499 $max = $count!==NULL ? $count : $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); 489 490 if ($count!==NULL) 491 $max = $count; 492 else if ($RCMAIL->action) 493 $max = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); 500 494 501 495 if ($max==0) … … 534 528 { 535 529 global $RCMAIL; 536 530 537 531 $old_unseen = $_SESSION['unseen_count'][$mbox_name]; 538 532 $unseen = $RCMAIL->imap->messagecount($mbox_name, 'UNSEEN', $force); … … 543 537 // @TODO: this data is doubled (session and cache tables) if caching is enabled 544 538 $_SESSION['unseen_count'][$mbox_name] = $unseen; 545 539 546 540 return $unseen; 547 541 } … … 642 636 $wash_opts['html_attribs'] = array('rel','type'); 643 637 } 644 638 645 639 $washer = new washtml($wash_opts); 646 640 $washer->add_callback('form', 'rcmail_washtml_callback'); … … 667 661 { 668 662 global $RCMAIL; 669 663 670 664 // trigger plugin hook 671 665 $data = $RCMAIL->plugins->exec_hook('message_part_before', … … 694 688 $part->ctype_secondary = $data['type'] = 'plain'; 695 689 } 696 690 697 691 // free some memory (hopefully) 698 692 unset($data['body']); … … 719 713 // make links and email-addresses clickable 720 714 $replacements = new rcube_string_replacer; 721 715 722 716 // search for patterns like links and e-mail addresses 723 717 $body = preg_replace_callback($replacements->link_pattern, array($replacements, 'link_callback'), $body); … … 793 787 $out = html::div('form', $content); 794 788 break; 795 789 796 790 case 'style': 797 791 // decode all escaped entities and reduce to ascii strings 798 792 $stripped = preg_replace('/[^a-zA-Z\(:]/', '', rcmail_xss_entity_decode($content)); 799 793 800 794 // now check for evil strings like expression, behavior or url() 801 795 if (!preg_match('/expression|behavior|url\(|import/', $stripped)) { … … 803 797 break; 804 798 } 805 799 806 800 default: 807 801 $out = ''; 808 802 } 809 803 810 804 return $out; 811 805 } … … 835 829 global $IMAP, $OUTPUT, $MESSAGE, $PRINT_MODE, $RCMAIL; 836 830 static $sa_attrib; 837 831 838 832 // keep header table attrib 839 833 if (is_array($attrib) && !$sa_attrib) … … 841 835 else if (!is_array($attrib) && is_array($sa_attrib)) 842 836 $attrib = $sa_attrib; 843 837 844 838 if (!isset($MESSAGE)) 845 839 return FALSE; … … 875 869 else 876 870 $header_value = trim($IMAP->decode_header($headers[$hkey])); 877 871 878 872 $output_headers[$hkey] = array('title' => rcube_label($hkey), 'value' => $header_value, 'raw' => $headers[$hkey]); 879 873 } 880 874 881 875 $plugin = $RCMAIL->plugins->exec_hook('message_headers_output', array('output' => $output_headers, 'headers' => $MESSAGE->headers)); 882 876 883 877 // compose html table 884 878 $table = new html_table(array('cols' => 2)); 885 879 886 880 foreach ($plugin['output'] as $hkey => $row) { 887 881 $table->add(array('class' => 'header-title'), Q($row['title'])); … … 913 907 if (!is_array($MESSAGE->parts) && empty($MESSAGE->body)) 914 908 return ''; 915 909 916 910 if (!$attrib['id']) 917 911 $attrib['id'] = 'rcmailMsgBody'; … … 919 913 $safe_mode = $MESSAGE->is_safe || intval($_GET['_safe']); 920 914 $out = ''; 921 915 922 916 $header_attrib = array(); 923 917 foreach ($attrib as $attr => $value) … … 973 967 } 974 968 } 975 969 976 970 // tell client that there are blocked remote objects 977 971 if ($REMOTE_OBJECTS && !$safe_mode) … … 1006 1000 $last_style_pos = 0; 1007 1001 $body_lc = strtolower($body); 1008 1002 1009 1003 // find STYLE tags 1010 1004 while (($pos = strpos($body_lc, '<style', $last_style_pos)) && ($pos2 = strpos($body_lc, '</style>', $pos))) … … 1069 1063 { 1070 1064 global $EMAIL_ADDRESS_PATTERN; 1071 1065 1072 1066 $tag = $matches[1]; 1073 1067 $attrib = parse_attrib_string($matches[2]); … … 1151 1145 $out .= (strlen($out) ? ' ' : '') . sprintf('<%s>', Q($part['mailto'])); 1152 1146 } 1153 1147 1154 1148 if ($c>$j) 1155 1149 $out .= ','.($max ? ' ' : ' '); 1156 1150 1157 1151 if ($max && $j==$max && $c>$j) { 1158 1152 $out .= '...'; … … 1160 1154 } 1161 1155 } 1162 1156 1163 1157 return $out; 1164 1158 } … … 1205 1199 $out .= $line . "\n"; 1206 1200 } 1207 1201 1208 1202 return $out; 1209 1203 } … … 1215 1209 foreach ($p as $key => $val) 1216 1210 $parts[] = $key . '=' . ($key == 'folder' ? base64_encode($val) : $val); 1217 1211 1218 1212 return join('; ', $parts); 1219 1213 } … … 1229 1223 $info[$key] = $val; 1230 1224 } 1231 1225 1232 1226 return $info; 1233 1227 } … … 1237 1231 { 1238 1232 global $MESSAGE; 1239 1233 1240 1234 $part = asciiwords(get_input_value('_part', RCUBE_INPUT_GPC)); 1241 1235 if (!is_object($MESSAGE) || !is_array($MESSAGE->parts) || !($_GET['_uid'] && $_GET['_part']) || !$MESSAGE->mime_parts[$part]) 1242 1236 return ''; 1243 1237 1244 1238 $part = $MESSAGE->mime_parts[$part]; 1245 1239 $table = new html_table(array('cols' => 3)); 1246 1240 1247 1241 if (!empty($part->filename)) { 1248 1242 $table->add('title', Q(rcube_label('filename'))); … … 1250 1244 $table->add(null, '[' . html::a('?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING']), Q(rcube_label('download'))) . ']'); 1251 1245 } 1252 1246 1253 1247 if (!empty($part->size)) { 1254 1248 $table->add('title', Q(rcube_label('filesize'))); 1255 1249 $table->add(null, Q(show_bytes($part->size))); 1256 1250 } 1257 1251 1258 1252 return $table->show($attrib); 1259 1253 } … … 1264 1258 { 1265 1259 global $MESSAGE; 1266 1260 1267 1261 $part = $MESSAGE->mime_parts[asciiwords(get_input_value('_part', RCUBE_INPUT_GPC))]; 1268 1262 $ctype_primary = strtolower($part->ctype_primary); … … 1286 1280 $rcmail->session->remove('compose'); 1287 1281 } 1288 1282 1289 1283 1290 1284 /** … … 1309 1303 // generate list of recipients 1310 1304 $a_recipients = array($mailto); 1311 1305 1312 1306 if (strlen($headers['Cc'])) 1313 1307 $a_recipients[] = $headers['Cc']; 1314 1308 if (strlen($headers['Bcc'])) 1315 1309 $a_recipients[] = $headers['Bcc']; 1316 1310 1317 1311 // clean Bcc from header for recipients 1318 1312 $send_headers = $headers; … … 1342 1336 if (!is_object($RCMAIL->smtp)) 1343 1337 $RCMAIL->smtp_init(true); 1344 1338 1345 1339 $sent = $RCMAIL->smtp->send_mail($from, $a_recipients, $smtp_headers, $msg_body); 1346 1340 $smtp_response = $RCMAIL->smtp->get_response(); … … 1362 1356 $headers_php = $message->_headers; 1363 1357 unset($headers_php['To'], $headers_php['Subject']); 1364 1358 1365 1359 // reset stored headers and overwrite 1366 1360 $message->_headers = array(); 1367 1361 $header_str = $message->txtHeaders($headers_php); 1368 1362 1369 1363 // #1485779 1370 1364 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { … … 1373 1367 } 1374 1368 } 1375 1369 1376 1370 $msg_body = $message->get(); 1377 1371 … … 1386 1380 $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str, "-f$from"); 1387 1381 } 1388 1382 1389 1383 if ($sent) { 1390 1384 $RCMAIL->plugins->exec_hook('message_sent', array('headers' => $headers, 'body' => $msg_body)); 1391 1385 1392 1386 // remove MDN headers after sending 1393 1387 unset($headers['Return-Receipt-To'], $headers['Disposition-Notification-To']); 1394 1388 1395 1389 if ($CONFIG['smtp_log']) { 1396 1390 write_log('sendmail', sprintf("User %s [%s]; Message for %s; %s", … … 1404 1398 $message->_headers = array(); 1405 1399 $message->headers($headers); 1406 1400 1407 1401 return $sent; 1408 1402 } … … 1414 1408 1415 1409 $message = new rcube_message($uid); 1416 1410 1417 1411 if ($message->headers->mdn_to && !$message->headers->mdn_sent && 1418 1412 ($IMAP->check_permflag('MDNSENT') || $IMAP->check_permflag('*'))) … … 1431 1425 $compose->setParam('html_charset', RCMAIL_CHARSET); 1432 1426 $compose->setParam('text_charset', RCMAIL_CHARSET); 1433 1427 1434 1428 // compose headers array 1435 1429 $headers = array( … … 1442 1436 'References' => trim($message->headers->references . ' ' . $message->headers->messageID), 1443 1437 ); 1444 1438 1445 1439 if ($agent = $RCMAIL->config->get('useragent')) 1446 1440 $headers['User-Agent'] = $agent; … … 1451 1445 "\t" . rcube_label("sent") . ': ' . format_date($message->headers->date, $RCMAIL->config->get('date_long')) . "\r\n" . 1452 1446 "\r\n" . rcube_label("receiptnote") . "\r\n"; 1453 1447 1454 1448 $ua = $RCMAIL->config->get('useragent', "RoundCube Webmail (Version ".RCMAIL_VERSION.")"); 1455 1449 $report = "Reporting-UA: $ua\r\n"; 1456 1450 1457 1451 if ($message->headers->to) 1458 1452 $report .= "Original-Recipient: {$message->headers->to}\r\n"; 1459 1453 1460 1454 $report .= "Final-Recipient: rfc822; {$identity['email']}\r\n" . 1461 1455 "Original-Message-ID: {$message->headers->messageID}\r\n" . 1462 1456 "Disposition: manual-action/MDN-sent-manually; displayed\r\n"; 1463 1457 1464 1458 $compose->headers($headers); 1465 1459 $compose->setContentType('multipart/report', array('report-type'=> 'disposition-notification')); … … 1475 1469 } 1476 1470 } 1477 1471 1478 1472 return false; 1479 1473 } … … 1487 1481 1488 1482 $attrib['onchange'] = JS_OBJECT_NAME.'.filter_mailbox(this.value)'; 1489 1483 1490 1484 /* 1491 1485 RFC3501 (6.4.4): 'ALL', 'RECENT', … … 1508 1502 $OUTPUT->add_gui_object('search_filter', $attrib['id']); 1509 1503 1510 return $out; 1504 return $out; 1511 1505 } 1512 1506 … … 1529 1523 1530 1524 ?> 1525 -
program/steps/mail/list.inc
rb62c486 r9800a82 79 79 $OUTPUT->set_env('pagecount', $pages); 80 80 $OUTPUT->set_env('threading', (bool) $IMAP->threading); 81 $OUTPUT->set_env('current_page', $IMAP->list_page); 81 82 $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count)); 82 83 $OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text()); … … 98 99 99 100 ?> 101
Note: See TracChangeset
for help on using the changeset viewer.
