Changeset 7671 for trunk/zpush/backend
- Timestamp:
- 12/18/12 15:08:46 (11 years ago)
- Location:
- trunk/zpush/backend/expresso
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zpush/backend/expresso/expresso.php
r7670 r7671 32 32 { 33 33 if($folder['id'] == $folderId && is_object($this->providerInstances[$provider])) 34 {35 34 return $this->providerInstances[$provider]; 36 }37 else38 {39 throw new Exception('Error in get Provider');40 }41 35 } 42 36 } 37 38 throw new FatalException("BackendExpresso->getProvider(): Provide not found", 0, null, LOGLEVEL_FATAL); 43 39 } 44 40 -
trunk/zpush/backend/expresso/providers/calendarProvider.php
r7670 r7671 201 201 $schedulable = Controller::find(array('concept' => 'schedulable'), null , array('filter' => array( '=' , 'uid' , $id))); 202 202 if( is_array($schedulable) && count($schedulable) > 0 ) 203 203 204 $schedulable = $schedulable[0]; 204 205 else -
trunk/zpush/backend/expresso/providers/imapProvider.php
r7644 r7671 1 1 <?php 2 2 /*********************************************** 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 3 * File : imap.php 4 * Project : Z-Push 5 * Descr : This backend is based on 6 * 'BackendDiff' and implements an 7 * IMAP interface 8 * 9 * Created : 10.10.2007 10 * 11 * Copyright 2007 - 2012 Zarafa Deutschland GmbH 12 * 13 * This program is free software: you can redistribute it and/or modify 14 * it under the terms of the GNU Affero General Public License, version 3, 15 * as published by the Free Software Foundation with the following additional 16 * term according to sec. 7: 17 * 18 * According to sec. 7 of the GNU Affero General Public License, version 3, 19 * the terms of the AGPL are supplemented with the following terms: 20 * 21 * "Zarafa" is a registered trademark of Zarafa B.V. 22 * "Z-Push" is a registered trademark of Zarafa Deutschland GmbH 23 * The licensing of the Program under the AGPL does not imply a trademark license. 24 * Therefore any rights, title and interest in our trademarks remain entirely with us. 25 * 26 * However, if you propagate an unmodified version of the Program you are 27 * allowed to use the term "Z-Push" to indicate that you distribute the Program. 28 * Furthermore you may use our trademarks where it is necessary to indicate 29 * the intended purpose of a product or service provided you use it in accordance 30 * with honest practices in industrial or commercial matters. 31 * If you want to propagate modified versions of the Program under the name "Z-Push", 32 * you may only do so if you have a written permission by Zarafa Deutschland GmbH 33 * (to acquire a permission please contact Zarafa at trademark@zarafa.com). 34 * 35 * This program is distributed in the hope that it will be useful, 36 * but WITHOUT ANY WARRANTY; without even the implied warranty of 37 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 38 * GNU Affero General Public License for more details. 39 * 40 * You should have received a copy of the GNU Affero General Public License 41 * along with this program. If not, see <http://www.gnu.org/licenses/>. 42 * 43 * Consult LICENSE file for details 44 ************************************************/ 45 45 46 46 include_once(__DIR__.'/../../../lib/default/diffbackend/diffbackend.php'); … … 60 60 protected $sinkfolders; 61 61 protected $sinkstates; 62 protected $excludedFolders; /* fmbiete's contribution r1527, ZP-319 */ 62 63 63 64 /**---------------------------------------------------------------------------------------------------------- … … 82 83 83 84 if (!function_exists("imap_open")) 84 throw new FatalException("ExpressoImapProvider(): php-imap module is not installed", 0, null, LOGLEVEL_FATAL); 85 throw new FatalException("BackendIMAP(): php-imap module is not installed", 0, null, LOGLEVEL_FATAL); 86 87 /* BEGIN fmbiete's contribution r1527, ZP-319 */ 88 $this->excludedFolders = array(); 89 if (defined('IMAP_EXCLUDED_FOLDERS')) { 90 $this->excludedFolders = explode("|", IMAP_EXCLUDED_FOLDERS); 91 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->Logon(): Excluding Folders (%s)", IMAP_EXCLUDED_FOLDERS)); 92 } 93 /* END fmbiete's contribution r1527, ZP-319 */ 85 94 86 95 // open the IMAP-mailbox … … 115 124 116 125 if ($this->mbox) { 117 ZLog::Write(LOGLEVEL_ INFO, sprintf("ExpressoImapProvider->Logon(): User '%s' is authenticated on IMAP",$username));126 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->Logon(): User '%s' is authenticated on IMAP",$username)); 118 127 $this->username = $username; 119 128 $this->domain = $domain; … … 123 132 } 124 133 else { 125 ZLog::Write(LOGLEVEL_ERROR, " ExpressoImapProvider->Logon(): can't connect: " . imap_last_error());134 ZLog::Write(LOGLEVEL_ERROR, "BackendIMAP->Logon(): can't connect: " . imap_last_error()); 126 135 return false; 127 136 } … … 141 150 $errors = imap_errors(); 142 151 if (is_array($errors)) { 143 foreach ($errors as $e) 144 if (stripos($e, "fail") !== false) 152 foreach ($errors as $e) { 153 if (stripos($e, "fail") !== false) { 145 154 $level = LOGLEVEL_WARN; 146 else 155 } 156 else { 147 157 $level = LOGLEVEL_DEBUG; 148 149 ZLog::Write($level, "ExpressoImapProvider->Logoff(): IMAP said: " . $e); 158 } 159 ZLog::Write($level, "BackendIMAP->Logoff(): IMAP said: " . $e); 160 } 150 161 } 151 162 @imap_close($this->mbox); 152 ZLog::Write(LOGLEVEL_DEBUG, " ExpressoImapProvider->Logoff(): IMAP connection closed");163 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->Logoff(): IMAP connection closed"); 153 164 } 154 165 $this->SaveStorages(); … … 171 182 172 183 ZLog::Write(LOGLEVEL_DEBUG, sprintf("IMAPBackend->SendMail(): RFC822: %d bytes forward-id: '%s' reply-id: '%s' parent-id: '%s' SaveInSent: '%s' ReplaceMIME: '%s'", 173 strlen($sm->mime), Utils::PrintAsString($sm->forwardflag), Utils::PrintAsString($sm->replyflag),174 Utils::PrintAsString((isset($sm->source->folderid) ? $sm->source->folderid : false)),175 Utils::PrintAsString(($sm->saveinsent)), Utils::PrintAsString(isset($sm->replacemime)) ));184 strlen($sm->mime), Utils::PrintAsString($sm->forwardflag), Utils::PrintAsString($sm->replyflag), 185 Utils::PrintAsString((isset($sm->source->folderid) ? $sm->source->folderid : false)), 186 Utils::PrintAsString(($sm->saveinsent)), Utils::PrintAsString(isset($sm->replacemime)) )); 176 187 177 188 if (isset($sm->source->folderid) && $sm->source->folderid) … … 307 318 $origmail = @imap_fetchheader($this->mbox, $reply, FT_UID) . @imap_body($this->mbox, $reply, FT_PEEK | FT_UID); 308 319 if (!$origmail) 309 throw new StatusException(sprintf(" ExpressoImapProvider->SendMail(): Could not open message id '%s' in folder id '%s' to be replied: %s", $reply, $parent, imap_last_error()), SYNC_COMMONSTATUS_ITEMNOTFOUND);320 throw new StatusException(sprintf("BackendIMAP->SendMail(): Could not open message id '%s' in folder id '%s' to be replied: %s", $reply, $parent, imap_last_error()), SYNC_COMMONSTATUS_ITEMNOTFOUND); 310 321 311 322 $mobj2 = new Mail_mimeDecode($origmail); … … 329 340 330 341 if (!$origmail) 331 throw new StatusException(sprintf(" ExpressoImapProvider->SendMail(): Could not open message id '%s' in folder id '%s' to be forwarded: %s", $forward, $parent, imap_last_error()), SYNC_COMMONSTATUS_ITEMNOTFOUND);342 throw new StatusException(sprintf("BackendIMAP->SendMail(): Could not open message id '%s' in folder id '%s' to be forwarded: %s", $forward, $parent, imap_last_error()), SYNC_COMMONSTATUS_ITEMNOTFOUND); 332 343 333 344 if (!defined('IMAP_INLINE_FORWARD') || IMAP_INLINE_FORWARD === false) { … … 370 381 $nbody = chunk_split(base64_encode($nbody)); 371 382 if ($use_orgbody) 372 383 // contrib - chunk base64 encoded body 373 384 $repl_body = chunk_split(base64_encode($repl_body)); 374 385 } 375 386 376 387 if ($use_orgbody) { 377 ZLog::Write(LOGLEVEL_DEBUG, " ExpressoImapProvider->SendMail(): -------------------");378 ZLog::Write(LOGLEVEL_DEBUG, " ExpressoImapProvider->SendMail(): old:\n'$repl_body'\nnew:\n'$nbody'\nund der body:\n'$body'");388 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): -------------------"); 389 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): old:\n'$repl_body'\nnew:\n'$nbody'\nund der body:\n'$body'"); 379 390 //$body is quoted-printable encoded while $repl_body and $nbody are plain text, 380 391 //so we need to decode $body in order replace to take place … … 434 445 //2. multipart/alternative part which is the original message 435 446 $body = "This is a message with multiple parts in MIME format.\n--". 436 $att_boundary.437 "\nContent-Type: $forward_h_ct\nContent-Transfer-Encoding: $forward_h_cte\n\n".438 (($body_base64) ? chunk_split(base64_encode($message->body)) : rtrim($message->body)).439 "\n--".$att_boundary.440 "\nContent-Type: {$mess2->headers['content-type']}\n\n".441 @imap_body($this->mbox, $forward, FT_PEEK | FT_UID)."\n\n";447 $att_boundary. 448 "\nContent-Type: $forward_h_ct\nContent-Transfer-Encoding: $forward_h_cte\n\n". 449 (($body_base64) ? chunk_split(base64_encode($message->body)) : rtrim($message->body)). 450 "\n--".$att_boundary. 451 "\nContent-Type: {$mess2->headers['content-type']}\n\n". 452 @imap_body($this->mbox, $forward, FT_PEEK | FT_UID)."\n\n"; 442 453 } 443 454 $body .= "--$att_boundary--\n\n"; … … 458 469 if (!empty($forward_h_ct)) $headers .= "\nContent-Type: $forward_h_ct"; 459 470 if (!empty($forward_h_cte)) $headers .= "\nContent-Transfer-Encoding: $forward_h_cte"; 460 471 // if body was quoted-printable, convert it again 461 472 if (isset($message->headers["content-transfer-encoding"]) && strtolower($message->headers["content-transfer-encoding"]) == "quoted-printable") { 462 473 $body = quoted_printable_encode($body); … … 465 476 466 477 // more debugging 467 ZLog::Write(LOGLEVEL_DEBUG, "ExpressoImapProvider->SendMail(): parsed message: ". print_r($message,1)); 468 ZLog::Write(LOGLEVEL_DEBUG, "ExpressoImapProvider->SendMail(): headers: $headers"); 469 ZLog::Write(LOGLEVEL_DEBUG, "ExpressoImapProvider->SendMail(): subject: {$message->headers["subject"]}"); 470 ZLog::Write(LOGLEVEL_DEBUG, "ExpressoImapProvider->SendMail(): body: $body"); 478 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): parsed message: ". print_r($message,1)); 479 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): headers: $headers"); 480 /* BEGIN fmbiete's contribution r1528, ZP-320 */ 481 if (isset($message->headers["subject"])) { 482 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): subject: {$message->headers["subject"]}"); 483 } 484 else { 485 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): subject: no subject set. Set to empty."); 486 $message->headers["subject"] = ""; // added by mku ZP-330 487 } 488 /* END fmbiete's contribution r1528, ZP-320 */ 489 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): body: $body"); 471 490 472 491 if (!defined('IMAP_USE_IMAPMAIL') || IMAP_USE_IMAPMAIL == true) { 492 // changed by mku ZP-330 473 493 $send = @imap_mail ( $toaddr, $message->headers["subject"], $body, $headers, $ccaddr, $bccaddr); 474 494 } … … 476 496 if (!empty($ccaddr)) $headers .= "\nCc: $ccaddr"; 477 497 if (!empty($bccaddr)) $headers .= "\nBcc: $bccaddr"; 498 // changed by mku ZP-330 478 499 $send = @mail ( $toaddr, $message->headers["subject"], $body, $headers, $envelopefrom ); 479 500 } … … 481 502 // email sent? 482 503 if (!$send) 483 throw new StatusException(sprintf(" ExpressoImapProvider->SendMail(): The email could not be sent. Last IMAP-error: %s", imap_last_error()), SYNC_COMMONSTATUS_MAILSUBMISSIONFAILED);504 throw new StatusException(sprintf("BackendIMAP->SendMail(): The email could not be sent. Last IMAP-error: %s", imap_last_error()), SYNC_COMMONSTATUS_MAILSUBMISSIONFAILED); 484 505 485 506 // add message to the sent folder 486 507 // build complete headers 487 508 $headers .= "\nTo: $toaddr"; 488 $headers .= "\nSubject: " . $message->headers["subject"]; 509 $headers .= "\nSubject: " . $message->headers["subject"]; // changed by mku ZP-330 489 510 490 511 if (!defined('IMAP_USE_IMAPMAIL') || IMAP_USE_IMAPMAIL == true) { … … 492 513 if (!empty($bccaddr)) $headers .= "\nBcc: $bccaddr"; 493 514 } 494 ZLog::Write(LOGLEVEL_DEBUG, " ExpressoImapProvider->SendMail(): complete headers: $headers");515 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): complete headers: $headers"); 495 516 496 517 $asf = false; … … 500 521 else if (IMAP_SENTFOLDER) { 501 522 $asf = $this->addSentMessage(IMAP_SENTFOLDER, $headers, $body); 502 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->SendMail(): Outgoing mail saved in configured 'Sent' folder '%s': %s", IMAP_SENTFOLDER, Utils::PrintAsString($asf)));523 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->SendMail(): Outgoing mail saved in configured 'Sent' folder '%s': %s", IMAP_SENTFOLDER, Utils::PrintAsString($asf))); 503 524 } 504 525 // No Sent folder set, try defaults 505 526 else { 506 ZLog::Write(LOGLEVEL_DEBUG, " ExpressoImapProvider->SendMail(): No Sent mailbox set");527 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): No Sent mailbox set"); 507 528 if($this->addSentMessage("INBOX.Sent", $headers, $body)) { 508 ZLog::Write(LOGLEVEL_DEBUG, " ExpressoImapProvider->SendMail(): Outgoing mail saved in 'INBOX.Sent'");529 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): Outgoing mail saved in 'INBOX.Sent'"); 509 530 $asf = true; 510 531 } 511 532 else if ($this->addSentMessage("Sent", $headers, $body)) { 512 ZLog::Write(LOGLEVEL_DEBUG, " ExpressoImapProvider->SendMail(): Outgoing mail saved in 'Sent'");533 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): Outgoing mail saved in 'Sent'"); 513 534 $asf = true; 514 535 } 515 536 else if ($this->addSentMessage("Sent Items", $headers, $body)) { 516 ZLog::Write(LOGLEVEL_DEBUG, " ExpressoImapProvider->SendMail():IMAP-SendMail: Outgoing mail saved in 'Sent Items'");537 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail():IMAP-SendMail: Outgoing mail saved in 'Sent Items'"); 517 538 $asf = true; 518 539 } … … 520 541 521 542 if (!$asf) { 522 ZLog::Write(LOGLEVEL_ERROR, " ExpressoImapProvider->SendMail(): The email could not be saved to Sent Items folder. Check your configuration.");543 ZLog::Write(LOGLEVEL_ERROR, "BackendIMAP->SendMail(): The email could not be saved to Sent Items folder. Check your configuration."); 523 544 } 524 545 … … 560 581 */ 561 582 public function GetAttachmentData($attname) { 562 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->GetAttachmentData('%s')", $attname));583 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->GetAttachmentData('%s')", $attname)); 563 584 564 585 list($folderid, $id, $part) = explode(":", $attname); 565 586 566 587 if (!$folderid || !$id || !$part) 567 throw new StatusException(sprintf(" ExpressoImapProvider->GetAttachmentData('%s'): Error, attachment name key can not be parsed", $attname), SYNC_ITEMOPERATIONSSTATUS_INVALIDATT);588 throw new StatusException(sprintf("BackendIMAP->GetAttachmentData('%s'): Error, attachment name key can not be parsed", $attname), SYNC_ITEMOPERATIONSSTATUS_INVALIDATT); 568 589 569 590 // convert back to work on an imap-id … … 576 597 $message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'charset' => 'utf-8')); 577 598 578 if (!isset($message->parts[$part]->body)) 579 throw new StatusException(sprintf("ExpressoImapProvider->GetAttachmentData('%s'): Error, requested part key can not be found: '%d'", $attname, $part), SYNC_ITEMOPERATIONSSTATUS_INVALIDATT); 599 /* BEGIN fmbiete's contribution r1528, ZP-320 */ 600 //trying parts 601 $mparts = $message->parts; 602 for ($i = 0; $i < count($mparts); $i++) { 603 $auxpart = $mparts[$i]; 604 //recursively add parts 605 if($auxpart->ctype_primary == "multipart" && ($auxpart->ctype_secondary == "mixed" || $auxpart->ctype_secondary == "alternative" || $auxpart->ctype_secondary == "related")) { 606 foreach($auxpart->parts as $spart) 607 $mparts[] = $spart; 608 } 609 } 610 /* END fmbiete's contribution r1528, ZP-320 */ 611 612 if (!isset($mparts[$part]->body)) 613 throw new StatusException(sprintf("BackendIMAP->GetAttachmentData('%s'): Error, requested part key can not be found: '%d'", $attname, $part), SYNC_ITEMOPERATIONSSTATUS_INVALIDATT); 580 614 581 615 // unset mimedecoder & mail … … 585 619 include_once('include/stringstreamwrapper.php'); 586 620 $attachment = new SyncItemOperationsAttachment(); 587 $attachment->data = StringStreamWrapper::Open($message->parts[$part]->body); 588 if (isset($message->parts[$part]->ctype_primary) && isset($message->parts[$part]->ctype_secondary)) 589 $attachment->contenttype = $message->parts[$part]->ctype_primary .'/'.$message->parts[$part]->ctype_secondary; 621 /* BEGIN fmbiete's contribution r1528, ZP-320 */ 622 $attachment->data = StringStreamWrapper::Open($mparts[$part]->body); 623 if (isset($mparts[$part]->ctype_primary) && isset($mparts[$part]->ctype_secondary)) 624 $attachment->contenttype = $mparts[$part]->ctype_primary .'/'.$mparts[$part]->ctype_secondary; 625 626 unset($mparts); 627 unset($message); 628 629 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->GetAttachmentData contenttype %s", $attachment->contenttype)); 630 /* END fmbiete's contribution r1528, ZP-320 */ 590 631 591 632 return $attachment; … … 690 731 $folders = array(); 691 732 692 $list = @imap_getmailboxes($this->mbox, $this->server, " INBOX*");733 $list = @imap_getmailboxes($this->mbox, $this->server, "*"); 693 734 if (is_array($list)) { 694 735 // reverse list to obtain folders in right order … … 696 737 697 738 foreach ($list as $val) { 698 $box = array(); 699 // cut off serverstring 700 $imapid = substr($val->name, strlen($this->server)); 701 $box["id"] = $this->convertImapId($imapid); 702 703 $fhir = explode($val->delimiter, $imapid); 704 if (count($fhir) > 1) { 705 $this->getModAndParentNames($fhir, $box["mod"], $imapparent); 706 $box["parent"] = $this->convertImapId($imapparent); 707 } 708 else { 709 $box["mod"] = $imapid; 710 $box["parent"] = "0"; 711 } 712 $folders[]=$box; 739 /* BEGIN fmbiete's contribution r1527, ZP-319 */ 740 // don't return the excluded folders 741 $notExcluded = true; 742 for ($i = 0, $cnt = count($this->excludedFolders); $notExcluded && $i < $cnt; $i++) { // expr1, expr2 modified by mku ZP-329 743 // fix exclude folders with special chars by mku ZP-329 744 if (strpos(strtolower($val->name), strtolower(Utils::Utf7_iconv_encode(Utils::Utf8_to_utf7($this->excludedFolders[$i])))) !== false) { 745 $notExcluded = false; 746 ZLog::Write(LOGLEVEL_DEBUG, sprintf("Pattern: <%s> found, excluding folder: '%s'", $this->excludedFolders[$i], $val->name)); // sprintf added by mku ZP-329 747 } 748 } 749 750 if ($notExcluded) { 751 $box = array(); 752 // cut off serverstring 753 $imapid = substr($val->name, strlen($this->server)); 754 $box["id"] = $this->convertImapId($imapid); 755 756 $fhir = explode($val->delimiter, $imapid); 757 if (count($fhir) > 1) { 758 $this->getModAndParentNames($fhir, $box["mod"], $imapparent); 759 $box["parent"] = $this->convertImapId($imapparent); 760 } 761 else { 762 $box["mod"] = $imapid; 763 $box["parent"] = "0"; 764 } 765 $folders[]=$box; 766 /* END fmbiete's contribution r1527, ZP-319 */ 767 } 713 768 } 714 769 } 715 770 else { 716 ZLog::Write(LOGLEVEL_WARN, " ExpressoImapProvider->GetFolderList(): imap_list failed: " . imap_last_error());771 ZLog::Write(LOGLEVEL_WARN, "BackendIMAP->GetFolderList(): imap_list failed: " . imap_last_error()); 717 772 return false; 718 773 } … … 795 850 $folder->parentid = "0"; 796 851 } 797 $folder->type = SYNC_FOLDER_TYPE_ OTHER;852 $folder->type = SYNC_FOLDER_TYPE_USER_MAIL; 798 853 } 799 854 800 855 //advanced debugging 801 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->GetFolder('%s'): '%s'", $id, $folder));856 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->GetFolder('%s'): '%s'", $id, $folder)); 802 857 803 858 return $folder; … … 838 893 */ 839 894 public function ChangeFolder($folderid, $oldid, $displayname, $type){ 840 ZLog::Write(LOGLEVEL_INFO, sprintf(" ExpressoImapProvider->ChangeFolder('%s','%s','%s','%s')", $folderid, $oldid, $displayname, $type));895 ZLog::Write(LOGLEVEL_INFO, sprintf("BackendIMAP->ChangeFolder('%s','%s','%s','%s')", $folderid, $oldid, $displayname, $type)); 841 896 842 897 // go to parent mailbox … … 891 946 */ 892 947 public function GetMessageList($folderid, $cutoffdate) { 893 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->GetMessageList('%s','%s')", $folderid, $cutoffdate));948 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->GetMessageList('%s','%s')", $folderid, $cutoffdate)); 894 949 895 950 $folderid = $this->getImapIdFromFolderId($folderid); … … 907 962 $sequence = implode(",", $search); 908 963 } 909 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->GetMessageList(): searching with sequence '%s'", $sequence));964 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->GetMessageList(): searching with sequence '%s'", $sequence)); 910 965 $overviews = @imap_fetch_overview($this->mbox, $sequence); 911 966 912 967 if (!$overviews || !is_array($overviews)) { 913 ZLog::Write(LOGLEVEL_WARN, sprintf(" ExpressoImapProvider->GetMessageList('%s','%s'): Failed to retrieve overview: %s",$folderid, $cutoffdate, imap_last_error()));968 ZLog::Write(LOGLEVEL_WARN, sprintf("BackendIMAP->GetMessageList('%s','%s'): Failed to retrieve overview: %s",$folderid, $cutoffdate, imap_last_error())); 914 969 return $messages; 915 970 } … … 925 980 926 981 // cut of deleted messages 927 if (array_key_exists( 982 if (array_key_exists("deleted", $vars) && $overview->deleted) 928 983 continue; 929 984 930 if (array_key_exists( 985 if (array_key_exists("uid", $vars)) { 931 986 $message = array(); 932 987 $message["mod"] = $date; … … 957 1012 $truncsize = Utils::GetTruncSize($contentparameters->GetTruncation()); 958 1013 $mimesupport = $contentparameters->GetMimeSupport(); 959 ZLog::Write(LOGLEVEL_DEBUG, sprintf("ExpressoImapProvider->GetMessage('%s','%s')", $folderid, $id)); 1014 $bodypreference = $contentparameters->GetBodyPreference(); /* fmbiete's contribution r1528, ZP-320 */ 1015 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->GetMessage('%s','%s')", $folderid, $id)); 960 1016 961 1017 $folderImapid = $this->getImapIdFromFolderId($folderid); … … 971 1027 $message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'charset' => 'utf-8')); 972 1028 1029 /* BEGIN fmbiete's contribution r1528, ZP-320 */ 973 1030 $output = new SyncMail(); 974 1031 975 $body = $this->getBody($message); 976 $output->bodysize = strlen($body); 977 978 // truncate body, if requested 979 if(strlen($body) > $truncsize) { 980 $body = Utils::Utf8_truncate($body, $truncsize); 981 $output->bodytruncated = 1; 982 } else { 983 $body = $body; 1032 //Select body type preference 1033 $bpReturnType = SYNC_BODYPREFERENCE_PLAIN; 1034 if ($bodypreference !== false) { 1035 $bpReturnType = Utils::GetBodyPreferenceBestMatch($bodypreference); // changed by mku ZP-330 1036 } 1037 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->GetMessage - getBodyPreferenceBestMatch: %d", $bpReturnType)); 1038 1039 //Get body data 1040 $this->getBodyRecursive($message, "plain", $plainBody); 1041 $this->getBodyRecursive($message, "html", $htmlBody); 1042 if ($plainBody == "") { 1043 $plainBody = Utils::ConvertHtmlToText($htmlBody); 1044 } 1045 $htmlBody = str_replace("\n","\r\n", str_replace("\r","",$htmlBody)); 1046 $plainBody = str_replace("\n","\r\n", str_replace("\r","",$plainBody)); 1047 1048 if (Request::GetProtocolVersion() >= 12.0) { 1049 $output->asbody = new SyncBaseBody(); 1050 1051 switch($bpReturnType) { 1052 case SYNC_BODYPREFERENCE_PLAIN: 1053 $output->asbody->data = $plainBody; 1054 break; 1055 case SYNC_BODYPREFERENCE_HTML: 1056 if ($htmlBody == "") { 1057 $output->asbody->data = $plainBody; 1058 $bpReturnType = SYNC_BODYPREFERENCE_PLAIN; 1059 } 1060 else { 1061 $output->asbody->data = $htmlBody; 1062 } 1063 break; 1064 case SYNC_BODYPREFERENCE_MIME: 1065 //We don't need to create a new MIME mail, we already have one!! 1066 $output->asbody->data = $mail; 1067 break; 1068 case SYNC_BODYPREFERENCE_RTF: 1069 ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->GetMessage RTF Format NOT CHECKED"); 1070 $output->asbody->data = base64_encode($plainBody); 1071 break; 1072 } 1073 // truncate body, if requested 1074 if(strlen($output->asbody->data) > $truncsize) { 1075 $output->asbody->data = Utils::Utf8_truncate($output->asbody->data, $truncsize); 1076 $output->asbody->truncated = 1; 1077 } 1078 1079 $output->asbody->type = $bpReturnType; 1080 $output->nativebodytype = $bpReturnType; 1081 $output->asbody->estimatedDataSize = strlen($output->asbody->data); 1082 1083 $bpo = $contentparameters->BodyPreference($output->asbody->type); 1084 if (Request::GetProtocolVersion() >= 14.0 && $bpo->GetPreview()) { 1085 $output->asbody->preview = Utils::Utf8_truncate(Utils::ConvertHtmlToText($plainBody), $bpo->GetPreview()); 1086 } 1087 else { 1088 $output->asbody->truncated = 0; 1089 } 1090 } 1091 /* END fmbiete's contribution r1528, ZP-320 */ 1092 else { // ASV_2.5 984 1093 $output->bodytruncated = 0; 985 } 986 987 $output->body = $body; 1094 /* BEGIN fmbiete's contribution r1528, ZP-320 */ 1095 if ($bpReturnType == SYNC_BODYPREFERENCE_MIME) { 1096 if (strlen($mail) > $truncsize) { 1097 $output->mimedata = Utils::Utf8_truncate($mail, $truncsize); 1098 $output->mimetruncated = 1; 1099 } 1100 else { 1101 $output->mimetruncated = 0; 1102 $output->mimedata = $mail; 1103 } 1104 $output->mimesize = strlen($output->mimedata); 1105 } 1106 else { 1107 // truncate body, if requested 1108 if (strlen($plainBody) > $truncsize) { 1109 $output->body = Utils::Utf8_truncate($plainBody, $truncsize); 1110 $output->bodytruncated = 1; 1111 } 1112 else { 1113 $output->body = $plainBody; 1114 $output->bodytruncated = 0; 1115 } 1116 $output->bodysize = strlen($output->body); 1117 } 1118 /* END fmbiete's contribution r1528, ZP-320 */ 1119 } 1120 988 1121 $output->datereceived = isset($message->headers["date"]) ? $this->cleanupDate($message->headers["date"]) : null; 989 1122 $output->messageclass = "IPM.Note"; … … 991 1124 $output->read = $stat["flags"]; 992 1125 $output->from = isset($message->headers["from"]) ? $message->headers["from"] : null; 1126 1127 /* BEGIN fmbiete's contribution r1528, ZP-320 */ 1128 if (isset($message->headers["thread-topic"])) { 1129 $output->threadtopic = $message->headers["thread-topic"]; 1130 } 1131 1132 // Language Code Page ID: http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756%28v=vs.85%29.aspx 1133 $output->internetcpid = INTERNET_CPID_UTF8; 1134 if (Request::GetProtocolVersion() >= 12.0) { 1135 $output->contentclass = "urn:content-classes:message"; 1136 } 1137 /* END fmbiete's contribution r1528, ZP-320 */ 993 1138 994 1139 $Mail_RFC822 = new Mail_RFC822(); … … 1030 1175 if (isset($message->headers["x-priority"])) { 1031 1176 $mimeImportance = preg_replace("/\D+/", "", $message->headers["x-priority"]); 1177 //MAIL 1 - most important, 3 - normal, 5 - lowest 1178 //AS 0 - low, 1 - normal, 2 - important 1032 1179 if ($mimeImportance > 3) 1033 1180 $output->importance = 0; … … 1036 1183 if ($mimeImportance < 3) 1037 1184 $output->importance = 2; 1038 } 1039 1040 // Attachments are only searched in the top-level part 1041 if(isset($message->parts)) { 1185 } else { /* fmbiete's contribution r1528, ZP-320 */ 1186 $output->importance = 1; 1187 } 1188 1189 // Attachments are not needed for MIME messages 1190 if($bpReturnType != SYNC_BODYPREFERENCE_MIME && isset($message->parts)) { 1042 1191 $mparts = $message->parts; 1043 1192 for ($i=0; $i<count($mparts); $i++) { … … 1053 1202 (isset($part->ctype_primary) && $part->ctype_primary != "text")) { 1054 1203 1055 if (!isset($output->attachments) || !is_array($output->attachments))1056 $output->attachments = array();1057 1058 $attachment = new SyncAttachment();1059 1060 if (isset($part->body))1061 $attachment->attsize = strlen($part->body);1062 1063 1204 if(isset($part->d_parameters['filename'])) 1064 1205 $attname = $part->d_parameters['filename']; … … 1069 1210 else $attname = "unknown attachment"; 1070 1211 1071 $attachment->displayname = $attname; 1072 $attachment->attname = $folderid . ":" . $id . ":" . $i; 1073 $attachment->attmethod = 1; 1074 $attachment->attoid = isset($part->headers['content-id']) ? $part->headers['content-id'] : ""; 1075 array_push($output->attachments, $attachment); 1212 /* BEGIN fmbiete's contribution r1528, ZP-320 */ 1213 if (Request::GetProtocolVersion() >= 12.0) { 1214 if (!isset($output->asattachments) || !is_array($output->asattachments)) 1215 $output->asattachments = array(); 1216 1217 $attachment = new SyncBaseAttachment(); 1218 1219 $attachment->estimatedDataSize = isset($part->d_parameters['size']) ? $part->d_parameters['size'] : isset($part->body) ? strlen($part->body) : 0; 1220 1221 $attachment->displayname = $attname; 1222 $attachment->filereference = $folderid . ":" . $id . ":" . $i; 1223 $attachment->method = 1; //Normal attachment 1224 $attachment->contentid = isset($part->headers['content-id']) ? str_replace("<", "", str_replace(">", "", $part->headers['content-id'])) : ""; 1225 if (isset($part->disposition) && $part->disposition == "inline") { 1226 $attachment->isinline = 1; 1227 } 1228 else { 1229 $attachment->isinline = 0; 1230 } 1231 1232 array_push($output->asattachments, $attachment); 1233 } 1234 else { //ASV_2.5 1235 if (!isset($output->attachments) || !is_array($output->attachments)) 1236 $output->attachments = array(); 1237 1238 $attachment = new SyncAttachment(); 1239 1240 $attachment->attsize = isset($part->d_parameters['size']) ? $part->d_parameters['size'] : isset($part->body) ? strlen($part->body) : 0; 1241 1242 $attachment->displayname = $attname; 1243 $attachment->attname = $folderid . ":" . $id . ":" . $i; 1244 $attachment->attmethod = 1; 1245 $attachment->attoid = isset($part->headers['content-id']) ? str_replace("<", "", str_replace(">", "", $part->headers['content-id'])) : ""; 1246 1247 array_push($output->attachments, $attachment); 1248 } 1249 /* END fmbiete's contribution r1528, ZP-320 */ 1076 1250 } 1077 1078 1251 } 1079 1252 } … … 1081 1254 unset($mobj); 1082 1255 unset($mail); 1083 1084 $output->body .= ' '; //Adicionado pois por algum motivo o android corta o ultimo caractere ao fazer a operação maiores detalhes1085 1256 return $output; 1086 1087 1257 } 1088 1258 … … 1100 1270 */ 1101 1271 public function StatMessage($folderid, $id) { 1102 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->StatMessage('%s','%s')", $folderid, $id));1272 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->StatMessage('%s','%s')", $folderid, $id)); 1103 1273 $folderImapid = $this->getImapIdFromFolderId($folderid); 1104 1274 … … 1107 1277 1108 1278 if (!$overview) { 1109 ZLog::Write(LOGLEVEL_WARN, sprintf(" ExpressoImapProvider->StatMessage('%s','%s'): Failed to retrieve overview: %s", $folderid, $id, imap_last_error()));1279 ZLog::Write(LOGLEVEL_WARN, sprintf("BackendIMAP->StatMessage('%s','%s'): Failed to retrieve overview: %s", $folderid, $id, imap_last_error())); 1110 1280 return false; 1111 1281 } … … 1131 1301 /** 1132 1302 * Called when a message has been changed on the mobile. 1133 * This functionality is not available for emails.1303 * Added support for FollowUp flag 1134 1304 * 1135 1305 * @param string $folderid id of the folder … … 1142 1312 */ 1143 1313 public function ChangeMessage($folderid, $id, $message) { 1144 ZLog::Write(LOGLEVEL_DEBUG, sprintf("ExpressoImapProvider->ChangeMessage('%s','%s','%s')", $folderid, $id, get_class($message))); 1145 // TODO recheck implementation 1146 // TODO this could throw several StatusExceptions like e.g. SYNC_STATUS_OBJECTNOTFOUND, SYNC_STATUS_SYNCCANNOTBECOMPLETED 1147 return false; 1314 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->ChangeMessage('%s','%s','%s')", $folderid, $id, get_class($message))); 1315 1316 /* BEGIN fmbiete's contribution r1529, ZP-321 */ 1317 if (isset($message->flag)) { 1318 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->ChangeMessage('Setting flag')")); 1319 1320 $folderImapid = $this->getImapIdFromFolderId($folderid); 1321 1322 $this->imap_reopenFolder($folderImapid); 1323 1324 if (isset($message->flag->flagstatus) && $message->flag->flagstatus == 2) { 1325 ZLog::Write(LOGLEVEL_DEBUG, "Set On FollowUp -> IMAP Flagged"); 1326 $status = @imap_setflag_full($this->mbox, $id, "\\Flagged",ST_UID); 1327 } 1328 else { 1329 ZLog::Write(LOGLEVEL_DEBUG, "Clearing Flagged"); 1330 $status = @imap_clearflag_full ( $this->mbox, $id, "\\Flagged", ST_UID); 1331 } 1332 1333 if ($status) { 1334 ZLog::Write(LOGLEVEL_DEBUG, "Flagged changed"); 1335 } 1336 else { 1337 ZLog::Write(LOGLEVEL_DEBUG, "Flagged failed"); 1338 } 1339 } 1340 1341 return $this->StatMessage($folderid, $id); 1342 /* END fmbiete's contribution r1529, ZP-321 */ 1148 1343 } 1149 1344 … … 1160 1355 */ 1161 1356 public function SetReadFlag($folderid, $id, $flags) { 1162 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->SetReadFlag('%s','%s','%s')", $folderid, $id, $flags));1357 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->SetReadFlag('%s','%s','%s')", $folderid, $id, $flags)); 1163 1358 $folderImapid = $this->getImapIdFromFolderId($folderid); 1164 1359 … … 1187 1382 */ 1188 1383 public function DeleteMessage($folderid, $id) { 1189 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->DeleteMessage('%s','%s')", $folderid, $id));1384 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->DeleteMessage('%s','%s')", $folderid, $id)); 1190 1385 $folderImapid = $this->getImapIdFromFolderId($folderid); 1191 1386 … … 1195 1390 $s2 = @imap_expunge($this->mbox); 1196 1391 1197 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->DeleteMessage('%s','%s'): result: s-delete: '%s' s-expunge: '%s' setflag: '%s'", $folderid, $id, $s1, $s2, $s11));1392 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->DeleteMessage('%s','%s'): result: s-delete: '%s' s-expunge: '%s' setflag: '%s'", $folderid, $id, $s1, $s2, $s11)); 1198 1393 1199 1394 return ($s1 && $s2 && $s11); … … 1212 1407 */ 1213 1408 public function MoveMessage($folderid, $id, $newfolderid) { 1214 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->MoveMessage('%s','%s','%s')", $folderid, $id, $newfolderid));1409 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->MoveMessage('%s','%s','%s')", $folderid, $id, $newfolderid)); 1215 1410 $folderImapid = $this->getImapIdFromFolderId($folderid); 1216 1411 $newfolderImapid = $this->getImapIdFromFolderId($newfolderid); … … 1225 1420 1226 1421 if (!$overview) 1227 throw new StatusException(sprintf(" ExpressoImapProvider->MoveMessage('%s','%s','%s'): Error, unable to retrieve overview of source message: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID);1422 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, unable to retrieve overview of source message: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID); 1228 1423 else { 1229 1424 // get next UID for destination folder … … 1234 1429 $destStatus = imap_status($this->mbox, $this->server . $newfolderImapid, SA_ALL); 1235 1430 if (!$destStatus) 1236 throw new StatusException(sprintf(" ExpressoImapProvider->MoveMessage('%s','%s','%s'): Error, unable to open destination folder: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_INVALIDDESTID);1431 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, unable to open destination folder: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_INVALIDDESTID); 1237 1432 1238 1433 $newid = $destStatus->uidnext; … … 1241 1436 $s1 = imap_mail_move($this->mbox, $id, $newfolderImapid, CP_UID); 1242 1437 if (! $s1) 1243 throw new StatusException(sprintf(" ExpressoImapProvider->MoveMessage('%s','%s','%s'): Error, copy to destination folder failed: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_CANNOTMOVE);1438 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, copy to destination folder failed: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_CANNOTMOVE); 1244 1439 1245 1440 … … 1250 1445 $stat = $this->imap_reopenFolder($newfolderImapid); 1251 1446 if (! $s1) 1252 throw new StatusException(sprintf(" ExpressoImapProvider->MoveMessage('%s','%s','%s'): Error, openeing the destination folder: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_CANNOTMOVE);1447 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, openeing the destination folder: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_CANNOTMOVE); 1253 1448 1254 1449 … … 1261 1456 $s4 = @imap_setflag_full ($this->mbox, $newid, $newflags, FT_UID); 1262 1457 1263 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->MoveMessage('%s','%s','%s'): result s-move: '%s' s-expunge: '%s' unset-Flags: '%s' set-Flags: '%s'", $folderid, $id, $newfolderid, Utils::PrintAsString($s1), Utils::PrintAsString($s2), Utils::PrintAsString($s3), Utils::PrintAsString($s4)));1458 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): result s-move: '%s' s-expunge: '%s' unset-Flags: '%s' set-Flags: '%s'", $folderid, $id, $newfolderid, Utils::PrintAsString($s1), Utils::PrintAsString($s2), Utils::PrintAsString($s3), Utils::PrintAsString($s4))); 1264 1459 1265 1460 // return the new id "as string"" … … 1287 1482 if (isset($this->permanentStorage->fmFidFimap[$folderid])) { 1288 1483 $imapId = $this->permanentStorage->fmFidFimap[$folderid]; 1289 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->getImapIdFromFolderId('%s') = %s", $folderid, $imapId));1484 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getImapIdFromFolderId('%s') = %s", $folderid, $imapId)); 1290 1485 return $imapId; 1291 1486 } 1292 1487 else { 1293 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->getImapIdFromFolderId('%s') = %s", $folderid, 'not found'));1488 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getImapIdFromFolderId('%s') = %s", $folderid, 'not found')); 1294 1489 return false; 1295 1490 } 1296 1491 } 1297 ZLog::Write(LOGLEVEL_WARN, sprintf(" ExpressoImapProvider->getImapIdFromFolderId('%s') = %s", $folderid, 'not initialized!'));1492 ZLog::Write(LOGLEVEL_WARN, sprintf("BackendIMAP->getImapIdFromFolderId('%s') = %s", $folderid, 'not initialized!')); 1298 1493 return false; 1299 1494 } … … 1313 1508 if (isset($this->permanentStorage->fmFimapFid[$imapid])) { 1314 1509 $folderid = $this->permanentStorage->fmFimapFid[$imapid]; 1315 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->getFolderIdFromImapId('%s') = %s", $imapid, $folderid));1510 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getFolderIdFromImapId('%s') = %s", $imapid, $folderid)); 1316 1511 return $folderid; 1317 1512 } 1318 1513 else { 1319 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->getFolderIdFromImapId('%s') = %s", $imapid, 'not found'));1514 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getFolderIdFromImapId('%s') = %s", $imapid, 'not found')); 1320 1515 return false; 1321 1516 } 1322 1517 } 1323 ZLog::Write(LOGLEVEL_WARN, sprintf(" ExpressoImapProvider->getFolderIdFromImapId('%s') = %s", $imapid, 'not initialized!'));1518 ZLog::Write(LOGLEVEL_WARN, sprintf("BackendIMAP->getFolderIdFromImapId('%s') = %s", $imapid, 'not initialized!')); 1324 1519 return false; 1325 1520 } … … 1363 1558 } 1364 1559 1365 ZLog::Write(LOGLEVEL_DEBUG, sprintf(" ExpressoImapProvider->convertImapId('%s') = %s", $imapid, $folderid));1560 ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->convertImapId('%s') = %s", $imapid, $folderid)); 1366 1561 1367 1562 return $folderid; … … 1385 1580 if($body === "") { 1386 1581 $this->getBodyRecursive($message, "html", $body); 1387 // remove css-style tags1388 $body = preg_replace("/<style.*?<\/style>/is", "", $body);1389 // remove all other html1390 $body = strip_tags($body);1391 1582 } 1392 1583 … … 1426 1617 */ 1427 1618 protected function getServerDelimiter() { 1428 $list = @imap_getmailboxes($this->mbox, $this->server, " *");1619 $list = @imap_getmailboxes($this->mbox, $this->server, "INBOX*"); 1429 1620 if (is_array($list)) { 1430 1621 $val = $list[0]; … … 1447 1638 protected function imap_reopenFolder($folderid, $force = false) { 1448 1639 // to see changes, the folder has to be reopened! 1449 if ($this->mboxFolder != $folderid || $force) {1450 $s = @imap_reopen($this->mbox, $this->server . $folderid);1451 // TODO throw status exception1452 if (!$s) {1453 ZLog::Write(LOGLEVEL_WARN, " ExpressoImapProvider->imap_reopenFolder('%s'): failed to change folder: ",$folderid, implode(", ", imap_errors()));1640 if ($this->mboxFolder != $folderid || $force) { 1641 $s = @imap_reopen($this->mbox, $this->server . $folderid); 1642 // TODO throw status exception 1643 if (!$s) { 1644 ZLog::Write(LOGLEVEL_WARN, "BackendIMAP->imap_reopenFolder('%s'): failed to change folder: ",$folderid, implode(", ", imap_errors())); 1454 1645 return false; 1455 }1646 } 1456 1647 $this->mboxFolder = $folderid; 1457 1648 } … … 1564 1755 foreach($ad as $addr) { 1565 1756 if ($addr_string) $addr_string .= ","; 1566 $addr_string .= $addr->mailbox . "@" . $addr->host;1757 $addr_string .= $addr->mailbox . "@" . $addr->host; 1567 1758 } 1568 1759 } … … 1627 1818 } 1628 1819 1629 } 1820 /* BEGIN fmbiete's contribution r1528, ZP-320 */ 1821 /** 1822 * Indicates which AS version is supported by the backend. 1823 * 1824 * @access public 1825 * @return string AS version constant 1826 */ 1827 public function GetSupportedASVersion() { 1828 return ZPush::ASV_14; 1829 } 1830 /* END fmbiete's contribution r1528, ZP-320 */ 1831 }; 1630 1832 1631 1833 ?>
Note: See TracChangeset
for help on using the changeset viewer.