Changeset 295 for trunk/docs
- Timestamp:
- Dec 16, 2007 7:21:57 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/examples/_config.inc.php
r288 r295 1 1 <?php 2 /** 3 * _config.inc.php lives in the document root of the site/application. It is the beginning of everything. 2 /** * _config.inc.php lives in the document root of the site/application. It is the beginning of everything. 4 3 * 5 4 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information. 6 5 * @author Quinn Comendant <quinn@strangecode.com> 7 * @version 1. 26 * @version 1.3 8 7 * @since 03 Dec 2005 19:09:32 9 8 */ 10 9 11 10 // The constant __FILE__ must be an absolute directory path, starting with / on unix or C: on windows. 12 11 // To work around a PHP bug always include this config file with: require_once dirname(__FILE__) . '/_config.inc.php'; … … 19 18 define('COMMON_BASE', realpath(dirname(__FILE__) . '/../')); 20 19 21 // The DocRoot for this application. SITE_BASE is ifferent from $_SERVER['DOCUMENT_ROOT'] because the20 // The DocRoot for this application. SITE_BASE is different from $_SERVER['DOCUMENT_ROOT'] because the 22 21 // latter does not change when using the apache Alias directive or URL Rewriting to define a site. 23 22 define('SITE_BASE', dirname(__FILE__)); 24 23 25 // Set include path for all temp ates.24 // Set include path for all templates. 26 25 ini_set('include_path', join(PATH_SEPARATOR, array( 27 26 COMMON_BASE, … … 32 31 // Include core libraries. 33 32 require_once 'codebase/lib/Utilities.inc.php'; 34 require_once 'codebase/lib/Auth_SQL.inc.php';35 33 require_once 'codebase/lib/App.inc.php'; 36 34 37 35 // Primary application class. 38 $app =& App::getInstance(' example.org');36 $app =& App::getInstance('public'); 39 37 $app->setParam(array( 40 'site_name' => ' My example site',38 'site_name' => 'WWW Public Site', 41 39 'site_email' => 'hello@example.com', 42 40 'redirect_home_url' => '/', … … 47 45 'character_set' => 'utf-8', 48 46 49 'enable_session' => false,47 'enable_session' => true, 50 48 'enable_db_session_handler' => false, 51 49 'session_use_cookies' => true, 50 'session_use_trans_sid' => true, // Disable this for high-security sites where session-ID theft is a risk. 52 51 53 'enable_db' => false, 52 // 'ssl_domain' => 'www.example.com', 53 // 'ssl_enabled' => ($_SERVER['SERVER_NAME'] == 'www.example.com'), 54 55 'enable_db' => true, 54 56 'db_always_debug' => false, 55 57 'db_debug' => true, 56 58 'db_die_on_failure' => true, 57 'db_create_tables' => true, // /Disable after site launch.59 'db_create_tables' => true, // Disable after site launch. 58 60 59 61 'display_errors' => true, … … 65 67 'log_sms_priority' => false, 66 68 'log_screen_priority' => false, 67 'log_to_email_address' => 'log@ example.com',68 'log_to_sms_address' => 'sms @example.com',69 'log_to_email_address' => 'log@strangecode.com', 70 'log_to_sms_address' => 'sms-quinn@strangecode.com', 69 71 )); 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------- 72 // This file includes $app-> method calls so must be included after App. 73 // require_once 'global/db_auth.inc.php'; 72 73 if (defined('_CLI')) { 74 // DB credentials for command line scripts stored in a file with read rights 75 // given only to the user who will be executing the scripts: -rw------- 76 // This file includes $app-> method calls so this must be included after App::getInstance(). 77 require_once 'global/db_auth.inc.php'; 78 } 74 79 75 80 // Start application-based functionality: database, session, environment, ini setup, etc. … … 77 82 $app->start(); 78 83 79 // Global DB object. Automatically pre configured by $app->start().84 // Global DB object. Automatically pre-configured by $app->start(). 80 85 $db =& DB::getInstance(); 81 86 82 // User authentication. 83 $auth = new Auth_SQL('user'); 87 // Global Auth object. 88 require_once 'codebase/lib/Auth_SQL.inc.php'; 89 $auth = new Auth_SQL('public'); 84 90 $auth->setParam(array( 85 91 'db_table' => 'user_tbl', 86 92 'db_primary_key' => 'user_id', 87 'login_url' => '/login.php' 93 'login_url' => '/login.php', 94 'login_timeout' => 260000, // 72 hours 95 'idle_timeout' => 86400, // 24 hours 88 96 )); 89 97 90 // Set CSS files. 98 // Load preferences for the user. 99 require_once 'codebase/lib/Prefs.inc.php'; 100 $prefs = new Prefs('permanent'); 101 $prefs->setParam(array( 102 'persistent' => $auth->isLoggedIn(), 103 'user_id' => $auth->get('user_id'), 104 )); 105 $prefs->setDefaults(array( 106 )); 107 $prefs->load(); 108 // Temporary prefs. 109 $tmp_prefs = new Prefs('temporary'); 110 $tmp_prefs->setDefaults(array( 111 )); 112 113 // Global record-locking object. 114 require_once 'codebase/lib/Lock.inc.php'; 115 $lock =& Lock::getInstance($auth); 116 $lock->setParam(array( 117 'timeout' => 0, 118 'auto_timeout' => 1800, 119 'error_url' => '/lock.php', 120 )); 121 122 // Global cache object. 123 require_once 'codebase/lib/Cache.inc.php'; 124 $cache = new Cache('global'); 125 $cache->setParam(array('enabled' => true)); 126 127 // Setup CSS files to include. These will always be available. 91 128 require_once 'codebase/lib/CSS.inc.php'; 92 129 $css = new CSS(); 93 $css->setParam(array('cache_css' => true));130 $css->setParam(array('cache_css' => false)); /// Enable caching after site launch. 94 131 $css->setFile('codebase/css/codebase.inc.css'); 95 132 $css->setFile('codebase/css/utilities.inc.css'); 96 $css->setFile('html/css/screen.inc.css');133 // $css->setFile('html/css/screen.inc.css'); 97 134 98 // Global navigation elements object. 135 // Nav class for titles, breadcrumbs, and page features. 136 // Global navigation titles, breadcrumbs, and page features. 99 137 require_once 'codebase/lib/Navigation.inc.php'; 100 138 $nav = new Navigation(array( … … 103 141 )); 104 142 143 // Global site-specific configuration. 144 // $cfg = array(); 145 // require_once 'global/config.inc.php'; 146 105 147 ?>
Note: See TracChangeset
for help on using the changeset viewer.