@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | $select = self::createSelectStatement(self::FORMAT_NONE, $fileDependent); |
151 | 151 | |
152 | - $where .= ' `' . $column . '` = ? AND `item_type` = ? '; |
|
152 | + $where .= ' `'.$column.'` = ? AND `item_type` = ? '; |
|
153 | 153 | $arguments = [$itemSource, $itemType]; |
154 | 154 | // for link shares $user === null |
155 | 155 | if ($user !== null) { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $arguments[] = $owner; |
168 | 168 | } |
169 | 169 | |
170 | - $query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $fileDependentWhere . $where); |
|
170 | + $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$fileDependentWhere.$where); |
|
171 | 171 | |
172 | 172 | $result = \OC_DB::executeAudited($query, $arguments); |
173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | if ($fileDependent && !self::isFileReachable($row['path'], $row['storage_id'])) { |
176 | 176 | continue; |
177 | 177 | } |
178 | - if ($fileDependent && (int)$row['file_parent'] === -1) { |
|
178 | + if ($fileDependent && (int) $row['file_parent'] === -1) { |
|
179 | 179 | // if it is a mount point we need to get the path from the mount manager |
180 | 180 | $mountManager = \OC\Files\Filesystem::getMountManager(); |
181 | 181 | $mountPoint = $mountManager->findByStorageId($row['storage_id']); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $row['path'] = $path; |
187 | 187 | } else { |
188 | 188 | \OC::$server->getLogger()->warning( |
189 | - 'Could not resolve mount point for ' . $row['storage_id'], |
|
189 | + 'Could not resolve mount point for '.$row['storage_id'], |
|
190 | 190 | ['app' => 'OCP\Share'] |
191 | 191 | ); |
192 | 192 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | //if didn't found a result than let's look for a group share. |
198 | - if(empty($shares) && $user !== null) { |
|
198 | + if (empty($shares) && $user !== null) { |
|
199 | 199 | $userObject = \OC::$server->getUserManager()->get($user); |
200 | 200 | $groups = []; |
201 | 201 | if ($userObject) { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | if (!empty($groups)) { |
206 | - $where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
206 | + $where = $fileDependentWhere.' WHERE `'.$column.'` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
207 | 207 | $arguments = [$itemSource, $itemType, $groups]; |
208 | 208 | $types = [null, null, IQueryBuilder::PARAM_STR_ARRAY]; |
209 | 209 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | // class isn't static anymore... |
218 | 218 | $conn = \OC::$server->getDatabaseConnection(); |
219 | 219 | $result = $conn->executeQuery( |
220 | - 'SELECT ' . $select . ' FROM `*PREFIX*share` ' . $where, |
|
220 | + 'SELECT '.$select.' FROM `*PREFIX*share` '.$where, |
|
221 | 221 | $arguments, |
222 | 222 | $types |
223 | 223 | ); |
@@ -351,12 +351,12 @@ discard block |
||
351 | 351 | $currentUser = $owner ? $owner : \OC_User::getUser(); |
352 | 352 | foreach ($items as $item) { |
353 | 353 | // delete the item with the expected share_type and owner |
354 | - if ((int)$item['share_type'] === (int)$shareType && $item['uid_owner'] === $currentUser) { |
|
354 | + if ((int) $item['share_type'] === (int) $shareType && $item['uid_owner'] === $currentUser) { |
|
355 | 355 | $toDelete = $item; |
356 | 356 | // if there is more then one result we don't have to delete the children |
357 | 357 | // but update their parent. For group shares the new parent should always be |
358 | 358 | // the original group share and not the db entry with the unique name |
359 | - } else if ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
359 | + } else if ((int) $item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
360 | 360 | $newParent = $item['parent']; |
361 | 361 | } else { |
362 | 362 | $newParent = $item['id']; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | */ |
416 | 416 | protected static function unshareItem(array $item, $newParent = null) { |
417 | 417 | |
418 | - $shareType = (int)$item['share_type']; |
|
418 | + $shareType = (int) $item['share_type']; |
|
419 | 419 | $shareWith = null; |
420 | 420 | if ($shareType !== \OCP\Share::SHARE_TYPE_LINK) { |
421 | 421 | $shareWith = $item['share_with']; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | 'itemParent' => $item['parent'], |
432 | 432 | 'uidOwner' => $item['uid_owner'], |
433 | 433 | ]; |
434 | - if($item['item_type'] === 'file' || $item['item_type'] === 'folder') { |
|
434 | + if ($item['item_type'] === 'file' || $item['item_type'] === 'folder') { |
|
435 | 435 | $hookParams['fileSource'] = $item['file_source']; |
436 | 436 | $hookParams['fileTarget'] = $item['file_target']; |
437 | 437 | } |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $deletedShares[] = $hookParams; |
442 | 442 | $hookParams['deletedShares'] = $deletedShares; |
443 | 443 | \OC_Hook::emit(\OCP\Share::class, 'post_unshare', $hookParams); |
444 | - if ((int)$item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
444 | + if ((int) $item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
445 | 445 | list(, $remote) = Helper::splitUserRemote($item['share_with']); |
446 | 446 | self::sendRemoteUnshare($remote, $item['id'], $item['token']); |
447 | 447 | } |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | // Get filesystem root to add it to the file target and remove from the |
606 | 606 | // file source, match file_source with the file cache |
607 | 607 | if ($itemType == 'file' || $itemType == 'folder') { |
608 | - if(!is_null($uidOwner)) { |
|
608 | + if (!is_null($uidOwner)) { |
|
609 | 609 | $root = \OC\Files\Filesystem::getRoot(); |
610 | 610 | } else { |
611 | 611 | $root = ''; |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | $result = $query->execute($queryArgs); |
751 | 751 | if ($result === false) { |
752 | 752 | \OCP\Util::writeLog('OCP\Share', |
753 | - \OC_DB::getErrorMessage() . ', select=' . $select . ' where=', |
|
753 | + \OC_DB::getErrorMessage().', select='.$select.' where=', |
|
754 | 754 | ILogger::ERROR); |
755 | 755 | } |
756 | 756 | $items = []; |
@@ -792,14 +792,14 @@ discard block |
||
792 | 792 | } |
793 | 793 | // Switch ids if sharing permission is granted on only |
794 | 794 | // one share to ensure correct parent is used if resharing |
795 | - if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
796 | - && (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
795 | + if (~(int) $items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
796 | + && (int) $row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
797 | 797 | $items[$row['id']] = $items[$id]; |
798 | 798 | $switchedItems[$id] = $row['id']; |
799 | 799 | unset($items[$id]); |
800 | 800 | $id = $row['id']; |
801 | 801 | } |
802 | - $items[$id]['permissions'] |= (int)$row['permissions']; |
|
802 | + $items[$id]['permissions'] |= (int) $row['permissions']; |
|
803 | 803 | |
804 | 804 | } |
805 | 805 | continue; |
@@ -813,8 +813,8 @@ discard block |
||
813 | 813 | $query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?'); |
814 | 814 | $parentResult = $query->execute([$row['parent']]); |
815 | 815 | if ($result === false) { |
816 | - \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' . |
|
817 | - \OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where, |
|
816 | + \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: '. |
|
817 | + \OC_DB::getErrorMessage().', select='.$select.' where='.$where, |
|
818 | 818 | ILogger::ERROR); |
819 | 819 | } else { |
820 | 820 | $parentRow = $parentResult->fetchRow(); |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | $subPath = substr($row['path'], $pos); |
825 | 825 | $splitPath = explode('/', $subPath); |
826 | 826 | foreach (array_slice($splitPath, 2) as $pathPart) { |
827 | - $tmpPath = $tmpPath . '/' . $pathPart; |
|
827 | + $tmpPath = $tmpPath.'/'.$pathPart; |
|
828 | 828 | } |
829 | 829 | $row['path'] = $tmpPath; |
830 | 830 | } |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | } |
844 | 844 | } |
845 | 845 | |
846 | - if($checkExpireDate) { |
|
846 | + if ($checkExpireDate) { |
|
847 | 847 | if (self::expireItem($row)) { |
848 | 848 | continue; |
849 | 849 | } |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | $row['share_type'] === self::SHARE_TYPE_USER) { |
859 | 859 | $shareWithUser = \OC::$server->getUserManager()->get($row['share_with']); |
860 | 860 | $row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName(); |
861 | - } else if(isset($row['share_with']) && $row['share_with'] != '' && |
|
861 | + } else if (isset($row['share_with']) && $row['share_with'] != '' && |
|
862 | 862 | $row['share_type'] === self::SHARE_TYPE_REMOTE) { |
863 | 863 | $addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']); |
864 | 864 | foreach ($addressBookEntries as $entry) { |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | |
976 | 976 | // filter out invalid items, these can appear when subshare entries exist |
977 | 977 | // for a group in which the requested user isn't a member any more |
978 | - $items = array_filter($items, function ($item) { |
|
978 | + $items = array_filter($items, function($item) { |
|
979 | 979 | return $item['share_type'] !== self::$shareTypeGroupUserUnique; |
980 | 980 | }); |
981 | 981 | |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | $groupItemTarget = $itemTarget = $fileSource = $parent = 0; |
1064 | 1064 | |
1065 | 1065 | $result = self::checkReshare('test', $itemSource, self::SHARE_TYPE_USER, $shareWith, $uidOwner, $permissions, null, null); |
1066 | - if(!empty($result)) { |
|
1066 | + if (!empty($result)) { |
|
1067 | 1067 | $parent = $result['parent']; |
1068 | 1068 | $itemSource = $result['itemSource']; |
1069 | 1069 | $fileSource = $result['fileSource']; |
@@ -1111,7 +1111,7 @@ discard block |
||
1111 | 1111 | $fileTarget = $sourceExists['file_target']; |
1112 | 1112 | $itemTarget = $sourceExists['item_target']; |
1113 | 1113 | |
1114 | - } elseif(!$sourceExists) { |
|
1114 | + } elseif (!$sourceExists) { |
|
1115 | 1115 | |
1116 | 1116 | $itemTarget = Helper::generateTarget($itemType, $itemSource, $userShareType, $user, |
1117 | 1117 | $uidOwner, $suggestedItemTarget, $parent); |
@@ -1222,8 +1222,8 @@ discard block |
||
1222 | 1222 | |
1223 | 1223 | if ($checkReshare && $checkReshare['uid_owner'] !== \OC_User::getUser()) { |
1224 | 1224 | // Check if share permissions is granted |
1225 | - if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
1226 | - if (~(int)$checkReshare['permissions'] & $permissions) { |
|
1225 | + if (self::isResharingAllowed() && (int) $checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
1226 | + if (~(int) $checkReshare['permissions'] & $permissions) { |
|
1227 | 1227 | $message = 'Sharing %1$s failed, because the permissions exceed permissions granted to %2$s'; |
1228 | 1228 | throw new \Exception(sprintf($message, $itemSourceName, $uidOwner)); |
1229 | 1229 | } else { |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | |
1233 | 1233 | $result['expirationDate'] = $expirationDate; |
1234 | 1234 | // $checkReshare['expiration'] could be null and then is always less than any value |
1235 | - if(isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) { |
|
1235 | + if (isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) { |
|
1236 | 1236 | $result['expirationDate'] = $checkReshare['expiration']; |
1237 | 1237 | } |
1238 | 1238 | |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | |
1313 | 1313 | $id = false; |
1314 | 1314 | if ($result) { |
1315 | - $id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share'); |
|
1315 | + $id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share'); |
|
1316 | 1316 | } |
1317 | 1317 | |
1318 | 1318 | return $id; |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | * @param array $parameters additional format parameters |
1415 | 1415 | * @return array format result |
1416 | 1416 | */ |
1417 | - private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) { |
|
1417 | + private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE, $parameters = null) { |
|
1418 | 1418 | if ($format === self::FORMAT_NONE) { |
1419 | 1419 | return $items; |
1420 | 1420 | } else if ($format === self::FORMAT_STATUSES) { |
@@ -1471,13 +1471,13 @@ discard block |
||
1471 | 1471 | $try = 0; |
1472 | 1472 | $discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class); |
1473 | 1473 | while ($result['success'] === false && $try < 2) { |
1474 | - $federationEndpoints = $discoveryService->discover($protocol . $remoteDomain, 'FEDERATED_SHARING'); |
|
1474 | + $federationEndpoints = $discoveryService->discover($protocol.$remoteDomain, 'FEDERATED_SHARING'); |
|
1475 | 1475 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
1476 | 1476 | $client = \OC::$server->getHTTPClientService()->newClient(); |
1477 | 1477 | |
1478 | 1478 | try { |
1479 | 1479 | $response = $client->post( |
1480 | - $protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, |
|
1480 | + $protocol.$remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT, |
|
1481 | 1481 | [ |
1482 | 1482 | 'body' => $fields, |
1483 | 1483 | 'connect_timeout' => 10, |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | * @return int |
1519 | 1519 | */ |
1520 | 1520 | public static function getExpireInterval() { |
1521 | - return (int)\OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1521 | + return (int) \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1522 | 1522 | } |
1523 | 1523 | |
1524 | 1524 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | $route = substr($route, 7); |
107 | - $route = '/ocs/v2.php' . $route; |
|
107 | + $route = '/ocs/v2.php'.$route; |
|
108 | 108 | |
109 | 109 | return $this->getAbsoluteURL($route); |
110 | 110 | } |
@@ -122,37 +122,37 @@ discard block |
||
122 | 122 | public function linkTo(string $app, string $file, array $args = []): string { |
123 | 123 | $frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); |
124 | 124 | |
125 | - if($app !== '') { |
|
125 | + if ($app !== '') { |
|
126 | 126 | $app_path = \OC_App::getAppPath($app); |
127 | 127 | // Check if the app is in the app folder |
128 | - if ($app_path && file_exists($app_path . '/' . $file)) { |
|
128 | + if ($app_path && file_exists($app_path.'/'.$file)) { |
|
129 | 129 | if (substr($file, -3) === 'php') { |
130 | 130 | |
131 | - $urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $app; |
|
131 | + $urlLinkTo = \OC::$WEBROOT.'/index.php/apps/'.$app; |
|
132 | 132 | if ($frontControllerActive) { |
133 | - $urlLinkTo = \OC::$WEBROOT . '/apps/' . $app; |
|
133 | + $urlLinkTo = \OC::$WEBROOT.'/apps/'.$app; |
|
134 | 134 | } |
135 | - $urlLinkTo .= ($file !== 'index.php') ? '/' . $file : ''; |
|
135 | + $urlLinkTo .= ($file !== 'index.php') ? '/'.$file : ''; |
|
136 | 136 | } else { |
137 | - $urlLinkTo = \OC_App::getAppWebPath($app) . '/' . $file; |
|
137 | + $urlLinkTo = \OC_App::getAppWebPath($app).'/'.$file; |
|
138 | 138 | } |
139 | 139 | } else { |
140 | - $urlLinkTo = \OC::$WEBROOT . '/' . $app . '/' . $file; |
|
140 | + $urlLinkTo = \OC::$WEBROOT.'/'.$app.'/'.$file; |
|
141 | 141 | } |
142 | 142 | } else { |
143 | - if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) { |
|
144 | - $urlLinkTo = \OC::$WEBROOT . '/core/' . $file; |
|
143 | + if (file_exists(\OC::$SERVERROOT.'/core/'.$file)) { |
|
144 | + $urlLinkTo = \OC::$WEBROOT.'/core/'.$file; |
|
145 | 145 | } else { |
146 | 146 | if ($frontControllerActive && $file === 'index.php') { |
147 | - $urlLinkTo = \OC::$WEBROOT . '/'; |
|
147 | + $urlLinkTo = \OC::$WEBROOT.'/'; |
|
148 | 148 | } else { |
149 | - $urlLinkTo = \OC::$WEBROOT . '/' . $file; |
|
149 | + $urlLinkTo = \OC::$WEBROOT.'/'.$file; |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | 154 | if ($args && $query = http_build_query($args, '', '&')) { |
155 | - $urlLinkTo .= '?' . $query; |
|
155 | + $urlLinkTo .= '?'.$query; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | return $urlLinkTo; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | public function imagePath(string $app, string $image): string { |
171 | 171 | $cache = $this->cacheFactory->createDistributed('imagePath-'.md5($this->getBaseUrl()).'-'); |
172 | 172 | $cacheKey = $app.'-'.$image; |
173 | - if($key = $cache->get($cacheKey)) { |
|
173 | + if ($key = $cache->get($cacheKey)) { |
|
174 | 174 | return $key; |
175 | 175 | } |
176 | 176 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $theme = \OC_Util::getTheme(); |
179 | 179 | |
180 | 180 | //if a theme has a png but not an svg always use the png |
181 | - $basename = substr(basename($image),0,-4); |
|
181 | + $basename = substr(basename($image), 0, -4); |
|
182 | 182 | |
183 | 183 | $appPath = \OC_App::getAppPath($app); |
184 | 184 | |
@@ -186,53 +186,53 @@ discard block |
||
186 | 186 | $path = ''; |
187 | 187 | $themingEnabled = $this->config->getSystemValue('installed', false) && \OCP\App::isEnabled('theming') && \OC_App::isAppLoaded('theming'); |
188 | 188 | $themingImagePath = false; |
189 | - if($themingEnabled) { |
|
189 | + if ($themingEnabled) { |
|
190 | 190 | $themingDefaults = \OC::$server->getThemingDefaults(); |
191 | 191 | if ($themingDefaults instanceof ThemingDefaults) { |
192 | 192 | $themingImagePath = $themingDefaults->replaceImagePath($app, $image); |
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | - if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) { |
|
197 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image"; |
|
198 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.svg") |
|
199 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.png")) { |
|
200 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$basename.png"; |
|
201 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$image")) { |
|
202 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$image"; |
|
203 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.svg") |
|
204 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.png"))) { |
|
205 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$basename.png"; |
|
206 | - } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$image")) { |
|
207 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$image"; |
|
208 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.svg") |
|
209 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.png")) { |
|
210 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
211 | - } elseif($themingEnabled && $themingImagePath) { |
|
196 | + if (file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image")) { |
|
197 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$app/img/$image"; |
|
198 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.svg") |
|
199 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.png")) { |
|
200 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$app/img/$basename.png"; |
|
201 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$image")) { |
|
202 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$image"; |
|
203 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.svg") |
|
204 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.png"))) { |
|
205 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$basename.png"; |
|
206 | + } elseif (file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$image")) { |
|
207 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$image"; |
|
208 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.svg") |
|
209 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.png")) { |
|
210 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
211 | + } elseif ($themingEnabled && $themingImagePath) { |
|
212 | 212 | $path = $themingImagePath; |
213 | - } elseif ($appPath && file_exists($appPath . "/img/$image")) { |
|
214 | - $path = \OC_App::getAppWebPath($app) . "/img/$image"; |
|
215 | - } elseif ($appPath && !file_exists($appPath . "/img/$basename.svg") |
|
216 | - && file_exists($appPath . "/img/$basename.png")) { |
|
217 | - $path = \OC_App::getAppWebPath($app) . "/img/$basename.png"; |
|
218 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/$app/img/$image")) { |
|
219 | - $path = \OC::$WEBROOT . "/$app/img/$image"; |
|
220 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/$app/img/$basename.svg") |
|
221 | - && file_exists(\OC::$SERVERROOT . "/$app/img/$basename.png"))) { |
|
222 | - $path = \OC::$WEBROOT . "/$app/img/$basename.png"; |
|
223 | - } elseif (file_exists(\OC::$SERVERROOT . "/core/img/$image")) { |
|
224 | - $path = \OC::$WEBROOT . "/core/img/$image"; |
|
225 | - } elseif (!file_exists(\OC::$SERVERROOT . "/core/img/$basename.svg") |
|
226 | - && file_exists(\OC::$SERVERROOT . "/core/img/$basename.png")) { |
|
227 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
213 | + } elseif ($appPath && file_exists($appPath."/img/$image")) { |
|
214 | + $path = \OC_App::getAppWebPath($app)."/img/$image"; |
|
215 | + } elseif ($appPath && !file_exists($appPath."/img/$basename.svg") |
|
216 | + && file_exists($appPath."/img/$basename.png")) { |
|
217 | + $path = \OC_App::getAppWebPath($app)."/img/$basename.png"; |
|
218 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/$app/img/$image")) { |
|
219 | + $path = \OC::$WEBROOT."/$app/img/$image"; |
|
220 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/$app/img/$basename.svg") |
|
221 | + && file_exists(\OC::$SERVERROOT."/$app/img/$basename.png"))) { |
|
222 | + $path = \OC::$WEBROOT."/$app/img/$basename.png"; |
|
223 | + } elseif (file_exists(\OC::$SERVERROOT."/core/img/$image")) { |
|
224 | + $path = \OC::$WEBROOT."/core/img/$image"; |
|
225 | + } elseif (!file_exists(\OC::$SERVERROOT."/core/img/$basename.svg") |
|
226 | + && file_exists(\OC::$SERVERROOT."/core/img/$basename.png")) { |
|
227 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
228 | 228 | } |
229 | 229 | |
230 | - if($path !== '') { |
|
230 | + if ($path !== '') { |
|
231 | 231 | $cache->set($cacheKey, $path); |
232 | 232 | return $path; |
233 | 233 | } |
234 | 234 | |
235 | - throw new RuntimeException('image not found: image:' . $image . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT); |
|
235 | + throw new RuntimeException('image not found: image:'.$image.' webroot:'.\OC::$WEBROOT.' serverroot:'.\OC::$SERVERROOT); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | $separator = strpos($url, '/') === 0 ? '' : '/'; |
246 | 246 | |
247 | 247 | if (\OC::$CLI && !\defined('PHPUNIT_RUN')) { |
248 | - return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/') . '/' . ltrim($url, '/'); |
|
248 | + return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/').'/'.ltrim($url, '/'); |
|
249 | 249 | } |
250 | 250 | // The ownCloud web root can already be prepended. |
251 | - if(\OC::$WEBROOT !== '' && strpos($url, \OC::$WEBROOT) === 0) { |
|
251 | + if (\OC::$WEBROOT !== '' && strpos($url, \OC::$WEBROOT) === 0) { |
|
252 | 252 | $url = substr($url, \strlen(\OC::$WEBROOT)); |
253 | 253 | } |
254 | 254 | |
255 | - return $this->getBaseUrl() . $separator . $url; |
|
255 | + return $this->getBaseUrl().$separator.$url; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -268,6 +268,6 @@ discard block |
||
268 | 268 | * @return string base url of the current request |
269 | 269 | */ |
270 | 270 | public function getBaseUrl(): string { |
271 | - return $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . \OC::$WEBROOT; |
|
271 | + return $this->request->getServerProtocol().'://'.$this->request->getServerHost().\OC::$WEBROOT; |
|
272 | 272 | } |
273 | 273 | } |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | public function searchPaged($query, array $inApps = [], $page = 1, $size = 30) { |
52 | 52 | $this->initProviders(); |
53 | 53 | $results = []; |
54 | - foreach($this->providers as $provider) { |
|
54 | + foreach ($this->providers as $provider) { |
|
55 | 55 | /** @var $provider Provider */ |
56 | - if (! $provider->providesResultsFor($inApps)) { |
|
56 | + if (!$provider->providesResultsFor($inApps)) { |
|
57 | 57 | continue; |
58 | 58 | } |
59 | 59 | if ($provider instanceof PagedProvider) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public function removeProvider($provider) { |
89 | 89 | $this->registeredProviders = array_filter( |
90 | 90 | $this->registeredProviders, |
91 | - function ($element) use ($provider) { |
|
91 | + function($element) use ($provider) { |
|
92 | 92 | return ($element['class'] != $provider); |
93 | 93 | } |
94 | 94 | ); |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | * Create instances of all the registered search providers |
110 | 110 | */ |
111 | 111 | private function initProviders() { |
112 | - if(! empty($this->providers)) { |
|
112 | + if (!empty($this->providers)) { |
|
113 | 113 | return; |
114 | 114 | } |
115 | - foreach($this->registeredProviders as $provider) { |
|
115 | + foreach ($this->registeredProviders as $provider) { |
|
116 | 116 | $class = $provider['class']; |
117 | 117 | $options = $provider['options']; |
118 | 118 | $this->providers[] = new $class($options); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ->setValue('gid', $builder->createNamedParameter($gid)) |
114 | 114 | ->setValue('displayname', $builder->createNamedParameter($gid)) |
115 | 115 | ->execute(); |
116 | - } catch(UniqueConstraintViolationException $e) { |
|
116 | + } catch (UniqueConstraintViolationException $e) { |
|
117 | 117 | $result = 0; |
118 | 118 | } |
119 | 119 | |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | $this->fixDI(); |
195 | 195 | |
196 | 196 | // No duplicate entries! |
197 | - if(!$this->inGroup($uid, $gid)) { |
|
197 | + if (!$this->inGroup($uid, $gid)) { |
|
198 | 198 | $qb = $this->dbConn->getQueryBuilder(); |
199 | 199 | $qb->insert('group_user') |
200 | 200 | ->setValue('uid', $qb->createNamedParameter($uid)) |
201 | 201 | ->setValue('gid', $qb->createNamedParameter($gid)) |
202 | 202 | ->execute(); |
203 | 203 | return true; |
204 | - }else{ |
|
204 | + } else { |
|
205 | 205 | return false; |
206 | 206 | } |
207 | 207 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | ->execute(); |
251 | 251 | |
252 | 252 | $groups = []; |
253 | - while($row = $cursor->fetch()) { |
|
253 | + while ($row = $cursor->fetch()) { |
|
254 | 254 | $groups[] = $row['gid']; |
255 | 255 | $this->groupCache[$row['gid']] = $row['gid']; |
256 | 256 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | if ($search !== '') { |
280 | 280 | $query->where($query->expr()->iLike('gid', $query->createNamedParameter( |
281 | - '%' . $this->dbConn->escapeLikeParameter($search) . '%' |
|
281 | + '%'.$this->dbConn->escapeLikeParameter($search).'%' |
|
282 | 282 | ))); |
283 | 283 | } |
284 | 284 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | if ($search !== '') { |
344 | 344 | $query->andWhere($query->expr()->like('uid', $query->createNamedParameter( |
345 | - '%' . $this->dbConn->escapeLikeParameter($search) . '%' |
|
345 | + '%'.$this->dbConn->escapeLikeParameter($search).'%' |
|
346 | 346 | ))); |
347 | 347 | } |
348 | 348 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | |
381 | 381 | if ($search !== '') { |
382 | 382 | $query->andWhere($query->expr()->like('uid', $query->createNamedParameter( |
383 | - '%' . $this->dbConn->escapeLikeParameter($search) . '%' |
|
383 | + '%'.$this->dbConn->escapeLikeParameter($search).'%' |
|
384 | 384 | ))); |
385 | 385 | } |
386 | 386 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $result->closeCursor(); |
390 | 390 | |
391 | 391 | if ($count !== false) { |
392 | - $count = (int)$count; |
|
392 | + $count = (int) $count; |
|
393 | 393 | } else { |
394 | 394 | $count = 0; |
395 | 395 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | $this->fixDI(); |
409 | 409 | |
410 | 410 | $query = $this->dbConn->getQueryBuilder(); |
411 | - $query->select($query->createFunction('COUNT(DISTINCT ' . $query->getColumnName('uid') . ')')) |
|
411 | + $query->select($query->createFunction('COUNT(DISTINCT '.$query->getColumnName('uid').')')) |
|
412 | 412 | ->from('preferences', 'p') |
413 | 413 | ->innerJoin('p', 'group_user', 'g', $query->expr()->eq('p.userid', 'g.uid')) |
414 | 414 | ->where($query->expr()->eq('appid', $query->createNamedParameter('core'))) |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $result->closeCursor(); |
422 | 422 | |
423 | 423 | if ($count !== false) { |
424 | - $count = (int)$count; |
|
424 | + $count = (int) $count; |
|
425 | 425 | } else { |
426 | 426 | $count = 0; |
427 | 427 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @return mixed the value or $default |
89 | 89 | */ |
90 | 90 | public function getValue($key, $default = null) { |
91 | - $envValue = getenv(self::ENV_PREFIX . $key); |
|
91 | + $envValue = getenv(self::ENV_PREFIX.$key); |
|
92 | 92 | if ($envValue !== false) { |
93 | 93 | return $envValue; |
94 | 94 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | foreach ($configFiles as $file) { |
201 | 201 | $fileExistsAndIsReadable = file_exists($file) && is_readable($file); |
202 | 202 | $filePointer = $fileExistsAndIsReadable ? fopen($file, 'r') : false; |
203 | - if($file === $this->configFilePath && |
|
203 | + if ($file === $this->configFilePath && |
|
204 | 204 | $filePointer === false) { |
205 | 205 | // Opening the main config might not be possible, e.g. if the wrong |
206 | 206 | // permissions are set (likely on a new installation) |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | // Try to acquire a file lock |
211 | - if(!flock($filePointer, LOCK_SH)) { |
|
211 | + if (!flock($filePointer, LOCK_SH)) { |
|
212 | 212 | throw new \Exception(sprintf('Could not acquire a shared lock on the config file %s', $file)); |
213 | 213 | } |
214 | 214 | |
215 | 215 | unset($CONFIG); |
216 | 216 | include $file; |
217 | - if(isset($CONFIG) && is_array($CONFIG)) { |
|
217 | + if (isset($CONFIG) && is_array($CONFIG)) { |
|
218 | 218 | $this->cache = array_merge($this->cache, $CONFIG); |
219 | 219 | } |
220 | 220 | |
@@ -246,14 +246,14 @@ discard block |
||
246 | 246 | chmod($this->configFilePath, 0640); |
247 | 247 | |
248 | 248 | // File does not exist, this can happen when doing a fresh install |
249 | - if(!is_resource($filePointer)) { |
|
249 | + if (!is_resource($filePointer)) { |
|
250 | 250 | throw new HintException( |
251 | 251 | "Can't write into config directory!", |
252 | 252 | 'This can usually be fixed by giving the webserver write access to the config directory.'); |
253 | 253 | } |
254 | 254 | |
255 | 255 | // Try to acquire a file lock |
256 | - if(!flock($filePointer, LOCK_EX)) { |
|
256 | + if (!flock($filePointer, LOCK_EX)) { |
|
257 | 257 | throw new \Exception(sprintf('Could not acquire an exclusive lock on the config file %s', $this->configFilePath)); |
258 | 258 | } |
259 | 259 |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function installApp(string $appId, bool $forceEnable = false): string { |
108 | 108 | $app = \OC_App::findAppInDirectories($appId); |
109 | - if($app === false) { |
|
109 | + if ($app === false) { |
|
110 | 110 | throw new \Exception('App not found in any app directory'); |
111 | 111 | } |
112 | 112 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | $l = \OC::$server->getL10N('core'); |
117 | 117 | |
118 | - if(!is_array($info)) { |
|
118 | + if (!is_array($info)) { |
|
119 | 119 | throw new \Exception( |
120 | 120 | $l->t('App "%s" cannot be installed because appinfo file cannot be read.', |
121 | 121 | [$appId] |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | //install the database |
149 | - if(is_file($basedir.'/appinfo/database.xml')) { |
|
149 | + if (is_file($basedir.'/appinfo/database.xml')) { |
|
150 | 150 | if (\OC::$server->getConfig()->getAppValue($info['id'], 'installed_version') === null) { |
151 | 151 | OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml'); |
152 | 152 | } else { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | \OC_App::setupBackgroundJobs($info['background-jobs']); |
164 | 164 | |
165 | 165 | //run appinfo/install.php |
166 | - self::includeAppScript($basedir . '/appinfo/install.php'); |
|
166 | + self::includeAppScript($basedir.'/appinfo/install.php'); |
|
167 | 167 | |
168 | 168 | $appData = OC_App::getAppInfo($appId); |
169 | 169 | OC_App::executeRepairSteps($appId, $appData['repair-steps']['install']); |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | \OC::$server->getConfig()->setAppValue($info['id'], 'enabled', 'no'); |
174 | 174 | |
175 | 175 | //set remote/public handlers |
176 | - foreach($info['remote'] as $name=>$path) { |
|
176 | + foreach ($info['remote'] as $name=>$path) { |
|
177 | 177 | \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path); |
178 | 178 | } |
179 | - foreach($info['public'] as $name=>$path) { |
|
179 | + foreach ($info['public'] as $name=>$path) { |
|
180 | 180 | \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $info['id'].'/'.$path); |
181 | 181 | } |
182 | 182 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @return bool |
193 | 193 | */ |
194 | 194 | public function updateAppstoreApp($appId) { |
195 | - if($this->isUpdateAvailable($appId)) { |
|
195 | + if ($this->isUpdateAvailable($appId)) { |
|
196 | 196 | try { |
197 | 197 | $this->downloadApp($appId); |
198 | 198 | } catch (\Exception $e) { |
@@ -219,18 +219,18 @@ discard block |
||
219 | 219 | $appId = strtolower($appId); |
220 | 220 | |
221 | 221 | $apps = $this->appFetcher->get(); |
222 | - foreach($apps as $app) { |
|
223 | - if($app['id'] === $appId) { |
|
222 | + foreach ($apps as $app) { |
|
223 | + if ($app['id'] === $appId) { |
|
224 | 224 | // Load the certificate |
225 | 225 | $certificate = new X509(); |
226 | - $certificate->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt')); |
|
226 | + $certificate->loadCA(file_get_contents(__DIR__.'/../../resources/codesigning/root.crt')); |
|
227 | 227 | $loadedCertificate = $certificate->loadX509($app['certificate']); |
228 | 228 | |
229 | 229 | // Verify if the certificate has been revoked |
230 | 230 | $crl = new X509(); |
231 | - $crl->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt')); |
|
232 | - $crl->loadCRL(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crl')); |
|
233 | - if($crl->validateSignature() !== true) { |
|
231 | + $crl->loadCA(file_get_contents(__DIR__.'/../../resources/codesigning/root.crt')); |
|
232 | + $crl->loadCRL(file_get_contents(__DIR__.'/../../resources/codesigning/root.crl')); |
|
233 | + if ($crl->validateSignature() !== true) { |
|
234 | 234 | throw new \Exception('Could not validate CRL signature'); |
235 | 235 | } |
236 | 236 | $csn = $loadedCertificate['tbsCertificate']['serialNumber']->toString(); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | // Verify if the certificate has been issued by the Nextcloud Code Authority CA |
248 | - if($certificate->validateSignature() !== true) { |
|
248 | + if ($certificate->validateSignature() !== true) { |
|
249 | 249 | throw new \Exception( |
250 | 250 | sprintf( |
251 | 251 | 'App with id %s has a certificate not issued by a trusted Code Signing Authority', |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | // Verify if the certificate is issued for the requested app id |
258 | 258 | $certInfo = openssl_x509_parse($app['certificate']); |
259 | - if(!isset($certInfo['subject']['CN'])) { |
|
259 | + if (!isset($certInfo['subject']['CN'])) { |
|
260 | 260 | throw new \Exception( |
261 | 261 | sprintf( |
262 | 262 | 'App with id %s has a cert with no CN', |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | ) |
265 | 265 | ); |
266 | 266 | } |
267 | - if($certInfo['subject']['CN'] !== $appId) { |
|
267 | + if ($certInfo['subject']['CN'] !== $appId) { |
|
268 | 268 | throw new \Exception( |
269 | 269 | sprintf( |
270 | 270 | 'App with id %s has a cert issued to %s', |
@@ -282,15 +282,15 @@ discard block |
||
282 | 282 | |
283 | 283 | // Check if the signature actually matches the downloaded content |
284 | 284 | $certificate = openssl_get_publickey($app['certificate']); |
285 | - $verified = (bool)openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512); |
|
285 | + $verified = (bool) openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512); |
|
286 | 286 | openssl_free_key($certificate); |
287 | 287 | |
288 | - if($verified === true) { |
|
288 | + if ($verified === true) { |
|
289 | 289 | // Seems to match, let's proceed |
290 | 290 | $extractDir = $this->tempManager->getTemporaryFolder(); |
291 | 291 | $archive = new TAR($tempFile); |
292 | 292 | |
293 | - if($archive) { |
|
293 | + if ($archive) { |
|
294 | 294 | if (!$archive->extract($extractDir)) { |
295 | 295 | throw new \Exception( |
296 | 296 | sprintf( |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $folders = array_diff($allFiles, ['.', '..']); |
304 | 304 | $folders = array_values($folders); |
305 | 305 | |
306 | - if(count($folders) > 1) { |
|
306 | + if (count($folders) > 1) { |
|
307 | 307 | throw new \Exception( |
308 | 308 | sprintf( |
309 | 309 | 'Extracted app %s has more than 1 folder', |
@@ -314,22 +314,22 @@ discard block |
||
314 | 314 | |
315 | 315 | // Check if appinfo/info.xml has the same app ID as well |
316 | 316 | $loadEntities = libxml_disable_entity_loader(false); |
317 | - $xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml'); |
|
317 | + $xml = simplexml_load_file($extractDir.'/'.$folders[0].'/appinfo/info.xml'); |
|
318 | 318 | libxml_disable_entity_loader($loadEntities); |
319 | - if((string)$xml->id !== $appId) { |
|
319 | + if ((string) $xml->id !== $appId) { |
|
320 | 320 | throw new \Exception( |
321 | 321 | sprintf( |
322 | 322 | 'App for id %s has a wrong app ID in info.xml: %s', |
323 | 323 | $appId, |
324 | - (string)$xml->id |
|
324 | + (string) $xml->id |
|
325 | 325 | ) |
326 | 326 | ); |
327 | 327 | } |
328 | 328 | |
329 | 329 | // Check if the version is lower than before |
330 | 330 | $currentVersion = OC_App::getAppVersion($appId); |
331 | - $newVersion = (string)$xml->version; |
|
332 | - if(version_compare($currentVersion, $newVersion) === 1) { |
|
331 | + $newVersion = (string) $xml->version; |
|
332 | + if (version_compare($currentVersion, $newVersion) === 1) { |
|
333 | 333 | throw new \Exception( |
334 | 334 | sprintf( |
335 | 335 | 'App for id %s has version %s and tried to update to lower version %s', |
@@ -340,12 +340,12 @@ discard block |
||
340 | 340 | ); |
341 | 341 | } |
342 | 342 | |
343 | - $baseDir = OC_App::getInstallPath() . '/' . $appId; |
|
343 | + $baseDir = OC_App::getInstallPath().'/'.$appId; |
|
344 | 344 | // Remove old app with the ID if existent |
345 | 345 | OC_Helper::rmdirr($baseDir); |
346 | 346 | // Move to app folder |
347 | - if(@mkdir($baseDir)) { |
|
348 | - $extractDir .= '/' . $folders[0]; |
|
347 | + if (@mkdir($baseDir)) { |
|
348 | + $extractDir .= '/'.$folders[0]; |
|
349 | 349 | OC_Helper::copyr($extractDir, $baseDir); |
350 | 350 | } |
351 | 351 | OC_Helper::copyr($extractDir, $baseDir); |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | $this->apps = $this->appFetcher->get(); |
409 | 409 | } |
410 | 410 | |
411 | - foreach($this->apps as $app) { |
|
412 | - if($app['id'] === $appId) { |
|
411 | + foreach ($this->apps as $app) { |
|
412 | + if ($app['id'] === $appId) { |
|
413 | 413 | $currentVersion = OC_App::getAppVersion($appId); |
414 | 414 | |
415 | 415 | if (!isset($app['releases'][0]['version'])) { |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | */ |
437 | 437 | private function isInstalledFromGit($appId) { |
438 | 438 | $app = \OC_App::findAppInDirectories($appId); |
439 | - if($app === false) { |
|
439 | + if ($app === false) { |
|
440 | 440 | return false; |
441 | 441 | } |
442 | 442 | $basedir = $app['path'].'/'.$appId; |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * The function will check if the app is already downloaded in the apps repository |
452 | 452 | */ |
453 | 453 | public function isDownloaded($name) { |
454 | - foreach(\OC::$APPSROOTS as $dir) { |
|
454 | + foreach (\OC::$APPSROOTS as $dir) { |
|
455 | 455 | $dirToTest = $dir['path']; |
456 | 456 | $dirToTest .= '/'; |
457 | 457 | $dirToTest .= $name; |
@@ -479,14 +479,14 @@ discard block |
||
479 | 479 | * this has to be done by the function oc_app_uninstall(). |
480 | 480 | */ |
481 | 481 | public function removeApp($appId) { |
482 | - if($this->isDownloaded($appId)) { |
|
482 | + if ($this->isDownloaded($appId)) { |
|
483 | 483 | if (\OC::$server->getAppManager()->isShipped($appId)) { |
484 | 484 | return false; |
485 | 485 | } |
486 | - $appDir = OC_App::getInstallPath() . '/' . $appId; |
|
486 | + $appDir = OC_App::getInstallPath().'/'.$appId; |
|
487 | 487 | OC_Helper::rmdirr($appDir); |
488 | 488 | return true; |
489 | - }else{ |
|
489 | + } else { |
|
490 | 490 | \OCP\Util::writeLog('core', 'can\'t remove app '.$appId.'. It is not installed.', ILogger::ERROR); |
491 | 491 | |
492 | 492 | return false; |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | */ |
503 | 503 | public function installAppBundle(Bundle $bundle) { |
504 | 504 | $appIds = $bundle->getAppIdentifiers(); |
505 | - foreach($appIds as $appId) { |
|
506 | - if(!$this->isDownloaded($appId)) { |
|
505 | + foreach ($appIds as $appId) { |
|
506 | + if (!$this->isDownloaded($appId)) { |
|
507 | 507 | $this->downloadApp($appId); |
508 | 508 | } |
509 | 509 | $this->installApp($appId); |
@@ -527,13 +527,13 @@ discard block |
||
527 | 527 | $appManager = \OC::$server->getAppManager(); |
528 | 528 | $config = \OC::$server->getConfig(); |
529 | 529 | $errors = []; |
530 | - foreach(\OC::$APPSROOTS as $app_dir) { |
|
531 | - if($dir = opendir($app_dir['path'])) { |
|
532 | - while(false !== ($filename = readdir($dir))) { |
|
533 | - if($filename[0] !== '.' and is_dir($app_dir['path']."/$filename")) { |
|
534 | - if(file_exists($app_dir['path']."/$filename/appinfo/info.xml")) { |
|
535 | - if($config->getAppValue($filename, "installed_version", null) === null) { |
|
536 | - $info=OC_App::getAppInfo($filename); |
|
530 | + foreach (\OC::$APPSROOTS as $app_dir) { |
|
531 | + if ($dir = opendir($app_dir['path'])) { |
|
532 | + while (false !== ($filename = readdir($dir))) { |
|
533 | + if ($filename[0] !== '.' and is_dir($app_dir['path']."/$filename")) { |
|
534 | + if (file_exists($app_dir['path']."/$filename/appinfo/info.xml")) { |
|
535 | + if ($config->getAppValue($filename, "installed_version", null) === null) { |
|
536 | + $info = OC_App::getAppInfo($filename); |
|
537 | 537 | $enabled = isset($info['default_enable']); |
538 | 538 | if (($enabled || in_array($filename, $appManager->getAlwaysEnabledApps())) |
539 | 539 | && $config->getAppValue($filename, 'enabled') !== 'no') { |
@@ -573,12 +573,12 @@ discard block |
||
573 | 573 | $appPath = OC_App::getAppPath($app); |
574 | 574 | \OC_App::registerAutoloading($app, $appPath); |
575 | 575 | |
576 | - if(is_file("$appPath/appinfo/database.xml")) { |
|
576 | + if (is_file("$appPath/appinfo/database.xml")) { |
|
577 | 577 | try { |
578 | 578 | OC_DB::createDbFromStructure("$appPath/appinfo/database.xml"); |
579 | 579 | } catch (TableExistsException $e) { |
580 | 580 | throw new HintException( |
581 | - 'Failed to enable app ' . $app, |
|
581 | + 'Failed to enable app '.$app, |
|
582 | 582 | 'Please ask for help via one of our <a href="https://nextcloud.com/support/" target="_blank" rel="noreferrer noopener">support channels</a>.', |
583 | 583 | 0, $e |
584 | 584 | ); |
@@ -607,10 +607,10 @@ discard block |
||
607 | 607 | } |
608 | 608 | |
609 | 609 | //set remote/public handlers |
610 | - foreach($info['remote'] as $name=>$path) { |
|
610 | + foreach ($info['remote'] as $name=>$path) { |
|
611 | 611 | $config->setAppValue('core', 'remote_'.$name, $app.'/'.$path); |
612 | 612 | } |
613 | - foreach($info['public'] as $name=>$path) { |
|
613 | + foreach ($info['public'] as $name=>$path) { |
|
614 | 614 | $config->setAppValue('core', 'public_'.$name, $app.'/'.$path); |
615 | 615 | } |
616 | 616 | |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | * @param string $script |
624 | 624 | */ |
625 | 625 | private static function includeAppScript($script) { |
626 | - if (file_exists($script)){ |
|
626 | + if (file_exists($script)) { |
|
627 | 627 | include $script; |
628 | 628 | } |
629 | 629 | } |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | * @return \OCP\IL10N |
115 | 115 | */ |
116 | 116 | public function get($app, $lang = null, $locale = null) { |
117 | - return new LazyL10N(function () use ($app, $lang, $locale) { |
|
117 | + return new LazyL10N(function() use ($app, $lang, $locale) { |
|
118 | 118 | |
119 | 119 | $app = \OC_App::cleanAppId($app); |
120 | 120 | if ($lang !== null) { |
121 | - $lang = str_replace(['\0', '/', '\\', '..'], '', (string)$lang); |
|
121 | + $lang = str_replace(['\0', '/', '\\', '..'], '', (string) $lang); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | $forceLang = $this->config->getSystemValue('force_language', false); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @link https://github.com/owncloud/core/issues/21955 |
175 | 175 | */ |
176 | 176 | if ($this->config->getSystemValue('installed', false)) { |
177 | - $userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null; |
|
177 | + $userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null; |
|
178 | 178 | if (!is_null($userId)) { |
179 | 179 | $userLang = $this->config->getUserValue($userId, 'core', 'lang', null); |
180 | 180 | } else { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | if ($this->config->getSystemValue('installed', false)) { |
227 | - $userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null; |
|
227 | + $userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null; |
|
228 | 228 | $userLocale = null; |
229 | 229 | if (null !== $userId) { |
230 | 230 | $userLocale = $this->config->getUserValue($userId, 'core', 'locale', null); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // merge with translations from theme |
306 | 306 | $theme = $this->config->getSystemValue('theme'); |
307 | 307 | if (!empty($theme)) { |
308 | - $themeDir = $this->serverRoot . '/themes/' . $theme . substr($dir, strlen($this->serverRoot)); |
|
308 | + $themeDir = $this->serverRoot.'/themes/'.$theme.substr($dir, strlen($this->serverRoot)); |
|
309 | 309 | |
310 | 310 | if (is_dir($themeDir)) { |
311 | 311 | $files = scandir($themeDir); |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | return $this->availableLocales; |
332 | 332 | } |
333 | 333 | |
334 | - $localeData = file_get_contents(\OC::$SERVERROOT . '/resources/locales.json'); |
|
334 | + $localeData = file_get_contents(\OC::$SERVERROOT.'/resources/locales.json'); |
|
335 | 335 | $this->availableLocales = \json_decode($localeData, true); |
336 | 336 | |
337 | 337 | return $this->availableLocales; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | public function getLanguageIterator(IUser $user = null): ILanguageIterator { |
355 | 355 | $user = $user ?? $this->userSession->getUser(); |
356 | - if($user === null) { |
|
356 | + if ($user === null) { |
|
357 | 357 | throw new \RuntimeException('Failed to get an IUser instance'); |
358 | 358 | } |
359 | 359 | return new LanguageIterator($user, $this->config); |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | } |
370 | 370 | |
371 | 371 | $locales = $this->findAvailableLocales(); |
372 | - $userLocale = array_filter($locales, function ($value) use ($locale) { |
|
372 | + $userLocale = array_filter($locales, function($value) use ($locale) { |
|
373 | 373 | return $locale === $value['code']; |
374 | 374 | }); |
375 | 375 | |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | $languageFiles = []; |
472 | 472 | |
473 | 473 | $i18nDir = $this->findL10nDir($app); |
474 | - $transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json'; |
|
474 | + $transFile = strip_tags($i18nDir).strip_tags($lang).'.json'; |
|
475 | 475 | |
476 | - if (($this->isSubDirectory($transFile, $this->serverRoot . '/core/l10n/') |
|
477 | - || $this->isSubDirectory($transFile, $this->serverRoot . '/lib/l10n/') |
|
478 | - || $this->isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/') |
|
476 | + if (($this->isSubDirectory($transFile, $this->serverRoot.'/core/l10n/') |
|
477 | + || $this->isSubDirectory($transFile, $this->serverRoot.'/lib/l10n/') |
|
478 | + || $this->isSubDirectory($transFile, \OC_App::getAppPath($app).'/l10n/') |
|
479 | 479 | ) |
480 | 480 | && file_exists($transFile)) { |
481 | 481 | // load the translations file |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | // merge with translations from theme |
486 | 486 | $theme = $this->config->getSystemValue('theme'); |
487 | 487 | if (!empty($theme)) { |
488 | - $transFile = $this->serverRoot . '/themes/' . $theme . substr($transFile, strlen($this->serverRoot)); |
|
488 | + $transFile = $this->serverRoot.'/themes/'.$theme.substr($transFile, strlen($this->serverRoot)); |
|
489 | 489 | if (file_exists($transFile)) { |
490 | 490 | $languageFiles[] = $transFile; |
491 | 491 | } |
@@ -502,14 +502,14 @@ discard block |
||
502 | 502 | */ |
503 | 503 | protected function findL10nDir($app = null) { |
504 | 504 | if (in_array($app, ['core', 'lib'])) { |
505 | - if (file_exists($this->serverRoot . '/' . $app . '/l10n/')) { |
|
506 | - return $this->serverRoot . '/' . $app . '/l10n/'; |
|
505 | + if (file_exists($this->serverRoot.'/'.$app.'/l10n/')) { |
|
506 | + return $this->serverRoot.'/'.$app.'/l10n/'; |
|
507 | 507 | } |
508 | 508 | } else if ($app && \OC_App::getAppPath($app) !== false) { |
509 | 509 | // Check if the app is in the app folder |
510 | - return \OC_App::getAppPath($app) . '/l10n/'; |
|
510 | + return \OC_App::getAppPath($app).'/l10n/'; |
|
511 | 511 | } |
512 | - return $this->serverRoot . '/core/l10n/'; |
|
512 | + return $this->serverRoot.'/core/l10n/'; |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | |
@@ -532,9 +532,9 @@ discard block |
||
532 | 532 | $plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]); |
533 | 533 | |
534 | 534 | $body = str_replace( |
535 | - [ 'plural', 'n', '$n$plurals', ], |
|
536 | - [ '$plural', '$n', '$nplurals', ], |
|
537 | - 'nplurals='. $nplurals . '; plural=' . $plural |
|
535 | + ['plural', 'n', '$n$plurals', ], |
|
536 | + ['$plural', '$n', '$nplurals', ], |
|
537 | + 'nplurals='.$nplurals.'; plural='.$plural |
|
538 | 538 | ); |
539 | 539 | |
540 | 540 | // add parents |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $res = ''; |
544 | 544 | $p = 0; |
545 | 545 | $length = strlen($body); |
546 | - for($i = 0; $i < $length; $i++) { |
|
546 | + for ($i = 0; $i < $length; $i++) { |
|
547 | 547 | $ch = $body[$i]; |
548 | 548 | switch ($ch) { |
549 | 549 | case '?': |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $res .= ') : ('; |
555 | 555 | break; |
556 | 556 | case ';': |
557 | - $res .= str_repeat(')', $p) . ';'; |
|
557 | + $res .= str_repeat(')', $p).';'; |
|
558 | 558 | $p = 0; |
559 | 559 | break; |
560 | 560 | default: |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
565 | - $body = $res . 'return ($plural>=$nplurals?$nplurals-1:$plural);'; |
|
565 | + $body = $res.'return ($plural>=$nplurals?$nplurals-1:$plural);'; |
|
566 | 566 | $function = create_function('$n', $body); |
567 | 567 | $this->pluralFunctions[$string] = $function; |
568 | 568 | return $function; |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | $commonLanguages = []; |
595 | 595 | $languages = []; |
596 | 596 | |
597 | - foreach($languageCodes as $lang) { |
|
597 | + foreach ($languageCodes as $lang) { |
|
598 | 598 | $l = $this->get('lib', $lang); |
599 | 599 | // TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version |
600 | 600 | $potentialName = (string) $l->t('__language_name__'); |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | ksort($commonLanguages); |
628 | 628 | |
629 | 629 | // sort now by displayed language not the iso-code |
630 | - usort($languages, function ($a, $b) { |
|
630 | + usort($languages, function($a, $b) { |
|
631 | 631 | if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) { |
632 | 632 | // If a doesn't have a name, but b does, list b before a |
633 | 633 | return 1; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | */ |
34 | 34 | |
35 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
35 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
36 | 36 | |
37 | 37 | use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin; |
38 | 38 | use Sabre\DAV\Exception\ServiceUnavailable; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | // we shall not log on RemoteException |
61 | 61 | $server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger())); |
62 | 62 | } |
63 | - $server->on('beforeMethod:*', function () use ($e) { |
|
63 | + $server->on('beforeMethod:*', function() use ($e) { |
|
64 | 64 | if ($e instanceof RemoteException) { |
65 | 65 | switch ($e->getCode()) { |
66 | 66 | case 503: |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | return $services[$service]; |
109 | 109 | } |
110 | 110 | |
111 | - return \OC::$server->getConfig()->getAppValue('core', 'remote_' . $service); |
|
111 | + return \OC::$server->getConfig()->getAppValue('core', 'remote_'.$service); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | try { |
115 | - require_once __DIR__ . '/lib/base.php'; |
|
115 | + require_once __DIR__.'/lib/base.php'; |
|
116 | 116 | |
117 | 117 | // All resources served via the DAV endpoint should have the strictest possible |
118 | 118 | // policy. Exempted from this is the SabreDAV browser plugin which overwrites |
@@ -133,18 +133,18 @@ discard block |
||
133 | 133 | if (!$pos = strpos($pathInfo, '/', 1)) { |
134 | 134 | $pos = strlen($pathInfo); |
135 | 135 | } |
136 | - $service=substr($pathInfo, 1, $pos-1); |
|
136 | + $service = substr($pathInfo, 1, $pos - 1); |
|
137 | 137 | |
138 | 138 | $file = resolveService($service); |
139 | 139 | |
140 | - if(is_null($file)) { |
|
140 | + if (is_null($file)) { |
|
141 | 141 | throw new RemoteException('Path not found', 404); |
142 | 142 | } |
143 | 143 | |
144 | - $file=ltrim($file, '/'); |
|
144 | + $file = ltrim($file, '/'); |
|
145 | 145 | |
146 | - $parts=explode('/', $file, 2); |
|
147 | - $app=$parts[0]; |
|
146 | + $parts = explode('/', $file, 2); |
|
147 | + $app = $parts[0]; |
|
148 | 148 | |
149 | 149 | // Load all required applications |
150 | 150 | \OC::$REQUESTEDAPP = $app; |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | |
154 | 154 | switch ($app) { |
155 | 155 | case 'core': |
156 | - $file = OC::$SERVERROOT .'/'. $file; |
|
156 | + $file = OC::$SERVERROOT.'/'.$file; |
|
157 | 157 | break; |
158 | 158 | default: |
159 | 159 | if (!\OC::$server->getAppManager()->isInstalled($app)) { |
160 | - throw new RemoteException('App not installed: ' . $app); |
|
160 | + throw new RemoteException('App not installed: '.$app); |
|
161 | 161 | } |
162 | 162 | OC_App::loadApp($app); |
163 | - $file = OC_App::getAppPath($app) .'/'. $parts[1]; |
|
163 | + $file = OC_App::getAppPath($app).'/'.$parts[1]; |
|
164 | 164 | break; |
165 | 165 | } |
166 | - $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; |
|
166 | + $baseuri = OC::$WEBROOT.'/remote.php/'.$service.'/'; |
|
167 | 167 | require_once $file; |
168 | 168 | |
169 | 169 | } catch (Exception $ex) { |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | $this->logger = $logger; |
86 | 86 | |
87 | 87 | $methods = get_class_methods($this->comment); |
88 | - $methods = array_filter($methods, function ($name) { |
|
88 | + $methods = array_filter($methods, function($name) { |
|
89 | 89 | return strpos($name, 'get') === 0; |
90 | 90 | }); |
91 | - foreach($methods as $getter) { |
|
92 | - if($getter === 'getMentions') { |
|
93 | - continue; // special treatment |
|
91 | + foreach ($methods as $getter) { |
|
92 | + if ($getter === 'getMentions') { |
|
93 | + continue; // special treatment |
|
94 | 94 | } |
95 | - $name = '{'.self::NS_OWNCLOUD.'}' . lcfirst(substr($getter, 3)); |
|
95 | + $name = '{'.self::NS_OWNCLOUD.'}'.lcfirst(substr($getter, 3)); |
|
96 | 96 | $this->properties[$name] = $getter; |
97 | 97 | } |
98 | 98 | $this->userManager = $userManager; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | protected function checkWriteAccessOnComment() { |
133 | 133 | $user = $this->userSession->getUser(); |
134 | - if($this->comment->getActorType() !== 'users' |
|
134 | + if ($this->comment->getActorType() !== 'users' |
|
135 | 135 | || is_null($user) |
136 | 136 | || $this->comment->getActorId() !== $user->getUID() |
137 | 137 | ) { |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | return true; |
196 | 196 | } catch (\Exception $e) { |
197 | 197 | $this->logger->logException($e, ['app' => 'dav/comments']); |
198 | - if($e instanceof MessageTooLongException) { |
|
198 | + if ($e instanceof MessageTooLongException) { |
|
199 | 199 | $msg = 'Message exceeds allowed character limit of '; |
200 | - throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e); |
|
200 | + throw new BadRequest($msg.IComment::MAX_MESSAGE_LENGTH, 0, $e); |
|
201 | 201 | } |
202 | 202 | throw $e; |
203 | 203 | } |
@@ -239,14 +239,14 @@ discard block |
||
239 | 239 | $properties = array_keys($this->properties); |
240 | 240 | |
241 | 241 | $result = []; |
242 | - foreach($properties as $property) { |
|
242 | + foreach ($properties as $property) { |
|
243 | 243 | $getter = $this->properties[$property]; |
244 | - if(method_exists($this->comment, $getter)) { |
|
244 | + if (method_exists($this->comment, $getter)) { |
|
245 | 245 | $result[$property] = $this->comment->$getter(); |
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
249 | - if($this->comment->getActorType() === 'users') { |
|
249 | + if ($this->comment->getActorType() === 'users') { |
|
250 | 250 | $user = $this->userManager->get($this->comment->getActorId()); |
251 | 251 | $displayName = is_null($user) ? null : $user->getDisplayName(); |
252 | 252 | $result[self::PROPERTY_NAME_ACTOR_DISPLAYNAME] = $displayName; |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | $result[self::PROPERTY_NAME_MENTIONS] = $this->composeMentionsPropertyValue(); |
256 | 256 | |
257 | 257 | $unread = null; |
258 | - $user = $this->userSession->getUser(); |
|
259 | - if(!is_null($user)) { |
|
258 | + $user = $this->userSession->getUser(); |
|
259 | + if (!is_null($user)) { |
|
260 | 260 | $readUntil = $this->commentsManager->getReadMark( |
261 | 261 | $this->comment->getObjectType(), |
262 | 262 | $this->comment->getObjectId(), |
263 | 263 | $user |
264 | 264 | ); |
265 | - if(is_null($readUntil)) { |
|
265 | + if (is_null($readUntil)) { |
|
266 | 266 | $unread = 'true'; |
267 | 267 | } else { |
268 | 268 | $unread = $this->comment->getCreationDateTime() > $readUntil; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @return array |
284 | 284 | */ |
285 | 285 | protected function composeMentionsPropertyValue() { |
286 | - return array_map(function ($mention) { |
|
286 | + return array_map(function($mention) { |
|
287 | 287 | try { |
288 | 288 | $displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']); |
289 | 289 | } catch (\OutOfBoundsException $e) { |