-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathajax.bound.php
35 lines (32 loc) · 1.13 KB
/
ajax.bound.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
31
32
33
34
35
<?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['V']) && isset($getpost['T']) && isset($getpost['F']) ) {
$ID=$getpost['I'];
$Table=$getpost['T'];
$Field=$getpost['F'];
$Value=$getpost['V'];
if ( !Auth::ACL('edit-'.$Table)
&& !Auth::ACL('edit-'.$Table.'-'.$Field)
&& !Auth::ACL('su') ) {
echo '{"result":"readonly"}';
die;
}
if ( LockCheck( $Table, $ID ) === TRUE ) { echo '{"result":"locked"}'; die; }
if ( AutoLockCheck( $Table, $ID ) === TRUE ) { echo '{"result":"locked"}'; die; }
// Update the db, but only when a valid model is provided
if ( class_exists($Table) && matches(get_parent_class($Table),'Model') ) {
global $database;
$model=new $Table($database);
$model->Update( array( $Field=>$Value ), array ( 'ID'=>$ID ) ) ;
Modified( array( "D"=>array($Table=>array("F"=>$Field,"I"=>$ID))) );
echo '{"result":"success"}';
//var_dump($getpost);
exit;
}
}
}
echo '{"result":"error"}';