diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-08-08 21:08:20 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-08-08 22:42:50 +0200 |
commit | 9156fb73fdd8385f891842a94eb414cb7fc5e35c (patch) | |
tree | a737a4ecfee733200b2cebc5eb38d60027f157ef /lib | |
parent | 10cfcd4ff0e7cbe186df80cb9a9aa83a94aac882 (diff) | |
download | nextcloud-server-9156fb73fdd8385f891842a94eb414cb7fc5e35c.tar.gz nextcloud-server-9156fb73fdd8385f891842a94eb414cb7fc5e35c.zip |
Move handling request of index.php to OC class
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/base.php b/lib/base.php index c5827064d75..b91945ab97b 100644 --- a/lib/base.php +++ b/lib/base.php @@ -398,6 +398,54 @@ class OC{ } } } + + /** + * @brief Try to handle request + * @return true when the request is handled here + */ + public static function handleRequest() { + if (!OC_Config::getValue('installed', false)) { + // Check for autosetup: + $autosetup_file = OC::$SERVERROOT."/config/autoconfig.php"; + if( file_exists( $autosetup_file )){ + OC_Log::write('core','Autoconfig file found, setting up owncloud...',OC_Log::INFO); + include( $autosetup_file ); + $_POST['install'] = 'true'; + $_POST = array_merge ($_POST, $AUTOCONFIG); + unlink($autosetup_file); + } + OC_Util::addScript('setup'); + require_once('setup.php'); + exit(); + } + // Handle WebDAV + if($_SERVER['REQUEST_METHOD']=='PROPFIND'){ + header('location: '.OC_Helper::linkToRemote('webdav')); + return true; + } + if(!OC_User::isLoggedIn() && substr(OC::$REQUESTEDFILE,-3) == 'css') { + OC_App::loadApps(); + OC::loadfile(); + return true; + } + // Someone is logged in : + if(OC_User::isLoggedIn()) { + OC_App::loadApps(); + if(isset($_GET["logout"]) and ($_GET["logout"])) { + OC_User::logout(); + header("Location: ".OC::$WEBROOT.'/'); + }else{ + if(is_null(OC::$REQUESTEDFILE)) { + OC::loadapp(); + }else{ + OC::loadfile(); + } + } + return true; + } + return false; + } + } // define runtime variables - unless this already has been done |