Changeset 295 for trunk/docs


Ignore:
Timestamp:
Dec 16, 2007 7:21:57 AM (16 years ago)
Author:
quinn
Message:

Updated example config file. Added admin2.inc.css and minor corrections into HTML. Module maker fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/examples/_config.inc.php

    r288 r295  
    11<?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.
    43 *
    54 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information.
    65 * @author  Quinn Comendant <quinn@strangecode.com>
    7  * @version 1.2
     6 * @version 1.3
    87 * @since   03 Dec 2005 19:09:32
    98 */
    10 
     9 
    1110// The constant __FILE__ must be an absolute directory path, starting with / on unix or C: on windows.
    1211// To work around a PHP bug always include this config file with: require_once dirname(__FILE__) . '/_config.inc.php';
     
    1918define('COMMON_BASE', realpath(dirname(__FILE__) . '/../'));
    2019
    21 // The DocRoot for this application. SITE_BASE is ifferent from $_SERVER['DOCUMENT_ROOT'] because the
     20// The DocRoot for this application. SITE_BASE is different from $_SERVER['DOCUMENT_ROOT'] because the
    2221// latter does not change when using the apache Alias directive or URL Rewriting to define a site.
    2322define('SITE_BASE', dirname(__FILE__));
    2423
    25 // Set include path for all tempates.
     24// Set include path for all templates.
    2625ini_set('include_path', join(PATH_SEPARATOR, array(
    2726    COMMON_BASE,
     
    3231// Include core libraries.
    3332require_once 'codebase/lib/Utilities.inc.php';
    34 require_once 'codebase/lib/Auth_SQL.inc.php';
    3533require_once 'codebase/lib/App.inc.php';
    3634
    3735// Primary application class.
    38 $app =& App::getInstance('example.org');
     36$app =& App::getInstance('public');
    3937$app->setParam(array(
    40     'site_name' => 'My example site',
     38    'site_name' => 'WWW Public Site',
    4139    'site_email' => 'hello@example.com',
    4240    'redirect_home_url' => '/',
     
    4745    'character_set' => 'utf-8',
    4846
    49     'enable_session' => false,
     47    'enable_session' => true,
    5048    'enable_db_session_handler' => false,
    5149    'session_use_cookies' => true,
     50    'session_use_trans_sid' => true, // Disable this for high-security sites where session-ID theft is a risk.
    5251
    53     'enable_db' => false,
     52    // 'ssl_domain' => 'www.example.com',
     53    // 'ssl_enabled' => ($_SERVER['SERVER_NAME'] == 'www.example.com'),
     54
     55    'enable_db' => true,
    5456    'db_always_debug' => false,
    5557    'db_debug' => true,
    5658    'db_die_on_failure' => true,
    57     'db_create_tables' => true, /// Disable after site launch.
     59    'db_create_tables' => true, // Disable after site launch.
    5860
    5961    'display_errors' => true,
     
    6567    'log_sms_priority' => false,
    6668    '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',
    6971));
    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
     73if (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}
    7479
    7580// Start application-based functionality: database, session, environment, ini setup, etc.
     
    7782$app->start();
    7883
    79 // Global DB object. Automatically preconfigured by $app->start().
     84// Global DB object. Automatically pre-configured by $app->start().
    8085$db =& DB::getInstance();
    8186
    82 // User authentication.
    83 $auth = new Auth_SQL('user');
     87// Global Auth object.
     88require_once 'codebase/lib/Auth_SQL.inc.php';
     89$auth = new Auth_SQL('public');
    8490$auth->setParam(array(
    8591    'db_table'          => 'user_tbl',
    8692    '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
    8896));
    8997
    90 // Set CSS files.
     98// Load preferences for the user.
     99require_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.
     114require_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.
     123require_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.
    91128require_once 'codebase/lib/CSS.inc.php';
    92129$css = new CSS();
    93 $css->setParam(array('cache_css' => true));
     130$css->setParam(array('cache_css' => false)); /// Enable caching after site launch.
    94131$css->setFile('codebase/css/codebase.inc.css');
    95132$css->setFile('codebase/css/utilities.inc.css');
    96 $css->setFile('html/css/screen.inc.css');
     133// $css->setFile('html/css/screen.inc.css');
    97134
    98 // Global navigation elements object.
     135// Nav class for titles, breadcrumbs, and page features.
     136// Global navigation titles, breadcrumbs, and page features.
    99137require_once 'codebase/lib/Navigation.inc.php';
    100138$nav = new Navigation(array(
     
    103141));
    104142
     143// Global site-specific configuration.
     144// $cfg = array();
     145// require_once 'global/config.inc.php';
     146
    105147?>
Note: See TracChangeset for help on using the changeset viewer.