-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincludes.php
57 lines (43 loc) · 1.58 KB
/
includes.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
<?php
$dir = dirname(__FILE__);
require("$dir/autoload.php");
require_once("$dir/vendor/autoload.php");
require_once('vendor/nitroxy/basic-object/ValidatingBasicObject.php');
require_once("$dir/vendor/michelf/php-markdown/MarkdownHelper.php");
require("$dir/libs/MC.php");
require("$dir/vendor/nitroxy/nxauth/include.php");
require("$dir/config.php");
BasicObject::$output_htmlspecialchars = true;
$db_settings = $settings['database'];
$db = new MySQLi($db_settings['host'], $db_settings['user'], $db_settings['password'], $db_settings['name']);
unset($db_settings);
$crew_groups = array('Kreativ'); /* Crew groups that are admins */
NXAuth::init($settings['cas_config']);
require("$dir/auth.php");
try {
$mc = MC::get_instance();
BasicObject::enable_structure_cache($mc, "nvote_");
} catch(Exception $e) {
trigger_error("Exception when trying to enable BasicObject structure cache: ".$e->getMessage());
// We can live without memcache
}
$event_short_name = Setting::get('event', NXAPI::current_event(), true);
$event = Event::one(array('short_name' => $event_short_name));
if(!$event) {
$api_event = NXAPI::event_info(array('event' => $event_short_name));
$event = new Event(array(
'short_name' => $event_short_name,
'name' => $api_event->name
));
$event->commit();
}
if(!isset($keep_settings) || !$keep_settings) unset($settings);
/* Include helpers */
$helper_dirs = dir("$dir/helpers");
while(($f = $helper_dirs->read()) !== false ) {
$f = "$dir/helpers/$f";
if(is_file($f) && pathinfo($f, PATHINFO_EXTENSION) == "php") {
require $f;
}
}
?>