Move OC::loadfile and OC::loadapp next to OC::handleRequest
This commit is contained in:
parent
e3c732040b
commit
da07245f59
70
lib/base.php
70
lib/base.php
|
@ -257,41 +257,6 @@ class OC{
|
||||||
session_start();
|
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(){
|
public static function init(){
|
||||||
// register autoloader
|
// register autoloader
|
||||||
spl_autoload_register(array('OC','autoload'));
|
spl_autoload_register(array('OC','autoload'));
|
||||||
|
@ -456,6 +421,41 @@ class OC{
|
||||||
return false;
|
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() {
|
public static function tryRememberLogin() {
|
||||||
if(!isset($_COOKIE["oc_remember_login"])
|
if(!isset($_COOKIE["oc_remember_login"])
|
||||||
|| !isset($_COOKIE["oc_token"])
|
|| !isset($_COOKIE["oc_token"])
|
||||||
|
|
Loading…
Reference in New Issue