@@ -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 { |
@@ -210,10 +210,10 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | $passwordPolicy = $this->getPasswordPolicy(); |
| 213 | - $passwordCharset = ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS; |
|
| 213 | + $passwordCharset = ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS; |
|
| 214 | 214 | $passwordLength = 8; |
| 215 | 215 | if (!empty($passwordPolicy)) { |
| 216 | - $passwordLength = (int)$passwordPolicy['minLength'] > 0 ? (int)$passwordPolicy['minLength'] : $passwordLength; |
|
| 216 | + $passwordLength = (int) $passwordPolicy['minLength'] > 0 ? (int) $passwordPolicy['minLength'] : $passwordLength; |
|
| 217 | 217 | $passwordCharset .= $passwordPolicy['enforceSpecialCharacters'] ? ISecureRandom::CHAR_SYMBOLS : ''; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -351,11 +351,11 @@ discard block |
||
| 351 | 351 | $share->getExpirationDate() |
| 352 | 352 | ); |
| 353 | 353 | } catch (HintException $hintException) { |
| 354 | - $this->logger->error('Failed to send share by mail: ' . $hintException->getMessage()); |
|
| 354 | + $this->logger->error('Failed to send share by mail: '.$hintException->getMessage()); |
|
| 355 | 355 | $this->removeShareFromTable($shareId); |
| 356 | 356 | throw $hintException; |
| 357 | 357 | } catch (\Exception $e) { |
| 358 | - $this->logger->error('Failed to send share by email: ' . $e->getMessage()); |
|
| 358 | + $this->logger->error('Failed to send share by email: '.$e->getMessage()); |
|
| 359 | 359 | $this->removeShareFromTable($shareId); |
| 360 | 360 | throw new HintException('Failed to send share by mail', |
| 361 | 361 | $this->l->t('Failed to send share by email')); |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | $text = $this->l->t('%s shared »%s« with you.', [$initiatorDisplayName, $filename]); |
| 397 | 397 | |
| 398 | 398 | $emailTemplate->addBodyText( |
| 399 | - $text . ' ' . $this->l->t('Click the button below to open it.'), |
|
| 399 | + $text.' '.$this->l->t('Click the button below to open it.'), |
|
| 400 | 400 | $text |
| 401 | 401 | ); |
| 402 | 402 | $emailTemplate->addBodyButton( |
@@ -420,9 +420,9 @@ discard block |
||
| 420 | 420 | // The "Reply-To" is set to the sharer if an mail address is configured |
| 421 | 421 | // also the default footer contains a "Do not reply" which needs to be adjusted. |
| 422 | 422 | $initiatorEmail = $initiatorUser->getEMailAddress(); |
| 423 | - if($initiatorEmail !== null) { |
|
| 423 | + if ($initiatorEmail !== null) { |
|
| 424 | 424 | $message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); |
| 425 | - $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')); |
|
| 425 | + $emailTemplate->addFooter($instanceName.($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : '')); |
|
| 426 | 426 | } else { |
| 427 | 427 | $emailTemplate->addFooter(); |
| 428 | 428 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | $message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]); |
| 484 | 484 | if ($initiatorEmailAddress !== null) { |
| 485 | 485 | $message->setReplyTo([$initiatorEmailAddress => $initiatorDisplayName]); |
| 486 | - $emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan()); |
|
| 486 | + $emailTemplate->addFooter($instanceName.' - '.$this->defaults->getSlogan()); |
|
| 487 | 487 | } else { |
| 488 | 488 | $emailTemplate->addFooter(); |
| 489 | 489 | } |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | ->orderBy('id'); |
| 579 | 579 | |
| 580 | 580 | $cursor = $qb->execute(); |
| 581 | - while($data = $cursor->fetch()) { |
|
| 581 | + while ($data = $cursor->fetch()) { |
|
| 582 | 582 | $children[] = $this->createShareObject($data); |
| 583 | 583 | } |
| 584 | 584 | $cursor->closeCursor(); |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | $qb->execute(); |
| 623 | 623 | $id = $qb->getLastInsertId(); |
| 624 | 624 | |
| 625 | - return (int)$id; |
|
| 625 | + return (int) $id; |
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | /** |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | // a real password was given |
| 640 | 640 | $validPassword = $plainTextPassword !== null && $plainTextPassword !== ''; |
| 641 | 641 | |
| 642 | - if($validPassword && $originalShare->getPassword() !== $share->getPassword()) { |
|
| 642 | + if ($validPassword && $originalShare->getPassword() !== $share->getPassword()) { |
|
| 643 | 643 | $this->sendPassword($share, $plainTextPassword); |
| 644 | 644 | } |
| 645 | 645 | /* |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | |
| 734 | 734 | $cursor = $qb->execute(); |
| 735 | 735 | $shares = []; |
| 736 | - while($data = $cursor->fetch()) { |
|
| 736 | + while ($data = $cursor->fetch()) { |
|
| 737 | 737 | $shares[] = $this->createShareObject($data); |
| 738 | 738 | } |
| 739 | 739 | $cursor->closeCursor(); |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | ->execute(); |
| 786 | 786 | |
| 787 | 787 | $shares = []; |
| 788 | - while($data = $cursor->fetch()) { |
|
| 788 | + while ($data = $cursor->fetch()) { |
|
| 789 | 789 | $shares[] = $this->createShareObject($data); |
| 790 | 790 | } |
| 791 | 791 | $cursor->closeCursor(); |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | |
| 825 | 825 | $cursor = $qb->execute(); |
| 826 | 826 | |
| 827 | - while($data = $cursor->fetch()) { |
|
| 827 | + while ($data = $cursor->fetch()) { |
|
| 828 | 828 | $shares[] = $this->createShareObject($data); |
| 829 | 829 | } |
| 830 | 830 | $cursor->closeCursor(); |
@@ -887,15 +887,15 @@ discard block |
||
| 887 | 887 | protected function createShareObject($data) { |
| 888 | 888 | |
| 889 | 889 | $share = new Share($this->rootFolder, $this->userManager); |
| 890 | - $share->setId((int)$data['id']) |
|
| 891 | - ->setShareType((int)$data['share_type']) |
|
| 892 | - ->setPermissions((int)$data['permissions']) |
|
| 890 | + $share->setId((int) $data['id']) |
|
| 891 | + ->setShareType((int) $data['share_type']) |
|
| 892 | + ->setPermissions((int) $data['permissions']) |
|
| 893 | 893 | ->setTarget($data['file_target']) |
| 894 | - ->setMailSend((bool)$data['mail_send']) |
|
| 894 | + ->setMailSend((bool) $data['mail_send']) |
|
| 895 | 895 | ->setToken($data['token']); |
| 896 | 896 | |
| 897 | 897 | $shareTime = new \DateTime(); |
| 898 | - $shareTime->setTimestamp((int)$data['stime']); |
|
| 898 | + $shareTime->setTimestamp((int) $data['stime']); |
|
| 899 | 899 | $share->setShareTime($shareTime); |
| 900 | 900 | $share->setSharedWith($data['share_with']); |
| 901 | 901 | $share->setPassword($data['password']); |
@@ -906,7 +906,7 @@ discard block |
||
| 906 | 906 | } else { |
| 907 | 907 | //OLD SHARE |
| 908 | 908 | $share->setSharedBy($data['uid_owner']); |
| 909 | - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); |
|
| 909 | + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); |
|
| 910 | 910 | |
| 911 | 911 | $owner = $path->getOwner(); |
| 912 | 912 | $share->setShareOwner($owner->getUID()); |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | } |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | - $share->setNodeId((int)$data['file_source']); |
|
| 922 | + $share->setNodeId((int) $data['file_source']); |
|
| 923 | 923 | $share->setNodeType($data['item_type']); |
| 924 | 924 | |
| 925 | 925 | $share->setProviderId($this->identifier()); |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | ); |
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | - $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
| 1041 | + $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
| 1042 | 1042 | $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); |
| 1043 | 1043 | |
| 1044 | 1044 | $qb->orderBy('id'); |
@@ -19,14 +19,14 @@ |
||
| 19 | 19 | <tr> |
| 20 | 20 | <th id='headerName' class="hidden column-name"> |
| 21 | 21 | <div id="headerName-container"> |
| 22 | - <a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a> |
|
| 22 | + <a class="name sort columntitle" data-sort="name"><span><?php p($l->t('Name')); ?></span><span class="sort-indicator"></span></a> |
|
| 23 | 23 | </div> |
| 24 | 24 | </th> |
| 25 | 25 | <th id="headerSize" class="hidden column-size"> |
| 26 | 26 | <a class="size sort columntitle" data-sort="size"><span><?php p($l->t('Size')); ?></span><span class="sort-indicator"></span></a> |
| 27 | 27 | </th> |
| 28 | 28 | <th id="headerDate" class="hidden column-mtime"> |
| 29 | - <a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t( 'Modified' )); ?></span><span class="sort-indicator"></span></a> |
|
| 29 | + <a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t('Modified')); ?></span><span class="sort-indicator"></span></a> |
|
| 30 | 30 | <span class="selectedActions"><a href="" class="delete-selected"> |
| 31 | 31 | <?php p($l->t('Delete'))?> |
| 32 | 32 | <img class="svg" alt="" |
@@ -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) { |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | class Manager implements IManager { |
| 31 | 31 | /** @var string[] */ |
| 32 | - protected $sorters =[]; |
|
| 32 | + protected $sorters = []; |
|
| 33 | 33 | |
| 34 | 34 | /** @var ISorter[] */ |
| 35 | 35 | protected $sorterInstances = []; |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function runSorters(array $sorters, array &$sortArray, array $context) { |
| 44 | 44 | $sorterInstances = $this->getSorters(); |
| 45 | - while($sorter = array_shift($sorters)) { |
|
| 46 | - if(isset($sorterInstances[$sorter])) { |
|
| 45 | + while ($sorter = array_shift($sorters)) { |
|
| 46 | + if (isset($sorterInstances[$sorter])) { |
|
| 47 | 47 | $sorterInstances[$sorter]->sort($sortArray, $context); |
| 48 | 48 | } else { |
| 49 | 49 | $this->c->getLogger()->warning('No sorter for ID "{id}", skipping', [ |
@@ -58,17 +58,17 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | protected function getSorters() { |
| 61 | - if(count($this->sorterInstances) === 0) { |
|
| 61 | + if (count($this->sorterInstances) === 0) { |
|
| 62 | 62 | foreach ($this->sorters as $sorter) { |
| 63 | 63 | /** @var ISorter $instance */ |
| 64 | 64 | $instance = $this->c->resolve($sorter); |
| 65 | - if(!$instance instanceof ISorter) { |
|
| 65 | + if (!$instance instanceof ISorter) { |
|
| 66 | 66 | $this->c->getLogger()->notice('Skipping sorter which is not an instance of ISorter. Class name: {class}', |
| 67 | 67 | ['app' => 'core', 'class' => $sorter]); |
| 68 | 68 | continue; |
| 69 | 69 | } |
| 70 | 70 | $sorterId = trim($instance->getId()); |
| 71 | - if(trim($sorterId) === '') { |
|
| 71 | + if (trim($sorterId) === '') { |
|
| 72 | 72 | $this->c->getLogger()->notice('Skipping sorter with empty ID. Class name: {class}', |
| 73 | 73 | ['app' => 'core', 'class' => $sorter]); |
| 74 | 74 | continue; |
@@ -4,12 +4,12 @@ discard block |
||
| 4 | 4 | script('federatedfilesharing', 'settings-admin'); |
| 5 | 5 | ?> |
| 6 | 6 | |
| 7 | -<?php if($_['internalOnly'] === false): ?> |
|
| 7 | +<?php if ($_['internalOnly'] === false): ?> |
|
| 8 | 8 | |
| 9 | 9 | <div id="fileSharingSettings" class="followupsection"> |
| 10 | - <h3><?php p($l->t('Federated Cloud Sharing'));?></h3> |
|
| 10 | + <h3><?php p($l->t('Federated Cloud Sharing')); ?></h3> |
|
| 11 | 11 | <a target="_blank" rel="noreferrer noopener" class="icon-info svg" |
| 12 | - title="<?php p($l->t('Open documentation'));?>" |
|
| 12 | + title="<?php p($l->t('Open documentation')); ?>" |
|
| 13 | 13 | href="<?php p(link_to_docs('admin-sharing-federated')); ?>"></a> |
| 14 | 14 | <p class="settings-hint"><?php p($l->t('Adjust how people can share between servers.')); ?></p> |
| 15 | 15 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | <input type="checkbox" name="outgoing_server2server_share_enabled" id="outgoingServer2serverShareEnabled" class="checkbox" |
| 18 | 18 | value="1" <?php if ($_['outgoingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
| 19 | 19 | <label for="outgoingServer2serverShareEnabled"> |
| 20 | - <?php p($l->t('Allow users on this server to send shares to other servers'));?> |
|
| 20 | + <?php p($l->t('Allow users on this server to send shares to other servers')); ?> |
|
| 21 | 21 | </label> |
| 22 | 22 | </p> |
| 23 | 23 | |
@@ -25,21 +25,21 @@ discard block |
||
| 25 | 25 | <input type="checkbox" name="incoming_server2server_share_enabled" id="incomingServer2serverShareEnabled" class="checkbox" |
| 26 | 26 | value="1" <?php if ($_['incomingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
| 27 | 27 | <label for="incomingServer2serverShareEnabled"> |
| 28 | - <?php p($l->t('Allow users on this server to receive shares from other servers'));?> |
|
| 28 | + <?php p($l->t('Allow users on this server to receive shares from other servers')); ?> |
|
| 29 | 29 | </label><br/> |
| 30 | 30 | </p> |
| 31 | 31 | <p> |
| 32 | 32 | <input type="checkbox" name="lookupServerEnabled" id="lookupServerEnabled" class="checkbox" |
| 33 | 33 | value="1" <?php if ($_['lookupServerEnabled']) print_unescaped('checked="checked"'); ?> /> |
| 34 | 34 | <label for="lookupServerEnabled"> |
| 35 | - <?php p($l->t('Search global and public address book for users'));?> |
|
| 35 | + <?php p($l->t('Search global and public address book for users')); ?> |
|
| 36 | 36 | </label><br/> |
| 37 | 37 | </p> |
| 38 | 38 | <p> |
| 39 | 39 | <input type="checkbox" name="lookupServerUploadEnabled" id="lookupServerUploadEnabled" class="checkbox" |
| 40 | 40 | value="1" <?php if ($_['lookupServerUploadEnabled']) print_unescaped('checked="checked"'); ?> /> |
| 41 | 41 | <label for="lookupServerUploadEnabled"> |
| 42 | - <?php p($l->t('Allow users to publish their data to a global and public address book'));?> |
|
| 42 | + <?php p($l->t('Allow users to publish their data to a global and public address book')); ?> |
|
| 43 | 43 | </label><br/> |
| 44 | 44 | </p> |
| 45 | 45 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | <h2 class="inlineblock"><?php p($_['heading']); ?></h2> |
| 27 | 27 | <?php if (!empty($_['docs'])): ?> |
| 28 | 28 | <a target="_blank" rel="noreferrer noopener" class="icon-info svg" |
| 29 | - title="<?php p($l->t('Open documentation'));?>" |
|
| 29 | + title="<?php p($l->t('Open documentation')); ?>" |
|
| 30 | 30 | href="<?php p(link_to_docs($_['docs'])); ?>"> |
| 31 | 31 | </a> |
| 32 | 32 | <?php endif; ?> |