WordPress.org

Make WordPress Core

Changeset 5045


Ignore:
Timestamp:
03/16/07 08:04:24 (8 years ago)
Author:
markjaquith
Message:

Sanitize output of previous_posts() and next_posts(). Props Alex Concha for the report.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/link-template.php

    r5020 r5045  
    423423    global $wp_rewrite; 
    424424 
    425     $qstr = wp_specialchars($_SERVER['REQUEST_URI']); 
     425    $qstr = $_SERVER['REQUEST_URI']; 
    426426 
    427427    $page_querystring = "paged"; 
     
    491491} 
    492492 
    493 function next_posts($max_page = 0) { // original by cfactor at cooltux.org 
     493function get_next_posts_page_link($max_page = 0) { 
    494494    global $paged, $pagenow; 
    495495 
     
    499499        $nextpage = intval($paged) + 1; 
    500500        if ( !$max_page || $max_page >= $nextpage ) 
    501             echo get_pagenum_link($nextpage); 
    502     } 
     501            return get_pagenum_link($nextpage); 
     502    } 
     503} 
     504 
     505function next_posts($max_page = 0) { 
     506    echo attribute_escape(get_next_posts_page_link($max_page)); 
    503507} 
    504508 
     
    518522} 
    519523 
    520  
    521 function previous_posts() { // original by cfactor at cooltux.org 
     524function get_previous_posts_page_link() { 
    522525    global $paged, $pagenow; 
    523526 
     
    526529        if ( $nextpage < 1 ) 
    527530            $nextpage = 1; 
    528         echo get_pagenum_link($nextpage); 
    529     } 
    530 } 
    531  
     531        return get_pagenum_link($nextpage); 
     532    } 
     533} 
     534 
     535function previous_posts() { 
     536    echo attribute_escape(get_previous_posts_page_link()); 
     537} 
    532538 
    533539function previous_posts_link($label='&laquo; Previous Page') { 
Note: See TracChangeset for help on using the changeset viewer.