示例#1
0
 protected function returnTotalArray()
 {
     $ldap = new \cmu\wrappers\LdapWrapper();
     //query LDAP
     $values = $ldap->getEntries($ldap->search($this->dn, $this->filter, $this->att));
     return $this->returnMeta('MetaTable', $values);
     //helper in parent
     //$totalarray = new TotalArray($this->returnMeta('MetaTable', $values));
 }
示例#2
0
 protected function returnTotalArray()
 {
     //check to see if $request array is populated with keys
     if (isset($this->request['uid'])) {
         //if POST, skip checking dn
         $values = $this->request;
     } elseif (isset($this->request['dn'])) {
         //GET
         $ldap = new \cmu\wrappers\LdapWrapper();
         //query LDAP
         $this->dn = $this->request['dn'];
         $values = $ldap->getEntries($ldap->search($this->dn, $this->filter, $this->att));
         //build array
     } else {
         $values = array();
     }
     return $this->returnMeta('Meta', $values);
     //helper in parent
     //$totalarray = new TotalArray($this->returnMeta('Meta', $values));
 }
示例#3
0
 private function returnTotalArray()
 {
     //check to see if $request array is populated
     if (isset($this->request['uid'])) {
         //form values passed POST
         $values = $this->request;
     } elseif (isset($this->request['dn'])) {
         //GET
         $filter = "(objectClass=*)";
         $att = ['cn', 'sn', 'uid'];
         //will pull same values as keys in $array
         //query LDAP
         $ldap = new \cmu\wrappers\LdapWrapper();
         //build array
         $values = $ldap->getEntries($ldap->search($this->request['dn'], $filter, $att));
     }
     if (isset($values)) {
         //if values set above, pass to META so it can inject
         $this->meta->setValues($values);
         $this->meta->injectValuesAndSet();
     }
     return $this->meta->getProperties();
 }
示例#4
0
文件: edit.php 项目: josephecmu/whois
            $person_array[$k]['values'] = $values;
        }
    }
}
if (null != $_GET) {
    //do lookup and return values
    //print_r($_GET);
    //echo $dn;
    //$dn = "ou=people, dc=mcs, dc=cmu, dc=edu";  //needs to be dynamic
    $filter = "(objectClass=*)";
    $att = ['cn', 'sn', 'uid'];
    //will pull same values as keys in $tablearray
    //query LDAP
    $ldap = new \cmu\wrappers\LdapWrapper();
    //build array
    $results = $ldap->getEntries($ldap->search($dn, $filter, $att));
    //(ldap)$results     [$i]     [$k]           [0]
    // arrayname        index   attribute   attributeposition (0)
    //print_r($results);
    //echo "<br />";  echo "<br />";
    //INJECT values
    for ($i = 0; $i < $results["count"]; $i++) {
        foreach ($person_array as $k => $v) {
            $ignore_array = ['userPassword', 'confirmuserPassword', 'dn'];
            //ignore these values inthe array for special handling or no handling
            if (!in_array($k, $ignore_array)) {
                $person_array[$k]['values'][] = $results[$i][$k][0];
                //we must input values as array as that is how builders expect them.
            }
            $person_array['dn']['value'] = $results[$i]['dn'];
            //we can override the 'values' array and set directly ONE value