<!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>[21755] trunk/wp-admin: Always URL-encode a stylesheet directory value before using it in a URL.</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, #logmsg > ol { margin-left: 0; 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">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/21755">21755</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-09-04 22:35:12 +0000 (Tue, 04 Sep 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Always URL-encode a stylesheet directory value before using it in a URL. These situations are saved by wp_nonce_url(), but we should not depend on that. see <a href="http://core.trac.wordpress.org/ticket/21749">#21749</a>, for trunk only.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesclasswpmsthemeslisttablephp">trunk/wp-admin/includes/class-wp-ms-themes-list-table.php</a></li>
<li><a href="#trunkwpadminincludesclasswpthemeslisttablephp">trunk/wp-admin/includes/class-wp-themes-list-table.php</a></li>
<li><a href="#trunkwpadminincludesclasswpupgraderphp">trunk/wp-admin/includes/class-wp-upgrader.php</a></li>
<li><a href="#trunkwpadminincludesthemephp">trunk/wp-admin/includes/theme.php</a></li>
<li><a href="#trunkwpadminthemeeditorphp">trunk/wp-admin/theme-editor.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesclasswpmsthemeslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-ms-themes-list-table.php (21754 => 21755)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-ms-themes-list-table.php        2012-09-04 22:27:52 UTC (rev 21754)
+++ trunk/wp-admin/includes/class-wp-ms-themes-list-table.php        2012-09-04 22:35:12 UTC (rev 21755)
</span><span class="lines">@@ -277,27 +277,28 @@
</span><span class="cx">                         'delete' => ''
</span><span class="cx">                 );
</span><span class="cx">
</span><del>-                $theme_key = $theme->get_stylesheet();
</del><ins>+                $stylesheet = $theme->get_stylesheet();
+                $theme_key = urlencode( $stylesheet );
</ins><span class="cx">
</span><span class="cx">                 if ( ! $allowed ) {
</span><span class="cx">                         if ( ! $theme->errors() )
</span><del>-                                $actions['enable'] = '<a href="' . esc_url( wp_nonce_url($url . 'action=enable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'enable-theme_' . $theme_key) ) . '" title="' . esc_attr__('Enable this theme') . '" class="edit">' . ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) ) . '</a>';
</del><ins>+                                $actions['enable'] = '<a href="' . esc_url( wp_nonce_url($url . 'action=enable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'enable-theme_' . $stylesheet ) ) . '" title="' . esc_attr__('Enable this theme') . '" class="edit">' . ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) ) . '</a>';
</ins><span class="cx">                 } else {
</span><del>-                        $actions['disable'] = '<a href="' . esc_url( wp_nonce_url($url . 'action=disable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'disable-theme_' . $theme_key) ) . '" title="' . esc_attr__('Disable this theme') . '">' . ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) . '</a>';
</del><ins>+                        $actions['disable'] = '<a href="' . esc_url( wp_nonce_url($url . 'action=disable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'disable-theme_' . $stylesheet ) ) . '" title="' . esc_attr__('Disable this theme') . '">' . ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) . '</a>';
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 if ( current_user_can('edit_themes') )
</span><del>-                        $actions['edit'] = '<a href="' . esc_url('theme-editor.php?theme=' . urlencode( $theme_key ) ) . '" title="' . esc_attr__('Open this theme in the Theme Editor') . '" class="edit">' . __('Edit') . '</a>';
</del><ins>+                        $actions['edit'] = '<a href="' . esc_url('theme-editor.php?theme=' . $theme_key ) . '" title="' . esc_attr__('Open this theme in the Theme Editor') . '" class="edit">' . __('Edit') . '</a>';
</ins><span class="cx">
</span><del>-                if ( ! $allowed && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $theme_key != get_option( 'stylesheet' ) && $theme_key != get_option( 'template' ) )
</del><ins>+                if ( ! $allowed && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $stylesheet != get_option( 'stylesheet' ) && $stylesheet != get_option( 'template' ) )
</ins><span class="cx">                         $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=delete-selected&amp;checked[]=' . $theme_key . '&amp;theme_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-themes' ) ) . '" title="' . esc_attr__( 'Delete this theme' ) . '" class="delete">' . __( 'Delete' ) . '</a>';
</span><span class="cx">
</span><del>-                $actions = apply_filters( 'theme_action_links', array_filter( $actions ), $theme_key, $theme, $context );
-                $actions = apply_filters( "theme_action_links_$theme_key", $actions, $theme_key, $theme, $context );
</del><ins>+                $actions = apply_filters( 'theme_action_links', array_filter( $actions ), $stylesheet, $theme, $context );
+                $actions = apply_filters( "theme_action_links_$stylesheet", $actions, $stylesheet, $theme, $context );
</ins><span class="cx">
</span><span class="cx">                 $class = ! $allowed ? 'inactive' : 'active';
</span><span class="cx">                 $checkbox_id = "checkbox_" . md5( $theme->get('Name') );
</span><del>-                $checkbox = "<input type='checkbox' name='checked[]' value='" . esc_attr( $theme_key ) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select') . " " . $theme->display('Name') . "</label>";
</del><ins>+                $checkbox = "<input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select') . " " . $theme->display('Name') . "</label>";
</ins><span class="cx">
</span><span class="cx">                 $id = sanitize_html_class( $theme->get_stylesheet() );
</span><span class="cx">
</span><span class="lines">@@ -341,7 +342,7 @@
</span><span class="cx">                                         if ( $theme->get('ThemeURI') )
</span><span class="cx">                                                 $theme_meta[] = '<a href="' . $theme->display('ThemeURI') . '" title="' . esc_attr__( 'Visit theme homepage' ) . '">' . __( 'Visit Theme Site' ) . '</a>';
</span><span class="cx">
</span><del>-                                        $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $theme_key, $theme, $status );
</del><ins>+                                        $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status );
</ins><span class="cx">                                         echo implode( ' | ', $theme_meta );
</span><span class="cx">
</span><span class="cx">                                         echo "</div></td>";
</span><span class="lines">@@ -349,7 +350,7 @@
</span><span class="cx">
</span><span class="cx">                                 default:
</span><span class="cx">                                         echo "<td class='$column_name column-$column_name'$style>";
</span><del>-                                        do_action( 'manage_themes_custom_column', $column_name, $theme_key, $theme );
</del><ins>+                                        do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme );
</ins><span class="cx">                                         echo "</td>";
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="lines">@@ -357,8 +358,8 @@
</span><span class="cx">                 echo "</tr>";
</span><span class="cx">
</span><span class="cx">                 if ( $this->is_site_themes )
</span><del>-                        remove_action( "after_theme_row_$theme_key", 'wp_theme_update_row' );
-                do_action( 'after_theme_row', $theme_key, $theme, $status );
-                do_action( "after_theme_row_$theme_key", $theme_key, $theme, $status );
</del><ins>+                        remove_action( "after_theme_row_$stylesheet", 'wp_theme_update_row' );
+                do_action( 'after_theme_row', $stylesheet, $theme, $status );
+                do_action( "after_theme_row_$stylesheet", $stylesheet, $theme, $status );
</ins><span class="cx">         }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadminincludesclasswpthemeslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-themes-list-table.php (21754 => 21755)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-themes-list-table.php        2012-09-04 22:27:52 UTC (rev 21754)
+++ trunk/wp-admin/includes/class-wp-themes-list-table.php        2012-09-04 22:35:12 UTC (rev 21755)
</span><span class="lines">@@ -143,7 +143,7 @@
</span><span class="cx">                                         . __( 'Live Preview' ) . '</a>';
</span><span class="cx">
</span><span class="cx">                         if ( ! is_multisite() && current_user_can( 'delete_themes' ) )
</span><del>-                                $actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url( "themes.php?action=delete&amp;stylesheet=$stylesheet", 'delete-theme_' . $stylesheet )
</del><ins>+                                $actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url( 'themes.php?action=delete&amp;stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet )
</ins><span class="cx">                                         . '" onclick="' . "return confirm( '" . esc_js( sprintf( __( "You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete." ), $title ) )
</span><span class="cx">                                         . "' );" . '">' . __( 'Delete' ) . '</a>';
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminincludesclasswpupgraderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-upgrader.php (21754 => 21755)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-upgrader.php        2012-09-04 22:27:52 UTC (rev 21754)
+++ trunk/wp-admin/includes/class-wp-upgrader.php        2012-09-04 22:35:12 UTC (rev 21755)
</span><span class="lines">@@ -1502,7 +1502,7 @@
</span><span class="cx">                         'preview' => 1,
</span><span class="cx">                         'template' => urlencode( $template ),
</span><span class="cx">                         'stylesheet' => urlencode( $stylesheet ),
</span><del>-                ), trailingslashit( get_home_url() ) );
</del><ins>+                ), trailingslashit( home_url() ) );
</ins><span class="cx">
</span><span class="cx">                 $activate_link = add_query_arg( array(
</span><span class="cx">                         'action' => 'activate',
</span><span class="lines">@@ -1517,7 +1517,7 @@
</span><span class="cx">                 $install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>';
</span><span class="cx">
</span><span class="cx">                 if ( is_network_admin() && current_user_can( 'manage_network_themes' ) )
</span><del>-                        $install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . $stylesheet, 'enable-theme_' . $stylesheet ) ) . '" title="' . esc_attr__( 'Enable this theme for all sites in this network' ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
</del><ins>+                        $install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ) . '" title="' . esc_attr__( 'Enable this theme for all sites in this network' ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
</ins><span class="cx">
</span><span class="cx">                 if ( $this->type == 'web' )
</span><span class="cx">                         $install_actions['themes_page'] = '<a href="' . self_admin_url('theme-install.php') . '" title="' . esc_attr__('Return to Theme Installer') . '" target="_parent">' . __('Return to Theme Installer') . '</a>';
</span><span class="lines">@@ -1566,7 +1566,7 @@
</span><span class="cx">                                 'preview' => 1,
</span><span class="cx">                                 'template' => urlencode( $template ),
</span><span class="cx">                                 'stylesheet' => urlencode( $stylesheet ),
</span><del>-                        ), trailingslashit( get_home_url() ) );
</del><ins>+                        ), trailingslashit( home_url() ) );
</ins><span class="cx">
</span><span class="cx">                         $activate_link = add_query_arg( array(
</span><span class="cx">                                 'action' => 'activate',
</span></span></pre></div>
<a id="trunkwpadminincludesthemephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/theme.php (21754 => 21755)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/theme.php        2012-09-04 22:27:52 UTC (rev 21754)
+++ trunk/wp-admin/includes/theme.php        2012-09-04 22:35:12 UTC (rev 21755)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">
</span><span class="cx">         ob_start();
</span><span class="cx">         if ( empty( $redirect ) )
</span><del>-                $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . $stylesheet, 'delete-theme_' . $stylesheet);
</del><ins>+                $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet);
</ins><span class="cx">         if ( false === ($credentials = request_filesystem_credentials($redirect)) ) {
</span><span class="cx">                 $data = ob_get_contents();
</span><span class="cx">                 ob_end_clean();
</span></span></pre></div>
<a id="trunkwpadminthemeeditorphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/theme-editor.php (21754 => 21755)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/theme-editor.php        2012-09-04 22:27:52 UTC (rev 21754)
+++ trunk/wp-admin/theme-editor.php        2012-09-04 22:35:12 UTC (rev 21755)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) );
</span><span class="cx">
</span><span class="cx"> if ( $theme )
</span><del>-        $stylesheet = urldecode( $theme );
</del><ins>+        $stylesheet = $theme;
</ins><span class="cx"> else
</span><span class="cx">         $stylesheet = get_stylesheet();
</span><span class="cx">
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">         $relative_file = 'style.css';
</span><span class="cx">         $file = $allowed_files['style.css'];
</span><span class="cx"> } else {
</span><del>-        $relative_file = urldecode( stripslashes( $file ) );
</del><ins>+        $relative_file = stripslashes( $file );
</ins><span class="cx">         $file = $theme->get_stylesheet_directory() . '/' . $relative_file;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>