@@ -85,7 +85,8 @@ discard block |
||
85 | 85 | |
86 | 86 | $this->clearcache(); |
87 | 87 | |
88 | - if ($file && $file['name'] === $name) { // file exists and check filename for item ID based filesystem |
|
88 | + if ($file && $file['name'] === $name) { |
|
89 | +// file exists and check filename for item ID based filesystem |
|
89 | 90 | if ($this->uploadOverwrite) { |
90 | 91 | if (!$file['write']) { |
91 | 92 | return $this->setError(elFinder::ERROR_PERM_DENIED); |
@@ -142,11 +143,13 @@ discard block |
||
142 | 143 | { |
143 | 144 | try { |
144 | 145 | return org_openpsa_documents_document_dba::get_cached($path); |
145 | - } catch (midcom_error $e) { |
|
146 | + } |
|
147 | + catch (midcom_error $e) { |
|
146 | 148 | $e->log(); |
147 | 149 | try { |
148 | 150 | return org_openpsa_documents_directory::get_cached($path); |
149 | - } catch (midcom_error $e) { |
|
151 | + } |
|
152 | + catch (midcom_error $e) { |
|
150 | 153 | $e->log(); |
151 | 154 | } |
152 | 155 | } |
@@ -282,7 +285,8 @@ discard block |
||
282 | 285 | $object = midcom::get()->dbfactory->get_object_by_guid($path); |
283 | 286 | try { |
284 | 287 | $parentdir = org_openpsa_documents_directory::get_cached($parent); |
285 | - } catch (midcom_error $e) { |
|
288 | + } |
|
289 | + catch (midcom_error $e) { |
|
286 | 290 | $e->log(); |
287 | 291 | return false; |
288 | 292 | } |
@@ -579,7 +583,8 @@ discard block |
||
579 | 583 | try { |
580 | 584 | $doc = new org_openpsa_documents_document_dba($path); |
581 | 585 | return $doc->delete(); |
582 | - } catch (midcom_error $e) { |
|
586 | + } |
|
587 | + catch (midcom_error $e) { |
|
583 | 588 | return false; |
584 | 589 | } |
585 | 590 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME, '(' . $mime . ')'); |
68 | 68 | } |
69 | 69 | |
70 | - $tmpsize = (int)sprintf('%u', filesize($tmpname)); |
|
70 | + $tmpsize = (int) sprintf('%u', filesize($tmpname)); |
|
71 | 71 | if ($this->uploadMaxSize > 0 && $tmpsize > $this->uploadMaxSize) { |
72 | 72 | return $this->setError(elFinder::ERROR_UPLOAD_FILE_SIZE); |
73 | 73 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $output = [$object->get_label()]; |
251 | 251 | |
252 | 252 | $parent = $object->get_parent(); |
253 | - while ( $parent |
|
253 | + while ($parent |
|
254 | 254 | && $parent->component == 'org.openpsa.documents') { |
255 | 255 | $output[] = $parent->extra; |
256 | 256 | $parent = $parent->get_parent(); |
@@ -347,12 +347,12 @@ discard block |
||
347 | 347 | $data['mime'] = 'directory'; |
348 | 348 | } |
349 | 349 | |
350 | - if ( $owner |
|
350 | + if ($owner |
|
351 | 351 | && $group = midcom::get()->auth->get_assignee($owner)) { |
352 | 352 | $data['group'] = $group->name; |
353 | 353 | } |
354 | 354 | |
355 | - if ( $this->root !== $path |
|
355 | + if ($this->root !== $path |
|
356 | 356 | && $parent = $object->get_parent()) { |
357 | 357 | $data['phash'] = $this->encode($parent->guid); |
358 | 358 | } |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param string $mode open mode |
412 | 412 | * @return resource|false |
413 | 413 | */ |
414 | - protected function _fopen($path, $mode="rb") |
|
414 | + protected function _fopen($path, $mode = "rb") |
|
415 | 415 | { |
416 | 416 | $document = org_openpsa_documents_document_dba::get_cached($path); |
417 | 417 | $attachments = blobs::get_attachments($document, 'document'); |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @param string $path file path |
430 | 430 | * @return bool |
431 | 431 | */ |
432 | - protected function _fclose($fp, $path='') |
|
432 | + protected function _fclose($fp, $path = '') |
|
433 | 433 | { |
434 | 434 | fclose($fp); |
435 | 435 | return true; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | { |
612 | 612 | $filename = midcom_db_attachment::safe_filename($name); |
613 | 613 | $att = $doc->create_attachment($filename, $name, $mimetype); |
614 | - if ( !$att |
|
614 | + if (!$att |
|
615 | 615 | || !$att->copy_from_handle($fp)) { |
616 | 616 | return false; |
617 | 617 | } |
@@ -193,7 +193,8 @@ |
||
193 | 193 | |
194 | 194 | try { |
195 | 195 | $diff_fields = $rcs_handler->get_diff($prev_version, $this_version); |
196 | - } catch (midcom_error $e) { |
|
196 | + } |
|
197 | + catch (midcom_error $e) { |
|
197 | 198 | $e->log(); |
198 | 199 | return ''; |
199 | 200 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | public function _on_creating() : bool |
30 | 30 | { |
31 | - if ( $this->title == '' |
|
31 | + if ($this->title == '' |
|
32 | 32 | || !$this->topic) { |
33 | 33 | // We must have wikiword and topic at this stage |
34 | 34 | return false; |
@@ -23,7 +23,7 @@ |
||
23 | 23 | <th><?php echo $data['l10n']->get('type'); ?></th> |
24 | 24 | <?php |
25 | 25 | } ?> |
26 | -<?php if ( array_key_exists('invoiceable_filter', $query_data)) { |
|
26 | +<?php if (array_key_exists('invoiceable_filter', $query_data)) { |
|
27 | 27 | ?> |
28 | 28 | <th><?php echo midcom::get()->i18n->get_string('invoiceable', 'org.openpsa.projects'); ?></th> |
29 | 29 | <?php |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $at_entries = $mc->get_related_objects(); |
41 | 41 | |
42 | 42 | if (empty($at_entries)) { |
43 | - if ( ( $this->_deliverable->continuous |
|
43 | + if (($this->_deliverable->continuous |
|
44 | 44 | || $this->_deliverable->end > time()) |
45 | 45 | && $this->_deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATE_STARTED) { |
46 | 46 | $schema->get_field('next_cycle')['hidden'] = false; |
@@ -30,7 +30,7 @@ |
||
30 | 30 | return null; |
31 | 31 | } |
32 | 32 | |
33 | - if (! $input instanceof midcom_db_attachment) { |
|
33 | + if (!$input instanceof midcom_db_attachment) { |
|
34 | 34 | throw new UnexpectedTypeException($input, midcom_db_attachment::class); |
35 | 35 | } |
36 | 36 |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 'customdata' => [] |
161 | 161 | ], $config)); |
162 | 162 | |
163 | - $normalize_widget = function (Options $options, $value) { |
|
163 | + $normalize_widget = function(Options $options, $value) { |
|
164 | 164 | if ($value == 'text') { |
165 | 165 | if (!empty($options['widget_config']['hideinput'])) { |
166 | 166 | return PasswordType::class; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | return $value; |
186 | 186 | }; |
187 | 187 | |
188 | - $normalize_storage = function (Options $options, $value) use ($name) { |
|
188 | + $normalize_storage = function(Options $options, $value) use ($name) { |
|
189 | 189 | $default = [ |
190 | 190 | 'location' => 'parameter', |
191 | 191 | 'domain' => 'midcom.helper.datamanager2', |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | return $value; |
228 | 228 | }; |
229 | 229 | |
230 | - $normalize_validation = function (Options $options, $value) { |
|
230 | + $normalize_validation = function(Options $options, $value) { |
|
231 | 231 | $validation = []; |
232 | 232 | |
233 | 233 | foreach ((array) $value as $key => $rule) { |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $rule = ['type' => $rule]; |
240 | 240 | } elseif (!array_key_exists('type', $rule)) { |
241 | 241 | throw new midcom_error("Missing validation rule type for rule {$key} on field {$options['name']}, this is a required option."); |
242 | - } elseif ( $rule['type'] == 'compare' |
|
242 | + } elseif ($rule['type'] == 'compare' |
|
243 | 243 | && !array_key_exists('compare_with', $rule)) { |
244 | 244 | throw new midcom_error("Missing compare_with option for compare type rule {$key} on field {$options['name']}, this is a required option."); |
245 | 245 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 'later_than' => null |
49 | 49 | ] |
50 | 50 | ]); |
51 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
51 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
52 | 52 | $widget_defaults = [ |
53 | 53 | 'showOn' => 'both', |
54 | 54 | 'format' => '%Y-%m-%d %H:%M', |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ]; |
60 | 60 | return helper::normalize($widget_defaults, $value); |
61 | 61 | }); |
62 | - $resolver->setNormalizer('constraints', function (Options $options, $value) { |
|
62 | + $resolver->setNormalizer('constraints', function(Options $options, $value) { |
|
63 | 63 | if ($options['type_config']['later_than']) { |
64 | 64 | $value[] = new laterthan($options['type_config']['later_than']); |
65 | 65 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | public static function add_normalizers(OptionsResolver $resolver, array $defaults) |
17 | 17 | { |
18 | 18 | foreach ($defaults as $key => $values) { |
19 | - $resolver->setNormalizer($key, function (Options $options, $value) use ($values) { |
|
19 | + $resolver->setNormalizer($key, function(Options $options, $value) use ($values) { |
|
20 | 20 | return self::normalize($values, $value); |
21 | 21 | }); |
22 | 22 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $converted = []; |
50 | 50 | foreach ($options as $key => $label) { |
51 | 51 | // symfony expects only strings |
52 | - $converted[(string)$label] = (string)$key; |
|
52 | + $converted[(string) $label] = (string) $key; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $this->choice_list = new ArrayChoiceList($converted, $value); |