From fd749fe6d5b3b39111e5bef317e10573422a3986 Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 23 Nov 2005 10:14:10 +0000 Subject: [PATCH] simplified code git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2020 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/addons/mailqueue/class_mailqueue.inc | 41 +++++--------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/plugins/addons/mailqueue/class_mailqueue.inc b/plugins/addons/mailqueue/class_mailqueue.inc index e3645eab7..989c89253 100644 --- a/plugins/addons/mailqueue/class_mailqueue.inc +++ b/plugins/addons/mailqueue/class_mailqueue.inc @@ -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)); + } } } } -- 2.30.2