summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Drumm <drumm@3064.no-reply.drupal.org>2006-07-18 07:51:39 +0000
committerNeil Drumm <drumm@3064.no-reply.drupal.org>2006-07-18 07:51:39 +0000
commit31bb8ef394eae49218f56b16add3e4b8a5da2c78 (patch)
treee8ea5c318599f8010674978d13a8bb13107ede54
parent2ddb81af029f376e136fce7127522a62f0da6b06 (diff)
downloadbrdo-31bb8ef394eae49218f56b16add3e4b8a5da2c78.tar.gz
brdo-31bb8ef394eae49218f56b16add3e4b8a5da2c78.tar.bz2
#50316 by hunmonk, disallow simultaneous editing of posts.
-rw-r--r--modules/node/node.module9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index c547c8ad8..d2fe1775a 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -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))));
}
- if (isset($node->nid) && (node_last_changed($node->nid) > $node->changed)) {
- form_set_error('changed', t('This content has been modified by another user; changes cannot be saved.'));
+ 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.'));
}
if (user_access('administer nodes')) {
@@ -1601,10 +1601,13 @@ function node_form_array($node) {
* Basic node information.
* 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);
}
+ // 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.
$form = array_merge_recursive($form, node_invoke($node, 'form'));
if (!isset($form['title']['#weight'])) {