Code

Check for invalid names first before trimming name, catching trailing
authorwolffc <wolffc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Sep 2010 14:38:38 +0000 (14:38 +0000)
committerwolffc <wolffc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Sep 2010 14:38:38 +0000 (14:38 +0000)
spaces at the end or beginning

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@19721 594d385d-05f5-0310-b6e9-bd551577e9d8

trunk/gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc

index db8366b1b2fee0d83bdad0e9cf782df4db72d3b0..7600ac934b66b80b9b85cdae65f59201c8efa07d 100644 (file)
@@ -137,14 +137,13 @@ class faiScriptEntry extends plugin
       $message[] = msgPool::duplicated(_("Name"));
     }
 
-    $c = trim($this->cn);
-    if($c == ""){
-      $message[] = msgPool::required(_("Name"));
-    }
-    if(preg_match("/[^a-z0-9_\-]/i",$c)){
-      $message[] = msgPool::invalid(_("Name"),$c,"/[a-z0-9_\-]/i");
+    if(preg_match("/[^a-z0-9_\-]/i",$this->cn)){
+      $message[] = msgPool::invalid(_("Name"),$this->cn,"/[a-z0-9_\-]/i");
     }
 
+    if(trim($this->cn)  == ""){
+      $message[] = msgPool::required(_("Name"));
+    }
     $s = trim($this->FAIscript);
     if($s == ""){
       $message[]= msgPool::required(_("Script"));