@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * The Default constructor creates an empty privilege, if you specify |
76 | 76 | * another privilege object in the constructor, a copy is constructed. |
77 | 77 | */ |
78 | - public function __construct(midcom_core_privilege_db|array|string $src = null) |
|
78 | + public function __construct(midcom_core_privilege_db | array | string $src = null) |
|
79 | 79 | { |
80 | 80 | if (is_array($src)) { |
81 | 81 | // Store given values to our privilege array |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * - Any midcom_core_user or midcom_core_group object or subtype thereof. |
211 | 211 | * - Any string identifier which can be resolved using midcom_services_auth::get_assignee(). |
212 | 212 | */ |
213 | - public function set_assignee(midcom_core_group|midcom_core_user|string $assignee) : bool |
|
213 | + public function set_assignee(midcom_core_group | midcom_core_user | string $assignee) : bool |
|
214 | 214 | { |
215 | 215 | if (is_string($assignee)) { |
216 | 216 | if ($this->is_magic_assignee($assignee)) { |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | - if ( !$this->is_magic_assignee() |
|
269 | + if (!$this->is_magic_assignee() |
|
270 | 270 | && !$this->get_assignee()) { |
271 | 271 | debug_add("The assignee identifier '{$this->assignee}' is invalid.", MIDCOM_LOG_INFO); |
272 | 272 | return false; |
273 | 273 | } |
274 | - if ( $this->assignee == 'OWNER' |
|
274 | + if ($this->assignee == 'OWNER' |
|
275 | 275 | && $this->privilegename == 'midgard:owner') { |
276 | 276 | debug_add("Tried to assign midgard:owner to the OWNER magic assignee, this is invalid.", MIDCOM_LOG_INFO); |
277 | 277 | return false; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | MIDCOM_LOG_INFO); |
284 | 284 | return false; |
285 | 285 | } |
286 | - if ( !$object->can_do('midgard:update') |
|
286 | + if (!$object->can_do('midgard:update') |
|
287 | 287 | || !$object->can_do('midgard:privileges')) { |
288 | 288 | debug_add("Insufficient privileges on the content object with the GUID '{$this->__guid}', midgard:update and midgard:privileges required.", |
289 | 289 | MIDCOM_LOG_INFO); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * |
60 | 60 | * Any error will trigger midcom_error. |
61 | 61 | */ |
62 | - public function __construct(string|int|midcom_db_group|midgard_group $id) |
|
62 | + public function __construct(string | int | midcom_db_group | midgard_group $id) |
|
63 | 63 | { |
64 | 64 | if (is_object($id)) { |
65 | 65 | $this->_storage = $id; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * Retrieve an object, uses in-request caching |
95 | 95 | */ |
96 | - public static function get(string|int $src) : self |
|
96 | + public static function get(string | int $src) : self |
|
97 | 97 | { |
98 | 98 | static $cache = []; |
99 | 99 | |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | - if ( $this->_config->get('jabber_enable_presence') |
|
139 | + if ($this->_config->get('jabber_enable_presence') |
|
140 | 140 | && $person->get_parameter('org.openpsa.jabber', 'jid')) { |
141 | 141 | $this->contact_details['jid'] = $person->get_parameter('org.openpsa.jabber', 'jid'); |
142 | 142 | } |
143 | 143 | |
144 | - if ( $this->_config->get('skype_enable_presence') |
|
144 | + if ($this->_config->get('skype_enable_presence') |
|
145 | 145 | && $person->get_parameter('org.openpsa.skype', 'name')) { |
146 | 146 | $this->contact_details['skype'] = $person->get_parameter('org.openpsa.skype', 'name'); |
147 | 147 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if (!empty($attachments[$type])) { |
179 | 179 | return '<img class="photo" src="' . midcom_db_attachment::get_url($attachments[$type]) . '">'; |
180 | 180 | } |
181 | - if ( $this->_config->get('gravatar_enable') |
|
181 | + if ($this->_config->get('gravatar_enable') |
|
182 | 182 | && !empty($this->contact_details['email'])) { |
183 | 183 | $size = ($type == 'view') ? 500 : 32; |
184 | 184 | $gravatar_url = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->contact_details['email']))) . "?s=" . $size . '&d=identicon'; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | |
292 | 292 | private function _show_groups() |
293 | 293 | { |
294 | - if ( !$this->show_groups |
|
294 | + if (!$this->show_groups |
|
295 | 295 | || empty($this->contact_details['id'])) { |
296 | 296 | return; |
297 | 297 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $default_shown = true; |
356 | 356 | $cards_to_show[] = $cardname; |
357 | 357 | } |
358 | - } elseif ( $customer->$property |
|
358 | + } elseif ($customer->$property |
|
359 | 359 | || ($customer->street && !$inherited_cards_only && !$default_shown)) { |
360 | 360 | $inherited_cards_only = false; |
361 | 361 | $multiple_addresses = true; |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | |
378 | 378 | foreach ($cards_to_show as $cardname) { |
379 | 379 | echo '<div class="vcard">'; |
380 | - if ( $multiple_addresses |
|
381 | - || ( $cardname != 'visiting' |
|
380 | + if ($multiple_addresses |
|
381 | + || ($cardname != 'visiting' |
|
382 | 382 | && !$inherited_cards_only)) { |
383 | 383 | echo '<div style="text-align:center"><em>' . midcom::get()->i18n->get_string($cardname . ' address', 'org.openpsa.contacts') . "</em></div>\n"; |
384 | 384 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public static function get_by_object(org_openpsa_invoices_interfaces_customer $object) : self |
54 | 54 | { |
55 | - if ( !($bd = self::get_billing_data(org_openpsa_contacts_group_dba::class, $object->customer)) |
|
55 | + if (!($bd = self::get_billing_data(org_openpsa_contacts_group_dba::class, $object->customer)) |
|
56 | 56 | // check if the customerContact is set and has invoice_data |
57 | 57 | && !($bd = self::get_billing_data(org_openpsa_contacts_person_dba::class, $object->customerContact))) { |
58 | 58 | $bd = new self(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * Get the billing data for given contact if any. |
70 | 70 | */ |
71 | - private static function get_billing_data(string $dba_class, string|int $contact_id) : ?self |
|
71 | + private static function get_billing_data(string $dba_class, string | int $contact_id) : ?self |
|
72 | 72 | { |
73 | 73 | if ($contact_id == 0) { |
74 | 74 | return null; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | $buttons = []; |
56 | 56 | $workflow = new midcom\workflow\datamanager; |
57 | - if ( $this->topic->can_do('midgard:update') |
|
57 | + if ($this->topic->can_do('midgard:update') |
|
58 | 58 | && $this->topic->can_do('midcom.admin.folder:topic_management')) { |
59 | 59 | $buttons[] = $workflow->get_button("__ais/folder/edit/", [ |
60 | 60 | MIDCOM_TOOLBAR_LABEL => midcom::get()->i18n->get_string('edit folder', 'midcom.admin.folder'), |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ]; |
90 | 90 | } |
91 | 91 | $buttons = array_merge($buttons, $this->get_approval_controls($this->topic, false)); |
92 | - if ( $this->topic->can_do('midcom.admin.folder:template_management') |
|
92 | + if ($this->topic->can_do('midcom.admin.folder:template_management') |
|
93 | 93 | && midcom::get()->auth->can_user_do('midgard.admin.asgard:manage_objects', class: 'midgard_admin_asgard_plugin')) { |
94 | 94 | $enabled = false; |
95 | 95 | $styleeditor_url = ''; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | MIDCOM_TOOLBAR_ACCESSKEY => 'f', |
123 | 123 | ]); |
124 | 124 | } |
125 | - if ( $this->topic->guid !== midcom::get()->config->get('midcom_root_topic_guid') |
|
125 | + if ($this->topic->guid !== midcom::get()->config->get('midcom_root_topic_guid') |
|
126 | 126 | && $this->topic->can_do('midgard:delete')) { |
127 | 127 | $workflow = new midcom\workflow\delete(['object' => $this->topic, 'recursive' => true]); |
128 | 128 | $buttons[] = $workflow->get_button("__ais/folder/delete/", [ |
@@ -133,7 +133,7 @@ |
||
133 | 133 | */ |
134 | 134 | public function show(bool $show_simple = false) |
135 | 135 | { |
136 | - if ( $show_simple |
|
136 | + if ($show_simple |
|
137 | 137 | || !midcom::get()->auth->can_user_do('midcom:ajax', class: static::class)) { |
138 | 138 | $this->show_simple(); |
139 | 139 | return; |
@@ -272,7 +272,7 @@ |
||
272 | 272 | |
273 | 273 | private function add_head_elements(bool $centralized = false) : bool |
274 | 274 | { |
275 | - if ( !midcom::get()->auth->user |
|
275 | + if (!midcom::get()->auth->user |
|
276 | 276 | || !midcom::get()->config->get('toolbars_enable_centralized') |
277 | 277 | || !midcom::get()->auth->can_user_do('midcom:centralized_toolbar', class: __CLASS__)) { |
278 | 278 | return false; |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | if ($parent = $object->get_parent()) { |
120 | 120 | // Attachments are a special case |
121 | 121 | if ($object instanceof midcom_db_attachment) { |
122 | - if ( !$parent->can_do('midgard:attachments') |
|
122 | + if (!$parent->can_do('midgard:attachments') |
|
123 | 123 | || !$parent->can_do('midgard:update')) { |
124 | 124 | debug_add("Failed to create attachment, update or attachments privilege on the parent " . get_class($parent) . " {$parent->guid} not granted for the current user.", |
125 | 125 | MIDCOM_LOG_ERROR); |
126 | 126 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
127 | 127 | return false; |
128 | 128 | } |
129 | - } elseif ( !$parent->can_do('midgard:create') |
|
129 | + } elseif (!$parent->can_do('midgard:create') |
|
130 | 130 | && !midcom::get()->auth->can_user_do('midgard:create', class: get_class($object))) { |
131 | 131 | debug_add("Failed to create object, create privilege on the parent " . get_class($parent) . " {$parent->guid} or the actual object class not granted for the current user.", |
132 | 132 | MIDCOM_LOG_ERROR); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | // Default the owner to first group of current user |
241 | - if ( empty($object->metadata->owner) |
|
241 | + if (empty($object->metadata->owner) |
|
242 | 242 | && $first_group = midcom::get()->auth->user->get_first_group_guid()) { |
243 | 243 | $object->metadata->set('owner', $first_group); |
244 | 244 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public static function get_by_guid(midcom_core_dbaobject $object, string $guid) : bool |
464 | 464 | { |
465 | - if ( !midcom::get()->auth->admin |
|
465 | + if (!midcom::get()->auth->admin |
|
466 | 466 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $guid, get_class($object), midcom::get()->auth->acl->get_user_id())) { |
467 | 467 | debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$guid} not granted for the current user.", MIDCOM_LOG_ERROR); |
468 | 468 | return false; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $invoices_url = $siteconfig->get_node_full_url('org.openpsa.invoices'); |
100 | 100 | $user_url = $siteconfig->get_node_full_url('org.openpsa.user'); |
101 | 101 | |
102 | - if ( $invoices_url |
|
102 | + if ($invoices_url |
|
103 | 103 | && midcom::get()->auth->can_user_do('midgard:create', class: org_openpsa_invoices_invoice_dba::class) |
104 | 104 | && $this->_contact->can_do('midgard:update')) { |
105 | 105 | $buttons[] = $workflow->get_button($invoices_url . "billingdata/" . $this->_contact->guid . '/', [ |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | ]); |
109 | 109 | } |
110 | 110 | |
111 | - if ( $user_url |
|
112 | - && ( midcom::get()->auth->user->guid == $this->_contact->guid |
|
111 | + if ($user_url |
|
112 | + && (midcom::get()->auth->user->guid == $this->_contact->guid |
|
113 | 113 | || midcom::get()->auth->can_user_do('org.openpsa.user:access', class: org_openpsa_user_interface::class))) { |
114 | 114 | $buttons[] = [ |
115 | 115 | MIDCOM_TOOLBAR_URL => $user_url . "view/{$this->_contact->guid}/", |