Exemplo n.º 1
0
 function search($uname, &$u)
 {
     $utimer = utime();
     $filter = '(sAMAccountName=' . $uname . ')';
     if ($result = ldap_search($this->c, LDAPTREE, $filter)) {
         $data = ldap_get_entries($this->c, $result);
         $keys = array_keys($data[0]);
         $member = '';
         while (list($k, $v) = each($keys)) {
             //  echo "<!-- [$v] -->\n";
             if (isset($u->{$v})) {
                 if ($v == 'memberof') {
                     for ($i = 0; $i < $data[0][$v]['count']; $i++) {
                         $member .= $data[0][$v][$i] . ';';
                     }
                     $u->{$v} = $member;
                 } else {
                     $u->{$v} = $data[0][$v]['0'];
                 }
             }
             // debug - et mis meil üldse AD'st saada on
             //  $uu = $data['0'][$v]['0'];
             //  echo "<!-- $v = $uu -->\n";
         }
         if ($this->debug) {
             $t = stop_utimer($utimer);
             $this->m[] = "<!-- LDAP [{$t}] userdata for [{$uname}] -->\n";
         }
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 public function parse($vars, $fname)
 {
     $utimer = utime();
     $this->vars = $vars;
     // loop peab nägema
     $this::open($fname, 'r');
     $this->content = $this::read();
     $parsed = $this::rip_open_and_do_replacements($vars);
     if ($this->debug) {
         $this->msg[] = "<!-- file: [{$fname}] parsed in " . stop_utimer($utimer) . " s. -->\n";
     }
     return $parsed;
 }
Exemplo n.º 3
0
Arquivo: func.php Projeto: jotttt/auth
function load_translations($lang, &$l)
{
    $utimer = utime();
    $l = new stdClass();
    $fn = sprintf("%s/%s.txt", ETC_DIR, $lang);
    if (file_exists($fn)) {
        $f = new FILE();
        $f->open($fn, 'r');
        $e = explode(';', $f->read());
        // esimene lõikamine
        while (list($k, $v) = each($e)) {
            $val = $chr = '';
            $j = explode('=', trim($v));
            $k = trim($j['0']);
            // esimene element
            if (count($j) > 0) {
                for ($i = 1; $i < count($j); $i++) {
                    $val .= $chr . $j[$i];
                    $chr = '=';
                }
            } else {
                $val = $j['1'];
            }
            if (!empty($k)) {
                $l->{$k} = trim($val);
            }
        }
        $f->close();
        unset($f);
        unset($e);
        /*
         echo "<!--";
         print_r($l);
         echo "-->";
        */
        $t = stop_utimer($utimer);
        return true;
    }
    return false;
}