Integrated sandbox functionality directly into the application so that there is no need for two independent applications for both the normal and sandbox version.

git-svn-id: file:///svn-source/pmgr/branches/single_site_sandbox_20090905@838 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-09-06 04:28:29 +00:00
parent 7a2034aea0
commit 740bcbedc0
8 changed files with 71 additions and 16 deletions

View File

@@ -33,7 +33,13 @@
*/
function sandbox() {
return preg_match("%^/[^/]*sand/%", $_SERVER['REQUEST_URI']);
$r = Router::requestRoute();
return !empty($r[3]['sand_route']);
}
function devbox() {
$r = Router::requestRoute();
return !empty($r[3]['dev_route']);
}
function server_request_var($var) {

View File

@@ -12,6 +12,8 @@ class DATABASE_CONFIG {
);
function __construct() {
if (devbox())
$this->default['database'] = 'pmgr_dev';
if (sandbox())
$this->default['database'] = 'pmgr_sand';
}

View File

@@ -36,4 +36,20 @@ $default_path = array('controller' => 'maps', 'action' => 'view', '1');
*/
Router::connect('/', $default_path);
/*
* Route for sandbox functionality
*/
Router::connect('/sand',
array('sand_route' => true) + $default_path);
Router::connect('/sand/:controller/:action/*',
array('sand_route' => true, 'action' => null));
/*
* Route for developement functionality
*/
Router::connect('/dev',
array('dev_route' => true) + $default_path);
Router::connect('/dev/:controller/:action/*',
array('dev_route' => true, 'action' => null));
?>