summaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-08-10 00:40:16 +0200
committerBart Visscher <bartv@thisnet.nl>2012-08-10 11:43:04 +0200
commit0973969386d70ce9935d0c01860bea82d13d5663 (patch)
tree8ff4d3ced40941bb1e19b2c551c8adb10a8cb90a /lib/base.php
parent667cd318fe19c11a19883536501d9cd562cd6201 (diff)
downloadnextcloud-server-0973969386d70ce9935d0c01860bea82d13d5663.tar.gz
nextcloud-server-0973969386d70ce9935d0c01860bea82d13d5663.zip
Cleanup OC::loadfile
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php32
1 files changed, 21 insertions, 11 deletions
diff --git a/lib/base.php b/lib/base.php
index 4fc8cfa2455..62d3918171f 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -257,25 +257,35 @@ class OC{
session_start();
}
- public static function loadapp(){
- if(file_exists(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/index.php')){
+ public static function loadapp() {
+ if(file_exists(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/index.php')) {
require_once(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/index.php');
- }else{
+ }
+ else {
trigger_error('The requested App was not found.', E_USER_ERROR);//load default app instead?
}
}
- public static function loadfile(){
- if(file_exists(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/' . OC::$REQUESTEDFILE)){
- if(substr(OC::$REQUESTEDFILE, -3) == 'css'){
- $file = OC_App::getAppWebPath(OC::$REQUESTEDAPP). '/' . OC::$REQUESTEDFILE;
+ public 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();
- $minimizer->output(array(array(OC_App::getAppPath(OC::$REQUESTEDAPP), OC_App::getAppWebPath(OC::$REQUESTEDAPP), OC::$REQUESTEDFILE)),$file);
+ $info = array($app_path, $app_web_path, $file);
+ $minimizer->output(array($info), $filepath);
exit;
- }elseif(substr(OC::$REQUESTEDFILE, -3) == 'php'){
- require_once(OC_App::getAppPath(OC::$REQUESTEDAPP). '/' . OC::$REQUESTEDFILE);
+ } elseif($file_ext == 'php') {
+ $file = $app_path . '/' . $file;
+ unset($app, $app_path, $app_web_path, $file_ext);
+ require_once($file);
}
- }else{
+ }
+ else {
die();
header('HTTP/1.0 404 Not Found');
exit;