Advertisement
Guest User

Untitled

a guest
Jan 4th, 2012
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.85 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.  * @see  http://kohanaframework.org/guide/using.configuration
  23.  * @see  http://php.net/timezones
  24.  */
  25. date_default_timezone_set('Europe/Sarajevo');
  26.  
  27. /**
  28.  * Set the default locale.
  29.  *
  30.  * @see  http://kohanaframework.org/guide/using.configuration
  31.  * @see  http://php.net/setlocale
  32.  */
  33. setlocale(LC_ALL, 'en_US.utf-8');
  34.  
  35. /**
  36.  * Enable the Kohana auto-loader.
  37.  *
  38.  * @see  http://kohanaframework.org/guide/using.autoloading
  39.  * @see  http://php.net/spl_autoload_register
  40.  */
  41. spl_autoload_register(array('Kohana', 'auto_load'));
  42.  
  43. /**
  44.  * Enable the Kohana auto-loader for unserialization.
  45.  *
  46.  * @see  http://php.net/spl_autoload_call
  47.  * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
  48.  */
  49. ini_set('unserialize_callback_func', 'spl_autoload_call');
  50.  
  51. //-- Configuration and initialization -----------------------------------------
  52.  
  53. /**
  54.  * Set the default language
  55.  */
  56. I18n::lang('en-us');
  57.  
  58. /**
  59.  * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
  60.  *
  61.  * Note: If you supply an invalid environment name, a PHP warning will be thrown
  62.  * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
  63.  */
  64. if (getenv('KOHANA_ENV') !== FALSE)
  65. {
  66.     Kohana::$environment = constant('Kohana::'.strtoupper(getenv('KOHANA_ENV')));
  67. }
  68.  
  69. /**
  70.  * Initialize Kohana, setting the default options.
  71.  *
  72.  * The following options are available:
  73.  *
  74.  * - string   base_url    path, and optionally domain, of your application   NULL
  75.  * - string   index_file  name of your index file, usually "index.php"       index.php
  76.  * - string   charset     internal character set used for input and output   utf-8
  77.  * - string   cache_dir   set the internal cache directory                   APPPATH/cache
  78.  * - boolean  errors      enable or disable error handling                   TRUE
  79.  * - boolean  profile     enable or disable internal profiling               TRUE
  80.  * - boolean  caching     enable or disable internal caching                 FALSE
  81.  */
  82. Kohana::init(array(
  83.     'base_url'      => '/',
  84.     'caching'       => FALSE,
  85.     'cache_life'    => 60,
  86.     'charset'       => 'utf-8',
  87.     'errors'        => TRUE,
  88.     'index_file'    => FALSE,
  89.     'profile'       => TRUE,
  90. ));
  91.  
  92. /**
  93.  * Attach the file write to logging. Multiple writers are supported.
  94.  */
  95. Kohana::$log->attach(new Log_File(APPPATH.'logs'));
  96.  
  97. /**
  98.  * Attach a file reader to config. Multiple readers are supported.
  99.  */
  100. Kohana::$config->attach(new Config_File);
  101.  
  102. /**
  103.  * Enable modules. Modules are referenced by a relative or absolute path.
  104.  */
  105. Kohana::modules(array(
  106.     'codebench'     => MODPATH.'codebench',     // Benchmarking tool
  107.     'auth'          => MODPATH.'auth',              // Basic authentication
  108.     'cache'         => MODPATH.'cache',             // Caching with multiple backends
  109.     'database'      => MODPATH.'database',          // Database access
  110.     'image'         => MODPATH.'image',             // Image manipulation
  111.     'orm'           => MODPATH.'orm',               // Object Relationship Mapping
  112.     'pagination'    => MODPATH.'pagination',        // Paging of results
  113.     'unittest'      => MODPATH.'unittest',          // Unit testing
  114.     'userguide'     => MODPATH.'userguide',     // User guide and API documentation
  115.     'purifier'      => MODPATH.'purifier',      // HTML Purifier module - overriding the Security::xss_clean()
  116.     'html_parser'   => MODPATH.'html_parser',   // HTML Parser module
  117.     'phpquery'      => MODPATH.'phpquery',      // phpQuery module
  118.     'less'          => MODPATH.'less',          // LESS CSS parser module
  119.     'jsmin'         => MODPATH.'jsmin',         // JSmin compiler
  120.     'sitemap'       => MODPATH.'sitemap',       // Sitemap module
  121.     'youtube'       => MODPATH.'youtube',       // YouTube module
  122.     'facebook'      => MODPATH.'facebook',     
  123.     'oauth'         => MODPATH.'oauth',
  124. ));
  125.  
  126. /**
  127.  * Set the routes. Each route must have a minimum of a name, a URI and a set of
  128.  * defaults for the URI.
  129.  */
  130. Route::set('archive', 'arhiva(/<date>)', array('date' => '([1-31]{2})/([1-12]{2})/([0-9]{4})'))
  131.     ->defaults(array(
  132.         'controller'    =>  'archive',
  133.         'action'        =>  'index',
  134.         'date'          =>  NULL,
  135.     ));
  136.    
  137. Route::set('flash', 'article/flash(/<id>)', array('id'=>'[0-9]+'))
  138.     ->defaults(array(
  139.         'controller'    =>  'article',
  140.         'action'        =>  'flash',
  141.         'id'            =>  NULL,
  142.     ));
  143.  
  144. Route::set('article', '<id>(/<seo>)', array('id'=>'[0-9]+','seo'=>'.+'))
  145.     ->defaults(array(
  146.         'controller'    =>  'article',
  147.         'action'        =>  'index',
  148.     ));
  149.    
  150. Route::set('category', 'kategorija(/<seo>(/<article_id>))', array('article_id'=>'[0-9]+'))
  151.     ->defaults(array(
  152.         'controller'    =>  'category',
  153.         'article_id'    =>  NULL,
  154.     ));
  155.    
  156. Route::set('archive' ,'arhiva(/<date>)(/<category_seo>)', array('date'=>'[0-9\.]+'))
  157.     ->defaults(array(
  158.         'controller'    =>  'archive',
  159.         'date'          =>  NULL,
  160.         'category_seo'  =>  NULL,
  161.     ));
  162.    
  163. Route::set('static', 's/<action>(/<file>)',array('file'=>'.+'))
  164.     ->defaults(array(
  165.         'controller'    =>  'static',
  166.     ));
  167.    
  168. Route::set('topic', 'tema/<seo>')
  169.     ->defaults(array(
  170.         'controller'    =>  'topic',
  171.     ));
  172.    
  173. Route::set('content', 'sadrzaj(/<kategorija>)')
  174.     ->defaults(array(
  175.         'controller'    =>  'content',
  176.     ));
  177.    
  178. Route::set('user', '<action>', array('action'=>'login|logout|registracija'))
  179.     ->defaults(array(
  180.         'controller'    =>  'user',
  181.         'action'        =>  'login',
  182.     ));
  183.    
  184. Route::set('sitemap_index', 'sitemap.xml(<gzip>)', array('gzip' => '\.gz'))
  185.     ->defaults(array(
  186.         'controller' => 'sitemap',
  187.         'action' => 'index'
  188.     ));
  189.  
  190. Route::set('default', '(<controller>(/<action>(/<id>(/<seo>))))')
  191.     ->defaults(array(
  192.         'controller' => 'index',
  193.         'action'     => 'index',
  194.     ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement