Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2014
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.63 KB | None | 0 0
  1. <?php defined('SYSPATH') or die('No direct script access.');
  2.  
  3. // -- Environment setup --------------------------------------------------------
  4.  
  5. // Load the core Kohana class
  6. require SYSPATH.'classes/Kohana/Core'.EXT;
  7.  
  8. if (is_file(APPPATH.'classes/Kohana'.EXT))
  9. {
  10. // Application extends the core
  11. require APPPATH.'classes/Kohana'.EXT;
  12. }
  13. else
  14. {
  15. // Load empty core extension
  16. require SYSPATH.'classes/Kohana'.EXT;
  17. }
  18.  
  19. /**
  20. * Set the default time zone.
  21. *
  22. * @link http://kohanaframework.org/guide/using.configuration
  23. * @link http://www.php.net/manual/timezones
  24. */
  25. date_default_timezone_set('Europe/Warsaw');
  26.  
  27. /**
  28. * Set the default locale.
  29. *
  30. * @link http://kohanaframework.org/guide/using.configuration
  31. * @link http://www.php.net/manual/function.setlocale
  32. */
  33. setlocale(LC_ALL, 'en_US.utf-8');
  34.  
  35. /**
  36. * Enable the Kohana auto-loader.
  37. *
  38. * @link http://kohanaframework.org/guide/using.autoloading
  39. * @link http://www.php.net/manual/function.spl-autoload-register
  40. */
  41. spl_autoload_register(array('Kohana', 'auto_load'));
  42.  
  43. /**
  44. * Optionally, you can enable a compatibility auto-loader for use with
  45. * older modules that have not been updated for PSR-0.
  46. *
  47. * It is recommended to not enable this unless absolutely necessary.
  48. */
  49. //spl_autoload_register(array('Kohana', 'auto_load_lowercase'));
  50.  
  51. /**
  52. * Enable the Kohana auto-loader for unserialization.
  53. *
  54. * @link http://www.php.net/manual/function.spl-autoload-call
  55. * @link http://www.php.net/manual/var.configuration#unserialize-callback-func
  56. */
  57. ini_set('unserialize_callback_func', 'spl_autoload_call');
  58.  
  59. /**
  60. * Set the mb_substitute_character to "none"
  61. *
  62. * @link http://www.php.net/manual/function.mb-substitute-character.php
  63. */
  64. mb_substitute_character('none');
  65.  
  66. // -- Configuration and initialization -----------------------------------------
  67.  
  68. /**
  69. * Set the default language
  70. */
  71. I18n::lang('en-us');
  72.  
  73. if (isset($_SERVER['SERVER_PROTOCOL']))
  74. {
  75. // Replace the default protocol.
  76. HTTP::$protocol = $_SERVER['SERVER_PROTOCOL'];
  77. }
  78.  
  79. /**
  80. * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
  81. *
  82. * Note: If you supply an invalid environment name, a PHP warning will be thrown
  83. * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
  84. */
  85. if (isset($_SERVER['KOHANA_ENV']))
  86. {
  87. Kohana::$environment = constant('Kohana::'.strtoupper($_SERVER['KOHANA_ENV']));
  88. }
  89.  
  90. /**
  91. * Initialize Kohana, setting the default options.
  92. *
  93. * The following options are available:
  94. *
  95. * - string base_url path, and optionally domain, of your application NULL
  96. * - string index_file name of your index file, usually "index.php" index.php
  97. * - string charset internal character set used for input and output utf-8
  98. * - string cache_dir set the internal cache directory APPPATH/cache
  99. * - integer cache_life lifetime, in seconds, of items cached 60
  100. * - boolean errors enable or disable error handling TRUE
  101. * - boolean profile enable or disable internal profiling TRUE
  102. * - boolean caching enable or disable internal caching FALSE
  103. * - boolean expose set the X-Powered-By header FALSE
  104. */
  105. Kohana::init(array(
  106. 'base_url' => '/',
  107. 'index_file' => false
  108. ));
  109.  
  110. /**
  111. * Attach the file write to logging. Multiple writers are supported.
  112. */
  113. Kohana::$log->attach(new Log_File(APPPATH.'logs'));
  114.  
  115. /**
  116. * Attach a file reader to config. Multiple readers are supported.
  117. */
  118. Kohana::$config->attach(new Config_File);
  119.  
  120. /**
  121. * Enable modules. Modules are referenced by a relative or absolute path.
  122. */
  123. Kohana::modules(array(
  124. 'auth' => MODPATH.'auth', // Basic authentication
  125. 'cache' => MODPATH.'cache', // Caching with multiple backends
  126. // 'codebench' => MODPATH.'codebench', // Benchmarking tool
  127. 'database' => MODPATH.'database', // Database access
  128. // 'image' => MODPATH.'image', // Image manipulation
  129. // 'minion' => MODPATH.'minion', // CLI Tasks
  130. // 'orm' => MODPATH.'orm', // Object Relationship Mapping
  131. // 'unittest' => MODPATH.'unittest', // Unit testing
  132. // 'userguide' => MODPATH.'userguide', // User guide and API documentation
  133. ));
  134.  
  135. /**
  136. * Set the routes. Each route must have a minimum of a name, a URI and a set of
  137. * defaults for the URI.
  138. */
  139.  
  140. Route::set('default', '')
  141. ->defaults(array(
  142. 'controller' => 'index',
  143. 'action' => 'index',
  144. ));
  145.  
  146. Route::set('login', '<action>',
  147. array(
  148. 'action' => '(login|logout|group_selection)'
  149. ))
  150. ->defaults(array(
  151. 'controller' => 'login'
  152. ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement