@@ -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 | } |
@@ -388,14 +388,14 @@ discard block |
||
| 388 | 388 | $incompatibleShippedApps = []; |
| 389 | 389 | foreach ($incompatibleApps as $appInfo) { |
| 390 | 390 | if ($appManager->isShipped($appInfo['id'])) { |
| 391 | - $incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')'; |
|
| 391 | + $incompatibleShippedApps[] = $appInfo['name'].' ('.$appInfo['id'].')'; |
|
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | if (!empty($incompatibleShippedApps)) { |
| 396 | 396 | $l = \OC::$server->getL10N('core'); |
| 397 | 397 | $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)]); |
| 398 | - 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 | + 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); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion)); |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | ini_set('session.cookie_httponly', 'true'); |
| 415 | 415 | |
| 416 | 416 | // set the cookie path to the Nextcloud directory |
| 417 | - $cookie_path = OC::$WEBROOT ? : '/'; |
|
| 417 | + $cookie_path = OC::$WEBROOT ?: '/'; |
|
| 418 | 418 | ini_set('session.cookie_path', $cookie_path); |
| 419 | 419 | |
| 420 | 420 | // Let the session name be changed in the initSession Hook |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | // session timeout |
| 442 | 442 | if ($session->exists('LAST_ACTIVITY') && (time() - $session->get('LAST_ACTIVITY') > $sessionLifeTime)) { |
| 443 | 443 | if (isset($_COOKIE[session_name()])) { |
| 444 | - setcookie(session_name(), '', -1, self::$WEBROOT ? : '/'); |
|
| 444 | + setcookie(session_name(), '', -1, self::$WEBROOT ?: '/'); |
|
| 445 | 445 | } |
| 446 | 446 | \OC::$server->getUserSession()->logout(); |
| 447 | 447 | } |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | foreach ($policies as $policy) { |
| 485 | 485 | header( |
| 486 | 486 | sprintf( |
| 487 | - 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;' . $secureCookie . 'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
| 487 | + 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;'.$secureCookie.'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
| 488 | 488 | $cookiePrefix, |
| 489 | 489 | $policy, |
| 490 | 490 | $cookieParams['path'], |
@@ -558,12 +558,12 @@ discard block |
||
| 558 | 558 | |
| 559 | 559 | // register autoloader |
| 560 | 560 | $loaderStart = microtime(true); |
| 561 | - require_once __DIR__ . '/autoloader.php'; |
|
| 561 | + require_once __DIR__.'/autoloader.php'; |
|
| 562 | 562 | self::$loader = new \OC\Autoloader([ |
| 563 | - OC::$SERVERROOT . '/lib/private/legacy', |
|
| 563 | + OC::$SERVERROOT.'/lib/private/legacy', |
|
| 564 | 564 | ]); |
| 565 | 565 | if (defined('PHPUNIT_RUN')) { |
| 566 | - self::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); |
|
| 566 | + self::$loader->addValidRoot(OC::$SERVERROOT.'/tests'); |
|
| 567 | 567 | } |
| 568 | 568 | spl_autoload_register([self::$loader, 'load']); |
| 569 | 569 | $loaderEnd = microtime(true); |
@@ -571,12 +571,12 @@ discard block |
||
| 571 | 571 | self::$CLI = (php_sapi_name() == 'cli'); |
| 572 | 572 | |
| 573 | 573 | // Add default composer PSR-4 autoloader |
| 574 | - self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php'; |
|
| 574 | + self::$composerAutoloader = require_once OC::$SERVERROOT.'/lib/composer/autoload.php'; |
|
| 575 | 575 | |
| 576 | 576 | try { |
| 577 | 577 | self::initPaths(); |
| 578 | 578 | // setup 3rdparty autoloader |
| 579 | - $vendorAutoLoad = OC::$SERVERROOT. '/3rdparty/autoload.php'; |
|
| 579 | + $vendorAutoLoad = OC::$SERVERROOT.'/3rdparty/autoload.php'; |
|
| 580 | 580 | if (!file_exists($vendorAutoLoad)) { |
| 581 | 581 | 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".'); |
| 582 | 582 | } |
@@ -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 | $systemConfig = \OC::$server->getSystemConfig(); |
| 701 | 701 | |
@@ -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(); |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | private static function registerAppRestrictionsHooks() { |
| 862 | 862 | /** @var \OC\Group\Manager $groupManager */ |
| 863 | 863 | $groupManager = self::$server->query(\OCP\IGroupManager::class); |
| 864 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OCP\IGroup $group) { |
|
| 864 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OCP\IGroup $group) { |
|
| 865 | 865 | $appManager = self::$server->getAppManager(); |
| 866 | 866 | $apps = $appManager->getEnabledAppsForGroup($group); |
| 867 | 867 | foreach ($apps as $appId) { |
@@ -971,11 +971,11 @@ discard block |
||
| 971 | 971 | // emergency app disabling |
| 972 | 972 | if ($requestPath === '/disableapp' |
| 973 | 973 | && $request->getMethod() === 'POST' |
| 974 | - && ((array)$request->getParam('appid')) !== '' |
|
| 974 | + && ((array) $request->getParam('appid')) !== '' |
|
| 975 | 975 | ) { |
| 976 | 976 | \OC_JSON::callCheck(); |
| 977 | 977 | \OC_JSON::checkAdminUser(); |
| 978 | - $appIds = (array)$request->getParam('appid'); |
|
| 978 | + $appIds = (array) $request->getParam('appid'); |
|
| 979 | 979 | foreach ($appIds as $appId) { |
| 980 | 980 | $appId = \OC_App::cleanAppId($appId); |
| 981 | 981 | \OC::$server->getAppManager()->disableApp($appId); |