Make WordPress Core

Ticket #3865: 3865.diff

File 3865.diff, 4.1 KB (added by Nazgul, 18 years ago)
  • wp-admin/admin-functions.php

     
    88                return $result;
    99}
    1010
     11function has_edit_date_changed() {
     12        if($_POST['aa']!=$_POST['aaold'] || $_POST['mm']!=$_POST['mmold'] || $_POST['jj']!=$_POST['jjold'] || $_POST['hh']!=$_POST['hhold'] || $_POST['mn'] != $_POST['mnold'] || $_POST['ss']!=$_POST['ssold']) {
     13                return true;
     14        }
     15       
     16        return false;
     17}
     18
    1119// Creates a new post from the "Write Post" form using $_POST information.
    1220function wp_write_post() {
    1321        global $user_ID;
     
    9199        if (!isset( $_POST['ping_status'] ))
    92100                $_POST['ping_status'] = 'closed';
    93101
    94         if (!empty ( $_POST['edit_date'] ) ) {
     102        if (has_edit_date_changed()) {
    95103                $aa = $_POST['aa'];
    96104                $mm = $_POST['mm'];
    97105                $jj = $_POST['jj'];
     
    257265        if (!isset( $_POST['ping_status'] ))
    258266                $_POST['ping_status'] = 'closed';
    259267
    260         if (!empty ( $_POST['edit_date'] ) ) {
     268        if (has_edit_date_changed()) {
    261269                $aa = $_POST['aa'];
    262270                $mm = $_POST['mm'];
    263271                $jj = $_POST['jj'];
     
    315323        $_POST['comment_content'] = $_POST['content'];
    316324        $_POST['comment_ID'] = (int) $_POST['comment_ID'];
    317325
    318         if (!empty ( $_POST['edit_date'] ) ) {
     326        if (has_edit_date_changed()) {
    319327                $aa = $_POST['aa'];
    320328                $mm = $_POST['mm'];
    321329                $jj = $_POST['jj'];
     
    10901098        if ( $for_post )
    10911099                $edit = ( ('draft' == $post->post_status ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true;
    10921100 
    1093         echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" /> <label for="timestamp">'.__( 'Edit timestamp' ).'</label></legend>';
     1101        echo '<fieldset>';
    10941102
    10951103        $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 );
    10961104        $post_date = ($for_post) ? $post->post_date : $comment->comment_date;
     
    11011109        $mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj );
    11021110        $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj );
    11031111
    1104         echo "<select name=\"mm\" onchange=\"edit_date.checked=true\">\n";
     1112        echo "<select name=\"mm\">\n";
    11051113        for ( $i = 1; $i < 13; $i = $i +1 ) {
    11061114                echo "\t\t\t<option value=\"$i\"";
    11071115                if ( $i == $mm )
     
    11101118        }
    11111119?>
    11121120</select>
    1113 <input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" onchange="edit_date.checked=true"/>
    1114 <input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true" /> @
    1115 <input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> :
    1116 <input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
    1117 <input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
     1121<input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" />
     1122<input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" /> @
     1123<input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> :
     1124<input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" />
     1125<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
     1126
     1127<input type="hidden" id="mmold" name="mmold" value="<?php echo $mm; ?>" size="2" maxlength="2" />
     1128<input type="hidden" id="jjold" name="jjold" value="<?php echo $jj; ?>" size="2" maxlength="2" />
     1129<input type="hidden" id="aaold" name="aaold" value="<?php echo $aa ?>" size="4" maxlength="5" />
     1130<input type="hidden" id="hhold" name="hhold" value="<?php echo $hh ?>" size="2" maxlength="2" />
     1131<input type="hidden" id="mnold" name="mnold" value="<?php echo $mn ?>" size="2" maxlength="2" />
     1132<input type="hidden" id="ssold" name="ssold" value="<?php echo $ss ?>" size="2" maxlength="2" />
    11181133<?php
    11191134        if ( $edit ) {
    11201135                printf( __('Existing timestamp: %1$s %2$s, %3$s @ %4$s:%5$s' ), $wp_locale->get_month( $mm ), $jj, $aa, $hh, $mn );