-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.php
More file actions
29 lines (25 loc) · 749 Bytes
/
api.php
File metadata and controls
29 lines (25 loc) · 749 Bytes
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
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/common/includes/util_inc.php");
require_once("shared.php");
function preSetup()
{
header('Content-Type: application/json');
}
$action = $_GET['a'];
$pid = $_GET['pid'];
$msg = $_GET['msg'];
preSetup();
if ($action == "msgs") {
$msghtml = genUserMsgs($pid);
$tophtml = genMsgsTop($pid);
clearUnreadMessagesForUser($pid);
echo json_encode(array("html" => $msghtml, "top" => "$tophtml"));
} else if ($action == "users") {
echo json_encode(array("html" => genUserBlocks()));
} else if ($action == "postmsg") {
postMsg($pid, $msg);
$msghtml = genUserMsgs($pid);
$tophtml = genMsgsTop($pid);
echo json_encode(array("html" => $msghtml, "top" => "$tophtml"));
}
?>