]> git.sur5r.net Git - openldap/commitdiff
Initial revision
authorKurt Zeilenga <kurt@openldap.org>
Tue, 27 Oct 1998 18:11:59 +0000 (18:11 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 27 Oct 1998 18:11:59 +0000 (18:11 +0000)
30 files changed:
contrib/php3-tool/COPYRIGHT [new file with mode: 0644]
contrib/php3-tool/LICENSE [new file with mode: 0644]
contrib/php3-tool/Makefile [new file with mode: 0644]
contrib/php3-tool/README [new file with mode: 0644]
contrib/php3-tool/at.conf [new file with mode: 0644]
contrib/php3-tool/at.conf2 [new file with mode: 0644]
contrib/php3-tool/false.gif [new file with mode: 0644]
contrib/php3-tool/images/I.gif [new file with mode: 0644]
contrib/php3-tool/images/L.gif [new file with mode: 0644]
contrib/php3-tool/images/Lminus.gif [new file with mode: 0644]
contrib/php3-tool/images/Lplus.gif [new file with mode: 0644]
contrib/php3-tool/images/T.gif [new file with mode: 0644]
contrib/php3-tool/images/Tminus.gif [new file with mode: 0644]
contrib/php3-tool/images/Tplus.gif [new file with mode: 0644]
contrib/php3-tool/images/foldericon.gif [new file with mode: 0644]
contrib/php3-tool/images/htmlicon.gif [new file with mode: 0644]
contrib/php3-tool/images/openfoldericon.gif [new file with mode: 0644]
contrib/php3-tool/images/top.gif [new file with mode: 0644]
contrib/php3-tool/images/topopen.gif [new file with mode: 0644]
contrib/php3-tool/images/white.gif [new file with mode: 0644]
contrib/php3-tool/include/ldap_entry.inc [new file with mode: 0644]
contrib/php3-tool/include/ldap_entry_attribute.inc [new file with mode: 0644]
contrib/php3-tool/include/ldap_manager.inc [new file with mode: 0644]
contrib/php3-tool/include/query_manager.inc [new file with mode: 0644]
contrib/php3-tool/include/search_form.inc [new file with mode: 0644]
contrib/php3-tool/index.php3 [new file with mode: 0644]
contrib/php3-tool/javascript/expandable-outlines.js [new file with mode: 0644]
contrib/php3-tool/javascript/resize.js [new file with mode: 0644]
contrib/php3-tool/ldap-photo.php3 [new file with mode: 0644]
contrib/php3-tool/true.gif [new file with mode: 0644]

diff --git a/contrib/php3-tool/COPYRIGHT b/contrib/php3-tool/COPYRIGHT
new file mode 100644 (file)
index 0000000..cf1515d
--- /dev/null
@@ -0,0 +1,8 @@
+Copyright 1998 Predrag Balorda, London, UK
+All rights reserved.
+
+Redistribution and use in source and binary forms are permitted only
+as authorized by the OpenLDAP Public License.  A copy of this
+license is available at http://www.OpenLDAP.org/license.html or
+in file LICENSE in the top-level directory of the distribution.
+
diff --git a/contrib/php3-tool/LICENSE b/contrib/php3-tool/LICENSE
new file mode 100644 (file)
index 0000000..5731d2c
--- /dev/null
@@ -0,0 +1,122 @@
+The OpenLDAP Public License
+
+Version 1.2, 1 September 1998
+Copyright 1998, The OpenLDAP Foundation.
+All Rights Reserved.
+
+Note:
+       This license is derived from the "Artistic License" as distributed
+       with the Perl Programming Language.  As differences may exist, the
+       complete license should be read.
+
+PREAMBLE
+
+The intent of this document is to state the conditions under which a
+Package may be copied, such that the Copyright Holder maintains some
+semblance of artistic control over the development of the package,
+while giving the users of the package the right to use and distribute
+the Package in a more-or-less customary fashion, plus the right to make
+reasonable modifications.
+
+Definitions:
+
+       "Package" refers to the collection of files distributed by the
+       Copyright Holder, and derivatives of that collection of files
+       created through textual modification.
+
+       "Standard Version" refers to such a Package if it has not been
+       modified, or has been modified in accordance with the wishes
+       of the Copyright Holder.
+
+       "Copyright Holder" is whoever is named in the copyright or
+       copyrights for the package.
+
+       "You" is you, if you're thinking about copying or distributing
+       this Package.
+
+       "Reasonable copying fee" is whatever you can justify on the
+       basis of media cost, duplication charges, time of people involved,
+       and so on.  (You will not be required to justify it to the
+       Copyright Holder, but only to the computing community at large
+       as a market that must bear the fee.)
+
+       "Freely Available" means that no fee is charged for the item
+       itself, though there may be fees involved in handling the item.
+       It also means that recipients of the item may redistribute it
+       under the same conditions they received it.
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you
+duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications
+derived from the Public Domain or from the Copyright Holder.  A Package
+modified in such a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided
+that you insert a prominent notice in each changed file stating how and
+when you changed that file, and provided that you do at least ONE of the
+following:
+
+    a) place your modifications in the Public Domain or otherwise make them
+    Freely Available, such as by posting said modifications to Usenet or
+    an equivalent medium, or placing the modifications on a major archive
+    site such as uunet.uu.net, or by allowing the Copyright Holder to include
+    your modifications in the Standard Version of the Package.
+
+    b) use the modified Package only within your corporation or organization.
+
+    c) rename any non-standard executables so the names do not conflict
+    with standard executables, which must also be provided, and provide
+    a separate manual page for each non-standard executable that clearly
+    documents how it differs from the Standard Version.
+
+    d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or
+executable form, provided that you do at least ONE of the following:
+
+    a) distribute a Standard Version of the executables and library files,
+    together with instructions (in the manual page or equivalent) on where
+    to get the Standard Version.
+
+    b) accompany the distribution with the machine-readable source of
+    the Package with your modifications.
+
+    c) accompany any non-standard executables with their corresponding
+    Standard Version executables, giving the non-standard executables
+    non-standard names, and clearly documenting the differences in manual
+    pages (or equivalent), together with instructions on where to get
+    the Standard Version.
+
+    d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+Package.  You may charge any fee you choose for support of this Package.
+You may not charge a fee for this Package itself.  However,
+you may distribute this Package in aggregate with other (possibly
+commercial) programs as part of a larger (possibly commercial) software
+distribution provided that you do not advertise this Package as a
+product of your own.
+
+6. The scripts and library files supplied as input to or produced as
+output from the programs of this Package do not automatically fall
+under the copyright of this Package, but belong to whomever generated
+them, and may be sold commercially, and may be aggregated with this
+Package.
+
+7. C subroutines supplied by you and linked into this Package in order
+to emulate subroutines and variables of the language defined by this
+Package shall not be considered part of this Package, but are the
+equivalent of input as in Paragraph 6, provided these subroutines do
+not change the language in any way that would cause it to fail the
+regression tests for the language.
+
+8. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End
diff --git a/contrib/php3-tool/Makefile b/contrib/php3-tool/Makefile
new file mode 100644 (file)
index 0000000..345c8a8
--- /dev/null
@@ -0,0 +1,2 @@
+all:
+       @printf "Hehe, these are scripts..you don't \033[1mcompile\033[0m them\n" 
diff --git a/contrib/php3-tool/README b/contrib/php3-tool/README
new file mode 100644 (file)
index 0000000..ff98acc
--- /dev/null
@@ -0,0 +1,6 @@
+blah blah blah yadda yadda yadda don't forget to modify at.conf
+blah blah
+/me hopes you'll like this
+
+p.s. do _NOT_ forget to add this to your /etc/httpd/conf/srm.conf (or wherever your put it):
+DorectoryIndex .... index.php3 ...
diff --git a/contrib/php3-tool/at.conf b/contrib/php3-tool/at.conf
new file mode 100644 (file)
index 0000000..0c46a6a
--- /dev/null
@@ -0,0 +1,53 @@
+aliasedObjectName,Aliased Object Name,TRUE
+associatedname,Associated Name,TRUE
+associateddomain,Associated Domain,TRUE
+audio,Audio Sample,TRUE
+cn,Common Name,TRUE
+dn,Distinguished Name,TRUE
+description,Description,TRUE
+documentauthor,Document Author,TRUE
+drink,Favourite Drink,TRUE
+errorsto,Errors To,TRUE
+facsimiletelephonenumber,Fax Number,TRUE
+fax,Fax Number,TRUE
+homephone,Home Telephone Number,TRUE
+homepostaladdress,Home Postal Address,TRUE
+joinable,Can be joined,TRUE
+jpegphoto,Photograph,TRUE
+krbname,Kerberos Name,TRUE
+l,Location,TRUE
+labeledurl,Web Page,TRUE
+lastmodifiedby,Last Modified by,TRUE
+lastmodifiedtime,Last Modified at,TRUE
+mail,E-mail,TRUE
+manager,Manager,TRUE
+member,Mambers,TRUE
+mobile,Mobile Phone Number,TRUE
+mobiletelephonenumber,Mobile Phone Number,TRUE
+modifytimestamp,Modified at,TRUE
+modifiersname,Modified by,TRUE
+multilinedescription,Multi-lined description,TRUE
+naminglink,Naming Link,TRUE
+nobatchupdates,No Batch Updates,TRUE
+notice,Notice,TRUE
+o,Organization,TRUE
+objectclass,Object Class,TRUE
+onvacation,On Vacation,TRUE
+ou,Organizational Unit,TRUE
+owner,Owner,TRUE
+pager,Pager Number,TRUE
+pagertelephonenumber,Pager Number,TRUE
+personalsignature,Personal Signature,TRUE
+photo,Photograph,TRUE
+postaladdress,Postal Address,TRUE
+reciprocalnaminglink,Reciprocal Naming Link,TRUE
+requeststo,Requests To,TRUE
+secretary,Secretary,TRUE
+seealso,See Also,TRUE
+sn,Surname,TRUE
+st,State,TRUE
+streetaddress,Streed Address,TRUE
+telephonenumber,Telephone Number,TRUE
+title,Title,TRUE
+userpassword,User Password,TRUE
+uid,User ID,TRUE
diff --git a/contrib/php3-tool/at.conf2 b/contrib/php3-tool/at.conf2
new file mode 100644 (file)
index 0000000..0c46a6a
--- /dev/null
@@ -0,0 +1,53 @@
+aliasedObjectName,Aliased Object Name,TRUE
+associatedname,Associated Name,TRUE
+associateddomain,Associated Domain,TRUE
+audio,Audio Sample,TRUE
+cn,Common Name,TRUE
+dn,Distinguished Name,TRUE
+description,Description,TRUE
+documentauthor,Document Author,TRUE
+drink,Favourite Drink,TRUE
+errorsto,Errors To,TRUE
+facsimiletelephonenumber,Fax Number,TRUE
+fax,Fax Number,TRUE
+homephone,Home Telephone Number,TRUE
+homepostaladdress,Home Postal Address,TRUE
+joinable,Can be joined,TRUE
+jpegphoto,Photograph,TRUE
+krbname,Kerberos Name,TRUE
+l,Location,TRUE
+labeledurl,Web Page,TRUE
+lastmodifiedby,Last Modified by,TRUE
+lastmodifiedtime,Last Modified at,TRUE
+mail,E-mail,TRUE
+manager,Manager,TRUE
+member,Mambers,TRUE
+mobile,Mobile Phone Number,TRUE
+mobiletelephonenumber,Mobile Phone Number,TRUE
+modifytimestamp,Modified at,TRUE
+modifiersname,Modified by,TRUE
+multilinedescription,Multi-lined description,TRUE
+naminglink,Naming Link,TRUE
+nobatchupdates,No Batch Updates,TRUE
+notice,Notice,TRUE
+o,Organization,TRUE
+objectclass,Object Class,TRUE
+onvacation,On Vacation,TRUE
+ou,Organizational Unit,TRUE
+owner,Owner,TRUE
+pager,Pager Number,TRUE
+pagertelephonenumber,Pager Number,TRUE
+personalsignature,Personal Signature,TRUE
+photo,Photograph,TRUE
+postaladdress,Postal Address,TRUE
+reciprocalnaminglink,Reciprocal Naming Link,TRUE
+requeststo,Requests To,TRUE
+secretary,Secretary,TRUE
+seealso,See Also,TRUE
+sn,Surname,TRUE
+st,State,TRUE
+streetaddress,Streed Address,TRUE
+telephonenumber,Telephone Number,TRUE
+title,Title,TRUE
+userpassword,User Password,TRUE
+uid,User ID,TRUE
diff --git a/contrib/php3-tool/false.gif b/contrib/php3-tool/false.gif
new file mode 100644 (file)
index 0000000..b5a6fb3
Binary files /dev/null and b/contrib/php3-tool/false.gif differ
diff --git a/contrib/php3-tool/images/I.gif b/contrib/php3-tool/images/I.gif
new file mode 100644 (file)
index 0000000..e9067b2
Binary files /dev/null and b/contrib/php3-tool/images/I.gif differ
diff --git a/contrib/php3-tool/images/L.gif b/contrib/php3-tool/images/L.gif
new file mode 100644 (file)
index 0000000..a11cead
Binary files /dev/null and b/contrib/php3-tool/images/L.gif differ
diff --git a/contrib/php3-tool/images/Lminus.gif b/contrib/php3-tool/images/Lminus.gif
new file mode 100644 (file)
index 0000000..c316c83
Binary files /dev/null and b/contrib/php3-tool/images/Lminus.gif differ
diff --git a/contrib/php3-tool/images/Lplus.gif b/contrib/php3-tool/images/Lplus.gif
new file mode 100644 (file)
index 0000000..701c16c
Binary files /dev/null and b/contrib/php3-tool/images/Lplus.gif differ
diff --git a/contrib/php3-tool/images/T.gif b/contrib/php3-tool/images/T.gif
new file mode 100644 (file)
index 0000000..5803c1d
Binary files /dev/null and b/contrib/php3-tool/images/T.gif differ
diff --git a/contrib/php3-tool/images/Tminus.gif b/contrib/php3-tool/images/Tminus.gif
new file mode 100644 (file)
index 0000000..1a3b056
Binary files /dev/null and b/contrib/php3-tool/images/Tminus.gif differ
diff --git a/contrib/php3-tool/images/Tplus.gif b/contrib/php3-tool/images/Tplus.gif
new file mode 100644 (file)
index 0000000..536dbc9
Binary files /dev/null and b/contrib/php3-tool/images/Tplus.gif differ
diff --git a/contrib/php3-tool/images/foldericon.gif b/contrib/php3-tool/images/foldericon.gif
new file mode 100644 (file)
index 0000000..96b709e
Binary files /dev/null and b/contrib/php3-tool/images/foldericon.gif differ
diff --git a/contrib/php3-tool/images/htmlicon.gif b/contrib/php3-tool/images/htmlicon.gif
new file mode 100644 (file)
index 0000000..2a8fd4f
Binary files /dev/null and b/contrib/php3-tool/images/htmlicon.gif differ
diff --git a/contrib/php3-tool/images/openfoldericon.gif b/contrib/php3-tool/images/openfoldericon.gif
new file mode 100644 (file)
index 0000000..c60c811
Binary files /dev/null and b/contrib/php3-tool/images/openfoldericon.gif differ
diff --git a/contrib/php3-tool/images/top.gif b/contrib/php3-tool/images/top.gif
new file mode 100644 (file)
index 0000000..7284af1
Binary files /dev/null and b/contrib/php3-tool/images/top.gif differ
diff --git a/contrib/php3-tool/images/topopen.gif b/contrib/php3-tool/images/topopen.gif
new file mode 100644 (file)
index 0000000..9aa4240
Binary files /dev/null and b/contrib/php3-tool/images/topopen.gif differ
diff --git a/contrib/php3-tool/images/white.gif b/contrib/php3-tool/images/white.gif
new file mode 100644 (file)
index 0000000..6a62ac8
Binary files /dev/null and b/contrib/php3-tool/images/white.gif differ
diff --git a/contrib/php3-tool/include/ldap_entry.inc b/contrib/php3-tool/include/ldap_entry.inc
new file mode 100644 (file)
index 0000000..d3f19d8
--- /dev/null
@@ -0,0 +1,110 @@
+<?
+include 'include/ldap_entry_attribute.inc';
+class ldap_entry {
+       var $attributes;
+       var $dn;
+       var $parent;
+       var $attributeCount;
+       var $link_identifier;
+       var $r_e_i;
+
+       cfunction ldap_entry($l_i) {
+       //      echo "creating new ldap_entry<br>\n";
+               $this->link_identifier = $l_i;
+       }
+
+       cfunction getAttributes() {
+               $i=0;
+               $attrib = new ldap_entry_attribute($this->dn);
+               $n = ldap_first_attribute($this->link_identifier, $this->r_e_i, &$ber);
+               while ($n) {
+                       $attrib->name = $n;
+                       $attrib->getValues($this->link_identifier,$this->r_e_i);
+                       $this->attributes[$i] = $attrib;
+                       $i++;
+                       $attrib = new ldap_entry_attribute($this->dn);
+                       $n = ldap_next_attribute($this->link_identifier, $this->r_e_i, $ber);
+               }
+       }
+
+       cfunction formatHTMLDN($dn) {
+               global $FILE, $host;
+               $string = "";
+               $attribs = ldap_explode_dn($dn, 0);
+               $names = ldap_explode_dn($dn, 1);
+               for ($i=0; $i<$attribs["count"]; $i++) {
+                       $s = $attribs[$i];
+                       for ($j=$i+1; $j<$attribs["count"]; $j++) {
+                               $s .= ",".$attribs[$j];
+                       }
+                       if (($s[0] == "c") && ($s[1] == "n")) {
+                               $string .= "<a href=".$FILE."?ldap_action=read&base_dn=".urlencode($s).">".$names[$i]."</a>";
+                       }
+                       else {
+                               $string .= "<a href=".$FILE."?ldap_action=list&base_dn=".urlencode($s).">".$names[$i]."</a>";
+                       }
+                       if ($i<$attribs["count"]-1) { $string .= ", "; }
+               }
+               return $string;
+       }
+
+       cfunction formatHTMLAttributes() {
+               global $FILE, $host;
+               $s = "";
+               $s .= "<tr>\n\t";
+               $s .= '<td colspan=2 bgcolor="#9380DB" align="center" valign="middle">';
+               $s .= "\n\t\t<h3 class=head>".$this->formatHTMLDN($this->dn)."</h3>\n";
+               $s .= "\t\t</td>\n\t</tr>\n";   
+               $c = count($this->attributes);
+               for ($i=0; $i<$c; $i++) {
+                       $attrib = $this->attributes[$i];
+                       if ($attrib->isVisible($attrib->name) == "TRUE") {
+                               $s .= $attrib->formatHTMLValues();
+                       }
+               //      switch ($attrib->name) {
+               //              case "krbname":
+               //              case "objectclass":
+               //              case "nobatchupdates":
+               //              case "uid":
+               //              case "userpassword": break;
+               //              default:        
+               //                      $s .= $attrib->formatHTMLValues();
+               //                      break;
+               //      }
+               }
+               $a = $this->attributes[0];
+               $v = $a->values[1];
+               if ($v == "organizationalUnit" || $v == "organization") {
+                       $s .= "<tr>\n\t<td colspan=2>\n";
+                       $s .= "\t\t<a href=".$FILE."?host=".urlencode($host)."&ldap_action=list&base_dn=".urlencode($this->dn).">Browse</a>\n";
+                       $s .= "\t\t</td>\n\t</tr>\n";
+               }
+               else {
+                       $s .= "<tr>\n\t<td colspan=2>\n\t\t&nbsp;\n\t\t</td>\n\t</tr>\n";
+               }
+               return $s;
+       }
+
+       cfunction display() {
+               global $FILE, $host;
+               echo "<tr><td colspan=2 bgcolor=gray>";
+               echo "<h3>".ldap_dn2ufn($this->dn)."</h3>";
+               echo "</td></tr>";
+               $c = count($this->attributes);
+               for ($i=0; $i<$c; $i++) {
+                       $attrib = $this->attributes[$i];
+                       $attrib->display();
+               }
+               $a = $this->attributes[0];
+               $v = $a->values[1];
+               if ($v == "organizationalUnit" || $v == "organization") {
+                       echo "<tr><td colspan=2>";
+                       echo "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=list&base_dn=".urlencode($this->dn).">Browse</a>";
+                       echo "</td></tr>";
+               }
+               else {
+                       echo "<tr><td colspan=2>&nbsp;</td></tr>";
+               }
+       }
+}
+?>
diff --git a/contrib/php3-tool/include/ldap_entry_attribute.inc b/contrib/php3-tool/include/ldap_entry_attribute.inc
new file mode 100644 (file)
index 0000000..d20da40
--- /dev/null
@@ -0,0 +1,169 @@
+<?
+class ldap_entry_attribute {
+       var $name, $values, $parent;
+       cfunction ldap_entry_attribute($d) {
+       //      echo "creating new ldap_entry_attribtute<br>\n";
+               $this->dn = $d;
+               $a = ldap_explode_dn($this->dn, 1);
+               $this->cn = $a[0];
+       }
+
+       cfunction getAttributeName($string) {
+               global $attribute_names;
+               for ($i=0; $i<count($attribute_names); $i++) {
+                       if ($attribute_names[$i][0] == $string) {
+                               return $attribute_names[$i][1];
+                       }       
+               }
+               return $string;
+       }
+       cfunction isVisible($string) {
+               global $attribute_names;
+               for ($i=0; $i<count($attribute_names); $i++) {
+                       if ($attribute_names[$i][0] == $string) {
+                               return $attribute_names[$i][2];
+                       }
+               }
+               return "FALSE";
+       }
+       
+       cfunction getValues($l_i, $r_e_i) {
+               //echo "My name is ".$this->name."<br>\n";
+               $this->values = ldap_get_values($l_i, $r_e_i, $this->name);
+       }
+
+       cfunction display() {
+               echo "<tr>\n\t<td valign=top bgcolor=white>\n";
+               echo "\t\t".$this->name."\n\t\t</td>\n\t<td valign=top bgcolor=lightyellow>\n";
+               echo "<ul type=square>\n";
+               for($i=0; $i<$this->values["count"]; $i++) {
+                       //echo "Displaying value ".$i."<br>\n";
+                       echo "<li>";
+                       $this->displayValue($i);
+                       echo "<br>\n";
+               }
+               echo "</ul>\n";
+               echo "</td>\n</tr>\n";
+       }
+
+       cfunction formatHTMLValues() {
+               $ct = $this->values["count"];
+               $str = "";
+               $str .= "<tr>\n\t<td valign=top bgcolor=white>\n";
+               $n = $this->getAttributeName($this->name);
+               $str .= "\t\t".$n."\n\t\t</td>\n\t<td valign=top bgcolor=lightyellow>\n\t\t<ul type=square>\n";
+       //      if ($ct > 1) {
+       //              $str .= "\t\t<ul type=square>\n";
+       //      }
+               for ($i=0; $i<$this->values["count"]; $i++) {
+                       $str .= "\t\t\t<li>";
+                       $str .= $this->formatHTMLValue($i);
+                       $str .= "<br>\n";
+               }
+               //if ($ct > 1) { $str .= "\t\t\t</ul>\n"; }
+               $str .= "\t\t\t</ul>\n\t\t</td>\n\t</tr>\n";
+               return $str;
+       }
+       
+       cfunction formatHTMLValue($index) {
+               global $FILE, $JPEGFILE, $host;
+               $p = "";
+               switch ($this->name) {
+                       case "cn":
+                               $p .= "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
+                               break;
+                       case "ou":
+                               $p .= "<a href=".$FILE."?ldap_action=list&host=".urlencode($host)."&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
+                               break;
+                       case "seealso":
+                       case "member":
+                       case "requeststo":
+                       case "errorsto":
+                       case "owner":
+                       case "lastmodifiedby":
+                       case "modifiersname":
+                               $p .= "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->values[$index]).">".ldap_dn2ufn($this->values[$index])."</a>";
+                               break;
+                       case "mail":
+                               $p .= "<a href=mailto:".$this->values[$index].">".$this->values[$index]."</a>";
+                               break;
+                       case "postaladdress":
+                       case "homepostaladdress":
+                               $i=0;
+                               $tok = strtok($this->values[$index], "$");
+                               while ($tok) {
+                                       $p .= $i." ".$tok."<br>\n";
+                                       $tok = strtok("$");
+                                       $i++;
+                               }
+                               break;
+                       case "labeledurl":
+                               $tok = strtok($this->values[$index], " ");
+                               $tok2 = strtok("\0");
+                               $p .=  '<a href='.$tok.'>'.$tok2.'</a>';
+                               break;
+                       case "lastmodifiedtime":
+                       case "modifytimestamp":
+                               $t = $this->values[$index];
+                               $hour = (int) $t[6].$t[7];
+                               $minute = (int) $t[8].$t[9];
+                               $second = (int) $t[10].$t[11];
+                               $month = (int) $t[2].$t[3];
+                               $day = (int) $t[4].$t[5];
+                               $year = (int) $t[0].$t[1];
+                               $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
+                               $date = date("h:i:sa, on l, dS of F Y", $timestamp);
+                               $p .= $date;
+                               break;
+                       case "jpegphoto":
+                               $p .= '<a href="'.$JPEGFILE.'?base_dn='.urlencode($this->dn).'"><img src="'.$JPEGFILE.'?base_dn='.urlencode($this->dn).'" alt="Image of '.$this->cn.'" border=0></a>';
+                               break;
+                       default:
+                               $p .= $this->values[$index];
+                               break;
+               }
+               return $p;
+       }
+
+       cfunction displayValue($index) {
+               //echo "ldap_entry_attribute.displayValue(".$index.")<br>\n";
+               global $FILE, $host;
+               if ($this->name == "cn") {
+                       print "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
+               }
+               else if ($this->name == "ou") {
+                       print "<a href=".$FILE."?ldap_action=list&host=".urlencode($host)."&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
+               }
+               else if ($this->name == "seealso" || $this->name == "member" || $this->name == "requeststo" || $this->name == "errorsto" || $this->name == "owner" || $this->name == "lastmodifiedby" || $this->name == "modifiersname") {
+                       print "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->values[$index]).">".ldap_dn2ufn($this->values[$index])."</a>";
+               }
+               else if ($this->name == "mail") {
+                       print "<a href=mailto:".$this->values[$index].">".$this->values[$index]."</a>";
+               }
+               else if ($this->name == "labeledurl") {
+                       $tok = strtok($this->values[$index], " ");
+                       $tok2 = strtok("\0");
+                       print '<a href='.$tok.'>'.$tok2.'</a>';
+               }
+               else if ($this->name == "lastmodifiedtime" || $this->name == "modifytimestamp") {
+                       $t = $this->values[$index];
+                       $hour = (int) $t[6].$t[7];
+                       $minute = (int) $t[8].$t[9];
+                       $second = (int) $t[10].$t[11];
+                       $month = (int) $t[2].$t[3];
+                       $day = (int) $t[4].$t[5];
+                       $year = (int) $t[0].$t[1];
+                       $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
+                       $date = date("h:i:sa, on l, dS of F Y", $timestamp);
+               //      $date = getdate($timestamp);
+               //      $date = getdate($this->values[$index]);
+               //      echo "".$date["hours"].":".$date["minutes"].",
+               //      ".$date["weekday"].",".$date["month"]." ".$date["mday"].", ".$date["year"]."<br>\n";
+                       print $date;
+               }
+               else {
+                       print $this->values[$index];
+               }
+       }
+}
+?>
diff --git a/contrib/php3-tool/include/ldap_manager.inc b/contrib/php3-tool/include/ldap_manager.inc
new file mode 100644 (file)
index 0000000..0861a9c
--- /dev/null
@@ -0,0 +1,150 @@
+<?
+include 'include/ldap_entry.inc';
+class ldap_manager {
+       var $entries;
+       var $result_identifier, $search_filter, $base_dn;
+       var $ldap_action, $host;
+       var $link_identifier;
+       var $entriesCount;
+
+       function connect($host) {
+               $this->link_identifier = ldap_connect($host);
+               if ($this->link_identifier) return 1;
+               return 0;
+       }
+
+       function disconnect() {
+               ldap_close($this->link_identifier);
+       }
+
+       function ldapTakeAction($a = "search") {
+               $func_ptr = "ldap_".$a;
+               if ($this->result_identifier = $func_ptr($this->link_identifier, $this->base_dn, $this->search_filter)) {
+                       $this->entriesCount = ldap_count_entries($this->link_identifier, $this->result_identifier);
+                       return 1;
+               }
+               return 0;
+       }
+       
+       cfunction getEntries() {
+               $i=0;
+               $entry = new ldap_entry($this->link_identifier);
+               $entry->r_e_i = ldap_first_entry($this->link_identifier, $this->result_identifier);
+               while($entry->r_e_i) {
+                       $entry->dn = ldap_get_dn($this->link_identifier, $entry->r_e_i);
+                       $entry->getAttributes();
+                       $this->entries[$i] = $entry;
+                       $i++;
+                       $r = $entry->r_e_i;
+                       $entry = new ldap_entry($this->link_identifier);
+                       $entry->r_e_i = ldap_next_entry($this->link_identifier, $r);
+               }
+//             ldap_free_result($this->result_identifier);
+       }
+
+       cfunction displayEntries() {
+               echo $this->formatHTMLEntries();
+       }
+
+       cfunction loadAttributeNames() {
+               global $attribute_names;
+               if (count($attribute_names) != 0) {
+                       //This is bullshit here..how do we make php3
+                       //preserve an array in memory between re-loads?
+                       //And no, I'm not going to send it every time
+                       //I make a subsequent request..
+                       //If we don't fix these things it won't run
+                       //on anything smaller than a StarFire 10000
+                       //EVEN THOUGH this stuff is suprisingly fast.
+                       echo "I have got attribute_names here<br>\n";
+               }
+               else {
+                       //echo "I dont have attribute_names here<br>\n";
+                       $fp = fopen("at.conf", "r");
+                       $i = 0;
+                       while (!feof($fp)) {
+                               $string = "";
+                               $foo = "";
+                               $string = fgets($fp, 80);
+                               $foo = strtok($string, ",");
+                               $attribute_names[$i][0] = $foo;
+                               $foo = strtok(",");
+                               $attribute_names[$i][1] = $foo;
+                               $foo = strtok("\n");
+                               $attribute_names[$i][2] = $foo;
+                               $i++;
+                       }
+               }
+       //      echo "Hello world:<b>".count($attribute_names)."</b>\n";
+       //      for ($i=0; $i<count($attribute_names)-1; $i++) {
+       //              echo $attribute_names[$i][0]." - <strong>".$attribute_names[$i][1]."</strong> - ".$attribute_names[$i][2]."<br>\n";
+       //      }       
+               return $attribute_names;
+       }
+       cfunction formatHTMLBaseDN($dn) {
+               global $FILE, $host;
+               $string = "";
+               $attribs = ldap_explode_dn($dn, 0);
+               $names = ldap_explode_dn($dn, 1);
+               for ($i=0; $i<$attribs["count"]; $i++) {
+                       $s = $attribs[$i];
+                       for ($j=$i+1; $j<$attribs["count"]; $j++) {
+                               $s .= ",".$attribs[$j];
+                       }
+                       if (($s[0] == "c") && ($s[1] == "n")) {
+                               $string .= "<a href=".$FILE."?ldap_action=read&base_dn=".urlencode($s).">".$names[$i]."</a>, ";
+                       }
+                       else {
+                               $string .= "<a href=".$FILE."?ldap_action=list&base_dn=".urlencode($s).">".$names[$i]."</a>, ";
+                       }
+               }
+               return $string;
+       }
+
+       cfunction formatHTMLEntries() {
+               $string = "";
+               $string .= '<table width="100%" border=1 cellpadding=0 cellspacing=0>';
+               $string .= "\n";
+               for ($i=0; $i<count($this->entries); $i++) {
+                       $e = $this->entries[$i];
+                       $string .= $e->formatHTMLAttributes();
+               }       
+               $string .= "</table>\n";
+               return $string;
+       }
+
+       cfunction calculateTime($string, $s_t, $e_t) {
+               $tok1 = strtok($s_t, " ");
+               $msecs1 = $tok1;
+               $tok1 = strtok(" ");
+               $secs1 = $tok1;
+        
+               $tok2 = strtok($e_t, " ");
+               $msecs2 = $tok2;
+               $tok2 = strtok(" ");
+               $secs2 = $tok2;
+               $t_t = (float) ($secs2 + $msecs2) - (float) ($secs1 + $msecs1);
+               echo "execution time for <b>".$string."</b> : <b>".$t_t."</b> seconds<br>\n";
+       //      echo "start: ".$secs1."<br>\n";
+       //      echo "end: ".$secs2."<br>\n";
+               return (float) $t_t;
+       }
+       
+       cfunction stripString($string, $tokens) {
+               $s = $string;
+               for ($i=0; $i<count($tokens); $i++) {
+                       $result = "";
+                       $tok = strtok($s, $tokens[$i]);
+                       while($tok) {
+                               $result .= $tok;
+                       //      echo "result = ".$result."\n";
+                               $tok = strtok($tokens[$i]);
+                       }
+                       $s = $result;
+               //      echo "s = ".$s."\n";
+               }
+       //      echo "result = ".$result."\n";
+               return $result;
+       }
+}
+?>
diff --git a/contrib/php3-tool/include/query_manager.inc b/contrib/php3-tool/include/query_manager.inc
new file mode 100644 (file)
index 0000000..0e38f24
--- /dev/null
@@ -0,0 +1,141 @@
+<?
+class query_manager {
+       function get_action() {
+               global $ldap_action;
+               if (isset ($ldap_action)) {
+                       $ldap_action = urldecode ($ldap_action);
+               }
+               else {
+                       $ldap_action = "read";
+               }
+               return $ldap_action;
+       }
+       function get_base_dn() {
+               global $base_dn;
+               if (isset ($base_dn)) {
+                       $base_dn = urldecode ($base_dn);
+               }
+               else {
+                       $base_dn = "o=University of Michigan, c=US";
+               //      $base_dn = "o=Balorda and Balorda, c=UK";
+               }
+               return $base_dn;
+       }
+
+       function get_host() {
+               global $host;
+               if (isset ($host)) {
+                       $host = urldecode($host);
+               }
+               else {
+                       $host = "localhost";
+               }
+               return $host;
+       }
+
+       function get_search_filter() {
+               global $objectclass, $attrib, $precision, $search_string;
+//             global $search_filter;
+//             if (isset ($search_filter)) {
+//                     $search_filter = urldecode($search_filter);
+//             }
+//             else {
+                       $search_filter = "(objectclass=";
+                       switch(urldecode($objectclass)) {
+                               case "People": $search_filter .= "person)";break;
+                               case "Groups": $search_filter .= "organizationalUnit)"; break;
+                               case "Joinable Groups": $search_filter .= "joinableGroup)"; break;
+                               case "Organisations": $search_filter .= "organization)"; break;
+                               default: $search_filter .= "*)"; break;
+                       }
+                       switch(urldecode($attrib)) {
+                               case "Common Name": $search_filter .= "(cn"; break;
+                               case "Surname": $search_filter .= "(sn"; break;
+                               case "Business Phone": $search_filter .= "(telephone"; break;
+                               case "E-mail": $search_filter .= "(mail"; break;
+                               case "Title": $search_filter .= "(title"; break;
+                               case "Distinguished Name": $search_filter .="(dn"; break;
+                               case "Location": $search_filter .="(l"; break;
+                               default: break;
+                       }
+                       switch(urldecode($precision)) {
+                               case "exactly matches": $search_filter .= "=".$search_string.")"; break;
+                               case "starts with": $search_filter .= "=".$search_string."*)"; break;
+                               case "ends with": $search_filter .= "=*".$search_string.")"; break;
+                               case "approximates": $search_filter .= "~=".$search_string.")"; break;
+                               case "contains": $search_filter .= "=*".$search_string."*)"; break;
+                               default: break;
+                       }
+                       $search_filter = "(&".$search_filter.")";
+               //      echo $search_filter;
+//             }
+               return $search_filter;
+       }
+
+       cfunction get_mode() {
+               global $mode;
+               if (isset ($mode)) {
+                       $mode = urldecode($mode);
+               }
+               else {
+                       $mode = "tree";
+               }
+               return $mode;
+       }
+
+       function display_form() {
+               global $lm, $FILE;
+?>             <form method=get action=<? echo $FILE; ?>>
+               <input type=text name=search_filter size=25 value="<? echo $lm->search_filter; ?>"><br>
+               <input type=hidden name=ldap_action value=search>
+               <input type=submit value="Search">
+               <input type=reset value="Clear">
+               </form>
+<?
+       }
+
+       cfunction makeForm($s) {
+               global $FILE;
+               echo "<table border=0 cellspacing=2 cellpadding=2 bgcolor=gray>\n";
+               for ($i=0; $i<count($s); $i++) {
+               $parameter = $s[$i];
+               echo "<form method=get action=".$FILE.">\n";
+               echo "<tr>\n\t<td colspan=2 align=left bgcolor=lightgrey>\n";
+               echo $parameter[0];
+               echo "\t\t</td>\n\t</tr>";
+               echo "<tr>\n\t<td align=left bgcolor=white>\n";
+               echo "\t\t<input type=submit width=80 height=30 value=".$parameter[1].">\n";
+               echo "\t\t</td>\n\t<td align=left bgcolor=lightyellow>\n";
+               echo "\t\t<input type=text size=25 name=".$parameter[2].">\n";
+               echo "\t\t</td>\n\t</tr>\n</form>\n";
+               }
+               echo "</table>\n";
+       }
+
+       cfunction display_console() {
+               echo '<table width="100%" border=0 cellspacing=2 cellpadding=2 bgcolor=gray><tr>';
+               echo '<td colspan=2 align=center valign=middle bgcolor=white><h2>LDAP Console</h2></td></tr><tr>';
+               echo '<td align=center valign=middle>';
+               $things = array(
+                       0 => array("Bind (authenticate) to the directory.", "bind", "who"),
+                       1 => array("Change the search base.", "cb", "where"),
+                       2 => array("Change information associated with an entry","change","entry"),
+                       3 => array("Create a new group entry","create","group"),
+                       4 => array("Edit a complete Directory entry","vedit","entry"),
+                       5 => array("Find an entry in the directory.","find","entry")
+               );
+               $this->makeForm($things);
+               echo '</td><td align=center valign=middle>';
+               $things = array(
+                       0 => array("Change the group base.","groupbase","where"),
+                       1 => array("Display detailed help for a function","help","command"),
+                       2 => array("Subscribe to a group.","join","group"),
+                       3 => array("List the groups owned by someone","list","who"),
+                       4 => array("List out the groups in which someone is a member.", "memberships", "who"),
+                       5 => array("Remove obsolete entries from a group.", "purge", "group")
+               );
+               $this->makeForm($things);
+               echo '</td></tr></table>';
+       }
+}
+?>
diff --git a/contrib/php3-tool/include/search_form.inc b/contrib/php3-tool/include/search_form.inc
new file mode 100644 (file)
index 0000000..6dee433
--- /dev/null
@@ -0,0 +1,80 @@
+<?
+function display_options($string) {
+?>
+       <select name="precision">
+               <option>exactly matches</option>
+               <option selected>approximates</option>
+               <option>starts with</option>
+               <option>ends with</option>
+               <option>contains</option>
+               </select>
+<?
+}
+function display_items($string) {
+?>
+       <select name="objectclass">
+               <option selected>People</option>
+               <option>Groups</option>
+               <option>Joinable Groups</option>
+               <option>Services</option>
+               <option>Organisations</option>
+               <option>Documents</option>
+               </select>
+<?
+}
+function display_attribs($string) {
+?>
+       <select name="attrib">
+               <option selected>Common Name</option>
+               <option>Surname</option>
+               <option>Business Phone</option>
+               <option>E-mail Address</option>
+               <option>Distinguished Name</option>
+               <option>Title</option>
+               <option>Location</option>
+               </select>
+<?
+}
+
+function display_base_dn($string) {
+?>
+       <select name="base_dn">
+               <option value="c=US">US</option>
+               <option value="o=University of Michigan, c=US" selected>University of Michigan</option>
+               <option value="o=Balorda and Balorda, c=UK">Balorda and Balorda</option>
+               </select>
+<?
+}
+               
+function display_simple_form() {
+       global $lm, $FILE;
+?>     <form method=form action=<? echo $FILE; ?>>
+       <input type=text name=search_filter size=25 value="<? echo $lm->search_filter; ?>"><br>
+       <input type=hidden name=ldap_action value=search>
+       <input type=submit value="Search"><input type=reset value="Clear">
+       </form><?
+}
+
+function display_advanced_form() {
+       global $lm, $FILE;
+?>
+       <table width="100%" border=1 cellspacing=0 cellpadding=0>
+       <tr>
+               <td colspan=2 bgcolor="lightyellow"> <!bgcolor=#9380DB>
+                       <p class=form>
+                       <form method=get action=<? echo $FILE; ?>>
+                       Find <?display_items("objectclass")?>
+                       within <?display_base_dn("base_dn")?>
+                       whose <?display_attribs("attrib")?><br>
+                       <?display_options("precision")?>
+                       <input type=text name=search_string size=25 value="">
+                       <input type=hidden name=ldap_action value=search>
+                       <input type=submit value="Search">
+                       </form>
+                       </p>
+                       </td>
+               </tr>
+       </table>
+<?
+}
+?>
diff --git a/contrib/php3-tool/index.php3 b/contrib/php3-tool/index.php3
new file mode 100644 (file)
index 0000000..d74a38a
--- /dev/null
@@ -0,0 +1,138 @@
+<!-- copyright, (C) Predrag Balorda, 1998 -->
+<html>
+<head>
+       <style type="text/css">
+       <!--
+       BODY {
+               font-family: lucida sans unicode;
+       }
+       B {
+               font-weight: bold;
+       }
+       P {
+               font-family: lucida sans unicode,Arial,Helvetica;
+               font-size: 12pt;
+       }
+       .form {
+               font-family: lucinda sans unicode;      
+               font-size: 10pt;
+               color: #003333;
+       }
+       H3 {
+               font-family: Verdana,Arial,Helvetica;
+               font-size: 12pt;
+               font-weight: bold;
+       }
+       .head {
+               font-size: 13pt;
+               color: #003333;
+       }
+       .subsection {
+               font-size: 12pt;
+               color: #003333;
+       }
+       -->
+       </style>
+</head>
+<body>
+<?
+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/ldap-photo.php3";
+$qm = new query_manager;
+$lm = new ldap_manager;
+$attribute_names = array();
+
+function main() {
+       $main_start_time = microtime();
+       global $lm, $qm, $FILE;
+       $qm = new query_manager;
+       $lm = new ldap_manager;
+       $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();
+       $lm->loadAttributeNames();
+       display_advanced_form();
+       if (!$lm->connect($lm->host)) {
+               echo "Couldn't connect to <b>".$lm->host."</b><br>\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."<br>\n";
+               return 0;
+       }
+       else {
+       //      echo "I got <b>".$lm->entriesCount."</b> entries for ".$lm->ldap_action." on ".$lm->search_filter." from ".$lm->base_dn."<br>\n";
+               $get_entries_s_t = microtime();
+               $lm->getEntries();
+               $get_entries_e_t = microtime();
+       //      echo "Disconnecting from <b>".$lm->host."</b><br>\n";
+               $lm->disconnect();
+       }
+       if (($qm->get_mode() == "tree") && ($lm->ldap_action == "list")) {
+               $display_entries_s_t = microtime();
+               ?><table width="100%" border=1 cellpadding=0 cellspacing=0>
+               <tr>
+                       <td bgcolor="#9380DB" align=center valign=absmiddle>
+                               <h3 class=head><?echo $lm->formatHTMLBaseDN($lm->base_dn);?></h3>
+                               </td>
+                       </tr>
+               </table>
+               <p>
+               <script language="JavaScript" src="javascript/expandable-outlines.js">
+               </script><?
+               $tokens = array( 0 => " ", 1 => ",");
+               $e = $lm->entries[0];
+               $s = ldap_dn2ufn($e->dn);
+               $firstel = $lm->stripString($s, $tokens);
+               for ($i=0; $i<count($lm->entries); $i++) {
+                       $c = "";
+                       $e = $lm->entries[$i];
+                       $s = ldap_dn2ufn($e->dn);
+                       $tin = $lm->stripString($s, $tokens);
+                       ?><div id="<? echo $tin; ?>Parent" class=parent>
+                       <h3 class=subsection>
+                       <a href="#" onClick="expandIt('<? echo $tin; ?>'); return false">
+                       <img name="imEx" src="false.gif" border=0 alt=""></a>
+                       <? $n = ldap_explode_dn($e->dn, 1); echo $n[0]; ?></h3>
+                       </div>
+                       <div id="<? echo $tin; ?>Child" class=child>
+                       <table border=1 cellspacing=0 cellpadding=0>
+                       <? $c .= $e->formatHTMLAttributes(); echo $c; ?>
+                       </table>
+                       <br>
+                       </div><?
+               }
+               ?><script language="JavaScript"><!--
+               if (NS4) {
+                       firstEl = "<? echo $firstel; ?>Parent";
+                       firstInd = getIndex(firstEl);
+                       showAll();
+                       arrange();
+               }
+               //--></script><?
+       }
+       else {
+               $display_entries_s_t = microtime();
+               $c = $lm->formatHTMLEntries();
+               echo $c;
+       }
+       $display_entries_e_t = microtime();
+//     echo "<div align=right valign=bottom>";
+//     $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<br>\n";
+//     echo "</div>";
+       return 1;
+}
+$return = main();
+?>
+</body>
+</html>
diff --git a/contrib/php3-tool/javascript/expandable-outlines.js b/contrib/php3-tool/javascript/expandable-outlines.js
new file mode 100644 (file)
index 0000000..83c1c93
--- /dev/null
@@ -0,0 +1,133 @@
+       var bV=parseInt(navigator.appVersion);
+       NS4=(document.layers) ? true : false;
+       IE4=((document.all)&&(bV>=4))?true:false;
+       ver4 = (NS4 || IE4) ? true : false;
+       function expandIt(){return}
+       function expandAll(){return}
+       isExpanded = false;
+
+       function getIndex(el) {
+               ind = null;
+               for (i=0; i<document.layers.length; i++) {
+                       whichEl = document.layers[i];
+                       if (whichEl.id == el) {
+                               ind = i;
+                               break;
+                       }
+               }
+               return ind;
+       }
+
+       function arrange() {
+               nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
+               for (i=firstInd+1; i<document.layers.length; i++) {
+                       whichEl = document.layers[i];
+                       if (whichEl.visibility != "hide") {
+                               whichEl.pageY = nextY;
+                               nextY += whichEl.document.height;
+                       }
+               }
+       }
+
+       function initIt(){
+               if (NS4) {
+                       for (i=0; i<document.layers.length; i++) {
+                               whichEl = document.layers[i];
+                               if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
+                       }
+                       arrange();
+               }
+               else {
+                       tempColl = document.all.tags("div");
+                       for (i=0; i<tempColl.length; i++) {
+                               if (tempColl(i).className == "child") tempColl(i).style.display = "none";
+                       }
+               }
+       }
+
+       function expandIt(el) {
+               if (!ver4) return;
+               if (IE4) {expandIE(el)} else {expandNS(el)}
+       }
+
+       function expandIE(el) { 
+               whichEl = eval(el + "Child");
+               whichIm = event.srcElement;
+               if (whichEl.style.display == "none") {
+                       whichEl.style.display = "block";
+                       whichIm.src = "true.gif";               
+               }
+               else {
+                       whichEl.style.display = "none";
+                       whichIm.src = "false.gif";
+               }
+       }
+
+       function expandNS(el) {
+               whichEl = eval("document." + el + "Child");
+               whichIm = eval("document." + el + "Parent.document.images['imEx']");
+               if (whichEl.visibility == "hide") {
+                       whichEl.visibility = "show";
+                       whichIm.src = "true.gif";
+               }
+               else {
+                       whichEl.visibility = "hide";
+                       whichIm.src = "false.gif";
+               }
+               arrange();
+       }
+
+       function showAll() {
+               for (i=firstInd; i<document.layers.length; i++) {
+                       whichEl = document.layers[i];
+                       whichEl.visibility = "show";
+               }
+       }
+
+       function expandAll(isBot) {
+               newSrc = (isExpanded) ? "false.gif" : "true.gif";
+       
+               if (NS4) {
+               document.images["imEx"].src = newSrc;
+                       for (i=firstInd; i<document.layers.length; i++) {
+                               whichEl = document.layers[i];
+                               if (whichEl.id.indexOf("Parent") != -1) {
+                                       whichEl.document.images["imEx"].src = newSrc;
+                               }
+                               if (whichEl.id.indexOf("Child") != -1) {
+                                       whichEl.visibility = (isExpanded) ? "hide" : "show";
+                               }
+                       }
+       
+                       arrange();
+                       if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);
+               }
+               else {
+                       divColl = document.all.tags("div");
+                       for (i=0; i<divColl.length; i++) {
+                               if (divColl(i).className == "child") {
+                                       divColl(i).style.display = (isExpanded) ? "none" : "block";
+                               }
+                       }
+                       imColl = document.images.item("imEx");
+                       for (i=0; i<imColl.length; i++) {
+                               imColl(i).src = newSrc;
+                       }
+               }
+       
+               isExpanded = !isExpanded;
+       }
+
+with (document) {
+       write("<style type='text/css'>");
+       if (NS4) {
+               write(".parent {position:absolute; visibility:hidden}");
+               write(".child {position:absolute; visibility:hidden}");
+               write(".regular {position:absolute; visibility:hidden}")
+       }
+       else {
+               write(".child {display:none}")
+       }
+       write("</style>\n");
+}
+onload = initIt;
diff --git a/contrib/php3-tool/javascript/resize.js b/contrib/php3-tool/javascript/resize.js
new file mode 100644 (file)
index 0000000..01dfc1b
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * resize.js 0.3 970811
+ * by gary smith
+ * js component for "reloading page onResize"
+ */
+
+if(!window.saveInnerWidth) {
+  window.onresize = resize;
+  window.saveInnerWidth = window.innerWidth;
+  window.saveInnerHeight = window.innerHeight;
+}
+
+function resize() {
+    if (saveInnerWidth < window.innerWidth || 
+        saveInnerWidth > window.innerWidth || 
+        saveInnerHeight > window.innerHeight || 
+        saveInnerHeight < window.innerHeight ) 
+    {
+        window.history.go(0);
+    }
+}
diff --git a/contrib/php3-tool/ldap-photo.php3 b/contrib/php3-tool/ldap-photo.php3
new file mode 100644 (file)
index 0000000..54d8c3b
--- /dev/null
@@ -0,0 +1,46 @@
+<?
+if (isset($base_dn)) {
+//     echo urldecode ($base_dn)."<br>\n";
+}
+if (isset($cn)) {
+//     echo urldecode ($cn)."<br>\n";
+}
+$link_identifier = ldap_connect("127.0.0.1");
+$result_identifier = ldap_read($link_identifier, $base_dn, 'objectclass=*');
+if(!$result_identifier) {
+       echo "No results.\n";
+}
+else {
+       $num_entries = ldap_count_entries($link_identifier, $result_identifier);
+       if ($num_entries == 0) {
+               echo "No results\n";
+               return 1;
+       }
+       Header("Content-type: image/jpeg");
+       $info = ldap_get_entries($link_identifier, $result_identifier);
+       ldap_close($link_identifier);
+       for ($i=0; $i<$info["count"]; $i++) {
+//             echo $i;
+               if ($info[$i]["cn"][0] == $cn) {
+                       //echo "<b>".$info[$i]["cn"][0]."</b><br>";
+               }
+               for ($j=0; $j<$info[$i]["count"]; $j++) {
+                       $attribute = $info[$i][$j];
+                       if (strtolower ($attribute) == "jpegphoto") {
+                       //      $file = fopen("/tmp/tmpphoto.jpg", "w");
+                       //      echo $info[$i]["jpegphoto"][0];
+                               $p = $info[$i]["jpegphoto"][0];
+                               $photo = base64_decode($p);
+                               echo $photo;
+                       //      fwrite($file, $photo);
+                       //      flush();
+                       //      fclose($file);
+                       //      $file = fopen("/tmp/tmpphoto.jpg", r);
+                       //      $contents = fread ($file, filesize("/tmp/tmpphoto.jpg"));
+                       //      fclose($file);
+                       //      echo $contents;
+                       }
+               }
+       }
+}
+?>
diff --git a/contrib/php3-tool/true.gif b/contrib/php3-tool/true.gif
new file mode 100644 (file)
index 0000000..306d341
Binary files /dev/null and b/contrib/php3-tool/true.gif differ