@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public static function initPaths(): void { |
| 139 | 139 | if (defined('PHPUNIT_CONFIG_DIR')) { |
| 140 | - self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/'; |
|
| 141 | - } elseif (defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT . '/tests/config/')) { |
|
| 142 | - self::$configDir = OC::$SERVERROOT . '/tests/config/'; |
|
| 140 | + self::$configDir = OC::$SERVERROOT.'/'.PHPUNIT_CONFIG_DIR.'/'; |
|
| 141 | + } elseif (defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT.'/tests/config/')) { |
|
| 142 | + self::$configDir = OC::$SERVERROOT.'/tests/config/'; |
|
| 143 | 143 | } elseif ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { |
| 144 | - self::$configDir = rtrim($dir, '/') . '/'; |
|
| 144 | + self::$configDir = rtrim($dir, '/').'/'; |
|
| 145 | 145 | } else { |
| 146 | - self::$configDir = OC::$SERVERROOT . '/config/'; |
|
| 146 | + self::$configDir = OC::$SERVERROOT.'/config/'; |
|
| 147 | 147 | } |
| 148 | 148 | self::$config = new \OC\Config(self::$configDir); |
| 149 | 149 | |
@@ -169,9 +169,9 @@ discard block |
||
| 169 | 169 | //make sure suburi follows the same rules as scriptName |
| 170 | 170 | if (substr(OC::$SUBURI, -9) != 'index.php') { |
| 171 | 171 | if (substr(OC::$SUBURI, -1) != '/') { |
| 172 | - OC::$SUBURI = OC::$SUBURI . '/'; |
|
| 172 | + OC::$SUBURI = OC::$SUBURI.'/'; |
|
| 173 | 173 | } |
| 174 | - OC::$SUBURI = OC::$SUBURI . 'index.php'; |
|
| 174 | + OC::$SUBURI = OC::$SUBURI.'index.php'; |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI)); |
| 184 | 184 | |
| 185 | 185 | if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') { |
| 186 | - OC::$WEBROOT = '/' . OC::$WEBROOT; |
|
| 186 | + OC::$WEBROOT = '/'.OC::$WEBROOT; |
|
| 187 | 187 | } |
| 188 | 188 | } else { |
| 189 | 189 | // The scriptName is not ending with OC::$SUBURI |
@@ -212,8 +212,8 @@ discard block |
||
| 212 | 212 | OC::$APPSROOTS[] = $paths; |
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | - } elseif (file_exists(OC::$SERVERROOT . '/apps')) { |
|
| 216 | - OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT . '/apps', 'url' => '/apps', 'writable' => true]; |
|
| 215 | + } elseif (file_exists(OC::$SERVERROOT.'/apps')) { |
|
| 216 | + OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT.'/apps', 'url' => '/apps', 'writable' => true]; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | if (empty(OC::$APPSROOTS)) { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $l = Server::get(\OCP\L10N\IFactory::class)->get('lib'); |
| 240 | 240 | |
| 241 | 241 | // Create config if it does not already exist |
| 242 | - $configFilePath = self::$configDir .'/config.php'; |
|
| 242 | + $configFilePath = self::$configDir.'/config.php'; |
|
| 243 | 243 | if (!file_exists($configFilePath)) { |
| 244 | 244 | @touch($configFilePath); |
| 245 | 245 | } |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | echo $l->t('This can usually be fixed by giving the web server write access to the config directory.')."\n"; |
| 256 | 256 | echo "\n"; |
| 257 | 257 | echo $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.')."\n"; |
| 258 | - echo $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ])."\n"; |
|
| 258 | + echo $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')])."\n"; |
|
| 259 | 259 | exit; |
| 260 | 260 | } else { |
| 261 | 261 | OC_Template::printErrorPage( |
| 262 | 262 | $l->t('Cannot write into "config" directory!'), |
| 263 | - $l->t('This can usually be fixed by giving the web server write access to the config directory.') . ' ' |
|
| 264 | - . $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.') . ' ' |
|
| 265 | - . $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ]), |
|
| 263 | + $l->t('This can usually be fixed by giving the web server write access to the config directory.').' ' |
|
| 264 | + . $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.').' ' |
|
| 265 | + . $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')]), |
|
| 266 | 266 | 503 |
| 267 | 267 | ); |
| 268 | 268 | } |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | if (OC::$CLI) { |
| 279 | 279 | throw new Exception('Not installed'); |
| 280 | 280 | } else { |
| 281 | - $url = OC::$WEBROOT . '/index.php'; |
|
| 282 | - header('Location: ' . $url); |
|
| 281 | + $url = OC::$WEBROOT.'/index.php'; |
|
| 282 | + header('Location: '.$url); |
|
| 283 | 283 | } |
| 284 | 284 | exit(); |
| 285 | 285 | } |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | $incompatibleShippedApps = []; |
| 386 | 386 | foreach ($incompatibleApps as $appInfo) { |
| 387 | 387 | if ($appManager->isShipped($appInfo['id'])) { |
| 388 | - $incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')'; |
|
| 388 | + $incompatibleShippedApps[] = $appInfo['name'].' ('.$appInfo['id'].')'; |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | if (!empty($incompatibleShippedApps)) { |
| 393 | 393 | $l = Server::get(\OCP\L10N\IFactory::class)->get('core'); |
| 394 | 394 | $hint = $l->t('The files of the app %1$s were not replaced correctly. Make sure it is a version compatible with the server.', [implode(', ', $incompatibleShippedApps)]); |
| 395 | - throw new \OCP\HintException('The files of the app ' . implode(', ', $incompatibleShippedApps) . ' were not replaced correctly. Make sure it is a version compatible with the server.', $hint); |
|
| 395 | + throw new \OCP\HintException('The files of the app '.implode(', ', $incompatibleShippedApps).' were not replaced correctly. Make sure it is a version compatible with the server.', $hint); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion)); |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | ini_set('session.cookie_httponly', 'true'); |
| 417 | 417 | |
| 418 | 418 | // set the cookie path to the Nextcloud directory |
| 419 | - $cookie_path = OC::$WEBROOT ? : '/'; |
|
| 419 | + $cookie_path = OC::$WEBROOT ?: '/'; |
|
| 420 | 420 | ini_set('session.cookie_path', $cookie_path); |
| 421 | 421 | |
| 422 | 422 | // Let the session name be changed in the initSession Hook |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | // if session can't be started break with http 500 error |
| 434 | 434 | } catch (Exception $e) { |
| 435 | - Server::get(LoggerInterface::class)->error($e->getMessage(), ['app' => 'base','exception' => $e]); |
|
| 435 | + Server::get(LoggerInterface::class)->error($e->getMessage(), ['app' => 'base', 'exception' => $e]); |
|
| 436 | 436 | //show the user a detailed error page |
| 437 | 437 | OC_Template::printExceptionErrorPage($e, 500); |
| 438 | 438 | die(); |
@@ -440,12 +440,12 @@ discard block |
||
| 440 | 440 | |
| 441 | 441 | //try to set the session lifetime |
| 442 | 442 | $sessionLifeTime = self::getSessionLifeTime(); |
| 443 | - @ini_set('gc_maxlifetime', (string)$sessionLifeTime); |
|
| 443 | + @ini_set('gc_maxlifetime', (string) $sessionLifeTime); |
|
| 444 | 444 | |
| 445 | 445 | // session timeout |
| 446 | 446 | if ($session->exists('LAST_ACTIVITY') && (time() - $session->get('LAST_ACTIVITY') > $sessionLifeTime)) { |
| 447 | 447 | if (isset($_COOKIE[session_name()])) { |
| 448 | - setcookie(session_name(), '', -1, self::$WEBROOT ? : '/'); |
|
| 448 | + setcookie(session_name(), '', -1, self::$WEBROOT ?: '/'); |
|
| 449 | 449 | } |
| 450 | 450 | Server::get(IUserSession::class)->logout(); |
| 451 | 451 | } |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | foreach ($policies as $policy) { |
| 496 | 496 | header( |
| 497 | 497 | sprintf( |
| 498 | - 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;' . $secureCookie . 'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
| 498 | + 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;'.$secureCookie.'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
| 499 | 499 | $cookiePrefix, |
| 500 | 500 | $policy, |
| 501 | 501 | $cookieParams['path'], |
@@ -569,12 +569,12 @@ discard block |
||
| 569 | 569 | |
| 570 | 570 | // register autoloader |
| 571 | 571 | $loaderStart = microtime(true); |
| 572 | - require_once __DIR__ . '/autoloader.php'; |
|
| 572 | + require_once __DIR__.'/autoloader.php'; |
|
| 573 | 573 | self::$loader = new \OC\Autoloader([ |
| 574 | - OC::$SERVERROOT . '/lib/private/legacy', |
|
| 574 | + OC::$SERVERROOT.'/lib/private/legacy', |
|
| 575 | 575 | ]); |
| 576 | 576 | if (defined('PHPUNIT_RUN')) { |
| 577 | - self::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); |
|
| 577 | + self::$loader->addValidRoot(OC::$SERVERROOT.'/tests'); |
|
| 578 | 578 | } |
| 579 | 579 | spl_autoload_register([self::$loader, 'load']); |
| 580 | 580 | $loaderEnd = microtime(true); |
@@ -582,13 +582,13 @@ discard block |
||
| 582 | 582 | self::$CLI = (php_sapi_name() == 'cli'); |
| 583 | 583 | |
| 584 | 584 | // Add default composer PSR-4 autoloader |
| 585 | - self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php'; |
|
| 585 | + self::$composerAutoloader = require_once OC::$SERVERROOT.'/lib/composer/autoload.php'; |
|
| 586 | 586 | self::$composerAutoloader->setApcuPrefix('composer_autoload'); |
| 587 | 587 | |
| 588 | 588 | try { |
| 589 | 589 | self::initPaths(); |
| 590 | 590 | // setup 3rdparty autoloader |
| 591 | - $vendorAutoLoad = OC::$SERVERROOT. '/3rdparty/autoload.php'; |
|
| 591 | + $vendorAutoLoad = OC::$SERVERROOT.'/3rdparty/autoload.php'; |
|
| 592 | 592 | if (!file_exists($vendorAutoLoad)) { |
| 593 | 593 | throw new \RuntimeException('Composer autoloader not found, unable to continue. Check the folder "3rdparty". Running "git submodule update --init" will initialize the git submodule that handles the subfolder "3rdparty".'); |
| 594 | 594 | } |
@@ -703,11 +703,11 @@ discard block |
||
| 703 | 703 | // Convert l10n string into regular string for usage in database |
| 704 | 704 | $staticErrors = []; |
| 705 | 705 | foreach ($errors as $error) { |
| 706 | - echo $error['error'] . "\n"; |
|
| 707 | - echo $error['hint'] . "\n\n"; |
|
| 706 | + echo $error['error']."\n"; |
|
| 707 | + echo $error['hint']."\n\n"; |
|
| 708 | 708 | $staticErrors[] = [ |
| 709 | - 'error' => (string)$error['error'], |
|
| 710 | - 'hint' => (string)$error['hint'], |
|
| 709 | + 'error' => (string) $error['error'], |
|
| 710 | + 'hint' => (string) $error['hint'], |
|
| 711 | 711 | ]; |
| 712 | 712 | } |
| 713 | 713 | |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | $eventLogger->log('init', 'OC::init', $loaderStart, microtime(true)); |
| 824 | 824 | $eventLogger->start('runtime', 'Runtime'); |
| 825 | 825 | $eventLogger->start('request', 'Full request after boot'); |
| 826 | - register_shutdown_function(function () use ($eventLogger) { |
|
| 826 | + register_shutdown_function(function() use ($eventLogger) { |
|
| 827 | 827 | $eventLogger->end('request'); |
| 828 | 828 | }); |
| 829 | 829 | } |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | if ($systemConfig->getValue('installed', false) && !\OCP\Util::needUpgrade()) { |
| 837 | 837 | // NOTE: This will be replaced to use OCP |
| 838 | 838 | $userSession = Server::get(\OC\User\Session::class); |
| 839 | - $userSession->listen('\OC\User', 'postLogin', function () use ($userSession) { |
|
| 839 | + $userSession->listen('\OC\User', 'postLogin', function() use ($userSession) { |
|
| 840 | 840 | if (!defined('PHPUNIT_RUN') && $userSession->isLoggedIn()) { |
| 841 | 841 | // reset brute force delay for this IP address and username |
| 842 | 842 | $uid = $userSession->getUser()->getUID(); |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | private static function registerAppRestrictionsHooks(): void { |
| 888 | 888 | /** @var \OC\Group\Manager $groupManager */ |
| 889 | 889 | $groupManager = Server::get(\OCP\IGroupManager::class); |
| 890 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OCP\IGroup $group) { |
|
| 890 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OCP\IGroup $group) { |
|
| 891 | 891 | $appManager = Server::get(\OCP\App\IAppManager::class); |
| 892 | 892 | $apps = $appManager->getEnabledAppsForGroup($group); |
| 893 | 893 | foreach ($apps as $appId) { |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | ) { |
| 996 | 996 | \OC_JSON::callCheck(); |
| 997 | 997 | \OC_JSON::checkAdminUser(); |
| 998 | - $appIds = (array)$request->getParam('appid'); |
|
| 998 | + $appIds = (array) $request->getParam('appid'); |
|
| 999 | 999 | foreach ($appIds as $appId) { |
| 1000 | 1000 | $appId = \OC_App::cleanAppId($appId); |
| 1001 | 1001 | Server::get(\OCP\App\IAppManager::class)->disableApp($appId); |
@@ -1071,10 +1071,10 @@ discard block |
||
| 1071 | 1071 | if ($requestPath === '') { |
| 1072 | 1072 | // Someone is logged in |
| 1073 | 1073 | if (Server::get(IUserSession::class)->isLoggedIn()) { |
| 1074 | - header('Location: ' . Server::get(IURLGenerator::class)->linkToDefaultPageUrl()); |
|
| 1074 | + header('Location: '.Server::get(IURLGenerator::class)->linkToDefaultPageUrl()); |
|
| 1075 | 1075 | } else { |
| 1076 | 1076 | // Not handled and not logged in |
| 1077 | - header('Location: ' . Server::get(IURLGenerator::class)->linkToRouteAbsolute('core.login.showLoginForm')); |
|
| 1077 | + header('Location: '.Server::get(IURLGenerator::class)->linkToRouteAbsolute('core.login.showLoginForm')); |
|
| 1078 | 1078 | } |
| 1079 | 1079 | return; |
| 1080 | 1080 | } |