Code

simplified code
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Nov 2005 10:14:10 +0000 (10:14 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Nov 2005 10:14:10 +0000 (10:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2020 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/addons/mailqueue/class_mailqueue.inc

index e3645eab7f2fd44ceb2b610b14328cf8793d20c2..989c89253fd357b04dd528cd990b70e964ed9205 100644 (file)
@@ -95,38 +95,17 @@ class mailqueue extends plugin
       }     
 
       if(!$error){
-        /* Delete entry if requested */
-        if((isset($_GET['act']))&&($_GET['act']=="del")){
-          if($mailQueueParser->IDExists($_GET['id'])){
-            $r_cmd = preg_replace("/%action/" ,"remove"      ,$this->mailQueueScript);
-            $r_cmd = preg_replace("/%server/" ,$_GET['server'] ,$r_cmd);
-            $r_cmd = preg_replace("/%id/"     ,$_GET['id']  ,$r_cmd);
-            if(!shell_exec($r_cmd)){
-              print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
-            }
-          }
-        }
-
-        /* Hold entry if requested */
-        if((isset($_GET['act']))&&($_GET['act']=="hold")){
-          if($mailQueueParser->IDExists($_GET['id'])){
-            $r_cmd = preg_replace("/%action/" ,"hold"          ,$this->mailQueueScript);
-            $r_cmd = preg_replace("/%server/" ,$_GET['server'] ,$r_cmd);
-            $r_cmd = preg_replace("/%id/"     ,$_GET['id']     ,$r_cmd);
-            if(!shell_exec($r_cmd)){
-              print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
-            }
-          }
-        }
 
-        /* Requeue entry if requested */
-        if((isset($_GET['act']))&&($_GET['act']=="requeue")){
-          if($mailQueueParser->IDExists($_GET['id'])){
-            $r_cmd = preg_replace("/%action/" ,"requeue"       ,$this->mailQueueScript);
-            $r_cmd = preg_replace("/%server/" ,$_GET['server'] ,$r_cmd);
-            $r_cmd = preg_replace("/%id/"     ,$_GET['id']     ,$r_cmd);
-            if(!shell_exec($r_cmd)){
-              print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
+        /* Check for actions */
+        foreach (array("requeue", "unhold", "hold", "del") as $type){
+          if((isset($_GET['act']))&&($_GET['act']=="$type")){
+            if($mailQueueParser->IDExists($_GET['id'])){
+              $r_cmd = preg_replace("/%action/" ,"$type"        ,$this->mailQueueScript);
+              $r_cmd = preg_replace("/%server/" ,$_GET['server'] ,$r_cmd);
+              $r_cmd = preg_replace("/%id/"     ,$_GET['id']     ,$r_cmd);
+              if(!shell_exec($r_cmd)){
+                print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
+              }
             }
           }
         }