@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | return; |
173 | 173 | } |
174 | 174 | |
175 | - $this->dispatcher->dispatch(IGroup::class . '::preAddUser', new GenericEvent($this, [ |
|
175 | + $this->dispatcher->dispatch(IGroup::class.'::preAddUser', new GenericEvent($this, [ |
|
176 | 176 | 'user' => $user, |
177 | 177 | ])); |
178 | 178 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $this->users[$user->getUID()] = $user; |
187 | 187 | } |
188 | 188 | |
189 | - $this->dispatcher->dispatch(IGroup::class . '::postAddUser', new GenericEvent($this, [ |
|
189 | + $this->dispatcher->dispatch(IGroup::class.'::postAddUser', new GenericEvent($this, [ |
|
190 | 190 | 'user' => $user, |
191 | 191 | ])); |
192 | 192 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function removeUser($user) { |
207 | 207 | $result = false; |
208 | - $this->dispatcher->dispatch(IGroup::class . '::preRemoveUser', new GenericEvent($this, [ |
|
208 | + $this->dispatcher->dispatch(IGroup::class.'::preRemoveUser', new GenericEvent($this, [ |
|
209 | 209 | 'user' => $user, |
210 | 210 | ])); |
211 | 211 | if ($this->emitter) { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | } |
220 | 220 | if ($result) { |
221 | - $this->dispatcher->dispatch(IGroup::class . '::postRemoveUser', new GenericEvent($this, [ |
|
221 | + $this->dispatcher->dispatch(IGroup::class.'::postRemoveUser', new GenericEvent($this, [ |
|
222 | 222 | 'user' => $user, |
223 | 223 | ])); |
224 | 224 | if ($this->emitter) { |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | public function count($search = '') { |
265 | 265 | $users = false; |
266 | 266 | foreach ($this->backends as $backend) { |
267 | - if($backend->implementsActions(\OC\Group\Backend::COUNT_USERS)) { |
|
268 | - if($users === false) { |
|
267 | + if ($backend->implementsActions(\OC\Group\Backend::COUNT_USERS)) { |
|
268 | + if ($users === false) { |
|
269 | 269 | //we could directly add to a bool variable, but this would |
270 | 270 | //be ugly |
271 | 271 | $users = 0; |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | public function countDisabled() { |
285 | 285 | $users = false; |
286 | 286 | foreach ($this->backends as $backend) { |
287 | - if($backend instanceOf ICountDisabledInGroup) { |
|
288 | - if($users === false) { |
|
287 | + if ($backend instanceOf ICountDisabledInGroup) { |
|
288 | + if ($users === false) { |
|
289 | 289 | //we could directly add to a bool variable, but this would |
290 | 290 | //be ugly |
291 | 291 | $users = 0; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | $result = false; |
331 | - $this->dispatcher->dispatch(IGroup::class . '::preDelete', new GenericEvent($this)); |
|
331 | + $this->dispatcher->dispatch(IGroup::class.'::preDelete', new GenericEvent($this)); |
|
332 | 332 | if ($this->emitter) { |
333 | 333 | $this->emitter->emit('\OC\Group', 'preDelete', [$this]); |
334 | 334 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | } |
340 | 340 | } |
341 | 341 | if ($result) { |
342 | - $this->dispatcher->dispatch(IGroup::class . '::postDelete', new GenericEvent($this)); |
|
342 | + $this->dispatcher->dispatch(IGroup::class.'::postDelete', new GenericEvent($this)); |
|
343 | 343 | if ($this->emitter) { |
344 | 344 | $this->emitter->emit('\OC\Group', 'postDelete', [$this]); |
345 | 345 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $this->output = $output; |
87 | 87 | |
88 | 88 | if ($user !== '' && $this->userManager->userExists($user) === false) { |
89 | - $this->output->writeln('User "' . $user . '" does not exist. Please check the username and try again'); |
|
89 | + $this->output->writeln('User "'.$user.'" does not exist. Please check the username and try again'); |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | $this->output->writeln('Files for following users couldn\'t be decrypted, '); |
105 | 105 | $this->output->writeln('maybe the user is not set up in a way that supports this operation: '); |
106 | 106 | foreach ($this->failed as $uid => $paths) { |
107 | - $this->output->writeln(' ' . $uid); |
|
107 | + $this->output->writeln(' '.$uid); |
|
108 | 108 | foreach ($paths as $path) { |
109 | - $this->output->writeln(' ' . $path); |
|
109 | + $this->output->writeln(' '.$path); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | $this->output->writeln(''); |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | /** @var IEncryptionModule $module */ |
129 | 129 | $module = call_user_func($moduleDesc['callback']); |
130 | 130 | $this->output->writeln(''); |
131 | - $this->output->writeln('Prepare "' . $module->getDisplayName() . '"'); |
|
131 | + $this->output->writeln('Prepare "'.$module->getDisplayName().'"'); |
|
132 | 132 | $this->output->writeln(''); |
133 | 133 | if ($module->prepareDecryptAll($this->input, $this->output, $user) === false) { |
134 | - $this->output->writeln('Module "' . $moduleDesc['displayName'] . '" does not support the functionality to decrypt all files again or the initialization of the module failed!'); |
|
134 | + $this->output->writeln('Module "'.$moduleDesc['displayName'].'" does not support the functionality to decrypt all files again or the initialization of the module failed!'); |
|
135 | 135 | return false; |
136 | 136 | } |
137 | 137 | } |
@@ -209,16 +209,16 @@ discard block |
||
209 | 209 | |
210 | 210 | $this->setupUserFS($uid); |
211 | 211 | $directories = []; |
212 | - $directories[] = '/' . $uid . '/files'; |
|
212 | + $directories[] = '/'.$uid.'/files'; |
|
213 | 213 | |
214 | 214 | while ($root = array_pop($directories)) { |
215 | 215 | $content = $this->rootView->getDirectoryContent($root); |
216 | 216 | foreach ($content as $file) { |
217 | 217 | // only decrypt files owned by the user |
218 | - if($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) { |
|
218 | + if ($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) { |
|
219 | 219 | continue; |
220 | 220 | } |
221 | - $path = $root . '/' . $file['name']; |
|
221 | + $path = $root.'/'.$file['name']; |
|
222 | 222 | if ($this->rootView->is_dir($path)) { |
223 | 223 | $directories[] = $path; |
224 | 224 | continue; |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | $source = $path; |
265 | - $target = $path . '.decrypted.' . $this->getTimestamp(); |
|
265 | + $target = $path.'.decrypted.'.$this->getTimestamp(); |
|
266 | 266 | |
267 | 267 | try { |
268 | 268 | $this->rootView->copy($source, $target); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
89 | 89 | $path = Filesystem::getPath($params['fileSource']); |
90 | 90 | list($owner, $ownerPath) = $this->getOwnerPath($path); |
91 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
91 | + $absPath = '/'.$owner.'/files/'.$ownerPath; |
|
92 | 92 | $this->update($absPath); |
93 | 93 | } |
94 | 94 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
105 | 105 | $path = Filesystem::getPath($params['fileSource']); |
106 | 106 | list($owner, $ownerPath) = $this->getOwnerPath($path); |
107 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
107 | + $absPath = '/'.$owner.'/files/'.$ownerPath; |
|
108 | 108 | $this->update($absPath); |
109 | 109 | } |
110 | 110 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function postRestore($params) { |
120 | 120 | if ($this->encryptionManager->isEnabled()) { |
121 | - $path = Filesystem::normalizePath('/' . $this->uid . '/files/' . $params['filePath']); |
|
121 | + $path = Filesystem::normalizePath('/'.$this->uid.'/files/'.$params['filePath']); |
|
122 | 122 | $this->update($path); |
123 | 123 | } |
124 | 124 | } |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | public function postRename($params) { |
133 | 133 | $source = $params['oldpath']; |
134 | 134 | $target = $params['newpath']; |
135 | - if( |
|
135 | + if ( |
|
136 | 136 | $this->encryptionManager->isEnabled() && |
137 | 137 | dirname($source) !== dirname($target) |
138 | 138 | ) { |
139 | 139 | list($owner, $ownerPath) = $this->getOwnerPath($target); |
140 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
140 | + $absPath = '/'.$owner.'/files/'.$ownerPath; |
|
141 | 141 | $this->update($absPath); |
142 | 142 | } |
143 | 143 | } |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | protected function getOwnerPath($path) { |
153 | 153 | $info = Filesystem::getFileInfo($path); |
154 | 154 | $owner = Filesystem::getOwner($path); |
155 | - $view = new View('/' . $owner . '/files'); |
|
155 | + $view = new View('/'.$owner.'/files'); |
|
156 | 156 | $path = $view->getPath($info->getId()); |
157 | 157 | if ($path === null) { |
158 | - throw new \InvalidArgumentException('No file found for ' . $info->getId()); |
|
158 | + throw new \InvalidArgumentException('No file found for '.$info->getId()); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | return [$owner, $path]; |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | $apps = self::getEnabledApps(); |
115 | 115 | |
116 | 116 | // Add each apps' folder as allowed class path |
117 | - foreach($apps as $app) { |
|
117 | + foreach ($apps as $app) { |
|
118 | 118 | $path = self::getAppPath($app); |
119 | - if($path !== false) { |
|
119 | + if ($path !== false) { |
|
120 | 120 | self::registerAutoloading($app, $path); |
121 | 121 | } |
122 | 122 | } |
@@ -142,19 +142,19 @@ discard block |
||
142 | 142 | public static function loadApp(string $app) { |
143 | 143 | self::$loadedApps[] = $app; |
144 | 144 | $appPath = self::getAppPath($app); |
145 | - if($appPath === false) { |
|
145 | + if ($appPath === false) { |
|
146 | 146 | return; |
147 | 147 | } |
148 | 148 | |
149 | 149 | // in case someone calls loadApp() directly |
150 | 150 | self::registerAutoloading($app, $appPath); |
151 | 151 | |
152 | - if (is_file($appPath . '/appinfo/app.php')) { |
|
153 | - \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); |
|
152 | + if (is_file($appPath.'/appinfo/app.php')) { |
|
153 | + \OC::$server->getEventLogger()->start('load_app_'.$app, 'Load app: '.$app); |
|
154 | 154 | try { |
155 | 155 | self::requireAppFile($app); |
156 | 156 | } catch (Throwable $ex) { |
157 | - if($ex instanceof ServerNotAvailableException) { |
|
157 | + if ($ex instanceof ServerNotAvailableException) { |
|
158 | 158 | throw $ex; |
159 | 159 | } |
160 | 160 | \OC::$server->getLogger()->logException($ex); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | \OC::$server->getAppManager()->disableApp($app, true); |
165 | 165 | } |
166 | 166 | } |
167 | - \OC::$server->getEventLogger()->end('load_app_' . $app); |
|
167 | + \OC::$server->getEventLogger()->end('load_app_'.$app); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $info = self::getAppInfo($app); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $plugins = isset($info['collaboration']['plugins']['plugin']['@value']) ? |
211 | 211 | [$info['collaboration']['plugins']['plugin']] : $info['collaboration']['plugins']['plugin']; |
212 | 212 | foreach ($plugins as $plugin) { |
213 | - if($plugin['@attributes']['type'] === 'collaborator-search') { |
|
213 | + if ($plugin['@attributes']['type'] === 'collaborator-search') { |
|
214 | 214 | $pluginInfo = [ |
215 | 215 | 'shareType' => $plugin['@attributes']['share-type'], |
216 | 216 | 'class' => $plugin['@value'], |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param bool $force |
231 | 231 | */ |
232 | 232 | public static function registerAutoloading(string $app, string $path, bool $force = false) { |
233 | - $key = $app . '-' . $path; |
|
233 | + $key = $app.'-'.$path; |
|
234 | 234 | if (!$force && isset(self::$alreadyRegistered[$key])) { |
235 | 235 | return; |
236 | 236 | } |
@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | $appNamespace = \OC\AppFramework\App::buildAppNamespace($app); |
242 | 242 | \OC::$server->registerNamespace($app, $appNamespace); |
243 | 243 | |
244 | - if (file_exists($path . '/composer/autoload.php')) { |
|
245 | - require_once $path . '/composer/autoload.php'; |
|
244 | + if (file_exists($path.'/composer/autoload.php')) { |
|
245 | + require_once $path.'/composer/autoload.php'; |
|
246 | 246 | } else { |
247 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true); |
|
247 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true); |
|
248 | 248 | // Register on legacy autoloader |
249 | 249 | \OC::$loader->addValidRoot($path); |
250 | 250 | } |
251 | 251 | |
252 | 252 | // Register Test namespace only when testing |
253 | 253 | if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) { |
254 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true); |
|
254 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | private static function requireAppFile(string $app) { |
265 | 265 | // encapsulated here to avoid variable scope conflicts |
266 | - require_once $app . '/appinfo/app.php'; |
|
266 | + require_once $app.'/appinfo/app.php'; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | public static function setAppTypes(string $app) { |
309 | 309 | $appManager = \OC::$server->getAppManager(); |
310 | 310 | $appData = $appManager->getAppInfo($app); |
311 | - if(!is_array($appData)) { |
|
311 | + if (!is_array($appData)) { |
|
312 | 312 | return; |
313 | 313 | } |
314 | 314 | |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | } else { |
357 | 357 | $apps = $appManager->getEnabledAppsForUser($user); |
358 | 358 | } |
359 | - $apps = array_filter($apps, function ($app) { |
|
360 | - return $app !== 'files';//we add this manually |
|
359 | + $apps = array_filter($apps, function($app) { |
|
360 | + return $app !== 'files'; //we add this manually |
|
361 | 361 | }); |
362 | 362 | sort($apps); |
363 | 363 | array_unshift($apps, 'files'); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $installer = \OC::$server->query(Installer::class); |
396 | 396 | $isDownloaded = $installer->isDownloaded($appId); |
397 | 397 | |
398 | - if(!$isDownloaded) { |
|
398 | + if (!$isDownloaded) { |
|
399 | 399 | $installer->downloadApp($appId); |
400 | 400 | } |
401 | 401 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | */ |
447 | 447 | public static function findAppInDirectories(string $appId) { |
448 | 448 | $sanitizedAppId = self::cleanAppId($appId); |
449 | - if($sanitizedAppId !== $appId) { |
|
449 | + if ($sanitizedAppId !== $appId) { |
|
450 | 450 | return false; |
451 | 451 | } |
452 | 452 | static $app_dir = []; |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | |
458 | 458 | $possibleApps = []; |
459 | 459 | foreach (OC::$APPSROOTS as $dir) { |
460 | - if (file_exists($dir['path'] . '/' . $appId)) { |
|
460 | + if (file_exists($dir['path'].'/'.$appId)) { |
|
461 | 461 | $possibleApps[] = $dir; |
462 | 462 | } |
463 | 463 | } |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } else { |
472 | 472 | $versionToLoad = []; |
473 | 473 | foreach ($possibleApps as $possibleApp) { |
474 | - $version = self::getAppVersionByPath($possibleApp['path'] . '/' . $appId); |
|
474 | + $version = self::getAppVersionByPath($possibleApp['path'].'/'.$appId); |
|
475 | 475 | if (empty($versionToLoad) || version_compare($version, $versionToLoad['version'], '>')) { |
476 | 476 | $versionToLoad = [ |
477 | 477 | 'dir' => $possibleApp, |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | } |
500 | 500 | |
501 | 501 | if (($dir = self::findAppInDirectories($appId)) != false) { |
502 | - return $dir['path'] . '/' . $appId; |
|
502 | + return $dir['path'].'/'.$appId; |
|
503 | 503 | } |
504 | 504 | return false; |
505 | 505 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | */ |
515 | 515 | public static function getAppWebPath(string $appId) { |
516 | 516 | if (($dir = self::findAppInDirectories($appId)) != false) { |
517 | - return OC::$WEBROOT . $dir['url'] . '/' . $appId; |
|
517 | + return OC::$WEBROOT.$dir['url'].'/'.$appId; |
|
518 | 518 | } |
519 | 519 | return false; |
520 | 520 | } |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | * @return string |
539 | 539 | */ |
540 | 540 | public static function getAppVersionByPath(string $path): string { |
541 | - $infoFile = $path . '/appinfo/info.xml'; |
|
541 | + $infoFile = $path.'/appinfo/info.xml'; |
|
542 | 542 | $appData = \OC::$server->getAppManager()->getAppInfo($infoFile, true); |
543 | 543 | return isset($appData['version']) ? $appData['version'] : ''; |
544 | 544 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | * @param string $page |
639 | 639 | */ |
640 | 640 | public static function registerAdmin(string $app, string $page) { |
641 | - self::$adminForms[] = $app . '/' . $page . '.php'; |
|
641 | + self::$adminForms[] = $app.'/'.$page.'.php'; |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | /** |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | * @param string $page |
648 | 648 | */ |
649 | 649 | public static function registerPersonal(string $app, string $page) { |
650 | - self::$personalForms[] = $app . '/' . $page . '.php'; |
|
650 | + self::$personalForms[] = $app.'/'.$page.'.php'; |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | /** |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | |
677 | 677 | foreach (OC::$APPSROOTS as $apps_dir) { |
678 | 678 | if (!is_readable($apps_dir['path'])) { |
679 | - \OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], ILogger::WARN); |
|
679 | + \OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], ILogger::WARN); |
|
680 | 680 | continue; |
681 | 681 | } |
682 | 682 | $dh = opendir($apps_dir['path']); |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | if (is_resource($dh)) { |
685 | 685 | while (($file = readdir($dh)) !== false) { |
686 | 686 | |
687 | - if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) { |
|
687 | + if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) { |
|
688 | 688 | |
689 | 689 | $apps[] = $file; |
690 | 690 | } |
@@ -720,12 +720,12 @@ discard block |
||
720 | 720 | |
721 | 721 | $info = OC_App::getAppInfo($app, false, $langCode); |
722 | 722 | if (!is_array($info)) { |
723 | - \OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR); |
|
723 | + \OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', ILogger::ERROR); |
|
724 | 724 | continue; |
725 | 725 | } |
726 | 726 | |
727 | 727 | if (!isset($info['name'])) { |
728 | - \OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', ILogger::ERROR); |
|
728 | + \OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', ILogger::ERROR); |
|
729 | 729 | continue; |
730 | 730 | } |
731 | 731 | |
@@ -756,13 +756,13 @@ discard block |
||
756 | 756 | } |
757 | 757 | |
758 | 758 | $appPath = self::getAppPath($app); |
759 | - if($appPath !== false) { |
|
760 | - $appIcon = $appPath . '/img/' . $app . '.svg'; |
|
759 | + if ($appPath !== false) { |
|
760 | + $appIcon = $appPath.'/img/'.$app.'.svg'; |
|
761 | 761 | if (file_exists($appIcon)) { |
762 | - $info['preview'] = $urlGenerator->imagePath($app, $app . '.svg'); |
|
762 | + $info['preview'] = $urlGenerator->imagePath($app, $app.'.svg'); |
|
763 | 763 | $info['previewAsIcon'] = true; |
764 | 764 | } else { |
765 | - $appIcon = $appPath . '/img/app.svg'; |
|
765 | + $appIcon = $appPath.'/img/app.svg'; |
|
766 | 766 | if (file_exists($appIcon)) { |
767 | 767 | $info['preview'] = $urlGenerator->imagePath($app, 'app.svg'); |
768 | 768 | $info['previewAsIcon'] = true; |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | public static function getAppVersions() { |
884 | 884 | static $versions; |
885 | 885 | |
886 | - if(!$versions) { |
|
886 | + if (!$versions) { |
|
887 | 887 | $appConfig = \OC::$server->getAppConfig(); |
888 | 888 | $versions = $appConfig->getValues(false, 'installed_version'); |
889 | 889 | } |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | */ |
899 | 899 | public static function updateApp(string $appId): bool { |
900 | 900 | $appPath = self::getAppPath($appId); |
901 | - if($appPath === false) { |
|
901 | + if ($appPath === false) { |
|
902 | 902 | return false; |
903 | 903 | } |
904 | 904 | |
@@ -908,8 +908,8 @@ discard block |
||
908 | 908 | self::registerAutoloading($appId, $appPath, true); |
909 | 909 | self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']); |
910 | 910 | |
911 | - if (file_exists($appPath . '/appinfo/database.xml')) { |
|
912 | - OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml'); |
|
911 | + if (file_exists($appPath.'/appinfo/database.xml')) { |
|
912 | + OC_DB::updateDbFromStructure($appPath.'/appinfo/database.xml'); |
|
913 | 913 | } else { |
914 | 914 | $ms = new MigrationService($appId, \OC::$server->getDatabaseConnection()); |
915 | 915 | $ms->migrate(); |
@@ -922,23 +922,23 @@ discard block |
||
922 | 922 | \OC::$server->getAppManager()->getAppVersion($appId, false); |
923 | 923 | |
924 | 924 | // run upgrade code |
925 | - if (file_exists($appPath . '/appinfo/update.php')) { |
|
925 | + if (file_exists($appPath.'/appinfo/update.php')) { |
|
926 | 926 | self::loadApp($appId); |
927 | - include $appPath . '/appinfo/update.php'; |
|
927 | + include $appPath.'/appinfo/update.php'; |
|
928 | 928 | } |
929 | 929 | self::setupBackgroundJobs($appData['background-jobs']); |
930 | 930 | |
931 | 931 | //set remote/public handlers |
932 | 932 | if (array_key_exists('ocsid', $appData)) { |
933 | 933 | \OC::$server->getConfig()->setAppValue($appId, 'ocsid', $appData['ocsid']); |
934 | - } elseif(\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
934 | + } elseif (\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
935 | 935 | \OC::$server->getConfig()->deleteAppValue($appId, 'ocsid'); |
936 | 936 | } |
937 | 937 | foreach ($appData['remote'] as $name => $path) { |
938 | - \OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path); |
|
938 | + \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path); |
|
939 | 939 | } |
940 | 940 | foreach ($appData['public'] as $name => $path) { |
941 | - \OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path); |
|
941 | + \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | self::setAppTypes($appId); |
@@ -1008,17 +1008,17 @@ discard block |
||
1008 | 1008 | public static function getStorage(string $appId) { |
1009 | 1009 | if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check |
1010 | 1010 | if (\OC::$server->getUserSession()->isLoggedIn()) { |
1011 | - $view = new \OC\Files\View('/' . OC_User::getUser()); |
|
1011 | + $view = new \OC\Files\View('/'.OC_User::getUser()); |
|
1012 | 1012 | if (!$view->file_exists($appId)) { |
1013 | 1013 | $view->mkdir($appId); |
1014 | 1014 | } |
1015 | - return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId); |
|
1015 | + return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId); |
|
1016 | 1016 | } else { |
1017 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', ILogger::ERROR); |
|
1017 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', ILogger::ERROR); |
|
1018 | 1018 | return false; |
1019 | 1019 | } |
1020 | 1020 | } else { |
1021 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', ILogger::ERROR); |
|
1021 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', ILogger::ERROR); |
|
1022 | 1022 | return false; |
1023 | 1023 | } |
1024 | 1024 | } |
@@ -1055,9 +1055,9 @@ discard block |
||
1055 | 1055 | |
1056 | 1056 | if ($attributeLang === $similarLang) { |
1057 | 1057 | $similarLangFallback = $option['@value']; |
1058 | - } else if (strpos($attributeLang, $similarLang . '_') === 0) { |
|
1058 | + } else if (strpos($attributeLang, $similarLang.'_') === 0) { |
|
1059 | 1059 | if ($similarLangFallback === false) { |
1060 | - $similarLangFallback = $option['@value']; |
|
1060 | + $similarLangFallback = $option['@value']; |
|
1061 | 1061 | } |
1062 | 1062 | } |
1063 | 1063 | } else { |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | $data['description'] = trim(self::findBestL10NOption($data['description'], $lang)); |
1093 | 1093 | } else if (isset($data['description']) && is_string($data['description'])) { |
1094 | 1094 | $data['description'] = trim($data['description']); |
1095 | - } else { |
|
1095 | + } else { |
|
1096 | 1096 | $data['description'] = ''; |
1097 | 1097 | } |
1098 | 1098 |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | * |
52 | 52 | * TODO: write example |
53 | 53 | */ |
54 | - static public function connect($signalClass, $signalName, $slotClass, $slotName ) { |
|
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 |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | public static function computerFileSize($str) { |
98 | 98 | $str = strtolower($str); |
99 | 99 | if (is_numeric($str)) { |
100 | - return (float)$str; |
|
100 | + return (float) $str; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | $bytes_array = [ |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | 'p' => 1024 * 1024 * 1024 * 1024 * 1024, |
115 | 115 | ]; |
116 | 116 | |
117 | - $bytes = (float)$str; |
|
117 | + $bytes = (float) $str; |
|
118 | 118 | |
119 | 119 | if (preg_match('#([kmgtp]?b?)$#si', $str, $matches) && !empty($bytes_array[$matches[1]])) { |
120 | 120 | $bytes *= $bytes_array[$matches[1]]; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | foreach ($dirs as $dir) { |
231 | 231 | foreach ($exts as $ext) { |
232 | - if ($check_fn("$dir/$name" . $ext)) |
|
232 | + if ($check_fn("$dir/$name".$ext)) |
|
233 | 233 | return true; |
234 | 234 | } |
235 | 235 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $ext = ''; |
301 | 301 | } |
302 | 302 | |
303 | - $newpath = $path . '/' . $filename; |
|
303 | + $newpath = $path.'/'.$filename; |
|
304 | 304 | if ($view->file_exists($newpath)) { |
305 | 305 | if (preg_match_all('/\((\d+)\)/', $name, $matches, PREG_OFFSET_CAPTURE)) { |
306 | 306 | //Replace the last "(number)" with "(number+1)" |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | do { |
317 | 317 | if ($offset) { |
318 | 318 | //Replace the last "(number)" with "(number+1)" |
319 | - $newname = substr_replace($name, '(' . $counter . ')', $offset, $match_length); |
|
319 | + $newname = substr_replace($name, '('.$counter.')', $offset, $match_length); |
|
320 | 320 | } else { |
321 | - $newname = $name . ' (' . $counter . ')'; |
|
321 | + $newname = $name.' ('.$counter.')'; |
|
322 | 322 | } |
323 | - $newpath = $path . '/' . $newname . $ext; |
|
323 | + $newpath = $path.'/'.$newname.$ext; |
|
324 | 324 | $counter++; |
325 | 325 | } while ($view->file_exists($newpath)); |
326 | 326 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * @return int number of bytes representing |
384 | 384 | */ |
385 | 385 | public static function maxUploadFilesize($dir, $freeSpace = null) { |
386 | - if (is_null($freeSpace) || $freeSpace < 0){ |
|
386 | + if (is_null($freeSpace) || $freeSpace < 0) { |
|
387 | 387 | $freeSpace = self::freeSpace($dir); |
388 | 388 | } |
389 | 389 | return min($freeSpace, self::uploadLimit()); |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $freeSpace = max($freeSpace, 0); |
402 | 402 | return $freeSpace; |
403 | 403 | } else { |
404 | - return (INF > 0)? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188 |
|
404 | + return (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188 |
|
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | $ini = \OC::$server->getIniWrapper(); |
415 | 415 | $upload_max_filesize = OCP\Util::computerFileSize($ini->get('upload_max_filesize')); |
416 | 416 | $post_max_size = OCP\Util::computerFileSize($ini->get('post_max_size')); |
417 | - if ((int)$upload_max_filesize === 0 and (int)$post_max_size === 0) { |
|
417 | + if ((int) $upload_max_filesize === 0 and (int) $post_max_size === 0) { |
|
418 | 418 | return INF; |
419 | - } elseif ((int)$upload_max_filesize === 0 or (int)$post_max_size === 0) { |
|
419 | + } elseif ((int) $upload_max_filesize === 0 or (int) $post_max_size === 0) { |
|
420 | 420 | return max($upload_max_filesize, $post_max_size); //only the non 0 value counts |
421 | 421 | } else { |
422 | 422 | return min($upload_max_filesize, $post_max_size); |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $ownerId = $storage->getOwner($path); |
544 | 544 | $ownerDisplayName = ''; |
545 | 545 | $owner = \OC::$server->getUserManager()->get($ownerId); |
546 | - if($owner) { |
|
546 | + if ($owner) { |
|
547 | 547 | $ownerDisplayName = $owner->getDisplayName(); |
548 | 548 | } |
549 | 549 |
@@ -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 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | return $storage; |
263 | 263 | }); |
264 | 264 | |
265 | - \OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
265 | + \OC\Files\Filesystem::addStorageWrapper('readonly', function($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) { |
|
266 | 266 | /* |
267 | 267 | * Do not allow any operations that modify the storage |
268 | 268 | */ |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | //if we aren't logged in, there is no use to set up the filesystem |
305 | 305 | if ($user != "") { |
306 | 306 | |
307 | - $userDir = '/' . $user . '/files'; |
|
307 | + $userDir = '/'.$user.'/files'; |
|
308 | 308 | |
309 | 309 | //jail the user into his "home" directory |
310 | 310 | \OC\Files\Filesystem::init($user, $userDir); |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | return \OCP\Files\FileInfo::SPACE_UNLIMITED; |
385 | 385 | } |
386 | 386 | $userQuota = $user->getQuota(); |
387 | - if($userQuota === 'none') { |
|
387 | + if ($userQuota === 'none') { |
|
388 | 388 | return \OCP\Files\FileInfo::SPACE_UNLIMITED; |
389 | 389 | } |
390 | 390 | return OC_Helper::computerFileSize($userQuota); |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | */ |
402 | 402 | public static function copySkeleton($userId, \OCP\Files\Folder $userDirectory) { |
403 | 403 | |
404 | - $plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton'); |
|
404 | + $plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT.'/core/skeleton'); |
|
405 | 405 | $userLang = \OC::$server->getL10NFactory()->findLanguage(); |
406 | 406 | $skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory); |
407 | 407 | |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | if ($instanceId === null) { |
424 | 424 | throw new \RuntimeException('no instance id!'); |
425 | 425 | } |
426 | - $appdata = 'appdata_' . $instanceId; |
|
426 | + $appdata = 'appdata_'.$instanceId; |
|
427 | 427 | if ($userId === $appdata) { |
428 | - throw new \RuntimeException('username is reserved name: ' . $appdata); |
|
428 | + throw new \RuntimeException('username is reserved name: '.$appdata); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | if (!empty($skeletonDirectory)) { |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | |
453 | 453 | // Verify if folder exists |
454 | 454 | $dir = opendir($source); |
455 | - if($dir === false) { |
|
455 | + if ($dir === false) { |
|
456 | 456 | $logger->error(sprintf('Could not opendir "%s"', $source), ['app' => 'core']); |
457 | 457 | return; |
458 | 458 | } |
@@ -460,14 +460,14 @@ discard block |
||
460 | 460 | // Copy the files |
461 | 461 | while (false !== ($file = readdir($dir))) { |
462 | 462 | if (!\OC\Files\Filesystem::isIgnoredDir($file)) { |
463 | - if (is_dir($source . '/' . $file)) { |
|
463 | + if (is_dir($source.'/'.$file)) { |
|
464 | 464 | $child = $target->newFolder($file); |
465 | - self::copyr($source . '/' . $file, $child); |
|
465 | + self::copyr($source.'/'.$file, $child); |
|
466 | 466 | } else { |
467 | 467 | $child = $target->newFile($file); |
468 | - $sourceStream = fopen($source . '/' . $file, 'r'); |
|
469 | - if($sourceStream === false) { |
|
470 | - $logger->error(sprintf('Could not fopen "%s"', $source . '/' . $file), ['app' => 'core']); |
|
468 | + $sourceStream = fopen($source.'/'.$file, 'r'); |
|
469 | + if ($sourceStream === false) { |
|
470 | + $logger->error(sprintf('Could not fopen "%s"', $source.'/'.$file), ['app' => 'core']); |
|
471 | 471 | closedir($dir); |
472 | 472 | return; |
473 | 473 | } |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | return; |
545 | 545 | } |
546 | 546 | |
547 | - $timestamp = filemtime(OC::$SERVERROOT . '/version.php'); |
|
548 | - require OC::$SERVERROOT . '/version.php'; |
|
547 | + $timestamp = filemtime(OC::$SERVERROOT.'/version.php'); |
|
548 | + require OC::$SERVERROOT.'/version.php'; |
|
549 | 549 | /** @var $timestamp int */ |
550 | 550 | self::$versionCache['OC_Version_Timestamp'] = $timestamp; |
551 | 551 | /** @var $OC_Version string */ |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | |
593 | 593 | // core js files need separate handling |
594 | 594 | if ($application !== 'core' && $file !== null) { |
595 | - self::addTranslations ( $application ); |
|
595 | + self::addTranslations($application); |
|
596 | 596 | } |
597 | 597 | self::addExternalResource($application, $prepend, $path, "script"); |
598 | 598 | } |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | if ($type === "style") { |
670 | 670 | if (!in_array($path, self::$styles)) { |
671 | 671 | if ($prepend === true) { |
672 | - array_unshift ( self::$styles, $path ); |
|
672 | + array_unshift(self::$styles, $path); |
|
673 | 673 | } else { |
674 | 674 | self::$styles[] = $path; |
675 | 675 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | } elseif ($type === "script") { |
678 | 678 | if (!in_array($path, self::$scripts)) { |
679 | 679 | if ($prepend === true) { |
680 | - array_unshift ( self::$scripts, $path ); |
|
680 | + array_unshift(self::$scripts, $path); |
|
681 | 681 | } else { |
682 | 682 | self::$scripts [] = $path; |
683 | 683 | } |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | 'text' => $text |
702 | 702 | ]; |
703 | 703 | if ($prepend === true) { |
704 | - array_unshift (self::$headers, $header); |
|
704 | + array_unshift(self::$headers, $header); |
|
705 | 705 | |
706 | 706 | } else { |
707 | 707 | self::$headers[] = $header; |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | public static function checkServer(\OC\SystemConfig $config) { |
718 | 718 | $l = \OC::$server->getL10N('lib'); |
719 | 719 | $errors = []; |
720 | - $CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT . '/data'); |
|
720 | + $CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT.'/data'); |
|
721 | 721 | |
722 | 722 | if (!self::needUpgrade($config) && $config->getValue('installed', false)) { |
723 | 723 | // this check needs to be done every time |
@@ -752,14 +752,14 @@ discard block |
||
752 | 752 | } |
753 | 753 | |
754 | 754 | // Check if config folder is writable. |
755 | - if(!OC_Helper::isReadOnlyConfigEnabled()) { |
|
755 | + if (!OC_Helper::isReadOnlyConfigEnabled()) { |
|
756 | 756 | if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) { |
757 | 757 | $errors[] = [ |
758 | 758 | 'error' => $l->t('Cannot write into "config" directory'), |
759 | 759 | 'hint' => $l->t('This can usually be fixed by giving the webserver write access to the config directory. See %s', |
760 | - [ $urlGenerator->linkToDocs('admin-dir_permissions') ]) . '. ' |
|
760 | + [$urlGenerator->linkToDocs('admin-dir_permissions')]).'. ' |
|
761 | 761 | . $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', |
762 | - [ $urlGenerator->linkToDocs('admin-config') ] ) |
|
762 | + [$urlGenerator->linkToDocs('admin-config')]) |
|
763 | 763 | ]; |
764 | 764 | } |
765 | 765 | } |
@@ -893,15 +893,15 @@ discard block |
||
893 | 893 | } |
894 | 894 | } |
895 | 895 | |
896 | - foreach($missingDependencies as $missingDependency) { |
|
896 | + foreach ($missingDependencies as $missingDependency) { |
|
897 | 897 | $errors[] = [ |
898 | 898 | 'error' => $l->t('PHP module %s not installed.', [$missingDependency]), |
899 | 899 | 'hint' => $moduleHint |
900 | 900 | ]; |
901 | 901 | $webServerRestart = true; |
902 | 902 | } |
903 | - foreach($invalidIniSettings as $setting) { |
|
904 | - if(is_bool($setting[1])) { |
|
903 | + foreach ($invalidIniSettings as $setting) { |
|
904 | + if (is_bool($setting[1])) { |
|
905 | 905 | $setting[1] = $setting[1] ? 'on' : 'off'; |
906 | 906 | } |
907 | 907 | $errors[] = [ |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | * TODO: Should probably be implemented in the above generic dependency |
920 | 920 | * check somehow in the long-term. |
921 | 921 | */ |
922 | - if($iniWrapper->getBool('mbstring.func_overload') !== null && |
|
922 | + if ($iniWrapper->getBool('mbstring.func_overload') !== null && |
|
923 | 923 | $iniWrapper->getBool('mbstring.func_overload') === true) { |
924 | 924 | $errors[] = [ |
925 | 925 | 'error' => $l->t('mbstring.func_overload is set to "%s" instead of the expected value "0"', [$iniWrapper->getString('mbstring.func_overload')]), |
@@ -927,16 +927,16 @@ discard block |
||
927 | 927 | ]; |
928 | 928 | } |
929 | 929 | |
930 | - if(function_exists('xml_parser_create') && |
|
931 | - LIBXML_LOADED_VERSION < 20700 ) { |
|
930 | + if (function_exists('xml_parser_create') && |
|
931 | + LIBXML_LOADED_VERSION < 20700) { |
|
932 | 932 | $version = LIBXML_LOADED_VERSION; |
933 | - $major = floor($version/10000); |
|
933 | + $major = floor($version / 10000); |
|
934 | 934 | $version -= ($major * 10000); |
935 | - $minor = floor($version/100); |
|
935 | + $minor = floor($version / 100); |
|
936 | 936 | $version -= ($minor * 100); |
937 | 937 | $patch = $version; |
938 | 938 | $errors[] = [ |
939 | - 'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major . '.' . $minor . '.' . $patch]), |
|
939 | + 'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major.'.'.$minor.'.'.$patch]), |
|
940 | 940 | 'hint' => $l->t('To fix this issue update your libxml2 version and restart your web server.') |
941 | 941 | ]; |
942 | 942 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | * @return array arrays with error messages and hints |
1003 | 1003 | */ |
1004 | 1004 | public static function checkDataDirectoryPermissions($dataDirectory) { |
1005 | - if(\OC::$server->getConfig()->getSystemValue('check_data_directory_permissions', true) === false) { |
|
1005 | + if (\OC::$server->getConfig()->getSystemValue('check_data_directory_permissions', true) === false) { |
|
1006 | 1006 | return []; |
1007 | 1007 | } |
1008 | 1008 | $l = \OC::$server->getL10N('lib'); |
@@ -1040,10 +1040,10 @@ discard block |
||
1040 | 1040 | 'hint' => $l->t('Check the value of "datadirectory" in your configuration') |
1041 | 1041 | ]; |
1042 | 1042 | } |
1043 | - if (!file_exists($dataDirectory . '/.ocdata')) { |
|
1043 | + if (!file_exists($dataDirectory.'/.ocdata')) { |
|
1044 | 1044 | $errors[] = [ |
1045 | 1045 | 'error' => $l->t('Your data directory is invalid'), |
1046 | - 'hint' => $l->t('Ensure there is a file called ".ocdata"' . |
|
1046 | + 'hint' => $l->t('Ensure there is a file called ".ocdata"'. |
|
1047 | 1047 | ' in the root of the data directory.') |
1048 | 1048 | ]; |
1049 | 1049 | } |
@@ -1059,7 +1059,7 @@ discard block |
||
1059 | 1059 | public static function checkLoggedIn() { |
1060 | 1060 | // Check if we are a user |
1061 | 1061 | if (!\OC::$server->getUserSession()->isLoggedIn()) { |
1062 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute( |
|
1062 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute( |
|
1063 | 1063 | 'core.login.showLoginForm', |
1064 | 1064 | [ |
1065 | 1065 | 'redirect_url' => \OC::$server->getRequest()->getRequestUri(), |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | } |
1071 | 1071 | // Redirect to 2FA challenge selection if 2FA challenge was not solved yet |
1072 | 1072 | if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { |
1073 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
1073 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
1074 | 1074 | exit(); |
1075 | 1075 | } |
1076 | 1076 | } |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | public static function checkAdminUser() { |
1084 | 1084 | OC_Util::checkLoggedIn(); |
1085 | 1085 | if (!OC_User::isAdminUser(OC_User::getUser())) { |
1086 | - header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); |
|
1086 | + header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php')); |
|
1087 | 1087 | exit(); |
1088 | 1088 | } |
1089 | 1089 | } |
@@ -1119,10 +1119,10 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | } |
1121 | 1121 | |
1122 | - if($config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') { |
|
1123 | - $location = $urlGenerator->getAbsoluteURL('/apps/' . $appId . '/'); |
|
1122 | + if ($config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') { |
|
1123 | + $location = $urlGenerator->getAbsoluteURL('/apps/'.$appId.'/'); |
|
1124 | 1124 | } else { |
1125 | - $location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/'); |
|
1125 | + $location = $urlGenerator->getAbsoluteURL('/index.php/apps/'.$appId.'/'); |
|
1126 | 1126 | } |
1127 | 1127 | } |
1128 | 1128 | } |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | */ |
1137 | 1137 | public static function redirectToDefaultPage() { |
1138 | 1138 | $location = self::getDefaultPageUrl(); |
1139 | - header('Location: ' . $location); |
|
1139 | + header('Location: '.$location); |
|
1140 | 1140 | exit(); |
1141 | 1141 | } |
1142 | 1142 | |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | $id = \OC::$server->getSystemConfig()->getValue('instanceid', null); |
1150 | 1150 | if (is_null($id)) { |
1151 | 1151 | // We need to guarantee at least one letter in instanceid so it can be used as the session_name |
1152 | - $id = 'oc' . \OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
1152 | + $id = 'oc'.\OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
1153 | 1153 | \OC::$server->getSystemConfig()->setValue('instanceid', $id); |
1154 | 1154 | } |
1155 | 1155 | return $id; |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | }, $value); |
1172 | 1172 | } else { |
1173 | 1173 | // Specify encoding for PHP<5.4 |
1174 | - $value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1174 | + $value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8'); |
|
1175 | 1175 | } |
1176 | 1176 | return $value; |
1177 | 1177 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | $testContent = 'This is used for testing whether htaccess is properly enabled to disallow access from the outside. This file can be safely removed.'; |
1205 | 1205 | |
1206 | 1206 | // creating a test file |
1207 | - $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName; |
|
1207 | + $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName; |
|
1208 | 1208 | |
1209 | 1209 | if (file_exists($testFile)) {// already running this test, possible recursive call |
1210 | 1210 | return false; |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | $fp = @fopen($testFile, 'w'); |
1214 | 1214 | if (!$fp) { |
1215 | 1215 | throw new OC\HintException('Can\'t create test file to check for working .htaccess file.', |
1216 | - 'Make sure it is possible for the webserver to write to ' . $testFile); |
|
1216 | + 'Make sure it is possible for the webserver to write to '.$testFile); |
|
1217 | 1217 | } |
1218 | 1218 | fwrite($fp, $testContent); |
1219 | 1219 | fclose($fp); |
@@ -1240,10 +1240,10 @@ discard block |
||
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | $fileName = '/htaccesstest.txt'; |
1243 | - $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName; |
|
1243 | + $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName; |
|
1244 | 1244 | |
1245 | 1245 | // accessing the file via http |
1246 | - $url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT . '/data' . $fileName); |
|
1246 | + $url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT.'/data'.$fileName); |
|
1247 | 1247 | try { |
1248 | 1248 | $content = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody(); |
1249 | 1249 | } catch (\Exception $e) { |
@@ -1251,9 +1251,9 @@ discard block |
||
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | if (strpos($url, 'https:') === 0) { |
1254 | - $url = 'http:' . substr($url, 6); |
|
1254 | + $url = 'http:'.substr($url, 6); |
|
1255 | 1255 | } else { |
1256 | - $url = 'https:' . substr($url, 5); |
|
1256 | + $url = 'https:'.substr($url, 5); |
|
1257 | 1257 | } |
1258 | 1258 | |
1259 | 1259 | try { |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | $theme = \OC::$server->getSystemConfig()->getValue("theme", ''); |
1338 | 1338 | |
1339 | 1339 | if ($theme === '') { |
1340 | - if (is_dir(OC::$SERVERROOT . '/themes/default')) { |
|
1340 | + if (is_dir(OC::$SERVERROOT.'/themes/default')) { |
|
1341 | 1341 | $theme = 'default'; |
1342 | 1342 | } |
1343 | 1343 | } |
@@ -1352,13 +1352,13 @@ discard block |
||
1352 | 1352 | * @return bool|string |
1353 | 1353 | */ |
1354 | 1354 | public static function normalizeUnicode($value) { |
1355 | - if(Normalizer::isNormalized($value)) { |
|
1355 | + if (Normalizer::isNormalized($value)) { |
|
1356 | 1356 | return $value; |
1357 | 1357 | } |
1358 | 1358 | |
1359 | 1359 | $normalizedValue = Normalizer::normalize($value); |
1360 | 1360 | if ($normalizedValue === null || $normalizedValue === false) { |
1361 | - \OC::$server->getLogger()->warning('normalizing failed for "' . $value . '"', ['app' => 'core']); |
|
1361 | + \OC::$server->getLogger()->warning('normalizing failed for "'.$value.'"', ['app' => 'core']); |
|
1362 | 1362 | return $value; |
1363 | 1363 | } |
1364 | 1364 | |
@@ -1374,7 +1374,7 @@ discard block |
||
1374 | 1374 | $version = OC_Util::getVersionString(); |
1375 | 1375 | $build = OC_Util::getBuild(); |
1376 | 1376 | if (!empty($build) and OC_Util::getChannel() === 'daily') { |
1377 | - $version .= ' Build:' . $build; |
|
1377 | + $version .= ' Build:'.$build; |
|
1378 | 1378 | } |
1379 | 1379 | return $version; |
1380 | 1380 | } |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | } |
1397 | 1397 | |
1398 | 1398 | // detect part files |
1399 | - if (preg_match('/' . \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX . '/', $trimmed) !== 0) { |
|
1399 | + if (preg_match('/'.\OCP\Files\FileInfo::BLACKLIST_FILES_REGEX.'/', $trimmed) !== 0) { |
|
1400 | 1400 | return false; |
1401 | 1401 | } |
1402 | 1402 | |
@@ -1427,19 +1427,19 @@ discard block |
||
1427 | 1427 | } else if ($config->getValue('debug', false) && $versionDiff < 0) { |
1428 | 1428 | // downgrade with debug |
1429 | 1429 | $installedMajor = explode('.', $installedVersion); |
1430 | - $installedMajor = $installedMajor[0] . '.' . $installedMajor[1]; |
|
1430 | + $installedMajor = $installedMajor[0].'.'.$installedMajor[1]; |
|
1431 | 1431 | $currentMajor = explode('.', $currentVersion); |
1432 | - $currentMajor = $currentMajor[0] . '.' . $currentMajor[1]; |
|
1432 | + $currentMajor = $currentMajor[0].'.'.$currentMajor[1]; |
|
1433 | 1433 | if ($installedMajor === $currentMajor) { |
1434 | 1434 | // Same major, allow downgrade for developers |
1435 | 1435 | return true; |
1436 | 1436 | } else { |
1437 | 1437 | // downgrade attempt, throw exception |
1438 | - throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); |
|
1438 | + throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')'); |
|
1439 | 1439 | } |
1440 | 1440 | } else if ($versionDiff < 0) { |
1441 | 1441 | // downgrade attempt, throw exception |
1442 | - throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); |
|
1442 | + throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')'); |
|
1443 | 1443 | } |
1444 | 1444 | |
1445 | 1445 | // 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 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public static function error($data = []) { |
105 | 105 | $data['status'] = 'error'; |
106 | - header( 'Content-Type: application/json; charset=utf-8'); |
|
106 | + header('Content-Type: application/json; charset=utf-8'); |
|
107 | 107 | echo self::encode($data); |
108 | 108 | } |
109 | 109 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public static function success($data = []) { |
116 | 116 | $data['status'] = 'success'; |
117 | - header( 'Content-Type: application/json; charset=utf-8'); |
|
117 | + header('Content-Type: application/json; charset=utf-8'); |
|
118 | 118 | echo self::encode($data); |
119 | 119 | } |
120 | 120 | |
@@ -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 |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function widthTopLeft() { |
134 | 134 | $o = $this->getOrientation(); |
135 | - $this->logger->debug('OC_Image->widthTopLeft() Orientation: ' . $o, ['app' => 'core']); |
|
135 | + $this->logger->debug('OC_Image->widthTopLeft() Orientation: '.$o, ['app' => 'core']); |
|
136 | 136 | switch ($o) { |
137 | 137 | case -1: |
138 | 138 | case 1: |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function heightTopLeft() { |
158 | 158 | $o = $this->getOrientation(); |
159 | - $this->logger->debug('OC_Image->heightTopLeft() Orientation: ' . $o, ['app' => 'core']); |
|
159 | + $this->logger->debug('OC_Image->heightTopLeft() Orientation: '.$o, ['app' => 'core']); |
|
160 | 160 | switch ($o) { |
161 | 161 | case -1: |
162 | 162 | case 1: |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | if ($mimeType === null) { |
184 | 184 | $mimeType = $this->mimeType(); |
185 | 185 | } |
186 | - header('Content-Type: ' . $mimeType); |
|
186 | + header('Content-Type: '.$mimeType); |
|
187 | 187 | return $this->_output(null, $mimeType); |
188 | 188 | } |
189 | 189 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | if ($filePath === null) { |
203 | 203 | if ($this->filePath === null) { |
204 | - $this->logger->error(__METHOD__ . '(): called with no path.', ['app' => 'core']); |
|
204 | + $this->logger->error(__METHOD__.'(): called with no path.', ['app' => 'core']); |
|
205 | 205 | return false; |
206 | 206 | } else { |
207 | 207 | $filePath = $this->filePath; |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | } |
226 | 226 | $isWritable = is_writable(dirname($filePath)); |
227 | 227 | if (!$isWritable) { |
228 | - $this->logger->error(__METHOD__ . '(): Directory \'' . dirname($filePath) . '\' is not writable.', ['app' => 'core']); |
|
228 | + $this->logger->error(__METHOD__.'(): Directory \''.dirname($filePath).'\' is not writable.', ['app' => 'core']); |
|
229 | 229 | return false; |
230 | 230 | } elseif ($isWritable && file_exists($filePath) && !is_writable($filePath)) { |
231 | - $this->logger->error(__METHOD__ . '(): File \'' . $filePath . '\' is not writable.', ['app' => 'core']); |
|
231 | + $this->logger->error(__METHOD__.'(): File \''.$filePath.'\' is not writable.', ['app' => 'core']); |
|
232 | 232 | return false; |
233 | 233 | } |
234 | 234 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $imageType = IMAGETYPE_BMP; |
257 | 257 | break; |
258 | 258 | default: |
259 | - throw new Exception('\OC_Image::_output(): "' . $mimeType . '" is not supported when forcing a specific output format'); |
|
259 | + throw new Exception('\OC_Image::_output(): "'.$mimeType.'" is not supported when forcing a specific output format'); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | return; |
436 | 436 | } |
437 | 437 | |
438 | - $exif = @exif_read_data('data://image/jpeg;base64,' . base64_encode($data)); |
|
438 | + $exif = @exif_read_data('data://image/jpeg;base64,'.base64_encode($data)); |
|
439 | 439 | if (!$exif) { |
440 | 440 | return; |
441 | 441 | } |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | */ |
454 | 454 | public function fixOrientation() { |
455 | 455 | $o = $this->getOrientation(); |
456 | - $this->logger->debug('OC_Image->fixOrientation() Orientation: ' . $o, ['app' => 'core']); |
|
456 | + $this->logger->debug('OC_Image->fixOrientation() Orientation: '.$o, ['app' => 'core']); |
|
457 | 457 | $rotate = 0; |
458 | 458 | $flip = false; |
459 | 459 | switch ($o) { |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $rotate = 90; |
489 | 489 | break; |
490 | 490 | } |
491 | - if($flip && function_exists('imageflip')) { |
|
491 | + if ($flip && function_exists('imageflip')) { |
|
492 | 492 | imageflip($this->resource, IMG_FLIP_HORIZONTAL); |
493 | 493 | } |
494 | 494 | if ($rotate) { |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | imagealphablending($this->resource, true); |
551 | 551 | imagesavealpha($this->resource, true); |
552 | 552 | } else { |
553 | - $this->logger->debug('OC_Image->loadFromFile, GIF images not supported: ' . $imagePath, ['app' => 'core']); |
|
553 | + $this->logger->debug('OC_Image->loadFromFile, GIF images not supported: '.$imagePath, ['app' => 'core']); |
|
554 | 554 | } |
555 | 555 | break; |
556 | 556 | case IMAGETYPE_JPEG: |
@@ -558,10 +558,10 @@ discard block |
||
558 | 558 | if (getimagesize($imagePath) !== false) { |
559 | 559 | $this->resource = @imagecreatefromjpeg($imagePath); |
560 | 560 | } else { |
561 | - $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, ['app' => 'core']); |
|
561 | + $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: '.$imagePath, ['app' => 'core']); |
|
562 | 562 | } |
563 | 563 | } else { |
564 | - $this->logger->debug('OC_Image->loadFromFile, JPG images not supported: ' . $imagePath, ['app' => 'core']); |
|
564 | + $this->logger->debug('OC_Image->loadFromFile, JPG images not supported: '.$imagePath, ['app' => 'core']); |
|
565 | 565 | } |
566 | 566 | break; |
567 | 567 | case IMAGETYPE_PNG: |
@@ -571,21 +571,21 @@ discard block |
||
571 | 571 | imagealphablending($this->resource, true); |
572 | 572 | imagesavealpha($this->resource, true); |
573 | 573 | } else { |
574 | - $this->logger->debug('OC_Image->loadFromFile, PNG images not supported: ' . $imagePath, ['app' => 'core']); |
|
574 | + $this->logger->debug('OC_Image->loadFromFile, PNG images not supported: '.$imagePath, ['app' => 'core']); |
|
575 | 575 | } |
576 | 576 | break; |
577 | 577 | case IMAGETYPE_XBM: |
578 | 578 | if (imagetypes() & IMG_XPM) { |
579 | 579 | $this->resource = @imagecreatefromxbm($imagePath); |
580 | 580 | } else { |
581 | - $this->logger->debug('OC_Image->loadFromFile, XBM/XPM images not supported: ' . $imagePath, ['app' => 'core']); |
|
581 | + $this->logger->debug('OC_Image->loadFromFile, XBM/XPM images not supported: '.$imagePath, ['app' => 'core']); |
|
582 | 582 | } |
583 | 583 | break; |
584 | 584 | case IMAGETYPE_WBMP: |
585 | 585 | if (imagetypes() & IMG_WBMP) { |
586 | 586 | $this->resource = @imagecreatefromwbmp($imagePath); |
587 | 587 | } else { |
588 | - $this->logger->debug('OC_Image->loadFromFile, WBMP images not supported: ' . $imagePath, ['app' => 'core']); |
|
588 | + $this->logger->debug('OC_Image->loadFromFile, WBMP images not supported: '.$imagePath, ['app' => 'core']); |
|
589 | 589 | } |
590 | 590 | break; |
591 | 591 | case IMAGETYPE_BMP: |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | */ |
696 | 696 | private function imagecreatefrombmp($fileName) { |
697 | 697 | if (!($fh = fopen($fileName, 'rb'))) { |
698 | - $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName, ['app' => 'core']); |
|
698 | + $this->logger->warning('imagecreatefrombmp: Can not open '.$fileName, ['app' => 'core']); |
|
699 | 699 | return false; |
700 | 700 | } |
701 | 701 | // read file header |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | // check for bitmap |
704 | 704 | if ($meta['type'] != 19778) { |
705 | 705 | fclose($fh); |
706 | - $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName . ' is not a bitmap!', ['app' => 'core']); |
|
706 | + $this->logger->warning('imagecreatefrombmp: Can not open '.$fileName.' is not a bitmap!', ['app' => 'core']); |
|
707 | 707 | return false; |
708 | 708 | } |
709 | 709 | // read image header |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | $meta['imagesize'] = @filesize($fileName) - $meta['offset']; |
728 | 728 | if ($meta['imagesize'] < 1) { |
729 | 729 | fclose($fh); |
730 | - $this->logger->warning('imagecreatefrombmp: Can not obtain file size of ' . $fileName . ' is not a bitmap!', ['app' => 'core']); |
|
730 | + $this->logger->warning('imagecreatefrombmp: Can not obtain file size of '.$fileName.' is not a bitmap!', ['app' => 'core']); |
|
731 | 731 | return false; |
732 | 732 | } |
733 | 733 | } |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | // read color palette |
738 | 738 | $palette = []; |
739 | 739 | if ($meta['bits'] < 16) { |
740 | - $palette = unpack('l' . $meta['colors'], fread($fh, $meta['colors'] * 4)); |
|
740 | + $palette = unpack('l'.$meta['colors'], fread($fh, $meta['colors'] * 4)); |
|
741 | 741 | // in rare cases the color value is signed |
742 | 742 | if ($palette[1] < 0) { |
743 | 743 | foreach ($palette as $i => $color) { |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | if ($im == false) { |
751 | 751 | fclose($fh); |
752 | 752 | $this->logger->warning( |
753 | - 'imagecreatefrombmp: imagecreatetruecolor failed for file "' . $fileName . '" with dimensions ' . $meta['width'] . 'x' . $meta['height'], |
|
753 | + 'imagecreatefrombmp: imagecreatetruecolor failed for file "'.$fileName.'" with dimensions '.$meta['width'].'x'.$meta['height'], |
|
754 | 754 | ['app' => 'core']); |
755 | 755 | return false; |
756 | 756 | } |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | $p = 0; |
760 | 760 | $vide = chr(0); |
761 | 761 | $y = $meta['height'] - 1; |
762 | - $error = 'imagecreatefrombmp: ' . $fileName . ' has not enough data!'; |
|
762 | + $error = 'imagecreatefrombmp: '.$fileName.' has not enough data!'; |
|
763 | 763 | // loop through the image data beginning with the lower left corner |
764 | 764 | while ($y >= 0) { |
765 | 765 | $x = 0; |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | $this->logger->warning($error, ['app' => 'core']); |
772 | 772 | return $im; |
773 | 773 | } |
774 | - $color = @unpack('V', $part . $vide); |
|
774 | + $color = @unpack('V', $part.$vide); |
|
775 | 775 | break; |
776 | 776 | case 16: |
777 | 777 | if (!($part = substr($data, $p, 2))) { |
@@ -783,16 +783,16 @@ discard block |
||
783 | 783 | $color[1] = (($color[1] & 0xf800) >> 8) * 65536 + (($color[1] & 0x07e0) >> 3) * 256 + (($color[1] & 0x001f) << 3); |
784 | 784 | break; |
785 | 785 | case 8: |
786 | - $color = @unpack('n', $vide . ($data[$p] ?? '')); |
|
786 | + $color = @unpack('n', $vide.($data[$p] ?? '')); |
|
787 | 787 | $color[1] = isset($palette[$color[1] + 1]) ? $palette[$color[1] + 1] : $palette[1]; |
788 | 788 | break; |
789 | 789 | case 4: |
790 | - $color = @unpack('n', $vide . ($data[floor($p)] ?? '')); |
|
790 | + $color = @unpack('n', $vide.($data[floor($p)] ?? '')); |
|
791 | 791 | $color[1] = ($p * 2) % 2 == 0 ? $color[1] >> 4 : $color[1] & 0x0F; |
792 | 792 | $color[1] = isset($palette[$color[1] + 1]) ? $palette[$color[1] + 1] : $palette[1]; |
793 | 793 | break; |
794 | 794 | case 1: |
795 | - $color = @unpack('n', $vide . ($data[floor($p)] ?? '')); |
|
795 | + $color = @unpack('n', $vide.($data[floor($p)] ?? '')); |
|
796 | 796 | switch (($p * 8) % 8) { |
797 | 797 | case 0: |
798 | 798 | $color[1] = $color[1] >> 7; |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | break; |
824 | 824 | default: |
825 | 825 | fclose($fh); |
826 | - $this->logger->warning('imagecreatefrombmp: ' . $fileName . ' has ' . $meta['bits'] . ' bits and this is not supported!', ['app' => 'core']); |
|
826 | + $this->logger->warning('imagecreatefrombmp: '.$fileName.' has '.$meta['bits'].' bits and this is not supported!', ['app' => 'core']); |
|
827 | 827 | return false; |
828 | 828 | } |
829 | 829 | imagesetpixel($im, $x, $y, $color[1]); |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | */ |
846 | 846 | public function resize($maxSize) { |
847 | 847 | if (!$this->valid()) { |
848 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
848 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
849 | 849 | return false; |
850 | 850 | } |
851 | 851 | $widthOrig = imagesx($this->resource); |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | $newHeight = $maxSize; |
861 | 861 | } |
862 | 862 | |
863 | - $this->preciseResize((int)round($newWidth), (int)round($newHeight)); |
|
863 | + $this->preciseResize((int) round($newWidth), (int) round($newHeight)); |
|
864 | 864 | return true; |
865 | 865 | } |
866 | 866 | |
@@ -871,14 +871,14 @@ discard block |
||
871 | 871 | */ |
872 | 872 | public function preciseResize(int $width, int $height): bool { |
873 | 873 | if (!$this->valid()) { |
874 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
874 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
875 | 875 | return false; |
876 | 876 | } |
877 | 877 | $widthOrig = imagesx($this->resource); |
878 | 878 | $heightOrig = imagesy($this->resource); |
879 | 879 | $process = imagecreatetruecolor($width, $height); |
880 | 880 | if ($process === false) { |
881 | - $this->logger->error(__METHOD__ . '(): Error creating true color image', ['app' => 'core']); |
|
881 | + $this->logger->error(__METHOD__.'(): Error creating true color image', ['app' => 'core']); |
|
882 | 882 | return false; |
883 | 883 | } |
884 | 884 | |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | |
892 | 892 | $res = imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig); |
893 | 893 | if ($res === false) { |
894 | - $this->logger->error(__METHOD__ . '(): Error re-sampling process image', ['app' => 'core']); |
|
894 | + $this->logger->error(__METHOD__.'(): Error re-sampling process image', ['app' => 'core']); |
|
895 | 895 | imagedestroy($process); |
896 | 896 | return false; |
897 | 897 | } |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | |
950 | 950 | imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height); |
951 | 951 | if ($process == false) { |
952 | - $this->logger->error('OC_Image->centerCrop, Error re-sampling process image ' . $width . 'x' . $height, ['app' => 'core']); |
|
952 | + $this->logger->error('OC_Image->centerCrop, Error re-sampling process image '.$width.'x'.$height, ['app' => 'core']); |
|
953 | 953 | imagedestroy($process); |
954 | 954 | return false; |
955 | 955 | } |
@@ -969,12 +969,12 @@ discard block |
||
969 | 969 | */ |
970 | 970 | public function crop(int $x, int $y, int $w, int $h): bool { |
971 | 971 | if (!$this->valid()) { |
972 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
972 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
973 | 973 | return false; |
974 | 974 | } |
975 | 975 | $process = imagecreatetruecolor($w, $h); |
976 | 976 | if ($process == false) { |
977 | - $this->logger->error(__METHOD__ . '(): Error creating true color image', ['app' => 'core']); |
|
977 | + $this->logger->error(__METHOD__.'(): Error creating true color image', ['app' => 'core']); |
|
978 | 978 | imagedestroy($process); |
979 | 979 | return false; |
980 | 980 | } |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | |
989 | 989 | imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $w, $h, $w, $h); |
990 | 990 | if ($process == false) { |
991 | - $this->logger->error(__METHOD__ . '(): Error re-sampling process image ' . $w . 'x' . $h, ['app' => 'core']); |
|
991 | + $this->logger->error(__METHOD__.'(): Error re-sampling process image '.$w.'x'.$h, ['app' => 'core']); |
|
992 | 992 | imagedestroy($process); |
993 | 993 | return false; |
994 | 994 | } |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | */ |
1009 | 1009 | public function fitIn($maxWidth, $maxHeight) { |
1010 | 1010 | if (!$this->valid()) { |
1011 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
1011 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
1012 | 1012 | return false; |
1013 | 1013 | } |
1014 | 1014 | $widthOrig = imagesx($this->resource); |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | $newWidth = min($maxWidth, $ratio * $maxHeight); |
1019 | 1019 | $newHeight = min($maxHeight, $maxWidth / $ratio); |
1020 | 1020 | |
1021 | - $this->preciseResize((int)round($newWidth), (int)round($newHeight)); |
|
1021 | + $this->preciseResize((int) round($newWidth), (int) round($newHeight)); |
|
1022 | 1022 | return true; |
1023 | 1023 | } |
1024 | 1024 | |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | */ |
1032 | 1032 | public function scaleDownToFit($maxWidth, $maxHeight) { |
1033 | 1033 | if (!$this->valid()) { |
1034 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
1034 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
1035 | 1035 | return false; |
1036 | 1036 | } |
1037 | 1037 | $widthOrig = imagesx($this->resource); |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | if ($bit <= 8) { |
1090 | 1090 | for ($i = 0; $i < $colorsNum; $i++) { |
1091 | 1091 | $colors = imagecolorsforindex($im, $i); |
1092 | - $rgbQuad .= chr($colors['blue']) . chr($colors['green']) . chr($colors['red']) . "\0"; |
|
1092 | + $rgbQuad .= chr($colors['blue']).chr($colors['green']).chr($colors['red'])."\0"; |
|
1093 | 1093 | } |
1094 | 1094 | $bmpData = ''; |
1095 | 1095 | if ($compression == 0 || $bit < 8) { |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | $index = imagecolorat($im, $i, $j); |
1123 | 1123 | if ($index !== $lastIndex || $sameNum > 255) { |
1124 | 1124 | if ($sameNum != 0) { |
1125 | - $bmpData .= chr($sameNum) . chr($lastIndex); |
|
1125 | + $bmpData .= chr($sameNum).chr($lastIndex); |
|
1126 | 1126 | } |
1127 | 1127 | $lastIndex = $index; |
1128 | 1128 | $sameNum = 1; |
@@ -1163,15 +1163,15 @@ discard block |
||
1163 | 1163 | $sizeData = strlen($bmpData); |
1164 | 1164 | $colorsNum = 0; |
1165 | 1165 | } |
1166 | - $fileHeader = 'BM' . pack('V3', 54 + $sizeQuad + $sizeData, 0, 54 + $sizeQuad); |
|
1166 | + $fileHeader = 'BM'.pack('V3', 54 + $sizeQuad + $sizeData, 0, 54 + $sizeQuad); |
|
1167 | 1167 | $infoHeader = pack('V3v2V*', 0x28, $width, $height, 1, $bit, $compression, $sizeData, 0, 0, $colorsNum, 0); |
1168 | 1168 | if ($fileName != '') { |
1169 | 1169 | $fp = fopen($fileName, 'wb'); |
1170 | - fwrite($fp, $fileHeader . $infoHeader . $rgbQuad . $bmpData); |
|
1170 | + fwrite($fp, $fileHeader.$infoHeader.$rgbQuad.$bmpData); |
|
1171 | 1171 | fclose($fp); |
1172 | 1172 | return true; |
1173 | 1173 | } |
1174 | - echo $fileHeader . $infoHeader . $rgbQuad . $bmpData; |
|
1174 | + echo $fileHeader.$infoHeader.$rgbQuad.$bmpData; |
|
1175 | 1175 | return true; |
1176 | 1176 | } |
1177 | 1177 | } |