@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | private array $_search = []; |
| 77 | 77 | |
| 78 | - public function __construct(array|client $source, string $datatype = 'json') |
|
| 78 | + public function __construct(array | client $source, string $datatype = 'json') |
|
| 79 | 79 | { |
| 80 | 80 | $this->_datatype = $datatype; |
| 81 | 81 | if ($source instanceof client) { |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | private function _convert_to_localdata() : string |
| 204 | 204 | { |
| 205 | - return "var " . $this->_grid->get_identifier() . '_entries = ' . json_encode($this->get_rows()) . ";\n"; |
|
| 205 | + return "var " . $this->_grid->get_identifier() . '_entries = ' . json_encode($this->get_rows()) . ";\n"; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | private function _render_json() |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $this->_sort_field = $query['sidx']; |
| 234 | 234 | $this->_sort_direction = strtoupper($query['sord'] ?? 'ASC'); |
| 235 | 235 | } |
| 236 | - if ( !empty($query['_search']) |
|
| 236 | + if (!empty($query['_search']) |
|
| 237 | 237 | && $query['_search'] === 'true') { |
| 238 | 238 | foreach ($query as $field => $value) { |
| 239 | 239 | if (in_array($field, ['_search', 'nd', 'page', 'rows', 'sidx', 'sord'])) { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | $this->_total_rows = $query->count(); |
| 258 | 258 | |
| 259 | - if ( $this->_datatype == 'json' |
|
| 259 | + if ($this->_datatype == 'json' |
|
| 260 | 260 | && !empty($this->_results_per_page)) { |
| 261 | 261 | $query->set_limit($this->_results_per_page); |
| 262 | 262 | if (!empty($this->_offset)) { |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | $fields[$key] = $this->detect_schema($key, $value); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if ( !isset($this->config->_local[$key]) |
|
| 61 | + if (!isset($this->config->_local[$key]) |
|
| 62 | 62 | || $this->config->_local[$key] == $this->config->_global[$key]) { |
| 63 | 63 | // No local configuration setting, note to user that this is the global value |
| 64 | 64 | $fields[$key]['title'] = $schema->get_l10n()->get($fields[$key]['title']); |
| 65 | - $fields[$key]['title'] .= " <span class=\"global\">(" . midcom::get()->i18n->get_string('global value', 'midgard.admin.asgard') .")</span>"; |
|
| 65 | + $fields[$key]['title'] .= " <span class=\"global\">(" . midcom::get()->i18n->get_string('global value', 'midgard.admin.asgard') . ")</span>"; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | /** |
| 119 | 119 | * Ensure the configuration is valid (form validation callback) |
| 120 | 120 | */ |
| 121 | - public function check_config(array $values) : array|true |
|
| 121 | + public function check_config(array $values) : array | true |
|
| 122 | 122 | { |
| 123 | 123 | $current = $this->config->get_all(); |
| 124 | 124 | $result = []; |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * |
| 29 | 29 | * @return mixed Array with error message or true on success |
| 30 | 30 | */ |
| 31 | - public function validate(array $input) : array|true |
|
| 31 | + public function validate(array $input) : array | true |
|
| 32 | 32 | { |
| 33 | 33 | $this->event->busy = $input['busy']; |
| 34 | 34 | $this->event->participants = array_flip($input['participants']); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param array $fields The form's data |
| 32 | 32 | * @return mixed True on success, array of error messages otherwise |
| 33 | 33 | */ |
| 34 | - public function validate_edit_form(array $fields) : array|true |
|
| 34 | + public function validate_edit_form(array $fields) : array | true |
|
| 35 | 35 | { |
| 36 | 36 | $result = $this->is_username_available($fields); |
| 37 | 37 | |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | * @param array $fields The form's data |
| 55 | 55 | * @return mixed True on success, array of error messages otherwise |
| 56 | 56 | */ |
| 57 | - public function validate_create_form(array $fields) : array|true |
|
| 57 | + public function validate_create_form(array $fields) : array | true |
|
| 58 | 58 | { |
| 59 | 59 | $result = $this->is_username_available($fields); |
| 60 | 60 | |
| 61 | - if ( $fields['password']['switch'] |
|
| 61 | + if ($fields['password']['switch'] |
|
| 62 | 62 | && !$this->get_accounthelper()->check_password_strength((string) $fields['password']['password'])) { |
| 63 | 63 | $result = ['password' => $this->l10n->get('password weak')]; |
| 64 | 64 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param array $fields The form's data |
| 76 | 76 | * @return mixed True on success, array of error messages otherwise |
| 77 | 77 | */ |
| 78 | - public function verify_existing_password(array $fields) : array|true |
|
| 78 | + public function verify_existing_password(array $fields) : array | true |
|
| 79 | 79 | { |
| 80 | 80 | if (midcom::get()->auth->can_user_do('org.openpsa.user:manage', class: org_openpsa_user_interface::class)) { |
| 81 | 81 | //User has the necessary rights, so we're good |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @param array $fields The form's data |
| 100 | 100 | * @return mixed True on success, array of error messages otherwise |
| 101 | 101 | */ |
| 102 | - public function username_exists(array $fields) : array|true |
|
| 102 | + public function username_exists(array $fields) : array | true |
|
| 103 | 103 | { |
| 104 | 104 | if ($this->is_username_available(['username' => $fields['username']]) === true) { |
| 105 | 105 | return ["username" => $this->l10n->get("unknown username")]; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @param array $fields The form's data |
| 114 | 114 | * @return mixed True on success, array of error messages otherwise |
| 115 | 115 | */ |
| 116 | - public function email_exists(array $fields) : array|true |
|
| 116 | + public function email_exists(array $fields) : array | true |
|
| 117 | 117 | { |
| 118 | 118 | $result = []; |
| 119 | 119 | $qb = new midgard_query_builder(midcom::get()->config->get('person_class')); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param array $fields The form's data |
| 135 | 135 | * @return mixed True on success, array of error messages otherwise |
| 136 | 136 | */ |
| 137 | - public function email_and_username_exist(array $fields) : array|true |
|
| 137 | + public function email_and_username_exist(array $fields) : array | true |
|
| 138 | 138 | { |
| 139 | 139 | $result = []; |
| 140 | 140 | $user = midcom::get()->auth->get_user_by_name($fields["username"]); |
@@ -157,15 +157,15 @@ discard block |
||
| 157 | 157 | * @param array $fields The form's data |
| 158 | 158 | * @return mixed True on success, array of error messages otherwise |
| 159 | 159 | */ |
| 160 | - public function password_check(array $fields) : array|true |
|
| 160 | + public function password_check(array $fields) : array | true |
|
| 161 | 161 | { |
| 162 | 162 | $result = []; |
| 163 | 163 | |
| 164 | 164 | $accounthelper = $this->get_accounthelper(new midcom_db_person($fields["person"])); |
| 165 | - if (!$accounthelper->check_password_reuse($fields['new_password'])){ |
|
| 165 | + if (!$accounthelper->check_password_reuse($fields['new_password'])) { |
|
| 166 | 166 | $result['password'] = $this->l10n->get('password was already used'); |
| 167 | 167 | } |
| 168 | - if (!$accounthelper->check_password_strength($fields['new_password'])){ |
|
| 168 | + if (!$accounthelper->check_password_strength($fields['new_password'])) { |
|
| 169 | 169 | $result['password'] = $this->l10n->get('password weak'); |
| 170 | 170 | } |
| 171 | 171 | return $result ?: true; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $account = $this->get_account(); |
| 152 | 152 | if (!empty($new_password)) { |
| 153 | 153 | //check if the new encrypted password was already used |
| 154 | - if ( !$this->check_password_reuse($new_password, true) |
|
| 154 | + if (!$this->check_password_reuse($new_password, true) |
|
| 155 | 155 | || !$this->check_password_strength($new_password, true)) { |
| 156 | 156 | $this->errstr = "password strength too low"; |
| 157 | 157 | return false; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $password_length = mb_strlen($password); |
| 271 | 271 | |
| 272 | 272 | if ($password_length < $this->_config->get('min_password_length')) { |
| 273 | - if ($show_ui_message){ |
|
| 273 | + if ($show_ui_message) { |
|
| 274 | 274 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.user'), $this->_l10n->get('password too short'), 'error'); |
| 275 | 275 | } |
| 276 | 276 | return false; |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | if ($score < $this->_config->get('min_password_score')) { |
| 291 | - if ($show_ui_message){ |
|
| 291 | + if ($show_ui_message) { |
|
| 292 | 292 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.user'), $this->_l10n->get('password weak'), 'error'); |
| 293 | 293 | } |
| 294 | 294 | return false; |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | public static function get_person_by_formdata(array $data) : ?midcom_db_person |
| 434 | 434 | { |
| 435 | - if ( empty($data['username']) |
|
| 435 | + if (empty($data['username']) |
|
| 436 | 436 | || empty($data['password'])) { |
| 437 | 437 | return null; |
| 438 | 438 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | $max_attempts = midcom_baseclasses_components_configuration::get($component, 'config')->get('max_password_attempts'); |
| 464 | 464 | $timeframe = midcom_baseclasses_components_configuration::get($component, 'config')->get('password_block_timeframe_min'); |
| 465 | 465 | |
| 466 | - if ( $max_attempts == 0 |
|
| 466 | + if ($max_attempts == 0 |
|
| 467 | 467 | || $timeframe == 0) { |
| 468 | 468 | return $stat; |
| 469 | 469 | } |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | * If the maximum number of attempts is reached and the oldest attempt |
| 486 | 486 | * on the stack is within our defined timeframe, we block the account |
| 487 | 487 | */ |
| 488 | - if ( count($attempts) >= $max_attempts |
|
| 488 | + if (count($attempts) >= $max_attempts |
|
| 489 | 489 | && $attempts[$max_attempts - 1] >= (time() - ($timeframe * 60))) { |
| 490 | 490 | $this->disable_account(); |
| 491 | 491 | $stat = false; |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * |
| 21 | 21 | * @param array $fields The form's data |
| 22 | 22 | */ |
| 23 | - public function is_code_available(array $fields) : array|true |
|
| 23 | + public function is_code_available(array $fields) : array | true |
|
| 24 | 24 | { |
| 25 | 25 | $result = []; |
| 26 | 26 | if (!empty($fields['id'])) { |
@@ -13,24 +13,24 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class org_openpsa_sales_validator |
| 15 | 15 | { |
| 16 | - public function validate_subscription(array $fields) : array|true |
|
| 16 | + public function validate_subscription(array $fields) : array | true |
|
| 17 | 17 | { |
| 18 | 18 | $result = $this->validate_units($fields); |
| 19 | 19 | |
| 20 | 20 | if ($result === true) { |
| 21 | 21 | $result = []; |
| 22 | 22 | } |
| 23 | - if ( empty($fields['end']) |
|
| 23 | + if (empty($fields['end']) |
|
| 24 | 24 | && empty($fields['continuous'])) { |
| 25 | 25 | $result['end'] = midcom::get()->i18n->get_string('select either end date or continuous', 'org.openpsa.sales'); |
| 26 | 26 | } |
| 27 | 27 | return $result ?: true; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function validate_units(array $fields) : array|true |
|
| 30 | + public function validate_units(array $fields) : array | true |
|
| 31 | 31 | { |
| 32 | 32 | $result = []; |
| 33 | - if ( empty($fields['invoiceByActualUnits']) |
|
| 33 | + if (empty($fields['invoiceByActualUnits']) |
|
| 34 | 34 | && empty($fields['plannedUnits'])) { |
| 35 | 35 | $result['plannedUnits'] = midcom::get()->i18n->get_string('select either planned units or invoice by actual units', 'org.openpsa.sales'); |
| 36 | 36 | return $result; |