@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | if (!$this->_schemadb) { |
67 | 67 | $this->_schemadb = schemadb::from_path($this->_config->get('schemadb')); |
68 | 68 | |
69 | - if ( $this->_config->get('use_captcha') |
|
70 | - || ( !midcom::get()->auth->user |
|
69 | + if ($this->_config->get('use_captcha') |
|
70 | + || (!midcom::get()->auth->user |
|
71 | 71 | && $this->_config->get('use_captcha_if_anonymous'))) { |
72 | 72 | $fields = $this->_schemadb->get('comment')->get('fields'); |
73 | 73 | $fields['captcha'] = [ |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $this->_schemadb->get('comment')->set('fields', $fields); |
81 | 81 | } |
82 | 82 | |
83 | - if ( $this->_config->get('ratings_enable') |
|
83 | + if ($this->_config->get('ratings_enable') |
|
84 | 84 | && $this->_schemadb->get('comment')->has_field('rating')) { |
85 | 85 | $this->_schemadb->get('comment')->get_field('rating')['hidden'] = false; |
86 | 86 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $this->_comments = $this->_comments->execute(); |
146 | 146 | } |
147 | 147 | |
148 | - if ( midcom::get()->auth->user |
|
148 | + if (midcom::get()->auth->user |
|
149 | 149 | || $this->_config->get('allow_anonymous')) { |
150 | 150 | $this->_init_post_controller($request); |
151 | 151 | if ($response = $this->_process_post($request)) { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | private function _process_post(Request $request) |
176 | 176 | { |
177 | - if ( !midcom::get()->auth->user |
|
177 | + if (!midcom::get()->auth->user |
|
178 | 178 | && !midcom::get()->auth->request_sudo($this->_component)) { |
179 | 179 | throw new midcom_error('We were anonymous but could not acquire SUDO privileges, aborting'); |
180 | 180 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | $formdata = $this->_post_controller->get_form_values(); |
190 | - if ( $formdata['subscribe'] |
|
190 | + if ($formdata['subscribe'] |
|
191 | 191 | && midcom::get()->auth->user) { |
192 | 192 | // User wants to subscribe to receive notifications about this comments thread |
193 | 193 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | private function _get_last_modified() : int |
223 | 223 | { |
224 | - return array_reduce($this->_comments, function ($carry, net_nehmer_comments_comment $item) { |
|
224 | + return array_reduce($this->_comments, function($carry, net_nehmer_comments_comment $item) { |
|
225 | 225 | return max($item->metadata->revised, $carry); |
226 | 226 | }, 0); |
227 | 227 | } |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | $data['comment_toolbar'] = $this->populate_post_toolbar($comment); |
241 | 241 | midcom_show_style('comments-item'); |
242 | 242 | |
243 | - if ( midcom::get()->auth->admin |
|
244 | - || ( midcom::get()->auth->user |
|
243 | + if (midcom::get()->auth->admin |
|
244 | + || (midcom::get()->auth->user |
|
245 | 245 | && $comment->can_do('midgard:delete'))) { |
246 | 246 | midcom_show_style('comments-admintoolbar'); |
247 | 247 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | midcom_show_style('comments-nonefound'); |
252 | 252 | } |
253 | 253 | |
254 | - if ( midcom::get()->auth->user |
|
254 | + if (midcom::get()->auth->user |
|
255 | 255 | || $this->_config->get('allow_anonymous')) { |
256 | 256 | midcom_show_style('post-comment'); |
257 | 257 | } else { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $qb = new midcom_core_querybuilder($midcom_dba_classname); |
32 | 32 | $qb->add_constraint('metadata.revised', '>=', $since); |
33 | 33 | |
34 | - if ( $only_mine |
|
34 | + if ($only_mine |
|
35 | 35 | && $guid = midcom::get()->auth->user?->guid) { |
36 | 36 | $qb->add_constraint('metadata.authors', 'LIKE', '|' . $guid . '|'); |
37 | 37 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | continue; |
197 | 197 | } |
198 | 198 | |
199 | - if ( $object->can_do('midgard:update') |
|
199 | + if ($object->can_do('midgard:update') |
|
200 | 200 | && $object->can_do('midcom:approve')) { |
201 | 201 | $object->metadata->approve(); |
202 | 202 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('object %s approved'), $object->guid)); |
@@ -185,7 +185,8 @@ |
||
185 | 185 | |
186 | 186 | try { |
187 | 187 | $account = new midcom_core_account($person); |
188 | - } catch (midcom_error) { |
|
188 | + } |
|
189 | + catch (midcom_error) { |
|
189 | 190 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('failed to get the user with id %s'), $person->id), 'error'); |
190 | 191 | return; |
191 | 192 | } |
@@ -90,7 +90,8 @@ |
||
90 | 90 | if ($request->request->has('midcom_helper_datamanager2_save')) { |
91 | 91 | try { |
92 | 92 | $rules = $this->_load_rules($request); |
93 | - } catch (midcom_error $e) { |
|
93 | + } |
|
94 | + catch (midcom_error $e) { |
|
94 | 95 | midcom::get()->uimessages->add($this->_component, $this->_l10n->get($e->getMessage()), 'error'); |
95 | 96 | return; |
96 | 97 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $workflow = $this->get_workflow('datamanager', ['controller' => $data['controller']]); |
45 | 45 | $response = $workflow->run($request); |
46 | 46 | |
47 | - if ( $workflow->get_state() == 'save' |
|
47 | + if ($workflow->get_state() == 'save' |
|
48 | 48 | && $this->create_account($this->person, $data["controller"]->get_form_values())) { |
49 | 49 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('person %s created'), $this->person->name)); |
50 | 50 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $person = new midcom_db_person($guid); |
78 | 78 | $accounthelper = new org_openpsa_user_accounthelper($person); |
79 | 79 | if ($accounthelper->welcome_email()) { |
80 | - midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('password reset and mail to %s sent'), $person->email )); |
|
80 | + midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('password reset and mail to %s sent'), $person->email)); |
|
81 | 81 | } else { |
82 | 82 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), $accounthelper->errstr, 'error'); |
83 | 83 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $accounthelper = new org_openpsa_user_accounthelper($this->person); |
134 | 134 | |
135 | 135 | // Update account |
136 | - if ( !$accounthelper->set_account($controller->get_form_values()["username"], $password) |
|
136 | + if (!$accounthelper->set_account($controller->get_form_values()["username"], $password) |
|
137 | 137 | && midcom_connection::get_error() != MGD_ERR_OK) { |
138 | 138 | // Failure, give a message |
139 | 139 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), $this->_l10n->get("failed to update the user account, reason") . ': ' . $accounthelper->errstr, 'error'); |
@@ -82,7 +82,8 @@ discard block |
||
82 | 82 | try { |
83 | 83 | $object1 = $this->load($param->parentguid); |
84 | 84 | $object2 = $this->load($param->name); |
85 | - } catch (midcom_error) { |
|
85 | + } |
|
86 | + catch (midcom_error) { |
|
86 | 87 | $i++; |
87 | 88 | continue; |
88 | 89 | } |
@@ -160,7 +161,8 @@ discard block |
||
160 | 161 | try { |
161 | 162 | $merger = new org_openpsa_contacts_duplicates_merge($this->mode, $this->_config); |
162 | 163 | $merger->merge_delete($object1, $object2); |
163 | - } catch (midcom_error $e) { |
|
164 | + } |
|
165 | + catch (midcom_error $e) { |
|
164 | 166 | // TODO: Localize |
165 | 167 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), 'Merge failed, errstr: ' . $e->getMessage(), 'error'); |
166 | 168 | } |