function get_user_info($ds, $user, $config, $decode_normal, $k)
{
    if ($ds) {
        $attrs = array('cn');
        if ($config[ldap_userdn] == '') {
            if ($config[ldap_filter] != '') {
                $filter = xlat($config[ldap_filter], $login, $config);
            } else {
                $filter = 'uid=' . $login;
            }
        } else {
            $filter = xlat($config[ldap_userdn], $login, $config);
        }
        if ($config[ldap_debug] == 'true') {
            if ($config[ldap_userdn] == '') {
                print "<b>DEBUG(LDAP): Search Query: BASE='{$config['ldap_base']}',FILTER='{$filter}'</b><br>\n";
            } else {
                print "<b>DEBUG(LDAP): Search Query: BASE='{$filter}',FILTER='(objectclass=radiusprofile)'</b><br>\n";
            }
        }
        if ($config[ldap_userdn] == '') {
            $sr = @ldap_search($ds, "{$config['ldap_base']}", $filter, $attrs);
        } else {
            $sr = @ldap_read($ds, $filter, '(objectclass=radiusprofile)', $attrs);
        }
        $info = @ldap_get_entries($ds, $sr);
        $cn = $info[0]["cn"][0];
        if ($cn != '' && $decode_normal == 1) {
            $cn = decode_string($cn, $k);
        }
        if ($cn == '') {
            $cn = '-';
        }
        return $cn;
    }
}
 function decode_message_body()
 {
     $this->body = decode_string($this->body, $this->headers['content-transfer-encoding']);
 }
Exemplo n.º 3
0
 } else {
     // We can't actually check the database yet since we haven't connected
     // to the database.  That happens in connect.php.
     // Check for session.  If not found, then note it for later
     // handling in connect.php.
     if (empty($webcalendar_session) && empty($login)) {
         $session_not_found = true;
     } else {
         // Check for cookie...
         if (!empty($webcalendar_session)) {
             $encoded_login = $webcalendar_session;
             if (empty($encoded_login)) {
                 // invalid session cookie
                 $session_not_found = true;
             } else {
                 $login_pw = split('\\|', decode_string($encoded_login));
                 $login = $login_pw[0];
                 $cryptpw = $login_pw[1];
                 // make sure we are connected to the database for password check
                 $c = dbi_connect($db_host, $db_login, $db_password, $db_database);
                 if (!$c) {
                     echo "Error connecting to database:<BLOCKQUOTE>" . dbi_error() . "</BLOCKQUOTE>\n";
                     exit;
                 }
                 if (!user_valid_crypt($login, $cryptpw)) {
                     do_debug("User not logged in; redirecting to login page");
                     if (empty($login_return_path)) {
                         do_redirect("login.php");
                     } else {
                         do_redirect("login.php?return_path={$login_return_path}");
                     }
Exemplo n.º 4
0
    if (!empty($username) && !empty($tstringarray['username'])) {
      $form = $form.'  translator: <input type="text" disabled="disabled" value="'.clean_username($tstringarray['username']).'" size="50" />'."<br/>\n";
    }
    $form = $form.'  <input name="action" value="edit-string-array" type="hidden" />'."\n";
    $form = $form.'  <table>';
    $i = 0;
    foreach ($stringarray->item as $item) {
	$av = (string) $item;
	$tv = (string) $tstringarray;
	if (count($tstringarray) > $i && empty($tstringarray->item[$i]['notranslation'])) {
	  $atv = (string) $tstringarray->item[$i];
	} else {
	  $atv = '';
	}
	$decodedv = decode_string($av);
	$decodedtv = decode_string($atv);
	if (
	  empty($decodedtv) && !empty($decodedv) ||
	  empty($decodedv) && !empty($decodedtv)
	  ) {
	  $color = $color_red;
	  $formcolor = $color;
	} else {
	  $color = $color_green;
	}
        $numlines = count(split('\\\n', $av));
        $numlines += strlen($av) / 50;
	// echo '  <!-- '.$av.'-->'."\n";
        $form = $form.'  <tr>';
        $form = $form.'  <td>';
	$form = $form.'  '.$i.': '."\n";
        $homeaddress_lang = $info[0]["homepostaladdress;lang-{$config['general_prefered_lang']}"][0];
        $homeaddress_lang = decode_string("{$homeaddress_lang}", $k);
        $homeaddress_lang = $homeaddress_lang ? $homeaddress_lang : '-';
        $mobile = $info[0]['mobile'][0] ? $info[0]['mobile'][0] : '-';
        $fax = $info[0]['facsimiletelephonenumber'][0] ? $info[0]['facsimiletelephonenumber'][0] : '-';
        $url = $info[0]['labeleduri'][0] ? $info[0]['labeleduri'][0] : '-';
        $ou = $info[0]['ou'][0];
        if ($decode_normal) {
            $ou = decode_string($ou, $k);
        }
        $ou_lang = $info[0]["ou;lang-{$config['general_prefered_lang']}"][0];
        $ou_lang = decode_string("{$ou_lang}", $k);
        $ou_lang = $ou_lang ? $ou_lang : '-';
        $mail = $info[0]['mail'][0] ? $info[0]['mail'][0] : '-';
        $title = $info[0]['title'][0] ? $info[0]['title'][0] : '-';
        if ($decode_normal) {
            $title = decode_string($title, $k);
        }
        $title_lang = $info[0]["title;lang-{$config['general_prefered_lang']}"][0];
        $title_lang = decode_string("{$title_lang}", $k);
        $title_lang = $title_lang ? $title_lang : '-';
        $mailalt = $info[0]['mailalternateaddress'][0] ? $info[0]['mailalternateaddress'][0] : '-';
        $user_password_exists = $info[0]['userpassword'][0] != '' ? 'yes' : 'no';
        foreach ($attrmap as $key => $val) {
            $item_vals["{$key}"] = $info[0]["{$val}"];
        }
    }
    @ldap_close($ds);
} else {
    echo "<b>Could not connect to the LDAP server</b><br>\n";
}