Detect and block conflicting edits

Fixes http://www.mantisbt.org/bugs/view.php?id=5466, whereby
concurrent edits to a single issue can overwrite field data.

These changes allow MantisBT to spot a conflicting edit, stopping
it from overwriting the first edit with the second. It's very much
a blunt tool (flat-out refusal to save), but it works.
Indentation looks inconsistent.