1 | <?php |
---|
2 | /* module_maker/_config.inc.php |
---|
3 | * code by strangecode :: www.strangecode.com :: this document contains copyrighted information. */ |
---|
4 | |
---|
5 | // Test argument. |
---|
6 | if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) { |
---|
7 | // Determine common site directory. |
---|
8 | $common_base = realpath($_SERVER['argv'][1]); |
---|
9 | |
---|
10 | // First arg is path to current site. Realpath removes trailing /s |
---|
11 | define('COMMON_BASE', $common_base); |
---|
12 | } else { |
---|
13 | die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n"); |
---|
14 | } |
---|
15 | |
---|
16 | // Make sure necessary files exist. |
---|
17 | if (!file_exists(COMMON_BASE . '/global/db_auth.inc.php')) { |
---|
18 | die("Error: First argument directory must contain the global/db_auth.inc.php file with valid MySQL credentials.\n"); |
---|
19 | } |
---|
20 | |
---|
21 | // Set include path. |
---|
22 | ini_set('include_path', |
---|
23 | PATH_SEPARATOR . '/usr/lib/php' |
---|
24 | . PATH_SEPARATOR . COMMON_BASE |
---|
25 | ); |
---|
26 | |
---|
27 | // Include core libraries. |
---|
28 | require_once 'codebase/lib/App.inc.php'; |
---|
29 | require_once 'codebase/lib/Utilities.inc.php'; |
---|
30 | require_once 'codebase/lib/Auth_SQL.inc.php'; |
---|
31 | |
---|
32 | $app =& App::getInstance('module_maker'); |
---|
33 | $app->setParam(array( |
---|
34 | 'site_name' => 'Module Maker', |
---|
35 | 'site_email' => 'codebase@strangecode.com', |
---|
36 | 'enable_session' => false, |
---|
37 | 'enable_db' => true, |
---|
38 | 'db_always_debug' => false, |
---|
39 | 'db_debug' => true, |
---|
40 | 'db_die_on_failure' => true, |
---|
41 | 'display_errors' => true, |
---|
42 | 'error_reporting' => E_ALL, |
---|
43 | 'log_screen_priority' => LOG_DEBUG, |
---|
44 | )); |
---|
45 | require_once 'global/db_auth.inc.php'; |
---|
46 | |
---|
47 | // Start application-based functionality: database, session, environment, ini setup, etc. |
---|
48 | // Most configuration parameters must be set before starting the App. |
---|
49 | $app->start(); |
---|
50 | |
---|
51 | // Global DB object. Automatically pre-configured by $app->start(). |
---|
52 | $db =& DB::getInstance(); |
---|
53 | |
---|
54 | |
---|
55 | ?> |
---|