Changeset 3074
- Timestamp:
- 11/14/2005 09:56:41 AM (20 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r3064 r3074 837 837 function touch_time($edit = 1, $for_post = 1) { 838 838 global $month, $post, $comment; 839 if ($for_post && ('draft' == $post->post_status)) { 840 $checked = 'checked="checked" '; 841 $edit = false; 842 } else { 843 $checked = ' '; 844 } 845 846 echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" '.$checked.'/> <label for="timestamp">'.__('Edit timestamp').'</label></legend>'; 839 840 if ( $for_post ) 841 $edit = ( ('draft' == $post->post_status) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date) ) ? false : true; 842 843 echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" /> <label for="timestamp">'.__('Edit timestamp').'</label></legend>'; 847 844 848 845 $time_adj = time() + (get_settings('gmt_offset') * 3600); … … 874 871 <input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" /> 875 872 <input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" /> 876 <?php _e('Existing timestamp'); ?>: 877 <?php 878 879 // We might need to readjust to display proper existing timestamp 880 if ($for_post && ('draft' == $post->post_status)) { 881 $jj = mysql2date('d', $post_date); 882 $mm = mysql2date('m', $post_date); 883 $aa = mysql2date('Y', $post_date); 884 $hh = mysql2date('H', $post_date); 885 $mn = mysql2date('i', $post_date); 886 $ss = mysql2date('s', $post_date); 887 } 888 echo "{$month[$mm]} $jj, $aa @ $hh:$mn"; 873 <?php 874 if ( $edit ) { 875 _e('Existing timestamp'); 876 echo ": {$month[$mm]} $jj, $aa @ $hh:$mn"; 877 } 889 878 ?> 890 879 </fieldset> -
trunk/wp-includes/functions-post.php
r3011 r3074 55 55 } 56 56 57 if (empty($post_date)) 58 $post_date = current_time('mysql'); 59 if (empty($post_date_gmt)) 60 $post_date_gmt = get_gmt_from_date($post_date); 57 58 // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now 59 if (empty($post_date)) { 60 if ( 'draft' != $post_status ) 61 $post_date = current_time('mysql'); 62 } 63 64 if (empty($post_date_gmt)) { 65 if ( 'draft' != $post_status ) 66 $post_date_gmt = get_gmt_from_date($post_date); 67 } 61 68 62 69 if ( empty($comment_status) ) { … … 383 390 $postarr['post_category'] = $post_cats; 384 391 392 // Drafts shouldn't be assigned a date unless explicitly done so by the user 393 if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) && 394 ('0000-00-00 00:00:00' == $post['post_date']) ) 395 $clear_date = true; 396 else 397 $clear_date = false; 398 399 // Merge old and new fields with new fields overwriting old ones. 400 $postarr = array_merge($post, $postarr); 401 $postarr['post_category'] = $post_cats; 402 if ( $clear_date ) { 403 $postarr['post_date'] = ''; 404 $postarr['post_date_gmt'] = ''; 405 } 406 385 407 return wp_insert_post($postarr); 386 408 }
Note: See TracChangeset
for help on using the changeset viewer.