Code

Some changes
[gosa.git] / plugins / admin / fai / class_faiTemplate.inc
index b33788bd56a559db4cf8a22710b97fa706e30bb7..0d1ea42a6652df1d9a77581eaf6810277d112c21 100644 (file)
@@ -66,7 +66,9 @@ class faiTemplate extends plugin
         foreach($this->sub64coded as $codeIt){
           $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
         }       
+
+        $this->SubObjects[$object['cn'][0]]['FAItemplateFile'] =base64_decode($this->readBinary("FAItemplateFile",$object['dn']));
+       
         $this->SubObjects[$object['cn'][0]]['status']      = "edited";
         $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
       }
@@ -289,6 +291,36 @@ class faiTemplate extends plugin
       show_ldap_error($ldap->get_error()); 
     }
   }
+
+  function readBinary($attr,$dn){
+    $Data  ="";
+    $ds= ldap_connect($this->config->current['SERVER']);
+    ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
+    if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") {
+      ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1);
+      ldap_set_rebind_proc($ds, array(&$this, "rebind"));
+    }
+
+    if(isset($this->config->current['TLS']) &&  $this->config->current['TLS'] == "true"){
+      ldap_start_tls($ds);
+    }
+
+    $r  = ldap_bind($ds);
+    $sr = @ldap_read($ds, $dn, $attr."=*", array($attr));
+
+    if ($sr) {
+      $ei=ldap_first_entry($ds, $sr);
+      if ($ei) {
+        if ($info = ldap_get_values_len($ds, $ei, $attr)){
+          $Data= $info[0];
+        }
+      }
+    }
+
+    /* close conncetion */
+    ldap_unbind($ds);
+    return($Data);
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: