@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param array $server $_SERVER |
| 43 | 43 | * @param string $protocolVersion the http version to use defaults to HTTP/1.1 |
| 44 | 44 | */ |
| 45 | - public function __construct($server, $protocolVersion='HTTP/1.1') { |
|
| 45 | + public function __construct($server, $protocolVersion = 'HTTP/1.1') { |
|
| 46 | 46 | $this->server = $server; |
| 47 | 47 | $this->protocolVersion = $protocolVersion; |
| 48 | 48 | |
@@ -117,16 +117,16 @@ discard block |
||
| 117 | 117 | * @param string $ETag the etag |
| 118 | 118 | * @return string |
| 119 | 119 | */ |
| 120 | - public function getStatusHeader($status, \DateTime $lastModified=null, |
|
| 121 | - $ETag=null) { |
|
| 120 | + public function getStatusHeader($status, \DateTime $lastModified = null, |
|
| 121 | + $ETag = null) { |
|
| 122 | 122 | |
| 123 | - if(!is_null($lastModified)) { |
|
| 123 | + if (!is_null($lastModified)) { |
|
| 124 | 124 | $lastModified = $lastModified->format(\DateTime::RFC2822); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // if etag or lastmodified have not changed, return a not modified |
| 128 | 128 | if ((isset($this->server['HTTP_IF_NONE_MATCH']) |
| 129 | - && trim(trim($this->server['HTTP_IF_NONE_MATCH']), '"') === (string)$ETag) |
|
| 129 | + && trim(trim($this->server['HTTP_IF_NONE_MATCH']), '"') === (string) $ETag) |
|
| 130 | 130 | |
| 131 | 131 | || |
| 132 | 132 | |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | // we have one change currently for the http 1.0 header that differs |
| 141 | 141 | // from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND |
| 142 | 142 | // if this differs any more, we want to create childclasses for this |
| 143 | - if($status === self::STATUS_TEMPORARY_REDIRECT |
|
| 143 | + if ($status === self::STATUS_TEMPORARY_REDIRECT |
|
| 144 | 144 | && $this->protocolVersion === 'HTTP/1.0') { |
| 145 | 145 | |
| 146 | 146 | $status = self::STATUS_FOUND; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - return $this->protocolVersion . ' ' . $status . ' ' . |
|
| 149 | + return $this->protocolVersion.' '.$status.' '. |
|
| 150 | 150 | $this->headers[$status]; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @param string $renderAs |
| 100 | 100 | */ |
| 101 | 101 | public static function initTemplateEngine($renderAs) { |
| 102 | - if (self::$initTemplateEngineFirstRun){ |
|
| 102 | + if (self::$initTemplateEngineFirstRun) { |
|
| 103 | 103 | |
| 104 | 104 | //apps that started before the template initialization can load their own scripts/styles |
| 105 | 105 | //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | protected function findTemplate($theme, $app, $name) { |
| 148 | 148 | // Check if it is a app template or not. |
| 149 | - if($app !== '') { |
|
| 149 | + if ($app !== '') { |
|
| 150 | 150 | $dirs = $this->getAppTemplateDirs($theme, $app, OC::$SERVERROOT, OC_App::getAppPath($app)); |
| 151 | 151 | } else { |
| 152 | 152 | $dirs = $this->getCoreTemplateDirs($theme, OC::$SERVERROOT); |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | * @param string $text the text content for the element. If $text is null then the |
| 165 | 165 | * element will be written as empty element. So use "" to get a closing tag. |
| 166 | 166 | */ |
| 167 | - public function addHeader($tag, $attributes, $text=null) { |
|
| 168 | - $this->headers[]= [ |
|
| 167 | + public function addHeader($tag, $attributes, $text = null) { |
|
| 168 | + $this->headers[] = [ |
|
| 169 | 169 | 'tag' => $tag, |
| 170 | 170 | 'attributes' => $attributes, |
| 171 | 171 | 'text' => $text |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | public function fetchPage($additionalParams = null) { |
| 183 | 183 | $data = parent::fetchPage($additionalParams); |
| 184 | 184 | |
| 185 | - if($this->renderAs) { |
|
| 185 | + if ($this->renderAs) { |
|
| 186 | 186 | $page = new TemplateLayout($this->renderAs, $this->app); |
| 187 | 187 | |
| 188 | - if(is_array($additionalParams)) { |
|
| 188 | + if (is_array($additionalParams)) { |
|
| 189 | 189 | foreach ($additionalParams as $key => $value) { |
| 190 | 190 | $page->assign($key, $value); |
| 191 | 191 | } |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | // Add custom headers |
| 195 | 195 | $headers = ''; |
| 196 | - foreach(OC_Util::$headers as $header) { |
|
| 196 | + foreach (OC_Util::$headers as $header) { |
|
| 197 | 197 | $headers .= '<'.\OCP\Util::sanitizeHTML($header['tag']); |
| 198 | 198 | if (strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes'])))) { |
| 199 | 199 | $headers .= ' defer'; |
| 200 | 200 | } |
| 201 | - foreach($header['attributes'] as $name=>$value) { |
|
| 201 | + foreach ($header['attributes'] as $name=>$value) { |
|
| 202 | 202 | $headers .= ' '.\OCP\Util::sanitizeHTML($name).'="'.\OCP\Util::sanitizeHTML($value).'"'; |
| 203 | 203 | } |
| 204 | 204 | if ($header['text'] !== null) { |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public static function printUserPage($application, $name, $parameters = []) { |
| 242 | 242 | $content = new OC_Template($application, $name, "user"); |
| 243 | - foreach($parameters as $key => $value) { |
|
| 243 | + foreach ($parameters as $key => $value) { |
|
| 244 | 244 | $content->assign($key, $value); |
| 245 | 245 | } |
| 246 | 246 | print $content->printPage(); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | public static function printAdminPage($application, $name, $parameters = []) { |
| 257 | 257 | $content = new OC_Template($application, $name, "admin"); |
| 258 | - foreach($parameters as $key => $value) { |
|
| 258 | + foreach ($parameters as $key => $value) { |
|
| 259 | 259 | $content->assign($key, $value); |
| 260 | 260 | } |
| 261 | 261 | return $content->printPage(); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | public static function printGuestPage($application, $name, $parameters = []) { |
| 272 | 272 | $content = new OC_Template($application, $name, $name === 'error' ? $name : 'guest'); |
| 273 | - foreach($parameters as $key => $value) { |
|
| 273 | + foreach ($parameters as $key => $value) { |
|
| 274 | 274 | $content->assign($key, $value); |
| 275 | 275 | } |
| 276 | 276 | return $content->printPage(); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | private static function initLocalStorageRootFS() { |
| 86 | 86 | // mount local file backend as root |
| 87 | - $configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT . "/data"); |
|
| 87 | + $configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT."/data"); |
|
| 88 | 88 | //first set up the local "root" storage |
| 89 | 89 | \OC\Files\Filesystem::initMountManager(); |
| 90 | 90 | if (!self::$rootMounted) { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | \OC\Files\Filesystem::initMountManager(); |
| 207 | 207 | |
| 208 | 208 | $prevLogging = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false); |
| 209 | - \OC\Files\Filesystem::addStorageWrapper('mount_options', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 209 | + \OC\Files\Filesystem::addStorageWrapper('mount_options', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 210 | 210 | if ($storage->instanceOfStorage('\OC\Files\Storage\Common')) { |
| 211 | 211 | /** @var \OC\Files\Storage\Common $storage */ |
| 212 | 212 | $storage->setMountOptions($mount->getOptions()); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | return $storage; |
| 215 | 215 | }); |
| 216 | 216 | |
| 217 | - \OC\Files\Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 217 | + \OC\Files\Filesystem::addStorageWrapper('enable_sharing', function($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 218 | 218 | if (!$mount->getOption('enable_sharing', true)) { |
| 219 | 219 | return new \OC\Files\Storage\Wrapper\PermissionsMask([ |
| 220 | 220 | 'storage' => $storage, |
@@ -225,21 +225,21 @@ discard block |
||
| 225 | 225 | }); |
| 226 | 226 | |
| 227 | 227 | // install storage availability wrapper, before most other wrappers |
| 228 | - \OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, \OCP\Files\Storage\IStorage $storage) { |
|
| 228 | + \OC\Files\Filesystem::addStorageWrapper('oc_availability', function($mountPoint, \OCP\Files\Storage\IStorage $storage) { |
|
| 229 | 229 | if (!$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { |
| 230 | 230 | return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]); |
| 231 | 231 | } |
| 232 | 232 | return $storage; |
| 233 | 233 | }); |
| 234 | 234 | |
| 235 | - \OC\Files\Filesystem::addStorageWrapper('oc_encoding', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 235 | + \OC\Files\Filesystem::addStorageWrapper('oc_encoding', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 236 | 236 | if ($mount->getOption('encoding_compatibility', false) && !$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { |
| 237 | 237 | return new \OC\Files\Storage\Wrapper\Encoding(['storage' => $storage]); |
| 238 | 238 | } |
| 239 | 239 | return $storage; |
| 240 | 240 | }); |
| 241 | 241 | |
| 242 | - \OC\Files\Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) { |
|
| 242 | + \OC\Files\Filesystem::addStorageWrapper('oc_quota', function($mountPoint, $storage) { |
|
| 243 | 243 | // set up quota for home storages, even for other users |
| 244 | 244 | // which can happen when using sharing |
| 245 | 245 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | return $storage; |
| 262 | 262 | }); |
| 263 | 263 | |
| 264 | - \OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 264 | + \OC\Files\Filesystem::addStorageWrapper('readonly', function($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
| 265 | 265 | /* |
| 266 | 266 | * Do not allow any operations that modify the storage |
| 267 | 267 | */ |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | //if we aren't logged in, there is no use to set up the filesystem |
| 304 | 304 | if ($user != "") { |
| 305 | 305 | |
| 306 | - $userDir = '/' . $user . '/files'; |
|
| 306 | + $userDir = '/'.$user.'/files'; |
|
| 307 | 307 | |
| 308 | 308 | //jail the user into his "home" directory |
| 309 | 309 | \OC\Files\Filesystem::init($user, $userDir); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | return \OCP\Files\FileInfo::SPACE_UNLIMITED; |
| 383 | 383 | } |
| 384 | 384 | $userQuota = $user->getQuota(); |
| 385 | - if($userQuota === 'none') { |
|
| 385 | + if ($userQuota === 'none') { |
|
| 386 | 386 | return \OCP\Files\FileInfo::SPACE_UNLIMITED; |
| 387 | 387 | } |
| 388 | 388 | return OC_Helper::computerFileSize($userQuota); |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | public static function copySkeleton($userId, \OCP\Files\Folder $userDirectory) { |
| 401 | 401 | |
| 402 | - $plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton'); |
|
| 402 | + $plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT.'/core/skeleton'); |
|
| 403 | 403 | $userLang = \OC::$server->getL10NFactory()->findLanguage(); |
| 404 | 404 | $skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory); |
| 405 | 405 | |
@@ -421,9 +421,9 @@ discard block |
||
| 421 | 421 | if ($instanceId === null) { |
| 422 | 422 | throw new \RuntimeException('no instance id!'); |
| 423 | 423 | } |
| 424 | - $appdata = 'appdata_' . $instanceId; |
|
| 424 | + $appdata = 'appdata_'.$instanceId; |
|
| 425 | 425 | if ($userId === $appdata) { |
| 426 | - throw new \RuntimeException('username is reserved name: ' . $appdata); |
|
| 426 | + throw new \RuntimeException('username is reserved name: '.$appdata); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | if (!empty($skeletonDirectory)) { |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | |
| 451 | 451 | // Verify if folder exists |
| 452 | 452 | $dir = opendir($source); |
| 453 | - if($dir === false) { |
|
| 453 | + if ($dir === false) { |
|
| 454 | 454 | $logger->error(sprintf('Could not opendir "%s"', $source), ['app' => 'core']); |
| 455 | 455 | return; |
| 456 | 456 | } |
@@ -458,14 +458,14 @@ discard block |
||
| 458 | 458 | // Copy the files |
| 459 | 459 | while (false !== ($file = readdir($dir))) { |
| 460 | 460 | if (!\OC\Files\Filesystem::isIgnoredDir($file)) { |
| 461 | - if (is_dir($source . '/' . $file)) { |
|
| 461 | + if (is_dir($source.'/'.$file)) { |
|
| 462 | 462 | $child = $target->newFolder($file); |
| 463 | - self::copyr($source . '/' . $file, $child); |
|
| 463 | + self::copyr($source.'/'.$file, $child); |
|
| 464 | 464 | } else { |
| 465 | 465 | $child = $target->newFile($file); |
| 466 | - $sourceStream = fopen($source . '/' . $file, 'r'); |
|
| 467 | - if($sourceStream === false) { |
|
| 468 | - $logger->error(sprintf('Could not fopen "%s"', $source . '/' . $file), ['app' => 'core']); |
|
| 466 | + $sourceStream = fopen($source.'/'.$file, 'r'); |
|
| 467 | + if ($sourceStream === false) { |
|
| 468 | + $logger->error(sprintf('Could not fopen "%s"', $source.'/'.$file), ['app' => 'core']); |
|
| 469 | 469 | closedir($dir); |
| 470 | 470 | return; |
| 471 | 471 | } |
@@ -542,8 +542,8 @@ discard block |
||
| 542 | 542 | return; |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | - $timestamp = filemtime(OC::$SERVERROOT . '/version.php'); |
|
| 546 | - require OC::$SERVERROOT . '/version.php'; |
|
| 545 | + $timestamp = filemtime(OC::$SERVERROOT.'/version.php'); |
|
| 546 | + require OC::$SERVERROOT.'/version.php'; |
|
| 547 | 547 | /** @var $timestamp int */ |
| 548 | 548 | self::$versionCache['OC_Version_Timestamp'] = $timestamp; |
| 549 | 549 | /** @var $OC_Version string */ |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | public static function checkServer(\OC\SystemConfig $config) { |
| 716 | 716 | $l = \OC::$server->getL10N('lib'); |
| 717 | 717 | $errors = []; |
| 718 | - $CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT . '/data'); |
|
| 718 | + $CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT.'/data'); |
|
| 719 | 719 | |
| 720 | 720 | if (!self::needUpgrade($config) && $config->getValue('installed', false)) { |
| 721 | 721 | // this check needs to be done every time |
@@ -750,14 +750,14 @@ discard block |
||
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | // Check if config folder is writable. |
| 753 | - if(!OC_Helper::isReadOnlyConfigEnabled()) { |
|
| 753 | + if (!OC_Helper::isReadOnlyConfigEnabled()) { |
|
| 754 | 754 | if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) { |
| 755 | 755 | $errors[] = [ |
| 756 | 756 | 'error' => $l->t('Cannot write into "config" directory'), |
| 757 | 757 | 'hint' => $l->t('This can usually be fixed by giving the webserver write access to the config directory. See %s', |
| 758 | - [ $urlGenerator->linkToDocs('admin-dir_permissions') ]) . '. ' |
|
| 758 | + [$urlGenerator->linkToDocs('admin-dir_permissions')]).'. ' |
|
| 759 | 759 | . $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', |
| 760 | - [ $urlGenerator->linkToDocs('admin-config') ]) |
|
| 760 | + [$urlGenerator->linkToDocs('admin-config')]) |
|
| 761 | 761 | ]; |
| 762 | 762 | } |
| 763 | 763 | } |
@@ -890,15 +890,15 @@ discard block |
||
| 890 | 890 | } |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | - foreach($missingDependencies as $missingDependency) { |
|
| 893 | + foreach ($missingDependencies as $missingDependency) { |
|
| 894 | 894 | $errors[] = [ |
| 895 | 895 | 'error' => $l->t('PHP module %s not installed.', [$missingDependency]), |
| 896 | 896 | 'hint' => $moduleHint |
| 897 | 897 | ]; |
| 898 | 898 | $webServerRestart = true; |
| 899 | 899 | } |
| 900 | - foreach($invalidIniSettings as $setting) { |
|
| 901 | - if(is_bool($setting[1])) { |
|
| 900 | + foreach ($invalidIniSettings as $setting) { |
|
| 901 | + if (is_bool($setting[1])) { |
|
| 902 | 902 | $setting[1] = $setting[1] ? 'on' : 'off'; |
| 903 | 903 | } |
| 904 | 904 | $errors[] = [ |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | * TODO: Should probably be implemented in the above generic dependency |
| 917 | 917 | * check somehow in the long-term. |
| 918 | 918 | */ |
| 919 | - if($iniWrapper->getBool('mbstring.func_overload') !== null && |
|
| 919 | + if ($iniWrapper->getBool('mbstring.func_overload') !== null && |
|
| 920 | 920 | $iniWrapper->getBool('mbstring.func_overload') === true) { |
| 921 | 921 | $errors[] = [ |
| 922 | 922 | 'error' => $l->t('mbstring.func_overload is set to "%s" instead of the expected value "0"', [$iniWrapper->getString('mbstring.func_overload')]), |
@@ -924,16 +924,16 @@ discard block |
||
| 924 | 924 | ]; |
| 925 | 925 | } |
| 926 | 926 | |
| 927 | - if(function_exists('xml_parser_create') && |
|
| 927 | + if (function_exists('xml_parser_create') && |
|
| 928 | 928 | LIBXML_LOADED_VERSION < 20700) { |
| 929 | 929 | $version = LIBXML_LOADED_VERSION; |
| 930 | - $major = floor($version/10000); |
|
| 930 | + $major = floor($version / 10000); |
|
| 931 | 931 | $version -= ($major * 10000); |
| 932 | - $minor = floor($version/100); |
|
| 932 | + $minor = floor($version / 100); |
|
| 933 | 933 | $version -= ($minor * 100); |
| 934 | 934 | $patch = $version; |
| 935 | 935 | $errors[] = [ |
| 936 | - 'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major . '.' . $minor . '.' . $patch]), |
|
| 936 | + 'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major.'.'.$minor.'.'.$patch]), |
|
| 937 | 937 | 'hint' => $l->t('To fix this issue update your libxml2 version and restart your web server.') |
| 938 | 938 | ]; |
| 939 | 939 | } |
@@ -999,7 +999,7 @@ discard block |
||
| 999 | 999 | * @return array arrays with error messages and hints |
| 1000 | 1000 | */ |
| 1001 | 1001 | public static function checkDataDirectoryPermissions($dataDirectory) { |
| 1002 | - if(\OC::$server->getConfig()->getSystemValue('check_data_directory_permissions', true) === false) { |
|
| 1002 | + if (\OC::$server->getConfig()->getSystemValue('check_data_directory_permissions', true) === false) { |
|
| 1003 | 1003 | return []; |
| 1004 | 1004 | } |
| 1005 | 1005 | $l = \OC::$server->getL10N('lib'); |
@@ -1037,10 +1037,10 @@ discard block |
||
| 1037 | 1037 | 'hint' => $l->t('Check the value of "datadirectory" in your configuration') |
| 1038 | 1038 | ]; |
| 1039 | 1039 | } |
| 1040 | - if (!file_exists($dataDirectory . '/.ocdata')) { |
|
| 1040 | + if (!file_exists($dataDirectory.'/.ocdata')) { |
|
| 1041 | 1041 | $errors[] = [ |
| 1042 | 1042 | 'error' => $l->t('Your data directory is invalid'), |
| 1043 | - 'hint' => $l->t('Ensure there is a file called ".ocdata"' . |
|
| 1043 | + 'hint' => $l->t('Ensure there is a file called ".ocdata"'. |
|
| 1044 | 1044 | ' in the root of the data directory.') |
| 1045 | 1045 | ]; |
| 1046 | 1046 | } |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | public static function checkLoggedIn() { |
| 1057 | 1057 | // Check if we are a user |
| 1058 | 1058 | if (!\OC::$server->getUserSession()->isLoggedIn()) { |
| 1059 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute( |
|
| 1059 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute( |
|
| 1060 | 1060 | 'core.login.showLoginForm', |
| 1061 | 1061 | [ |
| 1062 | 1062 | 'redirect_url' => \OC::$server->getRequest()->getRequestUri(), |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | } |
| 1068 | 1068 | // Redirect to 2FA challenge selection if 2FA challenge was not solved yet |
| 1069 | 1069 | if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { |
| 1070 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
| 1070 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
| 1071 | 1071 | exit(); |
| 1072 | 1072 | } |
| 1073 | 1073 | } |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | public static function checkAdminUser() { |
| 1081 | 1081 | OC_Util::checkLoggedIn(); |
| 1082 | 1082 | if (!OC_User::isAdminUser(OC_User::getUser())) { |
| 1083 | - header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); |
|
| 1083 | + header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php')); |
|
| 1084 | 1084 | exit(); |
| 1085 | 1085 | } |
| 1086 | 1086 | } |
@@ -1116,10 +1116,10 @@ discard block |
||
| 1116 | 1116 | } |
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | - if($config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') { |
|
| 1120 | - $location = $urlGenerator->getAbsoluteURL('/apps/' . $appId . '/'); |
|
| 1119 | + if ($config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') { |
|
| 1120 | + $location = $urlGenerator->getAbsoluteURL('/apps/'.$appId.'/'); |
|
| 1121 | 1121 | } else { |
| 1122 | - $location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/'); |
|
| 1122 | + $location = $urlGenerator->getAbsoluteURL('/index.php/apps/'.$appId.'/'); |
|
| 1123 | 1123 | } |
| 1124 | 1124 | } |
| 1125 | 1125 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | */ |
| 1134 | 1134 | public static function redirectToDefaultPage() { |
| 1135 | 1135 | $location = self::getDefaultPageUrl(); |
| 1136 | - header('Location: ' . $location); |
|
| 1136 | + header('Location: '.$location); |
|
| 1137 | 1137 | exit(); |
| 1138 | 1138 | } |
| 1139 | 1139 | |
@@ -1146,7 +1146,7 @@ discard block |
||
| 1146 | 1146 | $id = \OC::$server->getSystemConfig()->getValue('instanceid', null); |
| 1147 | 1147 | if (is_null($id)) { |
| 1148 | 1148 | // We need to guarantee at least one letter in instanceid so it can be used as the session_name |
| 1149 | - $id = 'oc' . \OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
| 1149 | + $id = 'oc'.\OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
| 1150 | 1150 | \OC::$server->getSystemConfig()->setValue('instanceid', $id); |
| 1151 | 1151 | } |
| 1152 | 1152 | return $id; |
@@ -1163,12 +1163,12 @@ discard block |
||
| 1163 | 1163 | */ |
| 1164 | 1164 | public static function sanitizeHTML($value) { |
| 1165 | 1165 | if (is_array($value)) { |
| 1166 | - $value = array_map(function ($value) { |
|
| 1166 | + $value = array_map(function($value) { |
|
| 1167 | 1167 | return self::sanitizeHTML($value); |
| 1168 | 1168 | }, $value); |
| 1169 | 1169 | } else { |
| 1170 | 1170 | // Specify encoding for PHP<5.4 |
| 1171 | - $value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8'); |
|
| 1171 | + $value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8'); |
|
| 1172 | 1172 | } |
| 1173 | 1173 | return $value; |
| 1174 | 1174 | } |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | $testContent = 'This is used for testing whether htaccess is properly enabled to disallow access from the outside. This file can be safely removed.'; |
| 1202 | 1202 | |
| 1203 | 1203 | // creating a test file |
| 1204 | - $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName; |
|
| 1204 | + $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName; |
|
| 1205 | 1205 | |
| 1206 | 1206 | if (file_exists($testFile)) {// already running this test, possible recursive call |
| 1207 | 1207 | return false; |
@@ -1210,7 +1210,7 @@ discard block |
||
| 1210 | 1210 | $fp = @fopen($testFile, 'w'); |
| 1211 | 1211 | if (!$fp) { |
| 1212 | 1212 | throw new OC\HintException('Can\'t create test file to check for working .htaccess file.', |
| 1213 | - 'Make sure it is possible for the webserver to write to ' . $testFile); |
|
| 1213 | + 'Make sure it is possible for the webserver to write to '.$testFile); |
|
| 1214 | 1214 | } |
| 1215 | 1215 | fwrite($fp, $testContent); |
| 1216 | 1216 | fclose($fp); |
@@ -1237,10 +1237,10 @@ discard block |
||
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | 1239 | $fileName = '/htaccesstest.txt'; |
| 1240 | - $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName; |
|
| 1240 | + $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName; |
|
| 1241 | 1241 | |
| 1242 | 1242 | // accessing the file via http |
| 1243 | - $url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT . '/data' . $fileName); |
|
| 1243 | + $url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT.'/data'.$fileName); |
|
| 1244 | 1244 | try { |
| 1245 | 1245 | $content = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody(); |
| 1246 | 1246 | } catch (\Exception $e) { |
@@ -1248,9 +1248,9 @@ discard block |
||
| 1248 | 1248 | } |
| 1249 | 1249 | |
| 1250 | 1250 | if (strpos($url, 'https:') === 0) { |
| 1251 | - $url = 'http:' . substr($url, 6); |
|
| 1251 | + $url = 'http:'.substr($url, 6); |
|
| 1252 | 1252 | } else { |
| 1253 | - $url = 'https:' . substr($url, 5); |
|
| 1253 | + $url = 'https:'.substr($url, 5); |
|
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | try { |
@@ -1334,7 +1334,7 @@ discard block |
||
| 1334 | 1334 | $theme = \OC::$server->getSystemConfig()->getValue("theme", ''); |
| 1335 | 1335 | |
| 1336 | 1336 | if ($theme === '') { |
| 1337 | - if (is_dir(OC::$SERVERROOT . '/themes/default')) { |
|
| 1337 | + if (is_dir(OC::$SERVERROOT.'/themes/default')) { |
|
| 1338 | 1338 | $theme = 'default'; |
| 1339 | 1339 | } |
| 1340 | 1340 | } |
@@ -1349,13 +1349,13 @@ discard block |
||
| 1349 | 1349 | * @return bool|string |
| 1350 | 1350 | */ |
| 1351 | 1351 | public static function normalizeUnicode($value) { |
| 1352 | - if(Normalizer::isNormalized($value)) { |
|
| 1352 | + if (Normalizer::isNormalized($value)) { |
|
| 1353 | 1353 | return $value; |
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | 1356 | $normalizedValue = Normalizer::normalize($value); |
| 1357 | 1357 | if ($normalizedValue === null || $normalizedValue === false) { |
| 1358 | - \OC::$server->getLogger()->warning('normalizing failed for "' . $value . '"', ['app' => 'core']); |
|
| 1358 | + \OC::$server->getLogger()->warning('normalizing failed for "'.$value.'"', ['app' => 'core']); |
|
| 1359 | 1359 | return $value; |
| 1360 | 1360 | } |
| 1361 | 1361 | |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | $version = OC_Util::getVersionString(); |
| 1372 | 1372 | $build = OC_Util::getBuild(); |
| 1373 | 1373 | if (!empty($build) and OC_Util::getChannel() === 'daily') { |
| 1374 | - $version .= ' Build:' . $build; |
|
| 1374 | + $version .= ' Build:'.$build; |
|
| 1375 | 1375 | } |
| 1376 | 1376 | return $version; |
| 1377 | 1377 | } |
@@ -1393,7 +1393,7 @@ discard block |
||
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | 1395 | // detect part files |
| 1396 | - if (preg_match('/' . \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX . '/', $trimmed) !== 0) { |
|
| 1396 | + if (preg_match('/'.\OCP\Files\FileInfo::BLACKLIST_FILES_REGEX.'/', $trimmed) !== 0) { |
|
| 1397 | 1397 | return false; |
| 1398 | 1398 | } |
| 1399 | 1399 | |
@@ -1424,19 +1424,19 @@ discard block |
||
| 1424 | 1424 | } else if ($config->getValue('debug', false) && $versionDiff < 0) { |
| 1425 | 1425 | // downgrade with debug |
| 1426 | 1426 | $installedMajor = explode('.', $installedVersion); |
| 1427 | - $installedMajor = $installedMajor[0] . '.' . $installedMajor[1]; |
|
| 1427 | + $installedMajor = $installedMajor[0].'.'.$installedMajor[1]; |
|
| 1428 | 1428 | $currentMajor = explode('.', $currentVersion); |
| 1429 | - $currentMajor = $currentMajor[0] . '.' . $currentMajor[1]; |
|
| 1429 | + $currentMajor = $currentMajor[0].'.'.$currentMajor[1]; |
|
| 1430 | 1430 | if ($installedMajor === $currentMajor) { |
| 1431 | 1431 | // Same major, allow downgrade for developers |
| 1432 | 1432 | return true; |
| 1433 | 1433 | } else { |
| 1434 | 1434 | // downgrade attempt, throw exception |
| 1435 | - throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); |
|
| 1435 | + throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')'); |
|
| 1436 | 1436 | } |
| 1437 | 1437 | } else if ($versionDiff < 0) { |
| 1438 | 1438 | // downgrade attempt, throw exception |
| 1439 | - throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); |
|
| 1439 | + throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')'); |
|
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | 1442 | // also check for upgrades for apps (independently from the user) |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * Class OC_JSON |
| 34 | 34 | * @deprecated Use a AppFramework JSONResponse instead |
| 35 | 35 | */ |
| 36 | -class OC_JSON{ |
|
| 36 | +class OC_JSON { |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Check if the app is enabled, send json error msg if not |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * @suppress PhanDeprecatedFunction |
| 43 | 43 | */ |
| 44 | 44 | public static function checkAppEnabled($app) { |
| 45 | - if(!\OC::$server->getAppManager()->isEnabledForUser($app)) { |
|
| 45 | + if (!\OC::$server->getAppManager()->isEnabledForUser($app)) { |
|
| 46 | 46 | $l = \OC::$server->getL10N('lib'); |
| 47 | - self::error([ 'data' => [ 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' ]]); |
|
| 47 | + self::error(['data' => ['message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled']]); |
|
| 48 | 48 | exit(); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public static function checkLoggedIn() { |
| 58 | 58 | $twoFactorAuthManger = \OC::$server->getTwoFactorAuthManager(); |
| 59 | - if(!\OC::$server->getUserSession()->isLoggedIn() |
|
| 59 | + if (!\OC::$server->getUserSession()->isLoggedIn() |
|
| 60 | 60 | || $twoFactorAuthManger->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { |
| 61 | 61 | $l = \OC::$server->getL10N('lib'); |
| 62 | 62 | http_response_code(\OCP\AppFramework\Http::STATUS_UNAUTHORIZED); |
| 63 | - self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]); |
|
| 63 | + self::error(['data' => ['message' => $l->t('Authentication error'), 'error' => 'authentication_error']]); |
|
| 64 | 64 | exit(); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -71,14 +71,14 @@ discard block |
||
| 71 | 71 | * @suppress PhanDeprecatedFunction |
| 72 | 72 | */ |
| 73 | 73 | public static function callCheck() { |
| 74 | - if(!\OC::$server->getRequest()->passesStrictCookieCheck()) { |
|
| 74 | + if (!\OC::$server->getRequest()->passesStrictCookieCheck()) { |
|
| 75 | 75 | header('Location: '.\OC::$WEBROOT); |
| 76 | 76 | exit(); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if(!\OC::$server->getRequest()->passesCSRFCheck()) { |
|
| 79 | + if (!\OC::$server->getRequest()->passesCSRFCheck()) { |
|
| 80 | 80 | $l = \OC::$server->getL10N('lib'); |
| 81 | - self::error([ 'data' => [ 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' ]]); |
|
| 81 | + self::error(['data' => ['message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired']]); |
|
| 82 | 82 | exit(); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | * @suppress PhanDeprecatedFunction |
| 90 | 90 | */ |
| 91 | 91 | public static function checkAdminUser() { |
| 92 | - if(!OC_User::isAdminUser(OC_User::getUser())) { |
|
| 92 | + if (!OC_User::isAdminUser(OC_User::getUser())) { |
|
| 93 | 93 | $l = \OC::$server->getL10N('lib'); |
| 94 | - self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]); |
|
| 94 | + self::error(['data' => ['message' => $l->t('Authentication error'), 'error' => 'authentication_error']]); |
|
| 95 | 95 | exit(); |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | protected static function to_string(&$value) { |
| 125 | 125 | if ($value instanceof \OC\L10N\L10NString) { |
| 126 | - $value = (string)$value; |
|
| 126 | + $value = (string) $value; |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * SQL query via Doctrine prepare(), needs to be execute()'d! |
| 60 | 60 | */ |
| 61 | - static public function prepare($query , $limit = null, $offset = null, $isManipulation = null) { |
|
| 61 | + static public function prepare($query, $limit = null, $offset = null, $isManipulation = null) { |
|
| 62 | 62 | $connection = \OC::$server->getDatabaseConnection(); |
| 63 | 63 | |
| 64 | 64 | if ($isManipulation === null) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | // return the result |
| 70 | 70 | try { |
| 71 | - $result =$connection->prepare($query, $limit, $offset); |
|
| 71 | + $result = $connection->prepare($query, $limit, $offset); |
|
| 72 | 72 | } catch (\Doctrine\DBAL\DBALException $e) { |
| 73 | 73 | throw new \OC\DatabaseException($e->getMessage()); |
| 74 | 74 | } |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | if (is_array($stmt)) { |
| 128 | 128 | // convert to prepared statement |
| 129 | - if (! array_key_exists('sql', $stmt)) { |
|
| 129 | + if (!array_key_exists('sql', $stmt)) { |
|
| 130 | 130 | $message = 'statement array must at least contain key \'sql\''; |
| 131 | 131 | throw new \OC\DatabaseException($message); |
| 132 | 132 | } |
| 133 | - if (! array_key_exists('limit', $stmt)) { |
|
| 133 | + if (!array_key_exists('limit', $stmt)) { |
|
| 134 | 134 | $stmt['limit'] = null; |
| 135 | 135 | } |
| 136 | - if (! array_key_exists('limit', $stmt)) { |
|
| 136 | + if (!array_key_exists('limit', $stmt)) { |
|
| 137 | 137 | $stmt['offset'] = null; |
| 138 | 138 | } |
| 139 | 139 | $stmt = self::prepare($stmt['sql'], $stmt['limit'], $stmt['offset']); |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | self::raiseExceptionOnError($result, 'Could not execute statement'); |
| 145 | 145 | } else { |
| 146 | 146 | if (is_object($stmt)) { |
| 147 | - $message = 'Expected a prepared statement or array got ' . get_class($stmt); |
|
| 147 | + $message = 'Expected a prepared statement or array got '.get_class($stmt); |
|
| 148 | 148 | } else { |
| 149 | - $message = 'Expected a prepared statement or array got ' . gettype($stmt); |
|
| 149 | + $message = 'Expected a prepared statement or array got '.gettype($stmt); |
|
| 150 | 150 | } |
| 151 | 151 | throw new \OC\DatabaseException($message); |
| 152 | 152 | } |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | * @throws \OC\DatabaseException |
| 213 | 213 | */ |
| 214 | 214 | public static function raiseExceptionOnError($result, $message = null) { |
| 215 | - if($result === false) { |
|
| 215 | + if ($result === false) { |
|
| 216 | 216 | if ($message === null) { |
| 217 | 217 | $message = self::getErrorMessage(); |
| 218 | 218 | } else { |
| 219 | - $message .= ', Root cause:' . self::getErrorMessage(); |
|
| 219 | + $message .= ', Root cause:'.self::getErrorMessage(); |
|
| 220 | 220 | } |
| 221 | 221 | throw new \OC\DatabaseException($message); |
| 222 | 222 | } |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | * @param string $opts, additional optional options |
| 48 | 48 | */ |
| 49 | 49 | function emit_css_tag($href, $opts = '') { |
| 50 | - $s='<link rel="stylesheet"'; |
|
| 50 | + $s = '<link rel="stylesheet"'; |
|
| 51 | 51 | if (!empty($href)) { |
| 52 | - $s.=' href="' . $href .'"'; |
|
| 52 | + $s .= ' href="'.$href.'"'; |
|
| 53 | 53 | } |
| 54 | 54 | if (!empty($opts)) { |
| 55 | - $s.=' '.$opts; |
|
| 55 | + $s .= ' '.$opts; |
|
| 56 | 56 | } |
| 57 | 57 | print_unescaped($s.">\n"); |
| 58 | 58 | } |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | * @param array $obj all the script information from template |
| 63 | 63 | */ |
| 64 | 64 | function emit_css_loading_tags($obj) { |
| 65 | - foreach($obj['cssfiles'] as $css) { |
|
| 65 | + foreach ($obj['cssfiles'] as $css) { |
|
| 66 | 66 | emit_css_tag($css); |
| 67 | 67 | } |
| 68 | - foreach($obj['printcssfiles'] as $css) { |
|
| 68 | + foreach ($obj['printcssfiles'] as $css) { |
|
| 69 | 69 | emit_css_tag($css, 'media="print"'); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -75,20 +75,20 @@ discard block |
||
| 75 | 75 | * @param string $src the source URL, ignored when empty |
| 76 | 76 | * @param string $script_content the inline script content, ignored when empty |
| 77 | 77 | */ |
| 78 | -function emit_script_tag($src, $script_content='') { |
|
| 79 | - $defer_str=' defer'; |
|
| 80 | - $s='<script nonce="' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '"'; |
|
| 78 | +function emit_script_tag($src, $script_content = '') { |
|
| 79 | + $defer_str = ' defer'; |
|
| 80 | + $s = '<script nonce="'.\OC::$server->getContentSecurityPolicyNonceManager()->getNonce().'"'; |
|
| 81 | 81 | if (!empty($src)) { |
| 82 | 82 | // emit script tag for deferred loading from $src |
| 83 | - $s.=$defer_str.' src="' . $src .'">'; |
|
| 83 | + $s .= $defer_str.' src="'.$src.'">'; |
|
| 84 | 84 | } else if (!empty($script_content)) { |
| 85 | 85 | // emit script tag for inline script from $script_content without defer (see MDN) |
| 86 | - $s.=">\n".$script_content."\n"; |
|
| 86 | + $s .= ">\n".$script_content."\n"; |
|
| 87 | 87 | } else { |
| 88 | 88 | // no $src nor $src_content, really useless empty tag |
| 89 | - $s.='>'; |
|
| 89 | + $s .= '>'; |
|
| 90 | 90 | } |
| 91 | - $s.='</script>'; |
|
| 91 | + $s .= '</script>'; |
|
| 92 | 92 | print_unescaped($s."\n"); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param array $obj all the script information from template |
| 98 | 98 | */ |
| 99 | 99 | function emit_script_loading_tags($obj) { |
| 100 | - foreach($obj['jsfiles'] as $jsfile) { |
|
| 100 | + foreach ($obj['jsfiles'] as $jsfile) { |
|
| 101 | 101 | emit_script_tag($jsfile, ''); |
| 102 | 102 | } |
| 103 | 103 | if (!empty($obj['inline_ocjs'])) { |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | * if an array is given it will add all scripts |
| 122 | 122 | */ |
| 123 | 123 | function script($app, $file = null) { |
| 124 | - if(is_array($file)) { |
|
| 125 | - foreach($file as $f) { |
|
| 124 | + if (is_array($file)) { |
|
| 125 | + foreach ($file as $f) { |
|
| 126 | 126 | OC_Util::addScript($app, $f); |
| 127 | 127 | } |
| 128 | 128 | } else { |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | * if an array is given it will add all scripts |
| 138 | 138 | */ |
| 139 | 139 | function vendor_script($app, $file = null) { |
| 140 | - if(is_array($file)) { |
|
| 141 | - foreach($file as $f) { |
|
| 140 | + if (is_array($file)) { |
|
| 141 | + foreach ($file as $f) { |
|
| 142 | 142 | OC_Util::addVendorScript($app, $f); |
| 143 | 143 | } |
| 144 | 144 | } else { |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | * if an array is given it will add all styles |
| 154 | 154 | */ |
| 155 | 155 | function style($app, $file = null) { |
| 156 | - if(is_array($file)) { |
|
| 157 | - foreach($file as $f) { |
|
| 156 | + if (is_array($file)) { |
|
| 157 | + foreach ($file as $f) { |
|
| 158 | 158 | OC_Util::addStyle($app, $f); |
| 159 | 159 | } |
| 160 | 160 | } else { |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | * if an array is given it will add all styles |
| 170 | 170 | */ |
| 171 | 171 | function vendor_style($app, $file = null) { |
| 172 | - if(is_array($file)) { |
|
| 173 | - foreach($file as $f) { |
|
| 172 | + if (is_array($file)) { |
|
| 173 | + foreach ($file as $f) { |
|
| 174 | 174 | OC_Util::addVendorStyle($app, $f); |
| 175 | 175 | } |
| 176 | 176 | } else { |
@@ -194,13 +194,13 @@ discard block |
||
| 194 | 194 | * if an array is given it will add all components |
| 195 | 195 | */ |
| 196 | 196 | function component($app, $file) { |
| 197 | - if(is_array($file)) { |
|
| 198 | - foreach($file as $f) { |
|
| 199 | - $url = link_to($app, 'component/' . $f . '.html'); |
|
| 197 | + if (is_array($file)) { |
|
| 198 | + foreach ($file as $f) { |
|
| 199 | + $url = link_to($app, 'component/'.$f.'.html'); |
|
| 200 | 200 | OC_Util::addHeader('link', ['rel' => 'import', 'href' => $url]); |
| 201 | 201 | } |
| 202 | 202 | } else { |
| 203 | - $url = link_to($app, 'component/' . $file . '.html'); |
|
| 203 | + $url = link_to($app, 'component/'.$file.'.html'); |
|
| 204 | 204 | OC_Util::addHeader('link', ['rel' => 'import', 'href' => $url]); |
| 205 | 205 | } |
| 206 | 206 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | function strip_time($timestamp) { |
| 286 | 286 | $date = new \DateTime("@{$timestamp}"); |
| 287 | 287 | $date->setTime(0, 0, 0); |
| 288 | - return (int)$date->format('U'); |
|
| 288 | + return (int) $date->format('U'); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -300,15 +300,15 @@ discard block |
||
| 300 | 300 | /** @var \OC\DateTimeFormatter $formatter */ |
| 301 | 301 | $formatter = \OC::$server->query('DateTimeFormatter'); |
| 302 | 302 | |
| 303 | - if ($dateOnly){ |
|
| 303 | + if ($dateOnly) { |
|
| 304 | 304 | return $formatter->formatDateSpan($timestamp, $fromTime); |
| 305 | 305 | } |
| 306 | 306 | return $formatter->formatTimeSpan($timestamp, $fromTime); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | -function html_select_options($options, $selected, $params=[]) { |
|
| 309 | +function html_select_options($options, $selected, $params = []) { |
|
| 310 | 310 | if (!is_array($selected)) { |
| 311 | - $selected=[$selected]; |
|
| 311 | + $selected = [$selected]; |
|
| 312 | 312 | } |
| 313 | 313 | if (isset($params['combine']) && $params['combine']) { |
| 314 | 314 | $options = array_combine($options, $options); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | $label_name = $params['label']; |
| 322 | 322 | } |
| 323 | 323 | $html = ''; |
| 324 | - foreach($options as $value => $label) { |
|
| 324 | + foreach ($options as $value => $label) { |
|
| 325 | 325 | if ($value_name && is_array($label)) { |
| 326 | 326 | $value = $label[$value_name]; |
| 327 | 327 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $label = $label[$label_name]; |
| 330 | 330 | } |
| 331 | 331 | $select = in_array($value, $selected) ? ' selected="selected"' : ''; |
| 332 | - $html .= '<option value="' . \OCP\Util::sanitizeHTML($value) . '"' . $select . '>' . \OCP\Util::sanitizeHTML($label) . '</option>'."\n"; |
|
| 332 | + $html .= '<option value="'.\OCP\Util::sanitizeHTML($value).'"'.$select.'>'.\OCP\Util::sanitizeHTML($label).'</option>'."\n"; |
|
| 333 | 333 | } |
| 334 | 334 | return $html; |
| 335 | 335 | } |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | \OC\AppFramework\Http\Request::USER_AGENT_ANDROID_MOBILE_CHROME, |
| 41 | 41 | \OC\AppFramework\Http\Request::USER_AGENT_FREEBOX, |
| 42 | 42 | ])) { |
| 43 | - header('Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode($filename) . '"'); |
|
| 43 | + header('Content-Disposition: '.rawurlencode($type).'; filename="'.rawurlencode($filename).'"'); |
|
| 44 | 44 | } else { |
| 45 | - header('Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode($filename) |
|
| 46 | - . '; filename="' . rawurlencode($filename) . '"'); |
|
| 45 | + header('Content-Disposition: '.rawurlencode($type).'; filename*=UTF-8\'\''.rawurlencode($filename) |
|
| 46 | + . '; filename="'.rawurlencode($filename).'"'); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | . 'connect-src *; ' |
| 91 | 91 | . 'object-src \'none\'; ' |
| 92 | 92 | . 'base-uri \'self\'; '; |
| 93 | - header('Content-Security-Policy:' . $policy); |
|
| 93 | + header('Content-Security-Policy:'.$policy); |
|
| 94 | 94 | |
| 95 | 95 | // Send fallback headers for installations that don't have the possibility to send |
| 96 | 96 | // custom headers on the webserver side |
| 97 | - if(getenv('modHeadersAvailable') !== 'true') { |
|
| 97 | + if (getenv('modHeadersAvailable') !== 'true') { |
|
| 98 | 98 | header('Referrer-Policy: no-referrer'); // https://www.w3.org/TR/referrer-policy/ |
| 99 | 99 | header('X-Content-Type-Options: nosniff'); // Disable sniffing the content type for IE |
| 100 | 100 | header('X-Download-Options: noopen'); // https://msdn.microsoft.com/en-us/library/jj542450(v=vs.85).aspx |
@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | static public function connect($signalClass, $signalName, $slotClass, $slotName) { |
| 55 | 55 | // If we're trying to connect to an emitting class that isn't |
| 56 | 56 | // yet registered, register it |
| 57 | - if(!array_key_exists($signalClass, self::$registered)) { |
|
| 57 | + if (!array_key_exists($signalClass, self::$registered)) { |
|
| 58 | 58 | self::$registered[$signalClass] = []; |
| 59 | 59 | } |
| 60 | 60 | // If we're trying to connect to an emitting method that isn't |
| 61 | 61 | // yet registered, register it with the emitting class |
| 62 | - if(!array_key_exists($signalName, self::$registered[$signalClass])) { |
|
| 62 | + if (!array_key_exists($signalName, self::$registered[$signalClass])) { |
|
| 63 | 63 | self::$registered[$signalClass][$signalName] = []; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -95,27 +95,27 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | // Return false if no hook handlers are listening to this |
| 97 | 97 | // emitting class |
| 98 | - if(!array_key_exists($signalClass, self::$registered)) { |
|
| 98 | + if (!array_key_exists($signalClass, self::$registered)) { |
|
| 99 | 99 | return false; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // Return false if no hook handlers are listening to this |
| 103 | 103 | // emitting method |
| 104 | - if(!array_key_exists($signalName, self::$registered[$signalClass])) { |
|
| 104 | + if (!array_key_exists($signalName, self::$registered[$signalClass])) { |
|
| 105 | 105 | return false; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Call all slots |
| 109 | - foreach(self::$registered[$signalClass][$signalName] as $i) { |
|
| 109 | + foreach (self::$registered[$signalClass][$signalName] as $i) { |
|
| 110 | 110 | try { |
| 111 | - call_user_func([ $i["class"], $i["name"] ], $params); |
|
| 112 | - } catch (Exception $e){ |
|
| 111 | + call_user_func([$i["class"], $i["name"]], $params); |
|
| 112 | + } catch (Exception $e) { |
|
| 113 | 113 | self::$thrownExceptions[] = $e; |
| 114 | 114 | \OC::$server->getLogger()->logException($e); |
| 115 | - if($e instanceof \OC\HintException) { |
|
| 115 | + if ($e instanceof \OC\HintException) { |
|
| 116 | 116 | throw $e; |
| 117 | 117 | } |
| 118 | - if($e instanceof \OC\ServerNotAvailableException) { |
|
| 118 | + if ($e instanceof \OC\ServerNotAvailableException) { |
|
| 119 | 119 | throw $e; |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -129,15 +129,15 @@ discard block |
||
| 129 | 129 | * @param string $signalClass |
| 130 | 130 | * @param string $signalName |
| 131 | 131 | */ |
| 132 | - static public function clear($signalClass='', $signalName='') { |
|
| 132 | + static public function clear($signalClass = '', $signalName = '') { |
|
| 133 | 133 | if ($signalClass) { |
| 134 | 134 | if ($signalName) { |
| 135 | - self::$registered[$signalClass][$signalName]=[]; |
|
| 136 | - }else{ |
|
| 137 | - self::$registered[$signalClass]=[]; |
|
| 135 | + self::$registered[$signalClass][$signalName] = []; |
|
| 136 | + } else { |
|
| 137 | + self::$registered[$signalClass] = []; |
|
| 138 | 138 | } |
| 139 | - }else{ |
|
| 140 | - self::$registered=[]; |
|
| 139 | + } else { |
|
| 140 | + self::$registered = []; |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * actions that user backends can define |
| 41 | 41 | */ |
| 42 | - const CREATE_USER = 1; // 1 << 0 |
|
| 43 | - const SET_PASSWORD = 16; // 1 << 4 |
|
| 44 | - const CHECK_PASSWORD = 256; // 1 << 8 |
|
| 45 | - const GET_HOME = 4096; // 1 << 12 |
|
| 46 | - const GET_DISPLAYNAME = 65536; // 1 << 16 |
|
| 47 | - const SET_DISPLAYNAME = 1048576; // 1 << 20 |
|
| 48 | - const PROVIDE_AVATAR = 16777216; // 1 << 24 |
|
| 49 | - const COUNT_USERS = 268435456; // 1 << 28 |
|
| 42 | + const CREATE_USER = 1; // 1 << 0 |
|
| 43 | + const SET_PASSWORD = 16; // 1 << 4 |
|
| 44 | + const CHECK_PASSWORD = 256; // 1 << 8 |
|
| 45 | + const GET_HOME = 4096; // 1 << 12 |
|
| 46 | + const GET_DISPLAYNAME = 65536; // 1 << 16 |
|
| 47 | + const SET_DISPLAYNAME = 1048576; // 1 << 20 |
|
| 48 | + const PROVIDE_AVATAR = 16777216; // 1 << 24 |
|
| 49 | + const COUNT_USERS = 268435456; // 1 << 28 |
|
| 50 | 50 | |
| 51 | 51 | protected $possibleActions = [ |
| 52 | 52 | self::CREATE_USER => 'createUser', |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function getSupportedActions() { |
| 70 | 70 | $actions = 0; |
| 71 | - foreach($this->possibleActions as $action => $methodName) { |
|
| 72 | - if(method_exists($this, $methodName)) { |
|
| 71 | + foreach ($this->possibleActions as $action => $methodName) { |
|
| 72 | + if (method_exists($this, $methodName)) { |
|
| 73 | 73 | $actions |= $action; |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * compared with self::CREATE_USER etc. |
| 87 | 87 | */ |
| 88 | 88 | public function implementsActions($actions) { |
| 89 | - return (bool)($this->getSupportedActions() & $actions); |
|
| 89 | + return (bool) ($this->getSupportedActions() & $actions); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |