@@ -28,10 +28,10 @@ |
||
28 | 28 | */ |
29 | 29 | private function load_controller() |
30 | 30 | { |
31 | - if ( $this->_config->get('simple_name_handling') |
|
31 | + if ($this->_config->get('simple_name_handling') |
|
32 | 32 | && !midcom::get()->auth->admin) { |
33 | 33 | foreach ($this->_request_data['schemadb']->all() as $schema) { |
34 | - $field =& $schema->get_field('name'); |
|
34 | + $field = & $schema->get_field('name'); |
|
35 | 35 | $field['readonly'] = true; |
36 | 36 | } |
37 | 37 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | private function load_controller($schemaname, array $defaults) |
33 | 33 | { |
34 | 34 | if ($this->_config->get('simple_name_handling')) { |
35 | - $field =& $this->_request_data['schemadb']->get($schemaname)->get_field('name'); |
|
35 | + $field = & $this->_request_data['schemadb']->get($schemaname)->get_field('name'); |
|
36 | 36 | $field['hidden'] = true; |
37 | 37 | } |
38 | 38 | $dm = new datamanager($this->_request_data['schemadb']); |
@@ -91,7 +91,8 @@ discard block |
||
91 | 91 | $data['product'] = $product; |
92 | 92 | try { |
93 | 93 | $data['datamanager_product']->set_storage($product); |
94 | - } catch (midcom_error $e) { |
|
94 | + } |
|
95 | + catch (midcom_error $e) { |
|
95 | 96 | $e->log(); |
96 | 97 | continue; |
97 | 98 | } |
@@ -150,7 +151,8 @@ discard block |
||
150 | 151 | $data['product'] = $product; |
151 | 152 | try { |
152 | 153 | $data['datamanager_product']->set_storage($product); |
153 | - } catch (midcom_error $e) { |
|
154 | + } |
|
155 | + catch (midcom_error $e) { |
|
154 | 156 | $e->log(); |
155 | 157 | continue; |
156 | 158 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | |
54 | 54 | public function _load_data($handler_id, array &$args, array &$data) |
55 | 55 | { |
56 | - if ( empty($_POST) |
|
56 | + if (empty($_POST) |
|
57 | 57 | && $data['session']->exists('POST_data')) { |
58 | 58 | $_POST = $data['session']->get('POST_data'); |
59 | 59 | $data['session']->remove('POST_data'); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | foreach ($this->_datamanagers as $type => $datamanager) { |
126 | 126 | foreach ($datamanager->get_schema($this->schemas[$type])->get('fields') as $name => $config) { |
127 | 127 | $title = $config['title']; |
128 | - if ( $this->include_totals |
|
128 | + if ($this->include_totals |
|
129 | 129 | && $config['type'] == 'number') { |
130 | 130 | $this->_totals[$type . '-' . $name] = 0; |
131 | 131 | } |
@@ -190,18 +190,18 @@ discard block |
||
190 | 190 | $output = array_pad($output, $target_size, ''); |
191 | 191 | continue; |
192 | 192 | } |
193 | - $object =& $row[$type]; |
|
193 | + $object = & $row[$type]; |
|
194 | 194 | |
195 | 195 | $datamanager->set_storage($object, $this->schemas[$type]); |
196 | 196 | |
197 | - if ( $this->include_guid |
|
197 | + if ($this->include_guid |
|
198 | 198 | && $type == $first_type) { |
199 | 199 | $output[] = $object->guid; |
200 | 200 | } |
201 | 201 | |
202 | 202 | $csvdata = $datamanager->get_content_csv(); |
203 | 203 | foreach ($datamanager->get_schema()->get('fields') as $fieldname => $config) { |
204 | - if ( $this->include_totals |
|
204 | + if ($this->include_totals |
|
205 | 205 | && $config['type'] == 'number') { |
206 | 206 | $this->_totals[$type . '-' . $fieldname] += $csvdata[$fieldname]; |
207 | 207 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | if (empty($this->csv['charset'])) { |
237 | 237 | // Default to ISO-LATIN-15 (Latin-1 with EURO sign etc) |
238 | 238 | $this->csv['charset'] = 'ISO-8859-15'; |
239 | - if ( isset($_SERVER['HTTP_USER_AGENT']) |
|
239 | + if (isset($_SERVER['HTTP_USER_AGENT']) |
|
240 | 240 | && !preg_match('/Windows/i', $_SERVER['HTTP_USER_AGENT'])) { |
241 | 241 | // Except when not on windows, then default to UTF-8 |
242 | 242 | $this->csv['charset'] = 'UTF-8'; |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | } |
265 | 265 | |
266 | 266 | // Strings and numbers beginning with zero are quoted |
267 | - if ( !empty($data) |
|
268 | - && ( !is_numeric($data) |
|
267 | + if (!empty($data) |
|
268 | + && (!is_numeric($data) |
|
269 | 269 | || preg_match('/^[0+]/', $data))) { |
270 | 270 | // Make sure we have only newlines in data |
271 | 271 | $data = preg_replace("/\n\r|\r\n|\r/", "\n", $data); |
@@ -35,12 +35,12 @@ |
||
35 | 35 | public function buildForm(FormBuilderInterface $builder, array $options) |
36 | 36 | { |
37 | 37 | $session_key = md5($builder->getForm()->getName() . '_session_key'); |
38 | - $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($session_key) { |
|
38 | + $builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) use ($session_key) { |
|
39 | 39 | $value = $event->getForm()->getData(); |
40 | 40 | $session = new midcom_services_session('midcom_datamanager_captcha'); |
41 | 41 | $l10n = midcom::get()->i18n->get_l10n('midcom.datamanager'); |
42 | 42 | |
43 | - if ( !$session->exists($session_key) |
|
43 | + if (!$session->exists($session_key) |
|
44 | 44 | || $value != $session->get($session_key)) { |
45 | 45 | $event->getForm()->addError(new FormError($l10n->get('captcha validation failed'))); |
46 | 46 | } |
@@ -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); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | { |
162 | 162 | $query = $this->request["term"]; |
163 | 163 | $wildcard_query = $query; |
164 | - if ( isset($this->request['auto_wildcards']) |
|
164 | + if (isset($this->request['auto_wildcards']) |
|
165 | 165 | && strpos($query, '%') === false) { |
166 | 166 | switch ($this->request['auto_wildcards']) { |
167 | 167 | case 'start': |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | } |
309 | 309 | break; |
310 | 310 | } |
311 | - } elseif ( $item_name == 'username' |
|
311 | + } elseif ($item_name == 'username' |
|
312 | 312 | && $object instanceof midcom_db_person) { |
313 | 313 | $account = new midcom_core_account($object); |
314 | 314 | return $account->get_username(); |
@@ -55,11 +55,11 @@ |
||
55 | 55 | foreach (array_filter($csv_line) as $field => $value) { |
56 | 56 | // Process the row accordingly |
57 | 57 | $field_matching = $this->_settings['fields'][$field]; |
58 | - if ( $field_matching |
|
58 | + if ($field_matching |
|
59 | 59 | && strstr($field_matching, ':')) { |
60 | 60 | list($schemadb, $schema_field) = explode(':', $field_matching); |
61 | 61 | |
62 | - if ( !array_key_exists($schemadb, $this->_schemadbs) |
|
62 | + if (!array_key_exists($schemadb, $this->_schemadbs) |
|
63 | 63 | || !$this->_schemadbs[$schemadb]->get('default')->has_field($schema_field)) { |
64 | 64 | // Invalid matching, skip |
65 | 65 | continue; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'campaign_member' => schemadb::from_path($this->_config->get('schemadb_campaign_member')), |
50 | 50 | 'organization' => schemadb::from_path($this->_config->get('schemadb_organization')), |
51 | 51 | 'organization_member' => schemadb::from_path($this->_config->get('schemadb_organization_member')), |
52 | - ];; |
|
52 | + ]; ; |
|
53 | 53 | $this->add_stylesheet(MIDCOM_STATIC_URL . "/midcom.datamanager/default.css"); |
54 | 54 | |
55 | 55 | midcom::get()->disable_limits(); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $contacts = $importer->parse($input); |
159 | 159 | if (count($contacts) > 0) { |
160 | 160 | $this->_request_data['import_status'] = $importer->import_subscribers($contacts, $this->_request_data['campaign']); |
161 | - if ( $this->_request_data['import_status']['subscribed_new'] > 0 |
|
161 | + if ($this->_request_data['import_status']['subscribed_new'] > 0 |
|
162 | 162 | || $this->_request_data['import_status']['already_subscribed'] > 0) { |
163 | 163 | $this->_import_success = true; |
164 | 164 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | // Update the breadcrumb line |
197 | 197 | $this->_update_breadcrumb($handler_id, $args); |
198 | 198 | |
199 | - if ( array_key_exists('org_openpsa_directmarketing_import', $_POST) |
|
199 | + if (array_key_exists('org_openpsa_directmarketing_import', $_POST) |
|
200 | 200 | && is_uploaded_file($_FILES['org_openpsa_directmarketing_import_upload']['tmp_name'])) { |
201 | 201 | $importer = new org_openpsa_directmarketing_importer_vcards($this->_schemadbs); |
202 | 202 | $this->_run_import($importer, $_FILES['org_openpsa_directmarketing_import_upload']['tmp_name']); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $read_rows = 0; |
251 | 251 | $handle = fopen($data['tmp_file'], 'r'); |
252 | 252 | $total_columns = 0; |
253 | - while ( $read_rows < 2 |
|
253 | + while ($read_rows < 2 |
|
254 | 254 | && $csv_line = fgetcsv($handle, 1000, $data['separator'])) { |
255 | 255 | if ($total_columns == 0) { |
256 | 256 | $total_columns = count($csv_line); |