@@ -68,7 +68,7 @@ |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | $config = $this->get_config_for_topic($topic); |
71 | - if ( $object->name == 'index' |
|
71 | + if ($object->name == 'index' |
|
72 | 72 | && !$config->get('autoindex')) { |
73 | 73 | return ''; |
74 | 74 | } |
@@ -29,7 +29,8 @@ |
||
29 | 29 | foreach ($qb->execute() as $article) { |
30 | 30 | try { |
31 | 31 | $datamanager->set_storage($article); |
32 | - } catch (midcom_error $e) { |
|
32 | + } |
|
33 | + catch (midcom_error $e) { |
|
33 | 34 | $e->log(MIDCOM_LOG_WARN); |
34 | 35 | continue; |
35 | 36 | } |
@@ -152,7 +152,8 @@ |
||
152 | 152 | try { |
153 | 153 | $topic = new midcom_db_topic($id); |
154 | 154 | $id = $topic->id; |
155 | - } catch (midcom_error $e) { |
|
155 | + } |
|
156 | + catch (midcom_error $e) { |
|
156 | 157 | $e->log(); |
157 | 158 | break; |
158 | 159 | } |
@@ -66,7 +66,8 @@ |
||
66 | 66 | try { |
67 | 67 | $author = new midcom_db_person($wikipage->metadata->revisor); |
68 | 68 | $item->author = $author->name; |
69 | - } catch (midcom_error $e) { |
|
69 | + } |
|
70 | + catch (midcom_error $e) { |
|
70 | 71 | $e->log(); |
71 | 72 | } |
72 | 73 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | return; |
51 | 51 | } |
52 | 52 | |
53 | - if ( $history['date'] < $from |
|
53 | + if ($history['date'] < $from |
|
54 | 54 | || $history['date'] > $to) { |
55 | 55 | // We can ignore revisions outside the timeframe |
56 | 56 | continue; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $this->_seek_updated($from); |
94 | 94 | |
95 | 95 | $i = 0; |
96 | - while ( $this->_updated_pages < $this->_max_pages |
|
96 | + while ($this->_updated_pages < $this->_max_pages |
|
97 | 97 | && $i < 20) { |
98 | 98 | // Expand seek by another two weeks |
99 | 99 | $to = $from; |
@@ -61,7 +61,7 @@ |
||
61 | 61 | public function get_link($key = 0, $rel = 'alternate') |
62 | 62 | { |
63 | 63 | $link = parent::get_link($key, $rel); |
64 | - if ( $rel !== 'alternate' |
|
64 | + if ($rel !== 'alternate' |
|
65 | 65 | || $key !== 0) { |
66 | 66 | return $link; |
67 | 67 | } |
@@ -296,7 +296,8 @@ |
||
296 | 296 | // the tree. This is, for example, used by the on-delete cache invalidation. |
297 | 297 | try { |
298 | 298 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
299 | - } catch (midcom_error $e) { |
|
299 | + } |
|
300 | + catch (midcom_error $e) { |
|
300 | 301 | debug_add("Could not load GUID {$guid}, trying to continue anyway. Last error was: " . $e->getMessage(), MIDCOM_LOG_WARN); |
301 | 302 | } |
302 | 303 | if (!empty($object)) { |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | while ($parent = $object->get_parent()) { |
341 | 341 | // Verify that this topic is within the current sites tree, if it is not, |
342 | 342 | // we ignore it. |
343 | - if ( $parent instanceof midcom_db_topic |
|
343 | + if ($parent instanceof midcom_db_topic |
|
344 | 344 | && $this->is_node_in_tree($parent->id, $this->get_root_node())) { |
345 | 345 | return $parent; |
346 | 346 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $entry = "<span class=\"{$current_class}\">{$entry}</span>"; |
395 | 395 | } |
396 | 396 | } else { |
397 | - if ( !empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
397 | + if (!empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
398 | 398 | && in_array($data['napobject'][MIDCOM_NAV_GUID], $skip_guids)) { |
399 | 399 | continue; |
400 | 400 | } |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | $id = "custom-{$key}"; |
509 | 509 | |
510 | 510 | $url = "{$prefix}{$entry[MIDCOM_NAV_URL]}"; |
511 | - if ( str_starts_with($entry[MIDCOM_NAV_URL], '/') |
|
511 | + if (str_starts_with($entry[MIDCOM_NAV_URL], '/') |
|
512 | 512 | || preg_match('|^https?://|', $entry[MIDCOM_NAV_URL])) { |
513 | 513 | $url = $entry[MIDCOM_NAV_URL]; |
514 | 514 | } |
@@ -658,7 +658,8 @@ |
||
658 | 658 | && mgd_is_guid($guid)) { |
659 | 659 | try { |
660 | 660 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
661 | - } catch (midcom_error $e) { |
|
661 | + } |
|
662 | + catch (midcom_error $e) { |
|
662 | 663 | debug_add("Failed to create a metadata instance for the GUID {$guid}: " . $e->getMessage(), MIDCOM_LOG_WARN); |
663 | 664 | debug_print_r("Source was:", $source); |
664 | 665 |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | { |
255 | 255 | if (in_array($key, $this->field_config['timebased'])) { |
256 | 256 | // This is ugly, but seems the only possible way... |
257 | - if ( isset($this->__metadata->$key) |
|
257 | + if (isset($this->__metadata->$key) |
|
258 | 258 | && (string) $this->__metadata->$key !== "0001-01-01T00:00:00+00:00") { |
259 | 259 | return (int) $this->__metadata->$key->format('U'); |
260 | 260 | } |
@@ -315,11 +315,11 @@ discard block |
||
315 | 315 | } |
316 | 316 | |
317 | 317 | $now = time(); |
318 | - if ( $this->get('schedulestart') |
|
318 | + if ($this->get('schedulestart') |
|
319 | 319 | && $this->get('schedulestart') > $now) { |
320 | 320 | return false; |
321 | 321 | } |
322 | - if ( $this->get('scheduleend') |
|
322 | + if ($this->get('scheduleend') |
|
323 | 323 | && $this->get('scheduleend') < $now) { |
324 | 324 | return false; |
325 | 325 | } |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | public function is_object_visible_onsite() : bool |
336 | 336 | { |
337 | 337 | return |
338 | - ( ( midcom::get()->config->get('show_hidden_objects') |
|
338 | + ((midcom::get()->config->get('show_hidden_objects') |
|
339 | 339 | || $this->is_visible()) |
340 | - && ( midcom::get()->config->get('show_unapproved_objects') |
|
340 | + && (midcom::get()->config->get('show_unapproved_objects') |
|
341 | 341 | || $this->is_approved()) |
342 | 342 | ); |
343 | 343 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $guid = $source; |
395 | 395 | } |
396 | 396 | |
397 | - if ( $object === null |
|
397 | + if ($object === null |
|
398 | 398 | && mgd_is_guid($guid)) { |
399 | 399 | try { |
400 | 400 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | */ |
454 | 454 | public function can_unlock() : bool |
455 | 455 | { |
456 | - return ( midcom::get()->auth->user?->guid == $this->__object->metadata->locker |
|
456 | + return (midcom::get()->auth->user?->guid == $this->__object->metadata->locker |
|
457 | 457 | || $this->__object->can_do('midcom:unlock') |
458 | 458 | || midcom::get()->auth->can_user_do('midcom:unlock', class: midcom_services_auth::class)); |
459 | 459 | } |
@@ -72,7 +72,8 @@ |
||
72 | 72 | |
73 | 73 | try { |
74 | 74 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
75 | - } catch (midcom_error $e) { |
|
75 | + } |
|
76 | + catch (midcom_error $e) { |
|
76 | 77 | debug_add("Failed to resolve the GUID {$guid}, this is most probably an access denied error.", MIDCOM_LOG_ERROR); |
77 | 78 | debug_add('Last MidCOM error string: ' . $e->getMessage()); |
78 | 79 | return null; |
@@ -109,7 +109,7 @@ |
||
109 | 109 | */ |
110 | 110 | public function members_to_fields() |
111 | 111 | { |
112 | - if ( empty($this->topic_guid) |
|
112 | + if (empty($this->topic_guid) |
|
113 | 113 | || empty($this->topic_url) |
114 | 114 | || empty($this->component)) { |
115 | 115 | //if one of those is missing, we override all three to ensure consistency |