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.

105 lines
3.8 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. ob_start();
  4. $ACCESS = intval( $CUser->Data['access'] );
  5. $UID = intval( $CUser->Data['id'] );
  6. if( $UID > 1 ){
  7. $Data = array();
  8. $Data['status'] = 'err';
  9. if( isset( $_POST['OPID'] ) ){
  10. $CMD = intval( $_POST['OPID'] );
  11. } else {
  12. $CMD = 0;
  13. };
  14. if( isset( $_POST['SESSION'] ) ){
  15. $OID = intval( $_POST['SESSION'] );
  16. } else {
  17. $OID = 0;
  18. };
  19. if( $CMD > 0 && $OID > 0 ){
  20. switch( $CMD ){
  21. case 1:{
  22. if( $ACCESS > 2 ){// Erase Session .... Direct
  23. /*
  24. $QS = "SELECT * FROM `sessions` WHERE `id`={$OID}";
  25. $RR = $DATABASE->Query( $QS );
  26. if( count( $RR ) ){
  27. $SD = $RR[0];
  28. $Data['basepath'] = $SYSPath .'/lib/controller/data/reports/'.$SD['track_id'].'/'.date("Y/m/d",intval($SD['ts'] ));
  29. if( file_exists( $Data['basepath'] )){
  30. $RBASE = new SQLite_DB( $Data['basepath'] .'/report.db' );
  31. $QS = "DELETE FROM `events` WHERE `session_id`={$OID}";
  32. $RBASE->Query( $QS );
  33. $QS = "SELECT * FROM `videos` WHERE `session_id`={$OID}";
  34. $RR = $RBASE->Query( $QS );
  35. foreach( $RR as $V ) unlink( $Data['basepath'] .'/'.$V['uuid'] . '.'. $V['ext'] );
  36. $QS = "DELETE FROM `videos` WHERE `session_id`={$OID}";
  37. $RBASE->Query( $QS );
  38. $QS = "DELETE FROM `sessions` WHERE `id`={$OID}";
  39. $DATABASE->Query( $QS );
  40. //ToDo: Check if there other session if not -> delete database and report folder
  41. $Data['status'] = 'ok';
  42. } else {
  43. $Data['msg']='Report DataBase is Corupted!';
  44. };
  45. } else {
  46. $Data['msg']='Session is already Deleted!';
  47. };*/
  48. //Via Kernel
  49. $QS="INSERT INTO `mem_web_queue`(`cmd`,`aux_id`) VALUES(246,{$OID})";
  50. $DATABASE->Query( $QS );
  51. $Data['status'] = 'ok';
  52. } else {
  53. $Data['msg']='Wrong Access Level!';
  54. };
  55. };
  56. case 2:{ // Set Session Status ---- Direct
  57. $QS = "SELECT `status`, `track_id`, `final` FROM `sessions` WHERE `id`={$OID}";
  58. $R = $DATABASE->Query( $QS );
  59. if( count( $R ) ){
  60. $CS = $R[0];
  61. $ST = intval( $_POST['OPAR'] );
  62. if( $ST ){
  63. if( $ST == 6 ) $ST = 4;
  64. $QS = "UPDATE `sessions` SET `status`={$ST} WHERE `id`={$OID}";
  65. $DATABASE->Query( $QS );
  66. if( $CS['final'] != 'Y' ){
  67. // Ongoing Session --->> Sinal to Kernel
  68. $QS="INSERT INTO `mem_web_queue`(`cmd`,`aux_id`,`param`) VALUES(247,{$CS['track_id']},'{$ST}')";
  69. $DATABASE->Query( $QS );
  70. };
  71. $CS['status'] = $ST;
  72. };
  73. if( $CS['final']=='Y' ){
  74. $QS = "SELECT * FROM `session_statuses` WHERE `min_access`<={$ACCESS}";
  75. } else {
  76. $QS = "SELECT * FROM `session_statuses` WHERE `min_access`<={$ACCESS} AND `special`=''";
  77. };
  78. $SR = $DATABASE->Query( $QS );
  79. $TDS = '';
  80. $PPP = 100.0 / count($SR);
  81. foreach( $SR as $S ){
  82. $FUNC = ($S['special']!='')?$S['special']:'setSessionStatus';
  83. if( $CS['status'] >= $S['lvl'] ){
  84. $TDS .= "<td align=\"center\" width=\"{$PPP}%\"><span class=\"sideInfo_item passive_gray\">{$S['label']}</span></td>";
  85. } else {
  86. $TDS .= "<td align=\"center\" width=\"{$PPP}%\"><span class=\"sideInfo_item {$S['class']}\" onclick=\"{$FUNC}({$OID},{$S['lvl']});\" >{$S['label']}</span></td>";
  87. };
  88. };
  89. $Data['content']="{ id: 'sets_ui', frame: true, html: '<table width=\"100%\" border=0><tr>{$TDS}</tr></table>'}";
  90. $Data['status'] = 'ok';
  91. };
  92. break;
  93. };
  94. };
  95. } else {
  96. $Data['msg']='Wrong Parameters!';
  97. };
  98. $Data['messages'] = ob_get_clean();
  99. echo json_encode( $Data );
  100. exit();
  101. } else {
  102. $LOG->security_treat( $_POST );
  103. };
  104. header('location: /');
  105. ?>