@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public static function initPaths() { |
| 142 | 142 | if (defined('PHPUNIT_CONFIG_DIR')) { |
| 143 | - self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/'; |
|
| 144 | - } elseif (defined('PHPUNIT_RUN') && PHPUNIT_RUN && is_dir(OC::$SERVERROOT . '/tests/config/')) { |
|
| 145 | - self::$configDir = OC::$SERVERROOT . '/tests/config/'; |
|
| 143 | + self::$configDir = OC::$SERVERROOT.'/'.PHPUNIT_CONFIG_DIR.'/'; |
|
| 144 | + } elseif (defined('PHPUNIT_RUN') && PHPUNIT_RUN && is_dir(OC::$SERVERROOT.'/tests/config/')) { |
|
| 145 | + self::$configDir = OC::$SERVERROOT.'/tests/config/'; |
|
| 146 | 146 | } elseif ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { |
| 147 | - self::$configDir = rtrim($dir, '/') . '/'; |
|
| 147 | + self::$configDir = rtrim($dir, '/').'/'; |
|
| 148 | 148 | } else { |
| 149 | - self::$configDir = OC::$SERVERROOT . '/config/'; |
|
| 149 | + self::$configDir = OC::$SERVERROOT.'/config/'; |
|
| 150 | 150 | } |
| 151 | 151 | self::$config = new \OC\Config(self::$configDir); |
| 152 | 152 | |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | //make sure suburi follows the same rules as scriptName |
| 173 | 173 | if (substr(OC::$SUBURI, -9) != 'index.php') { |
| 174 | 174 | if (substr(OC::$SUBURI, -1) != '/') { |
| 175 | - OC::$SUBURI = OC::$SUBURI . '/'; |
|
| 175 | + OC::$SUBURI = OC::$SUBURI.'/'; |
|
| 176 | 176 | } |
| 177 | - OC::$SUBURI = OC::$SUBURI . 'index.php'; |
|
| 177 | + OC::$SUBURI = OC::$SUBURI.'index.php'; |
|
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI)); |
| 187 | 187 | |
| 188 | 188 | if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') { |
| 189 | - OC::$WEBROOT = '/' . OC::$WEBROOT; |
|
| 189 | + OC::$WEBROOT = '/'.OC::$WEBROOT; |
|
| 190 | 190 | } |
| 191 | 191 | } else { |
| 192 | 192 | // The scriptName is not ending with OC::$SUBURI |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | OC::$APPSROOTS[] = $paths; |
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | - } elseif (file_exists(OC::$SERVERROOT . '/apps')) { |
|
| 219 | - OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT . '/apps', 'url' => '/apps', 'writable' => true]; |
|
| 218 | + } elseif (file_exists(OC::$SERVERROOT.'/apps')) { |
|
| 219 | + OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT.'/apps', 'url' => '/apps', 'writable' => true]; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (empty(OC::$APPSROOTS)) { |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $l = \OC::$server->getL10N('lib'); |
| 243 | 243 | |
| 244 | 244 | // Create config if it does not already exist |
| 245 | - $configFilePath = self::$configDir .'/config.php'; |
|
| 245 | + $configFilePath = self::$configDir.'/config.php'; |
|
| 246 | 246 | if (!file_exists($configFilePath)) { |
| 247 | 247 | @touch($configFilePath); |
| 248 | 248 | } |
@@ -258,14 +258,14 @@ discard block |
||
| 258 | 258 | echo $l->t('This can usually be fixed by giving the web server write access to the config directory.')."\n"; |
| 259 | 259 | echo "\n"; |
| 260 | 260 | 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"; |
| 261 | - echo $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ])."\n"; |
|
| 261 | + echo $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')])."\n"; |
|
| 262 | 262 | exit; |
| 263 | 263 | } else { |
| 264 | 264 | OC_Template::printErrorPage( |
| 265 | 265 | $l->t('Cannot write into "config" directory!'), |
| 266 | - $l->t('This can usually be fixed by giving the web server write access to the config directory.') . ' ' |
|
| 267 | - . $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.') . ' ' |
|
| 268 | - . $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ]), |
|
| 266 | + $l->t('This can usually be fixed by giving the web server write access to the config directory.').' ' |
|
| 267 | + . $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.').' ' |
|
| 268 | + . $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')]), |
|
| 269 | 269 | 503 |
| 270 | 270 | ); |
| 271 | 271 | } |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | if (OC::$CLI) { |
| 282 | 282 | throw new Exception('Not installed'); |
| 283 | 283 | } else { |
| 284 | - $url = OC::$WEBROOT . '/index.php'; |
|
| 285 | - header('Location: ' . $url); |
|
| 284 | + $url = OC::$WEBROOT.'/index.php'; |
|
| 285 | + header('Location: '.$url); |
|
| 286 | 286 | } |
| 287 | 287 | exit(); |
| 288 | 288 | } |
@@ -389,14 +389,14 @@ discard block |
||
| 389 | 389 | $incompatibleShippedApps = []; |
| 390 | 390 | foreach ($incompatibleApps as $appInfo) { |
| 391 | 391 | if ($appManager->isShipped($appInfo['id'])) { |
| 392 | - $incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')'; |
|
| 392 | + $incompatibleShippedApps[] = $appInfo['name'].' ('.$appInfo['id'].')'; |
|
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | if (!empty($incompatibleShippedApps)) { |
| 397 | 397 | $l = \OC::$server->getL10N('core'); |
| 398 | 398 | $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)]); |
| 399 | - 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); |
|
| 399 | + 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); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion)); |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | ini_set('session.cookie_httponly', 'true'); |
| 421 | 421 | |
| 422 | 422 | // set the cookie path to the Nextcloud directory |
| 423 | - $cookie_path = OC::$WEBROOT ? : '/'; |
|
| 423 | + $cookie_path = OC::$WEBROOT ?: '/'; |
|
| 424 | 424 | ini_set('session.cookie_path', $cookie_path); |
| 425 | 425 | |
| 426 | 426 | // Let the session name be changed in the initSession Hook |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | // session timeout |
| 448 | 448 | if ($session->exists('LAST_ACTIVITY') && (time() - $session->get('LAST_ACTIVITY') > $sessionLifeTime)) { |
| 449 | 449 | if (isset($_COOKIE[session_name()])) { |
| 450 | - setcookie(session_name(), '', -1, self::$WEBROOT ? : '/'); |
|
| 450 | + setcookie(session_name(), '', -1, self::$WEBROOT ?: '/'); |
|
| 451 | 451 | } |
| 452 | 452 | \OC::$server->getUserSession()->logout(); |
| 453 | 453 | } |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | foreach ($policies as $policy) { |
| 483 | 483 | header( |
| 484 | 484 | sprintf( |
| 485 | - 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;' . $secureCookie . 'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
| 485 | + 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;'.$secureCookie.'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
| 486 | 486 | $cookiePrefix, |
| 487 | 487 | $policy, |
| 488 | 488 | $cookieParams['path'], |
@@ -556,12 +556,12 @@ discard block |
||
| 556 | 556 | |
| 557 | 557 | // register autoloader |
| 558 | 558 | $loaderStart = microtime(true); |
| 559 | - require_once __DIR__ . '/autoloader.php'; |
|
| 559 | + require_once __DIR__.'/autoloader.php'; |
|
| 560 | 560 | self::$loader = new \OC\Autoloader([ |
| 561 | - OC::$SERVERROOT . '/lib/private/legacy', |
|
| 561 | + OC::$SERVERROOT.'/lib/private/legacy', |
|
| 562 | 562 | ]); |
| 563 | 563 | if (defined('PHPUNIT_RUN')) { |
| 564 | - self::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); |
|
| 564 | + self::$loader->addValidRoot(OC::$SERVERROOT.'/tests'); |
|
| 565 | 565 | } |
| 566 | 566 | spl_autoload_register([self::$loader, 'load']); |
| 567 | 567 | $loaderEnd = microtime(true); |
@@ -569,12 +569,12 @@ discard block |
||
| 569 | 569 | self::$CLI = (php_sapi_name() == 'cli'); |
| 570 | 570 | |
| 571 | 571 | // Add default composer PSR-4 autoloader |
| 572 | - self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php'; |
|
| 572 | + self::$composerAutoloader = require_once OC::$SERVERROOT.'/lib/composer/autoload.php'; |
|
| 573 | 573 | |
| 574 | 574 | try { |
| 575 | 575 | self::initPaths(); |
| 576 | 576 | // setup 3rdparty autoloader |
| 577 | - $vendorAutoLoad = OC::$SERVERROOT. '/3rdparty/autoload.php'; |
|
| 577 | + $vendorAutoLoad = OC::$SERVERROOT.'/3rdparty/autoload.php'; |
|
| 578 | 578 | if (!file_exists($vendorAutoLoad)) { |
| 579 | 579 | 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".'); |
| 580 | 580 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | $eventLogger = \OC::$server->getEventLogger(); |
| 597 | 597 | $eventLogger->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd); |
| 598 | 598 | $eventLogger->start('request', 'Full request after autoloading'); |
| 599 | - register_shutdown_function(function () use ($eventLogger) { |
|
| 599 | + register_shutdown_function(function() use ($eventLogger) { |
|
| 600 | 600 | $eventLogger->end('request'); |
| 601 | 601 | }); |
| 602 | 602 | $eventLogger->start('boot', 'Initialize'); |
@@ -675,11 +675,11 @@ discard block |
||
| 675 | 675 | // Convert l10n string into regular string for usage in database |
| 676 | 676 | $staticErrors = []; |
| 677 | 677 | foreach ($errors as $error) { |
| 678 | - echo $error['error'] . "\n"; |
|
| 679 | - echo $error['hint'] . "\n\n"; |
|
| 678 | + echo $error['error']."\n"; |
|
| 679 | + echo $error['hint']."\n\n"; |
|
| 680 | 680 | $staticErrors[] = [ |
| 681 | - 'error' => (string)$error['error'], |
|
| 682 | - 'hint' => (string)$error['hint'], |
|
| 681 | + 'error' => (string) $error['error'], |
|
| 682 | + 'hint' => (string) $error['hint'], |
|
| 683 | 683 | ]; |
| 684 | 684 | } |
| 685 | 685 | |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | } |
| 696 | 696 | //try to set the session lifetime |
| 697 | 697 | $sessionLifeTime = self::getSessionLifeTime(); |
| 698 | - @ini_set('gc_maxlifetime', (string)$sessionLifeTime); |
|
| 698 | + @ini_set('gc_maxlifetime', (string) $sessionLifeTime); |
|
| 699 | 699 | |
| 700 | 700 | // User and Groups |
| 701 | 701 | if (!$systemConfig->getValue("installed", false)) { |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | |
| 809 | 809 | // NOTE: This will be replaced to use OCP |
| 810 | 810 | $userSession = self::$server->getUserSession(); |
| 811 | - $userSession->listen('\OC\User', 'postLogin', function () use ($userSession) { |
|
| 811 | + $userSession->listen('\OC\User', 'postLogin', function() use ($userSession) { |
|
| 812 | 812 | if (!defined('PHPUNIT_RUN') && $userSession->isLoggedIn()) { |
| 813 | 813 | // reset brute force delay for this IP address and username |
| 814 | 814 | $uid = \OC::$server->getUserSession()->getUser()->getUID(); |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | private static function registerAppRestrictionsHooks() { |
| 861 | 861 | /** @var \OC\Group\Manager $groupManager */ |
| 862 | 862 | $groupManager = self::$server->query(\OCP\IGroupManager::class); |
| 863 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OCP\IGroup $group) { |
|
| 863 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OCP\IGroup $group) { |
|
| 864 | 864 | $appManager = self::$server->getAppManager(); |
| 865 | 865 | $apps = $appManager->getEnabledAppsForGroup($group); |
| 866 | 866 | foreach ($apps as $appId) { |
@@ -970,11 +970,11 @@ discard block |
||
| 970 | 970 | // emergency app disabling |
| 971 | 971 | if ($requestPath === '/disableapp' |
| 972 | 972 | && $request->getMethod() === 'POST' |
| 973 | - && ((array)$request->getParam('appid')) !== '' |
|
| 973 | + && ((array) $request->getParam('appid')) !== '' |
|
| 974 | 974 | ) { |
| 975 | 975 | \OC_JSON::callCheck(); |
| 976 | 976 | \OC_JSON::checkAdminUser(); |
| 977 | - $appIds = (array)$request->getParam('appid'); |
|
| 977 | + $appIds = (array) $request->getParam('appid'); |
|
| 978 | 978 | foreach ($appIds as $appId) { |
| 979 | 979 | $appId = \OC_App::cleanAppId($appId); |
| 980 | 980 | \OC::$server->getAppManager()->disableApp($appId); |
@@ -1035,10 +1035,10 @@ discard block |
||
| 1035 | 1035 | OC_App::loadApps(); |
| 1036 | 1036 | OC_User::setupBackends(); |
| 1037 | 1037 | OC_Util::setupFS(); |
| 1038 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToDefaultPageUrl()); |
|
| 1038 | + header('Location: '.\OC::$server->getURLGenerator()->linkToDefaultPageUrl()); |
|
| 1039 | 1039 | } else { |
| 1040 | 1040 | // Not handled and not logged in |
| 1041 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRouteAbsolute('core.login.showLoginForm')); |
|
| 1041 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute('core.login.showLoginForm')); |
|
| 1042 | 1042 | } |
| 1043 | 1043 | } |
| 1044 | 1044 | |