本文整理汇总了PHP中adLDAP::contact方法的典型用法代码示例。如果您正苦于以下问题:PHP adLDAP::contact方法的具体用法?PHP adLDAP::contact怎么用?PHP adLDAP::contact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类adLDAP
的用法示例。
在下文中一共展示了adLDAP::contact方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: contactMailEnable
/**
* Mail enable a contact
* Allows email to be sent to them through Exchange
*
* @param string $distinguishedName The contact to mail enable
* @param string $emailAddress The email address to allow emails to be sent through
* @param string $mailNickname The mailnickname for the contact in Exchange. If NULL this will be set to the display name
* @return bool
*/
public function contactMailEnable($distinguishedName, $emailAddress, $mailNickname = NULL)
{
if ($distinguishedName === NULL) {
return "Missing compulsory field [distinguishedName]";
}
if ($emailAddress === NULL) {
return "Missing compulsory field [emailAddress]";
}
if ($mailNickname !== NULL) {
// Find the dn of the user
$user = $this->adldap->contact()->info($distinguishedName, array("cn", "displayname"));
if ($user[0]["displayname"] === NULL) {
return false;
}
$mailNickname = $user[0]['displayname'][0];
}
$attributes = array("email" => $emailAddress, "contact_email" => "SMTP:" . $emailAddress, "exchange_proxyaddress" => "SMTP:" . $emailAddress, "exchange_mailnickname" => $mailNickname);
// Translate the update to the LDAP schema
$mod = $this->adldap->adldap_schema($attributes);
// Check to see if this is an enabled status update
if (!$mod) {
return false;
}
// Do the update
$result = ldap_modify($this->adldap->getLdapConnection(), $distinguishedName, $mod);
if ($result == false) {
return false;
}
return true;
}