Plugin Directory

Changeset 3166998


Ignore:
Timestamp:
10/11/2024 08:16:41 AM (17 months ago)
Author:
jacking83
Message:

fix local file inclusion

Location:
sb-random-posts-widget
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sb-random-posts-widget/tags/1.1/classes.php

    r3166112 r3166998  
    2020        ), $atts );
    2121
     22        $item_file = sanitize_file_name( 'shortcode-content-'. $atts['type'] .'.php' );
     23        $view_file = dirname(__FILE__) . '/parts/' . $item_file;
     24       
     25        if ( ! file_exists ( $view_file ) ) {
     26            $view_file = dirname(__FILE__) . '/parts/shortcode-content-image_only.php';
     27        }
     28
    2229        $args = array(
    2330            'post_type' => $atts['post_type'],
     
    3340            while ( $q->have_posts() ) :
    3441                $q->the_post();
    35                 include dirname(__FILE__) . '/parts/shortcode-content-'. $atts['type'] .'.php';
     42                include dirname(__FILE__) . '/parts/' . $view_file;
    3643            endwhile;
    3744            wp_reset_query();
  • sb-random-posts-widget/trunk/classes.php

    r3166110 r3166998  
    2020        ), $atts );
    2121
     22        $item_file = sanitize_file_name( 'shortcode-content-'. $atts['type'] .'.php' );
     23        $view_file = dirname(__FILE__) . '/parts/' . $item_file;
     24       
     25        if ( ! file_exists ( $view_file ) ) {
     26            $view_file = dirname(__FILE__) . '/parts/shortcode-content-image_only.php';
     27        }
     28
    2229        $args = array(
    2330            'post_type' => $atts['post_type'],
     
    3340            while ( $q->have_posts() ) :
    3441                $q->the_post();
    35                 include dirname(__FILE__) . '/parts/shortcode-content-'. $atts['type'] .'.php';
     42                include dirname(__FILE__) . '/parts/' . $view_file;
    3643            endwhile;
    3744            wp_reset_query();
Note: See TracChangeset for help on using the changeset viewer.