diff options
Diffstat (limited to 'lib/private')
27 files changed, 99 insertions, 99 deletions
diff --git a/lib/private/AppFramework/Http.php b/lib/private/AppFramework/Http.php index 91d13b9e231..4b08812b6cf 100644 --- a/lib/private/AppFramework/Http.php +++ b/lib/private/AppFramework/Http.php @@ -117,7 +117,7 @@ class Http extends BaseHttp { * @param string $ETag the etag * @return string */ - public function getStatusHeader($status, \DateTime $lastModified=null, + public function getStatusHeader($status, \DateTime $lastModified=null, $ETag=null) { if(!is_null($lastModified)) { @@ -131,7 +131,7 @@ class Http extends BaseHttp { || (isset($this->server['HTTP_IF_MODIFIED_SINCE']) - && trim($this->server['HTTP_IF_MODIFIED_SINCE']) === + && trim($this->server['HTTP_IF_MODIFIED_SINCE']) === $lastModified)) { $status = self::STATUS_NOT_MODIFIED; @@ -140,13 +140,13 @@ class Http extends BaseHttp { // we have one change currently for the http 1.0 header that differs // from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND // if this differs any more, we want to create childclasses for this - if($status === self::STATUS_TEMPORARY_REDIRECT + if($status === self::STATUS_TEMPORARY_REDIRECT && $this->protocolVersion === 'HTTP/1.0') { $status = self::STATUS_FOUND; } - return $this->protocolVersion . ' ' . $status . ' ' . + return $this->protocolVersion . ' ' . $status . ' ' . $this->headers[$status]; } diff --git a/lib/private/Avatar/Avatar.php b/lib/private/Avatar/Avatar.php index a097db286f2..4badc8c43f5 100644 --- a/lib/private/Avatar/Avatar.php +++ b/lib/private/Avatar/Avatar.php @@ -300,7 +300,7 @@ abstract class Avatar implements IAvatar { $hash = strtolower($hash); // Already a md5 hash? - if( preg_match('/^([0-9a-f]{4}-?){8}$/', $hash, $matches) !== 1 ) { + if(preg_match('/^([0-9a-f]{4}-?){8}$/', $hash, $matches) !== 1) { $hash = md5($hash); } diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php index b41e6441f84..6309b8e6eab 100644 --- a/lib/private/Collaboration/Collaborators/RemotePlugin.php +++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php @@ -96,7 +96,7 @@ class RemotePlugin implements ISearchPlugin { /** * Add local share if remote cloud id matches a local user ones */ - if ($localUser !== null && $remoteUser !== $this->userId && $cloudId === $localUser->getCloudId() ) { + if ($localUser !== null && $remoteUser !== $this->userId && $cloudId === $localUser->getCloudId()) { $result['wide'][] = [ 'label' => $contact['FN'], 'uuid' => $contact['UID'], diff --git a/lib/private/DB/AdapterPgSql.php b/lib/private/DB/AdapterPgSql.php index 0febdd7f1f8..dd9c7dc9680 100644 --- a/lib/private/DB/AdapterPgSql.php +++ b/lib/private/DB/AdapterPgSql.php @@ -35,8 +35,8 @@ class AdapterPgSql extends Adapter { const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)'; public function fixupStatement($statement) { - $statement = str_replace( '`', '"', $statement ); - $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement ); + $statement = str_replace('`', '"', $statement); + $statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement); return $statement; } diff --git a/lib/private/DB/AdapterSqlite.php b/lib/private/DB/AdapterSqlite.php index 20d27732131..2d8715e90f5 100644 --- a/lib/private/DB/AdapterSqlite.php +++ b/lib/private/DB/AdapterSqlite.php @@ -43,10 +43,10 @@ class AdapterSqlite extends Adapter { public function fixupStatement($statement) { $statement = preg_replace('/`(\w+)` ILIKE \?/', 'LOWER($1) LIKE LOWER(?)', $statement); - $statement = str_replace( '`', '"', $statement ); - $statement = str_ireplace( 'NOW()', 'datetime(\'now\')', $statement ); + $statement = str_replace('`', '"', $statement); + $statement = str_ireplace('NOW()', 'datetime(\'now\')', $statement); $statement = str_ireplace('GREATEST(', 'MAX(', $statement); - $statement = str_ireplace( 'UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement ); + $statement = str_ireplace('UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement); return $statement; } diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index bfca8d4ec7b..a0c0ac18481 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -395,7 +395,7 @@ class Connection extends ReconnectWrapper implements IDBConnection { * @return string */ protected function replaceTablePrefix($statement) { - return str_replace( '*PREFIX*', $this->tablePrefix, $statement ); + return str_replace('*PREFIX*', $this->tablePrefix, $statement); } /** diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php index 9010f81dc40..937a77bca7a 100644 --- a/lib/private/Encryption/Util.php +++ b/lib/private/Encryption/Util.php @@ -253,7 +253,7 @@ class Util { public function stripPartialFileExtension($path) { $extension = pathinfo($path, PATHINFO_EXTENSION); - if ( $extension === 'part') { + if ($extension === 'part') { $newLength = strlen($path) - 5; // 5 = strlen(".part") $fPath = substr($path, 0, $newLength); diff --git a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php index 0632caedc6e..98b99efcb5a 100644 --- a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php @@ -34,7 +34,7 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements \OCP\Files\IH * @param array $params */ public function __construct($params) { - if ( ! isset($params['user']) || ! $params['user'] instanceof User) { + if (! isset($params['user']) || ! $params['user'] instanceof User) { throw new \Exception('missing user object in parameters'); } $this->user = $params['user']; diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index ba023d64acb..99654b5d1f2 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -194,7 +194,7 @@ class Database extends ABackend $this->fixDI(); // No duplicate entries! - if( !$this->inGroup( $uid, $gid )) { + if(!$this->inGroup($uid, $gid)) { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('group_user') ->setValue('uid', $qb->createNamedParameter($uid)) @@ -250,7 +250,7 @@ class Database extends ABackend ->execute(); $groups = []; - while( $row = $cursor->fetch()) { + while($row = $cursor->fetch()) { $groups[] = $row['gid']; $this->groupCache[$row['gid']] = $row['gid']; } diff --git a/lib/private/Installer.php b/lib/private/Installer.php index b3919f22d03..78925a56a2e 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -479,7 +479,7 @@ class Installer { * this has to be done by the function oc_app_uninstall(). */ public function removeApp($appId) { - if($this->isDownloaded( $appId )) { + if($this->isDownloaded($appId)) { if (\OC::$server->getAppManager()->isShipped($appId)) { return false; } @@ -528,10 +528,10 @@ class Installer { $config = \OC::$server->getConfig(); $errors = []; foreach(\OC::$APPSROOTS as $app_dir) { - if($dir = opendir( $app_dir['path'] )) { - while( false !== ( $filename = readdir( $dir ))) { - if( $filename[0] !== '.' and is_dir($app_dir['path']."/$filename") ) { - if( file_exists( $app_dir['path']."/$filename/appinfo/info.xml" )) { + if($dir = opendir($app_dir['path'])) { + while(false !== ($filename = readdir($dir))) { + if($filename[0] !== '.' and is_dir($app_dir['path']."/$filename")) { + if(file_exists($app_dir['path']."/$filename/appinfo/info.xml")) { if($config->getAppValue($filename, "installed_version", null) === null) { $info=OC_App::getAppInfo($filename); $enabled = isset($info['default_enable']); @@ -556,7 +556,7 @@ class Installer { } } } - closedir( $dir ); + closedir($dir); } } @@ -623,7 +623,7 @@ class Installer { * @param string $script */ private static function includeAppScript($script) { - if ( file_exists($script) ){ + if (file_exists($script)){ include $script; } } diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 2902136e62e..5624155dadd 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -526,10 +526,10 @@ class Factory implements IFactory { return $this->pluralFunctions[$string]; } - if (preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { + if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { // sanitize - $nplurals = preg_replace( '/[^0-9]/', '', $matches[1] ); - $plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] ); + $nplurals = preg_replace('/[^0-9]/', '', $matches[1]); + $plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]); $body = str_replace( [ 'plural', 'n', '$n$plurals', ], @@ -545,7 +545,7 @@ class Factory implements IFactory { $length = strlen($body); for($i = 0; $i < $length; $i++) { $ch = $body[$i]; - switch ( $ch ) { + switch ($ch) { case '?': $res .= ' ? ('; $p++; @@ -554,7 +554,7 @@ class Factory implements IFactory { $res .= ') : ('; break; case ';': - $res .= str_repeat( ')', $p ) . ';'; + $res .= str_repeat(')', $p) . ';'; $p = 0; break; default: @@ -627,7 +627,7 @@ class Factory implements IFactory { ksort($commonLanguages); // sort now by displayed language not the iso-code - usort( $languages, function ($a, $b) { + usort($languages, function ($a, $b) { if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) { // If a doesn't have a name, but b does, list b before a return 1; diff --git a/lib/private/Search.php b/lib/private/Search.php index 598eda82a54..42a925f90d9 100644 --- a/lib/private/Search.php +++ b/lib/private/Search.php @@ -53,7 +53,7 @@ class Search implements ISearch { $results = []; foreach($this->providers as $provider) { /** @var $provider Provider */ - if ( ! $provider->providesResultsFor($inApps) ) { + if (! $provider->providesResultsFor($inApps)) { continue; } if ($provider instanceof PagedProvider) { @@ -109,7 +109,7 @@ class Search implements ISearch { * Create instances of all the registered search providers */ private function initProviders() { - if( ! empty($this->providers) ) { + if(! empty($this->providers)) { return; } foreach($this->registeredProviders as $provider) { diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 5fcb38de008..9b74239d69d 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -854,7 +854,7 @@ class Share extends Constants { } // Add display names to result $row['share_with_displayname'] = $row['share_with']; - if ( isset($row['share_with']) && $row['share_with'] != '' && + if (isset($row['share_with']) && $row['share_with'] != '' && $row['share_type'] === self::SHARE_TYPE_USER) { $shareWithUser = \OC::$server->getUserManager()->get($row['share_with']); $row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName(); @@ -869,7 +869,7 @@ class Share extends Constants { } } } - if ( isset($row['uid_owner']) && $row['uid_owner'] != '') { + if (isset($row['uid_owner']) && $row['uid_owner'] != '') { $ownerUser = \OC::$server->getUserManager()->get($row['uid_owner']); $row['displayname_owner'] = $ownerUser === null ? $row['uid_owner'] : $ownerUser->getDisplayName(); } @@ -1018,7 +1018,7 @@ class Share extends Constants { // for file/folder shares we need to compare file_source, otherwise we compare item_source // only group shares if they already point to the same target, otherwise the file where shared // before grouping of shares was added. In this case we don't group them toi avoid confusions - if (( $fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) || + if (($fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) || (!$fileSharing && $item['item_source'] === $r['item_source'] && $item['item_target'] === $r['item_target'])) { // add the first item to the list of grouped shares if (!isset($result[$key]['grouped'])) { diff --git a/lib/private/Tags.php b/lib/private/Tags.php index 20a80672a52..4d05beb259c 100644 --- a/lib/private/Tags.php +++ b/lib/private/Tags.php @@ -306,7 +306,7 @@ class Tags implements ITags { } if(!is_null($result)) { - while( $row = $result->fetchRow()) { + while($row = $result->fetchRow()) { $id = (int)$row['objid']; if ($this->includeShared) { @@ -452,7 +452,7 @@ class Tags implements ITags { if(!$this->hasTag($name) && $name !== '') { $newones[] = new Tag($this->user, $this->type, $name); } - if(!is_null($id) ) { + if(!is_null($id)) { // Insert $objectid, $categoryid pairs if not exist. self::$relations[] = ['objid' => $id, 'tag' => $name]; } @@ -550,7 +550,7 @@ class Tags implements ITags { try { $stmt = \OC_DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` ' . 'WHERE `categoryid` = ?'); - while( $row = $result->fetchRow()) { + while($row = $result->fetchRow()) { try { $stmt->execute([$row['id']]); } catch(\Exception $e) { diff --git a/lib/private/Template/Base.php b/lib/private/Template/Base.php index ddbe58b6d9d..d07cf2249f7 100644 --- a/lib/private/Template/Base.php +++ b/lib/private/Template/Base.php @@ -65,7 +65,7 @@ class Base { */ protected function getAppTemplateDirs($theme, $app, $serverRoot, $app_dir) { // Check if the app is in the app folder or in the root - if( file_exists($app_dir.'/templates/' )) { + if(file_exists($app_dir.'/templates/')) { return [ $serverRoot.'/themes/'.$theme.'/apps/'.$app.'/templates/', $app_dir.'/templates/', @@ -115,7 +115,7 @@ class Base { * $_[$key][$position] in the template. */ public function append($key, $value) { - if( array_key_exists( $key, $this->vars )) { + if(array_key_exists($key, $this->vars)) { $this->vars[$key][] = $value; } else{ @@ -131,7 +131,7 @@ class Base { */ public function printPage() { $data = $this->fetchPage(); - if( $data === false ) { + if($data === false) { return false; } else{ @@ -168,7 +168,7 @@ class Base { $theme = $this->theme; if(!is_null($additionalParams)) { - $_ = array_merge( $additionalParams, $this->vars ); + $_ = array_merge($additionalParams, $this->vars); foreach ($_ as $var => $value) { ${$var} = $value; } diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 3ed0b86a269..968ae7fceb8 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -75,7 +75,7 @@ class TemplateLayout extends \OC_Template { // Decide which page we show if($renderAs === 'user') { - parent::__construct( 'core', 'layout.user' ); + parent::__construct('core', 'layout.user'); if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) { $this->assign('bodyid', 'body-settings'); }else{ @@ -83,22 +83,22 @@ class TemplateLayout extends \OC_Template { } // Add navigation entry - $this->assign( 'application', ''); - $this->assign( 'appid', $appId ); + $this->assign('application', ''); + $this->assign('appid', $appId); $navigation = \OC::$server->getNavigationManager()->getAll(); - $this->assign( 'navigation', $navigation); + $this->assign('navigation', $navigation); $settingsNavigation = \OC::$server->getNavigationManager()->getAll('settings'); - $this->assign( 'settingsnavigation', $settingsNavigation); + $this->assign('settingsnavigation', $settingsNavigation); foreach($navigation as $entry) { if ($entry['active']) { - $this->assign( 'application', $entry['name'] ); + $this->assign('application', $entry['name']); break; } } foreach($settingsNavigation as $entry) { if ($entry['active']) { - $this->assign( 'application', $entry['name'] ); + $this->assign('application', $entry['name']); break; } } @@ -139,7 +139,7 @@ class TemplateLayout extends \OC_Template { $this->assign('user_uid', \OC_User::getUser()); } else if ($renderAs === 'public') { parent::__construct('core', 'layout.public'); - $this->assign( 'appid', $appId ); + $this->assign('appid', $appId); $this->assign('bodyid', 'body-public'); /** @var IRegistry $subscription */ @@ -196,7 +196,7 @@ class TemplateLayout extends \OC_Template { foreach($jsFiles as $info) { $web = $info[1]; $file = $info[2]; - $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); + $this->append('jsfiles', $web.'/'.$file . $this->getVersionHashSuffix()); } try { @@ -229,14 +229,14 @@ class TemplateLayout extends \OC_Template { $file = $info[2]; if (substr($file, -strlen('print.css')) === 'print.css') { - $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); + $this->append('printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix()); } else { $suffix = $this->getVersionHashSuffix($web, $file); if (strpos($file, '?v=') == false) { - $this->append( 'cssfiles', $web.'/'.$file . $suffix); + $this->append('cssfiles', $web.'/'.$file . $suffix); } else { - $this->append( 'cssfiles', $web.'/'.$file . '-' . substr($suffix, 3)); + $this->append('cssfiles', $web.'/'.$file . '-' . substr($suffix, 3)); } } diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index 62eafaafedb..c0896ec3516 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -122,7 +122,7 @@ class URLGenerator implements IURLGenerator { public function linkTo(string $app, string $file, array $args = []): string { $frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); - if( $app !== '' ) { + if($app !== '') { $app_path = \OC_App::getAppPath($app); // Check if the app is in the app folder if ($app_path && file_exists($app_path . '/' . $file)) { diff --git a/lib/private/User/Backend.php b/lib/private/User/Backend.php index 24f7c5161b8..4a3c5bdca19 100644 --- a/lib/private/User/Backend.php +++ b/lib/private/User/Backend.php @@ -150,7 +150,7 @@ abstract class Backend implements UserInterface { public function getDisplayNames($search = '', $limit = null, $offset = null) { $displayNames = []; $users = $this->getUsers($search, $limit, $offset); - foreach ( $users as $user) { + foreach ($users as $user) { $displayNames[$user] = $user; } return $displayNames; diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index ca0c7263f7b..7b129a393e3 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -459,7 +459,7 @@ class Session implements IUserSession, Emitter { } // Try to login with this username and password - if (!$this->login($user, $password) ) { + if (!$this->login($user, $password)) { // Failed, maybe the user used their email address $users = $this->manager->getByEmail($user); diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 0f17af3063e..bc492a6df29 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -449,7 +449,7 @@ class User implements IUser { public function getCloudId() { $uid = $this->getUID(); $server = $this->urlGenerator->getAbsoluteURL('/'); - $server = rtrim( $this->removeProtocolFromUrl($server), '/'); + $server = rtrim($this->removeProtocolFromUrl($server), '/'); return \OC::$server->getCloudIdManager()->getCloudId($uid, $server)->getId(); } diff --git a/lib/private/legacy/OC_DB.php b/lib/private/legacy/OC_DB.php index edcac8f9071..cf45faae314 100644 --- a/lib/private/legacy/OC_DB.php +++ b/lib/private/legacy/OC_DB.php @@ -126,14 +126,14 @@ class OC_DB { } if (is_array($stmt)) { // convert to prepared statement - if ( ! array_key_exists('sql', $stmt) ) { + if (! array_key_exists('sql', $stmt)) { $message = 'statement array must at least contain key \'sql\''; throw new \OC\DatabaseException($message); } - if ( ! array_key_exists('limit', $stmt) ) { + if (! array_key_exists('limit', $stmt)) { $stmt['limit'] = null; } - if ( ! array_key_exists('limit', $stmt) ) { + if (! array_key_exists('limit', $stmt)) { $stmt['offset'] = null; } $stmt = self::prepare($stmt['sql'], $stmt['limit'], $stmt['offset']); diff --git a/lib/private/legacy/OC_Hook.php b/lib/private/legacy/OC_Hook.php index d7b1e414a00..b98424711dd 100644 --- a/lib/private/legacy/OC_Hook.php +++ b/lib/private/legacy/OC_Hook.php @@ -54,12 +54,12 @@ class OC_Hook { static public function connect($signalClass, $signalName, $slotClass, $slotName) { // If we're trying to connect to an emitting class that isn't // yet registered, register it - if( !array_key_exists($signalClass, self::$registered )) { + if(!array_key_exists($signalClass, self::$registered)) { self::$registered[$signalClass] = []; } // If we're trying to connect to an emitting method that isn't // yet registered, register it with the emitting class - if( !array_key_exists( $signalName, self::$registered[$signalClass] )) { + if(!array_key_exists($signalName, self::$registered[$signalClass])) { self::$registered[$signalClass][$signalName] = []; } @@ -95,20 +95,20 @@ class OC_Hook { // Return false if no hook handlers are listening to this // emitting class - if( !array_key_exists($signalClass, self::$registered )) { + if(!array_key_exists($signalClass, self::$registered)) { return false; } // Return false if no hook handlers are listening to this // emitting method - if( !array_key_exists( $signalName, self::$registered[$signalClass] )) { + if(!array_key_exists($signalName, self::$registered[$signalClass])) { return false; } // Call all slots - foreach( self::$registered[$signalClass][$signalName] as $i ) { + foreach(self::$registered[$signalClass][$signalName] as $i) { try { - call_user_func( [ $i["class"], $i["name"] ], $params ); + call_user_func([ $i["class"], $i["name"] ], $params); } catch (Exception $e){ self::$thrownExceptions[] = $e; \OC::$server->getLogger()->logException($e); diff --git a/lib/private/legacy/OC_JSON.php b/lib/private/legacy/OC_JSON.php index f83fca0a433..5b4b97e6fd0 100644 --- a/lib/private/legacy/OC_JSON.php +++ b/lib/private/legacy/OC_JSON.php @@ -42,7 +42,7 @@ class OC_JSON{ * @suppress PhanDeprecatedFunction */ public static function checkAppEnabled($app) { - if( !\OC::$server->getAppManager()->isEnabledForUser($app)) { + if(!\OC::$server->getAppManager()->isEnabledForUser($app)) { $l = \OC::$server->getL10N('lib'); self::error([ 'data' => [ 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' ]]); exit(); @@ -56,7 +56,7 @@ class OC_JSON{ */ public static function checkLoggedIn() { $twoFactorAuthManger = \OC::$server->getTwoFactorAuthManager(); - if( !\OC::$server->getUserSession()->isLoggedIn() + if(!\OC::$server->getUserSession()->isLoggedIn() || $twoFactorAuthManger->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { $l = \OC::$server->getL10N('lib'); http_response_code(\OCP\AppFramework\Http::STATUS_UNAUTHORIZED); @@ -76,7 +76,7 @@ class OC_JSON{ exit(); } - if( !\OC::$server->getRequest()->passesCSRFCheck()) { + if(!\OC::$server->getRequest()->passesCSRFCheck()) { $l = \OC::$server->getL10N('lib'); self::error([ 'data' => [ 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' ]]); exit(); @@ -89,7 +89,7 @@ class OC_JSON{ * @suppress PhanDeprecatedFunction */ public static function checkAdminUser() { - if( !OC_User::isAdminUser(OC_User::getUser())) { + if(!OC_User::isAdminUser(OC_User::getUser())) { $l = \OC::$server->getL10N('lib'); self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]); exit(); @@ -103,7 +103,7 @@ class OC_JSON{ */ public static function error($data = []) { $data['status'] = 'error'; - header( 'Content-Type: application/json; charset=utf-8'); + header('Content-Type: application/json; charset=utf-8'); echo self::encode($data); } @@ -114,7 +114,7 @@ class OC_JSON{ */ public static function success($data = []) { $data['status'] = 'success'; - header( 'Content-Type: application/json; charset=utf-8'); + header('Content-Type: application/json; charset=utf-8'); echo self::encode($data); } diff --git a/lib/private/legacy/OC_Response.php b/lib/private/legacy/OC_Response.php index d30f56ca1ba..45fea27d61d 100644 --- a/lib/private/legacy/OC_Response.php +++ b/lib/private/legacy/OC_Response.php @@ -40,10 +40,10 @@ class OC_Response { \OC\AppFramework\Http\Request::USER_AGENT_ANDROID_MOBILE_CHROME, \OC\AppFramework\Http\Request::USER_AGENT_FREEBOX, ])) { - header( 'Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode( $filename ) . '"' ); + header('Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode($filename) . '"'); } else { - header( 'Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode( $filename ) - . '; filename="' . rawurlencode( $filename ) . '"' ); + header('Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode($filename) + . '; filename="' . rawurlencode($filename) . '"'); } } diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php index ad1d31d80f9..08f23b55a0f 100644 --- a/lib/private/legacy/OC_Template.php +++ b/lib/private/legacy/OC_Template.php @@ -105,8 +105,8 @@ class OC_Template extends \OC\Template\Base { //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true //meaning the last script/style in this list will be loaded first if (\OC::$server->getSystemConfig()->getValue('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) { - if (\OC::$server->getConfig()->getAppValue( 'core', 'backgroundjobs_mode', 'ajax' ) == 'ajax') { - OC_Util::addScript( 'backgroundjobs', null, true ); + if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') { + OC_Util::addScript('backgroundjobs', null, true); } } OC_Util::addStyle('css-variables', null, true); @@ -146,12 +146,12 @@ class OC_Template extends \OC\Template\Base { */ protected function findTemplate($theme, $app, $name) { // Check if it is a app template or not. - if( $app !== '' ) { + if($app !== '') { $dirs = $this->getAppTemplateDirs($theme, $app, OC::$SERVERROOT, OC_App::getAppPath($app)); } else { $dirs = $this->getCoreTemplateDirs($theme, OC::$SERVERROOT); } - $locator = new \OC\Template\TemplateFileLocator( $dirs ); + $locator = new \OC\Template\TemplateFileLocator($dirs); $template = $locator->find($name); $path = $locator->getPath(); return [$path, $template]; @@ -182,7 +182,7 @@ class OC_Template extends \OC\Template\Base { public function fetchPage($additionalParams = null) { $data = parent::fetchPage($additionalParams); - if( $this->renderAs ) { + if($this->renderAs) { $page = new TemplateLayout($this->renderAs, $this->app); if(is_array($additionalParams)) { @@ -195,7 +195,7 @@ class OC_Template extends \OC\Template\Base { $headers = ''; foreach(OC_Util::$headers as $header) { $headers .= '<'.\OCP\Util::sanitizeHTML($header['tag']); - if ( strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes']))) ) { + if (strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes'])))) { $headers .= ' defer'; } foreach($header['attributes'] as $name=>$value) { @@ -239,9 +239,9 @@ class OC_Template extends \OC\Template\Base { * @return boolean|null */ public static function printUserPage($application, $name, $parameters = []) { - $content = new OC_Template( $application, $name, "user" ); - foreach( $parameters as $key => $value ) { - $content->assign( $key, $value ); + $content = new OC_Template($application, $name, "user"); + foreach($parameters as $key => $value) { + $content->assign($key, $value); } print $content->printPage(); } @@ -254,9 +254,9 @@ class OC_Template extends \OC\Template\Base { * @return bool */ public static function printAdminPage($application, $name, $parameters = []) { - $content = new OC_Template( $application, $name, "admin" ); - foreach( $parameters as $key => $value ) { - $content->assign( $key, $value ); + $content = new OC_Template($application, $name, "admin"); + foreach($parameters as $key => $value) { + $content->assign($key, $value); } return $content->printPage(); } @@ -270,8 +270,8 @@ class OC_Template extends \OC\Template\Base { */ public static function printGuestPage($application, $name, $parameters = []) { $content = new OC_Template($application, $name, $name === 'error' ? $name : 'guest'); - foreach( $parameters as $key => $value ) { - $content->assign( $key, $value ); + foreach($parameters as $key => $value) { + $content->assign($key, $value); } return $content->printPage(); } @@ -296,9 +296,9 @@ class OC_Template extends \OC\Template\Base { http_response_code($statusCode); try { - $content = new \OC_Template( '', 'error', 'error', false ); + $content = new \OC_Template('', 'error', 'error', false); $errors = [['error' => $error_msg, 'hint' => $hint]]; - $content->assign( 'errors', $errors ); + $content->assign('errors', $errors); $content->printPage(); } catch (\Exception $e) { $logger = \OC::$server->getLogger(); diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 378c3938317..4d7d00f5dc2 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -590,7 +590,7 @@ class OC_Util { // core js files need separate handling if ($application !== 'core' && $file !== null) { - self::addTranslations( $application ); + self::addTranslations($application); } self::addExternalResource($application, $prepend, $path, "script"); } @@ -667,7 +667,7 @@ class OC_Util { if ($type === "style") { if (!in_array($path, self::$styles)) { if ($prepend === true) { - array_unshift( self::$styles, $path ); + array_unshift(self::$styles, $path); } else { self::$styles[] = $path; } @@ -675,7 +675,7 @@ class OC_Util { } elseif ($type === "script") { if (!in_array($path, self::$scripts)) { if ($prepend === true) { - array_unshift( self::$scripts, $path ); + array_unshift(self::$scripts, $path); } else { self::$scripts [] = $path; } @@ -757,7 +757,7 @@ class OC_Util { 'hint' => $l->t('This can usually be fixed by giving the webserver write access to the config directory. See %s', [ $urlGenerator->linkToDocs('admin-dir_permissions') ]) . '. ' . $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', - [ $urlGenerator->linkToDocs('admin-config') ] ) + [ $urlGenerator->linkToDocs('admin-config') ]) ]; } } @@ -925,7 +925,7 @@ class OC_Util { } if(function_exists('xml_parser_create') && - LIBXML_LOADED_VERSION < 20700 ) { + LIBXML_LOADED_VERSION < 20700) { $version = LIBXML_LOADED_VERSION; $major = floor($version/10000); $version -= ($major * 10000); diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php index f427642b619..e42ef796f0f 100644 --- a/lib/private/legacy/template/functions.php +++ b/lib/private/legacy/template/functions.php @@ -235,7 +235,7 @@ function link_to_docs($key) { * For further information have a look at \OCP\IURLGenerator::imagePath */ function image_path($app, $image) { - return \OC::$server->getURLGenerator()->imagePath( $app, $image ); + return \OC::$server->getURLGenerator()->imagePath($app, $image); } /** @@ -244,7 +244,7 @@ function image_path($app, $image) { * @return string link to the image */ function mimetype_icon($mimetype) { - return \OC::$server->getMimeTypeDetector()->mimeTypeIcon( $mimetype ); + return \OC::$server->getMimeTypeDetector()->mimeTypeIcon($mimetype); } /** @@ -274,7 +274,7 @@ function publicPreview_icon($path, $token) { * For further information have a look at OC_Helper::humanFileSize */ function human_file_size($bytes) { - return OC_Helper::humanFileSize( $bytes ); + return OC_Helper::humanFileSize($bytes); } /** |