@@ -99,7 +99,7 @@ |
||
99 | 99 | $qb = midcom::get()->dbfactory->new_query_builder($this->config['type_config']['mapping_class_name']); |
100 | 100 | $qb->add_constraint($this->config['type_config']['master_fieldname'], '=', $this->get_master_foreign_key()); |
101 | 101 | |
102 | - if ( $this->config['type_config']['sortable'] |
|
102 | + if ($this->config['type_config']['sortable'] |
|
103 | 103 | && preg_match('/^(ASC|DESC)/i', $this->config['type_config']['sortable_sort_order'], $regs)) { |
104 | 104 | $order = strtoupper($regs[1]); |
105 | 105 | $qb->add_order('metadata.score', $order); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $this->content .= "{$this->abstract}\n"; |
138 | 138 | } |
139 | 139 | |
140 | - if (! $this->title) { |
|
140 | + if (!$this->title) { |
|
141 | 141 | $this->title = $this->document_url; |
142 | 142 | } |
143 | 143 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if (!empty($field->vars['value'])) { |
179 | 179 | //only index the first attachment for now |
180 | 180 | $attachment = array_shift($field->vars['value']); |
181 | - if ( !$attachment instanceof \midcom_db_attachment |
|
181 | + if (!$attachment instanceof \midcom_db_attachment |
|
182 | 182 | && !empty($attachment['object'])) { |
183 | 183 | //This is the form edit case |
184 | 184 | //@todo: In create case, nothing is found currently |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | */ |
263 | 263 | private function resolve_auto_method($name) |
264 | 264 | { |
265 | - if ( $name == 'abstract' |
|
265 | + if ($name == 'abstract' |
|
266 | 266 | || $name == 'title' |
267 | 267 | || $name == 'author') { |
268 | 268 | return $name; |
@@ -85,7 +85,7 @@ |
||
85 | 85 | $qb = org_openpsa_directmarketing_campaign_messagereceipt_dba::new_query_builder(); |
86 | 86 | $qb->add_constraint('token', '=', $token); |
87 | 87 | $qb->add_constraint('orgOpenpsaObtype', '=', $type); |
88 | - $ret = $qb->execute(); |
|
88 | + $ret = $qb->execute(); |
|
89 | 89 | debug_print_r("_qb_token_receipts({$token}) returned", $ret); |
90 | 90 | if (empty($ret)) { |
91 | 91 | midcom::get()->auth->drop_sudo(); |
@@ -34,7 +34,8 @@ discard block |
||
34 | 34 | // Add person to campaign |
35 | 35 | try { |
36 | 36 | $campaign = new org_openpsa_directmarketing_campaign_dba($_POST['add_to_campaign']); |
37 | - } catch (midcom_error $e) { |
|
37 | + } |
|
38 | + catch (midcom_error $e) { |
|
38 | 39 | // FIXME: More informative error message |
39 | 40 | $this->notify('Failed adding person %s to campaign %s', $_POST['add_to_campaign'], 'error'); |
40 | 41 | return; |
@@ -87,7 +88,8 @@ discard block |
||
87 | 88 | try { |
88 | 89 | $campaigns[$membership->campaign] = new org_openpsa_directmarketing_campaign_dba($membership->campaign); |
89 | 90 | $campaign_membership_map[$membership->campaign] = $membership; |
90 | - } catch (midcom_error $e) { |
|
91 | + } |
|
92 | + catch (midcom_error $e) { |
|
91 | 93 | debug_add('Failed to load campaign ' . $membership->campaign . ', reason: ' . $e->getMessage()); |
92 | 94 | } |
93 | 95 | } |
@@ -104,7 +104,8 @@ discard block |
||
104 | 104 | $customer = org_openpsa_contacts_group_dba::get_cached($invoice->customer); |
105 | 105 | $entry['customer'] = "<a href=\"{$this->_request_data['invoices_url']}list/customer/all/{$customer->guid}/\">" . $customer->get_label() . "</a>"; |
106 | 106 | $entry['index_customer'] = $customer->get_label(); |
107 | - } catch (midcom_error $e) { |
|
107 | + } |
|
108 | + catch (midcom_error $e) { |
|
108 | 109 | $entry['customer'] = ''; |
109 | 110 | $entry['index_customer'] = ''; |
110 | 111 | } |
@@ -115,7 +116,8 @@ discard block |
||
115 | 116 | $contact = org_openpsa_contacts_person_dba::get_cached($invoice->customerContact); |
116 | 117 | $entry['contact'] = "<a href=\"{$this->_request_data['invoices_url']}list/customer/all/{$contact->guid}/\">" . $contact->get_label() . "</a>"; |
117 | 118 | $entry['index_contact'] = $contact->get_label(); |
118 | - } catch (midcom_error $e) { |
|
119 | + } |
|
120 | + catch (midcom_error $e) { |
|
119 | 121 | $entry['contact'] = ''; |
120 | 122 | $entry['index_contact'] = ''; |
121 | 123 | } |
@@ -290,7 +292,8 @@ discard block |
||
290 | 292 | { |
291 | 293 | try { |
292 | 294 | $this->_customer = new org_openpsa_contacts_group_dba($args[0]); |
293 | - } catch (midcom_error $e) { |
|
295 | + } |
|
296 | + catch (midcom_error $e) { |
|
294 | 297 | $this->_customer = new org_openpsa_contacts_person_dba($args[0]); |
295 | 298 | } |
296 | 299 | $data['customer'] = $this->_customer; |
@@ -171,7 +171,7 @@ |
||
171 | 171 | { |
172 | 172 | $this->prepare_toolbar(false); |
173 | 173 | |
174 | - if ( $this->_topic->can_do('midgard:update') |
|
174 | + if ($this->_topic->can_do('midgard:update') |
|
175 | 175 | && $this->_topic->can_do('midcom:component_config')) { |
176 | 176 | $workflow = $this->get_workflow('datamanager'); |
177 | 177 | $this->_node_toolbar->add_item($workflow->get_button('config/', [ |
@@ -38,13 +38,15 @@ |
||
38 | 38 | try { |
39 | 39 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($item->deliverable); |
40 | 40 | $entry['deliverable'] = $deliverable->title; |
41 | - } catch (midcom_error $e) { |
|
41 | + } |
|
42 | + catch (midcom_error $e) { |
|
42 | 43 | $entry['deliverable'] = ''; |
43 | 44 | } |
44 | 45 | try { |
45 | 46 | $task = org_openpsa_projects_task_dba::get_cached($item->task); |
46 | 47 | $entry['task'] = $task->title; |
47 | - } catch (midcom_error $e) { |
|
48 | + } |
|
49 | + catch (midcom_error $e) { |
|
48 | 50 | $entry['task'] = ''; |
49 | 51 | } |
50 | 52 |
@@ -141,7 +141,7 @@ |
||
141 | 141 | |
142 | 142 | private function _verify_post_data() |
143 | 143 | { |
144 | - if ( empty($_POST['oper']) |
|
144 | + if (empty($_POST['oper']) |
|
145 | 145 | || !isset($_POST['id']) |
146 | 146 | || !isset($_POST['description']) |
147 | 147 | || !isset($_POST['price']) |
@@ -66,7 +66,8 @@ discard block |
||
66 | 66 | try { |
67 | 67 | $person1 = new org_openpsa_contacts_person_dba($param->parentguid); |
68 | 68 | $person2 = new org_openpsa_contacts_person_dba($param->name); |
69 | - } catch (midcom_error $e) { |
|
69 | + } |
|
70 | + catch (midcom_error $e) { |
|
70 | 71 | $i++; |
71 | 72 | continue; |
72 | 73 | } |
@@ -137,7 +138,8 @@ discard block |
||
137 | 138 | try { |
138 | 139 | $merger = new org_openpsa_contacts_duplicates_merge('person', $this->_config); |
139 | 140 | $merger->merge_delete($person1, $person2); |
140 | - } catch (midcom_error $e) { |
|
141 | + } |
|
142 | + catch (midcom_error $e) { |
|
141 | 143 | // TODO: Localize |
142 | 144 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.contacts'), 'Merge failed, errstr: ' . $e->getMessage(), 'error'); |
143 | 145 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | private function load_next() |
45 | 45 | { |
46 | - $i =& $this->_request_data['loop_i']; |
|
46 | + $i = & $this->_request_data['loop_i']; |
|
47 | 47 | while ($i < 100) { |
48 | 48 | debug_add("Loop iteration {$i}"); |
49 | 49 | $qb = new midgard_query_builder('midgard_parameter'); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | continue; |
72 | 72 | } |
73 | 73 | // Make sure we actually have enough rights to do this |
74 | - if ( !$person1->can_do('midgard:update') |
|
74 | + if (!$person1->can_do('midgard:update') |
|
75 | 75 | || !$person1->can_do('midgard:delete') |
76 | 76 | || !$person2->can_do('midgard:update') |
77 | 77 | || !$person2->can_do('midgard:delete')) { |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | continue; |
81 | 81 | } |
82 | 82 | // Extra sanity check (in case of semi-successful not-duplicate mark) |
83 | - if ( $person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid) |
|
83 | + if ($person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid) |
|
84 | 84 | || $person2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person1->guid)) { |
85 | 85 | debug_add("It seems these two (#{$person1->id} and #{$person2->id}) have also marked as not duplicates, some cleanup might be a good thing", MIDCOM_LOG_WARN); |
86 | 86 | $i++; |
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | |
90 | - $this->_request_data['probability'] = (float)$param->value; |
|
90 | + $this->_request_data['probability'] = (float) $param->value; |
|
91 | 91 | $this->_request_data['person1'] = $person1; |
92 | 92 | $this->_request_data['person2'] = $person2; |
93 | 93 | break; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | private function process_submit() |
98 | 98 | { |
99 | - if ( !empty($_POST['org_openpsa_contacts_handler_duplicates_person_keep']) |
|
99 | + if (!empty($_POST['org_openpsa_contacts_handler_duplicates_person_keep']) |
|
100 | 100 | && !empty($_POST['org_openpsa_contacts_handler_duplicates_person_options']) |
101 | 101 | && count($_POST['org_openpsa_contacts_handler_duplicates_person_options']) == 2) { |
102 | 102 | $option1 = new org_openpsa_contacts_person_dba($_POST['org_openpsa_contacts_handler_duplicates_person_options'][1]); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | if ($keep == 'both') { |
106 | 106 | $option1->require_do('midgard:update'); |
107 | 107 | $option2->require_do('midgard:update'); |
108 | - if ( $option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
108 | + if ($option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
109 | 109 | && $option2->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option1->guid, time())) { |
110 | 110 | // Clear the possible duplicate parameters |
111 | 111 | $option1->delete_parameter('org.openpsa.contacts.duplicates:possible_duplicate', $option2->guid); |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | } |
124 | 124 | } else { |
125 | 125 | if ($keep == $option1->guid) { |
126 | - $person1 =& $option1; |
|
127 | - $person2 =& $option2; |
|
126 | + $person1 = & $option1; |
|
127 | + $person2 = & $option2; |
|
128 | 128 | } elseif ($keep == $option2->guid) { |
129 | - $person1 =& $option2; |
|
130 | - $person2 =& $option1; |
|
129 | + $person1 = & $option2; |
|
130 | + $person2 = & $option1; |
|
131 | 131 | } else { |
132 | 132 | throw new midcom_error('Something weird happened (basically we got bogus data)'); |
133 | 133 | } |
@@ -82,7 +82,8 @@ discard block |
||
82 | 82 | $file = $this->stat($test); |
83 | 83 | $this->clearcache(); |
84 | 84 | |
85 | - if ($file && $file['name'] === $name) { // file exists and check filename for item ID based filesystem |
|
85 | + if ($file && $file['name'] === $name) { |
|
86 | +// file exists and check filename for item ID based filesystem |
|
86 | 87 | // check POST data `overwrite` for 3rd party uploader |
87 | 88 | $overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite']; |
88 | 89 | if ($overwrite) { |
@@ -135,11 +136,13 @@ discard block |
||
135 | 136 | { |
136 | 137 | try { |
137 | 138 | return org_openpsa_documents_document_dba::get_cached($path); |
138 | - } catch (midcom_error $e) { |
|
139 | + } |
|
140 | + catch (midcom_error $e) { |
|
139 | 141 | $e->log(); |
140 | 142 | try { |
141 | 143 | return org_openpsa_documents_directory::get_cached($path); |
142 | - } catch (midcom_error $e) { |
|
144 | + } |
|
145 | + catch (midcom_error $e) { |
|
143 | 146 | $e->log(); |
144 | 147 | } |
145 | 148 | } |
@@ -275,7 +278,8 @@ discard block |
||
275 | 278 | $object = midcom::get()->dbfactory->get_object_by_guid($path); |
276 | 279 | try { |
277 | 280 | $parentdir = org_openpsa_documents_directory::get_cached($parent); |
278 | - } catch (midcom_error $e) { |
|
281 | + } |
|
282 | + catch (midcom_error $e) { |
|
279 | 283 | $e->log(); |
280 | 284 | return false; |
281 | 285 | } |
@@ -571,7 +575,8 @@ discard block |
||
571 | 575 | try { |
572 | 576 | $doc = new org_openpsa_documents_document_dba($path); |
573 | 577 | return $doc->delete(); |
574 | - } catch (midcom_error $e) { |
|
578 | + } |
|
579 | + catch (midcom_error $e) { |
|
575 | 580 | return false; |
576 | 581 | } |
577 | 582 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | // elfinder tmp detection doesn't work on OS X |
19 | 19 | $this->tmpPath = midcom::get()->config->get('midcom_tempdir'); |
20 | 20 | // elfinder calls exit(), so we need to make sure we write caches |
21 | - register_shutdown_function(function () { |
|
21 | + register_shutdown_function(function() { |
|
22 | 22 | midcom::get()->finish(); |
23 | 23 | }); |
24 | 24 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | if (($dir = $this->dir($dst)) == false) { |
46 | - return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst); |
|
46 | + return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#' . $dst); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | if (!$dir['write']) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | if ($file && $file['name'] === $name) { // file exists and check filename for item ID based filesystem |
86 | 86 | // check POST data `overwrite` for 3rd party uploader |
87 | - $overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite']; |
|
87 | + $overwrite = isset($_POST['overwrite']) ? (bool) $_POST['overwrite'] : $this->options['uploadOverwrite']; |
|
88 | 88 | if ($overwrite) { |
89 | 89 | if (!$file['write']) { |
90 | 90 | return $this->setError(elFinder::ERROR_PERM_DENIED); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $output = [$object->get_label()]; |
251 | 251 | |
252 | 252 | $parent = $object->get_parent(); |
253 | - while ( $parent |
|
253 | + while ($parent |
|
254 | 254 | && $parent->component == 'org.openpsa.documents') { |
255 | 255 | $output[] = $parent->extra; |
256 | 256 | $parent = $parent->get_parent(); |
@@ -347,12 +347,12 @@ discard block |
||
347 | 347 | $data['mime'] = 'directory'; |
348 | 348 | } |
349 | 349 | |
350 | - if ( $owner |
|
350 | + if ($owner |
|
351 | 351 | && $group = midcom::get()->auth->get_assignee($owner)) { |
352 | 352 | $data['group'] = $group->name; |
353 | 353 | } |
354 | 354 | |
355 | - if ( $this->root !== $path |
|
355 | + if ($this->root !== $path |
|
356 | 356 | && $parent = $object->get_parent()) { |
357 | 357 | $data['phash'] = $this->encode($parent->guid); |
358 | 358 | } |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param string $mode open mode |
412 | 412 | * @return resource|false |
413 | 413 | */ |
414 | - protected function _fopen($path, $mode="rb") |
|
414 | + protected function _fopen($path, $mode = "rb") |
|
415 | 415 | { |
416 | 416 | $document = org_openpsa_documents_document_dba::get_cached($path); |
417 | 417 | $attachments = org_openpsa_helpers::get_dm2_attachments($document, 'document'); |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @param string $path file path |
430 | 430 | * @return bool |
431 | 431 | */ |
432 | - protected function _fclose($fp, $path='') |
|
432 | + protected function _fclose($fp, $path = '') |
|
433 | 433 | { |
434 | 434 | fclose($fp); |
435 | 435 | return true; |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | { |
614 | 614 | $filename = midcom_db_attachment::safe_filename($name, true); |
615 | 615 | $att = $doc->create_attachment($filename, $name, $mimetype); |
616 | - if ( !$att |
|
616 | + if (!$att |
|
617 | 617 | || !$att->copy_from_handle($fp)) { |
618 | 618 | return false; |
619 | 619 | } |
@@ -196,7 +196,8 @@ discard block |
||
196 | 196 | try { |
197 | 197 | $event = new org_openpsa_calendar_event_dba($member->event); |
198 | 198 | $set_as_modified = true; |
199 | - } catch (midcom_error $e) { |
|
199 | + } |
|
200 | + catch (midcom_error $e) { |
|
200 | 201 | debug_add("event_resource #{$member->id} links ot bogus event #{$member->event}, skipping and removing", MIDCOM_LOG_WARN); |
201 | 202 | $member->delete(); |
202 | 203 | return; |
@@ -224,7 +225,8 @@ discard block |
||
224 | 225 | |
225 | 226 | try { |
226 | 227 | $event = new org_openpsa_calendar_event_dba($member->eid); |
227 | - } catch (midcom_error $e) { |
|
228 | + } |
|
229 | + catch (midcom_error $e) { |
|
228 | 230 | debug_add("eventmember #{$member->id} links to bogus event #{$member->eid}, skipping and removing", MIDCOM_LOG_WARN); |
229 | 231 | $member->delete(); |
230 | 232 | return; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | // TODO: Shared tasks need a separate check (different member object) |
127 | 127 | |
128 | - if ( !empty($this->busy_members) |
|
128 | + if (!empty($this->busy_members) |
|
129 | 129 | || !empty($this->busy_resources)) { |
130 | 130 | //Unresolved conflicts (note return value is for conflicts not lack of them) |
131 | 131 | midcom::get()->auth->drop_sudo(); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | //These events have been robbed of (some of) their resources |
139 | 139 | $creator = midcom_db_person::get_cached($event->metadata->creator); |
140 | 140 | $other_participants = array_diff_key($event->participants, [$creator->id => true]); |
141 | - if ( count($other_participants) == 0 |
|
141 | + if (count($other_participants) == 0 |
|
142 | 142 | && count($event->resources) == 0) { |
143 | 143 | /* If modified event has no-one or only creator as participant and no resources |
144 | 144 | then delete it (as it's unlikely the stub event is useful anymore) */ |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | if (array_key_exists($member->event, $modified_events)) { |
192 | - $event =& $modified_events[$member->event]; |
|
192 | + $event = & $modified_events[$member->event]; |
|
193 | 193 | $set_as_modified = false; |
194 | 194 | } else { |
195 | 195 | try { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | debug_add("overlap found in event {$event->title} (#{$event->id})"); |
205 | 205 | |
206 | - if ( $event->tentative |
|
206 | + if ($event->tentative |
|
207 | 207 | && $rob_tentative) { |
208 | 208 | debug_add('event is tentative, robbing resources'); |
209 | 209 | $event->resources = array_diff_key($event->resources, $this->_event->resources); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | } |
231 | 231 | debug_add("overlap found in event {$event->title} (#{$event->id})"); |
232 | 232 | |
233 | - if ( $event->tentative |
|
233 | + if ($event->tentative |
|
234 | 234 | && $rob_tentative) { |
235 | 235 | debug_add('event is tentative, robbing participants'); |
236 | 236 | $event->participants = array_diff_key($event->participants, $this->_event->participants); |