@@ -26,11 +26,11 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function configureOptions(OptionsResolver $resolver) |
| 28 | 28 | { |
| 29 | - $resolver->setDefault('config', function (Options $options) { |
|
| 29 | + $resolver->setDefault('config', function(Options $options) { |
|
| 30 | 30 | return \midcom_baseclasses_components_configuration::get('midcom.datamanager', 'config'); |
| 31 | 31 | }); |
| 32 | 32 | |
| 33 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
| 33 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
| 34 | 34 | $widget_defaults = [ |
| 35 | 35 | 'mode' => 'exact', |
| 36 | 36 | 'theme' => $options['config']->get('tinymce_default_theme'), |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | protected function prepare_storage() |
| 57 | 57 | { |
| 58 | - $cookie_secure = ( !empty($_SERVER['HTTPS']) |
|
| 58 | + $cookie_secure = (!empty($_SERVER['HTTPS']) |
|
| 59 | 59 | && $_SERVER['HTTPS'] !== 'off' |
| 60 | 60 | && midcom::get()->config->get('auth_backend_simple_cookie_secure')); |
| 61 | 61 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | ksort($constraints); |
| 90 | 90 | foreach ($constraints as $key => $data) { |
| 91 | - if ( !array_key_exists('value', $data) |
|
| 91 | + if (!array_key_exists('value', $data) |
|
| 92 | 92 | || empty($data['field']) |
| 93 | 93 | || empty($data['op'])) { |
| 94 | 94 | debug_add("Constraint #{$key} is not correctly defined, skipping", MIDCOM_LOG_WARN); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | { |
| 150 | 150 | $query = $this->request["term"]; |
| 151 | 151 | $wildcard_query = $query; |
| 152 | - if ( isset($this->request['auto_wildcards']) |
|
| 152 | + if (isset($this->request['auto_wildcards']) |
|
| 153 | 153 | && strpos($query, '%') === false) { |
| 154 | 154 | switch ($this->request['auto_wildcards']) { |
| 155 | 155 | case 'start': |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | break; |
| 306 | 306 | } |
| 307 | - } elseif ( $item_name == 'username' |
|
| 307 | + } elseif ($item_name == 'username' |
|
| 308 | 308 | && $object instanceof midcom_db_person) { |
| 309 | 309 | $account = new midcom_core_account($object); |
| 310 | 310 | return self::sanitize_label($account->get_username()); |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | $view->vars['readonly'] = $options['readonly']; |
| 57 | 57 | |
| 58 | 58 | if ($options['write_privilege'] !== null) { |
| 59 | - if ( array_key_exists('group', $options['write_privilege']) |
|
| 59 | + if (array_key_exists('group', $options['write_privilege']) |
|
| 60 | 60 | && !midcom::get()->auth->is_group_member($options['write_privilege']['group'])) { |
| 61 | 61 | $view->vars['readonly'] = true; |
| 62 | 62 | } |
@@ -12,10 +12,10 @@ |
||
| 12 | 12 | { |
| 13 | 13 | public function validate($value, Constraint $constraint) |
| 14 | 14 | { |
| 15 | - if ( empty($value) |
|
| 15 | + if (empty($value) |
|
| 16 | 16 | || !empty($value['delete']) |
| 17 | - || ( empty($value['file']) |
|
| 18 | - && ( empty($constraint->config['do_not_save_archival']) && empty($value['archival']) |
|
| 17 | + || (empty($value['file']) |
|
| 18 | + && (empty($constraint->config['do_not_save_archival']) && empty($value['archival']) |
|
| 19 | 19 | xor empty($value['main'])))) { |
| 20 | 20 | $this->context->buildViolation('This value should not be blank.') |
| 21 | 21 | ->addViolation(); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'max_count' => 0 |
| 42 | 42 | ] |
| 43 | 43 | ]); |
| 44 | - $resolver->setNormalizer('constraints', function (Options $options, $value) { |
|
| 44 | + $resolver->setNormalizer('constraints', function(Options $options, $value) { |
|
| 45 | 45 | $validation = []; |
| 46 | 46 | if ($options['type_config']['max_count'] > 0) { |
| 47 | 47 | $validation['max'] = $options['type_config']['max_count']; |
@@ -54,13 +54,13 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | return $validation; |
| 56 | 56 | }); |
| 57 | - $resolver->setNormalizer('entry_options', function (Options $options, $value) { |
|
| 57 | + $resolver->setNormalizer('entry_options', function(Options $options, $value) { |
|
| 58 | 58 | return array_replace([ |
| 59 | 59 | 'required' => false, //@todo no idea why this is necessary |
| 60 | 60 | 'widget_config' => $options['widget_config'] |
| 61 | 61 | ], (array) $value); |
| 62 | 62 | }); |
| 63 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
| 63 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
| 64 | 64 | if (!array_key_exists('sortable', $value)) { |
| 65 | 65 | $value['sortable'] = false; |
| 66 | 66 | } |
@@ -68,7 +68,8 @@ discard block |
||
| 68 | 68 | $field['type_config']['options'] = [0 => '', $customer->id => $customer->official]; |
| 69 | 69 | |
| 70 | 70 | $defaults['customer'] = $customer->id; |
| 71 | - } catch (midcom_error $e) { |
|
| 71 | + } |
|
| 72 | + catch (midcom_error $e) { |
|
| 72 | 73 | $customer = new org_openpsa_contacts_person_dba($guid); |
| 73 | 74 | $defaults['customerContact'] = $customer->id; |
| 74 | 75 | $field['type_config']['options'] = $this->list_groups(new org_openpsa_sales_salesproject_dba, [$customer->id => true]); |
@@ -142,7 +143,8 @@ discard block |
||
| 142 | 143 | try { |
| 143 | 144 | $company = org_openpsa_contacts_group_dba::get_cached($company_id); |
| 144 | 145 | $ret[$company->id] = $company->get_label(); |
| 145 | - } catch (midcom_error $e) { |
|
| 146 | + } |
|
| 147 | + catch (midcom_error $e) { |
|
| 146 | 148 | $e->log(); |
| 147 | 149 | } |
| 148 | 150 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | $schemadb = schemadb::from_path($this->_config->get('schemadb_salesproject')); |
| 62 | 62 | |
| 63 | 63 | if (!empty($guid)) { |
| 64 | - $field =& $schemadb->get('default')->get_field('customer'); |
|
| 64 | + $field = & $schemadb->get('default')->get_field('customer'); |
|
| 65 | 65 | try { |
| 66 | 66 | $customer = new org_openpsa_contacts_group_dba($guid); |
| 67 | 67 | $field['type_config']['options'] = [0 => '', $customer->id => $customer->official]; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $result = $this->is_username_available($fields); |
| 48 | 48 | |
| 49 | 49 | $accounthelper = new org_openpsa_user_accounthelper(); |
| 50 | - if ($fields['password']['switch'] && !$accounthelper->check_password_strength($fields['password']['password'])){ |
|
| 50 | + if ($fields['password']['switch'] && !$accounthelper->check_password_strength($fields['password']['password'])) { |
|
| 51 | 51 | $result = ['password' => midcom::get()->i18n->get_string('password weak', 'org.openpsa.user')]; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | $user = new midcom_db_person($fields["person"]); |
| 156 | 156 | |
| 157 | 157 | $accounthelper = new org_openpsa_user_accounthelper($user); |
| 158 | - if (!$accounthelper->check_password_reuse($fields['new_password'])){ |
|
| 158 | + if (!$accounthelper->check_password_reuse($fields['new_password'])) { |
|
| 159 | 159 | $result['password'] = midcom::get()->i18n->get_string('password was already used', 'org.openpsa.user'); |
| 160 | 160 | } |
| 161 | - if (!$accounthelper->check_password_strength($fields['new_password'])){ |
|
| 161 | + if (!$accounthelper->check_password_strength($fields['new_password'])) { |
|
| 162 | 162 | $result['password'] = midcom::get()->i18n->get_string('password weak', 'org.openpsa.user'); |
| 163 | 163 | } |
| 164 | 164 | if (!empty($result)) { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $result = $this->is_username_available($fields); |
| 48 | 48 | |
| 49 | 49 | $accounthelper = new org_openpsa_user_accounthelper(); |
| 50 | - if ($fields['password']['switch'] && !$accounthelper->check_password_strength($fields['password']['password'])){ |
|
| 50 | + if ($fields['password']['switch'] && !$accounthelper->check_password_strength($fields['password']['password'])) { |
|
| 51 | 51 | $result = ['password' => midcom::get()->i18n->get_string('password weak', 'org.openpsa.user')]; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | $user = new midcom_db_person($fields["person"]); |
| 156 | 156 | |
| 157 | 157 | $accounthelper = new org_openpsa_user_accounthelper($user); |
| 158 | - if (!$accounthelper->check_password_reuse($fields['new_password'])){ |
|
| 158 | + if (!$accounthelper->check_password_reuse($fields['new_password'])) { |
|
| 159 | 159 | $result['password'] = midcom::get()->i18n->get_string('password was already used', 'org.openpsa.user'); |
| 160 | 160 | } |
| 161 | - if (!$accounthelper->check_password_strength($fields['new_password'])){ |
|
| 161 | + if (!$accounthelper->check_password_strength($fields['new_password'])) { |
|
| 162 | 162 | $result['password'] = midcom::get()->i18n->get_string('password weak', 'org.openpsa.user'); |
| 163 | 163 | } |
| 164 | 164 | if (!empty($result)) { |
@@ -29,8 +29,8 @@ |
||
| 29 | 29 | $mc->add_constraint('authtype', '=', midcom::get()->config->get('auth_type')); |
| 30 | 30 | $mc->execute(); |
| 31 | 31 | $keys = $mc->list_keys(); |
| 32 | - if ( count($keys) > 0 |
|
| 33 | - && ( !isset($fields['person']) |
|
| 32 | + if (count($keys) > 0 |
|
| 33 | + && (!isset($fields['person']) |
|
| 34 | 34 | || key($keys) != $fields['person'])) { |
| 35 | 35 | return [ |
| 36 | 36 | "username" => sprintf(midcom::get()->i18n->get_string("username %s is already in use", "midgard.admin.user"), $fields['username']) |