mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 00:01:27 +01:00
Fix timestamp editing. http://mosquito.wordpress.org/view.php?id=1022
git-svn-id: http://svn.automattic.com/wordpress/trunk@2429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2bc77d4189
commit
379367cfbe
@ -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'");
|
return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
|
||||||
}
|
}
|
||||||
|
|
||||||
function touch_time($edit = 1) {
|
function touch_time($edit = 1, $for_post = 1) {
|
||||||
global $month, $postdata;
|
global $month, $postdata, $commentdata;
|
||||||
// echo $postdata['Date'];
|
if ( $for_post && ('draft' == $postdata->post_status) ) {
|
||||||
if ('draft' == $postdata->post_status) {
|
|
||||||
$checked = 'checked="checked" ';
|
$checked = 'checked="checked" ';
|
||||||
$edit = false;
|
$edit = false;
|
||||||
} else {
|
} 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>';
|
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);
|
$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);
|
$jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj);
|
||||||
$mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj);
|
$mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj);
|
||||||
$aa = ($edit) ? mysql2date('Y', $post_date) : gmdate('Y', $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="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="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> :
|
||||||
<input type="text" name="mn" value="<?php echo $mn ?>" 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
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ edCanvas = document.getElementById('content');
|
|||||||
<?php if ($user_level > 4) : ?>
|
<?php if ($user_level > 4) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><?php _e('Edit time'); ?>:</th>
|
<th scope="row"><?php _e('Edit time'); ?>:</th>
|
||||||
<td><?php touch_time(($action == 'edit')); ?></td>
|
<td><?php touch_time(('editcomment' == $action), 0); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user