本文整理汇总了PHP中mapi_logon_zarafa函数的典型用法代码示例。如果您正苦于以下问题:PHP mapi_logon_zarafa函数的具体用法?PHP mapi_logon_zarafa怎么用?PHP mapi_logon_zarafa使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mapi_logon_zarafa函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public static function login($username, $password)
{
// Login to MAPI to check credentials
$mapiSession = mapi_logon_zarafa($username, $password, ZARAFA_SERVER);
if ($mapiSession == false) {
return false;
}
Encryption::add('username', $username);
Encryption::add('password', $password);
Authentication::$_authenticated = true;
}
示例2: openMsgStore
function openMsgStore($username, $password)
{
$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);
isUnicodeStore($store);
return $store;
}
示例3: 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);
}
示例4: __construct
/**
* 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);
}
示例5: Logon
function Logon($user, $domain, $pass)
{
$pos = strpos($user, "\\");
if ($pos) {
$user = substr($user, $pos + 1);
}
$this->_session = mapi_logon_zarafa($user, $pass, MAPI_SERVER);
if ($this->_session === false) {
debugLog("logon failed for user {$user}");
$this->_defaultstore = false;
return false;
}
// Get/open default store
$this->_defaultstore = $this->_openDefaultMessageStore($this->_session);
if ($this->_defaultstore === false) {
debugLog("user {$user} has no default store");
return false;
}
$this->_importedFolders = array();
debugLog("User {$user} logged on");
$this->_isUnicodeStore();
return true;
}
示例6: count
}
}
// final cleanup
$dup_count = count($dup_messages);
if ($dup_count) {
$total_deleted += $dup_count;
echo " [i] Finally deleting {$dup_count} duplicates. \n";
delete_messages($folder, $dup_messages);
$dup_messages = array();
echo "Deleted {$total_deleted} messages so far.\n\n";
}
}
/*
* END FUNCTIONS
*/
$session = mapi_logon_zarafa("{$zarafa_user}", "", "{$zarafa_sock}");
if (!$session) {
print "Unable to open session\n";
exit(1);
}
$msgstorestable = mapi_getmsgstorestable($session);
if (!$msgstorestable) {
print "Unable to open message stores table\n";
exit(1);
}
$msgstores = mapi_table_queryallrows($msgstorestable, array(PR_DEFAULT_STORE, PR_ENTRYID));
foreach ($msgstores as $row) {
if ($row[PR_DEFAULT_STORE]) {
$default_store_entry_id = $row[PR_ENTRYID];
}
}
示例7: logon
function logon()
{
$this->session = mapi_logon_zarafa($this->options->loginuser, $this->options->password, "file:///var/run/zarafa");
if (!$this->session) {
print "Logon failure\n";
exit(RESULT_ERROR_LOG_FAILURE);
}
}
示例8: MAPISession
require "server/core/class.properties.php";
require "server/modules/class.appointmentitemmodule.php";
require "server/modules/class.appointmentlistmodule.php";
if (isset($_POST['user']) && isset($_POST["pwd"]) && isset($_POST['zid'])) {
//////////////////////////////////
/// get username and password
//////////////////////////////////
$username = $_POST['user'];
$password = $_POST['pwd'];
$server = 'http://localhost:236/zarafa';
////////////////////////////////
//connect to the zarafa server
///////////////////////////////
$GLOBALS["mapisession"] = new MAPISession();
$sess = $GLOBALS["mapisession"]->logon($username, $password, $server);
$session = mapi_logon_zarafa($username, $password, $server);
$bus = new Bus();
// Create global bus object
$GLOBALS["bus"] = $bus;
// Make bus global
$GLOBALS["settings"] = new Settings();
$storelist = $GLOBALS["mapisession"]->getAllMessageStores();
$id = "webclient_7";
//define an id
$GLOBALS["operations"] = new Operations();
$datas = $GLOBALS["operations"]->getHierarchyList(array(PR_IPM_APPOINTMENT_ENTRYID));
$store_idhex = $datas[store][0][attributes][id];
$entryidhex = $datas[store][0][defaultfolders][calendar];
$entryid = hex2bin($entryidhex);
$appointment_id = $_POST['zid'];
$GLOBALS["properties"] = new Properties();
示例9: listfolders_zarafa_admin_setup
function listfolders_zarafa_admin_setup($mapi, $user, $pass)
{
$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]);
$zarafauserinfo = @mapi_zarafa_getuser_by_name($adminStore, $user);
$admin = isset($zarafauserinfo['admin']) && $zarafauserinfo['admin'] ? true : false;
if (!$stores || !$storeslist || !$adminStore || !$admin) {
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);
}
示例10: define
/* FILETIME 64-bit int w/ number of 100ns periods since Jan 1,1601 */
define('PR_DEFAULT_STORE', mapi_prop_tag(PT_BOOLEAN, 0x3400));
define('PR_ENTRYID', mapi_prop_tag(PT_BINARY, 0xfff));
define('PR_IPM_WASTEBASKET_ENTRYID', mapi_prop_tag(PT_BINARY, 0x35e3));
define('PR_CREATION_TIME', mapi_prop_tag(PT_SYSTIME, 0x3007));
function greaterDate($start_date, $daysBeforeDeleted)
{
return strtotime($start_date) - strtotime(date('Y-m-d G:i:s', strtotime("-{$daysBeforeDeleted} days"))) < 0 ? 1 : 0;
}
// Add the SVN revision number to the version
$mapi_version = str_replace('-', '.', phpversion('mapi'));
// Log in to Zarafa server
if (version_compare($mapi_version, '7.2.0.46424', '>=')) {
$l_rSession = mapi_logon_zarafa($l_sUsername, $l_sPassword, $l_sServer, NULL, NULL, NULL, NULL);
} else {
$l_rSession = mapi_logon_zarafa($l_sUsername, $l_sPassword, $l_sServer);
}
echo (mapi_last_hresult() == 0 ? "Logged in successfully" : "Some error in login") . "\n";
// Get a table with the message stores within this session
$l_rTableStores = mapi_getmsgstorestable($l_rSession);
echo (mapi_last_hresult() == 0 ? "Processing to get data... " : "Some error in processing...") . "\n";
// Retrieve the default store by querying the table
$l_aTableRows = mapi_table_queryallrows($l_rTableStores, array(PR_ENTRYID, PR_DEFAULT_STORE));
echo (mapi_last_hresult() == 0 ? "Fetching Deleted Folder..." : "Some error in fetching...") . "\n";
$l_bbnEntryID = false;
// Either boolean or binary
// Loop through returned rows
for ($i = 0; $i < count($l_aTableRows); $i++) {
// Check to see if this entry is the default store
if (isset($l_aTableRows[$i][PR_DEFAULT_STORE]) && $l_aTableRows[$i][PR_DEFAULT_STORE] == true) {
$storeEntryId = $l_aTableRows[$i][PR_ENTRYID];
示例11: while
}
while (1) {
$rows = mapi_table_queryrows($table, array(PR_MESSAGE_SIZE), 0, 100);
if (count($rows) == 0) {
break;
}
foreach ($rows as $row) {
if (isset($row[PR_MESSAGE_SIZE])) {
$size += $row[PR_MESSAGE_SIZE];
}
}
}
return $size;
}
$times["load"] = t();
$session = mapi_logon_zarafa($argv[1], "", "file:///var/run/zarafa");
$times["logon"] = t();
$msgstorestable = mapi_getmsgstorestable($session);
$msgstores = mapi_table_queryallrows($msgstorestable, array(PR_DEFAULT_STORE, PR_ENTRYID));
$times["stores"] = t();
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) {
示例12: ScanMailBox
function ScanMailBox($uid)
{
$ct = new user($uid);
$sock = new sockets();
$username = $uid;
$password = $ct->password;
$zarafa_sock = "file:///var/run/zarafa";
$ZarafaServerListenIP = $sock->GET_INFO("ZarafaServerListenIP");
if ($ZarafaServerListenIP == null) {
$ZarafaServerListenIP = "127.0.0.1";
}
if ($ZarafaServerListenIP == "0.0.0.0") {
$ZarafaServerListenIP = "127.0.0.1";
}
$ZarafaServerListenPort = intval($sock->GET_INFO("ZarafaServerListenPort"));
if ($ZarafaServerListenPort == 0) {
$ZarafaServerListenPort = 236;
}
$zarafaServer = "http://{$ZarafaServerListenIP}:{$ZarafaServerListenPort}/zarafa";
$session = mapi_logon_zarafa($username, $password, $zarafaServer);
$hard_delete_messages = true;
$folder_to_process = 'Sent Items';
$total_deleted = 0;
if (!$session) {
print "Unable to open session {$username}@{$zarafaServer} `{$password}`\n";
return;
}
$msgstorestable = mapi_getmsgstorestable($session);
if (!$msgstorestable) {
print "Unable to open message stores table\n";
return;
}
$msgstores = mapi_table_queryallrows($msgstorestable, array(PR_DEFAULT_STORE, PR_ENTRYID));
foreach ($msgstores as $row) {
if ($row[PR_DEFAULT_STORE]) {
$default_store_entry_id = $row[PR_ENTRYID];
}
}
$default_store = mapi_openmsgstore($session, $default_store_entry_id);
if (!$default_store) {
print "Unable to open default store\n";
exit(1);
}
$root = mapi_msgstore_openentry($default_store);
// get folders
$folders = mapi_folder_gethierarchytable($root, CONVENIENT_DEPTH);
// loop over every folder
while (1) {
$rows = mapi_table_queryrows($folders, array(PR_DISPLAY_NAME, PR_FOLDER_TYPE, PR_ENTRYID), 0, 100);
if (count($rows) == 0) {
break;
}
foreach ($rows as $row) {
// skip searchfolders
if (isset($row[PR_FOLDER_TYPE]) && $row[PR_FOLDER_TYPE] == FOLDER_SEARCH) {
continue;
}
// operate only on folders, whose name is specified in the config section.
// Like 'Sent Objects'.
if ($row[PR_DISPLAY_NAME] == $folder_to_process) {
parse_messages($default_store, $row[PR_ENTRYID]);
}
}
}
}
示例13: define
// The charset of the CSV input files
//set it to true if the first line of the csv file contains field names, it will be skipped then.
define("FIELD_NAMES", true);
//the format of date values: true if they are as unix timestamps, false otherwise
define("DATES_AS_TIMESTAMPS", false);
// 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);
示例14: resolve
} else {
print "Permissions successfully set\n";
}
}
function resolve($session, $name)
{
$ab = mapi_openaddressbook($session);
$resolved = mapi_ab_resolvename($ab, array(array(PR_DISPLAY_NAME => $name)), EMS_AB_ADDRESS_LOOKUP);
$id = false;
if ($resolved) {
$id = $resolved[0][PR_ENTRYID];
}
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) {
示例15: connect
/**
* Connect to Zarafa and do some init
* @param $user user login
* @param $password user password
*/
public function connect($user, $password)
{
$this->logger->debug("connect({$user}," . md5($password) . ")");
$this->session = NULL;
try {
$session = mapi_logon_zarafa($user, $password, ZARAFA_SERVER);
} catch (Exception $e) {
$this->logger->debug("connection failed: " . get_mapi_error_name());
return false;
}
if ($session === FALSE) {
// Failed
return false;
}
$this->logger->trace("Connected to zarafa server - init bridge");
$this->session = $session;
// Find user store
$storesTable = mapi_getmsgstorestable($session);
$stores = mapi_table_queryallrows($storesTable, array(PR_ENTRYID, PR_MDB_PROVIDER));
for ($i = 0; $i < count($stores); $i++) {
switch ($stores[$i][PR_MDB_PROVIDER]) {
case ZARAFA_SERVICE_GUID:
$storeEntryid = $stores[$i][PR_ENTRYID];
break;
case ZARAFA_STORE_PUBLIC_GUID:
$pubStoreEntryid = $stores[$i][PR_ENTRYID];
break;
}
}
if (!isset($storeEntryid)) {
trigger_error("Default store not found", E_USER_ERROR);
}
$this->store = mapi_openmsgstore($this->session, $storeEntryid);
$root = mapi_msgstore_openentry($this->store, null);
$rootProps = mapi_getprops($root, array(PR_IPM_CONTACT_ENTRYID));
// Store rootfolder
$this->rootFolder = mapi_msgstore_openentry($this->store, $rootProps[PR_IPM_CONTACT_ENTRYID]);
$this->rootFolderId = $rootProps[PR_IPM_CONTACT_ENTRYID];
if (isset($pubStoreEntryid)) {
$this->pubStore = mapi_openmsgstore($this->session, $pubStoreEntryid);
$pubFolder = mapi_msgstore_openentry($this->pubStore);
$h_table = mapi_folder_gethierarchytable($pubFolder, CONVENIENT_DEPTH);
// $subfolders = mapi_table_queryallrows($h_table, array(PR_ENTRYID, PR_DISPLAY_NAME));
$subfolders = mapi_table_queryallrows($h_table);
for ($i = 0; $i < count($subfolders); $i++) {
$name = $subfolders[$i][PR_DISPLAY_NAME];
$entryid = $subfolders[$i][PR_ENTRYID];
$folder = mapi_msgstore_openentry($this->pubStore, $entryid);
$props = mapi_getprops($folder);
if (isset($props[PR_CONTAINER_CLASS_A]) && $props[PR_CONTAINER_CLASS_A] == "IPF.Contact") {
$this->pubFolderIds[] = $entryid;
$this->pubFolders[] = mapi_msgstore_openentry($this->pubStore, $entryid);
}
}
}
// Check for unicode
$this->isUnicodeStore($this->store);
// Load properties
$this->initProperties();
// Store username for principals
$this->connectedUser = $user;
// Set protected variable to NULL.
$this->adressBooks = NULL;
return true;
}