@@ -54,421 +54,421 @@ |
||
| 54 | 54 | * @package OC\Settings\Controller |
| 55 | 55 | */ |
| 56 | 56 | class AppSettingsController extends Controller { |
| 57 | - const CAT_ENABLED = 0; |
|
| 58 | - const CAT_DISABLED = 1; |
|
| 59 | - const CAT_ALL_INSTALLED = 2; |
|
| 60 | - const CAT_APP_BUNDLES = 3; |
|
| 61 | - const CAT_UPDATES = 4; |
|
| 62 | - |
|
| 63 | - /** @var \OCP\IL10N */ |
|
| 64 | - private $l10n; |
|
| 65 | - /** @var IConfig */ |
|
| 66 | - private $config; |
|
| 67 | - /** @var INavigationManager */ |
|
| 68 | - private $navigationManager; |
|
| 69 | - /** @var IAppManager */ |
|
| 70 | - private $appManager; |
|
| 71 | - /** @var CategoryFetcher */ |
|
| 72 | - private $categoryFetcher; |
|
| 73 | - /** @var AppFetcher */ |
|
| 74 | - private $appFetcher; |
|
| 75 | - /** @var IFactory */ |
|
| 76 | - private $l10nFactory; |
|
| 77 | - /** @var BundleFetcher */ |
|
| 78 | - private $bundleFetcher; |
|
| 79 | - /** @var Installer */ |
|
| 80 | - private $installer; |
|
| 81 | - /** @var IURLGenerator */ |
|
| 82 | - private $urlGenerator; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @param string $appName |
|
| 86 | - * @param IRequest $request |
|
| 87 | - * @param IL10N $l10n |
|
| 88 | - * @param IConfig $config |
|
| 89 | - * @param INavigationManager $navigationManager |
|
| 90 | - * @param IAppManager $appManager |
|
| 91 | - * @param CategoryFetcher $categoryFetcher |
|
| 92 | - * @param AppFetcher $appFetcher |
|
| 93 | - * @param IFactory $l10nFactory |
|
| 94 | - * @param BundleFetcher $bundleFetcher |
|
| 95 | - * @param Installer $installer |
|
| 96 | - * @param IURLGenerator $urlGenerator |
|
| 97 | - */ |
|
| 98 | - public function __construct(string $appName, |
|
| 99 | - IRequest $request, |
|
| 100 | - IL10N $l10n, |
|
| 101 | - IConfig $config, |
|
| 102 | - INavigationManager $navigationManager, |
|
| 103 | - IAppManager $appManager, |
|
| 104 | - CategoryFetcher $categoryFetcher, |
|
| 105 | - AppFetcher $appFetcher, |
|
| 106 | - IFactory $l10nFactory, |
|
| 107 | - BundleFetcher $bundleFetcher, |
|
| 108 | - Installer $installer, |
|
| 109 | - IURLGenerator $urlGenerator) { |
|
| 110 | - parent::__construct($appName, $request); |
|
| 111 | - $this->l10n = $l10n; |
|
| 112 | - $this->config = $config; |
|
| 113 | - $this->navigationManager = $navigationManager; |
|
| 114 | - $this->appManager = $appManager; |
|
| 115 | - $this->categoryFetcher = $categoryFetcher; |
|
| 116 | - $this->appFetcher = $appFetcher; |
|
| 117 | - $this->l10nFactory = $l10nFactory; |
|
| 118 | - $this->bundleFetcher = $bundleFetcher; |
|
| 119 | - $this->installer = $installer; |
|
| 120 | - $this->urlGenerator = $urlGenerator; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * @NoCSRFRequired |
|
| 125 | - * |
|
| 126 | - * @param string $category |
|
| 127 | - * @return TemplateResponse |
|
| 128 | - */ |
|
| 129 | - public function viewApps($category = '') { |
|
| 130 | - if ($category === '') { |
|
| 131 | - $category = 'installed'; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - $params = []; |
|
| 135 | - $params['category'] = $category; |
|
| 136 | - $params['appstoreEnabled'] = $this->config->getSystemValue('appstoreenabled', true) === true; |
|
| 137 | - $params['urlGenerator'] = $this->urlGenerator; |
|
| 138 | - $this->navigationManager->setActiveEntry('core_apps'); |
|
| 139 | - |
|
| 140 | - $templateResponse = new TemplateResponse($this->appName, 'apps', $params, 'user'); |
|
| 141 | - $policy = new ContentSecurityPolicy(); |
|
| 142 | - $policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com'); |
|
| 143 | - $templateResponse->setContentSecurityPolicy($policy); |
|
| 144 | - |
|
| 145 | - return $templateResponse; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - private function getAllCategories() { |
|
| 149 | - $currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2); |
|
| 150 | - |
|
| 151 | - $updateCount = count($this->getAppsWithUpdates()); |
|
| 152 | - $formattedCategories = [ |
|
| 153 | - ['id' => self::CAT_ALL_INSTALLED, 'ident' => 'installed', 'displayName' => (string)$this->l10n->t('Your apps')], |
|
| 154 | - ['id' => self::CAT_UPDATES, 'ident' => 'updates', 'displayName' => (string)$this->l10n->t('Updates'), 'counter' => $updateCount], |
|
| 155 | - ['id' => self::CAT_ENABLED, 'ident' => 'enabled', 'displayName' => (string)$this->l10n->t('Enabled apps')], |
|
| 156 | - ['id' => self::CAT_DISABLED, 'ident' => 'disabled', 'displayName' => (string)$this->l10n->t('Disabled apps')], |
|
| 157 | - ['id' => self::CAT_APP_BUNDLES, 'ident' => 'app-bundles', 'displayName' => (string)$this->l10n->t('App bundles')], |
|
| 158 | - ]; |
|
| 159 | - $categories = $this->categoryFetcher->get(); |
|
| 160 | - foreach($categories as $category) { |
|
| 161 | - $formattedCategories[] = [ |
|
| 162 | - 'id' => $category['id'], |
|
| 163 | - 'ident' => $category['id'], |
|
| 164 | - 'displayName' => isset($category['translations'][$currentLanguage]['name']) ? $category['translations'][$currentLanguage]['name'] : $category['translations']['en']['name'], |
|
| 165 | - ]; |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - return $formattedCategories; |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * Get all available categories |
|
| 173 | - * |
|
| 174 | - * @return JSONResponse |
|
| 175 | - */ |
|
| 176 | - public function listCategories() { |
|
| 177 | - return new JSONResponse($this->getAllCategories()); |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - /** |
|
| 181 | - * Get all apps for a category |
|
| 182 | - * |
|
| 183 | - * @param string $requestedCategory |
|
| 184 | - * @return array |
|
| 185 | - */ |
|
| 186 | - private function getAppsForCategory($requestedCategory) { |
|
| 187 | - $versionParser = new VersionParser(); |
|
| 188 | - $formattedApps = []; |
|
| 189 | - $apps = $this->appFetcher->get(); |
|
| 190 | - foreach($apps as $app) { |
|
| 191 | - if (isset($app['isFeatured'])) { |
|
| 192 | - $app['featured'] = $app['isFeatured']; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - // Skip all apps not in the requested category |
|
| 196 | - $isInCategory = false; |
|
| 197 | - foreach($app['categories'] as $category) { |
|
| 198 | - if($category === $requestedCategory) { |
|
| 199 | - $isInCategory = true; |
|
| 200 | - } |
|
| 201 | - } |
|
| 202 | - if(!$isInCategory) { |
|
| 203 | - continue; |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - $nextCloudVersion = $versionParser->getVersion($app['releases'][0]['rawPlatformVersionSpec']); |
|
| 207 | - $nextCloudVersionDependencies = []; |
|
| 208 | - if($nextCloudVersion->getMinimumVersion() !== '') { |
|
| 209 | - $nextCloudVersionDependencies['nextcloud']['@attributes']['min-version'] = $nextCloudVersion->getMinimumVersion(); |
|
| 210 | - } |
|
| 211 | - if($nextCloudVersion->getMaximumVersion() !== '') { |
|
| 212 | - $nextCloudVersionDependencies['nextcloud']['@attributes']['max-version'] = $nextCloudVersion->getMaximumVersion(); |
|
| 213 | - } |
|
| 214 | - $phpVersion = $versionParser->getVersion($app['releases'][0]['rawPhpVersionSpec']); |
|
| 215 | - $existsLocally = \OC_App::getAppPath($app['id']) !== false; |
|
| 216 | - $phpDependencies = []; |
|
| 217 | - if($phpVersion->getMinimumVersion() !== '') { |
|
| 218 | - $phpDependencies['php']['@attributes']['min-version'] = $phpVersion->getMinimumVersion(); |
|
| 219 | - } |
|
| 220 | - if($phpVersion->getMaximumVersion() !== '') { |
|
| 221 | - $phpDependencies['php']['@attributes']['max-version'] = $phpVersion->getMaximumVersion(); |
|
| 222 | - } |
|
| 223 | - if(isset($app['releases'][0]['minIntSize'])) { |
|
| 224 | - $phpDependencies['php']['@attributes']['min-int-size'] = $app['releases'][0]['minIntSize']; |
|
| 225 | - } |
|
| 226 | - $authors = ''; |
|
| 227 | - foreach($app['authors'] as $key => $author) { |
|
| 228 | - $authors .= $author['name']; |
|
| 229 | - if($key !== count($app['authors']) - 1) { |
|
| 230 | - $authors .= ', '; |
|
| 231 | - } |
|
| 232 | - } |
|
| 233 | - |
|
| 234 | - $currentLanguage = substr(\OC::$server->getL10NFactory()->findLanguage(), 0, 2); |
|
| 235 | - $enabledValue = $this->config->getAppValue($app['id'], 'enabled', 'no'); |
|
| 236 | - $groups = null; |
|
| 237 | - if($enabledValue !== 'no' && $enabledValue !== 'yes') { |
|
| 238 | - $groups = $enabledValue; |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - $currentVersion = ''; |
|
| 242 | - if($this->appManager->isInstalled($app['id'])) { |
|
| 243 | - $currentVersion = \OC_App::getAppVersion($app['id']); |
|
| 244 | - } else { |
|
| 245 | - $currentLanguage = $app['releases'][0]['version']; |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - $formattedApps[] = [ |
|
| 249 | - 'id' => $app['id'], |
|
| 250 | - 'name' => isset($app['translations'][$currentLanguage]['name']) ? $app['translations'][$currentLanguage]['name'] : $app['translations']['en']['name'], |
|
| 251 | - 'description' => isset($app['translations'][$currentLanguage]['description']) ? $app['translations'][$currentLanguage]['description'] : $app['translations']['en']['description'], |
|
| 252 | - 'license' => $app['releases'][0]['licenses'], |
|
| 253 | - 'author' => $authors, |
|
| 254 | - 'shipped' => false, |
|
| 255 | - 'version' => $currentVersion, |
|
| 256 | - 'default_enable' => '', |
|
| 257 | - 'types' => [], |
|
| 258 | - 'documentation' => [ |
|
| 259 | - 'admin' => $app['adminDocs'], |
|
| 260 | - 'user' => $app['userDocs'], |
|
| 261 | - 'developer' => $app['developerDocs'] |
|
| 262 | - ], |
|
| 263 | - 'website' => $app['website'], |
|
| 264 | - 'bugs' => $app['issueTracker'], |
|
| 265 | - 'detailpage' => $app['website'], |
|
| 266 | - 'dependencies' => array_merge( |
|
| 267 | - $nextCloudVersionDependencies, |
|
| 268 | - $phpDependencies |
|
| 269 | - ), |
|
| 270 | - 'level' => ($app['featured'] === true) ? 200 : 100, |
|
| 271 | - 'missingMaxOwnCloudVersion' => false, |
|
| 272 | - 'missingMinOwnCloudVersion' => false, |
|
| 273 | - 'canInstall' => true, |
|
| 274 | - 'preview' => isset($app['screenshots'][0]['url']) ? 'https://usercontent.apps.nextcloud.com/'.base64_encode($app['screenshots'][0]['url']) : '', |
|
| 275 | - 'score' => $app['ratingOverall'], |
|
| 276 | - 'ratingNumOverall' => $app['ratingNumOverall'], |
|
| 277 | - 'ratingNumThresholdReached' => $app['ratingNumOverall'] > 5 ? true : false, |
|
| 278 | - 'removable' => $existsLocally, |
|
| 279 | - 'active' => $this->appManager->isEnabledForUser($app['id']), |
|
| 280 | - 'needsDownload' => !$existsLocally, |
|
| 281 | - 'groups' => $groups, |
|
| 282 | - 'fromAppStore' => true, |
|
| 283 | - ]; |
|
| 284 | - |
|
| 285 | - |
|
| 286 | - $newVersion = $this->installer->isUpdateAvailable($app['id']); |
|
| 287 | - if($newVersion && $this->appManager->isInstalled($app['id'])) { |
|
| 288 | - $formattedApps[count($formattedApps)-1]['update'] = $newVersion; |
|
| 289 | - } |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - return $formattedApps; |
|
| 293 | - } |
|
| 294 | - |
|
| 295 | - private function getAppsWithUpdates() { |
|
| 296 | - $appClass = new \OC_App(); |
|
| 297 | - $apps = $appClass->listAllApps(); |
|
| 298 | - foreach($apps as $key => $app) { |
|
| 299 | - $newVersion = $this->installer->isUpdateAvailable($app['id']); |
|
| 300 | - if($newVersion !== false) { |
|
| 301 | - $apps[$key]['update'] = $newVersion; |
|
| 302 | - } else { |
|
| 303 | - unset($apps[$key]); |
|
| 304 | - } |
|
| 305 | - } |
|
| 306 | - usort($apps, function ($a, $b) { |
|
| 307 | - $a = (string)$a['name']; |
|
| 308 | - $b = (string)$b['name']; |
|
| 309 | - if ($a === $b) { |
|
| 310 | - return 0; |
|
| 311 | - } |
|
| 312 | - return ($a < $b) ? -1 : 1; |
|
| 313 | - }); |
|
| 314 | - return $apps; |
|
| 315 | - } |
|
| 316 | - |
|
| 317 | - /** |
|
| 318 | - * Get all available apps in a category |
|
| 319 | - * |
|
| 320 | - * @param string $category |
|
| 321 | - * @return JSONResponse |
|
| 322 | - */ |
|
| 323 | - public function listApps($category = '') { |
|
| 324 | - $appClass = new \OC_App(); |
|
| 325 | - |
|
| 326 | - switch ($category) { |
|
| 327 | - // installed apps |
|
| 328 | - case 'installed': |
|
| 329 | - $apps = $appClass->listAllApps(); |
|
| 330 | - |
|
| 331 | - foreach($apps as $key => $app) { |
|
| 332 | - $newVersion = $this->installer->isUpdateAvailable($app['id']); |
|
| 333 | - $apps[$key]['update'] = $newVersion; |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - usort($apps, function ($a, $b) { |
|
| 337 | - $a = (string)$a['name']; |
|
| 338 | - $b = (string)$b['name']; |
|
| 339 | - if ($a === $b) { |
|
| 340 | - return 0; |
|
| 341 | - } |
|
| 342 | - return ($a < $b) ? -1 : 1; |
|
| 343 | - }); |
|
| 344 | - break; |
|
| 345 | - // updates |
|
| 346 | - case 'updates': |
|
| 347 | - $apps = $this->getAppsWithUpdates(); |
|
| 348 | - break; |
|
| 349 | - // enabled apps |
|
| 350 | - case 'enabled': |
|
| 351 | - $apps = $appClass->listAllApps(); |
|
| 352 | - $apps = array_filter($apps, function ($app) { |
|
| 353 | - return $app['active']; |
|
| 354 | - }); |
|
| 355 | - |
|
| 356 | - foreach($apps as $key => $app) { |
|
| 357 | - $newVersion = $this->installer->isUpdateAvailable($app['id']); |
|
| 358 | - $apps[$key]['update'] = $newVersion; |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - usort($apps, function ($a, $b) { |
|
| 362 | - $a = (string)$a['name']; |
|
| 363 | - $b = (string)$b['name']; |
|
| 364 | - if ($a === $b) { |
|
| 365 | - return 0; |
|
| 366 | - } |
|
| 367 | - return ($a < $b) ? -1 : 1; |
|
| 368 | - }); |
|
| 369 | - break; |
|
| 370 | - // disabled apps |
|
| 371 | - case 'disabled': |
|
| 372 | - $apps = $appClass->listAllApps(); |
|
| 373 | - $apps = array_filter($apps, function ($app) { |
|
| 374 | - return !$app['active']; |
|
| 375 | - }); |
|
| 376 | - |
|
| 377 | - $apps = array_map(function ($app) { |
|
| 378 | - $newVersion = $this->installer->isUpdateAvailable($app['id']); |
|
| 379 | - if ($newVersion !== false) { |
|
| 380 | - $app['update'] = $newVersion; |
|
| 381 | - } |
|
| 382 | - return $app; |
|
| 383 | - }, $apps); |
|
| 384 | - |
|
| 385 | - usort($apps, function ($a, $b) { |
|
| 386 | - $a = (string)$a['name']; |
|
| 387 | - $b = (string)$b['name']; |
|
| 388 | - if ($a === $b) { |
|
| 389 | - return 0; |
|
| 390 | - } |
|
| 391 | - return ($a < $b) ? -1 : 1; |
|
| 392 | - }); |
|
| 393 | - break; |
|
| 394 | - case 'app-bundles': |
|
| 395 | - $bundles = $this->bundleFetcher->getBundles(); |
|
| 396 | - $apps = []; |
|
| 397 | - foreach($bundles as $bundle) { |
|
| 398 | - $newCategory = true; |
|
| 399 | - $allApps = $appClass->listAllApps(); |
|
| 400 | - $categories = $this->getAllCategories(); |
|
| 401 | - foreach($categories as $singleCategory) { |
|
| 402 | - $newApps = $this->getAppsForCategory($singleCategory['id']); |
|
| 403 | - foreach($allApps as $app) { |
|
| 404 | - foreach($newApps as $key => $newApp) { |
|
| 405 | - if($app['id'] === $newApp['id']) { |
|
| 406 | - unset($newApps[$key]); |
|
| 407 | - } |
|
| 408 | - } |
|
| 409 | - } |
|
| 410 | - $allApps = array_merge($allApps, $newApps); |
|
| 411 | - } |
|
| 412 | - |
|
| 413 | - foreach($bundle->getAppIdentifiers() as $identifier) { |
|
| 414 | - foreach($allApps as $app) { |
|
| 415 | - if($app['id'] === $identifier) { |
|
| 416 | - if($newCategory) { |
|
| 417 | - $app['newCategory'] = true; |
|
| 418 | - $app['categoryName'] = $bundle->getName(); |
|
| 419 | - } |
|
| 420 | - $app['bundleId'] = $bundle->getIdentifier(); |
|
| 421 | - $newCategory = false; |
|
| 422 | - $apps[] = $app; |
|
| 423 | - continue; |
|
| 424 | - } |
|
| 425 | - } |
|
| 426 | - } |
|
| 427 | - } |
|
| 428 | - break; |
|
| 429 | - default: |
|
| 430 | - $apps = $this->getAppsForCategory($category); |
|
| 431 | - |
|
| 432 | - // sort by score |
|
| 433 | - usort($apps, function ($a, $b) { |
|
| 434 | - $a = (int)$a['score']; |
|
| 435 | - $b = (int)$b['score']; |
|
| 436 | - if ($a === $b) { |
|
| 437 | - return 0; |
|
| 438 | - } |
|
| 439 | - return ($a > $b) ? -1 : 1; |
|
| 440 | - }); |
|
| 441 | - break; |
|
| 442 | - } |
|
| 443 | - |
|
| 444 | - // fix groups to be an array |
|
| 445 | - $dependencyAnalyzer = new DependencyAnalyzer(new Platform($this->config), $this->l10n); |
|
| 446 | - $apps = array_map(function($app) use ($dependencyAnalyzer) { |
|
| 447 | - |
|
| 448 | - // fix groups |
|
| 449 | - $groups = array(); |
|
| 450 | - if (is_string($app['groups'])) { |
|
| 451 | - $groups = json_decode($app['groups']); |
|
| 452 | - } |
|
| 453 | - $app['groups'] = $groups; |
|
| 454 | - $app['canUnInstall'] = !$app['active'] && $app['removable']; |
|
| 455 | - |
|
| 456 | - // fix licence vs license |
|
| 457 | - if (isset($app['license']) && !isset($app['licence'])) { |
|
| 458 | - $app['licence'] = $app['license']; |
|
| 459 | - } |
|
| 460 | - |
|
| 461 | - // analyse dependencies |
|
| 462 | - $missing = $dependencyAnalyzer->analyze($app); |
|
| 463 | - $app['canInstall'] = empty($missing); |
|
| 464 | - $app['missingDependencies'] = $missing; |
|
| 465 | - |
|
| 466 | - $app['missingMinOwnCloudVersion'] = !isset($app['dependencies']['nextcloud']['@attributes']['min-version']); |
|
| 467 | - $app['missingMaxOwnCloudVersion'] = !isset($app['dependencies']['nextcloud']['@attributes']['max-version']); |
|
| 468 | - |
|
| 469 | - return $app; |
|
| 470 | - }, $apps); |
|
| 471 | - |
|
| 472 | - return new JSONResponse(['apps' => $apps, 'status' => 'success']); |
|
| 473 | - } |
|
| 57 | + const CAT_ENABLED = 0; |
|
| 58 | + const CAT_DISABLED = 1; |
|
| 59 | + const CAT_ALL_INSTALLED = 2; |
|
| 60 | + const CAT_APP_BUNDLES = 3; |
|
| 61 | + const CAT_UPDATES = 4; |
|
| 62 | + |
|
| 63 | + /** @var \OCP\IL10N */ |
|
| 64 | + private $l10n; |
|
| 65 | + /** @var IConfig */ |
|
| 66 | + private $config; |
|
| 67 | + /** @var INavigationManager */ |
|
| 68 | + private $navigationManager; |
|
| 69 | + /** @var IAppManager */ |
|
| 70 | + private $appManager; |
|
| 71 | + /** @var CategoryFetcher */ |
|
| 72 | + private $categoryFetcher; |
|
| 73 | + /** @var AppFetcher */ |
|
| 74 | + private $appFetcher; |
|
| 75 | + /** @var IFactory */ |
|
| 76 | + private $l10nFactory; |
|
| 77 | + /** @var BundleFetcher */ |
|
| 78 | + private $bundleFetcher; |
|
| 79 | + /** @var Installer */ |
|
| 80 | + private $installer; |
|
| 81 | + /** @var IURLGenerator */ |
|
| 82 | + private $urlGenerator; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @param string $appName |
|
| 86 | + * @param IRequest $request |
|
| 87 | + * @param IL10N $l10n |
|
| 88 | + * @param IConfig $config |
|
| 89 | + * @param INavigationManager $navigationManager |
|
| 90 | + * @param IAppManager $appManager |
|
| 91 | + * @param CategoryFetcher $categoryFetcher |
|
| 92 | + * @param AppFetcher $appFetcher |
|
| 93 | + * @param IFactory $l10nFactory |
|
| 94 | + * @param BundleFetcher $bundleFetcher |
|
| 95 | + * @param Installer $installer |
|
| 96 | + * @param IURLGenerator $urlGenerator |
|
| 97 | + */ |
|
| 98 | + public function __construct(string $appName, |
|
| 99 | + IRequest $request, |
|
| 100 | + IL10N $l10n, |
|
| 101 | + IConfig $config, |
|
| 102 | + INavigationManager $navigationManager, |
|
| 103 | + IAppManager $appManager, |
|
| 104 | + CategoryFetcher $categoryFetcher, |
|
| 105 | + AppFetcher $appFetcher, |
|
| 106 | + IFactory $l10nFactory, |
|
| 107 | + BundleFetcher $bundleFetcher, |
|
| 108 | + Installer $installer, |
|
| 109 | + IURLGenerator $urlGenerator) { |
|
| 110 | + parent::__construct($appName, $request); |
|
| 111 | + $this->l10n = $l10n; |
|
| 112 | + $this->config = $config; |
|
| 113 | + $this->navigationManager = $navigationManager; |
|
| 114 | + $this->appManager = $appManager; |
|
| 115 | + $this->categoryFetcher = $categoryFetcher; |
|
| 116 | + $this->appFetcher = $appFetcher; |
|
| 117 | + $this->l10nFactory = $l10nFactory; |
|
| 118 | + $this->bundleFetcher = $bundleFetcher; |
|
| 119 | + $this->installer = $installer; |
|
| 120 | + $this->urlGenerator = $urlGenerator; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * @NoCSRFRequired |
|
| 125 | + * |
|
| 126 | + * @param string $category |
|
| 127 | + * @return TemplateResponse |
|
| 128 | + */ |
|
| 129 | + public function viewApps($category = '') { |
|
| 130 | + if ($category === '') { |
|
| 131 | + $category = 'installed'; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + $params = []; |
|
| 135 | + $params['category'] = $category; |
|
| 136 | + $params['appstoreEnabled'] = $this->config->getSystemValue('appstoreenabled', true) === true; |
|
| 137 | + $params['urlGenerator'] = $this->urlGenerator; |
|
| 138 | + $this->navigationManager->setActiveEntry('core_apps'); |
|
| 139 | + |
|
| 140 | + $templateResponse = new TemplateResponse($this->appName, 'apps', $params, 'user'); |
|
| 141 | + $policy = new ContentSecurityPolicy(); |
|
| 142 | + $policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com'); |
|
| 143 | + $templateResponse->setContentSecurityPolicy($policy); |
|
| 144 | + |
|
| 145 | + return $templateResponse; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + private function getAllCategories() { |
|
| 149 | + $currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2); |
|
| 150 | + |
|
| 151 | + $updateCount = count($this->getAppsWithUpdates()); |
|
| 152 | + $formattedCategories = [ |
|
| 153 | + ['id' => self::CAT_ALL_INSTALLED, 'ident' => 'installed', 'displayName' => (string)$this->l10n->t('Your apps')], |
|
| 154 | + ['id' => self::CAT_UPDATES, 'ident' => 'updates', 'displayName' => (string)$this->l10n->t('Updates'), 'counter' => $updateCount], |
|
| 155 | + ['id' => self::CAT_ENABLED, 'ident' => 'enabled', 'displayName' => (string)$this->l10n->t('Enabled apps')], |
|
| 156 | + ['id' => self::CAT_DISABLED, 'ident' => 'disabled', 'displayName' => (string)$this->l10n->t('Disabled apps')], |
|
| 157 | + ['id' => self::CAT_APP_BUNDLES, 'ident' => 'app-bundles', 'displayName' => (string)$this->l10n->t('App bundles')], |
|
| 158 | + ]; |
|
| 159 | + $categories = $this->categoryFetcher->get(); |
|
| 160 | + foreach($categories as $category) { |
|
| 161 | + $formattedCategories[] = [ |
|
| 162 | + 'id' => $category['id'], |
|
| 163 | + 'ident' => $category['id'], |
|
| 164 | + 'displayName' => isset($category['translations'][$currentLanguage]['name']) ? $category['translations'][$currentLanguage]['name'] : $category['translations']['en']['name'], |
|
| 165 | + ]; |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + return $formattedCategories; |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * Get all available categories |
|
| 173 | + * |
|
| 174 | + * @return JSONResponse |
|
| 175 | + */ |
|
| 176 | + public function listCategories() { |
|
| 177 | + return new JSONResponse($this->getAllCategories()); |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + /** |
|
| 181 | + * Get all apps for a category |
|
| 182 | + * |
|
| 183 | + * @param string $requestedCategory |
|
| 184 | + * @return array |
|
| 185 | + */ |
|
| 186 | + private function getAppsForCategory($requestedCategory) { |
|
| 187 | + $versionParser = new VersionParser(); |
|
| 188 | + $formattedApps = []; |
|
| 189 | + $apps = $this->appFetcher->get(); |
|
| 190 | + foreach($apps as $app) { |
|
| 191 | + if (isset($app['isFeatured'])) { |
|
| 192 | + $app['featured'] = $app['isFeatured']; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + // Skip all apps not in the requested category |
|
| 196 | + $isInCategory = false; |
|
| 197 | + foreach($app['categories'] as $category) { |
|
| 198 | + if($category === $requestedCategory) { |
|
| 199 | + $isInCategory = true; |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + if(!$isInCategory) { |
|
| 203 | + continue; |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + $nextCloudVersion = $versionParser->getVersion($app['releases'][0]['rawPlatformVersionSpec']); |
|
| 207 | + $nextCloudVersionDependencies = []; |
|
| 208 | + if($nextCloudVersion->getMinimumVersion() !== '') { |
|
| 209 | + $nextCloudVersionDependencies['nextcloud']['@attributes']['min-version'] = $nextCloudVersion->getMinimumVersion(); |
|
| 210 | + } |
|
| 211 | + if($nextCloudVersion->getMaximumVersion() !== '') { |
|
| 212 | + $nextCloudVersionDependencies['nextcloud']['@attributes']['max-version'] = $nextCloudVersion->getMaximumVersion(); |
|
| 213 | + } |
|
| 214 | + $phpVersion = $versionParser->getVersion($app['releases'][0]['rawPhpVersionSpec']); |
|
| 215 | + $existsLocally = \OC_App::getAppPath($app['id']) !== false; |
|
| 216 | + $phpDependencies = []; |
|
| 217 | + if($phpVersion->getMinimumVersion() !== '') { |
|
| 218 | + $phpDependencies['php']['@attributes']['min-version'] = $phpVersion->getMinimumVersion(); |
|
| 219 | + } |
|
| 220 | + if($phpVersion->getMaximumVersion() !== '') { |
|
| 221 | + $phpDependencies['php']['@attributes']['max-version'] = $phpVersion->getMaximumVersion(); |
|
| 222 | + } |
|
| 223 | + if(isset($app['releases'][0]['minIntSize'])) { |
|
| 224 | + $phpDependencies['php']['@attributes']['min-int-size'] = $app['releases'][0]['minIntSize']; |
|
| 225 | + } |
|
| 226 | + $authors = ''; |
|
| 227 | + foreach($app['authors'] as $key => $author) { |
|
| 228 | + $authors .= $author['name']; |
|
| 229 | + if($key !== count($app['authors']) - 1) { |
|
| 230 | + $authors .= ', '; |
|
| 231 | + } |
|
| 232 | + } |
|
| 233 | + |
|
| 234 | + $currentLanguage = substr(\OC::$server->getL10NFactory()->findLanguage(), 0, 2); |
|
| 235 | + $enabledValue = $this->config->getAppValue($app['id'], 'enabled', 'no'); |
|
| 236 | + $groups = null; |
|
| 237 | + if($enabledValue !== 'no' && $enabledValue !== 'yes') { |
|
| 238 | + $groups = $enabledValue; |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + $currentVersion = ''; |
|
| 242 | + if($this->appManager->isInstalled($app['id'])) { |
|
| 243 | + $currentVersion = \OC_App::getAppVersion($app['id']); |
|
| 244 | + } else { |
|
| 245 | + $currentLanguage = $app['releases'][0]['version']; |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + $formattedApps[] = [ |
|
| 249 | + 'id' => $app['id'], |
|
| 250 | + 'name' => isset($app['translations'][$currentLanguage]['name']) ? $app['translations'][$currentLanguage]['name'] : $app['translations']['en']['name'], |
|
| 251 | + 'description' => isset($app['translations'][$currentLanguage]['description']) ? $app['translations'][$currentLanguage]['description'] : $app['translations']['en']['description'], |
|
| 252 | + 'license' => $app['releases'][0]['licenses'], |
|
| 253 | + 'author' => $authors, |
|
| 254 | + 'shipped' => false, |
|
| 255 | + 'version' => $currentVersion, |
|
| 256 | + 'default_enable' => '', |
|
| 257 | + 'types' => [], |
|
| 258 | + 'documentation' => [ |
|
| 259 | + 'admin' => $app['adminDocs'], |
|
| 260 | + 'user' => $app['userDocs'], |
|
| 261 | + 'developer' => $app['developerDocs'] |
|
| 262 | + ], |
|
| 263 | + 'website' => $app['website'], |
|
| 264 | + 'bugs' => $app['issueTracker'], |
|
| 265 | + 'detailpage' => $app['website'], |
|
| 266 | + 'dependencies' => array_merge( |
|
| 267 | + $nextCloudVersionDependencies, |
|
| 268 | + $phpDependencies |
|
| 269 | + ), |
|
| 270 | + 'level' => ($app['featured'] === true) ? 200 : 100, |
|
| 271 | + 'missingMaxOwnCloudVersion' => false, |
|
| 272 | + 'missingMinOwnCloudVersion' => false, |
|
| 273 | + 'canInstall' => true, |
|
| 274 | + 'preview' => isset($app['screenshots'][0]['url']) ? 'https://usercontent.apps.nextcloud.com/'.base64_encode($app['screenshots'][0]['url']) : '', |
|
| 275 | + 'score' => $app['ratingOverall'], |
|
| 276 | + 'ratingNumOverall' => $app['ratingNumOverall'], |
|
| 277 | + 'ratingNumThresholdReached' => $app['ratingNumOverall'] > 5 ? true : false, |
|
| 278 | + 'removable' => $existsLocally, |
|
| 279 | + 'active' => $this->appManager->isEnabledForUser($app['id']), |
|
| 280 | + 'needsDownload' => !$existsLocally, |
|
| 281 | + 'groups' => $groups, |
|
| 282 | + 'fromAppStore' => true, |
|
| 283 | + ]; |
|
| 284 | + |
|
| 285 | + |
|
| 286 | + $newVersion = $this->installer->isUpdateAvailable($app['id']); |
|
| 287 | + if($newVersion && $this->appManager->isInstalled($app['id'])) { |
|
| 288 | + $formattedApps[count($formattedApps)-1]['update'] = $newVersion; |
|
| 289 | + } |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + return $formattedApps; |
|
| 293 | + } |
|
| 294 | + |
|
| 295 | + private function getAppsWithUpdates() { |
|
| 296 | + $appClass = new \OC_App(); |
|
| 297 | + $apps = $appClass->listAllApps(); |
|
| 298 | + foreach($apps as $key => $app) { |
|
| 299 | + $newVersion = $this->installer->isUpdateAvailable($app['id']); |
|
| 300 | + if($newVersion !== false) { |
|
| 301 | + $apps[$key]['update'] = $newVersion; |
|
| 302 | + } else { |
|
| 303 | + unset($apps[$key]); |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | + usort($apps, function ($a, $b) { |
|
| 307 | + $a = (string)$a['name']; |
|
| 308 | + $b = (string)$b['name']; |
|
| 309 | + if ($a === $b) { |
|
| 310 | + return 0; |
|
| 311 | + } |
|
| 312 | + return ($a < $b) ? -1 : 1; |
|
| 313 | + }); |
|
| 314 | + return $apps; |
|
| 315 | + } |
|
| 316 | + |
|
| 317 | + /** |
|
| 318 | + * Get all available apps in a category |
|
| 319 | + * |
|
| 320 | + * @param string $category |
|
| 321 | + * @return JSONResponse |
|
| 322 | + */ |
|
| 323 | + public function listApps($category = '') { |
|
| 324 | + $appClass = new \OC_App(); |
|
| 325 | + |
|
| 326 | + switch ($category) { |
|
| 327 | + // installed apps |
|
| 328 | + case 'installed': |
|
| 329 | + $apps = $appClass->listAllApps(); |
|
| 330 | + |
|
| 331 | + foreach($apps as $key => $app) { |
|
| 332 | + $newVersion = $this->installer->isUpdateAvailable($app['id']); |
|
| 333 | + $apps[$key]['update'] = $newVersion; |
|
| 334 | + } |
|
| 335 | + |
|
| 336 | + usort($apps, function ($a, $b) { |
|
| 337 | + $a = (string)$a['name']; |
|
| 338 | + $b = (string)$b['name']; |
|
| 339 | + if ($a === $b) { |
|
| 340 | + return 0; |
|
| 341 | + } |
|
| 342 | + return ($a < $b) ? -1 : 1; |
|
| 343 | + }); |
|
| 344 | + break; |
|
| 345 | + // updates |
|
| 346 | + case 'updates': |
|
| 347 | + $apps = $this->getAppsWithUpdates(); |
|
| 348 | + break; |
|
| 349 | + // enabled apps |
|
| 350 | + case 'enabled': |
|
| 351 | + $apps = $appClass->listAllApps(); |
|
| 352 | + $apps = array_filter($apps, function ($app) { |
|
| 353 | + return $app['active']; |
|
| 354 | + }); |
|
| 355 | + |
|
| 356 | + foreach($apps as $key => $app) { |
|
| 357 | + $newVersion = $this->installer->isUpdateAvailable($app['id']); |
|
| 358 | + $apps[$key]['update'] = $newVersion; |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + usort($apps, function ($a, $b) { |
|
| 362 | + $a = (string)$a['name']; |
|
| 363 | + $b = (string)$b['name']; |
|
| 364 | + if ($a === $b) { |
|
| 365 | + return 0; |
|
| 366 | + } |
|
| 367 | + return ($a < $b) ? -1 : 1; |
|
| 368 | + }); |
|
| 369 | + break; |
|
| 370 | + // disabled apps |
|
| 371 | + case 'disabled': |
|
| 372 | + $apps = $appClass->listAllApps(); |
|
| 373 | + $apps = array_filter($apps, function ($app) { |
|
| 374 | + return !$app['active']; |
|
| 375 | + }); |
|
| 376 | + |
|
| 377 | + $apps = array_map(function ($app) { |
|
| 378 | + $newVersion = $this->installer->isUpdateAvailable($app['id']); |
|
| 379 | + if ($newVersion !== false) { |
|
| 380 | + $app['update'] = $newVersion; |
|
| 381 | + } |
|
| 382 | + return $app; |
|
| 383 | + }, $apps); |
|
| 384 | + |
|
| 385 | + usort($apps, function ($a, $b) { |
|
| 386 | + $a = (string)$a['name']; |
|
| 387 | + $b = (string)$b['name']; |
|
| 388 | + if ($a === $b) { |
|
| 389 | + return 0; |
|
| 390 | + } |
|
| 391 | + return ($a < $b) ? -1 : 1; |
|
| 392 | + }); |
|
| 393 | + break; |
|
| 394 | + case 'app-bundles': |
|
| 395 | + $bundles = $this->bundleFetcher->getBundles(); |
|
| 396 | + $apps = []; |
|
| 397 | + foreach($bundles as $bundle) { |
|
| 398 | + $newCategory = true; |
|
| 399 | + $allApps = $appClass->listAllApps(); |
|
| 400 | + $categories = $this->getAllCategories(); |
|
| 401 | + foreach($categories as $singleCategory) { |
|
| 402 | + $newApps = $this->getAppsForCategory($singleCategory['id']); |
|
| 403 | + foreach($allApps as $app) { |
|
| 404 | + foreach($newApps as $key => $newApp) { |
|
| 405 | + if($app['id'] === $newApp['id']) { |
|
| 406 | + unset($newApps[$key]); |
|
| 407 | + } |
|
| 408 | + } |
|
| 409 | + } |
|
| 410 | + $allApps = array_merge($allApps, $newApps); |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + foreach($bundle->getAppIdentifiers() as $identifier) { |
|
| 414 | + foreach($allApps as $app) { |
|
| 415 | + if($app['id'] === $identifier) { |
|
| 416 | + if($newCategory) { |
|
| 417 | + $app['newCategory'] = true; |
|
| 418 | + $app['categoryName'] = $bundle->getName(); |
|
| 419 | + } |
|
| 420 | + $app['bundleId'] = $bundle->getIdentifier(); |
|
| 421 | + $newCategory = false; |
|
| 422 | + $apps[] = $app; |
|
| 423 | + continue; |
|
| 424 | + } |
|
| 425 | + } |
|
| 426 | + } |
|
| 427 | + } |
|
| 428 | + break; |
|
| 429 | + default: |
|
| 430 | + $apps = $this->getAppsForCategory($category); |
|
| 431 | + |
|
| 432 | + // sort by score |
|
| 433 | + usort($apps, function ($a, $b) { |
|
| 434 | + $a = (int)$a['score']; |
|
| 435 | + $b = (int)$b['score']; |
|
| 436 | + if ($a === $b) { |
|
| 437 | + return 0; |
|
| 438 | + } |
|
| 439 | + return ($a > $b) ? -1 : 1; |
|
| 440 | + }); |
|
| 441 | + break; |
|
| 442 | + } |
|
| 443 | + |
|
| 444 | + // fix groups to be an array |
|
| 445 | + $dependencyAnalyzer = new DependencyAnalyzer(new Platform($this->config), $this->l10n); |
|
| 446 | + $apps = array_map(function($app) use ($dependencyAnalyzer) { |
|
| 447 | + |
|
| 448 | + // fix groups |
|
| 449 | + $groups = array(); |
|
| 450 | + if (is_string($app['groups'])) { |
|
| 451 | + $groups = json_decode($app['groups']); |
|
| 452 | + } |
|
| 453 | + $app['groups'] = $groups; |
|
| 454 | + $app['canUnInstall'] = !$app['active'] && $app['removable']; |
|
| 455 | + |
|
| 456 | + // fix licence vs license |
|
| 457 | + if (isset($app['license']) && !isset($app['licence'])) { |
|
| 458 | + $app['licence'] = $app['license']; |
|
| 459 | + } |
|
| 460 | + |
|
| 461 | + // analyse dependencies |
|
| 462 | + $missing = $dependencyAnalyzer->analyze($app); |
|
| 463 | + $app['canInstall'] = empty($missing); |
|
| 464 | + $app['missingDependencies'] = $missing; |
|
| 465 | + |
|
| 466 | + $app['missingMinOwnCloudVersion'] = !isset($app['dependencies']['nextcloud']['@attributes']['min-version']); |
|
| 467 | + $app['missingMaxOwnCloudVersion'] = !isset($app['dependencies']['nextcloud']['@attributes']['max-version']); |
|
| 468 | + |
|
| 469 | + return $app; |
|
| 470 | + }, $apps); |
|
| 471 | + |
|
| 472 | + return new JSONResponse(['apps' => $apps, 'status' => 'success']); |
|
| 473 | + } |
|
| 474 | 474 | } |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | style('settings', 'settings'); |
| 3 | 3 | vendor_script( |
| 4 | - 'core', |
|
| 5 | - [ |
|
| 6 | - 'marked/marked.min', |
|
| 7 | - ] |
|
| 4 | + 'core', |
|
| 5 | + [ |
|
| 6 | + 'marked/marked.min', |
|
| 7 | + ] |
|
| 8 | 8 | ); |
| 9 | 9 | script( |
| 10 | - 'settings', |
|
| 11 | - [ |
|
| 12 | - 'settings', |
|
| 13 | - 'apps', |
|
| 14 | - ] |
|
| 10 | + 'settings', |
|
| 11 | + [ |
|
| 12 | + 'settings', |
|
| 13 | + 'apps', |
|
| 14 | + ] |
|
| 15 | 15 | ); |
| 16 | 16 | /** @var array $_ */ |
| 17 | 17 | /** @var \OCP\IURLGenerator $urlGenerator */ |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | </li> |
| 30 | 30 | {{/each}} |
| 31 | 31 | |
| 32 | -<?php if($_['appstoreEnabled']): ?> |
|
| 32 | +<?php if ($_['appstoreEnabled']): ?> |
|
| 33 | 33 | <li> |
| 34 | - <a class="app-external icon-info" target="_blank" rel="noreferrer noopener" href="<?php p($urlGenerator->linkToDocs('developer-manual')); ?>"><?php p($l->t('Developer documentation'));?> ↗</a> |
|
| 34 | + <a class="app-external icon-info" target="_blank" rel="noreferrer noopener" href="<?php p($urlGenerator->linkToDocs('developer-manual')); ?>"><?php p($l->t('Developer documentation')); ?> ↗</a> |
|
| 35 | 35 | </li> |
| 36 | 36 | <?php endif; ?> |
| 37 | 37 | </script> |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | {{#if newCategory}} |
| 41 | 41 | <div class="apps-header"> |
| 42 | 42 | <div class="app-image"></div> |
| 43 | - <h2>{{categoryName}} <input class="enable" type="submit" data-bundleid="{{bundleId}}" data-active="true" value="<?php p($l->t('Enable all'));?>"/></h2> |
|
| 43 | + <h2>{{categoryName}} <input class="enable" type="submit" data-bundleid="{{bundleId}}" data-active="true" value="<?php p($l->t('Enable all')); ?>"/></h2> |
|
| 44 | 44 | <div class="app-version"></div> |
| 45 | 45 | <div class="app-level"></div> |
| 46 | 46 | <div class="app-groups"></div> |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | </div> |
| 59 | 59 | <div class="app-version">{{version}}</div> |
| 60 | 60 | <div class="app-level"> |
| 61 | - {{{level}}}{{#unless internal}}<a href="https://apps.nextcloud.com/apps/{{id}}"><?php p($l->t('View in store'));?> ↗</a>{{/unless}} |
|
| 61 | + {{{level}}}{{#unless internal}}<a href="https://apps.nextcloud.com/apps/{{id}}"><?php p($l->t('View in store')); ?> ↗</a>{{/unless}} |
|
| 62 | 62 | </div> |
| 63 | 63 | |
| 64 | 64 | <div class="app-groups"> |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | <input class="uninstall" type="submit" value="<?php p($l->t('Remove')); ?>" data-appid="{{id}}" /> |
| 79 | 79 | {{/if}} |
| 80 | 80 | {{#if active}} |
| 81 | - <input class="enable" type="submit" data-appid="{{id}}" data-active="true" value="<?php p($l->t("Disable"));?>"/> |
|
| 81 | + <input class="enable" type="submit" data-appid="{{id}}" data-active="true" value="<?php p($l->t("Disable")); ?>"/> |
|
| 82 | 82 | {{else}} |
| 83 | - <input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable"));?>"/> |
|
| 83 | + <input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable")); ?>"/> |
|
| 84 | 84 | {{/if}} |
| 85 | 85 | </div> |
| 86 | 86 | </div> |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | <div class="app-description-container hidden"> |
| 111 | 111 | <div class="app-version">{{version}}</div> |
| 112 | 112 | {{#if profilepage}}<a href="{{profilepage}}" target="_blank" rel="noreferrer noopener">{{/if}} |
| 113 | - <div class="app-author"><?php p($l->t('by %s', ['{{author}}']));?> |
|
| 113 | + <div class="app-author"><?php p($l->t('by %s', ['{{author}}'])); ?> |
|
| 114 | 114 | {{#if licence}} |
| 115 | 115 | (<?php p($l->t('%s-licensed', ['{{licence}}'])); ?>) |
| 116 | 116 | {{/if}} |
@@ -120,37 +120,37 @@ discard block |
||
| 120 | 120 | <!--<div class="app-changed">{{changed}}</div>--> |
| 121 | 121 | {{#if documentation}} |
| 122 | 122 | <p class="documentation"> |
| 123 | - <?php p($l->t("Documentation:"));?> |
|
| 123 | + <?php p($l->t("Documentation:")); ?> |
|
| 124 | 124 | {{#if documentation.user}} |
| 125 | 125 | <span class="userDocumentation"> |
| 126 | - <a id="userDocumentation" class="appslink" href="{{documentation.user}}" target="_blank" rel="noreferrer noopener"><?php p($l->t('User documentation'));?> ↗</a> |
|
| 126 | + <a id="userDocumentation" class="appslink" href="{{documentation.user}}" target="_blank" rel="noreferrer noopener"><?php p($l->t('User documentation')); ?> ↗</a> |
|
| 127 | 127 | </span> |
| 128 | 128 | {{/if}} |
| 129 | 129 | |
| 130 | 130 | {{#if documentation.admin}} |
| 131 | 131 | <span class="adminDocumentation"> |
| 132 | - <a id="adminDocumentation" class="appslink" href="{{documentation.admin}}" target="_blank" rel="noreferrer noopener"><?php p($l->t('Admin documentation'));?> ↗</a> |
|
| 132 | + <a id="adminDocumentation" class="appslink" href="{{documentation.admin}}" target="_blank" rel="noreferrer noopener"><?php p($l->t('Admin documentation')); ?> ↗</a> |
|
| 133 | 133 | </span> |
| 134 | 134 | {{/if}} |
| 135 | 135 | |
| 136 | 136 | {{#if documentation.developer}} |
| 137 | 137 | <span class="developerDocumentation"> |
| 138 | - <a id="developerDocumentation" class="appslink" href="{{documentation.developer}}" target="_blank" rel="noreferrer noopener"><?php p($l->t('Developer documentation'));?> ↗</a> |
|
| 138 | + <a id="developerDocumentation" class="appslink" href="{{documentation.developer}}" target="_blank" rel="noreferrer noopener"><?php p($l->t('Developer documentation')); ?> ↗</a> |
|
| 139 | 139 | </span> |
| 140 | 140 | {{/if}} |
| 141 | 141 | </p> |
| 142 | 142 | {{/if}} |
| 143 | 143 | |
| 144 | 144 | {{#if website}} |
| 145 | - <a id="userDocumentation" class="appslink" href="{{website}}" target="_blank" rel="noreferrer noopener"><?php p($l->t('Visit website'));?> ↗</a> |
|
| 145 | + <a id="userDocumentation" class="appslink" href="{{website}}" target="_blank" rel="noreferrer noopener"><?php p($l->t('Visit website')); ?> ↗</a> |
|
| 146 | 146 | {{/if}} |
| 147 | 147 | |
| 148 | 148 | {{#if bugs}} |
| 149 | - <a id="adminDocumentation" class="appslink" href="{{bugs}}" target="_blank" rel="noreferrer noopener"><?php p($l->t('Report a bug'));?> ↗</a> |
|
| 149 | + <a id="adminDocumentation" class="appslink" href="{{bugs}}" target="_blank" rel="noreferrer noopener"><?php p($l->t('Report a bug')); ?> ↗</a> |
|
| 150 | 150 | {{/if}} |
| 151 | 151 | </div><!-- end app-description-container --> |
| 152 | - <div class="app-description-toggle-show" role="link"><?php p($l->t("Show description …"));?></div> |
|
| 153 | - <div class="app-description-toggle-hide hidden" role="link"><?php p($l->t("Hide description …"));?></div> |
|
| 152 | + <div class="app-description-toggle-show" role="link"><?php p($l->t("Show description …")); ?></div> |
|
| 153 | + <div class="app-description-toggle-hide hidden" role="link"><?php p($l->t("Hide description …")); ?></div> |
|
| 154 | 154 | |
| 155 | 155 | <div class="app-dependencies update hidden"> |
| 156 | 156 | <p><?php p($l->t('This app has an update available.')); ?></p> |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | <input class="update hidden" type="submit" value="<?php p($l->t('Update to %s', array('{{update}}'))); ?>" data-appid="{{id}}" /> |
| 183 | 183 | {{#if active}} |
| 184 | - <input class="enable" type="submit" data-appid="{{id}}" data-active="true" value="<?php p($l->t("Disable"));?>"/> |
|
| 184 | + <input class="enable" type="submit" data-appid="{{id}}" data-active="true" value="<?php p($l->t("Disable")); ?>"/> |
|
| 185 | 185 | <div class="groups-enable"> |
| 186 | 186 | <input type="checkbox" class="groups-enable__checkbox checkbox" id="groups_enable-{{id}}"/> |
| 187 | 187 | <label for="groups_enable-{{id}}"><?php p($l->t('Enable only for specific groups')); ?></label> |
| 188 | 188 | </div> |
| 189 | 189 | <input type="hidden" class="group_select" title="<?php p($l->t('All')); ?>" style="width: 200px"> |
| 190 | 190 | {{else}} |
| 191 | - <input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable"));?>"/> |
|
| 191 | + <input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable")); ?>"/> |
|
| 192 | 192 | {{/if}} |
| 193 | 193 | {{#if canUnInstall}} |
| 194 | 194 | <input class="uninstall" type="submit" value="<?php p($l->t('Remove')); ?>" data-appid="{{id}}" /> |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | </div> |
| 200 | 200 | </script> |
| 201 | 201 | |
| 202 | -<div id="app-navigation" class="icon-loading" data-category="<?php p($_['category']);?>"> |
|
| 202 | +<div id="app-navigation" class="icon-loading" data-category="<?php p($_['category']); ?>"> |
|
| 203 | 203 | <ul id="apps-categories"> |
| 204 | 204 | |
| 205 | 205 | </ul> |