-
Notifications
You must be signed in to change notification settings - Fork 0
/
schedule.php
executable file
·52 lines (51 loc) · 1.7 KB
/
schedule.php
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
47
48
49
50
51
52
<?php
require_once("includes.php");
if (!isset($_GET["event"]))
header("Location: /" . SITE_ROOT);
$event = get_event($_GET["event"]);
if ($event == null)
header("Location: /" . SITE_ROOT);
if ($event["public"] == 0 && $event["account"] != $account
&& !(isset($_GET["key"]) && validate_invite($event["id"], $_GET["key"])) && !($account !== false && validate_invite_account($event["id"], $account)))
header("Location: /" . SITE_ROOT);
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if ($account === false && (isset($_POST["name"]) && $_POST["name"] == ""))
echo "Please enter your name";
else if ($_POST["text"] == "")
echo "Please enter your availability";
else
{
$processor = new NaturalLanguageProcessor($_POST["text"], $event["range_start"], $event["range_end"]);
$p = $processor->Process();
if ($p !== false)
{
$userid = 0;
if ($account !== false)
$userid = put_schedule("", $p, $event["id"], $account, $_POST["text"]);
else
{
if ($event["public"] == 0)
$userid = put_schedule((isset($_POST["name"]) ? $_POST["name"] : ""), $p, $event["id"], 0, $_POST["text"], $_GET["key"]);
else
$userid = put_schedule((isset($_POST["name"]) ? $_POST["name"] : ""), $p, $event["id"], 0, $_POST["text"]);
}
if ($event["public"] == 0)
{
if ($account !== false)
{
update_invite_account($event["id"], $account, $userid);
}
else
{
update_invite($event["id"], $_GET["key"], $userid);
}
}
}
}
}
if ($event["public"] == 0 && isset($_GET["key"]))
header("Location: view?event=" . $_GET["event"] . "&key=" . $_GET["key"] . "#attendees");
else
header("Location: view?event=" . $_GET["event"] . "#attendees");
?>