From 79bade674800feeb983af7450aacea36a5cb409a Mon Sep 17 00:00:00 2001 From: Frank Fegert Date: Sat, 23 May 2009 21:10:59 +0000 Subject: [PATCH] - Escaped backslashes before insert into DB. This fixes display errors for e.g. Windows filespaces. This is also only a ugly workaround. A DB dependend escape of SQL statments via ADODBs 'qstr()' would be much better, but needs code refactoring. - Allow to save empty config field values. Needed to enable/disable file logging. - Fallback logging to STDOUT if given logfile not accessible. --- admin.php | 4 ++-- includes/polld.php | 4 ++++ includes/tsmmonitor.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/admin.php b/admin.php index 62e70e2..afe1840 100644 --- a/admin.php +++ b/admin.php @@ -249,7 +249,7 @@ if ($_POST["css"] != "") { } else { $val = $_POST["txt".$col['Field']]; } - if ($val != "") { +// if ($val != "") { if ($_POST['AddSave'] == "Save") { $colarray["`".$col['Field']."`"] = $val; $sqlcols .= $col['Field']; @@ -261,7 +261,7 @@ if ($_POST["css"] != "") { $set .= $col['Field']."='".$val."'"; $set .= ", "; } - } +// } } } $sqlcols = ereg_replace(", $", "", $sqlcols); diff --git a/includes/polld.php b/includes/polld.php index 83239eb..9a1bf38 100644 --- a/includes/polld.php +++ b/includes/polld.php @@ -74,6 +74,9 @@ class PollD { $logfile = $this->adodb->fetchArrayDB($sql); if ($logfile[0][confval] != "") { $this->loghandle = fopen($logfile[0][confval], 'at'); + if (!$this->loghandle) { + echo "ERROR: Cannot open logfile: '".$logfile[0][confval]."' for writing. Falling back to STDOUT.\n"; + } } $this->servers = $this->getServers(); $this->queries = $this->getQueries(); @@ -253,6 +256,7 @@ class PollD { if ($blank == "") { $read = preg_replace('/[\n]+/', '', $read); $read = ereg_replace("\t","\",\"",$read); + $read = ereg_replace("\\\\",'\\\\',$read); if ($overviewname == '') { $out[] = 'INSERT IGNORE INTO '.$restable.' values ("'.$timestamp.'", "'.$read.'")'; } else { diff --git a/includes/tsmmonitor.php b/includes/tsmmonitor.php index ed2baeb..d0f6176 100644 --- a/includes/tsmmonitor.php +++ b/includes/tsmmonitor.php @@ -746,7 +746,7 @@ class TSMMonitor { $i++; } else { $outp = $this->adodb->fetchArrayDB($sql); - var_dump($outp); + //var_dump($outp); } } return $outp;