@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | break; |
91 | 91 | |
92 | 92 | case 'openssl': |
93 | - $prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]?).*}', function ($match) { |
|
94 | - return $match[1] . (empty($match[2]) ? '' : '.' . (ord($match[2]) - 96)); |
|
93 | + $prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]?).*}', function($match) { |
|
94 | + return $match[1].(empty($match[2]) ? '' : '.'.(ord($match[2]) - 96)); |
|
95 | 95 | }, OPENSSL_VERSION_TEXT); |
96 | 96 | break; |
97 | 97 | |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | return '9999999-dev'; |
167 | 167 | } |
168 | 168 | if ('dev-' === strtolower(substr($version, 0, 4))) { |
169 | - return 'dev-' . substr($version, 4); |
|
169 | + return 'dev-'.substr($version, 4); |
|
170 | 170 | } |
171 | 171 | // match classical versioning |
172 | - if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?' . self::$modifierRegex . '$}i', $version, $matches)) { |
|
172 | + if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?'.self::$modifierRegex.'$}i', $version, $matches)) { |
|
173 | 173 | $version = $matches[1] |
174 | 174 | . (!empty($matches[2]) ? $matches[2] : '.0') |
175 | 175 | . (!empty($matches[3]) ? $matches[3] : '.0') |
176 | 176 | . (!empty($matches[4]) ? $matches[4] : '.0'); |
177 | 177 | $index = 5; |
178 | - } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) { // match date-based versioning |
|
178 | + } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)'.self::$modifierRegex.'$}i', $version, $matches)) { // match date-based versioning |
|
179 | 179 | $version = preg_replace('{\D}', '-', $matches[1]); |
180 | 180 | $index = 2; |
181 | - } elseif (preg_match('{^v?(\d{4,})(\.\d+)?(\.\d+)?(\.\d+)?' . self::$modifierRegex . '$}i', $version, $matches)) { |
|
181 | + } elseif (preg_match('{^v?(\d{4,})(\.\d+)?(\.\d+)?(\.\d+)?'.self::$modifierRegex.'$}i', $version, $matches)) { |
|
182 | 182 | $version = $matches[1] |
183 | 183 | . (!empty($matches[2]) ? $matches[2] : '.0') |
184 | 184 | . (!empty($matches[3]) ? $matches[3] : '.0') |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | if ('stable' === $matches[$index]) { |
192 | 192 | return $version; |
193 | 193 | } |
194 | - $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? $matches[$index + 1] : ''); |
|
194 | + $version .= '-'.$this->expandStability($matches[$index]).(!empty($matches[$index + 1]) ? $matches[$index + 1] : ''); |
|
195 | 195 | } |
196 | 196 | if (!empty($matches[$index + 2])) { |
197 | 197 | $version .= '-dev'; |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | return $version; |
200 | 200 | } |
201 | 201 | $extraMessage = ''; |
202 | - if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) { |
|
203 | - $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version'; |
|
204 | - } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) { |
|
205 | - $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-'; |
|
202 | + if (preg_match('{ +as +'.preg_quote($version).'$}', $fullVersion)) { |
|
203 | + $extraMessage = ' in "'.$fullVersion.'", the alias must be an exact version'; |
|
204 | + } elseif (preg_match('{^'.preg_quote($version).' +as +}', $fullVersion)) { |
|
205 | + $extraMessage = ' in "'.$fullVersion.'", the alias source must be an exact version, if it is a branch name you should prefix it with dev-'; |
|
206 | 206 | } |
207 | - throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage); |
|
207 | + throw new \UnexpectedValueException('Invalid version string "'.$version.'"'.$extraMessage); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @return string Formatted date and time string |
238 | 238 | */ |
239 | 239 | public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null) { |
240 | - return $this->format($timestamp, 'datetime', $formatDate . '|' . $formatTime, $timeZone, $l); |
|
240 | + return $this->format($timestamp, 'datetime', $formatDate.'|'.$formatTime, $timeZone, $l); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $formatDate .= '^'; |
257 | 257 | } |
258 | 258 | |
259 | - return $this->format($timestamp, 'datetime', $formatDate . '|' . $formatTime, $timeZone, $l); |
|
259 | + return $this->format($timestamp, 'datetime', $formatDate.'|'.$formatTime, $timeZone, $l); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -56,15 +56,15 @@ |
||
56 | 56 | public function connectWatcher() { |
57 | 57 | // Do not connect if we are not setup yet! |
58 | 58 | if ($this->config->getValue('instanceid', null) !== null) { |
59 | - $this->root->listen('\OC\Files', 'postWrite', function (Node $node) { |
|
59 | + $this->root->listen('\OC\Files', 'postWrite', function(Node $node) { |
|
60 | 60 | $this->getWatcher()->postWrite($node); |
61 | 61 | }); |
62 | 62 | |
63 | - $this->root->listen('\OC\Files', 'preDelete', function (Node $node) { |
|
63 | + $this->root->listen('\OC\Files', 'preDelete', function(Node $node) { |
|
64 | 64 | $this->getWatcher()->preDelete($node); |
65 | 65 | }); |
66 | 66 | |
67 | - $this->root->listen('\OC\Files', 'postDelete', function (Node $node) { |
|
67 | + $this->root->listen('\OC\Files', 'postDelete', function(Node $node) { |
|
68 | 68 | $this->getWatcher()->postDelete($node); |
69 | 69 | }); |
70 | 70 | } |
@@ -46,10 +46,10 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -84,15 +84,15 @@ |
||
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 |
@@ -42,7 +42,7 @@ |
||
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 |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function setId($id) { |
88 | 88 | if (is_int($id)) { |
89 | - $id = (string)$id; |
|
89 | + $id = (string) $id; |
|
90 | 90 | } |
91 | 91 | |
92 | - if(!is_string($id)) { |
|
92 | + if (!is_string($id)) { |
|
93 | 93 | throw new \InvalidArgumentException('String expected.'); |
94 | 94 | } |
95 | 95 | |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | if ($this->providerId === null || $this->id === null) { |
116 | 116 | throw new \UnexpectedValueException; |
117 | 117 | } |
118 | - return $this->providerId . ':' . $this->id; |
|
118 | + return $this->providerId.':'.$this->id; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | 122 | * @inheritdoc |
123 | 123 | */ |
124 | 124 | public function setProviderId($id) { |
125 | - if(!is_string($id)) { |
|
125 | + if (!is_string($id)) { |
|
126 | 126 | throw new \InvalidArgumentException('String expected.'); |
127 | 127 | } |
128 | 128 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | // for federated shares the owner can be a remote user, in this |
158 | 158 | // case we use the initiator |
159 | - if($this->userManager->userExists($this->shareOwner)) { |
|
159 | + if ($this->userManager->userExists($this->shareOwner)) { |
|
160 | 160 | $userFolder = $this->rootFolder->getUserFolder($this->shareOwner); |
161 | 161 | } else { |
162 | 162 | $userFolder = $this->rootFolder->getUserFolder($this->sharedBy); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | $nodes = $userFolder->getById($this->fileId); |
166 | 166 | if (empty($nodes)) { |
167 | - throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId); |
|
167 | + throw new NotFoundException('Node for share not found, fileid: '.$this->fileId); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $this->node = $nodes[0]; |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | //use the admin login data for the new database user |
61 | 61 | |
62 | 62 | //add prefix to the postgresql user name to prevent collisions |
63 | - $this->dbUser = 'oc_' . strtolower($username); |
|
63 | + $this->dbUser = 'oc_'.strtolower($username); |
|
64 | 64 | //create a new password so we don't need to store the admin config in the config file |
65 | - $this->dbPassword = \OC::$server->getSecureRandom()->generate(30, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
65 | + $this->dbPassword = \OC::$server->getSecureRandom()->generate(30, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
66 | 66 | |
67 | 67 | $this->createDBUser($connection); |
68 | 68 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | //create the database |
76 | 76 | $this->createDatabase($connection); |
77 | 77 | $query = $connection->prepare("select count(*) FROM pg_class WHERE relname=? limit 1"); |
78 | - $query->execute([$this->tablePrefix . "users"]); |
|
78 | + $query->execute([$this->tablePrefix."users"]); |
|
79 | 79 | $tablesSetup = $query->fetchColumn() > 0; |
80 | 80 | |
81 | 81 | // the connection to dbname=postgres is not needed anymore |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | private function createDatabase(IDBConnection $connection) { |
112 | 112 | if (!$this->databaseExists($connection)) { |
113 | 113 | //The database does not exists... let's create it |
114 | - $query = $connection->prepare("CREATE DATABASE " . addslashes($this->dbName) . " OWNER " . addslashes($this->dbUser)); |
|
114 | + $query = $connection->prepare("CREATE DATABASE ".addslashes($this->dbName)." OWNER ".addslashes($this->dbUser)); |
|
115 | 115 | try { |
116 | 116 | $query->execute(); |
117 | 117 | } catch (DatabaseException $e) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $this->logger->logException($e); |
120 | 120 | } |
121 | 121 | } else { |
122 | - $query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE " . addslashes($this->dbName) . " FROM PUBLIC"); |
|
122 | + $query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE ".addslashes($this->dbName)." FROM PUBLIC"); |
|
123 | 123 | try { |
124 | 124 | $query->execute(); |
125 | 125 | } catch (DatabaseException $e) { |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | $i = 1; |
156 | 156 | while ($this->userExists($connection)) { |
157 | 157 | $i++; |
158 | - $this->dbUser = $dbUser . $i; |
|
158 | + $this->dbUser = $dbUser.$i; |
|
159 | 159 | }; |
160 | 160 | |
161 | 161 | // create the user |
162 | - $query = $connection->prepare("CREATE USER " . addslashes($this->dbUser) . " CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'"); |
|
162 | + $query = $connection->prepare("CREATE USER ".addslashes($this->dbUser)." CREATEDB PASSWORD '".addslashes($this->dbPassword)."'"); |
|
163 | 163 | $query->execute(); |
164 | 164 | } catch (DatabaseException $e) { |
165 | 165 | $this->logger->error('Error while trying to create database user'); |
@@ -68,14 +68,14 @@ |
||
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; |