Newer
Older
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
//* Load the form definition
$app->remoting_lib->loadFormDef($formdef_file);
//* Get the SQL query
$sql = $app->remoting_lib->getDeleteSQL($primary_id);
$app->db->query($sql);
if($app->db->errorMessage != '') {
$this->server->fault('database_error', $app->db->errorMessage . ' '.$sql);
return false;
}
$affected_rows = $app->db->affectedRows();
//* Save changes to Datalog
if($app->remoting_lib->formDef["db_history"] == 'yes') {
$rec = $app->remoting_lib->getDataRecord($primary_id);
$app->remoting_lib->datalogSave('DELETE',$primary_id,$rec,array());
}
return $affected_rows;
}
private function checkPerm($session_id, $function_name)
{
$dobre=Array();
$session = $this->getSession($session_id);
if(!$session){
return false;
}
$dobre= str_replace(';',',',$session['remote_functions']);
return in_array($function_name, explode(',', $dobre) );
}
private function getSession($session_id)
{
global $app;
if(empty($session_id)) {
$this->server->fault('session_id_empty','The SessionID is empty.');
return false;
}
$session_id = $app->db->quote($session_id);
$now = time();
$sql = "SELECT * FROM remote_session WHERE remote_session = '$session_id' AND tstamp >= $now";
$session = $app->db->queryOneRecord($sql);
if($session['remote_userid'] > 0) {
return $session;
} else {
$this->server->fault('session_does_not_exist','The Session is expired or does not exist.');
return false;
}
}
}
?>