Code

Added FAIprofile selection for Workstations
[gosa.git] / plugins / admin / fai / class_faiHookEntry.inc
index 3621552b0f9648d3eb09ec710e4f89f6197cf6e9..70ed9f85606219ec467b0bab41550f46870b7dac 100644 (file)
@@ -37,20 +37,36 @@ class faiHookEntry extends plugin
     }
   }
 
+
   function execute()
   {
     /* Fill templating stuff */
     $smarty     = get_smarty();
     $display = "";
+        
+    if(isset($_POST['ImportUpload'])){
+      if(($_FILES['ImportFile']['error']!=0)){
+        print_red(_("Please select a valid file."));
+      }else
+      if(($_FILES['ImportFile']['size']==0)){
+        print_red(_("Selected file is empty."));
+      }else{
+        $str = utf8_encode(file_get_contents($_FILES['ImportFile']['tmp_name']));
+        $this->Object_FAIscript = $str;
+      }
+    }
 
+     /* 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);
   }
@@ -80,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.");
     }