@@ -54,7 +54,7 @@ |
||
54 | 54 | $message['content'] = ''; |
55 | 55 | $logs = $comment->get_logs(); |
56 | 56 | if (!empty($logs)) { |
57 | - $message['content'] .= $this->_l10n->get('moderation history').":\n\n"; |
|
57 | + $message['content'] .= $this->_l10n->get('moderation history') . ":\n\n"; |
|
58 | 58 | foreach ($logs as $time => $log) { |
59 | 59 | $reported = $this->_l10n->get_formatter()->datetime(strtotime("{$time}Z")); |
60 | 60 | $message['content'] .= $this->_l10n->get(sprintf('%s: %s by %s (from %s)', "$reported:\n", $this->_l10n->get($log['action']), $log['reporter'], $log['ip'])) . "\n\n"; |
@@ -47,7 +47,8 @@ |
||
47 | 47 | if ($node_id) { |
48 | 48 | try { |
49 | 49 | $comments_topic = new midcom_db_topic($node_id); |
50 | - } catch (midcom_error $e) { |
|
50 | + } |
|
51 | + catch (midcom_error $e) { |
|
51 | 52 | return null; |
52 | 53 | } |
53 | 54 |
@@ -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 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | ]); |
49 | 49 | } |
50 | 50 | |
51 | - if ( $this->_article->topic === $this->_topic->id |
|
51 | + if ($this->_article->topic === $this->_topic->id |
|
52 | 52 | && $this->_article->can_do('midgard:delete')) { |
53 | 53 | $delete = $this->get_workflow('delete', ['object' => $this->_article]); |
54 | 54 | $buttons[] = $delete->get_button("delete/{$this->_article->guid}/"); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | if ($this->_config->get('comments_enable')) { |
84 | 84 | if ($node = net_nehmer_comments_interface::get_node($this->_topic, $this->_config->get('comments_topic'))) { |
85 | 85 | $this->_request_data['comments_url'] = $node[MIDCOM_NAV_RELATIVEURL] . "comment/{$this->_article->guid}"; |
86 | - if ( $this->_topic->can_do('midgard:update') |
|
86 | + if ($this->_topic->can_do('midgard:update') |
|
87 | 87 | && $this->_topic->can_do('net.nehmer.comments:moderation')) { |
88 | 88 | net_nehmer_comments_viewer::add_head_elements(); |
89 | 89 | } |
@@ -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 | } |