@@ -119,9 +119,9 @@ |
||
| 119 | 119 | $elements = explode(' ', $fullName); |
| 120 | 120 | $result = ['', '', '', '', '']; |
| 121 | 121 | if (count($elements) > 2) { |
| 122 | - $result[0] = implode(' ', array_slice($elements, count($elements)-1)); |
|
| 122 | + $result[0] = implode(' ', array_slice($elements, count($elements) - 1)); |
|
| 123 | 123 | $result[1] = $elements[0]; |
| 124 | - $result[2] = implode(' ', array_slice($elements, 1, count($elements)-2)); |
|
| 124 | + $result[2] = implode(' ', array_slice($elements, 1, count($elements) - 2)); |
|
| 125 | 125 | } elseif (count($elements) === 2) { |
| 126 | 126 | $result[0] = $elements[1]; |
| 127 | 127 | $result[1] = $elements[0]; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | if ($ex->getCode() === Http::STATUS_UNAUTHORIZED) { |
| 100 | 100 | // remote server revoked access to the address book, remove it |
| 101 | 101 | $this->backend->deleteAddressBook($addressBookId); |
| 102 | - $this->logger->info('Authorization failed, remove address book: ' . $url, ['app' => 'dav']); |
|
| 102 | + $this->logger->info('Authorization failed, remove address book: '.$url, ['app' => 'dav']); |
|
| 103 | 103 | throw $ex; |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | protected function getClient($url, $userName, $sharedSecret) { |
| 151 | 151 | $settings = [ |
| 152 | - 'baseUri' => $url . '/', |
|
| 152 | + 'baseUri' => $url.'/', |
|
| 153 | 153 | 'userName' => $userName, |
| 154 | 154 | 'password' => $sharedSecret, |
| 155 | 155 | ]; |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | public function deleteUser($userOrCardId) { |
| 271 | 271 | $systemAddressBook = $this->getLocalSystemAddressBook(); |
| 272 | - if ($userOrCardId instanceof IUser){ |
|
| 272 | + if ($userOrCardId instanceof IUser) { |
|
| 273 | 273 | $name = $userOrCardId->getBackendClassName(); |
| 274 | 274 | $userId = $userOrCardId->getUID(); |
| 275 | 275 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | if (is_null($this->localSystemAddressBook)) { |
| 286 | 286 | $systemPrincipal = "principals/system/system"; |
| 287 | 287 | $this->localSystemAddressBook = $this->ensureSystemAddressBookExists($systemPrincipal, 'system', [ |
| 288 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => 'System addressbook which holds all users of this instance' |
|
| 288 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => 'System addressbook which holds all users of this instance' |
|
| 289 | 289 | ]); |
| 290 | 290 | } |
| 291 | 291 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | // remove no longer existing |
| 305 | 305 | $allCards = $this->backend->getCards($systemAddressBook['id']); |
| 306 | - foreach($allCards as $card) { |
|
| 306 | + foreach ($allCards as $card) { |
|
| 307 | 307 | $vCard = Reader::read($card['carddata']); |
| 308 | 308 | $uid = $vCard->UID->getValue(); |
| 309 | 309 | // load backend and see if user exists |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | private static function initLocalStorageRootFS() { |
| 78 | 78 | // mount local file backend as root |
| 79 | - $configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT . "/data"); |
|
| 79 | + $configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT."/data"); |
|
| 80 | 80 | //first set up the local "root" storage |
| 81 | 81 | \OC\Files\Filesystem::initMountManager(); |
| 82 | 82 | if (!self::$rootMounted) { |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | \OC\Files\Filesystem::initMountManager(); |
| 155 | 155 | |
| 156 | 156 | \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false); |
| 157 | - \OC\Files\Filesystem::addStorageWrapper('mount_options', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 157 | + \OC\Files\Filesystem::addStorageWrapper('mount_options', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 158 | 158 | if ($storage->instanceOfStorage('\OC\Files\Storage\Common')) { |
| 159 | 159 | /** @var \OC\Files\Storage\Common $storage */ |
| 160 | 160 | $storage->setMountOptions($mount->getOptions()); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | return $storage; |
| 163 | 163 | }); |
| 164 | 164 | |
| 165 | - \OC\Files\Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 165 | + \OC\Files\Filesystem::addStorageWrapper('enable_sharing', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 166 | 166 | if (!$mount->getOption('enable_sharing', true)) { |
| 167 | 167 | return new \OC\Files\Storage\Wrapper\PermissionsMask([ |
| 168 | 168 | 'storage' => $storage, |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | }); |
| 174 | 174 | |
| 175 | 175 | // install storage availability wrapper, before most other wrappers |
| 176 | - \OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) { |
|
| 176 | + \OC\Files\Filesystem::addStorageWrapper('oc_availability', function($mountPoint, $storage) { |
|
| 177 | 177 | if (!$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { |
| 178 | 178 | return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]); |
| 179 | 179 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | }); |
| 182 | 182 | |
| 183 | 183 | // install storage checksum wrapper |
| 184 | - \OC\Files\Filesystem::addStorageWrapper('oc_checksum', function ($mountPoint, \OCP\Files\Storage\IStorage $storage) { |
|
| 184 | + \OC\Files\Filesystem::addStorageWrapper('oc_checksum', function($mountPoint, \OCP\Files\Storage\IStorage $storage) { |
|
| 185 | 185 | if (!$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) { |
| 186 | 186 | return new \OC\Files\Storage\Wrapper\Checksum(['storage' => $storage]); |
| 187 | 187 | } |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | }, 1); |
| 192 | 192 | |
| 193 | 193 | |
| 194 | - \OC\Files\Filesystem::addStorageWrapper('oc_encoding', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 194 | + \OC\Files\Filesystem::addStorageWrapper('oc_encoding', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 195 | 195 | if ($mount->getOption('encoding_compatibility', false) && !$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { |
| 196 | 196 | return new \OC\Files\Storage\Wrapper\Encoding(['storage' => $storage]); |
| 197 | 197 | } |
| 198 | 198 | return $storage; |
| 199 | 199 | }); |
| 200 | 200 | |
| 201 | - \OC\Files\Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) { |
|
| 201 | + \OC\Files\Filesystem::addStorageWrapper('oc_quota', function($mountPoint, $storage) { |
|
| 202 | 202 | // set up quota for home storages, even for other users |
| 203 | 203 | // which can happen when using sharing |
| 204 | 204 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | //if we aren't logged in, there is no use to set up the filesystem |
| 241 | 241 | if ($user != "") { |
| 242 | 242 | |
| 243 | - $userDir = '/' . $user . '/files'; |
|
| 243 | + $userDir = '/'.$user.'/files'; |
|
| 244 | 244 | |
| 245 | 245 | //jail the user into his "home" directory |
| 246 | 246 | \OC\Files\Filesystem::init($user, $userDir); |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | return \OCP\Files\FileInfo::SPACE_UNLIMITED; |
| 320 | 320 | } |
| 321 | 321 | $userQuota = $user->getQuota(); |
| 322 | - if($userQuota === 'none') { |
|
| 322 | + if ($userQuota === 'none') { |
|
| 323 | 323 | return \OCP\Files\FileInfo::SPACE_UNLIMITED; |
| 324 | 324 | } |
| 325 | 325 | return OC_Helper::computerFileSize($userQuota); |
@@ -334,15 +334,15 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public static function copySkeleton($userId, \OCP\Files\Folder $userDirectory) { |
| 336 | 336 | |
| 337 | - $skeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton'); |
|
| 337 | + $skeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT.'/core/skeleton'); |
|
| 338 | 338 | $instanceId = \OC::$server->getConfig()->getSystemValue('instanceid', ''); |
| 339 | 339 | |
| 340 | 340 | if ($instanceId === null) { |
| 341 | 341 | throw new \RuntimeException('no instance id!'); |
| 342 | 342 | } |
| 343 | - $appdata = 'appdata_' . $instanceId; |
|
| 343 | + $appdata = 'appdata_'.$instanceId; |
|
| 344 | 344 | if ($userId === $appdata) { |
| 345 | - throw new \RuntimeException('username is reserved name: ' . $appdata); |
|
| 345 | + throw new \RuntimeException('username is reserved name: '.$appdata); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | if (!empty($skeletonDirectory)) { |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | |
| 370 | 370 | // Verify if folder exists |
| 371 | 371 | $dir = opendir($source); |
| 372 | - if($dir === false) { |
|
| 372 | + if ($dir === false) { |
|
| 373 | 373 | $logger->error(sprintf('Could not opendir "%s"', $source), ['app' => 'core']); |
| 374 | 374 | return; |
| 375 | 375 | } |
@@ -377,14 +377,14 @@ discard block |
||
| 377 | 377 | // Copy the files |
| 378 | 378 | while (false !== ($file = readdir($dir))) { |
| 379 | 379 | if (!\OC\Files\Filesystem::isIgnoredDir($file)) { |
| 380 | - if (is_dir($source . '/' . $file)) { |
|
| 380 | + if (is_dir($source.'/'.$file)) { |
|
| 381 | 381 | $child = $target->newFolder($file); |
| 382 | - self::copyr($source . '/' . $file, $child); |
|
| 382 | + self::copyr($source.'/'.$file, $child); |
|
| 383 | 383 | } else { |
| 384 | 384 | $child = $target->newFile($file); |
| 385 | - $sourceStream = fopen($source . '/' . $file, 'r'); |
|
| 386 | - if($sourceStream === false) { |
|
| 387 | - $logger->error(sprintf('Could not fopen "%s"', $source . '/' . $file), ['app' => 'core']); |
|
| 385 | + $sourceStream = fopen($source.'/'.$file, 'r'); |
|
| 386 | + if ($sourceStream === false) { |
|
| 387 | + $logger->error(sprintf('Could not fopen "%s"', $source.'/'.$file), ['app' => 'core']); |
|
| 388 | 388 | closedir($dir); |
| 389 | 389 | return; |
| 390 | 390 | } |
@@ -459,8 +459,8 @@ discard block |
||
| 459 | 459 | return; |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - $timestamp = filemtime(OC::$SERVERROOT . '/version.php'); |
|
| 463 | - require OC::$SERVERROOT . '/version.php'; |
|
| 462 | + $timestamp = filemtime(OC::$SERVERROOT.'/version.php'); |
|
| 463 | + require OC::$SERVERROOT.'/version.php'; |
|
| 464 | 464 | /** @var $timestamp int */ |
| 465 | 465 | self::$versionCache['OC_Version_Timestamp'] = $timestamp; |
| 466 | 466 | /** @var $OC_Version string */ |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | |
| 508 | 508 | // core js files need separate handling |
| 509 | 509 | if ($application !== 'core' && $file !== null) { |
| 510 | - self::addTranslations ( $application ); |
|
| 510 | + self::addTranslations($application); |
|
| 511 | 511 | } |
| 512 | 512 | self::addExternalResource($application, $prepend, $path, "script"); |
| 513 | 513 | } |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | if ($type === "style") { |
| 585 | 585 | if (!in_array($path, self::$styles)) { |
| 586 | 586 | if ($prepend === true) { |
| 587 | - array_unshift ( self::$styles, $path ); |
|
| 587 | + array_unshift(self::$styles, $path); |
|
| 588 | 588 | } else { |
| 589 | 589 | self::$styles[] = $path; |
| 590 | 590 | } |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | } elseif ($type === "script") { |
| 593 | 593 | if (!in_array($path, self::$scripts)) { |
| 594 | 594 | if ($prepend === true) { |
| 595 | - array_unshift ( self::$scripts, $path ); |
|
| 595 | + array_unshift(self::$scripts, $path); |
|
| 596 | 596 | } else { |
| 597 | 597 | self::$scripts [] = $path; |
| 598 | 598 | } |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | * @param array $attributes array of attributes for the element |
| 609 | 609 | * @param string $text the text content for the element |
| 610 | 610 | */ |
| 611 | - public static function addHeader($tag, $attributes, $text=null) { |
|
| 611 | + public static function addHeader($tag, $attributes, $text = null) { |
|
| 612 | 612 | self::$headers[] = array( |
| 613 | 613 | 'tag' => $tag, |
| 614 | 614 | 'attributes' => $attributes, |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | public static function checkServer(\OC\SystemConfig $config) { |
| 649 | 649 | $l = \OC::$server->getL10N('lib'); |
| 650 | 650 | $errors = array(); |
| 651 | - $CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT . '/data'); |
|
| 651 | + $CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT.'/data'); |
|
| 652 | 652 | |
| 653 | 653 | if (!self::needUpgrade($config) && $config->getValue('installed', false)) { |
| 654 | 654 | // this check needs to be done every time |
@@ -676,13 +676,13 @@ discard block |
||
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | // Check if config folder is writable. |
| 679 | - if(!OC_Helper::isReadOnlyConfigEnabled()) { |
|
| 679 | + if (!OC_Helper::isReadOnlyConfigEnabled()) { |
|
| 680 | 680 | if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) { |
| 681 | 681 | $errors[] = array( |
| 682 | 682 | 'error' => $l->t('Cannot write into "config" directory'), |
| 683 | 683 | 'hint' => $l->t('This can usually be fixed by ' |
| 684 | 684 | . '%sgiving the webserver write access to the config directory%s.', |
| 685 | - array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>')) |
|
| 685 | + array('<a href="'.$urlGenerator->linkToDocs('admin-dir_permissions').'" target="_blank" rel="noreferrer">', '</a>')) |
|
| 686 | 686 | ); |
| 687 | 687 | } |
| 688 | 688 | } |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | 'hint' => $l->t('This can usually be fixed by ' |
| 699 | 699 | . '%sgiving the webserver write access to the apps directory%s' |
| 700 | 700 | . ' or disabling the appstore in the config file.', |
| 701 | - array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>')) |
|
| 701 | + array('<a href="'.$urlGenerator->linkToDocs('admin-dir_permissions').'" target="_blank" rel="noreferrer">', '</a>')) |
|
| 702 | 702 | ); |
| 703 | 703 | } |
| 704 | 704 | } |
@@ -720,9 +720,9 @@ discard block |
||
| 720 | 720 | //common hint for all file permissions error messages |
| 721 | 721 | $permissionsHint = $l->t('Permissions can usually be fixed by ' |
| 722 | 722 | . '%sgiving the webserver write access to the root directory%s.', |
| 723 | - array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>')); |
|
| 723 | + array('<a href="'.$urlGenerator->linkToDocs('admin-dir_permissions').'" target="_blank" rel="noreferrer">', '</a>')); |
|
| 724 | 724 | $errors[] = array( |
| 725 | - 'error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable', |
|
| 725 | + 'error' => 'Data directory ('.$CONFIG_DATADIRECTORY.') not writable', |
|
| 726 | 726 | 'hint' => $permissionsHint |
| 727 | 727 | ); |
| 728 | 728 | } else { |
@@ -820,15 +820,15 @@ discard block |
||
| 820 | 820 | } |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | - foreach($missingDependencies as $missingDependency) { |
|
| 823 | + foreach ($missingDependencies as $missingDependency) { |
|
| 824 | 824 | $errors[] = array( |
| 825 | 825 | 'error' => $l->t('PHP module %s not installed.', array($missingDependency)), |
| 826 | 826 | 'hint' => $moduleHint |
| 827 | 827 | ); |
| 828 | 828 | $webServerRestart = true; |
| 829 | 829 | } |
| 830 | - foreach($invalidIniSettings as $setting) { |
|
| 831 | - if(is_bool($setting[1])) { |
|
| 830 | + foreach ($invalidIniSettings as $setting) { |
|
| 831 | + if (is_bool($setting[1])) { |
|
| 832 | 832 | $setting[1] = ($setting[1]) ? 'on' : 'off'; |
| 833 | 833 | } |
| 834 | 834 | $errors[] = [ |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | * TODO: Should probably be implemented in the above generic dependency |
| 847 | 847 | * check somehow in the long-term. |
| 848 | 848 | */ |
| 849 | - if($iniWrapper->getBool('mbstring.func_overload') !== null && |
|
| 849 | + if ($iniWrapper->getBool('mbstring.func_overload') !== null && |
|
| 850 | 850 | $iniWrapper->getBool('mbstring.func_overload') === true) { |
| 851 | 851 | $errors[] = array( |
| 852 | 852 | 'error' => $l->t('mbstring.func_overload is set to "%s" instead of the expected value "0"', [$iniWrapper->getString('mbstring.func_overload')]), |
@@ -854,16 +854,16 @@ discard block |
||
| 854 | 854 | ); |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | - if(function_exists('xml_parser_create') && |
|
| 858 | - LIBXML_LOADED_VERSION < 20700 ) { |
|
| 857 | + if (function_exists('xml_parser_create') && |
|
| 858 | + LIBXML_LOADED_VERSION < 20700) { |
|
| 859 | 859 | $version = LIBXML_LOADED_VERSION; |
| 860 | - $major = floor($version/10000); |
|
| 860 | + $major = floor($version / 10000); |
|
| 861 | 861 | $version -= ($major * 10000); |
| 862 | - $minor = floor($version/100); |
|
| 862 | + $minor = floor($version / 100); |
|
| 863 | 863 | $version -= ($minor * 100); |
| 864 | 864 | $patch = $version; |
| 865 | 865 | $errors[] = array( |
| 866 | - 'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major . '.' . $minor . '.' . $patch]), |
|
| 866 | + 'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major.'.'.$minor.'.'.$patch]), |
|
| 867 | 867 | 'hint' => $l->t('To fix this issue update your libxml2 version and restart your web server.') |
| 868 | 868 | ); |
| 869 | 869 | } |
@@ -964,10 +964,10 @@ discard block |
||
| 964 | 964 | 'hint' => $l->t('Check the value of "datadirectory" in your configuration') |
| 965 | 965 | ]; |
| 966 | 966 | } |
| 967 | - if (!file_exists($dataDirectory . '/.ocdata')) { |
|
| 967 | + if (!file_exists($dataDirectory.'/.ocdata')) { |
|
| 968 | 968 | $errors[] = [ |
| 969 | 969 | 'error' => $l->t('Data directory (%s) is invalid', [$dataDirectory]), |
| 970 | - 'hint' => $l->t('Please check that the data directory contains a file' . |
|
| 970 | + 'hint' => $l->t('Please check that the data directory contains a file'. |
|
| 971 | 971 | ' ".ocdata" in its root.') |
| 972 | 972 | ]; |
| 973 | 973 | } |
@@ -983,7 +983,7 @@ discard block |
||
| 983 | 983 | public static function checkLoggedIn() { |
| 984 | 984 | // Check if we are a user |
| 985 | 985 | if (!\OC::$server->getUserSession()->isLoggedIn()) { |
| 986 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute( |
|
| 986 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute( |
|
| 987 | 987 | 'core.login.showLoginForm', |
| 988 | 988 | [ |
| 989 | 989 | 'redirect_url' => \OC::$server->getRequest()->getRequestUri(), |
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | } |
| 995 | 995 | // Redirect to index page if 2FA challenge was not solved yet |
| 996 | 996 | if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { |
| 997 | - header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); |
|
| 997 | + header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php')); |
|
| 998 | 998 | exit(); |
| 999 | 999 | } |
| 1000 | 1000 | } |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | public static function checkAdminUser() { |
| 1008 | 1008 | OC_Util::checkLoggedIn(); |
| 1009 | 1009 | if (!OC_User::isAdminUser(OC_User::getUser())) { |
| 1010 | - header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); |
|
| 1010 | + header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php')); |
|
| 1011 | 1011 | exit(); |
| 1012 | 1012 | } |
| 1013 | 1013 | } |
@@ -1021,12 +1021,12 @@ discard block |
||
| 1021 | 1021 | OC_Util::checkLoggedIn(); |
| 1022 | 1022 | $userObject = \OC::$server->getUserSession()->getUser(); |
| 1023 | 1023 | $isSubAdmin = false; |
| 1024 | - if($userObject !== null) { |
|
| 1024 | + if ($userObject !== null) { |
|
| 1025 | 1025 | $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | if (!$isSubAdmin) { |
| 1029 | - header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); |
|
| 1029 | + header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php')); |
|
| 1030 | 1030 | exit(); |
| 1031 | 1031 | } |
| 1032 | 1032 | return true; |
@@ -1061,10 +1061,10 @@ discard block |
||
| 1061 | 1061 | } |
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | - if(\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') { |
|
| 1065 | - $location = $urlGenerator->getAbsoluteURL('/apps/' . $appId . '/'); |
|
| 1064 | + if (\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') { |
|
| 1065 | + $location = $urlGenerator->getAbsoluteURL('/apps/'.$appId.'/'); |
|
| 1066 | 1066 | } else { |
| 1067 | - $location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/'); |
|
| 1067 | + $location = $urlGenerator->getAbsoluteURL('/index.php/apps/'.$appId.'/'); |
|
| 1068 | 1068 | } |
| 1069 | 1069 | } |
| 1070 | 1070 | } |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | */ |
| 1079 | 1079 | public static function redirectToDefaultPage() { |
| 1080 | 1080 | $location = self::getDefaultPageUrl(); |
| 1081 | - header('Location: ' . $location); |
|
| 1081 | + header('Location: '.$location); |
|
| 1082 | 1082 | exit(); |
| 1083 | 1083 | } |
| 1084 | 1084 | |
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | $id = \OC::$server->getSystemConfig()->getValue('instanceid', null); |
| 1092 | 1092 | if (is_null($id)) { |
| 1093 | 1093 | // We need to guarantee at least one letter in instanceid so it can be used as the session_name |
| 1094 | - $id = 'oc' . \OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
| 1094 | + $id = 'oc'.\OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
| 1095 | 1095 | \OC::$server->getSystemConfig()->setValue('instanceid', $id); |
| 1096 | 1096 | } |
| 1097 | 1097 | return $id; |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | }, $value); |
| 1114 | 1114 | } else { |
| 1115 | 1115 | // Specify encoding for PHP<5.4 |
| 1116 | - $value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8'); |
|
| 1116 | + $value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8'); |
|
| 1117 | 1117 | } |
| 1118 | 1118 | return $value; |
| 1119 | 1119 | } |
@@ -1146,7 +1146,7 @@ discard block |
||
| 1146 | 1146 | $testContent = 'This is used for testing whether htaccess is properly enabled to disallow access from the outside. This file can be safely removed.'; |
| 1147 | 1147 | |
| 1148 | 1148 | // creating a test file |
| 1149 | - $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName; |
|
| 1149 | + $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName; |
|
| 1150 | 1150 | |
| 1151 | 1151 | if (file_exists($testFile)) {// already running this test, possible recursive call |
| 1152 | 1152 | return false; |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | $fp = @fopen($testFile, 'w'); |
| 1156 | 1156 | if (!$fp) { |
| 1157 | 1157 | throw new OC\HintException('Can\'t create test file to check for working .htaccess file.', |
| 1158 | - 'Make sure it is possible for the webserver to write to ' . $testFile); |
|
| 1158 | + 'Make sure it is possible for the webserver to write to '.$testFile); |
|
| 1159 | 1159 | } |
| 1160 | 1160 | fwrite($fp, $testContent); |
| 1161 | 1161 | fclose($fp); |
@@ -1182,10 +1182,10 @@ discard block |
||
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | 1184 | $fileName = '/htaccesstest.txt'; |
| 1185 | - $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName; |
|
| 1185 | + $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName; |
|
| 1186 | 1186 | |
| 1187 | 1187 | // accessing the file via http |
| 1188 | - $url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT . '/data' . $fileName); |
|
| 1188 | + $url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT.'/data'.$fileName); |
|
| 1189 | 1189 | try { |
| 1190 | 1190 | $content = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody(); |
| 1191 | 1191 | } catch (\Exception $e) { |
@@ -1276,7 +1276,7 @@ discard block |
||
| 1276 | 1276 | $theme = \OC::$server->getSystemConfig()->getValue("theme", ''); |
| 1277 | 1277 | |
| 1278 | 1278 | if ($theme === '') { |
| 1279 | - if (is_dir(OC::$SERVERROOT . '/themes/default')) { |
|
| 1279 | + if (is_dir(OC::$SERVERROOT.'/themes/default')) { |
|
| 1280 | 1280 | $theme = 'default'; |
| 1281 | 1281 | } |
| 1282 | 1282 | } |
@@ -1347,13 +1347,13 @@ discard block |
||
| 1347 | 1347 | * @return bool|string |
| 1348 | 1348 | */ |
| 1349 | 1349 | public static function normalizeUnicode($value) { |
| 1350 | - if(Normalizer::isNormalized($value)) { |
|
| 1350 | + if (Normalizer::isNormalized($value)) { |
|
| 1351 | 1351 | return $value; |
| 1352 | 1352 | } |
| 1353 | 1353 | |
| 1354 | 1354 | $normalizedValue = Normalizer::normalize($value); |
| 1355 | 1355 | if ($normalizedValue === null || $normalizedValue === false) { |
| 1356 | - \OC::$server->getLogger()->warning('normalizing failed for "' . $value . '"', ['app' => 'core']); |
|
| 1356 | + \OC::$server->getLogger()->warning('normalizing failed for "'.$value.'"', ['app' => 'core']); |
|
| 1357 | 1357 | return $value; |
| 1358 | 1358 | } |
| 1359 | 1359 | |
@@ -1379,7 +1379,7 @@ discard block |
||
| 1379 | 1379 | $version = OC_Util::getVersionString(); |
| 1380 | 1380 | $build = OC_Util::getBuild(); |
| 1381 | 1381 | if (!empty($build) and OC_Util::getChannel() === 'daily') { |
| 1382 | - $version .= ' Build:' . $build; |
|
| 1382 | + $version .= ' Build:'.$build; |
|
| 1383 | 1383 | } |
| 1384 | 1384 | return $version; |
| 1385 | 1385 | } |
@@ -1426,19 +1426,19 @@ discard block |
||
| 1426 | 1426 | } else if ($config->getValue('debug', false) && $versionDiff < 0) { |
| 1427 | 1427 | // downgrade with debug |
| 1428 | 1428 | $installedMajor = explode('.', $installedVersion); |
| 1429 | - $installedMajor = $installedMajor[0] . '.' . $installedMajor[1]; |
|
| 1429 | + $installedMajor = $installedMajor[0].'.'.$installedMajor[1]; |
|
| 1430 | 1430 | $currentMajor = explode('.', $currentVersion); |
| 1431 | - $currentMajor = $currentMajor[0] . '.' . $currentMajor[1]; |
|
| 1431 | + $currentMajor = $currentMajor[0].'.'.$currentMajor[1]; |
|
| 1432 | 1432 | if ($installedMajor === $currentMajor) { |
| 1433 | 1433 | // Same major, allow downgrade for developers |
| 1434 | 1434 | return true; |
| 1435 | 1435 | } else { |
| 1436 | 1436 | // downgrade attempt, throw exception |
| 1437 | - throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); |
|
| 1437 | + throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')'); |
|
| 1438 | 1438 | } |
| 1439 | 1439 | } else if ($versionDiff < 0) { |
| 1440 | 1440 | // downgrade attempt, throw exception |
| 1441 | - throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); |
|
| 1441 | + throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')'); |
|
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | 1444 | // also check for upgrades for apps (independently from the user) |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | throw new Forbidden(); |
| 94 | 94 | } |
| 95 | 95 | } catch (StorageNotAvailableException $e) { |
| 96 | - throw new ServiceUnavailable("File is not updatable: " . $e->getMessage()); |
|
| 96 | + throw new ServiceUnavailable("File is not updatable: ".$e->getMessage()); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // verify path of the target |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | if ($needsPartFile) { |
| 115 | 115 | // mark file as partial while uploading (ignored by the scanner) |
| 116 | - $partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part'; |
|
| 116 | + $partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part'; |
|
| 117 | 117 | } else { |
| 118 | 118 | // upload file directly as the final path |
| 119 | 119 | $partFilePath = $this->path; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | if (isset($_SERVER['CONTENT_LENGTH'])) { |
| 144 | 144 | $expected = $_SERVER['CONTENT_LENGTH']; |
| 145 | 145 | } |
| 146 | - throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )'); |
|
| 146 | + throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )'); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // if content length is sent by client: |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
| 153 | 153 | $expected = $_SERVER['CONTENT_LENGTH']; |
| 154 | 154 | if ($count != $expected) { |
| 155 | - throw new BadRequest('expected filesize ' . $expected . ' got ' . $count); |
|
| 155 | + throw new BadRequest('expected filesize '.$expected.' got '.$count); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
@@ -239,10 +239,10 @@ discard block |
||
| 239 | 239 | $this->refreshInfo(); |
| 240 | 240 | |
| 241 | 241 | } catch (StorageNotAvailableException $e) { |
| 242 | - throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage()); |
|
| 242 | + throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage()); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - return '"' . $this->info->getEtag() . '"'; |
|
| 245 | + return '"'.$this->info->getEtag().'"'; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | private function getPartFileBasePath($path) { |
@@ -321,9 +321,9 @@ discard block |
||
| 321 | 321 | return $res; |
| 322 | 322 | } catch (GenericEncryptionException $e) { |
| 323 | 323 | // returning 503 will allow retry of the operation at a later point in time |
| 324 | - throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage()); |
|
| 324 | + throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage()); |
|
| 325 | 325 | } catch (StorageNotAvailableException $e) { |
| 326 | - throw new ServiceUnavailable("Failed to open file: " . $e->getMessage()); |
|
| 326 | + throw new ServiceUnavailable("Failed to open file: ".$e->getMessage()); |
|
| 327 | 327 | } catch (ForbiddenException $ex) { |
| 328 | 328 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
| 329 | 329 | } catch (LockedException $e) { |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | throw new Forbidden(); |
| 349 | 349 | } |
| 350 | 350 | } catch (StorageNotAvailableException $e) { |
| 351 | - throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage()); |
|
| 351 | + throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage()); |
|
| 352 | 352 | } catch (ForbiddenException $ex) { |
| 353 | 353 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
| 354 | 354 | } catch (LockedException $e) { |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | if ($bytesWritten != $expected) { |
| 416 | 416 | $chunk_handler->remove($info['index']); |
| 417 | 417 | throw new BadRequest( |
| 418 | - 'expected filesize ' . $expected . ' got ' . $bytesWritten); |
|
| 418 | + 'expected filesize '.$expected.' got '.$bytesWritten); |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | } |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | $needsPartFile = $this->needsPartFile($storage); |
| 426 | 426 | $partFile = null; |
| 427 | 427 | |
| 428 | - $targetPath = $path . '/' . $info['name']; |
|
| 428 | + $targetPath = $path.'/'.$info['name']; |
|
| 429 | 429 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
| 430 | 430 | list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath); |
| 431 | 431 | |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | |
| 442 | 442 | if ($needsPartFile) { |
| 443 | 443 | // we first assembly the target file as a part file |
| 444 | - $partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part'; |
|
| 444 | + $partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part'; |
|
| 445 | 445 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
| 446 | 446 | list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile); |
| 447 | 447 | |
@@ -594,10 +594,10 @@ discard block |
||
| 594 | 594 | } |
| 595 | 595 | if ($e instanceof GenericEncryptionException) { |
| 596 | 596 | // returning 503 will allow retry of the operation at a later point in time |
| 597 | - throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e); |
|
| 597 | + throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e); |
|
| 598 | 598 | } |
| 599 | 599 | if ($e instanceof StorageNotAvailableException) { |
| 600 | - throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e); |
|
| 600 | + throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e); |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e); |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | $checksums = explode(' ', $allChecksums); |
| 621 | - $algoPrefix = strtoupper($algo) . ':'; |
|
| 621 | + $algoPrefix = strtoupper($algo).':'; |
|
| 622 | 622 | |
| 623 | 623 | foreach ($checksums as $checksum) { |
| 624 | 624 | // starts with $algoPrefix |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | private function wrapChecksumStream($stream, $path) { |
| 74 | - return \OC\Files\Stream\Checksum::wrap($stream, function (array $hashes) use ($path) { |
|
| 74 | + return \OC\Files\Stream\Checksum::wrap($stream, function(array $hashes) use ($path) { |
|
| 75 | 75 | $cache = $this->getCache(); |
| 76 | 76 | $cache->put($path, [ |
| 77 | 77 | 'checksum' => self::getChecksumsInDbFormat($hashes) |