forked from Code4SierraLeone/MembaO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.php
113 lines (92 loc) · 3.36 KB
/
init.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/**
* Init
*
* @package Membao
* @author Alan Kawamara
* @copyright 2017
*/
if (!defined("_VALID_PHP"))
die('Direct access to this location is not allowed.');
?>
<?php //error_reporting(E_ALL);
if (substr(PHP_OS, 0, 3) == "WIN") {
$BASEPATH = str_replace("admin\\init.php", "", realpath(__FILE__));
} else {
$BASEPATH = str_replace("admin/init.php", "", realpath(__FILE__));
}
define("BASEPATH", $BASEPATH);
$configFile = BASEPATH . "lib/config.ini.php";
if (file_exists($configFile)) {
require_once($configFile);
} else {
header("Location: setup/");
}
//include_once(BASEPATH . "language.php");
require_once(BASEPATH . "lib/class_db.php");
require_once(BASEPATH . "lib/class_registry.php");
Registry::set('Database',new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE));
$db = Registry::get("Database");
$db->connect();
//Include Functions
require_once(BASEPATH . "lib/functions.php");
require_once(BASEPATH . "lib/fn_seo.php");
require_once(BASEPATH . "lib/class_filter.php");
$request = new Filter();
//Start Core Class
require_once(BASEPATH . "lib/class_core.php");
Registry::set('Core',new Core());
$core = Registry::get("Core");
//Start Language Class
require_once(BASEPATH . "lib/class_language.php");
Registry::set('Lang',new Lang());
$lang = Registry::get("Lang");
//StartUser Class
require_once(BASEPATH . "lib/class_user.php");
Registry::set('Users',new Users());
$user = Registry::get("Users");
//Load Content Class
require_once(BASEPATH . "lib/class_content.php");
Registry::set('Content',new Content());
$content = Registry::get("Content");
//Load Bills Class
require_once(BASEPATH . "lib/class_bills.php");
Registry::set('Bills',new Bills());
$bill = Registry::get("Bills");
//Load Committees Class
require_once(BASEPATH . "lib/class_committees.php");
Registry::set('Committees',new Committees());
$committee = Registry::get("Committees");
//Load Leader Class
require_once(BASEPATH . "lib/class_leaders.php");
Registry::set('Leaders',new Leaders());
$leader = Registry::get("Leaders");
//Start Uploader Class
require_once(BASEPATH . "lib/class_fm.php");
Registry::set('FM',new FM());
//Start Minify Class
require_once (BASEPATH . "lib/class_minify.php");
Registry::set('Minify', new Minify());
//Start Paginator Class
require_once(BASEPATH . "lib/class_paginate.php");
$pager = Paginator::instance();
if (isset($_SERVER['HTTPS'])) {
$protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http";
} else {
$protocol = 'http';
}
$dir = (Registry::get("Core")->site_dir) ? '/' . Registry::get("Core")->site_dir : '';
$url = preg_replace("#/+#", "/", $_SERVER['HTTP_HOST'] . $dir);
$site_url = $protocol . "://" . $url;
define("SITEURL", $site_url);
define("ADMINURL", $site_url."/admin");
define("UPLOADS", BASEPATH . "uploads/");
define("UPLOADURL", SITEURL . "/uploads/");
define("PRODIMGPATH", BASEPATH . "uploads/leaders/");
define("PRODIMGURL", SITEURL . "/uploads/leaders/");
define("PRODGALPATH", BASEPATH . "uploads/bill_audio/");
define("PRODGALURL", SITEURL . "/uploads/bill_audio/");
define("THEME", BASEPATH . "admin/assets");
define("THEMEU", SITEURL . "/admin/assets");
setlocale(LC_TIME, $core->setLocale());
?>