cvs: pear /Text_Wiki/Text/Wiki/Render/Xhtml Freelink.php
| From: | Paul Jones | Date: | Mon, 14 Jun 2004 01:50:27 +0000 |
| Subject: | cvs: pear /Text_Wiki/Text/Wiki/Render/Xhtml Freelink.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-20613@lists.php.net to get a copy of this message | ||
pmjones Sun Jun 13 21:50:27 2004 EDT
Modified files:
/pear/Text_Wiki/Text/Wiki/Render/Xhtml Freelink.php
Log:
apply htmlspecialchars() to $href and $text, apply urlencode() to $page
http://cvs.php.net/diff.php/pear/Text_Wiki/Text/Wiki/Render/Xhtml/Freelink.php?r1=1.1&r2=1.2&ty=u
Index: pear/Text_Wiki/Text/Wiki/Render/Xhtml/Freelink.php
diff -u pear/Text_Wiki/Text/Wiki/Render/Xhtml/Freelink.php:1.1
pear/Text_Wiki/Text/Wiki/Render/Xhtml/Freelink.php:1.2
--- pear/Text_Wiki/Text/Wiki/Render/Xhtml/Freelink.php:1.1 Sun Jun 6 11:44:35 2004
+++ pear/Text_Wiki/Text/Wiki/Render/Xhtml/Freelink.php Sun Jun 13 21:50:27 2004
@@ -34,11 +34,13 @@
$href = $this->getConf('view_url');
if (strpos($href, '%s') === false) {
// use the old form
- $href = $href . $page . '#' . $anchor;
+ $href = $href . urlencode($page) . '#' . $anchor;
} else {
// use the new form
- $href = sprintf($href, $page . '#' . $anchor);
+ $href = sprintf($href, urlencode($page) . '#' . $anchor);
}
+
+ $text = htmlspecialchars($text);
return "<a href=\"$href\">$text</a>";
} else {
@@ -48,11 +50,12 @@
$href = $this->getConf('new_url');
if (strpos($href, '%s') === false) {
// use the old form
- $href = $href . $page;
+ $href = $href . urlencode($page);
} else {
// use the new form
- $href = sprintf($href, $page);
+ $href = sprintf($href, urlencode($page));
}
+
return $text . "<a href=\"$href\">" .
$this->getConf('new_text') . "</a>";
}