Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.882 diff -u -p -r1.882 node.module --- modules/node/node.module 14 Sep 2007 09:37:29 -0000 1.882 +++ modules/node/node.module 17 Sep 2007 07:41:02 -0000 @@ -754,10 +754,9 @@ function node_submit($node) { else { $node->uid = 0; } - - $node->created = $node->date ? strtotime($node->date) : NULL; } + $node->created = !empty($node->date) ? strtotime($node->date) : time(); $node->validated = TRUE; return $node; Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.2 diff -u -p -r1.2 node.pages.inc --- modules/node/node.pages.inc 9 Sep 2007 19:52:29 -0000 1.2 +++ modules/node/node.pages.inc 17 Sep 2007 07:41:04 -0000 @@ -62,17 +62,7 @@ function node_form_validate($form, &$for } function node_object_prepare(&$node) { - if (user_access('administer nodes')) { - // Set up default values, if required. - if (!isset($node->created)) { - $node->created = time(); - } - - if (!isset($node->date)) { - $node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O'); - } - } - + // Set up default values, if required. $node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); // If this is a new node, fill in the default values. if (!isset($node->nid)) { @@ -81,6 +71,10 @@ function node_object_prepare(&$node) { } global $user; $node->uid = $user->uid; + $node->created = time(); + } + else { + $node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O'); } // Always use the default revision setting. $node->revision = in_array('revision', $node_options); @@ -160,34 +154,35 @@ function node_form(&$form_state, $node) } // Node author information for administrators - $form['author'] = array( - '#type' => 'fieldset', - '#access' => user_access('administer nodes'), - '#title' => t('Authoring information'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#weight' => 20, - ); - $form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $node->name ? $node->name : '', '#weight' => -1, '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous'))))); - $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => $node->date))); - - if (isset($node->nid)) { - $form['author']['date']['#default_value'] = $node->date; + if (user_access('administer nodes')) { + $form['author'] = array( + '#type' => 'fieldset', + '#access' => user_access('administer nodes'), + '#title' => t('Authoring information'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#weight' => 20, + ); + $form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $node->name ? $node->name : '', '#weight' => -1, '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous'))))); + $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? $node->date : format_date($node->created, 'custom', 'Y-m-d H:i:s O')))); + + if (isset($node->date)) { + $form['author']['date']['#default_value'] = $node->date; + } + + // Node options for administrators + $form['options'] = array( + '#type' => 'fieldset', + '#access' => user_access('administer nodes'), + '#title' => t('Publishing options'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#weight' => 25, + ); + $form['options']['status'] = array('#type' => 'checkbox', '#title' => t('Published'), '#default_value' => $node->status); + $form['options']['promote'] = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => $node->promote); + $form['options']['sticky'] = array('#type' => 'checkbox', '#title' => t('Sticky at top of lists'), '#default_value' => $node->sticky); } - - // Node options for administrators - $form['options'] = array( - '#type' => 'fieldset', - '#access' => user_access('administer nodes'), - '#title' => t('Publishing options'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#weight' => 25, - ); - $form['options']['status'] = array('#type' => 'checkbox', '#title' => t('Published'), '#default_value' => $node->status); - $form['options']['promote'] = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => $node->promote); - $form['options']['sticky'] = array('#type' => 'checkbox', '#title' => t('Sticky at top of lists'), '#default_value' => $node->sticky); - // These values are used when the user has no administrator access. foreach (array('uid', 'created') as $key) { $form[$key] = array('#type' => 'value', '#value' => $node->$key); @@ -336,10 +331,6 @@ function node_preview($node) { $node->picture = $user->picture; } - // Set the timestamps when needed: - if ($node->date) { - $node->created = strtotime($node->date); - } $node->changed = time(); // Extract a teaser, if it hasn't been set (e.g. by a module-provided