@@ -39,7 +39,7 @@ |
||
39 | 39 | * @return \OC_DB_StatementWrapper prepared SQL query |
40 | 40 | * @since 7.0.0 |
41 | 41 | */ |
42 | - public function prepareQuery($sql, $limit=null, $offset=null); |
|
42 | + public function prepareQuery($sql, $limit = null, $offset = null); |
|
43 | 43 | |
44 | 44 | |
45 | 45 | /** |
@@ -42,11 +42,11 @@ |
||
42 | 42 | const METHOD_STREAM = 'stream'; |
43 | 43 | const METHOD_MAIL = 'email'; |
44 | 44 | |
45 | - const PRIORITY_VERYLOW = 10; |
|
46 | - const PRIORITY_LOW = 20; |
|
47 | - const PRIORITY_MEDIUM = 30; |
|
48 | - const PRIORITY_HIGH = 40; |
|
49 | - const PRIORITY_VERYHIGH = 50; |
|
45 | + const PRIORITY_VERYLOW = 10; |
|
46 | + const PRIORITY_LOW = 20; |
|
47 | + const PRIORITY_MEDIUM = 30; |
|
48 | + const PRIORITY_HIGH = 40; |
|
49 | + const PRIORITY_VERYHIGH = 50; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * The extension can return an array of additional notification types. |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * Remove "apps/" from inclusion path for smooth migration to mutli app dir |
99 | 99 | */ |
100 | 100 | if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) { |
101 | - \OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', \OCP\Util::DEBUG); |
|
101 | + \OCP\Util::writeLog('core', 'include path for class "'.$class.'" starts with "apps/"', \OCP\Util::DEBUG); |
|
102 | 102 | $paths[] = str_replace('apps/', '', \OC::$CLASSPATH[$class]); |
103 | 103 | } |
104 | 104 | } elseif (strpos($class, 'OC_') === 0) { |
105 | - $paths[] = \OC::$SERVERROOT . '/lib/private/legacy/' . strtolower(str_replace('_', '/', substr($class, 3)) . '.php'); |
|
106 | - $paths[] = \OC::$SERVERROOT . '/lib/private/' . strtolower(str_replace('_', '/', substr($class, 3)) . '.php'); |
|
105 | + $paths[] = \OC::$SERVERROOT.'/lib/private/legacy/'.strtolower(str_replace('_', '/', substr($class, 3)).'.php'); |
|
106 | + $paths[] = \OC::$SERVERROOT.'/lib/private/'.strtolower(str_replace('_', '/', substr($class, 3)).'.php'); |
|
107 | 107 | } elseif (strpos($class, 'OC\\') === 0) { |
108 | 108 | $split = explode('\\', $class, 3); |
109 | 109 | |
@@ -111,31 +111,31 @@ discard block |
||
111 | 111 | $split[1] = strtolower($split[1]); |
112 | 112 | |
113 | 113 | if ($split[1] === 'core') { |
114 | - $paths[] = \OC::$SERVERROOT . '/core/' . strtolower(str_replace('\\', '/', $split[2])) . '.php'; |
|
114 | + $paths[] = \OC::$SERVERROOT.'/core/'.strtolower(str_replace('\\', '/', $split[2])).'.php'; |
|
115 | 115 | } else if ($split[1] === 'settings') { |
116 | - $paths[] = \OC::$SERVERROOT . '/settings/' . strtolower(str_replace('\\', '/', $split[2])) . '.php'; |
|
116 | + $paths[] = \OC::$SERVERROOT.'/settings/'.strtolower(str_replace('\\', '/', $split[2])).'.php'; |
|
117 | 117 | } else { |
118 | - $paths[] = \OC::$SERVERROOT . '/lib/private/' . $split[1] . '/' . strtolower(str_replace('\\', '/', $split[2])) . '.php'; |
|
118 | + $paths[] = \OC::$SERVERROOT.'/lib/private/'.$split[1].'/'.strtolower(str_replace('\\', '/', $split[2])).'.php'; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | } else { |
122 | - $paths[] = \OC::$SERVERROOT . '/lib/private/' . strtolower(str_replace('\\', '/', $split[1])) . '.php'; |
|
122 | + $paths[] = \OC::$SERVERROOT.'/lib/private/'.strtolower(str_replace('\\', '/', $split[1])).'.php'; |
|
123 | 123 | } |
124 | 124 | } elseif (strpos($class, 'OCP\\') === 0) { |
125 | - $paths[] = \OC::$SERVERROOT . '/lib/public/' . strtolower(str_replace('\\', '/', substr($class, 4)) . '.php'); |
|
125 | + $paths[] = \OC::$SERVERROOT.'/lib/public/'.strtolower(str_replace('\\', '/', substr($class, 4)).'.php'); |
|
126 | 126 | } elseif (strpos($class, 'OCA\\') === 0) { |
127 | 127 | list(, $app, $rest) = explode('\\', $class, 3); |
128 | 128 | $app = strtolower($app); |
129 | 129 | $appPath = \OC_App::getAppPath($app); |
130 | 130 | if ($appPath && stream_resolve_include_path($appPath)) { |
131 | - $paths[] = $appPath . '/' . strtolower(str_replace('\\', '/', $rest) . '.php'); |
|
131 | + $paths[] = $appPath.'/'.strtolower(str_replace('\\', '/', $rest).'.php'); |
|
132 | 132 | // If not found in the root of the app directory, insert '/lib' after app id and try again. |
133 | - $paths[] = $appPath . '/lib/' . strtolower(str_replace('\\', '/', $rest) . '.php'); |
|
133 | + $paths[] = $appPath.'/lib/'.strtolower(str_replace('\\', '/', $rest).'.php'); |
|
134 | 134 | } |
135 | 135 | } elseif (strpos($class, 'Test_') === 0) { |
136 | - $paths[] = \OC::$SERVERROOT . '/tests/lib/' . strtolower(str_replace('_', '/', substr($class, 5)) . '.php'); |
|
136 | + $paths[] = \OC::$SERVERROOT.'/tests/lib/'.strtolower(str_replace('_', '/', substr($class, 5)).'.php'); |
|
137 | 137 | } elseif (strpos($class, 'Test\\') === 0) { |
138 | - $paths[] = \OC::$SERVERROOT . '/tests/lib/' . strtolower(str_replace('\\', '/', substr($class, 5)) . '.php'); |
|
138 | + $paths[] = \OC::$SERVERROOT.'/tests/lib/'.strtolower(str_replace('\\', '/', substr($class, 5)).'.php'); |
|
139 | 139 | } |
140 | 140 | return $paths; |
141 | 141 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | protected function isValidPath($fullPath) { |
148 | 148 | foreach ($this->validRoots as $root => $true) { |
149 | - if (substr($fullPath, 0, strlen($root) + 1) === $root . '/') { |
|
149 | + if (substr($fullPath, 0, strlen($root) + 1) === $root.'/') { |
|
150 | 150 | return true; |
151 | 151 | } |
152 | 152 | } |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | * |
29 | 29 | */ |
30 | 30 | |
31 | -class OC_Archive_ZIP extends OC_Archive{ |
|
31 | +class OC_Archive_ZIP extends OC_Archive { |
|
32 | 32 | /** |
33 | 33 | * @var ZipArchive zip |
34 | 34 | */ |
35 | - private $zip=null; |
|
35 | + private $zip = null; |
|
36 | 36 | private $path; |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @param string $source |
40 | 40 | */ |
41 | 41 | function __construct($source) { |
42 | - $this->path=$source; |
|
43 | - $this->zip=new ZipArchive(); |
|
44 | - if($this->zip->open($source, ZipArchive::CREATE)) { |
|
45 | - }else{ |
|
42 | + $this->path = $source; |
|
43 | + $this->zip = new ZipArchive(); |
|
44 | + if ($this->zip->open($source, ZipArchive::CREATE)) { |
|
45 | + } else { |
|
46 | 46 | OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, OCP\Util::WARN); |
47 | 47 | } |
48 | 48 | } |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | * @param string $source either a local file or string data |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | - function addFile($path, $source='') { |
|
64 | - if($source and $source[0]=='/' and file_exists($source)) { |
|
65 | - $result=$this->zip->addFile($source, $path); |
|
66 | - }else{ |
|
67 | - $result=$this->zip->addFromString($path, $source); |
|
63 | + function addFile($path, $source = '') { |
|
64 | + if ($source and $source[0] == '/' and file_exists($source)) { |
|
65 | + $result = $this->zip->addFile($source, $path); |
|
66 | + } else { |
|
67 | + $result = $this->zip->addFromString($path, $source); |
|
68 | 68 | } |
69 | - if($result) { |
|
70 | - $this->zip->close();//close and reopen to save the zip |
|
69 | + if ($result) { |
|
70 | + $this->zip->close(); //close and reopen to save the zip |
|
71 | 71 | $this->zip->open($this->path); |
72 | 72 | } |
73 | 73 | return $result; |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * @return boolean|null |
80 | 80 | */ |
81 | 81 | function rename($source, $dest) { |
82 | - $source=$this->stripPath($source); |
|
83 | - $dest=$this->stripPath($dest); |
|
82 | + $source = $this->stripPath($source); |
|
83 | + $dest = $this->stripPath($dest); |
|
84 | 84 | $this->zip->renameName($source, $dest); |
85 | 85 | } |
86 | 86 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return int |
90 | 90 | */ |
91 | 91 | function filesize($path) { |
92 | - $stat=$this->zip->statName($path); |
|
92 | + $stat = $this->zip->statName($path); |
|
93 | 93 | return $stat['size']; |
94 | 94 | } |
95 | 95 | /** |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @return array |
107 | 107 | */ |
108 | 108 | function getFolder($path) { |
109 | - $files=$this->getFiles(); |
|
110 | - $folderContent=array(); |
|
111 | - $pathLength=strlen($path); |
|
112 | - foreach($files as $file) { |
|
113 | - if(substr($file, 0, $pathLength)==$path and $file!=$path) { |
|
114 | - if(strrpos(substr($file, 0, -1), '/')<=$pathLength) { |
|
115 | - $folderContent[]=substr($file, $pathLength); |
|
109 | + $files = $this->getFiles(); |
|
110 | + $folderContent = array(); |
|
111 | + $pathLength = strlen($path); |
|
112 | + foreach ($files as $file) { |
|
113 | + if (substr($file, 0, $pathLength) == $path and $file != $path) { |
|
114 | + if (strrpos(substr($file, 0, -1), '/') <= $pathLength) { |
|
115 | + $folderContent[] = substr($file, $pathLength); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | * @return array |
124 | 124 | */ |
125 | 125 | function getFiles() { |
126 | - $fileCount=$this->zip->numFiles; |
|
127 | - $files=array(); |
|
128 | - for($i=0;$i<$fileCount;$i++) { |
|
129 | - $files[]=$this->zip->getNameIndex($i); |
|
126 | + $fileCount = $this->zip->numFiles; |
|
127 | + $files = array(); |
|
128 | + for ($i = 0; $i < $fileCount; $i++) { |
|
129 | + $files[] = $this->zip->getNameIndex($i); |
|
130 | 130 | } |
131 | 131 | return $files; |
132 | 132 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @return bool |
163 | 163 | */ |
164 | 164 | function fileExists($path) { |
165 | - return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false); |
|
165 | + return ($this->zip->locateName($path) !== false) or ($this->zip->locateName($path.'/') !== false); |
|
166 | 166 | } |
167 | 167 | /** |
168 | 168 | * remove a file or folder from the archive |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | * @return bool |
171 | 171 | */ |
172 | 172 | function remove($path) { |
173 | - if($this->fileExists($path.'/')) { |
|
173 | + if ($this->fileExists($path.'/')) { |
|
174 | 174 | return $this->zip->deleteName($path.'/'); |
175 | - }else{ |
|
175 | + } else { |
|
176 | 176 | return $this->zip->deleteName($path); |
177 | 177 | } |
178 | 178 | } |
@@ -183,33 +183,33 @@ discard block |
||
183 | 183 | * @return resource |
184 | 184 | */ |
185 | 185 | function getStream($path, $mode) { |
186 | - if($mode=='r' or $mode=='rb') { |
|
186 | + if ($mode == 'r' or $mode == 'rb') { |
|
187 | 187 | return $this->zip->getStream($path); |
188 | 188 | } else { |
189 | 189 | //since we cant directly get a writable stream, |
190 | 190 | //make a temp copy of the file and put it back |
191 | 191 | //in the archive when the stream is closed |
192 | - if(strrpos($path, '.')!==false) { |
|
193 | - $ext=substr($path, strrpos($path, '.')); |
|
194 | - }else{ |
|
195 | - $ext=''; |
|
192 | + if (strrpos($path, '.') !== false) { |
|
193 | + $ext = substr($path, strrpos($path, '.')); |
|
194 | + } else { |
|
195 | + $ext = ''; |
|
196 | 196 | } |
197 | - $tmpFile=OCP\Files::tmpFile($ext); |
|
197 | + $tmpFile = OCP\Files::tmpFile($ext); |
|
198 | 198 | \OC\Files\Stream\Close::registerCallback($tmpFile, array($this, 'writeBack')); |
199 | - if($this->fileExists($path)) { |
|
199 | + if ($this->fileExists($path)) { |
|
200 | 200 | $this->extractFile($path, $tmpFile); |
201 | 201 | } |
202 | - self::$tempFiles[$tmpFile]=$path; |
|
202 | + self::$tempFiles[$tmpFile] = $path; |
|
203 | 203 | return fopen('close://'.$tmpFile, $mode); |
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | - private static $tempFiles=array(); |
|
207 | + private static $tempFiles = array(); |
|
208 | 208 | /** |
209 | 209 | * write back temporary files |
210 | 210 | */ |
211 | 211 | function writeBack($tmpFile) { |
212 | - if(isset(self::$tempFiles[$tmpFile])) { |
|
212 | + if (isset(self::$tempFiles[$tmpFile])) { |
|
213 | 213 | $this->addFile(self::$tempFiles[$tmpFile], $tmpFile); |
214 | 214 | unlink($tmpFile); |
215 | 215 | } |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | * @return string |
221 | 221 | */ |
222 | 222 | private function stripPath($path) { |
223 | - if(!$path || $path[0]=='/') { |
|
223 | + if (!$path || $path[0] == '/') { |
|
224 | 224 | return substr($path, 1); |
225 | - }else{ |
|
225 | + } else { |
|
226 | 226 | return $path; |
227 | 227 | } |
228 | 228 | } |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | $parts = explode('/', $path); |
98 | 98 | $folder = $tmpBase; |
99 | 99 | foreach ($parts as $part) { |
100 | - $folder .= '/' . $part; |
|
100 | + $folder .= '/'.$part; |
|
101 | 101 | if (!is_dir($folder)) { |
102 | 102 | mkdir($folder); |
103 | 103 | } |
104 | 104 | } |
105 | - $result = $this->tar->addModify(array($tmpBase . $path), '', $tmpBase); |
|
106 | - rmdir($tmpBase . $path); |
|
105 | + $result = $this->tar->addModify(array($tmpBase.$path), '', $tmpBase); |
|
106 | + rmdir($tmpBase.$path); |
|
107 | 107 | $this->fileList = false; |
108 | 108 | $this->cachedHeaders = false; |
109 | 109 | return $result; |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | //no proper way to delete, rename entire archive, rename file and remake archive |
141 | 141 | $tmp = OCP\Files::tmpFolder(); |
142 | 142 | $this->tar->extract($tmp); |
143 | - rename($tmp . $source, $tmp . $dest); |
|
143 | + rename($tmp.$source, $tmp.$dest); |
|
144 | 144 | $this->tar = null; |
145 | 145 | unlink($this->path); |
146 | 146 | $types = array(null, 'gz', 'bz'); |
147 | 147 | $this->tar = new Archive_Tar($this->path, $types[self::getTarType($this->path)]); |
148 | - $this->tar->createModify(array($tmp), '', $tmp . '/'); |
|
148 | + $this->tar->createModify(array($tmp), '', $tmp.'/'); |
|
149 | 149 | $this->fileList = false; |
150 | 150 | $this->cachedHeaders = false; |
151 | 151 | return true; |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | } |
161 | 161 | foreach ($this->cachedHeaders as $header) { |
162 | 162 | if ($file == $header['filename'] |
163 | - or $file . '/' == $header['filename'] |
|
164 | - or '/' . $file . '/' == $header['filename'] |
|
165 | - or '/' . $file == $header['filename'] |
|
163 | + or $file.'/' == $header['filename'] |
|
164 | + or '/'.$file.'/' == $header['filename'] |
|
165 | + or '/'.$file == $header['filename'] |
|
166 | 166 | ) { |
167 | 167 | return $header; |
168 | 168 | } |
@@ -261,13 +261,13 @@ discard block |
||
261 | 261 | if (!$this->fileExists($path)) { |
262 | 262 | return false; |
263 | 263 | } |
264 | - if ($this->fileExists('/' . $path)) { |
|
265 | - $success = $this->tar->extractList(array('/' . $path), $tmp); |
|
264 | + if ($this->fileExists('/'.$path)) { |
|
265 | + $success = $this->tar->extractList(array('/'.$path), $tmp); |
|
266 | 266 | } else { |
267 | 267 | $success = $this->tar->extractList(array($path), $tmp); |
268 | 268 | } |
269 | 269 | if ($success) { |
270 | - rename($tmp . $path, $dest); |
|
270 | + rename($tmp.$path, $dest); |
|
271 | 271 | } |
272 | 272 | OCP\Files::rmdirr($tmp); |
273 | 273 | return $success; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | */ |
292 | 292 | function fileExists($path) { |
293 | 293 | $files = $this->getFiles(); |
294 | - if ((array_search($path, $files) !== false) or (array_search($path . '/', $files) !== false)) { |
|
294 | + if ((array_search($path, $files) !== false) or (array_search($path.'/', $files) !== false)) { |
|
295 | 295 | return true; |
296 | 296 | } else { |
297 | 297 | $folderPath = $path; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | } |
307 | 307 | } |
308 | 308 | if ($path[0] != '/') { //not all programs agree on the use of a leading / |
309 | - return $this->fileExists('/' . $path); |
|
309 | + return $this->fileExists('/'.$path); |
|
310 | 310 | } else { |
311 | 311 | return false; |
312 | 312 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | //no proper way to delete, extract entire archive, delete file and remake archive |
328 | 328 | $tmp = OCP\Files::tmpFolder(); |
329 | 329 | $this->tar->extract($tmp); |
330 | - OCP\Files::rmdirr($tmp . $path); |
|
330 | + OCP\Files::rmdirr($tmp.$path); |
|
331 | 331 | $this->tar = null; |
332 | 332 | unlink($this->path); |
333 | 333 | $this->reopen(); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | } else { |
360 | 360 | \OC\Files\Stream\Close::registerCallback($tmpFile, array($this, 'writeBack')); |
361 | 361 | self::$tempFiles[$tmpFile] = $path; |
362 | - return fopen('close://' . $tmpFile, $mode); |
|
362 | + return fopen('close://'.$tmpFile, $mode); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @link https://github.com/owncloud/core/issues/21955 |
130 | 130 | */ |
131 | - if($this->config->getSystemValue('installed', false)) { |
|
132 | - $userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null; |
|
133 | - if(!is_null($userId)) { |
|
131 | + if ($this->config->getSystemValue('installed', false)) { |
|
132 | + $userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null; |
|
133 | + if (!is_null($userId)) { |
|
134 | 134 | $userLang = $this->config->getUserValue($userId, 'core', 'lang', null); |
135 | 135 | } else { |
136 | 136 | $userLang = null; |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | // merge with translations from theme |
195 | 195 | $theme = $this->config->getSystemValue('theme'); |
196 | 196 | if (!empty($theme)) { |
197 | - $themeDir = $this->serverRoot . '/themes/' . $theme . substr($dir, strlen($this->serverRoot)); |
|
197 | + $themeDir = $this->serverRoot.'/themes/'.$theme.substr($dir, strlen($this->serverRoot)); |
|
198 | 198 | |
199 | 199 | if (is_dir($themeDir)) { |
200 | 200 | $files = scandir($themeDir); |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | $languageFiles = []; |
284 | 284 | |
285 | 285 | $i18nDir = $this->findL10nDir($app); |
286 | - $transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json'; |
|
286 | + $transFile = strip_tags($i18nDir).strip_tags($lang).'.json'; |
|
287 | 287 | |
288 | - if ((\OC_Helper::isSubDirectory($transFile, $this->serverRoot . '/core/l10n/') |
|
289 | - || \OC_Helper::isSubDirectory($transFile, $this->serverRoot . '/lib/l10n/') |
|
290 | - || \OC_Helper::isSubDirectory($transFile, $this->serverRoot . '/settings/l10n/') |
|
291 | - || \OC_Helper::isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/') |
|
288 | + if ((\OC_Helper::isSubDirectory($transFile, $this->serverRoot.'/core/l10n/') |
|
289 | + || \OC_Helper::isSubDirectory($transFile, $this->serverRoot.'/lib/l10n/') |
|
290 | + || \OC_Helper::isSubDirectory($transFile, $this->serverRoot.'/settings/l10n/') |
|
291 | + || \OC_Helper::isSubDirectory($transFile, \OC_App::getAppPath($app).'/l10n/') |
|
292 | 292 | ) |
293 | 293 | && file_exists($transFile)) { |
294 | 294 | // load the translations file |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | // merge with translations from theme |
299 | 299 | $theme = $this->config->getSystemValue('theme'); |
300 | 300 | if (!empty($theme)) { |
301 | - $transFile = $this->serverRoot . '/themes/' . $theme . substr($transFile, strlen($this->serverRoot)); |
|
301 | + $transFile = $this->serverRoot.'/themes/'.$theme.substr($transFile, strlen($this->serverRoot)); |
|
302 | 302 | if (file_exists($transFile)) { |
303 | 303 | $languageFiles[] = $transFile; |
304 | 304 | } |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | */ |
316 | 316 | protected function findL10nDir($app = null) { |
317 | 317 | if (in_array($app, ['core', 'lib', 'settings'])) { |
318 | - if (file_exists($this->serverRoot . '/' . $app . '/l10n/')) { |
|
319 | - return $this->serverRoot . '/' . $app . '/l10n/'; |
|
318 | + if (file_exists($this->serverRoot.'/'.$app.'/l10n/')) { |
|
319 | + return $this->serverRoot.'/'.$app.'/l10n/'; |
|
320 | 320 | } |
321 | 321 | } else if ($app && \OC_App::getAppPath($app) !== false) { |
322 | 322 | // Check if the app is in the app folder |
323 | - return \OC_App::getAppPath($app) . '/l10n/'; |
|
323 | + return \OC_App::getAppPath($app).'/l10n/'; |
|
324 | 324 | } |
325 | - return $this->serverRoot . '/core/l10n/'; |
|
325 | + return $this->serverRoot.'/core/l10n/'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | |
@@ -339,15 +339,15 @@ discard block |
||
339 | 339 | return $this->pluralFunctions[$string]; |
340 | 340 | } |
341 | 341 | |
342 | - if (preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { |
|
342 | + if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { |
|
343 | 343 | // sanitize |
344 | - $nplurals = preg_replace( '/[^0-9]/', '', $matches[1] ); |
|
345 | - $plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] ); |
|
344 | + $nplurals = preg_replace('/[^0-9]/', '', $matches[1]); |
|
345 | + $plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]); |
|
346 | 346 | |
347 | 347 | $body = str_replace( |
348 | - array( 'plural', 'n', '$n$plurals', ), |
|
349 | - array( '$plural', '$n', '$nplurals', ), |
|
350 | - 'nplurals='. $nplurals . '; plural=' . $plural |
|
348 | + array('plural', 'n', '$n$plurals',), |
|
349 | + array('$plural', '$n', '$nplurals',), |
|
350 | + 'nplurals='.$nplurals.'; plural='.$plural |
|
351 | 351 | ); |
352 | 352 | |
353 | 353 | // add parents |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | $body .= ';'; |
356 | 356 | $res = ''; |
357 | 357 | $p = 0; |
358 | - for($i = 0; $i < strlen($body); $i++) { |
|
358 | + for ($i = 0; $i < strlen($body); $i++) { |
|
359 | 359 | $ch = $body[$i]; |
360 | - switch ( $ch ) { |
|
360 | + switch ($ch) { |
|
361 | 361 | case '?': |
362 | 362 | $res .= ' ? ('; |
363 | 363 | $p++; |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $res .= ') : ('; |
367 | 367 | break; |
368 | 368 | case ';': |
369 | - $res .= str_repeat( ')', $p ) . ';'; |
|
369 | + $res .= str_repeat(')', $p).';'; |
|
370 | 370 | $p = 0; |
371 | 371 | break; |
372 | 372 | default: |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | - $body = $res . 'return ($plural>=$nplurals?$nplurals-1:$plural);'; |
|
377 | + $body = $res.'return ($plural>=$nplurals?$nplurals-1:$plural);'; |
|
378 | 378 | $function = create_function('$n', $body); |
379 | 379 | $this->pluralFunctions[$string] = $function; |
380 | 380 | return $function; |
@@ -56,13 +56,13 @@ |
||
56 | 56 | $translations = $this->l10n->getTranslations(); |
57 | 57 | |
58 | 58 | $text = $this->text; |
59 | - if(array_key_exists($this->text, $translations)) { |
|
60 | - if(is_array($translations[$this->text])) { |
|
59 | + if (array_key_exists($this->text, $translations)) { |
|
60 | + if (is_array($translations[$this->text])) { |
|
61 | 61 | $fn = $this->l10n->getPluralFormFunction(); |
62 | 62 | $id = $fn($this->count); |
63 | 63 | $text = $translations[$this->text][$id]; |
64 | 64 | } |
65 | - else{ |
|
65 | + else { |
|
66 | 66 | $text = $translations[$this->text]; |
67 | 67 | } |
68 | 68 | } |
@@ -131,7 +131,7 @@ |
||
131 | 131 | } |
132 | 132 | $query = $this->connection->prepare('SELECT `lock` from `*PREFIX*file_locks` WHERE `key` = ?'); |
133 | 133 | $query->execute([$path]); |
134 | - $lockValue = (int)$query->fetchColumn(); |
|
134 | + $lockValue = (int) $query->fetchColumn(); |
|
135 | 135 | if ($type === self::LOCK_SHARED) { |
136 | 136 | if ($this->isLocallyLocked($path)) { |
137 | 137 | // if we have a shared lock we kept open locally but it's released we always have at least 1 shared lock in the db |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @return string|null Either the value or null |
98 | 98 | */ |
99 | 99 | public function get($key) { |
100 | - if(isset($this->sessionValues[$key])) { |
|
100 | + if (isset($this->sessionValues[$key])) { |
|
101 | 101 | return $this->sessionValues[$key]; |
102 | 102 | } |
103 | 103 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * Close the session and release the lock, also writes all changed data in batch |
160 | 160 | */ |
161 | 161 | public function close() { |
162 | - if($this->isModified) { |
|
162 | + if ($this->isModified) { |
|
163 | 163 | $encryptedValue = $this->crypto->encrypt(json_encode($this->sessionValues), $this->passphrase); |
164 | 164 | $this->session->set(self::encryptedSessionName, $encryptedValue); |
165 | 165 | $this->isModified = false; |