@@ -6,54 +6,54 @@ |
||
6 | 6 | |
7 | 7 | class ComposerStaticInitFiles |
8 | 8 | { |
9 | - public static $prefixLengthsPsr4 = array ( |
|
9 | + public static $prefixLengthsPsr4 = array( |
|
10 | 10 | 'O' => |
11 | - array ( |
|
11 | + array( |
|
12 | 12 | 'OCA\\Files\\' => 10, |
13 | 13 | ), |
14 | 14 | ); |
15 | 15 | |
16 | - public static $prefixDirsPsr4 = array ( |
|
16 | + public static $prefixDirsPsr4 = array( |
|
17 | 17 | 'OCA\\Files\\' => |
18 | - array ( |
|
19 | - 0 => __DIR__ . '/..' . '/../lib', |
|
18 | + array( |
|
19 | + 0 => __DIR__.'/..'.'/../lib', |
|
20 | 20 | ), |
21 | 21 | ); |
22 | 22 | |
23 | - public static $classMap = array ( |
|
24 | - 'OCA\\Files\\Activity\\FavoriteProvider' => __DIR__ . '/..' . '/../lib/Activity/FavoriteProvider.php', |
|
25 | - 'OCA\\Files\\Activity\\Filter\\Favorites' => __DIR__ . '/..' . '/../lib/Activity/Filter/Favorites.php', |
|
26 | - 'OCA\\Files\\Activity\\Filter\\FileChanges' => __DIR__ . '/..' . '/../lib/Activity/Filter/FileChanges.php', |
|
27 | - 'OCA\\Files\\Activity\\Helper' => __DIR__ . '/..' . '/../lib/Activity/Helper.php', |
|
28 | - 'OCA\\Files\\Activity\\Provider' => __DIR__ . '/..' . '/../lib/Activity/Provider.php', |
|
29 | - 'OCA\\Files\\Activity\\Settings\\FavoriteAction' => __DIR__ . '/..' . '/../lib/Activity/Settings/FavoriteAction.php', |
|
30 | - 'OCA\\Files\\Activity\\Settings\\FileChanged' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileChanged.php', |
|
31 | - 'OCA\\Files\\Activity\\Settings\\FileCreated' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileCreated.php', |
|
32 | - 'OCA\\Files\\Activity\\Settings\\FileDeleted' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileDeleted.php', |
|
33 | - 'OCA\\Files\\Activity\\Settings\\FileFavorite' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileFavorite.php', |
|
34 | - 'OCA\\Files\\Activity\\Settings\\FileRestored' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileRestored.php', |
|
35 | - 'OCA\\Files\\App' => __DIR__ . '/..' . '/../lib/App.php', |
|
36 | - 'OCA\\Files\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', |
|
37 | - 'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupFileLocks.php', |
|
38 | - 'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => __DIR__ . '/..' . '/../lib/BackgroundJob/DeleteOrphanedItems.php', |
|
39 | - 'OCA\\Files\\BackgroundJob\\ScanFiles' => __DIR__ . '/..' . '/../lib/BackgroundJob/ScanFiles.php', |
|
40 | - 'OCA\\Files\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php', |
|
41 | - 'OCA\\Files\\Collaboration\\Resources\\Listener' => __DIR__ . '/..' . '/../lib/Collaboration/Resources/Listener.php', |
|
42 | - 'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => __DIR__ . '/..' . '/../lib/Collaboration/Resources/ResourceProvider.php', |
|
43 | - 'OCA\\Files\\Command\\DeleteOrphanedFiles' => __DIR__ . '/..' . '/../lib/Command/DeleteOrphanedFiles.php', |
|
44 | - 'OCA\\Files\\Command\\Scan' => __DIR__ . '/..' . '/../lib/Command/Scan.php', |
|
45 | - 'OCA\\Files\\Command\\ScanAppData' => __DIR__ . '/..' . '/../lib/Command/ScanAppData.php', |
|
46 | - 'OCA\\Files\\Command\\TransferOwnership' => __DIR__ . '/..' . '/../lib/Command/TransferOwnership.php', |
|
47 | - 'OCA\\Files\\Controller\\AjaxController' => __DIR__ . '/..' . '/../lib/Controller/AjaxController.php', |
|
48 | - 'OCA\\Files\\Controller\\ApiController' => __DIR__ . '/..' . '/../lib/Controller/ApiController.php', |
|
49 | - 'OCA\\Files\\Controller\\ViewController' => __DIR__ . '/..' . '/../lib/Controller/ViewController.php', |
|
50 | - 'OCA\\Files\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php', |
|
51 | - 'OCA\\Files\\Service\\TagService' => __DIR__ . '/..' . '/../lib/Service/TagService.php', |
|
23 | + public static $classMap = array( |
|
24 | + 'OCA\\Files\\Activity\\FavoriteProvider' => __DIR__.'/..'.'/../lib/Activity/FavoriteProvider.php', |
|
25 | + 'OCA\\Files\\Activity\\Filter\\Favorites' => __DIR__.'/..'.'/../lib/Activity/Filter/Favorites.php', |
|
26 | + 'OCA\\Files\\Activity\\Filter\\FileChanges' => __DIR__.'/..'.'/../lib/Activity/Filter/FileChanges.php', |
|
27 | + 'OCA\\Files\\Activity\\Helper' => __DIR__.'/..'.'/../lib/Activity/Helper.php', |
|
28 | + 'OCA\\Files\\Activity\\Provider' => __DIR__.'/..'.'/../lib/Activity/Provider.php', |
|
29 | + 'OCA\\Files\\Activity\\Settings\\FavoriteAction' => __DIR__.'/..'.'/../lib/Activity/Settings/FavoriteAction.php', |
|
30 | + 'OCA\\Files\\Activity\\Settings\\FileChanged' => __DIR__.'/..'.'/../lib/Activity/Settings/FileChanged.php', |
|
31 | + 'OCA\\Files\\Activity\\Settings\\FileCreated' => __DIR__.'/..'.'/../lib/Activity/Settings/FileCreated.php', |
|
32 | + 'OCA\\Files\\Activity\\Settings\\FileDeleted' => __DIR__.'/..'.'/../lib/Activity/Settings/FileDeleted.php', |
|
33 | + 'OCA\\Files\\Activity\\Settings\\FileFavorite' => __DIR__.'/..'.'/../lib/Activity/Settings/FileFavorite.php', |
|
34 | + 'OCA\\Files\\Activity\\Settings\\FileRestored' => __DIR__.'/..'.'/../lib/Activity/Settings/FileRestored.php', |
|
35 | + 'OCA\\Files\\App' => __DIR__.'/..'.'/../lib/App.php', |
|
36 | + 'OCA\\Files\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php', |
|
37 | + 'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupFileLocks.php', |
|
38 | + 'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => __DIR__.'/..'.'/../lib/BackgroundJob/DeleteOrphanedItems.php', |
|
39 | + 'OCA\\Files\\BackgroundJob\\ScanFiles' => __DIR__.'/..'.'/../lib/BackgroundJob/ScanFiles.php', |
|
40 | + 'OCA\\Files\\Capabilities' => __DIR__.'/..'.'/../lib/Capabilities.php', |
|
41 | + 'OCA\\Files\\Collaboration\\Resources\\Listener' => __DIR__.'/..'.'/../lib/Collaboration/Resources/Listener.php', |
|
42 | + 'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => __DIR__.'/..'.'/../lib/Collaboration/Resources/ResourceProvider.php', |
|
43 | + 'OCA\\Files\\Command\\DeleteOrphanedFiles' => __DIR__.'/..'.'/../lib/Command/DeleteOrphanedFiles.php', |
|
44 | + 'OCA\\Files\\Command\\Scan' => __DIR__.'/..'.'/../lib/Command/Scan.php', |
|
45 | + 'OCA\\Files\\Command\\ScanAppData' => __DIR__.'/..'.'/../lib/Command/ScanAppData.php', |
|
46 | + 'OCA\\Files\\Command\\TransferOwnership' => __DIR__.'/..'.'/../lib/Command/TransferOwnership.php', |
|
47 | + 'OCA\\Files\\Controller\\AjaxController' => __DIR__.'/..'.'/../lib/Controller/AjaxController.php', |
|
48 | + 'OCA\\Files\\Controller\\ApiController' => __DIR__.'/..'.'/../lib/Controller/ApiController.php', |
|
49 | + 'OCA\\Files\\Controller\\ViewController' => __DIR__.'/..'.'/../lib/Controller/ViewController.php', |
|
50 | + 'OCA\\Files\\Helper' => __DIR__.'/..'.'/../lib/Helper.php', |
|
51 | + 'OCA\\Files\\Service\\TagService' => __DIR__.'/..'.'/../lib/Service/TagService.php', |
|
52 | 52 | ); |
53 | 53 | |
54 | 54 | public static function getInitializer(ClassLoader $loader) |
55 | 55 | { |
56 | - return \Closure::bind(function () use ($loader) { |
|
56 | + return \Closure::bind(function() use ($loader) { |
|
57 | 57 | $loader->prefixLengthsPsr4 = ComposerStaticInitFiles::$prefixLengthsPsr4; |
58 | 58 | $loader->prefixDirsPsr4 = ComposerStaticInitFiles::$prefixDirsPsr4; |
59 | 59 | $loader->classMap = ComposerStaticInitFiles::$classMap; |
@@ -6,32 +6,32 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'OCA\\Files\\Activity\\FavoriteProvider' => $baseDir . '/../lib/Activity/FavoriteProvider.php', |
|
10 | - 'OCA\\Files\\Activity\\Filter\\Favorites' => $baseDir . '/../lib/Activity/Filter/Favorites.php', |
|
11 | - 'OCA\\Files\\Activity\\Filter\\FileChanges' => $baseDir . '/../lib/Activity/Filter/FileChanges.php', |
|
12 | - 'OCA\\Files\\Activity\\Helper' => $baseDir . '/../lib/Activity/Helper.php', |
|
13 | - 'OCA\\Files\\Activity\\Provider' => $baseDir . '/../lib/Activity/Provider.php', |
|
14 | - 'OCA\\Files\\Activity\\Settings\\FavoriteAction' => $baseDir . '/../lib/Activity/Settings/FavoriteAction.php', |
|
15 | - 'OCA\\Files\\Activity\\Settings\\FileChanged' => $baseDir . '/../lib/Activity/Settings/FileChanged.php', |
|
16 | - 'OCA\\Files\\Activity\\Settings\\FileCreated' => $baseDir . '/../lib/Activity/Settings/FileCreated.php', |
|
17 | - 'OCA\\Files\\Activity\\Settings\\FileDeleted' => $baseDir . '/../lib/Activity/Settings/FileDeleted.php', |
|
18 | - 'OCA\\Files\\Activity\\Settings\\FileFavorite' => $baseDir . '/../lib/Activity/Settings/FileFavorite.php', |
|
19 | - 'OCA\\Files\\Activity\\Settings\\FileRestored' => $baseDir . '/../lib/Activity/Settings/FileRestored.php', |
|
20 | - 'OCA\\Files\\App' => $baseDir . '/../lib/App.php', |
|
21 | - 'OCA\\Files\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', |
|
22 | - 'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => $baseDir . '/../lib/BackgroundJob/CleanupFileLocks.php', |
|
23 | - 'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => $baseDir . '/../lib/BackgroundJob/DeleteOrphanedItems.php', |
|
24 | - 'OCA\\Files\\BackgroundJob\\ScanFiles' => $baseDir . '/../lib/BackgroundJob/ScanFiles.php', |
|
25 | - 'OCA\\Files\\Capabilities' => $baseDir . '/../lib/Capabilities.php', |
|
26 | - 'OCA\\Files\\Collaboration\\Resources\\Listener' => $baseDir . '/../lib/Collaboration/Resources/Listener.php', |
|
27 | - 'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => $baseDir . '/../lib/Collaboration/Resources/ResourceProvider.php', |
|
28 | - 'OCA\\Files\\Command\\DeleteOrphanedFiles' => $baseDir . '/../lib/Command/DeleteOrphanedFiles.php', |
|
29 | - 'OCA\\Files\\Command\\Scan' => $baseDir . '/../lib/Command/Scan.php', |
|
30 | - 'OCA\\Files\\Command\\ScanAppData' => $baseDir . '/../lib/Command/ScanAppData.php', |
|
31 | - 'OCA\\Files\\Command\\TransferOwnership' => $baseDir . '/../lib/Command/TransferOwnership.php', |
|
32 | - 'OCA\\Files\\Controller\\AjaxController' => $baseDir . '/../lib/Controller/AjaxController.php', |
|
33 | - 'OCA\\Files\\Controller\\ApiController' => $baseDir . '/../lib/Controller/ApiController.php', |
|
34 | - 'OCA\\Files\\Controller\\ViewController' => $baseDir . '/../lib/Controller/ViewController.php', |
|
35 | - 'OCA\\Files\\Helper' => $baseDir . '/../lib/Helper.php', |
|
36 | - 'OCA\\Files\\Service\\TagService' => $baseDir . '/../lib/Service/TagService.php', |
|
9 | + 'OCA\\Files\\Activity\\FavoriteProvider' => $baseDir.'/../lib/Activity/FavoriteProvider.php', |
|
10 | + 'OCA\\Files\\Activity\\Filter\\Favorites' => $baseDir.'/../lib/Activity/Filter/Favorites.php', |
|
11 | + 'OCA\\Files\\Activity\\Filter\\FileChanges' => $baseDir.'/../lib/Activity/Filter/FileChanges.php', |
|
12 | + 'OCA\\Files\\Activity\\Helper' => $baseDir.'/../lib/Activity/Helper.php', |
|
13 | + 'OCA\\Files\\Activity\\Provider' => $baseDir.'/../lib/Activity/Provider.php', |
|
14 | + 'OCA\\Files\\Activity\\Settings\\FavoriteAction' => $baseDir.'/../lib/Activity/Settings/FavoriteAction.php', |
|
15 | + 'OCA\\Files\\Activity\\Settings\\FileChanged' => $baseDir.'/../lib/Activity/Settings/FileChanged.php', |
|
16 | + 'OCA\\Files\\Activity\\Settings\\FileCreated' => $baseDir.'/../lib/Activity/Settings/FileCreated.php', |
|
17 | + 'OCA\\Files\\Activity\\Settings\\FileDeleted' => $baseDir.'/../lib/Activity/Settings/FileDeleted.php', |
|
18 | + 'OCA\\Files\\Activity\\Settings\\FileFavorite' => $baseDir.'/../lib/Activity/Settings/FileFavorite.php', |
|
19 | + 'OCA\\Files\\Activity\\Settings\\FileRestored' => $baseDir.'/../lib/Activity/Settings/FileRestored.php', |
|
20 | + 'OCA\\Files\\App' => $baseDir.'/../lib/App.php', |
|
21 | + 'OCA\\Files\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php', |
|
22 | + 'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => $baseDir.'/../lib/BackgroundJob/CleanupFileLocks.php', |
|
23 | + 'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => $baseDir.'/../lib/BackgroundJob/DeleteOrphanedItems.php', |
|
24 | + 'OCA\\Files\\BackgroundJob\\ScanFiles' => $baseDir.'/../lib/BackgroundJob/ScanFiles.php', |
|
25 | + 'OCA\\Files\\Capabilities' => $baseDir.'/../lib/Capabilities.php', |
|
26 | + 'OCA\\Files\\Collaboration\\Resources\\Listener' => $baseDir.'/../lib/Collaboration/Resources/Listener.php', |
|
27 | + 'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => $baseDir.'/../lib/Collaboration/Resources/ResourceProvider.php', |
|
28 | + 'OCA\\Files\\Command\\DeleteOrphanedFiles' => $baseDir.'/../lib/Command/DeleteOrphanedFiles.php', |
|
29 | + 'OCA\\Files\\Command\\Scan' => $baseDir.'/../lib/Command/Scan.php', |
|
30 | + 'OCA\\Files\\Command\\ScanAppData' => $baseDir.'/../lib/Command/ScanAppData.php', |
|
31 | + 'OCA\\Files\\Command\\TransferOwnership' => $baseDir.'/../lib/Command/TransferOwnership.php', |
|
32 | + 'OCA\\Files\\Controller\\AjaxController' => $baseDir.'/../lib/Controller/AjaxController.php', |
|
33 | + 'OCA\\Files\\Controller\\ApiController' => $baseDir.'/../lib/Controller/ApiController.php', |
|
34 | + 'OCA\\Files\\Controller\\ViewController' => $baseDir.'/../lib/Controller/ViewController.php', |
|
35 | + 'OCA\\Files\\Helper' => $baseDir.'/../lib/Helper.php', |
|
36 | + 'OCA\\Files\\Service\\TagService' => $baseDir.'/../lib/Service/TagService.php', |
|
37 | 37 | ); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | private static function sendHeaders($filename, $name, array $rangeArray) { |
77 | 77 | OC_Response::setContentDispositionHeader($name, 'attachment'); |
78 | 78 | header('Content-Transfer-Encoding: binary', true); |
79 | - header('Pragma: public');// enable caching in IE |
|
79 | + header('Pragma: public'); // enable caching in IE |
|
80 | 80 | header('Expires: 0'); |
81 | 81 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
82 | 82 | $fileSize = \OC\Files\Filesystem::filesize($filename); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | if (!is_array($files)) { |
123 | - $filename = $dir . '/' . $files; |
|
123 | + $filename = $dir.'/'.$files; |
|
124 | 124 | if (!$view->is_dir($filename)) { |
125 | 125 | self::getSingleFile($view, $dir, $files, is_null($params) ? array() : $params); |
126 | 126 | return; |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | $name = $basename; |
136 | 136 | } |
137 | 137 | |
138 | - $filename = $dir . '/' . $name; |
|
138 | + $filename = $dir.'/'.$name; |
|
139 | 139 | } else { |
140 | - $filename = $dir . '/' . $files; |
|
140 | + $filename = $dir.'/'.$files; |
|
141 | 141 | $getType = self::ZIP_DIR; |
142 | 142 | // downloading root ? |
143 | 143 | if ($files !== '') { |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | $fileInfos = array(); |
153 | 153 | $fileSize = 0; |
154 | 154 | foreach ($files as $file) { |
155 | - $fileInfo = \OC\Files\Filesystem::getFileInfo($dir . '/' . $file); |
|
155 | + $fileInfo = \OC\Files\Filesystem::getFileInfo($dir.'/'.$file); |
|
156 | 156 | $fileSize += $fileInfo->getSize(); |
157 | 157 | $fileInfos[] = $fileInfo; |
158 | 158 | } |
159 | 159 | $numberOfFiles = self::getNumberOfFiles($fileInfos); |
160 | 160 | } elseif ($getType === self::ZIP_DIR) { |
161 | - $fileInfo = \OC\Files\Filesystem::getFileInfo($dir . '/' . $files); |
|
161 | + $fileInfo = \OC\Files\Filesystem::getFileInfo($dir.'/'.$files); |
|
162 | 162 | $fileSize = $fileInfo->getSize(); |
163 | 163 | $numberOfFiles = self::getNumberOfFiles(array($fileInfo)); |
164 | 164 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | OC_Util::obEnd(); |
168 | 168 | |
169 | 169 | $streamer->sendHeaders($name); |
170 | - $executionTime = (int)OC::$server->getIniWrapper()->getNumeric('max_execution_time'); |
|
170 | + $executionTime = (int) OC::$server->getIniWrapper()->getNumeric('max_execution_time'); |
|
171 | 171 | if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
172 | 172 | @set_time_limit(0); |
173 | 173 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | if ($getType === self::ZIP_FILES) { |
177 | 177 | foreach ($files as $file) { |
178 | - $file = $dir . '/' . $file; |
|
178 | + $file = $dir.'/'.$file; |
|
179 | 179 | if (\OC\Files\Filesystem::is_file($file)) { |
180 | 180 | $fileSize = \OC\Files\Filesystem::filesize($file); |
181 | 181 | $fileTime = \OC\Files\Filesystem::filemtime($file); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | } |
189 | 189 | } elseif ($getType === self::ZIP_DIR) { |
190 | - $file = $dir . '/' . $files; |
|
190 | + $file = $dir.'/'.$files; |
|
191 | 191 | $streamer->addDirRecursive($file); |
192 | 192 | } |
193 | 193 | $streamer->finalize(); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @return array $rangeArray ('from'=>int,'to'=>int), ... |
220 | 220 | */ |
221 | 221 | private static function parseHttpRangeHeader($rangeHeaderPos, $fileSize) { |
222 | - $rArray=explode(',', $rangeHeaderPos); |
|
222 | + $rArray = explode(',', $rangeHeaderPos); |
|
223 | 223 | $minOffset = 0; |
224 | 224 | $ind = 0; |
225 | 225 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | if ($ranges[0] < $minOffset) { // case: bytes=500-700,601-999 |
232 | 232 | $ranges[0] = $minOffset; |
233 | 233 | } |
234 | - if ($ind > 0 && $rangeArray[$ind-1]['to']+1 == $ranges[0]) { // case: bytes=500-600,601-999 |
|
234 | + if ($ind > 0 && $rangeArray[$ind - 1]['to'] + 1 == $ranges[0]) { // case: bytes=500-600,601-999 |
|
235 | 235 | $ind--; |
236 | 236 | $ranges[0] = $rangeArray[$ind]['from']; |
237 | 237 | } |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | if (is_numeric($ranges[0]) && is_numeric($ranges[1]) && $ranges[0] < $fileSize && $ranges[0] <= $ranges[1]) { |
241 | 241 | // case: x-x |
242 | 242 | if ($ranges[1] >= $fileSize) { |
243 | - $ranges[1] = $fileSize-1; |
|
243 | + $ranges[1] = $fileSize - 1; |
|
244 | 244 | } |
245 | - $rangeArray[$ind++] = array( 'from' => $ranges[0], 'to' => $ranges[1], 'size' => $fileSize ); |
|
245 | + $rangeArray[$ind++] = array('from' => $ranges[0], 'to' => $ranges[1], 'size' => $fileSize); |
|
246 | 246 | $minOffset = $ranges[1] + 1; |
247 | 247 | if ($minOffset >= $fileSize) { |
248 | 248 | break; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | } |
251 | 251 | elseif (is_numeric($ranges[0]) && $ranges[0] < $fileSize) { |
252 | 252 | // case: x- |
253 | - $rangeArray[$ind++] = array( 'from' => $ranges[0], 'to' => $fileSize-1, 'size' => $fileSize ); |
|
253 | + $rangeArray[$ind++] = array('from' => $ranges[0], 'to' => $fileSize - 1, 'size' => $fileSize); |
|
254 | 254 | break; |
255 | 255 | } |
256 | 256 | elseif (is_numeric($ranges[1])) { |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | if ($ranges[1] > $fileSize) { |
259 | 259 | $ranges[1] = $fileSize; |
260 | 260 | } |
261 | - $rangeArray[$ind++] = array( 'from' => $fileSize-$ranges[1], 'to' => $fileSize-1, 'size' => $fileSize ); |
|
261 | + $rangeArray[$ind++] = array('from' => $fileSize - $ranges[1], 'to' => $fileSize - 1, 'size' => $fileSize); |
|
262 | 262 | break; |
263 | 263 | } |
264 | 264 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @param array $params ; 'head' boolean to only send header of the request ; 'range' http range header |
273 | 273 | */ |
274 | 274 | private static function getSingleFile($view, $dir, $name, $params) { |
275 | - $filename = $dir . '/' . $name; |
|
275 | + $filename = $dir.'/'.$name; |
|
276 | 276 | OC_Util::obEnd(); |
277 | 277 | $view->lockFile($filename, ILockingProvider::LOCK_SHARED); |
278 | 278 | |
@@ -361,17 +361,17 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public static function lockFiles($view, $dir, $files) { |
363 | 363 | if (!is_array($files)) { |
364 | - $file = $dir . '/' . $files; |
|
364 | + $file = $dir.'/'.$files; |
|
365 | 365 | $files = [$file]; |
366 | 366 | } |
367 | 367 | foreach ($files as $file) { |
368 | - $file = $dir . '/' . $file; |
|
368 | + $file = $dir.'/'.$file; |
|
369 | 369 | $view->lockFile($file, ILockingProvider::LOCK_SHARED); |
370 | 370 | if ($view->is_dir($file)) { |
371 | 371 | $contents = $view->getDirectoryContent($file); |
372 | 372 | $contents = array_map(function($fileInfo) use ($file) { |
373 | 373 | /** @var \OCP\Files\FileInfo $fileInfo */ |
374 | - return $file . '/' . $fileInfo->getName(); |
|
374 | + return $file.'/'.$fileInfo->getName(); |
|
375 | 375 | }, $contents); |
376 | 376 | self::lockFiles($view, $dir, $contents); |
377 | 377 | } |
@@ -391,12 +391,12 @@ discard block |
||
391 | 391 | } |
392 | 392 | if ($getType === self::ZIP_FILES) { |
393 | 393 | foreach ($files as $file) { |
394 | - $file = $dir . '/' . $file; |
|
394 | + $file = $dir.'/'.$file; |
|
395 | 395 | $view->unlockFile($file, ILockingProvider::LOCK_SHARED); |
396 | 396 | } |
397 | 397 | } |
398 | 398 | if ($getType === self::ZIP_DIR) { |
399 | - $file = $dir . '/' . $files; |
|
399 | + $file = $dir.'/'.$files; |
|
400 | 400 | $view->unlockFile($file, ILockingProvider::LOCK_SHARED); |
401 | 401 | } |
402 | 402 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | public static function computerFileSize($str) { |
99 | 99 | $str = strtolower($str); |
100 | 100 | if (is_numeric($str)) { |
101 | - return (float)$str; |
|
101 | + return (float) $str; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $bytes_array = array( |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | 'p' => 1024 * 1024 * 1024 * 1024 * 1024, |
116 | 116 | ); |
117 | 117 | |
118 | - $bytes = (float)$str; |
|
118 | + $bytes = (float) $str; |
|
119 | 119 | |
120 | 120 | if (preg_match('#([kmgtp]?b?)$#si', $str, $matches) && !empty($bytes_array[$matches[1]])) { |
121 | 121 | $bytes *= $bytes_array[$matches[1]]; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | foreach ($dirs as $dir) { |
231 | 231 | foreach ($exts as $ext) { |
232 | - if ($check_fn("$dir/$name" . $ext)) |
|
232 | + if ($check_fn("$dir/$name".$ext)) |
|
233 | 233 | return true; |
234 | 234 | } |
235 | 235 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $ext = ''; |
301 | 301 | } |
302 | 302 | |
303 | - $newpath = $path . '/' . $filename; |
|
303 | + $newpath = $path.'/'.$filename; |
|
304 | 304 | if ($view->file_exists($newpath)) { |
305 | 305 | if (preg_match_all('/\((\d+)\)/', $name, $matches, PREG_OFFSET_CAPTURE)) { |
306 | 306 | //Replace the last "(number)" with "(number+1)" |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | do { |
317 | 317 | if ($offset) { |
318 | 318 | //Replace the last "(number)" with "(number+1)" |
319 | - $newname = substr_replace($name, '(' . $counter . ')', $offset, $match_length); |
|
319 | + $newname = substr_replace($name, '('.$counter.')', $offset, $match_length); |
|
320 | 320 | } else { |
321 | - $newname = $name . ' (' . $counter . ')'; |
|
321 | + $newname = $name.' ('.$counter.')'; |
|
322 | 322 | } |
323 | - $newpath = $path . '/' . $newname . $ext; |
|
323 | + $newpath = $path.'/'.$newname.$ext; |
|
324 | 324 | $counter++; |
325 | 325 | } while ($view->file_exists($newpath)); |
326 | 326 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * @return int number of bytes representing |
384 | 384 | */ |
385 | 385 | public static function maxUploadFilesize($dir, $freeSpace = null) { |
386 | - if (is_null($freeSpace) || $freeSpace < 0){ |
|
386 | + if (is_null($freeSpace) || $freeSpace < 0) { |
|
387 | 387 | $freeSpace = self::freeSpace($dir); |
388 | 388 | } |
389 | 389 | return min($freeSpace, self::uploadLimit()); |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $freeSpace = max($freeSpace, 0); |
402 | 402 | return $freeSpace; |
403 | 403 | } else { |
404 | - return (INF > 0)? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188 |
|
404 | + return (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188 |
|
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | $ini = \OC::$server->getIniWrapper(); |
415 | 415 | $upload_max_filesize = OCP\Util::computerFileSize($ini->get('upload_max_filesize')); |
416 | 416 | $post_max_size = OCP\Util::computerFileSize($ini->get('post_max_size')); |
417 | - if ((int)$upload_max_filesize === 0 and (int)$post_max_size === 0) { |
|
417 | + if ((int) $upload_max_filesize === 0 and (int) $post_max_size === 0) { |
|
418 | 418 | return INF; |
419 | - } elseif ((int)$upload_max_filesize === 0 or (int)$post_max_size === 0) { |
|
419 | + } elseif ((int) $upload_max_filesize === 0 or (int) $post_max_size === 0) { |
|
420 | 420 | return max($upload_max_filesize, $post_max_size); //only the non 0 value counts |
421 | 421 | } else { |
422 | 422 | return min($upload_max_filesize, $post_max_size); |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $ownerId = $storage->getOwner($path); |
544 | 544 | $ownerDisplayName = ''; |
545 | 545 | $owner = \OC::$server->getUserManager()->get($ownerId); |
546 | - if($owner) { |
|
546 | + if ($owner) { |
|
547 | 547 | $ownerDisplayName = $owner->getDisplayName(); |
548 | 548 | } |
549 | 549 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return bool |
100 | 100 | */ |
101 | 101 | public function isCodeCheckEnforced(): bool { |
102 | - $notSignedChannels = [ '', 'git']; |
|
102 | + $notSignedChannels = ['', 'git']; |
|
103 | 103 | if (\in_array($this->environmentHelper->getChannel(), $notSignedChannels, true)) { |
104 | 104 | return false; |
105 | 105 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $folderToIterate, |
134 | 134 | \RecursiveDirectoryIterator::SKIP_DOTS |
135 | 135 | ); |
136 | - if($root === '') { |
|
136 | + if ($root === '') { |
|
137 | 137 | $root = \OC::$SERVERROOT; |
138 | 138 | } |
139 | 139 | $root = rtrim($root, '/'); |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | $hashes = []; |
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 |
||
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 | |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | // Thus we ignore everything below the first occurrence of |
186 | 186 | // "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####" and have the |
187 | 187 | // hash generated based on this. |
188 | - if($filename === $this->environmentHelper->getServerRoot() . '/.htaccess') { |
|
188 | + if ($filename === $this->environmentHelper->getServerRoot().'/.htaccess') { |
|
189 | 189 | $fileContent = file_get_contents($filename); |
190 | 190 | $explodedArray = explode('#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####', $fileContent); |
191 | - if(\count($explodedArray) === 2) { |
|
191 | + if (\count($explodedArray) === 2) { |
|
192 | 192 | $hashes[$relativeFileName] = hash('sha512', $explodedArray[0]); |
193 | 193 | continue; |
194 | 194 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | public function writeAppSignature($path, |
238 | 238 | X509 $certificate, |
239 | 239 | RSA $privateKey) { |
240 | - $appInfoDir = $path . '/appinfo'; |
|
240 | + $appInfoDir = $path.'/appinfo'; |
|
241 | 241 | try { |
242 | 242 | $this->fileAccessHelper->assertDirectoryExists($appInfoDir); |
243 | 243 | |
@@ -245,12 +245,12 @@ discard block |
||
245 | 245 | $hashes = $this->generateHashes($iterator, $path); |
246 | 246 | $signature = $this->createSignatureData($hashes, $certificate, $privateKey); |
247 | 247 | $this->fileAccessHelper->file_put_contents( |
248 | - $appInfoDir . '/signature.json', |
|
248 | + $appInfoDir.'/signature.json', |
|
249 | 249 | json_encode($signature, JSON_PRETTY_PRINT) |
250 | 250 | ); |
251 | - } catch (\Exception $e){ |
|
251 | + } catch (\Exception $e) { |
|
252 | 252 | if (!$this->fileAccessHelper->is_writable($appInfoDir)) { |
253 | - throw new \Exception($appInfoDir . ' is not writable'); |
|
253 | + throw new \Exception($appInfoDir.' is not writable'); |
|
254 | 254 | } |
255 | 255 | throw $e; |
256 | 256 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | public function writeCoreSignature(X509 $certificate, |
268 | 268 | RSA $rsa, |
269 | 269 | $path) { |
270 | - $coreDir = $path . '/core'; |
|
270 | + $coreDir = $path.'/core'; |
|
271 | 271 | try { |
272 | 272 | |
273 | 273 | $this->fileAccessHelper->assertDirectoryExists($coreDir); |
@@ -275,12 +275,12 @@ discard block |
||
275 | 275 | $hashes = $this->generateHashes($iterator, $path); |
276 | 276 | $signatureData = $this->createSignatureData($hashes, $certificate, $rsa); |
277 | 277 | $this->fileAccessHelper->file_put_contents( |
278 | - $coreDir . '/signature.json', |
|
278 | + $coreDir.'/signature.json', |
|
279 | 279 | json_encode($signatureData, JSON_PRETTY_PRINT) |
280 | 280 | ); |
281 | - } catch (\Exception $e){ |
|
281 | + } catch (\Exception $e) { |
|
282 | 282 | if (!$this->fileAccessHelper->is_writable($coreDir)) { |
283 | - throw new \Exception($coreDir . ' is not writable'); |
|
283 | + throw new \Exception($coreDir.' is not writable'); |
|
284 | 284 | } |
285 | 285 | throw $e; |
286 | 286 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @throws \Exception |
298 | 298 | */ |
299 | 299 | private function verify(string $signaturePath, string $basePath, string $certificateCN): array { |
300 | - if(!$this->isCodeCheckEnforced()) { |
|
300 | + if (!$this->isCodeCheckEnforced()) { |
|
301 | 301 | return []; |
302 | 302 | } |
303 | 303 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | if (\is_string($content)) { |
308 | 308 | $signatureData = json_decode($content, true); |
309 | 309 | } |
310 | - if(!\is_array($signatureData)) { |
|
310 | + if (!\is_array($signatureData)) { |
|
311 | 311 | throw new InvalidSignatureException('Signature data not found.'); |
312 | 312 | } |
313 | 313 | |
@@ -321,11 +321,11 @@ discard block |
||
321 | 321 | $rootCertificatePublicKey = $this->fileAccessHelper->file_get_contents($this->environmentHelper->getServerRoot().'/resources/codesigning/root.crt'); |
322 | 322 | $x509->loadCA($rootCertificatePublicKey); |
323 | 323 | $x509->loadX509($certificate); |
324 | - if(!$x509->validateSignature()) { |
|
324 | + if (!$x509->validateSignature()) { |
|
325 | 325 | throw new InvalidSignatureException('Certificate is not valid.'); |
326 | 326 | } |
327 | 327 | // Verify if certificate has proper CN. "core" CN is always trusted. |
328 | - if($x509->getDN(X509::DN_OPENSSL)['CN'] !== $certificateCN && $x509->getDN(X509::DN_OPENSSL)['CN'] !== 'core') { |
|
328 | + if ($x509->getDN(X509::DN_OPENSSL)['CN'] !== $certificateCN && $x509->getDN(X509::DN_OPENSSL)['CN'] !== 'core') { |
|
329 | 329 | throw new InvalidSignatureException( |
330 | 330 | sprintf('Certificate is not valid for required scope. (Requested: %s, current: CN=%s)', $certificateCN, $x509->getDN(true)['CN']) |
331 | 331 | ); |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $rsa->setMGFHash('sha512'); |
339 | 339 | // See https://tools.ietf.org/html/rfc3447#page-38 |
340 | 340 | $rsa->setSaltLength(0); |
341 | - if(!$rsa->verify(json_encode($expectedHashes), $signature)) { |
|
341 | + if (!$rsa->verify(json_encode($expectedHashes), $signature)) { |
|
342 | 342 | throw new InvalidSignatureException('Signature could not get verified.'); |
343 | 343 | } |
344 | 344 | |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | // |
348 | 348 | // Due to this reason we exclude the whole updater/ folder from the code |
349 | 349 | // integrity check. |
350 | - if($basePath === $this->environmentHelper->getServerRoot()) { |
|
351 | - foreach($expectedHashes as $fileName => $hash) { |
|
352 | - if(strpos($fileName, 'updater/') === 0) { |
|
350 | + if ($basePath === $this->environmentHelper->getServerRoot()) { |
|
351 | + foreach ($expectedHashes as $fileName => $hash) { |
|
352 | + if (strpos($fileName, 'updater/') === 0) { |
|
353 | 353 | unset($expectedHashes[$fileName]); |
354 | 354 | } |
355 | 355 | } |
@@ -361,23 +361,23 @@ discard block |
||
361 | 361 | $differencesB = array_diff($currentInstanceHashes, $expectedHashes); |
362 | 362 | $differences = array_unique(array_merge($differencesA, $differencesB)); |
363 | 363 | $differenceArray = []; |
364 | - foreach($differences as $filename => $hash) { |
|
364 | + foreach ($differences as $filename => $hash) { |
|
365 | 365 | // Check if file should not exist in the new signature table |
366 | - if(!array_key_exists($filename, $expectedHashes)) { |
|
366 | + if (!array_key_exists($filename, $expectedHashes)) { |
|
367 | 367 | $differenceArray['EXTRA_FILE'][$filename]['expected'] = ''; |
368 | 368 | $differenceArray['EXTRA_FILE'][$filename]['current'] = $hash; |
369 | 369 | continue; |
370 | 370 | } |
371 | 371 | |
372 | 372 | // Check if file is missing |
373 | - if(!array_key_exists($filename, $currentInstanceHashes)) { |
|
373 | + if (!array_key_exists($filename, $currentInstanceHashes)) { |
|
374 | 374 | $differenceArray['FILE_MISSING'][$filename]['expected'] = $expectedHashes[$filename]; |
375 | 375 | $differenceArray['FILE_MISSING'][$filename]['current'] = ''; |
376 | 376 | continue; |
377 | 377 | } |
378 | 378 | |
379 | 379 | // Check if hash does mismatch |
380 | - if($expectedHashes[$filename] !== $currentInstanceHashes[$filename]) { |
|
380 | + if ($expectedHashes[$filename] !== $currentInstanceHashes[$filename]) { |
|
381 | 381 | $differenceArray['INVALID_HASH'][$filename]['expected'] = $expectedHashes[$filename]; |
382 | 382 | $differenceArray['INVALID_HASH'][$filename]['current'] = $currentInstanceHashes[$filename]; |
383 | 383 | continue; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | */ |
398 | 398 | public function hasPassedCheck(): bool { |
399 | 399 | $results = $this->getResults(); |
400 | - if(empty($results)) { |
|
400 | + if (empty($results)) { |
|
401 | 401 | return true; |
402 | 402 | } |
403 | 403 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | */ |
410 | 410 | public function getResults(): array { |
411 | 411 | $cachedResults = $this->cache->get(self::CACHE_KEY); |
412 | - if(!\is_null($cachedResults)) { |
|
412 | + if (!\is_null($cachedResults)) { |
|
413 | 413 | return json_decode($cachedResults, true); |
414 | 414 | } |
415 | 415 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | private function storeResults(string $scope, array $result) { |
429 | 429 | $resultArray = $this->getResults(); |
430 | 430 | unset($resultArray[$scope]); |
431 | - if(!empty($result)) { |
|
431 | + if (!empty($result)) { |
|
432 | 432 | $resultArray[$scope] = $result; |
433 | 433 | } |
434 | 434 | if ($this->config !== null) { |
@@ -480,11 +480,11 @@ discard block |
||
480 | 480 | */ |
481 | 481 | public function verifyAppSignature(string $appId, string $path = ''): array { |
482 | 482 | try { |
483 | - if($path === '') { |
|
483 | + if ($path === '') { |
|
484 | 484 | $path = $this->appLocator->getAppPath($appId); |
485 | 485 | } |
486 | 486 | $result = $this->verify( |
487 | - $path . '/appinfo/signature.json', |
|
487 | + $path.'/appinfo/signature.json', |
|
488 | 488 | $path, |
489 | 489 | $appId |
490 | 490 | ); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | public function verifyCoreSignature(): array { |
535 | 535 | try { |
536 | 536 | $result = $this->verify( |
537 | - $this->environmentHelper->getServerRoot() . '/core/signature.json', |
|
537 | + $this->environmentHelper->getServerRoot().'/core/signature.json', |
|
538 | 538 | $this->environmentHelper->getServerRoot(), |
539 | 539 | 'core' |
540 | 540 | ); |
@@ -559,18 +559,18 @@ discard block |
||
559 | 559 | $this->cleanResults(); |
560 | 560 | $this->verifyCoreSignature(); |
561 | 561 | $appIds = $this->appLocator->getAllApps(); |
562 | - foreach($appIds as $appId) { |
|
562 | + foreach ($appIds as $appId) { |
|
563 | 563 | // If an application is shipped a valid signature is required |
564 | 564 | $isShipped = $this->appManager->isShipped($appId); |
565 | 565 | $appNeedsToBeChecked = false; |
566 | 566 | if ($isShipped) { |
567 | 567 | $appNeedsToBeChecked = true; |
568 | - } elseif ($this->fileAccessHelper->file_exists($this->appLocator->getAppPath($appId) . '/appinfo/signature.json')) { |
|
568 | + } elseif ($this->fileAccessHelper->file_exists($this->appLocator->getAppPath($appId).'/appinfo/signature.json')) { |
|
569 | 569 | // Otherwise only if the application explicitly ships a signature.json file |
570 | 570 | $appNeedsToBeChecked = true; |
571 | 571 | } |
572 | 572 | |
573 | - if($appNeedsToBeChecked) { |
|
573 | + if ($appNeedsToBeChecked) { |
|
574 | 574 | $this->verifyAppSignature($appId); |
575 | 575 | } |
576 | 576 | } |