Routing: Add some core routes

This commit is contained in:
Bart Visscher 2012-08-12 16:52:36 +02:00
parent 8c02494744
commit db4111f6d5
3 changed files with 23 additions and 1 deletions

19
core/routes.php Normal file
View File

@ -0,0 +1,19 @@
<?php
/**
* Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
$this->create('app_css', '/apps/{app}/{file}')
->requirements(array('file' => '.*.css'))
->action('OC', 'loadCSSFile');
$this->create('app_index_script', '/apps/{app}/')
->defaults(array('file' => 'index.php'))
//->requirements(array('file' => '.*.php'))
->action('OC', 'loadAppScriptFile');
$this->create('app_script', '/apps/{app}/{file}')
->defaults(array('file' => 'index.php'))
->requirements(array('file' => '.*.php'))
->action('OC', 'loadAppScriptFile');

View File

@ -440,8 +440,8 @@ class OC{
}
// Someone is logged in :
if(OC_User::isLoggedIn()) {
OC_App::loadApps();
if(isset($_GET["logout"]) and ($_GET["logout"])) {
OC_App::loadApps();
OC_User::logout();
header("Location: ".OC::$WEBROOT.'/');
}else{
@ -461,6 +461,7 @@ class OC{
}
public static function loadAppScriptFile($param) {
OC_App::loadApps();
$app = $param['app'];
$file = $param['file'];
$app_path = OC_App::getAppPath($app);

View File

@ -34,6 +34,8 @@ class OC_Router {
$this->root->addCollection($collection, '/apps/'.$app);
}
}
$this->useCollection('root');
require_once('core/routes.php');
}
protected function getCollection($name) {