| 1 | Index: wp-admin/includes/post.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/includes/post.php (revision 17979) |
|---|
| 4 | +++ wp-admin/includes/post.php (working copy) |
|---|
| 5 | @@ -108,10 +108,9 @@ |
|---|
| 6 | $hh = $post_data['hh']; |
|---|
| 7 | $mn = $post_data['mn']; |
|---|
| 8 | $ss = $post_data['ss']; |
|---|
| 9 | - $aa = ($aa <= 0 ) ? date('Y') : $aa; |
|---|
| 10 | - $mm = ($mm <= 0 ) ? date('n') : $mm; |
|---|
| 11 | - $jj = ($jj > 31 ) ? 31 : $jj; |
|---|
| 12 | - $jj = ($jj <= 0 ) ? date('j') : $jj; |
|---|
| 13 | + if( ! checkdate( $mm, $jj, $aa ) ) |
|---|
| 14 | + return new WP_Error( 'invalid_publish_date', __( 'The publish date you supplied is invalid.' ) ); |
|---|
| 15 | + |
|---|
| 16 | $hh = ($hh > 23 ) ? $hh -24 : $hh; |
|---|
| 17 | $mn = ($mn > 59 ) ? $mn -60 : $mn; |
|---|
| 18 | $ss = ($ss > 59 ) ? $ss -60 : $ss; |
|---|
| 19 | Index: wp-admin/js/post.dev.js |
|---|
| 20 | =================================================================== |
|---|
| 21 | --- wp-admin/js/post.dev.js (revision 17979) |
|---|
| 22 | +++ wp-admin/js/post.dev.js (working copy) |
|---|
| 23 | @@ -376,6 +376,7 @@ |
|---|
| 24 | originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val() ); |
|---|
| 25 | currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val() ); |
|---|
| 26 | |
|---|
| 27 | + |
|---|
| 28 | if ( attemptedDate.getFullYear() != aa || (1 + attemptedDate.getMonth()) != mm || attemptedDate.getDate() != jj || attemptedDate.getMinutes() != mn ) { |
|---|
| 29 | $('.timestamp-wrap', '#timestampdiv').addClass('form-invalid'); |
|---|
| 30 | return false; |
|---|
| 31 | @@ -489,6 +490,7 @@ |
|---|
| 32 | $('#timestampdiv').siblings('a.edit-timestamp').click(function() { |
|---|
| 33 | if ($('#timestampdiv').is(":hidden")) { |
|---|
| 34 | $('#timestampdiv').slideDown('fast'); |
|---|
| 35 | + $('#publish').prop('disabled', true); |
|---|
| 36 | $(this).hide(); |
|---|
| 37 | } |
|---|
| 38 | return false; |
|---|
| 39 | @@ -503,6 +505,7 @@ |
|---|
| 40 | $('#mn').val($('#hidden_mn').val()); |
|---|
| 41 | $('#timestampdiv').siblings('a.edit-timestamp').show(); |
|---|
| 42 | updateText(); |
|---|
| 43 | + $('#publish').prop('disabled', false); |
|---|
| 44 | return false; |
|---|
| 45 | }); |
|---|
| 46 | |
|---|
| 47 | @@ -510,6 +513,7 @@ |
|---|
| 48 | if ( updateText() ) { |
|---|
| 49 | $('#timestampdiv').slideUp('fast'); |
|---|
| 50 | $('#timestampdiv').siblings('a.edit-timestamp').show(); |
|---|
| 51 | + $('#publish').prop('disabled', false); |
|---|
| 52 | } |
|---|
| 53 | return false; |
|---|
| 54 | }); |
|---|