git-svn-id: http://svn.automattic.com/wordpress/trunk@2429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-03-10 09:50:26 +00:00
parent 2bc77d4189
commit 379367cfbe
2 changed files with 19 additions and 7 deletions

View File

@ -409,10 +409,9 @@ function update_meta($mid, $mkey, $mvalue) {
return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
}
function touch_time($edit = 1) {
global $month, $postdata;
// echo $postdata['Date'];
if ('draft' == $postdata->post_status) {
function touch_time($edit = 1, $for_post = 1) {
global $month, $postdata, $commentdata;
if ( $for_post && ('draft' == $postdata->post_status) ) {
$checked = 'checked="checked" ';
$edit = false;
} else {
@ -422,7 +421,7 @@ function touch_time($edit = 1) {
echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" '.$checked.'/> <label for="timestamp">' . __('Edit timestamp') . '</label></legend>';
$time_adj = time() + (get_settings('gmt_offset') * 3600);
$post_date = $postdata->post_date;
$post_date = ($for_post) ? $postdata->post_date : $commentdata['comment_date'];
$jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj);
$mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj);
$aa = ($edit) ? mysql2date('Y', $post_date) : gmdate('Y', $time_adj);
@ -449,7 +448,20 @@ function touch_time($edit = 1) {
<input type="text" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" /> @
<input type="text" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> :
<input type="text" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" />
<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>
<input type="hidden" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
<?php _e('Existing timestamp'); ?>:
<?php
// We might need to readjust to display proper existing timestamp
if ( $for_post && ('draft' == $postdata->post_status) ) {
$jj = mysql2date('d', $post_date);
$mm = mysql2date('m', $post_date);
$aa = mysql2date('Y', $post_date);
$hh = mysql2date('H', $post_date);
$mn = mysql2date('i', $post_date);
$ss = mysql2date('s', $post_date);
}
echo "{$month[$mm]} $jj, $aa @ $hh:$mn"; ?>
</fieldset>
<?php
}

View File

@ -74,7 +74,7 @@ edCanvas = document.getElementById('content');
<?php if ($user_level > 4) : ?>
<tr>
<th scope="row"><?php _e('Edit time'); ?>:</th>
<td><?php touch_time(($action == 'edit')); ?></td>
<td><?php touch_time(('editcomment' == $action), 0); ?></td>
</tr>
<?php endif; ?>