1
0

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

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