From: <par...@us...> - 2009-02-13 20:52:35
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/init In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20439/functions/init Modified Files: sanitize.php Log Message: Fix potential XSS issue Index: sanitize.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init/sanitize.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sanitize.php 11 Dec 2008 23:48:39 -0000 1.1 --- sanitize.php 13 Feb 2009 20:52:28 -0000 1.2 *************** *** 33,36 **** --- 33,52 ---- } + + function sanitizeForWeb($string) { + $string = preg_replace('/<br\s*\/?>/', "\n", $string); + + $string = str_replace('&', '&', $string); + $string = str_replace('<', '<', $string); + $string = str_replace('>', '>', $string); + $string = str_replace('\'', ''', $string); + $string = str_replace('"', '"', $string); + + $string = str_replace('<br />', "\n", $string); + + return $string; + } + + if (!isset($_SERVER) && isset($HTTP_SERVER_VARS)) { $_SERVER = &$HTTP_SERVER_VARS; |