Пример #1
0
 function __construct($uid, $uidType = OUSER_LOGIN)
 {
     //  parent::__construct(array(OLDAP_DN,OLDAP_DN1), array(		'cn',
     parent::__construct(OLDAP_DN, array('cn', 'samaccountname', 'telephonenumber', 'manager', 'mail', 'department', 'description', 'useraccountcontrol', 'directreports', 'userworkstations', 'lastlogon', 'lastlogoff', 'lastlogontimestamp', 'badpasswordtime', 'logoncount', 'memberof', 'pwdlastset', 'whencreated', 'whenchanged', 'employeeid'));
     $uid = str_replace(array('(', ')'), array('\\(', '\\)'), $uid);
     switch ($uidType) {
         case OUSER_FULLNAME:
             $i = strpos($uid, ',');
             $uid = substr($uid, 3, $i - 3);
         case OUSER_CN:
             $this->_execute('(&(cn=' . $uid . ')(&(objectClass=user)(!(objectClass=computer))))');
             break;
         case OUSER_TAB:
             //5.2.2
             $this->_execute('(&(employeeid=' . $uid . ')(&(objectClass=user)(!(objectClass=computer))))');
             break;
         default:
             $this->_execute('(&(|(userPrincipalName=' . $uid . ')(SAMAccountName=' . $uid . '))(&(objectClass=user)(!(objectClass=computer))))');
     }
     if ($this->count > 1) {
         for ($i = 0; $i < $this->count; $i++) {
             $this->userworkstations[$i] = explode(',', $this->userworkstations[$i]);
             //5.0.2
         }
     } else {
         $this->userworkstations = explode(',', $this->userworkstations);
         //5.0.2
     }
 }