- 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.
This commit is contained in:
Frank Fegert 2009-05-23 21:10:59 +00:00
parent 5ce2f693d6
commit 79bade6748
3 changed files with 7 additions and 3 deletions

View File

@ -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);

View File

@ -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 {

View File

@ -746,7 +746,7 @@ class TSMMonitor {
$i++;
} else {
$outp = $this->adodb->fetchArrayDB($sql);
var_dump($outp);
//var_dump($outp);
}
}
return $outp;