forked from fluxapps/LiveVoting
-
Notifications
You must be signed in to change notification settings - Fork 6
/
presenter.php
executable file
·53 lines (42 loc) · 1.47 KB
/
presenter.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
53
<?php
/**
* @author Fabian Schmid <[email protected]>
*
* Presenter 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\Conf\xlvoConf;
use LiveVoting\Context\InitialisationManager;
use LiveVoting\Context\Param\ParamManager;
use LiveVoting\Context\xlvoContext;
use LiveVoting\Pin\xlvoPin;
use LiveVoting\Voting\xlvoVotingConfig;
use srag\DIC\LiveVoting\DICStatic;
try {
$pin = trim(filter_input(INPUT_GET, ParamManager::PARAM_PIN), "/");
$puk = trim(filter_input(INPUT_GET, ParamManager::PARAM_PUK), "/");
if (!empty($pin)) {
InitialisationManager::startMinimal();
if (xlvoPin::checkPinAndGetObjId($pin) && !empty($puk)) {
$param_manager = ParamManager::getInstance();
/**
* @var xlvoVotingConfig|null $xlvoVotingConfig
*/
$xlvoVotingConfig = xlvoVotingConfig::where([ "pin" => $pin ])->first();
if ($xlvoVotingConfig !== NULL) {
if ($xlvoVotingConfig->getPuk() === $puk) {
xlvoContext::setContext(xlvoContext::CONTEXT_PIN);
DICStatic::dic()->ctrl()->setTargetScript(xlvoConf::getFullApiURL());
DICStatic::dic()->ctrl()->redirectByClass([
ilUIPluginRouterGUI::class,
xlvoPlayerGUI::class,
], xlvoPlayerGUI::CMD_START_PRESENTER);
}
}
}
}
} catch (Throwable $ex) {
echo $ex->getMessage() . "<br /><br /><a href='/'>back</a>";
}