include ('include/preferences.inc');
include ('include/ldap_manager.inc');
include ('include/query_manager.inc');
include ('include/search_form.inc');
$FILE = "http://$HTTP_HOST$SCRIPT_NAME";
$JPEGFILE = "http://$HTTP_HOST/ldap/php3-tool/ldap-photo.php3";
$qm = new query_manager;
$lm = new ldap_manager;
$prefs = new preferences;
function main() {
$main_start_time = microtime();
global $lm, $qm, $prefs, $FILE;
$qm = new query_manager;
$lm = new ldap_manager;
$prefs = new preferences;
$lm->ldap_action = $qm->get_action();
$lm->base_dn = $qm->get_base_dn();
$lm->host = $qm->get_host();
$lm->search_filter = $qm->get_search_filter();
$prefs->loadPreferences();
display_advanced_form();
if (!$lm->connect($lm->host)) {
echo "Couldn't connect to ".$lm->host."
\n";
echo "Bye";
return 0;
}
if (!$lm->ldapTakeAction($lm->ldap_action) || $lm->entriesCount == 0) {
echo "Didn't find anything for ".$lm->ldap_action." on ".$lm->search_filter." from ".$lm->base_dn."
\n";
return 0;
}
else {
// echo "I got ".$lm->entriesCount." entries for ".$lm->ldap_action." on ".$lm->search_filter." from ".$lm->base_dn."
\n";
$get_entries_s_t = microtime();
$lm->getEntries();
$get_entries_e_t = microtime();
// echo "Disconnecting from ".$lm->host."
\n";
$lm->disconnect();
}
if (($qm->get_mode() == "tree") && ($lm->ldap_action == "list")) {
$display_entries_s_t = microtime();
?>
formatHTMLBaseDN($lm->base_dn);?>
|
$tokens = array( 0 => " ", 1 => ",");
$e = $lm->entries[0];
$s = ldap_dn2ufn($e->dn);
$firstel = $lm->stripString($s, $tokens);
for ($i=0; $ientries); $i++) {
$c = "";
$e = $lm->entries[$i];
$s = ldap_dn2ufn($e->dn);
$tin = $lm->stripString($s, $tokens);
?>
$n = ldap_explode_dn($e->dn, 1); echo $n[0]; ?>
$c .= $e->formatHTMLAttributes(); echo $c; ?>
}
?>
}
else {
$display_entries_s_t = microtime();
$c = $lm->formatHTMLEntries();
echo $c;
}
$display_entries_e_t = microtime();
// echo "";
// $t1 = $lm->calculateTime("getEntries()", $get_entries_s_t, $get_entries_e_t);
// $t2 = $lm->calculateTime("displayEntries()", $display_entries_s_t, $display_entries_e_t);
// $main_end_time = microtime();
// $t3 = $lm->calculateTime("main()", $main_start_time, $main_end_time);
// $t = $t3 - ($t1 + $t2);
// echo "Ether : ".$t." seconds
\n";
// echo "
";
return 1;
}
$return = main();
?>