diff --git a/admin.php b/admin.php
index 732ac3b..ab71185 100644
--- a/admin.php
+++ b/admin.php
@@ -73,7 +73,43 @@ if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"
// show overview page
if ($GETVars['qq'] == "index") {
- //include_once "includes/overview.php" ;
+ // do nothing
+ // show settings page
+ } else if ($GETVars['qq'] == "settings") {
+ $tmonpolld = new PollD();
+ $tmonpolld->setDBParams($db_host, $db_name, $db_user, $db_password);
+ $tmonpolld->initialize();
+
+ // If start/stop button was pressed
+ if ($_POST["PollDControl"] != "") {
+ if ($_POST["PollDControl"] == "Start") {
+ $tmonpolld->controlPollD("on");
+ } else if ($_POST["PollDControl"] == "Stop") {
+ $tmonpolld->controlPollD("off");
+ }
+ }
+
+ if ($tmonpolld->isEnabled()=="1") {
+ $polldenabled = "enabled and ".$tmonpolld->getStatus();
+ $cellcolor = "green";
+ } else {
+ $polldenabled = "disabled";
+ $cellcolor = "red";
+ }
+
+ echo "PollD Control
";
+ echo "
";
} else {
if ( ($_GET['action'] != "" && ($_GET['action'] == "edit" && $_GET['id'] != "")) || $_POST['Add'] == "Add") {
diff --git a/includes/functions.php b/includes/functions.php
index 2fb826f..7513e10 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -127,7 +127,7 @@ function initialize() {
}
- if (($_POST['Poll'] == "Poll Now!" || $_SESSION['timemachine']['date'] == "") && $queryarray[$GETVars['qq']]["polltype"]=="snapshot" || $_POST['s'] != "" && $GETVars['qq'] != "overview") {
+ if (($_POST['Poll'] == "Poll Now!" || $_SESSION['timemachine']['date'] == "") && $queryarray[$GETVars['qq']]["polltype"]=="snapshot" || $_POST['s'] != "" && $GETVars['qq'] != "overview" && $GETVars['qq'] != "index") {
$qtable = $configarray["queryarray"][$GETVars['qq']]["name"];
$sql = "SELECT MAX(TimeStamp) FROM res_".$qtable."_".$GETVars["server"];
$res = fetchArrayDB($sql, $conn);
@@ -1405,6 +1405,8 @@ function getConfigArray() {
$adminmenuarray["q=mainmenu&m=main"] = "Mainmenu";
$adminmenuarray["q=queries&m=main"] = "Queries";
$adminmenuarray["trennlinie"] = "trennlinie";
+ $adminmenuarray["q=settings&m=main"] = "Settings";
+ $adminmenuarray["trennlinie2"] = "trennlinie";
$adminmenuarray["tsmmonitor"] = "TSM Monitor";
$adminmenuarray["q=logout"] = "Logout";
$retArray["adminmenuarray"] = $adminmenuarray;
diff --git a/includes/polld.php b/includes/polld.php
index b0b4850..dba901e 100644
--- a/includes/polld.php
+++ b/includes/polld.php
@@ -481,9 +481,9 @@ function setPollDStatus($status, $lastrun, $nextrun) {
function isEnabled() {
$sql = "select enabled from log_polldstat WHERE `id`='1'";
- $enabled = $this->fireMySQLQuery($sql, TRUE);
+ $result = $this->fireMySQLQuery($sql, TRUE);
- if ($enabled != "" && $enabled[0]->enabled == "1"){
+ if ($result != "" && $result[0]->enabled == "1"){
return TRUE;
} else {
return FALSE;
@@ -492,6 +492,43 @@ function isEnabled() {
}
+/**
+ * controlPollD - enables or disables polld
+ *
+ * @param string switch on or off
+ */
+
+function controlPollD($switch = "") {
+
+ if ($switch == "on") {
+ $val = "1";
+ } else if ($switch == "off") {
+ $val = "0";
+ } else {
+ return "";
+ }
+
+ $sql = "update log_polldstat set `enabled` = '".$val."' WHERE `id`='1'";
+ $this->fireMySQLQuery($sql, FALSE);
+
+}
+
+/**
+ * get Status - returns status of PollD
+ *
+ * @returns string
+ */
+
+function getStatus() {
+
+ $sql = "select status from log_polldstat WHERE `id`='1'";
+ $result = $this->fireMySQLQuery($sql, TRUE);
+
+ return $result[0]->status;
+
+
+}
+
/**
* poll - the main function that polls the data
@@ -501,6 +538,8 @@ function isEnabled() {
function poll(){
+ $this->controlPollD("off");
+
$sleeptime = $this->getSleeptime();