From 85019887dfed3762025d3fc936a61f085ab4e440 Mon Sep 17 00:00:00 2001
From: Georg Ehrke <dev@georgswebsite.de>
Date: Thu, 19 Apr 2012 16:44:49 +0200
Subject: [PATCH] add loading of files

---
 index.php    |  7 ++++++-
 lib/base.php | 11 +++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/index.php b/index.php
index 1858865875b..b85c49c76c2 100644
--- a/index.php
+++ b/index.php
@@ -57,7 +57,12 @@ elseif(OC_User::isLoggedIn()) {
 		exit();
 	}
 	else {
-		OC::loadapp();
+		if(is_null(OC::$REQUESTEDFILE)){
+			OC::loadapp();
+		}else{
+			OC::loadfile();
+		}
+		
 	}
 }
 
diff --git a/lib/base.php b/lib/base.php
index c21ab973593..2924a1da182 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -276,6 +276,17 @@ class OC{
 		if(file_exists(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP)){
 			OC_App::loadApps();
 			require_once(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/index.php');
+		}else{
+			trigger_error('The requested App was not found.', E_USER_ERROR);
+		}
+	}
+	
+	public static function loadfile(){
+		if(file_exists(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE)){
+			OC_App::loadApps();
+			require_once(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE);
+		}else{
+			header('404 Not Found');
 		}
 	}
 
-- 
GitLab