forked from surlabs/LiveVoting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.php
executable file
·48 lines (35 loc) · 1.08 KB
/
api.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
<?php
/**
* @author Fabian Schmid <[email protected]>
*
* User starts here. Use a RewriteRule to access this page a bit simpler
*/
require_once __DIR__ . '/../../../../../../../libs/composer/vendor/autoload.php';
require_once __DIR__ . "/vendor/autoload.php";
require_once "dir.php";
use LiveVoting\Api\xlvoApi;
use LiveVoting\Context\InitialisationManager;
use LiveVoting\Context\Param\ParamManager;
use LiveVoting\Context\xlvoContext;
use LiveVoting\Pin\xlvoPin;
try {
$pin = trim(filter_input(INPUT_GET, "pin"), "/");
$puk = trim(filter_input(INPUT_GET, "puk"), "/");
if (!empty($pin)) {
InitialisationManager::startMinimal();
if (xlvoPin::checkPinAndGetObjId($pin)) {
$param_manager = ParamManager::getInstance();
xlvoContext::setContext(xlvoContext::CONTEXT_PIN);
$token = trim(filter_input(INPUT_GET, "token"), "/");
if (!empty($token)) {
$api = new xlvoApi(new xlvoPin($pin), $token);
$type = trim(filter_input(INPUT_GET, "type"), "/");
if (!empty($type)) {
$api->setType($type);
}
$api->send();
}
}
}
} catch (Throwable $ex) {
}