Пример #1
0
 /**
  * Gets the user's email address from server
  *
  * @param SyncObject $userinformation
  *
  * @access private
  * @return void
  */
 private function settingsUserInformation(&$userinformation)
 {
     if (!isset($this->defaultstore) || !isset($this->mainUser)) {
         ZLog::Write(LOGLEVEL_ERROR, "The store or user are not available for getting user information");
         return false;
     }
     $user = mapi_zarafa_getuser($this->defaultstore, $this->mainUser);
     if ($user != false) {
         $userinformation->Status = SYNC_SETTINGSSTATUS_USERINFO_SUCCESS;
         $userinformation->emailaddresses[] = $user["emailaddress"];
         return true;
     }
     ZLog::Write(LOGLEVEL_ERROR, sprintf("Getting user information failed: mapi_zarafa_getuser(%X)", mapi_last_hresult()));
     return false;
 }
Пример #2
0
 /**
  * Writes a SyncTask to MAPI
  *
  * @param mixed             $mapimessage
  * @param SyncTask          $task
  *
  * @access private
  * @return boolean
  */
 private function setTask($mapimessage, $task)
 {
     mapi_setprops($mapimessage, array(PR_MESSAGE_CLASS => "IPM.Task"));
     $taskmapping = MAPIMapping::GetTaskMapping();
     $taskprops = MAPIMapping::GetTaskProperties();
     $this->setPropsInMAPI($mapimessage, $task, $taskmapping);
     $taskprops = array_merge($this->getPropIdsFromStrings($taskmapping), $this->getPropIdsFromStrings($taskprops));
     // task specific properties to be set
     $props = array();
     if (isset($task->asbody)) {
         $this->setASbody($task->asbody, $props, $taskprops);
     }
     if (isset($task->complete)) {
         if ($task->complete) {
             // Set completion to 100%
             // Set status to 'complete'
             $props[$taskprops["completion"]] = 1.0;
             $props[$taskprops["status"]] = 2;
             $props[$taskprops["reminderset"]] = false;
         } else {
             // Set completion to 0%
             // Set status to 'not started'
             $props[$taskprops["completion"]] = 0.0;
             $props[$taskprops["status"]] = 0;
         }
     }
     if (isset($task->recurrence) && class_exists('TaskRecurrence')) {
         $deadoccur = false;
         if (isset($task->recurrence->occurrences) && $task->recurrence->occurrences == 1 || isset($task->recurrence->deadoccur) && $task->recurrence->deadoccur == 1) {
             //ios5 sends deadoccur inside the recurrence
             $deadoccur = true;
         }
         // Set PR_ICON_INDEX to 1281 to show correct icon in category view
         $props[$taskprops["icon"]] = 1281;
         // dead occur - false if new occurrences should be generated from the task
         // true - if it is the last ocurrence of the task
         $props[$taskprops["deadoccur"]] = $deadoccur;
         $props[$taskprops["isrecurringtag"]] = true;
         $recurrence = new TaskRecurrence($this->store, $mapimessage);
         $recur = array();
         $this->setRecurrence($task, $recur);
         // task specific recurrence properties which we need to set here
         // "start" and "end" are in GMT when passing to class.recurrence
         // set recurrence start here because it's calculated differently for tasks and appointments
         $recur["start"] = $task->recurrence->start;
         $recur["regen"] = $task->regenerate;
         //Also add dates to $recur
         $recur["duedate"] = $task->duedate;
         $recurrence->setRecurrence($recur);
     }
     //open addresss book for user resolve to set the owner
     $addrbook = $this->getAddressbook();
     // check if there is already an owner for the task, set current user if not
     $p = array($taskprops["owner"]);
     $owner = $this->getProps($mapimessage, $p);
     if (!isset($owner[$taskprops["owner"]])) {
         $userinfo = mapi_zarafa_getuser($this->store, Request::GetAuthUser());
         if (mapi_last_hresult() == NOERROR && isset($userinfo["fullname"])) {
             $props[$taskprops["owner"]] = $userinfo["fullname"];
         }
     }
     mapi_setprops($mapimessage, $props);
 }
Пример #3
0
 function getSettings($request, $devid)
 {
     if (isset($request["userinformation"])) {
         $userdetails = mapi_zarafa_getuser($this->_defaultstore, $this->_user);
         if ($userdetails != false) {
             $response["userinformation"]["status"] = 1;
             $response["userinformation"]["emailaddresses"][] = $userdetails["emailaddress"];
         } else {
             $response["userinformation"]["status"] = false;
         }
     }
     if (isset($request["oof"])) {
         $props = mapi_getprops($this->_defaultstore, array(PR_EC_OUTOFOFFICE, PR_EC_OUTOFOFFICE_MSG, PR_EC_OUTOFOFFICE_SUBJECT));
         if ($props != false) {
             $response["oof"]["status"] = 1;
             $response["oof"]["oofstate"] = isset($props[PR_EC_OUTOFOFFICE]) ? $props[PR_EC_OUTOFOFFICE] ? 1 : 0 : 0;
             $oofmsg["appliesto"] = SYNC_SETTINGS_APPLIESTOINTERNAL;
             $oofmsg["replymessage"] = w2u(isset($props[PR_EC_OUTOFOFFICE_MSG]) ? $props[PR_EC_OUTOFOFFICE_MSG] : "");
             $oofmsg["enabled"] = isset($props[PR_EC_OUTOFOFFICE]) ? $props[PR_EC_OUTOFOFFICE] ? 1 : 0 : 0;
             $oofmsg["bodytype"] = $request["oof"]["bodytype"];
             $response["oof"]["oofmsgs"][] = $oofmsg;
             // $this->settings["outofoffice"]["subject"] = windows1252_to_utf8(isset($props[PR_EC_OUTOFOFFICE_SUBJECT]) ? $props[PR_EC_OUTOFOFFICE_SUBJECT] : "");
         } else {
             $response["oof"]["status"] = 0;
         }
     }
     return $response;
 }