@@ -53,261 +53,261 @@ |
||
53 | 53 | use OCP\Util; |
54 | 54 | |
55 | 55 | class JSConfigHelper { |
56 | - protected IL10N $l; |
|
57 | - protected Defaults $defaults; |
|
58 | - protected IAppManager $appManager; |
|
59 | - protected ISession $session; |
|
60 | - protected ?IUser $currentUser; |
|
61 | - protected IConfig $config; |
|
62 | - protected IGroupManager $groupManager; |
|
63 | - protected IniGetWrapper $iniWrapper; |
|
64 | - protected IURLGenerator $urlGenerator; |
|
65 | - protected CapabilitiesManager $capabilitiesManager; |
|
66 | - protected IInitialStateService $initialStateService; |
|
56 | + protected IL10N $l; |
|
57 | + protected Defaults $defaults; |
|
58 | + protected IAppManager $appManager; |
|
59 | + protected ISession $session; |
|
60 | + protected ?IUser $currentUser; |
|
61 | + protected IConfig $config; |
|
62 | + protected IGroupManager $groupManager; |
|
63 | + protected IniGetWrapper $iniWrapper; |
|
64 | + protected IURLGenerator $urlGenerator; |
|
65 | + protected CapabilitiesManager $capabilitiesManager; |
|
66 | + protected IInitialStateService $initialStateService; |
|
67 | 67 | |
68 | - /** @var array user back-ends excluded from password verification */ |
|
69 | - private $excludedUserBackEnds = ['user_saml' => true, 'user_globalsiteselector' => true]; |
|
68 | + /** @var array user back-ends excluded from password verification */ |
|
69 | + private $excludedUserBackEnds = ['user_saml' => true, 'user_globalsiteselector' => true]; |
|
70 | 70 | |
71 | - public function __construct(IL10N $l, |
|
72 | - Defaults $defaults, |
|
73 | - IAppManager $appManager, |
|
74 | - ISession $session, |
|
75 | - ?IUser $currentUser, |
|
76 | - IConfig $config, |
|
77 | - IGroupManager $groupManager, |
|
78 | - IniGetWrapper $iniWrapper, |
|
79 | - IURLGenerator $urlGenerator, |
|
80 | - CapabilitiesManager $capabilitiesManager, |
|
81 | - IInitialStateService $initialStateService) { |
|
82 | - $this->l = $l; |
|
83 | - $this->defaults = $defaults; |
|
84 | - $this->appManager = $appManager; |
|
85 | - $this->session = $session; |
|
86 | - $this->currentUser = $currentUser; |
|
87 | - $this->config = $config; |
|
88 | - $this->groupManager = $groupManager; |
|
89 | - $this->iniWrapper = $iniWrapper; |
|
90 | - $this->urlGenerator = $urlGenerator; |
|
91 | - $this->capabilitiesManager = $capabilitiesManager; |
|
92 | - $this->initialStateService = $initialStateService; |
|
93 | - } |
|
71 | + public function __construct(IL10N $l, |
|
72 | + Defaults $defaults, |
|
73 | + IAppManager $appManager, |
|
74 | + ISession $session, |
|
75 | + ?IUser $currentUser, |
|
76 | + IConfig $config, |
|
77 | + IGroupManager $groupManager, |
|
78 | + IniGetWrapper $iniWrapper, |
|
79 | + IURLGenerator $urlGenerator, |
|
80 | + CapabilitiesManager $capabilitiesManager, |
|
81 | + IInitialStateService $initialStateService) { |
|
82 | + $this->l = $l; |
|
83 | + $this->defaults = $defaults; |
|
84 | + $this->appManager = $appManager; |
|
85 | + $this->session = $session; |
|
86 | + $this->currentUser = $currentUser; |
|
87 | + $this->config = $config; |
|
88 | + $this->groupManager = $groupManager; |
|
89 | + $this->iniWrapper = $iniWrapper; |
|
90 | + $this->urlGenerator = $urlGenerator; |
|
91 | + $this->capabilitiesManager = $capabilitiesManager; |
|
92 | + $this->initialStateService = $initialStateService; |
|
93 | + } |
|
94 | 94 | |
95 | - public function getConfig(): string { |
|
96 | - $userBackendAllowsPasswordConfirmation = true; |
|
97 | - if ($this->currentUser !== null) { |
|
98 | - $uid = $this->currentUser->getUID(); |
|
95 | + public function getConfig(): string { |
|
96 | + $userBackendAllowsPasswordConfirmation = true; |
|
97 | + if ($this->currentUser !== null) { |
|
98 | + $uid = $this->currentUser->getUID(); |
|
99 | 99 | |
100 | - $backend = $this->currentUser->getBackend(); |
|
101 | - if ($backend instanceof IPasswordConfirmationBackend) { |
|
102 | - $userBackendAllowsPasswordConfirmation = $backend->canConfirmPassword($uid); |
|
103 | - } elseif (isset($this->excludedUserBackEnds[$this->currentUser->getBackendClassName()])) { |
|
104 | - $userBackendAllowsPasswordConfirmation = false; |
|
105 | - } |
|
106 | - } else { |
|
107 | - $uid = null; |
|
108 | - } |
|
100 | + $backend = $this->currentUser->getBackend(); |
|
101 | + if ($backend instanceof IPasswordConfirmationBackend) { |
|
102 | + $userBackendAllowsPasswordConfirmation = $backend->canConfirmPassword($uid); |
|
103 | + } elseif (isset($this->excludedUserBackEnds[$this->currentUser->getBackendClassName()])) { |
|
104 | + $userBackendAllowsPasswordConfirmation = false; |
|
105 | + } |
|
106 | + } else { |
|
107 | + $uid = null; |
|
108 | + } |
|
109 | 109 | |
110 | - // Get the config |
|
111 | - $apps_paths = []; |
|
110 | + // Get the config |
|
111 | + $apps_paths = []; |
|
112 | 112 | |
113 | - if ($this->currentUser === null) { |
|
114 | - $apps = $this->appManager->getInstalledApps(); |
|
115 | - } else { |
|
116 | - $apps = $this->appManager->getEnabledAppsForUser($this->currentUser); |
|
117 | - } |
|
113 | + if ($this->currentUser === null) { |
|
114 | + $apps = $this->appManager->getInstalledApps(); |
|
115 | + } else { |
|
116 | + $apps = $this->appManager->getEnabledAppsForUser($this->currentUser); |
|
117 | + } |
|
118 | 118 | |
119 | - foreach ($apps as $app) { |
|
120 | - try { |
|
121 | - $apps_paths[$app] = $this->appManager->getAppWebPath($app); |
|
122 | - } catch (AppPathNotFoundException $e) { |
|
123 | - $apps_paths[$app] = false; |
|
124 | - } |
|
125 | - } |
|
119 | + foreach ($apps as $app) { |
|
120 | + try { |
|
121 | + $apps_paths[$app] = $this->appManager->getAppWebPath($app); |
|
122 | + } catch (AppPathNotFoundException $e) { |
|
123 | + $apps_paths[$app] = false; |
|
124 | + } |
|
125 | + } |
|
126 | 126 | |
127 | - $enableLinkPasswordByDefault = $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'); |
|
128 | - $enableLinkPasswordByDefault = $enableLinkPasswordByDefault === 'yes'; |
|
129 | - $defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
130 | - $defaultExpireDate = $enforceDefaultExpireDate = null; |
|
131 | - if ($defaultExpireDateEnabled) { |
|
132 | - $defaultExpireDate = (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
133 | - $enforceDefaultExpireDate = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
134 | - } |
|
135 | - $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; |
|
127 | + $enableLinkPasswordByDefault = $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'); |
|
128 | + $enableLinkPasswordByDefault = $enableLinkPasswordByDefault === 'yes'; |
|
129 | + $defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
130 | + $defaultExpireDate = $enforceDefaultExpireDate = null; |
|
131 | + if ($defaultExpireDateEnabled) { |
|
132 | + $defaultExpireDate = (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
133 | + $enforceDefaultExpireDate = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
134 | + } |
|
135 | + $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; |
|
136 | 136 | |
137 | - $defaultInternalExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes'; |
|
138 | - $defaultInternalExpireDate = $defaultInternalExpireDateEnforced = null; |
|
139 | - if ($defaultInternalExpireDateEnabled) { |
|
140 | - $defaultInternalExpireDate = (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
141 | - $defaultInternalExpireDateEnforced = $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes'; |
|
142 | - } |
|
137 | + $defaultInternalExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes'; |
|
138 | + $defaultInternalExpireDate = $defaultInternalExpireDateEnforced = null; |
|
139 | + if ($defaultInternalExpireDateEnabled) { |
|
140 | + $defaultInternalExpireDate = (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
141 | + $defaultInternalExpireDateEnforced = $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes'; |
|
142 | + } |
|
143 | 143 | |
144 | - $defaultRemoteExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_remote_expire_date', 'no') === 'yes'; |
|
145 | - $defaultRemoteExpireDate = $defaultRemoteExpireDateEnforced = null; |
|
146 | - if ($defaultRemoteExpireDateEnabled) { |
|
147 | - $defaultRemoteExpireDate = (int)$this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'); |
|
148 | - $defaultRemoteExpireDateEnforced = $this->config->getAppValue('core', 'shareapi_enforce_remote_expire_date', 'no') === 'yes'; |
|
149 | - } |
|
144 | + $defaultRemoteExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_remote_expire_date', 'no') === 'yes'; |
|
145 | + $defaultRemoteExpireDate = $defaultRemoteExpireDateEnforced = null; |
|
146 | + if ($defaultRemoteExpireDateEnabled) { |
|
147 | + $defaultRemoteExpireDate = (int)$this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'); |
|
148 | + $defaultRemoteExpireDateEnforced = $this->config->getAppValue('core', 'shareapi_enforce_remote_expire_date', 'no') === 'yes'; |
|
149 | + } |
|
150 | 150 | |
151 | - $countOfDataLocation = 0; |
|
152 | - $dataLocation = str_replace(\OC::$SERVERROOT . '/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
153 | - if ($countOfDataLocation !== 1 || $uid === null || !$this->groupManager->isAdmin($uid)) { |
|
154 | - $dataLocation = false; |
|
155 | - } |
|
151 | + $countOfDataLocation = 0; |
|
152 | + $dataLocation = str_replace(\OC::$SERVERROOT . '/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
153 | + if ($countOfDataLocation !== 1 || $uid === null || !$this->groupManager->isAdmin($uid)) { |
|
154 | + $dataLocation = false; |
|
155 | + } |
|
156 | 156 | |
157 | - if ($this->currentUser instanceof IUser) { |
|
158 | - $lastConfirmTimestamp = $this->session->get('last-password-confirm'); |
|
159 | - if (!is_int($lastConfirmTimestamp)) { |
|
160 | - $lastConfirmTimestamp = 0; |
|
161 | - } |
|
162 | - } else { |
|
163 | - $lastConfirmTimestamp = 0; |
|
164 | - } |
|
157 | + if ($this->currentUser instanceof IUser) { |
|
158 | + $lastConfirmTimestamp = $this->session->get('last-password-confirm'); |
|
159 | + if (!is_int($lastConfirmTimestamp)) { |
|
160 | + $lastConfirmTimestamp = 0; |
|
161 | + } |
|
162 | + } else { |
|
163 | + $lastConfirmTimestamp = 0; |
|
164 | + } |
|
165 | 165 | |
166 | - $capabilities = $this->capabilitiesManager->getCapabilities(false, true); |
|
166 | + $capabilities = $this->capabilitiesManager->getCapabilities(false, true); |
|
167 | 167 | |
168 | - $config = [ |
|
169 | - 'session_lifetime' => min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')), |
|
170 | - 'session_keepalive' => $this->config->getSystemValue('session_keepalive', true), |
|
171 | - 'auto_logout' => $this->config->getSystemValue('auto_logout', false), |
|
172 | - 'version' => implode('.', Util::getVersion()), |
|
173 | - 'versionstring' => \OC_Util::getVersionString(), |
|
174 | - 'enable_avatars' => true, // here for legacy reasons - to not crash existing code that relies on this value |
|
175 | - 'lost_password_link' => $this->config->getSystemValue('lost_password_link', null), |
|
176 | - 'modRewriteWorking' => $this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true', |
|
177 | - 'sharing.maxAutocompleteResults' => max(0, $this->config->getSystemValueInt('sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT)), |
|
178 | - 'sharing.minSearchStringLength' => $this->config->getSystemValueInt('sharing.minSearchStringLength', 0), |
|
179 | - 'blacklist_files_regex' => FileInfo::BLACKLIST_FILES_REGEX, |
|
180 | - 'loglevel' => $this->config->getSystemValue('loglevel_frontend', |
|
181 | - $this->config->getSystemValue('loglevel', ILogger::WARN) |
|
182 | - ), |
|
183 | - ]; |
|
168 | + $config = [ |
|
169 | + 'session_lifetime' => min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')), |
|
170 | + 'session_keepalive' => $this->config->getSystemValue('session_keepalive', true), |
|
171 | + 'auto_logout' => $this->config->getSystemValue('auto_logout', false), |
|
172 | + 'version' => implode('.', Util::getVersion()), |
|
173 | + 'versionstring' => \OC_Util::getVersionString(), |
|
174 | + 'enable_avatars' => true, // here for legacy reasons - to not crash existing code that relies on this value |
|
175 | + 'lost_password_link' => $this->config->getSystemValue('lost_password_link', null), |
|
176 | + 'modRewriteWorking' => $this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true', |
|
177 | + 'sharing.maxAutocompleteResults' => max(0, $this->config->getSystemValueInt('sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT)), |
|
178 | + 'sharing.minSearchStringLength' => $this->config->getSystemValueInt('sharing.minSearchStringLength', 0), |
|
179 | + 'blacklist_files_regex' => FileInfo::BLACKLIST_FILES_REGEX, |
|
180 | + 'loglevel' => $this->config->getSystemValue('loglevel_frontend', |
|
181 | + $this->config->getSystemValue('loglevel', ILogger::WARN) |
|
182 | + ), |
|
183 | + ]; |
|
184 | 184 | |
185 | - $array = [ |
|
186 | - "_oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false', |
|
187 | - "_oc_isadmin" => $uid !== null && $this->groupManager->isAdmin($uid) ? 'true' : 'false', |
|
188 | - "backendAllowsPasswordConfirmation" => $userBackendAllowsPasswordConfirmation ? 'true' : 'false', |
|
189 | - "oc_dataURL" => is_string($dataLocation) ? "\"" . $dataLocation . "\"" : 'false', |
|
190 | - "_oc_webroot" => "\"" . \OC::$WEBROOT . "\"", |
|
191 | - "_oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution |
|
192 | - "datepickerFormatDate" => json_encode($this->l->l('jsdate', null)), |
|
193 | - 'nc_lastLogin' => $lastConfirmTimestamp, |
|
194 | - 'nc_pageLoad' => time(), |
|
195 | - "dayNames" => json_encode([ |
|
196 | - $this->l->t('Sunday'), |
|
197 | - $this->l->t('Monday'), |
|
198 | - $this->l->t('Tuesday'), |
|
199 | - $this->l->t('Wednesday'), |
|
200 | - $this->l->t('Thursday'), |
|
201 | - $this->l->t('Friday'), |
|
202 | - $this->l->t('Saturday') |
|
203 | - ]), |
|
204 | - "dayNamesShort" => json_encode([ |
|
205 | - $this->l->t('Sun.'), |
|
206 | - $this->l->t('Mon.'), |
|
207 | - $this->l->t('Tue.'), |
|
208 | - $this->l->t('Wed.'), |
|
209 | - $this->l->t('Thu.'), |
|
210 | - $this->l->t('Fri.'), |
|
211 | - $this->l->t('Sat.') |
|
212 | - ]), |
|
213 | - "dayNamesMin" => json_encode([ |
|
214 | - $this->l->t('Su'), |
|
215 | - $this->l->t('Mo'), |
|
216 | - $this->l->t('Tu'), |
|
217 | - $this->l->t('We'), |
|
218 | - $this->l->t('Th'), |
|
219 | - $this->l->t('Fr'), |
|
220 | - $this->l->t('Sa') |
|
221 | - ]), |
|
222 | - "monthNames" => json_encode([ |
|
223 | - $this->l->t('January'), |
|
224 | - $this->l->t('February'), |
|
225 | - $this->l->t('March'), |
|
226 | - $this->l->t('April'), |
|
227 | - $this->l->t('May'), |
|
228 | - $this->l->t('June'), |
|
229 | - $this->l->t('July'), |
|
230 | - $this->l->t('August'), |
|
231 | - $this->l->t('September'), |
|
232 | - $this->l->t('October'), |
|
233 | - $this->l->t('November'), |
|
234 | - $this->l->t('December') |
|
235 | - ]), |
|
236 | - "monthNamesShort" => json_encode([ |
|
237 | - $this->l->t('Jan.'), |
|
238 | - $this->l->t('Feb.'), |
|
239 | - $this->l->t('Mar.'), |
|
240 | - $this->l->t('Apr.'), |
|
241 | - $this->l->t('May.'), |
|
242 | - $this->l->t('Jun.'), |
|
243 | - $this->l->t('Jul.'), |
|
244 | - $this->l->t('Aug.'), |
|
245 | - $this->l->t('Sep.'), |
|
246 | - $this->l->t('Oct.'), |
|
247 | - $this->l->t('Nov.'), |
|
248 | - $this->l->t('Dec.') |
|
249 | - ]), |
|
250 | - "firstDay" => json_encode($this->l->l('firstday', null)), |
|
251 | - "_oc_config" => json_encode($config), |
|
252 | - "oc_appconfig" => json_encode([ |
|
253 | - 'core' => [ |
|
254 | - 'defaultExpireDateEnabled' => $defaultExpireDateEnabled, |
|
255 | - 'defaultExpireDate' => $defaultExpireDate, |
|
256 | - 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, |
|
257 | - 'enforcePasswordForPublicLink' => Util::isPublicLinkPasswordRequired(), |
|
258 | - 'enableLinkPasswordByDefault' => $enableLinkPasswordByDefault, |
|
259 | - 'sharingDisabledForUser' => Util::isSharingDisabledForUser(), |
|
260 | - 'resharingAllowed' => Share::isResharingAllowed(), |
|
261 | - 'remoteShareAllowed' => $outgoingServer2serverShareEnabled, |
|
262 | - 'federatedCloudShareDoc' => $this->urlGenerator->linkToDocs('user-sharing-federated'), |
|
263 | - 'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing(), |
|
264 | - 'defaultInternalExpireDateEnabled' => $defaultInternalExpireDateEnabled, |
|
265 | - 'defaultInternalExpireDate' => $defaultInternalExpireDate, |
|
266 | - 'defaultInternalExpireDateEnforced' => $defaultInternalExpireDateEnforced, |
|
267 | - 'defaultRemoteExpireDateEnabled' => $defaultRemoteExpireDateEnabled, |
|
268 | - 'defaultRemoteExpireDate' => $defaultRemoteExpireDate, |
|
269 | - 'defaultRemoteExpireDateEnforced' => $defaultRemoteExpireDateEnforced, |
|
270 | - ] |
|
271 | - ]), |
|
272 | - "_theme" => json_encode([ |
|
273 | - 'entity' => $this->defaults->getEntity(), |
|
274 | - 'name' => $this->defaults->getName(), |
|
275 | - 'productName' => $this->defaults->getProductName(), |
|
276 | - 'title' => $this->defaults->getTitle(), |
|
277 | - 'baseUrl' => $this->defaults->getBaseUrl(), |
|
278 | - 'syncClientUrl' => $this->defaults->getSyncClientUrl(), |
|
279 | - 'docBaseUrl' => $this->defaults->getDocBaseUrl(), |
|
280 | - 'docPlaceholderUrl' => $this->defaults->buildDocLinkToKey('PLACEHOLDER'), |
|
281 | - 'slogan' => $this->defaults->getSlogan(), |
|
282 | - 'logoClaim' => '', |
|
283 | - 'folder' => \OC_Util::getTheme(), |
|
284 | - ]), |
|
285 | - ]; |
|
185 | + $array = [ |
|
186 | + "_oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false', |
|
187 | + "_oc_isadmin" => $uid !== null && $this->groupManager->isAdmin($uid) ? 'true' : 'false', |
|
188 | + "backendAllowsPasswordConfirmation" => $userBackendAllowsPasswordConfirmation ? 'true' : 'false', |
|
189 | + "oc_dataURL" => is_string($dataLocation) ? "\"" . $dataLocation . "\"" : 'false', |
|
190 | + "_oc_webroot" => "\"" . \OC::$WEBROOT . "\"", |
|
191 | + "_oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution |
|
192 | + "datepickerFormatDate" => json_encode($this->l->l('jsdate', null)), |
|
193 | + 'nc_lastLogin' => $lastConfirmTimestamp, |
|
194 | + 'nc_pageLoad' => time(), |
|
195 | + "dayNames" => json_encode([ |
|
196 | + $this->l->t('Sunday'), |
|
197 | + $this->l->t('Monday'), |
|
198 | + $this->l->t('Tuesday'), |
|
199 | + $this->l->t('Wednesday'), |
|
200 | + $this->l->t('Thursday'), |
|
201 | + $this->l->t('Friday'), |
|
202 | + $this->l->t('Saturday') |
|
203 | + ]), |
|
204 | + "dayNamesShort" => json_encode([ |
|
205 | + $this->l->t('Sun.'), |
|
206 | + $this->l->t('Mon.'), |
|
207 | + $this->l->t('Tue.'), |
|
208 | + $this->l->t('Wed.'), |
|
209 | + $this->l->t('Thu.'), |
|
210 | + $this->l->t('Fri.'), |
|
211 | + $this->l->t('Sat.') |
|
212 | + ]), |
|
213 | + "dayNamesMin" => json_encode([ |
|
214 | + $this->l->t('Su'), |
|
215 | + $this->l->t('Mo'), |
|
216 | + $this->l->t('Tu'), |
|
217 | + $this->l->t('We'), |
|
218 | + $this->l->t('Th'), |
|
219 | + $this->l->t('Fr'), |
|
220 | + $this->l->t('Sa') |
|
221 | + ]), |
|
222 | + "monthNames" => json_encode([ |
|
223 | + $this->l->t('January'), |
|
224 | + $this->l->t('February'), |
|
225 | + $this->l->t('March'), |
|
226 | + $this->l->t('April'), |
|
227 | + $this->l->t('May'), |
|
228 | + $this->l->t('June'), |
|
229 | + $this->l->t('July'), |
|
230 | + $this->l->t('August'), |
|
231 | + $this->l->t('September'), |
|
232 | + $this->l->t('October'), |
|
233 | + $this->l->t('November'), |
|
234 | + $this->l->t('December') |
|
235 | + ]), |
|
236 | + "monthNamesShort" => json_encode([ |
|
237 | + $this->l->t('Jan.'), |
|
238 | + $this->l->t('Feb.'), |
|
239 | + $this->l->t('Mar.'), |
|
240 | + $this->l->t('Apr.'), |
|
241 | + $this->l->t('May.'), |
|
242 | + $this->l->t('Jun.'), |
|
243 | + $this->l->t('Jul.'), |
|
244 | + $this->l->t('Aug.'), |
|
245 | + $this->l->t('Sep.'), |
|
246 | + $this->l->t('Oct.'), |
|
247 | + $this->l->t('Nov.'), |
|
248 | + $this->l->t('Dec.') |
|
249 | + ]), |
|
250 | + "firstDay" => json_encode($this->l->l('firstday', null)), |
|
251 | + "_oc_config" => json_encode($config), |
|
252 | + "oc_appconfig" => json_encode([ |
|
253 | + 'core' => [ |
|
254 | + 'defaultExpireDateEnabled' => $defaultExpireDateEnabled, |
|
255 | + 'defaultExpireDate' => $defaultExpireDate, |
|
256 | + 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, |
|
257 | + 'enforcePasswordForPublicLink' => Util::isPublicLinkPasswordRequired(), |
|
258 | + 'enableLinkPasswordByDefault' => $enableLinkPasswordByDefault, |
|
259 | + 'sharingDisabledForUser' => Util::isSharingDisabledForUser(), |
|
260 | + 'resharingAllowed' => Share::isResharingAllowed(), |
|
261 | + 'remoteShareAllowed' => $outgoingServer2serverShareEnabled, |
|
262 | + 'federatedCloudShareDoc' => $this->urlGenerator->linkToDocs('user-sharing-federated'), |
|
263 | + 'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing(), |
|
264 | + 'defaultInternalExpireDateEnabled' => $defaultInternalExpireDateEnabled, |
|
265 | + 'defaultInternalExpireDate' => $defaultInternalExpireDate, |
|
266 | + 'defaultInternalExpireDateEnforced' => $defaultInternalExpireDateEnforced, |
|
267 | + 'defaultRemoteExpireDateEnabled' => $defaultRemoteExpireDateEnabled, |
|
268 | + 'defaultRemoteExpireDate' => $defaultRemoteExpireDate, |
|
269 | + 'defaultRemoteExpireDateEnforced' => $defaultRemoteExpireDateEnforced, |
|
270 | + ] |
|
271 | + ]), |
|
272 | + "_theme" => json_encode([ |
|
273 | + 'entity' => $this->defaults->getEntity(), |
|
274 | + 'name' => $this->defaults->getName(), |
|
275 | + 'productName' => $this->defaults->getProductName(), |
|
276 | + 'title' => $this->defaults->getTitle(), |
|
277 | + 'baseUrl' => $this->defaults->getBaseUrl(), |
|
278 | + 'syncClientUrl' => $this->defaults->getSyncClientUrl(), |
|
279 | + 'docBaseUrl' => $this->defaults->getDocBaseUrl(), |
|
280 | + 'docPlaceholderUrl' => $this->defaults->buildDocLinkToKey('PLACEHOLDER'), |
|
281 | + 'slogan' => $this->defaults->getSlogan(), |
|
282 | + 'logoClaim' => '', |
|
283 | + 'folder' => \OC_Util::getTheme(), |
|
284 | + ]), |
|
285 | + ]; |
|
286 | 286 | |
287 | - if ($this->currentUser !== null) { |
|
288 | - $array['oc_userconfig'] = json_encode([ |
|
289 | - 'avatar' => [ |
|
290 | - 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
291 | - 'generated' => $this->config->getUserValue($uid, 'avatar', 'generated', 'true') === 'true', |
|
292 | - ] |
|
293 | - ]); |
|
294 | - } |
|
287 | + if ($this->currentUser !== null) { |
|
288 | + $array['oc_userconfig'] = json_encode([ |
|
289 | + 'avatar' => [ |
|
290 | + 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
291 | + 'generated' => $this->config->getUserValue($uid, 'avatar', 'generated', 'true') === 'true', |
|
292 | + ] |
|
293 | + ]); |
|
294 | + } |
|
295 | 295 | |
296 | - $this->initialStateService->provideInitialState('core', 'projects_enabled', $this->config->getSystemValueBool('projects.enabled', false)); |
|
296 | + $this->initialStateService->provideInitialState('core', 'projects_enabled', $this->config->getSystemValueBool('projects.enabled', false)); |
|
297 | 297 | |
298 | - $this->initialStateService->provideInitialState('core', 'config', $config); |
|
299 | - $this->initialStateService->provideInitialState('core', 'capabilities', $capabilities); |
|
298 | + $this->initialStateService->provideInitialState('core', 'config', $config); |
|
299 | + $this->initialStateService->provideInitialState('core', 'capabilities', $capabilities); |
|
300 | 300 | |
301 | - // Allow hooks to modify the output values |
|
302 | - \OC_Hook::emit('\OCP\Config', 'js', ['array' => &$array]); |
|
301 | + // Allow hooks to modify the output values |
|
302 | + \OC_Hook::emit('\OCP\Config', 'js', ['array' => &$array]); |
|
303 | 303 | |
304 | - $result = ''; |
|
304 | + $result = ''; |
|
305 | 305 | |
306 | - // Echo it |
|
307 | - foreach ($array as $setting => $value) { |
|
308 | - $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL; |
|
309 | - } |
|
306 | + // Echo it |
|
307 | + foreach ($array as $setting => $value) { |
|
308 | + $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL; |
|
309 | + } |
|
310 | 310 | |
311 | - return $result; |
|
312 | - } |
|
311 | + return $result; |
|
312 | + } |
|
313 | 313 | } |