You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
4.0 KiB
112 lines
4.0 KiB
<?php
|
|
require_once('../ajax_asm.php');
|
|
ob_start();
|
|
$ACCESS = intval( $CUser->Data['access'] );
|
|
$UID = intval( $CUser->Data['id'] );
|
|
if( $UID > 1 ){
|
|
$Data = array();
|
|
$Data['status'] = 'err';
|
|
if( isset( $_POST['OPID'] ) ){
|
|
$CMD = intval( $_POST['OPID'] );
|
|
} else {
|
|
$CMD = 0;
|
|
};
|
|
if( isset( $_POST['SESSION'] ) ){
|
|
$OID = intval( $_POST['SESSION'] );
|
|
} else {
|
|
$OID = 0;
|
|
};
|
|
if( $CMD > 0 && $OID > 0 ){
|
|
switch( $CMD ){
|
|
case 1:{
|
|
if( $ACCESS > 2 ){// Erase Session .... Direct
|
|
/*
|
|
$QS = "SELECT * FROM `sessions` WHERE `id`={$OID}";
|
|
$RR = $DATABASE->Query( $QS );
|
|
if( count( $RR ) ){
|
|
$SD = $RR[0];
|
|
$Data['basepath'] = $SYSPath .'/lib/controller/data/reports/'.$SD['track_id'].'/'.date("Y/m/d",intval($SD['ts'] ));
|
|
if( file_exists( $Data['basepath'] )){
|
|
$RBASE = new SQLite_DB( $Data['basepath'] .'/report.db' );
|
|
$QS = "DELETE FROM `events` WHERE `session_id`={$OID}";
|
|
$RBASE->Query( $QS );
|
|
$QS = "SELECT * FROM `videos` WHERE `session_id`={$OID}";
|
|
$RR = $RBASE->Query( $QS );
|
|
foreach( $RR as $V ) unlink( $Data['basepath'] .'/'.$V['uuid'] . '.'. $V['ext'] );
|
|
$QS = "DELETE FROM `videos` WHERE `session_id`={$OID}";
|
|
$RBASE->Query( $QS );
|
|
$QS = "DELETE FROM `sessions` WHERE `id`={$OID}";
|
|
$DATABASE->Query( $QS );
|
|
//ToDo: Check if there other session if not -> delete database and report folder
|
|
|
|
$Data['status'] = 'ok';
|
|
} else {
|
|
$Data['msg']='Report DataBase is Corupted!';
|
|
};
|
|
} else {
|
|
$Data['msg']='Session is already Deleted!';
|
|
};*/
|
|
//Via Kernel
|
|
$QS="INSERT INTO `mem_web_queue`(`cmd`,`aux_id`) VALUES(246,{$OID})";
|
|
$DATABASE->Query( $QS );
|
|
$Data['status'] = 'ok';
|
|
} else {
|
|
$Data['msg']='Wrong Access Level!';
|
|
};
|
|
};
|
|
case 2:{ // Set Session Status ---- Direct
|
|
$QS = "SELECT `status`, `track_id`, `final` FROM `sessions` WHERE `id`={$OID}";
|
|
$R = $DATABASE->Query( $QS );
|
|
if( count( $R ) ){
|
|
$CS = $R[0];
|
|
$ST = intval( $_POST['OPAR'] );
|
|
if( $ST ){
|
|
if( $ST == 6 ) $ST = 4;
|
|
$QS = "UPDATE `sessions` SET `status`={$ST} WHERE `id`={$OID}";
|
|
$DATABASE->Query( $QS );
|
|
if( $CS['final'] != 'Y' ){
|
|
// Ongoing Session --->> Sinal to Kernel
|
|
$QS="INSERT INTO `mem_web_queue`(`cmd`,`aux_id`,`param`) VALUES(247,{$CS['track_id']},'{$ST}')";
|
|
$DATABASE->Query( $QS );
|
|
};
|
|
$CS['status'] = $ST;
|
|
};
|
|
if( $CS['final']=='Y' ){
|
|
$QS = "SELECT * FROM `session_statuses` WHERE `min_access`<={$ACCESS}";
|
|
} else {
|
|
$QS = "SELECT * FROM `session_statuses` WHERE `min_access`<={$ACCESS} AND `special`=''";
|
|
};
|
|
$SR = $DATABASE->Query( $QS );
|
|
$TDS = '';
|
|
$PPP = 100.0 / count($SR);
|
|
foreach( $SR as $S ){
|
|
$FUNC = ($S['special']!='')?$S['special']:'setSessionStatus';
|
|
if( $CS['status'] >= $S['lvl'] ){
|
|
$TDS .= "<td align=\"center\" width=\"{$PPP}%\"><span class=\"sideInfo_item passive_gray\">{$S['label']}</span></td>";
|
|
} else {
|
|
$TDS .= "<td align=\"center\" width=\"{$PPP}%\"><span class=\"sideInfo_item {$S['class']}\" onclick=\"{$FUNC}({$OID},{$S['lvl']});\" >{$S['label']}</span></td>";
|
|
};
|
|
};
|
|
$Data['content']="{ id: 'sets_ui', frame: true, html: '<table width=\"100%\" border=0><tr>{$TDS}</tr></table>'}";
|
|
$Data['status'] = 'ok';
|
|
};
|
|
break;
|
|
};
|
|
case 3:{ // Compose Session videos`
|
|
$QS="INSERT INTO `mem_web_queue`(`cmd`,`aux_id`) VALUES(239,{$OID})";
|
|
$DATABASE->Query( $QS );
|
|
$Data['status'] = 'ok';
|
|
break;
|
|
};
|
|
};
|
|
} else {
|
|
$Data['msg']='Wrong Parameters!';
|
|
};
|
|
$Data['messages'] = ob_get_clean();
|
|
echo json_encode( $Data );
|
|
exit();
|
|
} else {
|
|
$LOG->security_treat( $_POST );
|
|
};
|
|
header('location: /');
|
|
?>
|