2009-05-10 07:44:45 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2009-05-18 07:37:07 -04:00
|
|
|
************************************************************************
|
|
|
|
TSM Monitor 2 v0.1 (www.tsm-monitor.org)
|
2009-05-10 07:44:45 -04:00
|
|
|
|
2009-05-18 07:37:07 -04:00
|
|
|
Copyright (C) 2009 Michael Clemens <mail@tsm-monitor.org>
|
2009-05-10 07:44:45 -04:00
|
|
|
|
2009-05-18 07:37:07 -04:00
|
|
|
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.
|
2009-05-10 07:44:45 -04:00
|
|
|
|
2009-05-18 07:37:07 -04:00
|
|
|
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.
|
2009-05-10 07:44:45 -04:00
|
|
|
|
2009-05-18 07:37:07 -04:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
************************************************************************
|
|
|
|
*/
|
2009-05-10 07:44:45 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* index.php, TSM Monitor
|
2009-05-24 15:22:45 -04:00
|
|
|
*
|
2009-05-10 07:44:45 -04:00
|
|
|
* main php file
|
2009-05-24 15:22:45 -04:00
|
|
|
*
|
2009-05-10 07:44:45 -04:00
|
|
|
* @author Michael Clemens
|
|
|
|
* @package tsmmonitor
|
|
|
|
*/
|
|
|
|
|
|
|
|
include_once "includes/global.php";
|
|
|
|
include_once "includes/page_head.php";
|
|
|
|
|
|
|
|
?>
|
|
|
|
<?php if ($_SESSION["logindata"]["loggedin"]) { ?>
|
2009-05-18 07:37:07 -04:00
|
|
|
<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">
|
|
|
|
|
2009-05-24 15:22:45 -04:00
|
|
|
<?php
|
2009-05-18 07:37:07 -04:00
|
|
|
if ( $_SESSION["logindata"]["loggedin"] && !in_array($tsmmonitor->GETVars['qq'], array("admin", "serverlist", "custom", "polldstat", "index", "overview", "")) && !strstr($tsmmonitor->GETVars['qq'], 'table') ) {
|
2009-05-24 15:22:45 -04:00
|
|
|
echo $tsmmonitor->getSearchfield();
|
2009-05-18 07:37:07 -04:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div id="tnbox2">
|
|
|
|
<?php if ($_SESSION["logindata"]["loggedin"]) { include_once "includes/topnav.php"; } ?>
|
|
|
|
</div>
|
|
|
|
</td>
|
2009-05-10 07:44:45 -04:00
|
|
|
<?php } ?>
|
2009-05-18 07:37:07 -04:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<?php if ($_SESSION["logindata"]["loggedin"]) { ?>
|
|
|
|
<!-- Start left navigation menu -->
|
|
|
|
<td id="menue">
|
|
|
|
<div class="menuelinks">
|
2009-05-24 09:20:15 -04:00
|
|
|
<?php echo $tsmmonitor->getMenu( $tsmmonitor->menu['main'], "index.php?q=".$tsmmonitor->GETVars['qq']."&m=".$tsmmonitor->GETVars['menu']."&s=".$tsmmonitor->GETVars['server'], "index" ); ?>
|
2009-05-18 07:37:07 -04:00
|
|
|
</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") {
|
2009-05-24 13:45:08 -04:00
|
|
|
$lines = $_POST["lpp"];
|
|
|
|
if ($lines != "") {
|
|
|
|
if (!isset($_SESSION["lines"])){
|
|
|
|
$temp = array();
|
|
|
|
$temp[$tsmmonitor->GETVars['qq']] = $lines;
|
|
|
|
$_SESSION["lines"] = $temp;
|
|
|
|
} else {
|
|
|
|
$_SESSION["lines"][$tsmmonitor->GETVars['qq']] = $lines;
|
|
|
|
}
|
|
|
|
}
|
2009-05-18 07:37:07 -04:00
|
|
|
echo $tsmmonitor->getPollDStat();
|
|
|
|
|
|
|
|
// show serverlist
|
|
|
|
} else if ( $tsmmonitor->GETVars['qq'] == "serverlist" ) {
|
|
|
|
echo $tsmmonitor->getServerlist();
|
|
|
|
|
|
|
|
// "vertical" table
|
|
|
|
} else if ( strstr($tsmmonitor->GETVars['qq'], 'vertical')) {
|
2009-05-10 07:44:45 -04:00
|
|
|
|
|
|
|
$i = 0;
|
2009-05-18 07:37:07 -04:00
|
|
|
$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)) {
|
2009-05-18 11:34:04 -04:00
|
|
|
$vertrow = array();
|
|
|
|
$vertrow["key"] = $keycell;
|
|
|
|
$vertrow["value"] = $valcell;
|
|
|
|
echo $tsmmonitor->renderZebraTableRow($vertrow, $i%2, "", "", "");
|
|
|
|
$i++;
|
2009-05-18 07:37:07 -04:00
|
|
|
}
|
|
|
|
}
|
2009-05-10 07:44:45 -04:00
|
|
|
|
2009-05-18 07:37:07 -04:00
|
|
|
echo "</table>";
|
2009-05-10 07:44:45 -04:00
|
|
|
|
|
|
|
|
2009-05-18 07:37:07 -04:00
|
|
|
// show normal table layout
|
|
|
|
} else {
|
2009-06-09 16:59:41 -04:00
|
|
|
if ($_SESSION["tabletype"] != "" && $_SESSION["tabletype"] == "timetable") {
|
2009-05-14 05:19:21 -04:00
|
|
|
|
2009-05-18 07:37:07 -04:00
|
|
|
if ($_POST["back"] != "") {
|
|
|
|
$_SESSION['timeshift'] += $_SESSION['selectedtimestep'];
|
|
|
|
}
|
|
|
|
if ($_POST["forward"] != "") {
|
|
|
|
$_SESSION['timeshift'] -= $_SESSION['selectedtimestep'];
|
|
|
|
}
|
|
|
|
if ($_SESSION['timeshift'] < 0) {
|
|
|
|
$_SESSION['timeshift'] = 0;
|
|
|
|
}
|
2009-05-14 05:19:21 -04:00
|
|
|
|
2009-05-18 07:37:07 -04:00
|
|
|
$tablearray = $tsmmonitor->execute('timetable');
|
|
|
|
$headerarray = $queryarray[$tsmmonitor->GETVars['qq']]["header"]["column"];
|
|
|
|
echo $tsmmonitor->generateTimetable($tablearray, $headerarray[0]);
|
2009-05-14 05:19:21 -04:00
|
|
|
|
2009-06-09 16:59:41 -04:00
|
|
|
} else if ($_SESSION["tabletype"] != "" && $_SESSION["tabletype"] == "timetable2") {
|
|
|
|
|
|
|
|
if ($_POST["back"] != "") {
|
|
|
|
$_SESSION['timeshift'] += $_SESSION['selectedtimestep'];
|
|
|
|
}
|
|
|
|
if ($_POST["forward"] != "") {
|
|
|
|
$_SESSION['timeshift'] -= $_SESSION['selectedtimestep'];
|
|
|
|
}
|
|
|
|
if ($_SESSION['timeshift'] < 0) {
|
|
|
|
$_SESSION['timeshift'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$tablearray = $tsmmonitor->execute('timetable2');
|
|
|
|
$headerarray = $queryarray[$tsmmonitor->GETVars['qq']]["header"]["column"];
|
|
|
|
echo $tsmmonitor->generateTimetable2($tablearray, $headerarray[0]);
|
2009-05-14 05:19:21 -04:00
|
|
|
|
|
|
|
} else {
|
2009-05-18 07:37:07 -04:00
|
|
|
|
|
|
|
$whereclause = array();
|
2009-05-24 15:22:45 -04:00
|
|
|
$whereclause["field"] = $_POST["wcfield"];
|
2009-05-18 07:37:07 -04:00
|
|
|
$whereclause["val"] = $_POST["wcval"];
|
|
|
|
$whereclause["op"] = $_POST["wcop"];
|
2009-05-24 15:22:45 -04:00
|
|
|
if ($whereclause["op"] == 'LIKE') {
|
|
|
|
$whereclause["val"] = ereg_replace("\*","%",$whereclause["val"]);
|
|
|
|
$_POST["wcval"] = $whereclause["val"];
|
|
|
|
}
|
|
|
|
if ($whereclause["field"] != "" && $whereclause["val"] != "") {
|
2009-05-18 07:37:07 -04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-05-24 11:25:29 -04:00
|
|
|
$lines = $_POST["lpp"];
|
|
|
|
if ($lines != "") {
|
|
|
|
if (!isset($_SESSION["lines"])){
|
|
|
|
$temp = array();
|
|
|
|
$temp[$tsmmonitor->GETVars['qq']] = $lines;
|
|
|
|
$_SESSION["lines"] = $temp;
|
|
|
|
} else {
|
|
|
|
$_SESSION["lines"][$tsmmonitor->GETVars['qq']] = $lines;
|
|
|
|
}
|
|
|
|
}
|
2009-05-18 07:37:07 -04:00
|
|
|
echo "<table class='zebra'>";
|
|
|
|
$thead = $tsmmonitor->getTableheader();
|
2009-06-05 06:50:25 -04:00
|
|
|
echo $thead["header"];
|
|
|
|
$tbody = $tsmmonitor->execute('table');
|
|
|
|
if ($tbody != "") {
|
|
|
|
echo $tbody;
|
|
|
|
} else {
|
|
|
|
echo "<tr class='d0'><td colspan='".$thead["numfields"]."' align='center'>No entries found in database.</td></tr>";
|
|
|
|
}
|
2009-05-18 07:37:07 -04:00
|
|
|
$nav = $tsmmonitor->showPageNavigation("40");
|
2009-05-24 11:25:29 -04:00
|
|
|
if ($nav != "") {
|
2009-06-17 08:32:13 -04:00
|
|
|
echo "<tr><td colspan='".$thead["numfields"]."' align='center' class='footer'><a>".$nav."</a></td></tr>";
|
2009-05-18 07:37:07 -04:00
|
|
|
}
|
|
|
|
echo "</table>";
|
2009-05-14 05:19:21 -04:00
|
|
|
}
|
2009-05-18 07:37:07 -04:00
|
|
|
|
2009-05-10 07:44:45 -04:00
|
|
|
}
|
|
|
|
}
|
2009-05-18 07:37:07 -04:00
|
|
|
} else {
|
2009-05-18 11:06:42 -04:00
|
|
|
if (isset($_SESSION["logindata"])){
|
|
|
|
$errormsg = "Login failed!";
|
|
|
|
}else{
|
|
|
|
$errormsg = "Login";
|
|
|
|
}
|
2009-05-10 07:44:45 -04:00
|
|
|
|
2009-05-18 11:06:42 -04:00
|
|
|
session_unset();
|
|
|
|
$_SESSION=array();
|
2009-05-18 07:37:07 -04:00
|
|
|
|
2009-05-18 11:06:42 -04:00
|
|
|
include_once "includes/login.php";
|
2009-05-18 07:37:07 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
$_SESSION['from'] = $tsmmonitor->GETVars['qq'];
|
2009-05-24 15:22:45 -04:00
|
|
|
session_write_close(void);
|
2009-05-18 07:37:07 -04:00
|
|
|
?>
|
2009-05-10 07:44:45 -04:00
|
|
|
|
2009-05-18 07:37:07 -04:00
|
|
|
</td>
|
|
|
|
</tr>
|
2009-05-10 07:44:45 -04:00
|
|
|
|
2009-05-18 07:37:07 -04:00
|
|
|
<?php if ($_SESSION["logindata"]["loggedin"]) include_once "includes/footer.php"; ?>
|
2009-05-10 07:44:45 -04:00
|
|
|
|
|
|
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|