当前位置: 首页>>代码示例>>PHP>>正文


PHP mapi_table_queryallrows函数代码示例

本文整理汇总了PHP中mapi_table_queryallrows函数的典型用法代码示例。如果您正苦于以下问题:PHP mapi_table_queryallrows函数的具体用法?PHP mapi_table_queryallrows怎么用?PHP mapi_table_queryallrows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mapi_table_queryallrows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: zpa_zarafa_admin_setup

function zpa_zarafa_admin_setup($mapi, $user, $pass)
{
    require PHP_MAPI_PATH . 'mapi.util.php';
    require PHP_MAPI_PATH . 'mapidefs.php';
    require PHP_MAPI_PATH . 'mapicode.php';
    require PHP_MAPI_PATH . 'mapitags.php';
    require PHP_MAPI_PATH . 'mapiguid.php';
    $session = @mapi_logon_zarafa($user, $pass, $mapi);
    if (!$session) {
        echo "User '{$user}' could not login. The script will exit. Errorcode: 0x" . sprintf("%x", mapi_last_hresult()) . "\n";
        exit(1);
    }
    $stores = @mapi_getmsgstorestable($session);
    $storeslist = @mapi_table_queryallrows($stores);
    $adminStore = @mapi_openmsgstore($session, $storeslist[0][PR_ENTRYID]);
    if (!$stores || !$storeslist || !$adminStore) {
        echo "There was error trying to log in as admin or retrieving admin info. The script will exit.\n";
        exit(1);
    }
    return array("session" => $session, "adminStore" => $adminStore);
}
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:21,代码来源:z-push-admin.php

示例2: getContactEntryId

 /**
  * Translate ($addressBookId, $cardUri) to entry id
  * @param $addressBookId address book to search contact in
  * @param $cardUri name of contact card to retrieve
  */
 protected function getContactEntryId($addressBookId, $cardUri)
 {
     // Update object properties
     $this->logger->trace("getContactEntryId({$cardUri})");
     $folder = mapi_msgstore_openentry($this->bridge->getStore($addressBookId), $addressBookId);
     $contactsTable = mapi_folder_getcontentstable($folder);
     $contacts = mapi_table_queryallrows($contactsTable, array(PR_ENTRYID, PR_CARDDAV_URI, PR_SUBJECT));
     $entryId = 0;
     foreach ($contacts as $c) {
         if (isset($c[PR_CARDDAV_URI])) {
             if ($c[PR_CARDDAV_URI] == $cardUri) {
                 $entryId = $c[PR_ENTRYID];
                 break;
             }
         } else {
             // CardURI can be PR_ENTRYID .vcf
             if ($this->bridge->entryIdToStr($c[PR_ENTRYID]) == substr($cardUri, 0, -4)) {
                 $entryId = $c[PR_ENTRYID];
                 break;
             }
         }
     }
     return $entryId;
 }
开发者ID:RobertWang,项目名称:sabre-zarafa,代码行数:29,代码来源:ZarafaCardDavBackend.php

示例3: translate

}
if ($argv[1] == "-t") {
    $trans_array = translate($argv[2], 1);
    foreach ($trans_array as $key => $value) {
        echo str_pad($key, 20, " ");
        echo "{$value}\n";
    }
    exit(0);
}
$socket = "file:///var/run/zarafa";
if (preg_match("#--socket=([0-9]+)#", @implode(" ", $argv), $re)) {
    $socket = "file:///var/run/zarafa-{$re[1]}";
}
$session = mapi_logon_zarafa("SYSTEM", "", $socket);
$msgstorestable = mapi_getmsgstorestable($session);
$msgstores = mapi_table_queryallrows($msgstorestable, array(PR_DEFAULT_STORE, PR_ENTRYID));
foreach ($msgstores as $row) {
    if ($row[PR_DEFAULT_STORE]) {
        $storeentryid = $row[PR_ENTRYID];
    }
}
if (!$storeentryid) {
    print "Can't find default store\n";
    exit(1);
}
$store = mapi_openmsgstore($session, $storeentryid);
if (!$store) {
    print "Unable to open system store\n";
    exit(1);
}
$userstoreentryid = mapi_msgstore_createentryid($store, $argv[1]);
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.zarafa7.foldersnames.php

示例4: GetSubfoldersForType

 /**
  * Returns subfolders of given type for a folder or false if there are none.
  *
  * @access public
  *
  * @param MAPIFolder $folder
  * @param string $type
  *
  * @return MAPITable|boolean
  */
 public static function GetSubfoldersForType($folder, $type)
 {
     $subfolders = mapi_folder_gethierarchytable($folder, CONVENIENT_DEPTH);
     mapi_table_restrict($subfolders, MAPIUtils::GetFolderTypeRestriction($type));
     if (mapi_table_getrowcount($subfolders) > 0) {
         return mapi_table_queryallrows($subfolders, array(PR_ENTRYID));
     }
     return false;
 }
开发者ID:SvKn,项目名称:Z-Push-contrib,代码行数:19,代码来源:mapiutils.php

示例5: getPublicContactFolders

/**
 * Get all public contact folders
 */
function getPublicContactFolders($session, $publicstore)
{
    $pub_folder = mapi_msgstore_openentry($publicstore);
    $h_table = mapi_folder_gethierarchytable($pub_folder, CONVENIENT_DEPTH);
    $contact_properties = getContactProperties($publicstore);
    $subfolders = mapi_table_queryallrows($h_table, array(PR_ENTRYID, PR_DISPLAY_NAME, PR_DISPLAY_TYPE, PR_CONTAINER_CLASS, PR_SUBFOLDERS));
    $pub_list2 = array();
    $contacts = array();
    foreach ($subfolders as $folder) {
        // check if folder contains PR_CONTAINER_CLASS and if its a contact
        if (isset($folder[907214878]) && $folder[907214878] == "IPF.Contact" && $folder[805371934] != "Kontakte") {
            $entryid = $folder[268370178];
            $pub_folder2 = mapi_msgstore_openentry($publicstore, $entryid);
            $pub_table2 = mapi_folder_getcontentstable($pub_folder2);
            $pub_list2 = mapi_table_queryallrows($pub_table2, $contact_properties);
            for ($j = 0; $j < sizeof($pub_list2); $j++) {
                $pub_list2[$j][268370178] = md5($pub_list2[$j][268370178]);
            }
            for ($k = 0; $k < sizeof($pub_list2); $k++) {
                foreach ($pub_list2[$k] as $key => $value) {
                    $attribute = mapKey($key);
                    if ($attribute != "") {
                        $contacts[$k][$attribute] = $value;
                    }
                }
            }
            //$contactFolders[$folder[805371934]] = $pub_list2;
            $contactFolders[] = array("foldername" => $folder[805371934], "contacts" => $contacts);
        }
    }
    //print_r($contactFolders);
    return $contactFolders;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:36,代码来源:exec.mapiContacts.php

示例6: buildEMLAttachment

function buildEMLAttachment($attach)
{
    $msgembedded = mapi_attach_openobj($attach);
    $msgprops = mapi_getprops($msgembedded, array(PR_MESSAGE_CLASS, PR_CLIENT_SUBMIT_TIME, PR_DISPLAY_TO, PR_SUBJECT, PR_SENT_REPRESENTING_NAME, PR_SENT_REPRESENTING_EMAIL_ADDRESS));
    $msgembeddedrcpttable = mapi_message_getrecipienttable($msgembedded);
    $msgto = $msgprops[PR_DISPLAY_TO];
    if ($msgembeddedrcpttable) {
        $msgembeddedrecipients = mapi_table_queryrows($msgembeddedrcpttable, array(PR_ADDRTYPE, PR_ENTRYID, PR_DISPLAY_NAME, PR_EMAIL_ADDRESS, PR_SMTP_ADDRESS, PR_RECIPIENT_TYPE, PR_RECIPIENT_FLAGS, PR_PROPOSEDNEWTIME, PR_PROPOSENEWTIME_START, PR_PROPOSENEWTIME_END, PR_RECIPIENT_TRACKSTATUS), 0, 99999999);
        foreach ($msgembeddedrecipients as $rcpt) {
            if ($rcpt[PR_DISPLAY_NAME] == $msgprops[PR_DISPLAY_TO]) {
                $msgto = $rcpt[PR_DISPLAY_NAME];
                if (isset($rcpt[PR_EMAIL_ADDRESS]) && $rcpt[PR_EMAIL_ADDRESS] != $msgprops[PR_DISPLAY_TO]) {
                    $msgto .= " <" . $rcpt[PR_EMAIL_ADDRESS] . ">";
                }
                break;
            }
        }
    }
    $msgsubject = $msgprops[PR_SUBJECT];
    $msgfrom = $msgprops[PR_SENT_REPRESENTING_NAME];
    if (isset($msgprops[PR_SENT_REPRESENTING_EMAIL_ADDRESS]) && $msgprops[PR_SENT_REPRESENTING_EMAIL_ADDRESS] != $msgprops[PR_SENT_REPRESENTING_NAME]) {
        $msgfrom .= " <" . $msgprops[PR_SENT_REPRESENTING_EMAIL_ADDRESS] . ">";
    }
    $msgtime = $msgprops[PR_CLIENT_SUBMIT_TIME];
    $msgembeddedbody = eml_ReadMessage($msgembedded);
    $msgembeddedattachtable = mapi_message_getattachmenttable($msgembedded);
    $msgembeddedattachtablerows = mapi_table_queryallrows($msgembeddedattachtable, array(PR_ATTACH_NUM, PR_ATTACH_METHOD));
    if ($msgembeddedattachtablerows) {
        $boundary = '=_zpush_static';
        $headercontenttype = "multipart/mixed";
        $msgembeddedbody['body'] = "Unfortunately your mobile is not able to handle MIME Messages\n" . "--" . $boundary . "\n" . "Content-Type: " . $msgembeddedbody['content'] . "; charset=utf-8\n" . "Content-Transfer-Encoding: quoted-printable\n\n" . $msgembeddedbody['body'] . "\n";
        foreach ($msgembeddedattachtablerows as $msgembeddedattachtablerow) {
            $msgembeddedattach = mapi_message_openattach($msgembedded, $msgembeddedattachtablerow[PR_ATTACH_NUM]);
            if (!$msgembeddedattach) {
                debugLog("Unable to open attachment number {$attachnum}");
            } else {
                $msgembeddedattachprops = mapi_getprops($msgembeddedattach, array(PR_ATTACH_MIME_TAG, PR_ATTACH_LONG_FILENAME, PR_ATTACH_FILENAME, PR_DISPLAY_NAME));
                if (isset($msgembeddedattachprops[PR_ATTACH_LONG_FILENAME])) {
                    $attachfilename = w2u($msgembeddedattachprops[PR_ATTACH_LONG_FILENAME]);
                } else {
                    if (isset($msgembeddedattachprops[PR_ATTACH_FILENAME])) {
                        $attachfilename = w2u($msgembeddedattachprops[PR_ATTACH_FILENAME]);
                    } else {
                        if (isset($msgembeddedattachprops[PR_DISPLAY_NAME])) {
                            $attachfilename = w2u($msgembeddedattachprops[PR_DISPLAY_NAME]);
                        } else {
                            $attachfilename = w2u("untitled");
                        }
                    }
                }
                if ($msgembeddedattachtablerow[PR_ATTACH_METHOD] == ATTACH_EMBEDDED_MSG) {
                    $attachfilename .= w2u(".eml");
                }
                $msgembeddedbody['body'] .= "--" . $boundary . "\n" . "Content-Type: " . $msgembeddedattachprops[PR_ATTACH_MIME_TAG] . ";\n" . " name=\"" . $attachfilename . "\"\n" . "Content-Transfer-Encoding: base64\n" . "Content-Disposition: attachment;\n" . " filename=\"" . $attachfilename . "\"\n\n";
                $msgembeddedattachstream = mapi_openpropertytostream($msgembeddedattach, PR_ATTACH_DATA_BIN);
                $msgembeddedattachment = "";
                while (1) {
                    $msgembeddedattachdata = mapi_stream_read($msgembeddedattachstream, 4096);
                    if (byte_strlen($msgembeddedattachdata) == 0) {
                        break;
                    }
                    $msgembeddedattachment .= $msgembeddedattachdata;
                }
                $msgembeddedbody['body'] .= chunk_split(base64_encode($msgembeddedattachment)) . "\n";
                unset($msgembeddedattachment);
            }
        }
        $msgembeddedbody['body'] .= "--" . $boundary . "--\n";
    } else {
        $headercontenttype = $msgembeddedbody['content'] . "; charset=utf-8";
        $boundary = '';
    }
    $msgembeddedheader = "Subject: " . $msgsubject . "\n" . "From: " . $msgfrom . "\n" . "To: " . $msgto . "\n" . "Date: " . gmstrftime("%a, %d %b %Y %T +0000", $msgprops[PR_CLIENT_SUBMIT_TIME]) . "\n" . "MIME-Version: 1.0\n" . "Content-Type: " . $headercontenttype . ";\n" . ($boundary ? " boundary=\"" . $boundary . "\"\n" : "") . "\n";
    $stream = mapi_stream_create();
    mapi_stream_setsize($stream, byte_strlen($msgembeddedheader . $msgembeddedbody['body']));
    mapi_stream_write($stream, $msgembeddedheader . $msgembeddedbody['body']);
    mapi_stream_seek($stream, 0, STREAM_SEEK_SET);
    return $stream;
}
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:79,代码来源:utils.php

示例7: setAllExceptionRecipients

 /**
  * Function which applies the provided recipients to the exception, also checks for deleted recipients.
  *
  * The $exception_recips should be an array containing all recipients which must be applied
  * to the exception. This will copy all recipients from the original message and then start filter
  * out all recipients which are not provided by the $exception_recips list.
  *
  * @param resource $message exception attachment of recurring item
  * @param array $exception_recips list of recipients
  */
 function setAllExceptionRecipients($message, $exception_recips)
 {
     $deletedRecipients = array();
     $useMessageRecipients = false;
     $recipientTable = mapi_message_getrecipienttable($message);
     $recipientRows = mapi_table_queryallrows($recipientTable, $this->recipprops);
     if (empty($recipientRows)) {
         $useMessageRecipients = true;
         $recipientTable = mapi_message_getrecipienttable($this->message);
         $recipientRows = mapi_table_queryallrows($recipientTable, $this->recipprops);
     }
     // Add organizer to meeting only if it is not organized.
     $msgprops = mapi_getprops($message, array(PR_SENT_REPRESENTING_ENTRYID, PR_SENT_REPRESENTING_EMAIL_ADDRESS, PR_SENT_REPRESENTING_NAME, PR_SENT_REPRESENTING_ADDRTYPE, $this->proptags['responsestatus']));
     if (isset($msgprops[$this->proptags['responsestatus']]) && $msgprops[$this->proptags['responsestatus']] != olResponseOrganized) {
         $this->addOrganizer($msgprops, $exception_recips);
     }
     if (!empty($exception_recips)) {
         foreach ($recipientRows as $key => $recipient) {
             $found = false;
             foreach ($exception_recips as $excep_recip) {
                 if (isset($recipient[PR_SEARCH_KEY]) && isset($excep_recip[PR_SEARCH_KEY]) && $recipient[PR_SEARCH_KEY] == $excep_recip[PR_SEARCH_KEY]) {
                     $found = true;
                 }
             }
             if (!$found) {
                 $foundInDeletedRecipients = false;
                 // Look if the $recipient is in the list of deleted recipients
                 if (!empty($deletedRecipients)) {
                     foreach ($deletedRecipients as $recip) {
                         if ($recip[PR_SEARCH_KEY] == $recipient[PR_SEARCH_KEY]) {
                             $foundInDeletedRecipients = true;
                             break;
                         }
                     }
                 }
                 // If recipient is not in list of deleted recipient, add him
                 if (!$foundInDeletedRecipients) {
                     if (!isset($recipient[PR_RECIPIENT_FLAGS]) || $recipient[PR_RECIPIENT_FLAGS] != (recipReserved | recipExceptionalDeleted | recipSendable)) {
                         $recipient[PR_RECIPIENT_FLAGS] = recipSendable | recipExceptionalDeleted;
                     } else {
                         $recipient[PR_RECIPIENT_FLAGS] = recipReserved | recipExceptionalDeleted | recipSendable;
                     }
                     $recipient[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;
                     // No Response required
                     $deletedRecipients[] = $recipient;
                 }
             }
             // When $message contains a non-empty recipienttable, we must delete the recipients
             // before re-adding them. However, when $message is doesn't contain any recipients,
             // we are using the recipient table of the original message ($this->message)
             // rather then $message. In that case, we don't need to remove the recipients
             // from the $message, as the recipient table is already empty, and
             // mapi_message_modifyrecipients() will throw an error.
             if ($useMessageRecipients === false) {
                 mapi_message_modifyrecipients($message, MODRECIP_REMOVE, array($recipient));
             }
         }
         $exception_recips = array_merge($exception_recips, $deletedRecipients);
     } else {
         $exception_recips = $recipientRows;
     }
     if (!empty($exception_recips)) {
         // Set the new list of recipients on the exception message, this also removes the existing recipients
         mapi_message_modifyrecipients($message, 0, $exception_recips);
     }
 }
开发者ID:EGroupware,项目名称:z-push,代码行数:76,代码来源:class.recurrence.php

示例8: mapi_logon_zarafa

    return $id;
}
// Log on to zarafa as admin user
$session = mapi_logon_zarafa('SYSTEM', '', SERVER);
if (!$session) {
    print "Unable to logon\n";
    return;
}
// Get our stores table
$storetable = mapi_getmsgstorestable($session);
if (!$storetable) {
    print "Unable to get stores list\n";
    return;
}
// Find our default store
$stores = mapi_table_queryallrows($storetable, array(PR_DISPLAY_NAME, PR_ENTRYID, PR_DEFAULT_STORE));
$storenentryid = false;
// Set default to false
foreach ($stores as $row) {
    if (isset($row[PR_DEFAULT_STORE]) && $row[PR_DEFAULT_STORE]) {
        $storeentryid = $row[PR_ENTRYID];
        //print "Found store " . $row[PR_DISPLAY_NAME] . "\n";
        break;
    }
}
if (!$storeentryid) {
    print "Unable to find default store\n";
    return;
}
// We now have the store entryid for the admin store, so open the store
$store = mapi_openmsgstore($session, $storeentryid);
开发者ID:marco-uniware,项目名称:zarafa-tools,代码行数:31,代码来源:mailstore-permissions.php

示例9: array

// mapping for the csv column number to contact field (first field is 0)
$csv_mapping = array("given_name" => 0, "middle_name" => 1, "surname" => 2, "display_name_prefix" => 3, "webpage" => 6, "birthday" => 8, "wedding_anniversary" => 9, "notes" => 13, "email_address_1" => 14, "email_address_2" => 15, "email_address_3" => 16, "home_telephone_number" => 18, "home2_telephone_number" => 19, "cellular_telephone_number" => 20, "pager_telephone_number" => 21, "home_fax_number" => 22, "home_address" => 23, "home_address_street" => 24, "home_address_street2" => 25, "home_address_street3" => 26, "home_address_pobox" => 27, "home_address_city" => 28, "home_address_state" => 29, "home_address_postal_code" => 30, "home_address_country" => 31, "spouse_name" => 32, "manager_name" => 34, "assistant" => 35, "company_telephone_number" => 37, "office_telephone_number" => 38, "business2_telephone_number" => 39, "business_fax_number" => 40, "assistant_telephone_number" => 41, "company_name" => 42, "job_title" => 43, "department_name" => 44, "office_location" => 45, "profession" => 47, "business_address" => 49, "business_address_street" => 50, "business_address_street2" => 51, "business_address_street3" => 52, "business_address_pobox" => 53, "business_address_city" => 54, "business_address_state" => 55, "business_address_postal_code" => 56, "business_address_country" => 57, "other_telephone_number" => 58, "other_address" => 60, "other_address_street" => 61, "other_address_street2" => 62, "other_address_street3" => 63, "other_address_pobox" => 64, "other_address_city" => 65, "other_address_state" => 66, "other_address_postal_code" => 67, "other_address_country" => 68, "callback_telephone_number" => 69, "car_telephone_number" => 70, "isdn_number" => 71, "radio_telephone_number" => 72, "ttytdd_telephone_number" => 73, "telex_telephone_number" => 74, "sensitivity" => 84, "categories" => 87);
##########################
## end of configuration ##
##########################
error_reporting(E_ALL);
ini_set("display_errors", true);
ini_set("html_errors", false);
mapidefs();
mapitags();
$session = mapi_logon_zarafa($username, $password, SERVER);
if (mapi_last_hresult() != 0) {
    trigger_error(sprintf("MAPI Error: 0x%x", mapi_last_hresult()), E_USER_ERROR);
}
$storesTable = mapi_getmsgstorestable($session);
$stores = mapi_table_queryallrows($storesTable, array(PR_ENTRYID, PR_MDB_PROVIDER));
for ($i = 0; $i < count($stores); $i++) {
    if ($stores[$i][PR_MDB_PROVIDER] == ZARAFA_SERVICE_GUID) {
        $storeEntryid = $stores[$i][PR_ENTRYID];
        break;
    }
}
if (!isset($storeEntryid)) {
    trigger_error("Default store not found", E_USER_ERROR);
}
$store = mapi_openmsgstore($session, $storeEntryid);
$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
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.zarafa.csv2contacts.php

示例10: array

require MAPI_PATH . "mapicode.php";
require MAPI_PATH . "mapidefs.php";
require MAPI_PATH . "mapitags.php";
require MAPI_PATH . "mapiguid.php";
$supported_classes = array("IPF.Note" => "SYNC_FOLDER_TYPE_USER_MAIL", "IPF.Task" => "SYNC_FOLDER_TYPE_USER_TASK", "IPF.Appointment" => "SYNC_FOLDER_TYPE_USER_APPOINTMENT", "IPF.Contact" => "SYNC_FOLDER_TYPE_USER_CONTACT", "IPF.StickyNote" => "SYNC_FOLDER_TYPE_USER_NOTE");
$session = @mapi_logon_zarafa(ZARAFA_USER, ZARAFA_PASS, ZARAFA_SERVER);
if (!$session) {
    die("Login to Zarafa failed\n");
}
$storetable = @mapi_getmsgstorestable($session);
$storeslist = @mapi_table_queryallrows($storetable, array(PR_ENTRYID, PR_MDB_PROVIDER));
for ($i = 0; $i < count($storeslist); $i++) {
    if ($storeslist[$i][PR_MDB_PROVIDER] == ZARAFA_STORE_PUBLIC_GUID) {
        $publicstore = @mapi_openmsgstore($session, $storeslist[$i][PR_ENTRYID]);
        break;
    }
}
if (!isset($publicstore)) {
    die("Public folder not available");
}
$pub_folder = @mapi_msgstore_openentry($publicstore);
$h_table = @mapi_folder_gethierarchytable($pub_folder, CONVENIENT_DEPTH);
$subfolders = @mapi_table_queryallrows($h_table, array(PR_ENTRYID, PR_DISPLAY_NAME, PR_CONTAINER_CLASS, PR_SOURCE_KEY));
echo "Available folders in public folder:\n" . str_repeat("-", 50) . "\n";
foreach ($subfolders as $folder) {
    if (isset($folder[PR_CONTAINER_CLASS]) && array_key_exists($folder[PR_CONTAINER_CLASS], $supported_classes)) {
        echo "Name:\t\t" . $folder[PR_DISPLAY_NAME] . "\n";
        echo "Sync-class:\t" . $supported_classes[$folder[PR_CONTAINER_CLASS]] . "\n";
        echo "PUID:\t\t" . bin2hex($folder[PR_SOURCE_KEY]) . "\n\n";
    }
}
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:31,代码来源:publicfolder.php

示例11: setContactPicture

 /**
  * Assign a contact picture to a contact
  * @param entryId contact entry id
  * @param contactPicture must be a valid jpeg file. If contactPicture is NULL will remove contact picture from contact if exists
  */
 public function setContactPicture(&$contact, $contactPicture)
 {
     $this->logger->trace("setContactPicture");
     // Find if contact picture is already set
     $contactAttachment = -1;
     $hasattachProp = mapi_getprops($contact, array(PR_HASATTACH));
     if ($hasattachProp) {
         $attachmentTable = mapi_message_getattachmenttable($contact);
         $attachments = mapi_table_queryallrows($attachmentTable, array(PR_ATTACH_NUM, PR_ATTACH_SIZE, PR_ATTACH_LONG_FILENAME, PR_ATTACH_FILENAME, PR_ATTACHMENT_HIDDEN, PR_DISPLAY_NAME, PR_ATTACH_METHOD, PR_ATTACH_CONTENT_ID, PR_ATTACH_MIME_TAG, PR_ATTACHMENT_CONTACTPHOTO, PR_EC_WA_ATTACHMENT_HIDDEN_OVERRIDE));
         foreach ($attachments as $attachmentRow) {
             if (isset($attachmentRow[PR_ATTACHMENT_CONTACTPHOTO]) && $attachmentRow[PR_ATTACHMENT_CONTACTPHOTO]) {
                 $contactAttachment = $attachmentRow[PR_ATTACH_NUM];
                 break;
             }
         }
     }
     // Remove existing attachment if necessary
     if ($contactAttachment != -1) {
         $this->logger->trace("removing existing contact picture");
         $attach = mapi_message_deleteattach($contact, $contactAttachment);
     }
     if ($contactPicture !== NULL) {
         $this->logger->debug("Saving contact picture as attachment");
         // Create attachment
         $attach = mapi_message_createattach($contact);
         // Update contact attachment properties
         $properties = array(PR_ATTACH_SIZE => strlen($contactPicture), PR_ATTACH_LONG_FILENAME => 'ContactPicture.jpg', PR_ATTACHMENT_HIDDEN => false, PR_DISPLAY_NAME => 'ContactPicture.jpg', PR_ATTACH_METHOD => ATTACH_BY_VALUE, PR_ATTACH_MIME_TAG => 'image/jpeg', PR_ATTACHMENT_CONTACTPHOTO => true, PR_ATTACH_DATA_BIN => $contactPicture, PR_ATTACHMENT_FLAGS => 1, PR_ATTACH_EXTENSION_A => '.jpg', PR_ATTACH_NUM => 1);
         mapi_setprops($attach, $properties);
         mapi_savechanges($attach);
     }
     // Test
     if (mapi_last_hresult() > 0) {
         $this->logger->warn("Error saving contact picture: " . get_mapi_error_name());
     } else {
         $this->logger->trace("contact picture done");
     }
 }
开发者ID:RobertWang,项目名称:sabre-zarafa,代码行数:42,代码来源:ZarafaBridge.php

示例12: open_zarafa

 /**
  * open_zarafa
  *
  * @param	descriptor	An open Zarafa session id.
  * @return	array		Array with session and store information.
  */
 function open_zarafa($session)
 {
     $ret = array("root" => "/");
     $storesTable = mapi_getmsgstorestable($session);
     $stores = mapi_table_queryallrows($storesTable, array(PR_ENTRYID, PR_MDB_PROVIDER));
     for ($i = 0; $i < count($stores); $i++) {
         if ($stores[$i][PR_MDB_PROVIDER] == ZARAFA_SERVICE_GUID) {
             $storeEntryid = $stores[$i][PR_ENTRYID];
             break;
         }
     }
     if (!isset($storeEntryid)) {
         trigger_error("Default store not found", PR_USER_ERROR);
     }
     $store = mapi_openmsgstore($session, $storeEntryid);
     $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]);
     $table = mapi_folder_getcontentstable($folder);
     $contacts = mapi_table_queryallrows($table);
     $ret["session"] = $session;
     $ret["store"] = $store;
     $ret["contacts"] = $contacts;
     // ZCP 7 and up know unicode...
     $supportmask = mapi_getprops($store, array(PR_STORE_SUPPORT_MASK));
     if (isset($supportmask[PR_STORE_SUPPORT_MASK]) && $supportmask[PR_STORE_SUPPORT_MASK] & STORE_UNICODE_OK) {
         $ret["unicode_store"] = true;
         setlocale(LC_CTYPE, 'en_US.utf-8');
     }
     // END ZCP7 and up know unicode
     return $ret;
 }
开发者ID:marco-uniware,项目名称:zarafa-tools,代码行数:38,代码来源:zarafa_carddav.php

示例13: listfolders_getlist

function listfolders_getlist($adminStore, $session, $user)
{
    global $supported_classes;
    if (strtoupper($user) == 'SYSTEM') {
        // Find the public store store
        $storestables = @mapi_getmsgstorestable($session);
        $result = @mapi_last_hresult();
        if ($result == NOERROR) {
            $rows = @mapi_table_queryallrows($storestables, array(PR_ENTRYID, PR_MDB_PROVIDER));
            foreach ($rows as $row) {
                if (isset($row[PR_MDB_PROVIDER]) && $row[PR_MDB_PROVIDER] == ZARAFA_STORE_PUBLIC_GUID) {
                    if (!isset($row[PR_ENTRYID])) {
                        echo "Public folder are not available.\nIf this is a multi-tenancy system, use -u and -p and login with an admin user of the company.\nThe script will exit.\n";
                        exit(1);
                    }
                    $entryid = $row[PR_ENTRYID];
                    break;
                }
            }
        }
    } else {
        $entryid = @mapi_msgstore_createentryid($adminStore, $user);
    }
    $userStore = @mapi_openmsgstore($session, $entryid);
    $hresult = mapi_last_hresult();
    // Cache the store for later use
    if ($hresult != NOERROR) {
        echo "Could not open store for '{$user}'. The script will exit.\n";
        exit(1);
    }
    if (strtoupper($user) != 'SYSTEM') {
        $inbox = mapi_msgstore_getreceivefolder($userStore);
        if (mapi_last_hresult() != NOERROR) {
            printf("Could not open inbox for %s (0x%08X). The script will exit.\n", $user, mapi_last_hresult());
            exit(1);
        }
        $inboxProps = mapi_getprops($inbox, array(PR_SOURCE_KEY));
    }
    $storeProps = mapi_getprops($userStore, array(PR_IPM_OUTBOX_ENTRYID, PR_IPM_SENTMAIL_ENTRYID, PR_IPM_WASTEBASKET_ENTRYID));
    $root = @mapi_msgstore_openentry($userStore, null);
    $h_table = @mapi_folder_gethierarchytable($root, CONVENIENT_DEPTH);
    $subfolders = @mapi_table_queryallrows($h_table, array(PR_ENTRYID, PR_DISPLAY_NAME, PR_CONTAINER_CLASS, PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY, PR_FOLDER_TYPE, PR_ATTR_HIDDEN));
    echo "Available folders in store '{$user}':\n" . str_repeat("-", 50) . "\n";
    foreach ($subfolders as $folder) {
        // do not display hidden and search folders
        if (isset($folder[PR_ATTR_HIDDEN]) && $folder[PR_ATTR_HIDDEN] || isset($folder[PR_FOLDER_TYPE]) && $folder[PR_FOLDER_TYPE] == FOLDER_SEARCH) {
            continue;
        }
        // handle some special folders
        if (strtoupper($user) != 'SYSTEM' && (isset($inboxProps[PR_SOURCE_KEY]) && $folder[PR_SOURCE_KEY] == $inboxProps[PR_SOURCE_KEY] || $folder[PR_ENTRYID] == $storeProps[PR_IPM_SENTMAIL_ENTRYID] || $folder[PR_ENTRYID] == $storeProps[PR_IPM_WASTEBASKET_ENTRYID])) {
            $folder[PR_CONTAINER_CLASS] = "IPF.Note";
        }
        if (isset($folder[PR_CONTAINER_CLASS]) && array_key_exists($folder[PR_CONTAINER_CLASS], $supported_classes)) {
            echo "Folder name:\t" . $folder[PR_DISPLAY_NAME] . "\n";
            echo "Folder ID:\t" . bin2hex($folder[PR_SOURCE_KEY]) . "\n";
            echo "Type:\t\t" . $supported_classes[$folder[PR_CONTAINER_CLASS]] . "\n";
            echo "\n";
        }
    }
}
开发者ID:EGroupware,项目名称:z-push,代码行数:60,代码来源:listfolders.php

示例14: export

function export($store, $csv_file)
{
    $folder = getContactsFolder($store);
    // open the csv file and start reading
    $fh = fopen($csv_file, "w");
    if (!$fh) {
        trigger_error("Can't write CSV file \"" . $csv_file . "\".", E_USER_ERROR);
    }
    $properties = getProperties();
    $properties = replaceStringPropertyTags($store, $properties);
    $table = mapi_folder_getcontentstable($folder);
    $list = mapi_table_queryallrows($table, $properties);
    $special_properties = array();
    // currently no special values, thus empty array.
    $csv_mapping = getMapping();
    $csv_mapping = convertToGaplessMapping($csv_mapping);
    fputcsv($fh, array_keys($csv_mapping), CSV_DELIMITER, CSV_ENCLOSURE);
    foreach ($list as $item) {
        printf("Contact read: \"%s\".\n", $item[$properties["display_name"]]);
        $attributeValues = array();
        foreach ($csv_mapping as $property => $cnt) {
            $attributeValue = "?????";
            if (substr($property, 0, 3) == "N/A") {
                $attributeValue = "";
            } else {
                if (!in_array($property, $special_properties)) {
                    $attributeValue = array_key_exists($properties[$property], $item) ? $item[$properties[$property]] : "";
                    if (is_array($attributeValue)) {
                        $attributeValue = implode(";", $attributeValue);
                    }
                } else {
                    $attributeValue = "Special value.";
                }
            }
            $attributeValues[] = $attributeValue;
        }
        fputcsv($fh, $attributeValues, CSV_DELIMITER, CSV_ENCLOSURE);
    }
    fclose($fh);
}
开发者ID:marco-uniware,项目名称:zarafa-tools,代码行数:40,代码来源:process-contacts.php

示例15: getCalendarItems

/**
 * 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;
}
开发者ID:alanturing1,项目名称:Z-Push-contrib,代码行数:53,代码来源:mapi.util.php


注:本文中的mapi_table_queryallrows函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。