Skip to content

Commit

Permalink
apply htmlspecialchars() to $href and $text, apply urlencode() to $page
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.php.net/repository/pear/packages/Text_Wiki/trunk@161296 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
Paul M Jones committed Jun 14, 2004
1 parent 4776595 commit 102c728
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Text/Wiki/Render/Xhtml/Freelink.php
Expand Up @@ -34,11 +34,13 @@ function token($options)
$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 {
Expand All @@ -48,11 +50,12 @@ function token($options)
$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>";

}
Expand Down

0 comments on commit 102c728

Please sign in to comment.