2009-02-24 09:13:09 +02:00
|
|
|
<?php defined('SYSPATH') or die('No direct script access.');
|
|
|
|
|
2010-12-14 05:12:53 +02:00
|
|
|
// -- Environment setup --------------------------------------------------------
|
|
|
|
|
|
|
|
// Load the core Kohana class
|
|
|
|
require SYSPATH.'classes/kohana/core'.EXT;
|
|
|
|
|
|
|
|
if (is_file(APPPATH.'classes/kohana'.EXT))
|
|
|
|
{
|
|
|
|
// Application extends the core
|
|
|
|
require APPPATH.'classes/kohana'.EXT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Load empty core extension
|
|
|
|
require SYSPATH.'classes/kohana'.EXT;
|
|
|
|
}
|
2009-05-20 22:13:02 +03:00
|
|
|
|
2009-05-21 20:43:09 +03:00
|
|
|
/**
|
|
|
|
* Set the default time zone.
|
2009-06-14 17:04:50 +03:00
|
|
|
*
|
2010-05-21 00:56:46 +03:00
|
|
|
* @see http://kohanaframework.org/guide/using.configuration
|
2009-05-21 20:43:09 +03:00
|
|
|
* @see http://php.net/timezones
|
|
|
|
*/
|
|
|
|
date_default_timezone_set('America/Chicago');
|
|
|
|
|
2009-11-24 03:20:48 +02:00
|
|
|
/**
|
|
|
|
* Set the default locale.
|
|
|
|
*
|
2010-05-21 00:56:46 +03:00
|
|
|
* @see http://kohanaframework.org/guide/using.configuration
|
2009-11-24 03:20:48 +02:00
|
|
|
* @see http://php.net/setlocale
|
|
|
|
*/
|
|
|
|
setlocale(LC_ALL, 'en_US.utf-8');
|
|
|
|
|
2009-05-20 22:13:02 +03:00
|
|
|
/**
|
|
|
|
* Enable the Kohana auto-loader.
|
2009-06-14 17:04:50 +03:00
|
|
|
*
|
2010-05-21 00:56:46 +03:00
|
|
|
* @see http://kohanaframework.org/guide/using.autoloading
|
2009-05-21 20:43:09 +03:00
|
|
|
* @see http://php.net/spl_autoload_register
|
2009-05-20 22:13:02 +03:00
|
|
|
*/
|
|
|
|
spl_autoload_register(array('Kohana', 'auto_load'));
|
|
|
|
|
2009-10-31 17:47:46 +02:00
|
|
|
/**
|
|
|
|
* Enable the Kohana auto-loader for unserialization.
|
|
|
|
*
|
|
|
|
* @see http://php.net/spl_autoload_call
|
|
|
|
* @see http://php.net/manual/var.configuration.php#unserialize-callback-func
|
|
|
|
*/
|
|
|
|
ini_set('unserialize_callback_func', 'spl_autoload_call');
|
|
|
|
|
2010-12-14 05:12:53 +02:00
|
|
|
// -- Configuration and initialization -----------------------------------------
|
2009-05-20 22:13:02 +03:00
|
|
|
|
2010-10-27 02:58:38 +03:00
|
|
|
/**
|
|
|
|
* Set the default language
|
|
|
|
*/
|
|
|
|
I18n::lang('en-us');
|
|
|
|
|
2010-09-21 01:28:44 +03:00
|
|
|
/**
|
2011-01-02 03:27:48 +02:00
|
|
|
* Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
|
2010-12-13 18:58:03 +02:00
|
|
|
*
|
2011-01-10 18:15:47 +02:00
|
|
|
* Note: If you supply an invalid environment name, a PHP warning will be thrown
|
|
|
|
* saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
|
2010-09-21 01:28:44 +03:00
|
|
|
*/
|
2011-01-02 03:27:48 +02:00
|
|
|
if (getenv('KOHANA_ENV') !== FALSE)
|
2010-09-21 01:28:44 +03:00
|
|
|
{
|
2011-01-10 18:15:47 +02:00
|
|
|
Kohana::$environment = constant('Kohana::'.strtoupper(getenv('KOHANA_ENV')));
|
2010-09-21 01:28:44 +03:00
|
|
|
}
|
|
|
|
|
2009-05-20 22:13:02 +03:00
|
|
|
/**
|
|
|
|
* Initialize Kohana, setting the default options.
|
2009-06-14 17:04:50 +03:00
|
|
|
*
|
|
|
|
* The following options are available:
|
2009-07-08 01:02:20 +03:00
|
|
|
*
|
|
|
|
* - string base_url path, and optionally domain, of your application NULL
|
|
|
|
* - string index_file name of your index file, usually "index.php" index.php
|
|
|
|
* - string charset internal character set used for input and output utf-8
|
2009-07-26 02:10:52 +03:00
|
|
|
* - string cache_dir set the internal cache directory APPPATH/cache
|
2009-07-08 01:02:20 +03:00
|
|
|
* - boolean errors enable or disable error handling TRUE
|
2009-07-26 02:10:52 +03:00
|
|
|
* - boolean profile enable or disable internal profiling TRUE
|
2009-07-08 01:02:20 +03:00
|
|
|
* - boolean caching enable or disable internal caching FALSE
|
2009-05-20 22:13:02 +03:00
|
|
|
*/
|
2010-05-16 14:27:34 +03:00
|
|
|
Kohana::init(array(
|
|
|
|
'base_url' => '/',
|
|
|
|
));
|
2009-03-01 15:43:44 +02:00
|
|
|
|
2009-07-26 02:13:28 +03:00
|
|
|
/**
|
|
|
|
* Attach the file write to logging. Multiple writers are supported.
|
|
|
|
*/
|
2010-12-06 05:00:29 +02:00
|
|
|
Kohana::$log->attach(new Log_File(APPPATH.'logs'));
|
2009-07-26 02:13:28 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Attach a file reader to config. Multiple readers are supported.
|
|
|
|
*/
|
2010-12-06 05:00:29 +02:00
|
|
|
Kohana::$config->attach(new Config_File);
|
2009-07-26 02:13:28 +03:00
|
|
|
|
2009-02-24 09:13:09 +02:00
|
|
|
/**
|
2009-05-20 22:13:02 +03:00
|
|
|
* Enable modules. Modules are referenced by a relative or absolute path.
|
2009-02-24 09:13:09 +02:00
|
|
|
*/
|
|
|
|
Kohana::modules(array(
|
2009-08-24 22:08:38 +03:00
|
|
|
// 'auth' => MODPATH.'auth', // Basic authentication
|
2010-05-25 15:07:08 +03:00
|
|
|
// 'cache' => MODPATH.'cache', // Caching with multiple backends
|
2009-08-24 22:08:38 +03:00
|
|
|
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
|
2010-05-25 15:07:08 +03:00
|
|
|
// 'database' => MODPATH.'database', // Database access
|
2009-07-03 20:32:25 +03:00
|
|
|
// 'image' => MODPATH.'image', // Image manipulation
|
2009-08-24 22:08:38 +03:00
|
|
|
// 'orm' => MODPATH.'orm', // Object Relationship Mapping
|
2010-07-04 18:13:04 +03:00
|
|
|
// 'oauth' => MODPATH.'oauth', // OAuth authentication
|
2009-07-03 20:32:25 +03:00
|
|
|
// 'pagination' => MODPATH.'pagination', // Paging of results
|
2010-07-04 15:08:45 +03:00
|
|
|
// 'unittest' => MODPATH.'unittest', // Unit testing
|
2010-05-25 15:07:08 +03:00
|
|
|
// 'userguide' => MODPATH.'userguide', // User guide and API documentation
|
2009-04-18 00:40:11 +03:00
|
|
|
));
|
|
|
|
|
2009-03-01 15:43:44 +02:00
|
|
|
/**
|
2009-06-14 17:04:50 +03:00
|
|
|
* Set the routes. Each route must have a minimum of a name, a URI and a set of
|
|
|
|
* defaults for the URI.
|
2009-03-01 15:43:44 +02:00
|
|
|
*/
|
2009-04-21 07:33:22 +03:00
|
|
|
Route::set('default', '(<controller>(/<action>(/<id>)))')
|
2009-02-24 09:13:09 +02:00
|
|
|
->defaults(array(
|
|
|
|
'controller' => 'welcome',
|
2009-07-08 01:02:20 +03:00
|
|
|
'action' => 'index',
|
2011-01-10 18:15:47 +02:00
|
|
|
));
|