Example #1
0
 public static function set_route($config)
 {
     $myroutes = Kohana::$config->load($config);
     foreach ($myroutes as $name => $rout) {
         Route::set($name, $rout["URI"])->defaults($rout["defaults"]);
     }
 }
Example #2
0
 /**
  * @dataProvider data_is_method_allowed
  */
 public function test_is_method_allowed($route_method, $requested_method, $expected_result)
 {
     $this->markTestSkipped();
     $route = Route::set('route_check', 'uri', NULL, array('method' => $route_method))->defaults(array('controller' => 'uri'));
     $request = new Request('uri');
     $request->method($requested_method);
     $this->assertEquals($expected_result, $route->is_method_allowed($route, array(), $request));
 }
Example #3
0
File: Site.php Project: qlsove/faq
 public static function set_routes($config)
 {
     $routes = Kohana::$config->load($config);
     foreach ($routes as $name => $rout) {
         if (isset($rout["regexp"])) {
             Route::set($name, $rout["URI"], $rout["regexp"])->defaults($rout["defaults"]);
         } else {
             Route::set($name, $rout["URI"])->defaults($rout["defaults"]);
         }
     }
 }
Example #4
0
 /**
  * Route
  *
  * @return Route
  */
 public static function write()
 {
     // Get backend name
     $backend_name = Cms_Helper::settings('backend_name');
     // Backend Auth
     Route::set('backend_auth', $backend_name . '/<action>', array('action' => '(directuser|login|logout)'))->defaults(array('directory' => 'backend', 'controller' => 'auth'));
     // Backend Media
     Route::set('backend_media', $backend_name . '/media(/<stuff>)', array('stuff' => '.*'))->defaults(array('directory' => 'backend', 'controller' => 'media', 'action' => 'index'));
     // Backend items
     Route::set('backend_items', $backend_name . '/items/<division>(/<action>(/<key>))')->filter(function ($route, $params, $request) {
         foreach ($params as &$param) {
             $param = str_replace('-', '_', $param);
         }
         return $params;
     })->defaults(array('directory' => 'backend', 'controller' => 'items', 'action' => 'index'));
     // Backend
     Route::set('backend', $backend_name . '(/<controller>(/<action>(/<key>)))')->filter(function ($route, $params, $request) {
         foreach ($params as &$param) {
             $param = str_replace('-', '_', Text::ucfirst($param));
         }
         return $params;
     })->defaults(array('directory' => 'backend', 'controller' => 'home', 'action' => 'index'));
     // Media
     Route::set('media', 'media(/<stuff>)', array('stuff' => '.*'))->defaults(array('controller' => 'media', 'action' => 'index'));
     // Imagefly
     // imagefly/1/w253-h253-p/test4.jpg
     Route::set('imagefly', 'imagefly(/<stuff>)', array('stuff' => '.*'))->defaults(array('controller' => 'imagefly', 'action' => 'index'));
     // Item
     Route::set('item', '<stuff>', array('stuff' => '.*'))->filter(function ($route, $params, $request) {
         foreach ($params as &$param) {
             $param = str_replace('-', '_', Text::ucfirst($param));
         }
         $stuffs = explode('/', $params['stuff']);
         $end_staff = end($stuffs);
         $segment = substr($end_staff, 0, strlen($end_staff) - (strpos($end_staff, '.') - 1));
         if (!$segment) {
             $segment = Cms_Helper::settings('home_page');
         }
         $params['segment'] = $segment;
         $item = (bool) DB::select('id')->from('items')->where('segment', '=', $segment)->execute()->get('id');
         if (!$item) {
             return FALSE;
         }
         return $params;
     })->defaults(array('controller' => 'item', 'action' => 'index'));
 }
Example #5
0
File: Site.php Project: qlsove/chat
 public static function set_routes($config)
 {
     $routes = Kohana::$config->load($config);
     $data = explode('.', $config);
     if (count($data) == 1) {
         foreach ($routes as $name => $rout) {
             if (isset($rout["regexp"])) {
                 Route::set($name, $rout["URI"], $rout["regexp"])->defaults($rout["defaults"]);
             } else {
                 Route::set($name, $rout["URI"])->defaults($rout["defaults"]);
             }
         }
     }
     if (count($data) == 2) {
         if (isset($rout["regexp"])) {
             Route::set($data[1], $routes["URI"], $routes["regexp"])->defaults($routes["defaults"]);
         } else {
             Route::set($data[1], $routes["URI"])->defaults($routes["defaults"]);
         }
     }
 }
Example #6
0
 /**
  * Creates a new instance of the class
  * @param  int  optional specific site load id
  */
 public function __construct($site_id = NULL)
 {
     $this->_id = $site_id === NULL ? $this->_lookup() : $site_id;
     $this->_site = ORM::factory('site', $this->_id);
     if (!$this->_site->loaded()) {
         throw new Kohana_Exception('The KMS Site ID :site: could not be found/loaded from the database', array(':site:' => $this->_id));
     }
     foreach ($this->_site->routes->find_all() as $route) {
         $regexps = array();
         $defaults = array();
         foreach ($route->defaults->find_all() as $default) {
             $defaults[$default->key] = $default->value;
         }
         foreach ($route->regexps->find_all() as $regexp) {
             $regexps[$regexp->key] = $regexp->regexp;
         }
         $new_route = Route::set('kms_' . $route->name, $route->route, $regexps);
         if (!empty($defaults)) {
             $new_route->defaults($defaults);
         }
     }
 }
Example #7
0
    Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
}
/**
 * Default path for uploads directory.
 * Path are referenced by a relative or absolute path.
 */
Upload::$default_directory = APPPATH . 'uploads';
/**
 * Set the routes
 *
 * Each route must have a minimum of a name,
 * a URI and a set of defaults for the URI.
 *
 * Example:
 * ~~~
 *	Route::set('frontend/page', 'page(/<action>)')
 *		->defaults(array(
 *			'controller' => 'page',
 *			'action' => 'view',
 *	));
 * ~~~
 *
 * @uses  Path::lookup
 * @uses  Route::cache
 * @uses  Route::set
 */
if (!Route::cache()) {
    Route::set('default', '(<controller>(/<action>(/<id>)))')->filter('Path::lookup')->defaults(array('controller' => 'welcome', 'action' => 'index'));
    // Cache the routes in production
    Route::cache(Kohana::$environment === Kohana::PRODUCTION);
}
Example #8
0
	/**
	 * Set route functionality.
	 *
	 * @return  void
	 */
	public static function set_route()
	{
		Route::set('Publicize', array('Publicize', 'route_callback'));
	}
Example #9
0
<?php

defined('SYSPATH') or die('No direct script access.');
/**
 * @version SVN: $Id:$
 */
$adminPrefix = Kohana::$config->load('extasy')->admin_path_prefix;
Route::set('admin-feedback', trim($adminPrefix . 'contacts(/<action>(/<id>))'))->defaults(array('directory' => 'admin', 'controller' => 'feedback', 'action' => 'index'));
Route::set('site-contacts', 'contacts(/<action>)')->defaults(array('directory' => 'site', 'controller' => 'contacts', 'action' => 'index'));
Route::set('site-ajax', 'ajax(/<action>)')->defaults(array('directory' => 'site', 'controller' => 'ajax', 'action' => 'ajax_add_comment'));
Example #10
0
<?php

defined('SYSPATH') or die('No direct script access.');
if (!Route::cache()) {
    Route::set('b_settings', ADMIN . '/settings(/<action>)', ['action' => 'i18n'])->defaults(['directory' => 'Settings/Backend', 'controller' => 'page', 'action' => 'edit']);
}
Example #11
0
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array('base_url' => '/', 'index_file' => FALSE, 'charset' => 'utf-8'));
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Kohana_Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Kohana_Config_File());
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'pagination' => MODPATH . 'pagination'));
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
Route::set('admin', 'admin(/<action>(/<id>))')->defaults(array('controller' => 'admin', 'action' => 'index'));
Route::set('captcha', 'captcha(/<action>)')->defaults(array('controller' => 'captcha', 'action' => 'default'));
Route::set('bg', 'background')->defaults(array('controller' => 'page', 'action' => 'background'));
Route::set('default', '(<page>(/<id>))')->defaults(array('controller' => 'page', 'action' => 'showpage'));
/**
 * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
 * If no source is specified, the URI will be automatically detected.
 */
echo Request::instance()->execute()->send_headers()->response;
Example #12
0
<?php

defined('SYSPATH') or die('No direct script access.');
Route::set('image', 'image/get/<file>', array('file' => '.+.(?:jpe?g|png|gif)'))->defaults(array('directory' => 'spot', 'controller' => 'image'));
Example #13
0
<?php

defined('SYSPATH') or die('No direct script access.');
// Disable in CLI
if (defined("PHP_SAPI") && PHP_SAPI == 'cli') {
    return;
}
Route::set('logdelete', 'logs/delete/<year>/<month>/<logfile>', array('logfile' => '.*'))->defaults(array('controller' => 'Logs', 'action' => 'delete'));
Route::set('logviewer', 'logs/(<year>(/<month>(/<day>(/<level>))))')->defaults(array('controller' => 'Logs', 'action' => 'index'));
Example #14
0
<?php

// If we're on the CLI then PHPUnit will already be loaded
if (class_exists('PHPUnit_Util_Filter', FALSE)) {
    Kohana_Tests::configure_enviroment();
    // Stop kohana from processing the request
    define('SUPPRESS_REQUEST', TRUE);
} else {
    if (Kohana_Tests::enabled()) {
        // People shouldn't be running unit tests on their production server
        // so we assume that this /could/ be a web ui request on the dev server
        // and include phpunit so that modules can add specific files to the blacklist
        require_once 'PHPUnit/Framework.php';
    }
}
Route::set('unittest', '(phpunit(/<action>(/<id>)))')->defaults(array('controller' => 'phpunit', 'action' => 'index'));
Example #15
0
<?php

defined('SYSPATH') or die('No direct script access.');
/**
 * Nexmo Data Provider
 *
 * @author     Ushahidi Team <*****@*****.**>
 * @package    DataProvider\Nexmo
 * @copyright  2013 Ushahidi
 * @license    http://www.gnu.org/copyleft/gpl.html GNU General Public License Version 3 (GPLv3)
 */
// Plugin Info
$plugin = array('name' => 'Nexmo', 'version' => '0.1', 'services' => array(Message_Type::SMS => TRUE, Message_Type::IVR => FALSE, Message_Type::EMAIL => FALSE, Message_Type::TWITTER => FALSE), 'options' => array('from' => array('label' => 'From', 'input' => 'text', 'description' => 'The from number', 'rules' => array('required')), 'secret' => array('label' => 'Secret', 'input' => 'text', 'description' => 'The secret value', 'rules' => array('required')), 'api_key' => array('label' => 'API Key', 'input' => 'text', 'description' => 'The API key', 'rules' => array('required')), 'api_secret' => array('label' => 'API secret', 'input' => 'text', 'description' => 'The API secret', 'rules' => array('required'))), 'links' => array('developer' => 'https://www.nexmo.com/', 'signup' => 'https://dashboard.nexmo.com/register'));
// Register the plugin
DataProvider::register_provider('nexmo', $plugin);
// Additional Routes
Route::set('nexmo_sms_callback_url', 'sms/nexmo(/<action>)')->defaults(array('directory' => 'Sms', 'controller' => 'Nexmo'));
Example #16
0
<?php

defined('SYSPATH') or die('No direct script access.');
$modules = Kohana::modules();
Route::set('lwrte-media', 'lwrte/media(/<file>)', array('file' => '.+'))->defaults(array('controller' => 'lwrte', 'action' => 'media', 'file' => NULL));
Route::set('lwrte-upload', 'lwrte/upload')->defaults(array('controller' => 'lwrte', 'action' => 'upload'));
Example #17
0
<?php

defined('SYSPATH') or die('No direct script access.');
Route::set('pngtext', 'pngtext')->defaults(array('controller' => 'pngtext', 'action' => 'index'));
Route::set('pngtext.js', 'pngtext/pngtext.js')->defaults(array('controller' => 'pngtext', 'action' => 'js'));
Example #18
0
/**
 * SavedSearches API Route
 */
Route::set('savedsearches-api', $apiBase . 'savedsearches(/<id>)', array('id' => '\\d+'))->defaults(array('action' => 'index', 'directory' => 'Api', 'controller' => 'SavedSearches'));
/**
 * Post stats API route
 */
// Route::set('post-stats-api', $apiBase . 'stats/posts')
// 	->defaults(array(
// 		'action'     => 'index',
// 		'directory'  => 'Api/Stats',
// 		'controller' => 'Posts',
// 	));
/**
 * Base Ushahidi API Route
 */
Route::set('api', $apiBase . '(<controller>(/<id>))', array('id' => '\\d+'))->defaults(array('action' => 'index', 'directory' => 'Api'));
/**
 * Translations API SubRoute
 */
Route::set('translations', $apiBase . 'posts/<parent_id>/translations(/<locale>)', array('parent_id' => '\\d+', 'locale' => '[a-zA-Z_]+'))->defaults(array('action' => 'index', 'controller' => 'Translations', 'directory' => 'Api/Posts'));
/**
 * OAuth Route
 * Have to add this manually because the class is OAuth not Oauth
 */
Route::set('oauth', 'oauth(/<action>)', array('action' => '(?:index|authorize|token)'))->defaults(array('controller' => 'OAuth', 'action' => 'index'));
/**
 * Default Route
 */
Route::set('default', '(' . $apiBase . ')')->defaults(array('controller' => 'Index', 'action' => 'index', 'directory' => 'Api'));
Example #19
0
<?php

defined('SYSPATH') or die('No direct script access.');
// http://startbootstrap.com/template-overviews/sb-admin-2/
//include_once './cms/fckeditor/fckeditor.php';
define('CMS_FOLDER', 'admin');
define('URL_PREFIX', 'admin');
Route::set('cms_default', URL_PREFIX . '(/<controller>(/<action>(/<id>)))', array('directory' => CMS_FOLDER))->defaults(array('directory' => CMS_FOLDER, 'controller' => 'home', 'action' => 'index'));
Example #20
0
 *
 * - 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
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - integer  cache_life  lifetime, in seconds, of items cached              60
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
 */
Kohana::init(array('base_url' => '/', 'index_file' => FALSE, 'charset' => 'utf-8'));
Cookie::$salt = '284e6f15a';
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('auth' => MODPATH . 'auth', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm', 'captcha' => MODPATH . 'captcha', 'guestid' => MODPATH . 'guestid'));
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
Route::set('default', '(<controller>(/<action>(/<id>)))', array('id' => '[0-9a-z]+'))->defaults(array('controller' => 'index', 'action' => 'index'));
Example #21
0
<?php

defined('SYSPATH') or die('No direct access allowed.');
Route::set('i18nget/generate', 'i18nget/generate(/<from_path>(/<to_path>))', array('from_path' => '[a-zA-Z-_0-9]+', 'to_path' => '[a-zA-Z-_0-9]+'))->defaults(array('controller' => 'i18nget', 'action' => 'generate', 'from_path' => 'application', 'to_path' => NULL));
Example #22
0
<?php

defined('SYSPATH') or die('No direct script access.');
Route::set('kohana-static-css', 'static/<action>/<filenames>', array('filenames' => '[^/]+'))->defaults(array('controller' => 'static'));
Example #23
0
<?php

defined('SYSPATH') or die('No direct script access.');
Route::set('comments', 'comments/<group>/<action>(/<id>(/<page>))(<format>)', array('id' => '\\d+', 'page' => '\\d+', 'format' => '\\.\\w+'))->defaults(array('controller' => 'comments', 'group' => 'default', 'format' => '.json'));
 /**
  * http://dev.kohanaframework.org/issues/4079
  *
  * @test
  * @covers Route::get
  * @ticket 4079
  * @dataProvider provider_route_uri_encode_parameters
  */
 public function test_route_uri_encode_parameters($name, $uri_callback, $defaults, $uri_key, $uri_value, $expected)
 {
     Route::set($name, $uri_callback)->defaults($defaults);
     $get_route_uri = Route::get($name)->uri(array($uri_key => $uri_value));
     $this->assertSame($expected, $get_route_uri);
 }
Example #25
0
    }
    return $orm->loaded();
}
function transliterate_unique($str, ORM $orm, $field_name, $where = array())
{
    $_value = Ku_Text::slug($str);
    $_value = substr($_value, 0, 50);
    while (row_exist($orm, $field_name, $_value, $where)) {
        $_value .= '-' . uniqid();
    }
    return $_value;
}
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
Route::set('modules', 'admin/modules/<controller>(/<action>(/<id>))(?<query>)')->defaults(array('directory' => 'admin/modules', 'action' => 'index'));
Route::set('admin', 'admin(/<controller>(/<action>(/<id>)))(?<query>)')->defaults(array('directory' => 'admin', 'controller' => 'home', 'action' => 'index'));
Route::set('admin_error', 'admin/error/<action>(/<message>)', array('action' => '[0-9]++', 'message' => '.+'))->defaults(array('directory' => 'admin', 'controller' => 'error'));
Route::set('widgets', 'widgets/<controller>(/<action>(/<id>))(?<query>)')->defaults(array('directory' => 'widgets', 'action' => 'index'));
Route::set('uploader', 'uploader(?<query>)')->defaults(array('controller' => 'uploader', 'action' => 'index'));
Route::set('home', '(?<query>)')->defaults(array('directory' => 'modules', 'controller' => 'home', 'action' => 'index'));
Route::set('preview', '_preview/<directory>/<controller>(?<query>)')->defaults(array('action' => 'preview'));
Route::remove_route('sitemap_index');
Route::remove_route('sitemap');
Route::set('sitemap', 'Sitemap.xml(/<action>)(?<query>)')->defaults(array('controller' => 'sitemap', 'action' => 'index'));
if (Kohana::$config->load('import.enable')) {
    Route::set('import', 'import/<controller>(/<action>(/<id>))(?<query>)')->defaults(array('directory' => 'import', 'action' => 'index'));
}
Route::set('error', 'error/<action>(/<message>)', array('action' => '[0-9]++', 'message' => '.+'))->defaults(array('controller' => 'error'));
Example #26
0
File: init.php Project: anqh/forum
<?php

defined('SYSPATH') or die('No direct access allowed.');
/**
 * Init for Forum
 *
 * @package    Forum
 * @author     Antti Qvickström
 * @copyright  (c) 2010 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
Route::set('forum_group_add', 'forum/areas/add')->defaults(array('controller' => 'forum_group', 'action' => 'edit'));
Route::set('forum_area_add', 'forum/areas/<group_id>/<action>', array('action' => 'add'))->defaults(array('controller' => 'forum_area', 'action' => 'edit'));
Route::set('forum_private_topic_add', 'messages/<action>', array('action' => 'post'))->defaults(array('controller' => 'forum_private'));
Route::set('forum_private_area', 'messages')->defaults(array('controller' => 'forum_area', 'action' => 'messages'));
Route::set('forum_topic_add', 'forum/<id>/<action>', array('action' => 'post'))->defaults(array('controller' => 'forum_topic'));
Route::set('forum_group', 'forum/areas(/<id>(/<action>))', array('action' => 'edit|delete'))->defaults(array('controller' => 'forum_group'));
Route::set('forum_area', 'forum/<id>(/<action>)', array('action' => 'edit|delete'))->defaults(array('controller' => 'forum_area'));
Route::set('forum_event', 'event/<id>/topic(/<time>)', array('time' => 'before|after'))->defaults(array('controller' => 'forum_topic', 'action' => 'event'));
Route::set('forum_topic', 'topic/<id>(/<action>)', array('action' => 'add|edit|reply|delete'))->defaults(array('controller' => 'forum_topic'));
Route::set('forum_private_topic', 'message/<id>(/<action>)', array('action' => 'add|edit|reply|delete'))->defaults(array('controller' => 'forum_private'));
Route::set('forum_post', 'topic/<topic_id>/<id>(/<action>)', array('action' => 'edit|quote|delete'))->defaults(array('controller' => 'forum_topic'));
Route::set('forum_private_post', 'message/<topic_id>/<id>(/<action>)', array('action' => 'edit|quote|delete'))->defaults(array('controller' => 'forum_private'));
Route::set('forum', 'forum(/)')->defaults(array('controller' => 'forum'));
<?php

defined('SYSPATH') or die('No direct script access.');
// Static file serving (CSS, JS, images)
Route::set('docs/media', 'guide-media(/<file>)', array('file' => '.+'))->defaults(array('controller' => 'Userguide', 'action' => 'media', 'file' => NULL));
// API Browser, if enabled
if (Kohana::$config->load('userguide.api_browser') === TRUE) {
    Route::set('docs/api', 'guide-api(/<class>)', array('class' => '[a-zA-Z0-9_]+'))->defaults(array('controller' => 'Userguide', 'action' => 'api', 'class' => NULL));
}
// User guide pages, in modules
Route::set('docs/guide', 'guide(/<module>(/<page>))', array('page' => '.+'))->defaults(array('controller' => 'Userguide', 'action' => 'docs', 'module' => ''));
// Simple autoloader used to encourage PHPUnit to behave itself.
class Markdown_Autoloader
{
    public static function autoload($class)
    {
        if ($class == 'Markdown_Parser' or $class == 'MarkdownExtra_Parser') {
            include_once Kohana::find_file('vendor', 'markdown/markdown');
        }
    }
}
// Register the autoloader
spl_autoload_register(array('Markdown_Autoloader', 'autoload'));
Example #28
0
<?php

defined('SYSPATH') or die('No direct script access.');
Route::set('devtools', 'devtools(/<action>)')->defaults(array('controller' => 'Devtools', 'action' => 'info'));
if (Kohana::$environment != Kohana::DEVELOPMENT) {
    throw new Kohana_Exception('Devtools should not be enabled when not in development.  Check your environment variable, or disable the devtools module.');
}
Example #29
0
Kohana::$log->attach(new Kohana_Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Kohana_Config_File());
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array());
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
// if ( ! Route::cache())
// {
Route::set('cron', 'cron/injest')->defaults(array('controller' => 'cron', 'action' => 'injest'));
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'front', 'action' => 'index'));
// Save the routes to cache
Route::cache(TRUE);
// }
/**
 * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
 * If no source is specified, the URI will be automatically detected.
 */
if (!defined('SUPPRESS_REQUEST')) {
    try {
        echo Request::instance($_SERVER['PATH_INFO'])->execute()->send_headers()->body();
    } catch (Exception $e) {
        throw $e;
    }
}
Example #30
0
File: init.php Project: laiello/ko3
<?php

// If we're on the CLI then PHPUnit will already be loaded
if (class_exists('PHPUnit_Util_Filter', FALSE) or function_exists('phpunit_autoload')) {
    Unittest_Tests::configure_environment();
    // Stop kohana from processing the request
    define('SUPPRESS_REQUEST', TRUE);
}
Route::set('unittest', 'unittest(/<action>)')->defaults(array('controller' => 'unittest', 'action' => 'index'));