1 <!DOCTYPE PUBLIC HTML "-//W3C//HTML3.2 Final//En">
4 <!-- copyright, (C) Predrag Balorda, OpenLDAP Foundation, 1998,1999,2000 -->
5 <title>PHP3 Thingy</title>
6 <link rel="stylesheet" type="text/css" href="style.css">
10 include ('include/preferences.inc');
11 include ('include/ldap_manager.inc');
12 include ('include/query_manager.inc');
13 include ('include/search_form.inc');
14 $FILE = "http://$HTTP_HOST$SCRIPT_NAME";
15 $JPEGFILE = "http://$HTTP_HOST/ldap/php3-tool/ldap-photo.php3";
16 $qm = new query_manager;
17 $lm = new ldap_manager;
18 $prefs = new preferences;
21 $main_start_time = microtime();
22 global $lm, $qm, $prefs, $FILE;
23 $qm = new query_manager;
24 $lm = new ldap_manager;
25 $prefs = new preferences;
26 $lm->ldap_action = $qm->get_action();
27 $lm->base_dn = $qm->get_base_dn();
28 $lm->host = $qm->get_host();
29 $lm->search_filter = $qm->get_search_filter();
30 $prefs->loadPreferences();
31 display_advanced_form();
32 if (!$lm->connect($lm->host)) {
33 echo "Couldn't connect to <b>".$lm->host."</b><br>\n";
37 if (!$lm->ldapTakeAction($lm->ldap_action) || $lm->entriesCount == 0) {
38 echo "Didn't find anything for ".$lm->ldap_action." on ".$lm->search_filter." from ".$lm->base_dn."<br>\n";
42 // echo "I got <b>".$lm->entriesCount."</b> entries for ".$lm->ldap_action." on ".$lm->search_filter." from ".$lm->base_dn."<br>\n";
43 $get_entries_s_t = microtime();
45 $get_entries_e_t = microtime();
46 // echo "Disconnecting from <b>".$lm->host."</b><br>\n";
49 if (($qm->get_mode() == "tree") && ($lm->ldap_action == "list")) {
50 $display_entries_s_t = microtime();
51 ?><table width="100%" border=1 cellpadding=0 cellspacing=0>
53 <td bgcolor="#9380DB" align=center valign=absmiddle>
54 <h3 class=head><?echo $lm->formatHTMLBaseDN($lm->base_dn);?></h3>
59 <script language="JavaScript" src="javascript/expandable-outlines.js">
61 $tokens = array( 0 => " ", 1 => ",");
63 $s = ldap_dn2ufn($e->dn);
64 $firstel = $lm->stripString($s, $tokens);
65 for ($i=0; $i<count($lm->entries); $i++) {
67 $e = $lm->entries[$i];
68 $s = ldap_dn2ufn($e->dn);
69 $tin = $lm->stripString($s, $tokens);
70 ?><div id="<? echo $tin; ?>Parent" class=parent>
72 <a href="#" onClick="expandIt('<? echo $tin; ?>'); return false">
73 <img name="imEx" src="false.gif" border=0 alt=""></a>
74 <? $n = ldap_explode_dn($e->dn, 1); echo $n[0]; ?></h3>
76 <div id="<? echo $tin; ?>Child" class=child>
77 <table border=1 cellspacing=0 cellpadding=0>
78 <? $c .= $e->formatHTMLAttributes(); echo $c; ?>
83 ?><script language="JavaScript"><!--
85 firstEl = "<? echo $firstel; ?>Parent";
86 firstInd = getIndex(firstEl);
93 $display_entries_s_t = microtime();
94 $c = $lm->formatHTMLEntries();
97 $display_entries_e_t = microtime();
98 // echo "<div align=right valign=bottom>";
99 // $t1 = $lm->calculateTime("getEntries()", $get_entries_s_t, $get_entries_e_t);
100 // $t2 = $lm->calculateTime("displayEntries()", $display_entries_s_t, $display_entries_e_t);
101 // $main_end_time = microtime();
102 // $t3 = $lm->calculateTime("main()", $main_start_time, $main_end_time);
103 // $t = $t3 - ($t1 + $t2);
104 // echo "Ether : ".$t." seconds<br>\n";