-
Notifications
You must be signed in to change notification settings - Fork 3
/
detect-app.php
28 lines (23 loc) · 1003 Bytes
/
detect-app.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
/*
* Copyright (c) 2014, webvariants GmbH & Co. KG, http://www.webvariants.de
*
* This file is released under the terms of the MIT license. You can find the
* complete text in the attached LICENSE file or online at:
*
* http://www.opensource.org/licenses/mit-license.php
*/
// determine application based on the request URI
function _sly_router($server) {
$base = dirname($server['SCRIPT_NAME']);
$reqUri = substr($server['REQUEST_URI'], strlen($base));
$reqUri = preg_replace('/[?&].*$/', '', $reqUri);
$reqUri = trim($reqUri, '/');
// route other app URIs (be careful not to confuse the assets)
if (preg_match('#^backend(?!/assets/)(/|$)#', $reqUri)) return array('backend', 'backend');
if (preg_match('#^setup(?!/assets/)(/|$)#', $reqUri)) return array('setup', 'setup');
if (preg_match('#^(assets|mediapool)/#', $reqUri)) return array('assets', '/');
// everything else goes through the frontend
return array('frontend', '/');
}
return _sly_router($_SERVER);