-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajax.alerts.php
More file actions
38 lines (33 loc) · 1.07 KB
/
ajax.alerts.php
File metadata and controls
38 lines (33 loc) · 1.07 KB
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
36
37
38
<?php
class ControllerIndex{
private $_system;
private $_hat;
private $_shoe;
function __construct()
{
header('Content-Type: application/json');
require_once 'libs/config.php'; //Archivo con configuraciones.
$this->_system = System::singleton();//contiene objeto system
$_POST = json_decode(file_get_contents('php://input'), true);
require_once 'libs/apps/alerts/class.alerts.php';
$alerts = new Alerts();
$what = (empty($_POST['what'])) ? null : $_POST['what'];
$token = (empty($_POST['token'])) ? null : $_POST['token'];
if($token===session_id()){
if($what==="LIST_ALERTS"){
$period = (empty($_POST['period'])) ? null : $_POST['period'];
$type = (empty($_POST['type'])) ? null : $_POST['type'];
$data = array(
'period' => $period,
'type' => $type
);
$current_alerts = $alerts->listAlerts($data);
echo json_encode($current_alerts);
}
}else{
echo json_encode(array("status"=>"Failed","message"=>"Cross site injection detected","code"=>501));
}
}
}
new ControllerIndex();
?>