@@ -48,7 +48,8 @@ |
||
48 | 48 | try { |
49 | 49 | $pdf_helper->render_and_attach(); |
50 | 50 | return $this->reply(true, $this->_l10n->get('pdf created')); |
51 | - } catch (midcom_error $e) { |
|
51 | + } |
|
52 | + catch (midcom_error $e) { |
|
52 | 53 | return $this->reply(false, $this->_l10n->get('pdf creation failed') . ': ' . $e->getMessage()); |
53 | 54 | } |
54 | 55 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | $this->_add_visibility_checks(); |
107 | 107 | |
108 | - if ( empty($this->_limit) |
|
108 | + if (empty($this->_limit) |
|
109 | 109 | && empty($this->_offset)) { |
110 | 110 | // No point to do windowing |
111 | 111 | $newresult = $this->_execute_and_check_privileges(); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | $this->_query->set_limit($window_size); |
152 | 152 | |
153 | - while ( ($resultset = $this->_execute_and_check_privileges()) |
|
153 | + while (($resultset = $this->_execute_and_check_privileges()) |
|
154 | 154 | || $this->denied > $denied) { |
155 | 155 | $size = count($resultset); |
156 | 156 | $total_size = $size + ($this->denied - $denied); |
@@ -25,7 +25,8 @@ |
||
25 | 25 | { |
26 | 26 | try { |
27 | 27 | $viewer->register_plugin_namespace('__feeds', ['rss' => ['class' => __CLASS__]]); |
28 | - } catch (midcom_error $e) { |
|
28 | + } |
|
29 | + catch (midcom_error $e) { |
|
29 | 30 | $e->log(); |
30 | 31 | } |
31 | 32 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | // Hide the articles that have the publish time in the future and if |
43 | 43 | // the user is not administrator |
44 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
44 | + if ($this->_config->get('enable_scheduled_publishing') |
|
45 | 45 | && !midcom::get()->auth->admin) { |
46 | 46 | // Show the article only if the publishing time has passed or the viewer |
47 | 47 | // is the author |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | |
84 | 84 | private function _add_pseudo_leaves(array &$leaves) |
85 | 85 | { |
86 | - if ( $this->_config->get('archive_enable') |
|
86 | + if ($this->_config->get('archive_enable') |
|
87 | 87 | && $this->_config->get('archive_in_navigation')) { |
88 | 88 | $leaves["{$this->_topic->id}_ARCHIVE"] = [ |
89 | 89 | MIDCOM_NAV_URL => "archive/", |
90 | 90 | MIDCOM_NAV_NAME => $this->_l10n->get('archive'), |
91 | 91 | ]; |
92 | 92 | } |
93 | - if ( $this->_config->get('rss_enable') |
|
93 | + if ($this->_config->get('rss_enable') |
|
94 | 94 | && $this->_config->get('feeds_in_navigation')) { |
95 | 95 | $leaves[self::LEAFID_FEEDS] = [ |
96 | 96 | MIDCOM_NAV_URL => "feeds/", |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ]; |
99 | 99 | } |
100 | 100 | |
101 | - if ( $this->_config->get('categories_in_navigation') |
|
101 | + if ($this->_config->get('categories_in_navigation') |
|
102 | 102 | && $this->_config->get('categories') != '') { |
103 | 103 | $categories = explode(',', $this->_config->get('categories')); |
104 | 104 | foreach ($categories as $category) { |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - if ( $this->_config->get('archive_years_in_navigation') |
|
112 | + if ($this->_config->get('archive_years_in_navigation') |
|
113 | 113 | && $this->_config->get('archive_years_enable')) { |
114 | 114 | $qb = midcom_db_article::new_query_builder(); |
115 | 115 | $qb->add_constraint('topic', '=', $this->_topic->id); |
116 | 116 | |
117 | 117 | // Hide the articles that have the publish time in the future and if |
118 | 118 | // the user is not administrator |
119 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
119 | + if ($this->_config->get('enable_scheduled_publishing') |
|
120 | 120 | && !midcom::get()->auth->admin) { |
121 | 121 | // Show the article only if the publishing time has passed or the viewer |
122 | 122 | // is the author |
@@ -73,7 +73,7 @@ |
||
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - if ( $this->_topic->can_do('midgard:update') |
|
76 | + if ($this->_topic->can_do('midgard:update') |
|
77 | 77 | && $this->_topic->can_do('midcom:component_config')) { |
78 | 78 | $buttons[] = $workflow->get_button('config/', [ |
79 | 79 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), |
@@ -94,7 +94,7 @@ |
||
94 | 94 | 'midcom' => [ |
95 | 95 | 'style-init' => '', |
96 | 96 | 'style-finish' => '', |
97 | - ] |
|
97 | + ] |
|
98 | 98 | ], |
99 | 99 | 'nodes' => [], |
100 | 100 | ]; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct(array &$data) |
24 | 24 | { |
25 | - $this->_data =& $data; |
|
25 | + $this->_data = & $data; |
|
26 | 26 | midcom::get()->head->enable_jquery_ui(['accordion']); |
27 | 27 | } |
28 | 28 | |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | - if ( midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_style') |
|
36 | - && ( $this->_data['handler_id'] !== 'object_create' |
|
35 | + if (midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_style') |
|
36 | + && ($this->_data['handler_id'] !== 'object_create' |
|
37 | 37 | || $this->_data['current_type'] == 'midgard_element')) { |
38 | 38 | // Suggest element names to create under a style |
39 | 39 | $this->_data['help_style_elementnames'] = $this->_get_style_elements_and_nodes($this->_data['object']->id); |
40 | 40 | midcom_show_style('midgard_admin_asgard_stylehelper_elementnames'); |
41 | 41 | |
42 | - } elseif ( midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_element') |
|
42 | + } elseif (midcom::get()->dbfactory->is_a($this->_data['object'], 'midgard_element') |
|
43 | 43 | && $this->_get_help_element()) { |
44 | 44 | midcom_show_style('midgard_admin_asgard_stylehelper_element'); |
45 | 45 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | private function _get_help_element() : bool |
49 | 49 | { |
50 | - if ( empty($this->_data['object']->name) |
|
50 | + if (empty($this->_data['object']->name) |
|
51 | 51 | || empty($this->_data['object']->style)) { |
52 | 52 | // We cannot help with empty elements |
53 | 53 | return false; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | ]); |
55 | 55 | } |
56 | 56 | |
57 | - if ( midcom::get()->config->get('midcom_services_rcs_enable') |
|
57 | + if (midcom::get()->config->get('midcom_services_rcs_enable') |
|
58 | 58 | && $object->can_do('midgard:update') |
59 | 59 | && $object->_use_rcs) { |
60 | 60 | $buttons[] = [ |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | $icon = 'stock-icons/16x16/page-' . $icontype . '.png'; |
87 | - if ( !midcom::get()->config->get('show_hidden_objects') |
|
87 | + if (!midcom::get()->config->get('show_hidden_objects') |
|
88 | 88 | && !$object->metadata->is_visible()) { |
89 | 89 | // Take scheduling into account |
90 | 90 | $icon = 'stock-icons/16x16/page-' . $icontype . '-notpublished.png'; |
@@ -123,7 +123,8 @@ |
||
123 | 123 | $row = []; |
124 | 124 | try { |
125 | 125 | $row['person'] = org_openpsa_contacts_person_dba::get_cached($hour->person); |
126 | - } catch (midcom_error $e) { |
|
126 | + } |
|
127 | + catch (midcom_error $e) { |
|
127 | 128 | $e->log(); |
128 | 129 | continue; |
129 | 130 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $qb_hr = org_openpsa_expenses_hour_report_dba::new_query_builder(); |
44 | 44 | $qb_hr->add_constraint('date', '<=', (int) $this->_request_data['query_data']['end']); |
45 | 45 | $qb_hr->add_constraint('date', '>=', (int) $this->_request_data['query_data']['start']); |
46 | - if ( array_key_exists('invoiceable_filter', $this->_request_data['query_data']) |
|
46 | + if (array_key_exists('invoiceable_filter', $this->_request_data['query_data']) |
|
47 | 47 | && $this->_request_data['query_data']['invoiceable_filter'] != -1) { |
48 | 48 | $qb_hr->add_constraint('invoiceable', '=', (bool) $this->_request_data['query_data']['invoiceable_filter']); |
49 | 49 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $tasks = $this->_expand_task($this->_request_data['query_data']['task']); |
59 | 59 | $qb_hr->add_constraint('task', 'IN', $tasks); |
60 | 60 | } |
61 | - if ( array_key_exists('hour_type_filter', $this->_request_data['query_data']) |
|
61 | + if (array_key_exists('hour_type_filter', $this->_request_data['query_data']) |
|
62 | 62 | && $this->_request_data['query_data']['hour_type_filter'] != 'builtin:all') { |
63 | 63 | $qb_hr->add_constraint('reportType', '=', $this->_request_data['query_data']['hour_type_filter']); |
64 | 64 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | private function add_to_group(array $new_row, string $matching, string $sort, string $title) |
148 | 148 | { |
149 | - $rows =& $this->_request_data['report']['rows']; |
|
149 | + $rows = & $this->_request_data['report']['rows']; |
|
150 | 150 | if (array_key_exists($matching, $rows)) { |
151 | 151 | $rows[$matching]['rows'][] = $new_row; |
152 | 152 | $rows[$matching]['total_hours'] += $new_row['hour']->hours; |
@@ -222,7 +222,8 @@ discard block |
||
222 | 222 | $this->_backend->send($person, $member, $token, $subject, $content, $from); |
223 | 223 | self::$_messages_sent++; |
224 | 224 | $status = org_openpsa_directmarketing_campaign_messagereceipt_dba::SENT; |
225 | - } catch (midcom_error $e) { |
|
225 | + } |
|
226 | + catch (midcom_error $e) { |
|
226 | 227 | $status = org_openpsa_directmarketing_campaign_messagereceipt_dba::FAILURE; |
227 | 228 | if (!$this->test_mode) { |
228 | 229 | $params[] = [ |
@@ -279,7 +280,8 @@ discard block |
||
279 | 280 | { |
280 | 281 | try { |
281 | 282 | $person = org_openpsa_contacts_person_dba::get_cached($member->person); |
282 | - } catch (midcom_error $e) { |
|
283 | + } |
|
284 | + catch (midcom_error $e) { |
|
283 | 285 | debug_add("Person #{$member->person} deleted or missing, removing member (member #{$member->id})"); |
284 | 286 | $member->orgOpenpsaObtype = org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED; |
285 | 287 | $member->delete(); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->from = $from; |
76 | 76 | $this->subject = $subject; |
77 | 77 | |
78 | - if ( $message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_TEXT |
|
78 | + if ($message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_TEXT |
|
79 | 79 | && $message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_HTML) { |
80 | 80 | throw new midcom_error('unsupported message type'); |
81 | 81 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $token .= midcom_helper_misc::random_string($this->token_size - 1, 'abcdefghijklmnopqrstuvwxyz0123456789'); |
220 | 220 | |
221 | 221 | //If token is not free or (very, very unlikely) matches our dummy token, recurse. |
222 | - if ( $token === 'dummy' |
|
222 | + if ($token === 'dummy' |
|
223 | 223 | || !org_openpsa_directmarketing_campaign_messagereceipt_dba::token_is_free($token)) { |
224 | 224 | return $this->_create_token(); |
225 | 225 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | return null; |
241 | 241 | } |
242 | 242 | $type = $this->_backend->get_type(); |
243 | - if ( $person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
243 | + if ($person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
244 | 244 | || $person->get_parameter('org.openpsa.directmarketing', "send_{$type}_denied")) { |
245 | 245 | debug_add("Sending {$type} messages to person {$person->rname} is denied, unsubscribing member (member #{$member->id})"); |
246 | 246 | $member->orgOpenpsaObtype = org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED; |