From: Kurt Zeilenga Date: Tue, 27 Oct 1998 18:11:59 +0000 (+0000) Subject: Initial revision X-Git-Tag: PHP3_TOOL_0_0~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=653846f8e90f4fde5d7e5977d33e173d247df10e;p=openldap Initial revision --- diff --git a/contrib/php3-tool/COPYRIGHT b/contrib/php3-tool/COPYRIGHT new file mode 100644 index 0000000000..cf1515dd54 --- /dev/null +++ b/contrib/php3-tool/COPYRIGHT @@ -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 index 0000000000..5731d2cffd --- /dev/null +++ b/contrib/php3-tool/LICENSE @@ -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 index 0000000000..345c8a8e82 --- /dev/null +++ b/contrib/php3-tool/Makefile @@ -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 index 0000000000..ff98acc809 --- /dev/null +++ b/contrib/php3-tool/README @@ -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 index 0000000000..0c46a6a599 --- /dev/null +++ b/contrib/php3-tool/at.conf @@ -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 index 0000000000..0c46a6a599 --- /dev/null +++ b/contrib/php3-tool/at.conf2 @@ -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 index 0000000000..b5a6fb3dd6 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 index 0000000000..e9067b2030 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 index 0000000000..a11cead6f8 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 index 0000000000..c316c834a7 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 index 0000000000..701c16c778 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 index 0000000000..5803c1d50a 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 index 0000000000..1a3b056898 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 index 0000000000..536dbc9a1b 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 index 0000000000..96b709eaf0 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 index 0000000000..2a8fd4f300 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 index 0000000000..c60c811a60 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 index 0000000000..7284af16f3 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 index 0000000000..9aa42400ca 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 index 0000000000..6a62ac8b2a 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 index 0000000000..d3f19d862d --- /dev/null +++ b/contrib/php3-tool/include/ldap_entry.inc @@ -0,0 +1,110 @@ +\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 .= "".$names[$i].""; + } + else { + $string .= "".$names[$i].""; + } + if ($i<$attribs["count"]-1) { $string .= ", "; } + } + return $string; + } + + cfunction formatHTMLAttributes() { + global $FILE, $host; + $s = ""; + $s .= "\n\t"; + $s .= ''; + $s .= "\n\t\t

".$this->formatHTMLDN($this->dn)."

\n"; + $s .= "\t\t\n\t\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 .= "\n\t\n"; + $s .= "\t\tdn).">Browse\n"; + $s .= "\t\t\n\t\n"; + } + else { + $s .= "\n\t\n\t\t \n\t\t\n\t\n"; + } + return $s; + } + + cfunction display() { + global $FILE, $host; + echo ""; + echo "

".ldap_dn2ufn($this->dn)."

"; + echo ""; + $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 ""; + echo "dn).">Browse"; + echo ""; + } + else { + echo " "; + } + } +} +?> diff --git a/contrib/php3-tool/include/ldap_entry_attribute.inc b/contrib/php3-tool/include/ldap_entry_attribute.inc new file mode 100644 index 0000000000..d20da40857 --- /dev/null +++ b/contrib/php3-tool/include/ldap_entry_attribute.inc @@ -0,0 +1,169 @@ +\n"; + $this->dn = $d; + $a = ldap_explode_dn($this->dn, 1); + $this->cn = $a[0]; + } + + cfunction getAttributeName($string) { + global $attribute_names; + for ($i=0; $iname."
\n"; + $this->values = ldap_get_values($l_i, $r_e_i, $this->name); + } + + cfunction display() { + echo "\n\t\n"; + echo "\t\t".$this->name."\n\t\t\n\t\n"; + echo "\n"; + echo "\n\n"; + } + + cfunction formatHTMLValues() { + $ct = $this->values["count"]; + $str = ""; + $str .= "\n\t\n"; + $n = $this->getAttributeName($this->name); + $str .= "\t\t".$n."\n\t\t\n\t\n\t\t\n\t\t\n\t\n"; + return $str; + } + + cfunction formatHTMLValue($index) { + global $FILE, $JPEGFILE, $host; + $p = ""; + switch ($this->name) { + case "cn": + $p .= "dn).">".$this->values[$index].""; + break; + case "ou": + $p .= "dn).">".$this->values[$index].""; + break; + case "seealso": + case "member": + case "requeststo": + case "errorsto": + case "owner": + case "lastmodifiedby": + case "modifiersname": + $p .= "values[$index]).">".ldap_dn2ufn($this->values[$index]).""; + break; + case "mail": + $p .= "values[$index].">".$this->values[$index].""; + break; + case "postaladdress": + case "homepostaladdress": + $i=0; + $tok = strtok($this->values[$index], "$"); + while ($tok) { + $p .= $i." ".$tok."
\n"; + $tok = strtok("$"); + $i++; + } + break; + case "labeledurl": + $tok = strtok($this->values[$index], " "); + $tok2 = strtok("\0"); + $p .= ''.$tok2.''; + 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 .= 'Image of '.$this->cn.''; + break; + default: + $p .= $this->values[$index]; + break; + } + return $p; + } + + cfunction displayValue($index) { + //echo "ldap_entry_attribute.displayValue(".$index.")
\n"; + global $FILE, $host; + if ($this->name == "cn") { + print "dn).">".$this->values[$index].""; + } + else if ($this->name == "ou") { + print "dn).">".$this->values[$index].""; + } + else if ($this->name == "seealso" || $this->name == "member" || $this->name == "requeststo" || $this->name == "errorsto" || $this->name == "owner" || $this->name == "lastmodifiedby" || $this->name == "modifiersname") { + print "values[$index]).">".ldap_dn2ufn($this->values[$index]).""; + } + else if ($this->name == "mail") { + print "values[$index].">".$this->values[$index].""; + } + else if ($this->name == "labeledurl") { + $tok = strtok($this->values[$index], " "); + $tok2 = strtok("\0"); + print ''.$tok2.''; + } + 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"]."
\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 index 0000000000..0861a9c1d9 --- /dev/null +++ b/contrib/php3-tool/include/ldap_manager.inc @@ -0,0 +1,150 @@ +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
\n"; + } + else { + //echo "I dont have attribute_names here
\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:".count($attribute_names)."\n"; + // for ($i=0; $i".$attribute_names[$i][1]." - ".$attribute_names[$i][2]."
\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 .= "".$names[$i].", "; + } + else { + $string .= "".$names[$i].", "; + } + } + return $string; + } + + cfunction formatHTMLEntries() { + $string = ""; + $string .= ''; + $string .= "\n"; + for ($i=0; $ientries); $i++) { + $e = $this->entries[$i]; + $string .= $e->formatHTMLAttributes(); + } + $string .= "
\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 ".$string." : ".$t_t." seconds
\n"; + // echo "start: ".$secs1."
\n"; + // echo "end: ".$secs2."
\n"; + return (float) $t_t; + } + + cfunction stripString($string, $tokens) { + $s = $string; + for ($i=0; $i diff --git a/contrib/php3-tool/include/query_manager.inc b/contrib/php3-tool/include/query_manager.inc new file mode 100644 index 0000000000..0e38f24f71 --- /dev/null +++ b/contrib/php3-tool/include/query_manager.inc @@ -0,0 +1,141 @@ +
> +
+ + + +
+\n"; + for ($i=0; $i\n"; + echo "\n\t\n"; + echo $parameter[0]; + echo "\t\t\n\t"; + echo "\n\t\n"; + echo "\t\t\n"; + echo "\t\t\n\t\n"; + echo "\t\t\n"; + echo "\t\t\n\t\n\n"; + } + echo "\n"; + } + + cfunction display_console() { + echo ''; + echo ''; + echo '

LDAP Console

'; + $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 ''; + $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 '
'; + } +} +?> diff --git a/contrib/php3-tool/include/search_form.inc b/contrib/php3-tool/include/search_form.inc new file mode 100644 index 0000000000..6dee433ad7 --- /dev/null +++ b/contrib/php3-tool/include/search_form.inc @@ -0,0 +1,80 @@ + + + + + + + + +
> +
+ + +
+ + + + +
+

+

> + Find + within + whose
+ + + + +
+

+
+ diff --git a/contrib/php3-tool/index.php3 b/contrib/php3-tool/index.php3 new file mode 100644 index 0000000000..d74a38af5a --- /dev/null +++ b/contrib/php3-tool/index.php3 @@ -0,0 +1,138 @@ + + + + + + +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 ".$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);?>

+
+

+ " ", 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); + ?>

+

+ + + dn, 1); echo $n[0]; ?>

+
+
+ + formatHTMLAttributes(); echo $c; ?> +
+
+
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(); +?> + + diff --git a/contrib/php3-tool/javascript/expandable-outlines.js b/contrib/php3-tool/javascript/expandable-outlines.js new file mode 100644 index 0000000000..83c1c937af --- /dev/null +++ b/contrib/php3-tool/javascript/expandable-outlines.js @@ -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"); + 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("\n"); +} +onload = initIt; diff --git a/contrib/php3-tool/javascript/resize.js b/contrib/php3-tool/javascript/resize.js new file mode 100644 index 0000000000..01dfc1b80f --- /dev/null +++ b/contrib/php3-tool/javascript/resize.js @@ -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 index 0000000000..54d8c3b8d0 --- /dev/null +++ b/contrib/php3-tool/ldap-photo.php3 @@ -0,0 +1,46 @@ +\n"; +} +if (isset($cn)) { +// echo urldecode ($cn)."
\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 "".$info[$i]["cn"][0]."
"; + } + 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 index 0000000000..306d3416ed Binary files /dev/null and b/contrib/php3-tool/true.gif differ