-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgetnotifications_data.php
More file actions
executable file
·46 lines (33 loc) · 1.24 KB
/
getnotifications_data.php
File metadata and controls
executable file
·46 lines (33 loc) · 1.24 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
39
40
41
42
43
44
45
46
<?php
function add_notify() {
global $db;
global $output;
global $config;
$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];
$output["notifications"] = array(
"version_num"=>$get_event_res["config_version"].",".$get_event_res["notif_version"],
"nav" => $get_event_res["notif_nav"],
"icon" => $get_event_res["notif_icon"]
);
$get_notif_stmt = $db->prepare("SELECT * FROM notifications where event_ID=:id");
$get_notif_stmt->bindValue(":id",$get_event_res["internal_ID"]);
$get_notif_stmt->execute();
// If we have a contact page section then include the contact_page section.
while($get_notif_res = $get_notif_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($get_notif_res["title"] != "" and $get_notif_res["body"] != "") {
$output["notifications"][$get_notif_res["ID"]] = array(
"title" => $get_notif_res["title"],
"body" => $get_notif_res["body"],
"date" => date("m/d/Y H:i:s",strtotime($get_notif_res["date"]))
);
}
}
}
?>