Commit e6898bad authored by Manfred Kutas's avatar Manfred Kutas

ZP-1339 Replace removed PHP-MAPI functions.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 84c366b8
...@@ -431,10 +431,10 @@ class ImportChangesICS implements IImportChanges { ...@@ -431,10 +431,10 @@ class ImportChangesICS implements IImportChanges {
if(mapi_importcontentschanges_importmessagechange($this->importer, $props, $flags, $mapimessage)) { if(mapi_importcontentschanges_importmessagechange($this->importer, $props, $flags, $mapimessage)) {
$this->mapiprovider->SetMessage($mapimessage, $message); $this->mapiprovider->SetMessage($mapimessage, $message);
mapi_message_savechanges($mapimessage); mapi_savechanges($mapimessage);
if (mapi_last_hresult()) if (mapi_last_hresult())
throw new StatusException(sprintf("ImportChangesICS->ImportMessageChange('%s','%s'): Error, mapi_message_savechanges() failed: 0x%X", $id, get_class($message), mapi_last_hresult()), SYNC_STATUS_SYNCCANNOTBECOMPLETED); throw new StatusException(sprintf("ImportChangesICS->ImportMessageChange('%s','%s'): Error, mapi_savechanges() failed: 0x%X", $id, get_class($message), mapi_last_hresult()), SYNC_STATUS_SYNCCANNOTBECOMPLETED);
$sourcekeyprops = mapi_getprops($mapimessage, array (PR_SOURCE_KEY)); $sourcekeyprops = mapi_getprops($mapimessage, array (PR_SOURCE_KEY));
......
...@@ -703,7 +703,7 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -703,7 +703,7 @@ class BackendKopano implements IBackend, ISearchProvider {
} }
mapi_setprops($mapimessage, $mapiprops); mapi_setprops($mapimessage, $mapiprops);
mapi_message_savechanges($mapimessage); mapi_savechanges($mapimessage);
mapi_message_submitmessage($mapimessage); mapi_message_submitmessage($mapimessage);
$hr = mapi_last_hresult(); $hr = mapi_last_hresult();
...@@ -1920,7 +1920,7 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -1920,7 +1920,7 @@ class BackendKopano implements IBackend, ISearchProvider {
ZLog::Write(LOGLEVEL_ERROR, "The store or user are not available for getting user information"); ZLog::Write(LOGLEVEL_ERROR, "The store or user are not available for getting user information");
return false; return false;
} }
$user = mapi_zarafa_getuser($this->defaultstore, $this->mainUser); $user = mapi_zarafa_getuser_by_name($this->defaultstore, $this->mainUser);
if ($user != false) { if ($user != false) {
$userinformation->Status = SYNC_SETTINGSSTATUS_USERINFO_SUCCESS; $userinformation->Status = SYNC_SETTINGSSTATUS_USERINFO_SUCCESS;
if (Request::GetProtocolVersion() >= 14.1) { if (Request::GetProtocolVersion() >= 14.1) {
...@@ -1936,7 +1936,7 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -1936,7 +1936,7 @@ class BackendKopano implements IBackend, ISearchProvider {
} }
return true; return true;
} }
ZLog::Write(LOGLEVEL_ERROR, sprintf("Getting user information failed: mapi_zarafa_getuser(%X)", mapi_last_hresult())); ZLog::Write(LOGLEVEL_ERROR, sprintf("Getting user information failed: mapi_zarafa_getuser_by_name(%X)", mapi_last_hresult()));
return false; return false;
} }
......
...@@ -379,7 +379,7 @@ class Meetingrequest { ...@@ -379,7 +379,7 @@ class Meetingrequest {
$recurr->createException($exception_props, $basedate, false, $recips); $recurr->createException($exception_props, $basedate, false, $recips);
} }
mapi_message_savechanges($calendaritem); mapi_savechanges($calendaritem);
$attach = $recurr->getExceptionAttachment($basedate); $attach = $recurr->getExceptionAttachment($basedate);
if ($attach) { if ($attach) {
...@@ -469,13 +469,13 @@ If it is the first time this attendee has proposed a new date/time, increment th ...@@ -469,13 +469,13 @@ If it is the first time this attendee has proposed a new date/time, increment th
$props[$this->proptags['counter_proposal']] = false; $props[$this->proptags['counter_proposal']] = false;
} }
mapi_message_setprops($calendaritem, $props); mapi_setprops($calendaritem, $props);
} }
mapi_message_savechanges($calendaritem); mapi_savechanges($calendaritem);
if (isset($attach)) { if (isset($attach)) {
mapi_message_savechanges($attach); mapi_savechanges($attach);
mapi_message_savechanges($recurringItem); mapi_savechanges($recurringItem);
} }
return $data; return $data;
...@@ -559,7 +559,7 @@ If it is the first time this attendee has proposed a new date/time, increment th ...@@ -559,7 +559,7 @@ If it is the first time this attendee has proposed a new date/time, increment th
foreach($calendaritems as $entryid) { foreach($calendaritems as $entryid) {
// Open each calendar item and set the properties of the cancellation object // Open each calendar item and set the properties of the cancellation object
$calendaritem = mapi_msgstore_openentry($store, $entryid); $calendaritem = mapi_msgstore_openentry($store, $entryid);
mapi_message_setprops($calendaritem, $messageprops); mapi_setprops($calendaritem, $messageprops);
mapi_savechanges($calendaritem); mapi_savechanges($calendaritem);
} }
} }
...@@ -639,7 +639,7 @@ If it is the first time this attendee has proposed a new date/time, increment th ...@@ -639,7 +639,7 @@ If it is the first time this attendee has proposed a new date/time, increment th
return false; return false;
} else { } else {
mapi_setprops($this->message, Array(PR_PROCESSED => true)); mapi_setprops($this->message, Array(PR_PROCESSED => true));
mapi_message_savechanges($this->message); mapi_savechanges($this->message);
} }
} }
...@@ -881,7 +881,7 @@ If it is the first time this attendee has proposed a new date/time, increment th ...@@ -881,7 +881,7 @@ If it is the first time this attendee has proposed a new date/time, increment th
mapi_message_modifyrecipients($calmsg, MODRECIP_ADD, $recips); mapi_message_modifyrecipients($calmsg, MODRECIP_ADD, $recips);
} }
mapi_message_savechanges($calmsg); mapi_savechanges($calmsg);
// Move the message to the wastebasket // Move the message to the wastebasket
$wastebasket = $this->openDefaultWastebasket(); $wastebasket = $this->openDefaultWastebasket();
...@@ -942,7 +942,7 @@ If it is the first time this attendee has proposed a new date/time, increment th ...@@ -942,7 +942,7 @@ If it is the first time this attendee has proposed a new date/time, increment th
} else { } else {
mapi_message_modifyrecipients($new, MODRECIP_ADD, $recips); mapi_message_modifyrecipients($new, MODRECIP_ADD, $recips);
} }
mapi_message_savechanges($new); mapi_savechanges($new);
$props = mapi_getprops($new, array(PR_ENTRYID)); $props = mapi_getprops($new, array(PR_ENTRYID));
$entryid = $props[PR_ENTRYID]; $entryid = $props[PR_ENTRYID];
...@@ -1757,7 +1757,7 @@ If it is the first time this attendee has proposed a new date/time, increment th ...@@ -1757,7 +1757,7 @@ If it is the first time this attendee has proposed a new date/time, increment th
$message = mapi_folder_createmessage($outbox); $message = mapi_folder_createmessage($outbox);
mapi_setprops($message, $props); mapi_setprops($message, $props);
mapi_message_modifyrecipients($message, MODRECIP_ADD, Array($recip)); mapi_message_modifyrecipients($message, MODRECIP_ADD, Array($recip));
mapi_message_savechanges($message); mapi_savechanges($message);
mapi_message_submitmessage($message); mapi_message_submitmessage($message);
} }
...@@ -2385,7 +2385,7 @@ If it is the first time this attendee has proposed a new date/time, increment th ...@@ -2385,7 +2385,7 @@ If it is the first time this attendee has proposed a new date/time, increment th
// Publish updated free/busy information // Publish updated free/busy information
if(!$this->errorSetResource){ if(!$this->errorSetResource){
for($i = 0, $len = count($resourceRecipData); $i < $len; $i++){ for($i = 0, $len = count($resourceRecipData); $i < $len; $i++){
$storeProps = mapi_msgstore_getprops($resourceRecipData[$i]['store'], array(PR_MAILBOX_OWNER_ENTRYID)); $storeProps = mapi_getprops($resourceRecipData[$i]['store'], array(PR_MAILBOX_OWNER_ENTRYID));
if (isset($storeProps[PR_MAILBOX_OWNER_ENTRYID])){ if (isset($storeProps[PR_MAILBOX_OWNER_ENTRYID])){
$pub = new FreeBusyPublish($this->session, $resourceRecipData[$i]['store'], $resourceRecipData[$i]['folder'], $storeProps[PR_MAILBOX_OWNER_ENTRYID]); $pub = new FreeBusyPublish($this->session, $resourceRecipData[$i]['store'], $resourceRecipData[$i]['folder'], $storeProps[PR_MAILBOX_OWNER_ENTRYID]);
$pub->publishFB(time() - (7 * 24 * 60 * 60), 6 * 30 * 24 * 60 * 60); // publish from one week ago, 6 months ahead $pub->publishFB(time() - (7 * 24 * 60 * 60), 6 * 30 * 24 * 60 * 60); // publish from one week ago, 6 months ahead
...@@ -2672,7 +2672,7 @@ If it is the first time this attendee has proposed a new date/time, increment th ...@@ -2672,7 +2672,7 @@ If it is the first time this attendee has proposed a new date/time, increment th
} }
mapi_setprops($new, $newmessageprops); mapi_setprops($new, $newmessageprops);
mapi_message_savechanges($new); mapi_savechanges($new);
// Submit message to non-resource recipients // Submit message to non-resource recipients
mapi_message_submitmessage($new); mapi_message_submitmessage($new);
...@@ -2693,7 +2693,7 @@ If it is the first time this attendee has proposed a new date/time, increment th ...@@ -2693,7 +2693,7 @@ If it is the first time this attendee has proposed a new date/time, increment th
} }
mapi_setprops($new, $newmessageprops); mapi_setprops($new, $newmessageprops);
mapi_message_savechanges($new); mapi_savechanges($new);
// Submit message to non-resource recipients // Submit message to non-resource recipients
mapi_message_submitmessage($new); mapi_message_submitmessage($new);
......
...@@ -706,7 +706,7 @@ ...@@ -706,7 +706,7 @@
$props[PR_DISPLAY_NAME] = "Exception"; $props[PR_DISPLAY_NAME] = "Exception";
$props[PR_EXCEPTION_STARTTIME] = $this->fromGMT($this->tz, $exception_props[$this->proptags["startdate"]]); $props[PR_EXCEPTION_STARTTIME] = $this->fromGMT($this->tz, $exception_props[$this->proptags["startdate"]]);
$props[PR_EXCEPTION_ENDTIME] = $this->fromGMT($this->tz, $exception_props[$this->proptags["duedate"]]); $props[PR_EXCEPTION_ENDTIME] = $this->fromGMT($this->tz, $exception_props[$this->proptags["duedate"]]);
mapi_message_setprops($attachment, $props); mapi_setprops($attachment, $props);
$imessage = mapi_attach_openobj($attachment, MAPI_CREATE | MAPI_MODIFY); $imessage = mapi_attach_openobj($attachment, MAPI_CREATE | MAPI_MODIFY);
...@@ -736,12 +736,12 @@ ...@@ -736,12 +736,12 @@
} }
} }
mapi_message_setprops($imessage, $props); mapi_setprops($imessage, $props);
$this->setExceptionRecipients($imessage, $exception_recips, true); $this->setExceptionRecipients($imessage, $exception_recips, true);
mapi_message_savechanges($imessage); mapi_savechanges($imessage);
mapi_message_savechanges($attachment); mapi_savechanges($attachment);
} }
/** /**
......
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
mapi_savechanges($newMessage); mapi_savechanges($newMessage);
// Update body of original message // Update body of original message
$msgbody = mapi_message_openproperty($this->message, PR_BODY); $msgbody = mapi_openproperty($this->message, PR_BODY);
$msgbody = trim($this->windows1252_to_utf8($msgbody), "\0"); $msgbody = trim($this->windows1252_to_utf8($msgbody), "\0");
$separator = "------------\r\n"; $separator = "------------\r\n";
......
...@@ -930,7 +930,7 @@ ...@@ -930,7 +930,7 @@
if (isset($msgProps[$this->props['mileage']])) $body .= "\n" . _("Mileage") . ":\t". $msgProps[$this->props['mileage']]; if (isset($msgProps[$this->props['mileage']])) $body .= "\n" . _("Mileage") . ":\t". $msgProps[$this->props['mileage']];
$body .="\n"; $body .="\n";
$content = mapi_message_openproperty($this->message, PR_BODY); $content = mapi_openproperty($this->message, PR_BODY);
$body .= "\n". trim($content, "\0"); $body .= "\n". trim($content, "\0");
return $body; return $body;
......
...@@ -1709,7 +1709,7 @@ class MAPIProvider { ...@@ -1709,7 +1709,7 @@ class MAPIProvider {
$p = array( $taskprops["owner"]); $p = array( $taskprops["owner"]);
$owner = $this->getProps($mapimessage, $p); $owner = $this->getProps($mapimessage, $p);
if (!isset($owner[$taskprops["owner"]])) { if (!isset($owner[$taskprops["owner"]])) {
$userinfo = mapi_zarafa_getuser($this->store, Request::GetAuthUser()); $userinfo = mapi_zarafa_getuser_by_name($this->store, Request::GetAuthUser());
if(mapi_last_hresult() == NOERROR && isset($userinfo["fullname"])) { if(mapi_last_hresult() == NOERROR && isset($userinfo["fullname"])) {
$props[$taskprops["owner"]] = $userinfo["fullname"]; $props[$taskprops["owner"]] = $userinfo["fullname"];
} }
......
...@@ -262,7 +262,7 @@ class Kopano extends ContactWorker { ...@@ -262,7 +262,7 @@ class Kopano extends ContactWorker {
// save the hash in the message as well // save the hash in the message as well
mapi_setprops($mapimessage, array($this->mapiprops['hash'] => $contact->GetHash())); mapi_setprops($mapimessage, array($this->mapiprops['hash'] => $contact->GetHash()));
$mapiprovider->SetMessage($mapimessage, $contact); $mapiprovider->SetMessage($mapimessage, $contact);
mapi_message_savechanges($mapimessage); mapi_savechanges($mapimessage);
unset($existingByAccount[$contact->accountname]); unset($existingByAccount[$contact->accountname]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment