@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * @param $request |
|
71 | + * @param Request $request |
|
72 | 72 | * @param CmsComponent $cmsComponent |
73 | 73 | */ |
74 | 74 | private function newRoute($request, $cmsComponent) |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * @param $request |
|
86 | + * @param Request $request |
|
87 | 87 | * @param CmsComponent $cmsComponent |
88 | 88 | */ |
89 | 89 | private function deleteRoute($request, $cmsComponent) |
@@ -39,21 +39,21 @@ discard block |
||
39 | 39 | private function downloadRoute($slug, $cmsComponent) |
40 | 40 | { |
41 | 41 | $file = $cmsComponent->storage->getFiles()->getFileByName($slug); |
42 | - $path = realpath(__DIR__ . '/../../../www/files/'); |
|
43 | - $quoted = sprintf('"%s"', addcslashes(basename($path . '/' . $file->file), '"\\')); |
|
44 | - $size = filesize($path . '/' . $file->file); |
|
42 | + $path = realpath(__DIR__.'/../../../www/files/'); |
|
43 | + $quoted = sprintf('"%s"', addcslashes(basename($path.'/'.$file->file), '"\\')); |
|
44 | + $size = filesize($path.'/'.$file->file); |
|
45 | 45 | |
46 | 46 | header('Content-Description: File Transfer'); |
47 | - header('Content-Type: ' . $file->type); |
|
48 | - header('Content-Disposition: attachment; filename=' . $quoted); |
|
47 | + header('Content-Type: '.$file->type); |
|
48 | + header('Content-Disposition: attachment; filename='.$quoted); |
|
49 | 49 | header('Content-Transfer-Encoding: binary'); |
50 | 50 | header('Connection: Keep-Alive'); |
51 | 51 | header('Expires: 0'); |
52 | 52 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
53 | 53 | header('Pragma: public'); |
54 | - header('Content-Length: ' . $size); |
|
54 | + header('Content-Length: '.$size); |
|
55 | 55 | |
56 | - readfile($path . '/' . $file->file); |
|
56 | + readfile($path.'/'.$file->file); |
|
57 | 57 | exit; |
58 | 58 | } |
59 | 59 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_FILES); |
78 | 78 | if (isset($_FILES[CmsComponent::FILES_PARAMETER_FILE])) { |
79 | 79 | $cmsComponent->storage->getFiles()->addFile($_FILES[CmsComponent::FILES_PARAMETER_FILE]); |
80 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/files'); |
|
80 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/files'); |
|
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | private function deleteRoute($request, $cmsComponent) |
90 | 90 | { |
91 | 91 | $cmsComponent->storage->getFiles()->deleteFileByName($request::$get[CmsComponent::FILES_PARAMETER_FILE]); |
92 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/files'); |
|
92 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/files'); |
|
93 | 93 | exit; |
94 | 94 | } |
95 | 95 |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * submitting the form |
148 | 148 | * |
149 | 149 | * @param $postValues |
150 | - * @param $storage |
|
150 | + * @param Storage $storage |
|
151 | 151 | */ |
152 | 152 | protected function postSubmit($postValues, $storage) |
153 | 153 | {} |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
320 | - * @param $form |
|
320 | + * @param string|null $form |
|
321 | 321 | */ |
322 | 322 | private function setFormParameter($form) |
323 | 323 | { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | private function config() |
64 | 64 | { |
65 | - $storagePath = __DIR__ . '/../../' . $this->storageDir; |
|
65 | + $storagePath = __DIR__.'/../../'.$this->storageDir; |
|
66 | 66 | if (realpath($storagePath) === false) { |
67 | 67 | initFramework(); |
68 | 68 | if (Repository::create($storagePath)) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $repository->init(); |
71 | 71 | $this->repository = $repository; |
72 | 72 | } else { |
73 | - throw new \Exception('Could not create repository directory: ' . $storagePath); |
|
73 | + throw new \Exception('Could not create repository directory: '.$storagePath); |
|
74 | 74 | } |
75 | 75 | } else { |
76 | 76 | $this->repository = new Repository($storagePath); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function getDocumentBySlug($slug) |
235 | 235 | { |
236 | - $path = '/' . $slug; |
|
236 | + $path = '/'.$slug; |
|
237 | 237 | |
238 | 238 | return $this->repository->getDocumentByPath($path); |
239 | 239 | } |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function saveDocument($postValues) |
245 | 245 | { |
246 | - $oldPath = '/' . $postValues['path']; |
|
246 | + $oldPath = '/'.$postValues['path']; |
|
247 | 247 | |
248 | 248 | $container = $this->getDocumentContainerByPath($oldPath); |
249 | 249 | $documentObject = DocumentFactory::createDocumentFromPostValues($postValues, $this); |
250 | 250 | if ($container->path === '/') { |
251 | - $newPath = $container->path . $documentObject->slug; |
|
251 | + $newPath = $container->path.$documentObject->slug; |
|
252 | 252 | } else { |
253 | - $newPath = $container->path . '/' . $documentObject->slug; |
|
253 | + $newPath = $container->path.'/'.$documentObject->slug; |
|
254 | 254 | } |
255 | 255 | $documentObject->path = $newPath; |
256 | 256 | $this->repository->saveDocument($documentObject); |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | { |
261 | 261 | $documentObject = DocumentFactory::createDocumentFromPostValues($postValues, $this); |
262 | 262 | if ($postValues['path'] === '/') { |
263 | - $documentObject->path = $postValues['path'] . $documentObject->slug; |
|
263 | + $documentObject->path = $postValues['path'].$documentObject->slug; |
|
264 | 264 | } else { |
265 | - $documentObject->path = $postValues['path'] . '/' . $documentObject->slug; |
|
265 | + $documentObject->path = $postValues['path'].'/'.$documentObject->slug; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | $this->repository->saveDocument($documentObject); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | public function deleteDocumentBySlug($slug) |
272 | 272 | { |
273 | - $path = '/' . $slug; |
|
273 | + $path = '/'.$slug; |
|
274 | 274 | $this->repository->deleteDocumentByPath($path); |
275 | 275 | } |
276 | 276 | |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | { |
286 | 286 | $documentFolderObject = DocumentFolderFactory::createDocumentFolderFromPostValues($postValues); |
287 | 287 | if ($postValues['path'] === '/') { |
288 | - $documentFolderObject->path = $postValues['path'] . $documentFolderObject->slug; |
|
288 | + $documentFolderObject->path = $postValues['path'].$documentFolderObject->slug; |
|
289 | 289 | } else { |
290 | - $documentFolderObject->path = $postValues['path'] . '/' . $documentFolderObject->slug; |
|
290 | + $documentFolderObject->path = $postValues['path'].'/'.$documentFolderObject->slug; |
|
291 | 291 | } |
292 | 292 | $this->repository->saveDocument($documentFolderObject); |
293 | 293 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function deleteDocumentFolderBySlug($slug) |
303 | 303 | { |
304 | - $path = '/' . $slug; |
|
304 | + $path = '/'.$slug; |
|
305 | 305 | $this->repository->deleteDocumentByPath($path); |
306 | 306 | } |
307 | 307 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function getDocumentFolderBySlug($slug) |
317 | 317 | { |
318 | - $path = '/' . $slug; |
|
318 | + $path = '/'.$slug; |
|
319 | 319 | |
320 | 320 | return $this->repository->getDocumentByPath($path); |
321 | 321 | } |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function addFile($postValues) |
27 | 27 | { |
28 | - $destinationPath = realpath(__DIR__ . '/../../../www/files/'); |
|
28 | + $destinationPath = realpath(__DIR__.'/../../../www/files/'); |
|
29 | 29 | |
30 | 30 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
31 | - $destination = $destinationPath . '/' . $filename; |
|
31 | + $destination = $destinationPath.'/'.$filename; |
|
32 | 32 | |
33 | 33 | if ($postValues['error'] != '0') { |
34 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
34 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function deleteFileByName($filename) |
75 | 75 | { |
76 | - $destinationPath = realpath(__DIR__ . '/../../../www/files/'); |
|
77 | - $destination = $destinationPath . '/' . $filename; |
|
76 | + $destinationPath = realpath(__DIR__.'/../../../www/files/'); |
|
77 | + $destination = $destinationPath.'/'.$filename; |
|
78 | 78 | |
79 | 79 | if (file_exists($destination)) { |
80 | 80 | $files = $this->getFiles(); |