public static function GetCalendarRestriction($store, $timestamp) { // This is our viewing window $start = $timestamp; $end = 0x7fffffff; // infinite end $props = MAPIMapping::GetAppointmentProperties(); $props = getPropIdsFromStrings($store, $props); $restriction = array(RES_OR, array(array(RES_AND, array(array(RES_PROPERTY, array(RELOP => RELOP_LE, ULPROPTAG => $props["starttime"], VALUE => $end)), array(RES_PROPERTY, array(RELOP => RELOP_GE, ULPROPTAG => $props["endtime"], VALUE => $start)))), array(RES_OR, array(array(RES_AND, array(array(RES_EXIST, array(ULPROPTAG => $props["recurrenceend"])), array(RES_PROPERTY, array(RELOP => RELOP_EQ, ULPROPTAG => $props["isrecurring"], VALUE => true)), array(RES_PROPERTY, array(RELOP => RELOP_GE, ULPROPTAG => $props["recurrenceend"], VALUE => $start)))), array(RES_AND, array(array(RES_NOT, array(array(RES_EXIST, array(ULPROPTAG => $props["recurrenceend"])))), array(RES_PROPERTY, array(RELOP => RELOP_LE, ULPROPTAG => $props["starttime"], VALUE => $end)), array(RES_PROPERTY, array(RELOP => RELOP_EQ, ULPROPTAG => $props["isrecurring"], VALUE => true)))))))); // global OR return $restriction; }
function TaskRecurrence($store, $message) { $this->store = $store; $this->message = $message; $properties = array(); $properties["entryid"] = PR_ENTRYID; $properties["parent_entryid"] = PR_PARENT_ENTRYID; $properties["icon_index"] = PR_ICON_INDEX; $properties["message_class"] = PR_MESSAGE_CLASS; $properties["message_flags"] = PR_MESSAGE_FLAGS; $properties["subject"] = PR_SUBJECT; $properties["importance"] = PR_IMPORTANCE; $properties["sensitivity"] = PR_SENSITIVITY; $properties["last_modification_time"] = PR_LAST_MODIFICATION_TIME; $properties["status"] = "PT_LONG:PSETID_Task:0x8101"; $properties["percent_complete"] = "PT_DOUBLE:PSETID_Task:0x8102"; $properties["startdate"] = "PT_SYSTIME:PSETID_Task:0x8104"; $properties["duedate"] = "PT_SYSTIME:PSETID_Task:0x8105"; $properties["reset_reminder"] = "PT_BOOLEAN:PSETID_Task:0x8107"; $properties["dead_occurrence"] = "PT_BOOLEAN:PSETID_Task:0x8109"; $properties["datecompleted"] = "PT_SYSTIME:PSETID_Task:0x810f"; $properties["recurring_data"] = "PT_BINARY:PSETID_Task:0x8116"; $properties["actualwork"] = "PT_LONG:PSETID_Task:0x8110"; $properties["totalwork"] = "PT_LONG:PSETID_Task:0x8111"; $properties["complete"] = "PT_BOOLEAN:PSETID_Task:0x811c"; $properties["task_f_creator"] = "PT_BOOLEAN:PSETID_Task:0x811e"; $properties["owner"] = "PT_STRING8:PSETID_Task:0x811f"; $properties["recurring"] = "PT_BOOLEAN:PSETID_Task:0x8126"; $properties["reminder_minutes"] = "PT_LONG:PSETID_Common:0x8501"; $properties["reminder_time"] = "PT_SYSTIME:PSETID_Common:0x8502"; $properties["reminder"] = "PT_BOOLEAN:PSETID_Common:0x8503"; $properties["private"] = "PT_BOOLEAN:PSETID_Common:0x8506"; $properties["contacts"] = "PT_MV_STRING8:PSETID_Common:0x853a"; $properties["contacts_string"] = "PT_STRING8:PSETID_Common:0x8586"; $properties["categories"] = "PT_MV_STRING8:PS_PUBLIC_STRINGS:Keywords"; $properties["commonstart"] = "PT_SYSTIME:PSETID_Common:0x8516"; $properties["commonend"] = "PT_SYSTIME:PSETID_Common:0x8517"; $properties["commonassign"] = "PT_LONG:PSETID_Common:0x8518"; $properties["flagdueby"] = "PT_SYSTIME:PSETID_Common:0x8560"; $properties["side_effects"] = "PT_LONG:PSETID_Common:0x8510"; $properties["reminder"] = "PT_BOOLEAN:PSETID_Common:0x8503"; $properties["reminder_minutes"] = "PT_LONG:PSETID_Common:0x8501"; $this->proptags = getPropIdsFromStrings($store, $properties); parent::BaseRecurrence($store, $message, $properties); }
/** * Constructor * @param resource $store MAPI Message Store Object * @param resource $message the MAPI (appointment) message */ function Recurrence($store, $message) { $properties = array(); $properties["entryid"] = PR_ENTRYID; $properties["parent_entryid"] = PR_PARENT_ENTRYID; $properties["message_class"] = PR_MESSAGE_CLASS; $properties["icon_index"] = PR_ICON_INDEX; $properties["subject"] = PR_SUBJECT; $properties["display_to"] = PR_DISPLAY_TO; $properties["importance"] = PR_IMPORTANCE; $properties["sensitivity"] = PR_SENSITIVITY; $properties["startdate"] = "PT_SYSTIME:PSETID_Appointment:0x820d"; $properties["duedate"] = "PT_SYSTIME:PSETID_Appointment:0x820e"; $properties["recurring"] = "PT_BOOLEAN:PSETID_Appointment:0x8223"; $properties["recurring_data"] = "PT_BINARY:PSETID_Appointment:0x8216"; $properties["busystatus"] = "PT_LONG:PSETID_Appointment:0x8205"; $properties["label"] = "PT_LONG:PSETID_Appointment:0x8214"; $properties["alldayevent"] = "PT_BOOLEAN:PSETID_Appointment:0x8215"; $properties["private"] = "PT_BOOLEAN:PSETID_Common:0x8506"; $properties["meeting"] = "PT_LONG:PSETID_Appointment:0x8217"; $properties["startdate_recurring"] = "PT_SYSTIME:PSETID_Appointment:0x8235"; $properties["enddate_recurring"] = "PT_SYSTIME:PSETID_Appointment:0x8236"; $properties["recurring_pattern"] = "PT_STRING8:PSETID_Appointment:0x8232"; $properties["location"] = "PT_STRING8:PSETID_Appointment:0x8208"; $properties["duration"] = "PT_LONG:PSETID_Appointment:0x8213"; $properties["responsestatus"] = "PT_LONG:PSETID_Appointment:0x8218"; $properties["reminder"] = "PT_BOOLEAN:PSETID_Common:0x8503"; $properties["reminder_minutes"] = "PT_LONG:PSETID_Common:0x8501"; $properties["recurrencetype"] = "PT_LONG:PSETID_Appointment:0x8231"; $properties["contacts"] = "PT_MV_STRING8:PSETID_Common:0x853a"; $properties["contacts_string"] = "PT_STRING8:PSETID_Common:0x8586"; $properties["categories"] = "PT_MV_STRING8:PS_PUBLIC_STRINGS:Keywords"; $properties["reminder_time"] = "PT_SYSTIME:PSETID_Common:0x8502"; $properties["commonstart"] = "PT_SYSTIME:PSETID_Common:0x8516"; $properties["commonend"] = "PT_SYSTIME:PSETID_Common:0x8517"; $properties["basedate"] = "PT_SYSTIME:PSETID_Appointment:0x8228"; $properties["timezone_data"] = "PT_BINARY:PSETID_Appointment:0x8233"; $properties["timezone"] = "PT_STRING8:PSETID_Appointment:0x8234"; $properties["flagdueby"] = "PT_SYSTIME:PSETID_Common:0x8560"; $properties["side_effects"] = "PT_LONG:PSETID_Common:0x8510"; $properties["hideattachments"] = "PT_BOOLEAN:PSETID_Common:0x8514"; $this->proptags = getPropIdsFromStrings($store, $properties); parent::BaseRecurrence($store, $message); }
/** * Constructor */ public function __construct() { parent::__construct(); // send Z-Push version and user agent to ZCP >7.2.0 if ($this->checkMapiExtVersion('7.2.0')) { $this->session = mapi_logon_zarafa(USERNAME, PASSWORD, SERVER, CERTIFICATE, CERTIFICATE_PASSWORD, 0, self::VERSION, self::NAME . " " . self::VERSION); } else { $this->session = mapi_logon_zarafa(USERNAME, PASSWORD, SERVER, CERTIFICATE, CERTIFICATE_PASSWORD, 0); } if (mapi_last_hresult()) { $this->Terminate(sprintf("Kopano: login failed with error code: 0x%08X", mapi_last_hresult())); } $this->mainUser = USERNAME; $this->targetStore = HIDDEN_FOLDERSTORE; $this->defaultstore = $this->openMessageStore($this->mainUser); $this->store = $this->openMessageStore(HIDDEN_FOLDERSTORE); $this->folderCache = array(); $this->storeCache = array(); $this->mapiprops = array("chunktype" => "PT_STRING8:PSETID_Appointment:0x6822", "chunkCRC" => "PT_STRING8:PSETID_Appointment:0x8208", "createtime" => "PT_SYSTIME:PSETID_Appointment:0x820d", "updatetime" => "PT_SYSTIME:PSETID_Appointment:0x820e", "reminderset" => "PT_BOOLEAN:PSETID_Common:0x8503", "isrecurring" => "PT_BOOLEAN:PSETID_Appointment:0x8223", "busystatus" => "PT_LONG:PSETID_Appointment:0x8205"); $this->mapiprops = getPropIdsFromStrings($this->store, $this->mapiprops); }
/** * Constuctor * * @param mapi_session $session MAPI Session * @param mapi_folder $calendar Calendar to publish * @param string $entryid AddressBook Entry ID for the user we're publishing for */ function FreeBusyPublish($session, $store, $calendar, $entryid) { $properties["entryid"] = PR_ENTRYID; $properties["parent_entryid"] = PR_PARENT_ENTRYID; $properties["message_class"] = PR_MESSAGE_CLASS; $properties["icon_index"] = PR_ICON_INDEX; $properties["subject"] = PR_SUBJECT; $properties["display_to"] = PR_DISPLAY_TO; $properties["importance"] = PR_IMPORTANCE; $properties["sensitivity"] = PR_SENSITIVITY; $properties["startdate"] = "PT_SYSTIME:PSETID_Appointment:0x820d"; $properties["duedate"] = "PT_SYSTIME:PSETID_Appointment:0x820e"; $properties["recurring"] = "PT_BOOLEAN:PSETID_Appointment:0x8223"; $properties["recurring_data"] = "PT_BINARY:PSETID_Appointment:0x8216"; $properties["busystatus"] = "PT_LONG:PSETID_Appointment:0x8205"; $properties["label"] = "PT_LONG:PSETID_Appointment:0x8214"; $properties["alldayevent"] = "PT_BOOLEAN:PSETID_Appointment:0x8215"; $properties["private"] = "PT_BOOLEAN:PSETID_Common:0x8506"; $properties["meeting"] = "PT_LONG:PSETID_Appointment:0x8217"; $properties["startdate_recurring"] = "PT_SYSTIME:PSETID_Appointment:0x8235"; $properties["enddate_recurring"] = "PT_SYSTIME:PSETID_Appointment:0x8236"; $properties["location"] = "PT_STRING8:PSETID_Appointment:0x8208"; $properties["duration"] = "PT_LONG:PSETID_Appointment:0x8213"; $properties["responsestatus"] = "PT_LONG:PSETID_Appointment:0x8218"; $properties["reminder"] = "PT_BOOLEAN:PSETID_Common:0x8503"; $properties["reminder_minutes"] = "PT_LONG:PSETID_Common:0x8501"; $properties["contacts"] = "PT_MV_STRING8:PSETID_Common:0x853a"; $properties["contacts_string"] = "PT_STRING8:PSETID_Common:0x8586"; $properties["categories"] = "PT_MV_STRING8:PS_PUBLIC_STRINGS:Keywords"; $properties["reminder_time"] = "PT_SYSTIME:PSETID_Common:0x8502"; $properties["commonstart"] = "PT_SYSTIME:PSETID_Common:0x8516"; $properties["commonend"] = "PT_SYSTIME:PSETID_Common:0x8517"; $properties["basedate"] = "PT_SYSTIME:PSETID_Appointment:0x8228"; $properties["timezone_data"] = "PT_BINARY:PSETID_Appointment:0x8233"; $this->proptags = getPropIdsFromStrings($store, $properties); $this->session = $session; $this->calendar = $calendar; $this->entryid = $entryid; $this->store = $store; }
/** * Checks if mapimessage is inside the synchronization interval * also defined by MAPIUtils::GetCalendarRestriction() * * @param MAPIStore $store mapi store * @param MAPIMessage $mapimessage the mapi message to be checked * @param long $timestamp the lower time limit * * @access public * @return boolean */ public static function IsInCalendarSyncInterval($store, $mapimessage, $timestamp) { // This is our viewing window $start = $timestamp; $end = 0x7fffffff; // infinite end $props = MAPIMapping::GetAppointmentProperties(); $props = getPropIdsFromStrings($store, $props); $p = mapi_getprops($mapimessage, array($props["starttime"], $props["endtime"], $props["recurrenceend"], $props["isrecurring"], $props["recurrenceend"])); if (isset($p[$props["endtime"]]) && isset($p[$props["starttime"]]) && $p[$props["endtime"]] > $start && $p[$props["starttime"]] < $end || isset($p[$props["isrecurring"]]) && isset($p[$props["recurrenceend"]]) && $p[$props["isrecurring"]] == true && $p[$props["recurrenceend"]] >= $start || isset($p[$props["isrecurring"]]) && isset($p[$props["starttime"]]) && !isset($p[$props["recurrenceend"]]) && $p[$props["isrecurring"]] == true && $p[$props["starttime"]] <= $end) { ZLog::Write(LOGLEVEL_DEBUG, "MAPIUtils->IsInCalendarSyncInterval: Message is in the synchronization interval"); return true; } ZLog::Write(LOGLEVEL_WARN, "MAPIUtils->IsInCalendarSyncInterval: Message is OUTSIDE the synchronization interval"); return false; }
function getContactProperties($mystore) { $properties = array("entryid" => PR_ENTRYID, "body" => PR_BODY, "anniversary" => PR_WEDDING_ANNIVERSARY, "assistantname" => PR_ASSISTANT, "assistnamephonenumber" => PR_ASSISTANT_TELEPHONE_NUMBER, "birthday" => PR_BIRTHDAY, "businessphonenumber" => PR_OFFICE_TELEPHONE_NUMBER, "business2phonenumber" => PR_BUSINESS2_TELEPHONE_NUMBER, "businessfaxnumber" => PR_BUSINESS_FAX_NUMBER, "carphonenumber" => PR_CAR_TELEPHONE_NUMBER, "categories" => "PT_MV_STRING8:{00020329-0000-0000-C000-000000000046}:Keywords", "companyname" => PR_COMPANY_NAME, "department" => PR_DEPARTMENT_NAME, "displayname" => PR_DISPLAY_NAME, "email1address" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x8083", "email2address" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x8093", "email3address" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x80A3", "fileas" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x8005", "firstname" => PR_GIVEN_NAME, "home2phonenumber" => PR_HOME2_TELEPHONE_NUMBER, "homecity" => PR_HOME_ADDRESS_CITY, "homecountry" => PR_HOME_ADDRESS_COUNTRY, "homepostalcode" => PR_HOME_ADDRESS_POSTAL_CODE, "homestate" => PR_HOME_ADDRESS_STATE_OR_PROVINCE, "homestreet" => PR_HOME_ADDRESS_STREET, "homefaxnumber" => PR_HOME_FAX_NUMBER, "homephonenumber" => PR_HOME_TELEPHONE_NUMBER, "jobtitle" => PR_PROFESSION, "lastname" => PR_SURNAME, "mailingaddresstype" => "PT_LONG:{00062004-0000-0000-C000-000000000046}:0x8022", "middlename" => PR_MIDDLE_NAME, "mobilephonenumber" => PR_CELLULAR_TELEPHONE_NUMBER, "othercity" => PR_OTHER_ADDRESS_CITY, "othercountry" => PR_OTHER_ADDRESS_COUNTRY, "otherpostalcode" => PR_OTHER_ADDRESS_POSTAL_CODE, "otherstate" => PR_OTHER_ADDRESS_STATE_OR_PROVINCE, "otherstreet" => PR_OTHER_ADDRESS_STREET, "pagernumber" => PR_PAGER_TELEPHONE_NUMBER, "private" => "PT_BOOLEAN:{00062008-0000-0000-C000-000000000046}:0x8506", "radiophonenumber" => PR_RADIO_TELEPHONE_NUMBER, "salutation" => PR_DISPLAY_NAME_PREFIX, "spouse" => PR_SPOUSE_NAME, "suffix" => PR_GENERATION, "title" => PR_TITLE, "webpage" => PR_BUSINESS_HOME_PAGE, "webpage" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x802B", "homeaddress" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x801A", "businessaddress" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x801B", "otheraddress" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x801C", "businessstreet" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x8045", "businesscity" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x8046", "businessstate" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x8047", "businesspostalcode" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x8048", "businesscountry" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x8049", "imaddress" => "PT_STRING8:{00062004-0000-0000-C000-000000000046}:0x8062", "lastmodificationtime" => PR_LAST_MODIFICATION_TIME, "sourcekey" => PR_SOURCE_KEY, "deleted" => MAPI_ACCESS_DELETE); return getPropIdsFromStrings($mystore, $properties); }
/** * Constructor * * Takes a store and a message. The message is an appointment item * that should be converted into a meeting request or an incoming * e-mail message that is a meeting request. * * The $session variable is optional, but required if the following features * are to be used: * * - Sending meeting requests for meetings that are not in your own store * - Sending meeting requests to resources, resource availability checking and resource freebusy updates */ function Meetingrequest($store, $message, $session = false, $enableDirectBooking = true) { $this->store = $store; $this->message = $message; $this->session = $session; // This variable string saves time information for the MR. $this->meetingTimeInfo = false; $this->enableDirectBooking = $enableDirectBooking; $properties['goid'] = 'PT_BINARY:PSETID_Meeting:0x3'; $properties['goid2'] = 'PT_BINARY:PSETID_Meeting:0x23'; $properties['type'] = 'PT_STRING8:PSETID_Meeting:0x24'; $properties['meetingrecurring'] = 'PT_BOOLEAN:PSETID_Meeting:0x5'; $properties['unknown2'] = 'PT_BOOLEAN:PSETID_Meeting:0xa'; $properties['attendee_critical_change'] = 'PT_SYSTIME:PSETID_Meeting:0x1'; $properties['owner_critical_change'] = 'PT_SYSTIME:PSETID_Meeting:0x1a'; $properties['meetingstatus'] = 'PT_LONG:PSETID_Appointment:0x8217'; $properties['responsestatus'] = 'PT_LONG:PSETID_Appointment:0x8218'; $properties['unknown6'] = 'PT_LONG:PSETID_Meeting:0x4'; $properties['replytime'] = 'PT_SYSTIME:PSETID_Appointment:0x8220'; $properties['usetnef'] = 'PT_BOOLEAN:PSETID_Common:0x8582'; $properties['recurrence_data'] = 'PT_BINARY:PSETID_Appointment:0x8216'; $properties['reminderminutes'] = 'PT_LONG:PSETID_Common:0x8501'; $properties['reminderset'] = 'PT_BOOLEAN:PSETID_Common:0x8503'; $properties['sendasical'] = 'PT_BOOLEAN:PSETID_Appointment:0x8200'; $properties['updatecounter'] = 'PT_LONG:PSETID_Appointment:0x8201'; // AppointmentSequenceNumber $properties['last_updatecounter'] = 'PT_LONG:PSETID_Appointment:0x8203'; // AppointmentLastSequence $properties['unknown7'] = 'PT_LONG:PSETID_Appointment:0x8202'; $properties['busystatus'] = 'PT_LONG:PSETID_Appointment:0x8205'; $properties['intendedbusystatus'] = 'PT_LONG:PSETID_Appointment:0x8224'; $properties['start'] = 'PT_SYSTIME:PSETID_Appointment:0x820d'; $properties['responselocation'] = 'PT_STRING8:PSETID_Meeting:0x2'; $properties['location'] = 'PT_STRING8:PSETID_Appointment:0x8208'; $properties['requestsent'] = 'PT_BOOLEAN:PSETID_Appointment:0x8229'; // PidLidFInvited, MeetingRequestWasSent $properties['startdate'] = 'PT_SYSTIME:PSETID_Appointment:0x820d'; $properties['duedate'] = 'PT_SYSTIME:PSETID_Appointment:0x820e'; $properties["flagdueby"] = "PT_SYSTIME:PSETID_Common:0x8560"; $properties['commonstart'] = 'PT_SYSTIME:PSETID_Common:0x8516'; $properties['commonend'] = 'PT_SYSTIME:PSETID_Common:0x8517'; $properties['recurring'] = 'PT_BOOLEAN:PSETID_Appointment:0x8223'; $properties['clipstart'] = 'PT_SYSTIME:PSETID_Appointment:0x8235'; $properties['clipend'] = 'PT_SYSTIME:PSETID_Appointment:0x8236'; $properties['start_recur_date'] = 'PT_LONG:PSETID_Meeting:0xD'; // StartRecurTime $properties['start_recur_time'] = 'PT_LONG:PSETID_Meeting:0xE'; // StartRecurTime $properties['end_recur_date'] = 'PT_LONG:PSETID_Meeting:0xF'; // EndRecurDate $properties['end_recur_time'] = 'PT_LONG:PSETID_Meeting:0x10'; // EndRecurTime $properties['is_exception'] = 'PT_BOOLEAN:PSETID_Meeting:0xA'; // LID_IS_EXCEPTION $properties['apptreplyname'] = 'PT_STRING8:PSETID_Appointment:0x8230'; // Propose new time properties $properties['proposed_start_whole'] = 'PT_SYSTIME:PSETID_Appointment:0x8250'; $properties['proposed_end_whole'] = 'PT_SYSTIME:PSETID_Appointment:0x8251'; $properties['proposed_duration'] = 'PT_LONG:PSETID_Appointment:0x8256'; $properties['counter_proposal'] = 'PT_BOOLEAN:PSETID_Appointment:0x8257'; $properties['recurring_pattern'] = 'PT_STRING8:PSETID_Appointment:0x8232'; $properties['basedate'] = 'PT_SYSTIME:PSETID_Appointment:0x8228'; $properties['meetingtype'] = 'PT_LONG:PSETID_Meeting:0x26'; $properties['timezone_data'] = 'PT_BINARY:PSETID_Appointment:0x8233'; $properties['timezone'] = 'PT_STRING8:PSETID_Appointment:0x8234'; $properties['toattendeesstring'] = 'PT_STRING8:PSETID_Appointment:0x823B'; $properties['ccattendeesstring'] = 'PT_STRING8:PSETID_Appointment:0x823C'; $this->proptags = getPropIdsFromStrings($store, $properties); }
/** * Processes a response to a meeting request. * CalendarID is a reference and has to be set if a new calendar item is created * * @param string $requestid id of the object containing the request * @param string $folderid id of the parent folder of $requestid * @param string $response * * @access public * @return string id of the created/updated calendar obj * @throws StatusException */ public function MeetingResponse($requestid, $folderid, $response) { // Use standard meeting response code to process meeting request $reqentryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($folderid), hex2bin($requestid)); if (!$reqentryid) { throw new StatusException(sprintf("BackendZarafa->MeetingResponse('%s', '%s', '%s'): Error, unable to entryid of the message 0x%X", $requestid, $folderid, $response, mapi_last_hresult()), SYNC_MEETRESPSTATUS_INVALIDMEETREQ); } $mapimessage = mapi_msgstore_openentry($this->store, $reqentryid); if (!$mapimessage) { throw new StatusException(sprintf("BackendZarafa->MeetingResponse('%s','%s', '%s'): Error, unable to open request message for response 0x%X", $requestid, $folderid, $response, mapi_last_hresult()), SYNC_MEETRESPSTATUS_INVALIDMEETREQ); } $meetingrequest = new Meetingrequest($this->store, $mapimessage); if (!$meetingrequest->isMeetingRequest()) { throw new StatusException(sprintf("BackendZarafa->MeetingResponse('%s','%s', '%s'): Error, attempt to respond to non-meeting request", $requestid, $folderid, $response), SYNC_MEETRESPSTATUS_INVALIDMEETREQ); } if ($meetingrequest->isLocalOrganiser()) { throw new StatusException(sprintf("BackendZarafa->MeetingResponse('%s','%s', '%s'): Error, attempt to response to meeting request that we organized", $requestid, $folderid, $response), SYNC_MEETRESPSTATUS_INVALIDMEETREQ); } // Process the meeting response. We don't have to send the actual meeting response // e-mail, because the device will send it itself. switch ($response) { case 1: // accept // accept default: $entryid = $meetingrequest->doAccept(false, false, false, false, false, false, true); // last true is the $userAction break; case 2: // tentative $entryid = $meetingrequest->doAccept(true, false, false, false, false, false, true); // last true is the $userAction break; case 3: // decline $meetingrequest->doDecline(false); break; } // F/B will be updated on logoff // We have to return the ID of the new calendar item, so do that here $calendarid = ""; if (isset($entryid)) { $newitem = mapi_msgstore_openentry($this->store, $entryid); $newprops = mapi_getprops($newitem, array(PR_SOURCE_KEY)); $calendarid = bin2hex($newprops[PR_SOURCE_KEY]); } // on recurring items, the MeetingRequest class responds with a wrong entryid if ($requestid == $calendarid) { ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendZarafa->MeetingResponse('%s','%s', '%s'): returned calender id is the same as the requestid - re-searching", $requestid, $folderid, $response)); $props = MAPIMapping::GetMeetingRequestProperties(); $props = getPropIdsFromStrings($this->store, $props); $messageprops = mapi_getprops($mapimessage, array($props["goidtag"])); $goid = $messageprops[$props["goidtag"]]; $items = $meetingrequest->findCalendarItems($goid); if (is_array($items)) { $newitem = mapi_msgstore_openentry($this->store, $items[0]); $newprops = mapi_getprops($newitem, array(PR_SOURCE_KEY)); $calendarid = bin2hex($newprops[PR_SOURCE_KEY]); ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendZarafa->MeetingResponse('%s','%s', '%s'): found other calendar entryid", $requestid, $folderid, $response)); } if ($requestid == $calendarid) { throw new StatusException(sprintf("BackendZarafa->MeetingResponse('%s','%s', '%s'): Error finding the accepted meeting response in the calendar", $requestid, $folderid, $response), SYNC_MEETRESPSTATUS_INVALIDMEETREQ); } } // delete meeting request from Inbox $folderentryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($folderid)); $folder = mapi_msgstore_openentry($this->store, $folderentryid); mapi_folder_deletemessages($folder, array($reqentryid), 0); return $calendarid; }
function _handleRecurringItem(&$mapimessage, &$mapiprops) { $props = array(); //set isRecurring flag to true $props[0] = "PT_BOOLEAN:{00062002-0000-0000-C000-000000000046}:0x8223"; // Set named prop 8510, unknown property, but enables deleting a single occurrence of a recurring type in OLK2003. $props[1] = "PT_LONG:{00062008-0000-0000-C000-000000000046}:0x8510"; //goid and goid2 from tnef $props[2] = "PT_BINARY:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0x3"; $props[3] = "PT_BINARY:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0x23"; $props[4] = "PT_STRING8:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0x24"; //type $props[5] = "PT_LONG:{00062002-0000-0000-C000-000000000046}:0x8205"; //busystatus $props[6] = "PT_LONG:{00062002-0000-0000-C000-000000000046}:0x8217"; //meeting status $props[7] = "PT_LONG:{00062002-0000-0000-C000-000000000046}:0x8218"; //response status $props[8] = "PT_BOOLEAN:{00062008-0000-0000-C000-000000000046}:0x8582"; $props[9] = "PT_BOOLEAN:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0xa"; //is exception $props[10] = "PT_I2:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0x11"; //day interval $props[11] = "PT_I2:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0x12"; //week interval $props[12] = "PT_I2:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0x13"; //month interval $props[13] = "PT_I2:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0x14"; //year interval $props = getPropIdsFromStrings($this->_defaultstore, $props); $mapiprops[$props[0]] = true; $mapiprops[$props[1]] = 369; //both goids have the same value $mapiprops[$props[3]] = $mapiprops[$props[2]]; $mapiprops[$props[4]] = "IPM.Appointment"; $mapiprops[$props[5]] = 1; //tentative $mapiprops[PR_RESPONSE_REQUESTED] = true; $mapiprops[PR_ICON_INDEX] = 1027; $mapiprops[$props[6]] = olMeetingReceived; // The recipient is receiving the request $mapiprops[$props[7]] = olResponseNotResponded; $mapiprops[$props[8]] = true; }
/** * Note: Static function, more like a utility function. * * Gets all the items (including recurring items) in the specified calendar in the given timeframe. Items are * included as a whole if they overlap the interval <$start, $end> (non-inclusive). This means that if the interval * is <08:00 - 14:00>, the item [6:00 - 8:00> is NOT included, nor is the item [14:00 - 16:00>. However, the item * [7:00 - 9:00> is included as a whole, and is NOT capped to [8:00 - 9:00>. * * @param $store resource The store in which the calendar resides * @param $calendar resource The calendar to get the items from * @param $viewstart int Timestamp of beginning of view window * @param $viewend int Timestamp of end of view window * @param $propsrequested array Array of properties to return * @param $rows array Array of rowdata as if they were returned directly from mapi_table_queryrows. Each recurring item is * expanded so that it seems that there are only many single appointments in the table. */ function getCalendarItems($store, $calendar, $viewstart, $viewend, $propsrequested) { $result = array(); $properties = getPropIdsFromStrings($store, array("duedate" => "PT_SYSTIME:PSETID_Appointment:0x820e", "startdate" => "PT_SYSTIME:PSETID_Appointment:0x820d", "enddate_recurring" => "PT_SYSTIME:PSETID_Appointment:0x8236", "recurring" => "PT_BOOLEAN:PSETID_Appointment:0x8223", "recurring_data" => "PT_BINARY:PSETID_Appointment:0x8216", "timezone_data" => "PT_BINARY:PSETID_Appointment:0x8233", "label" => "PT_LONG:PSETID_Appointment:0x8214")); // Create a restriction that will discard rows of appointments that are definitely not in our // requested time frame $table = mapi_folder_getcontentstable($calendar); $restriction = array(RES_OR, array(array(RES_AND, array(array(RES_PROPERTY, array(RELOP => RELOP_GT, ULPROPTAG => $properties["duedate"], VALUE => $viewstart)), array(RES_PROPERTY, array(RELOP => RELOP_LT, ULPROPTAG => $properties["startdate"], VALUE => $viewend)))), array(RES_PROPERTY, array(RELOP => RELOP_EQ, ULPROPTAG => $properties["recurring"], VALUE => true)))); // global OR // Get requested properties, plus whatever we need $proplist = array(PR_ENTRYID, $properties["recurring"], $properties["recurring_data"], $properties["timezone_data"]); $proplist = array_merge($proplist, $propsrequested); $propslist = array_unique($proplist); $rows = mapi_table_queryallrows($table, $proplist, $restriction); // $rows now contains all the items that MAY be in the window; a recurring item needs expansion before including in the output. foreach ($rows as $row) { $items = array(); if (isset($row[$properties["recurring"]]) && $row[$properties["recurring"]]) { // Recurring item $rec = new Recurrence($store, $row); // GetItems guarantees that the item overlaps the interval <$viewstart, $viewend> $occurrences = $rec->getItems($viewstart, $viewend); foreach ($occurrences as $occurrence) { // The occurrence takes all properties from the main row, but overrides some properties (like start and end obviously) $item = $occurrence + $row; array_push($items, $item); } } else { // Normal item, it matched the search criteria and therefore overlaps the interval <$viewstart, $viewend> array_push($items, $row); } $result = array_merge($result, $items); } // All items are guaranteed to overlap the interval <$viewstart, $viewend>. Note that we may be returning a few extra // properties that the caller did not request (recurring, etc). This shouldn't be a problem though. return $result; }
$root = mapi_msgstore_openentry($store, null); $rootProps = mapi_getprops($root, array(PR_IPM_CONTACT_ENTRYID)); $folder = mapi_msgstore_openentry($store, $rootProps[PR_IPM_CONTACT_ENTRYID]); isUnicodeStore($store); // open the csv file and start reading $fh = fopen($csv_file, "r"); if (!$fh) { trigger_error("Can't open CSV file \"" . $csv_file . "\"", E_USER_ERROR); } // empty folder if needed if (EMPTY_FOLDER) { mapi_folder_emptyfolder($folder, DEL_ASSOCIATED); } $properties = array(); loadProperties($properties); $properties = getPropIdsFromStrings($store, $properties); //composed properties which require more work $special_properties = array("email_address_1", "email_address_2", "email_address_3"); $i = 1; while (!feof($fh)) { $line = fgetcsv($fh, CSV_MAX_LENGTH, CSV_DELIMITER, CSV_ENCLOSURE); if (!$line) { continue; } if ($i == 1 && defined('FIELD_NAMES') && FIELD_NAMES) { $i++; continue; } $props = array(); //set "simple" properties foreach ($csv_mapping as $property => $cnt) {
/** * Init properties to read contact data */ protected function initProperties() { $this->logger->trace("initProperties"); $properties = array(); $properties["subject"] = PR_SUBJECT; $properties["icon_index"] = PR_ICON_INDEX; $properties["message_class"] = PR_MESSAGE_CLASS; $properties["display_name"] = PR_DISPLAY_NAME; $properties["given_name"] = PR_GIVEN_NAME; $properties["middle_name"] = PR_MIDDLE_NAME; $properties["surname"] = PR_SURNAME; $properties["home_telephone_number"] = PR_HOME_TELEPHONE_NUMBER; $properties["cellular_telephone_number"] = PR_CELLULAR_TELEPHONE_NUMBER; $properties["office_telephone_number"] = PR_OFFICE_TELEPHONE_NUMBER; $properties["business_fax_number"] = PR_BUSINESS_FAX_NUMBER; $properties["company_name"] = PR_COMPANY_NAME; $properties["title"] = PR_TITLE; $properties["department_name"] = PR_DEPARTMENT_NAME; $properties["office_location"] = PR_OFFICE_LOCATION; $properties["profession"] = PR_PROFESSION; $properties["manager_name"] = PR_MANAGER_NAME; $properties["assistant"] = PR_ASSISTANT; $properties["nickname"] = PR_NICKNAME; $properties["display_name_prefix"] = PR_DISPLAY_NAME_PREFIX; $properties["spouse_name"] = PR_SPOUSE_NAME; $properties["generation"] = PR_GENERATION; $properties["birthday"] = PR_BIRTHDAY; $properties["wedding_anniversary"] = PR_WEDDING_ANNIVERSARY; $properties["sensitivity"] = PR_SENSITIVITY; $properties["fileas"] = "PT_STRING8:PSETID_Address:0x8005"; $properties["fileas_selection"] = "PT_LONG:PSETID_Address:0x8006"; $properties["email_address_1"] = "PT_STRING8:PSETID_Address:0x8083"; $properties["email_address_display_name_1"] = "PT_STRING8:PSETID_Address:0x8080"; $properties["email_address_display_name_email_1"] = "PT_STRING8:PSETID_Address:0x8084"; $properties["email_address_type_1"] = "PT_STRING8:PSETID_Address:0x8082"; $properties["email_address_2"] = "PT_STRING8:PSETID_Address:0x8093"; $properties["email_address_display_name_2"] = "PT_STRING8:PSETID_Address:0x8090"; $properties["email_address_display_name_email_2"] = "PT_STRING8:PSETID_Address:0x8094"; $properties["email_address_type_2"] = "PT_STRING8:PSETID_Address:0x8092"; $properties["email_address_3"] = "PT_STRING8:PSETID_Address:0x80a3"; $properties["email_address_display_name_3"] = "PT_STRING8:PSETID_Address:0x80a0"; $properties["email_address_display_name_email_3"] = "PT_STRING8:PSETID_Address:0x80a4"; $properties["email_address_type_3"] = "PT_STRING8:PSETID_Address:0x80a2"; $properties["home_address"] = "PT_STRING8:PSETID_Address:0x801a"; $properties["business_address"] = "PT_STRING8:PSETID_Address:0x801b"; $properties["other_address"] = "PT_STRING8:PSETID_Address:0x801c"; $properties["mailing_address"] = "PT_LONG:PSETID_Address:0x8022"; $properties["im"] = "PT_STRING8:PSETID_Address:0x8062"; $properties["webpage"] = "PT_STRING8:PSETID_Address:0x802b"; $properties["business_home_page"] = PR_BUSINESS_HOME_PAGE; $properties["email_address_entryid_1"] = "PT_BINARY:PSETID_Address:0x8085"; $properties["email_address_entryid_2"] = "PT_BINARY:PSETID_Address:0x8095"; $properties["email_address_entryid_3"] = "PT_BINARY:PSETID_Address:0x80a5"; $properties["address_book_mv"] = "PT_MV_LONG:PSETID_Address:0x8028"; $properties["address_book_long"] = "PT_LONG:PSETID_Address:0x8029"; $properties["oneoff_members"] = "PT_MV_BINARY:PSETID_Address:0x8054"; $properties["members"] = "PT_MV_BINARY:PSETID_Address:0x8055"; $properties["private"] = "PT_BOOLEAN:PSETID_Common:0x8506"; $properties["contacts"] = "PT_MV_STRING8:PSETID_Common:0x853a"; $properties["contacts_string"] = "PT_STRING8:PSETID_Common:0x8586"; $properties["categories"] = "PT_MV_STRING8:PS_PUBLIC_STRINGS:Keywords"; $properties["last_modification_time"] = PR_LAST_MODIFICATION_TIME; // Detailed contacts properties // Properties for phone numbers $properties["assistant_telephone_number"] = PR_ASSISTANT_TELEPHONE_NUMBER; $properties["business2_telephone_number"] = PR_BUSINESS2_TELEPHONE_NUMBER; $properties["callback_telephone_number"] = PR_CALLBACK_TELEPHONE_NUMBER; $properties["car_telephone_number"] = PR_CAR_TELEPHONE_NUMBER; $properties["company_telephone_number"] = PR_COMPANY_MAIN_PHONE_NUMBER; $properties["home2_telephone_number"] = PR_HOME2_TELEPHONE_NUMBER; $properties["home_fax_number"] = PR_HOME_FAX_NUMBER; $properties["isdn_number"] = PR_ISDN_NUMBER; $properties["other_telephone_number"] = PR_OTHER_TELEPHONE_NUMBER; $properties["pager_telephone_number"] = PR_PAGER_TELEPHONE_NUMBER; $properties["primary_fax_number"] = PR_PRIMARY_FAX_NUMBER; $properties["primary_telephone_number"] = PR_PRIMARY_TELEPHONE_NUMBER; $properties["radio_telephone_number"] = PR_RADIO_TELEPHONE_NUMBER; $properties["telex_telephone_number"] = PR_TELEX_NUMBER; $properties["ttytdd_telephone_number"] = PR_TTYTDD_PHONE_NUMBER; // Additional fax properties $properties["fax_1_address_type"] = "PT_STRING8:PSETID_Address:0x80B2"; $properties["fax_1_email_address"] = "PT_STRING8:PSETID_Address:0x80B3"; $properties["fax_1_original_display_name"] = "PT_STRING8:PSETID_Address:0x80B4"; $properties["fax_1_original_entryid"] = "PT_BINARY:PSETID_Address:0x80B5"; $properties["fax_2_address_type"] = "PT_STRING8:PSETID_Address:0x80C2"; $properties["fax_2_email_address"] = "PT_STRING8:PSETID_Address:0x80C3"; $properties["fax_2_original_display_name"] = "PT_STRING8:PSETID_Address:0x80C4"; $properties["fax_2_original_entryid"] = "PT_BINARY:PSETID_Address:0x80C5"; $properties["fax_3_address_type"] = "PT_STRING8:PSETID_Address:0x80D2"; $properties["fax_3_email_address"] = "PT_STRING8:PSETID_Address:0x80D3"; $properties["fax_3_original_display_name"] = "PT_STRING8:PSETID_Address:0x80D4"; $properties["fax_3_original_entryid"] = "PT_BINARY:PSETID_Address:0x80D5"; // Properties for addresses // Home address $properties["home_address_street"] = PR_HOME_ADDRESS_STREET; $properties["home_address_city"] = PR_HOME_ADDRESS_CITY; $properties["home_address_state"] = PR_HOME_ADDRESS_STATE_OR_PROVINCE; $properties["home_address_postal_code"] = PR_HOME_ADDRESS_POSTAL_CODE; $properties["home_address_country"] = PR_HOME_ADDRESS_COUNTRY; // Other address $properties["other_address_street"] = PR_OTHER_ADDRESS_STREET; $properties["other_address_city"] = PR_OTHER_ADDRESS_CITY; $properties["other_address_state"] = PR_OTHER_ADDRESS_STATE_OR_PROVINCE; $properties["other_address_postal_code"] = PR_OTHER_ADDRESS_POSTAL_CODE; $properties["other_address_country"] = PR_OTHER_ADDRESS_COUNTRY; // Business address $properties["business_address_street"] = "PT_STRING8:PSETID_Address:0x8045"; $properties["business_address_city"] = "PT_STRING8:PSETID_Address:0x8046"; $properties["business_address_state"] = "PT_STRING8:PSETID_Address:0x8047"; $properties["business_address_postal_code"] = "PT_STRING8:PSETID_Address:0x8048"; $properties["business_address_country"] = "PT_STRING8:PSETID_Address:0x8049"; // Mailing address $properties["country"] = PR_COUNTRY; $properties["city"] = PR_LOCALITY; $properties["postal_address"] = PR_POSTAL_ADDRESS; $properties["postal_code"] = PR_POSTAL_CODE; $properties["state"] = PR_STATE_OR_PROVINCE; $properties["street"] = PR_STREET_ADDRESS; // Special Date such as birthday n anniversary appoitment's entryid is store $properties["birthday_eventid"] = "PT_BINARY:PSETID_Address:0x804D"; $properties["anniversary_eventid"] = "PT_BINARY:PSETID_Address:0x804E"; $properties["notes"] = PR_BODY; // Has contact picture $properties["has_picture"] = "PT_BOOLEAN:{00062004-0000-0000-C000-000000000046}:0x8015"; // Custom properties needed for carddav functionnality $properties["carddav_uri"] = PR_CARDDAV_URI; $properties["carddav_rawdata"] = PR_CARDDAV_RAW_DATA; $properties["carddav_generation_time"] = PR_CARDDAV_RAW_DATA_GENERATION_TIME; $properties["contact_count"] = PR_CARDDAV_AB_CONTACT_COUNT; $properties["carddav_version"] = PR_CARDDAV_RAW_DATA_VERSION; // Ask Mapi to load those properties and store mapping. $this->extendedProperties = getPropIdsFromStrings($this->store, $properties); // Dump properties to debug $dump = print_r($this->extendedProperties, true); $this->logger->trace("Properties init done:\n{$dump}"); }
/** * Check authentication * @param string HTTP Authentication type (Basic, Digest, ...) * @param string Username * @param string Password * @return bool true on successful authentication */ function check_auth($type, $user, $pass) { $user = str_replace('%', '@', $user); // This fixes a logon problem with Evolution, login with user%domain instead of user@domain which seems to confuse evolution... $user = str_replace('$', '@', $user); // Mac OS X Address Book App fix $session = mapi_logon_zarafa($user, $pass, $this->server); if (false != $session) { $this->zarafa = $this->open_zarafa($session); $this->zarafa['user'] = $user; $this->specialprops = getPropIdsFromStrings($this->zarafa["store"], $this->specialprops); return true; } return false; }
/** * Constructor * * Takes a store and a message. The message is an appointment item * that should be converted into a meeting request or an incoming * e-mail message that is a meeting request. * * The $session variable is optional, but required if the following features * are to be used: * * - Sending meeting requests for meetings that are not in your own store * - Sending meeting requests to resources, resource availability checking and resource freebusy updates */ function Meetingrequest($store, $message, $session = false, $enableDirectBooking = true) { $this->store = $store; $this->message = $message; $this->session = $session; // This variable string saves time information for the MR. $this->meetingTimeInfo = false; $this->enableDirectBooking = $enableDirectBooking; $properties["goid"] = "PT_BINARY:PSETID_Meeting:0x3"; $properties["goid2"] = "PT_BINARY:PSETID_Meeting:0x23"; $properties["type"] = "PT_STRING8:PSETID_Meeting:0x24"; $properties["meetingrecurring"] = "PT_BOOLEAN:PSETID_Meeting:0x5"; $properties["unknown2"] = "PT_BOOLEAN:PSETID_Meeting:0xa"; $properties["attendee_critical_change"] = "PT_SYSTIME:PSETID_Meeting:0x1"; $properties["owner_critical_change"] = "PT_SYSTIME:PSETID_Meeting:0x1a"; $properties["meetingstatus"] = "PT_LONG:PSETID_Appointment:0x8217"; $properties["responsestatus"] = "PT_LONG:PSETID_Appointment:0x8218"; $properties["unknown6"] = "PT_LONG:PSETID_Meeting:0x4"; $properties["replytime"] = "PT_SYSTIME:PSETID_Appointment:0x8220"; $properties["usetnef"] = "PT_BOOLEAN:PSETID_Common:0x8582"; $properties["recurrence_data"] = "PT_BINARY:PSETID_Appointment:0x8216"; $properties["reminderminutes"] = "PT_LONG:PSETID_Common:0x8501"; $properties["reminderset"] = "PT_BOOLEAN:PSETID_Common:0x8503"; $properties["sendasical"] = "PT_BOOLEAN:PSETID_Appointment:0x8200"; $properties["updatecounter"] = "PT_LONG:PSETID_Appointment:0x8201"; // AppointmentSequenceNumber $properties["last_updatecounter"] = "PT_LONG:PSETID_Appointment:0x8203"; // AppointmentLastSequence $properties["unknown7"] = "PT_LONG:PSETID_Appointment:0x8202"; $properties["busystatus"] = "PT_LONG:PSETID_Appointment:0x8205"; $properties["intendedbusystatus"] = "PT_LONG:PSETID_Appointment:0x8224"; $properties["start"] = "PT_SYSTIME:PSETID_Appointment:0x820d"; $properties["responselocation"] = "PT_STRING8:PSETID_Meeting:0x2"; $properties["location"] = "PT_STRING8:PSETID_Appointment:0x8208"; $properties["requestsent"] = "PT_BOOLEAN:PSETID_Appointment:0x8229"; // PidLidFInvited, MeetingRequestWasSent $properties["startdate"] = "PT_SYSTIME:PSETID_Appointment:0x820d"; $properties["duedate"] = "PT_SYSTIME:PSETID_Appointment:0x820e"; $properties["commonstart"] = "PT_SYSTIME:PSETID_Common:0x8516"; $properties["commonend"] = "PT_SYSTIME:PSETID_Common:0x8517"; $properties["recurring"] = "PT_BOOLEAN:PSETID_Appointment:0x8223"; $properties["clipstart"] = "PT_SYSTIME:PSETID_Appointment:0x8235"; $properties["clipend"] = "PT_SYSTIME:PSETID_Appointment:0x8236"; $properties["start_recur_date"] = "PT_LONG:PSETID_Meeting:0xD"; // StartRecurTime $properties["start_recur_time"] = "PT_LONG:PSETID_Meeting:0xE"; // StartRecurTime $properties["end_recur_date"] = "PT_LONG:PSETID_Meeting:0xF"; // EndRecurDate $properties["end_recur_time"] = "PT_LONG:PSETID_Meeting:0x10"; // EndRecurTime $properties["is_exception"] = "PT_BOOLEAN:PSETID_Meeting:0xA"; // LID_IS_EXCEPTION $properties["apptreplyname"] = "PT_STRING8:PSETID_Appointment:0x8230"; // Propose new time properties $properties["proposed_start_whole"] = "PT_SYSTIME:PSETID_Appointment:0x8250"; $properties["proposed_end_whole"] = "PT_SYSTIME:PSETID_Appointment:0x8251"; $properties["proposed_duration"] = "PT_LONG:PSETID_Appointment:0x8256"; $properties["counter_proposal"] = "PT_BOOLEAN:PSETID_Appointment:0x8257"; $properties["recurring_pattern"] = "PT_STRING8:PSETID_Appointment:0x8232"; $properties["basedate"] = "PT_SYSTIME:PSETID_Appointment:0x8228"; $properties["meetingtype"] = "PT_LONG:PSETID_Meeting:0x26"; $properties["timezone_data"] = "PT_BINARY:PSETID_Appointment:0x8233"; $properties["timezone"] = "PT_STRING8:PSETID_Appointment:0x8234"; $properties["toattendeesstring"] = "PT_STRING8:PSETID_Appointment:0x823B"; $properties["ccattendeesstring"] = "PT_STRING8:PSETID_Appointment:0x823C"; $this->proptags = getPropIdsFromStrings($store, $properties); }
function TaskRequest($store, $message, $session) { $this->store = $store; $this->message = $message; $this->session = $session; $properties["owner"] = "PT_STRING8:PSETID_Task:0x811f"; $properties["updatecount"] = "PT_LONG:PSETID_Task:0x8112"; $properties["taskstate"] = "PT_LONG:PSETID_Task:0x8113"; $properties["taskmultrecips"] = "PT_LONG:PSETID_Task:0x8120"; $properties["taskupdates"] = "PT_BOOLEAN:PSETID_Task:0x811b"; $properties["tasksoc"] = "PT_BOOLEAN:PSETID_Task:0x8119"; $properties["taskhistory"] = "PT_LONG:PSETID_Task:0x811a"; $properties["taskmode"] = "PT_LONG:PSETID_Common:0x8518"; $properties["taskglobalobjid"] = "PT_BINARY:PSETID_Common:0x8519"; $properties["complete"] = "PT_BOOLEAN:PSETID_Common:0x811c"; $properties["assignedtime"] = "PT_SYSTIME:PSETID_Task:0x8115"; $properties["taskfcreator"] = "PT_BOOLEAN:PSETID_Task:0x0x811e"; $properties["tasklastuser"] = "******"; $properties["tasklastdelegate"] = "PT_STRING8:PSETID_Task:0x8125"; $properties["taskaccepted"] = "PT_BOOLEAN:PSETID_Task:0x8108"; $properties["delegationstate"] = "PT_LONG:PSETID_Task:0x812a"; $properties["ownership"] = "PT_LONG:PSETID_Task:0x8129"; $properties["complete"] = "PT_BOOLEAN:PSETID_Task:0x811c"; $properties["datecompleted"] = "PT_SYSTIME:PSETID_Task:0x810f"; $properties["recurring"] = "PT_BOOLEAN:PSETID_Task:0x8126"; $properties["startdate"] = "PT_SYSTIME:PSETID_Task:0x8104"; $properties["duedate"] = "PT_SYSTIME:PSETID_Task:0x8105"; $properties["status"] = "PT_LONG:PSETID_Task:0x8101"; $properties["percent_complete"] = "PT_DOUBLE:PSETID_Task:0x8102"; $properties["totalwork"] = "PT_LONG:PSETID_Task:0x8111"; $properties["actualwork"] = "PT_LONG:PSETID_Task:0x8110"; $properties["categories"] = "PT_MV_STRING8:PS_PUBLIC_STRINGS:Keywords"; $properties["companies"] = "PT_MV_STRING8:PSETID_Common:0x8539"; $properties["mileage"] = "PT_STRING8:PSETID_Common:0x8534"; $properties["billinginformation"] = "PT_STRING8:PSETID_Common:0x8535"; $this->props = getPropIdsFromStrings($store, $properties); }
/** * Wraps getPropIdsFromStrings() calls * * @param mixed &$mapiprops * * @access private * @return */ private function getPropIdsFromStrings(&$mapiprops) { return getPropIdsFromStrings($this->store, $mapiprops); }
/** * Processes a response to a meeting request. * CalendarID is a reference and has to be set if a new calendar item is created * * @param string $requestid id of the object containing the request * @param string $folderid id of the parent folder of $requestid * @param string $response * * @access public * @return string id of the created/updated calendar obj * @throws StatusException */ public function MeetingResponse($requestid, $folderid, $response) { // Use standard meeting response code to process meeting request list($fid, $requestid) = Utils::SplitMessageId($requestid); $reqentryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($folderid), hex2bin($requestid)); if (!$reqentryid) { throw new StatusException(sprintf("BackendKopano->MeetingResponse('%s', '%s', '%s'): Error, unable to entryid of the message 0x%X", $requestid, $folderid, $response, mapi_last_hresult()), SYNC_MEETRESPSTATUS_INVALIDMEETREQ); } $mapimessage = mapi_msgstore_openentry($this->store, $reqentryid); if (!$mapimessage) { throw new StatusException(sprintf("BackendKopano->MeetingResponse('%s','%s', '%s'): Error, unable to open request message for response 0x%X", $requestid, $folderid, $response, mapi_last_hresult()), SYNC_MEETRESPSTATUS_INVALIDMEETREQ); } $meetingrequest = new Meetingrequest($this->store, $mapimessage, $this->session); if (!$meetingrequest->isMeetingRequest()) { throw new StatusException(sprintf("BackendKopano->MeetingResponse('%s','%s', '%s'): Error, attempt to respond to non-meeting request", $requestid, $folderid, $response), SYNC_MEETRESPSTATUS_INVALIDMEETREQ); } if ($meetingrequest->isLocalOrganiser()) { throw new StatusException(sprintf("BackendKopano->MeetingResponse('%s','%s', '%s'): Error, attempt to response to meeting request that we organized", $requestid, $folderid, $response), SYNC_MEETRESPSTATUS_INVALIDMEETREQ); } // Process the meeting response. We don't have to send the actual meeting response // e-mail, because the device will send it itself. switch ($response) { case 1: // accept // accept default: $entryid = $meetingrequest->doAccept(false, false, false, false, false, false, true); // last true is the $userAction break; case 2: // tentative $entryid = $meetingrequest->doAccept(true, false, false, false, false, false, true); // last true is the $userAction break; case 3: // decline $meetingrequest->doDecline(false); break; } // F/B will be updated on logoff // We have to return the ID of the new calendar item, so do that here $calendarid = ""; $calFolderId = ""; if (isset($entryid)) { $newitem = mapi_msgstore_openentry($this->store, $entryid); // new item might be in a delegator's store. ActiveSync does not support accepting them. if (!$newitem) { throw new StatusException(sprintf("BackendKopano->MeetingResponse('%s','%s', '%s'): Object with entryid '%s' was not found in user's store (0x%X). It might be in a delegator's store.", $requestid, $folderid, $response, bin2hex($entryid), mapi_last_hresult()), SYNC_MEETRESPSTATUS_SERVERERROR, null, LOGLEVEL_WARN); } $newprops = mapi_getprops($newitem, array(PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY)); $calendarid = bin2hex($newprops[PR_SOURCE_KEY]); $calFolderId = bin2hex($newprops[PR_PARENT_SOURCE_KEY]); } // on recurring items, the MeetingRequest class responds with a wrong entryid if ($requestid == $calendarid) { ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendKopano->MeetingResponse('%s','%s', '%s'): returned calender id is the same as the requestid - re-searching", $requestid, $folderid, $response)); $props = MAPIMapping::GetMeetingRequestProperties(); $props = getPropIdsFromStrings($this->store, $props); $messageprops = mapi_getprops($mapimessage, array($props["goidtag"])); $goid = $messageprops[$props["goidtag"]]; $items = $meetingrequest->findCalendarItems($goid); if (is_array($items)) { $newitem = mapi_msgstore_openentry($this->store, $items[0]); $newprops = mapi_getprops($newitem, array(PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY)); $calendarid = bin2hex($newprops[PR_SOURCE_KEY]); $calFolderId = bin2hex($newprops[PR_PARENT_SOURCE_KEY]); ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendKopano->MeetingResponse('%s','%s', '%s'): found other calendar entryid", $requestid, $folderid, $response)); } if ($requestid == $calendarid) { throw new StatusException(sprintf("BackendKopano->MeetingResponse('%s','%s', '%s'): Error finding the accepted meeting response in the calendar", $requestid, $folderid, $response), SYNC_MEETRESPSTATUS_INVALIDMEETREQ); } } // delete meeting request from Inbox $folderentryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($folderid)); $folder = mapi_msgstore_openentry($this->store, $folderentryid); mapi_folder_deletemessages($folder, array($reqentryid), 0); $prefix = ''; // prepend the short folderid of the target calendar: if available and short ids are used if ($calFolderId) { $shortFolderId = ZPush::GetDeviceManager()->GetFolderIdForBackendId($calFolderId); if ($calFolderId != $shortFolderId) { $prefix = $shortFolderId . ':'; } } return $prefix . $calendarid; }