mirror of
https://codeberg.org/mclemens/tsmmonitor2.git
synced 2025-01-03 03:46:38 -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 $servers;
|
||||||
var $queries;
|
var $queries;
|
||||||
|
var $os;
|
||||||
var $overviewqueries;
|
var $overviewqueries;
|
||||||
var $adodb;
|
var $adodb;
|
||||||
var $debuglevel; // VERBOSE=4, INFO=3, WARN=2, ERROR=1, OFF=0
|
var $debuglevel; // VERBOSE=4, INFO=3, WARN=2, ERROR=1, OFF=0
|
||||||
@ -62,7 +63,7 @@ class PollD {
|
|||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function PollD($adodb) {
|
function PollD($adodb, $os) {
|
||||||
|
|
||||||
$this->setDebuglevel("INFO");
|
$this->setDebuglevel("INFO");
|
||||||
$this->adodb = $adodb;
|
$this->adodb = $adodb;
|
||||||
@ -238,7 +239,8 @@ class PollD {
|
|||||||
$query = ereg_replace("NOTEQUAL","<>",$query);
|
$query = ereg_replace("NOTEQUAL","<>",$query);
|
||||||
$query = ereg_replace("LESS","<",$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 = "";
|
$hashstring = "";
|
||||||
|
|
||||||
|
@ -87,15 +87,15 @@ class TSMMonitor {
|
|||||||
$_SESSION['configarray'] = $this->getConfigArray();
|
$_SESSION['configarray'] = $this->getConfigArray();
|
||||||
|
|
||||||
// GET-variables
|
// GET-variables
|
||||||
$this->GETVars["menu"] = $_GET['m'];
|
$this->GETVars["menu"] = urlencode($_GET['m']);
|
||||||
$this->GETVars["qq"] = $_GET['q'];
|
$this->GETVars["qq"] = urlencode($_GET['q']);
|
||||||
$this->GETVars['ob'] = $_GET['sort'];
|
$this->GETVars['ob'] = urlencode($_GET['sort']);
|
||||||
$this->GETVars['orderdir'] = $_GET['so'];
|
$this->GETVars['orderdir'] = urlencode($_GET['so']);
|
||||||
|
|
||||||
if ($_POST['s'] != '') {
|
if ($_POST['s'] != '') {
|
||||||
$this->GETVars['server'] = $_POST['s'];
|
$this->GETVars['server'] = urlencode($_POST['s']);
|
||||||
} else {
|
} 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['server'] == "") { $this->GETVars['server']=$this->configarray["defaultserver"]; }
|
||||||
if ($this->GETVars['orderdir'] == "") { $this->GETVars['orderdir'] = "asc"; }
|
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"] == "") {
|
if ($_SESSION['timeshift'] == '' || $this->configarray["queryarray"][$this->GETVars['qq']]["timetablefields"] == "") {
|
||||||
$_SESSION['timeshift'] = 0 ;
|
$_SESSION['timeshift'] = 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->menu = $this->configarray["menuarray"];
|
$this->menu = $this->configarray["menuarray"];
|
||||||
$this->adminmenu = $this->configarray["adminmenuarray"];
|
$this->adminmenu = $this->configarray["adminmenuarray"];
|
||||||
//$query = $this->configarray["queryarray"][$this->GETVars['qq']]["tsmquery"];
|
|
||||||
$this->queryarray = $this->configarray["queryarray"];
|
$this->queryarray = $this->configarray["queryarray"];
|
||||||
|
|
||||||
$_SESSION["GETVars"] = $this->GETVars;
|
$_SESSION["GETVars"] = $this->GETVars;
|
||||||
@ -231,10 +229,10 @@ class TSMMonitor {
|
|||||||
$this->page = intval($_GET['page']);
|
$this->page = intval($_GET['page']);
|
||||||
if ($this->page == "") $this->page = 1;
|
if ($this->page == "") $this->page = 1;
|
||||||
$so = $_GET['so'];
|
$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;
|
$getvars = 'q='.$_GET['q'].'&m='.$_GET['m'].'&s='.$this->GETVars['server'].'&sort='.$sortcol."&so=".$so;
|
||||||
$self = htmlspecialchars($_SERVER['PHP_SELF']);
|
$self = urlencode($_SERVER['PHP_SELF']);
|
||||||
$navelement = '<a class="tablefooter" href="'.$self.'?'.$getvars.'&page=';
|
$navelement = '<a class="tablefooter" href="'.$self.'?'.$getvars.'&page=';
|
||||||
|
|
||||||
$fp = "First";
|
$fp = "First";
|
||||||
@ -1037,7 +1035,7 @@ class TSMMonitor {
|
|||||||
$listip = $serveritems["ip"];
|
$listip = $serveritems["ip"];
|
||||||
$listdescription = $serveritems["description"];
|
$listdescription = $serveritems["description"];
|
||||||
$listport = $serveritems["port"];
|
$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);
|
$row = array("<a class='nav' href='".$listlink."'>".$servername."</a>", $listdescription, $listip, $listport);
|
||||||
$ret .= $this->renderZebraTableRow($row, $i%2, "", "", "");
|
$ret .= $this->renderZebraTableRow($row, $i%2, "", "", "");
|
||||||
$i++;
|
$i++;
|
||||||
|
@ -255,11 +255,7 @@ if (empty($_REQUEST["step"])) {
|
|||||||
if ($input_err == "") {
|
if ($input_err == "") {
|
||||||
$dsmadmc = $_SESSION["install"]["paths"]["path_dsmadmc"]["default"];
|
$dsmadmc = $_SESSION["install"]["paths"]["path_dsmadmc"]["default"];
|
||||||
if (file_exists($dsmadmc) && is_executable($dsmadmc)) {
|
if (file_exists($dsmadmc) && is_executable($dsmadmc)) {
|
||||||
if ($config["server_os"] == "win32") {
|
$popen_flags = ($os == "win32") ? 'rb' : 'r';
|
||||||
$popen_flags = "r";
|
|
||||||
} elseif ($config["server_os"] == "unix") {
|
|
||||||
$popen_flags = "rb";
|
|
||||||
}
|
|
||||||
$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");
|
$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) {
|
if ($oh != 0) {
|
||||||
while (!feof($oh)) {
|
while (!feof($oh)) {
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
include_once("../includes/global.php");
|
include_once("../includes/global.php");
|
||||||
|
|
||||||
|
|
||||||
$tmonpolld = new PollD($adodb);
|
$tmonpolld = new PollD($adodb, $config["server_os"]);
|
||||||
//$tmonpolld->setDebuglevel("WARN");
|
//$tmonpolld->setDebuglevel("WARN");
|
||||||
$tmonpolld->controlPollD("on");
|
$tmonpolld->controlPollD("on");
|
||||||
$tmonpolld->poll();
|
$tmonpolld->poll();
|
||||||
|
Loading…
Reference in New Issue
Block a user