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 <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. 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"; include_once "includes/page_head.php";
if ($_SESSION["logindata"]["role"]!="admin") { if ($_SESSION["logindata"]["role"]!="admin") {
$_SESSION["logindata"] = ""; $_SESSION["logindata"] = "";
} }
if ($_POST["css"] != "") { if ($_POST["css"] != "") {
$_SESSION['stylesheet'] = $_POST["css"]; $_SESSION['stylesheet'] = $_POST["css"];
} }
?> ?>
<?php if ($_SESSION["logindata"]["loggedin"]) { ?> <?php if ($_SESSION["logindata"]["loggedin"]) { ?>
<tr> <tr>
<td colspan="2" id="head"><a class='navheader' href="admin.php"><img src="images/PollDTitleAdmin.gif" border=0></img></a></td> <td colspan="2" id="head"><a class='navheader' href="admin.php"><img src="images/PollDTitleAdmin.gif" border=0></img></a></td>
</tr> </tr>
<tr> <tr>
<td id="tnleft"></td> <td id="tnleft"></td>
<td id="tnright"> <td id="tnright"></td>
</td>
<?php } ?> <?php } ?>
</tr> </tr>
<tr> <tr>
<?php if ($_SESSION["logindata"]["loggedin"]) { ?> <?php if ($_SESSION["logindata"]["loggedin"]) { ?>
<!-- Start left cik navigation menu --> <!-- Start left navigation menu -->
<td id="menue"> <td id="menue">
<div class="menuelinks"> <div class="menuelinks">
<?php echo $tsmmonitor->getMenu( $tsmmonitor->adminmenu, "admin.php?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu'], "admin" ); ?> <?php echo $tsmmonitor->getMenu( $tsmmonitor->adminmenu, "admin.php?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu'], "admin" ); ?>
</div> </div>
<br> <br>
<img src="/images/trans.gif" alt="" width="150" height="1" border="0"><br> <img src="/images/trans.gif" alt="" width="150" height="1" border="0"><br>
</td> </td>
<!-- End left cik navigation menu --> <!-- End left navigation menu -->
<?php } ?> <?php } ?>
<td id="content"> <td id="content">
<?php <?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 // show overview page
if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"]) && $tsmmonitor->GETVars['qq'] != "logout" && $_SESSION["logindata"]["loggedin"]) { if ($tsmmonitor->GETVars['qq'] == "index") {
if ($tsmmonitor->GETVars['qq'] != "" && $tsmmonitor->GETVars['qq'] != "overview") { // do nothing
// show settings page
} else if ($tsmmonitor->GETVars['qq'] == "settings") {
$tmonpolld = new PollD($adodb);
$tmonpolld->adodb->setDebug($_SESSION["debug"]);
// show overview page // If start/stop button was pressed
if ($tsmmonitor->GETVars['qq'] == "index") { if ($_POST["PollDControl"] != "") {
// do nothing if ($_POST["PollDControl"] == "Start") {
// show settings page $tmonpolld->controlPollD("on");
} else if ($tsmmonitor->GETVars['qq'] == "settings") { } else if ($_POST["PollDControl"] == "Stop") {
$tmonpolld = new PollD($adodb); $tmonpolld->controlPollD("off");
$tmonpolld->adodb->setDebug($_SESSION["debug"]); }
}
// If start/stop button was pressed if ($tmonpolld->isEnabled()=="1") {
if ($_POST["PollDControl"] != "") { $polldenabled = "enabled and ".$tmonpolld->getStatus();
if ($_POST["PollDControl"] == "Start") { //$cellcolor = "green";
$tmonpolld->controlPollD("on"); } else {
} else if ($_POST["PollDControl"] == "Stop") { $polldenabled = "disabled";
$tmonpolld->controlPollD("off"); //$cellcolor = "red";
} }
}
if ($tmonpolld->isEnabled()=="1") { echo "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']." method='post'>";
$polldenabled = "enabled and ".$tmonpolld->getStatus(); echo "<table class='zebra'>";
//$cellcolor = "green"; echo "<tr><th>Configuration</th><th>Action</th><th>Status</th></tr>";
} else { echo "<tr class='d0'>";
$polldenabled = "disabled"; echo " <td>PollD Control</td>";
//$cellcolor = "red"; 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'>"; } else {
echo "<table class='zebra'>"; if ( ($_GET['action'] != "" && ($_GET['action'] == "edit" && $_GET['id'] != "")) || $_POST['Add'] == "Add") {
echo "<tr><th>Configuration</th><th>Action</th><th>Status</th></tr>"; $i = 0;
echo "<tr class='d0'>"; // show Add New Entry Form
echo " <td>PollD Control</td>"; if ($_POST['Add'] == "Add") {
echo " <td>"; $sqlth = "SHOW COLUMNS from cfg_".$tsmmonitor->GETVars['qq'];
echo " <input type='submit' class='button' name='PollDControl' value='Start' onclick='submit();'>"; $sqlresth = $adodb->fetchArrayDB($sqlth);
echo " <input type='submit' class='button' name='PollDControl' value='Stop' onclick='submit();'>"; echo "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']." method='post'>";
echo " </td>"; echo "<table class='zebra'>";
echo " <td bgcolor=".$cellcolor.">PollD is ".$polldenabled."</td>"; echo "<tr><th>Key</th><th>Value</th></tr>";
echo "</tr>"; foreach ($sqlresth as $col) {
echo "<tr class='d1'>"; echo "TEST: ".$col['Field']." -> $colval<br>\n";
echo " <td>Debug Mode</td>"; if ($col['Field'] != "id") {
echo " <td>"; if ($i == 0) {
echo " <input type='submit' class='button' name='DebugMode' value='On' onclick='submit();'>"; echo "<tr class='d0'>";
echo " <input type='submit' class='button' name='DebugMode' value='Off' onclick='submit();'>"; $i = 1;
echo " </td>"; } else {
echo " <td>".$_SESSION["debug"]."</td>"; echo "<tr class='d1'>";
echo "</tr>"; $i = 0;
echo "<tr class='d0'>"; }
echo " <td>PollD Control</td>"; if ($col['Field'] == "password") {
echo " <td>"; echo "<td><b>".$col['Field']."</b></td><td><input type='password' name='txt".$col['Field']."' value='' /></td></tr>";
echo " <table border=0>"; } else {
echo " <tr><td>"; echo "<td><b>".$col['Field']."</b></td><td><input type='text' size='50' name='txt".$col['Field']."' value='' /></td></tr>";
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 "<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>"; } else {
echo " <select name='cleandbquery' size=1 class='button'>"; if (isset($_SESSION["logindata"])) {
echo ' <option value="all">- all queries -</options>'; $errormsg = "Login failed!";
while(list($queryname,$queryitems) = each($tsmmonitor->queryarray)) { } else {
echo '<option value="'.$queryname.'"> '.$queryname.'</option>'; $errormsg = "Login";
} }
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 { session_unset();
if ( ($_GET['action'] != "" && ($_GET['action'] == "edit" && $_GET['id'] != "")) || $_POST['Add'] == "Add") { $_SESSION=array();
$i = 0; include_once "includes/login.php";
// 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 { $_SESSION['from'] = $tsmmonitor->GETVars['qq'];
$tablearray = $tsmmonitor->getAdminTables("edit"); session_write_close(void);
echo "<form action=".$_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']." method='post'>"; ?>
echo "<table class='zebra'>"; </td>
echo "<tr><th>Key</th><th>Value</th></tr>"; </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>"; <?php if ($_SESSION["logindata"]["loggedin"]) include_once "includes/footer.php"; ?>
}
// show List of all entries </table>
} 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>
</div> </div>
</body> </body>

View File

@ -1,24 +1,24 @@
<?php <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************ ************************************************************************
*/ */
/** /**
* *
@ -43,53 +43,53 @@ class ADOdb {
var $conn; var $conn;
var $debug; var $debug;
/** /**
* constructor - establishes a DB connection via ADODB * constructor - establishes a DB connection via ADODB
* *
* @param string $host the hostname of the DB server * @param string $host the hostname of the DB server
* @param string $port the portnumber for the DB connection * @param string $port the portnumber for the DB connection
* @param string $user the username for the DB connection * @param string $user the username for the DB connection
* @param string $pass the password 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_name the name of the DB
* @param string $db_type the type of the DB (currently only 'mysql') * @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 * @param string $retr the number attempts for the DB connection before a failure is reported
* @return 0 * @return 0
*/ */
function ADOdb($host, $port = "3306", $user, $pass, $db_name, $db_type, $retr = 20, $debug = FALSE) { function ADOdb($host, $port = "3306", $user, $pass, $db_name, $db_type, $retr = 20, $debug = FALSE) {
$this->debug = $debug; $this->debug = $debug;
$try = 0; $try = 0;
$hostport = $host . ":" . $port; $hostport = $host . ":" . $port;
$this->conn = NewADOConnection($db_type); $this->conn = NewADOConnection($db_type);
while ($try <= $retries) { while ($try <= $retries) {
if ($this->conn->PConnect($hostport,$user,$pass,$db_name)) { if ($this->conn->PConnect($hostport,$user,$pass,$db_name)) {
$this->conn = $this->conn; $this->conn = $this->conn;
return 0; return 0;
} }
$try++; $try++;
usleep(50000); 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"); 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; return 0;
} }
/** /**
* setDebug - enables or disabled debug mode * setDebug - enables or disabled debug mode
* *
* @param string $debug On or Off * @param string $debug On or Off
*/ */
function setDebug($debug) { function setDebug($debug) {
if ($debug == "On") { if ($debug == "On") {
$this->debug = TRUE; $this->debug = TRUE;
} else { } else {
$this->debug = FALSE; $this->debug = FALSE;
} }
} }
@ -99,9 +99,9 @@ class ADOdb {
* @return string * @return string
*/ */
function closeDB() { function closeDB() {
if ($this->conn) { if ($this->conn) {
return $this->conn->Close(); return $this->conn->Close();
} }
} }
@ -112,17 +112,17 @@ class ADOdb {
* @return ADORecordSet * @return ADORecordSet
*/ */
function execDB($sql) { function execDB($sql) {
$this->conn->debug = $this->debug; $this->conn->debug = $this->debug;
$sql = $this->sanitizeSQL($sql); $sql = $this->sanitizeSQL($sql);
$recordSet = &$this->conn->Execute($sql); $recordSet = &$this->conn->Execute($sql);
if (($recordSet) || ($this->conn->ErrorNo() == 0)) { if (($recordSet) || ($this->conn->ErrorNo() == 0)) {
return($recordSet); return($recordSet);
} else { } else {
echo "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>"; echo "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>";
//exit; //exit;
return ""; return "";
} }
} }
@ -136,32 +136,32 @@ class ADOdb {
* @return string Content of the cell as a single variable * @return string Content of the cell as a single variable
*/ */
function fetchCellDB($sql, $column_name) { function fetchCellDB($sql, $column_name) {
//$this->conn->debug = true; //$this->conn->debug = true;
$this->conn->debug = $this->debug; $this->conn->debug = $this->debug;
$sql = $this->sanitizeSQL($sql); $sql = $this->sanitizeSQL($sql);
if ($column_name != '') { if ($column_name != '') {
$this->conn->SetFetchMode(ADODB_FETCH_ASSOC); $this->conn->SetFetchMode(ADODB_FETCH_ASSOC);
} else { } else {
$this->conn->SetFetchMode(ADODB_FETCH_NUM); $this->conn->SetFetchMode(ADODB_FETCH_NUM);
} }
$recordSet = $this->conn->Execute($sql); $recordSet = $this->conn->Execute($sql);
if (($recordSet) || ($this->conn->ErrorNo() == 0)) { if (($recordSet) || ($this->conn->ErrorNo() == 0)) {
if (!$recordSet->EOF) { if (!$recordSet->EOF) {
if ($column_name != '') { if ($column_name != '') {
$column = $recordSet->fields[$column_name]; $column = $recordSet->fields[$column_name];
}else{ }else{
$column = $recordSet->fields[0]; $column = $recordSet->fields[0];
} }
$recordSet->close(); $recordSet->close();
return($column); 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 * @return array First row of results as an associative array
*/ */
function fetchRowDB($sql) { function fetchRowDB($sql) {
//$this->conn->debug = true; //$this->conn->debug = true;
$this->conn->debug = $this->debug; $this->conn->debug = $this->debug;
$sql = $this->sanitizeSQL($sql); $sql = $this->sanitizeSQL($sql);
$this->conn->SetFetchMode(ADODB_FETCH_ASSOC); $this->conn->SetFetchMode(ADODB_FETCH_ASSOC);
$recordSet = $this->conn->Execute($sql); $recordSet = $this->conn->Execute($sql);
if (($recordSet) || ($this->conn->ErrorNo() == 0)) { if (($recordSet) || ($this->conn->ErrorNo() == 0)) {
if (!$recordSet->EOF) { if (!$recordSet->EOF) {
$recordFields = $recordSet->fields; $recordFields = $recordSet->fields;
$recordSet->close(); $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 * @return array All results in an associative array
*/ */
function fetchArrayDB($sql) { function fetchArrayDB($sql) {
//$this->conn->debug = true; //$this->conn->debug = true;
$this->conn->debug = $this->debug; $this->conn->debug = $this->debug;
$sql = $this->sanitizeSQL($sql); $sql = $this->sanitizeSQL($sql);
$recordArray = array(); $recordArray = array();
$this->conn->SetFetchMode(ADODB_FETCH_ASSOC); $this->conn->SetFetchMode(ADODB_FETCH_ASSOC);
$recordSet = &$this->conn->Execute($sql); $recordSet = &$this->conn->Execute($sql);
if (($recordSet) || ($this->conn->ErrorNo() == 0)) { if (($recordSet) || ($this->conn->ErrorNo() == 0)) {
while ((!$recordSet->EOF) && ($recordSet)) { while ((!$recordSet->EOF) && ($recordSet)) {
$recordArray{sizeof($recordArray)} = $recordSet->fields; $recordArray{sizeof($recordArray)} = $recordSet->fields;
$recordSet->MoveNext(); $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 * @return string Auto-increment ID if insert was performed
*/ */
function updateDB($table, $cells, $keys, $autoquote = TRUE) { function updateDB($table, $cells, $keys, $autoquote = TRUE) {
//$this->conn->debug = true; //$this->conn->debug = true;
$this->conn->debug = $this->debug; $this->conn->debug = $this->debug;
$this->conn->Replace($table, $cells, $keys, $autoquote); $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 * @return string
*/ */
function sanitizeSQL($sql) { function sanitizeSQL($sql) {
$sql = str_replace(";", "\;", $sql); $sql = str_replace(";", "\;", $sql);
$sql = str_replace("\n", "", $sql); $sql = str_replace("\n", "", $sql);
$sql = str_replace("\r", "", $sql); $sql = str_replace("\r", "", $sql);
$sql = str_replace("\t", " ", $sql); $sql = str_replace("\t", " ", $sql);
return $sql; return $sql;
} }
} }

View File

@ -1,23 +1,23 @@
<?php <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************ ************************************************************************
*/ */
/** /**
* *

View File

@ -1,23 +1,23 @@
<?php <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************ ************************************************************************
*/ */
/** /**
* *
@ -32,13 +32,13 @@
?> ?>
<!-- Begin: footer.php --> <!-- Begin: footer.php -->
<?php if ($message!="") { ?> <?php if ($message!="") { ?>
<tr> <tr>
<td colspan="2" id="sysinfo"><b>System Message: </b><?php echo $message; ?></td> <td colspan="2" id="sysinfo"><b>System Message: </b><?php echo $message; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<tr> <tr>
<td colspan="2" id="footer"> <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>) 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> </td>
</tr> </tr>
<!-- End: footer.php --> <!-- End: footer.php -->

View File

@ -1,22 +1,22 @@
<?php <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. 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! The defaults in this file are not meant to be altered by users!
See include/config.php for user configurable database settings. See include/config.php for user configurable database settings.
*/ */
// ** Default database settings ** // // ** Default database settings ** //
$db_type = 'mysql'; $db_type = 'mysql';
@ -62,9 +62,9 @@ $config["server_os"] = (strstr(PHP_OS, "WIN")) ? "win32" : "unix";
// ** Search paths for external programs (dsmadmc, php, ...) ** // // ** Search paths for external programs (dsmadmc, php, ...) ** //
if ($config["server_os"] == "win32") { 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") { } 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, ...) ** // // ** Paths (libraries, includes, ...) ** //
@ -97,8 +97,8 @@ $tsmmonitor = new TSMMonitor($adodb);
// check to see if this is a new installation // check to see if this is a new installation
$version = $adodb->fetchCellDB("select confval from cfg_config where confkey='version'", ''); $version = $adodb->fetchCellDB("select confval from cfg_config where confkey='version'", '');
if ($version != $config["tsm_monitor_version"] && basename($_SERVER['REQUEST_URI']) != 'install.php') { if ($version != $config["tsm_monitor_version"] && basename($_SERVER['REQUEST_URI']) != 'install.php') {
header("Location: install.php"); header("Location: install.php");
exit; exit;
} }
// ** Include generic code and external libraries ** // // ** Include generic code and external libraries ** //

View File

@ -1,24 +1,24 @@
<?php <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. 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"> <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"> <form action="<?php echo $_SERVER['PHP_SELF']; if ($GETVars['qq'] != 'logout'){ echo '?q='.$GETVars['qq'].'&m='.$GETVars['menu']; } ?>" method="post">
<br> <br>
<br> <br>
<br> <br>
<br> <br>
<table class='login'> <table class='login'>
<tr> <tr>
<td colspan="2" id="head"><a class='navheader' ><img src="<?php echo $headerimage ?>" border=0></img></a></td> <td colspan="2" id="head"><a class='navheader' ><img src="<?php echo $headerimage ?>" border=0></img></a></td>
</tr> </tr>
<tr><th colspan="2"><?php echo $errormsg ?></th></tr> <tr><th colspan="2"><?php echo $errormsg ?></th></tr>
<tr><td>Username:</td><td><input name="loginname"></td></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>Password:</td><td><input name="loginpasswort" type=password></td></tr>
<tr><td colspan="2"><input type=submit name=submit value="Login"></td></tr> <tr><td colspan="2"><input type=submit name=submit value="Login"></td></tr>
</table> </table>
<br> <br>
<br> <br>
<br> <br>
<br> <br>
<br> <br>
<br> <br>
</form> </form>

View File

@ -1,23 +1,23 @@
<?php <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************ ************************************************************************
*/ */
/** /**
* *
@ -32,43 +32,43 @@
?> ?>
<table width=90% cellspacing="3" cellpadding="3"> <table width=90% cellspacing="3" cellpadding="3">
<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><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> <tr>
<td width='48%' valign='top'> <td width='48%' valign='top'>
<table class='zebra'> <table class='zebra'>
<tr><th colspan="2">Health Status</th></tr> <tr><th colspan="2">Health Status</th></tr>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["healthdata"]); ?> <?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["healthdata"]); ?>
</table> </table>
</td> </td>
<td width='4%'> <td width='4%'>
</td> </td>
<td width='48%' valign='top'> <td width='48%' valign='top'>
<table class='zebra'> <table class='zebra'>
<tr><th colspan="2">TSM Database</th></tr> <tr><th colspan="2">TSM Database</th></tr>
<?php //echo getOverviewRows(getInfobox("database")); ?> <?php //echo getOverviewRows(getInfobox("database")); ?>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["database"]); ?> <?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["database"]); ?>
</table> </table>
</td> </td>
</tr> </tr>
<tr><td colspan="3" height='20px'></td></tr> <tr><td colspan="3" height='20px'></td></tr>
<tr> <tr>
<td width='48%' valign='top'> <td width='48%' valign='top'>
<table class='zebra'> <table class='zebra'>
<tr><th colspan="2">Total Data</th></tr> <tr><th colspan="2">Total Data</th></tr>
<?php //echo getOverviewRows(getInfobox("totaldata")); ?> <?php //echo getOverviewRows(getInfobox("totaldata")); ?>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["totaldata"]); ?> <?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["totaldata"]); ?>
</table> </table>
</td> </td>
<td width='4%'> <td width='4%'>
</td> </td>
<td width='48%' valign='top'> <td width='48%' valign='top'>
<table class='zebra'> <table class='zebra'>
<tr><th colspan="2">Schedule Status</th></tr> <tr><th colspan="2">Schedule Status</th></tr>
<?php //echo getOverviewRows(getInfobox("schedules")); ?> <?php //echo getOverviewRows(getInfobox("schedules")); ?>
<?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["schedules"]); ?> <?php echo $tsmmonitor->getOverviewRows($tsmmonitor->configarray["infoboxarray"]["schedules"]); ?>
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -1,21 +1,21 @@
<?php <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. 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["tabletype"] != "") $_SESSION["tabletype"] = $_POST["tabletype"];
if ($_POST["DebugMode"] != "") $_SESSION["debug"] = $_POST["DebugMode"]; if ($_POST["DebugMode"] != "") $_SESSION["debug"] = $_POST["DebugMode"];
$adodb->setDebug($_SESSION["debug"]); $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\"> <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<!-- Begin: page_head.php --> <!-- Begin: page_head.php -->
<html> <html>
<head> <head>
<title>TSM Monitor</title> <title>TSM Monitor</title>
<meta http-equiv='content-type' content='text/html; charset=ISO-8859-1'> <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='shortcut icon' href='images/favicon.ico' type='image/x-icon'>
<link rel='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/print.css" media="print">
<link rel='stylesheet' type='text/css' href='css/layout.css'> <link rel='stylesheet' type='text/css' href='css/layout.css'>
<link rel='stylesheet' type='text/css' href='css/<?php echo $_SESSION['stylesheet']; ?>'> <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="extlib/datechooser.js"></script>
<script type="text/javascript" src="includes/functions.js"></script> <script type="text/javascript" src="includes/functions.js"></script>
<script type="text/javascript"> <script type="text/javascript">
<!-- // <!-- //
events.add(window, 'load', WindowLoad); 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;
}
function genPDF() { function WindowLoad()
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" ) {
} 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']); ?>);
</script> objStartDate.setYear(<?php if ($_SESSION['timemachine']['date']!= "") echo strftime("%Y", $_SESSION['timemachine']['date']); ?>);
</meta>
</head>
<body> objLateDate.setMonth(objLateDate.getMonth());
<div id="inhalt"> datepicker.DateChooser = new DateChooser();
<table cellspacing="4" cellpadding="2" border="0" id="design"> datepicker.DateChooser.setXOffset(5);
<!-- End: page_head.php --> 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 <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************ ************************************************************************
*/ */
/** /**
@ -57,7 +57,6 @@ class PDF extends FPDF
* Header - generates page header * Header - generates page header
* *
*/ */
function Header() function Header()
{ {
//Print the table header if necessary //Print the table header if necessary
@ -67,14 +66,14 @@ class PDF extends FPDF
} }
/** /**
* PageHeader - writes page title on top of first page * PageHeader - writes page title on top of first page
* *
* @param string $pagetitle title of page * @param string $pagetitle title of page
* @access public * @access public
* @return void * @return void
*/ */
function PageHeader($pagetitle) { function PageHeader($pagetitle) {
//Title //Title
$this->SetFont('Arial','',12); $this->SetFont('Arial','',12);
@ -88,7 +87,6 @@ class PDF extends FPDF
* TableHeader * TableHeader
* *
*/ */
function TableHeader() function TableHeader()
{ {
$this->SetFont('Arial','B',6); $this->SetFont('Arial','B',6);
@ -107,7 +105,6 @@ class PDF extends FPDF
* *
* @param unknown $date * @param unknown $date
*/ */
function Row($data) function Row($data)
{ {
$this->SetX($this->TableX); $this->SetX($this->TableX);
@ -129,7 +126,6 @@ class PDF extends FPDF
* @param string $width * @param string $width
* @param string $align * @param string $align
*/ */
function CalcWidths($width,$align) function CalcWidths($width,$align)
{ {
//Compute the widths of the columns //Compute the widths of the columns
@ -162,7 +158,6 @@ class PDF extends FPDF
* @param string $caption * @param string $caption
* @param string $align * @param string $align
*/ */
function AddCol($field=-1,$width=-1,$caption='',$align='L') function AddCol($field=-1,$width=-1,$caption='',$align='L')
{ {
//Add a column to the table //Add a column to the table
@ -178,7 +173,6 @@ class PDF extends FPDF
* @param string $query * @param string $query
* @param array $prop * @param array $prop
*/ */
function Table($query,$prop=array(),$dbresult) function Table($query,$prop=array(),$dbresult)
{ {
//Issue query //Issue query
@ -219,10 +213,10 @@ class PDF extends FPDF
$this->ColorIndex=0; $this->ColorIndex=0;
$this->ProcessingTable=true; $this->ProcessingTable=true;
foreach($dbresult as $key => $row) { foreach($dbresult as $key => $row) {
$row_num = array_values($row); $row_num = array_values($row);
$row_comb = array_merge($row, $row_num); $row_comb = array_merge($row, $row_num);
$this->Row($row_comb); $this->Row($row_comb);
} }
$this->ProcessingTable=false; $this->ProcessingTable=false;
$this->cMargin=$cMargin; $this->cMargin=$cMargin;
$this->aCols=array(); $this->aCols=array();

View File

@ -1,23 +1,23 @@
<?php <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************ ************************************************************************
*/ */
/** /**
@ -162,7 +162,7 @@ class PollD {
if ($handle) { if ($handle) {
while (!feof($handle) && !$stop) { while (!feof($handle) && !$stop) {
$read = fgets($handle, 4096); $read = fgets($handle, 4096);
$hashstring .= $read; $hashstring .= $read;
$stop = strstr($read, 'ANR2034E'); $stop = strstr($read, 'ANR2034E');
@ -214,7 +214,7 @@ class PollD {
$countobj = $this->adodb->fetchArrayDB($sql); $countobj = $this->adodb->fetchArrayDB($sql);
$countarray = (array)$countobj[0]; $countarray = (array)$countobj[0];
$count = $countarray["count(*)"]; $count = $countarray["count(*)"];
if ($count > 0) { if ($count > 0) {
return TRUE; return TRUE;
} else { } else {
@ -307,7 +307,7 @@ class PollD {
$result = $this->execute($query["tsmquery"], $server["servername"], $tablename, $timestamp); $result = $this->execute($query["tsmquery"], $server["servername"], $tablename, $timestamp);
} catch (exception $e) { } catch (exception $e) {
$result = ""; $result = "";
print_r($e); print_r($e);
} }
if ($result != "") { if ($result != "") {
if (!$this->checkHash($tablename, $result["md5"])) { if (!$this->checkHash($tablename, $result["md5"])) {
@ -420,7 +420,7 @@ class PollD {
if ($status != "") $status = "`status`='".$status."'"; if ($status != "") $status = "`status`='".$status."'";
if ($lastrun != "") $lastrun = ", `lastrun`='".$lastrun."'"; if ($lastrun != "") $lastrun = ", `lastrun`='".$lastrun."'";
if ($nextrun != "") $nextrun = ", `nextrun`='".$nextrun."'"; if ($nextrun != "") $nextrun = ", `nextrun`='".$nextrun."'";
$sql = "update log_polldstat set ".$status." ".$lastrun." ".$nextrun." WHERE `id`='1'"; $sql = "update log_polldstat set ".$status." ".$lastrun." ".$nextrun." WHERE `id`='1'";
$this->adodb->execDB($sql); $this->adodb->execDB($sql);
} }
@ -436,7 +436,7 @@ class PollD {
$sql = "select enabled from log_polldstat WHERE `id`='1'"; $sql = "select enabled from log_polldstat WHERE `id`='1'";
$result = $this->adodb->fetchArrayDB($sql); $result = $this->adodb->fetchArrayDB($sql);
if ($result != "" && $result[0]["enabled"] == "1"){ if ($result != "" && $result[0]["enabled"] == "1"){
return TRUE; return TRUE;
} else { } else {
@ -476,7 +476,7 @@ class PollD {
$result = $this->adodb->fetchArrayDB($sql); $result = $this->adodb->fetchArrayDB($sql);
return $result[0]["status"]; return $result[0]["status"];
} }
@ -494,18 +494,18 @@ class PollD {
echo "Sleeptime will be ".$sleeptime." seconds\n"; echo "Sleeptime will be ".$sleeptime." seconds\n";
// infinite loop // infinite loop
while(true) { while(true) {
if ($this->isEnabled()) { if ($this->isEnabled()) {
$timestamp = time(); $timestamp = time();
echo "running!\n"; echo "running!\n";
echo "timestamp for this run is ".$timestamp."\n"; echo "timestamp for this run is ".$timestamp."\n";
$this->setPollDStatus("running", "", ""); $this->setPollDStatus("running", "", "");
@ -529,7 +529,7 @@ class PollD {
} }
$init = "no"; $init = "no";
echo "needed ".(time()-$timestamp)." seconds for this run.\n"; echo "needed ".(time()-$timestamp)." seconds for this run.\n";
//$tempsleeptime = $sleeptime-(time()-$timestamp); //$tempsleeptime = $sleeptime-(time()-$timestamp);
$tempsleeptime = 900 -(time()-$timestamp); $tempsleeptime = 900 -(time()-$timestamp);

View File

@ -1,22 +1,22 @@
<?php <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************ ************************************************************************
*/ */
/** /**
@ -40,9 +40,9 @@ $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
//First table: put all columns automatically //First table: put all columns automatically
$prop=array('HeaderColor'=>array(180,180,180), $prop=array('HeaderColor'=>array(180,180,180),
'color1'=>array(255,255,255), 'color1'=>array(255,255,255),
'color2'=>array(230,230,230), 'color2'=>array(230,230,230),
'padding'=>2); 'padding'=>2);
$res = $adodb->fetchArrayDB($_SESSION["lastsql"]); $res = $adodb->fetchArrayDB($_SESSION["lastsql"]);
//build Page Title //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"> <form action="<?php echo $_SERVER['PHP_SELF']."?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']."&s=".$tsmmonitor->GETVars['server']; ?>" method="post">
<?php <?php
//if ($tsmmonitor->GETVars['qq'] != "admin" && !$_POST["edit"] == "edit") { if ($tsmmonitor->GETVars['qq'] != "index" && $tsmmonitor->GETVars['qq'] != "overview" && $tsmmonitor->GETVars['qq'] != "serverlist") {
if ($tsmmonitor->GETVars['qq'] != "index" && $tsmmonitor->GETVars['qq'] != "overview" && $tsmmonitor->GETVars['qq'] != "serverlist") { echo "<input type='button' value='PDF' onclick='genPDF()' class='button topnavbutton'>";
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'>"; echo "<select name='tabletype' size=1 onChange='submit();' class='button topnavbutton'>";
$types = array('normal view', 'timetable'); $types = array('normal view', 'timetable');
foreach ($types as $type) { foreach ($types as $type) {
echo '<option value="'.$type.'"'; echo '<option value="'.$type.'"';
if ($_SESSION['tabletype'] == $type){echo "SELECTED";} if ($_SESSION['tabletype'] == $type){echo "SELECTED";}
echo '> '.$type.'</option>'; 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>"; 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> </form>

File diff suppressed because it is too large Load Diff

318
index.php
View File

@ -1,25 +1,25 @@
<?php <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. 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"]) { ?> <?php if ($_SESSION["logindata"]["loggedin"]) { ?>
<tr> <tr>
<td colspan="2" id="head"><a class='navheader' href="index.php"><img src="images/PollDTitle.gif" border=0></img></a></td> <td colspan="2" id="head"><a class='navheader' href="index.php"><img src="images/PollDTitle.gif" border=0></img></a></td>
</tr> </tr>
<tr> <tr>
<td id="tnleft"></td> <td id="tnleft"></td>
<td id="tnright"> <td id="tnright">
<div id="tnbox1"> <div id="tnbox1">
<?php <?php
if ( $_SESSION["logindata"]["loggedin"] && !in_array($tsmmonitor->GETVars['qq'], array("admin", "serverlist", "custom", "polldstat", "index", "overview", "")) && !strstr($tsmmonitor->GETVars['qq'], 'table') ) { if ( $_SESSION["logindata"]["loggedin"] && !in_array($tsmmonitor->GETVars['qq'], array("admin", "serverlist", "custom", "polldstat", "index", "overview", "")) && !strstr($tsmmonitor->GETVars['qq'], 'table') ) {
echo $tsmmonitor->getSearchfield(); echo $tsmmonitor->getSearchfield();
} }
?> ?>
</div> </div>
<div id="tnbox2"> <div id="tnbox2">
<?php if ($_SESSION["logindata"]["loggedin"]) { include_once "includes/topnav.php"; } ?> <?php if ($_SESSION["logindata"]["loggedin"]) { include_once "includes/topnav.php"; } ?>
</div> </div>
</td> </td>
<?php } ?> <?php } ?>
</tr> </tr>
<tr> <tr>
<?php if ($_SESSION["logindata"]["loggedin"]) { ?> <?php if ($_SESSION["logindata"]["loggedin"]) { ?>
<!-- Start left cik navigation menu --> <!-- Start left navigation menu -->
<td id="menue"> <td id="menue">
<div class="menuelinks"> <div class="menuelinks">
<?php echo $tsmmonitor->getMenu( $tsmmonitor->submenu, "index.php?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']."&s=".$tsmmonitor->GETVars['server'], "index" ); ?> <?php echo $tsmmonitor->getMenu( $tsmmonitor->submenu, "index.php?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']."&s=".$tsmmonitor->GETVars['server'], "index" ); ?>
</div> </div>
<br> <br>
<div class='menuelinks' id='datechooser'> <div class='menuelinks' id='datechooser'>
<?php echo $tsmmonitor->getTimemachine(); ?> <?php echo $tsmmonitor->getTimemachine(); ?>
</div> </div>
<!-- <!--
<br> <br>
<div class="menuelinks"> <div class="menuelinks">
<?php //echo $tsmmonitor->getInfo(); ?> <?php //echo $tsmmonitor->getInfo(); ?>
</div> </div>
--> -->
<br> <br>
<div class="menuelinks"> <div class="menuelinks">
<?php echo $tsmmonitor->getStylesheetSwitcher(); ?> <?php echo $tsmmonitor->getStylesheetSwitcher(); ?>
</div> </div>
<img src="/images/trans.gif" alt="" width="150" height="1" border="0"><br> <img src="/images/trans.gif" alt="" width="150" height="1" border="0"><br>
</td> </td>
<!-- End left cik navigation menu --> <!-- End left navigation menu -->
<?php } ?> <?php } ?>
<td id="content"> <td id="content">
<?php <?php
// main content, right of menu // main content, right of menu
if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"]) && $tsmmonitor->GETVars['qq'] != "logout" && $_SESSION["logindata"]["loggedin"]){ if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"]) && $tsmmonitor->GETVars['qq'] != "logout" && $_SESSION["logindata"]["loggedin"]){
if ($tsmmonitor->GETVars['qq'] != "" && $tsmmonitor->GETVars['qq'] != "overview"){ 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();
// "vertical" table // show overview page
} else if ( strstr($tsmmonitor->GETVars['qq'], 'vertical')) { 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; $i = 0;
} $tablearray = $tsmmonitor->execute('verticaltable');
echo "<td><b>".$keycell."</b></td><td>".$valcell."</td></tr>"; echo "<table class='zebra'>";
} echo "<tr><th>Key</th><th>Value</th></tr>";
} foreach ($tablearray as $row) {
while(list($keycell, $valcell) = each($row)) {
echo "</table>"; if ($i == 0) {
echo "<tr class='d0'>";
$i = 1;
// show normal table layout } else {
} else { echo "<tr class='d1'>";
if ($_SESSION["tabletype"]!="" && $_SESSION["tabletype"] == "timetable") { $i = 0;
}
if ($_POST["back"] != "") { echo "<td><b>".$keycell."</b></td><td>".$valcell."</td></tr>";
$_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>";
// 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'>"; } else {
$thead = $tsmmonitor->getTableheader(); if (isset($_SESSION["logindata"])){
echo $thead; $errormsg = "Login failed!";
echo $tsmmonitor->execute('table'); }else{
$nav = $tsmmonitor->showPageNavigation("40"); $errormsg = "Login";
if ($nav!="") {
echo "<tr><td colspan='".substr_count($thead, "<th>")."' align='center' class='footer'><a class='navhead'>".$nav."</a></td></tr>";
}
echo "</table>";
} }
} session_unset();
} $_SESSION=array();
} else {
if (isset($_SESSION["logindata"])){
$errormsg = "Login failed!";
}else{
$errormsg = "Login";
}
session_unset(); include_once "includes/login.php";
$_SESSION=array();
include_once "includes/login.php";
} }
$_SESSION['from'] = $tsmmonitor->GETVars['qq']; $_SESSION['from'] = $tsmmonitor->GETVars['qq'];
session_write_close(void); 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> </table>

View File

@ -1,23 +1,23 @@
<?php <?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 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
TSM Monitor is distributed in the hope that it will be useful, TSM Monitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>. along with TSM Monitor. If not, see <http://www.gnu.org/licenses/>.
************************************************************************ ************************************************************************
*/ */
/** /**