Make WordPress Core

Ticket #11082: new_#11082.patch

File new_#11082.patch, 4.2 KB (added by akhilasuram, 15 years ago)
  • wp-admin/edit-form-advanced.php

     
    3333        sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ),
    3434        // translators: Publish box date format, see http://php.net/date - Same as in meta-boxes.php
    3535        sprintf( __('Post scheduled for: <b>%1$s</b>. <a target="_blank" href="%2$s">Preview post</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID) ),
    36         sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) )
     36        sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ),
     37        __('You attempted to save or publish an empty post. Provide some content before saving.')
    3738);
    3839$messages['page'] = array(
    3940        '',
     
    4344        __('Page updated.'),
    4445        isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    4546        sprintf( __('Page published. <a href="%s">View page</a>'), get_permalink($post_ID) ),
     47        '',
    4648        sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ),
    4749        // translators: Publish box date format, see http://php.net/date - Same as in meta-boxes.php
    4850        sprintf( __('Page scheduled for: <b>%1$s</b>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID) ),
    49         sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) )
     51        sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ),
     52        __('You attempted to save or publish an empty page. Provide some content before saving.')
    5053);
    5154
    5255$message = false;
  • wp-admin/post.php

     
    5757                elseif ( isset($_POST['publish']) )
    5858                        $location = 'sidebar.php?a=b';
    5959        } elseif ( isset($_POST['save']) || isset($_POST['publish']) ) {
    60                 $status = get_post_status( $post_id );
    61 
    62                 if ( isset( $_POST['publish'] ) ) {
    63                         switch ( $status ) {
    64                                 case 'pending':
    65                                         $message = 8;
    66                                         break;
    67                                 case 'future':
    68                                         $message = 9;
    69                                         break;
    70                                 default:
    71                                         $message = 6;
    72                         }
     60                if ( 0 == $post_id ){
     61                    $location = "post-new.php?message=11";
     62                    wp_redirect($location);
     63                        exit();
    7364                } else {
    74                                 $message = 'draft' == $status ? 10 : 1;
    75                 }
     65                     $status = get_post_status( $post_id );
    7666
     67               if ( isset( $_POST['publish'] ) ) {
     68                               switch ( $status ) {
     69                                       case 'pending':
     70                                               $message = 8;
     71                                               break;
     72                                       case 'future':     
     73                                               $message = 9;
     74                                               break;
     75                                       default:
     76                                               $message = 6;
     77                               }
     78                       } else {
     79                                    $message = 'draft' == $status ? 10 : 1;
     80                       }
     81                  }                     
    7782                $location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
    7883        } elseif ( isset($_POST['addmeta']) && $_POST['addmeta'] ) {
    7984                $location = add_query_arg( 'message', 2, wp_get_referer() );
  • wp-includes/functions.php

     
    24602460                $html .= "</p><p>" . sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url() );
    24612461        elseif ( wp_get_referer() )
    24622462                $html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
    2463 
     2463     
     2464         if( 0== $post_id ){
     2465                        $location = "post-new.php?post_type=page&message=11";
     2466                        wp_redirect($location);
     2467                        exit();
     2468                }
    24642469        wp_die( $html, $title, array('response' => 403) );
    24652470}
    24662471