-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·63 lines (50 loc) · 1.68 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
<?php
require_once 'config.php';
require_once 'routes.php';
require_once 'static/altorouter/AltoRouter.php';
require_once 'static/smarty/Smarty.class.php';
require_once 'static/redbeanphp/rb-mysql.php';
require_once 'static/phpseclib/rsa.php';
require_once 'controllers/core.php';
require_once 'controllers/forum.php';
require_once 'controllers/comment.php';
require_once 'controllers/vote.php';
require_once 'controllers/auth.php';
require_once 'controllers/process.php';
date_default_timezone_set($TIME_ZONE);
R::setup("mysql:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PWD);
R::freeze(TRUE);
$smarty = new Smarty;
$smarty->setTemplateDir('views');
$smarty->setCompileDir('cache');
$smarty->caching = 0;
$smarty->auto_literal = TRUE;
$smarty->left_delimiter = "{";
$smarty->right_delimiter = "}";
Core::$engine = $smarty;
Core::$base_url = $BASE_URL;
Core::$base_route = $BASE_ROUTE;
Core::$engine->assign('base_url', $BASE_URL);
Core::$engine->assign('groups', R::findAll('posts', "type_of = 'group'"));
Auth::$rsa = new RSA($PUB_KEY, $PRIV_KEY);
Auth::$public_key = $PUB_KEY;
Auth::$public_parity = $PUB_PARITY;
Auth::$admin_email = $ADMIN_EMAIL;
// Uncomment to re-generate RSA key pairs and manually update them in config.php
// print_r(Auth::$rsa->generate_keys());
Forum::$engine->assign('healthnews', Process::get_newsfeed());
Forum::$engine->assign('healthvideo', Process::get_video());
$router = new AltoRouter();
foreach ($ROUTES as $route)
{
$router->map($route[1], $BASE_ROUTE.$route[0], $route[2]);
}
$match = $router->match();
if($match && is_callable($match['target']))
{
call_user_func_array($match['target'], $match['params']);
}
else
{
$smarty->display('views/404.tpl');
}