WordPress.org

Make WordPress Core

Ticket #13591: 13591.diff

File 13591.diff, 2.1 KB (added by wojtek.szkutnik, 8 years ago)
  • themes.php

     
    99/** WordPress Administration Bootstrap */
    1010require_once('./admin.php');
    1111
     12if ( isset( $_GET['pagenum'] ) )
     13        $page = absint( $_GET['pagenum'] );
     14
     15if ( empty($page) )
     16        $page = 1;
     17
    1218if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') )
    1319        wp_die( __( 'Cheatin’ uh?' ) );
    1420
     
    1622        if ( 'activate' == $_GET['action'] ) {
    1723                check_admin_referer('switch-theme_' . $_GET['template']);
    1824                switch_theme($_GET['template'], $_GET['stylesheet']);
    19                 wp_redirect('themes.php?activated=true');
     25               
     26                $activate_link_page = '';
     27                if ( $page > 1 )
     28                        $activate_link_page = '&pagenum='.$page;
     29                       
     30                wp_redirect('themes.php?activated=true'.$activate_link_page);
    2031                exit;
    2132        } else if ( 'delete' == $_GET['action'] ) {
    2233                check_admin_referer('delete-theme_' . $_GET['template']);
     
    7485$theme_total = count( $themes );
    7586$per_page = 15;
    7687
    77 if ( isset( $_GET['pagenum'] ) )
    78         $page = absint( $_GET['pagenum'] );
    79 
    80 if ( empty($page) )
    81         $page = 1;
    82 
    8388$start = $offset = ( $page - 1 ) * $per_page;
    8489
    8590$page_links = paginate_links( array(
     
    188193        $preview_text = esc_attr( sprintf( __('Preview of “%s”'), $title ) );
    189194        $tags = $themes[$theme_name]['Tags'];
    190195        $thickbox_class = 'thickbox thickbox-preview';
    191         $activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
     196        $activate_link_page = '';
     197        if ( $page > 1 )
     198                $activate_link_page = '&pagenum='.$page;
     199        $activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet).$activate_link_page, 'switch-theme_' . $template);
    192200        $activate_text = esc_attr( sprintf( __('Activate “%s”'), $title ) );
    193201        $actions = array();
    194202        $actions[] = '<a href="' . $activate_link .  '" class="activatelink" title="' . $activate_text . '">' . __('Activate') . '</a>';