@@ -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 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | private function _process_category_constraint(org_openpsa_qbpager $qb) |
77 | 77 | { |
78 | - if ( !in_array($this->category, $this->_request_data['categories']) |
|
78 | + if (!in_array($this->category, $this->_request_data['categories']) |
|
79 | 79 | && !$this->_config->get('categories_custom_enable')) { |
80 | 80 | throw new midcom_error('Custom categories are not allowed'); |
81 | 81 | // TODO: Check here if there are actually items in this cat? |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | midcom::get()->head->set_pagetitle($this->_request_data['page_title']); |
89 | 89 | |
90 | 90 | // Activate correct leaf |
91 | - if ( $this->_config->get('show_navigation_pseudo_leaves') |
|
91 | + if ($this->_config->get('show_navigation_pseudo_leaves') |
|
92 | 92 | && in_array($this->category, $this->_request_data['categories'])) { |
93 | 93 | $this->set_active_leaf($this->_topic->id . '_CAT_' . $this->category); |
94 | 94 | } |
@@ -568,10 +568,10 @@ |
||
568 | 568 | } |
569 | 569 | |
570 | 570 | //owner privileges override everything but person privileges, so we have to cross-check those here |
571 | - if ( $privilegename != 'midgard:owner' |
|
571 | + if ($privilegename != 'midgard:owner' |
|
572 | 572 | && $last_scope < MIDCOM_PRIVILEGE_SCOPE_OWNER) { |
573 | 573 | $owner_privileges = $this->get_owner_default_privileges(); |
574 | - if ( array_key_exists($privilegename, $owner_privileges) |
|
574 | + if (array_key_exists($privilegename, $owner_privileges) |
|
575 | 575 | && $this->_load_content_privilege('midgard:owner', $guid, $class, $user_id) |
576 | 576 | && self::$_content_privileges_cache[$cache_id]['midgard:owner']) { |
577 | 577 | self::$_content_privileges_cache[$cache_id][$privilegename] = ($owner_privileges[$privilegename] == MIDCOM_PRIVILEGE_ALLOW); |
@@ -253,15 +253,15 @@ |
||
253 | 253 | private static array $_default_magic_class_privileges = []; |
254 | 254 | |
255 | 255 | /** |
256 | - * Internal cache of the content privileges of users on content objects, this is |
|
257 | - * an associative array using a combination of the user identifier and the object's |
|
258 | - * guid as index. The privileges for the anonymous user use the magic |
|
259 | - * EVERYONE as user identifier. |
|
260 | - * |
|
261 | - * This must not be merged with the class-wide privileges_cache, because otherwise |
|
262 | - * class_default_privileges for child objects might be overridden by parent default |
|
263 | - * privileges |
|
264 | - */ |
|
256 | + * Internal cache of the content privileges of users on content objects, this is |
|
257 | + * an associative array using a combination of the user identifier and the object's |
|
258 | + * guid as index. The privileges for the anonymous user use the magic |
|
259 | + * EVERYONE as user identifier. |
|
260 | + * |
|
261 | + * This must not be merged with the class-wide privileges_cache, because otherwise |
|
262 | + * class_default_privileges for child objects might be overridden by parent default |
|
263 | + * privileges |
|
264 | + */ |
|
265 | 265 | private static array $_content_privileges_cache = []; |
266 | 266 | |
267 | 267 | /** |
@@ -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 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | public function setTargetUrl($url) |
29 | 29 | { |
30 | - if ( !str_starts_with($url, "/") |
|
30 | + if (!str_starts_with($url, "/") |
|
31 | 31 | && !preg_match('|^https?://|', $url)) { |
32 | 32 | $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); |
33 | 33 | if ($prefix == '') { |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | // show_unapproved_objects). Disabled by default. Unsafe to Link Prefetching! |
428 | 428 | 'metadata_approval' => false, |
429 | 429 | 'metadata_scheduling' => false, |
430 | - 'metadata_lock_timeout' => 60, // Time in minutes |
|
430 | + 'metadata_lock_timeout' => 60, // Time in minutes |
|
431 | 431 | 'staging2live_staging' => false, |
432 | 432 | |
433 | 433 | // Set the datamanager schema used by the Metadata Service |
@@ -518,12 +518,12 @@ discard block |
||
518 | 518 | return $default; |
519 | 519 | } |
520 | 520 | |
521 | - if ( $key === 'auth_type' |
|
521 | + if ($key === 'auth_type' |
|
522 | 522 | && !in_array($this->_merged_config[$key], ['Plaintext', 'Legacy', 'SHA256'])) { |
523 | 523 | throw new midcom_error('Unsupported authentication type'); |
524 | 524 | } |
525 | 525 | // Check the midcom_config site prefix for absolute local urls |
526 | - if ( $key === 'midcom_site_url' |
|
526 | + if ($key === 'midcom_site_url' |
|
527 | 527 | && str_starts_with($this->_merged_config[$key], '/')) { |
528 | 528 | $this->_merged_config[$key] = midcom::get()->get_page_prefix() . substr($this->_merged_config[$key], 1); |
529 | 529 | } |