Changeset 520c36a in github
- Timestamp:
- Oct 11, 2005 5:11:42 PM (8 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 09941ea
- Parents:
- 49afbf5
- Location:
- program
- Files:
-
- 7 edited
-
include/main.inc (modified) (1 diff)
-
include/rcube_imap.inc (modified) (11 diffs)
-
include/rcube_smtp.inc (modified) (1 diff)
-
lib/imap.inc (modified) (2 diffs)
-
steps/mail/compose.inc (modified) (1 diff)
-
steps/mail/sendmail.inc (modified) (1 diff)
-
steps/settings/manage_folders.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
program/include/main.inc
r42b1135 r520c36a 387 387 function console($msg, $type=1) 388 388 { 389 print $msg; 390 print "\n<hr>\n"; 389 if ($GLOBALS['REMOTE_REQUEST']) 390 print "// $msg\n"; 391 else 392 { 393 print $msg; 394 print "\n<hr>\n"; 395 } 391 396 } 392 397 -
program/include/rcube_imap.inc
r42b1135 r520c36a 29 29 { 30 30 var $conn; 31 var $root_ns = ''; 31 32 var $root_dir = ''; 32 33 var $mailbox = 'INBOX'; … … 55 56 56 57 57 function iloha_imap($connection='')58 {59 if ($connection)60 {61 $a_url = parse_url($connection);62 $scheme = $a_url['scheme'] ? $a_url['scheme'] : 'imap';63 $port = $a_url['port'] ? $a_url['port'] : ($scheme=='imaps' ? 993 : 143);64 $host = $a_url['host'];65 $user = $a_url['user'];66 $pass = $a_url['pass'];67 68 //var_dump($a_url);69 70 $this->connect($host, $user, $pass, $port);71 }72 }73 74 75 58 function connect($host, $user, $pass, $port=143, $use_ssl=FALSE) 76 59 { … … 80 63 if ($use_ssl && in_array('openssl', get_loaded_extensions())) 81 64 $ICL_SSL = TRUE; 65 else if ($use_ssl) 66 { 67 raise_error(array('code' => 403, 68 'type' => 'imap', 69 'message' => 'Open SSL not available;'), TRUE, FALSE); 70 $port = 143; 71 } 82 72 83 73 $ICL_PORT = $port; … … 86 76 $this->user = $user; 87 77 $this->pass = $pass; 88 78 $this->port = $port; 79 $this->ssl = $use_ssl; 80 81 // print trace mesages 89 82 if ($this->conn && ($CONFIG['debug_level'] & 8)) 90 print $this->conn->message; 91 83 console($this->conn->message); 84 85 // write error log 92 86 else if (!$this->conn && $GLOBALS['iil_error']) 93 87 { … … 95 89 'type' => 'imap', 96 90 'message' => $GLOBALS['iil_error']), TRUE, FALSE); 91 } 92 93 // get account namespace 94 if ($this->conn) 95 { 96 iil_C_NameSpace($this->conn); 97 98 if (!empty($this->conn->delimiter)) 99 $this->delimiter = $this->conn->delimiter; 100 if (!empty($this->conn->rootdir)) 101 $this->root_ns = $this->conn->rootdir; 97 102 } 98 103 … … 108 113 109 114 115 function reconnect() 116 { 117 $this->close(); 118 $this->connect($this->host, $this->user, $this->pass, $this->port, $this->ssl); 119 } 120 121 110 122 function set_rootdir($root) 111 123 { 112 if ( substr($root, -1, 1)==='/')124 if (ereg('[\.\/]$', $root)) //(substr($root, -1, 1)==='/') 113 125 $root = substr($root, 0, -1); 114 126 115 127 $this->root_dir = $root; 128 129 if (empty($this->delimiter)) 130 $this->get_hierarchy_delimiter(); 116 131 } 117 132 … … 369 384 if ($a_msg_headers[$uid]) 370 385 return $a_msg_headers[$uid]; 371 386 372 387 $msg_id = $this->_uid2id($uid); 373 388 $header = iil_C_FetchHeader($this->conn, $mailbox, $msg_id); 374 389 375 390 // write headers cache 376 391 $a_msg_headers[$uid] = $header; … … 428 443 $result = iil_C_Flag($this->conn, $this->mailbox, join(',', $msg_ids), $flag); 429 444 430 431 445 // reload message headers if cached 432 446 $cache_key = $this->mailbox.'.msg'; 433 if ($result && ($a_cached_headers = $this->get_cache($cache_key))) 434 { 447 if ($this->caching_enabled && $result && ($a_cached_headers = $this->get_cache($cache_key))) 448 { 449 // close and re-open connection 450 $this->reconnect(); 451 435 452 foreach ($uids as $uid) 436 453 { … … 493 510 if (!is_array($a_uids)) 494 511 return false; 495 512 496 513 // convert uids to message ids 497 514 $a_mids = array(); 498 515 foreach ($a_uids as $uid) 499 516 $a_mids[] = $this->_uid2id($uid, $from_mbox); 500 517 501 518 $moved = iil_C_Move($this->conn, join(',', $a_mids), $from_mbox, $to_mbox); 502 519 … … 647 664 $abs_name = $this->_mod_mailbox($name); 648 665 $a_mailbox_cache = $this->get_cache('mailboxes'); 666 667 if (strlen($this->root_ns)) 668 $abs_name = $this->root_ns.$abs_name; 649 669 650 670 if (strlen($abs_name) && (!is_array($a_mailbox_cache) || !in_array($abs_name, $a_mailbox_cache))) 651 $result = iil_C_CreateFolder($this->conn, $abs_name);671 $result = iil_C_CreateFolder($this->conn, iil_utf7_encode($abs_name)); 652 672 653 673 // update mailboxlist cache 654 674 if ($result && $subscribe) 655 $this->subscribe($ name);656 657 return $result ;675 $this->subscribe($this->root_ns.$name); 676 677 return $result ? $this->root_ns.$name : FALSE; 658 678 } 659 679 … … 912 932 function _mod_mailbox($mbox, $mode='in') 913 933 { 914 if ( $this->root_dir&& $mode=='in')915 $mbox = $this->root_dir. '/'.$mbox;916 else if ( $this->root_dir&& $mode=='out')934 if (!empty($this->root_dir) && $mode=='in') 935 $mbox = $this->root_dir.$this->delimiter.$mbox; 936 else if (strlen($this->root_dir) && $mode=='out') 917 937 $mbox = substr($mbox, strlen($this->root_dir)+1); 918 938 -
program/include/rcube_smtp.inc
r968bdc7 r520c36a 1 <? 1 <?php 2 2 3 3 /* -
program/lib/imap.inc
r42b1135 r520c36a 326 326 327 327 //open socket connection 328 $conn->fp = @fsockopen($host, $ICL_PORT );328 $conn->fp = @fsockopen($host, $ICL_PORT, &$errno, &$errstr, 10); 329 329 if (!$conn->fp){ 330 $iil_error = "Could not connect to $host at port $ICL_PORT ";330 $iil_error = "Could not connect to $host at port $ICL_PORT: $errstr"; 331 331 $iil_errornum = -1; 332 332 return false; … … 1441 1441 if ($line[0]=="*") $c++; 1442 1442 }while (!iil_StartsWith($line, "flg")); 1443 1443 1444 1444 if (iil_ParseResult($line) == 0){ 1445 1445 iil_C_ExpireCachedItems($conn, $mailbox, $messages); -
program/steps/mail/compose.inc
r597170f r520c36a 404 404 // create a reply-subject 405 405 else if (isset($REPLY_MESSAGE['subject'])) 406 $subject = 'Re: '.$REPLY_MESSAGE['subject']; 406 { 407 if (strpos($REPLY_MESSAGE['subject'], 'Re:')===0) 408 $subject = $REPLY_MESSAGE['subject']; 409 else 410 $subject = 'Re: '.$REPLY_MESSAGE['subject']; 411 } 407 412 408 413 // create a forward-subject -
program/steps/mail/sendmail.inc
r968bdc7 r520c36a 217 217 // check if mailbox exists 218 218 if (!in_array_nocase($CONFIG['sent_mbox'], $IMAP->list_mailboxes())) 219 $IMAP->create_mailbox($CONFIG['sent_mbox'], TRUE); 219 $mbox = $IMAP->create_mailbox($CONFIG['sent_mbox'], TRUE); 220 else 221 $mbox = TRUE; 220 222 221 223 // append message to sent box 222 $saved = $IMAP->save_message($CONFIG['sent_mbox'], $header_str."\r\n".$msg_body); 224 if ($mbox) 225 $saved = $IMAP->save_message($CONFIG['sent_mbox'], $header_str."\r\n".$msg_body); 226 227 // raise error if saving failed 228 if (!$saved) 229 raise_error(array('code' => 800, 230 'type' => 'imap', 231 'file' => __FILE__, 232 'message' => "Could not save message in $CONFIG[sent_mbox]"), TRUE, FALSE); 223 233 } 224 234 -
program/steps/settings/manage_folders.inc
r30233b8 r520c36a 52 52 if ($create && $_GET['_remote']) 53 53 { 54 $commands = sprintf("this.add_folder_row('%s')", rep_specialchars_output($ _GET['_name'], 'js'));54 $commands = sprintf("this.add_folder_row('%s')", rep_specialchars_output($create, 'js')); 55 55 rcube_remote_response($commands); 56 56 }
Note: See TracChangeset
for help on using the changeset viewer.
