]> git.sur5r.net Git - openldap/commitdiff
Update to my little php3-tool thingy - config file parsing.
authorPredrag "Pele" Balorda <pele@openldap.org>
Sat, 21 Nov 1998 20:33:20 +0000 (20:33 +0000)
committerPredrag "Pele" Balorda <pele@openldap.org>
Sat, 21 Nov 1998 20:33:20 +0000 (20:33 +0000)
contrib/php3-tool/README
contrib/php3-tool/at.conf
contrib/php3-tool/include/ldap_entry_attribute.inc
contrib/php3-tool/include/ldap_manager.inc
contrib/php3-tool/include/query_manager.inc
contrib/php3-tool/index.php3

index ff98acc8097317dc488d6940140a0e94689c62d6..6312238dc8af0dbef3f28d545cb6b0a7d3aea3e1 100644 (file)
@@ -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 ...
index 0c46a6a599ca3a1f7914aa4bff63f72cc0ce83ef..9d567611dbbeca0e92494fb7b85c7de73a15a59a 100644 (file)
@@ -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
index d20da40857313e2e35a535316e898bd8bbd06776..1d2167c2b4e7318d200e01d40a8f9f79ae564772 100644 (file)
@@ -9,19 +9,19 @@ class ldap_entry_attribute {
        }
 
        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];
+               global $prefs;
+               for ($i=0; $i<count($prefs->attribute_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; $i<count($attribute_names); $i++) {
-                       if ($attribute_names[$i][0] == $string) {
-                               return $attribute_names[$i][2];
+               global $prefs;
+               for ($i=0; $i<count($prefs->attribute_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 .= '<a href="'.$JPEGFILE.'?base_dn='.urlencode($this->dn).'"><img src="'.$JPEGFILE.'?base_dn='.urlencode($this->dn).'" alt="Image of '.$this->cn.'" border=0></a>';
+                               $p .= '<a href="'.$prefs->get("PATH.photo").'?base_dn='.urlencode($this->dn).'"><img src="'.$prefs->get("PATH.photo").'?base_dn='.urlencode($this->dn).'" alt="Image of '.$this->cn.'" border=0></a>';
                                break;
                        default:
                                $p .= $this->values[$index];
index 0861a9c1d95123fa25a74b9c8674ca04ccccb222..6db3fc79110614f355d996839a8e1bb97247001d 100644 (file)
@@ -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<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 = "";
index 0e38f24f71a907771356ebde96a8962768e32ac9..a5a40210e55b5e75ee766f2eb07c10f1af6c2890 100644 (file)
@@ -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;
index d74a38af5a3c0243127c536a04aec646c8fe8b4f..c7c89190aee471d5d9e345eef2168311c47cf0e9 100644 (file)
@@ -1,60 +1,33 @@
-<!-- copyright, (C) Predrag Balorda, 1998 -->
+<!DOCTYPE PUBLIC HTML "-//W3C//HTML3.2 Final//En">
 <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>
+       <!-- copyright, (C) Predrag Balorda, OpenLDAP Foundation, 1998 -->
+       <title>PHP3 Thingy</title>
+       <link rel="stylesheet" type="text/css" href="style.css">
 </head>
 <body>
 <?
+include ('include/preferences.inc');
 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";
+$JPEGFILE = "http://$HTTP_HOST/ldap/php3-tool/ldap-photo.php3";
 $qm = new query_manager;
 $lm = new ldap_manager;
-$attribute_names = array();
+$prefs = new preferences;
 
 function main() {
        $main_start_time = microtime();
-       global $lm, $qm, $FILE;
+       global $lm, $qm, $prefs, $FILE;
        $qm = new query_manager;
        $lm = new ldap_manager;
+       $prefs = new preferences;
        $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();
+       $prefs->loadPreferences();
        display_advanced_form();
        if (!$lm->connect($lm->host)) {
                echo "Couldn't connect to <b>".$lm->host."</b><br>\n";