Escape JS specific characters

This commit is contained in:
Garvin Hicking 2006-10-05 11:45:34 +00:00
parent 8191755ec8
commit 68f51cd5af
3 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# $Id$ # $Id$
Version 1.1-beta4 () Version 1.1-beta5 ()
------------------------------------------------------------------------ ------------------------------------------------------------------------
* Added new plugin hooks: * Added new plugin hooks:

View File

@ -542,8 +542,8 @@ function serendipity_restoreVar(&$source, &$target) {
* @return null * @return null
*/ */
function serendipity_JSsetCookie($name, $value) { function serendipity_JSsetCookie($name, $value) {
$name = str_replace('"', '\"', $name); $name = strtr($name, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
$value = str_replace('"', '\"', $value); $value = strtr($value, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
echo '<script type="text/javascript">SetCookie("' . $name . '", "' . $value . '")</script>' . "\n"; echo '<script type="text/javascript">SetCookie("' . $name . '", "' . $value . '")</script>' . "\n";
} }

View File

@ -31,7 +31,7 @@ if (IS_installed === true && !defined('IN_serendipity')) {
include(S9Y_INCLUDE_PATH . 'include/compat.inc.php'); include(S9Y_INCLUDE_PATH . 'include/compat.inc.php');
// The version string // The version string
$serendipity['version'] = '1.1-beta4'; $serendipity['version'] = '1.1-beta5';
// Setting this to 'false' will enable debugging output. All alpa/beta/cvs snapshot versions will emit debug information by default. To increase the debug level (to enable Smarty debugging), set this flag to 'debug'. // Setting this to 'false' will enable debugging output. All alpa/beta/cvs snapshot versions will emit debug information by default. To increase the debug level (to enable Smarty debugging), set this flag to 'debug'.
$serendipity['production'] = (preg_match('@\-(alpha|beta|cvs)@', $serendipity['version']) ? false : true); $serendipity['production'] = (preg_match('@\-(alpha|beta|cvs)@', $serendipity['version']) ? false : true);