Completed
Pull Request — master (#6360)
by Christoph
14:02
created
core/templates/installation.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 <input type='hidden' id='hasOracle' value='<?php p($_['hasOracle']) ?>'>
11 11
 <form action="index.php" method="post">
12 12
 <input type="hidden" name="install" value="true">
13
-	<?php if(count($_['errors']) > 0): ?>
13
+	<?php if (count($_['errors']) > 0): ?>
14 14
 	<fieldset class="warning">
15
-		<legend><strong><?php p($l->t('Error'));?></strong></legend>
16
-		<?php foreach($_['errors'] as $err): ?>
15
+		<legend><strong><?php p($l->t('Error')); ?></strong></legend>
16
+		<?php foreach ($_['errors'] as $err): ?>
17 17
 		<p>
18
-			<?php if(is_array($err)):?>
18
+			<?php if (is_array($err)):?>
19 19
 				<?php print_unescaped($err['error']); ?>
20 20
 				<span class='hint'><?php print_unescaped($err['hint']); ?></span>
21 21
 			<?php else: ?>
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 		<?php endforeach; ?>
26 26
 	</fieldset>
27 27
 	<?php endif; ?>
28
-	<?php if(!$_['htaccessWorking']): ?>
28
+	<?php if (!$_['htaccessWorking']): ?>
29 29
 	<fieldset class="warning">
30
-		<legend><strong><?php p($l->t('Security warning'));?></strong></legend>
31
-		<p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br>
30
+		<legend><strong><?php p($l->t('Security warning')); ?></strong></legend>
31
+		<p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.')); ?><br>
32 32
 		<?php print_unescaped($l->t(
33 33
 			'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer">documentation</a>.',
34 34
 			link_to_docs('admin-install')
@@ -36,35 +36,35 @@  discard block
 block discarded – undo
36 36
 	</fieldset>
37 37
 	<?php endif; ?>
38 38
 	<fieldset id="adminaccount">
39
-		<legend><?php print_unescaped($l->t( 'Create an <strong>admin account</strong>' )); ?></legend>
39
+		<legend><?php print_unescaped($l->t('Create an <strong>admin account</strong>')); ?></legend>
40 40
 		<p class="grouptop">
41 41
 			<input type="text" name="adminlogin" id="adminlogin"
42
-				placeholder="<?php p($l->t( 'Username' )); ?>"
42
+				placeholder="<?php p($l->t('Username')); ?>"
43 43
 				value="<?php p($_['adminlogin']); ?>"
44 44
 				autocomplete="off" autocapitalize="none" autocorrect="off" autofocus required>
45
-			<label for="adminlogin" class="infield"><?php p($l->t( 'Username' )); ?></label>
45
+			<label for="adminlogin" class="infield"><?php p($l->t('Username')); ?></label>
46 46
 		</p>
47 47
 		<p class="groupbottom">
48 48
 			<input type="password" name="adminpass" data-typetoggle="#show" id="adminpass"
49
-				placeholder="<?php p($l->t( 'Password' )); ?>"
49
+				placeholder="<?php p($l->t('Password')); ?>"
50 50
 				value="<?php p($_['adminpass']); ?>"
51 51
 				autocomplete="off" autocapitalize="none" autocorrect="off" required>
52
-			<label for="adminpass" class="infield"><?php p($l->t( 'Password' )); ?></label>
52
+			<label for="adminpass" class="infield"><?php p($l->t('Password')); ?></label>
53 53
 			<input type="checkbox" id="show" name="show">
54 54
 			<label for="show"></label>
55 55
 		</p>
56 56
 	</fieldset>
57 57
 
58
-	<?php if(!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?>
58
+	<?php if (!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?>
59 59
 	<fieldset id="advancedHeader">
60
-		<legend><a id="showAdvanced"><?php p($l->t( 'Storage & database' )); ?> <img src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend>
60
+		<legend><a id="showAdvanced"><?php p($l->t('Storage & database')); ?> <img src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend>
61 61
 	</fieldset>
62 62
 	<?php endif; ?>
63 63
 
64
-	<?php if(!$_['directoryIsSet'] OR count($_['errors']) > 0): ?>
64
+	<?php if (!$_['directoryIsSet'] OR count($_['errors']) > 0): ?>
65 65
 	<fieldset id="datadirField">
66 66
 		<div id="datadirContent">
67
-			<label for="directory"><?php p($l->t( 'Data folder' )); ?></label>
67
+			<label for="directory"><?php p($l->t('Data folder')); ?></label>
68 68
 			<input type="text" name="directory" id="directory"
69 69
 				placeholder="<?php p(OC::$SERVERROOT.'/data'); ?>"
70 70
 				value="<?php p($_['directory']); ?>"
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
 	</fieldset>
74 74
 	<?php endif; ?>
75 75
 
76
-	<?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
76
+	<?php if (!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
77 77
 	<fieldset id='databaseBackend'>
78
-		<?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle'])
79
-			$hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?>
80
-		<legend><?php p($l->t( 'Configure the database' )); ?></legend>
78
+		<?php if ($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle'])
79
+			$hasOtherDB = true; else $hasOtherDB = false; //other than SQLite ?>
80
+		<legend><?php p($l->t('Configure the database')); ?></legend>
81 81
 		<div id="selectDbType">
82
-		<?php foreach($_['databases'] as $type => $label): ?>
83
-		<?php if(count($_['databases']) === 1): ?>
82
+		<?php foreach ($_['databases'] as $type => $label): ?>
83
+		<?php if (count($_['databases']) === 1): ?>
84 84
 		<p class="info">
85
-			<?php p($l->t( 'Only %s is available.', array($label) )); ?>
86
-			<?php p($l->t( 'Install and activate additional PHP modules to choose other database types.' )); ?><br>
85
+			<?php p($l->t('Only %s is available.', array($label))); ?>
86
+			<?php p($l->t('Install and activate additional PHP modules to choose other database types.')); ?><br>
87 87
 			<a href="<?php print_unescaped(link_to_docs('admin-source_install')); ?>" target="_blank" rel="noreferrer">
88
-				<?php p($l->t( 'For more details check out the documentation.' )); ?> ↗</a>
88
+				<?php p($l->t('For more details check out the documentation.')); ?> ↗</a>
89 89
 		</p>
90 90
 		<input type="hidden" id="dbtype" name="dbtype" value="<?php p($type) ?>">
91 91
 		<?php else: ?>
@@ -97,75 +97,75 @@  discard block
 block discarded – undo
97 97
 		</div>
98 98
 	</fieldset>
99 99
 
100
-		<?php if($hasOtherDB): ?>
100
+		<?php if ($hasOtherDB): ?>
101 101
 		<fieldset id='databaseField'>
102 102
 		<div id="use_other_db">
103 103
 			<p class="grouptop">
104
-				<label for="dbuser" class="infield"><?php p($l->t( 'Database user' )); ?></label>
104
+				<label for="dbuser" class="infield"><?php p($l->t('Database user')); ?></label>
105 105
 				<input type="text" name="dbuser" id="dbuser"
106
-					placeholder="<?php p($l->t( 'Database user' )); ?>"
106
+					placeholder="<?php p($l->t('Database user')); ?>"
107 107
 					value="<?php p($_['dbuser']); ?>"
108 108
 					autocomplete="off" autocapitalize="none" autocorrect="off">
109 109
 			</p>
110 110
 			<p class="groupmiddle">
111 111
 				<input type="password" name="dbpass" id="dbpass" data-typetoggle="#dbpassword-toggle"
112
-					placeholder="<?php p($l->t( 'Database password' )); ?>"
112
+					placeholder="<?php p($l->t('Database password')); ?>"
113 113
 					value="<?php p($_['dbpass']); ?>"
114 114
 					autocomplete="off" autocapitalize="none" autocorrect="off">
115
-				<label for="dbpass" class="infield"><?php p($l->t( 'Database password' )); ?></label>
115
+				<label for="dbpass" class="infield"><?php p($l->t('Database password')); ?></label>
116 116
 				<input type="checkbox" id="dbpassword-toggle" name="dbpassword-toggle">
117 117
 				<label for="dbpassword-toggle"></label>
118 118
 			</p>
119 119
 			<p class="groupmiddle">
120
-				<label for="dbname" class="infield"><?php p($l->t( 'Database name' )); ?></label>
120
+				<label for="dbname" class="infield"><?php p($l->t('Database name')); ?></label>
121 121
 				<input type="text" name="dbname" id="dbname"
122
-					placeholder="<?php p($l->t( 'Database name' )); ?>"
122
+					placeholder="<?php p($l->t('Database name')); ?>"
123 123
 					value="<?php p($_['dbname']); ?>"
124 124
 					autocomplete="off" autocapitalize="none" autocorrect="off"
125 125
 					pattern="[0-9a-zA-Z$_-]+">
126 126
 			</p>
127
-			<?php if($_['hasOracle']): ?>
127
+			<?php if ($_['hasOracle']): ?>
128 128
 			<div id="use_oracle_db">
129 129
 				<p class="groupmiddle">
130
-					<label for="dbtablespace" class="infield"><?php p($l->t( 'Database tablespace' )); ?></label>
130
+					<label for="dbtablespace" class="infield"><?php p($l->t('Database tablespace')); ?></label>
131 131
 					<input type="text" name="dbtablespace" id="dbtablespace"
132
-						placeholder="<?php p($l->t( 'Database tablespace' )); ?>"
132
+						placeholder="<?php p($l->t('Database tablespace')); ?>"
133 133
 						value="<?php p($_['dbtablespace']); ?>"
134 134
 						autocomplete="off" autocapitalize="none" autocorrect="off">
135 135
 				</p>
136 136
 			</div>
137 137
 			<?php endif; ?>
138 138
 			<p class="groupbottom">
139
-				<label for="dbhost" class="infield"><?php p($l->t( 'Database host' )); ?></label>
139
+				<label for="dbhost" class="infield"><?php p($l->t('Database host')); ?></label>
140 140
 				<input type="text" name="dbhost" id="dbhost"
141
-					placeholder="<?php p($l->t( 'Database host' )); ?>"
141
+					placeholder="<?php p($l->t('Database host')); ?>"
142 142
 					value="<?php p($_['dbhost']); ?>"
143 143
 					autocomplete="off" autocapitalize="none" autocorrect="off">
144 144
 			</p>
145 145
 			<p class="info">
146
-				<?php p($l->t( 'Please specify the port number along with the host name (e.g., localhost:5432).' )); ?>
146
+				<?php p($l->t('Please specify the port number along with the host name (e.g., localhost:5432).')); ?>
147 147
 			</p>
148 148
 		</div>
149 149
 		</fieldset>
150 150
 		<?php endif; ?>
151 151
 	<?php endif; ?>
152 152
 
153
-	<?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
153
+	<?php if (!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
154 154
 		<fieldset id="sqliteInformation" class="warning">
155
-			<legend><?php p($l->t('Performance warning'));?></legend>
156
-			<p><?php p($l->t('SQLite will be used as database.'));?></p>
157
-			<p><?php p($l->t('For larger installations we recommend to choose a different database backend.'));?></p>
155
+			<legend><?php p($l->t('Performance warning')); ?></legend>
156
+			<p><?php p($l->t('SQLite will be used as database.')); ?></p>
157
+			<p><?php p($l->t('For larger installations we recommend to choose a different database backend.')); ?></p>
158 158
 			<p><?php p($l->t('Especially when using the desktop client for file syncing the use of SQLite is discouraged.')); ?></p>
159 159
 		</fieldset>
160 160
 	<?php endif ?>
161 161
 
162 162
 	<div class="icon-loading-dark float-spinner">&nbsp;</div>
163 163
 
164
-	<div class="buttons"><input type="submit" class="primary" value="<?php p($l->t( 'Finish setup' )); ?>" data-finishing="<?php p($l->t( 'Finishing …' )); ?>"></div>
164
+	<div class="buttons"><input type="submit" class="primary" value="<?php p($l->t('Finish setup')); ?>" data-finishing="<?php p($l->t('Finishing …')); ?>"></div>
165 165
 
166 166
 	<p class="info">
167 167
 		<span class="icon-info-white"></span>
168
-		<?php p($l->t('Need help?'));?>
169
-		<a target="_blank" rel="noreferrer" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation'));?> ↗</a>
168
+		<?php p($l->t('Need help?')); ?>
169
+		<a target="_blank" rel="noreferrer" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation')); ?> ↗</a>
170 170
 	</p>
171 171
 </form>
Please login to merge, or discard this patch.
lib/private/Preview/Generator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	public function getPreview(File $file, $width = -1, $height = -1, $crop = false, $mode = IPreview::MODE_FILL, $mimeType = null) {
89 89
 		$this->eventDispatcher->dispatch(
90 90
 			IPreview::EVENT,
91
-			new GenericEvent($file,[
91
+			new GenericEvent($file, [
92 92
 				'width' => $width,
93 93
 				'height' => $height,
94 94
 				'crop' => $crop,
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 					continue;
156 156
 				}
157 157
 
158
-				$maxWidth = (int)$this->config->getSystemValue('preview_max_x', 2048);
159
-				$maxHeight = (int)$this->config->getSystemValue('preview_max_y', 2048);
158
+				$maxWidth = (int) $this->config->getSystemValue('preview_max_x', 2048);
159
+				$maxHeight = (int) $this->config->getSystemValue('preview_max_y', 2048);
160 160
 
161 161
 				$preview = $this->helper->getThumbnail($provider, $file, $maxWidth, $maxHeight);
162 162
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 					continue;
165 165
 				}
166 166
 
167
-				$path = (string)$preview->width() . '-' . (string)$preview->height() . '-max.png';
167
+				$path = (string) $preview->width().'-'.(string) $preview->height().'-max.png';
168 168
 				try {
169 169
 					$file = $previewFolder->newFile($path);
170 170
 					$file->putContent($preview->data());
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	private function getPreviewSize(ISimpleFile $file) {
187 187
 		$size = explode('-', $file->getName());
188
-		return [(int)$size[0], (int)$size[1]];
188
+		return [(int) $size[0], (int) $size[1]];
189 189
 	}
190 190
 
191 191
 	/**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @return string
196 196
 	 */
197 197
 	private function generatePath($width, $height, $crop) {
198
-		$path = (string)$width . '-' . (string)$height;
198
+		$path = (string) $width.'-'.(string) $height;
199 199
 		if ($crop) {
200 200
 			$path .= '-crop';
201 201
 		}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			$height /= $ratio;
287 287
 		}
288 288
 
289
-		return [(int)round($width), (int)round($height)];
289
+		return [(int) round($width), (int) round($height)];
290 290
 	}
291 291
 
292 292
 	/**
Please login to merge, or discard this patch.
lib/private/Repair/Collation.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		$tables = $this->getAllNonUTF8BinTables($this->connection);
77 77
 		foreach ($tables as $table) {
78 78
 			$output->info("Change row format for $table ...");
79
-			$query = $this->connection->prepare('ALTER TABLE `' . $table . '` ROW_FORMAT = DYNAMIC;');
79
+			$query = $this->connection->prepare('ALTER TABLE `'.$table.'` ROW_FORMAT = DYNAMIC;');
80 80
 			try {
81 81
 				$query->execute();
82 82
 			} catch (DriverException $e) {
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 			$output->info("Change collation for $table ...");
91 91
 			if ($characterSet === 'utf8mb4') {
92 92
 				// need to set row compression first
93
-				$query = $this->connection->prepare('ALTER TABLE `' . $table . '` ROW_FORMAT=COMPRESSED;');
93
+				$query = $this->connection->prepare('ALTER TABLE `'.$table.'` ROW_FORMAT=COMPRESSED;');
94 94
 				$query->execute();
95 95
 			}
96
-			$query = $this->connection->prepare('ALTER TABLE `' . $table . '` CONVERT TO CHARACTER SET ' . $characterSet . ' COLLATE ' . $characterSet . '_bin;');
96
+			$query = $this->connection->prepare('ALTER TABLE `'.$table.'` CONVERT TO CHARACTER SET '.$characterSet.' COLLATE '.$characterSet.'_bin;');
97 97
 			try {
98 98
 				$query->execute();
99 99
 			} catch (DriverException $e) {
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 
120 120
 		// fetch tables by columns
121 121
 		$statement = $connection->executeQuery(
122
-			"SELECT DISTINCT(TABLE_NAME) AS `table`" .
123
-			"	FROM INFORMATION_SCHEMA . COLUMNS" .
124
-			"	WHERE TABLE_SCHEMA = ?" .
125
-			"	AND (COLLATION_NAME <> '" . $characterSet . "_bin' OR CHARACTER_SET_NAME <> '" . $characterSet . "')" .
122
+			"SELECT DISTINCT(TABLE_NAME) AS `table`".
123
+			"	FROM INFORMATION_SCHEMA . COLUMNS".
124
+			"	WHERE TABLE_SCHEMA = ?".
125
+			"	AND (COLLATION_NAME <> '".$characterSet."_bin' OR CHARACTER_SET_NAME <> '".$characterSet."')".
126 126
 			"	AND TABLE_NAME LIKE \"*PREFIX*%\"",
127 127
 			array($dbName)
128 128
 		);
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 
135 135
 		// fetch tables by collation
136 136
 		$statement = $connection->executeQuery(
137
-			"SELECT DISTINCT(TABLE_NAME) AS `table`" .
138
-			"	FROM INFORMATION_SCHEMA . TABLES" .
139
-			"	WHERE TABLE_SCHEMA = ?" .
140
-			"	AND TABLE_COLLATION <> '" . $characterSet . "_bin'" .
137
+			"SELECT DISTINCT(TABLE_NAME) AS `table`".
138
+			"	FROM INFORMATION_SCHEMA . TABLES".
139
+			"	WHERE TABLE_SCHEMA = ?".
140
+			"	AND TABLE_COLLATION <> '".$characterSet."_bin'".
141 141
 			"	AND TABLE_NAME LIKE \"*PREFIX*%\"",
142 142
 			[$dbName]
143 143
 		);
Please login to merge, or discard this patch.
lib/private/Template/ResourceLocator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 				$this->doFind($resource);
76 76
 			} catch (ResourceNotFoundException $e) {
77 77
 				$resourceApp = substr($resource, 0, strpos($resource, '/'));
78
-				$this->logger->debug('Could not find resource file "' . $e->getResourcePath() . '"', ['app' => $resourceApp]);
78
+				$this->logger->debug('Could not find resource file "'.$e->getResourcePath().'"', ['app' => $resourceApp]);
79 79
 			}
80 80
 		}
81 81
 		if (!empty($this->theme)) {
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 					$this->doFindTheme($resource);
85 85
 				} catch (ResourceNotFoundException $e) {
86 86
 					$resourceApp = substr($resource, 0, strpos($resource, '/'));
87
-					$this->logger->debug('Could not find resource file in theme "' . $e->getResourcePath() . '"', ['app' => $resourceApp]);
87
+					$this->logger->debug('Could not find resource file in theme "'.$e->getResourcePath().'"', ['app' => $resourceApp]);
88 88
 				}
89 89
 			}
90 90
 		}
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
 					break;
148 148
 				}
149 149
 				$tmpRoot = dirname($tmpRoot);
150
-			} while(true);
150
+			} while (true);
151 151
 
152 152
 		}
153 153
 		$this->resources[] = array($root, $webRoot, $file);
154 154
 
155
-		if ($throw && !is_file($root . '/' . $file)) {
155
+		if ($throw && !is_file($root.'/'.$file)) {
156 156
 			throw new ResourceNotFoundException($file, $webRoot);
157 157
 		}
158 158
 	}
Please login to merge, or discard this patch.
lib/private/Authentication/Token/DefaultTokenProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	public function invalidateOldTokens() {
255 255
 		$olderThan = $this->time->getTime() - (int) $this->config->getSystemValue('session_lifetime', 60 * 60 * 24);
256
-		$this->logger->debug('Invalidating session tokens older than ' . date('c', $olderThan), ['app' => 'cron']);
256
+		$this->logger->debug('Invalidating session tokens older than '.date('c', $olderThan), ['app' => 'cron']);
257 257
 		$this->mapper->invalidateOld($olderThan, IToken::DO_NOT_REMEMBER);
258 258
 		$rememberThreshold = $this->time->getTime() - (int) $this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
259
-		$this->logger->debug('Invalidating remembered session tokens older than ' . date('c', $rememberThreshold), ['app' => 'cron']);
259
+		$this->logger->debug('Invalidating remembered session tokens older than '.date('c', $rememberThreshold), ['app' => 'cron']);
260 260
 		$this->mapper->invalidateOld($rememberThreshold, IToken::REMEMBER);
261 261
 	}
262 262
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	private function hashToken($token) {
268 268
 		$secret = $this->config->getSystemValue('secret');
269
-		return hash('sha512', $token . $secret);
269
+		return hash('sha512', $token.$secret);
270 270
 	}
271 271
 
272 272
 	/**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 */
281 281
 	private function encryptPassword($password, $token) {
282 282
 		$secret = $this->config->getSystemValue('secret');
283
-		return $this->crypto->encrypt($password, $token . $secret);
283
+		return $this->crypto->encrypt($password, $token.$secret);
284 284
 	}
285 285
 
286 286
 	/**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	private function decryptPassword($password, $token) {
297 297
 		$secret = $this->config->getSystemValue('secret');
298 298
 		try {
299
-			return $this->crypto->decrypt($password, $token . $secret);
299
+			return $this->crypto->decrypt($password, $token.$secret);
300 300
 		} catch (Exception $ex) {
301 301
 			// Delete the invalid token
302 302
 			$this->invalidateToken($token);
Please login to merge, or discard this patch.
lib/private/App/AppManager.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 			$values = $this->appConfig->getValues(false, 'enabled');
107 107
 
108 108
 			$alwaysEnabledApps = $this->getAlwaysEnabledApps();
109
-			foreach($alwaysEnabledApps as $appId) {
109
+			foreach ($alwaysEnabledApps as $appId) {
110 110
 				$values[$appId] = 'yes';
111 111
 			}
112 112
 
113
-			$this->installedAppsCache = array_filter($values, function ($value) {
113
+			$this->installedAppsCache = array_filter($values, function($value) {
114 114
 				return $value !== 'no';
115 115
 			});
116 116
 			ksort($this->installedAppsCache);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function getEnabledAppsForUser(IUser $user) {
137 137
 		$apps = $this->getInstalledAppsValues();
138
-		$appsForUser = array_filter($apps, function ($enabled) use ($user) {
138
+		$appsForUser = array_filter($apps, function($enabled) use ($user) {
139 139
 			return $this->checkAppForUser($enabled, $user);
140 140
 		});
141 141
 		return array_keys($appsForUser);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		} elseif ($user === null) {
175 175
 			return false;
176 176
 		} else {
177
-			if(empty($enabled)){
177
+			if (empty($enabled)) {
178 178
 				return false;
179 179
 			}
180 180
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 			if (!is_array($groupIds)) {
184 184
 				$jsonError = json_last_error();
185
-				\OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']);
185
+				\OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: '.print_r($enabled, true).' - json error code: '.$jsonError, ['app' => 'lib']);
186 186
 				return false;
187 187
 			}
188 188
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			}
257 257
 		}
258 258
 
259
-		$groupIds = array_map(function ($group) {
259
+		$groupIds = array_map(function($group) {
260 260
 			/** @var \OCP\IGroup $group */
261 261
 			return $group->getGID();
262 262
 		}, $groups);
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 	 */
296 296
 	public function getAppPath($appId) {
297 297
 		$appPath = \OC_App::getAppPath($appId);
298
-		if($appPath === false) {
299
-			throw new AppPathNotFoundException('Could not find path for ' . $appId);
298
+		if ($appPath === false) {
299
+			throw new AppPathNotFoundException('Could not find path for '.$appId);
300 300
 		}
301 301
 		return $appPath;
302 302
 	}
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
 	private function loadShippedJson() {
391 391
 		if ($this->shippedApps === null) {
392
-			$shippedJson = \OC::$SERVERROOT . '/core/shipped.json';
392
+			$shippedJson = \OC::$SERVERROOT.'/core/shipped.json';
393 393
 			if (!file_exists($shippedJson)) {
394 394
 				throw new \Exception("File not found: $shippedJson");
395 395
 			}
Please login to merge, or discard this patch.
apps/files_sharing/lib/MountProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		$shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_CIRCLE, null, -1));
75 75
 
76 76
 		// filter out excluded shares and group shares that includes self
77
-		$shares = array_filter($shares, function (\OCP\Share\IShare $share) use ($user) {
77
+		$shares = array_filter($shares, function(\OCP\Share\IShare $share) use ($user) {
78 78
 			return $share->getPermissions() > 0 && $share->getShareOwner() !== $user->getUID();
79 79
 		});
80 80
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 						// null groups which usually appear with group backend
187 187
 						// caching inconsistencies
188 188
 						$this->logger->debug(
189
-							'Could not adjust share target for share ' . $share->getId() . ' to make it consistent: ' . $e->getMessage(),
189
+							'Could not adjust share target for share '.$share->getId().' to make it consistent: '.$e->getMessage(),
190 190
 							['app' => 'files_sharing']
191 191
 						);
192 192
 					}
Please login to merge, or discard this patch.
lib/autoloader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -99,24 +99,24 @@  discard block
 block discarded – undo
99 99
 			 * Remove "apps/" from inclusion path for smooth migration to multi app dir
100 100
 			 */
101 101
 			if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) {
102
-				\OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', \OCP\Util::DEBUG);
102
+				\OCP\Util::writeLog('core', 'include path for class "'.$class.'" starts with "apps/"', \OCP\Util::DEBUG);
103 103
 				$paths[] = str_replace('apps/', '', \OC::$CLASSPATH[$class]);
104 104
 			}
105 105
 		} elseif (strpos($class, 'OC_') === 0) {
106
-			$paths[] = \OC::$SERVERROOT . '/lib/private/legacy/' . strtolower(str_replace('_', '/', substr($class, 3)) . '.php');
106
+			$paths[] = \OC::$SERVERROOT.'/lib/private/legacy/'.strtolower(str_replace('_', '/', substr($class, 3)).'.php');
107 107
 		} elseif (strpos($class, 'OCA\\') === 0) {
108 108
 			list(, $app, $rest) = explode('\\', $class, 3);
109 109
 			$app = strtolower($app);
110 110
 			$appPath = \OC_App::getAppPath($app);
111 111
 			if ($appPath && stream_resolve_include_path($appPath)) {
112
-				$paths[] = $appPath . '/' . strtolower(str_replace('\\', '/', $rest) . '.php');
112
+				$paths[] = $appPath.'/'.strtolower(str_replace('\\', '/', $rest).'.php');
113 113
 				// If not found in the root of the app directory, insert '/lib' after app id and try again.
114
-				$paths[] = $appPath . '/lib/' . strtolower(str_replace('\\', '/', $rest) . '.php');
114
+				$paths[] = $appPath.'/lib/'.strtolower(str_replace('\\', '/', $rest).'.php');
115 115
 			}
116 116
 		} elseif ($class === 'Test\\TestCase') {
117 117
 			// This File is considered public API, so we make sure that the class
118 118
 			// can still be loaded, although the PSR-4 paths have not been loaded.
119
-			$paths[] = \OC::$SERVERROOT . '/tests/lib/TestCase.php';
119
+			$paths[] = \OC::$SERVERROOT.'/tests/lib/TestCase.php';
120 120
 		}
121 121
 		return $paths;
122 122
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	protected function isValidPath($fullPath) {
129 129
 		foreach ($this->validRoots as $root => $true) {
130
-			if (substr($fullPath, 0, strlen($root) + 1) === $root . '/') {
130
+			if (substr($fullPath, 0, strlen($root) + 1) === $root.'/') {
131 131
 				return true;
132 132
 			}
133 133
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			$pathsToRequire = $this->memoryCache->get($class);
147 147
 		}
148 148
 
149
-		if(class_exists($class, false)) {
149
+		if (class_exists($class, false)) {
150 150
 			return false;
151 151
 		}
152 152
 
Please login to merge, or discard this patch.
lib/private/IntegrityCheck/Checker.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @return bool
97 97
 	 */
98 98
 	public function isCodeCheckEnforced() {
99
-		$notSignedChannels = [ '', 'git'];
99
+		$notSignedChannels = ['', 'git'];
100 100
 		if (in_array($this->environmentHelper->getChannel(), $notSignedChannels, true)) {
101 101
 			return false;
102 102
 		}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 			$folderToIterate,
132 132
 			\RecursiveDirectoryIterator::SKIP_DOTS
133 133
 		);
134
-		if($root === '') {
134
+		if ($root === '') {
135 135
 			$root = \OC::$SERVERROOT;
136 136
 		}
137 137
 		$root = rtrim($root, '/');
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
 		$tmpFolder = '';
161 161
 
162 162
 		$baseDirectoryLength = strlen($path);
163
-		foreach($iterator as $filename => $data) {
163
+		foreach ($iterator as $filename => $data) {
164 164
 			/** @var \DirectoryIterator $data */
165
-			if($data->isDir()) {
165
+			if ($data->isDir()) {
166 166
 				continue;
167 167
 			}
168 168
 
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 			$relativeFileName = ltrim($relativeFileName, '/');
171 171
 
172 172
 			// Exclude signature.json files in the appinfo and root folder
173
-			if($relativeFileName === 'appinfo/signature.json') {
173
+			if ($relativeFileName === 'appinfo/signature.json') {
174 174
 				continue;
175 175
 			}
176 176
 			// Exclude signature.json files in the appinfo and core folder
177
-			if($relativeFileName === 'core/signature.json') {
177
+			if ($relativeFileName === 'core/signature.json') {
178 178
 				continue;
179 179
 			}
180 180
 
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
 			// to ensure that this will not lead to false positives this will
184 184
 			// copy the file to a temporary folder and reset it to the default
185 185
 			// values.
186
-			if($filename === $this->environmentHelper->getServerRoot() . '/.htaccess'
187
-				|| $filename === $this->environmentHelper->getServerRoot() . '/.user.ini') {
186
+			if ($filename === $this->environmentHelper->getServerRoot().'/.htaccess'
187
+				|| $filename === $this->environmentHelper->getServerRoot().'/.user.ini') {
188 188
 
189
-				if(!$copiedWebserverSettingFiles) {
189
+				if (!$copiedWebserverSettingFiles) {
190 190
 					$tmpFolder = rtrim($this->tempManager->getTemporaryFolder(), '/');
191
-					copy($this->environmentHelper->getServerRoot() . '/.htaccess', $tmpFolder . '/.htaccess');
192
-					copy($this->environmentHelper->getServerRoot() . '/.user.ini', $tmpFolder . '/.user.ini');
191
+					copy($this->environmentHelper->getServerRoot().'/.htaccess', $tmpFolder.'/.htaccess');
192
+					copy($this->environmentHelper->getServerRoot().'/.user.ini', $tmpFolder.'/.user.ini');
193 193
 					\OC_Files::setUploadLimit(
194 194
 						\OCP\Util::computerFileSize('511MB'),
195 195
 						[
196
-							'.htaccess' => $tmpFolder . '/.htaccess',
197
-							'.user.ini' => $tmpFolder . '/.user.ini',
196
+							'.htaccess' => $tmpFolder.'/.htaccess',
197
+							'.user.ini' => $tmpFolder.'/.user.ini',
198 198
 						]
199 199
 					);
200 200
 				}
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 
203 203
 			// The .user.ini file can contain custom modifications to the file size
204 204
 			// as well.
205
-			if($filename === $this->environmentHelper->getServerRoot() . '/.user.ini') {
206
-				$fileContent = file_get_contents($tmpFolder . '/.user.ini');
205
+			if ($filename === $this->environmentHelper->getServerRoot().'/.user.ini') {
206
+				$fileContent = file_get_contents($tmpFolder.'/.user.ini');
207 207
 				$hashes[$relativeFileName] = hash('sha512', $fileContent);
208 208
 				continue;
209 209
 			}
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
 			// Thus we ignore everything below the first occurrence of
216 216
 			// "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####" and have the
217 217
 			// hash generated based on this.
218
-			if($filename === $this->environmentHelper->getServerRoot() . '/.htaccess') {
219
-				$fileContent = file_get_contents($tmpFolder . '/.htaccess');
218
+			if ($filename === $this->environmentHelper->getServerRoot().'/.htaccess') {
219
+				$fileContent = file_get_contents($tmpFolder.'/.htaccess');
220 220
 				$explodedArray = explode('#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####', $fileContent);
221
-				if(count($explodedArray) === 2) {
221
+				if (count($explodedArray) === 2) {
222 222
 					$hashes[$relativeFileName] = hash('sha512', $explodedArray[0]);
223 223
 					continue;
224 224
 				}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	public function writeAppSignature($path,
268 268
 									  X509 $certificate,
269 269
 									  RSA $privateKey) {
270
-		$appInfoDir = $path . '/appinfo';
270
+		$appInfoDir = $path.'/appinfo';
271 271
 		try {
272 272
 			$this->fileAccessHelper->assertDirectoryExists($appInfoDir);
273 273
 
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 			$hashes = $this->generateHashes($iterator, $path);
276 276
 			$signature = $this->createSignatureData($hashes, $certificate, $privateKey);
277 277
 				$this->fileAccessHelper->file_put_contents(
278
-					$appInfoDir . '/signature.json',
278
+					$appInfoDir.'/signature.json',
279 279
 				json_encode($signature, JSON_PRETTY_PRINT)
280 280
 			);
281
-		} catch (\Exception $e){
281
+		} catch (\Exception $e) {
282 282
 			if (!$this->fileAccessHelper->is_writable($appInfoDir)) {
283
-				throw new \Exception($appInfoDir . ' is not writable');
283
+				throw new \Exception($appInfoDir.' is not writable');
284 284
 			}
285 285
 			throw $e;
286 286
 		}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	public function writeCoreSignature(X509 $certificate,
298 298
 									   RSA $rsa,
299 299
 									   $path) {
300
-		$coreDir = $path . '/core';
300
+		$coreDir = $path.'/core';
301 301
 		try {
302 302
 
303 303
 			$this->fileAccessHelper->assertDirectoryExists($coreDir);
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 			$hashes = $this->generateHashes($iterator, $path);
306 306
 			$signatureData = $this->createSignatureData($hashes, $certificate, $rsa);
307 307
 			$this->fileAccessHelper->file_put_contents(
308
-				$coreDir . '/signature.json',
308
+				$coreDir.'/signature.json',
309 309
 				json_encode($signatureData, JSON_PRETTY_PRINT)
310 310
 			);
311
-		} catch (\Exception $e){
311
+		} catch (\Exception $e) {
312 312
 			if (!$this->fileAccessHelper->is_writable($coreDir)) {
313
-				throw new \Exception($coreDir . ' is not writable');
313
+				throw new \Exception($coreDir.' is not writable');
314 314
 			}
315 315
 			throw $e;
316 316
 		}
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
 	 * @throws \Exception
328 328
 	 */
329 329
 	private function verify($signaturePath, $basePath, $certificateCN) {
330
-		if(!$this->isCodeCheckEnforced()) {
330
+		if (!$this->isCodeCheckEnforced()) {
331 331
 			return [];
332 332
 		}
333 333
 
334 334
 		$signatureData = json_decode($this->fileAccessHelper->file_get_contents($signaturePath), true);
335
-		if(!is_array($signatureData)) {
335
+		if (!is_array($signatureData)) {
336 336
 			throw new InvalidSignatureException('Signature data not found.');
337 337
 		}
338 338
 
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
 		$rootCertificatePublicKey = $this->fileAccessHelper->file_get_contents($this->environmentHelper->getServerRoot().'/resources/codesigning/root.crt');
347 347
 		$x509->loadCA($rootCertificatePublicKey);
348 348
 		$x509->loadX509($certificate);
349
-		if(!$x509->validateSignature()) {
349
+		if (!$x509->validateSignature()) {
350 350
 			throw new InvalidSignatureException('Certificate is not valid.');
351 351
 		}
352 352
 		// Verify if certificate has proper CN. "core" CN is always trusted.
353
-		if($x509->getDN(X509::DN_OPENSSL)['CN'] !== $certificateCN && $x509->getDN(X509::DN_OPENSSL)['CN'] !== 'core') {
353
+		if ($x509->getDN(X509::DN_OPENSSL)['CN'] !== $certificateCN && $x509->getDN(X509::DN_OPENSSL)['CN'] !== 'core') {
354 354
 			throw new InvalidSignatureException(
355 355
 					sprintf('Certificate is not valid for required scope. (Requested: %s, current: CN=%s)', $certificateCN, $x509->getDN(true)['CN'])
356 356
 			);
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		$rsa->setMGFHash('sha512');
364 364
 		// See https://tools.ietf.org/html/rfc3447#page-38
365 365
 		$rsa->setSaltLength(0);
366
-		if(!$rsa->verify(json_encode($expectedHashes), $signature)) {
366
+		if (!$rsa->verify(json_encode($expectedHashes), $signature)) {
367 367
 			throw new InvalidSignatureException('Signature could not get verified.');
368 368
 		}
369 369
 
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
 		//
373 373
 		// Due to this reason we exclude the whole updater/ folder from the code
374 374
 		// integrity check.
375
-		if($basePath === $this->environmentHelper->getServerRoot()) {
376
-			foreach($expectedHashes as $fileName => $hash) {
377
-				if(strpos($fileName, 'updater/') === 0) {
375
+		if ($basePath === $this->environmentHelper->getServerRoot()) {
376
+			foreach ($expectedHashes as $fileName => $hash) {
377
+				if (strpos($fileName, 'updater/') === 0) {
378 378
 					unset($expectedHashes[$fileName]);
379 379
 				}
380 380
 			}
@@ -386,23 +386,23 @@  discard block
 block discarded – undo
386 386
 		$differencesB = array_diff($currentInstanceHashes, $expectedHashes);
387 387
 		$differences = array_unique(array_merge($differencesA, $differencesB));
388 388
 		$differenceArray = [];
389
-		foreach($differences as $filename => $hash) {
389
+		foreach ($differences as $filename => $hash) {
390 390
 			// Check if file should not exist in the new signature table
391
-			if(!array_key_exists($filename, $expectedHashes)) {
391
+			if (!array_key_exists($filename, $expectedHashes)) {
392 392
 				$differenceArray['EXTRA_FILE'][$filename]['expected'] = '';
393 393
 				$differenceArray['EXTRA_FILE'][$filename]['current'] = $hash;
394 394
 				continue;
395 395
 			}
396 396
 
397 397
 			// Check if file is missing
398
-			if(!array_key_exists($filename, $currentInstanceHashes)) {
398
+			if (!array_key_exists($filename, $currentInstanceHashes)) {
399 399
 				$differenceArray['FILE_MISSING'][$filename]['expected'] = $expectedHashes[$filename];
400 400
 				$differenceArray['FILE_MISSING'][$filename]['current'] = '';
401 401
 				continue;
402 402
 			}
403 403
 
404 404
 			// Check if hash does mismatch
405
-			if($expectedHashes[$filename] !== $currentInstanceHashes[$filename]) {
405
+			if ($expectedHashes[$filename] !== $currentInstanceHashes[$filename]) {
406 406
 				$differenceArray['INVALID_HASH'][$filename]['expected'] = $expectedHashes[$filename];
407 407
 				$differenceArray['INVALID_HASH'][$filename]['current'] = $currentInstanceHashes[$filename];
408 408
 				continue;
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 */
423 423
 	public function hasPassedCheck() {
424 424
 		$results = $this->getResults();
425
-		if(empty($results)) {
425
+		if (empty($results)) {
426 426
 			return true;
427 427
 		}
428 428
 
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	 */
435 435
 	public function getResults() {
436 436
 		$cachedResults = $this->cache->get(self::CACHE_KEY);
437
-		if(!is_null($cachedResults)) {
437
+		if (!is_null($cachedResults)) {
438 438
 			return json_decode($cachedResults, true);
439 439
 		}
440 440
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	private function storeResults($scope, array $result) {
454 454
 		$resultArray = $this->getResults();
455 455
 		unset($resultArray[$scope]);
456
-		if(!empty($result)) {
456
+		if (!empty($result)) {
457 457
 			$resultArray[$scope] = $result;
458 458
 		}
459 459
 		if ($this->config !== null) {
@@ -505,11 +505,11 @@  discard block
 block discarded – undo
505 505
 	 */
506 506
 	public function verifyAppSignature($appId, $path = '') {
507 507
 		try {
508
-			if($path === '') {
508
+			if ($path === '') {
509 509
 				$path = $this->appLocator->getAppPath($appId);
510 510
 			}
511 511
 			$result = $this->verify(
512
-					$path . '/appinfo/signature.json',
512
+					$path.'/appinfo/signature.json',
513 513
 					$path,
514 514
 					$appId
515 515
 			);
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 	public function verifyCoreSignature() {
560 560
 		try {
561 561
 			$result = $this->verify(
562
-					$this->environmentHelper->getServerRoot() . '/core/signature.json',
562
+					$this->environmentHelper->getServerRoot().'/core/signature.json',
563 563
 					$this->environmentHelper->getServerRoot(),
564 564
 					'core'
565 565
 			);
@@ -584,18 +584,18 @@  discard block
 block discarded – undo
584 584
 		$this->cleanResults();
585 585
 		$this->verifyCoreSignature();
586 586
 		$appIds = $this->appLocator->getAllApps();
587
-		foreach($appIds as $appId) {
587
+		foreach ($appIds as $appId) {
588 588
 			// If an application is shipped a valid signature is required
589 589
 			$isShipped = $this->appManager->isShipped($appId);
590 590
 			$appNeedsToBeChecked = false;
591 591
 			if ($isShipped) {
592 592
 				$appNeedsToBeChecked = true;
593
-			} elseif ($this->fileAccessHelper->file_exists($this->appLocator->getAppPath($appId) . '/appinfo/signature.json')) {
593
+			} elseif ($this->fileAccessHelper->file_exists($this->appLocator->getAppPath($appId).'/appinfo/signature.json')) {
594 594
 				// Otherwise only if the application explicitly ships a signature.json file
595 595
 				$appNeedsToBeChecked = true;
596 596
 			}
597 597
 
598
-			if($appNeedsToBeChecked) {
598
+			if ($appNeedsToBeChecked) {
599 599
 				$this->verifyAppSignature($appId);
600 600
 			}
601 601
 		}
Please login to merge, or discard this patch.