@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public static function initPaths() { |
| 140 | 140 | if (defined('PHPUNIT_CONFIG_DIR')) { |
| 141 | - self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/'; |
|
| 142 | - } elseif (defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT . '/tests/config/')) { |
|
| 143 | - self::$configDir = OC::$SERVERROOT . '/tests/config/'; |
|
| 141 | + self::$configDir = OC::$SERVERROOT.'/'.PHPUNIT_CONFIG_DIR.'/'; |
|
| 142 | + } elseif (defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT.'/tests/config/')) { |
|
| 143 | + self::$configDir = OC::$SERVERROOT.'/tests/config/'; |
|
| 144 | 144 | } elseif ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { |
| 145 | - self::$configDir = rtrim($dir, '/') . '/'; |
|
| 145 | + self::$configDir = rtrim($dir, '/').'/'; |
|
| 146 | 146 | } else { |
| 147 | - self::$configDir = OC::$SERVERROOT . '/config/'; |
|
| 147 | + self::$configDir = OC::$SERVERROOT.'/config/'; |
|
| 148 | 148 | } |
| 149 | 149 | self::$config = new \OC\Config(self::$configDir); |
| 150 | 150 | |
@@ -166,9 +166,9 @@ discard block |
||
| 166 | 166 | //make sure suburi follows the same rules as scriptName |
| 167 | 167 | if (substr(OC::$SUBURI, -9) != 'index.php') { |
| 168 | 168 | if (substr(OC::$SUBURI, -1) != '/') { |
| 169 | - OC::$SUBURI = OC::$SUBURI . '/'; |
|
| 169 | + OC::$SUBURI = OC::$SUBURI.'/'; |
|
| 170 | 170 | } |
| 171 | - OC::$SUBURI = OC::$SUBURI . 'index.php'; |
|
| 171 | + OC::$SUBURI = OC::$SUBURI.'index.php'; |
|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI)); |
| 181 | 181 | |
| 182 | 182 | if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') { |
| 183 | - OC::$WEBROOT = '/' . OC::$WEBROOT; |
|
| 183 | + OC::$WEBROOT = '/'.OC::$WEBROOT; |
|
| 184 | 184 | } |
| 185 | 185 | } else { |
| 186 | 186 | // The scriptName is not ending with OC::$SUBURI |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | OC::$APPSROOTS[] = $paths; |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | - } elseif (file_exists(OC::$SERVERROOT . '/apps')) { |
|
| 213 | - OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT . '/apps', 'url' => '/apps', 'writable' => true]; |
|
| 214 | - } elseif (file_exists(OC::$SERVERROOT . '/../apps')) { |
|
| 212 | + } elseif (file_exists(OC::$SERVERROOT.'/apps')) { |
|
| 213 | + OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT.'/apps', 'url' => '/apps', 'writable' => true]; |
|
| 214 | + } elseif (file_exists(OC::$SERVERROOT.'/../apps')) { |
|
| 215 | 215 | OC::$APPSROOTS[] = [ |
| 216 | - 'path' => rtrim(dirname(OC::$SERVERROOT), '/') . '/apps', |
|
| 216 | + 'path' => rtrim(dirname(OC::$SERVERROOT), '/').'/apps', |
|
| 217 | 217 | 'url' => '/apps', |
| 218 | 218 | 'writable' => true |
| 219 | 219 | ]; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $l = \OC::$server->getL10N('lib'); |
| 244 | 244 | |
| 245 | 245 | // Create config if it does not already exist |
| 246 | - $configFilePath = self::$configDir .'/config.php'; |
|
| 246 | + $configFilePath = self::$configDir.'/config.php'; |
|
| 247 | 247 | if (!file_exists($configFilePath)) { |
| 248 | 248 | @touch($configFilePath); |
| 249 | 249 | } |
@@ -259,14 +259,14 @@ discard block |
||
| 259 | 259 | echo $l->t('This can usually be fixed by giving the webserver write access to the config directory')."\n"; |
| 260 | 260 | echo "\n"; |
| 261 | 261 | echo $l->t('Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.')."\n"; |
| 262 | - echo $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ])."\n"; |
|
| 262 | + echo $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')])."\n"; |
|
| 263 | 263 | exit; |
| 264 | 264 | } else { |
| 265 | 265 | OC_Template::printErrorPage( |
| 266 | 266 | $l->t('Cannot write into "config" directory!'), |
| 267 | - $l->t('This can usually be fixed by giving the webserver write access to the config directory.') . '. ' |
|
| 267 | + $l->t('This can usually be fixed by giving the webserver write access to the config directory.').'. ' |
|
| 268 | 268 | . $l->t('Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it. See %s', |
| 269 | - [ $urlGenerator->linkToDocs('admin-config') ]), |
|
| 269 | + [$urlGenerator->linkToDocs('admin-config')]), |
|
| 270 | 270 | 503 |
| 271 | 271 | ); |
| 272 | 272 | } |
@@ -282,8 +282,8 @@ discard block |
||
| 282 | 282 | if (OC::$CLI) { |
| 283 | 283 | throw new Exception('Not installed'); |
| 284 | 284 | } else { |
| 285 | - $url = OC::$WEBROOT . '/index.php'; |
|
| 286 | - header('Location: ' . $url); |
|
| 285 | + $url = OC::$WEBROOT.'/index.php'; |
|
| 286 | + header('Location: '.$url); |
|
| 287 | 287 | } |
| 288 | 288 | exit(); |
| 289 | 289 | } |
@@ -387,14 +387,14 @@ discard block |
||
| 387 | 387 | $incompatibleShippedApps = []; |
| 388 | 388 | foreach ($incompatibleApps as $appInfo) { |
| 389 | 389 | if ($appManager->isShipped($appInfo['id'])) { |
| 390 | - $incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')'; |
|
| 390 | + $incompatibleShippedApps[] = $appInfo['name'].' ('.$appInfo['id'].')'; |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | if (!empty($incompatibleShippedApps)) { |
| 395 | 395 | $l = \OC::$server->getL10N('core'); |
| 396 | 396 | $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)]); |
| 397 | - throw new \OC\HintException('The files of the app ' . implode(', ', $incompatibleShippedApps) . ' were not replaced correctly. Make sure it is a version compatible with the server.', $hint); |
|
| 397 | + throw new \OC\HintException('The files of the app '.implode(', ', $incompatibleShippedApps).' were not replaced correctly. Make sure it is a version compatible with the server.', $hint); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion)); |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | ini_set('session.cookie_httponly', 'true'); |
| 414 | 414 | |
| 415 | 415 | // set the cookie path to the Nextcloud directory |
| 416 | - $cookie_path = OC::$WEBROOT ? : '/'; |
|
| 416 | + $cookie_path = OC::$WEBROOT ?: '/'; |
|
| 417 | 417 | ini_set('session.cookie_path', $cookie_path); |
| 418 | 418 | |
| 419 | 419 | // Let the session name be changed in the initSession Hook |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | // session timeout |
| 441 | 441 | if ($session->exists('LAST_ACTIVITY') && (time() - $session->get('LAST_ACTIVITY') > $sessionLifeTime)) { |
| 442 | 442 | if (isset($_COOKIE[session_name()])) { |
| 443 | - setcookie(session_name(), '', -1, self::$WEBROOT ? : '/'); |
|
| 443 | + setcookie(session_name(), '', -1, self::$WEBROOT ?: '/'); |
|
| 444 | 444 | } |
| 445 | 445 | \OC::$server->getUserSession()->logout(); |
| 446 | 446 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | foreach ($policies as $policy) { |
| 484 | 484 | header( |
| 485 | 485 | sprintf( |
| 486 | - 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;' . $secureCookie . 'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
| 486 | + 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;'.$secureCookie.'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
| 487 | 487 | $cookiePrefix, |
| 488 | 488 | $policy, |
| 489 | 489 | $cookieParams['path'], |
@@ -557,12 +557,12 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | // register autoloader |
| 559 | 559 | $loaderStart = microtime(true); |
| 560 | - require_once __DIR__ . '/autoloader.php'; |
|
| 560 | + require_once __DIR__.'/autoloader.php'; |
|
| 561 | 561 | self::$loader = new \OC\Autoloader([ |
| 562 | - OC::$SERVERROOT . '/lib/private/legacy', |
|
| 562 | + OC::$SERVERROOT.'/lib/private/legacy', |
|
| 563 | 563 | ]); |
| 564 | 564 | if (defined('PHPUNIT_RUN')) { |
| 565 | - self::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); |
|
| 565 | + self::$loader->addValidRoot(OC::$SERVERROOT.'/tests'); |
|
| 566 | 566 | } |
| 567 | 567 | spl_autoload_register([self::$loader, 'load']); |
| 568 | 568 | $loaderEnd = microtime(true); |
@@ -570,12 +570,12 @@ discard block |
||
| 570 | 570 | self::$CLI = (php_sapi_name() == 'cli'); |
| 571 | 571 | |
| 572 | 572 | // Add default composer PSR-4 autoloader |
| 573 | - self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php'; |
|
| 573 | + self::$composerAutoloader = require_once OC::$SERVERROOT.'/lib/composer/autoload.php'; |
|
| 574 | 574 | |
| 575 | 575 | try { |
| 576 | 576 | self::initPaths(); |
| 577 | 577 | // setup 3rdparty autoloader |
| 578 | - $vendorAutoLoad = OC::$SERVERROOT. '/3rdparty/autoload.php'; |
|
| 578 | + $vendorAutoLoad = OC::$SERVERROOT.'/3rdparty/autoload.php'; |
|
| 579 | 579 | if (!file_exists($vendorAutoLoad)) { |
| 580 | 580 | 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".'); |
| 581 | 581 | } |
@@ -671,11 +671,11 @@ discard block |
||
| 671 | 671 | // Convert l10n string into regular string for usage in database |
| 672 | 672 | $staticErrors = []; |
| 673 | 673 | foreach ($errors as $error) { |
| 674 | - echo $error['error'] . "\n"; |
|
| 675 | - echo $error['hint'] . "\n\n"; |
|
| 674 | + echo $error['error']."\n"; |
|
| 675 | + echo $error['hint']."\n\n"; |
|
| 676 | 676 | $staticErrors[] = [ |
| 677 | - 'error' => (string)$error['error'], |
|
| 678 | - 'hint' => (string)$error['hint'], |
|
| 677 | + 'error' => (string) $error['error'], |
|
| 678 | + 'hint' => (string) $error['hint'], |
|
| 679 | 679 | ]; |
| 680 | 680 | } |
| 681 | 681 | |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | } |
| 692 | 692 | //try to set the session lifetime |
| 693 | 693 | $sessionLifeTime = self::getSessionLifeTime(); |
| 694 | - @ini_set('gc_maxlifetime', (string)$sessionLifeTime); |
|
| 694 | + @ini_set('gc_maxlifetime', (string) $sessionLifeTime); |
|
| 695 | 695 | |
| 696 | 696 | // User and Groups |
| 697 | 697 | if (!$systemConfig->getValue("installed", false)) { |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | |
| 802 | 802 | // NOTE: This will be replaced to use OCP |
| 803 | 803 | $userSession = self::$server->getUserSession(); |
| 804 | - $userSession->listen('\OC\User', 'postLogin', function () use ($userSession) { |
|
| 804 | + $userSession->listen('\OC\User', 'postLogin', function() use ($userSession) { |
|
| 805 | 805 | if (!defined('PHPUNIT_RUN') && $userSession->isLoggedIn()) { |
| 806 | 806 | // reset brute force delay for this IP address and username |
| 807 | 807 | $uid = \OC::$server->getUserSession()->getUser()->getUID(); |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | private static function registerAppRestrictionsHooks() { |
| 853 | 853 | /** @var \OC\Group\Manager $groupManager */ |
| 854 | 854 | $groupManager = self::$server->query(\OCP\IGroupManager::class); |
| 855 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OCP\IGroup $group) { |
|
| 855 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OCP\IGroup $group) { |
|
| 856 | 856 | $appManager = self::$server->getAppManager(); |
| 857 | 857 | $apps = $appManager->getEnabledAppsForGroup($group); |
| 858 | 858 | foreach ($apps as $appId) { |
@@ -962,11 +962,11 @@ discard block |
||
| 962 | 962 | // emergency app disabling |
| 963 | 963 | if ($requestPath === '/disableapp' |
| 964 | 964 | && $request->getMethod() === 'POST' |
| 965 | - && ((array)$request->getParam('appid')) !== '' |
|
| 965 | + && ((array) $request->getParam('appid')) !== '' |
|
| 966 | 966 | ) { |
| 967 | 967 | \OC_JSON::callCheck(); |
| 968 | 968 | \OC_JSON::checkAdminUser(); |
| 969 | - $appIds = (array)$request->getParam('appid'); |
|
| 969 | + $appIds = (array) $request->getParam('appid'); |
|
| 970 | 970 | foreach ($appIds as $appId) { |
| 971 | 971 | $appId = \OC_App::cleanAppId($appId); |
| 972 | 972 | \OC::$server->getAppManager()->disableApp($appId); |