Skip to content

Commit

Permalink
Sanitize output of previous_posts() and next_posts(). Props Alex Conc…
Browse files Browse the repository at this point in the history
…ha for the report.

git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@5047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
markjaquith committed Mar 16, 2007
1 parent 0e0362a commit b3268bd
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions wp-includes/template-functions-links.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=
function get_pagenum_link($pagenum = 1) {
global $wp_rewrite;

$qstr = wp_specialchars($_SERVER['REQUEST_URI']);
$qstr = $_SERVER['REQUEST_URI'];

$page_querystring = "paged";
$page_modstring = "page/";
Expand Down Expand Up @@ -445,18 +445,22 @@ function get_pagenum_link($pagenum = 1) {
return $qstr;
}

function next_posts($max_page = 0) { // original by cfactor at cooltux.org
function get_next_posts_page_link($max_page = 0) {
global $paged, $pagenow;

if ( !is_single() ) {
if ( !$paged )
$paged = 1;
$nextpage = intval($paged) + 1;
if ( !$max_page || $max_page >= $nextpage )
echo get_pagenum_link($nextpage);
return get_pagenum_link($nextpage);
}
}

function next_posts($max_page = 0) {
echo attribute_escape(get_next_posts_page_link($max_page));
}

function next_posts_link($label='Next Page »', $max_page=0) {
global $paged, $result, $request, $posts_per_page, $wpdb, $max_num_pages;
if ( !$max_page ) {
Expand All @@ -479,18 +483,20 @@ function next_posts_link($label='Next Page »', $max_page=0) {
}
}


function previous_posts() { // original by cfactor at cooltux.org
function get_previous_posts_page_link() {
global $paged, $pagenow;

if ( !is_single() ) {
$nextpage = intval($paged) - 1;
if ( $nextpage < 1 )
$nextpage = 1;
echo get_pagenum_link($nextpage);
return get_pagenum_link($nextpage);
}
}

function previous_posts() {
echo attribute_escape(get_previous_posts_page_link());
}

function previous_posts_link($label='&laquo; Previous Page') {
global $paged;
Expand Down

0 comments on commit b3268bd

Please sign in to comment.