-
Notifications
You must be signed in to change notification settings - Fork 24
/
exponent.php
162 lines (142 loc) · 4.38 KB
/
exponent.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
/**
* This file is part of Exponent
* Exponent is free software; you can redistribute
* it and/or modify it under the terms of the GNU
* General Public License as published by the Free
* Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The file that initializes everything
*
* @link http://www.gnu.org/licenses/gpl.txt GPL http://www.gnu.org/licenses/gpl.txt
* @package Exponent-CMS
* @copyright 2004-2011 OIC Group, Inc.
* @author Adam Kessler <adam@oicgroup.net>
* @version 2.0.0
*/
require_once('exponent_common.php');
// Initialize the AutoLoader Subsystem
require_once(BASE.'subsystems/autoloader.php');
// Initialize the Sessions Subsystem
require_once(BASE.'subsystems/sessions.php');
// Initializes the session.
exponent_sessions_initialize();
// initialize useful/needed constants throughout the system
require_once(BASE.'exponent_constants.php');
// Initialize the language subsystem
require_once(BASE.'subsystems/lang.php');
exponent_lang_initialize();
// Load 2.0 lang
expLang::loadLang();
// Initialize the Core Subsystem
require_once(BASE.'subsystems/core.php');
// Initialize the Database Subsystem
require_once(BASE.'subsystems/database.php');
/**
* The exponent database object
*
* @global mysqli_database $db the exponent database object
* @name $db
*/
$db = exponent_database_connect(DB_USER,DB_PASS,DB_HOST.':'.DB_PORT,DB_NAME);
// Initialize the Modules Subsystem.
require_once(BASE.'subsystems/modules.php');
exponent_modules_initialize();
// Initialize the Template Subsystem.
require_once(BASE.'subsystems/template.php');
// Initialize the Permissions Subsystem.
require_once(BASE.'subsystems/permissions.php');
// Initialize the Flow Subsystem.
if (!defined('SYS_FLOW')) require_once(BASE.'subsystems/flow.php');
/**
* the browsing history object
* @global expHistory $history
* @name $history
*/
$history = new expHistory(); //<--This is the new flow subsystem and will be replacing the above.
// Initialize the User Subsystem.
require_once(BASE.'subsystems/users.php');
// Initialize the javascript subsystem
if (!defined('SYS_JAVASCRIPT')) require_once(BASE.'subsystems/javascript.php');
// Initialize the new MVC framework
require_once(BASE.'framework/core/expFramework.php');
/**
* the list of available/active controllers
* @global array $available_controllers
* @name $available_controllers
*/
$available_controllers = intializeControllers();
if (exponent_javascript_inAjaxAction()) set_error_handler('handleErrors');
// Validate the session. This will populate the $user variable
/**
* the current user object
* @global user $user
* @name $user
*/
$user = new user();
exponent_sessions_validate();
// Initialize permissions variables
exponent_permissions_initialize();
/**
* initialize the expRouter
* the routing/link/url object
* @global expRouter $router
* @name $router
*/
$router = new expRouter();
/**
* initialize this users cart if they have ecomm installed.
* the shopping cart/order object
* @global order $order
* @name $order
*/
if (controllerExists('cart')) $order = order::getUserCart();
/**
* Initialize the navigation hierarchy
* the list of sections/pages for the site
* @global array $sections
* @name $sections
*/
$sections = exponent_core_initializeNavigation();
/**
* dumps the passed variable to screen, but only if in development mode
* @param $var the variable to dump
* @param bool $halt if set to true will halt execution
* @return void
*/
function eDebug($var, $halt=false){
if (DEVELOPMENT) {
echo "<xmp>";
print_r($var);
echo "</xmp>";
if ($halt) die();
}
}
/**
* dumps the passed variable to a log, but only if in development mode
* @param $var the variable to log
* @param string $type the type of entry to record
* @param string $path the pathname for the log file
* @param string $minlevel
* @return void
*/
function eLog($var, $type='', $path='', $minlevel='0') {
if($type == '') { $type = "INFO"; }
if($path == '') { $path = BASE . 'tmp/exponent.log'; }
if (DEVELOPMENT >= $minlevel) {
if (is_writable ($path) || !file_exists($path)) {
if (!$log = fopen ($path, "ab")) {
eDebug("Error opening log file for writing.");
} else {
if (fwrite ($log, $type . ": " . $var . "\r\n") === FALSE) {
eDebug("Error writing to log file ($path).");
}
fclose ($log);
}
} else {
eDebug ("Log file ($path) not writable.");
}
}
}
?>