[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. |
---|
[5] | 26 | ini_set('include_path', get_include_path() |
---|
| 27 | . PATH_SEPARATOR . COMMON_BASE |
---|
| 28 | . PATH_SEPARATOR . SITE_BASE . '/_templates' |
---|
| 29 | ); |
---|
| 30 | |
---|
| 31 | // Include core libraries. |
---|
| 32 | require_once 'codebase/lib/Utilities.inc.php'; |
---|
| 33 | require_once 'codebase/lib/Auth_SQL.inc.php'; |
---|
[27] | 34 | require_once 'codebase/lib/App.inc.php'; |
---|
[5] | 35 | |
---|
[27] | 36 | // Primary application class. |
---|
[5] | 37 | $app =& App::getInstance('admin'); |
---|
| 38 | $app->setParam(array( |
---|
| 39 | 'site_name' => 'WWW Admin', |
---|
| 40 | 'site_email' => 'hello@example.com', |
---|
| 41 | 'redirect_home_url' => '/admin/', |
---|
| 42 | |
---|
| 43 | 'date_format' => 'd M Y', |
---|
| 44 | 'sql_date_format' => '%e %b %Y', |
---|
| 45 | 'sql_time_format' => '%k:%i', |
---|
| 46 | 'character_set' => 'utf-8', |
---|
| 47 | |
---|
| 48 | 'enable_session' => true, |
---|
[27] | 49 | 'enable_db_session_handler' => false, |
---|
[5] | 50 | 'session_use_cookies' => true, |
---|
| 51 | |
---|
| 52 | 'enable_db' => true, |
---|
| 53 | 'db_always_debug' => false, |
---|
| 54 | 'db_debug' => true, |
---|
| 55 | 'db_die_on_failure' => true, |
---|
[27] | 56 | 'db_create_tables' => true, /// Disable after site launch. |
---|
[5] | 57 | |
---|
| 58 | 'display_errors' => true, |
---|
| 59 | |
---|
| 60 | 'log_directory' => COMMON_BASE . '/log', |
---|
| 61 | 'log_filename' => 'admin_log', |
---|
| 62 | 'log_file_priority' => LOG_DEBUG, |
---|
| 63 | 'log_email_priority' => false, |
---|
| 64 | 'log_sms_priority' => false, |
---|
| 65 | 'log_screen_priority' => false, |
---|
| 66 | 'log_to_email_address' => 'log@example.com', |
---|
| 67 | 'log_to_sms_address' => 'sms@example.com', |
---|
| 68 | )); |
---|
[27] | 69 | // DB credentials for command line scripts stored in a file with read rights |
---|
| 70 | // given only to the user who will be executing the scripts: -rw------- |
---|
| 71 | // This file includes App:: method calls so must be included after App. |
---|
[5] | 72 | require_once 'global/db_auth.inc.php'; |
---|
| 73 | |
---|
[27] | 74 | // Most configuration parameters must be set before starting the App. |
---|
[5] | 75 | $app->start(); |
---|
| 76 | |
---|
[27] | 77 | // User authentication. |
---|
[5] | 78 | $auth = new Auth_SQL('admin'); |
---|
| 79 | $auth->setParam(array( |
---|
| 80 | 'db_table' => 'admin_tbl', |
---|
| 81 | 'db_primary_key' => 'admin_id', |
---|
| 82 | 'login_url' => '/admin/login.php' |
---|
| 83 | )); |
---|
| 84 | |
---|
[27] | 85 | // Set CSS files. |
---|
[5] | 86 | require_once 'codebase/lib/CSS.inc.php'; |
---|
| 87 | $css = new CSS(); |
---|
| 88 | $css->setParam(array('cache_css' => true)); |
---|
[27] | 89 | $css->setFile('codebase/css/codebase.inc.css'); |
---|
| 90 | $css->setFile('codebase/css/utilities.inc.css'); |
---|
| 91 | $css->setFile('codebase/css/admin.inc.css'); |
---|
[5] | 92 | |
---|
[27] | 93 | // Nav class for titles, breadcrumbs, and page features. |
---|
[5] | 94 | require_once 'codebase/lib/Nav.inc.php'; |
---|
| 95 | $nav = new Nav(); |
---|
| 96 | $nav->path_delimiter = ' / '; |
---|
| 97 | $nav->last_crumb_format = '<b>%s</b>'; |
---|
| 98 | |
---|
| 99 | ?> |
---|