source: trunk/docs/example_config.inc.php @ 27

Last change on this file since 27 was 27, checked in by scdev, 18 years ago
File size: 3.4 KB
Line 
1<?php
2/**
3 * _config.inc.php lives in the document root of the site/application. It is the beginning of everything.
4 *
5 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information.
6 * @author  Quinn Comendant <quinn@strangecode.com>
7 * @version 1.2
8 * @since   03 Dec 2005 19:09:32
9 */
10
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';
13if (!preg_match('!^(/|[A-Z]:)!', __FILE__)) {
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);
15}
16
17// First things first. Define the globally used directory paths.
18// The parent directory of all application DocRoots.
19define('COMMON_BASE', realpath(dirname(__FILE__) . '/../'));
20
21// The DocRoot for this application. SITE_BASE is ifferent from $_SERVER['DOCUMENT_ROOT'] because the
22// latter does not change when using the apache Alias directive or URL Rewriting to define a site.
23define('SITE_BASE', dirname(__FILE__));
24
25// Set include path for all tempates.
26ini_set('include_path', get_include_path()
27    . PATH_SEPARATOR . COMMON_BASE
28    . PATH_SEPARATOR . SITE_BASE . '/_templates'
29);
30
31// Include core libraries.
32require_once 'codebase/lib/Utilities.inc.php';
33require_once 'codebase/lib/Auth_SQL.inc.php';
34require_once 'codebase/lib/App.inc.php';
35
36// Primary application class.
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,
49    'enable_db_session_handler' => false,
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,
56    'db_create_tables' => true, /// Disable after site launch.
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));
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.
72require_once 'global/db_auth.inc.php';
73
74// Most configuration parameters must be set before starting the App.
75$app->start();
76
77// User authentication.
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
85// Set CSS files.
86require_once 'codebase/lib/CSS.inc.php';
87$css = new CSS();
88$css->setParam(array('cache_css' => true));
89$css->setFile('codebase/css/codebase.inc.css');
90$css->setFile('codebase/css/utilities.inc.css');
91$css->setFile('codebase/css/admin.inc.css');
92
93// Nav class for titles, breadcrumbs, and page features.
94require_once 'codebase/lib/Nav.inc.php';
95$nav = new Nav();
96$nav->path_delimiter = ' / ';
97$nav->last_crumb_format = '<b>%s</b>';
98
99?>
Note: See TracBrowser for help on using the repository browser.