@@ -37,91 +37,91 @@ discard block |
||
37 | 37 | /** @var Application $application */ |
38 | 38 | $application = \OC::$server->query(Application::class); |
39 | 39 | $application->registerRoutes($this, [ |
40 | - 'routes' => [ |
|
41 | - ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'], |
|
42 | - ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'], |
|
43 | - ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'], |
|
44 | - ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'], |
|
45 | - ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'], |
|
46 | - ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'], |
|
47 | - ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'], |
|
48 | - ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'], |
|
49 | - ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'], |
|
50 | - ['name' => 'GuestAvatar#getAvatar', 'url' => '/avatar/guest/{guestName}/{size}', 'verb' => 'GET'], |
|
51 | - ['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'], |
|
52 | - ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'], |
|
53 | - ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'], |
|
54 | - ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'], |
|
55 | - ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'], |
|
56 | - // Original login flow used by all clients |
|
57 | - ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'], |
|
58 | - ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'], |
|
59 | - ['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'], |
|
60 | - ['name' => 'ClientFlowLogin#apptokenRedirect', 'url' => '/login/flow/apptoken', 'verb' => 'POST'], |
|
61 | - // NG login flow used by desktop client in case of Kerberos/fancy 2fa (smart cards for example) |
|
62 | - ['name' => 'ClientFlowLoginV2#poll', 'url' => '/login/v2/poll', 'verb' => 'POST'], |
|
63 | - ['name' => 'ClientFlowLoginV2#showAuthPickerPage', 'url' => '/login/v2/flow', 'verb' => 'GET'], |
|
64 | - ['name' => 'ClientFlowLoginV2#landing', 'url' => '/login/v2/flow/{token}', 'verb' => 'GET'], |
|
65 | - ['name' => 'ClientFlowLoginV2#grantPage', 'url' => '/login/v2/grant', 'verb' => 'GET'], |
|
66 | - ['name' => 'ClientFlowLoginV2#generateAppPassword', 'url' => '/login/v2/grant', 'verb' => 'POST'], |
|
67 | - ['name' => 'ClientFlowLoginV2#init', 'url' => '/login/v2', 'verb' => 'POST'], |
|
68 | - ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'], |
|
69 | - ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'], |
|
70 | - ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'], |
|
71 | - ['name' => 'TwoFactorChallenge#setupProviders', 'url' => 'login/setupchallenge', 'verb' => 'GET'], |
|
72 | - ['name' => 'TwoFactorChallenge#setupProvider', 'url' => 'login/setupchallenge/{providerId}', 'verb' => 'GET'], |
|
73 | - ['name' => 'TwoFactorChallenge#confirmProviderSetup', 'url' => 'login/setupchallenge/{providerId}', 'verb' => 'POST'], |
|
74 | - ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'], |
|
75 | - ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'], |
|
76 | - ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'], |
|
77 | - ['name' => 'RecommendedApps#index', 'url' => '/core/apps/recommended', 'verb' => 'GET'], |
|
78 | - ['name' => 'Svg#getSvgFromCore', 'url' => '/svg/core/{folder}/{fileName}', 'verb' => 'GET'], |
|
79 | - ['name' => 'Svg#getSvgFromApp', 'url' => '/svg/{app}/{fileName}', 'verb' => 'GET'], |
|
80 | - ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'], |
|
81 | - ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'], |
|
82 | - ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'], |
|
83 | - ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'], |
|
84 | - ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'], |
|
85 | - ['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'], |
|
86 | - ['name' => 'Wipe#checkWipe', 'url' => '/core/wipe/check', 'verb' => 'POST'], |
|
87 | - ['name' => 'Wipe#wipeDone', 'url' => '/core/wipe/success', 'verb' => 'POST'], |
|
40 | + 'routes' => [ |
|
41 | + ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'], |
|
42 | + ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'], |
|
43 | + ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'], |
|
44 | + ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'], |
|
45 | + ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'], |
|
46 | + ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'], |
|
47 | + ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'], |
|
48 | + ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'], |
|
49 | + ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'], |
|
50 | + ['name' => 'GuestAvatar#getAvatar', 'url' => '/avatar/guest/{guestName}/{size}', 'verb' => 'GET'], |
|
51 | + ['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'], |
|
52 | + ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'], |
|
53 | + ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'], |
|
54 | + ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'], |
|
55 | + ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'], |
|
56 | + // Original login flow used by all clients |
|
57 | + ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'], |
|
58 | + ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'], |
|
59 | + ['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'], |
|
60 | + ['name' => 'ClientFlowLogin#apptokenRedirect', 'url' => '/login/flow/apptoken', 'verb' => 'POST'], |
|
61 | + // NG login flow used by desktop client in case of Kerberos/fancy 2fa (smart cards for example) |
|
62 | + ['name' => 'ClientFlowLoginV2#poll', 'url' => '/login/v2/poll', 'verb' => 'POST'], |
|
63 | + ['name' => 'ClientFlowLoginV2#showAuthPickerPage', 'url' => '/login/v2/flow', 'verb' => 'GET'], |
|
64 | + ['name' => 'ClientFlowLoginV2#landing', 'url' => '/login/v2/flow/{token}', 'verb' => 'GET'], |
|
65 | + ['name' => 'ClientFlowLoginV2#grantPage', 'url' => '/login/v2/grant', 'verb' => 'GET'], |
|
66 | + ['name' => 'ClientFlowLoginV2#generateAppPassword', 'url' => '/login/v2/grant', 'verb' => 'POST'], |
|
67 | + ['name' => 'ClientFlowLoginV2#init', 'url' => '/login/v2', 'verb' => 'POST'], |
|
68 | + ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'], |
|
69 | + ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'], |
|
70 | + ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'], |
|
71 | + ['name' => 'TwoFactorChallenge#setupProviders', 'url' => 'login/setupchallenge', 'verb' => 'GET'], |
|
72 | + ['name' => 'TwoFactorChallenge#setupProvider', 'url' => 'login/setupchallenge/{providerId}', 'verb' => 'GET'], |
|
73 | + ['name' => 'TwoFactorChallenge#confirmProviderSetup', 'url' => 'login/setupchallenge/{providerId}', 'verb' => 'POST'], |
|
74 | + ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'], |
|
75 | + ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'], |
|
76 | + ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'], |
|
77 | + ['name' => 'RecommendedApps#index', 'url' => '/core/apps/recommended', 'verb' => 'GET'], |
|
78 | + ['name' => 'Svg#getSvgFromCore', 'url' => '/svg/core/{folder}/{fileName}', 'verb' => 'GET'], |
|
79 | + ['name' => 'Svg#getSvgFromApp', 'url' => '/svg/{app}/{fileName}', 'verb' => 'GET'], |
|
80 | + ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'], |
|
81 | + ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'], |
|
82 | + ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'], |
|
83 | + ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'], |
|
84 | + ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'], |
|
85 | + ['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'], |
|
86 | + ['name' => 'Wipe#checkWipe', 'url' => '/core/wipe/check', 'verb' => 'POST'], |
|
87 | + ['name' => 'Wipe#wipeDone', 'url' => '/core/wipe/success', 'verb' => 'POST'], |
|
88 | 88 | |
89 | - // Legacy routes that need to be globally available while they are handled by an app |
|
90 | - ['name' => 'viewcontroller#showFile', 'url' => '/f/{fileid}', 'verb' => 'GET', 'app' => 'files'], |
|
91 | - ['name' => 'sharecontroller#showShare', 'url' => '/s/{token}', 'verb' => 'GET', 'app' => 'files_sharing'], |
|
92 | - ['name' => 'sharecontroller#showAuthenticate', 'url' => '/s/{token}/authenticate/{redirect}', 'verb' => 'GET', 'app' => 'files_sharing'], |
|
93 | - ['name' => 'sharecontroller#authenticate', 'url' => '/s/{token}/authenticate/{redirect}', 'verb' => 'POST', 'app' => 'files_sharing'], |
|
94 | - ['name' => 'sharecontroller#downloadShare', 'url' => '/s/{token}/download', 'verb' => 'GET', 'app' => 'files_sharing'], |
|
95 | - ['name' => 'publicpreview#directLink', 'url' => '/s/{token}/preview', 'verb' => 'GET', 'app' => 'files_sharing'], |
|
96 | - ['name' => 'requesthandlercontroller#addShare', 'url' => '/ocm/shares', 'verb' => 'POST', 'app' => 'cloud_federation_api'], |
|
97 | - ['name' => 'requesthandlercontroller#receiveNotification', 'url' => '/ocm/notifications', 'verb' => 'POST', 'app' => 'cloud_federation_api'], |
|
98 | - ['name' => 'pagecontroller#showCall', 'url' => '/call/{token}', 'verb' => 'GET', 'app' => 'spreed'], |
|
99 | - ['name' => 'pagecontroller#authenticatePassword', 'url' => '/call/{token}', 'verb' => 'POST', 'app' => 'spreed'], |
|
100 | - ], |
|
101 | - 'ocs' => [ |
|
102 | - ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'], |
|
103 | - ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'], |
|
104 | - ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'], |
|
105 | - ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'], |
|
106 | - ['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'], |
|
107 | - ['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'], |
|
108 | - ['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'], |
|
109 | - ['root' => '/core', 'name' => 'WhatsNew#get', 'url' => '/whatsnew', 'verb' => 'GET'], |
|
110 | - ['root' => '/core', 'name' => 'WhatsNew#dismiss', 'url' => '/whatsnew', 'verb' => 'POST'], |
|
111 | - ['root' => '/core', 'name' => 'AppPassword#getAppPassword', 'url' => '/getapppassword', 'verb' => 'GET'], |
|
112 | - ['root' => '/core', 'name' => 'AppPassword#rotateAppPassword', 'url' => '/apppassword/rotate', 'verb' => 'POST'], |
|
113 | - ['root' => '/core', 'name' => 'AppPassword#deleteAppPassword', 'url' => '/apppassword', 'verb' => 'DELETE'], |
|
89 | + // Legacy routes that need to be globally available while they are handled by an app |
|
90 | + ['name' => 'viewcontroller#showFile', 'url' => '/f/{fileid}', 'verb' => 'GET', 'app' => 'files'], |
|
91 | + ['name' => 'sharecontroller#showShare', 'url' => '/s/{token}', 'verb' => 'GET', 'app' => 'files_sharing'], |
|
92 | + ['name' => 'sharecontroller#showAuthenticate', 'url' => '/s/{token}/authenticate/{redirect}', 'verb' => 'GET', 'app' => 'files_sharing'], |
|
93 | + ['name' => 'sharecontroller#authenticate', 'url' => '/s/{token}/authenticate/{redirect}', 'verb' => 'POST', 'app' => 'files_sharing'], |
|
94 | + ['name' => 'sharecontroller#downloadShare', 'url' => '/s/{token}/download', 'verb' => 'GET', 'app' => 'files_sharing'], |
|
95 | + ['name' => 'publicpreview#directLink', 'url' => '/s/{token}/preview', 'verb' => 'GET', 'app' => 'files_sharing'], |
|
96 | + ['name' => 'requesthandlercontroller#addShare', 'url' => '/ocm/shares', 'verb' => 'POST', 'app' => 'cloud_federation_api'], |
|
97 | + ['name' => 'requesthandlercontroller#receiveNotification', 'url' => '/ocm/notifications', 'verb' => 'POST', 'app' => 'cloud_federation_api'], |
|
98 | + ['name' => 'pagecontroller#showCall', 'url' => '/call/{token}', 'verb' => 'GET', 'app' => 'spreed'], |
|
99 | + ['name' => 'pagecontroller#authenticatePassword', 'url' => '/call/{token}', 'verb' => 'POST', 'app' => 'spreed'], |
|
100 | + ], |
|
101 | + 'ocs' => [ |
|
102 | + ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'], |
|
103 | + ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'], |
|
104 | + ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'], |
|
105 | + ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'], |
|
106 | + ['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'], |
|
107 | + ['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'], |
|
108 | + ['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'], |
|
109 | + ['root' => '/core', 'name' => 'WhatsNew#get', 'url' => '/whatsnew', 'verb' => 'GET'], |
|
110 | + ['root' => '/core', 'name' => 'WhatsNew#dismiss', 'url' => '/whatsnew', 'verb' => 'POST'], |
|
111 | + ['root' => '/core', 'name' => 'AppPassword#getAppPassword', 'url' => '/getapppassword', 'verb' => 'GET'], |
|
112 | + ['root' => '/core', 'name' => 'AppPassword#rotateAppPassword', 'url' => '/apppassword/rotate', 'verb' => 'POST'], |
|
113 | + ['root' => '/core', 'name' => 'AppPassword#deleteAppPassword', 'url' => '/apppassword', 'verb' => 'DELETE'], |
|
114 | 114 | |
115 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#searchCollections', 'url' => '/resources/collections/search/{filter}', 'verb' => 'GET'], |
|
116 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#listCollection', 'url' => '/resources/collections/{collectionId}', 'verb' => 'GET'], |
|
117 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#renameCollection', 'url' => '/resources/collections/{collectionId}', 'verb' => 'PUT'], |
|
118 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#addResource', 'url' => '/resources/collections/{collectionId}', 'verb' => 'POST'], |
|
115 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#searchCollections', 'url' => '/resources/collections/search/{filter}', 'verb' => 'GET'], |
|
116 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#listCollection', 'url' => '/resources/collections/{collectionId}', 'verb' => 'GET'], |
|
117 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#renameCollection', 'url' => '/resources/collections/{collectionId}', 'verb' => 'PUT'], |
|
118 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#addResource', 'url' => '/resources/collections/{collectionId}', 'verb' => 'POST'], |
|
119 | 119 | |
120 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#removeResource', 'url' => '/resources/collections/{collectionId}', 'verb' => 'DELETE'], |
|
121 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#getCollectionsByResource', 'url' => '/resources/{resourceType}/{resourceId}', 'verb' => 'GET'], |
|
122 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#createCollectionOnResource', 'url' => '/resources/{baseResourceType}/{baseResourceId}', 'verb' => 'POST'] |
|
120 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#removeResource', 'url' => '/resources/collections/{collectionId}', 'verb' => 'DELETE'], |
|
121 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#getCollectionsByResource', 'url' => '/resources/{resourceType}/{resourceId}', 'verb' => 'GET'], |
|
122 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#createCollectionOnResource', 'url' => '/resources/{baseResourceType}/{baseResourceId}', 'verb' => 'POST'] |
|
123 | 123 | |
124 | - ], |
|
124 | + ], |
|
125 | 125 | ]); |
126 | 126 | |
127 | 127 | // Post installation check |
@@ -130,4 +130,4 @@ discard block |
||
130 | 130 | // Core ajax actions |
131 | 131 | // Routing |
132 | 132 | $this->create('core_ajax_update', '/core/ajax/update.php') |
133 | - ->actionInclude('core/ajax/update.php'); |
|
133 | + ->actionInclude('core/ajax/update.php'); |
@@ -32,22 +32,22 @@ |
||
32 | 32 | |
33 | 33 | class RecommendedAppsController extends Controller { |
34 | 34 | |
35 | - /** @var IInitialStateService */ |
|
36 | - private $initialStateService; |
|
37 | - |
|
38 | - public function __construct(IRequest $request, |
|
39 | - IInitialStateService $initialStateService) { |
|
40 | - parent::__construct('core', $request); |
|
41 | - $this->initialStateService = $initialStateService; |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * @NoCSRFRequired |
|
46 | - * @return Response |
|
47 | - */ |
|
48 | - public function index(): Response { |
|
49 | - $this->initialStateService->provideInitialState('core', 'defaultPageUrl', \OC_Util::getDefaultPageUrl()); |
|
50 | - return new StandaloneTemplateResponse($this->appName, 'recommendedapps', [], 'guest'); |
|
51 | - } |
|
35 | + /** @var IInitialStateService */ |
|
36 | + private $initialStateService; |
|
37 | + |
|
38 | + public function __construct(IRequest $request, |
|
39 | + IInitialStateService $initialStateService) { |
|
40 | + parent::__construct('core', $request); |
|
41 | + $this->initialStateService = $initialStateService; |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * @NoCSRFRequired |
|
46 | + * @return Response |
|
47 | + */ |
|
48 | + public function index(): Response { |
|
49 | + $this->initialStateService->provideInitialState('core', 'defaultPageUrl', \OC_Util::getDefaultPageUrl()); |
|
50 | + return new StandaloneTemplateResponse($this->appName, 'recommendedapps', [], 'guest'); |
|
51 | + } |
|
52 | 52 | |
53 | 53 | } |
@@ -37,117 +37,117 @@ |
||
37 | 37 | use function urlencode; |
38 | 38 | |
39 | 39 | class SetupController { |
40 | - /** @var Setup */ |
|
41 | - protected $setupHelper; |
|
42 | - /** @var string */ |
|
43 | - private $autoConfigFile; |
|
44 | - |
|
45 | - /** |
|
46 | - * @param Setup $setupHelper |
|
47 | - */ |
|
48 | - function __construct(Setup $setupHelper) { |
|
49 | - $this->autoConfigFile = \OC::$configDir.'autoconfig.php'; |
|
50 | - $this->setupHelper = $setupHelper; |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * @param $post |
|
55 | - */ |
|
56 | - public function run($post) { |
|
57 | - // Check for autosetup: |
|
58 | - $post = $this->loadAutoConfig($post); |
|
59 | - $opts = $this->setupHelper->getSystemInfo(); |
|
60 | - |
|
61 | - // convert 'abcpassword' to 'abcpass' |
|
62 | - if (isset($post['adminpassword'])) { |
|
63 | - $post['adminpass'] = $post['adminpassword']; |
|
64 | - } |
|
65 | - if (isset($post['dbpassword'])) { |
|
66 | - $post['dbpass'] = $post['dbpassword']; |
|
67 | - } |
|
68 | - |
|
69 | - if (!is_file(\OC::$configDir.'/CAN_INSTALL')) { |
|
70 | - $this->displaySetupForbidden(); |
|
71 | - return; |
|
72 | - } |
|
73 | - |
|
74 | - if(isset($post['install']) AND $post['install']=='true') { |
|
75 | - // We have to launch the installation process : |
|
76 | - $e = $this->setupHelper->install($post); |
|
77 | - $errors = array('errors' => $e); |
|
78 | - |
|
79 | - if(count($e) > 0) { |
|
80 | - $options = array_merge($opts, $post, $errors); |
|
81 | - $this->display($options); |
|
82 | - } else { |
|
83 | - $this->finishSetup(isset($post['install-recommended-apps'])); |
|
84 | - } |
|
85 | - } else { |
|
86 | - $options = array_merge($opts, $post); |
|
87 | - $this->display($options); |
|
88 | - } |
|
89 | - } |
|
90 | - |
|
91 | - private function displaySetupForbidden() { |
|
92 | - \OC_Template::printGuestPage('', 'installation_forbidden'); |
|
93 | - } |
|
94 | - |
|
95 | - public function display($post) { |
|
96 | - $defaults = array( |
|
97 | - 'adminlogin' => '', |
|
98 | - 'adminpass' => '', |
|
99 | - 'dbuser' => '', |
|
100 | - 'dbpass' => '', |
|
101 | - 'dbname' => '', |
|
102 | - 'dbtablespace' => '', |
|
103 | - 'dbhost' => 'localhost', |
|
104 | - 'dbtype' => '', |
|
105 | - ); |
|
106 | - $parameters = array_merge($defaults, $post); |
|
107 | - |
|
108 | - \OC_Util::addScript('setup'); |
|
109 | - \OC_Template::printGuestPage('', 'installation', $parameters); |
|
110 | - } |
|
111 | - |
|
112 | - private function finishSetup(bool $installRecommended) { |
|
113 | - if( file_exists( $this->autoConfigFile )) { |
|
114 | - unlink($this->autoConfigFile); |
|
115 | - } |
|
116 | - \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); |
|
117 | - |
|
118 | - if (\OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL')) { |
|
119 | - if (!unlink(\OC::$configDir.'/CAN_INSTALL')) { |
|
120 | - \OC_Template::printGuestPage('', 'installation_incomplete'); |
|
121 | - } |
|
122 | - } |
|
123 | - |
|
124 | - if ($installRecommended) { |
|
125 | - $urlGenerator = \OC::$server->getURLGenerator(); |
|
126 | - $location = $urlGenerator->getAbsoluteURL('index.php/core/apps/recommended'); |
|
127 | - header('Location: ' . $location); |
|
128 | - exit(); |
|
129 | - } |
|
130 | - \OC_Util::redirectToDefaultPage(); |
|
131 | - } |
|
132 | - |
|
133 | - public function loadAutoConfig($post) { |
|
134 | - if( file_exists($this->autoConfigFile)) { |
|
135 | - \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); |
|
136 | - $AUTOCONFIG = array(); |
|
137 | - include $this->autoConfigFile; |
|
138 | - $post = array_merge ($post, $AUTOCONFIG); |
|
139 | - } |
|
140 | - |
|
141 | - $dbIsSet = isset($post['dbtype']); |
|
142 | - $directoryIsSet = isset($post['directory']); |
|
143 | - $adminAccountIsSet = isset($post['adminlogin']); |
|
144 | - |
|
145 | - if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { |
|
146 | - $post['install'] = 'true'; |
|
147 | - } |
|
148 | - $post['dbIsSet'] = $dbIsSet; |
|
149 | - $post['directoryIsSet'] = $directoryIsSet; |
|
150 | - |
|
151 | - return $post; |
|
152 | - } |
|
40 | + /** @var Setup */ |
|
41 | + protected $setupHelper; |
|
42 | + /** @var string */ |
|
43 | + private $autoConfigFile; |
|
44 | + |
|
45 | + /** |
|
46 | + * @param Setup $setupHelper |
|
47 | + */ |
|
48 | + function __construct(Setup $setupHelper) { |
|
49 | + $this->autoConfigFile = \OC::$configDir.'autoconfig.php'; |
|
50 | + $this->setupHelper = $setupHelper; |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * @param $post |
|
55 | + */ |
|
56 | + public function run($post) { |
|
57 | + // Check for autosetup: |
|
58 | + $post = $this->loadAutoConfig($post); |
|
59 | + $opts = $this->setupHelper->getSystemInfo(); |
|
60 | + |
|
61 | + // convert 'abcpassword' to 'abcpass' |
|
62 | + if (isset($post['adminpassword'])) { |
|
63 | + $post['adminpass'] = $post['adminpassword']; |
|
64 | + } |
|
65 | + if (isset($post['dbpassword'])) { |
|
66 | + $post['dbpass'] = $post['dbpassword']; |
|
67 | + } |
|
68 | + |
|
69 | + if (!is_file(\OC::$configDir.'/CAN_INSTALL')) { |
|
70 | + $this->displaySetupForbidden(); |
|
71 | + return; |
|
72 | + } |
|
73 | + |
|
74 | + if(isset($post['install']) AND $post['install']=='true') { |
|
75 | + // We have to launch the installation process : |
|
76 | + $e = $this->setupHelper->install($post); |
|
77 | + $errors = array('errors' => $e); |
|
78 | + |
|
79 | + if(count($e) > 0) { |
|
80 | + $options = array_merge($opts, $post, $errors); |
|
81 | + $this->display($options); |
|
82 | + } else { |
|
83 | + $this->finishSetup(isset($post['install-recommended-apps'])); |
|
84 | + } |
|
85 | + } else { |
|
86 | + $options = array_merge($opts, $post); |
|
87 | + $this->display($options); |
|
88 | + } |
|
89 | + } |
|
90 | + |
|
91 | + private function displaySetupForbidden() { |
|
92 | + \OC_Template::printGuestPage('', 'installation_forbidden'); |
|
93 | + } |
|
94 | + |
|
95 | + public function display($post) { |
|
96 | + $defaults = array( |
|
97 | + 'adminlogin' => '', |
|
98 | + 'adminpass' => '', |
|
99 | + 'dbuser' => '', |
|
100 | + 'dbpass' => '', |
|
101 | + 'dbname' => '', |
|
102 | + 'dbtablespace' => '', |
|
103 | + 'dbhost' => 'localhost', |
|
104 | + 'dbtype' => '', |
|
105 | + ); |
|
106 | + $parameters = array_merge($defaults, $post); |
|
107 | + |
|
108 | + \OC_Util::addScript('setup'); |
|
109 | + \OC_Template::printGuestPage('', 'installation', $parameters); |
|
110 | + } |
|
111 | + |
|
112 | + private function finishSetup(bool $installRecommended) { |
|
113 | + if( file_exists( $this->autoConfigFile )) { |
|
114 | + unlink($this->autoConfigFile); |
|
115 | + } |
|
116 | + \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); |
|
117 | + |
|
118 | + if (\OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL')) { |
|
119 | + if (!unlink(\OC::$configDir.'/CAN_INSTALL')) { |
|
120 | + \OC_Template::printGuestPage('', 'installation_incomplete'); |
|
121 | + } |
|
122 | + } |
|
123 | + |
|
124 | + if ($installRecommended) { |
|
125 | + $urlGenerator = \OC::$server->getURLGenerator(); |
|
126 | + $location = $urlGenerator->getAbsoluteURL('index.php/core/apps/recommended'); |
|
127 | + header('Location: ' . $location); |
|
128 | + exit(); |
|
129 | + } |
|
130 | + \OC_Util::redirectToDefaultPage(); |
|
131 | + } |
|
132 | + |
|
133 | + public function loadAutoConfig($post) { |
|
134 | + if( file_exists($this->autoConfigFile)) { |
|
135 | + \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); |
|
136 | + $AUTOCONFIG = array(); |
|
137 | + include $this->autoConfigFile; |
|
138 | + $post = array_merge ($post, $AUTOCONFIG); |
|
139 | + } |
|
140 | + |
|
141 | + $dbIsSet = isset($post['dbtype']); |
|
142 | + $directoryIsSet = isset($post['directory']); |
|
143 | + $adminAccountIsSet = isset($post['adminlogin']); |
|
144 | + |
|
145 | + if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { |
|
146 | + $post['install'] = 'true'; |
|
147 | + } |
|
148 | + $post['dbIsSet'] = $dbIsSet; |
|
149 | + $post['directoryIsSet'] = $directoryIsSet; |
|
150 | + |
|
151 | + return $post; |
|
152 | + } |
|
153 | 153 | } |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | return; |
72 | 72 | } |
73 | 73 | |
74 | - if(isset($post['install']) AND $post['install']=='true') { |
|
74 | + if (isset($post['install']) AND $post['install'] == 'true') { |
|
75 | 75 | // We have to launch the installation process : |
76 | 76 | $e = $this->setupHelper->install($post); |
77 | 77 | $errors = array('errors' => $e); |
78 | 78 | |
79 | - if(count($e) > 0) { |
|
79 | + if (count($e) > 0) { |
|
80 | 80 | $options = array_merge($opts, $post, $errors); |
81 | 81 | $this->display($options); |
82 | 82 | } else { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | private function finishSetup(bool $installRecommended) { |
113 | - if( file_exists( $this->autoConfigFile )) { |
|
113 | + if (file_exists($this->autoConfigFile)) { |
|
114 | 114 | unlink($this->autoConfigFile); |
115 | 115 | } |
116 | 116 | \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); |
@@ -124,18 +124,18 @@ discard block |
||
124 | 124 | if ($installRecommended) { |
125 | 125 | $urlGenerator = \OC::$server->getURLGenerator(); |
126 | 126 | $location = $urlGenerator->getAbsoluteURL('index.php/core/apps/recommended'); |
127 | - header('Location: ' . $location); |
|
127 | + header('Location: '.$location); |
|
128 | 128 | exit(); |
129 | 129 | } |
130 | 130 | \OC_Util::redirectToDefaultPage(); |
131 | 131 | } |
132 | 132 | |
133 | 133 | public function loadAutoConfig($post) { |
134 | - if( file_exists($this->autoConfigFile)) { |
|
134 | + if (file_exists($this->autoConfigFile)) { |
|
135 | 135 | \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); |
136 | 136 | $AUTOCONFIG = array(); |
137 | 137 | include $this->autoConfigFile; |
138 | - $post = array_merge ($post, $AUTOCONFIG); |
|
138 | + $post = array_merge($post, $AUTOCONFIG); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | $dbIsSet = isset($post['dbtype']); |