Move OC::loadfile and OC::loadapp next to OC::handleRequest

This commit is contained in:
Bart Visscher 2012-08-10 00:58:13 +02:00
parent e3c732040b
commit da07245f59
1 changed files with 35 additions and 35 deletions

View File

@ -257,41 +257,6 @@ class OC{
session_start();
}
protected static function loadapp() {
if(file_exists(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/index.php')) {
require_once(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/index.php');
}
else {
trigger_error('The requested App was not found.', E_USER_ERROR);//load default app instead?
}
}
protected static function loadfile() {
$app = OC::$REQUESTEDAPP;
$file = OC::$REQUESTEDFILE;
$app_path = OC_App::getAppPath($app);
if(file_exists($app_path . '/' . $file)) {
$file_ext = substr($file, -3);
if ($file_ext == 'css') {
$app_web_path = OC_App::getAppWebPath($app);
$filepath = $app_web_path . '/' . $file;
$minimizer = new OC_Minimizer_CSS();
$info = array($app_path, $app_web_path, $file);
$minimizer->output(array($info), $filepath);
exit;
} elseif($file_ext == 'php') {
$file = $app_path . '/' . $file;
unset($app, $app_path, $app_web_path, $file_ext);
require_once($file);
}
}
else {
die();
header('HTTP/1.0 404 Not Found');
exit;
}
}
public static function init(){
// register autoloader
spl_autoload_register(array('OC','autoload'));
@ -456,6 +421,41 @@ class OC{
return false;
}
protected static function loadapp() {
if(file_exists(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/index.php')) {
require_once(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/index.php');
}
else {
trigger_error('The requested App was not found.', E_USER_ERROR);//load default app instead?
}
}
protected static function loadfile() {
$app = OC::$REQUESTEDAPP;
$file = OC::$REQUESTEDFILE;
$app_path = OC_App::getAppPath($app);
if (file_exists($app_path . '/' . $file)) {
$file_ext = substr($file, -3);
if ($file_ext == 'css') {
$app_web_path = OC_App::getAppWebPath($app);
$filepath = $app_web_path . '/' . $file;
$minimizer = new OC_Minimizer_CSS();
$info = array($app_path, $app_web_path, $file);
$minimizer->output(array($info), $filepath);
exit;
} elseif($file_ext == 'php') {
$file = $app_path . '/' . $file;
unset($app, $app_path, $app_web_path, $file_ext);
require_once($file);
}
}
else {
die();
header('HTTP/1.0 404 Not Found');
exit;
}
}
public static function tryRememberLogin() {
if(!isset($_COOKIE["oc_remember_login"])
|| !isset($_COOKIE["oc_token"])