-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.php
36 lines (31 loc) · 873 Bytes
/
bootstrap.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
<?php
/**
* Prepare for work, tie your shoes and get ready.
*/
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(__FILE__));
define('FUNCTIONS', ROOT . DS . 'functions');
define('CLASSES', ROOT . DS . 'classes');
define('JS', ROOT . DS . 'js');
/**
* ikluderar alla php filer ifrån en mapp
*/
function includeAll($path) {
foreach (glob($path . '/*.php') as $filename) {
include_once($filename);
}
}
includeAll(FUNCTIONS);
includeAll(CLASSES);
if(file_exists(ROOT . DS . 'database.php')) {
include_once ROOT . DS . 'database.php';
} else {
require_once ROOT . DS . 'database.default.php';
}
if(!mysql_connect($database['server'], $database['user'], $database['password'])) {
trigger_error('db connection not established', E_USER_NOTICE);
}
if(!mysql_select_db($database['db_name'])) {
trigger_error('db could not be selected', E_USER_NOTICE);
}
?>