* Copyright 2001-2010 Strangecode, LLC * * This file is part of The Strangecode Codebase. * * The Strangecode Codebase is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your option) * any later version. * * The Strangecode Codebase is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * The Strangecode Codebase. If not, see . */ /** * _config.inc.php lives in the document root of the site/application. It is the beginning of everything. * * @author Quinn Comendant * @version 1.3 * @since 03 Dec 2005 19:09:32 */ // The constant __FILE__ must be an absolute directory path, starting with / on unix or C: on windows. // To work around a PHP bug always include this config file with: require_once dirname(__FILE__) . '/_config.inc.php'; if (!preg_match('!^(/|[A-Z]:)!', __FILE__)) { 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); } // First things first. Define the globally used directory paths. // The parent directory of all application DocRoots. define('COMMON_BASE', realpath(dirname(__FILE__) . '/../')); // The DocRoot for this application. SITE_BASE is different from $_SERVER['DOCUMENT_ROOT'] because the // latter does not change when using the apache Alias directive or URL Rewriting to define a site. define('SITE_BASE', dirname(__FILE__)); // Set include path for all templates and libraries. ini_set('include_path', join(PATH_SEPARATOR, array( COMMON_BASE, SITE_BASE . '/_templates', get_include_path(), ))); // Include core libraries. require_once 'codebase/lib/Utilities.inc.php'; require_once 'codebase/lib/App.inc.php'; // Primary application class. $app =& App::getInstance('public'); $app->setParam(array( 'site_name' => 'WWW Public Site', 'site_email' => 'hello@example.com', 'redirect_home_url' => '/', 'images_path' => '/i', 'date_format' => 'd M Y', 'sql_date_format' => '%e %b %Y', 'sql_time_format' => '%k:%i', 'character_set' => 'utf-8', 'enable_session' => true, 'enable_db_session_handler' => false, 'session_use_cookies' => true, 'session_use_trans_sid' => true, // Disable this for high-security sites where session-ID theft is a risk. // 'ssl_domain' => 'www.example.com', // 'ssl_enabled' => ($_SERVER['SERVER_NAME'] == 'www.example.com'), 'enable_db' => true, 'db_always_debug' => false, 'db_debug' => true, 'db_die_on_failure' => true, 'db_create_tables' => true, // Disable after site launch. 'display_errors' => true, 'log_directory' => COMMON_BASE . '/log', 'log_filename' => 'site_log', 'log_file_priority' => LOG_DEBUG, 'log_email_priority' => false, 'log_sms_priority' => false, 'log_screen_priority' => false, 'log_to_email_address' => 'log@strangecode.com', 'log_to_sms_address' => 'sms-quinn@strangecode.com', )); if (defined('_CLI')) { // DB credentials for command line scripts stored in a file with read rights // given only to the user who will be executing the scripts: -rw------- // This file includes $app-> method calls so this must be included after App::getInstance(). require_once 'global/db_auth.inc.php'; } // Start application-based functionality: database, session, environment, ini setup, etc. // Most configuration parameters must be set before starting the App. $app->start(); // Global DB object. Automatically pre-configured by $app->start(). $db =& DB::getInstance(); // Global Auth object. require_once 'codebase/lib/Auth_SQL.inc.php'; $auth = new Auth_SQL('public'); $auth->setParam(array( 'db_table' => 'user_tbl', 'db_primary_key' => 'user_id', 'login_url' => '/login.php', 'login_timeout' => 260000, // 72 hours 'idle_timeout' => 86400, // 24 hours )); // Load preferences for the user. require_once 'codebase/lib/Prefs.inc.php'; $prefs = new Prefs('permanent'); $prefs->setParam(array( 'persistent' => $auth->isLoggedIn(), 'user_id' => $auth->get('user_id'), )); $prefs->setDefaults(array( )); $prefs->load(); // Temporary prefs. $tmp_prefs = new Prefs('temporary'); $tmp_prefs->setDefaults(array( )); // Global record-locking object. require_once 'codebase/lib/Lock.inc.php'; $lock =& Lock::getInstance($auth); $lock->setParam(array( 'timeout' => 0, 'auto_timeout' => 1800, 'error_url' => '/lock.php', )); // Global cache object. require_once 'codebase/lib/Cache.inc.php'; $cache = new Cache('global'); $cache->setParam(array('enabled' => true)); // Setup CSS files to include. These will always be available. require_once 'codebase/lib/CSS.inc.php'; $css = new CSS(); $css->setParam(array('cache_css' => false)); /// Enable caching after site launch. $css->setFile('codebase/css/codebase.inc.css'); $css->setFile('codebase/css/utilities.inc.css'); // $css->setFile('html/css/screen.inc.css'); // Nav class for titles, breadcrumbs, and page features. // Global navigation titles, breadcrumbs, and page features. require_once 'codebase/lib/Navigation.inc.php'; $nav = new Navigation(array( 'path_delimiter' => ' / ', 'last_crumb_format' => '%s', )); // Global site-specific configuration. // $cfg = array(); // require_once 'global/config.inc.php'; ?>