auth->check_module_permissions('sites'); $app->uses("tform_actions"); class page_action extends tform_actions { function onBeforeDelete() { global $app; $conf; if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission')); $old_record = $app->tform->getDataRecord($this->id); $app->db->datalogDelete('web_database_user', 'database_user_id', $this->id); } function onAfterDelete() { // this has to be done on AFTER delete, because we need the db user still in the database when the server plugin processes the datalog global $app; $conf; //* Update all records that belog to this user $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = '".intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogUpdate('web_database','database_user_id=NULL','database_id', $rec['database_id']); } $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_ro_user_id = '".intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogUpdate('web_database','database_ro_user_id=NULL','database_id', $rec['database_id']); } } } $page = new page_action; $page->onDelete(); ?>