Changeset 50618
- Timestamp:
- 03/30/2021 03:17:05 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r50564 r50618 170 170 171 171 if ( ! empty( $post_data['edit_date'] ) ) { 172 $aa = $post_data['aa']; 173 $mm = $post_data['mm']; 174 $jj = $post_data['jj']; 175 $hh = $post_data['hh']; 176 $mn = $post_data['mn']; 177 $ss = $post_data['ss']; 178 $aa = ( $aa <= 0 ) ? gmdate( 'Y' ) : $aa; 179 $mm = ( $mm <= 0 ) ? gmdate( 'n' ) : $mm; 180 $jj = ( $jj > 31 ) ? 31 : $jj; 181 $jj = ( $jj <= 0 ) ? gmdate( 'j' ) : $jj; 182 $hh = ( $hh > 23 ) ? $hh - 24 : $hh; 183 $mn = ( $mn > 59 ) ? $mn - 60 : $mn; 184 $ss = ( $ss > 59 ) ? $ss - 60 : $ss; 172 $aa = $post_data['aa']; 173 $mm = $post_data['mm']; 174 $jj = $post_data['jj']; 175 $hh = $post_data['hh']; 176 $mn = $post_data['mn']; 177 $ss = $post_data['ss']; 178 $aa = ( $aa <= 0 ) ? gmdate( 'Y' ) : $aa; 179 $mm = ( $mm <= 0 ) ? gmdate( 'n' ) : $mm; 180 $jj = ( $jj > 31 ) ? 31 : $jj; 181 $jj = ( $jj <= 0 ) ? gmdate( 'j' ) : $jj; 182 $hh = ( $hh > 23 ) ? $hh - 24 : $hh; 183 $mn = ( $mn > 59 ) ? $mn - 60 : $mn; 184 $ss = ( $ss > 59 ) ? $ss - 60 : $ss; 185 185 186 $post_data['post_date'] = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $aa, $mm, $jj, $hh, $mn, $ss ); 186 $valid_date = wp_checkdate( $mm, $jj, $aa, $post_data['post_date'] ); 187 188 $valid_date = wp_checkdate( $mm, $jj, $aa, $post_data['post_date'] ); 187 189 if ( ! $valid_date ) { 188 190 return new WP_Error( 'invalid_date', __( 'Invalid date.' ) ); 189 191 } 192 190 193 $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] ); 191 194 } … … 247 250 unset( $post_data['filter'] ); 248 251 249 $post_ID = (int) $post_data['post_ID']; 250 $post = get_post( $post_ID ); 252 $post_ID = (int) $post_data['post_ID']; 253 $post = get_post( $post_ID ); 254 251 255 $post_data['post_type'] = $post->post_type; 252 256 $post_data['post_mime_type'] = $post->post_mime_type;
Note: See TracChangeset
for help on using the changeset viewer.