From 3a61131ffd65d2c133b8f1c9a8576982e085f56c Mon Sep 17 00:00:00 2001 From: Jonathan Ernst Date: Tue, 18 Jul 2006 02:42:57 +0000 Subject: [PATCH] Trim 's' and 'sh' variables in filter.php so we correctly convert variable values with spaces into "" strings --- include/filter.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/filter.php b/include/filter.php index f5b558f..422a9cf 100644 --- a/include/filter.php +++ b/include/filter.php @@ -32,10 +32,13 @@ function filter_gpc() switch($aKeys[$i][1]) { case "h": // HTML string - $aClean[$aKeys[$i]] = htmlspecialchars($_REQUEST[$aKeys[$i]]); + $aClean[$aKeys[$i]] = trim(htmlspecialchars($_REQUEST[$aKeys[$i]])); + // if there is no content and no image, make the variable empty + if(strip_tags($aClean[$aKeys[$i]],'')=="") + $aClean[$aKeys[$i]] = ""; break; default: // normal string (no HTML) - $aClean[$aKeys[$i]] = strip_tags($_REQUEST[$aKeys[$i]]); + $aClean[$aKeys[$i]] = trim(strip_tags($_REQUEST[$aKeys[$i]])); break; } break;