Menu

#18 Escaped characters in snippets

open
nobody
General (15)
5
2005-12-25
2005-12-25
mathew
No

Escaped characters in snippets lose the back slash when
editing the snippet:

$sString .= "\n";

would become, when opened for editing:

$sString .= "n";

I figure it may be something to do with magic quotes,
which are currently turned off on my installation of
php? I added the following to my copy (0.91) and it
seems ok now..
at the end of functions.php, i added a function:

function rtStripSlashes($sString) {
# returns string that has slashes stripped if magic
quotes are on
if (ini_get('magic_quotes_runtime')) {
return stripslashes($sString);
} else {
return $sString;
}
}

in file snips_edit.php, changed lines 50,51 to call
this function instead of stripslashes():

echo '<b>Edit Syntax below:</b></br><textarea
name=syntax rows=16
cols=60>'.rtStripSlashes(htmlspecialchars($syntax)).'</textarea></td></tr><tr><td
class="fr1">';
echo '<b>Edit Description below:</b></br><textarea
name=description rows=10
cols=60>'.rtStripSlashes(htmlspecialchars($description)).'</textarea></td></tr><tr><td
class="fr2" align=center>';

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.