@@ -9,7 +9,7 @@ |
||
9 | 9 | continue; |
10 | 10 | } |
11 | 11 | |
12 | - if ( !$object->can_do('midgard:update') |
|
12 | + if (!$object->can_do('midgard:update') |
|
13 | 13 | || !$object->can_do('midgard:attachments')) { |
14 | 14 | echo sprintf(midcom::get()->i18n->get_string('not recreating object %s %s, reason %s', 'midcom'), $type, $object->guid, 'Insufficient privileges') . "\n"; |
15 | 15 | continue; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | public function get_parent_guid_uncached() |
95 | 95 | { |
96 | - if ( $this->up |
|
96 | + if ($this->up |
|
97 | 97 | || $this->title != '__org_openpsa_calendar') { |
98 | 98 | $root_event = org_openpsa_calendar_interface::find_root_event(); |
99 | 99 | if ($this->id != $root_event->id) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | //Check up |
156 | - if ( !$this->up |
|
156 | + if (!$this->up |
|
157 | 157 | && $this->title != '__org_openpsa_calendar') { |
158 | 158 | $root_event = org_openpsa_calendar_interface::find_root_event(); |
159 | 159 | $this->up = $root_event->id; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | private function _check_timerange() |
180 | 180 | { |
181 | - if ( !$this->start |
|
181 | + if (!$this->start |
|
182 | 182 | || !$this->end) { |
183 | 183 | debug_add('Event must have start and end timestamps'); |
184 | 184 | midcom_connection::set_error(MGD_ERR_RANGE); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | <?php |
31 | 31 | foreach ($type_choices as $value => $label) { |
32 | 32 | $selected = ''; |
33 | - if ( isset($data['type_filter']) |
|
33 | + if (isset($data['type_filter']) |
|
34 | 34 | && $data['type_filter'] == $value) { |
35 | 35 | $selected = ' selected="selected"'; |
36 | 36 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | <?php |
46 | 46 | foreach ($revised_after_choices as $value => $label) { |
47 | 47 | $selected = ''; |
48 | - if ( isset($data['revised_after']) |
|
48 | + if (isset($data['revised_after']) |
|
49 | 49 | && $data['revised_after'] == date('Y-m-d', $value)) { |
50 | 50 | $selected = ' selected="selected"'; |
51 | 51 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function initialize(midcom_baseclasses_components_viewer $master, Router $router) |
19 | 19 | { |
20 | 20 | $this->router = $router; |
21 | - $this->_request_data =& $master->_request_data; |
|
21 | + $this->_request_data = & $master->_request_data; |
|
22 | 22 | $this->_topic = $master->_topic; |
23 | 23 | $this->_request_data['l10n'] = $this->_l10n; |
24 | 24 |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | if (!$this->_schemadb) { |
99 | 99 | $this->_schemadb = schemadb::from_path($this->_config->get('schemadb')); |
100 | 100 | |
101 | - if ( $this->_config->get('use_captcha') |
|
102 | - || ( !midcom::get()->auth->user |
|
101 | + if ($this->_config->get('use_captcha') |
|
102 | + || (!midcom::get()->auth->user |
|
103 | 103 | && $this->_config->get('use_captcha_if_anonymous'))) { |
104 | 104 | $fields = $this->_schemadb->get('comment')->get('fields'); |
105 | 105 | $fields['captcha'] = [ |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | $this->_schemadb->get('comment')->set('fields', $fields); |
113 | 113 | } |
114 | 114 | |
115 | - if ( $this->_config->get('ratings_enable') |
|
115 | + if ($this->_config->get('ratings_enable') |
|
116 | 116 | && $this->_schemadb->get('comment')->has_field('rating')) { |
117 | - $field =& $this->_schemadb->get('comment')->get_field('rating'); |
|
117 | + $field = & $this->_schemadb->get('comment')->get_field('rating'); |
|
118 | 118 | $field['hidden'] = false; |
119 | 119 | } |
120 | 120 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $this->_comments = $this->_comments->execute(); |
190 | 190 | } |
191 | 191 | |
192 | - if ( midcom::get()->auth->user |
|
192 | + if (midcom::get()->auth->user |
|
193 | 193 | || $this->_config->get('allow_anonymous')) { |
194 | 194 | $this->_init_post_controller($request); |
195 | 195 | $this->_process_post($request); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | private function _process_post(Request $request) |
219 | 219 | { |
220 | - if ( !midcom::get()->auth->user |
|
220 | + if (!midcom::get()->auth->user |
|
221 | 221 | && !midcom::get()->auth->request_sudo('net.nehmer.comments')) { |
222 | 222 | throw new midcom_error('We were anonymous but could not acquire SUDO privileges, aborting'); |
223 | 223 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // Check against comment spam |
228 | 228 | $this->_new_comment->check_spam($this->_config); |
229 | 229 | $formdata = $this->_post_controller->get_form_values(); |
230 | - if ( $formdata['subscribe'] |
|
230 | + if ($formdata['subscribe'] |
|
231 | 231 | && midcom::get()->auth->user) { |
232 | 232 | // User wants to subscribe to receive notifications about this comments thread |
233 | 233 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | private function _get_last_modified() |
266 | 266 | { |
267 | - return array_reduce($this->_comments, function ($carry, net_nehmer_comments_comment $item) { |
|
267 | + return array_reduce($this->_comments, function($carry, net_nehmer_comments_comment $item) { |
|
268 | 268 | return max($item->metadata->revised, $carry); |
269 | 269 | }, 0); |
270 | 270 | } |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | $data['comment_toolbar'] = $this->populate_post_toolbar($comment); |
287 | 287 | midcom_show_style('comments-item'); |
288 | 288 | |
289 | - if ( midcom::get()->auth->admin |
|
290 | - || ( midcom::get()->auth->user |
|
289 | + if (midcom::get()->auth->admin |
|
290 | + || (midcom::get()->auth->user |
|
291 | 291 | && $comment->can_do('midgard:delete'))) { |
292 | 292 | midcom_show_style('comments-admintoolbar'); |
293 | 293 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | midcom_show_style('comments-nonefound'); |
298 | 298 | } |
299 | 299 | |
300 | - if ( midcom::get()->auth->user |
|
300 | + if (midcom::get()->auth->user |
|
301 | 301 | || $this->_config->get('allow_anonymous')) { |
302 | 302 | midcom_show_style('post-comment'); |
303 | 303 | } else { |
@@ -118,7 +118,7 @@ |
||
118 | 118 | */ |
119 | 119 | public function _handler_moderate_ajax(Request $request, $status, array &$data) |
120 | 120 | { |
121 | - if ( !$request->request->has('action') |
|
121 | + if (!$request->request->has('action') |
|
122 | 122 | || !$request->request->has('guid')) { |
123 | 123 | throw new midcom_error_notfound('Incomplete POST data'); |
124 | 124 | } |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | |
52 | 52 | if ($this->_product->delivery == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) { |
53 | 53 | $schema = 'subscription'; |
54 | - $field =& $schemadb->get('subscription')->get_field('start'); |
|
54 | + $field = & $schemadb->get('subscription')->get_field('start'); |
|
55 | 55 | $field['type_config']['min_date'] = strftime('%Y-%m-%d'); |
56 | 56 | } else { |
57 | - $end =& $schemadb->get('default')->get_field('end'); |
|
57 | + $end = & $schemadb->get('default')->get_field('end'); |
|
58 | 58 | $end['type_config']['min_date'] = strftime('%Y-%m-%d'); |
59 | 59 | if ($this->_product->costType == "%") { |
60 | - $costPerUnit =& $schemadb->get('default')->get_field('costPerUnit'); |
|
60 | + $costPerUnit = & $schemadb->get('default')->get_field('costPerUnit'); |
|
61 | 61 | $costPerUnit['title'] = $this->_l10n->get("cost per unit (percentage)"); |
62 | 62 | } |
63 | 63 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function _handler_add(Request $request, $guid, array &$data) |
97 | 97 | { |
98 | - if ( !$request->request->has('product') |
|
98 | + if (!$request->request->has('product') |
|
99 | 99 | && !$request->request->has('org_openpsa_sales')) { |
100 | 100 | throw new midcom_error('No product specified, aborting.'); |
101 | 101 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $this->_salesproject->require_do('midgard:update'); |
33 | 33 | |
34 | 34 | $schemadb = schemadb::from_path($this->_config->get('schemadb_salesproject')); |
35 | - $field =& $schemadb->get('default')->get_field('customer'); |
|
35 | + $field = & $schemadb->get('default')->get_field('customer'); |
|
36 | 36 | $field['type_config']['options'] = org_openpsa_helpers_list::task_groups($this->_salesproject); |
37 | 37 | $dm = new datamanager($schemadb); |
38 | 38 | $dm->set_storage($this->_salesproject); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $schemadb = schemadb::from_path($this->_config->get('schemadb_salesproject')); |
60 | 60 | |
61 | 61 | if (!empty($guid)) { |
62 | - $field =& $schemadb->get('default')->get_field('customer'); |
|
62 | + $field = & $schemadb->get('default')->get_field('customer'); |
|
63 | 63 | try { |
64 | 64 | $customer = new org_openpsa_contacts_group_dba($guid); |
65 | 65 | $field['type_config']['options'] = [0 => '', $customer->id => $customer->official]; |
@@ -65,7 +65,8 @@ |
||
65 | 65 | $field['type_config']['options'] = [0 => '', $customer->id => $customer->official]; |
66 | 66 | |
67 | 67 | $defaults['customer'] = $customer->id; |
68 | - } catch (midcom_error $e) { |
|
68 | + } |
|
69 | + catch (midcom_error $e) { |
|
69 | 70 | $customer = new org_openpsa_contacts_person_dba($guid); |
70 | 71 | $defaults['customerContact'] = $customer->id; |
71 | 72 | $field['type_config']['options'] = org_openpsa_helpers_list::task_groups(new org_openpsa_sales_salesproject_dba, 'id', [$customer->id => true]); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $images = $qb->execute(); |
64 | 64 | $failed = 0; |
65 | 65 | foreach ($images as $image) { |
66 | - if ( !$image->generate_image('thumbnail', $this->_config->get('thumbnail_filter')) |
|
66 | + if (!$image->generate_image('thumbnail', $this->_config->get('thumbnail_filter')) |
|
67 | 67 | || !$image->generate_image('image', $this->_config->get('image_filter'))) { |
68 | 68 | $failed++; |
69 | 69 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $attachment->title = $_POST['title']; |
250 | 250 | $attachment->mimetype = $file['type']; |
251 | 251 | $attachment->parentguid = $image->guid; |
252 | - if ( !$attachment->create() |
|
252 | + if (!$attachment->create() |
|
253 | 253 | || !$attachment->copy_from_file($file['tmp_name'])) { |
254 | 254 | throw new midcom_error('Failed to create attachment: ' . midcom_connection::get_error_string()); |
255 | 255 | } |
@@ -134,7 +134,8 @@ |
||
134 | 134 | try { |
135 | 135 | $this->$function($request->request); |
136 | 136 | $this->_response->success = true; |
137 | - } catch (midcom_error $e) { |
|
137 | + } |
|
138 | + catch (midcom_error $e) { |
|
138 | 139 | $this->_response->success = false; |
139 | 140 | $this->_response->error = $e->getMessage(); |
140 | 141 | } |