@@ -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)); |
@@ -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'); |