reformatted/beautified most files

This commit is contained in:
Michael Clemens 2009-05-18 11:37:07 +00:00
parent 75611f3f8f
commit 5624331190
15 changed files with 1337 additions and 1346 deletions

545
admin.php
View File

@ -1,23 +1,23 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
/**
*
@ -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"];
}
?>
<?php if ($_SESSION["logindata"]["loggedin"]) { ?>
<tr>
<td colspan="2" id="head"><a class='navheader' href="admin.php"><img src="images/PollDTitleAdmin.gif" border=0></img></a></td>
</tr>
<tr>
<td id="tnleft"></td>
<td id="tnright">
</td>
<tr>
<td colspan="2" id="head"><a class='navheader' href="admin.php"><img src="images/PollDTitleAdmin.gif" border=0></img></a></td>
</tr>
<tr>
<td id="tnleft"></td>
<td id="tnright"></td>
<?php } ?>
</tr>
<tr>
<?php if ($_SESSION["logindata"]["loggedin"]) { ?>
<!-- Start left cik navigation menu -->
<td id="menue">
<div class="menuelinks">
<?php echo $tsmmonitor->getMenu( $tsmmonitor->adminmenu, "admin.php?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu'], "admin" ); ?>
</div>
<br>
<img src="/images/trans.gif" alt="" width="150" height="1" border="0"><br>
</td>
<!-- End left cik navigation menu -->
<?php } ?>
<td id="content">
<?php
</tr>
<tr>
<?php if ($_SESSION["logindata"]["loggedin"]) { ?>
<!-- Start left navigation menu -->
<td id="menue">
<div class="menuelinks">
<?php echo $tsmmonitor->getMenu( $tsmmonitor->adminmenu, "admin.php?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu'], "admin" ); ?>
</div>
<br>
<img src="/images/trans.gif" alt="" width="150" height="1" border="0"><br>
</td>
<!-- End left navigation menu -->
<?php } ?>
<td id="content">
<?php
// 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") {
// 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 "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']." method='post'>";
echo "<table class='zebra'>";
echo "<tr><th>Configuration</th><th>Action</th><th>Status</th></tr>";
echo "<tr class='d0'>";
echo " <td>PollD Control</td>";
echo " <td>";
echo " <input type='submit' class='button' name='PollDControl' value='Start' onclick='submit();'>";
echo " <input type='submit' class='button' name='PollDControl' value='Stop' onclick='submit();'>";
echo " </td>";
echo " <td bgcolor=".$cellcolor.">PollD is ".$polldenabled."</td>";
echo "</tr>";
echo "<tr class='d1'>";
echo " <td>Debug Mode</td>";
echo " <td>";
echo " <input type='submit' class='button' name='DebugMode' value='On' onclick='submit();'>";
echo " <input type='submit' class='button' name='DebugMode' value='Off' onclick='submit();'>";
echo " </td>";
echo " <td>".$_SESSION["debug"]."</td>";
echo "</tr>";
echo "<tr class='d0'>";
echo " <td>PollD Control</td>";
echo " <td>";
echo " <table border=0>";
echo " <tr><td>";
echo " <select name='cleandbserver' size=1 class='button'>";
echo " <option value='all'>- all servers -</options>";
while(list($servername,$serveritems) = each($tsmmonitor->configarray["serverlist"])) {
echo '<option value="'.$servername.'"> '.$servername.' ('.$serveritems["description"].')</option>';
}
echo " </select>";
echo " </td><td>";
echo " <select name='cleandbquery' size=1 class='button'>";
echo ' <option value="all">- all queries -</options>';
while(list($queryname,$queryitems) = each($tsmmonitor->queryarray)) {
echo '<option value="'.$queryname.'"> '.$queryname.'</option>';
}
echo " </select>";
echo " </td><td>";
echo " <select name='cleandbovqueires' size=1 class='button'>";
echo ' <option value="yes">yes</options>';
echo ' <option value="no">no</options>';
echo " </select>";
echo " </td><td>";
echo " <select name='cleandbtime' size=1 class='button'>";
$times = array("1 month" => "30", "2 months" => "60", "3 months" => "90", "6 months" => "180", "1 year" => "360");
while(list($label,$value) = each($times)) {
echo '<option value="'.$value.'"> '.$label.'</option>';
}
echo " </select>";
echo " </td><td>";
echo " <input type='submit' class='button' name='cleanaction' value='Clean Up' onclick='submit();'>";
echo " </td></tr>";
echo " </table>";
echo " </td>";
echo " <td></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
echo "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']." method='post'>";
echo "<table class='zebra'>";
echo "<tr><th>Configuration</th><th>Action</th><th>Status</th></tr>";
echo "<tr class='d0'>";
echo " <td>PollD Control</td>";
echo " <td>";
echo " <input type='submit' class='button' name='PollDControl' value='Start' onclick='submit();'>";
echo " <input type='submit' class='button' name='PollDControl' value='Stop' onclick='submit();'>";
echo " </td>";
echo " <td bgcolor=".$cellcolor.">PollD is ".$polldenabled."</td>";
echo "</tr>";
echo "<tr class='d1'>";
echo " <td>Debug Mode</td>";
echo " <td>";
echo " <input type='submit' class='button' name='DebugMode' value='On' onclick='submit();'>";
echo " <input type='submit' class='button' name='DebugMode' value='Off' onclick='submit();'>";
echo " </td>";
echo " <td>".$_SESSION["debug"]."</td>";
echo "</tr>";
echo "<tr class='d0'>";
echo " <td>PollD Control</td>";
echo " <td>";
echo " <table border=0>";
echo " <tr><td>";
echo " <select name='cleandbserver' size=1 class='button'>";
echo " <option value='all'>- all servers -</options>";
while(list($servername,$serveritems) = each($tsmmonitor->configarray["serverlist"])) {
echo '<option value="'.$servername.'"> '.$servername.' ('.$serveritems["description"].')</option>';
} 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 "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']." method='post'>";
echo "<table class='zebra'>";
echo "<tr><th>Key</th><th>Value</th></tr>";
foreach ($sqlresth as $col) {
echo "TEST: ".$col['Field']." -> $colval<br>\n";
if ($col['Field'] != "id") {
if ($i == 0) {
echo "<tr class='d0'>";
$i = 1;
} else {
echo "<tr class='d1'>";
$i = 0;
}
if ($col['Field'] == "password") {
echo "<td><b>".$col['Field']."</b></td><td><input type='password' name='txt".$col['Field']."' value='' /></td></tr>";
} else {
echo "<td><b>".$col['Field']."</b></td><td><input type='text' size='50' name='txt".$col['Field']."' value='' /></td></tr>";
}
}
}
echo "<tr><td colspan=2 class='footer'>";
echo "<input type='submit' class='button' name='AddSave' value='Save' onclick='submit();'>";
echo "<input type='submit' class='button' name='Cancel' value='Cancel' onclick='submit();'>";
echo "</td></tr>";
echo "</table></form>";
// show Edit Existing Entry Form
} else {
$tablearray = $tsmmonitor->getAdminTables("edit");
echo "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']." method='post'>";
echo "<table class='zebra'>";
echo "<tr><th>Key</th><th>Value</th></tr>";
foreach ($tablearray as $row) {
while(list($keycell, $valcell) = each($row)) {
if ($i == 0) {
echo "<tr class='d0'>";
$i = 1;
} else {
echo "<tr class='d1'>";
$i = 0;
}
if ($keycell == "password") {
echo "<td><b>".$keycell."</b></td><td><input type='password' name='txt".$keycell."' value='' /></td></tr>";
} else if ($keycell == "id") {
$id = $valcell;
} else {
echo "<td><b>".$keycell."</b></td><td><input type='text' size='50' name='txt".$keycell."' value='".$valcell."' /></td></tr>";
}
}
}
echo "<tr><td colspan=2 class='footer'>";
echo "<input type='submit' class='button' name='EditSave' value='Save' onclick='submit();'>";
echo "<input type='submit' class='button' name='Cancel' value='Cancel' onclick='submit();'>";
echo "<input type='hidden' name='id' value='".$id."' />";
echo "</td></tr>";
echo "</table></form>";
}
// 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 "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']." method='post'>";
echo "<table class='zebra'>";
echo $tsmmonitor->getTableheader();
echo $tsmmonitor->getAdminTables("list");
$nav = $tsmmonitor->showPageNavigation("40");
if ($nav!="") {
echo "<tr><td colspan='0' align='center' class='footer'><a class='navhead'>".$nav."</a></td></tr>";
}
echo "</table>";
echo "<input type='submit' class='button' name='Add' value='Add' onclick='submit();'>";
echo "</form>";
}
}
echo " </select>";
echo " </td><td>";
echo " <select name='cleandbquery' size=1 class='button'>";
echo ' <option value="all">- all queries -</options>';
while(list($queryname,$queryitems) = each($tsmmonitor->queryarray)) {
echo '<option value="'.$queryname.'"> '.$queryname.'</option>';
}
echo " </select>";
echo " </td><td>";
echo " <select name='cleandbovqueires' size=1 class='button'>";
echo ' <option value="yes">yes</options>';
echo ' <option value="no">no</options>';
echo " </select>";
echo " </td><td>";
echo " <select name='cleandbtime' size=1 class='button'>";
$times = array("1 month" => "30", "2 months" => "60", "3 months" => "90", "6 months" => "180", "1 year" => "360");
while(list($label,$value) = each($times)) {
echo '<option value="'.$value.'"> '.$label.'</option>';
}
echo " </select>";
echo " </td><td>";
echo " <input type='submit' class='button' name='cleanaction' value='Clean Up' onclick='submit();'>";
echo " </td></tr>";
echo " </table>";
echo " </td>";
echo " <td></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
} 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 "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']." method='post'>";
echo "<table class='zebra'>";
echo "<tr><th>Key</th><th>Value</th></tr>";
foreach ($sqlresth as $col) {
echo "TEST: ".$col['Field']." -> $colval<br>\n";
if ($col['Field'] != "id") {
if ($i == 0) {
echo "<tr class='d0'>";
$i = 1;
} else {
echo "<tr class='d1'>";
$i = 0;
}
if ($col['Field'] == "password") {
echo "<td><b>".$col['Field']."</b></td><td><input type='password' name='txt".$col['Field']."' value='' /></td></tr>";
} else {
echo "<td><b>".$col['Field']."</b></td><td><input type='text' size='50' name='txt".$col['Field']."' value='' /></td></tr>";
}
}
}
echo "<tr><td colspan=2 class='footer'>";
echo "<input type='submit' class='button' name='AddSave' value='Save' onclick='submit();'>";
echo "<input type='submit' class='button' name='Cancel' value='Cancel' onclick='submit();'>";
echo "</td></tr>";
echo "</table></form>";
session_unset();
$_SESSION=array();
include_once "includes/login.php";
// show Edit Existing Entry Form
} else {
$tablearray = $tsmmonitor->getAdminTables("edit");
echo "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']." method='post'>";
echo "<table class='zebra'>";
echo "<tr><th>Key</th><th>Value</th></tr>";
foreach ($tablearray as $row) {
while(list($keycell, $valcell) = each($row)) {
if ($i == 0) {
echo "<tr class='d0'>";
$i = 1;
} else {
echo "<tr class='d1'>";
$i = 0;
}
if ($keycell == "password") {
echo "<td><b>".$keycell."</b></td><td><input type='password' name='txt".$keycell."' value='' /></td></tr>";
} else if ($keycell == "id") {
$id = $valcell;
} else {
echo "<td><b>".$keycell."</b></td><td><input type='text' size='50' name='txt".$keycell."' value='".$valcell."' /></td></tr>";
}
}
}
echo "<tr><td colspan=2 class='footer'>";
echo "<input type='submit' class='button' name='EditSave' value='Save' onclick='submit();'>";
echo "<input type='submit' class='button' name='Cancel' value='Cancel' onclick='submit();'>";
echo "<input type='hidden' name='id' value='".$id."' />";
echo "</td></tr>";
}
$_SESSION['from'] = $tsmmonitor->GETVars['qq'];
session_write_close(void);
?>
</td>
</tr>
echo "</table></form>";
}
<?php if ($_SESSION["logindata"]["loggedin"]) include_once "includes/footer.php"; ?>
// 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 "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']." method='post'>";
echo "<table class='zebra'>";
echo $tsmmonitor->getTableheader();
echo $tsmmonitor->getAdminTables("list");
$nav = $tsmmonitor->showPageNavigation("40");
if ($nav!="") {
echo "<tr><td colspan='0' align='center' class='footer'><a class='navhead'>".$nav."</a></td></tr>";
}
echo "</table>";
echo "<input type='submit' class='button' name='Add' value='Add' onclick='submit();'>";
echo "</form>";
}
}
}
} 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);
?>
</tr>
<?php if ($_SESSION["logindata"]["loggedin"]) include_once "includes/footer.php"; ?>
</table>
</table>
</div>
</body>

View File

@ -1,24 +1,24 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
************************************************************************
*/
/**
*
@ -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 "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>";
//exit;
return "";
}
$recordSet = &$this->conn->Execute($sql);
if (($recordSet) || ($this->conn->ErrorNo() == 0)) {
return($recordSet);
} else {
echo "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>";
//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 "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>";
exit;
}
} else {
echo "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>";
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 "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>";
exit;
}
} else {
echo "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>";
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 "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>";
exit;
}
$recordSet->close();
return($recordArray);
} else {
echo "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>";
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;
}
}

View File

@ -1,23 +1,23 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
/**
*

View File

@ -1,23 +1,23 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
/**
*
@ -32,13 +32,13 @@
?>
<!-- Begin: footer.php -->
<?php if ($message!="") { ?>
<tr>
<td colspan="2" id="sysinfo"><b>System Message: </b><?php echo $message; ?></td>
</tr>
<tr>
<td colspan="2" id="sysinfo"><b>System Message: </b><?php echo $message; ?></td>
</tr>
<?php } ?>
<tr>
<td colspan="2" id="footer">
TSM Monitor 2 v<?php echo $config["tsm_monitor_version"]?> &copy; 2008 - <?php echo date('Y'); ?> TSM Monitor Development Team (<a class='nav' href="http://www.tsm-monitor.org">www.tsm-monitor.org</a>)
</td>
</tr>
<tr>
<td colspan="2" id="footer">
TSM Monitor 2 v<?php echo $config["tsm_monitor_version"]?> &copy; 2008 - <?php echo date('Y'); ?> TSM Monitor Development Team (<a class='nav' href="http://www.tsm-monitor.org">www.tsm-monitor.org</a>)
</td>
</tr>
<!-- End: footer.php -->

View File

@ -1,22 +1,22 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
/**
*
@ -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 ** //

View File

@ -1,24 +1,24 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
<form action="<?php echo $_SERVER['PHP_SELF']."?q=".$qq."&m=".$menu; ?>" method="post">
*/
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
<form action="<?php echo $_SERVER['PHP_SELF']."?q=".$qq."&m=".$menu; ?>" method="post">
*/
/**
*
@ -40,23 +40,23 @@ if ($isAdmin) {
?>
<form action="<?php echo $_SERVER['PHP_SELF']; if ($GETVars['qq'] != 'logout'){ echo '?q='.$GETVars['qq'].'&m='.$GETVars['menu']; } ?>" method="post">
<br>
<br>
<br>
<br>
<table class='login'>
<tr>
<td colspan="2" id="head"><a class='navheader' ><img src="<?php echo $headerimage ?>" border=0></img></a></td>
</tr>
<tr><th colspan="2"><?php echo $errormsg ?></th></tr>
<tr><td>Username:</td><td><input name="loginname"></td></tr>
<tr><td>Password:</td><td><input name="loginpasswort" type=password></td></tr>
<tr><td colspan="2"><input type=submit name=submit value="Login"></td></tr>
</table>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<table class='login'>
<tr>
<td colspan="2" id="head"><a class='navheader' ><img src="<?php echo $headerimage ?>" border=0></img></a></td>
</tr>
<tr><th colspan="2"><?php echo $errormsg ?></th></tr>
<tr><td>Username:</td><td><input name="loginname"></td></tr>
<tr><td>Password:</td><td><input name="loginpasswort" type=password></td></tr>
<tr><td colspan="2"><input type=submit name=submit value="Login"></td></tr>
</table>
<br>
<br>
<br>
<br>
<br>
<br>
</form>

View File

@ -1,23 +1,23 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
/**
*
@ -32,43 +32,43 @@
?>
<table width=90% cellspacing="3" cellpadding="3">
<tr><td colspan="3" height='15px'></td></tr>
<tr><th colspan="3" align='center'>Quick Overview for Server <?php echo $server; ?></th></tr>
<tr><td colspan="3" height='15px'></td></tr>
<tr><td colspan="3" height='15px'></td></tr>
<tr><th colspan="3" align='center'>Quick Overview for Server <?php echo $server; ?></th></tr>
<tr><td colspan="3" height='15px'></td></tr>
<tr>
<td width='48%' valign='top'>
<table class='zebra'>
<tr><th colspan="2">Health Status</th></tr>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["healthdata"]); ?>
</table>
</td>
<td width='4%'>
</td>
<td width='48%' valign='top'>
<table class='zebra'>
<tr><th colspan="2">TSM Database</th></tr>
<?php //echo getOverviewRows(getInfobox("database")); ?>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["database"]); ?>
</table>
</td>
<td width='48%' valign='top'>
<table class='zebra'>
<tr><th colspan="2">Health Status</th></tr>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["healthdata"]); ?>
</table>
</td>
<td width='4%'>
</td>
<td width='48%' valign='top'>
<table class='zebra'>
<tr><th colspan="2">TSM Database</th></tr>
<?php //echo getOverviewRows(getInfobox("database")); ?>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["database"]); ?>
</table>
</td>
</tr>
<tr><td colspan="3" height='20px'></td></tr>
<tr>
<td width='48%' valign='top'>
<table class='zebra'>
<tr><th colspan="2">Total Data</th></tr>
<?php //echo getOverviewRows(getInfobox("totaldata")); ?>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["totaldata"]); ?>
</table>
</td>
<td width='4%'>
</td>
<td width='48%' valign='top'>
<table class='zebra'>
<tr><th colspan="2">Schedule Status</th></tr>
<?php //echo getOverviewRows(getInfobox("schedules")); ?>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["schedules"]); ?>
</table>
</td>
</tr>
<tr>
<td width='48%' valign='top'>
<table class='zebra'>
<tr><th colspan="2">Total Data</th></tr>
<?php //echo getOverviewRows(getInfobox("totaldata")); ?>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["totaldata"]); ?>
</table>
</td>
<td width='4%'>
</td>
<td width='48%' valign='top'>
<table class='zebra'>
<tr><th colspan="2">Schedule Status</th></tr>
<?php //echo getOverviewRows(getInfobox("schedules")); ?>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["schedules"]); ?>
</table>
</td>
</tr>
</table>

View File

@ -1,21 +1,21 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
*************************************************************************/
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
*************************************************************************/
/**
*
@ -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";
?>
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<!-- Begin: page_head.php -->
<html>
<head>
<title>TSM Monitor</title>
<meta http-equiv='content-type' content='text/html; charset=ISO-8859-1'>
<link rel='shortcut icon' href='images/favicon.ico' type='image/x-icon'>
<link rel='icon' href='images/favicon.ico' type='image/x-icon'>
<link rel="stylesheet" type="text/css" href="css/print.css" media="print">
<link rel='stylesheet' type='text/css' href='css/layout.css'>
<link rel='stylesheet' type='text/css' href='css/<?php echo $_SESSION['stylesheet']; ?>'>
<script type="text/javascript" src="extlib/datechooser.js"></script>
<script type="text/javascript" src="includes/functions.js"></script>
<script type="text/javascript">
<!-- //
events.add(window, 'load', WindowLoad);
function WindowLoad()
{
var datepicker = document.getElementById('datechooser');
var objLateDate = new Date();
var objStartDate = new Date();
objStartDate.setMonth(<?php if ($_SESSION['timemachine']['date']!= "") echo strftime("%m", $_SESSION['timemachine']['date']); ?>);
objStartDate.setDate(<?php if ($_SESSION['timemachine']['date']!= "") echo strftime("%d", $_SESSION['timemachine']['date']); ?>);
objStartDate.setYear(<?php if ($_SESSION['timemachine']['date']!= "") echo strftime("%Y", $_SESSION['timemachine']['date']); ?>);
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;
}
<head>
<title>TSM Monitor</title>
<meta http-equiv='content-type' content='text/html; charset=ISO-8859-1'>
<link rel='shortcut icon' href='images/favicon.ico' type='image/x-icon'>
<link rel='icon' href='images/favicon.ico' type='image/x-icon'>
<link rel="stylesheet" type="text/css" href="css/print.css" media="print">
<link rel='stylesheet' type='text/css' href='css/layout.css'>
<link rel='stylesheet' type='text/css' href='css/<?php echo $_SESSION['stylesheet']; ?>'>
<script type="text/javascript" src="extlib/datechooser.js"></script>
<script type="text/javascript" src="includes/functions.js"></script>
<script type="text/javascript">
<!-- //
events.add(window, 'load', WindowLoad);
function genPDF() {
window.open( "includes/show_pdf.php?q=<?php echo $_SESSION['GETVars']['qq'] ?>&s=<?php echo $_SESSION['GETVars']['server'] ?>", "myWindow", "status = 1, fullscreen=yes,scrollbars=yes" )
}
function WindowLoad()
{
var datepicker = document.getElementById('datechooser');
var objLateDate = new Date();
var objStartDate = new Date();
// -->
</script>
</meta>
</head>
objStartDate.setMonth(<?php if ($_SESSION['timemachine']['date']!= "") echo strftime("%m", $_SESSION['timemachine']['date']); ?>);
objStartDate.setDate(<?php if ($_SESSION['timemachine']['date']!= "") echo strftime("%d", $_SESSION['timemachine']['date']); ?>);
objStartDate.setYear(<?php if ($_SESSION['timemachine']['date']!= "") echo strftime("%Y", $_SESSION['timemachine']['date']); ?>);
<body>
<div id="inhalt">
<table cellspacing="4" cellpadding="2" border="0" id="design">
<!-- End: page_head.php -->
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=<?php echo $_SESSION['GETVars']['qq'] ?>&s=<?php echo $_SESSION['GETVars']['server'] ?>", "myWindow", "status = 1, fullscreen=yes,scrollbars=yes" )
}
// -->
</script>
</meta>
</head>
<body>
<div id="inhalt">
<table cellspacing="4" cellpadding="2" border="0" id="design">
<!-- End: page_head.php -->

View File

@ -1,22 +1,22 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
/**
@ -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();

View File

@ -1,23 +1,23 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
/**
@ -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);

View File

@ -1,22 +1,22 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
/**
@ -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

View File

@ -32,35 +32,34 @@
?>
<form action="<?php echo $_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']."&s=".$tsmmonitor->GETVars['server']; ?>" method="post">
<?php
//if ($tsmmonitor->GETVars['qq'] != "admin" && !$_POST["edit"] == "edit") {
if ($tsmmonitor->GETVars['qq'] != "index" && $tsmmonitor->GETVars['qq'] != "overview" && $tsmmonitor->GETVars['qq'] != "serverlist") {
echo "<input type='button' value='PDF' onclick='genPDF()' class='button topnavbutton'>";
<?php
if ($tsmmonitor->GETVars['qq'] != "index" && $tsmmonitor->GETVars['qq'] != "overview" && $tsmmonitor->GETVars['qq'] != "serverlist") {
echo "<input type='button' value='PDF' onclick='genPDF()' class='button topnavbutton'>";
if ($tsmmonitor->configarray["queryarray"][$tsmmonitor->GETVars['qq']]["timetablefields"] != "") {
if ($tsmmonitor->configarray["queryarray"][$tsmmonitor->GETVars['qq']]["timetablefields"] != "") {
echo "<select name='tabletype' size=1 onChange='submit();' class='button topnavbutton'>";
$types = array('normal view', 'timetable');
foreach ($types as $type) {
echo '<option value="'.$type.'"';
if ($_SESSION['tabletype'] == $type){echo "SELECTED";}
echo '> '.$type.'</option>';
echo "<select name='tabletype' size=1 onChange='submit();' class='button topnavbutton'>";
$types = array('normal view', 'timetable');
foreach ($types as $type) {
echo '<option value="'.$type.'"';
if ($_SESSION['tabletype'] == $type){echo "SELECTED";}
echo '> '.$type.'</option>';
}
echo "</select>";
}
}
if ($tsmmonitor->GETVars['qq'] != "polldstat" && $tsmmonitor->GETVars['qq'] != "serverlist") {
echo "<select name='s' size=1 onChange='submit();' class='button topnavbutton'>";
while(list($servername,$serveritems) = each($tsmmonitor->configarray["serverlist"])) {
echo '<option value="'.$servername.'"';
if ($tsmmonitor->GETVars['server'] == $servername){echo "SELECTED";}
echo '> '.$servername.' ('.$serveritems["description"].')</option>';
}
echo "</select>";
}
}
if ($tsmmonitor->GETVars['qq'] != "polldstat" && $tsmmonitor->GETVars['qq'] != "serverlist") {
echo "<select name='s' size=1 onChange='submit();' class='button topnavbutton'>";
while(list($servername,$serveritems) = each($tsmmonitor->configarray["serverlist"])) {
echo '<option value="'.$servername.'"';
if ($tsmmonitor->GETVars['server'] == $servername){echo "SELECTED";}
echo '> '.$servername.' ('.$serveritems["description"].')</option>';
}
echo "</select>";
}
?>
?>
</form>

File diff suppressed because it is too large Load Diff

318
index.php
View File

@ -1,25 +1,25 @@
<?php
/*
************************************************************************
TSM Monitor 2 v0.1 (www.tsm-monitor.org)
************************************************************************
TSM Monitor 2 v0.1 (www.tsm-monitor.org)
Copyright (C) 2009 Michael Clemens <mail@tsm-monitor.org>
Copyright (C) 2009 Michael Clemens <mail@tsm-monitor.org>
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 <http://www.gnu.org/licenses/>.
************************************************************************
*/
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
/**
*
@ -36,165 +36,167 @@ include_once "includes/page_head.php";
?>
<?php if ($_SESSION["logindata"]["loggedin"]) { ?>
<tr>
<td colspan="2" id="head"><a class='navheader' href="index.php"><img src="images/PollDTitle.gif" border=0></img></a></td>
</tr>
<tr>
<td id="tnleft"></td>
<td id="tnright">
<div id="tnbox1">
<tr>
<td colspan="2" id="head"><a class='navheader' href="index.php"><img src="images/PollDTitle.gif" border=0></img></a></td>
</tr>
<tr>
<td id="tnleft"></td>
<td id="tnright">
<div id="tnbox1">
<?php
if ( $_SESSION["logindata"]["loggedin"] && !in_array($tsmmonitor->GETVars['qq'], array("admin", "serverlist", "custom", "polldstat", "index", "overview", "")) && !strstr($tsmmonitor->GETVars['qq'], 'table') ) {
echo $tsmmonitor->getSearchfield();
}
?>
<?php
if ( $_SESSION["logindata"]["loggedin"] && !in_array($tsmmonitor->GETVars['qq'], array("admin", "serverlist", "custom", "polldstat", "index", "overview", "")) && !strstr($tsmmonitor->GETVars['qq'], 'table') ) {
echo $tsmmonitor->getSearchfield();
}
?>
</div>
<div id="tnbox2">
<?php if ($_SESSION["logindata"]["loggedin"]) { include_once "includes/topnav.php"; } ?>
</div>
</td>
</div>
<div id="tnbox2">
<?php if ($_SESSION["logindata"]["loggedin"]) { include_once "includes/topnav.php"; } ?>
</div>
</td>
<?php } ?>
</tr>
<tr>
<?php if ($_SESSION["logindata"]["loggedin"]) { ?>
<!-- Start left cik navigation menu -->
<td id="menue">
<div class="menuelinks">
<?php echo $tsmmonitor->getMenu( $tsmmonitor->submenu, "index.php?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']."&s=".$tsmmonitor->GETVars['server'], "index" ); ?>
</div>
<br>
<div class='menuelinks' id='datechooser'>
<?php echo $tsmmonitor->getTimemachine(); ?>
</div>
<!--
<br>
<div class="menuelinks">
<?php //echo $tsmmonitor->getInfo(); ?>
</div>
-->
<br>
<div class="menuelinks">
<?php echo $tsmmonitor->getStylesheetSwitcher(); ?>
</div>
<img src="/images/trans.gif" alt="" width="150" height="1" border="0"><br>
</td>
<!-- End left cik navigation menu -->
<?php } ?>
<td id="content">
<?php
</tr>
<tr>
<?php if ($_SESSION["logindata"]["loggedin"]) { ?>
<!-- Start left navigation menu -->
<td id="menue">
<div class="menuelinks">
<?php echo $tsmmonitor->getMenu( $tsmmonitor->submenu, "index.php?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']."&s=".$tsmmonitor->GETVars['server'], "index" ); ?>
</div>
<br>
<div class='menuelinks' id='datechooser'>
<?php echo $tsmmonitor->getTimemachine(); ?>
</div>
<!--
<br>
<div class="menuelinks">
<?php //echo $tsmmonitor->getInfo(); ?>
</div>
-->
<br>
<div class="menuelinks">
<?php echo $tsmmonitor->getStylesheetSwitcher(); ?>
</div>
<img src="/images/trans.gif" alt="" width="150" height="1" border="0"><br>
</td>
<!-- End left navigation menu -->
<?php } ?>
<td id="content">
<?php
// 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") {
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 "<table class='zebra'>";
echo "<tr><th>Key</th><th>Value</th></tr>";
foreach ($tablearray as $row) {
while(list($keycell, $valcell) = each($row)) {
if ($i == 0) {
echo "<tr class='d0'>";
$i = 1;
} else {
echo "<tr class='d1'>";
$i = 0;
}
echo "<td><b>".$keycell."</b></td><td>".$valcell."</td></tr>";
}
}
echo "</table>";
// 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 "<table class='zebra'>";
echo "<tr><th>Key</th><th>Value</th></tr>";
foreach ($tablearray as $row) {
while(list($keycell, $valcell) = each($row)) {
if ($i == 0) {
echo "<tr class='d0'>";
$i = 1;
} else {
echo "<tr class='d1'>";
$i = 0;
}
echo "<td><b>".$keycell."</b></td><td>".$valcell."</td></tr>";
}
}
echo "</table>";
// 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 "<table class='zebra'>";
$thead = $tsmmonitor->getTableheader();
echo $thead;
echo $tsmmonitor->execute('table');
$nav = $tsmmonitor->showPageNavigation("40");
if ($nav!="") {
echo "<tr><td colspan='".substr_count($thead, "<th>")."' align='center' class='footer'><a class='navhead'>".$nav."</a></td></tr>";
}
echo "</table>";
}
}
}
echo "<table class='zebra'>";
$thead = $tsmmonitor->getTableheader();
echo $thead;
echo $tsmmonitor->execute('table');
$nav = $tsmmonitor->showPageNavigation("40");
if ($nav!="") {
echo "<tr><td colspan='".substr_count($thead, "<th>")."' align='center' class='footer'><a class='navhead'>".$nav."</a></td></tr>";
}
echo "</table>";
} 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);
?>
</tr>
</td>
</tr>
<?php if ($_SESSION["logindata"]["loggedin"]) include_once "includes/footer.php"; ?>
<?php if ($_SESSION["logindata"]["loggedin"]) include_once "includes/footer.php"; ?>
</table>

View File

@ -1,23 +1,23 @@
<?php
/*
************************************************************************
This file is part of TSM Monitor.
************************************************************************
This file is part of TSM Monitor.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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.
TSM Monitor 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 TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************
*/
/**