@@ -409,7 +409,8 @@ |
||
409 | 409 | foreach ($this->_articles as $article_counter => $article) { |
410 | 410 | try { |
411 | 411 | $data['datamanager']->set_storage($article); |
412 | - } catch (midcom_error $e) { |
|
412 | + } |
|
413 | + catch (midcom_error $e) { |
|
413 | 414 | $e->log(); |
414 | 415 | continue; |
415 | 416 | } |
@@ -91,7 +91,7 @@ |
||
91 | 91 | midcom::get()->head->set_pagetitle($this->_request_data['page_title']); |
92 | 92 | |
93 | 93 | // Activate correct leaf |
94 | - if ( $this->_config->get('show_navigation_pseudo_leaves') |
|
94 | + if ($this->_config->get('show_navigation_pseudo_leaves') |
|
95 | 95 | && in_array($this->category, $this->_request_data['categories'])) { |
96 | 96 | $this->set_active_leaf($this->_topic->id . '_CAT_' . $this->category); |
97 | 97 | } |
@@ -55,11 +55,11 @@ |
||
55 | 55 | foreach (array_filter($csv_line) as $field => $value) { |
56 | 56 | // Process the row accordingly |
57 | 57 | $field_matching = $this->_settings['fields'][$field]; |
58 | - if ( $field_matching |
|
58 | + if ($field_matching |
|
59 | 59 | && strstr($field_matching, ':')) { |
60 | 60 | [$schemadb, $schema_field] = explode(':', $field_matching); |
61 | 61 | |
62 | - if ( !array_key_exists($schemadb, $this->_schemadbs) |
|
62 | + if (!array_key_exists($schemadb, $this->_schemadbs) |
|
63 | 63 | || !$this->_schemadbs[$schemadb]->get('default')->has_field($schema_field)) { |
64 | 64 | // Invalid matching, skip |
65 | 65 | continue; |
@@ -386,7 +386,8 @@ |
||
386 | 386 | debug_add("EXIF information missing or without orientation tag. Skipping.", MIDCOM_LOG_INFO); |
387 | 387 | return; |
388 | 388 | } |
389 | - } catch (Exception $e) { |
|
389 | + } |
|
390 | + catch (Exception $e) { |
|
390 | 391 | debug_add("Could not read EXIF data: " . $e->getMessage() . ", skipping.", MIDCOM_LOG_WARN); |
391 | 392 | return; |
392 | 393 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | debug_add("The File {$filename} is not writable.", MIDCOM_LOG_ERROR); |
188 | 188 | return false; |
189 | 189 | } |
190 | - if ( !empty($this->_filename) |
|
190 | + if (!empty($this->_filename) |
|
191 | 191 | && $this->_filename !== $filename) { |
192 | 192 | $this->_tmpfiles[] = $this->_filename; |
193 | 193 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $tmpfile = null; |
393 | 393 | $imagesize = getimagesize($this->_filename); |
394 | 394 | |
395 | - if ( $imagesize[2] == IMAGETYPE_JPEG |
|
395 | + if ($imagesize[2] == IMAGETYPE_JPEG |
|
396 | 396 | && $this->_jpegtran_available()) { |
397 | 397 | /* jpegtran */ |
398 | 398 | $operations = [ |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $imagesize = getimagesize($this->_filename); |
461 | 461 | |
462 | 462 | // Try lossless jpegtran rotation if possible |
463 | - if ( $imagesize[2] == IMAGETYPE_JPEG |
|
463 | + if ($imagesize[2] == IMAGETYPE_JPEG |
|
464 | 464 | && ($rotate % 90 == 0) |
465 | 465 | && $this->_jpegtran_available()) { |
466 | 466 | $tmpfile = $this->_get_tempfile(); |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | */ |
591 | 591 | public function fill($x = null, $y = null, $color = null, string $gravity = 'center') |
592 | 592 | { |
593 | - if ( empty($x) |
|
593 | + if (empty($x) |
|
594 | 594 | || empty($y) |
595 | 595 | || empty($color)) { |
596 | 596 | //This is a bit silly, but here for backwards compatibility... |
@@ -64,7 +64,8 @@ |
||
64 | 64 | try { |
65 | 65 | $backend->update($message); |
66 | 66 | return true; |
67 | - } catch (midcom_error $e) { |
|
67 | + } |
|
68 | + catch (midcom_error $e) { |
|
68 | 69 | debug_add('RCS: Could not save file!'); |
69 | 70 | $e->log(); |
70 | 71 | return false; |
@@ -50,9 +50,11 @@ |
||
50 | 50 | $filepath = $this->generate_filename(); |
51 | 51 | try { |
52 | 52 | $this->exec('co -q -f -r' . escapeshellarg(trim($revision)) . " {$filepath} 2>/dev/null"); |
53 | - } catch (midcom_error $e) { |
|
53 | + } |
|
54 | + catch (midcom_error $e) { |
|
54 | 55 | $e->log(); |
55 | - } finally { |
|
56 | + } |
|
57 | + finally { |
|
56 | 58 | if (!file_exists($filepath)) { |
57 | 59 | return []; |
58 | 60 | } |
@@ -91,7 +91,7 @@ |
||
91 | 91 | $revisions[$history['revision']] = $history; |
92 | 92 | |
93 | 93 | $i += 3; |
94 | - while ( $i < $total |
|
94 | + while ($i < $total |
|
95 | 95 | && !str_starts_with($lines[$i], '----') |
96 | 96 | && !str_starts_with($lines[$i], '=====')) { |
97 | 97 | $i++; |
@@ -55,7 +55,8 @@ |
||
55 | 55 | { |
56 | 56 | try { |
57 | 57 | return eval("return [{$data}\n];"); |
58 | - } catch (ParseError $e) { |
|
58 | + } |
|
59 | + catch (ParseError $e) { |
|
59 | 60 | throw new midcom_error('Failed to parse config data: ' . $e->getMessage() . ' in ' . $path . ' line ' . $e->getLine()); |
60 | 61 | } |
61 | 62 | } |
@@ -43,11 +43,11 @@ |
||
43 | 43 | public function buildForm(FormBuilderInterface $builder, array $options) |
44 | 44 | { |
45 | 45 | $session_key = md5($builder->getForm()->getName() . '_session_key'); |
46 | - $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($session_key) { |
|
46 | + $builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) use ($session_key) { |
|
47 | 47 | $value = $event->getForm()->getData(); |
48 | 48 | $session = new midcom_services_session('midcom_datamanager_captcha'); |
49 | 49 | |
50 | - if ( !$session->exists($session_key) |
|
50 | + if (!$session->exists($session_key) |
|
51 | 51 | || $value != $session->get($session_key)) { |
52 | 52 | $event->getForm()->addError(new FormError($this->l10n->get('captcha validation failed'))); |
53 | 53 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | $view->vars['readonly'] = $options['readonly']; |
66 | 66 | |
67 | 67 | if ($options['write_privilege'] !== null) { |
68 | - if ( array_key_exists('group', $options['write_privilege']) |
|
68 | + if (array_key_exists('group', $options['write_privilege']) |
|
69 | 69 | && !$this->auth->is_group_member($options['write_privilege']['group'])) { |
70 | 70 | $view->vars['readonly'] = true; |
71 | 71 | } |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | |
89 | 89 | while ($bt) { |
90 | 90 | $caller = array_shift($bt); |
91 | - if ( !array_key_exists('class', $caller) |
|
91 | + if (!array_key_exists('class', $caller) |
|
92 | 92 | || $caller['class'] != midcom_debug::class) { |
93 | - if ( !array_key_exists('function', $bt[0]) |
|
93 | + if (!array_key_exists('function', $bt[0]) |
|
94 | 94 | || $bt[0]['function'] != 'require') { |
95 | 95 | $caller = array_shift($bt); |
96 | 96 | } |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | if (array_key_exists('class', $caller)) { |
103 | 103 | $record['extra']['caller'] .= $caller['class'] . '::'; |
104 | 104 | } |
105 | - if ( array_key_exists('function', $caller) |
|
105 | + if (array_key_exists('function', $caller) |
|
106 | 106 | && !str_starts_with($caller['function'], 'debug_')) { |
107 | 107 | $record['extra']['caller'] .= $caller['function']; |
108 | 108 | } else { |
109 | - $record['extra']['caller'] .= $caller['file'] . ' (' . $caller['line']. ')'; |
|
109 | + $record['extra']['caller'] .= $caller['file'] . ' (' . $caller['line'] . ')'; |
|
110 | 110 | } |
111 | 111 | return $record; |
112 | 112 | } |