commit | author | age
|
812087
|
1 |
<?php |
FÁ |
2 |
ini_set('display_errors', E_ALL); |
|
3 |
|
|
4 |
include "vendor/autoload.php"; |
|
5 |
|
|
6 |
define('IS_DEV', (!isset($_SERVER['HTTP_HOST']))); |
|
7 |
define('SITE_ROOT', __DIR__); |
|
8 |
|
|
9 |
if (IS_DEV) |
|
10 |
{ |
|
11 |
define('OVERLAY_DIR', dirname(__DIR__) . '/esl-overlay/'); |
|
12 |
} |
|
13 |
else |
|
14 |
{ |
|
15 |
define('OVERLAY_DIR', dirname(__DIR__) . '/overlays/'); |
|
16 |
} |
|
17 |
|
1867e1
|
18 |
$last_json = OVERLAY_DIR . 'last.json'; |
cc3ac8
|
19 |
|
812087
|
20 |
$twig = \EOG\Utils\TwigFactory::getEnvironment(SITE_ROOT); |
FÁ |
21 |
|
cc3ac8
|
22 |
$s = new \EOG\Models\Stripe(); |
FÁ |
23 |
|
|
24 |
if (!empty($_POST['stripe'])) |
812087
|
25 |
{ |
cc3ac8
|
26 |
$s->loadFromArray($_POST['stripe']); |
812087
|
27 |
|
1867e1
|
28 |
if (!empty($s->getState())) |
cc3ac8
|
29 |
{ |
1867e1
|
30 |
file_put_contents($last_json, $s->getJson()); |
cc3ac8
|
31 |
} |
FÁ |
32 |
|
1867e1
|
33 |
$s->setClass('simple'); |
FÁ |
34 |
$html_content = $twig->render('templates/overlay-base.twig', ['stripe' => $s]); |
|
35 |
file_put_contents(OVERLAY_DIR . 'simple.html', $html_content); |
|
36 |
|
|
37 |
$s->setClass('team'); |
|
38 |
$html_content = $twig->render('templates/overlay-base.twig', ['stripe' => $s]); |
|
39 |
file_put_contents(OVERLAY_DIR . 'team.html', $html_content); |
|
40 |
|
|
41 |
$s->setClass('team-ban'); |
|
42 |
$html_content = $twig->render('templates/overlay-base.twig', ['stripe' => $s]); |
|
43 |
file_put_contents(OVERLAY_DIR . 'team-ban.html', $html_content); |
|
44 |
|
|
45 |
} |
|
46 |
else |
|
47 |
{ |
|
48 |
if (file_exists($last_json)) |
|
49 |
{ |
|
50 |
$raw_json = file_get_contents($last_json); |
|
51 |
$stateArray = json_decode($raw_json, true); |
|
52 |
if (is_array($stateArray)) |
|
53 |
{ |
|
54 |
$s->loadFromArray($stateArray); |
|
55 |
} |
|
56 |
} |
|
57 |
} |
268b32
|
58 |
|
cc3ac8
|
59 |
$var = [ |
FÁ |
60 |
'stripe' => $s, |
|
61 |
'operators' => $s->getOperators(), |
|
62 |
'post' => !empty($_POST['stripe']) |
|
63 |
]; |
|
64 |
echo $twig->render('templates/admin/form.twig', $var); |
812087
|
65 |
|