Fix a possible race condition in the PaintWeb DML code.
[moodle/mihaisucan.git] / mod / wiki / confirmlock.php
blob45eeea7dda761bfb0cc72fbb46ed88fe4839e5f9
1 <?php
2 /**
3 * This script is called through AJAX. It confirms that a user is still
4 * trying to edit a page that they have locked (they haven't closed
5 * their browser window or something).
7 * @copyright &copy; 2006 The Open University
8 * @author s.marshall@open.ac.uk
9 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
10 * @package mod-wiki
11 * @category mod
12 *//** */
14 require_once("../../config.php");
16 header('Content-Type: text/plain');
18 if(empty($_POST['lockid'])) {
19 print 'noid';
20 exit;
23 $lockid=(int)$_POST['lockid'];
24 if($lock=get_record('wiki_locks','id',$lockid)) {
25 $lock->lockedseen=time();
26 update_record('wiki_locks',$lock);
27 print 'ok';
28 } else {
29 print 'cancel'; // Tells user their lock has been cancelled.