@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $searchResult = $this->c->resolve(SearchResult::class); |
48 | 48 | |
49 | 49 | foreach ($shareTypes as $type) { |
50 | - if(!isset($this->pluginList[$type])) { |
|
50 | + if (!isset($this->pluginList[$type])) { |
|
51 | 51 | continue; |
52 | 52 | } |
53 | 53 | foreach ($this->pluginList[$type] as $plugin) { |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | // that the exact same email address and federated cloud id exists |
71 | 71 | $emailType = new SearchResultType('emails'); |
72 | 72 | $remoteType = new SearchResultType('remotes'); |
73 | - if($searchResult->hasExactIdMatch($emailType) && !$searchResult->hasExactIdMatch($remoteType)) { |
|
73 | + if ($searchResult->hasExactIdMatch($emailType) && !$searchResult->hasExactIdMatch($remoteType)) { |
|
74 | 74 | $searchResult->unsetResult($remoteType); |
75 | 75 | } elseif (!$searchResult->hasExactIdMatch($emailType) && $searchResult->hasExactIdMatch($remoteType)) { |
76 | 76 | $searchResult->unsetResult($emailType); |
77 | 77 | } |
78 | 78 | |
79 | - return [$searchResult->asArray(), (bool)$hasMoreResults]; |
|
79 | + return [$searchResult->asArray(), (bool) $hasMoreResults]; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function registerPlugin(array $pluginInfo) { |
83 | - $shareType = constant(Share::class . '::' . $pluginInfo['shareType']); |
|
84 | - if($shareType === null) { |
|
83 | + $shareType = constant(Share::class.'::'.$pluginInfo['shareType']); |
|
84 | + if ($shareType === null) { |
|
85 | 85 | throw new \InvalidArgumentException('Provided ShareType is invalid'); |
86 | 86 | } |
87 | 87 | $this->pluginList[$shareType][] = $pluginInfo['class']; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $template->setSubject($this->l->t('Password for %1$s changed on %2$s', [$user->getDisplayName(), $instanceUrl])); |
127 | 127 | $template->addHeader(); |
128 | 128 | $template->addHeading($this->l->t('Password changed for %s', [$user->getDisplayName()]), false); |
129 | - $template->addBodyText($text . ' ' . $this->l->t('If you did not request this, please contact an administrator.')); |
|
129 | + $template->addBodyText($text.' '.$this->l->t('If you did not request this, please contact an administrator.')); |
|
130 | 130 | $template->addFooter(); |
131 | 131 | |
132 | 132 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $template->setSubject($this->l->t('Email address for %1$s changed on %2$s', [$user->getDisplayName(), $instanceUrl])); |
197 | 197 | $template->addHeader(); |
198 | 198 | $template->addHeading($this->l->t('Email address changed for %s', [$user->getDisplayName()]), false); |
199 | - $template->addBodyText($text . ' ' . $this->l->t('If you did not request this, please contact an administrator.')); |
|
199 | + $template->addBodyText($text.' '.$this->l->t('If you did not request this, please contact an administrator.')); |
|
200 | 200 | if ($user->getEMailAddress()) { |
201 | 201 | $template->addBodyText($this->l->t('The new email address is %s', [$user->getEMailAddress()])); |
202 | 202 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | if ($excludedGroups) { |
118 | 118 | $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', ''); |
119 | 119 | $decodedExcludeGroups = json_decode($excludedGroups, true); |
120 | - $excludeGroupsList = ($decodedExcludeGroups !== null) ? $decodedExcludeGroups : []; |
|
120 | + $excludeGroupsList = ($decodedExcludeGroups !== null) ? $decodedExcludeGroups : []; |
|
121 | 121 | |
122 | 122 | if (count(array_intersect($excludeGroupsList, $selfGroups)) !== 0) { |
123 | 123 | // a group of the current user is excluded -> filter all local users |
@@ -133,22 +133,22 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | // Prevent enumerating local users |
136 | - if($disallowEnumeration && $entry->getProperty('isLocalSystemBook')) { |
|
136 | + if ($disallowEnumeration && $entry->getProperty('isLocalSystemBook')) { |
|
137 | 137 | $filterUser = true; |
138 | 138 | |
139 | 139 | $mailAddresses = $entry->getEMailAddresses(); |
140 | - foreach($mailAddresses as $mailAddress) { |
|
141 | - if($mailAddress === $filter) { |
|
140 | + foreach ($mailAddresses as $mailAddress) { |
|
141 | + if ($mailAddress === $filter) { |
|
142 | 142 | $filterUser = false; |
143 | 143 | break; |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | - if($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) { |
|
147 | + if ($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) { |
|
148 | 148 | $filterUser = false; |
149 | 149 | } |
150 | 150 | |
151 | - if($filterUser) { |
|
151 | + if ($filterUser) { |
|
152 | 152 | return false; |
153 | 153 | } |
154 | 154 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @return IEntry|null |
173 | 173 | */ |
174 | 174 | public function findOne(IUser $user, $shareType, $shareWith) { |
175 | - switch($shareType) { |
|
175 | + switch ($shareType) { |
|
176 | 176 | case 0: |
177 | 177 | case 6: |
178 | 178 | $filter = ['UID']; |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | $icon->setImageFormat("png32"); |
64 | 64 | |
65 | 65 | $clone = clone $icon; |
66 | - $clone->scaleImage(16,0); |
|
66 | + $clone->scaleImage(16, 0); |
|
67 | 67 | $favicon->addImage($clone); |
68 | 68 | |
69 | 69 | $clone = clone $icon; |
70 | - $clone->scaleImage(32,0); |
|
70 | + $clone->scaleImage(32, 0); |
|
71 | 71 | $favicon->addImage($clone); |
72 | 72 | |
73 | 73 | $clone = clone $icon; |
74 | - $clone->scaleImage(64,0); |
|
74 | + $clone->scaleImage(64, 0); |
|
75 | 75 | $favicon->addImage($clone); |
76 | 76 | |
77 | 77 | $clone = clone $icon; |
78 | - $clone->scaleImage(128,0); |
|
78 | + $clone->scaleImage(128, 0); |
|
79 | 79 | $favicon->addImage($clone); |
80 | 80 | |
81 | 81 | $data = $favicon->getImagesBlob(); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function renderAppIcon($app, $size) { |
119 | 119 | $appIcon = $this->util->getAppIcon($app); |
120 | - if($appIcon === false) { |
|
120 | + if ($appIcon === false) { |
|
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | if ($appIcon instanceof ISimpleFile) { |
@@ -128,20 +128,20 @@ discard block |
||
128 | 128 | $mime = mime_content_type($appIcon); |
129 | 129 | } |
130 | 130 | |
131 | - if($appIconContent === false || $appIconContent === "") { |
|
131 | + if ($appIconContent === false || $appIconContent === "") { |
|
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | |
135 | 135 | $color = $this->themingDefaults->getColorPrimary(); |
136 | 136 | |
137 | 137 | // generate background image with rounded corners |
138 | - $background = '<?xml version="1.0" encoding="UTF-8"?>' . |
|
139 | - '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:cc="http://creativecommons.org/ns#" width="512" height="512" xmlns:xlink="http://www.w3.org/1999/xlink">' . |
|
140 | - '<rect x="0" y="0" rx="100" ry="100" width="512" height="512" style="fill:' . $color . ';" />' . |
|
138 | + $background = '<?xml version="1.0" encoding="UTF-8"?>'. |
|
139 | + '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:cc="http://creativecommons.org/ns#" width="512" height="512" xmlns:xlink="http://www.w3.org/1999/xlink">'. |
|
140 | + '<rect x="0" y="0" rx="100" ry="100" width="512" height="512" style="fill:'.$color.';" />'. |
|
141 | 141 | '</svg>'; |
142 | 142 | // resize svg magic as this seems broken in Imagemagick |
143 | - if($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") { |
|
144 | - if(substr($appIconContent, 0, 5) !== "<?xml") { |
|
143 | + if ($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") { |
|
144 | + if (substr($appIconContent, 0, 5) !== "<?xml") { |
|
145 | 145 | $svg = "<?xml version=\"1.0\"?>".$appIconContent; |
146 | 146 | } else { |
147 | 147 | $svg = $appIconContent; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $res = $tmp->getImageResolution(); |
154 | 154 | $tmp->destroy(); |
155 | 155 | |
156 | - if($x>$y) { |
|
156 | + if ($x > $y) { |
|
157 | 157 | $max = $x; |
158 | 158 | } else { |
159 | 159 | $max = $y; |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | |
162 | 162 | // convert svg to resized image |
163 | 163 | $appIconFile = new Imagick(); |
164 | - $resX = (int)(512 * $res['x'] / $max * 2.53); |
|
165 | - $resY = (int)(512 * $res['y'] / $max * 2.53); |
|
164 | + $resX = (int) (512 * $res['x'] / $max * 2.53); |
|
165 | + $resY = (int) (512 * $res['y'] / $max * 2.53); |
|
166 | 166 | $appIconFile->setResolution($resX, $resY); |
167 | 167 | $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
168 | 168 | $appIconFile->readImageBlob($svg); |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | $appIconFile->scaleImage(512, 512, true); |
186 | 186 | } |
187 | 187 | // offset for icon positioning |
188 | - $border_w = (int)($appIconFile->getImageWidth() * 0.05); |
|
189 | - $border_h = (int)($appIconFile->getImageHeight() * 0.05); |
|
190 | - $innerWidth = (int)($appIconFile->getImageWidth() - $border_w * 2); |
|
191 | - $innerHeight = (int)($appIconFile->getImageHeight() - $border_h * 2); |
|
188 | + $border_w = (int) ($appIconFile->getImageWidth() * 0.05); |
|
189 | + $border_h = (int) ($appIconFile->getImageHeight() * 0.05); |
|
190 | + $innerWidth = (int) ($appIconFile->getImageWidth() - $border_w * 2); |
|
191 | + $innerHeight = (int) ($appIconFile->getImageHeight() - $border_h * 2); |
|
192 | 192 | $appIconFile->adaptiveResizeImage($innerWidth, $innerHeight); |
193 | 193 | // center icon |
194 | 194 | $offset_w = 512 / 2 - $innerWidth / 2; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * @package OCP |
30 | 30 | * @since 7.0.0 |
31 | 31 | */ |
32 | -interface ICacheFactory{ |
|
32 | +interface ICacheFactory { |
|
33 | 33 | /** |
34 | 34 | * Get a distributed memory cache instance |
35 | 35 | * |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function beforeController($controller, $methodName) { |
47 | 47 | $requestUri = $this->request->getScriptName(); |
48 | 48 | $processingScript = explode('/', $requestUri); |
49 | - $processingScript = $processingScript[count($processingScript)-1]; |
|
49 | + $processingScript = $processingScript[count($processingScript) - 1]; |
|
50 | 50 | |
51 | 51 | if ($processingScript !== 'index.php') { |
52 | 52 | return; |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | |
87 | 87 | // Append __Host to the cookie if it meets the requirements |
88 | 88 | $cookiePrefix = ''; |
89 | - if($cookieParams['secure'] === true && $cookieParams['path'] === '/') { |
|
89 | + if ($cookieParams['secure'] === true && $cookieParams['path'] === '/') { |
|
90 | 90 | $cookiePrefix = '__Host-'; |
91 | 91 | } |
92 | 92 | |
93 | - foreach($policies as $policy) { |
|
93 | + foreach ($policies as $policy) { |
|
94 | 94 | header( |
95 | 95 | sprintf( |
96 | - 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;' . $secureCookie . 'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
96 | + 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;'.$secureCookie.'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
97 | 97 | $cookiePrefix, |
98 | 98 | $policy, |
99 | 99 | $cookieParams['path'], |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | ->from('addressbooks') |
115 | 115 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); |
116 | 116 | |
117 | - return (int)$query->execute()->fetchColumn(); |
|
117 | + return (int) $query->execute()->fetchColumn(); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | $addressBooks = []; |
146 | 146 | |
147 | 147 | $result = $query->execute(); |
148 | - while($row = $result->fetch()) { |
|
148 | + while ($row = $result->fetch()) { |
|
149 | 149 | $addressBooks[$row['id']] = [ |
150 | 150 | 'id' => $row['id'], |
151 | 151 | 'uri' => $row['uri'], |
152 | 152 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
153 | 153 | '{DAV:}displayname' => $row['displayname'], |
154 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
154 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
155 | 155 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
156 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
156 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
157 | 157 | ]; |
158 | 158 | |
159 | 159 | $this->addOwnerPrincipal($addressBooks[$row['id']]); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $principals = array_map(function($principal) { |
166 | 166 | return urldecode($principal); |
167 | 167 | }, $principals); |
168 | - $principals[]= $principalUri; |
|
168 | + $principals[] = $principalUri; |
|
169 | 169 | |
170 | 170 | $query = $this->db->getQueryBuilder(); |
171 | 171 | $result = $query->select(['a.id', 'a.uri', 'a.displayname', 'a.principaluri', 'a.description', 'a.synctoken', 's.access']) |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | ->setParameter('principaluri', $principals, IQueryBuilder::PARAM_STR_ARRAY) |
178 | 178 | ->execute(); |
179 | 179 | |
180 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
181 | - while($row = $result->fetch()) { |
|
180 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
181 | + while ($row = $result->fetch()) { |
|
182 | 182 | if ($row['principaluri'] === $principalUri) { |
183 | 183 | continue; |
184 | 184 | } |
@@ -197,18 +197,18 @@ discard block |
||
197 | 197 | } |
198 | 198 | |
199 | 199 | list(, $name) = \Sabre\Uri\split($row['principaluri']); |
200 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
201 | - $displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
200 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
201 | + $displayName = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
202 | 202 | |
203 | 203 | $addressBooks[$row['id']] = [ |
204 | 204 | 'id' => $row['id'], |
205 | 205 | 'uri' => $uri, |
206 | 206 | 'principaluri' => $principalUriOriginal, |
207 | 207 | '{DAV:}displayname' => $displayName, |
208 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
208 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
209 | 209 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
210 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
211 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'], |
|
210 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
211 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'], |
|
212 | 212 | $readOnlyPropertyName => $readOnly, |
213 | 213 | ]; |
214 | 214 | |
@@ -229,15 +229,15 @@ discard block |
||
229 | 229 | $addressBooks = []; |
230 | 230 | |
231 | 231 | $result = $query->execute(); |
232 | - while($row = $result->fetch()) { |
|
232 | + while ($row = $result->fetch()) { |
|
233 | 233 | $addressBooks[$row['id']] = [ |
234 | 234 | 'id' => $row['id'], |
235 | 235 | 'uri' => $row['uri'], |
236 | 236 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
237 | 237 | '{DAV:}displayname' => $row['displayname'], |
238 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
238 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
239 | 239 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
240 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
240 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
241 | 241 | ]; |
242 | 242 | |
243 | 243 | $this->addOwnerPrincipal($addressBooks[$row['id']]); |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | 'uri' => $row['uri'], |
283 | 283 | 'principaluri' => $row['principaluri'], |
284 | 284 | '{DAV:}displayname' => $row['displayname'], |
285 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
285 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
286 | 286 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
287 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
287 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
288 | 288 | ]; |
289 | 289 | |
290 | 290 | $this->addOwnerPrincipal($addressBook); |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | 'uri' => $row['uri'], |
317 | 317 | 'principaluri' => $row['principaluri'], |
318 | 318 | '{DAV:}displayname' => $row['displayname'], |
319 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
319 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
320 | 320 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
321 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
321 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
322 | 322 | ]; |
323 | 323 | |
324 | 324 | $this->addOwnerPrincipal($addressBook); |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { |
346 | 346 | $supportedProperties = [ |
347 | 347 | '{DAV:}displayname', |
348 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description', |
|
348 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description', |
|
349 | 349 | ]; |
350 | 350 | |
351 | 351 | /** |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | $propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) { |
355 | 355 | |
356 | 356 | $updates = []; |
357 | - foreach($mutations as $property=>$newValue) { |
|
357 | + foreach ($mutations as $property=>$newValue) { |
|
358 | 358 | |
359 | - switch($property) { |
|
359 | + switch ($property) { |
|
360 | 360 | case '{DAV:}displayname' : |
361 | 361 | $updates['displayname'] = $newValue; |
362 | 362 | break; |
363 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description' : |
|
363 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description' : |
|
364 | 364 | $updates['description'] = $newValue; |
365 | 365 | break; |
366 | 366 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | $query = $this->db->getQueryBuilder(); |
369 | 369 | $query->update('addressbooks'); |
370 | 370 | |
371 | - foreach($updates as $key=>$value) { |
|
371 | + foreach ($updates as $key=>$value) { |
|
372 | 372 | $query->set($key, $query->createNamedParameter($value)); |
373 | 373 | } |
374 | 374 | $query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId))) |
@@ -399,24 +399,24 @@ discard block |
||
399 | 399 | 'synctoken' => 1 |
400 | 400 | ]; |
401 | 401 | |
402 | - foreach($properties as $property=>$newValue) { |
|
402 | + foreach ($properties as $property=>$newValue) { |
|
403 | 403 | |
404 | - switch($property) { |
|
404 | + switch ($property) { |
|
405 | 405 | case '{DAV:}displayname' : |
406 | 406 | $values['displayname'] = $newValue; |
407 | 407 | break; |
408 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description' : |
|
408 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description' : |
|
409 | 409 | $values['description'] = $newValue; |
410 | 410 | break; |
411 | 411 | default : |
412 | - throw new BadRequest('Unknown property: ' . $property); |
|
412 | + throw new BadRequest('Unknown property: '.$property); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | } |
416 | 416 | |
417 | 417 | // Fallback to make sure the displayname is set. Some clients may refuse |
418 | 418 | // to work with addressbooks not having a displayname. |
419 | - if(is_null($values['displayname'])) { |
|
419 | + if (is_null($values['displayname'])) { |
|
420 | 420 | $values['displayname'] = $url; |
421 | 421 | } |
422 | 422 | |
@@ -494,8 +494,8 @@ discard block |
||
494 | 494 | $cards = []; |
495 | 495 | |
496 | 496 | $result = $query->execute(); |
497 | - while($row = $result->fetch()) { |
|
498 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
497 | + while ($row = $result->fetch()) { |
|
498 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
499 | 499 | $row['carddata'] = $this->readBlob($row['carddata']); |
500 | 500 | $cards[] = $row; |
501 | 501 | } |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | if (!$row) { |
530 | 530 | return false; |
531 | 531 | } |
532 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
532 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
533 | 533 | $row['carddata'] = $this->readBlob($row['carddata']); |
534 | 534 | |
535 | 535 | return $row; |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | $result = $query->execute(); |
567 | 567 | |
568 | 568 | while ($row = $result->fetch()) { |
569 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
569 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
570 | 570 | $row['carddata'] = $this->readBlob($row['carddata']); |
571 | 571 | $cards[] = $row; |
572 | 572 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | 'cardUri' => $cardUri, |
625 | 625 | 'cardData' => $cardData])); |
626 | 626 | |
627 | - return '"' . $etag . '"'; |
|
627 | + return '"'.$etag.'"'; |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | /** |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | 'cardUri' => $cardUri, |
675 | 675 | 'cardData' => $cardData])); |
676 | 676 | |
677 | - return '"' . $etag . '"'; |
|
677 | + return '"'.$etag.'"'; |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | /** |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) { |
773 | 773 | // Current synctoken |
774 | 774 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?'); |
775 | - $stmt->execute([ $addressBookId ]); |
|
775 | + $stmt->execute([$addressBookId]); |
|
776 | 776 | $currentToken = $stmt->fetchColumn(0); |
777 | 777 | |
778 | 778 | if (is_null($currentToken)) return null; |
@@ -787,8 +787,8 @@ discard block |
||
787 | 787 | if ($syncToken) { |
788 | 788 | |
789 | 789 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`"; |
790 | - if ($limit>0) { |
|
791 | - $query .= " `LIMIT` " . (int)$limit; |
|
790 | + if ($limit > 0) { |
|
791 | + $query .= " `LIMIT` ".(int) $limit; |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | // Fetching all changes |
@@ -799,15 +799,15 @@ discard block |
||
799 | 799 | |
800 | 800 | // This loop ensures that any duplicates are overwritten, only the |
801 | 801 | // last change on a node is relevant. |
802 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
802 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
803 | 803 | |
804 | 804 | $changes[$row['uri']] = $row['operation']; |
805 | 805 | |
806 | 806 | } |
807 | 807 | |
808 | - foreach($changes as $uri => $operation) { |
|
808 | + foreach ($changes as $uri => $operation) { |
|
809 | 809 | |
810 | - switch($operation) { |
|
810 | + switch ($operation) { |
|
811 | 811 | case 1: |
812 | 812 | $result['added'][] = $uri; |
813 | 813 | break; |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | |
894 | 894 | // No need for like when the pattern is empty |
895 | 895 | if ('' !== $pattern) { |
896 | - $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
896 | + $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
897 | 897 | } |
898 | 898 | |
899 | 899 | $query->select('c.carddata', 'c.uri')->from($this->dbCardsTable, 'c') |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | $result->closeCursor(); |
947 | 947 | |
948 | 948 | if (!isset($uri['uri'])) { |
949 | - throw new \InvalidArgumentException('Card does not exists: ' . $id); |
|
949 | + throw new \InvalidArgumentException('Card does not exists: '.$id); |
|
950 | 950 | } |
951 | 951 | |
952 | 952 | return $uri['uri']; |
@@ -1018,11 +1018,11 @@ discard block |
||
1018 | 1018 | ); |
1019 | 1019 | |
1020 | 1020 | foreach ($vCard->children() as $property) { |
1021 | - if(!in_array($property->name, self::$indexProperties)) { |
|
1021 | + if (!in_array($property->name, self::$indexProperties)) { |
|
1022 | 1022 | continue; |
1023 | 1023 | } |
1024 | 1024 | $preferred = 0; |
1025 | - foreach($property->parameters as $parameter) { |
|
1025 | + foreach ($property->parameters as $parameter) { |
|
1026 | 1026 | if ($parameter->name === 'TYPE' && strtoupper($parameter->getValue()) === 'PREF') { |
1027 | 1027 | $preferred = 1; |
1028 | 1028 | break; |
@@ -1077,10 +1077,10 @@ discard block |
||
1077 | 1077 | $result->closeCursor(); |
1078 | 1078 | |
1079 | 1079 | if (!isset($cardIds['id'])) { |
1080 | - throw new \InvalidArgumentException('Card does not exists: ' . $uri); |
|
1080 | + throw new \InvalidArgumentException('Card does not exists: '.$uri); |
|
1081 | 1081 | } |
1082 | 1082 | |
1083 | - return (int)$cardIds['id']; |
|
1083 | + return (int) $cardIds['id']; |
|
1084 | 1084 | } |
1085 | 1085 | |
1086 | 1086 | /** |
@@ -1105,8 +1105,8 @@ discard block |
||
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | private function addOwnerPrincipal(&$addressbookInfo) { |
1108 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
1109 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
1108 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
1109 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
1110 | 1110 | if (isset($addressbookInfo[$ownerPrincipalKey])) { |
1111 | 1111 | $uri = $addressbookInfo[$ownerPrincipalKey]; |
1112 | 1112 | } else { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $count = 0; |
160 | 160 | foreach ($entries as $entry) { |
161 | 161 | $count++; |
162 | - $calculatedPath = $entry['parent_path'] . '/' . $entry['name']; |
|
162 | + $calculatedPath = $entry['parent_path'].'/'.$entry['name']; |
|
163 | 163 | if ($newId = $this->getId($entry['parent_storage'], $calculatedPath)) { |
164 | 164 | // a new entry with the correct path has already been created, reuse that one and delete the incorrect entry |
165 | 165 | $this->reparent($entry['fileid'], $newId); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if ($this->shouldRun()) { |
187 | 187 | $count = $this->repair(); |
188 | 188 | |
189 | - $output->info('Repaired ' . $count . ' paths'); |
|
189 | + $output->info('Repaired '.$count.' paths'); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | } |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | return null; |
50 | 50 | } |
51 | 51 | |
52 | - if(!is_null($this->cache)) { |
|
53 | - $fileCacheKey = $file . filemtime($file); |
|
52 | + if (!is_null($this->cache)) { |
|
53 | + $fileCacheKey = $file.filemtime($file); |
|
54 | 54 | if ($cachedValue = $this->cache->get($fileCacheKey)) { |
55 | 55 | return json_decode($cachedValue, true); |
56 | 56 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $array['settings']['personal-section'] = [$array['settings']['personal-section']]; |
200 | 200 | } |
201 | 201 | |
202 | - if(!is_null($this->cache)) { |
|
202 | + if (!is_null($this->cache)) { |
|
203 | 203 | $this->cache->set($fileCacheKey, json_encode($array)); |
204 | 204 | } |
205 | 205 | return $array; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function xmlToArray($xml) { |
213 | 213 | if (!$xml->children()) { |
214 | - return (string)$xml; |
|
214 | + return (string) $xml; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | $array = []; |
@@ -227,16 +227,16 @@ discard block |
||
227 | 227 | $data = [ |
228 | 228 | '@attributes' => [], |
229 | 229 | ]; |
230 | - if (!count($node->children())){ |
|
231 | - $value = (string)$node; |
|
230 | + if (!count($node->children())) { |
|
231 | + $value = (string) $node; |
|
232 | 232 | if (!empty($value)) { |
233 | - $data['@value'] = (string)$node; |
|
233 | + $data['@value'] = (string) $node; |
|
234 | 234 | } |
235 | 235 | } else { |
236 | 236 | $data = array_merge($data, $this->xmlToArray($node)); |
237 | 237 | } |
238 | 238 | foreach ($attributes as $attr => $value) { |
239 | - $data['@attributes'][$attr] = (string)$value; |
|
239 | + $data['@attributes'][$attr] = (string) $value; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | if ($totalElement > 1) { |