diff --git a/includes/layout.js b/includes/layout.js index 3c8c387..0a12eb8 100644 --- a/includes/layout.js +++ b/includes/layout.js @@ -1,7 +1,3 @@ -function genPDF() { - window.open( "includes/show_pdf.php", "myWindow", "status = 1, fullscreen=yes,scrollbars=yes" ) -} - function show_confirm($url, $id, $action) { var r=confirm("Are you sure?"); diff --git a/includes/page_head.php b/includes/page_head.php index 1176305..90d1c47 100644 --- a/includes/page_head.php +++ b/includes/page_head.php @@ -72,6 +72,11 @@ $adodb->setDebug($_SESSION["debug"]); return true; } + + function genPDF() { + window.open( "includes/show_pdf.php?q=&s=", "myWindow", "status = 1, fullscreen=yes,scrollbars=yes" ) + } + // --> diff --git a/includes/pdf.php b/includes/pdf.php index 2b18750..9f64b87 100644 --- a/includes/pdf.php +++ b/includes/pdf.php @@ -54,7 +54,7 @@ class PDF extends FPDF /** - * Header - class header + * Header - generates page header * */ @@ -62,24 +62,27 @@ class PDF extends FPDF { //Print the table header if necessary if($this->ProcessingTable) $this->TableHeader(); - $configarray = $_SESSION["configarray"]; - $queryarray = $configarray["queryarray"]; - $qq = $_SESSION["GETVars"]["qq"]; - $server = $_SESSION["GETVars"]["server"]; - $label = $queryarray[$qq]["label"]; - $snapshotdate = $_SESSION['timemachine']['time']; - if ($snapshotdate != "") { - $snapshotdate = " (".strftime("%Y/%m/%d %H:%m", $snapshotdate).")"; - } - //Title - $this->SetFont('Arial','',12); - $this->Cell(0,6,$server.": ".$label.$snapshotdate,0,1,'C'); - $this->Ln(10); //Ensure table header is output parent::Header(); } + /** + * 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); + $this->Cell(0,6,$pagetitle,0,1,'C'); + $this->Ln(10); + + } + /** * * TableHeader diff --git a/includes/polld.php b/includes/polld.php index 4a93eaa..6d8ea37 100644 --- a/includes/polld.php +++ b/includes/polld.php @@ -40,7 +40,6 @@ * Class PollD * */ - class PollD { var $servers; @@ -57,10 +56,12 @@ class PollD { /** - * constructor - * + * PollD + * + * @param mixed $adodb + * @access public + * @return void */ - function PollD($adodb) { $this->adodb = $adodb; @@ -76,7 +77,6 @@ class PollD { * getQueries - returns an array filled with all configured TSM queries * */ - function getQueries() { $queries = array(); $query = "select * from cfg_queries"; @@ -103,7 +103,6 @@ class PollD { * * @return array */ - function getOverviewQueries() { $queries = array(); $query = "select * from cfg_overviewqueries"; @@ -120,7 +119,6 @@ class PollD { * * @return array */ - function getServers() { $query = "select * from cfg_servers"; $rows = $this->adodb->fetchArrayDB($query); @@ -145,7 +143,6 @@ class PollD { * @param string $overviewname * @return array */ - function execute($query = '', $servername = '', $restable = '', $timestamp = '', $overviewname = '') { $server = $this->servers[$servername]; @@ -182,7 +179,7 @@ class PollD { if ($overviewname == '') { $out[] = 'INSERT IGNORE INTO '.$restable.' values ("'.$timestamp.'", "'.$read.'")'; } else { - $out[] = 'INSERT INTO '.$restable.' (timestamp, name, result) values ("'.$timestamp.'", "'.$overviewname.'", "'.$read.'") ON DUPLICATE KEY update result="'.$read.'"'; + $out[] = 'INSERT INTO '.$restable.' (timestamp, name, result) values ("'.$timestamp.'", "'.$overviewname.'", "'.$read.'") ON DUPLICATE KEY update result="'.$read.'", timestamp="'.$timestamp.'"'; } } else { // result is empty and it's ok $out[0] = 'INSERT IGNORE INTO '.$restable.' (timestamp) values ("'.$timestamp.'")'; @@ -211,7 +208,6 @@ class PollD { * @param string $hash md5 hash checksum of current resultSet * @return boolean */ - function checkHash($tablename = '', $hash = ''){ $sql = "select count(*) from log_hashes where TABLENAME='".$tablename."' and HASH='".$hash."'"; @@ -242,7 +238,6 @@ class PollD { * @param string $timestamp timestamp * @return boolean */ - function checkFreq($tablename, $pollfreq, $timestamp) { $sql = "select MAX(TimeStamp) from ".$tablename; @@ -264,7 +259,6 @@ class PollD { * * @return string */ - function getSleeptime() { $sql = "select MIN(pollfreq) from cfg_queries"; @@ -290,7 +284,6 @@ class PollD { * @param boolean $ignorePollFreq * @param string $timestamp */ - function pollQuery($query = "", $server = "", $ignorePollFreq = FALSE, $timestamp){ $queryname = $query["name"]; @@ -351,7 +344,6 @@ class PollD { * @param boolean $ignorePollFreq * @param string $timestamp */ - function pollOverviewQuery($query = "", $server = "", $timestamp){ $tablename = "res_overview_".$server["servername"]; @@ -382,7 +374,6 @@ class PollD { * @param string $overviewqueryname * @param string $hashonly do not drop table, just delete entry in log_hashes */ - function cleanupDatabase($servername = "", $queryname = "", $overviewqueryname = "", $months = "9999" ,$hashonly = "yes"){ if ($servername != "" && $queryname != "" && $overviewqueryname != "") { @@ -424,7 +415,6 @@ class PollD { * @param string $lastrun * @param string $nextrun */ - function setPollDStatus($status, $lastrun, $nextrun) { if ($status != "") $status = "`status`='".$status."'"; @@ -442,7 +432,6 @@ class PollD { * * @returns boolean */ - function isEnabled() { $sql = "select enabled from log_polldstat WHERE `id`='1'"; @@ -462,7 +451,6 @@ class PollD { * * @param string switch on or off */ - function controlPollD($switch = "") { if ($switch == "on") { @@ -482,7 +470,6 @@ class PollD { * * @returns string */ - function getStatus() { $sql = "select status from log_polldstat WHERE `id`='1'"; @@ -499,7 +486,6 @@ class PollD { * * @return boolean */ - function poll(){ $this->controlPollD("off"); diff --git a/includes/show_pdf.php b/includes/show_pdf.php index e569577..509ffcf 100644 --- a/includes/show_pdf.php +++ b/includes/show_pdf.php @@ -43,8 +43,19 @@ $prop=array('HeaderColor'=>array(180,180,180), 'color1'=>array(255,255,255), 'color2'=>array(230,230,230), 'padding'=>2); - $res = $adodb->fetchArrayDB($_SESSION["lastsql"]); + +//build Page Title +$configarray = $_SESSION["configarray"]; +$queryarray = $configarray["queryarray"]; +$qq = $_GET["q"]; +$server = $_GET["s"]; +$label = $queryarray[$qq]["label"]; +$snapshotdate = $_SESSION['timemachine']['time']; +if ($snapshotdate != "") $snapshotdate = " (".strftime("%Y/%m/%d %H:%m", $snapshotdate).")"; +$pageheader = $server.": ".$label." ".$snapshotdate; + +$pdf->PageHeader($pageheader); $pdf->Table($_SESSION["lastsql"],$prop,$res); $pdf->Output(); diff --git a/includes/tsmmonitor.php b/includes/tsmmonitor.php index bca4af2..849f251 100644 --- a/includes/tsmmonitor.php +++ b/includes/tsmmonitor.php @@ -56,10 +56,12 @@ class TSMMonitor { /** - * TSMMonitor - constructor - * + * TSMMonitor + * + * @param mixed $adodb + * @access public + * @return void */ - function TSMMonitor($adodb) { $this->adodb = $adodb; @@ -217,7 +219,6 @@ class TSMMonitor { * @param string links_per_page number of links that will be displayed per page * @return string */ - function showPageNavigation($links_per_page = "1") { $this->page = intval($_GET['page']); @@ -294,7 +295,6 @@ class TSMMonitor { * @param string $end second string * @return string */ - function GetBetween($content,$start,$end) { $r = explode($start, $content); if (isset($r[1])) { @@ -312,7 +312,6 @@ class TSMMonitor { * * @return string */ - function GetTimemachine() { $this->queryarray = $this->configarray["queryarray"]; @@ -351,7 +350,7 @@ class TSMMonitor { $ret .= "
"; if ($qq == "index") $qq = "overview"; $LastTimestamp = $this->getLastSnapshot($qq); - if ($LastTimestamp!="") $ret .= "Last updated: ".strftime('%H:%M:%S', $LastTimestamp); + if ($LastTimestamp!="") $ret .= "Last updated: ".strftime('%Y-%m-%d %H:%M:%S', $LastTimestamp); $ret .= "
"; $ret .= "
"; $ret .= ""; @@ -371,7 +370,6 @@ class TSMMonitor { * @param string $type index or admin * @return string */ - function getMenu($menu = '', $activelink = '', $type) { if (!isset($menu)) { return ""; }; @@ -416,7 +414,6 @@ class TSMMonitor { * * @return string */ - function getMessage() { return "
System Message:

".$this->message."
"; @@ -430,7 +427,6 @@ class TSMMonitor { * * @return string */ - function getInfo() { $label = $this->configarray["queryarray"][$this->GETVars['qq']]["label"]; @@ -451,7 +447,6 @@ class TSMMonitor { * * @return string */ - function getStylesheetSwitcher() { $ret = ""; @@ -488,7 +483,6 @@ class TSMMonitor { * * @return string */ - function getTableheader() { $tableheader=""; @@ -553,7 +547,6 @@ class TSMMonitor { * checkLogin - processes login procedure and sets loggedin property in SESSION * */ - function checkLogin() { $user = $_SESSION["logindata"]["user"]; @@ -590,7 +583,6 @@ class TSMMonitor { * @param string $val the value that will be checked * @return boolean */ - function checkAlert($comperator = '', $alertval = '', $val = '') { $error = false; @@ -628,7 +620,6 @@ class TSMMonitor { * @param string $timestamp a timestamp that s needed to get the current day * @return string */ - function getTimestampsOfADay($timestamp = "") { $server = $this->GETVars['server']; @@ -655,7 +646,6 @@ class TSMMonitor { * @param string qq name of query * @return string */ - function getLastSnapshot($qq) { $server = $this->GETVars['server']; @@ -673,12 +663,12 @@ class TSMMonitor { /** - * $this->getTableFields - * - * @param string tablename - * @return string + * getTableFields + * + * @param string $tablename + * @access public + * @return void */ - function getTableFields($tablename="") { $sqlth = "SELECT * from ".$tablename." LIMIT 1"; @@ -706,7 +696,6 @@ class TSMMonitor { * @param string $type (list, edit, add) * @return string */ - function getAdminTables($type="") { $columnnames = $this->getTableFields("cfg_".$this->GETVars['qq']); @@ -765,7 +754,6 @@ class TSMMonitor { * @param string $type sets the table type (vertical, standard and graphical time table) * @return string */ - function execute($type = 'table') { $colorsarray = $this->configarray["colorsarray"]; @@ -907,7 +895,6 @@ class TSMMonitor { * * @return string */ - function getSearchfield() { $ret = ""; @@ -967,7 +954,6 @@ class TSMMonitor { * * @return string */ - function getServerlist() { $ret = ""; @@ -1001,7 +987,6 @@ class TSMMonitor { * * @return string */ - function getPollDStat() { $i=1; @@ -1067,7 +1052,6 @@ class TSMMonitor { * @param array $subindexqueryarray array of query objects * @return string */ - function getOverviewRows($subindexqueryarray = '') { $out=""; @@ -1135,7 +1119,6 @@ class TSMMonitor { * @param string $FirstCol first field of result table * @return string */ - function generateTimetableHeader($startpunkt = '', $FirstCol = '') { $header = $FirstCol["label"]; @@ -1159,7 +1142,6 @@ class TSMMonitor { * * @return string */ - function generateTimetableNavigation() { @@ -1199,7 +1181,6 @@ class TSMMonitor { * @param string $FirstCol first field of result table * @return string */ - function generateTimetable($tablearray = '', $FirstCol = '') { $now = time(); @@ -1321,7 +1302,6 @@ class TSMMonitor { * * @return array */ - function getConfigArray() { $retArray = array();