@@ -33,231 +33,231 @@ |
||
| 33 | 33 | |
| 34 | 34 | class JSConfigHelper { |
| 35 | 35 | |
| 36 | - /** @var IL10N */ |
|
| 37 | - private $l; |
|
| 36 | + /** @var IL10N */ |
|
| 37 | + private $l; |
|
| 38 | 38 | |
| 39 | - /** @var \OC_Defaults */ |
|
| 40 | - private $defaults; |
|
| 39 | + /** @var \OC_Defaults */ |
|
| 40 | + private $defaults; |
|
| 41 | 41 | |
| 42 | - /** @var IAppManager */ |
|
| 43 | - private $appManager; |
|
| 42 | + /** @var IAppManager */ |
|
| 43 | + private $appManager; |
|
| 44 | 44 | |
| 45 | - /** @var ISession */ |
|
| 46 | - private $session; |
|
| 45 | + /** @var ISession */ |
|
| 46 | + private $session; |
|
| 47 | 47 | |
| 48 | - /** @var IUser|null */ |
|
| 49 | - private $currentUser; |
|
| 48 | + /** @var IUser|null */ |
|
| 49 | + private $currentUser; |
|
| 50 | 50 | |
| 51 | - /** @var IConfig */ |
|
| 52 | - private $config; |
|
| 51 | + /** @var IConfig */ |
|
| 52 | + private $config; |
|
| 53 | 53 | |
| 54 | - /** @var IGroupManager */ |
|
| 55 | - private $groupManager; |
|
| 54 | + /** @var IGroupManager */ |
|
| 55 | + private $groupManager; |
|
| 56 | 56 | |
| 57 | - /** @var IniGetWrapper */ |
|
| 58 | - private $iniWrapper; |
|
| 57 | + /** @var IniGetWrapper */ |
|
| 58 | + private $iniWrapper; |
|
| 59 | 59 | |
| 60 | - /** @var IURLGenerator */ |
|
| 61 | - private $urlGenerator; |
|
| 60 | + /** @var IURLGenerator */ |
|
| 61 | + private $urlGenerator; |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * @param IL10N $l |
|
| 65 | - * @param \OC_Defaults $defaults |
|
| 66 | - * @param IAppManager $appManager |
|
| 67 | - * @param ISession $session |
|
| 68 | - * @param IUser|null $currentUser |
|
| 69 | - * @param IConfig $config |
|
| 70 | - * @param IGroupManager $groupManager |
|
| 71 | - * @param IniGetWrapper $iniWrapper |
|
| 72 | - * @param IURLGenerator $urlGenerator |
|
| 73 | - */ |
|
| 74 | - public function __construct(IL10N $l, |
|
| 75 | - \OC_Defaults $defaults, |
|
| 76 | - IAppManager $appManager, |
|
| 77 | - ISession $session, |
|
| 78 | - $currentUser, |
|
| 79 | - IConfig $config, |
|
| 80 | - IGroupManager $groupManager, |
|
| 81 | - IniGetWrapper $iniWrapper, |
|
| 82 | - IURLGenerator $urlGenerator) { |
|
| 83 | - $this->l = $l; |
|
| 84 | - $this->defaults = $defaults; |
|
| 85 | - $this->appManager = $appManager; |
|
| 86 | - $this->session = $session; |
|
| 87 | - $this->currentUser = $currentUser; |
|
| 88 | - $this->config = $config; |
|
| 89 | - $this->groupManager = $groupManager; |
|
| 90 | - $this->iniWrapper = $iniWrapper; |
|
| 91 | - $this->urlGenerator = $urlGenerator; |
|
| 92 | - } |
|
| 63 | + /** |
|
| 64 | + * @param IL10N $l |
|
| 65 | + * @param \OC_Defaults $defaults |
|
| 66 | + * @param IAppManager $appManager |
|
| 67 | + * @param ISession $session |
|
| 68 | + * @param IUser|null $currentUser |
|
| 69 | + * @param IConfig $config |
|
| 70 | + * @param IGroupManager $groupManager |
|
| 71 | + * @param IniGetWrapper $iniWrapper |
|
| 72 | + * @param IURLGenerator $urlGenerator |
|
| 73 | + */ |
|
| 74 | + public function __construct(IL10N $l, |
|
| 75 | + \OC_Defaults $defaults, |
|
| 76 | + IAppManager $appManager, |
|
| 77 | + ISession $session, |
|
| 78 | + $currentUser, |
|
| 79 | + IConfig $config, |
|
| 80 | + IGroupManager $groupManager, |
|
| 81 | + IniGetWrapper $iniWrapper, |
|
| 82 | + IURLGenerator $urlGenerator) { |
|
| 83 | + $this->l = $l; |
|
| 84 | + $this->defaults = $defaults; |
|
| 85 | + $this->appManager = $appManager; |
|
| 86 | + $this->session = $session; |
|
| 87 | + $this->currentUser = $currentUser; |
|
| 88 | + $this->config = $config; |
|
| 89 | + $this->groupManager = $groupManager; |
|
| 90 | + $this->iniWrapper = $iniWrapper; |
|
| 91 | + $this->urlGenerator = $urlGenerator; |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - public function getConfig() { |
|
| 94 | + public function getConfig() { |
|
| 95 | 95 | |
| 96 | - if ($this->currentUser !== null) { |
|
| 97 | - $uid = $this->currentUser->getUID(); |
|
| 98 | - } else { |
|
| 99 | - $uid = null; |
|
| 100 | - } |
|
| 96 | + if ($this->currentUser !== null) { |
|
| 97 | + $uid = $this->currentUser->getUID(); |
|
| 98 | + } else { |
|
| 99 | + $uid = null; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - // Get the config |
|
| 103 | - $apps_paths = []; |
|
| 102 | + // Get the config |
|
| 103 | + $apps_paths = []; |
|
| 104 | 104 | |
| 105 | - if ($this->currentUser === null) { |
|
| 106 | - $apps = $this->appManager->getInstalledApps(); |
|
| 107 | - } else { |
|
| 108 | - $apps = $this->appManager->getEnabledAppsForUser($this->currentUser); |
|
| 109 | - } |
|
| 105 | + if ($this->currentUser === null) { |
|
| 106 | + $apps = $this->appManager->getInstalledApps(); |
|
| 107 | + } else { |
|
| 108 | + $apps = $this->appManager->getEnabledAppsForUser($this->currentUser); |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - foreach($apps as $app) { |
|
| 112 | - $apps_paths[$app] = \OC_App::getAppWebPath($app); |
|
| 113 | - } |
|
| 111 | + foreach($apps as $app) { |
|
| 112 | + $apps_paths[$app] = \OC_App::getAppWebPath($app); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - $defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
| 116 | - $defaultExpireDate = $enforceDefaultExpireDate = null; |
|
| 117 | - if ($defaultExpireDateEnabled) { |
|
| 118 | - $defaultExpireDate = (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 119 | - $enforceDefaultExpireDate = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
| 120 | - } |
|
| 121 | - $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; |
|
| 115 | + $defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
| 116 | + $defaultExpireDate = $enforceDefaultExpireDate = null; |
|
| 117 | + if ($defaultExpireDateEnabled) { |
|
| 118 | + $defaultExpireDate = (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 119 | + $enforceDefaultExpireDate = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
| 120 | + } |
|
| 121 | + $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; |
|
| 122 | 122 | |
| 123 | - $countOfDataLocation = 0; |
|
| 124 | - $dataLocation = str_replace(\OC::$SERVERROOT .'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
| 125 | - if($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) { |
|
| 126 | - $dataLocation = false; |
|
| 127 | - } |
|
| 123 | + $countOfDataLocation = 0; |
|
| 124 | + $dataLocation = str_replace(\OC::$SERVERROOT .'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
| 125 | + if($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) { |
|
| 126 | + $dataLocation = false; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - if ($this->currentUser instanceof IUser) { |
|
| 130 | - $lastConfirmTimestamp = $this->session->get('last-password-confirm'); |
|
| 131 | - if (!is_int($lastConfirmTimestamp)) { |
|
| 132 | - $lastConfirmTimestamp = 0; |
|
| 133 | - } |
|
| 134 | - } else { |
|
| 135 | - $lastConfirmTimestamp = 0; |
|
| 136 | - } |
|
| 129 | + if ($this->currentUser instanceof IUser) { |
|
| 130 | + $lastConfirmTimestamp = $this->session->get('last-password-confirm'); |
|
| 131 | + if (!is_int($lastConfirmTimestamp)) { |
|
| 132 | + $lastConfirmTimestamp = 0; |
|
| 133 | + } |
|
| 134 | + } else { |
|
| 135 | + $lastConfirmTimestamp = 0; |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - $array = [ |
|
| 139 | - "oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false', |
|
| 140 | - "oc_isadmin" => $this->groupManager->isAdmin($uid) ? 'true' : 'false', |
|
| 141 | - "oc_dataURL" => is_string($dataLocation) ? "\"".$dataLocation."\"" : 'false', |
|
| 142 | - "oc_webroot" => "\"".\OC::$WEBROOT."\"", |
|
| 143 | - "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution |
|
| 144 | - "datepickerFormatDate" => json_encode($this->l->l('jsdate', null)), |
|
| 145 | - 'nc_lastLogin' => $lastConfirmTimestamp, |
|
| 146 | - "dayNames" => json_encode([ |
|
| 147 | - (string)$this->l->t('Sunday'), |
|
| 148 | - (string)$this->l->t('Monday'), |
|
| 149 | - (string)$this->l->t('Tuesday'), |
|
| 150 | - (string)$this->l->t('Wednesday'), |
|
| 151 | - (string)$this->l->t('Thursday'), |
|
| 152 | - (string)$this->l->t('Friday'), |
|
| 153 | - (string)$this->l->t('Saturday') |
|
| 154 | - ]), |
|
| 155 | - "dayNamesShort" => json_encode([ |
|
| 156 | - (string)$this->l->t('Sun.'), |
|
| 157 | - (string)$this->l->t('Mon.'), |
|
| 158 | - (string)$this->l->t('Tue.'), |
|
| 159 | - (string)$this->l->t('Wed.'), |
|
| 160 | - (string)$this->l->t('Thu.'), |
|
| 161 | - (string)$this->l->t('Fri.'), |
|
| 162 | - (string)$this->l->t('Sat.') |
|
| 163 | - ]), |
|
| 164 | - "dayNamesMin" => json_encode([ |
|
| 165 | - (string)$this->l->t('Su'), |
|
| 166 | - (string)$this->l->t('Mo'), |
|
| 167 | - (string)$this->l->t('Tu'), |
|
| 168 | - (string)$this->l->t('We'), |
|
| 169 | - (string)$this->l->t('Th'), |
|
| 170 | - (string)$this->l->t('Fr'), |
|
| 171 | - (string)$this->l->t('Sa') |
|
| 172 | - ]), |
|
| 173 | - "monthNames" => json_encode([ |
|
| 174 | - (string)$this->l->t('January'), |
|
| 175 | - (string)$this->l->t('February'), |
|
| 176 | - (string)$this->l->t('March'), |
|
| 177 | - (string)$this->l->t('April'), |
|
| 178 | - (string)$this->l->t('May'), |
|
| 179 | - (string)$this->l->t('June'), |
|
| 180 | - (string)$this->l->t('July'), |
|
| 181 | - (string)$this->l->t('August'), |
|
| 182 | - (string)$this->l->t('September'), |
|
| 183 | - (string)$this->l->t('October'), |
|
| 184 | - (string)$this->l->t('November'), |
|
| 185 | - (string)$this->l->t('December') |
|
| 186 | - ]), |
|
| 187 | - "monthNamesShort" => json_encode([ |
|
| 188 | - (string)$this->l->t('Jan.'), |
|
| 189 | - (string)$this->l->t('Feb.'), |
|
| 190 | - (string)$this->l->t('Mar.'), |
|
| 191 | - (string)$this->l->t('Apr.'), |
|
| 192 | - (string)$this->l->t('May.'), |
|
| 193 | - (string)$this->l->t('Jun.'), |
|
| 194 | - (string)$this->l->t('Jul.'), |
|
| 195 | - (string)$this->l->t('Aug.'), |
|
| 196 | - (string)$this->l->t('Sep.'), |
|
| 197 | - (string)$this->l->t('Oct.'), |
|
| 198 | - (string)$this->l->t('Nov.'), |
|
| 199 | - (string)$this->l->t('Dec.') |
|
| 200 | - ]), |
|
| 201 | - "firstDay" => json_encode($this->l->l('firstday', null)) , |
|
| 202 | - "oc_config" => json_encode([ |
|
| 203 | - 'session_lifetime' => min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')), |
|
| 204 | - 'session_keepalive' => $this->config->getSystemValue('session_keepalive', true), |
|
| 205 | - 'version' => implode('.', \OCP\Util::getVersion()), |
|
| 206 | - 'versionstring' => \OC_Util::getVersionString(), |
|
| 207 | - 'enable_avatars' => true, // here for legacy reasons - to not crash existing code that relies on this value |
|
| 208 | - 'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null), |
|
| 209 | - 'modRewriteWorking' => ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'), |
|
| 210 | - 'sharing.maxAutocompleteResults' => intval($this->config->getSystemValue('sharing.maxAutocompleteResults', 0)), |
|
| 211 | - 'sharing.minSearchStringLength' => intval($this->config->getSystemValue('sharing.minSearchStringLength', 0)), |
|
| 212 | - 'blacklist_files_regex' => \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX, |
|
| 213 | - ]), |
|
| 214 | - "oc_appconfig" => json_encode([ |
|
| 215 | - 'core' => [ |
|
| 216 | - 'defaultExpireDateEnabled' => $defaultExpireDateEnabled, |
|
| 217 | - 'defaultExpireDate' => $defaultExpireDate, |
|
| 218 | - 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, |
|
| 219 | - 'enforcePasswordForPublicLink' => \OCP\Util::isPublicLinkPasswordRequired(), |
|
| 220 | - 'sharingDisabledForUser' => \OCP\Util::isSharingDisabledForUser(), |
|
| 221 | - 'resharingAllowed' => \OCP\Share::isResharingAllowed(), |
|
| 222 | - 'remoteShareAllowed' => $outgoingServer2serverShareEnabled, |
|
| 223 | - 'federatedCloudShareDoc' => $this->urlGenerator->linkToDocs('user-sharing-federated'), |
|
| 224 | - 'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing() |
|
| 225 | - ] |
|
| 226 | - ]), |
|
| 227 | - "oc_defaults" => json_encode([ |
|
| 228 | - 'entity' => $this->defaults->getEntity(), |
|
| 229 | - 'name' => $this->defaults->getName(), |
|
| 230 | - 'title' => $this->defaults->getTitle(), |
|
| 231 | - 'baseUrl' => $this->defaults->getBaseUrl(), |
|
| 232 | - 'syncClientUrl' => $this->defaults->getSyncClientUrl(), |
|
| 233 | - 'docBaseUrl' => $this->defaults->getDocBaseUrl(), |
|
| 234 | - 'docPlaceholderUrl' => $this->defaults->buildDocLinkToKey('PLACEHOLDER'), |
|
| 235 | - 'slogan' => $this->defaults->getSlogan(), |
|
| 236 | - 'logoClaim' => $this->defaults->getLogoClaim(), |
|
| 237 | - 'shortFooter' => $this->defaults->getShortFooter(), |
|
| 238 | - 'longFooter' => $this->defaults->getLongFooter(), |
|
| 239 | - 'folder' => \OC_Util::getTheme(), |
|
| 240 | - ]), |
|
| 241 | - ]; |
|
| 138 | + $array = [ |
|
| 139 | + "oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false', |
|
| 140 | + "oc_isadmin" => $this->groupManager->isAdmin($uid) ? 'true' : 'false', |
|
| 141 | + "oc_dataURL" => is_string($dataLocation) ? "\"".$dataLocation."\"" : 'false', |
|
| 142 | + "oc_webroot" => "\"".\OC::$WEBROOT."\"", |
|
| 143 | + "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution |
|
| 144 | + "datepickerFormatDate" => json_encode($this->l->l('jsdate', null)), |
|
| 145 | + 'nc_lastLogin' => $lastConfirmTimestamp, |
|
| 146 | + "dayNames" => json_encode([ |
|
| 147 | + (string)$this->l->t('Sunday'), |
|
| 148 | + (string)$this->l->t('Monday'), |
|
| 149 | + (string)$this->l->t('Tuesday'), |
|
| 150 | + (string)$this->l->t('Wednesday'), |
|
| 151 | + (string)$this->l->t('Thursday'), |
|
| 152 | + (string)$this->l->t('Friday'), |
|
| 153 | + (string)$this->l->t('Saturday') |
|
| 154 | + ]), |
|
| 155 | + "dayNamesShort" => json_encode([ |
|
| 156 | + (string)$this->l->t('Sun.'), |
|
| 157 | + (string)$this->l->t('Mon.'), |
|
| 158 | + (string)$this->l->t('Tue.'), |
|
| 159 | + (string)$this->l->t('Wed.'), |
|
| 160 | + (string)$this->l->t('Thu.'), |
|
| 161 | + (string)$this->l->t('Fri.'), |
|
| 162 | + (string)$this->l->t('Sat.') |
|
| 163 | + ]), |
|
| 164 | + "dayNamesMin" => json_encode([ |
|
| 165 | + (string)$this->l->t('Su'), |
|
| 166 | + (string)$this->l->t('Mo'), |
|
| 167 | + (string)$this->l->t('Tu'), |
|
| 168 | + (string)$this->l->t('We'), |
|
| 169 | + (string)$this->l->t('Th'), |
|
| 170 | + (string)$this->l->t('Fr'), |
|
| 171 | + (string)$this->l->t('Sa') |
|
| 172 | + ]), |
|
| 173 | + "monthNames" => json_encode([ |
|
| 174 | + (string)$this->l->t('January'), |
|
| 175 | + (string)$this->l->t('February'), |
|
| 176 | + (string)$this->l->t('March'), |
|
| 177 | + (string)$this->l->t('April'), |
|
| 178 | + (string)$this->l->t('May'), |
|
| 179 | + (string)$this->l->t('June'), |
|
| 180 | + (string)$this->l->t('July'), |
|
| 181 | + (string)$this->l->t('August'), |
|
| 182 | + (string)$this->l->t('September'), |
|
| 183 | + (string)$this->l->t('October'), |
|
| 184 | + (string)$this->l->t('November'), |
|
| 185 | + (string)$this->l->t('December') |
|
| 186 | + ]), |
|
| 187 | + "monthNamesShort" => json_encode([ |
|
| 188 | + (string)$this->l->t('Jan.'), |
|
| 189 | + (string)$this->l->t('Feb.'), |
|
| 190 | + (string)$this->l->t('Mar.'), |
|
| 191 | + (string)$this->l->t('Apr.'), |
|
| 192 | + (string)$this->l->t('May.'), |
|
| 193 | + (string)$this->l->t('Jun.'), |
|
| 194 | + (string)$this->l->t('Jul.'), |
|
| 195 | + (string)$this->l->t('Aug.'), |
|
| 196 | + (string)$this->l->t('Sep.'), |
|
| 197 | + (string)$this->l->t('Oct.'), |
|
| 198 | + (string)$this->l->t('Nov.'), |
|
| 199 | + (string)$this->l->t('Dec.') |
|
| 200 | + ]), |
|
| 201 | + "firstDay" => json_encode($this->l->l('firstday', null)) , |
|
| 202 | + "oc_config" => json_encode([ |
|
| 203 | + 'session_lifetime' => min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')), |
|
| 204 | + 'session_keepalive' => $this->config->getSystemValue('session_keepalive', true), |
|
| 205 | + 'version' => implode('.', \OCP\Util::getVersion()), |
|
| 206 | + 'versionstring' => \OC_Util::getVersionString(), |
|
| 207 | + 'enable_avatars' => true, // here for legacy reasons - to not crash existing code that relies on this value |
|
| 208 | + 'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null), |
|
| 209 | + 'modRewriteWorking' => ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'), |
|
| 210 | + 'sharing.maxAutocompleteResults' => intval($this->config->getSystemValue('sharing.maxAutocompleteResults', 0)), |
|
| 211 | + 'sharing.minSearchStringLength' => intval($this->config->getSystemValue('sharing.minSearchStringLength', 0)), |
|
| 212 | + 'blacklist_files_regex' => \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX, |
|
| 213 | + ]), |
|
| 214 | + "oc_appconfig" => json_encode([ |
|
| 215 | + 'core' => [ |
|
| 216 | + 'defaultExpireDateEnabled' => $defaultExpireDateEnabled, |
|
| 217 | + 'defaultExpireDate' => $defaultExpireDate, |
|
| 218 | + 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, |
|
| 219 | + 'enforcePasswordForPublicLink' => \OCP\Util::isPublicLinkPasswordRequired(), |
|
| 220 | + 'sharingDisabledForUser' => \OCP\Util::isSharingDisabledForUser(), |
|
| 221 | + 'resharingAllowed' => \OCP\Share::isResharingAllowed(), |
|
| 222 | + 'remoteShareAllowed' => $outgoingServer2serverShareEnabled, |
|
| 223 | + 'federatedCloudShareDoc' => $this->urlGenerator->linkToDocs('user-sharing-federated'), |
|
| 224 | + 'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing() |
|
| 225 | + ] |
|
| 226 | + ]), |
|
| 227 | + "oc_defaults" => json_encode([ |
|
| 228 | + 'entity' => $this->defaults->getEntity(), |
|
| 229 | + 'name' => $this->defaults->getName(), |
|
| 230 | + 'title' => $this->defaults->getTitle(), |
|
| 231 | + 'baseUrl' => $this->defaults->getBaseUrl(), |
|
| 232 | + 'syncClientUrl' => $this->defaults->getSyncClientUrl(), |
|
| 233 | + 'docBaseUrl' => $this->defaults->getDocBaseUrl(), |
|
| 234 | + 'docPlaceholderUrl' => $this->defaults->buildDocLinkToKey('PLACEHOLDER'), |
|
| 235 | + 'slogan' => $this->defaults->getSlogan(), |
|
| 236 | + 'logoClaim' => $this->defaults->getLogoClaim(), |
|
| 237 | + 'shortFooter' => $this->defaults->getShortFooter(), |
|
| 238 | + 'longFooter' => $this->defaults->getLongFooter(), |
|
| 239 | + 'folder' => \OC_Util::getTheme(), |
|
| 240 | + ]), |
|
| 241 | + ]; |
|
| 242 | 242 | |
| 243 | - if ($this->currentUser !== null) { |
|
| 244 | - $array['oc_userconfig'] = json_encode([ |
|
| 245 | - 'avatar' => [ |
|
| 246 | - 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
| 247 | - ] |
|
| 248 | - ]); |
|
| 249 | - } |
|
| 243 | + if ($this->currentUser !== null) { |
|
| 244 | + $array['oc_userconfig'] = json_encode([ |
|
| 245 | + 'avatar' => [ |
|
| 246 | + 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
| 247 | + ] |
|
| 248 | + ]); |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | - // Allow hooks to modify the output values |
|
| 252 | - \OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array)); |
|
| 251 | + // Allow hooks to modify the output values |
|
| 252 | + \OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array)); |
|
| 253 | 253 | |
| 254 | - $result = ''; |
|
| 254 | + $result = ''; |
|
| 255 | 255 | |
| 256 | - // Echo it |
|
| 257 | - foreach ($array as $setting => $value) { |
|
| 258 | - $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL; |
|
| 259 | - } |
|
| 256 | + // Echo it |
|
| 257 | + foreach ($array as $setting => $value) { |
|
| 258 | + $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL; |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | - return $result; |
|
| 262 | - } |
|
| 261 | + return $result; |
|
| 262 | + } |
|
| 263 | 263 | } |
@@ -33,229 +33,229 @@ |
||
| 33 | 33 | * @since 7.0.0 |
| 34 | 34 | */ |
| 35 | 35 | interface FileInfo { |
| 36 | - /** |
|
| 37 | - * @since 7.0.0 |
|
| 38 | - */ |
|
| 39 | - const TYPE_FILE = 'file'; |
|
| 40 | - /** |
|
| 41 | - * @since 7.0.0 |
|
| 42 | - */ |
|
| 43 | - const TYPE_FOLDER = 'dir'; |
|
| 36 | + /** |
|
| 37 | + * @since 7.0.0 |
|
| 38 | + */ |
|
| 39 | + const TYPE_FILE = 'file'; |
|
| 40 | + /** |
|
| 41 | + * @since 7.0.0 |
|
| 42 | + */ |
|
| 43 | + const TYPE_FOLDER = 'dir'; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value |
|
| 47 | - * @since 8.0.0 |
|
| 48 | - */ |
|
| 49 | - const SPACE_NOT_COMPUTED = -1; |
|
| 50 | - /** |
|
| 51 | - * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value |
|
| 52 | - * @since 8.0.0 |
|
| 53 | - */ |
|
| 54 | - const SPACE_UNKNOWN = -2; |
|
| 55 | - /** |
|
| 56 | - * @const \OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space |
|
| 57 | - * @since 8.0.0 |
|
| 58 | - */ |
|
| 59 | - const SPACE_UNLIMITED = -3; |
|
| 45 | + /** |
|
| 46 | + * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value |
|
| 47 | + * @since 8.0.0 |
|
| 48 | + */ |
|
| 49 | + const SPACE_NOT_COMPUTED = -1; |
|
| 50 | + /** |
|
| 51 | + * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value |
|
| 52 | + * @since 8.0.0 |
|
| 53 | + */ |
|
| 54 | + const SPACE_UNKNOWN = -2; |
|
| 55 | + /** |
|
| 56 | + * @const \OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space |
|
| 57 | + * @since 8.0.0 |
|
| 58 | + */ |
|
| 59 | + const SPACE_UNLIMITED = -3; |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @since 9.1.0 |
|
| 63 | - */ |
|
| 64 | - const MIMETYPE_FOLDER = 'httpd/unix-directory'; |
|
| 61 | + /** |
|
| 62 | + * @since 9.1.0 |
|
| 63 | + */ |
|
| 64 | + const MIMETYPE_FOLDER = 'httpd/unix-directory'; |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * @const \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting) |
|
| 68 | - * @since 12.0.0 |
|
| 69 | - */ |
|
| 70 | - const BLACKLIST_FILES_REGEX = '\.(part|filepart)$'; |
|
| 66 | + /** |
|
| 67 | + * @const \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting) |
|
| 68 | + * @since 12.0.0 |
|
| 69 | + */ |
|
| 70 | + const BLACKLIST_FILES_REGEX = '\.(part|filepart)$'; |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Get the Etag of the file or folder |
|
| 74 | - * |
|
| 75 | - * @return string |
|
| 76 | - * @since 7.0.0 |
|
| 77 | - */ |
|
| 78 | - public function getEtag(); |
|
| 72 | + /** |
|
| 73 | + * Get the Etag of the file or folder |
|
| 74 | + * |
|
| 75 | + * @return string |
|
| 76 | + * @since 7.0.0 |
|
| 77 | + */ |
|
| 78 | + public function getEtag(); |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Get the size in bytes for the file or folder |
|
| 82 | - * |
|
| 83 | - * @return int |
|
| 84 | - * @since 7.0.0 |
|
| 85 | - */ |
|
| 86 | - public function getSize(); |
|
| 80 | + /** |
|
| 81 | + * Get the size in bytes for the file or folder |
|
| 82 | + * |
|
| 83 | + * @return int |
|
| 84 | + * @since 7.0.0 |
|
| 85 | + */ |
|
| 86 | + public function getSize(); |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Get the last modified date as timestamp for the file or folder |
|
| 90 | - * |
|
| 91 | - * @return int |
|
| 92 | - * @since 7.0.0 |
|
| 93 | - */ |
|
| 94 | - public function getMtime(); |
|
| 88 | + /** |
|
| 89 | + * Get the last modified date as timestamp for the file or folder |
|
| 90 | + * |
|
| 91 | + * @return int |
|
| 92 | + * @since 7.0.0 |
|
| 93 | + */ |
|
| 94 | + public function getMtime(); |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Get the name of the file or folder |
|
| 98 | - * |
|
| 99 | - * @return string |
|
| 100 | - * @since 7.0.0 |
|
| 101 | - */ |
|
| 102 | - public function getName(); |
|
| 96 | + /** |
|
| 97 | + * Get the name of the file or folder |
|
| 98 | + * |
|
| 99 | + * @return string |
|
| 100 | + * @since 7.0.0 |
|
| 101 | + */ |
|
| 102 | + public function getName(); |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Get the path relative to the storage |
|
| 106 | - * |
|
| 107 | - * @return string |
|
| 108 | - * @since 7.0.0 |
|
| 109 | - */ |
|
| 110 | - public function getInternalPath(); |
|
| 104 | + /** |
|
| 105 | + * Get the path relative to the storage |
|
| 106 | + * |
|
| 107 | + * @return string |
|
| 108 | + * @since 7.0.0 |
|
| 109 | + */ |
|
| 110 | + public function getInternalPath(); |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * Get the absolute path |
|
| 114 | - * |
|
| 115 | - * @return string |
|
| 116 | - * @since 7.0.0 |
|
| 117 | - */ |
|
| 118 | - public function getPath(); |
|
| 112 | + /** |
|
| 113 | + * Get the absolute path |
|
| 114 | + * |
|
| 115 | + * @return string |
|
| 116 | + * @since 7.0.0 |
|
| 117 | + */ |
|
| 118 | + public function getPath(); |
|
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * Get the full mimetype of the file or folder i.e. 'image/png' |
|
| 122 | - * |
|
| 123 | - * @return string |
|
| 124 | - * @since 7.0.0 |
|
| 125 | - */ |
|
| 126 | - public function getMimetype(); |
|
| 120 | + /** |
|
| 121 | + * Get the full mimetype of the file or folder i.e. 'image/png' |
|
| 122 | + * |
|
| 123 | + * @return string |
|
| 124 | + * @since 7.0.0 |
|
| 125 | + */ |
|
| 126 | + public function getMimetype(); |
|
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Get the first part of the mimetype of the file or folder i.e. 'image' |
|
| 130 | - * |
|
| 131 | - * @return string |
|
| 132 | - * @since 7.0.0 |
|
| 133 | - */ |
|
| 134 | - public function getMimePart(); |
|
| 128 | + /** |
|
| 129 | + * Get the first part of the mimetype of the file or folder i.e. 'image' |
|
| 130 | + * |
|
| 131 | + * @return string |
|
| 132 | + * @since 7.0.0 |
|
| 133 | + */ |
|
| 134 | + public function getMimePart(); |
|
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * Get the storage the file or folder is storage on |
|
| 138 | - * |
|
| 139 | - * @return \OCP\Files\Storage |
|
| 140 | - * @since 7.0.0 |
|
| 141 | - */ |
|
| 142 | - public function getStorage(); |
|
| 136 | + /** |
|
| 137 | + * Get the storage the file or folder is storage on |
|
| 138 | + * |
|
| 139 | + * @return \OCP\Files\Storage |
|
| 140 | + * @since 7.0.0 |
|
| 141 | + */ |
|
| 142 | + public function getStorage(); |
|
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Get the file id of the file or folder |
|
| 146 | - * |
|
| 147 | - * @return int |
|
| 148 | - * @since 7.0.0 |
|
| 149 | - */ |
|
| 150 | - public function getId(); |
|
| 144 | + /** |
|
| 145 | + * Get the file id of the file or folder |
|
| 146 | + * |
|
| 147 | + * @return int |
|
| 148 | + * @since 7.0.0 |
|
| 149 | + */ |
|
| 150 | + public function getId(); |
|
| 151 | 151 | |
| 152 | - /** |
|
| 153 | - * Check whether the file is encrypted |
|
| 154 | - * |
|
| 155 | - * @return bool |
|
| 156 | - * @since 7.0.0 |
|
| 157 | - */ |
|
| 158 | - public function isEncrypted(); |
|
| 152 | + /** |
|
| 153 | + * Check whether the file is encrypted |
|
| 154 | + * |
|
| 155 | + * @return bool |
|
| 156 | + * @since 7.0.0 |
|
| 157 | + */ |
|
| 158 | + public function isEncrypted(); |
|
| 159 | 159 | |
| 160 | - /** |
|
| 161 | - * Get the permissions of the file or folder as bitmasked combination of the following constants |
|
| 162 | - * \OCP\Constants::PERMISSION_CREATE |
|
| 163 | - * \OCP\Constants::PERMISSION_READ |
|
| 164 | - * \OCP\Constants::PERMISSION_UPDATE |
|
| 165 | - * \OCP\Constants::PERMISSION_DELETE |
|
| 166 | - * \OCP\Constants::PERMISSION_SHARE |
|
| 167 | - * \OCP\Constants::PERMISSION_ALL |
|
| 168 | - * |
|
| 169 | - * @return int |
|
| 170 | - * @since 7.0.0 - namespace of constants has changed in 8.0.0 |
|
| 171 | - */ |
|
| 172 | - public function getPermissions(); |
|
| 160 | + /** |
|
| 161 | + * Get the permissions of the file or folder as bitmasked combination of the following constants |
|
| 162 | + * \OCP\Constants::PERMISSION_CREATE |
|
| 163 | + * \OCP\Constants::PERMISSION_READ |
|
| 164 | + * \OCP\Constants::PERMISSION_UPDATE |
|
| 165 | + * \OCP\Constants::PERMISSION_DELETE |
|
| 166 | + * \OCP\Constants::PERMISSION_SHARE |
|
| 167 | + * \OCP\Constants::PERMISSION_ALL |
|
| 168 | + * |
|
| 169 | + * @return int |
|
| 170 | + * @since 7.0.0 - namespace of constants has changed in 8.0.0 |
|
| 171 | + */ |
|
| 172 | + public function getPermissions(); |
|
| 173 | 173 | |
| 174 | - /** |
|
| 175 | - * Check whether this is a file or a folder |
|
| 176 | - * |
|
| 177 | - * @return \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER |
|
| 178 | - * @since 7.0.0 |
|
| 179 | - */ |
|
| 180 | - public function getType(); |
|
| 174 | + /** |
|
| 175 | + * Check whether this is a file or a folder |
|
| 176 | + * |
|
| 177 | + * @return \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER |
|
| 178 | + * @since 7.0.0 |
|
| 179 | + */ |
|
| 180 | + public function getType(); |
|
| 181 | 181 | |
| 182 | - /** |
|
| 183 | - * Check if the file or folder is readable |
|
| 184 | - * |
|
| 185 | - * @return bool |
|
| 186 | - * @since 7.0.0 |
|
| 187 | - */ |
|
| 188 | - public function isReadable(); |
|
| 182 | + /** |
|
| 183 | + * Check if the file or folder is readable |
|
| 184 | + * |
|
| 185 | + * @return bool |
|
| 186 | + * @since 7.0.0 |
|
| 187 | + */ |
|
| 188 | + public function isReadable(); |
|
| 189 | 189 | |
| 190 | - /** |
|
| 191 | - * Check if a file is writable |
|
| 192 | - * |
|
| 193 | - * @return bool |
|
| 194 | - * @since 7.0.0 |
|
| 195 | - */ |
|
| 196 | - public function isUpdateable(); |
|
| 190 | + /** |
|
| 191 | + * Check if a file is writable |
|
| 192 | + * |
|
| 193 | + * @return bool |
|
| 194 | + * @since 7.0.0 |
|
| 195 | + */ |
|
| 196 | + public function isUpdateable(); |
|
| 197 | 197 | |
| 198 | - /** |
|
| 199 | - * Check whether new files or folders can be created inside this folder |
|
| 200 | - * |
|
| 201 | - * @return bool |
|
| 202 | - * @since 8.0.0 |
|
| 203 | - */ |
|
| 204 | - public function isCreatable(); |
|
| 198 | + /** |
|
| 199 | + * Check whether new files or folders can be created inside this folder |
|
| 200 | + * |
|
| 201 | + * @return bool |
|
| 202 | + * @since 8.0.0 |
|
| 203 | + */ |
|
| 204 | + public function isCreatable(); |
|
| 205 | 205 | |
| 206 | - /** |
|
| 207 | - * Check if a file or folder can be deleted |
|
| 208 | - * |
|
| 209 | - * @return bool |
|
| 210 | - * @since 7.0.0 |
|
| 211 | - */ |
|
| 212 | - public function isDeletable(); |
|
| 206 | + /** |
|
| 207 | + * Check if a file or folder can be deleted |
|
| 208 | + * |
|
| 209 | + * @return bool |
|
| 210 | + * @since 7.0.0 |
|
| 211 | + */ |
|
| 212 | + public function isDeletable(); |
|
| 213 | 213 | |
| 214 | - /** |
|
| 215 | - * Check if a file or folder can be shared |
|
| 216 | - * |
|
| 217 | - * @return bool |
|
| 218 | - * @since 7.0.0 |
|
| 219 | - */ |
|
| 220 | - public function isShareable(); |
|
| 214 | + /** |
|
| 215 | + * Check if a file or folder can be shared |
|
| 216 | + * |
|
| 217 | + * @return bool |
|
| 218 | + * @since 7.0.0 |
|
| 219 | + */ |
|
| 220 | + public function isShareable(); |
|
| 221 | 221 | |
| 222 | - /** |
|
| 223 | - * Check if a file or folder is shared |
|
| 224 | - * |
|
| 225 | - * @return bool |
|
| 226 | - * @since 7.0.0 |
|
| 227 | - */ |
|
| 228 | - public function isShared(); |
|
| 222 | + /** |
|
| 223 | + * Check if a file or folder is shared |
|
| 224 | + * |
|
| 225 | + * @return bool |
|
| 226 | + * @since 7.0.0 |
|
| 227 | + */ |
|
| 228 | + public function isShared(); |
|
| 229 | 229 | |
| 230 | - /** |
|
| 231 | - * Check if a file or folder is mounted |
|
| 232 | - * |
|
| 233 | - * @return bool |
|
| 234 | - * @since 7.0.0 |
|
| 235 | - */ |
|
| 236 | - public function isMounted(); |
|
| 230 | + /** |
|
| 231 | + * Check if a file or folder is mounted |
|
| 232 | + * |
|
| 233 | + * @return bool |
|
| 234 | + * @since 7.0.0 |
|
| 235 | + */ |
|
| 236 | + public function isMounted(); |
|
| 237 | 237 | |
| 238 | - /** |
|
| 239 | - * Get the mountpoint the file belongs to |
|
| 240 | - * |
|
| 241 | - * @return \OCP\Files\Mount\IMountPoint |
|
| 242 | - * @since 8.0.0 |
|
| 243 | - */ |
|
| 244 | - public function getMountPoint(); |
|
| 238 | + /** |
|
| 239 | + * Get the mountpoint the file belongs to |
|
| 240 | + * |
|
| 241 | + * @return \OCP\Files\Mount\IMountPoint |
|
| 242 | + * @since 8.0.0 |
|
| 243 | + */ |
|
| 244 | + public function getMountPoint(); |
|
| 245 | 245 | |
| 246 | - /** |
|
| 247 | - * Get the owner of the file |
|
| 248 | - * |
|
| 249 | - * @return \OCP\IUser |
|
| 250 | - * @since 9.0.0 |
|
| 251 | - */ |
|
| 252 | - public function getOwner(); |
|
| 246 | + /** |
|
| 247 | + * Get the owner of the file |
|
| 248 | + * |
|
| 249 | + * @return \OCP\IUser |
|
| 250 | + * @since 9.0.0 |
|
| 251 | + */ |
|
| 252 | + public function getOwner(); |
|
| 253 | 253 | |
| 254 | - /** |
|
| 255 | - * Get the stored checksum for this file |
|
| 256 | - * |
|
| 257 | - * @return string |
|
| 258 | - * @since 9.0.0 |
|
| 259 | - */ |
|
| 260 | - public function getChecksum(); |
|
| 254 | + /** |
|
| 255 | + * Get the stored checksum for this file |
|
| 256 | + * |
|
| 257 | + * @return string |
|
| 258 | + * @since 9.0.0 |
|
| 259 | + */ |
|
| 260 | + public function getChecksum(); |
|
| 261 | 261 | } |