Make WordPress Core


Ignore:
Timestamp:
03/10/2005 09:50:26 AM (21 years ago)
Author:
ryan
Message:

Fix timestamp editing. http://mosquito.wordpress.org/view.php?id=1022

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r2405 r2429  
    410410}
    411411
    412 function touch_time($edit = 1) {
    413     global $month, $postdata;
    414     // echo $postdata['Date'];
    415     if ('draft' == $postdata->post_status) {
     412function touch_time($edit = 1, $for_post = 1) {
     413    global $month, $postdata, $commentdata;
     414    if ( $for_post && ('draft' == $postdata->post_status) ) {
    416415        $checked = 'checked="checked" ';
    417416        $edit = false;
     
    423422   
    424423    $time_adj = time() + (get_settings('gmt_offset') * 3600);
    425     $post_date = $postdata->post_date;
     424    $post_date = ($for_post) ? $postdata->post_date : $commentdata['comment_date'];
    426425    $jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj);
    427426    $mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj);
     
    450449<input type="text" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> :
    451450<input type="text" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" />
    452 <input type="hidden" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" /> <?php _e('Existing timestamp'); ?>: <?php echo "{$month[$mm]} $jj, $aa @ $hh:$mn"; ?></fieldset>
     451<input type="hidden" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
     452<?php _e('Existing timestamp'); ?>:
     453    <?php
     454        // We might need to readjust to display proper existing timestamp
     455        if ( $for_post && ('draft' == $postdata->post_status) ) {
     456            $jj = mysql2date('d', $post_date);
     457            $mm = mysql2date('m', $post_date);
     458            $aa = mysql2date('Y', $post_date);
     459            $hh = mysql2date('H', $post_date);
     460            $mn = mysql2date('i', $post_date);
     461            $ss = mysql2date('s', $post_date);
     462        }
     463        echo "{$month[$mm]} $jj, $aa @ $hh:$mn"; ?>
     464</fieldset>
    453465    <?php
    454466}
Note: See TracChangeset for help on using the changeset viewer.