-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget.php
More file actions
executable file
·37 lines (33 loc) · 1.2 KB
/
get.php
File metadata and controls
executable file
·37 lines (33 loc) · 1.2 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
<?php
include("global.php");
$cur_config = isset($_GET['config'])?intval($_GET['config']):-1;
$cur_notify = isset($_GET['notify'])?intval($_GET['notify']):-1;
$get_event_stmt = $db->prepare("SELECT internal_ID,notif_nav,notif_icon,config_version,notif_version FROM event where ID=:id");
$get_event_stmt->bindParam(":id",$_GET['id']);
$get_event_stmt->execute();
$get_event_res = $get_event_stmt->fetchAll(PDO::FETCH_ASSOC);
if(count($get_event_res) != 1) {
die();
}
$get_event_res = $get_event_res[0];
$user_ag = $_SERVER['HTTP_USER_AGENT'];
//Detect if the request is being made through the LightSys App
if(strpos($user_ag, 'Dalvik') !== false){
header('Content-Type: application/json');
$output = array();
$output["version_num"] = $get_event_res["config_version"].",".$get_event_res["notif_version"];
if ($get_event_res && intval($get_event_res["config_version"]) != $cur_config) {
include("getevent_data.php");
add_data();
}
if ($get_event_res && intval($get_event_res["notif_version"]) != $cur_notify) {
include("getnotifications_data.php");
add_notify();
}
echo json_encode_noescape($output);
}
//See if the request is coming from a browser.
else{
include("event_web.php");
}
?>