@@ -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,8 +209,8 @@ 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]; |
|
212 | + } elseif (file_exists(OC::$SERVERROOT.'/apps')) { |
|
213 | + OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT.'/apps', 'url' => '/apps', 'writable' => true]; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | if (empty(OC::$APPSROOTS)) { |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $l = \OC::$server->getL10N('lib'); |
237 | 237 | |
238 | 238 | // Create config if it does not already exist |
239 | - $configFilePath = self::$configDir .'/config.php'; |
|
239 | + $configFilePath = self::$configDir.'/config.php'; |
|
240 | 240 | if (!file_exists($configFilePath)) { |
241 | 241 | @touch($configFilePath); |
242 | 242 | } |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | echo $l->t('This can usually be fixed by giving the webserver write access to the config directory.')."\n"; |
253 | 253 | echo "\n"; |
254 | 254 | 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"; |
255 | - echo $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ])."\n"; |
|
255 | + echo $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')])."\n"; |
|
256 | 256 | exit; |
257 | 257 | } else { |
258 | 258 | OC_Template::printErrorPage( |
259 | 259 | $l->t('Cannot write into "config" directory!'), |
260 | - $l->t('This can usually be fixed by giving the webserver write access to the config directory.') . ' ' |
|
261 | - . $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.') . ' ' |
|
262 | - . $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ]), |
|
260 | + $l->t('This can usually be fixed by giving the webserver write access to the config directory.').' ' |
|
261 | + . $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.').' ' |
|
262 | + . $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')]), |
|
263 | 263 | 503 |
264 | 264 | ); |
265 | 265 | } |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | if (OC::$CLI) { |
276 | 276 | throw new Exception('Not installed'); |
277 | 277 | } else { |
278 | - $url = OC::$WEBROOT . '/index.php'; |
|
279 | - header('Location: ' . $url); |
|
278 | + $url = OC::$WEBROOT.'/index.php'; |
|
279 | + header('Location: '.$url); |
|
280 | 280 | } |
281 | 281 | exit(); |
282 | 282 | } |
@@ -380,14 +380,14 @@ discard block |
||
380 | 380 | $incompatibleShippedApps = []; |
381 | 381 | foreach ($incompatibleApps as $appInfo) { |
382 | 382 | if ($appManager->isShipped($appInfo['id'])) { |
383 | - $incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')'; |
|
383 | + $incompatibleShippedApps[] = $appInfo['name'].' ('.$appInfo['id'].')'; |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
387 | 387 | if (!empty($incompatibleShippedApps)) { |
388 | 388 | $l = \OC::$server->getL10N('core'); |
389 | 389 | $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)]); |
390 | - 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); |
|
390 | + 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); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion)); |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | ini_set('session.cookie_httponly', 'true'); |
412 | 412 | |
413 | 413 | // set the cookie path to the Nextcloud directory |
414 | - $cookie_path = OC::$WEBROOT ? : '/'; |
|
414 | + $cookie_path = OC::$WEBROOT ?: '/'; |
|
415 | 415 | ini_set('session.cookie_path', $cookie_path); |
416 | 416 | |
417 | 417 | // Let the session name be changed in the initSession Hook |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | // session timeout |
439 | 439 | if ($session->exists('LAST_ACTIVITY') && (time() - $session->get('LAST_ACTIVITY') > $sessionLifeTime)) { |
440 | 440 | if (isset($_COOKIE[session_name()])) { |
441 | - setcookie(session_name(), '', -1, self::$WEBROOT ? : '/'); |
|
441 | + setcookie(session_name(), '', -1, self::$WEBROOT ?: '/'); |
|
442 | 442 | } |
443 | 443 | \OC::$server->getUserSession()->logout(); |
444 | 444 | } |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | foreach ($policies as $policy) { |
482 | 482 | header( |
483 | 483 | sprintf( |
484 | - 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;' . $secureCookie . 'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
484 | + 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;'.$secureCookie.'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
485 | 485 | $cookiePrefix, |
486 | 486 | $policy, |
487 | 487 | $cookieParams['path'], |
@@ -555,12 +555,12 @@ discard block |
||
555 | 555 | |
556 | 556 | // register autoloader |
557 | 557 | $loaderStart = microtime(true); |
558 | - require_once __DIR__ . '/autoloader.php'; |
|
558 | + require_once __DIR__.'/autoloader.php'; |
|
559 | 559 | self::$loader = new \OC\Autoloader([ |
560 | - OC::$SERVERROOT . '/lib/private/legacy', |
|
560 | + OC::$SERVERROOT.'/lib/private/legacy', |
|
561 | 561 | ]); |
562 | 562 | if (defined('PHPUNIT_RUN')) { |
563 | - self::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); |
|
563 | + self::$loader->addValidRoot(OC::$SERVERROOT.'/tests'); |
|
564 | 564 | } |
565 | 565 | spl_autoload_register([self::$loader, 'load']); |
566 | 566 | $loaderEnd = microtime(true); |
@@ -568,12 +568,12 @@ discard block |
||
568 | 568 | self::$CLI = (php_sapi_name() == 'cli'); |
569 | 569 | |
570 | 570 | // Add default composer PSR-4 autoloader |
571 | - self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php'; |
|
571 | + self::$composerAutoloader = require_once OC::$SERVERROOT.'/lib/composer/autoload.php'; |
|
572 | 572 | |
573 | 573 | try { |
574 | 574 | self::initPaths(); |
575 | 575 | // setup 3rdparty autoloader |
576 | - $vendorAutoLoad = OC::$SERVERROOT. '/3rdparty/autoload.php'; |
|
576 | + $vendorAutoLoad = OC::$SERVERROOT.'/3rdparty/autoload.php'; |
|
577 | 577 | if (!file_exists($vendorAutoLoad)) { |
578 | 578 | 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".'); |
579 | 579 | } |
@@ -669,11 +669,11 @@ discard block |
||
669 | 669 | // Convert l10n string into regular string for usage in database |
670 | 670 | $staticErrors = []; |
671 | 671 | foreach ($errors as $error) { |
672 | - echo $error['error'] . "\n"; |
|
673 | - echo $error['hint'] . "\n\n"; |
|
672 | + echo $error['error']."\n"; |
|
673 | + echo $error['hint']."\n\n"; |
|
674 | 674 | $staticErrors[] = [ |
675 | - 'error' => (string)$error['error'], |
|
676 | - 'hint' => (string)$error['hint'], |
|
675 | + 'error' => (string) $error['error'], |
|
676 | + 'hint' => (string) $error['hint'], |
|
677 | 677 | ]; |
678 | 678 | } |
679 | 679 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | } |
690 | 690 | //try to set the session lifetime |
691 | 691 | $sessionLifeTime = self::getSessionLifeTime(); |
692 | - @ini_set('gc_maxlifetime', (string)$sessionLifeTime); |
|
692 | + @ini_set('gc_maxlifetime', (string) $sessionLifeTime); |
|
693 | 693 | |
694 | 694 | // User and Groups |
695 | 695 | if (!$systemConfig->getValue("installed", false)) { |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | |
800 | 800 | // NOTE: This will be replaced to use OCP |
801 | 801 | $userSession = self::$server->getUserSession(); |
802 | - $userSession->listen('\OC\User', 'postLogin', function () use ($userSession) { |
|
802 | + $userSession->listen('\OC\User', 'postLogin', function() use ($userSession) { |
|
803 | 803 | if (!defined('PHPUNIT_RUN') && $userSession->isLoggedIn()) { |
804 | 804 | // reset brute force delay for this IP address and username |
805 | 805 | $uid = \OC::$server->getUserSession()->getUser()->getUID(); |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | private static function registerAppRestrictionsHooks() { |
851 | 851 | /** @var \OC\Group\Manager $groupManager */ |
852 | 852 | $groupManager = self::$server->query(\OCP\IGroupManager::class); |
853 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OCP\IGroup $group) { |
|
853 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OCP\IGroup $group) { |
|
854 | 854 | $appManager = self::$server->getAppManager(); |
855 | 855 | $apps = $appManager->getEnabledAppsForGroup($group); |
856 | 856 | foreach ($apps as $appId) { |
@@ -960,11 +960,11 @@ discard block |
||
960 | 960 | // emergency app disabling |
961 | 961 | if ($requestPath === '/disableapp' |
962 | 962 | && $request->getMethod() === 'POST' |
963 | - && ((array)$request->getParam('appid')) !== '' |
|
963 | + && ((array) $request->getParam('appid')) !== '' |
|
964 | 964 | ) { |
965 | 965 | \OC_JSON::callCheck(); |
966 | 966 | \OC_JSON::checkAdminUser(); |
967 | - $appIds = (array)$request->getParam('appid'); |
|
967 | + $appIds = (array) $request->getParam('appid'); |
|
968 | 968 | foreach ($appIds as $appId) { |
969 | 969 | $appId = \OC_App::cleanAppId($appId); |
970 | 970 | \OC::$server->getAppManager()->disableApp($appId); |