diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/controllers/Users.class.php | 60 |
1 files changed, 38 insertions, 22 deletions
diff --git a/src/controllers/Users.class.php b/src/controllers/Users.class.php index 1d947e1..a5d23fc 100644 --- a/src/controllers/Users.class.php +++ b/src/controllers/Users.class.php @@ -256,30 +256,46 @@ class Users extends Controller { if (isset($_POST[$key]) && is_array($_POST[$key])) { $old = $_POST['_old'][$key]; foreach ($_POST[$key] as $uid => $value) { - $have_old = !isset($old[$uid]); - @$change_it = $old[$uid]!==$value; - if (!$have_old || $change_it) { - $user = Auth::getObj($uid); - $oldvalue = $this->getConf($user,$key); - $oldvalue = $oldvalue['value']; - if ($oldvalue===false) $oldvalue = 'false'; - if ($oldvalue===true) $oldvalue = 'true'; - $changed = $value != $oldvalue; - if ($changed) { - echo "<pre>\n"; - echo "Error: Value changed elsewhere, and I don't have real handling for this yet.\n"; - echo "uid: $uid\n"; - echo "Name: ".$user->getName()."\n"; - echo "Key: $key\n"; - echo "oldvalue: "; var_dump($oldvalue); echo "\n"; - echo "newvalue: "; var_dump($value); echo "\n"; - echo "</pre>"; + $doit = true; + $forked = false; + $have_old = isset($old[$uid]); + if ($have_old) { + @$value_base = $old[$uid]; + $we_changed_it = $value_base != $value; + if ($we_changed_it) { + $user = Auth::getObj($uid); + $value_fork = $this->getConf($user,$key); + $value_fork = $value_fork['value']; + if ($value_fork===false) $value_fork = 'false'; + if ($value_fork===true) $value_fork = 'true'; - } else { - $this->setConf($uid, - $key, - $value); + $someone_else_changed_it = $value_fork != $value_base; + if ($someone_else_changed_it) { + if ($value == $value_fork) { + // we might as well not have + $we_changed_it = false; + } else { + $forked = true; + } + } } + if (!$we_changed_it) { + $doit = false;// nothing to do + } + } + if ($doit) { + $this->setConf($uid, $key, $value); + } + if ($forked) { + echo "<pre>\n"; + echo "Error: Value changed elsewhere, and I don't have real handling for this yet.\n"; + echo "UID: $uid\n"; + echo "Name: ".$user->getName()."\n"; + echo "Key: $key\n"; + echo "Value: Original : "; var_dump($value_base); + echo "Value: Other edit: "; var_dump($value_fork); + echo "Value: This edit : "; var_dump($value); + echo "</pre>"; } } } |