<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[41412] branches/4.8/src/wp-admin: General: Add missing URL-encoding and add extra hardening to plugin and template names when they're displayed in the admin area.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/41412">41412</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/41412","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>johnbillion</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-09-19 10:15:56 +0000 (Tue, 19 Sep 2017)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>General: Add missing URL-encoding and add extra hardening to plugin and template names when they're displayed in the admin area.
Merges <a href="https://core.trac.wordpress.org/changeset/41399">[41399]</a>, with additions, to the 4.8 branch.
See <a href="https://core.trac.wordpress.org/ticket/13377">#13377</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches48srcwpadminincludesclasswppluginslisttablephp">branches/4.8/src/wp-admin/includes/class-wp-plugins-list-table.php</a></li>
<li><a href="#branches48srcwpadminincludestemplatephp">branches/4.8/src/wp-admin/includes/template.php</a></li>
<li><a href="#branches48srcwpadminplugineditorphp">branches/4.8/src/wp-admin/plugin-editor.php</a></li>
<li><a href="#branches48srcwpadminpluginsphp">branches/4.8/src/wp-admin/plugins.php</a></li>
<li><a href="#branches48srcwpadminthemeeditorphp">branches/4.8/src/wp-admin/theme-editor.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches48srcwpadminincludesclasswppluginslisttablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.8/src/wp-admin/includes/class-wp-plugins-list-table.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.8/src/wp-admin/includes/class-wp-plugins-list-table.php 2017-09-19 10:15:44 UTC (rev 41411)
+++ branches/4.8/src/wp-admin/includes/class-wp-plugins-list-table.php 2017-09-19 10:15:56 UTC (rev 41412)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -601,16 +601,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $is_active ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( current_user_can( 'manage_network_plugins' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: plugin name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( current_user_can( 'manage_network_plugins' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: plugin name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: plugin name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -624,14 +624,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( $is_active ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: plugin name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: plugin name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Activate' ) . '</a>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Activate' ) . '</a>';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: plugin name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } // end if $is_active
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -639,7 +639,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can( 'edit_plugins' ) && is_writable( WP_PLUGIN_DIR . '/' . $plugin_file ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: plugin name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Edit %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Edit' ) . '</a>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $actions['edit'] = '<a href="plugin-editor.php?file=' . urlencode( $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Edit %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Edit' ) . '</a>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } // end if $context
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches48srcwpadminincludestemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.8/src/wp-admin/includes/template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.8/src/wp-admin/includes/template.php 2017-09-19 10:15:44 UTC (rev 41411)
+++ branches/4.8/src/wp-admin/includes/template.php 2017-09-19 10:15:56 UTC (rev 41412)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -772,7 +772,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ksort( $templates );
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( array_keys( $templates ) as $template ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $selected = selected( $default, $templates[ $template ], false );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo "\n\t<option value='" . $templates[ $template ] . "' $selected>$template</option>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo "\n\t<option value='" . esc_attr( $templates[ $template ] ) . "' $selected>" . esc_html( $template ) . "</option>";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches48srcwpadminplugineditorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.8/src/wp-admin/plugin-editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.8/src/wp-admin/plugin-editor.php 2017-09-19 10:15:44 UTC (rev 41411)
+++ branches/4.8/src/wp-admin/plugin-editor.php 2017-09-19 10:15:56 UTC (rev 41412)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -37,11 +37,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $file = '';
</span><span class="cx" style="display: block; padding: 0 10px"> $plugin = '';
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $_REQUEST['file'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $file = sanitize_text_field( $_REQUEST['file'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $file = wp_unslash( $_REQUEST['file'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $_REQUEST['plugin'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugin = sanitize_text_field( $_REQUEST['plugin'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugin = wp_unslash( $_REQUEST['plugin'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $plugin ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -107,10 +107,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network( $file ) ) || ! is_plugin_active( $file ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- activate_plugin( $plugin, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ activate_plugin( $plugin, "plugin-editor.php?file=" . urlencode( $file ) . "&phperror=1", ! empty( $_GET['networkwide'] ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> } // we'll override this later if the plugin can be included without fatal error
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_redirect( self_admin_url("plugin-editor.php?file=$file&plugin=$plugin&a=te&scrollto=$scrollto") );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_redirect( self_admin_url( 'plugin-editor.php?file=' . urlencode( $file ) . '&plugin=' . urlencode( $plugin ) . "&a=te&scrollto=$scrollto" ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> exit;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -203,18 +203,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_plugin_active( $plugin ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_writeable( $real_file ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: plugin file name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo sprintf( __( 'Editing %s (active)' ), '<strong>' . $file . '</strong>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo sprintf( __( 'Editing %s (active)' ), '<strong>' . esc_html( $file ) . '</strong>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: plugin file name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo sprintf( __( 'Browsing %s (active)' ), '<strong>' . $file . '</strong>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo sprintf( __( 'Browsing %s (active)' ), '<strong>' . esc_html( $file ) . '</strong>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_writeable( $real_file ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: plugin file name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo sprintf( __( 'Editing %s (inactive)' ), '<strong>' . $file . '</strong>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo sprintf( __( 'Editing %s (inactive)' ), '<strong>' . esc_html( $file ) . '</strong>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: plugin file name */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo sprintf( __( 'Browsing %s (inactive)' ), '<strong>' . $file . '</strong>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo sprintf( __( 'Browsing %s (inactive)' ), '<strong>' . esc_html( $file ) . '</strong>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> ?></big>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -259,7 +259,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&plugin=<?php echo urlencode( $plugin ) ?>"><?php echo $plugin_file ?></a></li>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&plugin=<?php echo urlencode( $plugin ) ?>"><?php echo esc_html( $plugin_file ); ?></a></li>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php endforeach; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </ul>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span></span></pre></div>
<a id="branches48srcwpadminpluginsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.8/src/wp-admin/plugins.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.8/src/wp-admin/plugins.php 2017-09-19 10:15:44 UTC (rev 41411)
+++ branches/4.8/src/wp-admin/plugins.php 2017-09-19 10:15:56 UTC (rev 41412)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,7 +17,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $action = $wp_list_table->current_action();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$plugin = isset($_REQUEST['plugin']) ? wp_unslash( $_REQUEST['plugin'] ) : '';
</ins><span class="cx" style="display: block; padding: 0 10px"> $s = isset($_REQUEST['s']) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Clean up request URI from temporary args for screen options/paging uri's to work as expected.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -39,10 +39,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> check_admin_referer('activate-plugin_' . $plugin);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), is_network_admin() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . urlencode( $plugin ) ), is_network_admin() );
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_wp_error( $result ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'unexpected_output' == $result->get_error_code() ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$s");
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
</span><span class="cx" style="display: block; padding: 0 10px"> exit;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -73,7 +73,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> check_admin_referer('bulk-plugins');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_network_admin() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $plugins as $i => $plugin ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -122,9 +122,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> check_admin_referer( 'bulk-plugins' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $_GET['plugins'] ) )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugins = explode( ',', $_GET['plugins'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugins = explode( ',', wp_unslash( $_GET['plugins'] ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> elseif ( isset( $_POST['checked'] ) )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugins = (array) $_POST['checked'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugins = (array) wp_unslash( $_POST['checked'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> else
</span><span class="cx" style="display: block; padding: 0 10px"> $plugins = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -197,7 +197,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> check_admin_referer('bulk-plugins');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array();
</ins><span class="cx" style="display: block; padding: 0 10px"> // Do not deactivate plugins which are already deactivated.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_network_admin() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $plugins = array_filter( $plugins, 'is_plugin_active_for_network' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -234,7 +234,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> check_admin_referer('bulk-plugins');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> //$_POST = from the plugin form; $_GET = from the FTP details screen.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugins = isset( $_REQUEST['checked'] ) ? (array) wp_unslash( $_REQUEST['checked'] ) : array();
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $plugins ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
</span><span class="cx" style="display: block; padding: 0 10px"> exit;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -368,7 +368,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> default:
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $_POST['checked'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> check_admin_referer('bulk-plugins');
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array();
</ins><span class="cx" style="display: block; padding: 0 10px"> $sendback = wp_get_referer();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /** This action is documented in wp-admin/edit-comments.php */
</span></span></pre></div>
<a id="branches48srcwpadminthemeeditorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.8/src/wp-admin/theme-editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.8/src/wp-admin/theme-editor.php 2017-09-19 10:15:44 UTC (rev 41411)
+++ branches/4.8/src/wp-admin/theme-editor.php 2017-09-19 10:15:56 UTC (rev 41412)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -99,7 +99,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $relative_file = 'style.css';
</span><span class="cx" style="display: block; padding: 0 10px"> $file = $allowed_files['style.css'];
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $relative_file = $file;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $relative_file = wp_unslash( $file );
</ins><span class="cx" style="display: block; padding: 0 10px"> $file = $theme->get_stylesheet_directory() . '/' . $relative_file;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -156,10 +156,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="message" class="updated notice is-dismissible"><p><?php _e( 'File edited successfully.' ) ?></p></div>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$description = get_file_description( $relative_file );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$file_description = get_file_description( $relative_file );
</ins><span class="cx" style="display: block; padding: 0 10px"> $file_show = array_search( $file, array_filter( $allowed_files ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( $description != $file_show )
- $description .= ' <span>(' . $file_show . ')</span>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$description = esc_html( $file_description );
+if ( $file_description != $file_show ) {
+ $description .= ' <span>(' . esc_html( $file_show ) . ')</span>';
+}
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="wrap">
</span><span class="cx" style="display: block; padding: 0 10px"> <h1><?php echo esc_html( $title ); ?></h1>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -230,9 +232,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> echo "\t<ul>\n";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $file_description = get_file_description( $filename );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $file_description = esc_html( get_file_description( $filename ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $filename !== basename( $absolute_filename ) || $file_description !== $filename ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $file_description .= '<br /><span class="nonessential">(' . esc_html( $filename ) . ')</span>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $absolute_filename === $file ) {
</span></span></pre>
</div>
</div>
</body>
</html>