Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-06-10 15:45:19 +0400
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-06-10 15:45:19 +0400
commit8dc6bdd96b9088b87fe8d11346338343135c77e7 (patch)
tree2f969c8b9a0572d7e4648c9ad8ff2524bdaf27af /remote.php
parentc0bdbd9d81eb22ded95cd7ea9b26a0c36cfa1be0 (diff)
clean up usage of DatabaseSetupException and catch Exceptions in entrypoints
Diffstat (limited to 'remote.php')
-rw-r--r--remote.php77
1 files changed, 43 insertions, 34 deletions
diff --git a/remote.php b/remote.php
index 7738de04f60..ec0f2ecef72 100644
--- a/remote.php
+++ b/remote.php
@@ -1,40 +1,49 @@
<?php
$RUNTIME_NOAPPS = true;
-require_once 'lib/base.php';
-$path_info = OC_Request::getPathInfo();
-if ($path_info === false || $path_info === '') {
- OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
- exit;
-}
-if (!$pos = strpos($path_info, '/', 1)) {
- $pos = strlen($path_info);
-}
-$service=substr($path_info, 1, $pos-1);
-$file = OC_AppConfig::getValue('core', 'remote_' . $service);
+try {
-if(is_null($file)) {
- OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
- exit;
-}
+ require_once 'lib/base.php';
+ $path_info = OC_Request::getPathInfo();
+ if ($path_info === false || $path_info === '') {
+ OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
+ exit;
+ }
+ if (!$pos = strpos($path_info, '/', 1)) {
+ $pos = strlen($path_info);
+ }
+ $service=substr($path_info, 1, $pos-1);
-$file=ltrim($file, '/');
+ $file = OC_AppConfig::getValue('core', 'remote_' . $service);
-$parts=explode('/', $file, 2);
-$app=$parts[0];
-switch ($app) {
- case 'core':
- $file = OC::$SERVERROOT .'/'. $file;
- break;
- default:
- OC_Util::checkAppEnabled($app);
- OC_App::loadApp($app);
- if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
- $file = OC_App::getAppPath($app) .'/'. $parts[1];
- }else{
- $file = '/' . OC_App::getAppPath($app) .'/'. $parts[1];
- }
- break;
-}
-$baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
-require_once $file;
+ if(is_null($file)) {
+ OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
+ exit;
+ }
+
+ $file=ltrim($file, '/');
+
+ $parts=explode('/', $file, 2);
+ $app=$parts[0];
+ switch ($app) {
+ case 'core':
+ $file = OC::$SERVERROOT .'/'. $file;
+ break;
+ default:
+ OC_Util::checkAppEnabled($app);
+ OC_App::loadApp($app);
+ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+ $file = OC_App::getAppPath($app) .'/'. $parts[1];
+ }else{
+ $file = '/' . OC_App::getAppPath($app) .'/'. $parts[1];
+ }
+ break;
+ }
+ $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
+ require_once $file;
+
+} catch (Exception $ex) {
+ OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
+ \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
+ OC_Template::printExceptionErrorPage($ex);
+} \ No newline at end of file