Completed
Push — master ( d984be...e4e338 )
by Morris
214:31 queued 188:35
created
ocs/v1.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 require_once __DIR__ . '/../lib/base.php';
34 34
 
35 35
 if (\OCP\Util::needUpgrade()
36
-	|| \OC::$server->getSystemConfig()->getValue('maintenance', false)) {
37
-	// since the behavior of apps or remotes are unpredictable during
38
-	// an upgrade, return a 503 directly
39
-	http_response_code(503);
40
-	$response = new \OC\OCS\Result(null, OC_Response::STATUS_SERVICE_UNAVAILABLE, 'Service unavailable');
41
-	OC_API::respond($response, OC_API::requestedFormat());
42
-	exit;
36
+    || \OC::$server->getSystemConfig()->getValue('maintenance', false)) {
37
+    // since the behavior of apps or remotes are unpredictable during
38
+    // an upgrade, return a 503 directly
39
+    http_response_code(503);
40
+    $response = new \OC\OCS\Result(null, OC_Response::STATUS_SERVICE_UNAVAILABLE, 'Service unavailable');
41
+    OC_API::respond($response, OC_API::requestedFormat());
42
+    exit;
43 43
 }
44 44
 
45 45
 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
@@ -50,57 +50,57 @@  discard block
 block discarded – undo
50 50
  * We first try the old routes since the appframework triggers more login stuff.
51 51
  */
52 52
 try {
53
-	OC_App::loadApps(['session']);
54
-	OC_App::loadApps(['authentication']);
55
-	// load all apps to get all api routes properly setup
56
-	OC_App::loadApps();
53
+    OC_App::loadApps(['session']);
54
+    OC_App::loadApps(['authentication']);
55
+    // load all apps to get all api routes properly setup
56
+    OC_App::loadApps();
57 57
 
58
-	OC::$server->getRouter()->match('/ocs'.\OC::$server->getRequest()->getRawPathInfo());
58
+    OC::$server->getRouter()->match('/ocs'.\OC::$server->getRequest()->getRawPathInfo());
59 59
 
60
-	sleep(1);
61
-	OC::$server->getLogger()->info('This uses an old OCP\API::register construct. This will be removed in a future version of Nextcloud. Please migrate to the OCSController');
60
+    sleep(1);
61
+    OC::$server->getLogger()->info('This uses an old OCP\API::register construct. This will be removed in a future version of Nextcloud. Please migrate to the OCSController');
62 62
 
63
-	return;
63
+    return;
64 64
 } catch (ResourceNotFoundException $e) {
65
-	// Fall through the not found
65
+    // Fall through the not found
66 66
 } catch (MethodNotAllowedException $e) {
67
-	OC_API::setContentType();
68
-	http_response_code(405);
69
-	exit();
67
+    OC_API::setContentType();
68
+    http_response_code(405);
69
+    exit();
70 70
 } catch (Exception $ex) {
71
-	OC_API::respond($ex->getResult(), OC_API::requestedFormat());
72
-	exit();
71
+    OC_API::respond($ex->getResult(), OC_API::requestedFormat());
72
+    exit();
73 73
 }
74 74
 
75 75
 /*
76 76
  * Try the appframework routes
77 77
  */
78 78
 try {
79
-	if(!\OC::$server->getUserSession()->isLoggedIn()) {
80
-		OC::handleLogin(\OC::$server->getRequest());
81
-	}
82
-	OC::$server->getRouter()->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo());
79
+    if(!\OC::$server->getUserSession()->isLoggedIn()) {
80
+        OC::handleLogin(\OC::$server->getRequest());
81
+    }
82
+    OC::$server->getRouter()->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo());
83 83
 } catch (ResourceNotFoundException $e) {
84
-	OC_API::setContentType();
84
+    OC_API::setContentType();
85 85
 
86
-	$format = \OC::$server->getRequest()->getParam('format', 'xml');
87
-	$txt='Invalid query, please check the syntax. API specifications are here:'
88
-		.' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n";
89
-	OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
86
+    $format = \OC::$server->getRequest()->getParam('format', 'xml');
87
+    $txt='Invalid query, please check the syntax. API specifications are here:'
88
+        .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n";
89
+    OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
90 90
 } catch (MethodNotAllowedException $e) {
91
-	OC_API::setContentType();
92
-	http_response_code(405);
91
+    OC_API::setContentType();
92
+    http_response_code(405);
93 93
 } catch (\OC\OCS\Exception $ex) {
94
-	OC_API::respond($ex->getResult(), OC_API::requestedFormat());
94
+    OC_API::respond($ex->getResult(), OC_API::requestedFormat());
95 95
 } catch (\OC\User\LoginException $e) {
96
-	OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised'));
96
+    OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised'));
97 97
 } catch (\Exception $e) {
98
-	\OC::$server->getLogger()->logException($e);
99
-	OC_API::setContentType();
98
+    \OC::$server->getLogger()->logException($e);
99
+    OC_API::setContentType();
100 100
 
101
-	$format = \OC::$server->getRequest()->getParam('format', 'xml');
102
-	$txt='Invalid query, please check the syntax. API specifications are here:'
103
-		.' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n";
104
-	OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
101
+    $format = \OC::$server->getRequest()->getParam('format', 'xml');
102
+    $txt='Invalid query, please check the syntax. API specifications are here:'
103
+        .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n";
104
+    OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
105 105
 }
106 106
 
Please login to merge, or discard this patch.
status.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,32 +33,32 @@
 block discarded – undo
33 33
 
34 34
 try {
35 35
 
36
-	require_once __DIR__ . '/lib/base.php';
36
+    require_once __DIR__ . '/lib/base.php';
37 37
 
38
-	$systemConfig = \OC::$server->getSystemConfig();
38
+    $systemConfig = \OC::$server->getSystemConfig();
39 39
 
40
-	$installed = (bool) $systemConfig->getValue('installed', false);
41
-	$maintenance = (bool) $systemConfig->getValue('maintenance', false);
42
-	# see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
43
-	# for description and defaults
44
-	$defaults = new \OCP\Defaults();
45
-	$values=array(
46
-		'installed'=>$installed,
47
-		'maintenance' => $maintenance,
48
-		'needsDbUpgrade' => \OCP\Util::needUpgrade(),
49
-		'version'=>implode('.', \OCP\Util::getVersion()),
50
-		'versionstring'=>OC_Util::getVersionString(),
51
-		'edition'=> '',
52
-		'productname'=>$defaults->getName());
53
-	if (OC::$CLI) {
54
-		print_r($values);
55
-	} else {
56
-		header('Access-Control-Allow-Origin: *');
57
-		header('Content-Type: application/json');
58
-		echo json_encode($values);
59
-	}
40
+    $installed = (bool) $systemConfig->getValue('installed', false);
41
+    $maintenance = (bool) $systemConfig->getValue('maintenance', false);
42
+    # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
43
+    # for description and defaults
44
+    $defaults = new \OCP\Defaults();
45
+    $values=array(
46
+        'installed'=>$installed,
47
+        'maintenance' => $maintenance,
48
+        'needsDbUpgrade' => \OCP\Util::needUpgrade(),
49
+        'version'=>implode('.', \OCP\Util::getVersion()),
50
+        'versionstring'=>OC_Util::getVersionString(),
51
+        'edition'=> '',
52
+        'productname'=>$defaults->getName());
53
+    if (OC::$CLI) {
54
+        print_r($values);
55
+    } else {
56
+        header('Access-Control-Allow-Origin: *');
57
+        header('Content-Type: application/json');
58
+        echo json_encode($values);
59
+    }
60 60
 
61 61
 } catch (Exception $ex) {
62
-	http_response_code(500);
63
-	\OC::$server->getLogger()->logException($ex, ['app' => 'remote']);
62
+    http_response_code(500);
63
+    \OC::$server->getLogger()->logException($ex, ['app' => 'remote']);
64 64
 }
Please login to merge, or discard this patch.
apps/files/ajax/list.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -36,72 +36,72 @@
 block discarded – undo
36 36
 $dir = \OC\Files\Filesystem::normalizePath($dir);
37 37
 
38 38
 try {
39
-	$dirInfo = \OC\Files\Filesystem::getFileInfo($dir);
40
-	if (!$dirInfo || !$dirInfo->getType() === 'dir') {
41
-		http_response_code(404);
42
-		exit();
43
-	}
39
+    $dirInfo = \OC\Files\Filesystem::getFileInfo($dir);
40
+    if (!$dirInfo || !$dirInfo->getType() === 'dir') {
41
+        http_response_code(404);
42
+        exit();
43
+    }
44 44
 
45
-	$data = array();
46
-	$baseUrl = \OC::$server->getURLGenerator()->linkTo('files', 'index.php') . '?dir=';
45
+    $data = array();
46
+    $baseUrl = \OC::$server->getURLGenerator()->linkTo('files', 'index.php') . '?dir=';
47 47
 
48
-	$permissions = $dirInfo->getPermissions();
48
+    $permissions = $dirInfo->getPermissions();
49 49
 
50
-	$sortAttribute = isset($_GET['sort']) ? (string)$_GET['sort'] : 'name';
51
-	$sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false;
52
-	$mimetypeFilters = isset($_GET['mimetypes']) ? json_decode($_GET['mimetypes']) : '';
50
+    $sortAttribute = isset($_GET['sort']) ? (string)$_GET['sort'] : 'name';
51
+    $sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false;
52
+    $mimetypeFilters = isset($_GET['mimetypes']) ? json_decode($_GET['mimetypes']) : '';
53 53
 
54
-	$files = [];
55
-	// Clean up duplicates from array
56
-	if (is_array($mimetypeFilters) && count($mimetypeFilters)) {
57
-		$mimetypeFilters = array_unique($mimetypeFilters);
54
+    $files = [];
55
+    // Clean up duplicates from array
56
+    if (is_array($mimetypeFilters) && count($mimetypeFilters)) {
57
+        $mimetypeFilters = array_unique($mimetypeFilters);
58 58
 
59
-		if (!in_array('httpd/unix-directory', $mimetypeFilters)) {
60
-			// append folder filter to be able to browse folders
61
-			$mimetypeFilters[] = 'httpd/unix-directory';
62
-		}
59
+        if (!in_array('httpd/unix-directory', $mimetypeFilters)) {
60
+            // append folder filter to be able to browse folders
61
+            $mimetypeFilters[] = 'httpd/unix-directory';
62
+        }
63 63
 
64
-		// create filelist with mimetype filter - as getFiles only supports on
65
-		// mimetype filter at once we will filter this folder for each
66
-		// mimetypeFilter
67
-		foreach ($mimetypeFilters as $mimetypeFilter) {
68
-			$files = array_merge($files, \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection, $mimetypeFilter));
69
-		}
64
+        // create filelist with mimetype filter - as getFiles only supports on
65
+        // mimetype filter at once we will filter this folder for each
66
+        // mimetypeFilter
67
+        foreach ($mimetypeFilters as $mimetypeFilter) {
68
+            $files = array_merge($files, \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection, $mimetypeFilter));
69
+        }
70 70
 
71
-		// sort the files accordingly
72
-		$files = \OCA\Files\Helper::sortFiles($files, $sortAttribute, $sortDirection);
73
-	} else {
74
-		// create file list without mimetype filter
75
-		$files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
76
-	}
71
+        // sort the files accordingly
72
+        $files = \OCA\Files\Helper::sortFiles($files, $sortAttribute, $sortDirection);
73
+    } else {
74
+        // create file list without mimetype filter
75
+        $files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
76
+    }
77 77
 
78
-	$data['directory'] = $dir;
79
-	$data['files'] = \OCA\Files\Helper::formatFileInfos($files);
80
-	$data['permissions'] = $permissions;
78
+    $data['directory'] = $dir;
79
+    $data['files'] = \OCA\Files\Helper::formatFileInfos($files);
80
+    $data['permissions'] = $permissions;
81 81
 
82
-	\OC_JSON::success(array('data' => $data));
82
+    \OC_JSON::success(array('data' => $data));
83 83
 } catch (\OCP\Files\StorageNotAvailableException $e) {
84
-	\OC::$server->getLogger()->logException($e, ['app' => 'files']);
85
-	\OC_JSON::error([
86
-		'data' => [
87
-			'exception' => StorageNotAvailableException::class,
88
-			'message' => $l->t('Storage is temporarily not available')
89
-		]
90
-	]);
84
+    \OC::$server->getLogger()->logException($e, ['app' => 'files']);
85
+    \OC_JSON::error([
86
+        'data' => [
87
+            'exception' => StorageNotAvailableException::class,
88
+            'message' => $l->t('Storage is temporarily not available')
89
+        ]
90
+    ]);
91 91
 } catch (\OCP\Files\StorageInvalidException $e) {
92
-	\OC::$server->getLogger()->logException($e, ['app' => 'files']);
93
-	\OC_JSON::error(array(
94
-		'data' => array(
95
-			'exception' => StorageInvalidException::class,
96
-			'message' => $l->t('Storage invalid')
97
-		)
98
-	));
92
+    \OC::$server->getLogger()->logException($e, ['app' => 'files']);
93
+    \OC_JSON::error(array(
94
+        'data' => array(
95
+            'exception' => StorageInvalidException::class,
96
+            'message' => $l->t('Storage invalid')
97
+        )
98
+    ));
99 99
 } catch (\Exception $e) {
100
-	\OC::$server->getLogger()->logException($e, ['app' => 'files']);
101
-	\OC_JSON::error(array(
102
-		'data' => array(
103
-			'exception' => \Exception::class,
104
-			'message' => $l->t('Unknown error')
105
-		)
106
-	));
100
+    \OC::$server->getLogger()->logException($e, ['app' => 'files']);
101
+    \OC_JSON::error(array(
102
+        'data' => array(
103
+            'exception' => \Exception::class,
104
+            'message' => $l->t('Unknown error')
105
+        )
106
+    ));
107 107
 }
Please login to merge, or discard this patch.
apps/files_sharing/public.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@
 block discarded – undo
28 28
 $route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadShare' : 'files_sharing.sharecontroller.showShare';
29 29
 
30 30
 if($token !== '') {
31
-	$protocol = \OC::$server->getRequest()->getHttpProtocol();
32
-	if ($protocol == 'HTTP/1.0') {
33
-		http_response_code(302);
34
-	} else {
35
-		http_response_code(307);
36
-	}
37
-	header('Location: ' . $urlGenerator->linkToRoute($route, array('token' => $token)));
31
+    $protocol = \OC::$server->getRequest()->getHttpProtocol();
32
+    if ($protocol == 'HTTP/1.0') {
33
+        http_response_code(302);
34
+    } else {
35
+        http_response_code(307);
36
+    }
37
+    header('Location: ' . $urlGenerator->linkToRoute($route, array('token' => $token)));
38 38
 } else {
39
-	http_response_code(404);
40
-	$tmpl = new OCP\Template('', '404', 'guest');
41
-	print_unescaped($tmpl->fetchPage());
39
+    http_response_code(404);
40
+    $tmpl = new OCP\Template('', '404', 'guest');
41
+    print_unescaped($tmpl->fetchPage());
42 42
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@
 block discarded – undo
27 27
 $token = isset($_GET['t']) ? $_GET['t'] : '';
28 28
 $route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadShare' : 'files_sharing.sharecontroller.showShare';
29 29
 
30
-if($token !== '') {
30
+if ($token !== '') {
31 31
 	$protocol = \OC::$server->getRequest()->getHttpProtocol();
32 32
 	if ($protocol == 'HTTP/1.0') {
33 33
 		http_response_code(302);
34 34
 	} else {
35 35
 		http_response_code(307);
36 36
 	}
37
-	header('Location: ' . $urlGenerator->linkToRoute($route, array('token' => $token)));
37
+	header('Location: '.$urlGenerator->linkToRoute($route, array('token' => $token)));
38 38
 } else {
39 39
 	http_response_code(404);
40 40
 	$tmpl = new OCP\Template('', '404', 'guest');
Please login to merge, or discard this patch.
apps/files_versions/download.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@
 block discarded – undo
32 32
 $revision=(int)$_GET['revision'];
33 33
 
34 34
 try {
35
-	list($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($file);
35
+    list($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($file);
36 36
 } catch(\OCP\Files\NotFoundException $e) {
37
-	http_response_code(404);
38
-	$tmpl = new OCP\Template('', '404', 'guest');
39
-	$tmpl->assign('file', '');
40
-	$tmpl->printPage();
41
-	exit();
37
+    http_response_code(404);
38
+    $tmpl = new OCP\Template('', '404', 'guest');
39
+    $tmpl->assign('file', '');
40
+    $tmpl->printPage();
41
+    exit();
42 42
 }
43 43
 
44 44
 $versionName = '/'.$uid.'/files_versions/'.$filename.'.v'.$revision;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 \OC_JSON::checkLoggedIn();
30 30
 
31 31
 $file = $_GET['file'];
32
-$revision=(int)$_GET['revision'];
32
+$revision = (int) $_GET['revision'];
33 33
 
34 34
 try {
35 35
 	list($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($file);
36
-} catch(\OCP\Files\NotFoundException $e) {
36
+} catch (\OCP\Files\NotFoundException $e) {
37 37
 	http_response_code(404);
38 38
 	$tmpl = new OCP\Template('', '404', 'guest');
39 39
 	$tmpl->assign('file', '');
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 header('Content-Type:'.$ftype);
51 51
 \OC_Response::setContentDispositionHeader(basename($filename), 'attachment');
52
-header('Pragma: public');// enable caching in IE
52
+header('Pragma: public'); // enable caching in IE
53 53
 header('Expires: 0');
54 54
 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
55 55
 \OC_Response::setContentLengthHeader($view->filesize($versionName));
Please login to merge, or discard this patch.
apps/files_trashbin/ajax/list.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
 
33 33
 // make filelist
34 34
 try {
35
-	$files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir, \OCP\User::getUser(), $sortAttribute, $sortDirection);
35
+    $files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir, \OCP\User::getUser(), $sortAttribute, $sortDirection);
36 36
 } catch (Exception $e) {
37
-	http_response_code(404);
38
-	exit();
37
+    http_response_code(404);
38
+    exit();
39 39
 }
40 40
 
41 41
 $encodedDir = \OCP\Util::encodePath($dir);
Please login to merge, or discard this patch.
public.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -32,61 +32,61 @@
 block discarded – undo
32 32
 
33 33
 try {
34 34
 
35
-	require_once __DIR__ . '/lib/base.php';
36
-	if (\OCP\Util::needUpgrade()) {
37
-		// since the behavior of apps or remotes are unpredictable during
38
-		// an upgrade, return a 503 directly
39
-		OC_Template::printErrorPage('Service unavailable', '', 503);
40
-		exit;
41
-	}
35
+    require_once __DIR__ . '/lib/base.php';
36
+    if (\OCP\Util::needUpgrade()) {
37
+        // since the behavior of apps or remotes are unpredictable during
38
+        // an upgrade, return a 503 directly
39
+        OC_Template::printErrorPage('Service unavailable', '', 503);
40
+        exit;
41
+    }
42 42
 
43
-	OC::checkMaintenanceMode();
44
-	$request = \OC::$server->getRequest();
45
-	$pathInfo = $request->getPathInfo();
43
+    OC::checkMaintenanceMode();
44
+    $request = \OC::$server->getRequest();
45
+    $pathInfo = $request->getPathInfo();
46 46
 
47
-	if (!$pathInfo && $request->getParam('service', '') === '') {
48
-		http_response_code(404);
49
-		exit;
50
-	} elseif ($request->getParam('service', '')) {
51
-		$service = $request->getParam('service', '');
52
-	} else {
53
-		$pathInfo = trim($pathInfo, '/');
54
-		list($service) = explode('/', $pathInfo);
55
-	}
56
-	$file = \OC::$server->getConfig()->getAppValue('core', 'public_' . strip_tags($service));
57
-	if ($file === null) {
58
-		http_response_code(404);
59
-		exit;
60
-	}
47
+    if (!$pathInfo && $request->getParam('service', '') === '') {
48
+        http_response_code(404);
49
+        exit;
50
+    } elseif ($request->getParam('service', '')) {
51
+        $service = $request->getParam('service', '');
52
+    } else {
53
+        $pathInfo = trim($pathInfo, '/');
54
+        list($service) = explode('/', $pathInfo);
55
+    }
56
+    $file = \OC::$server->getConfig()->getAppValue('core', 'public_' . strip_tags($service));
57
+    if ($file === null) {
58
+        http_response_code(404);
59
+        exit;
60
+    }
61 61
 
62
-	$parts = explode('/', $file, 2);
63
-	$app = $parts[0];
62
+    $parts = explode('/', $file, 2);
63
+    $app = $parts[0];
64 64
 
65
-	// Load all required applications
66
-	\OC::$REQUESTEDAPP = $app;
67
-	OC_App::loadApps(array('authentication'));
68
-	OC_App::loadApps(array('filesystem', 'logging'));
65
+    // Load all required applications
66
+    \OC::$REQUESTEDAPP = $app;
67
+    OC_App::loadApps(array('authentication'));
68
+    OC_App::loadApps(array('filesystem', 'logging'));
69 69
 
70
-	if (!\OC::$server->getAppManager()->isInstalled($app)) {
71
-		throw new Exception('App not installed: ' . $app);
72
-	}
73
-	OC_App::loadApp($app);
74
-	OC_User::setIncognitoMode(true);
70
+    if (!\OC::$server->getAppManager()->isInstalled($app)) {
71
+        throw new Exception('App not installed: ' . $app);
72
+    }
73
+    OC_App::loadApp($app);
74
+    OC_User::setIncognitoMode(true);
75 75
 
76
-	$baseuri = OC::$WEBROOT . '/public.php/' . $service . '/';
76
+    $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/';
77 77
 
78
-	require_once OC_App::getAppPath($app) . '/' . $parts[1];
78
+    require_once OC_App::getAppPath($app) . '/' . $parts[1];
79 79
 
80 80
 } catch (Exception $ex) {
81
-	$status = 500;
82
-	if ($ex instanceof \OC\ServiceUnavailableException) {
83
-		$status = 503;
84
-	}
85
-	//show the user a detailed error page
86
-	\OC::$server->getLogger()->logException($ex, ['app' => 'public']);
87
-	OC_Template::printExceptionErrorPage($ex, $status);
81
+    $status = 500;
82
+    if ($ex instanceof \OC\ServiceUnavailableException) {
83
+        $status = 503;
84
+    }
85
+    //show the user a detailed error page
86
+    \OC::$server->getLogger()->logException($ex, ['app' => 'public']);
87
+    OC_Template::printExceptionErrorPage($ex, $status);
88 88
 } catch (Error $ex) {
89
-	//show the user a detailed error page
90
-	\OC::$server->getLogger()->logException($ex, ['app' => 'public']);
91
-	OC_Template::printExceptionErrorPage($ex, 500);
89
+    //show the user a detailed error page
90
+    \OC::$server->getLogger()->logException($ex, ['app' => 'public']);
91
+    OC_Template::printExceptionErrorPage($ex, 500);
92 92
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
  *
29 29
  */
30 30
 
31
-require_once __DIR__ . '/lib/versioncheck.php';
31
+require_once __DIR__.'/lib/versioncheck.php';
32 32
 
33 33
 try {
34 34
 
35
-	require_once __DIR__ . '/lib/base.php';
35
+	require_once __DIR__.'/lib/base.php';
36 36
 	if (\OCP\Util::needUpgrade()) {
37 37
 		// since the behavior of apps or remotes are unpredictable during
38 38
 		// an upgrade, return a 503 directly
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		$pathInfo = trim($pathInfo, '/');
54 54
 		list($service) = explode('/', $pathInfo);
55 55
 	}
56
-	$file = \OC::$server->getConfig()->getAppValue('core', 'public_' . strip_tags($service));
56
+	$file = \OC::$server->getConfig()->getAppValue('core', 'public_'.strip_tags($service));
57 57
 	if ($file === null) {
58 58
 		http_response_code(404);
59 59
 		exit;
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	OC_App::loadApps(array('filesystem', 'logging'));
69 69
 
70 70
 	if (!\OC::$server->getAppManager()->isInstalled($app)) {
71
-		throw new Exception('App not installed: ' . $app);
71
+		throw new Exception('App not installed: '.$app);
72 72
 	}
73 73
 	OC_App::loadApp($app);
74 74
 	OC_User::setIncognitoMode(true);
75 75
 
76
-	$baseuri = OC::$WEBROOT . '/public.php/' . $service . '/';
76
+	$baseuri = OC::$WEBROOT.'/public.php/'.$service.'/';
77 77
 
78
-	require_once OC_App::getAppPath($app) . '/' . $parts[1];
78
+	require_once OC_App::getAppPath($app).'/'.$parts[1];
79 79
 
80 80
 } catch (Exception $ex) {
81 81
 	$status = 500;
Please login to merge, or discard this patch.
index.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -37,44 +37,44 @@
 block discarded – undo
37 37
 
38 38
 try {
39 39
 
40
-	require_once __DIR__ . '/lib/base.php';
40
+    require_once __DIR__ . '/lib/base.php';
41 41
 
42
-	OC::handleRequest();
42
+    OC::handleRequest();
43 43
 
44 44
 } catch(\OC\ServiceUnavailableException $ex) {
45
-	\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
45
+    \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
46 46
 
47
-	//show the user a detailed error page
48
-	OC_Template::printExceptionErrorPage($ex, 503);
47
+    //show the user a detailed error page
48
+    OC_Template::printExceptionErrorPage($ex, 503);
49 49
 } catch (\OC\HintException $ex) {
50
-	try {
51
-		OC_Template::printErrorPage($ex->getMessage(), $ex->getHint(), 503);
52
-	} catch (Exception $ex2) {
53
-		\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
54
-		\OC::$server->getLogger()->logException($ex2, array('app' => 'index'));
50
+    try {
51
+        OC_Template::printErrorPage($ex->getMessage(), $ex->getHint(), 503);
52
+    } catch (Exception $ex2) {
53
+        \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
54
+        \OC::$server->getLogger()->logException($ex2, array('app' => 'index'));
55 55
 
56
-		//show the user a detailed error page
57
-		OC_Template::printExceptionErrorPage($ex, 500);
58
-	}
56
+        //show the user a detailed error page
57
+        OC_Template::printExceptionErrorPage($ex, 500);
58
+    }
59 59
 } catch (\OC\User\LoginException $ex) {
60
-	OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 403);
60
+    OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 403);
61 61
 } catch (Exception $ex) {
62
-	\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
62
+    \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
63 63
 
64
-	//show the user a detailed error page
65
-	OC_Template::printExceptionErrorPage($ex, 500);
64
+    //show the user a detailed error page
65
+    OC_Template::printExceptionErrorPage($ex, 500);
66 66
 } catch (Error $ex) {
67
-	try {
68
-		\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
69
-	} catch (Error $e) {
70
-		http_response_code(500);
71
-		header('Content-Type: text/plain; charset=utf-8');
72
-		print("Internal Server Error\n\n");
73
-		print("The server encountered an internal error and was unable to complete your request.\n");
74
-		print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n");
75
-		print("More details can be found in the webserver log.\n");
67
+    try {
68
+        \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
69
+    } catch (Error $e) {
70
+        http_response_code(500);
71
+        header('Content-Type: text/plain; charset=utf-8');
72
+        print("Internal Server Error\n\n");
73
+        print("The server encountered an internal error and was unable to complete your request.\n");
74
+        print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n");
75
+        print("More details can be found in the webserver log.\n");
76 76
 
77
-		throw $e;
78
-	}
79
-	OC_Template::printExceptionErrorPage($ex, 500);
77
+        throw $e;
78
+    }
79
+    OC_Template::printExceptionErrorPage($ex, 500);
80 80
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,15 +33,15 @@
 block discarded – undo
33 33
  *
34 34
  */
35 35
 
36
-require_once __DIR__ . '/lib/versioncheck.php';
36
+require_once __DIR__.'/lib/versioncheck.php';
37 37
 
38 38
 try {
39 39
 
40
-	require_once __DIR__ . '/lib/base.php';
40
+	require_once __DIR__.'/lib/base.php';
41 41
 
42 42
 	OC::handleRequest();
43 43
 
44
-} catch(\OC\ServiceUnavailableException $ex) {
44
+} catch (\OC\ServiceUnavailableException $ex) {
45 45
 	\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
46 46
 
47 47
 	//show the user a detailed error page
Please login to merge, or discard this patch.
remote.php 2 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -46,43 +46,43 @@  discard block
 block discarded – undo
46 46
  * @param Exception|Error $e
47 47
  */
48 48
 function handleException($e) {
49
-	$request = \OC::$server->getRequest();
50
-	// in case the request content type is text/xml - we assume it's a WebDAV request
51
-	$isXmlContentType = strpos($request->getHeader('Content-Type'), 'text/xml');
52
-	if ($isXmlContentType === 0) {
53
-		// fire up a simple server to properly process the exception
54
-		$server = new Server();
55
-		if (!($e instanceof RemoteException)) {
56
-			// we shall not log on RemoteException
57
-			$server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger()));
58
-		}
59
-		$server->on('beforeMethod', function () use ($e) {
60
-			if ($e instanceof RemoteException) {
61
-				switch ($e->getCode()) {
62
-					case 503:
63
-						throw new ServiceUnavailable($e->getMessage());
64
-					case 404:
65
-						throw new \Sabre\DAV\Exception\NotFound($e->getMessage());
66
-				}
67
-			}
68
-			$class = get_class($e);
69
-			$msg = $e->getMessage();
70
-			throw new ServiceUnavailable("$class: $msg");
71
-		});
72
-		$server->exec();
73
-	} else {
74
-		$statusCode = 500;
75
-		if ($e instanceof \OC\ServiceUnavailableException ) {
76
-			$statusCode = 503;
77
-		}
78
-		if ($e instanceof RemoteException) {
79
-			// we shall not log on RemoteException
80
-			OC_Template::printErrorPage($e->getMessage(), '', $e->getCode());
81
-		} else {
82
-			\OC::$server->getLogger()->logException($e, ['app' => 'remote']);
83
-			OC_Template::printExceptionErrorPage($e, $statusCode);
84
-		}
85
-	}
49
+    $request = \OC::$server->getRequest();
50
+    // in case the request content type is text/xml - we assume it's a WebDAV request
51
+    $isXmlContentType = strpos($request->getHeader('Content-Type'), 'text/xml');
52
+    if ($isXmlContentType === 0) {
53
+        // fire up a simple server to properly process the exception
54
+        $server = new Server();
55
+        if (!($e instanceof RemoteException)) {
56
+            // we shall not log on RemoteException
57
+            $server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger()));
58
+        }
59
+        $server->on('beforeMethod', function () use ($e) {
60
+            if ($e instanceof RemoteException) {
61
+                switch ($e->getCode()) {
62
+                    case 503:
63
+                        throw new ServiceUnavailable($e->getMessage());
64
+                    case 404:
65
+                        throw new \Sabre\DAV\Exception\NotFound($e->getMessage());
66
+                }
67
+            }
68
+            $class = get_class($e);
69
+            $msg = $e->getMessage();
70
+            throw new ServiceUnavailable("$class: $msg");
71
+        });
72
+        $server->exec();
73
+    } else {
74
+        $statusCode = 500;
75
+        if ($e instanceof \OC\ServiceUnavailableException ) {
76
+            $statusCode = 503;
77
+        }
78
+        if ($e instanceof RemoteException) {
79
+            // we shall not log on RemoteException
80
+            OC_Template::printErrorPage($e->getMessage(), '', $e->getCode());
81
+        } else {
82
+            \OC::$server->getLogger()->logException($e, ['app' => 'remote']);
83
+            OC_Template::printExceptionErrorPage($e, $statusCode);
84
+        }
85
+    }
86 86
 }
87 87
 
88 88
 /**
@@ -90,80 +90,80 @@  discard block
 block discarded – undo
90 90
  * @return string
91 91
  */
92 92
 function resolveService($service) {
93
-	$services = [
94
-		'webdav' => 'dav/appinfo/v1/webdav.php',
95
-		'dav' => 'dav/appinfo/v2/remote.php',
96
-		'caldav' => 'dav/appinfo/v1/caldav.php',
97
-		'calendar' => 'dav/appinfo/v1/caldav.php',
98
-		'carddav' => 'dav/appinfo/v1/carddav.php',
99
-		'contacts' => 'dav/appinfo/v1/carddav.php',
100
-		'files' => 'dav/appinfo/v1/webdav.php',
101
-		'direct' => 'dav/appinfo/v2/direct.php',
102
-	];
103
-	if (isset($services[$service])) {
104
-		return $services[$service];
105
-	}
106
-
107
-	return \OC::$server->getConfig()->getAppValue('core', 'remote_' . $service);
93
+    $services = [
94
+        'webdav' => 'dav/appinfo/v1/webdav.php',
95
+        'dav' => 'dav/appinfo/v2/remote.php',
96
+        'caldav' => 'dav/appinfo/v1/caldav.php',
97
+        'calendar' => 'dav/appinfo/v1/caldav.php',
98
+        'carddav' => 'dav/appinfo/v1/carddav.php',
99
+        'contacts' => 'dav/appinfo/v1/carddav.php',
100
+        'files' => 'dav/appinfo/v1/webdav.php',
101
+        'direct' => 'dav/appinfo/v2/direct.php',
102
+    ];
103
+    if (isset($services[$service])) {
104
+        return $services[$service];
105
+    }
106
+
107
+    return \OC::$server->getConfig()->getAppValue('core', 'remote_' . $service);
108 108
 }
109 109
 
110 110
 try {
111
-	require_once __DIR__ . '/lib/base.php';
112
-
113
-	// All resources served via the DAV endpoint should have the strictest possible
114
-	// policy. Exempted from this is the SabreDAV browser plugin which overwrites
115
-	// this policy with a softer one if debug mode is enabled.
116
-	header("Content-Security-Policy: default-src 'none';");
117
-
118
-	if (\OCP\Util::needUpgrade()) {
119
-		// since the behavior of apps or remotes are unpredictable during
120
-		// an upgrade, return a 503 directly
121
-		throw new RemoteException('Service unavailable', 503);
122
-	}
123
-
124
-	$request = \OC::$server->getRequest();
125
-	$pathInfo = $request->getPathInfo();
126
-	if ($pathInfo === false || $pathInfo === '') {
127
-		throw new RemoteException('Path not found', 404);
128
-	}
129
-	if (!$pos = strpos($pathInfo, '/', 1)) {
130
-		$pos = strlen($pathInfo);
131
-	}
132
-	$service=substr($pathInfo, 1, $pos-1);
133
-
134
-	$file = resolveService($service);
135
-
136
-	if(is_null($file)) {
137
-		throw new RemoteException('Path not found', 404);
138
-	}
139
-
140
-	$file=ltrim($file, '/');
141
-
142
-	$parts=explode('/', $file, 2);
143
-	$app=$parts[0];
144
-
145
-	// Load all required applications
146
-	\OC::$REQUESTEDAPP = $app;
147
-	OC_App::loadApps(array('authentication'));
148
-	OC_App::loadApps(array('filesystem', 'logging'));
149
-
150
-	switch ($app) {
151
-		case 'core':
152
-			$file =  OC::$SERVERROOT .'/'. $file;
153
-			break;
154
-		default:
155
-			if (!\OC::$server->getAppManager()->isInstalled($app)) {
156
-				throw new RemoteException('App not installed: ' . $app);
157
-			}
158
-			OC_App::loadApp($app);
159
-			$file = OC_App::getAppPath($app) .'/'. $parts[1];
160
-			break;
161
-	}
162
-	$baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
163
-	require_once $file;
111
+    require_once __DIR__ . '/lib/base.php';
112
+
113
+    // All resources served via the DAV endpoint should have the strictest possible
114
+    // policy. Exempted from this is the SabreDAV browser plugin which overwrites
115
+    // this policy with a softer one if debug mode is enabled.
116
+    header("Content-Security-Policy: default-src 'none';");
117
+
118
+    if (\OCP\Util::needUpgrade()) {
119
+        // since the behavior of apps or remotes are unpredictable during
120
+        // an upgrade, return a 503 directly
121
+        throw new RemoteException('Service unavailable', 503);
122
+    }
123
+
124
+    $request = \OC::$server->getRequest();
125
+    $pathInfo = $request->getPathInfo();
126
+    if ($pathInfo === false || $pathInfo === '') {
127
+        throw new RemoteException('Path not found', 404);
128
+    }
129
+    if (!$pos = strpos($pathInfo, '/', 1)) {
130
+        $pos = strlen($pathInfo);
131
+    }
132
+    $service=substr($pathInfo, 1, $pos-1);
133
+
134
+    $file = resolveService($service);
135
+
136
+    if(is_null($file)) {
137
+        throw new RemoteException('Path not found', 404);
138
+    }
139
+
140
+    $file=ltrim($file, '/');
141
+
142
+    $parts=explode('/', $file, 2);
143
+    $app=$parts[0];
144
+
145
+    // Load all required applications
146
+    \OC::$REQUESTEDAPP = $app;
147
+    OC_App::loadApps(array('authentication'));
148
+    OC_App::loadApps(array('filesystem', 'logging'));
149
+
150
+    switch ($app) {
151
+        case 'core':
152
+            $file =  OC::$SERVERROOT .'/'. $file;
153
+            break;
154
+        default:
155
+            if (!\OC::$server->getAppManager()->isInstalled($app)) {
156
+                throw new RemoteException('App not installed: ' . $app);
157
+            }
158
+            OC_App::loadApp($app);
159
+            $file = OC_App::getAppPath($app) .'/'. $parts[1];
160
+            break;
161
+    }
162
+    $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
163
+    require_once $file;
164 164
 
165 165
 } catch (Exception $ex) {
166
-	handleException($ex);
166
+    handleException($ex);
167 167
 } catch (Error $e) {
168
-	handleException($e);
168
+    handleException($e);
169 169
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
  *
29 29
  */
30 30
 
31
-require_once __DIR__ . '/lib/versioncheck.php';
31
+require_once __DIR__.'/lib/versioncheck.php';
32 32
 
33 33
 use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
34 34
 use Sabre\DAV\Exception\ServiceUnavailable;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 			// we shall not log on RemoteException
57 57
 			$server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger()));
58 58
 		}
59
-		$server->on('beforeMethod', function () use ($e) {
59
+		$server->on('beforeMethod', function() use ($e) {
60 60
 			if ($e instanceof RemoteException) {
61 61
 				switch ($e->getCode()) {
62 62
 					case 503:
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		$server->exec();
73 73
 	} else {
74 74
 		$statusCode = 500;
75
-		if ($e instanceof \OC\ServiceUnavailableException ) {
75
+		if ($e instanceof \OC\ServiceUnavailableException) {
76 76
 			$statusCode = 503;
77 77
 		}
78 78
 		if ($e instanceof RemoteException) {
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 		return $services[$service];
105 105
 	}
106 106
 
107
-	return \OC::$server->getConfig()->getAppValue('core', 'remote_' . $service);
107
+	return \OC::$server->getConfig()->getAppValue('core', 'remote_'.$service);
108 108
 }
109 109
 
110 110
 try {
111
-	require_once __DIR__ . '/lib/base.php';
111
+	require_once __DIR__.'/lib/base.php';
112 112
 
113 113
 	// All resources served via the DAV endpoint should have the strictest possible
114 114
 	// policy. Exempted from this is the SabreDAV browser plugin which overwrites
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
 	if (!$pos = strpos($pathInfo, '/', 1)) {
130 130
 		$pos = strlen($pathInfo);
131 131
 	}
132
-	$service=substr($pathInfo, 1, $pos-1);
132
+	$service = substr($pathInfo, 1, $pos - 1);
133 133
 
134 134
 	$file = resolveService($service);
135 135
 
136
-	if(is_null($file)) {
136
+	if (is_null($file)) {
137 137
 		throw new RemoteException('Path not found', 404);
138 138
 	}
139 139
 
140
-	$file=ltrim($file, '/');
140
+	$file = ltrim($file, '/');
141 141
 
142
-	$parts=explode('/', $file, 2);
143
-	$app=$parts[0];
142
+	$parts = explode('/', $file, 2);
143
+	$app = $parts[0];
144 144
 
145 145
 	// Load all required applications
146 146
 	\OC::$REQUESTEDAPP = $app;
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
 
150 150
 	switch ($app) {
151 151
 		case 'core':
152
-			$file =  OC::$SERVERROOT .'/'. $file;
152
+			$file = OC::$SERVERROOT.'/'.$file;
153 153
 			break;
154 154
 		default:
155 155
 			if (!\OC::$server->getAppManager()->isInstalled($app)) {
156
-				throw new RemoteException('App not installed: ' . $app);
156
+				throw new RemoteException('App not installed: '.$app);
157 157
 			}
158 158
 			OC_App::loadApp($app);
159
-			$file = OC_App::getAppPath($app) .'/'. $parts[1];
159
+			$file = OC_App::getAppPath($app).'/'.$parts[1];
160 160
 			break;
161 161
 	}
162
-	$baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
162
+	$baseuri = OC::$WEBROOT.'/remote.php/'.$service.'/';
163 163
 	require_once $file;
164 164
 
165 165
 } catch (Exception $ex) {
Please login to merge, or discard this patch.