]> git.sur5r.net Git - openldap/blob - contrib/php3-tool/index.php3
d74a38af5a3c0243127c536a04aec646c8fe8b4f
[openldap] / contrib / php3-tool / index.php3
1 <!-- copyright, (C) Predrag Balorda, 1998 -->
2 <html>
3 <head>
4         <style type="text/css">
5         <!--
6         BODY {
7                 font-family: lucida sans unicode;
8         }
9         B {
10                 font-weight: bold;
11         }
12         P {
13                 font-family: lucida sans unicode,Arial,Helvetica;
14                 font-size: 12pt;
15         }
16         .form {
17                 font-family: lucinda sans unicode;      
18                 font-size: 10pt;
19                 color: #003333;
20         }
21         H3 {
22                 font-family: Verdana,Arial,Helvetica;
23                 font-size: 12pt;
24                 font-weight: bold;
25         }
26         .head {
27                 font-size: 13pt;
28                 color: #003333;
29         }
30         .subsection {
31                 font-size: 12pt;
32                 color: #003333;
33         }
34         -->
35         </style>
36 </head>
37 <body>
38 <?
39 include ('include/ldap_manager.inc');
40 include ('include/query_manager.inc');
41 include ('include/search_form.inc');
42 $FILE = "http://$HTTP_HOST$SCRIPT_NAME";
43 $JPEGFILE = "http://$HTTP_HOST/ldap/ldap-photo.php3";
44 $qm = new query_manager;
45 $lm = new ldap_manager;
46 $attribute_names = array();
47
48 function main() {
49         $main_start_time = microtime();
50         global $lm, $qm, $FILE;
51         $qm = new query_manager;
52         $lm = new ldap_manager;
53         $lm->ldap_action = $qm->get_action();
54         $lm->base_dn = $qm->get_base_dn();
55         $lm->host = $qm->get_host();
56         $lm->search_filter = $qm->get_search_filter();
57         $lm->loadAttributeNames();
58         display_advanced_form();
59         if (!$lm->connect($lm->host)) {
60                 echo "Couldn't connect to <b>".$lm->host."</b><br>\n";
61                 echo "Bye";
62                 return 0;
63         }
64         if (!$lm->ldapTakeAction($lm->ldap_action) || $lm->entriesCount == 0) {
65                 echo "Didn't find anything for ".$lm->ldap_action." on ".$lm->search_filter." from ".$lm->base_dn."<br>\n";
66                 return 0;
67         }
68         else {
69         //      echo "I got <b>".$lm->entriesCount."</b> entries for ".$lm->ldap_action." on ".$lm->search_filter." from ".$lm->base_dn."<br>\n";
70                 $get_entries_s_t = microtime();
71                 $lm->getEntries();
72                 $get_entries_e_t = microtime();
73         //      echo "Disconnecting from <b>".$lm->host."</b><br>\n";
74                 $lm->disconnect();
75         }
76         if (($qm->get_mode() == "tree") && ($lm->ldap_action == "list")) {
77                 $display_entries_s_t = microtime();
78                 ?><table width="100%" border=1 cellpadding=0 cellspacing=0>
79                 <tr>
80                         <td bgcolor="#9380DB" align=center valign=absmiddle>
81                                 <h3 class=head><?echo $lm->formatHTMLBaseDN($lm->base_dn);?></h3>
82                                 </td>
83                         </tr>
84                 </table>
85                 <p>
86                 <script language="JavaScript" src="javascript/expandable-outlines.js">
87                 </script><?
88                 $tokens = array( 0 => " ", 1 => ",");
89                 $e = $lm->entries[0];
90                 $s = ldap_dn2ufn($e->dn);
91                 $firstel = $lm->stripString($s, $tokens);
92                 for ($i=0; $i<count($lm->entries); $i++) {
93                         $c = "";
94                         $e = $lm->entries[$i];
95                         $s = ldap_dn2ufn($e->dn);
96                         $tin = $lm->stripString($s, $tokens);
97                         ?><div id="<? echo $tin; ?>Parent" class=parent>
98                         <h3 class=subsection>
99                         <a href="#" onClick="expandIt('<? echo $tin; ?>'); return false">
100                         <img name="imEx" src="false.gif" border=0 alt=""></a>
101                         <? $n = ldap_explode_dn($e->dn, 1); echo $n[0]; ?></h3>
102                         </div>
103                         <div id="<? echo $tin; ?>Child" class=child>
104                         <table border=1 cellspacing=0 cellpadding=0>
105                         <? $c .= $e->formatHTMLAttributes(); echo $c; ?>
106                         </table>
107                         <br>
108                         </div><?
109                 }
110                 ?><script language="JavaScript"><!--
111                 if (NS4) {
112                         firstEl = "<? echo $firstel; ?>Parent";
113                         firstInd = getIndex(firstEl);
114                         showAll();
115                         arrange();
116                 }
117                 //--></script><?
118         }
119         else {
120                 $display_entries_s_t = microtime();
121                 $c = $lm->formatHTMLEntries();
122                 echo $c;
123         }
124         $display_entries_e_t = microtime();
125 //      echo "<div align=right valign=bottom>";
126 //      $t1 = $lm->calculateTime("getEntries()", $get_entries_s_t, $get_entries_e_t);
127 //      $t2 = $lm->calculateTime("displayEntries()", $display_entries_s_t, $display_entries_e_t);
128 //      $main_end_time = microtime();
129 //      $t3 = $lm->calculateTime("main()", $main_start_time, $main_end_time);
130 //      $t = $t3 - ($t1 + $t2);
131 //      echo "Ether : ".$t." seconds<br>\n";
132 //      echo "</div>";
133         return 1;
134 }
135 $return = main();
136 ?>
137 </body>
138 </html>