Make WordPress Core


Ignore:
Timestamp:
06/27/2006 08:06:00 AM (19 years ago)
Author:
ryan
Message:

wp_explain_nonce() and wp_nonce_ays(). Props mdawaffe. #2734

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/pluggable.php

    r3928 r3934  
    230230if ( !function_exists('check_admin_referer') ) :
    231231function check_admin_referer($action = -1) {
    232     global $pagenow, $menu, $submenu, $parent_file, $submenu_file;;
    233232    $adminurl = strtolower(get_settings('siteurl')).'/wp-admin';
    234233    $referer = strtolower(wp_get_referer());
    235234    if ( !wp_verify_nonce($_REQUEST['_wpnonce'], $action) &&
    236235        !(-1 == $action && strstr($referer, $adminurl)) ) {
    237         if ( $referer )
    238             $adminurl = $referer;
    239         $title = __('WordPress Confirmation');
    240         require_once(ABSPATH . '/wp-admin/admin-header.php');
    241         // Remove extra layer of slashes.
    242         $_POST   = stripslashes_deep($_POST  );
    243         if ( $_POST ) {
    244             $q = http_build_query($_POST);
    245             $q = explode( ini_get('arg_separator.output'), $q);
    246             $html .= "\t<form method='post' action='$pagenow'>\n";
    247             foreach ( (array) $q as $a ) {
    248                 $v = substr(strstr($a, '='), 1);
    249                 $k = substr($a, 0, -(strlen($v)+1));
    250                 $html .= "\t\t<input type='hidden' name='" . wp_specialchars( urldecode($k), 1 ) . "' value='" . wp_specialchars( urldecode($v), 1 ) . "' />\n";
    251             }
    252             $html .= "\t\t<input type='hidden' name='_wpnonce' value='" . wp_create_nonce($action) . "' />\n";
    253             $html .= "\t\t<div id='message' class='confirm fade'>\n\t\t<p>" . __('Are you sure you want to do this?') . "</p>\n\t\t<p><a href='$adminurl'>" . __('No') . "</a> <input type='submit' value='" . __('Yes') . "' /></p>\n\t\t</div>\n\t</form>\n";
    254         } else {
    255             $html .= "\t<div id='message' class='confirm fade'>\n\t<p>" . __('Are you sure you want to do this?') . "</p>\n\t<p><a href='$adminurl'>" . __('No') . "</a> <a href='" . add_query_arg( '_wpnonce', wp_create_nonce($action), $_SERVER['REQUEST_URI'] ) . "'>" . __('Yes') . "</a></p>\n\t</div>\n";
    256         }
    257         $html .= "</body>\n</html>";
    258         echo $html;
    259         include_once(ABSPATH . '/wp-admin/admin-footer.php');
     236        wp_nonce_ays($action);
    260237        die();
    261238    }
Note: See TracChangeset for help on using the changeset viewer.