@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | throw new \RuntimeException("No app with given id <$appId> known."); |
36 | 36 | } |
37 | 37 | |
38 | - if (!file_exists($appPath . '/appinfo/database.xml')) { |
|
38 | + if (!file_exists($appPath.'/appinfo/database.xml')) { |
|
39 | 39 | return ['errors' => [], 'warnings' => []]; |
40 | 40 | } |
41 | 41 | |
42 | 42 | libxml_use_internal_errors(true); |
43 | 43 | $loadEntities = libxml_disable_entity_loader(false); |
44 | - $xml = simplexml_load_file($appPath . '/appinfo/database.xml'); |
|
44 | + $xml = simplexml_load_file($appPath.'/appinfo/database.xml'); |
|
45 | 45 | libxml_disable_entity_loader($loadEntities); |
46 | 46 | |
47 | 47 | |
@@ -49,37 +49,37 @@ discard block |
||
49 | 49 | |
50 | 50 | foreach ($xml->table as $table) { |
51 | 51 | // Table names |
52 | - if (strpos((string)$table->name, '*dbprefix*') !== 0) { |
|
53 | - $errors[] = 'Database schema error: name of table ' . (string)$table->name . ' does not start with *dbprefix*'; |
|
52 | + if (strpos((string) $table->name, '*dbprefix*') !== 0) { |
|
53 | + $errors[] = 'Database schema error: name of table '.(string) $table->name.' does not start with *dbprefix*'; |
|
54 | 54 | } |
55 | - $tableName = substr((string)$table->name, strlen('*dbprefix*')); |
|
55 | + $tableName = substr((string) $table->name, strlen('*dbprefix*')); |
|
56 | 56 | if (strpos($tableName, '*dbprefix*') !== false) { |
57 | - $warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table ' . (string)$table->name; |
|
57 | + $warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table '.(string) $table->name; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if (strlen($tableName) > 27) { |
61 | - $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
61 | + $errors[] = 'Database schema error: Name of table '.(string) $table->name.' is too long ('.strlen($tableName).'), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $hasAutoIncrement = false; |
65 | 65 | |
66 | 66 | // Column names |
67 | 67 | foreach ($table->declaration->field as $column) { |
68 | - if (strpos((string)$column->name, '*dbprefix*') !== false) { |
|
69 | - $warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column ' . (string)$column->name . ' on table ' . (string)$table->name; |
|
68 | + if (strpos((string) $column->name, '*dbprefix*') !== false) { |
|
69 | + $warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column '.(string) $column->name.' on table '.(string) $table->name; |
|
70 | 70 | } |
71 | 71 | |
72 | - if (strlen((string)$column->name) > 30) { |
|
73 | - $errors[] = 'Database schema error: Name of column ' . (string)$column->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 30 characters allowed'; |
|
72 | + if (strlen((string) $column->name) > 30) { |
|
73 | + $errors[] = 'Database schema error: Name of column '.(string) $column->name.' on table '.(string) $table->name.' is too long ('.strlen($tableName).'), max. 30 characters allowed'; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | if ($column->autoincrement) { |
77 | 77 | if ($hasAutoIncrement) { |
78 | - $errors[] = 'Database schema error: Table ' . (string)$table->name . ' has multiple autoincrement columns'; |
|
78 | + $errors[] = 'Database schema error: Table '.(string) $table->name.' has multiple autoincrement columns'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | if (strlen($tableName) > 21) { |
82 | - $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
82 | + $errors[] = 'Database schema error: Name of table '.(string) $table->name.' is too long ('.strlen($tableName).'), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $hasAutoIncrement = true; |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | |
89 | 89 | // Index names |
90 | 90 | foreach ($table->declaration->index as $index) { |
91 | - $hasPrefix = strpos((string)$index->name, '*dbprefix*'); |
|
91 | + $hasPrefix = strpos((string) $index->name, '*dbprefix*'); |
|
92 | 92 | if ($hasPrefix !== false && $hasPrefix !== 0) { |
93 | - $warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index ' . (string)$index->name . ' on table ' . (string)$table->name; |
|
93 | + $warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index '.(string) $index->name.' on table '.(string) $table->name; |
|
94 | 94 | } |
95 | 95 | |
96 | - $indexName = $hasPrefix === 0 ? substr((string)$index->name, strlen('*dbprefix*')) : (string)$index->name; |
|
96 | + $indexName = $hasPrefix === 0 ? substr((string) $index->name, strlen('*dbprefix*')) : (string) $index->name; |
|
97 | 97 | if (strlen($indexName) > 27) { |
98 | - $errors[] = 'Database schema error: Name of index ' . (string)$index->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters + *dbprefix* allowed'; |
|
98 | + $errors[] = 'Database schema error: Name of index '.(string) $index->name.' on table '.(string) $table->name.' is too long ('.strlen($tableName).'), max. 27 characters + *dbprefix* allowed'; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $folder = $this->appData->getFolder($appName); |
73 | 73 | $gzip = false; |
74 | 74 | $file = $this->getFile($folder, $fileName, $gzip); |
75 | - } catch(NotFoundException $e) { |
|
75 | + } catch (NotFoundException $e) { |
|
76 | 76 | return new NotFoundResponse(); |
77 | 77 | } |
78 | 78 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | if (strpos($encoding, 'gzip') !== false) { |
102 | 102 | try { |
103 | 103 | $gzip = true; |
104 | - return $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz |
|
104 | + return $folder->getFile($fileName.'.gzip'); # Safari doesn't like .gz |
|
105 | 105 | } catch (NotFoundException $e) { |
106 | 106 | // continue |
107 | 107 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | $config = \OC::$server->getConfig(); |
26 | 26 | $state = $config->getSystemValue('ldapIgnoreNamingRules', 'doSet'); |
27 | -if($state === 'doSet') { |
|
27 | +if ($state === 'doSet') { |
|
28 | 28 | \OC::$server->getConfig()->setSystemValue('ldapIgnoreNamingRules', false); |
29 | 29 | } |
30 | 30 |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public static function readData($user = null) { |
258 | 258 | if (isset($user)) { |
259 | - $jsonFile = \OC::$server->getUserManager()->get($user)->getHome() . '/mount.json'; |
|
259 | + $jsonFile = \OC::$server->getUserManager()->get($user)->getHome().'/mount.json'; |
|
260 | 260 | } else { |
261 | 261 | $config = \OC::$server->getConfig(); |
262 | - $datadir = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/'); |
|
263 | - $jsonFile = $config->getSystemValue('mount_file', $datadir . '/mount.json'); |
|
262 | + $datadir = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data/'); |
|
263 | + $jsonFile = $config->getSystemValue('mount_file', $datadir.'/mount.json'); |
|
264 | 264 | } |
265 | 265 | if (is_file($jsonFile)) { |
266 | 266 | $mountPoints = json_decode(file_get_contents($jsonFile), true); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | foreach ($backends as $backend) { |
287 | 287 | foreach ($backend->checkDependencies() as $dependency) { |
288 | 288 | if ($message = $dependency->getMessage()) { |
289 | - $message .= '<p>' . $message . '</p>'; |
|
289 | + $message .= '<p>'.$message.'</p>'; |
|
290 | 290 | } else { |
291 | 291 | $dependencyGroups[$dependency->getDependency()][] = $backend; |
292 | 292 | } |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | |
296 | 296 | foreach ($dependencyGroups as $module => $dependants) { |
297 | 297 | $backends = implode(', ', array_map(function($backend) { |
298 | - return '"' . $backend->getText() . '"'; |
|
298 | + return '"'.$backend->getText().'"'; |
|
299 | 299 | }, $dependants)); |
300 | - $message .= '<p>' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends) . '</p>'; |
|
300 | + $message .= '<p>'.OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends).'</p>'; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | return $message; |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | private static function getSingleDependencyMessage(\OCP\IL10N $l, $module, $backend) { |
315 | 315 | switch (strtolower($module)) { |
316 | 316 | case 'curl': |
317 | - return (string)$l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
317 | + return (string) $l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
318 | 318 | case 'ftp': |
319 | - return (string)$l->t('The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
319 | + return (string) $l->t('The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
320 | 320 | default: |
321 | - return (string)$l->t('"%s" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$module, $backend]); |
|
321 | + return (string) $l->t('"%s" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$module, $backend]); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $cipher = self::getCipher(); |
364 | 364 | $iv = \OC::$server->getSecureRandom()->generate(16); |
365 | 365 | $cipher->setIV($iv); |
366 | - return base64_encode($iv . $cipher->encrypt($password)); |
|
366 | + return base64_encode($iv.$cipher->encrypt($password)); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -128,7 +128,7 @@ |
||
128 | 128 | * @since 8.0.0 |
129 | 129 | * @suppress PhanDeprecatedFunction |
130 | 130 | */ |
131 | - public static function html_select_options($options, $selected, $params=array()) { |
|
131 | + public static function html_select_options($options, $selected, $params = array()) { |
|
132 | 132 | return \html_select_options($options, $selected, $params); |
133 | 133 | } |
134 | 134 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function shouldJoinTags(ISearchOperator $operator) { |
76 | 76 | if ($operator instanceof ISearchBinaryOperator) { |
77 | - return array_reduce($operator->getArguments(), function ($shouldJoin, ISearchOperator $operator) { |
|
77 | + return array_reduce($operator->getArguments(), function($shouldJoin, ISearchOperator $operator) { |
|
78 | 78 | return $shouldJoin || $this->shouldJoinTags($operator); |
79 | 79 | }, false); |
80 | 80 | } else if ($operator instanceof ISearchComparison) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param ISearchOperator $operator |
89 | 89 | */ |
90 | 90 | public function searchOperatorArrayToDBExprArray(IQueryBuilder $builder, array $operators) { |
91 | - return array_map(function ($operator) use ($builder) { |
|
91 | + return array_map(function($operator) use ($builder) { |
|
92 | 92 | return $this->searchOperatorToDBExpr($builder, $operator); |
93 | 93 | }, $operators); |
94 | 94 | } |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | case ISearchBinaryOperator::OPERATOR_OR: |
110 | 110 | return call_user_func_array([$expr, 'orX'], $this->searchOperatorArrayToDBExprArray($builder, $operator->getArguments())); |
111 | 111 | default: |
112 | - throw new \InvalidArgumentException('Invalid operator type: ' . $operator->getType()); |
|
112 | + throw new \InvalidArgumentException('Invalid operator type: '.$operator->getType()); |
|
113 | 113 | } |
114 | 114 | } else if ($operator instanceof ISearchComparison) { |
115 | 115 | return $this->searchComparisonToDBExpr($builder, $operator, self::$searchOperatorMap); |
116 | 116 | } else { |
117 | - throw new \InvalidArgumentException('Invalid operator type: ' . get_class($operator)); |
|
117 | + throw new \InvalidArgumentException('Invalid operator type: '.get_class($operator)); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $queryOperator = $operatorMap[$type]; |
127 | 127 | return $builder->expr()->$queryOperator($field, $this->getParameterForValue($builder, $value)); |
128 | 128 | } else { |
129 | - throw new \InvalidArgumentException('Invalid operator type: ' . $comparison->getType()); |
|
129 | + throw new \InvalidArgumentException('Invalid operator type: '.$comparison->getType()); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $type = ISearchComparison::COMPARE_EQUAL; |
146 | 146 | } |
147 | 147 | if (strpos($value, '%') !== false) { |
148 | - throw new \InvalidArgumentException('Unsupported query value for mimetype: ' . $value . ', only values in the format "mime/type" or "mime/%" are supported'); |
|
148 | + throw new \InvalidArgumentException('Unsupported query value for mimetype: '.$value.', only values in the format "mime/type" or "mime/%" are supported'); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | } else if ($field === 'favorite') { |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | ]; |
179 | 179 | |
180 | 180 | if (!isset($types[$operator->getField()])) { |
181 | - throw new \InvalidArgumentException('Unsupported comparison field ' . $operator->getField()); |
|
181 | + throw new \InvalidArgumentException('Unsupported comparison field '.$operator->getField()); |
|
182 | 182 | } |
183 | 183 | $type = $types[$operator->getField()]; |
184 | 184 | if (gettype($operator->getValue()) !== $type) { |
185 | - throw new \InvalidArgumentException('Invalid type for field ' . $operator->getField()); |
|
185 | + throw new \InvalidArgumentException('Invalid type for field '.$operator->getField()); |
|
186 | 186 | } |
187 | 187 | if (!in_array($operator->getType(), $comparisons[$operator->getField()])) { |
188 | - throw new \InvalidArgumentException('Unsupported comparison for field ' . $operator->getField() . ': ' . $operator->getType()); |
|
188 | + throw new \InvalidArgumentException('Unsupported comparison for field '.$operator->getField().': '.$operator->getType()); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | // WARNING: this should be moved to proper AppFramework handling |
24 | 24 | // Check if we are a user |
25 | 25 | if (!\OC::$server->getUserSession()->isLoggedIn()) { |
26 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute( |
|
26 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute( |
|
27 | 27 | 'core.login.showLoginForm', |
28 | 28 | [ |
29 | 29 | 'redirect_url' => \OC::$server->getRequest()->getRequestUri(), |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | // Redirect to 2FA challenge selection if 2FA challenge was not solved yet |
36 | 36 | if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { |
37 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
37 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
38 | 38 | exit(); |
39 | 39 | } |
40 | 40 |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @return IMemcache |
134 | 134 | */ |
135 | 135 | public function createLocking(string $prefix = ''): IMemcache { |
136 | - return new $this->lockingCacheClass($this->globalPrefix . '/' . $prefix); |
|
136 | + return new $this->lockingCacheClass($this->globalPrefix.'/'.$prefix); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return ICache |
144 | 144 | */ |
145 | 145 | public function createDistributed(string $prefix = ''): ICache { |
146 | - return new $this->distributedCacheClass($this->globalPrefix . '/' . $prefix); |
|
146 | + return new $this->distributedCacheClass($this->globalPrefix.'/'.$prefix); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return ICache |
154 | 154 | */ |
155 | 155 | public function createLocal(string $prefix = ''): ICache { |
156 | - return new $this->localCacheClass($this->globalPrefix . '/' . $prefix); |
|
156 | + return new $this->localCacheClass($this->globalPrefix.'/'.$prefix); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | if (!($node instanceof File)) { |
173 | 173 | return new JSONResponse(['data' => ['message' => $this->l->t('Please select a file.')]]); |
174 | 174 | } |
175 | - if ($node->getSize() > 20*1024*1024) { |
|
175 | + if ($node->getSize() > 20 * 1024 * 1024) { |
|
176 | 176 | return new JSONResponse( |
177 | 177 | ['data' => ['message' => $this->l->t('File is too big')]], |
178 | 178 | Http::STATUS_BAD_REQUEST |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | is_uploaded_file($files['tmp_name'][0]) && |
201 | 201 | !\OC\Files\Filesystem::isFileBlacklisted($files['tmp_name'][0]) |
202 | 202 | ) { |
203 | - if ($files['size'][0] > 20*1024*1024) { |
|
203 | + if ($files['size'][0] > 20 * 1024 * 1024) { |
|
204 | 204 | return new JSONResponse( |
205 | 205 | ['data' => ['message' => $this->l->t('File is too big')]], |
206 | 206 | Http::STATUS_BAD_REQUEST |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | Http::STATUS_OK, |
293 | 293 | ['Content-Type' => $image->mimeType()]); |
294 | 294 | |
295 | - $resp->setETag((string)crc32($image->data())); |
|
295 | + $resp->setETag((string) crc32($image->data())); |
|
296 | 296 | $resp->cacheFor(0); |
297 | 297 | $resp->setLastModified(new \DateTime('now', new \DateTimeZone('GMT'))); |
298 | 298 | return $resp; |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | $image = new \OC_Image(); |
327 | 327 | $image->loadFromData($tmpAvatar); |
328 | - $image->crop($crop['x'], $crop['y'], (int)round($crop['w']), (int)round($crop['h'])); |
|
328 | + $image->crop($crop['x'], $crop['y'], (int) round($crop['w']), (int) round($crop['h'])); |
|
329 | 329 | try { |
330 | 330 | $avatar = $this->avatarManager->getAvatar($this->userId); |
331 | 331 | $avatar->set($image); |