use clean_url() instead of attribute_escape() when dealing with src/href to protect against XSS. props xknown. fixes #3986 for trunk.

git-svn-id: http://svn.automattic.com/wordpress/trunk@5056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith
2007-03-17 08:46:59 +00:00
parent 7136d65028
commit 611b037efa
18 changed files with 39 additions and 38 deletions

View File

@@ -297,6 +297,7 @@ function single_month_title($prefix = '', $display = true ) {
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
$text = wptexturize($text);
$title_text = attribute_escape($text);
$url = clean_url($url);
if ('link' == $format)
return "\t<link rel='archives' title='$title_text' href='$url' />\n";
@@ -985,7 +986,7 @@ function paginate_links( $arg = '' ) {
$link = str_replace('%#%', $current - 1, $link);
if ( $add_args )
$link = add_query_arg( $add_args, $link );
$page_links[] = "<a class='prev page-numbers' href='" . attribute_escape($link) . "'>$prev_text</a>";
$page_links[] = "<a class='prev page-numbers' href='" . clean_url($link) . "'>$prev_text</a>";
endif;
for ( $n = 1; $n <= $total; $n++ ) :
if ( $n == $current ) :
@@ -997,7 +998,7 @@ function paginate_links( $arg = '' ) {
$link = str_replace('%#%', $n, $link);
if ( $add_args )
$link = add_query_arg( $add_args, $link );
$page_links[] = "<a class='page-numbers' href='" . attribute_escape($link) . "'>$n</a>";
$page_links[] = "<a class='page-numbers' href='" . clean_url($link) . "'>$n</a>";
$dots = true;
elseif ( $dots && !$show_all ) :
$page_links[] = "<span class='page-numbers dots'>...</span>";
@@ -1010,7 +1011,7 @@ function paginate_links( $arg = '' ) {
$link = str_replace('%#%', $current + 1, $link);
if ( $add_args )
$link = add_query_arg( $add_args, $link );
$page_links[] = "<a class='next page-numbers' href='" . attribute_escape($link) . "'>$next_text</a>";
$page_links[] = "<a class='next page-numbers' href='" . clean_url($link) . "'>$next_text</a>";
endif;
switch ( $type ) :
case 'array' :