Make WordPress Core

Changeset 7586


Ignore:
Timestamp:
04/02/2008 01:15:21 PM (17 years ago)
Author:
markjaquith
Message:

Sanitize "cat" query var and cast to int before looking for a category template

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/wp-includes/taxonomy.php

    r6322 r7586  
    496496
    497497    $key = md5( serialize( $args ) . serialize( $taxonomies ) );
     498    if ( $_GET['taxonomy_test'] )
     499        $timer_start = time();
    498500    if ( $cache = wp_cache_get( 'get_terms', 'terms' ) ) {
     501        if ( $_GET['taxonomy_test'] )
     502            mail('markjaquith@gmail.com', 'MM Debug ' . $timer_start - time() , print_r($cache, true));
    499503        if ( isset( $cache[ $key ] ) )
    500504            return apply_filters('get_terms', $cache[$key], $taxonomies, $args);
  • branches/2.5/wp-includes/query.php

    r7531 r7586  
    520520        $qv['w'] = (int) $qv['w'];
    521521        $qv['m'] =  (int) $qv['m'];
     522        $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
    522523        if ( '' !== $qv['hour'] ) $qv['hour'] = (int) $qv['hour'];
    523524        if ( '' !== $qv['minute'] ) $qv['minute'] = (int) $qv['minute'];
  • branches/2.5/wp-includes/theme.php

    r7491 r7586  
    364364function get_category_template() {
    365365    $template = '';
    366     if ( file_exists(TEMPLATEPATH . "/category-" . get_query_var('cat') . '.php') )
    367         $template = TEMPLATEPATH . "/category-" . get_query_var('cat') . '.php';
     366    if ( file_exists(TEMPLATEPATH . "/category-" . absint( get_query_var('cat') ) . '.php') )
     367        $template = TEMPLATEPATH . "/category-" . absint( get_query_var('cat') ) . '.php';
    368368    elseif ( file_exists(TEMPLATEPATH . "/category.php") )
    369369        $template = TEMPLATEPATH . "/category.php";
  • trunk/wp-includes/query.php

    r7531 r7586  
    520520        $qv['w'] = (int) $qv['w'];
    521521        $qv['m'] =  (int) $qv['m'];
     522        $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
    522523        if ( '' !== $qv['hour'] ) $qv['hour'] = (int) $qv['hour'];
    523524        if ( '' !== $qv['minute'] ) $qv['minute'] = (int) $qv['minute'];
  • trunk/wp-includes/theme.php

    r7491 r7586  
    364364function get_category_template() {
    365365    $template = '';
    366     if ( file_exists(TEMPLATEPATH . "/category-" . get_query_var('cat') . '.php') )
    367         $template = TEMPLATEPATH . "/category-" . get_query_var('cat') . '.php';
     366    if ( file_exists(TEMPLATEPATH . "/category-" . absint( get_query_var('cat') ) . '.php') )
     367        $template = TEMPLATEPATH . "/category-" . absint( get_query_var('cat') ) . '.php';
    368368    elseif ( file_exists(TEMPLATEPATH . "/category.php") )
    369369        $template = TEMPLATEPATH . "/category.php";
Note: See TracChangeset for help on using the changeset viewer.