mirror of
https://codeberg.org/mclemens/tsmmonitor2.git
synced 2024-11-14 01:46:03 -05:00
- urlencode()'ed all URL parameters.
- added OS switch for popen() mode.
This commit is contained in:
parent
961d466758
commit
7bd1b0356c
@ -44,6 +44,7 @@ class PollD {
|
||||
|
||||
var $servers;
|
||||
var $queries;
|
||||
var $os;
|
||||
var $overviewqueries;
|
||||
var $adodb;
|
||||
var $debuglevel; // VERBOSE=4, INFO=3, WARN=2, ERROR=1, OFF=0
|
||||
@ -62,7 +63,7 @@ class PollD {
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function PollD($adodb) {
|
||||
function PollD($adodb, $os) {
|
||||
|
||||
$this->setDebuglevel("INFO");
|
||||
$this->adodb = $adodb;
|
||||
@ -238,7 +239,8 @@ class PollD {
|
||||
$query = ereg_replace("NOTEQUAL","<>",$query);
|
||||
$query = ereg_replace("LESS","<",$query);
|
||||
|
||||
$handle = popen("dsmadmc -se=$servername -id=$user -password=$pass -TCPServeraddress=$ip -COMMMethod=TCPIP -TCPPort=$port -dataonly=yes -TAB \"$query\" ", 'r');
|
||||
$popen_flags = ($os == "win32") ? 'rb' : 'r';
|
||||
$handle = popen("dsmadmc -se=$servername -id=$user -password=$pass -TCPServeraddress=$ip -COMMMethod=TCPIP -TCPPort=$port -dataonly=yes -TAB \"$query\" ", "$popen_flags");
|
||||
|
||||
$hashstring = "";
|
||||
|
||||
|
@ -87,15 +87,15 @@ class TSMMonitor {
|
||||
$_SESSION['configarray'] = $this->getConfigArray();
|
||||
|
||||
// GET-variables
|
||||
$this->GETVars["menu"] = $_GET['m'];
|
||||
$this->GETVars["qq"] = $_GET['q'];
|
||||
$this->GETVars['ob'] = $_GET['sort'];
|
||||
$this->GETVars['orderdir'] = $_GET['so'];
|
||||
$this->GETVars["menu"] = urlencode($_GET['m']);
|
||||
$this->GETVars["qq"] = urlencode($_GET['q']);
|
||||
$this->GETVars['ob'] = urlencode($_GET['sort']);
|
||||
$this->GETVars['orderdir'] = urlencode($_GET['so']);
|
||||
|
||||
if ($_POST['s'] != '') {
|
||||
$this->GETVars['server'] = $_POST['s'];
|
||||
$this->GETVars['server'] = urlencode($_POST['s']);
|
||||
} else {
|
||||
$this->GETVars['server'] = $_GET['s'];
|
||||
$this->GETVars['server'] = urlencode($_GET['s']);
|
||||
}
|
||||
|
||||
|
||||
@ -117,14 +117,12 @@ class TSMMonitor {
|
||||
if ($this->GETVars['server'] == "") { $this->GETVars['server']=$this->configarray["defaultserver"]; }
|
||||
if ($this->GETVars['orderdir'] == "") { $this->GETVars['orderdir'] = "asc"; }
|
||||
|
||||
//if ($_SESSION['timeshift'] == '' || !strstr($this->GETVars["qq"], 'dynamictimetable')) {
|
||||
if ($_SESSION['timeshift'] == '' || $this->configarray["queryarray"][$this->GETVars['qq']]["timetablefields"] == "") {
|
||||
$_SESSION['timeshift'] = 0 ;
|
||||
}
|
||||
|
||||
$this->menu = $this->configarray["menuarray"];
|
||||
$this->adminmenu = $this->configarray["adminmenuarray"];
|
||||
//$query = $this->configarray["queryarray"][$this->GETVars['qq']]["tsmquery"];
|
||||
$this->queryarray = $this->configarray["queryarray"];
|
||||
|
||||
$_SESSION["GETVars"] = $this->GETVars;
|
||||
@ -231,10 +229,10 @@ class TSMMonitor {
|
||||
$this->page = intval($_GET['page']);
|
||||
if ($this->page == "") $this->page = 1;
|
||||
$so = $_GET['so'];
|
||||
$sortcol = $_GET['sort'];
|
||||
$sortcol = urlencode($_GET['sort']);
|
||||
|
||||
$getvars = 'q='.$_GET['q'].'&m='.$_GET['m'].'&s='.$this->GETVars['server'].'&sort='.(urlencode($sortcol))."&so=".$so;
|
||||
$self = htmlspecialchars($_SERVER['PHP_SELF']);
|
||||
$getvars = 'q='.$_GET['q'].'&m='.$_GET['m'].'&s='.$this->GETVars['server'].'&sort='.$sortcol."&so=".$so;
|
||||
$self = urlencode($_SERVER['PHP_SELF']);
|
||||
$navelement = '<a class="tablefooter" href="'.$self.'?'.$getvars.'&page=';
|
||||
|
||||
$fp = "First";
|
||||
@ -1037,7 +1035,7 @@ class TSMMonitor {
|
||||
$listip = $serveritems["ip"];
|
||||
$listdescription = $serveritems["description"];
|
||||
$listport = $serveritems["port"];
|
||||
$listlink = $_SERVER['PHP_SELF']."?q=".$_SESSION["from"]."&m=".$this->GETVars['menu']."&s=".$servername;
|
||||
$listlink = $_SERVER['PHP_SELF']."?q=".$_SESSION["from"]."&m=".$this->GETVars['menu']."&s=".(urlencode($servername));
|
||||
$row = array("<a class='nav' href='".$listlink."'>".$servername."</a>", $listdescription, $listip, $listport);
|
||||
$ret .= $this->renderZebraTableRow($row, $i%2, "", "", "");
|
||||
$i++;
|
||||
|
@ -255,11 +255,7 @@ if (empty($_REQUEST["step"])) {
|
||||
if ($input_err == "") {
|
||||
$dsmadmc = $_SESSION["install"]["paths"]["path_dsmadmc"]["default"];
|
||||
if (file_exists($dsmadmc) && is_executable($dsmadmc)) {
|
||||
if ($config["server_os"] == "win32") {
|
||||
$popen_flags = "r";
|
||||
} elseif ($config["server_os"] == "unix") {
|
||||
$popen_flags = "rb";
|
||||
}
|
||||
$popen_flags = ($os == "win32") ? 'rb' : 'r';
|
||||
$oh = popen($dsmadmc." -se=".$server['srv_servername']." -id=".$server['srv_username']." -password=".$server['srv_password']." -TCPServeraddress=".$server['srv_ip']." -COMMMethod=TCPIP -TCPPort=".$server['srv_port']." -dataonly=yes -TAB \"SELECT SERVER_HLA,SERVER_LLA FROM status\" ", "$popen_flags");
|
||||
if ($oh != 0) {
|
||||
while (!feof($oh)) {
|
||||
|
@ -36,7 +36,7 @@
|
||||
include_once("../includes/global.php");
|
||||
|
||||
|
||||
$tmonpolld = new PollD($adodb);
|
||||
$tmonpolld = new PollD($adodb, $config["server_os"]);
|
||||
//$tmonpolld->setDebuglevel("WARN");
|
||||
$tmonpolld->controlPollD("on");
|
||||
$tmonpolld->poll();
|
||||
|
Loading…
Reference in New Issue
Block a user