From 5624331190b16f702fa2502abd240eeeb1ac5d77 Mon Sep 17 00:00:00 2001 From: Michael Clemens Date: Mon, 18 May 2009 11:37:07 +0000 Subject: [PATCH] reformatted/beautified most files --- admin.php | 545 ++++++++++++----------- includes/adodb.php | 248 +++++------ includes/config.php | 28 +- includes/footer.php | 44 +- includes/global.php | 38 +- includes/login.php | 68 +-- includes/overview.php | 100 ++--- includes/page_head.php | 121 +++-- includes/pdf.php | 58 ++- includes/polld.php | 48 +- includes/show_pdf.php | 34 +- includes/topnav.php | 51 ++- includes/tsmmonitor.php | 954 ++++++++++++++++++++-------------------- index.php | 318 +++++++------- polld/tmonpolld.php | 28 +- 15 files changed, 1337 insertions(+), 1346 deletions(-) diff --git a/admin.php b/admin.php index a9909e0..62e70e2 100644 --- a/admin.php +++ b/admin.php @@ -1,23 +1,23 @@ . -************************************************************************ -*/ + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . + ************************************************************************ + */ /** * @@ -33,284 +33,281 @@ include_once "includes/global.php"; include_once "includes/page_head.php"; if ($_SESSION["logindata"]["role"]!="admin") { - $_SESSION["logindata"] = ""; + $_SESSION["logindata"] = ""; } if ($_POST["css"] != "") { - $_SESSION['stylesheet'] = $_POST["css"]; + $_SESSION['stylesheet'] = $_POST["css"]; } ?> - - - - - - - - + + + + + + - - - - - - -
-
- - - - - + + + + + +
+
+ + + + + GETVars['qq'] != "logout" && $_SESSION["logindata"]["loggedin"]) { + if ($tsmmonitor->GETVars['qq'] != "" && $tsmmonitor->GETVars['qq'] != "overview") { -// main content, right of menu -if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"]) && $tsmmonitor->GETVars['qq'] != "logout" && $_SESSION["logindata"]["loggedin"]) { - if ($tsmmonitor->GETVars['qq'] != "" && $tsmmonitor->GETVars['qq'] != "overview") { + // show overview page + if ($tsmmonitor->GETVars['qq'] == "index") { + // do nothing + // show settings page + } else if ($tsmmonitor->GETVars['qq'] == "settings") { + $tmonpolld = new PollD($adodb); + $tmonpolld->adodb->setDebug($_SESSION["debug"]); - // show overview page - if ($tsmmonitor->GETVars['qq'] == "index") { - // do nothing - // show settings page - } else if ($tsmmonitor->GETVars['qq'] == "settings") { - $tmonpolld = new PollD($adodb); - $tmonpolld->adodb->setDebug($_SESSION["debug"]); + // 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 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"; + } - if ($tmonpolld->isEnabled()=="1") { - $polldenabled = "enabled and ".$tmonpolld->getStatus(); - //$cellcolor = "green"; - } else { - $polldenabled = "disabled"; - //$cellcolor = "red"; - } + echo "
"; + echo ""; + echo ""; + echo ""; + echo " "; + echo " "; + echo " "; + echo ""; + echo ""; + echo " "; + echo " "; + echo " "; + echo ""; + echo ""; + echo " "; + echo " "; + echo " "; + echo ""; + echo "
ConfigurationActionStatus
PollD Control"; + echo " "; + echo " "; + echo " PollD is ".$polldenabled."
Debug Mode"; + echo " "; + echo " "; + echo " ".$_SESSION["debug"]."
PollD Control"; + echo " "; + echo " "; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo "
"; + echo "
"; - echo "
"; - echo ""; - echo ""; - echo ""; - echo " "; - echo " "; - echo " "; - echo ""; - echo ""; - echo " "; - echo " "; - echo " "; - echo ""; - echo ""; - echo " "; - echo " "; - echo " "; - echo ""; - echo "
ConfigurationActionStatus
PollD Control"; - echo " "; - echo " "; - echo " PollD is ".$polldenabled."
Debug Mode"; - echo " "; - echo " "; - echo " ".$_SESSION["debug"]."
PollD Control"; - echo " "; - echo " "; - echo "
"; - echo " "; + echo ""; + foreach ($sqlresth as $col) { + echo "TEST: ".$col['Field']." -> $colval
\n"; + if ($col['Field'] != "id") { + if ($i == 0) { + echo ""; + $i = 1; + } else { + echo ""; + $i = 0; + } + if ($col['Field'] == "password") { + echo ""; + } else { + echo ""; + } + } + } + echo ""; + echo "
KeyValue
".$col['Field']."
".$col['Field']."
"; + + // show Edit Existing Entry Form + } else { + $tablearray = $tsmmonitor->getAdminTables("edit"); + echo "
"; + echo ""; + echo ""; + foreach ($tablearray as $row) { + while(list($keycell, $valcell) = each($row)) { + if ($i == 0) { + echo ""; + $i = 1; + } else { + echo ""; + $i = 0; + } + if ($keycell == "password") { + echo ""; + } else if ($keycell == "id") { + $id = $valcell; + } else { + echo ""; + } + } + } + echo ""; + + echo "
KeyValue
".$keycell."
".$keycell."
"; + } + + // show List of all entries + } else { + // Process deletion of an item + if ( $_GET['id'] != "" && $_GET['action'] != "") { + if ($_GET['action'] == "delete") { + echo $_POST['hidfield']; + $sql = "DELETE from cfg_".$_GET['q']." where id='".$_GET['id']."' LIMIT 1"; + $adodb->execDB($sql); + } + // Process update of an existing item or insert of a new one + } else if ($_POST['EditSave'] == "Save" || $_POST['AddSave'] == "Save") { + $sqlth = "SHOW COLUMNS from cfg_".$_GET['q']; + $sqlresth = $adodb->fetchArrayDB($sqlth); + $colarray = array(); + $colarray['id'] = $_POST['id']; + $set = ""; + $sqlcols = ""; + $sqlvals = ""; + + // get all table fields to be selected + foreach ($sqlresth as $col) { + if ($col['Field'] != "id") { + if ($col['Field'] == "password") { + if ($_POST["txt".$col['Field']] != "") { + $val = md5($_POST["txt".$col['Field']]); + } else { + $val = ""; + } + } else { + $val = $_POST["txt".$col['Field']]; + } + if ($val != "") { + if ($_POST['AddSave'] == "Save") { + $colarray["`".$col['Field']."`"] = $val; + $sqlcols .= $col['Field']; + $sqlvals .= "'".$val."'"; + $sqlcols .= ", "; + $sqlvals .= ", "; + } else if ($_POST['EditSave'] == "Save") { + $colarray["`".$col['Field']."`"] = $val; + $set .= $col['Field']."='".$val."'"; + $set .= ", "; + } + } + } + } + $sqlcols = ereg_replace(", $", "", $sqlcols); + $sqlvals = ereg_replace(", $", "", $sqlvals); + if ($_POST['AddSave'] == "Save") { + $sql = "INSERT into cfg_".$_GET['q']." (".$sqlcols.") values (".$sqlvals.")"; + } else if ($_POST['EditSave'] == "Save") { + $sql = "UPDATE cfg_".$_GET['q']." set ".$set." where id='".$_POST['id']."' LIMIT 1"; + } + $adodb->updateDB("cfg_".$_GET['q'], $colarray, 'id'); + } + echo "
"; + echo ""; + echo $tsmmonitor->getTableheader(); + echo $tsmmonitor->getAdminTables("list"); + $nav = $tsmmonitor->showPageNavigation("40"); + if ($nav!="") { + echo ""; + } + echo "
"; + echo ""; + echo "
"; + } } - echo " "; - echo "
"; - echo " "; - echo " "; - echo " "; - echo " "; - echo " "; - echo " "; - echo " "; - echo "
"; - echo "
"; - echo ""; + } + } else { + if (isset($_SESSION["logindata"])) { + $errormsg = "Login failed!"; + } else { + $errormsg = "Login"; + } - } else { - if ( ($_GET['action'] != "" && ($_GET['action'] == "edit" && $_GET['id'] != "")) || $_POST['Add'] == "Add") { - $i = 0; - // show Add New Entry Form - if ($_POST['Add'] == "Add") { - $sqlth = "SHOW COLUMNS from cfg_".$tsmmonitor->GETVars['qq']; - $sqlresth = $adodb->fetchArrayDB($sqlth); - echo "
"; - echo ""; - echo ""; - foreach ($sqlresth as $col) { -echo "TEST: ".$col['Field']." -> $colval
\n"; - if ($col['Field'] != "id") { - if ($i == 0) { - echo ""; - $i = 1; - } else { - echo ""; - $i = 0; - } - if ($col['Field'] == "password") { - echo ""; - } else { - echo ""; - } - } - } - echo ""; - echo "
KeyValue
".$col['Field']."
".$col['Field']."
"; + session_unset(); + $_SESSION=array(); + include_once "includes/login.php"; - // show Edit Existing Entry Form - } else { - $tablearray = $tsmmonitor->getAdminTables("edit"); - echo "
"; - echo ""; - echo ""; - foreach ($tablearray as $row) { - while(list($keycell, $valcell) = each($row)) { - if ($i == 0) { - echo ""; - $i = 1; - } else { - echo ""; - $i = 0; - } - if ($keycell == "password") { - echo ""; - } else if ($keycell == "id") { - $id = $valcell; - } else { - echo ""; - } - } - } - echo ""; + } + $_SESSION['from'] = $tsmmonitor->GETVars['qq']; + session_write_close(void); + ?> + + - echo "
KeyValue
".$keycell."
".$keycell."
"; - } + - // show List of all entries - } else { - // Process deletion of an item - if ( $_GET['id'] != "" && $_GET['action'] != "") { - if ($_GET['action'] == "delete") { - echo $_POST['hidfield']; - $sql = "DELETE from cfg_".$_GET['q']." where id='".$_GET['id']."' LIMIT 1"; - $adodb->execDB($sql); - } - // Process update of an existing item or insert of a new one - } else if ($_POST['EditSave'] == "Save" || $_POST['AddSave'] == "Save") { - $sqlth = "SHOW COLUMNS from cfg_".$_GET['q']; - $sqlresth = $adodb->fetchArrayDB($sqlth); - $colarray = array(); - $colarray['id'] = $_POST['id']; - $set = ""; - $sqlcols = ""; - $sqlvals = ""; - - // get all table fields to be selected - foreach ($sqlresth as $col) { - if ($col['Field'] != "id") { - if ($col['Field'] == "password") { - if ($_POST["txt".$col['Field']] != "") { - $val = md5($_POST["txt".$col['Field']]); - } else { - $val = ""; - } - } else { - $val = $_POST["txt".$col['Field']]; - } - if ($val != "") { - if ($_POST['AddSave'] == "Save") { - $colarray["`".$col['Field']."`"] = $val; - $sqlcols .= $col['Field']; - $sqlvals .= "'".$val."'"; - $sqlcols .= ", "; - $sqlvals .= ", "; - } else if ($_POST['EditSave'] == "Save") { - $colarray["`".$col['Field']."`"] = $val; - $set .= $col['Field']."='".$val."'"; - $set .= ", "; - } - } - } - } - $sqlcols = ereg_replace(", $", "", $sqlcols); - $sqlvals = ereg_replace(", $", "", $sqlvals); - if ($_POST['AddSave'] == "Save") { - $sql = "INSERT into cfg_".$_GET['q']." (".$sqlcols.") values (".$sqlvals.")"; - } else if ($_POST['EditSave'] == "Save") { - $sql = "UPDATE cfg_".$_GET['q']." set ".$set." where id='".$_POST['id']."' LIMIT 1"; - } - $adodb->updateDB("cfg_".$_GET['q'], $colarray, 'id'); - } - echo "
"; - echo ""; - echo $tsmmonitor->getTableheader(); - echo $tsmmonitor->getAdminTables("list"); - $nav = $tsmmonitor->showPageNavigation("40"); - if ($nav!="") { - echo ""; - } - echo "
"; - echo ""; - echo "
"; - } - } - } -} else { - if (isset($_SESSION["logindata"])) { - $errormsg = "Login failed!"; - } else { - $errormsg = "Login"; - } - - session_unset(); - $_SESSION=array(); - include_once "includes/login.php"; - -} -$_SESSION['from'] = $tsmmonitor->GETVars['qq']; -session_write_close(void); -?> - - - - - - + diff --git a/includes/adodb.php b/includes/adodb.php index cdb7427..81de3cc 100644 --- a/includes/adodb.php +++ b/includes/adodb.php @@ -1,24 +1,24 @@ . + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . -************************************************************************ -*/ + ************************************************************************ + */ /** * @@ -43,53 +43,53 @@ class ADOdb { var $conn; var $debug; - /** - * constructor - establishes a DB connection via ADODB - * - * @param string $host the hostname of the DB server - * @param string $port the portnumber for the DB connection - * @param string $user the username for the DB connection - * @param string $pass the password for the DB connection - * @param string $db_name the name of the DB - * @param string $db_type the type of the DB (currently only 'mysql') - * @param string $retr the number attempts for the DB connection before a failure is reported - * @return 0 - */ - function ADOdb($host, $port = "3306", $user, $pass, $db_name, $db_type, $retr = 20, $debug = FALSE) { + /** + * constructor - establishes a DB connection via ADODB + * + * @param string $host the hostname of the DB server + * @param string $port the portnumber for the DB connection + * @param string $user the username for the DB connection + * @param string $pass the password for the DB connection + * @param string $db_name the name of the DB + * @param string $db_type the type of the DB (currently only 'mysql') + * @param string $retr the number attempts for the DB connection before a failure is reported + * @return 0 + */ + function ADOdb($host, $port = "3306", $user, $pass, $db_name, $db_type, $retr = 20, $debug = FALSE) { - $this->debug = $debug; + $this->debug = $debug; - $try = 0; - $hostport = $host . ":" . $port; - $this->conn = NewADOConnection($db_type); - while ($try <= $retries) { - if ($this->conn->PConnect($hostport,$user,$pass,$db_name)) { - $this->conn = $this->conn; - return 0; - } - $try++; - usleep(50000); - } + $try = 0; + $hostport = $host . ":" . $port; + $this->conn = NewADOConnection($db_type); + while ($try <= $retries) { + if ($this->conn->PConnect($hostport,$user,$pass,$db_name)) { + $this->conn = $this->conn; + return 0; + } + $try++; + usleep(50000); + } - die("FATAL: Cannot connect to database server on '$host':'$port'. Please make sure you have specified a valid database name in 'includes/config.php'\n"); - return 0; - } + die("FATAL: Cannot connect to database server on '$host':'$port'. Please make sure you have specified a valid database name in 'includes/config.php'\n"); + return 0; + } - /** - * setDebug - enables or disabled debug mode - * + /** + * setDebug - enables or disabled debug mode + * * @param string $debug On or Off - */ - function setDebug($debug) { + */ + function setDebug($debug) { if ($debug == "On") { $this->debug = TRUE; } else { $this->debug = FALSE; } - } + } @@ -99,9 +99,9 @@ class ADOdb { * @return string */ function closeDB() { - if ($this->conn) { - return $this->conn->Close(); - } + if ($this->conn) { + return $this->conn->Close(); + } } @@ -112,17 +112,17 @@ class ADOdb { * @return ADORecordSet */ function execDB($sql) { - $this->conn->debug = $this->debug; - $sql = $this->sanitizeSQL($sql); + $this->conn->debug = $this->debug; + $sql = $this->sanitizeSQL($sql); - $recordSet = &$this->conn->Execute($sql); - if (($recordSet) || ($this->conn->ErrorNo() == 0)) { - return($recordSet); - } else { - echo "

Database Error (".$this->conn->ErrorNo().")

\n

".$this->conn->ErrorMsg()."

"; - //exit; - return ""; - } + $recordSet = &$this->conn->Execute($sql); + if (($recordSet) || ($this->conn->ErrorNo() == 0)) { + return($recordSet); + } else { + echo "

Database Error (".$this->conn->ErrorNo().")

\n

".$this->conn->ErrorMsg()."

"; + //exit; + return ""; + } } @@ -136,32 +136,32 @@ class ADOdb { * @return string Content of the cell as a single variable */ function fetchCellDB($sql, $column_name) { - //$this->conn->debug = true; - $this->conn->debug = $this->debug; - $sql = $this->sanitizeSQL($sql); + //$this->conn->debug = true; + $this->conn->debug = $this->debug; + $sql = $this->sanitizeSQL($sql); - if ($column_name != '') { - $this->conn->SetFetchMode(ADODB_FETCH_ASSOC); - } else { - $this->conn->SetFetchMode(ADODB_FETCH_NUM); - } - $recordSet = $this->conn->Execute($sql); - - if (($recordSet) || ($this->conn->ErrorNo() == 0)) { - if (!$recordSet->EOF) { - if ($column_name != '') { - $column = $recordSet->fields[$column_name]; - }else{ - $column = $recordSet->fields[0]; - } - $recordSet->close(); - - return($column); + if ($column_name != '') { + $this->conn->SetFetchMode(ADODB_FETCH_ASSOC); + } else { + $this->conn->SetFetchMode(ADODB_FETCH_NUM); + } + $recordSet = $this->conn->Execute($sql); + + if (($recordSet) || ($this->conn->ErrorNo() == 0)) { + if (!$recordSet->EOF) { + if ($column_name != '') { + $column = $recordSet->fields[$column_name]; + }else{ + $column = $recordSet->fields[0]; + } + $recordSet->close(); + + return($column); + } + } else { + echo "

Database Error (".$this->conn->ErrorNo().")

\n

".$this->conn->ErrorMsg()."

"; + exit; } - } else { - echo "

Database Error (".$this->conn->ErrorNo().")

\n

".$this->conn->ErrorMsg()."

"; - exit; - } } @@ -173,24 +173,24 @@ class ADOdb { * @return array First row of results as an associative array */ function fetchRowDB($sql) { - //$this->conn->debug = true; - $this->conn->debug = $this->debug; - $sql = $this->sanitizeSQL($sql); + //$this->conn->debug = true; + $this->conn->debug = $this->debug; + $sql = $this->sanitizeSQL($sql); - $this->conn->SetFetchMode(ADODB_FETCH_ASSOC); - $recordSet = $this->conn->Execute($sql); + $this->conn->SetFetchMode(ADODB_FETCH_ASSOC); + $recordSet = $this->conn->Execute($sql); - if (($recordSet) || ($this->conn->ErrorNo() == 0)) { - if (!$recordSet->EOF) { - $recordFields = $recordSet->fields; - $recordSet->close(); + if (($recordSet) || ($this->conn->ErrorNo() == 0)) { + if (!$recordSet->EOF) { + $recordFields = $recordSet->fields; + $recordSet->close(); - return($recordFields); + return($recordFields); + } + } else { + echo "

Database Error (".$this->conn->ErrorNo().")

\n

".$this->conn->ErrorMsg()."

"; + exit; } - } else { - echo "

Database Error (".$this->conn->ErrorNo().")

\n

".$this->conn->ErrorMsg()."

"; - exit; - } } @@ -202,25 +202,25 @@ class ADOdb { * @return array All results in an associative array */ function fetchArrayDB($sql) { - //$this->conn->debug = true; - $this->conn->debug = $this->debug; - $sql = $this->sanitizeSQL($sql); + //$this->conn->debug = true; + $this->conn->debug = $this->debug; + $sql = $this->sanitizeSQL($sql); - $recordArray = array(); - $this->conn->SetFetchMode(ADODB_FETCH_ASSOC); - $recordSet = &$this->conn->Execute($sql); + $recordArray = array(); + $this->conn->SetFetchMode(ADODB_FETCH_ASSOC); + $recordSet = &$this->conn->Execute($sql); - if (($recordSet) || ($this->conn->ErrorNo() == 0)) { - while ((!$recordSet->EOF) && ($recordSet)) { - $recordArray{sizeof($recordArray)} = $recordSet->fields; - $recordSet->MoveNext(); + if (($recordSet) || ($this->conn->ErrorNo() == 0)) { + while ((!$recordSet->EOF) && ($recordSet)) { + $recordArray{sizeof($recordArray)} = $recordSet->fields; + $recordSet->MoveNext(); + } + $recordSet->close(); + return($recordArray); + } else { + echo "

Database Error (".$this->conn->ErrorNo().")

\n

".$this->conn->ErrorMsg()."

"; + exit; } - $recordSet->close(); - return($recordArray); - } else { - echo "

Database Error (".$this->conn->ErrorNo().")

\n

".$this->conn->ErrorMsg()."

"; - exit; - } } @@ -237,11 +237,11 @@ class ADOdb { * @return string Auto-increment ID if insert was performed */ function updateDB($table, $cells, $keys, $autoquote = TRUE) { - //$this->conn->debug = true; - $this->conn->debug = $this->debug; - $this->conn->Replace($table, $cells, $keys, $autoquote); + //$this->conn->debug = true; + $this->conn->debug = $this->debug; + $this->conn->Replace($table, $cells, $keys, $autoquote); - return $this->conn->Insert_ID(); + return $this->conn->Insert_ID(); } @@ -253,11 +253,11 @@ class ADOdb { * @return string */ function sanitizeSQL($sql) { - $sql = str_replace(";", "\;", $sql); - $sql = str_replace("\n", "", $sql); - $sql = str_replace("\r", "", $sql); - $sql = str_replace("\t", " ", $sql); - return $sql; + $sql = str_replace(";", "\;", $sql); + $sql = str_replace("\n", "", $sql); + $sql = str_replace("\r", "", $sql); + $sql = str_replace("\t", " ", $sql); + return $sql; } } diff --git a/includes/config.php b/includes/config.php index 1eee1f3..b882093 100644 --- a/includes/config.php +++ b/includes/config.php @@ -1,23 +1,23 @@ . -************************************************************************ -*/ + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . + ************************************************************************ + */ /** * diff --git a/includes/footer.php b/includes/footer.php index 0cc76f8..57120cd 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -1,23 +1,23 @@ . -************************************************************************ -*/ + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . + ************************************************************************ + */ /** * @@ -32,13 +32,13 @@ ?> - - System Message: - + + System Message: + - - - TSM Monitor 2 v © 2008 - TSM Monitor Development Team (www.tsm-monitor.org) - - + + + TSM Monitor 2 v © 2008 - TSM Monitor Development Team (www.tsm-monitor.org) + + diff --git a/includes/global.php b/includes/global.php index c0add2a..493da32 100644 --- a/includes/global.php +++ b/includes/global.php @@ -1,22 +1,22 @@ . -************************************************************************ -*/ + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . + ************************************************************************ + */ /** * @@ -36,7 +36,7 @@ The defaults in this file are not meant to be altered by users! See include/config.php for user configurable database settings. -*/ + */ // ** Default database settings ** // $db_type = 'mysql'; @@ -62,9 +62,9 @@ $config["server_os"] = (strstr(PHP_OS, "WIN")) ? "win32" : "unix"; // ** Search paths for external programs (dsmadmc, php, ...) ** // if ($config["server_os"] == "win32") { - $config["search_path"] = array('c:/php', 'c:/progra~1/php', 'd:/php', 'd:/progra~1/php', 'c:/progra~1/tivoli/tsm/baclient', 'd:/progra~1/tivoli/tsm/baclient'); + $config["search_path"] = array('c:/php', 'c:/progra~1/php', 'd:/php', 'd:/progra~1/php', 'c:/progra~1/tivoli/tsm/baclient', 'd:/progra~1/tivoli/tsm/baclient'); } elseif ($config["server_os"] == "unix") { - $config["search_path"] = array('/bin', '/sbin', '/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin', '/usr/tivoli/tsm/client/admin/bin', '/opt/tivoli/tsm/client/ba/bin'); + $config["search_path"] = array('/bin', '/sbin', '/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin', '/usr/tivoli/tsm/client/admin/bin', '/opt/tivoli/tsm/client/ba/bin'); } // ** Paths (libraries, includes, ...) ** // @@ -97,8 +97,8 @@ $tsmmonitor = new TSMMonitor($adodb); // check to see if this is a new installation $version = $adodb->fetchCellDB("select confval from cfg_config where confkey='version'", ''); if ($version != $config["tsm_monitor_version"] && basename($_SERVER['REQUEST_URI']) != 'install.php') { - header("Location: install.php"); - exit; + header("Location: install.php"); + exit; } // ** Include generic code and external libraries ** // diff --git a/includes/login.php b/includes/login.php index 54eac8b..6ef4bd5 100644 --- a/includes/login.php +++ b/includes/login.php @@ -1,24 +1,24 @@ . -************************************************************************ -
-*/ + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . + ************************************************************************ + + */ /** * @@ -40,23 +40,23 @@ if ($isAdmin) { ?> -
-
-
-
- - - - - - - - - -
-
-
-
-
-
+
+
+
+
+ + + + + + + + + +
+
+
+
+
+
diff --git a/includes/overview.php b/includes/overview.php index 8d6d283..61163e0 100644 --- a/includes/overview.php +++ b/includes/overview.php @@ -1,23 +1,23 @@ . -************************************************************************ -*/ + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . + ************************************************************************ + */ /** * @@ -32,43 +32,43 @@ ?> - - - + + + - - - + + + - - - - - + + + + +
Quick Overview for Server
Quick Overview for Server
- - -getOverviewRows($tsmmonitor->configarray["infoboxarray"]["healthdata"]); ?> -
Health Status
-
- - - - -getOverviewRows($tsmmonitor->configarray["infoboxarray"]["database"]); ?> -
TSM Database
-
+ + + getOverviewRows($tsmmonitor->configarray["infoboxarray"]["healthdata"]); ?> +
Health Status
+
+ + + + + getOverviewRows($tsmmonitor->configarray["infoboxarray"]["database"]); ?> +
TSM Database
+
- - - -getOverviewRows($tsmmonitor->configarray["infoboxarray"]["totaldata"]); ?> -
Total Data
-
- - - - -getOverviewRows($tsmmonitor->configarray["infoboxarray"]["schedules"]); ?> -
Schedule Status
-
+ + + + getOverviewRows($tsmmonitor->configarray["infoboxarray"]["totaldata"]); ?> +
Total Data
+
+ + + + + getOverviewRows($tsmmonitor->configarray["infoboxarray"]["schedules"]); ?> +
Schedule Status
+
diff --git a/includes/page_head.php b/includes/page_head.php index 3f559dc..9d20d7e 100644 --- a/includes/page_head.php +++ b/includes/page_head.php @@ -1,21 +1,21 @@ . -*************************************************************************/ + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . + *************************************************************************/ /** * @@ -31,59 +31,58 @@ if ($_POST["css"] != "") $_SESSION['stylesheet'] = $_POST["css"]; if ($_POST["tabletype"] != "") $_SESSION["tabletype"] = $_POST["tabletype"]; if ($_POST["DebugMode"] != "") $_SESSION["debug"] = $_POST["DebugMode"]; $adodb->setDebug($_SESSION["debug"]); -//if ($_SESSION['stylesheet'] == "") $_SESSION['stylesheet'] = "style_classic.css"; ?> - - TSM Monitor - - - - - - '> - - - - - + objStartDate.setMonth(); + objStartDate.setDate(); + objStartDate.setYear(); - -
- - + objLateDate.setMonth(objLateDate.getMonth()); + datepicker.DateChooser = new DateChooser(); + datepicker.DateChooser.setXOffset(5); + datepicker.DateChooser.setYOffset(-5); + datepicker.DateChooser.setStartDate(objStartDate); + datepicker.DateChooser.setLatestDate(objLateDate); + datepicker.DateChooser.setUpdateField('dateinput', 'Y/m/d'); + datepicker.DateChooser.setIcon('images/datechooser.png', 'dateinput'); + + return true; + } + + function genPDF() { + window.open( "includes/show_pdf.php?q=&s=", "myWindow", "status = 1, fullscreen=yes,scrollbars=yes" ) + } + + + // --> + + + + + +
+
+ diff --git a/includes/pdf.php b/includes/pdf.php index 9f64b87..0656661 100644 --- a/includes/pdf.php +++ b/includes/pdf.php @@ -1,22 +1,22 @@ . -************************************************************************ -*/ + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . + ************************************************************************ + */ /** @@ -57,7 +57,6 @@ class PDF extends FPDF * Header - generates page header * */ - function Header() { //Print the table header if necessary @@ -67,14 +66,14 @@ class PDF extends FPDF } - /** - * PageHeader - writes page title on top of first page - * - * @param string $pagetitle title of page - * @access public - * @return void - */ - function PageHeader($pagetitle) { + /** + * PageHeader - writes page title on top of first page + * + * @param string $pagetitle title of page + * @access public + * @return void + */ + function PageHeader($pagetitle) { //Title $this->SetFont('Arial','',12); @@ -88,7 +87,6 @@ class PDF extends FPDF * TableHeader * */ - function TableHeader() { $this->SetFont('Arial','B',6); @@ -107,7 +105,6 @@ class PDF extends FPDF * * @param unknown $date */ - function Row($data) { $this->SetX($this->TableX); @@ -129,7 +126,6 @@ class PDF extends FPDF * @param string $width * @param string $align */ - function CalcWidths($width,$align) { //Compute the widths of the columns @@ -162,7 +158,6 @@ class PDF extends FPDF * @param string $caption * @param string $align */ - function AddCol($field=-1,$width=-1,$caption='',$align='L') { //Add a column to the table @@ -178,7 +173,6 @@ class PDF extends FPDF * @param string $query * @param array $prop */ - function Table($query,$prop=array(),$dbresult) { //Issue query @@ -219,10 +213,10 @@ class PDF extends FPDF $this->ColorIndex=0; $this->ProcessingTable=true; foreach($dbresult as $key => $row) { - $row_num = array_values($row); - $row_comb = array_merge($row, $row_num); - $this->Row($row_comb); - } + $row_num = array_values($row); + $row_comb = array_merge($row, $row_num); + $this->Row($row_comb); + } $this->ProcessingTable=false; $this->cMargin=$cMargin; $this->aCols=array(); diff --git a/includes/polld.php b/includes/polld.php index 6d8ea37..75fd051 100644 --- a/includes/polld.php +++ b/includes/polld.php @@ -1,23 +1,23 @@ . -************************************************************************ -*/ + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . + ************************************************************************ + */ /** @@ -162,7 +162,7 @@ class PollD { if ($handle) { - while (!feof($handle) && !$stop) { + while (!feof($handle) && !$stop) { $read = fgets($handle, 4096); $hashstring .= $read; $stop = strstr($read, 'ANR2034E'); @@ -214,7 +214,7 @@ class PollD { $countobj = $this->adodb->fetchArrayDB($sql); $countarray = (array)$countobj[0]; $count = $countarray["count(*)"]; - + if ($count > 0) { return TRUE; } else { @@ -307,7 +307,7 @@ class PollD { $result = $this->execute($query["tsmquery"], $server["servername"], $tablename, $timestamp); } catch (exception $e) { $result = ""; - print_r($e); + print_r($e); } if ($result != "") { if (!$this->checkHash($tablename, $result["md5"])) { @@ -420,7 +420,7 @@ class PollD { if ($status != "") $status = "`status`='".$status."'"; if ($lastrun != "") $lastrun = ", `lastrun`='".$lastrun."'"; if ($nextrun != "") $nextrun = ", `nextrun`='".$nextrun."'"; - + $sql = "update log_polldstat set ".$status." ".$lastrun." ".$nextrun." WHERE `id`='1'"; $this->adodb->execDB($sql); } @@ -436,7 +436,7 @@ class PollD { $sql = "select enabled from log_polldstat WHERE `id`='1'"; $result = $this->adodb->fetchArrayDB($sql); - + if ($result != "" && $result[0]["enabled"] == "1"){ return TRUE; } else { @@ -476,7 +476,7 @@ class PollD { $result = $this->adodb->fetchArrayDB($sql); return $result[0]["status"]; - + } @@ -494,18 +494,18 @@ class PollD { echo "Sleeptime will be ".$sleeptime." seconds\n"; - + // infinite loop while(true) { if ($this->isEnabled()) { - + $timestamp = time(); echo "running!\n"; echo "timestamp for this run is ".$timestamp."\n"; - + $this->setPollDStatus("running", "", ""); @@ -529,7 +529,7 @@ class PollD { } $init = "no"; - + echo "needed ".(time()-$timestamp)." seconds for this run.\n"; //$tempsleeptime = $sleeptime-(time()-$timestamp); $tempsleeptime = 900 -(time()-$timestamp); diff --git a/includes/show_pdf.php b/includes/show_pdf.php index 509ffcf..bf7d2d7 100644 --- a/includes/show_pdf.php +++ b/includes/show_pdf.php @@ -1,22 +1,22 @@ . -************************************************************************ -*/ + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . + ************************************************************************ + */ /** @@ -40,9 +40,9 @@ $pdf->Open(); $pdf->AddPage(); //First table: put all columns automatically $prop=array('HeaderColor'=>array(180,180,180), - 'color1'=>array(255,255,255), - 'color2'=>array(230,230,230), - 'padding'=>2); + 'color1'=>array(255,255,255), + 'color2'=>array(230,230,230), + 'padding'=>2); $res = $adodb->fetchArrayDB($_SESSION["lastsql"]); //build Page Title diff --git a/includes/topnav.php b/includes/topnav.php index 3ac59ec..3f54453 100644 --- a/includes/topnav.php +++ b/includes/topnav.php @@ -32,35 +32,34 @@ ?>
-GETVars['qq'] != "admin" && !$_POST["edit"] == "edit") { -if ($tsmmonitor->GETVars['qq'] != "index" && $tsmmonitor->GETVars['qq'] != "overview" && $tsmmonitor->GETVars['qq'] != "serverlist") { - echo ""; + GETVars['qq'] != "index" && $tsmmonitor->GETVars['qq'] != "overview" && $tsmmonitor->GETVars['qq'] != "serverlist") { + echo ""; - if ($tsmmonitor->configarray["queryarray"][$tsmmonitor->GETVars['qq']]["timetablefields"] != "") { + if ($tsmmonitor->configarray["queryarray"][$tsmmonitor->GETVars['qq']]["timetablefields"] != "") { - echo ""; + $types = array('normal view', 'timetable'); + foreach ($types as $type) { + echo ''; + } + echo ""; + + } + + } + if ($tsmmonitor->GETVars['qq'] != "polldstat" && $tsmmonitor->GETVars['qq'] != "serverlist") { + + echo ""; - -} - -} -if ($tsmmonitor->GETVars['qq'] != "polldstat" && $tsmmonitor->GETVars['qq'] != "serverlist") { - - echo ""; -} -?> + ?> diff --git a/includes/tsmmonitor.php b/includes/tsmmonitor.php index 849f251..b128bcf 100644 --- a/includes/tsmmonitor.php +++ b/includes/tsmmonitor.php @@ -1,24 +1,24 @@ . + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . -************************************************************************ -*/ + ************************************************************************ + */ /** * @@ -157,11 +157,11 @@ class TSMMonitor { // Custom Stylesheet if ($_SESSION['stylesheet'] == "") { - if ($this->configarray['stylesheet'] != "") { - $_SESSION['stylesheet'] = $this->configarray['stylesheet']; - } else { - $_SESSION['stylesheet'] = "style_classic.css"; - } + if ($this->configarray['stylesheet'] != "") { + $_SESSION['stylesheet'] = $this->configarray['stylesheet']; + } else { + $_SESSION['stylesheet'] = "style_classic.css"; + } } } @@ -169,46 +169,46 @@ class TSMMonitor { - /** - * $this->fetchSplitArrayDB - execute a SQL query against the DB via ADODB - * and return results in an associative array. - * - * @param string $sql SQL statement to execute - * @param string $rows_per_page number of rows per page a result will have - * @return array All results in an associative array - */ - function fetchSplitArrayDB($sql, $rows_per_page = '20') { - // $this->conn->debug = true; - $this->page = intval($_GET['page']); + /** + * $this->fetchSplitArrayDB - execute a SQL query against the DB via ADODB + * and return results in an associative array. + * + * @param string $sql SQL statement to execute + * @param string $rows_per_page number of rows per page a result will have + * @return array All results in an associative array + */ + function fetchSplitArrayDB($sql, $rows_per_page = '20') { + // $this->conn->debug = true; + $this->page = intval($_GET['page']); - $sql = $this->adodb->sanitizeSQL($sql); + $sql = $this->adodb->sanitizeSQL($sql); - $recordArray = array(); - $this->adodb->conn->SetFetchMode(ADODB_FETCH_ASSOC); - $recordSet = $this->adodb->conn->Execute($sql); + $recordArray = array(); + $this->adodb->conn->SetFetchMode(ADODB_FETCH_ASSOC); + $recordSet = $this->adodb->conn->Execute($sql); - if (($recordSet) || ($this->adodb->conn->ErrorNo() == 0)) { - $total_rows = $recordSet->RecordCount($recordSet); - $this->max_pages = ceil($total_rows/$rows_per_page); + if (($recordSet) || ($this->adodb->conn->ErrorNo() == 0)) { + $total_rows = $recordSet->RecordCount($recordSet); + $this->max_pages = ceil($total_rows/$rows_per_page); - if($this->page > $this->max_pages || $this->page <= 0) { - $this->page = 1; - } - $offset = $rows_per_page * ($this->page-1); - $endset = $offset + $rows_per_page; - $recordSet->Move($offset); + if($this->page > $this->max_pages || $this->page <= 0) { + $this->page = 1; + } + $offset = $rows_per_page * ($this->page-1); + $endset = $offset + $rows_per_page; + $recordSet->Move($offset); - while (($recordSet->CurrentRow() < $endset) && ($recordSet->CurrentRow() < $total_rows) && ($recordSet)) { - $recordArray{sizeof($recordArray)} = $recordSet->fields; - $recordSet->MoveNext(); - } - $recordSet->close(); - return($recordArray); - } else { - echo "

Database Error (".$this->conn->ErrorNo().")

\n

".$this->conn->ErrorMsg()."

"; - exit; - } - } + while (($recordSet->CurrentRow() < $endset) && ($recordSet->CurrentRow() < $total_rows) && ($recordSet)) { + $recordArray{sizeof($recordArray)} = $recordSet->fields; + $recordSet->MoveNext(); + } + $recordSet->close(); + return($recordArray); + } else { + echo "

Database Error (".$this->conn->ErrorNo().")

\n

".$this->conn->ErrorMsg()."

"; + exit; + } + } @@ -282,7 +282,7 @@ class TSMMonitor { } else { return ""; } - + } @@ -296,12 +296,12 @@ class TSMMonitor { * @return string */ function GetBetween($content,$start,$end) { - $r = explode($start, $content); - if (isset($r[1])) { - $r = explode($end, $r[1]); - return $r[0]; - } - return ''; + $r = explode($start, $content); + if (isset($r[1])) { + $r = explode($end, $r[1]); + return $r[0]; + } + return ''; } @@ -379,7 +379,7 @@ class TSMMonitor { $q = $this->GetBetween($key,"q=","&m="); if ($this->configarray["queryarray"][$q]["notforlibclient"] == 1 && $this->configarray["serverlist"][$this->GETVars['server']]["libraryclient"] == 1) { $bCont = FALSE; - + } $key = $_SERVER['PHP_SELF']."?".$key; @@ -442,33 +442,33 @@ class TSMMonitor { - /** - * getStylesheetSwitcher - returns HTML Code for Stylesheetswitchdropdownbox ;) - * - * @return string - */ - function getStylesheetSwitcher() { - + /** + * getStylesheetSwitcher - returns HTML Code for Stylesheetswitchdropdownbox ;) + * + * @return string + */ + function getStylesheetSwitcher() { + $ret = ""; - $ret .= "
"; - $ret .= "Stylesheet Switcher

"; - $ret .= "
\n"; - $ret .= "\n"; + if ($handle = opendir('css')) { + while (false !== ($file = readdir($handle))) { + if ($file != '.' && $file != '..' && substr($file, 0, 6) == 'style_') { + $fileName = str_replace('.css', '', $file); + $fileName = str_replace('style_', '', $fileName); + $ret .= '
"; + $ret .= ""; return $ret; @@ -485,61 +485,61 @@ class TSMMonitor { */ function getTableheader() { - $tableheader="
"; - $orderby = $this->configarray["queryarray"][$this->GETVars['qq']]["orderby"]; - $orderdir = $this->GETVars['orderdir']; - $this->page = $_GET['page']; + $tableheader=""; + $orderby = $this->configarray["queryarray"][$this->GETVars['qq']]["orderby"]; + $orderdir = $this->GETVars['orderdir']; + $this->page = $_GET['page']; - if ($orderdir == "asc") { - $sonew="desc"; - } else if ($orderdir == "desc") { - $sonew="asc"; - } - - $isAdmin = strstr($_SERVER['PHP_SELF'], 'admin.php'); - - if ($isAdmin) { - $sql = "SHOW COLUMNS FROM cfg_".$_GET['q']; - } else { - $sql = "SHOW COLUMNS FROM res_".$this->configarray["queryarray"][$this->GETVars['qq']]["name"]."_".$this->GETVars['server']; - } - $fieldnames = $this->adodb->fetchArrayDB($sql); - - // If table has more than one column - if (sizeof($fieldnames) > 1) { - foreach ($fieldnames as $col) { - if ($col['Field'] != "timestamp" && $col['Field'] != "id") { - $name = $col['Field']; - $arrow = ""; - if (($this->GETVars['ob'] == $name && $this->GETVars['ob']!="") || ($this->GETVars['ob']=="" && $orderby!="" && $orderby == $name)) { - $link = "href='".$_SERVER['PHP_SELF']."?q=".$this->GETVars['qq']."&m=".$this->GETVars['menu']."&sort=".$name."&page=".$this->page."&so=".$sonew."&s=".$this->GETVars['server']."'"; - if ($orderdir == "asc") { - $arrow = "↑"; - } else if ($orderdir == "desc") { - $arrow = "↓"; - } - } else { - $arrow = ""; - $link = "href='".$_SERVER['PHP_SELF']."?q=".$this->GETVars['qq']."&m=".$this->GETVars['menu']."&sort=".$name."&page=".$this->page."&s=".$this->GETVars['server']."'"; - } - $tableheader = $tableheader.""; - } - } - } else { if ($orderdir == "asc") { - $arrow = "⇑"; + $sonew="desc"; } else if ($orderdir == "desc") { - $arrow = "⇓"; + $sonew="asc"; } - $link = "href='".$_SERVER['PHP_SELF']."?q=".$this->GETVars['qq']."&m=".$this->GETVars['menu']."&sort=".$name."&page=".$this->page."&so=".$sonew."'"; - $label = $fieldnames[0]['Field']; - $tableheader = $tableheader.""; - } - if ($isAdmin) { - $tableheader = $tableheader.""; - } - $tableheader=$tableheader.""; - return $tableheader; + + $isAdmin = strstr($_SERVER['PHP_SELF'], 'admin.php'); + + if ($isAdmin) { + $sql = "SHOW COLUMNS FROM cfg_".$_GET['q']; + } else { + $sql = "SHOW COLUMNS FROM res_".$this->configarray["queryarray"][$this->GETVars['qq']]["name"]."_".$this->GETVars['server']; + } + $fieldnames = $this->adodb->fetchArrayDB($sql); + + // If table has more than one column + if (sizeof($fieldnames) > 1) { + foreach ($fieldnames as $col) { + if ($col['Field'] != "timestamp" && $col['Field'] != "id") { + $name = $col['Field']; + $arrow = ""; + if (($this->GETVars['ob'] == $name && $this->GETVars['ob']!="") || ($this->GETVars['ob']=="" && $orderby!="" && $orderby == $name)) { + $link = "href='".$_SERVER['PHP_SELF']."?q=".$this->GETVars['qq']."&m=".$this->GETVars['menu']."&sort=".$name."&page=".$this->page."&so=".$sonew."&s=".$this->GETVars['server']."'"; + if ($orderdir == "asc") { + $arrow = "↑"; + } else if ($orderdir == "desc") { + $arrow = "↓"; + } + } else { + $arrow = ""; + $link = "href='".$_SERVER['PHP_SELF']."?q=".$this->GETVars['qq']."&m=".$this->GETVars['menu']."&sort=".$name."&page=".$this->page."&s=".$this->GETVars['server']."'"; + } + $tableheader = $tableheader.""; + } + } + } else { + if ($orderdir == "asc") { + $arrow = "⇑"; + } else if ($orderdir == "desc") { + $arrow = "⇓"; + } + $link = "href='".$_SERVER['PHP_SELF']."?q=".$this->GETVars['qq']."&m=".$this->GETVars['menu']."&sort=".$name."&page=".$this->page."&so=".$sonew."'"; + $label = $fieldnames[0]['Field']; + $tableheader = $tableheader.""; + } + if ($isAdmin) { + $tableheader = $tableheader.""; + } + $tableheader=$tableheader.""; + return $tableheader; } @@ -554,7 +554,7 @@ class TSMMonitor { $wc = ""; $isAdmin = strstr($_SERVER['PHP_SELF'], 'admin.php'); - + if ($user != "" && $pass != "") { $sql = "SELECT password, role from cfg_users where username='".$user."'"; $ret = $this->adodb->fetchArrayDB($sql); @@ -570,7 +570,7 @@ class TSMMonitor { } else { $_SESSION["logindata"]["loggedin"] = FALSE; } - + } @@ -586,7 +586,7 @@ class TSMMonitor { function checkAlert($comperator = '', $alertval = '', $val = '') { $error = false; - + if (substr($val, -1) == "*") { $val = substr($val,0,-1); } @@ -648,16 +648,16 @@ class TSMMonitor { */ function getLastSnapshot($qq) { - $server = $this->GETVars['server']; - $ret = array(); + $server = $this->GETVars['server']; + $ret = array(); - //$qtable = $this->configarray["queryarray"][$this->GETVars['qq']]["name"]; + //$qtable = $this->configarray["queryarray"][$this->GETVars['qq']]["name"]; - $sql = "SELECT MAX(TimeStamp) from res_".$qq."_".$server; - $ret = $this->adodb->fetchArrayDB($sql); - $ret = (array)$ret[0]; + $sql = "SELECT MAX(TimeStamp) from res_".$qq."_".$server; + $ret = $this->adodb->fetchArrayDB($sql); + $ret = (array)$ret[0]; - return $ret["MAX(TimeStamp)"]; + return $ret["MAX(TimeStamp)"]; } @@ -671,22 +671,22 @@ class TSMMonitor { */ function getTableFields($tablename="") { - $sqlth = "SELECT * from ".$tablename." LIMIT 1"; + $sqlth = "SELECT * from ".$tablename." LIMIT 1"; - $sqlresth = $this->adodb->fetchArrayDB($sqlth); - $columnnames = ""; + $sqlresth = $this->adodb->fetchArrayDB($sqlth); + $columnnames = ""; - // get all table fields to be selected - foreach ($sqlresth as $row) { - foreach ($row as $colname => $colval) { - if ($colname != "timestamp") { - $columnnames .= "`".$colname."`"; - if ( $i < $numfields-1) $columnnames .= ", "; - } + // get all table fields to be selected + foreach ($sqlresth as $row) { + foreach ($row as $colname => $colval) { + if ($colname != "timestamp") { + $columnnames .= "`".$colname."`"; + if ( $i < $numfields-1) $columnnames .= ", "; + } + } } - } - $columnnames = ereg_replace(", $", "", $columnnames); - return $columnnames; + $columnnames = ereg_replace(", $", "", $columnnames); + return $columnnames; } @@ -698,53 +698,53 @@ class TSMMonitor { */ function getAdminTables($type="") { - $columnnames = $this->getTableFields("cfg_".$this->GETVars['qq']); + $columnnames = $this->getTableFields("cfg_".$this->GETVars['qq']); - if ($this->GETVars['ob'] != '' ) { - $sqlappend = " order by `".$this->GETVars['ob']."` ".$this->GETVars['orderdir']; - } elseif ($this->configarray["queryarray"][$this->GETVars['qq']]["orderby"] != '') { - $sqlappend = " order by `".$this->configarray["queryarray"][$this->GETVars['qq']]["orderby"]."` ".$this->GETVars['orderdir']; - } - - if ($type == "edit") { - $wc = " where `id`='".$_GET['id']."' "; - } - - $sql = "SELECT ".$columnnames." from cfg_".$this->GETVars["qq"].$wc.$sqlappend; - $_SESSION["lastsql"] = $sql; - if ($sqlres) $this->message = $sql; - - $i = 1; - $rs = $this->adodb->fetchArrayDB($sql); - - foreach ($rs as $row) { - if ($type=="list") { - if ($i % 2 == 0) { - $outp .= ""; - }else{ - $outp .= ""; - } - $i++; - - while(list($keycell, $valcell) = each($row)) { - if ($keycell == "id") { - $id = $valcell; - } else { - $outp .= ""; - } - } - - $baseurl = $_SERVER['PHP_SELF']."?q=".$this->GETVars['qq']."&m=".$this->GETVars['menu']; - $outp .= ""; - $outp .= ""; - - $outp .= "\n"; - } else { - $outp = $this->adodb->fetchArrayDB($sql); - var_dump($outp); + if ($this->GETVars['ob'] != '' ) { + $sqlappend = " order by `".$this->GETVars['ob']."` ".$this->GETVars['orderdir']; + } elseif ($this->configarray["queryarray"][$this->GETVars['qq']]["orderby"] != '') { + $sqlappend = " order by `".$this->configarray["queryarray"][$this->GETVars['qq']]["orderby"]."` ".$this->GETVars['orderdir']; } - } - return $outp; + + if ($type == "edit") { + $wc = " where `id`='".$_GET['id']."' "; + } + + $sql = "SELECT ".$columnnames." from cfg_".$this->GETVars["qq"].$wc.$sqlappend; + $_SESSION["lastsql"] = $sql; + if ($sqlres) $this->message = $sql; + + $i = 1; + $rs = $this->adodb->fetchArrayDB($sql); + + foreach ($rs as $row) { + if ($type=="list") { + if ($i % 2 == 0) { + $outp .= ""; + }else{ + $outp .= ""; + } + $i++; + + while(list($keycell, $valcell) = each($row)) { + if ($keycell == "id") { + $id = $valcell; + } else { + $outp .= ""; + } + } + + $baseurl = $_SERVER['PHP_SELF']."?q=".$this->GETVars['qq']."&m=".$this->GETVars['menu']; + $outp .= ""; + $outp .= ""; + + $outp .= "\n"; + } else { + $outp = $this->adodb->fetchArrayDB($sql); + var_dump($outp); + } + } + return $outp; } @@ -846,10 +846,10 @@ class TSMMonitor { $outp = $outp.""; } $i++; - + while(list($keycell, $valcell) = each($row)) { if($color!="" && $col==$keycell) { - + if ($i % 2 == 0) { $cellcol = $colorsarray[$color."_light"]; } else { @@ -897,53 +897,53 @@ class TSMMonitor { */ function getSearchfield() { - $ret = ""; - $arrfield = ""; - $arrval = ""; - $arrop = ""; + $ret = ""; + $arrfield = ""; + $arrval = ""; + $arrop = ""; - $operators = array ("<", "=", "<>", ">"); + $operators = array ("<", "=", "<>", ">"); - $searcharr = $_SESSION["search"][$this->GETVars['qq']]; - if (isset($searcharr)) { - $arrfield = $searcharr["field"]; - $arrval = $searcharr["val"]; - $arrop = $searcharr["op"]; - } - $sql = "SHOW COLUMNS FROM res_".$this->configarray["queryarray"][$this->GETVars['qq']]["name"]."_".$this->GETVars['server']; - $fieldnames = $this->adodb->fetchArrayDB($sql); - - // Build Field Name Combobox - $fieldbox = ""; - - // Build Operator Combobox - if ($arrop=="") $arrop="="; - $opbox = ""; + foreach ($fieldnames as $field) { + if ($field['Field'] != "timestamp") { + $fieldbox.= '
".ucfirst($name)." ".$arrow."".$label." ".$arrow."
".ucfirst($name)." ".$arrow."".$label." ".$arrow."
".$valcell."
".$valcell."
"; - $outp .= ""; + $i=1; + $outp = "
StatusLast RunNext Run
"; + $outp .= ""; - $sql = "SELECT enabled, status, lastrun, nextrun from log_polldstat"; - $sqlres = $this->adodb->fetchArrayDB($sql); - foreach ($sqlres as $row) { - if ($row['enabled'] == "1") { - if ($row['status'] == "running") { - $cellcolor = "green"; - } else if ($row['status'] == "sleeping") { - $cellcolor = "yellow"; + $sql = "SELECT enabled, status, lastrun, nextrun from log_polldstat"; + $sqlres = $this->adodb->fetchArrayDB($sql); + foreach ($sqlres as $row) { + if ($row['enabled'] == "1") { + if ($row['status'] == "running") { + $cellcolor = "green"; + } else if ($row['status'] == "sleeping") { + $cellcolor = "yellow"; + } else { + $cellcolor = "red"; + } + if ($row['nextrun'] != "") $nextrun = strftime("%Y/%m/%d %H:%M:%S", $row['nextrun']); + $status = $row['status']; } else { + $status = "disabled"; $cellcolor = "red"; } - if ($row['nextrun'] != "") $nextrun = strftime("%Y/%m/%d %H:%M:%S", $row['nextrun']); - $status = $row['status']; - } else { - $status = "disabled"; - $cellcolor = "red"; + if ($row['lastrun'] != "") $lastrun = strftime("%Y/%m/%d %H:%M:%S", $row['lastrun']); + $outp .= ""; } - if ($row['lastrun'] != "") $lastrun = strftime("%Y/%m/%d %H:%M:%S", $row['lastrun']); - $outp .= ""; - } - $outp .= "
StatusLast RunNext Run
".$status."".$lastrun."".$nextrun."
".$status."".$lastrun."".$nextrun."


"; + $outp .= "

"; - $outp .= ""; - $outp .= ""; + $outp .= "
TimeServernameUpdatedUnchangedPollfreq not reachedTime needed (s)
"; + $outp .= ""; - $sql = "SELECT * from log_polldlog where timestamp > '".(time()-86400)."' order by timestamp desc"; - $_SESSION["lastsql"] = $sql; - $rs = $this->fetchSplitArrayDB($sql,20); - foreach ($rs as $row) { - if ($i % 2 == 0) { - $outp = $outp.""; - } else { - $outp = $outp.""; + $sql = "SELECT * from log_polldlog where timestamp > '".(time()-86400)."' order by timestamp desc"; + $_SESSION["lastsql"] = $sql; + $rs = $this->fetchSplitArrayDB($sql,20); + foreach ($rs as $row) { + if ($i % 2 == 0) { + $outp = $outp.""; + } else { + $outp = $outp.""; + } + $i++; + + while(list($keycell, $valcell) = each($row)) { + if ($keycell == "timestamp") { + $valcell = strftime("%Y/%m/%d %T", $valcell); + } + $outp = $outp.""; + } + $outp = $outp."\n"; } - $i++; - - while(list($keycell, $valcell) = each($row)) { - if ($keycell == "timestamp") { - $valcell = strftime("%Y/%m/%d %T", $valcell); - } - $outp = $outp.""; + $nav = $this->showPageNavigation("20"); + if ($nav!="") { + $outp = $outp.""; } - $outp = $outp."\n"; - } - $nav = $this->showPageNavigation("20"); - if ($nav!="") { - $outp = $outp.""; - } - - return $outp."
TimeServernameUpdatedUnchangedPollfreq not reachedTime needed (s)
".$valcell."
".$valcell."
"; + + return $outp.""; } @@ -1054,58 +1054,58 @@ class TSMMonitor { */ function getOverviewRows($subindexqueryarray = '') { - $out=""; - $i=0; + $out=""; + $i=0; - while(list($key, $val) = each($subindexqueryarray)) { + while(list($key, $val) = each($subindexqueryarray)) { - $bgcol=""; - $comperator = ""; - $alertval = ""; - $alertcol = ""; - $cellcolors = $this->configarray["colorsarray"]; + $bgcol=""; + $comperator = ""; + $alertval = ""; + $alertcol = ""; + $cellcolors = $this->configarray["colorsarray"]; - $cache = $subindexqueryarray[$key]["cache"]; - if ($this->configarray["serverlist"][$this->GETVars['server']]["libraryclient"] == 1 && $subindexqueryarray[$key]["notforlibclient"] == 1) { - $res = "-§§§-"; - } else { - $res = ''; - $sql = "SELECT name, result from res_overview_".$this->GETVars['server']." where name='".$subindexqueryarray[$key]["name"]."'"; - $sqlres = $this->adodb->fetchArrayDB($sql); - foreach ($sqlres as $row) { - $res .= $row['name']."§§§".$row['result']; - } - } - - if ($i == 1) { - $out = $out.""; - $i=0; - } else { - $out = $out.""; - $i=1; - } - $res = split("§§§", $res); - //$out .= $subindexqueryarray[$key]["header"]; - $out .= $res[0]; - $comperator = $subindexqueryarray[$key]["alert_comp"]; - $alertval = $subindexqueryarray[$key]["alert_val"]; - $alertcol = $subindexqueryarray[$key]["alert_col"]; - $unit = $subindexqueryarray[$key]["unit"]; - $error = $this->checkAlert($comperator, $alertval, $res[1]); - if ($i==1) { - $shade="light"; - } else { - $shade="dark"; - } - if ($error && $res != "" && $res[1] != "-") { - $bgcol="bgcolor='".$cellcolors[$alertcol."_".$shade]."'"; - } else { - $bgcol="bgcolor='".$cellcolors["ok_".$shade]."'"; - } - $out .= "".$res[1]." ".$unit."\n"; - } + $cache = $subindexqueryarray[$key]["cache"]; + if ($this->configarray["serverlist"][$this->GETVars['server']]["libraryclient"] == 1 && $subindexqueryarray[$key]["notforlibclient"] == 1) { + $res = "-§§§-"; + } else { + $res = ''; + $sql = "SELECT name, result from res_overview_".$this->GETVars['server']." where name='".$subindexqueryarray[$key]["name"]."'"; + $sqlres = $this->adodb->fetchArrayDB($sql); + foreach ($sqlres as $row) { + $res .= $row['name']."§§§".$row['result']; + } + } - return $out; + if ($i == 1) { + $out = $out.""; + $i=0; + } else { + $out = $out.""; + $i=1; + } + $res = split("§§§", $res); + //$out .= $subindexqueryarray[$key]["header"]; + $out .= $res[0]; + $comperator = $subindexqueryarray[$key]["alert_comp"]; + $alertval = $subindexqueryarray[$key]["alert_val"]; + $alertcol = $subindexqueryarray[$key]["alert_col"]; + $unit = $subindexqueryarray[$key]["unit"]; + $error = $this->checkAlert($comperator, $alertval, $res[1]); + if ($i==1) { + $shade="light"; + } else { + $shade="dark"; + } + if ($error && $res != "" && $res[1] != "-") { + $bgcol="bgcolor='".$cellcolors[$alertcol."_".$shade]."'"; + } else { + $bgcol="bgcolor='".$cellcolors["ok_".$shade]."'"; + } + $out .= "".$res[1]." ".$unit."\n"; + } + + return $out; } @@ -1120,7 +1120,7 @@ class TSMMonitor { * @return string */ function generateTimetableHeader($startpunkt = '', $FirstCol = '') { - + $header = $FirstCol["label"]; $out= "".$header.""; for ($count = 0; $count <= 24; $count++) { @@ -1130,7 +1130,7 @@ class TSMMonitor { $out .= ""; - return $out; + return $out; } @@ -1165,9 +1165,9 @@ class TSMMonitor { $out .= ""; $out .= ""; $out .= ""; - $out .= ""; + $out .= ""; - return $out; + return $out; } @@ -1244,7 +1244,7 @@ class TSMMonitor { $barcol = $shade."grey"; $statusmsg = ""; } - + if($ii == 1) { $out .= ""; } else { @@ -1279,20 +1279,20 @@ class TSMMonitor { - /** - * findPath - find a external program in the search path - * - * @param string $binary the external program to search for - * @param string $search_path the search path in which to look for the external program - * @return string the full path to the external program or empty string if not found - */ - function findPath($binary, $search_path) { - foreach ($search_path as $path) { - if ((file_exists($path . "/" . $binary)) && (is_readable($path . "/" . $binary))) { - return($path . "/" . $binary); - } - } - } + /** + * findPath - find a external program in the search path + * + * @param string $binary the external program to search for + * @param string $search_path the search path in which to look for the external program + * @return string the full path to the external program or empty string if not found + */ + function findPath($binary, $search_path) { + foreach ($search_path as $path) { + if ((file_exists($path . "/" . $binary)) && (is_readable($path . "/" . $binary))) { + return($path . "/" . $binary); + } + } + } @@ -1304,142 +1304,142 @@ class TSMMonitor { */ function getConfigArray() { - $retArray = array(); + $retArray = array(); - // Navigation - $query = "SELECT * from cfg_mainmenu"; - $mainmenutablerows = $this->adodb->fetchArrayDB($query); + // Navigation + $query = "SELECT * from cfg_mainmenu"; + $mainmenutablerows = $this->adodb->fetchArrayDB($query); - $ret = array(); + $ret = array(); - $menuarray = array(); - $mainmenuarray = array(); + $menuarray = array(); + $mainmenuarray = array(); - while (list ($key, $val) = each ($mainmenutablerows)) { - $menuname = $val['name']; - $menulabel = $val['label']; - $url = "q=overview&m=".$menuname; - $mainmenuarray[$url] = $menulabel; - } + while (list ($key, $val) = each ($mainmenutablerows)) { + $menuname = $val['name']; + $menulabel = $val['label']; + $url = "q=overview&m=".$menuname; + $mainmenuarray[$url] = $menulabel; + } - $menuarrayxml = $queryconfigarray["navigation"]["mainmenuitem"]; - $mainmenuarrayxml = $menuarrayxml; - $mainmenuarray["trennlinie"] = "trennlinie"; - $mainmenuarray["q=polldstat&m=main"] = "Polling Daemon Log"; - $mainmenuarray["q=serverlist&m=main"] = "Change Server"; - if ($_SESSION["logindata"]["role"] == "admin") $mainmenuarray["admin"] = "Admin"; - $mainmenuarray["q=logout"] = "Logout"; - $menuarray["main"] = $mainmenuarray; + $menuarrayxml = $queryconfigarray["navigation"]["mainmenuitem"]; + $mainmenuarrayxml = $menuarrayxml; + $mainmenuarray["trennlinie"] = "trennlinie"; + $mainmenuarray["q=polldstat&m=main"] = "Polling Daemon Log"; + $mainmenuarray["q=serverlist&m=main"] = "Change Server"; + if ($_SESSION["logindata"]["role"] == "admin") $mainmenuarray["admin"] = "Admin"; + $mainmenuarray["q=logout"] = "Logout"; + $menuarray["main"] = $mainmenuarray; - $query = "SELECT * from cfg_mainmenu"; - $mainmenutablerows = $this->adodb->fetchArrayDB($query); - $query = "SELECT * from cfg_queries"; - $querytablerows = $this->adodb->fetchArrayDB($query); - - - while (list ($key, $val) = each ($mainmenutablerows)) { - $menuname = $val['name']; - $menulabel = $val['label']; - $submenuarray = array(); - $submenuarray[""] = "<---"; - $query = "SELECT * from cfg_queries where parent='".$menuname."'"; + $query = "SELECT * from cfg_mainmenu"; + $mainmenutablerows = $this->adodb->fetchArrayDB($query); + $query = "SELECT * from cfg_queries"; $querytablerows = $this->adodb->fetchArrayDB($query); - while (list ($subkey, $submenuitem) = each ($querytablerows)) { - $submenuitem_name = $submenuitem['name']; - $submenuitem_label = $submenuitem['label']; - $url = "q=".$submenuitem_name."&m=".$menuname; - $submenuarray[$url] = $submenuitem_label; + + + while (list ($key, $val) = each ($mainmenutablerows)) { + $menuname = $val['name']; + $menulabel = $val['label']; + $submenuarray = array(); + $submenuarray[""] = "<---"; + $query = "SELECT * from cfg_queries where parent='".$menuname."'"; + $querytablerows = $this->adodb->fetchArrayDB($query); + while (list ($subkey, $submenuitem) = each ($querytablerows)) { + $submenuitem_name = $submenuitem['name']; + $submenuitem_label = $submenuitem['label']; + $url = "q=".$submenuitem_name."&m=".$menuname; + $submenuarray[$url] = $submenuitem_label; + } + $submenuarray["trennlinie"] = "trennlinie"; + $submenuarray["q=polldstat&m=".$submenu['name']] = "Polling Daemon Log"; + $submenuarray["q=serverlist&m=".$submenu['name']] = "Change Server"; + if ($_SESSION["logindata"]["role"] == "admin") $submenuarray["admin"] = "Admin"; + $submenuarray["q=logout"] = "Logout"; + $menuarray[$menuname] = $submenuarray; } - $submenuarray["trennlinie"] = "trennlinie"; - $submenuarray["q=polldstat&m=".$submenu['name']] = "Polling Daemon Log"; - $submenuarray["q=serverlist&m=".$submenu['name']] = "Change Server"; - if ($_SESSION["logindata"]["role"] == "admin") $submenuarray["admin"] = "Admin"; - $submenuarray["q=logout"] = "Logout"; - $menuarray[$menuname] = $submenuarray; - } - $retArray["menuarray"] = $menuarray; + $retArray["menuarray"] = $menuarray; - // Admin Backend Menu - $adminmenuarray = array(); - $adminmenuarray["q=config&m=main"] = "General"; - $adminmenuarray["q=users&m=main"] = "Users"; - $adminmenuarray["q=groups&m=main"] = "Groups"; - $adminmenuarray["q=servers&m=main"] = "Servers"; - $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; + // Admin Backend Menu + $adminmenuarray = array(); + $adminmenuarray["q=config&m=main"] = "General"; + $adminmenuarray["q=users&m=main"] = "Users"; + $adminmenuarray["q=groups&m=main"] = "Groups"; + $adminmenuarray["q=servers&m=main"] = "Servers"; + $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; - // Overview Boxes - $ret = array(); - - $query = "SELECT * from cfg_overviewboxes order by sortorder asc"; - $queryoverviewboxes = $this->adodb->fetchArrayDB($query); - while (list ($subkey, $box) = each ($queryoverviewboxes)) { - $query = "SELECT * from cfg_overviewqueries where parent='".$box['name']."' order by sortorder asc"; - $queryoverview = $this->adodb->fetchArrayDB($query); - $temp = array (); - //print_r($queryoverview); - while (list ($subkey, $ovquery) = each ($queryoverview)) { - $ovquery['header'] = $queryoverview['name']; - $temp[] = (array)$ovquery; + // Overview Boxes + $ret = array(); + + $query = "SELECT * from cfg_overviewboxes order by sortorder asc"; + $queryoverviewboxes = $this->adodb->fetchArrayDB($query); + while (list ($subkey, $box) = each ($queryoverviewboxes)) { + $query = "SELECT * from cfg_overviewqueries where parent='".$box['name']."' order by sortorder asc"; + $queryoverview = $this->adodb->fetchArrayDB($query); + $temp = array (); + //print_r($queryoverview); + while (list ($subkey, $ovquery) = each ($queryoverview)) { + $ovquery['header'] = $queryoverview['name']; + $temp[] = (array)$ovquery; + } + $ret[$box['name']] = $temp; } - $ret[$box['name']] = $temp; - } - $retArray["infoboxarray"] = $ret; + $retArray["infoboxarray"] = $ret; - // Queries - $dbret = array(); - $query = "SELECT * from cfg_queries"; - $querytablerows = $this->adodb->fetchArrayDB($query); - while (list ($subkey, $queryrow) = each ($querytablerows)) { - $dbret[$queryrow['name']] = (array)$queryrow; - } - $retArray["queryarray"] = $dbret; - - // General settings - $query = "SELECT * from cfg_config"; - $rows = $this->adodb->fetchArrayDB($query); - $ret = array(); - foreach ($rows as $key => $val) { - $ret[$val['confkey']] = $val['confval']; - } - $retArray["settings"] = $ret; - - // Set Stylesheet - $query = "SELECT stylesheet from cfg_users where username='".$_SESSION["logindata"]["user"]."'"; - $row = $this->adodb->fetchArrayDB($query); - $retArray["stylesheet"] = $row[0]['stylesheet']; - - // Colors - $query = "SELECT * from cfg_colors"; - $rows = $this->adodb->fetchArrayDB($query); - - $ret = array(); - while (list ($key, $val) = each ($rows)) { - $ret[$val['name']] = $val['value']; - } - $retArray["colorsarray"] = $ret; - - // Servers - $query = "SELECT * from cfg_servers"; - $rows = $this->adodb->fetchArrayDB($query); - - $ret = array(); - while (list ($key, $val) = each ($rows)) { - $ret[$val['servername']] = (array)$val; - if ($val['default'] == 1) { - $retArray["defaultserver"] = $val['servername']; + // Queries + $dbret = array(); + $query = "SELECT * from cfg_queries"; + $querytablerows = $this->adodb->fetchArrayDB($query); + while (list ($subkey, $queryrow) = each ($querytablerows)) { + $dbret[$queryrow['name']] = (array)$queryrow; } - } + $retArray["queryarray"] = $dbret; - $retArray["serverlist"] = $ret; - return $retArray; + // General settings + $query = "SELECT * from cfg_config"; + $rows = $this->adodb->fetchArrayDB($query); + $ret = array(); + foreach ($rows as $key => $val) { + $ret[$val['confkey']] = $val['confval']; + } + $retArray["settings"] = $ret; + + // Set Stylesheet + $query = "SELECT stylesheet from cfg_users where username='".$_SESSION["logindata"]["user"]."'"; + $row = $this->adodb->fetchArrayDB($query); + $retArray["stylesheet"] = $row[0]['stylesheet']; + + // Colors + $query = "SELECT * from cfg_colors"; + $rows = $this->adodb->fetchArrayDB($query); + + $ret = array(); + while (list ($key, $val) = each ($rows)) { + $ret[$val['name']] = $val['value']; + } + $retArray["colorsarray"] = $ret; + + // Servers + $query = "SELECT * from cfg_servers"; + $rows = $this->adodb->fetchArrayDB($query); + + $ret = array(); + while (list ($key, $val) = each ($rows)) { + $ret[$val['servername']] = (array)$val; + if ($val['default'] == 1) { + $retArray["defaultserver"] = $val['servername']; + } + } + + $retArray["serverlist"] = $ret; + return $retArray; } } diff --git a/index.php b/index.php index 2cb0194..0c9d8cc 100644 --- a/index.php +++ b/index.php @@ -1,25 +1,25 @@ + Copyright (C) 2009 Michael Clemens - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . -************************************************************************ -*/ + You should have received a copy of the GNU General Public License + along with this program. If not, see . + ************************************************************************ + */ /** * @@ -36,165 +36,167 @@ include_once "includes/page_head.php"; ?> - - - - - - -
+ + + + + + +
- GETVars['qq'], array("admin", "serverlist", "custom", "polldstat", "index", "overview", "")) && !strstr($tsmmonitor->GETVars['qq'], 'table') ) { - echo $tsmmonitor->getSearchfield(); - } - ?> + GETVars['qq'], array("admin", "serverlist", "custom", "polldstat", "index", "overview", "")) && !strstr($tsmmonitor->GETVars['qq'], 'table') ) { + echo $tsmmonitor->getSearchfield(); + } + ?> -
-
- -
- +
+
+ +
+ - - - - - - -
- - -
- -
- - - - - + + + + + +
+ + +
+ +
+ + + + + GETVars['qq'] != "logout" && $_SESSION["logindata"]["loggedin"]){ - if ($tsmmonitor->GETVars['qq'] != "" && $tsmmonitor->GETVars['qq'] != "overview"){ - - // show overview page - if ($tsmmonitor->GETVars['qq'] == "index") { - include_once "includes/overview.php" ; - - // show polld status - } else if ($tsmmonitor->GETVars['qq'] == "polldstat") { - echo $tsmmonitor->getPollDStat(); - - // show serverlist - } else if ( $tsmmonitor->GETVars['qq'] == "serverlist" ) { - echo $tsmmonitor->getServerlist(); + // main content, right of menu + if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"]) && $tsmmonitor->GETVars['qq'] != "logout" && $_SESSION["logindata"]["loggedin"]){ + if ($tsmmonitor->GETVars['qq'] != "" && $tsmmonitor->GETVars['qq'] != "overview"){ - // "vertical" table - } else if ( strstr($tsmmonitor->GETVars['qq'], 'vertical')) { + // show overview page + if ($tsmmonitor->GETVars['qq'] == "index") { + include_once "includes/overview.php" ; + + // show polld status + } else if ($tsmmonitor->GETVars['qq'] == "polldstat") { + echo $tsmmonitor->getPollDStat(); + + // show serverlist + } else if ( $tsmmonitor->GETVars['qq'] == "serverlist" ) { + echo $tsmmonitor->getServerlist(); + + // "vertical" table + } else if ( strstr($tsmmonitor->GETVars['qq'], 'vertical')) { - $i = 0; - $tablearray = $tsmmonitor->execute('verticaltable'); - echo ""; - echo ""; - foreach ($tablearray as $row) { - while(list($keycell, $valcell) = each($row)) { - if ($i == 0) { - echo ""; - $i = 1; - } else { - echo ""; $i = 0; - } - echo ""; - } - } - - echo "
KeyValue
".$keycell."".$valcell."
"; - - - // show normal table layout - } else { - if ($_SESSION["tabletype"]!="" && $_SESSION["tabletype"] == "timetable") { - - if ($_POST["back"] != "") { - $_SESSION['timeshift'] += $_SESSION['selectedtimestep']; - } - if ($_POST["forward"] != "") { - $_SESSION['timeshift'] -= $_SESSION['selectedtimestep']; - } - if ($_SESSION['timeshift'] < 0) { - $_SESSION['timeshift'] = 0; - } - - $tablearray = $tsmmonitor->execute('timetable'); - $headerarray = $queryarray[$tsmmonitor->GETVars['qq']]["header"]["column"]; - echo $tsmmonitor->generateTimetable($tablearray, $headerarray[0]); - - - } else { - - $whereclause = array(); - $whereclause["field"] = $_POST["wcfield"]; - $whereclause["val"] = $_POST["wcval"]; - $whereclause["op"] = $_POST["wcop"]; - //} - if ($whereclause["field"]!="" && $whereclause["val"]!="") { - if ($_POST["Clear"] == "Clear") { - $_SESSION["search"][$tsmmonitor->GETVars['qq']] = ""; - } else { - if (!isset($_SESSION["search"])){ - $temp = array(); - $temp[$tsmmonitor->GETVars['qq']] = $whereclause; - $_SESSION["search"] = $temp; - } else { - $_SESSION["search"][$tsmmonitor->GETVars['qq']] = $whereclause; + $tablearray = $tsmmonitor->execute('verticaltable'); + echo ""; + echo ""; + foreach ($tablearray as $row) { + while(list($keycell, $valcell) = each($row)) { + if ($i == 0) { + echo ""; + $i = 1; + } else { + echo ""; + $i = 0; + } + echo ""; + } } + + echo "
KeyValue
".$keycell."".$valcell."
"; + + + // show normal table layout + } else { + if ($_SESSION["tabletype"]!="" && $_SESSION["tabletype"] == "timetable") { + + if ($_POST["back"] != "") { + $_SESSION['timeshift'] += $_SESSION['selectedtimestep']; + } + if ($_POST["forward"] != "") { + $_SESSION['timeshift'] -= $_SESSION['selectedtimestep']; + } + if ($_SESSION['timeshift'] < 0) { + $_SESSION['timeshift'] = 0; + } + + $tablearray = $tsmmonitor->execute('timetable'); + $headerarray = $queryarray[$tsmmonitor->GETVars['qq']]["header"]["column"]; + echo $tsmmonitor->generateTimetable($tablearray, $headerarray[0]); + + + } else { + + $whereclause = array(); + $whereclause["field"] = $_POST["wcfield"]; + $whereclause["val"] = $_POST["wcval"]; + $whereclause["op"] = $_POST["wcop"]; + //} + if ($whereclause["field"]!="" && $whereclause["val"]!="") { + if ($_POST["Clear"] == "Clear") { + $_SESSION["search"][$tsmmonitor->GETVars['qq']] = ""; + } else { + if (!isset($_SESSION["search"])){ + $temp = array(); + $temp[$tsmmonitor->GETVars['qq']] = $whereclause; + $_SESSION["search"] = $temp; + } else { + $_SESSION["search"][$tsmmonitor->GETVars['qq']] = $whereclause; + } + } + } + echo ""; + $thead = $tsmmonitor->getTableheader(); + echo $thead; + echo $tsmmonitor->execute('table'); + $nav = $tsmmonitor->showPageNavigation("40"); + if ($nav!="") { + echo ""; + } + echo "
"; + } + } } - echo ""; - $thead = $tsmmonitor->getTableheader(); - echo $thead; - echo $tsmmonitor->execute('table'); - $nav = $tsmmonitor->showPageNavigation("40"); - if ($nav!="") { - echo ""; - } - echo "
"; + } else { + if (isset($_SESSION["logindata"])){ + $errormsg = "Login failed!"; + }else{ + $errormsg = "Login"; } - } - } -} else { - if (isset($_SESSION["logindata"])){ - $errormsg = "Login failed!"; - }else{ - $errormsg = "Login"; - } + session_unset(); + $_SESSION=array(); - session_unset(); - $_SESSION=array(); - include_once "includes/login.php"; + include_once "includes/login.php"; -} -$_SESSION['from'] = $tsmmonitor->GETVars['qq']; -session_write_close(void); -?> + } + $_SESSION['from'] = $tsmmonitor->GETVars['qq']; + session_write_close(void); + ?> - + + - + diff --git a/polld/tmonpolld.php b/polld/tmonpolld.php index f2f8845..00a5641 100644 --- a/polld/tmonpolld.php +++ b/polld/tmonpolld.php @@ -1,23 +1,23 @@ . -************************************************************************ -*/ + You should have received a copy of the GNU General Public License + along with TSM Monitor. If not, see . + ************************************************************************ + */ /**