salientdigital

Kohana 3.0.8 Bootstrap File

Jan 21st, 2011
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.21 KB | None | 0 0
  1. <?php defined('SYSPATH') or die('No direct script access.');
  2.  
  3. //-- Environment setup --------------------------------------------------------
  4.  
  5. /**
  6.  * Set the default time zone.
  7.  *
  8.  * @see  http://kohanaframework.org/guide/using.configuration
  9.  * @see  http://php.net/timezones
  10.  */
  11. date_default_timezone_set('America/Chicago');
  12.  
  13. /**
  14.  * Set the default locale.
  15.  *
  16.  * @see  http://kohanaframework.org/guide/using.configuration
  17.  * @see  http://php.net/setlocale
  18.  */
  19. setlocale(LC_ALL, 'en_US.utf-8');
  20.  
  21. /**
  22.  * Enable the Kohana auto-loader.
  23.  *
  24.  * @see  http://kohanaframework.org/guide/using.autoloading
  25.  * @see  http://php.net/spl_autoload_register
  26.  */
  27. spl_autoload_register(array('Kohana', 'auto_load'));
  28.  
  29. /**
  30.  * Enable the Kohana auto-loader for unserialization.
  31.  *
  32.  * @see  http://php.net/spl_autoload_call
  33.  * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
  34.  */
  35. ini_set('unserialize_callback_func', 'spl_autoload_call');
  36.  
  37. //-- Configuration and initialization -----------------------------------------
  38.  
  39. /**
  40.  * Set Kohana::$environment if $_ENV['KOHANA_ENV'] has been supplied.
  41.  *
  42.  */
  43. if (isset($_ENV['KOHANA_ENV']))
  44. {
  45.     Kohana::$environment = $_ENV['KOHANA_ENV'];
  46. }
  47.  
  48. /**
  49.  * Initialize Kohana, setting the default options.
  50.  *
  51.  * The following options are available:
  52.  *
  53.  * - string   base_url    path, and optionally domain, of your application   NULL
  54.  * - string   index_file  name of your index file, usually "index.php"       index.php
  55.  * - string   charset     internal character set used for input and output   utf-8
  56.  * - string   cache_dir   set the internal cache directory                   APPPATH/cache
  57.  * - boolean  errors      enable or disable error handling                   TRUE
  58.  * - boolean  profile     enable or disable internal profiling               TRUE
  59.  * - boolean  caching     enable or disable internal caching                 FALSE
  60.  */
  61. Kohana::init(array(
  62.     'index_file' => FALSE,
  63.     'base_url'   => '/',
  64. ));
  65.  
  66. /**
  67.  * Attach the file write to logging. Multiple writers are supported.
  68.  */
  69. Kohana::$log->attach(new Kohana_Log_File(APPPATH.'logs'));
  70.  
  71. /**
  72.  * Attach a file reader to config. Multiple readers are supported.
  73.  */
  74. Kohana::$config->attach(new Kohana_Config_File);
  75.  
  76. /**
  77.  * Enable modules. Modules are referenced by a relative or absolute path.
  78.  */
  79. Kohana::modules(array(
  80.        'auth'       => MODPATH.'auth',       // Basic authentication
  81.        'cache'      => MODPATH.'cache',      // Caching with multiple backends
  82.     // 'codebench'  => MODPATH.'codebench',  // Benchmarking tool
  83.        'database'   => MODPATH.'database',   // Database access
  84.        'email'      => MODPATH.'email',      // Swiftmailer.org
  85.     // 'image'      => MODPATH.'image',      // Image manipulation
  86.        'orm'        => MODPATH.'orm',        // Object Relationship Mapping
  87.     // 'oauth'      => MODPATH.'oauth',      // OAuth authentication
  88.        'pagination' => MODPATH.'pagination', // Paging of results
  89.     // 'unittest'   => MODPATH.'unittest',   // Unit testing
  90.        'captcha'    => MODPATH.'captcha',    // Captcha class ported from Kohana 2x https://github.com/kolanos/kohana-captcha
  91.        'userguide'  => MODPATH.'userguide',  // User guide and API documentation
  92.     ));
  93.  
  94.  
  95.  
  96. Route::set('admin', 'admin(/<controller>(/<action>(/<id>)))')
  97.     ->defaults(array(
  98.         'directory'  => 'admin',
  99.         'controller' => 'textad',
  100.         'action'     => 'index',
  101.     ));
  102.  
  103. Route::set('admin', 'admin(/<controller>(/<action>(/<id>)))')
  104.     ->defaults(array(
  105.         'directory'  => 'admin',
  106.         'controller' => 'publisher',
  107.         'action'     => 'index',
  108.     ));
  109.  
  110. Route::set('admin', 'admin(/<controller>(/<action>(/<id>(/<publisher_id>(/adplacement_id)))))')
  111.     ->defaults(array(
  112.         'directory'  => 'admin',
  113.         'controller' => 'publisher',
  114.         'action'     => 'index',
  115.         'publisher_id' => NULL,
  116.         'adplacement_id' => NULL,
  117.     ));
  118.    
  119. /*
  120. Route::set('member', '(<controller>(/<action>(/<id>(/<email>(/<verification>)))))')
  121.     ->defaults(array(
  122.         'controller'   => 'member',
  123.         'action'       => 'verify',
  124.         'email'        => NULL,
  125.         'verification' => NULL,
  126.     ));
  127. */
  128.  
  129. Route::set('verify', 'member/verify(/<email>(/<verification>))', array('email'=>'[a-zA-Z0-9\.\_@]+','verification'=>'[a-zA-Z0-9]+'))
  130.     ->defaults(array(
  131.         'controller'=>'member',
  132.         'action'=>'verify' ,
  133.         'email' => NULL ,
  134.         'verification' => NULL,
  135.     ));
  136.  
  137. // STATIC CONTENT
  138. Route::set('pages','<action>')
  139.     ->defaults(array(
  140.         'controller' => 'welcome',
  141.         'action' => 'index',
  142.         ));
  143. /**
  144.  * Set the routes. Each route must have a minimum of a name, a URI and a set of
  145.  * defaults for the URI.
  146.  */
  147. Route::set('default', '(<controller>(/<action>(/<id>)))')
  148.     ->defaults(array(
  149.         'controller' => 'welcome',
  150.         'action'     => 'index',
  151.     ));
  152.  
  153. if ( ! defined('SUPPRESS_REQUEST'))
  154. {
  155.     /**
  156.      * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
  157.      * If no source is specified, the URI will be automatically detected.
  158.      */
  159.     echo Request::instance()
  160.         ->execute()
  161.         ->send_headers()
  162.         ->response;
  163. }
Add Comment
Please, Sign In to add comment