WordPress.org

Make WordPress Core

Ticket #17038: 17038.diff

File 17038.diff, 2.1 KB (added by kawauso, 4 years ago)

URL encode filenames in URLs

  • wp-admin/plugin-editor.php

     
    215215                continue; 
    216216        } 
    217217?> 
    218                 <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo $plugin_file; ?>&amp;plugin=<?php echo $plugin; ?>"><?php echo $plugin_file ?></a></li> 
     218                <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&amp;plugin=<?php echo urlencode( $plugin ) ?>"><?php echo $plugin_file ?></a></li> 
    219219<?php endforeach; ?> 
    220220        </ul> 
    221221</div> 
  • wp-admin/theme-editor.php

     
    192192        ksort( $template_mapping ); 
    193193        while ( list( $template_sorted_key, list( $template_file, $filedesc ) ) = each( $template_mapping ) ) : 
    194194        ?> 
    195                 <li><a href="theme-editor.php?file=<?php echo "$template_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>&amp;dir=theme"><?php echo $filedesc ?></a></li> 
    196 <?php endwhile; ?> 
     195                <li><a href="theme-editor.php?file=<?php echo urlencode( $template_file ) ?>&amp;theme=<?php echo urlencode( $theme ) ?>&amp;dir=theme"><?php echo $filedesc ?></a></li> 
     196<?php endwhile; ?>  
    197197        </ul> 
    198198        <h3><?php /* translators: Theme stylesheets in theme editor */ _ex('Styles', 'Theme stylesheets in theme editor'); ?></h3> 
    199199        <ul> 
     
    214214        ksort( $template_mapping ); 
    215215        while ( list( $template_sorted_key, list( $style_file, $filedesc ) ) = each( $template_mapping ) ) : 
    216216                ?> 
    217                 <li><a href="theme-editor.php?file=<?php echo "$style_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>&amp;dir=style"><?php echo $filedesc ?></a></li> 
     217                <li><a href="theme-editor.php?file=<?php echo urlencode( $style_file ) ?>&amp;theme=<?php echo urlencode($theme) ?>&amp;dir=style"><?php echo $filedesc ?></a></li> 
    218218<?php endwhile; ?> 
    219219        </ul> 
    220220<?php endif; ?>