-
Notifications
You must be signed in to change notification settings - Fork 10
/
startup.php
58 lines (50 loc) · 1.35 KB
/
startup.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
<?php
if (getenv('ENVIRONMENT') == 'DEV') {
include_once( dirname( __FILE__ ) . '/config.dev.php');
} else {
include_once( dirname( __FILE__ ) . '/config.php' );
}
// System Setup
if ( isset( $LOG ) )
return;
$LOG;
$DB;
if ( !isset( $DB ) ) {
$DB = new yapo_mysql( DB_HOSTNAME, DB_DATABASE, DB_USERNAME, DB_PASSWORD );
}
if ( !DO_SETUP ) {
if ( !isset( $LOG ) ) {
$LOG = new Log();
}
$classes = scandir( DIR_SYSTEMLIB );
foreach ( $classes as $k => $file ) {
$path_parts = pathinfo( $file );
if ( 'php' == $path_parts[ 'extension' ] ) {
require_once( DIR_SYSTEMLIB . $path_parts[ 'basename' ] );
}
}
$classes = scandir( DIR_ORK3 );
$GLOBALS[ 'ORK3_SYSTEM' ] = [ ];
require_once( DIR_ORK3 . 'class.Ork3.php' );
$ORK3 = new Ork3();
$LIB = new Ork3LibContainer();
foreach ( $classes as $k => $file ) {
$path_parts = pathinfo( $file );
if ( 'php' == $path_parts[ 'extension' ] ) {
require_once( DIR_ORK3 . $path_parts[ 'basename' ] );
}
}
foreach ( $classes as $k => $file ) {
$path_parts = pathinfo( $file );
if ( 'php' == $path_parts[ 'extension' ] ) {
$class = explode( '.', $path_parts[ 'basename' ] );
$class_name = $class[ 1 ];
$chad_name = strtolower( $class_name );
if ( 'php' != $class_name && 'Ork3' != $class_name ) {
$LIB->$chad_name = new $class_name();
}
}
}
Ork3::$Lib = $LIB;
Ork3::$Lib->Log = $LOG;
}