3 function get_action() {
5 if (isset ($ldap_action)) {
6 $ldap_action = urldecode ($ldap_action);
13 function get_base_dn() {
15 if (isset ($base_dn)) {
16 $base_dn = urldecode ($base_dn);
19 $base_dn = "o=University of Michigan, c=US";
20 // $base_dn = "o=Balorda and Balorda, c=UK";
28 $host = urldecode($host);
36 function get_search_filter() {
37 global $objectclass, $attrib, $precision, $search_string;
38 // global $search_filter;
39 // if (isset ($search_filter)) {
40 // $search_filter = urldecode($search_filter);
43 $search_filter = "(objectclass=";
44 switch(urldecode($objectclass)) {
45 case "People": $search_filter .= "person)";break;
46 case "Groups": $search_filter .= "organizationalUnit)"; break;
47 case "Joinable Groups": $search_filter .= "joinableGroup)"; break;
48 case "Organisations": $search_filter .= "organization)"; break;
49 default: $search_filter .= "*)"; break;
51 switch(urldecode($attrib)) {
52 case "Common Name": $search_filter .= "(cn"; break;
53 case "Surname": $search_filter .= "(sn"; break;
54 case "Business Phone": $search_filter .= "(telephone"; break;
55 case "E-mail Address": $search_filter .= "(mail"; break;
56 case "Title": $search_filter .= "(title"; break;
57 case "Distinguished Name": $search_filter .="(dn"; break;
58 case "Location": $search_filter .="(l"; break;
61 switch(urldecode($precision)) {
62 case "exactly matches": $search_filter .= "=".$search_string.")"; break;
63 case "starts with": $search_filter .= "=".$search_string."*)"; break;
64 case "ends with": $search_filter .= "=*".$search_string.")"; break;
65 case "approximates": $search_filter .= "~=".$search_string.")"; break;
66 case "contains": $search_filter .= "=*".$search_string."*)"; break;
69 $search_filter = "(&".$search_filter.")";
70 // echo $search_filter;
72 return $search_filter;
75 cfunction get_mode() {
78 $mode = urldecode($mode);
86 function display_form() {
88 ?> <form method=get action=<? echo $FILE; ?>>
89 <input type=text name=search_filter size=25 value="<? echo $lm->search_filter; ?>"><br>
90 <input type=hidden name=ldap_action value=search>
91 <input type=submit value="Search">
92 <input type=reset value="Clear">
97 cfunction makeForm($s) {
99 echo "<table border=0 cellspacing=2 cellpadding=2 bgcolor=gray>\n";
100 for ($i=0; $i<count($s); $i++) {
102 echo "<form method=get action=".$FILE.">\n";
103 echo "<tr>\n\t<td colspan=2 align=left bgcolor=lightgrey>\n";
105 echo "\t\t</td>\n\t</tr>";
106 echo "<tr>\n\t<td align=left bgcolor=white>\n";
107 echo "\t\t<input type=submit width=80 height=30 value=".$parameter[1].">\n";
108 echo "\t\t</td>\n\t<td align=left bgcolor=lightyellow>\n";
109 echo "\t\t<input type=text size=25 name=".$parameter[2].">\n";
110 echo "\t\t</td>\n\t</tr>\n</form>\n";
115 cfunction display_console() {
116 echo '<table width="100%" border=0 cellspacing=2 cellpadding=2 bgcolor=gray><tr>';
117 echo '<td colspan=2 align=center valign=middle bgcolor=white><h2>LDAP Console</h2></td></tr><tr>';
118 echo '<td align=center valign=middle>';
120 0 => array("Bind (authenticate) to the directory.", "bind", "who"),
121 1 => array("Change the search base.", "cb", "where"),
122 2 => array("Change information associated with an entry","change","entry"),
123 3 => array("Create a new group entry","create","group"),
124 4 => array("Edit a complete Directory entry","vedit","entry"),
125 5 => array("Find an entry in the directory.","find","entry")
127 $this->makeForm($things);
128 echo '</td><td align=center valign=middle>';
130 0 => array("Change the group base.","groupbase","where"),
131 1 => array("Display detailed help for a function","help","command"),
132 2 => array("Subscribe to a group.","join","group"),
133 3 => array("List the groups owned by someone","list","who"),
134 4 => array("List out the groups in which someone is a member.", "memberships", "who"),
135 5 => array("Remove obsolete entries from a group.", "purge", "group")
137 $this->makeForm($things);
138 echo '</td></tr></table>';