@@ -62,7 +62,8 @@ |
||
62 | 62 | try { |
63 | 63 | $this->__object = call_user_func([$this->__midcom_class_name__, 'get_cached'], $this->__identifier); |
64 | 64 | return true; |
65 | - } catch (midcom_error $e) { |
|
65 | + } |
|
66 | + catch (midcom_error $e) { |
|
66 | 67 | $e->log(); |
67 | 68 | } |
68 | 69 | return false; |
@@ -553,7 +553,8 @@ |
||
553 | 553 | $tree = []; |
554 | 554 | try { |
555 | 555 | $children = self::get_child_objects($parent); |
556 | - } catch (midcom_error $e) { |
|
556 | + } |
|
557 | + catch (midcom_error $e) { |
|
557 | 558 | return $tree; |
558 | 559 | } |
559 | 560 |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | private static function _check_permissions(bool $deleted) : bool |
149 | 149 | { |
150 | 150 | // PONDER: Check for some generic user privilege instead ?? |
151 | - if ( $deleted |
|
151 | + if ($deleted |
|
152 | 152 | && !midcom_connection::is_admin() |
153 | 153 | && !midcom::get()->auth->is_component_sudo()) { |
154 | 154 | debug_add('Non-admins are not allowed to list deleted objects', MIDCOM_LOG_ERROR); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | 'target' => $ref->get_link_target($field) |
233 | 233 | ]; |
234 | 234 | $linked_class = $ref->get_link_name($field); |
235 | - if ( empty($linked_class) |
|
235 | + if (empty($linked_class) |
|
236 | 236 | && $info['type'] === MGD_TYPE_GUID) { |
237 | 237 | // Guid link without class specification, valid for all classes |
238 | 238 | if (empty($info['target'])) { |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $field_type = $field_data['type']; |
283 | 283 | $field = $field_data['name']; |
284 | 284 | |
285 | - if ( !$field_target |
|
285 | + if (!$field_target |
|
286 | 286 | || !isset($for_object->$field_target)) { |
287 | 287 | // Why return false ??? |
288 | 288 | return false; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $parent_property = midgard_object_class::get_property_parent($schema_type); |
395 | 395 | $up_property = midgard_object_class::get_property_up($schema_type); |
396 | 396 | |
397 | - if ( !$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class) |
|
397 | + if (!$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class) |
|
398 | 398 | && !$this->_resolve_child_classes_links_back($up_property, $schema_type, $this->mgdschema_class)) { |
399 | 399 | continue; |
400 | 400 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | |
419 | 419 | $ref = new midgard_reflection_property($prospect_type); |
420 | 420 | $link_class = $ref->get_link_name($property); |
421 | - if ( empty($link_class) |
|
421 | + if (empty($link_class) |
|
422 | 422 | && $ref->get_midgard_type($property) === MGD_TYPE_GUID) { |
423 | 423 | return true; |
424 | 424 | } |
@@ -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'; |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | $classes = []; |
339 | 339 | |
340 | 340 | if ($child[MIDCOM_NAV_TYPE] === 'node') { |
341 | - if ( $item[MIDCOM_NAV_ID] === $this->_nap->get_current_node() |
|
342 | - && ( !$this->_nap->get_current_leaf() |
|
341 | + if ($item[MIDCOM_NAV_ID] === $this->_nap->get_current_node() |
|
342 | + && (!$this->_nap->get_current_leaf() |
|
343 | 343 | || !$this->_nap->get_leaf($this->_nap->get_current_leaf()))) { |
344 | 344 | $classes[] = $this->css_active; |
345 | 345 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | } |
387 | 387 | |
388 | 388 | // Add information about the object's status |
389 | - if ( $this->object_status_to_class |
|
389 | + if ($this->object_status_to_class |
|
390 | 390 | && isset($item[MIDCOM_NAV_OBJECT]) |
391 | 391 | && $css_status_class = midcom::get()->metadata->get_object_classes($item[MIDCOM_NAV_OBJECT])) { |
392 | 392 | $classes[] = $css_status_class; |
@@ -405,12 +405,12 @@ discard block |
||
405 | 405 | echo "<a href=\"{$item[MIDCOM_NAV_ABSOLUTEURL]}\"{$link_class}>{$item[MIDCOM_NAV_NAME]}</a>"; |
406 | 406 | // If either of the follow nodes switches is on, follow all the nodes |
407 | 407 | |
408 | - if ( $item[MIDCOM_NAV_TYPE] === 'node' |
|
408 | + if ($item[MIDCOM_NAV_TYPE] === 'node' |
|
409 | 409 | && !$this->show_only_current |
410 | - && ( $this->list_levels === 0 |
|
410 | + && ($this->list_levels === 0 |
|
411 | 411 | || $this->_level < $this->list_levels)) { |
412 | - if ( $this->follow_all |
|
413 | - || ( $this->follow_selected |
|
412 | + if ($this->follow_all |
|
413 | + || ($this->follow_selected |
|
414 | 414 | && in_array($item[MIDCOM_NAV_ID], $this->node_path, true))) { |
415 | 415 | $this->_level++; |
416 | 416 | $this->_list_child_elements($item[MIDCOM_NAV_ID]); |
@@ -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; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | $recipient = $_ENV["RECIPIENT"]; |
47 | 47 | $token_length = strlen($recipient) - strlen($prefix) - strlen($suffix); |
48 | -if ( $token_length <= 0 |
|
48 | +if ($token_length <= 0 |
|
49 | 49 | || substr($recipient, 0, strlen($prefix)) != $prefix |
50 | 50 | || substr($recipient, strlen($prefix) + $token_length) != $suffix) { |
51 | 51 | error_log("Recipient address does not match address template: $recipient"); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | fclose($fh); |
62 | 62 | exit(0); |
63 | 63 | } |
64 | -} elseif ( substr($BOUNCE_LOGGER, 0, strlen("http://")) == "http://" |
|
64 | +} elseif (substr($BOUNCE_LOGGER, 0, strlen("http://")) == "http://" |
|
65 | 65 | || substr($BOUNCE_LOGGER, 0, strlen("https://")) == "https://") { |
66 | 66 | $client = new org_openpsa_httplib(); |
67 | 67 | $client->post($BOUNCE_LOGGER, ["token" => $token]); |
@@ -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(); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $this->from = $from; |
80 | 80 | $this->subject = $subject; |
81 | 81 | |
82 | - if ( $this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_TEXT |
|
82 | + if ($this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_TEXT |
|
83 | 83 | && $this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_HTML) { |
84 | 84 | throw new midcom_error('unsupported message type'); |
85 | 85 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $token .= midcom_helper_misc::random_string($this->token_size - 1, 'abcdefghijklmnopqrstuvwxyz0123456789'); |
226 | 226 | |
227 | 227 | //If token is not free or (very, very unlikely) matches our dummy token, recurse. |
228 | - if ( $token === 'dummy' |
|
228 | + if ($token === 'dummy' |
|
229 | 229 | || !org_openpsa_directmarketing_campaign_messagereceipt_dba::token_is_free($token)) { |
230 | 230 | return $this->_create_token(); |
231 | 231 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | return false; |
250 | 250 | } |
251 | 251 | $type = $this->_backend->get_type(); |
252 | - if ( $person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
252 | + if ($person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
253 | 253 | || $person->get_parameter('org.openpsa.directmarketing', "send_{$type}_denied")) { |
254 | 254 | debug_add("Sending {$type} messages to person {$person->rname} is denied, unsubscribing member (member #{$member->id})"); |
255 | 255 | $member->orgOpenpsaObtype = org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return; |
75 | 75 | } |
76 | 76 | $parent = $this->get_parent(); |
77 | - if ( $parent |
|
77 | + if ($parent |
|
78 | 78 | && $parent->component == 'org.openpsa.documents') { |
79 | 79 | midcom::get()->auth->request_sudo('org.openpsa.documents'); |
80 | 80 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * if nothing matched so far and the subtype is alphanumeric, uppercase it on the theory |
171 | 171 | * that it's probably a file extension |
172 | 172 | */ |
173 | - if ( $st_orig == $subtype |
|
173 | + if ($st_orig == $subtype |
|
174 | 174 | && preg_match('/^[a-z0-9]+$/', $subtype)) { |
175 | 175 | $subtype = strtoupper($subtype); |
176 | 176 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $properties = $this->get_properties(); |
186 | 186 | // Copy current properties |
187 | 187 | foreach ($properties as $key) { |
188 | - if ( $key != 'guid' |
|
188 | + if ($key != 'guid' |
|
189 | 189 | && $key != 'id' |
190 | 190 | && $key != 'metadata') { |
191 | 191 | $backup->$key = $this->{$key}; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $backup_attachment = $backup->create_attachment($original_attachment->name, $original_attachment->title, $original_attachment->mimetype); |
218 | 218 | |
219 | 219 | $original_handle = $original_attachment->open('r'); |
220 | - if ( !$backup_attachment |
|
220 | + if (!$backup_attachment |
|
221 | 221 | || !$original_handle) { |
222 | 222 | // Failed to copy the attachment, abort |
223 | 223 | return $backup->delete(); |
@@ -82,7 +82,7 @@ |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | // OPML subscription list import support |
85 | - if ( array_key_exists('net_nemein_rss_manage_opml', $_FILES) |
|
85 | + if (array_key_exists('net_nemein_rss_manage_opml', $_FILES) |
|
86 | 86 | && is_uploaded_file($_FILES['net_nemein_rss_manage_opml']['tmp_name'])) { |
87 | 87 | $opml_file = $_FILES['net_nemein_rss_manage_opml']['tmp_name']; |
88 | 88 |