diff --git a/includes/polld.php b/includes/polld.php
index 9a1bf38..6497851 100644
--- a/includes/polld.php
+++ b/includes/polld.php
@@ -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 = "";
diff --git a/includes/tsmmonitor.php b/includes/tsmmonitor.php
index a1181bc..8b85106 100644
--- a/includes/tsmmonitor.php
+++ b/includes/tsmmonitor.php
@@ -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 = '".$servername."", $listdescription, $listip, $listport);
$ret .= $this->renderZebraTableRow($row, $i%2, "", "", "");
$i++;
diff --git a/install.php b/install.php
index d0e91a4..fa0302f 100644
--- a/install.php
+++ b/install.php
@@ -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)) {
diff --git a/polld/tmonpolld.php b/polld/tmonpolld.php
index badacfb..f53f3fd 100644
--- a/polld/tmonpolld.php
+++ b/polld/tmonpolld.php
@@ -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();