@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | $route = substr($route, 7); |
102 | - $route = '/ocs/v2.php' . $route; |
|
102 | + $route = '/ocs/v2.php'.$route; |
|
103 | 103 | |
104 | 104 | return $this->getAbsoluteURL($route); |
105 | 105 | } |
@@ -117,37 +117,37 @@ discard block |
||
117 | 117 | public function linkTo(string $app, string $file, array $args = array()): string { |
118 | 118 | $frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); |
119 | 119 | |
120 | - if( $app !== '' ) { |
|
120 | + if ($app !== '') { |
|
121 | 121 | $app_path = \OC_App::getAppPath($app); |
122 | 122 | // Check if the app is in the app folder |
123 | - if ($app_path && file_exists($app_path . '/' . $file)) { |
|
123 | + if ($app_path && file_exists($app_path.'/'.$file)) { |
|
124 | 124 | if (substr($file, -3) === 'php') { |
125 | 125 | |
126 | - $urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $app; |
|
126 | + $urlLinkTo = \OC::$WEBROOT.'/index.php/apps/'.$app; |
|
127 | 127 | if ($frontControllerActive) { |
128 | - $urlLinkTo = \OC::$WEBROOT . '/apps/' . $app; |
|
128 | + $urlLinkTo = \OC::$WEBROOT.'/apps/'.$app; |
|
129 | 129 | } |
130 | - $urlLinkTo .= ($file !== 'index.php') ? '/' . $file : ''; |
|
130 | + $urlLinkTo .= ($file !== 'index.php') ? '/'.$file : ''; |
|
131 | 131 | } else { |
132 | - $urlLinkTo = \OC_App::getAppWebPath($app) . '/' . $file; |
|
132 | + $urlLinkTo = \OC_App::getAppWebPath($app).'/'.$file; |
|
133 | 133 | } |
134 | 134 | } else { |
135 | - $urlLinkTo = \OC::$WEBROOT . '/' . $app . '/' . $file; |
|
135 | + $urlLinkTo = \OC::$WEBROOT.'/'.$app.'/'.$file; |
|
136 | 136 | } |
137 | 137 | } else { |
138 | - if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) { |
|
139 | - $urlLinkTo = \OC::$WEBROOT . '/core/' . $file; |
|
138 | + if (file_exists(\OC::$SERVERROOT.'/core/'.$file)) { |
|
139 | + $urlLinkTo = \OC::$WEBROOT.'/core/'.$file; |
|
140 | 140 | } else { |
141 | 141 | if ($frontControllerActive && $file === 'index.php') { |
142 | - $urlLinkTo = \OC::$WEBROOT . '/'; |
|
142 | + $urlLinkTo = \OC::$WEBROOT.'/'; |
|
143 | 143 | } else { |
144 | - $urlLinkTo = \OC::$WEBROOT . '/' . $file; |
|
144 | + $urlLinkTo = \OC::$WEBROOT.'/'.$file; |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | 149 | if ($args && $query = http_build_query($args, '', '&')) { |
150 | - $urlLinkTo .= '?' . $query; |
|
150 | + $urlLinkTo .= '?'.$query; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return $urlLinkTo; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function imagePath(string $app, string $image): string { |
166 | 166 | $cache = $this->cacheFactory->createDistributed('imagePath-'.md5($this->getBaseUrl()).'-'); |
167 | 167 | $cacheKey = $app.'-'.$image; |
168 | - if($key = $cache->get($cacheKey)) { |
|
168 | + if ($key = $cache->get($cacheKey)) { |
|
169 | 169 | return $key; |
170 | 170 | } |
171 | 171 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $theme = \OC_Util::getTheme(); |
174 | 174 | |
175 | 175 | //if a theme has a png but not an svg always use the png |
176 | - $basename = substr(basename($image),0,-4); |
|
176 | + $basename = substr(basename($image), 0, -4); |
|
177 | 177 | |
178 | 178 | $appPath = \OC_App::getAppPath($app); |
179 | 179 | |
@@ -181,53 +181,53 @@ discard block |
||
181 | 181 | $path = ''; |
182 | 182 | $themingEnabled = $this->config->getSystemValue('installed', false) && \OCP\App::isEnabled('theming') && \OC_App::isAppLoaded('theming'); |
183 | 183 | $themingImagePath = false; |
184 | - if($themingEnabled) { |
|
184 | + if ($themingEnabled) { |
|
185 | 185 | $themingDefaults = \OC::$server->getThemingDefaults(); |
186 | 186 | if ($themingDefaults instanceof ThemingDefaults) { |
187 | 187 | $themingImagePath = $themingDefaults->replaceImagePath($app, $image); |
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | - if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) { |
|
192 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image"; |
|
193 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.svg") |
|
194 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.png")) { |
|
195 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$basename.png"; |
|
196 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$image")) { |
|
197 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$image"; |
|
198 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.svg") |
|
199 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.png"))) { |
|
200 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$basename.png"; |
|
201 | - } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$image")) { |
|
202 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$image"; |
|
203 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.svg") |
|
204 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.png")) { |
|
205 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
206 | - } elseif($themingEnabled && $themingImagePath) { |
|
191 | + if (file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image")) { |
|
192 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$app/img/$image"; |
|
193 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.svg") |
|
194 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.png")) { |
|
195 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$app/img/$basename.png"; |
|
196 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$image")) { |
|
197 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$image"; |
|
198 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.svg") |
|
199 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.png"))) { |
|
200 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$basename.png"; |
|
201 | + } elseif (file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$image")) { |
|
202 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$image"; |
|
203 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.svg") |
|
204 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.png")) { |
|
205 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
206 | + } elseif ($themingEnabled && $themingImagePath) { |
|
207 | 207 | $path = $themingImagePath; |
208 | - } elseif ($appPath && file_exists($appPath . "/img/$image")) { |
|
209 | - $path = \OC_App::getAppWebPath($app) . "/img/$image"; |
|
210 | - } elseif ($appPath && !file_exists($appPath . "/img/$basename.svg") |
|
211 | - && file_exists($appPath . "/img/$basename.png")) { |
|
212 | - $path = \OC_App::getAppWebPath($app) . "/img/$basename.png"; |
|
213 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/$app/img/$image")) { |
|
214 | - $path = \OC::$WEBROOT . "/$app/img/$image"; |
|
215 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/$app/img/$basename.svg") |
|
216 | - && file_exists(\OC::$SERVERROOT . "/$app/img/$basename.png"))) { |
|
217 | - $path = \OC::$WEBROOT . "/$app/img/$basename.png"; |
|
218 | - } elseif (file_exists(\OC::$SERVERROOT . "/core/img/$image")) { |
|
219 | - $path = \OC::$WEBROOT . "/core/img/$image"; |
|
220 | - } elseif (!file_exists(\OC::$SERVERROOT . "/core/img/$basename.svg") |
|
221 | - && file_exists(\OC::$SERVERROOT . "/core/img/$basename.png")) { |
|
222 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
208 | + } elseif ($appPath && file_exists($appPath."/img/$image")) { |
|
209 | + $path = \OC_App::getAppWebPath($app)."/img/$image"; |
|
210 | + } elseif ($appPath && !file_exists($appPath."/img/$basename.svg") |
|
211 | + && file_exists($appPath."/img/$basename.png")) { |
|
212 | + $path = \OC_App::getAppWebPath($app)."/img/$basename.png"; |
|
213 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/$app/img/$image")) { |
|
214 | + $path = \OC::$WEBROOT."/$app/img/$image"; |
|
215 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/$app/img/$basename.svg") |
|
216 | + && file_exists(\OC::$SERVERROOT."/$app/img/$basename.png"))) { |
|
217 | + $path = \OC::$WEBROOT."/$app/img/$basename.png"; |
|
218 | + } elseif (file_exists(\OC::$SERVERROOT."/core/img/$image")) { |
|
219 | + $path = \OC::$WEBROOT."/core/img/$image"; |
|
220 | + } elseif (!file_exists(\OC::$SERVERROOT."/core/img/$basename.svg") |
|
221 | + && file_exists(\OC::$SERVERROOT."/core/img/$basename.png")) { |
|
222 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
223 | 223 | } |
224 | 224 | |
225 | - if($path !== '') { |
|
225 | + if ($path !== '') { |
|
226 | 226 | $cache->set($cacheKey, $path); |
227 | 227 | return $path; |
228 | 228 | } |
229 | 229 | |
230 | - throw new RuntimeException('image not found: image:' . $image . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT); |
|
230 | + throw new RuntimeException('image not found: image:'.$image.' webroot:'.\OC::$WEBROOT.' serverroot:'.\OC::$SERVERROOT); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | $separator = strpos($url, '/') === 0 ? '' : '/'; |
241 | 241 | |
242 | 242 | if (\OC::$CLI && !\defined('PHPUNIT_RUN')) { |
243 | - return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/') . '/' . ltrim($url, '/'); |
|
243 | + return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/').'/'.ltrim($url, '/'); |
|
244 | 244 | } |
245 | 245 | // The ownCloud web root can already be prepended. |
246 | - if(\OC::$WEBROOT !== '' && strpos($url, \OC::$WEBROOT) === 0) { |
|
246 | + if (\OC::$WEBROOT !== '' && strpos($url, \OC::$WEBROOT) === 0) { |
|
247 | 247 | $url = substr($url, \strlen(\OC::$WEBROOT)); |
248 | 248 | } |
249 | 249 | |
250 | - return $this->getBaseUrl() . $separator . $url; |
|
250 | + return $this->getBaseUrl().$separator.$url; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -263,6 +263,6 @@ discard block |
||
263 | 263 | * @return string base url of the current request |
264 | 264 | */ |
265 | 265 | public function getBaseUrl(): string { |
266 | - return $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . \OC::$WEBROOT; |
|
266 | + return $this->request->getServerProtocol().'://'.$this->request->getServerHost().\OC::$WEBROOT; |
|
267 | 267 | } |
268 | 268 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $mailer = $this->getInstance(); |
173 | 173 | |
174 | 174 | // Enable logger if debug mode is enabled |
175 | - if($debugMode) { |
|
175 | + if ($debugMode) { |
|
176 | 176 | $mailLogger = new \Swift_Plugins_Loggers_ArrayLogger(); |
177 | 177 | $mailer->registerPlugin(new \Swift_Plugins_LoggerPlugin($mailLogger)); |
178 | 178 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | // Debugging logging |
183 | 183 | $logMessage = sprintf('Sent mail to "%s" with subject "%s"', print_r($message->getTo(), true), $message->getSubject()); |
184 | 184 | $this->logger->debug($logMessage, ['app' => 'core']); |
185 | - if($debugMode && isset($mailLogger)) { |
|
185 | + if ($debugMode && isset($mailLogger)) { |
|
186 | 186 | $this->logger->debug($mailLogger->dump(), ['app' => 'core']); |
187 | 187 | } |
188 | 188 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | list($name, $domain) = explode('@', $email, 2); |
219 | - $domain = idn_to_ascii($domain, 0,INTL_IDNA_VARIANT_UTS46); |
|
219 | + $domain = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46); |
|
220 | 220 | return $name.'@'.$domain; |
221 | 221 | } |
222 | 222 | |
@@ -291,6 +291,6 @@ discard block |
||
291 | 291 | break; |
292 | 292 | } |
293 | 293 | |
294 | - return new \Swift_SendmailTransport($binaryPath . $binaryParam); |
|
294 | + return new \Swift_SendmailTransport($binaryPath.$binaryParam); |
|
295 | 295 | } |
296 | 296 | } |
@@ -52,24 +52,24 @@ |
||
52 | 52 | } |
53 | 53 | $contextPath = ''; |
54 | 54 | $hostSlashPos = strpos($host, '/'); |
55 | - if ($hostSlashPos !== false){ |
|
55 | + if ($hostSlashPos !== false) { |
|
56 | 56 | $contextPath = substr($host, $hostSlashPos); |
57 | 57 | $host = substr($host, 0, $hostSlashPos); |
58 | 58 | } |
59 | 59 | |
60 | - if (substr($contextPath, -1) !== '/'){ |
|
60 | + if (substr($contextPath, -1) !== '/') { |
|
61 | 61 | $contextPath .= '/'; |
62 | 62 | } |
63 | 63 | |
64 | - if (isset($params['root'])){ |
|
65 | - $root = '/' . ltrim($params['root'], '/'); |
|
64 | + if (isset($params['root'])) { |
|
65 | + $root = '/'.ltrim($params['root'], '/'); |
|
66 | 66 | } |
67 | - else{ |
|
67 | + else { |
|
68 | 68 | $root = '/'; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $params['host'] = $host; |
72 | - $params['root'] = $contextPath . self::OC_URL_SUFFIX . $root; |
|
72 | + $params['root'] = $contextPath.self::OC_URL_SUFFIX.$root; |
|
73 | 73 | $params['authType'] = Client::AUTH_BASIC; |
74 | 74 | |
75 | 75 | parent::__construct($params); |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | style('federatedfilesharing', 'settings-admin'); |
6 | 6 | ?> |
7 | 7 | |
8 | -<?php if($_['internalOnly'] === false): ?> |
|
8 | +<?php if ($_['internalOnly'] === false): ?> |
|
9 | 9 | |
10 | 10 | <div id="fileSharingSettings" class="section"> |
11 | 11 | <h2> |
12 | - <?php p($l->t('Federated Cloud Sharing'));?> |
|
12 | + <?php p($l->t('Federated Cloud Sharing')); ?> |
|
13 | 13 | </h2> |
14 | 14 | <a target="_blank" rel="noreferrer noopener" class="icon-info svg" |
15 | - title="<?php p($l->t('Open documentation'));?>" |
|
15 | + title="<?php p($l->t('Open documentation')); ?>" |
|
16 | 16 | href="<?php p(link_to_docs('admin-sharing-federated')); ?>"></a> |
17 | 17 | |
18 | 18 | <p class="settings-hint"><?php p($l->t('Adjust how people can share between servers.')); ?></p> |
@@ -21,29 +21,29 @@ discard block |
||
21 | 21 | <input type="checkbox" name="outgoing_server2server_share_enabled" id="outgoingServer2serverShareEnabled" class="checkbox" |
22 | 22 | value="1" <?php if ($_['outgoingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
23 | 23 | <label for="outgoingServer2serverShareEnabled"> |
24 | - <?php p($l->t('Allow users on this server to send shares to other servers'));?> |
|
24 | + <?php p($l->t('Allow users on this server to send shares to other servers')); ?> |
|
25 | 25 | </label> |
26 | 26 | </p> |
27 | 27 | <p> |
28 | 28 | <input type="checkbox" name="incoming_server2server_share_enabled" id="incomingServer2serverShareEnabled" class="checkbox" |
29 | 29 | value="1" <?php if ($_['incomingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
30 | 30 | <label for="incomingServer2serverShareEnabled"> |
31 | - <?php p($l->t('Allow users on this server to receive shares from other servers'));?> |
|
31 | + <?php p($l->t('Allow users on this server to receive shares from other servers')); ?> |
|
32 | 32 | </label><br/> |
33 | 33 | </p> |
34 | - <?php if($_['federatedGroupSharingSupported']): ?> |
|
34 | + <?php if ($_['federatedGroupSharingSupported']): ?> |
|
35 | 35 | <p> |
36 | 36 | <input type="checkbox" name="outgoing_server2server_group_share_enabled" id="outgoingServer2serverGroupShareEnabled" class="checkbox" |
37 | 37 | value="1" <?php if ($_['outgoingServer2serverGroupShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
38 | 38 | <label for="outgoingServer2serverGroupShareEnabled"> |
39 | - <?php p($l->t('Allow users on this server to send shares to groups on other servers'));?> |
|
39 | + <?php p($l->t('Allow users on this server to send shares to groups on other servers')); ?> |
|
40 | 40 | </label> |
41 | 41 | </p> |
42 | 42 | <p> |
43 | 43 | <input type="checkbox" name="incoming_server2server_group_share_enabled" id="incomingServer2serverGroupShareEnabled" class="checkbox" |
44 | 44 | value="1" <?php if ($_['incomingServer2serverGroupShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
45 | 45 | <label for="incomingServer2serverGroupShareEnabled"> |
46 | - <?php p($l->t('Allow users on this server to receive group shares from other servers'));?> |
|
46 | + <?php p($l->t('Allow users on this server to receive group shares from other servers')); ?> |
|
47 | 47 | </label><br/> |
48 | 48 | </p> |
49 | 49 | <?php endif; ?> |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | <input type="checkbox" name="lookupServerEnabled" id="lookupServerEnabled" class="checkbox" |
52 | 52 | value="1" <?php if ($_['lookupServerEnabled']) print_unescaped('checked="checked"'); ?> /> |
53 | 53 | <label for="lookupServerEnabled"> |
54 | - <?php p($l->t('Search global and public address book for users'));?> |
|
54 | + <?php p($l->t('Search global and public address book for users')); ?> |
|
55 | 55 | </label><br/> |
56 | 56 | </p> |
57 | 57 | <p> |
58 | 58 | <input type="checkbox" name="lookupServerUploadEnabled" id="lookupServerUploadEnabled" class="checkbox" |
59 | 59 | value="1" <?php if ($_['lookupServerUploadEnabled']) print_unescaped('checked="checked"'); ?> /> |
60 | 60 | <label for="lookupServerUploadEnabled"> |
61 | - <?php p($l->t('Allow users to publish their data to a global and public address book'));?> |
|
61 | + <?php p($l->t('Allow users to publish their data to a global and public address book')); ?> |
|
62 | 62 | </label><br/> |
63 | 63 | </p> |
64 | 64 |
@@ -84,7 +84,7 @@ |
||
84 | 84 | $column->setType(Type::getType(Type::BIGINT)); |
85 | 85 | $column->setOptions(['length' => 20]); |
86 | 86 | |
87 | - $updates[] = '* ' . $tableName . '.' . $columnName; |
|
87 | + $updates[] = '* '.$tableName.'.'.$columnName; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | $addressBooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri); |
50 | 50 | $objects = []; |
51 | - foreach($addressBooks as $addressBook) { |
|
51 | + foreach ($addressBooks as $addressBook) { |
|
52 | 52 | if ($addressBook['principaluri'] === 'principals/system/system') { |
53 | 53 | $objects[] = new SystemAddressbook($this->carddavBackend, $addressBook, $this->l10n, $this->config); |
54 | 54 | } else { |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | public function delete($configID) { |
151 | 151 | try { |
152 | 152 | $this->ensureConfigIDExists($configID); |
153 | - if(!$this->ldapHelper->deleteServerConfiguration($configID)) { |
|
153 | + if (!$this->ldapHelper->deleteServerConfiguration($configID)) { |
|
154 | 154 | throw new OCSException('Could not delete configuration'); |
155 | 155 | } |
156 | - } catch(OCSException $e) { |
|
156 | + } catch (OCSException $e) { |
|
157 | 157 | throw $e; |
158 | - } catch(\Exception $e) { |
|
158 | + } catch (\Exception $e) { |
|
159 | 159 | $this->logger->logException($e); |
160 | 160 | throw new OCSException('An issue occurred when deleting the config.'); |
161 | 161 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | try { |
191 | 191 | $this->ensureConfigIDExists($configID); |
192 | 192 | |
193 | - if(!is_array($configData)) { |
|
193 | + if (!is_array($configData)) { |
|
194 | 194 | throw new OCSBadRequestException('configData is not properly set'); |
195 | 195 | } |
196 | 196 | |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | $configKeys = $configuration->getConfigTranslationArray(); |
199 | 199 | |
200 | 200 | foreach ($configKeys as $i => $key) { |
201 | - if(isset($configData[$key])) { |
|
201 | + if (isset($configData[$key])) { |
|
202 | 202 | $configuration->$key = $configData[$key]; |
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
206 | 206 | $configuration->saveConfiguration(); |
207 | 207 | $this->connectionFactory->get($configID)->clearCache(); |
208 | - } catch(OCSException $e) { |
|
208 | + } catch (OCSException $e) { |
|
209 | 209 | throw $e; |
210 | 210 | } catch (\Exception $e) { |
211 | 211 | $this->logger->logException($e); |
@@ -291,16 +291,16 @@ discard block |
||
291 | 291 | |
292 | 292 | $config = new Configuration($configID); |
293 | 293 | $data = $config->getConfiguration(); |
294 | - if(!(int)$showPassword) { |
|
294 | + if (!(int) $showPassword) { |
|
295 | 295 | $data['ldapAgentPassword'] = '***'; |
296 | 296 | } |
297 | 297 | foreach ($data as $key => $value) { |
298 | - if(is_array($value)) { |
|
298 | + if (is_array($value)) { |
|
299 | 299 | $value = implode(';', $value); |
300 | 300 | $data[$key] = $value; |
301 | 301 | } |
302 | 302 | } |
303 | - } catch(OCSException $e) { |
|
303 | + } catch (OCSException $e) { |
|
304 | 304 | throw $e; |
305 | 305 | } catch (\Exception $e) { |
306 | 306 | $this->logger->logException($e); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | private function ensureConfigIDExists($configID) { |
320 | 320 | $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(); |
321 | - if(!in_array($configID, $prefixes, true)) { |
|
321 | + if (!in_array($configID, $prefixes, true)) { |
|
322 | 322 | throw new OCSNotFoundException('Config ID not found'); |
323 | 323 | } |
324 | 324 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * because the database connection was created with an uninitialized config |
90 | 90 | */ |
91 | 91 | private function fixDIInit() { |
92 | - if($this->connection === null) { |
|
92 | + if ($this->connection === null) { |
|
93 | 93 | $this->connection = \OC::$server->getDatabaseConnection(); |
94 | 94 | } |
95 | 95 | } |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | $prevValue = $this->getUserValue($userId, $appName, $key, null); |
221 | 221 | |
222 | 222 | if ($prevValue !== null) { |
223 | - if ($prevValue === (string)$value) { |
|
223 | + if ($prevValue === (string) $value) { |
|
224 | 224 | return; |
225 | - } else if ($preCondition !== null && $prevValue !== (string)$preCondition) { |
|
225 | + } else if ($preCondition !== null && $prevValue !== (string) $preCondition) { |
|
226 | 226 | throw new PreConditionNotMetException(); |
227 | 227 | } else { |
228 | 228 | $qb = $this->connection->getQueryBuilder(); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key))); |
234 | 234 | $qb->execute(); |
235 | 235 | |
236 | - $this->userCache[$userId][$appName][$key] = (string)$value; |
|
236 | + $this->userCache[$userId][$appName][$key] = (string) $value; |
|
237 | 237 | return; |
238 | 238 | } |
239 | 239 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | if (!isset($this->userCache[$userId][$appName])) { |
259 | 259 | $this->userCache[$userId][$appName] = array(); |
260 | 260 | } |
261 | - $this->userCache[$userId][$appName][$key] = (string)$value; |
|
261 | + $this->userCache[$userId][$appName][$key] = (string) $value; |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | // TODO - FIXME |
308 | 308 | $this->fixDIInit(); |
309 | 309 | |
310 | - $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
310 | + $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
311 | 311 | 'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?'; |
312 | 312 | $this->connection->executeUpdate($sql, array($userId, $appName, $key)); |
313 | 313 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | // TODO - FIXME |
326 | 326 | $this->fixDIInit(); |
327 | 327 | |
328 | - $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
328 | + $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
329 | 329 | 'WHERE `userid` = ?'; |
330 | 330 | $this->connection->executeUpdate($sql, array($userId)); |
331 | 331 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | // TODO - FIXME |
342 | 342 | $this->fixDIInit(); |
343 | 343 | |
344 | - $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
344 | + $sql = 'DELETE FROM `*PREFIX*preferences` '. |
|
345 | 345 | 'WHERE `appid` = ?'; |
346 | 346 | $this->connection->executeUpdate($sql, array($appName)); |
347 | 347 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | return $this->userCache[$userId]; |
365 | 365 | } |
366 | 366 | if ($userId === null || $userId === '') { |
367 | - $this->userCache[$userId]=array(); |
|
367 | + $this->userCache[$userId] = array(); |
|
368 | 368 | return $this->userCache[$userId]; |
369 | 369 | } |
370 | 370 | |
@@ -411,12 +411,12 @@ discard block |
||
411 | 411 | array_unshift($queryParams, $key); |
412 | 412 | array_unshift($queryParams, $appName); |
413 | 413 | |
414 | - $placeholders = (count($chunk) === 50) ? $placeholders50 : implode(',', array_fill(0, count($chunk), '?')); |
|
414 | + $placeholders = (count($chunk) === 50) ? $placeholders50 : implode(',', array_fill(0, count($chunk), '?')); |
|
415 | 415 | |
416 | - $query = 'SELECT `userid`, `configvalue` ' . |
|
417 | - 'FROM `*PREFIX*preferences` ' . |
|
418 | - 'WHERE `appid` = ? AND `configkey` = ? ' . |
|
419 | - 'AND `userid` IN (' . $placeholders . ')'; |
|
416 | + $query = 'SELECT `userid`, `configvalue` '. |
|
417 | + 'FROM `*PREFIX*preferences` '. |
|
418 | + 'WHERE `appid` = ? AND `configkey` = ? '. |
|
419 | + 'AND `userid` IN ('.$placeholders.')'; |
|
420 | 420 | $result = $this->connection->executeQuery($query, $queryParams); |
421 | 421 | |
422 | 422 | while ($row = $result->fetch()) { |
@@ -439,10 +439,10 @@ discard block |
||
439 | 439 | // TODO - FIXME |
440 | 440 | $this->fixDIInit(); |
441 | 441 | |
442 | - $sql = 'SELECT `userid` FROM `*PREFIX*preferences` ' . |
|
442 | + $sql = 'SELECT `userid` FROM `*PREFIX*preferences` '. |
|
443 | 443 | 'WHERE `appid` = ? AND `configkey` = ? '; |
444 | 444 | |
445 | - if($this->getSystemValue('dbtype', 'sqlite') === 'oci') { |
|
445 | + if ($this->getSystemValue('dbtype', 'sqlite') === 'oci') { |
|
446 | 446 | //oracle hack: need to explicitly cast CLOB to CHAR for comparison |
447 | 447 | $sql .= 'AND to_char(`configvalue`) = ?'; |
448 | 448 | } else { |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | // TODO - FIXME |
472 | 472 | $this->fixDIInit(); |
473 | 473 | |
474 | - $sql = 'SELECT `userid` FROM `*PREFIX*preferences` ' . |
|
474 | + $sql = 'SELECT `userid` FROM `*PREFIX*preferences` '. |
|
475 | 475 | 'WHERE `appid` = ? AND `configkey` = ? '; |
476 | 476 | |
477 | - if($this->getSystemValue('dbtype', 'sqlite') === 'oci') { |
|
477 | + if ($this->getSystemValue('dbtype', 'sqlite') === 'oci') { |
|
478 | 478 | //oracle hack: need to explicitly cast CLOB to CHAR for comparison |
479 | 479 | $sql .= 'AND LOWER(to_char(`configvalue`)) = LOWER(?)'; |
480 | 480 | } else { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | throw new \RuntimeException('no instance id!'); |
76 | 76 | } |
77 | 77 | |
78 | - return 'appdata_' . $instanceId; |
|
78 | + return 'appdata_'.$instanceId; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | private function getAppDataRootFolder(): Folder { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $name = $this->getAppDataFolderName(); |
104 | 104 | |
105 | 105 | try { |
106 | - $this->folder = $this->rootFolder->get($name . '/' . $this->appId); |
|
106 | + $this->folder = $this->rootFolder->get($name.'/'.$this->appId); |
|
107 | 107 | } catch (NotFoundException $e) { |
108 | 108 | $appDataRootFolder = $this->getAppDataRootFolder(); |
109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | try { |
114 | 114 | $this->folder = $appDataRootFolder->newFolder($this->appId); |
115 | 115 | } catch (NotPermittedException $e) { |
116 | - throw new \RuntimeException('Could not get appdata folder for ' . $this->appId); |
|
116 | + throw new \RuntimeException('Could not get appdata folder for '.$this->appId); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | public function getFolder(string $name): ISimpleFolder { |
126 | - $key = $this->appId . '/' . $name; |
|
126 | + $key = $this->appId.'/'.$name; |
|
127 | 127 | if ($cachedFolder = $this->folders->get($key)) { |
128 | 128 | if ($cachedFolder instanceof \Exception) { |
129 | 129 | throw $cachedFolder; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | if ($name === '/') { |
137 | 137 | $node = $this->getAppDataFolder(); |
138 | 138 | } else { |
139 | - $path = $this->getAppDataFolderName() . '/' . $this->appId . '/' . $name; |
|
139 | + $path = $this->getAppDataFolderName().'/'.$this->appId.'/'.$name; |
|
140 | 140 | $node = $this->rootFolder->get($path); |
141 | 141 | } |
142 | 142 | } catch (NotFoundException $e) { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | public function newFolder(string $name): ISimpleFolder { |
154 | - $key = $this->appId . '/' . $name; |
|
154 | + $key = $this->appId.'/'.$name; |
|
155 | 155 | $folder = $this->getAppDataFolder()->newFolder($name); |
156 | 156 | |
157 | 157 | $simpleFolder = new SimpleFolder($folder); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | public function getDirectoryListing(): array { |
163 | 163 | $listing = $this->getAppDataFolder()->getDirectoryListing(); |
164 | 164 | |
165 | - $fileListing = array_map(function (Node $folder) { |
|
165 | + $fileListing = array_map(function(Node $folder) { |
|
166 | 166 | if ($folder instanceof Folder) { |
167 | 167 | return new SimpleFolder($folder); |
168 | 168 | } |