From: Predrag "Pele" Balorda Date: Sat, 21 Nov 1998 20:33:20 +0000 (+0000) Subject: Update to my little php3-tool thingy - config file parsing. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~1062 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=744be28b328cb7a120d6d8e8f7383be7009782d4;p=openldap Update to my little php3-tool thingy - config file parsing. --- diff --git a/contrib/php3-tool/README b/contrib/php3-tool/README index ff98acc809..6312238dc8 100644 --- a/contrib/php3-tool/README +++ b/contrib/php3-tool/README @@ -1,6 +1,29 @@ -blah blah blah yadda yadda yadda don't forget to modify at.conf -blah blah -/me hopes you'll like this +This is the first version of this README +php3-tool v0.2gamma +This package has been tested and run with apache/php3 and OpenLDAP 1.1-devel +Look at the php3tool.conf (no need to at present) . The file format is exactly +the same as CSS1/2. No particular reason, just that I like it.. +So you have something like: +PATH { + attributes: "at.conf"; + photo: "ldap-photo.php3"; +} + +Section PATH, which has following attribute-value pairs: +attributes: "at.conf" +this pair defines where the schema stuff is. +photo: "ldap-photo.php3"; +this pair defines which script to use to fetch and convert photos for an entry. + +Also look at the at.conf (where all your schema stuff is). Format of at.conf is like follows: +string,Human Readable Representation,VISIBLE +So, for example +homephone,Home Telephone Number,TRUE +will _show_ anyone's home phone if it is present and will display it as "Home Telephone Number". I think the rest is self-explanatory. + +I really couldn't think of anything else to put here (at the moment that is). But please feel free to add whatever else you consider neccessary to understanding how this thing works. Enjoy, and I hope this can be useful to you in some miniscule way. + +Pele 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 index 0c46a6a599..9d567611db 100644 --- a/contrib/php3-tool/at.conf +++ b/contrib/php3-tool/at.conf @@ -14,7 +14,7 @@ homephone,Home Telephone Number,TRUE homepostaladdress,Home Postal Address,TRUE joinable,Can be joined,TRUE jpegphoto,Photograph,TRUE -krbname,Kerberos Name,TRUE +krbname,Kerberos Name,FALSE l,Location,TRUE labeledurl,Web Page,TRUE lastmodifiedby,Last Modified by,TRUE @@ -28,10 +28,10 @@ modifytimestamp,Modified at,TRUE modifiersname,Modified by,TRUE multilinedescription,Multi-lined description,TRUE naminglink,Naming Link,TRUE -nobatchupdates,No Batch Updates,TRUE +nobatchupdates,No Batch Updates,FALSE notice,Notice,TRUE o,Organization,TRUE -objectclass,Object Class,TRUE +objectclass,Object Class,FALSE onvacation,On Vacation,TRUE ou,Organizational Unit,TRUE owner,Owner,TRUE diff --git a/contrib/php3-tool/include/ldap_entry_attribute.inc b/contrib/php3-tool/include/ldap_entry_attribute.inc index d20da40857..1d2167c2b4 100644 --- a/contrib/php3-tool/include/ldap_entry_attribute.inc +++ b/contrib/php3-tool/include/ldap_entry_attribute.inc @@ -9,19 +9,19 @@ class ldap_entry_attribute { } cfunction getAttributeName($string) { - global $attribute_names; - for ($i=0; $iattribute_names); $i++) { + if ($prefs->attribute_names[$i][0] == $string) { + return $prefs->attribute_names[$i][1]; } } return $string; } cfunction isVisible($string) { - global $attribute_names; - for ($i=0; $iattribute_names); $i++) { + if ($prefs->attribute_names[$i][0] == $string) { + return $prefs->attribute_names[$i][2]; } } return "FALSE"; @@ -66,7 +66,7 @@ class ldap_entry_attribute { } cfunction formatHTMLValue($index) { - global $FILE, $JPEGFILE, $host; + global $prefs, $FILE, $host; $p = ""; switch ($this->name) { case "cn": @@ -116,7 +116,7 @@ class ldap_entry_attribute { $p .= $date; break; case "jpegphoto": - $p .= 'Image of '.$this->cn.''; + $p .= 'Image of '.$this->cn.''; break; default: $p .= $this->values[$index]; diff --git a/contrib/php3-tool/include/ldap_manager.inc b/contrib/php3-tool/include/ldap_manager.inc index 0861a9c1d9..6db3fc7911 100644 --- a/contrib/php3-tool/include/ldap_manager.inc +++ b/contrib/php3-tool/include/ldap_manager.inc @@ -46,41 +46,6 @@ class ldap_manager { 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 = ""; diff --git a/contrib/php3-tool/include/query_manager.inc b/contrib/php3-tool/include/query_manager.inc index 0e38f24f71..a5a40210e5 100644 --- a/contrib/php3-tool/include/query_manager.inc +++ b/contrib/php3-tool/include/query_manager.inc @@ -52,7 +52,7 @@ class query_manager { 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 "E-mail Address": $search_filter .= "(mail"; break; case "Title": $search_filter .= "(title"; break; case "Distinguished Name": $search_filter .="(dn"; break; case "Location": $search_filter .="(l"; break; diff --git a/contrib/php3-tool/index.php3 b/contrib/php3-tool/index.php3 index d74a38af5a..c7c89190ae 100644 --- a/contrib/php3-tool/index.php3 +++ b/contrib/php3-tool/index.php3 @@ -1,60 +1,33 @@ - + - + + PHP3 Thingy + 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(); + $prefs->loadPreferences(); display_advanced_form(); if (!$lm->connect($lm->host)) { echo "Couldn't connect to ".$lm->host."
\n";