Ticket #20770: 20770.2.diff
File 20770.2.diff, 4.6 KB (added by , 13 years ago) |
---|
-
wp-includes/pluggable.php
831 831 * 832 832 * @param string $action Action nonce 833 833 * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5) 834 * @param bool $die Die if checking fails 835 * @param bool $renonce If checking succeeds, calculate a new nonce and send it as an X-WP-nonce header 834 836 */ 835 function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {837 function check_ajax_referer( $action = -1, $query_arg = false, $die = true, $renonce = false ) { 836 838 if ( $query_arg ) 837 839 $nonce = $_REQUEST[$query_arg]; 838 840 else … … 849 851 850 852 do_action('check_ajax_referer', $action, $result); 851 853 854 if ( $renonce && !headers_sent() ) 855 header( 'X-WP-nonce: ' . $action . '=' . wp_create_nonce( $action ) ); 856 852 857 return $result; 853 858 } 854 859 endif; -
wp-includes/script-loader.php
373 373 $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) ); 374 374 375 375 $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 ); 376 $scripts->localize( 'admin-widgets', 'widgetsL10n', array( 377 'loggedOut' => __('You are logged out!') 378 )); 376 379 377 380 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'jquery' ), false, 1 ); 378 381 -
wp-admin/includes/ajax-actions.php
1510 1510 } 1511 1511 1512 1512 function wp_ajax_widgets_order() { 1513 check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );1513 check_ajax_referer( 'save-sidebar-widgets', 'savewidgets', true, true ); 1514 1514 1515 1515 if ( !current_user_can('edit_theme_options') ) 1516 1516 wp_die( -1 ); … … 1543 1543 function wp_ajax_save_widget() { 1544 1544 global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates; 1545 1545 1546 check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );1546 check_ajax_referer( 'save-sidebar-widgets', 'savewidgets', true, true ); 1547 1547 1548 1548 if ( !current_user_can('edit_theme_options') || !isset($_POST['id_base']) ) 1549 1549 wp_die( -1 ); -
wp-admin/js/widgets.dev.js
189 189 a['sidebars[' + $(this).attr('id') + ']'] = $(this).sortable('toArray').join(','); 190 190 }); 191 191 192 $.post( ajaxurl, a, function() {192 var xhr = $.post( ajaxurl, a, function() { 193 193 $('img.ajax-feedback').css('visibility', 'hidden'); 194 nonce_header = xhr.getResponseHeader("X-WP-nonce"); 195 nonce = nonce_header.split("=", 2)[1]; 196 $('#_wpnonce_widgets').val(nonce); 194 197 }); 195 198 196 199 this.resize(); … … 212 215 213 216 data += '&' + $.param(a); 214 217 215 $.post( ajaxurl, data, function(r){218 var xhr = $.post( ajaxurl, data, function(r){ 216 219 var id; 217 220 221 if ( "0" === r ) { 222 logout_message = $('.logout-message', widget) 223 if ( !logout_message.length ) { 224 $('img.ajax-feedback', widget).parent().parent().append($('<div class="error logout-message"><p>' + widgetsL10n.loggedOut + '</p></div>')); 225 } 226 $('.ajax-feedback', widget).css('visibility', 'hidden'); 227 logout_message.fadeOut(50).fadeIn(500); 228 return false; 229 } 230 218 231 if ( del ) { 219 232 if ( !$('input.widget_number', widget).val() ) { 220 233 id = $('input.widget-id', widget).val(); … … 236 249 } 237 250 } else { 238 251 $('.ajax-feedback').css('visibility', 'hidden'); 252 $('.logout-message', widget).hide(); 239 253 if ( r && r.length > 2 ) { 240 254 $('div.widget-content', widget).html(r); 241 255 wpWidgets.appendTitle(widget); 242 256 wpWidgets.fixLabels(widget); 243 257 } 244 258 } 245 if ( order ) 259 if ( order ) { 246 260 wpWidgets.saveOrder(); 261 } else { 262 nonce_header = xhr.getResponseHeader("X-WP-nonce"); 263 nonce = nonce_header.split("=", 2)[1]; 264 $('#_wpnonce_widgets').val(nonce); 265 } 247 266 }); 248 267 }, 249 268 -
wp-admin/css/wp-admin.dev.css
7883 7883 display: block; 7884 7884 } 7885 7885 7886 .widget .widget-inside p {7886 .widget-inside p { 7887 7887 margin: 0 0 1em; 7888 7888 padding: 0; 7889 7889 }