Code

Fixed php error message while checking for correct hsync/vsync
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Oct 2009 09:22:52 +0000 (09:22 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Oct 2009 09:22:52 +0000 (09:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14700 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/class_workstationService.inc

index 41f00a8f8a8887de0467d2a7c7ba2bafdd2144c3..5b6329e6d6addc92bc10c91172e27c56a69eca86 100644 (file)
@@ -383,13 +383,15 @@ class workservice extends plugin
         if($this->acl_is_writeable("gotoXVsync")){
           if(empty($val)){
             $message[]= msgPool::required(_("VSync"));
-          }elseif (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
+          }elseif (!preg_match ("/^\d+(\.\d+)?([+-]\d+(\.\d+)?)?$/", $val)){
             $message[]= msgPool::invalid(_("VSync"));
           } else{
-            list($v1,$v2)= preg_split ("/[-+]/", $val);
-            if ($v2 != ""){
-              if ($v1 > $v2){
-                $message[]= msgPool::invalid(_("VSync"));
+            if (!preg_match('/^\d+$/', $val)){
+              list($v1,$v2)= preg_split ("/[-+]/", $val);
+              if ($v2 != ""){
+                if ($v1 > $v2){
+                  $message[]= msgPool::invalid(_("VSync"));
+                }
               }
             }
           }
@@ -403,10 +405,12 @@ class workservice extends plugin
           }elseif (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
             $message[]= msgPool::invalid(_("HSync"));
           } else{
-            list($v1,$v2)= preg_split ("/[-+]/", $val);
-            if ($v2 != ""){
-              if ($v1 > $v2){
-                $message[]= msgPool::invalid(_("HSync"));
+            if (!preg_match('/^\d+$/', $val)){
+              list($v1,$v2)= preg_split ("/[-+]/", $val);
+              if ($v2 != ""){
+                if ($v1 > $v2){
+                  $message[]= msgPool::invalid(_("HSync"));
+                }
               }
             }
           }