From ea127e3d7700d3253eb35cf90750c2bf658ed122 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 6 Aug 2015 12:26:58 +0545 Subject: Service Watchdog package code style --- .../servicewatchdog/services_servicewatchdog.php | 175 ++++++++++++--------- 1 file changed, 100 insertions(+), 75 deletions(-) (limited to 'config/servicewatchdog/services_servicewatchdog.php') diff --git a/config/servicewatchdog/services_servicewatchdog.php b/config/servicewatchdog/services_servicewatchdog.php index bd4d4442..6c91b98e 100644 --- a/config/servicewatchdog/services_servicewatchdog.php +++ b/config/servicewatchdog/services_servicewatchdog.php @@ -41,14 +41,16 @@ require_once("functions.inc"); require_once("service-utils.inc"); require_once("servicewatchdog.inc"); -if (!is_array($config['installedpackages']['servicewatchdog']['item'])) +if (!is_array($config['installedpackages']['servicewatchdog']['item'])) { $config['installedpackages']['servicewatchdog']['item'] = array(); +} $a_pwservices = &$config['installedpackages']['servicewatchdog']['item']; /* if a custom message has been passed along, lets process it */ -if ($_GET['savemsg']) +if ($_GET['savemsg']) { $savemsg = $_GET['savemsg']; +} if ($_GET['act'] == "del") { if ($a_pwservices[$_GET['id']]) { @@ -65,13 +67,15 @@ if (isset($_POST['Update'])) { if (is_array($_POST['notifies']) && count($_POST['notifies'])) { /* Check each service and set the notify flag only for those chosen, remove those that are unset. */ foreach ($a_pwservices as $idx => $thisservice) { - if (!is_array($thisservice)) + if (!is_array($thisservice)) { continue; + } if (in_array($idx, $_POST['notifies'])) { $a_pwservices[$idx]['notify'] = true; } else { - if (isset($a_pwservices[$idx]['notify'])) + if (isset($a_pwservices[$idx]['notify'])) { unset($a_pwservices[$idx]['notify']); + } } } } else { /* No notifies selected, remove them all. */ @@ -111,26 +115,31 @@ if (isset($_POST['del_x'])) { /* copy all services < $movebtn and not selected */ for ($i = 0; $i < $movebtn; $i++) { - if (!in_array($i, $_POST['pwservices'])) + if (!in_array($i, $_POST['pwservices'])) { $a_pwservices_new[] = $a_pwservices[$i]; + } } /* copy all selected services */ for ($i = 0; $i < count($a_pwservices); $i++) { - if ($i == $movebtn) + if ($i == $movebtn) { continue; - if (in_array($i, $_POST['pwservices'])) + } + if (in_array($i, $_POST['pwservices'])) { $a_pwservices_new[] = $a_pwservices[$i]; + } } /* copy $movebtn service */ - if ($movebtn < count($a_pwservices)) + if ($movebtn < count($a_pwservices)) { $a_pwservices_new[] = $a_pwservices[$movebtn]; + } /* copy all services > $movebtn and not selected */ for ($i = $movebtn+1; $i < count($a_pwservices); $i++) { - if (!in_array($i, $_POST['pwservices'])) + if (!in_array($i, $_POST['pwservices'])) { $a_pwservices_new[] = $a_pwservices[$i]; + } } $a_pwservices = $a_pwservices_new; servicewatchdog_cron_job(); @@ -141,7 +150,7 @@ if (isset($_POST['del_x'])) { } $closehead = false; -$pgtitle = array(gettext("Services"),gettext("Service Watchdog")); +$pgtitle = array(gettext("Services"), gettext("Service Watchdog")); include("head.inc"); ?> @@ -160,83 +169,99 @@ include("head.inc");
- - - - - - - - - - - - - - - - - + + + + - - -
- -

-
 Notify - - - + + + + + + + + + -
- - " border="0" alt="delete" /> - - " onclick="return confirm('')" /> - - " alt="add" />
+ +

+
 Notify + + + + + +
+ + " border="0" alt="delete" /> + + " onclick="return confirm('')" /> + + " alt="add" />
+
-
/> - - - - - - - - - -
" height="17" type="image" width="17" border="0" />')">" alt="delete" />
-
- + + + + + + + - + + - - + + + -
/> + + + + + + + + + +
" height="17" type="image" width="17" border="0" />')">" alt="delete" />
+
" border="0" alt="move" />" border="0" alt="move" /> + + + + + + + + +
" border="0" alt="move" />" border="0" alt="move" />
+ + " border="0" alt="delete" /> + + " onclick="return confirm('')" /> + + " alt="add" />
+
- - " border="0" alt="delete" /> - - " onclick="return confirm('')" /> - - " alt="add" /> + +
+ " /> +
+
+
-
+ +
- -
- " /> -
-
-
- -
+
-- cgit v1.2.3