Completed
Push — stable10 ( e55881...b0ab3b )
by Joas
36:13 queued 35:48
created
lib/private/Preview/TXT.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
48 48
 		$content = $fileview->fopen($path, 'r');
49
-		$content = stream_get_contents($content,3000);
49
+		$content = stream_get_contents($content, 3000);
50 50
 
51 51
 		//don't create previews of empty text files
52
-		if(trim($content) === '') {
52
+		if (trim($content) === '') {
53 53
 			return false;
54 54
 		}
55 55
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 		$canUseTTF = function_exists('imagettftext');
70 70
 
71
-		foreach($lines as $index => $line) {
71
+		foreach ($lines as $index => $line) {
72 72
 			$index = $index + 1;
73 73
 
74 74
 			$x = (int) 1;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 				imagestring($image, 1, $x, $y, $line, $textColor);
82 82
 			}
83 83
 
84
-			if(($index * $lineSize) >= $maxY) {
84
+			if (($index * $lineSize) >= $maxY) {
85 85
 				break;
86 86
 			}
87 87
 		}
Please login to merge, or discard this patch.
lib/private/Preview/Bitmap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		try {
49 49
 			$bp = $this->getResizedPreview($tmpPath, $maxX, $maxY);
50 50
 		} catch (\Exception $e) {
51
-			\OCP\Util::writeLog('core', 'ImageMagick says: ' . $e->getmessage(), \OCP\Util::ERROR);
51
+			\OCP\Util::writeLog('core', 'ImageMagick says: '.$e->getmessage(), \OCP\Util::ERROR);
52 52
 			return false;
53 53
 		}
54 54
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		$bp = new Imagick();
80 80
 
81 81
 		// Layer 0 contains either the bitmap or a flat representation of all vector layers
82
-		$bp->readImage($tmpPath . '[0]');
82
+		$bp->readImage($tmpPath.'[0]');
83 83
 
84 84
 		$bp = $this->resize($bp, $maxX, $maxY);
85 85
 
Please login to merge, or discard this patch.
lib/private/Preview/Office.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -41,20 +41,20 @@
 block discarded – undo
41 41
 
42 42
 		$tmpDir = \OC::$server->getTempManager()->getTempBaseDir();
43 43
 
44
-		$defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
44
+		$defaultParameters = ' -env:UserInstallation=file://'.escapeshellarg($tmpDir.'/owncloud-'.\OC_Util::getInstanceId().'/').' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
45 45
 		$clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
46 46
 
47
-		$exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
47
+		$exec = $this->cmd.$clParameters.escapeshellarg($tmpDir).' '.escapeshellarg($absPath);
48 48
 
49 49
 		shell_exec($exec);
50 50
 
51 51
 		//create imagick object from pdf
52 52
 		$pdfPreview = null;
53 53
 		try {
54
-			list($dirname, , , $filename) = array_values(pathinfo($absPath));
55
-			$pdfPreview = $dirname . '/' . $filename . '.pdf';
54
+			list($dirname,,, $filename) = array_values(pathinfo($absPath));
55
+			$pdfPreview = $dirname.'/'.$filename.'.pdf';
56 56
 
57
-			$pdf = new \imagick($pdfPreview . '[0]');
57
+			$pdf = new \imagick($pdfPreview.'[0]');
58 58
 			$pdf->setImageFormat('jpg');
59 59
 		} catch (\Exception $e) {
60 60
 			unlink($absPath);
Please login to merge, or discard this patch.
lib/private/Preview/Movie.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -84,15 +84,15 @@
 block discarded – undo
84 84
 		$tmpPath = \OC::$server->getTempManager()->getTemporaryFile();
85 85
 
86 86
 		if (self::$avconvBinary) {
87
-			$cmd = self::$avconvBinary . ' -y -ss ' . escapeshellarg($second) .
88
-				' -i ' . escapeshellarg($absPath) .
89
-				' -an -f mjpeg -vframes 1 -vsync 1 ' . escapeshellarg($tmpPath) .
87
+			$cmd = self::$avconvBinary.' -y -ss '.escapeshellarg($second).
88
+				' -i '.escapeshellarg($absPath).
89
+				' -an -f mjpeg -vframes 1 -vsync 1 '.escapeshellarg($tmpPath).
90 90
 				' > /dev/null 2>&1';
91 91
 		} else {
92
-			$cmd = self::$ffmpegBinary . ' -y -ss ' . escapeshellarg($second) .
93
-				' -i ' . escapeshellarg($absPath) .
94
-				' -f mjpeg -vframes 1' .
95
-				' ' . escapeshellarg($tmpPath) .
92
+			$cmd = self::$ffmpegBinary.' -y -ss '.escapeshellarg($second).
93
+				' -i '.escapeshellarg($absPath).
94
+				' -f mjpeg -vframes 1'.
95
+				' '.escapeshellarg($tmpPath).
96 96
 				' > /dev/null 2>&1';
97 97
 		}
98 98
 
Please login to merge, or discard this patch.
lib/private/Preview/SVG.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 
43 43
 			$content = stream_get_contents($fileview->fopen($path, 'r'));
44 44
 			if (substr($content, 0, 5) !== '<?xml') {
45
-				$content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content;
45
+				$content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'.$content;
46 46
 			}
47 47
 
48 48
 			// Do not parse SVG files with references
Please login to merge, or discard this patch.
lib/private/Share20/ProviderFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		}
179 179
 
180 180
 		if ($provider === null) {
181
-			throw new ProviderException('No provider with id .' . $id . ' found.');
181
+			throw new ProviderException('No provider with id .'.$id.' found.');
182 182
 		}
183 183
 
184 184
 		return $provider;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	public function getProviderForType($shareType) {
191 191
 		$provider = null;
192 192
 
193
-		if ($shareType === \OCP\Share::SHARE_TYPE_USER  ||
193
+		if ($shareType === \OCP\Share::SHARE_TYPE_USER ||
194 194
 			$shareType === \OCP\Share::SHARE_TYPE_GROUP ||
195 195
 			$shareType === \OCP\Share::SHARE_TYPE_LINK) {
196 196
 			$provider = $this->defaultShareProvider();
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		}
202 202
 
203 203
 		if ($provider === null) {
204
-			throw new ProviderException('No share provider for share type ' . $shareType);
204
+			throw new ProviderException('No share provider for share type '.$shareType);
205 205
 		}
206 206
 
207 207
 		return $provider;
Please login to merge, or discard this patch.
lib/private/Setup/OCI.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 
54 54
 	public function validate($config) {
55 55
 		$errors = array();
56
-		if(empty($config['dbuser']) && empty($config['dbname'])) {
56
+		if (empty($config['dbuser']) && empty($config['dbname'])) {
57 57
 			$errors[] = $this->trans->t("%s enter the database username and name.", array($this->dbprettyname));
58
-		} else if(empty($config['dbuser'])) {
58
+		} else if (empty($config['dbuser'])) {
59 59
 			$errors[] = $this->trans->t("%s enter the database username.", array($this->dbprettyname));
60
-		} else if(empty($config['dbname'])) {
60
+		} else if (empty($config['dbname'])) {
61 61
 			$errors[] = $this->trans->t("%s enter the database name.", array($this->dbprettyname));
62 62
 		}
63 63
 		return $errors;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	public function setupDatabase($username) {
67 67
 		$e_host = addslashes($this->dbHost);
68 68
 		// casting to int to avoid malicious input
69
-		$e_port = (int)$this->dbPort;
69
+		$e_port = (int) $this->dbPort;
70 70
 		$e_dbname = addslashes($this->dbName);
71 71
 		//check if the database user has admin right
72 72
 		if ($e_host == '') {
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 		} else {
75 75
 			$easy_connect_string = '//'.$e_host.(!empty($e_port) ? ":{$e_port}" : "").'/'.$e_dbname;
76 76
 		}
77
-		$this->logger->debug('connect string: ' . $easy_connect_string, ['app' => 'setup.oci']);
77
+		$this->logger->debug('connect string: '.$easy_connect_string, ['app' => 'setup.oci']);
78 78
 		$connection = @oci_connect($this->dbUser, $this->dbPassword, $easy_connect_string);
79
-		if(!$connection) {
79
+		if (!$connection) {
80 80
 			$errorMessage = $this->getLastError();
81 81
 			if ($errorMessage) {
82 82
 				throw new \OC\DatabaseSetupException($this->trans->t('Oracle connection could not be established'),
@@ -84,41 +84,41 @@  discard block
 block discarded – undo
84 84
 							.' ORACLE_SID='.getenv('ORACLE_SID')
85 85
 							.' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH')
86 86
 							.' NLS_LANG='.getenv('NLS_LANG')
87
-							.' tnsnames.ora is '.(is_readable(getenv('ORACLE_HOME').'/network/admin/tnsnames.ora')?'':'not ').'readable');
87
+							.' tnsnames.ora is '.(is_readable(getenv('ORACLE_HOME').'/network/admin/tnsnames.ora') ? '' : 'not ').'readable');
88 88
 			}
89 89
 			throw new \OC\DatabaseSetupException($this->trans->t('Oracle username and/or password not valid'),
90 90
 					'Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
91 91
 							.' ORACLE_SID='.getenv('ORACLE_SID')
92 92
 							.' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH')
93 93
 							.' NLS_LANG='.getenv('NLS_LANG')
94
-							.' tnsnames.ora is '.(is_readable(getenv('ORACLE_HOME').'/network/admin/tnsnames.ora')?'':'not ').'readable');
94
+							.' tnsnames.ora is '.(is_readable(getenv('ORACLE_HOME').'/network/admin/tnsnames.ora') ? '' : 'not ').'readable');
95 95
 		}
96 96
 		//check for roles creation rights in oracle
97 97
 
98
-		$query='SELECT count(*) FROM user_role_privs, role_sys_privs'
98
+		$query = 'SELECT count(*) FROM user_role_privs, role_sys_privs'
99 99
 			." WHERE user_role_privs.granted_role = role_sys_privs.role AND privilege = 'CREATE ROLE'";
100 100
 		$stmt = oci_parse($connection, $query);
101 101
 		if (!$stmt) {
102
-			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
103
-			$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
102
+			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))).'<br />';
103
+			$entry .= $this->trans->t('Offending command was: "%s"', array($query)).'<br />';
104 104
 			$this->logger->warning($entry, ['app' => 'setup.oci']);
105 105
 		}
106 106
 		$result = oci_execute($stmt);
107
-		if($result) {
107
+		if ($result) {
108 108
 			$row = oci_fetch_row($stmt);
109 109
 
110 110
 			if ($row[0] > 0) {
111 111
 				//use the admin login data for the new database user
112 112
 
113 113
 				//add prefix to the oracle user name to prevent collisions
114
-				$this->dbUser='oc_'.$username;
114
+				$this->dbUser = 'oc_'.$username;
115 115
 				//create a new password so we don't need to store the admin config in the config file
116 116
 				$this->dbPassword = \OC::$server->getSecureRandom()->generate(30, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS);
117 117
 
118 118
 				//oracle passwords are treated as identifiers:
119 119
 				//  must start with alphanumeric char
120 120
 				//  needs to be shortened to 30 bytes, as the two " needed to escape the identifier count towards the identifier length.
121
-				$this->dbPassword=substr($this->dbPassword, 0, 30);
121
+				$this->dbPassword = substr($this->dbPassword, 0, 30);
122 122
 
123 123
 				$this->createDBUser($connection);
124 124
 			}
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 			$easy_connect_string = '//'.$e_host.'/'.$e_dbname;
153 153
 		}
154 154
 		$connection = @oci_connect($this->dbUser, $this->dbPassword, $easy_connect_string);
155
-		if(!$connection) {
155
+		if (!$connection) {
156 156
 			throw new \OC\DatabaseSetupException($this->trans->t('Oracle username and/or password not valid'),
157 157
 					$this->trans->t('You need to enter either an existing account or the administrator.'));
158 158
 		}
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
 		$un = $this->tablePrefix.'users';
162 162
 		oci_bind_by_name($stmt, ':un', $un);
163 163
 		if (!$stmt) {
164
-			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
165
-			$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
166
-			$this->logger->warning( $entry, ['app' => 'setup.oci']);
164
+			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))).'<br />';
165
+			$entry .= $this->trans->t('Offending command was: "%s"', array($query)).'<br />';
166
+			$this->logger->warning($entry, ['app' => 'setup.oci']);
167 167
 		}
168 168
 		$result = oci_execute($stmt);
169 169
 
170
-		if($result) {
170
+		if ($result) {
171 171
 			$row = oci_fetch_row($stmt);
172 172
 		}
173
-		if(!$result or $row[0]==0) {
173
+		if (!$result or $row[0] == 0) {
174 174
 			\OC_DB::createDbFromStructure($this->dbDefinitionFile);
175 175
 		}
176 176
 	}
@@ -184,35 +184,35 @@  discard block
 block discarded – undo
184 184
 		$query = "SELECT * FROM all_users WHERE USERNAME = :un";
185 185
 		$stmt = oci_parse($connection, $query);
186 186
 		if (!$stmt) {
187
-			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
188
-			$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
187
+			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))).'<br />';
188
+			$entry .= $this->trans->t('Offending command was: "%s"', array($query)).'<br />';
189 189
 			$this->logger->warning($entry, ['app' => 'setup.oci']);
190 190
 		}
191 191
 		oci_bind_by_name($stmt, ':un', $name);
192 192
 		$result = oci_execute($stmt);
193
-		if(!$result) {
194
-			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
195
-			$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
193
+		if (!$result) {
194
+			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))).'<br />';
195
+			$entry .= $this->trans->t('Offending command was: "%s"', array($query)).'<br />';
196 196
 			$this->logger->warning($entry, ['app' => 'setup.oci']);
197 197
 		}
198 198
 
199
-		if(! oci_fetch_row($stmt)) {
199
+		if (!oci_fetch_row($stmt)) {
200 200
 			//user does not exists let's create it :)
201 201
 			//password must start with alphabetic character in oracle
202 202
 			$query = 'CREATE USER '.$name.' IDENTIFIED BY "'.$password.'" DEFAULT TABLESPACE '.$this->dbtablespace;
203 203
 			$stmt = oci_parse($connection, $query);
204 204
 			if (!$stmt) {
205
-				$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
206
-				$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
205
+				$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))).'<br />';
206
+				$entry .= $this->trans->t('Offending command was: "%s"', array($query)).'<br />';
207 207
 				$this->logger->warning($entry, ['app' => 'setup.oci']);
208 208
 
209 209
 			}
210 210
 			//oci_bind_by_name($stmt, ':un', $name);
211 211
 			$result = oci_execute($stmt);
212
-			if(!$result) {
213
-				$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
212
+			if (!$result) {
213
+				$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))).'<br />';
214 214
 				$entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s',
215
-					array($query, $name, $password)) . '<br />';
215
+					array($query, $name, $password)).'<br />';
216 216
 				$this->logger->warning($entry, ['app' => 'setup.oci']);
217 217
 
218 218
 			}
@@ -220,16 +220,16 @@  discard block
 block discarded – undo
220 220
 			$query = "ALTER USER :un IDENTIFIED BY :pw";
221 221
 			$stmt = oci_parse($connection, $query);
222 222
 			if (!$stmt) {
223
-				$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
224
-				$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
223
+				$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))).'<br />';
224
+				$entry .= $this->trans->t('Offending command was: "%s"', array($query)).'<br />';
225 225
 				$this->logger->warning($entry, ['app' => 'setup.oci']);
226 226
 			}
227 227
 			oci_bind_by_name($stmt, ':un', $name);
228 228
 			oci_bind_by_name($stmt, ':pw', $password);
229 229
 			$result = oci_execute($stmt);
230
-			if(!$result) {
231
-				$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
232
-				$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
230
+			if (!$result) {
231
+				$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))).'<br />';
232
+				$entry .= $this->trans->t('Offending command was: "%s"', array($query)).'<br />';
233 233
 				$this->logger->warning($entry, ['app' => 'setup.oci']);
234 234
 			}
235 235
 		}
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
 		$query = 'GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER, UNLIMITED TABLESPACE TO '.$name;
238 238
 		$stmt = oci_parse($connection, $query);
239 239
 		if (!$stmt) {
240
-			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
241
-			$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
240
+			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))).'<br />';
241
+			$entry .= $this->trans->t('Offending command was: "%s"', array($query)).'<br />';
242 242
 			$this->logger->warning($entry, ['app' => 'setup.oci']);
243 243
 		}
244 244
 		$result = oci_execute($stmt);
245
-		if(!$result) {
246
-			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
245
+		if (!$result) {
246
+			$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))).'<br />';
247 247
 			$entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s',
248
-				array($query, $name, $password)) . '<br />';
248
+				array($query, $name, $password)).'<br />';
249 249
 			$this->logger->warning($entry, ['app' => 'setup.oci']);
250 250
 		}
251 251
 	}
Please login to merge, or discard this patch.
lib/private/Setup/AbstractDatabase.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,14 +68,14 @@
 block discarded – undo
68 68
 
69 69
 	public function validate($config) {
70 70
 		$errors = array();
71
-		if(empty($config['dbuser']) && empty($config['dbname'])) {
71
+		if (empty($config['dbuser']) && empty($config['dbname'])) {
72 72
 			$errors[] = $this->trans->t("%s enter the database username and name.", array($this->dbprettyname));
73
-		} else if(empty($config['dbuser'])) {
73
+		} else if (empty($config['dbuser'])) {
74 74
 			$errors[] = $this->trans->t("%s enter the database username.", array($this->dbprettyname));
75
-		} else if(empty($config['dbname'])) {
75
+		} else if (empty($config['dbname'])) {
76 76
 			$errors[] = $this->trans->t("%s enter the database name.", array($this->dbprettyname));
77 77
 		}
78
-		if(substr_count($config['dbname'], '.') >= 1) {
78
+		if (substr_count($config['dbname'], '.') >= 1) {
79 79
 			$errors[] = $this->trans->t("%s you may not use dots in the database name", array($this->dbprettyname));
80 80
 		}
81 81
 		return $errors;
Please login to merge, or discard this patch.
lib/private/PreviewManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 		}
245 245
 
246 246
 		$mount = $file->getMountPoint();
247
-		if ($mount and !$mount->getOption('previews', true)){
247
+		if ($mount and !$mount->getOption('previews', true)) {
248 248
 			return false;
249 249
 		}
250 250
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 */
331 331
 	protected function registerCoreProvider($class, $mimeType, $options = []) {
332 332
 		if (in_array(trim($class, '\\'), $this->getEnabledDefaultProvider())) {
333
-			$this->registerProvider($mimeType, function () use ($class, $options) {
333
+			$this->registerProvider($mimeType, function() use ($class, $options) {
334 334
 				return new $class($options);
335 335
 			});
336 336
 		}
Please login to merge, or discard this patch.