-
Notifications
You must be signed in to change notification settings - Fork 229
/
silex.php
47 lines (35 loc) · 1.12 KB
/
silex.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
<?php
define('COOKIE_SESSION', true);
require_once "tsugi/config.php";
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use \Tsugi\Core\LTIX;
$launch = LTIX::session_start();
$app = new \Tsugi\Silex\Application($launch);
$app['tsugi']->output->buffer = false;
$app['debug'] = true;
$app->error(function (NotFoundHttpException $e, Request $request, $code) use ($app) {
global $CFG, $LAUNCH, $OUTPUT, $USER, $CONTEXT, $LINK, $RESULT;
include("top.php");
include("nav.php");
echo("<h2>Page not found.</h2>\n");
include("foot.php");
return "";
});
$app->get('/materials', function () {
global $CFG, $OUTPUT, $USER, $CONTEXT, $LINK, $RESULT;
require_once('materials.php');
return "";
});
$app->get('/book', function () {
global $CFG, $OUTPUT, $USER, $CONTEXT, $LINK, $RESULT;
require_once('book.php');
return "";
});
$app->get('/install', function () {
global $CFG, $OUTPUT, $USER, $CONTEXT, $LINK, $RESULT;
require_once('install.php');
return "";
});
$app->run();