<?php

/**
 * Configure and create a website object
 */
// set the settings in website class
Website::settings(Kohana::$config->load('websites'));
// get a website instance
$website = Website::instance();
// create website regex pattern
$websites_pattern = '(' . implode('|', $website->websites()) . ')';
// set the website regex in the website instance
$website->match('(website_' . $websites_pattern . ')', 1);
/**
 * BACKEND
 */
Route::set('backend', 'admin(/website_<website>)(/viewport_<viewport>(/task_<task>)(/callback_<callback>))(/<controller>(/arguments_<arguments>)(/<action>(/<id>(/<param1>(/<param2>(/<param3>))))))(?<query>)', array('website' => $websites_pattern, 'viewport' => '(application|module|item)', 'task' => '(select)'))->defaults(array('controller' => 'Default', 'action' => 'index'))->retain(array('website', 'viewport', 'task', 'callback', 'arguments'));
/**
 * ERROR
 */
Route::set('error', 'error(/<action>(/<message>))', array('action' => '[0-9]++', 'message' => '.+'))->defaults(array('controller' => 'Error', 'action' => '500', 'message' => ''));
/**
 * DIRECT ACCESS
 */
Route::set('access', 'access/<token>(/<controller>(/<action>(/<id>(/<param1>))))')->defaults(array('token' => '', 'controller' => 'Home', 'action' => 'index'));
/**
 * INTERNAL SUBREQUEST
 */
Route::set('internal', 'internal_<controller>(@<action>(:<id>))', array('controller' => '[a-zA-Z0-9\\_\\-]+', 'action' => '[a-zA-Z0-9\\_\\-]+'))->defaults(array('action' => 'index'));
/**
 * LOCAL ALIAS NEWS