|
1 | 1 | <?php
|
| 2 | + |
2 | 3 | /**
|
3 | 4 | * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
4 | 5 | * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
@@ -175,9 +176,9 @@ public function getAllAppsInAppsFolders(): array {
|
175 | 176 | if (is_resource($dh)) {
|
176 | 177 | while (($file = readdir($dh)) !== false) {
|
177 | 178 | if (
|
178 |
| - $file[0] != '.' && |
179 |
| - is_dir($apps_dir['path'] . '/' . $file) && |
180 |
| - is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml') |
| 179 | + $file[0] != '.' |
| 180 | + && is_dir($apps_dir['path'] . '/' . $file) |
| 181 | + && is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml') |
181 | 182 | ) {
|
182 | 183 | $apps[] = $file;
|
183 | 184 | }
|
@@ -525,8 +526,8 @@ public function loadApp(string $app): void {
|
525 | 526 |
|
526 | 527 | if (!empty($info['collaboration']['plugins'])) {
|
527 | 528 | // deal with one or many plugin entries
|
528 |
| - $plugins = isset($info['collaboration']['plugins']['plugin']['@value']) ? |
529 |
| - [$info['collaboration']['plugins']['plugin']] : $info['collaboration']['plugins']['plugin']; |
| 529 | + $plugins = isset($info['collaboration']['plugins']['plugin']['@value']) |
| 530 | + ? [$info['collaboration']['plugins']['plugin']] : $info['collaboration']['plugins']['plugin']; |
530 | 531 | $collaboratorSearch = null;
|
531 | 532 | $autoCompleteManager = null;
|
532 | 533 | foreach ($plugins as $plugin) {
|
@@ -945,6 +946,6 @@ public function isBackendRequired(string $backend): bool {
|
945 | 946 | */
|
946 | 947 | public function cleanAppId(string $app): string {
|
947 | 948 | /* Only lowercase alphanumeric is allowed */
|
948 |
| - return preg_replace('/(^[0-9_]|[^a-z0-9_]+|_$)/', '', $app); |
| 949 | + return preg_replace('/(^[0-9_-]+|[^a-z0-9_-]+|[_-]+$)/', '', $app); |
949 | 950 | }
|
950 | 951 | }
|
0 commit comments