Code

Added FAIprofile selection for Workstations
[gosa.git] / plugins / admin / fai / class_faiHookEntry.inc
index 5dd08ab682531b8668f298f82871cbdfc38ad789..70ed9f85606219ec467b0bab41550f46870b7dac 100644 (file)
@@ -35,36 +35,9 @@ class faiHookEntry extends plugin
       $this->Object_status = "new";
       $this->orig_cn       = false;
     }
-
-    if(isset($this->Object_FAIscript)){
-      $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, $this->dn, "FAIscript=*", array("FAIscript"));
-      if ($sr) {
-        $ei=ldap_first_entry($ds, $sr);
-        if ($ei) {
-          if ($info = ldap_get_values_len($ds, $ei, "FAIscript")){
-            $this->Object_FAIscript = base64_decode($info[0]);
-          }
-        }
-      }
-
-      /* close conncetion */
-      ldap_unbind($ds);
-    }
-
   }
 
+
   function execute()
   {
     /* Fill templating stuff */
@@ -83,14 +56,17 @@ class faiHookEntry extends plugin
       }
     }
 
+     /* Magic quotes GPC, escapes every ' " \, to solve some security risks
+     * If we post the escaped strings they will be escaped again
+     */
     foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,stripslashes($this->$attrs));
+      if(get_magic_quotes_gpc()){
+        $smarty->assign($attrs,stripslashes($this->$attrs));
+      }else{
+        $smarty->assign($attrs,($this->$attrs));
+      }
     }
 
-    for($i =1 ; $i <= 100 ; $i++){
-      $Object_FAIprioritys[$i]=$i;
-    }
-    $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys);
     $display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE));
     return($display);
   }
@@ -120,12 +96,6 @@ class faiHookEntry extends plugin
       $message[]=_("Please enter a value for script.");
     }
 
-    $str = utf8_encode("üöä");
-
-    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->Object_description)){
-      $message[] = _("Invalid character in description. Please enter a valid description.");
-    }
-
     if(empty($this->Object_cn)){
       $message[] = _("Please enter a name.");
     }