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