WordPress.org

Make WordPress Core

Changeset 9335


Ignore:
Timestamp:
10/24/2008 09:00:40 PM (10 years ago)
Author:
ryan
Message:

Send 403 instead of 500 for comment flood protection. Allow specifying response code for wp_die(). Props DD32. fixes #7246

Location:
trunk/wp-includes
Files:
2 edited

Legend:

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

    r9296 r9335  
    453453                die( __('You are posting comments too quickly.  Slow down.') );
    454454
    455             wp_die( __('You are posting comments too quickly.  Slow down.') );
     455            wp_die( __('You are posting comments too quickly.  Slow down.'), '', array('response' => 403) );
    456456        }
    457457    }
  • trunk/wp-includes/functions.php

    r9327 r9335  
    22092209 * @param string $message Error message.
    22102210 * @param string $title Error title.
    2211  */
    2212 function wp_die( $message, $title = '' ) {
     2211 * @param string|array $args Optional arguements to control behaviour.
     2212 */
     2213function wp_die( $message, $title = '', $args = array() ) {
    22132214    global $wp_locale;
     2215
     2216    $defaults = array( 'response' => 500 );
     2217    $r = wp_parse_args($args, $defaults);
    22142218
    22152219    if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
     
    22462250    if ( !function_exists( 'did_action' ) || !did_action( 'admin_head' ) ) :
    22472251    if( !headers_sent() ){
    2248         status_header( 500 );
     2252        status_header( $r['response'] );
    22492253        nocache_headers();
    22502254        header( 'Content-Type: text/html; charset=utf-8' );
Note: See TracChangeset for help on using the changeset viewer.