3 Puts a warning message above the edit box, if someone else activated
4 the edit screen recently (spiders often interfer with this). This is
5 a poor replacement for the 'patchsaving' extension (see ../feature/).
6 Needs EWIKI_TMP correctly set.
9 @title: concurrent edit warning
10 @desc: if you cannot use 'patchsaving' you should at least warn people if pages are edited concurrently
13 $ewiki_plugins["edit_form_final"][] = "ewiki_edit_warn";
15 function ewiki_edit_warn(&$o, $id, &$data, $action) {
17 $keep = 420; // in seconds
19 if (!file_exists($dir = EWIKI_TMP."/edit.d/")) {
23 $lockfile = $dir . ewiki_lowercase($id) . ".lock";
25 if (file_exists($lockfile)) {
26 $time = filemtime($lockfile);
29 if ($_SERVER["REQUEST_METHOD"] == "POST") {
32 elseif ($time + $keep > time()) {
33 $o = ewiki_t("<p class=\"system-message\"><b>_{Warning}</b>:"
34 . " _{This page is currently being edited by someone else}."
35 . " _{If you start editing now, your changes may get lost}."