From d26e06e92b90cb435759692d6014957648e7d539 Mon Sep 17 00:00:00 2001 From: Frank Fegert Date: Sun, 21 Jun 2009 16:16:32 +0000 Subject: [PATCH] - Workaround for escaped backslashes in file path input fields when PHP-option 'magic_quotes_gpc' is set. - Extended installer tests for valid logfile/logpath input. --- install.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/install.php b/install.php index 299cefe..e7473d5 100644 --- a/install.php +++ b/install.php @@ -212,7 +212,11 @@ if (empty($_REQUEST["step"])) { } foreach ($_SESSION["install"]["paths"] as $name => $array) { if (isset($_POST[$name])) { - $_SESSION["install"]["paths"][$name]["default"] = $_POST[$name]; + if (get_magic_quotes_gpc() != 0) { + $_SESSION["install"]["paths"][$name]["default"] = stripslashes($_POST[$name]); + } else { + $_SESSION["install"]["paths"][$name]["default"] = $_POST[$name]; + } } } } @@ -475,6 +479,27 @@ if ($_REQUEST["step"] == "90") { $resStr = "[NOT FOUND] "; $capStr = "
[ERROR: FILE NOT FOUND]
"; } + + if ($name == "path_tmlog" || $name == "path_polldlog") { + $dir = dirname($file); + $base = basename($file); + if (file_exists($file) && is_file($file) && is_writable($file)) { + $resStr = "[FOUND] "; + $capStr = "
[OK: FILE FOUND]
"; + } else if (file_exists($file) && is_dir($file) && is_writable($file)) { + $file = ereg_replace("\/*$", "", $file); + $file .= "/tsmmonitor.log"; + $resStr = "[FOUND] "; + $capStr = "
[OK: DIRECTORY FOUND]
"; + } else if (!file_exists($file) && is_dir($dir) && is_writable($dir)) { + $file = $dir."/".$base; + $resStr = "[FOUND] "; + $capStr = "
[OK: DIRECTORY FOUND]
"; + } else { + $resStr = "[NOT FOUND] "; + $capStr = "
[ERROR: FILE OR DIRECTORY NOT FOUND OR NOT WRITEABLE]
"; + } + } echo "

" . $resStr . $array["name"];