Commit 31bb8ef3 authored by drumm's avatar drumm

#50316 by hunmonk, disallow simultaneous editing of posts.

parent 2ddb81af
...@@ -1536,8 +1536,8 @@ function node_validate($node, $form = array()) { ...@@ -1536,8 +1536,8 @@ function node_validate($node, $form = array()) {
form_set_error('body', t('The body of your %type is too short. You need at least %words words.', array('%words' => variable_get('minimum_'. $node->type .'_size', 0), '%type' => node_get_name($node)))); form_set_error('body', t('The body of your %type is too short. You need at least %words words.', array('%words' => variable_get('minimum_'. $node->type .'_size', 0), '%type' => node_get_name($node))));
} }
if (isset($node->nid) && (node_last_changed($node->nid) > $node->changed)) { if (isset($node->nid) && (node_last_changed($node->nid) > $_POST['edit']['changed'])) {
form_set_error('changed', t('This content has been modified by another user; changes cannot be saved.')); form_set_error('changed', t('This content has been modified by another user, changes cannot be saved.'));
} }
if (user_access('administer nodes')) { if (user_access('administer nodes')) {
...@@ -1601,10 +1601,13 @@ function node_form_array($node) { ...@@ -1601,10 +1601,13 @@ function node_form_array($node) {
* Basic node information. * Basic node information.
* These elements are just values so they are not even sent to the client. * These elements are just values so they are not even sent to the client.
*/ */
foreach (array('nid', 'vid', 'uid', 'created', 'changed', 'type') as $key) { foreach (array('nid', 'vid', 'uid', 'created', 'type') as $key) {
$form[$key] = array('#type' => 'value', '#value' => $node->$key); $form[$key] = array('#type' => 'value', '#value' => $node->$key);
} }
// Changed must be sent to the client, for later overwrite error checking.
$form['changed'] = array('#type' => 'hidden', '#value' => $node->changed);
// Get the node-specific bits. // Get the node-specific bits.
$form = array_merge_recursive($form, node_invoke($node, 'form')); $form = array_merge_recursive($form, node_invoke($node, 'form'));
if (!isset($form['title']['#weight'])) { if (!isset($form['title']['#weight'])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment