[5] | 1 | <?php |
---|
| 2 | /** |
---|
[27] | 3 | * _config.inc.php lives in the document root of the site/application. It is the beginning of everything. |
---|
[5] | 4 | * |
---|
| 5 | * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information. |
---|
| 6 | * @author Quinn Comendant <quinn@strangecode.com> |
---|
[27] | 7 | * @version 1.2 |
---|
| 8 | * @since 03 Dec 2005 19:09:32 |
---|
[5] | 9 | */ |
---|
| 10 | |
---|
[27] | 11 | // The constant __FILE__ must be an absolute directory path, starting with / on unix or C: on windows. |
---|
| 12 | // To work around a PHP bug always include this config file with: require_once dirname(__FILE__) . '/_config.inc.php'; |
---|
| 13 | if (!preg_match('!^(/|[A-Z]:)!', __FILE__)) { |
---|
[42] | 14 | trigger_error('_config.inc.php include must be specified with an absolute file path (eg: "require_once dirname(__FILE__) . \'/_config.inc.php\';"', E_USER_ERROR); |
---|
[5] | 15 | } |
---|
| 16 | |
---|
[27] | 17 | // First things first. Define the globally used directory paths. |
---|
| 18 | // The parent directory of all application DocRoots. |
---|
[5] | 19 | define('COMMON_BASE', realpath(dirname(__FILE__) . '/../')); |
---|
[27] | 20 | |
---|
[42] | 21 | // The DocRoot for this application. SITE_BASE is ifferent from $_SERVER['DOCUMENT_ROOT'] because the |
---|
[27] | 22 | // latter does not change when using the apache Alias directive or URL Rewriting to define a site. |
---|
[5] | 23 | define('SITE_BASE', dirname(__FILE__)); |
---|
| 24 | |
---|
[27] | 25 | // Set include path for all tempates. |
---|
[94] | 26 | ini_set('include_path', join(PATH_SEPARATOR, array( |
---|
| 27 | COMMON_BASE, |
---|
| 28 | SITE_BASE . '/_templates', |
---|
[101] | 29 | get_include_path(), |
---|
[94] | 30 | ))); |
---|
[5] | 31 | |
---|
| 32 | // Include core libraries. |
---|
| 33 | require_once 'codebase/lib/Utilities.inc.php'; |
---|
| 34 | require_once 'codebase/lib/Auth_SQL.inc.php'; |
---|
[27] | 35 | require_once 'codebase/lib/App.inc.php'; |
---|
[5] | 36 | |
---|
[27] | 37 | // Primary application class. |
---|
[5] | 38 | $app =& App::getInstance('admin'); |
---|
| 39 | $app->setParam(array( |
---|
| 40 | 'site_name' => 'WWW Admin', |
---|
| 41 | 'site_email' => 'hello@example.com', |
---|
| 42 | 'redirect_home_url' => '/admin/', |
---|
| 43 | |
---|
| 44 | 'date_format' => 'd M Y', |
---|
| 45 | 'sql_date_format' => '%e %b %Y', |
---|
| 46 | 'sql_time_format' => '%k:%i', |
---|
| 47 | 'character_set' => 'utf-8', |
---|
| 48 | |
---|
| 49 | 'enable_session' => true, |
---|
[27] | 50 | 'enable_db_session_handler' => false, |
---|
[5] | 51 | 'session_use_cookies' => true, |
---|
| 52 | |
---|
| 53 | 'enable_db' => true, |
---|
| 54 | 'db_always_debug' => false, |
---|
| 55 | 'db_debug' => true, |
---|
| 56 | 'db_die_on_failure' => true, |
---|
[27] | 57 | 'db_create_tables' => true, /// Disable after site launch. |
---|
[5] | 58 | |
---|
| 59 | 'display_errors' => true, |
---|
| 60 | |
---|
| 61 | 'log_directory' => COMMON_BASE . '/log', |
---|
| 62 | 'log_filename' => 'admin_log', |
---|
| 63 | 'log_file_priority' => LOG_DEBUG, |
---|
| 64 | 'log_email_priority' => false, |
---|
| 65 | 'log_sms_priority' => false, |
---|
| 66 | 'log_screen_priority' => false, |
---|
| 67 | 'log_to_email_address' => 'log@example.com', |
---|
| 68 | 'log_to_sms_address' => 'sms@example.com', |
---|
| 69 | )); |
---|
[27] | 70 | // DB credentials for command line scripts stored in a file with read rights |
---|
| 71 | // given only to the user who will be executing the scripts: -rw------- |
---|
[136] | 72 | // This file includes $app-> method calls so must be included after App. |
---|
[5] | 73 | require_once 'global/db_auth.inc.php'; |
---|
| 74 | |
---|
[136] | 75 | // Start application-based functionality: database, session, environment, ini setup, etc. |
---|
[27] | 76 | // Most configuration parameters must be set before starting the App. |
---|
[5] | 77 | $app->start(); |
---|
| 78 | |
---|
[136] | 79 | // Global DB object. Automatically preconfigured by $app->start(). |
---|
| 80 | $db =& DB::getInstance(); |
---|
| 81 | |
---|
[27] | 82 | // User authentication. |
---|
[5] | 83 | $auth = new Auth_SQL('admin'); |
---|
| 84 | $auth->setParam(array( |
---|
| 85 | 'db_table' => 'admin_tbl', |
---|
| 86 | 'db_primary_key' => 'admin_id', |
---|
| 87 | 'login_url' => '/admin/login.php' |
---|
| 88 | )); |
---|
| 89 | |
---|
[27] | 90 | // Set CSS files. |
---|
[5] | 91 | require_once 'codebase/lib/CSS.inc.php'; |
---|
| 92 | $css = new CSS(); |
---|
| 93 | $css->setParam(array('cache_css' => true)); |
---|
[27] | 94 | $css->setFile('codebase/css/codebase.inc.css'); |
---|
| 95 | $css->setFile('codebase/css/utilities.inc.css'); |
---|
| 96 | $css->setFile('codebase/css/admin.inc.css'); |
---|
[5] | 97 | |
---|
[202] | 98 | // Global navigation elements object. |
---|
| 99 | require_once 'codebase/lib/Navigation.inc.php'; |
---|
| 100 | $nav = new Navigation(array( |
---|
| 101 | 'path_delimiter' => ' / ', |
---|
| 102 | 'last_crumb_format' => '<b>%s</b>', |
---|
| 103 | )); |
---|
[5] | 104 | |
---|
| 105 | ?> |
---|