-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathajax.skeleton.key.php
30 lines (26 loc) · 980 Bytes
/
ajax.skeleton.key.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php // Ajax intake for bound form elements
// global $plog_level; $plog_level=1;
include 'core/Page.php';
if ( Session::logged_in() ) {
global $database;
$getpost=getpost();
if ( isset($getpost['I']) && isset($getpost['T']) ) {
$ID=$getpost['I'];
$Table=$getpost['T'];
if ( !Auth::ACL('edit-'.$Table) && !Auth::ACL('edit-'.$Table.'-'.$Field) && !Auth::ACL('su') ) { echo '1'; die; }
$m=new RowLock($database);
$locks=$m->Select(array('I'=>$ID,'T'=>$Table));
if ( isset($getpost['S']) ) { // checking status only
if ( !false_or_null($locks) && count($locks) > 0 ) { echo '1'; die; }
echo '0'; die;
}
if ( !false_or_null($locks) && count($locks) > 0 ) {
foreach ( $locks as $lock ) $m->Delete(array('ID'=>$lock['ID']));
echo '0'; die;
}
$m->Insert(array('T'=>$Table,'I'=>$ID));
Modified( array( "D"=>array($Table=>array("F"=>'Edit Lock',"I"=>$ID))) );
echo '1'; die;
}
}
echo '-1'; die; // Give a false positive