@@ -61,7 +61,8 @@ |
||
61 | 61 | { |
62 | 62 | try { |
63 | 63 | $this->_object = midcom::get()->dbfactory->get_object_by_guid($guid); |
64 | - } catch (midcom_error $e) { |
|
64 | + } |
|
65 | + catch (midcom_error $e) { |
|
65 | 66 | if (midcom_connection::get_error() == MGD_ERR_OBJECT_DELETED) { |
66 | 67 | $relocate = $this->router->generate('object_deleted', ['guid' => $guid]); |
67 | 68 | midcom::get()->relocate($relocate); |
@@ -223,10 +223,10 @@ |
||
223 | 223 | $new_type_reflector = midcom_helper_reflector::get($new_type); |
224 | 224 | $link_properties = $new_type_reflector->get_link_properties(); |
225 | 225 | foreach ($link_properties as $property => $link) { |
226 | - if ( ($link['class'] && midcom_helper_reflector::is_same_class($link['class'], $this->_object->__mgdschema_class_name__)) |
|
226 | + if (($link['class'] && midcom_helper_reflector::is_same_class($link['class'], $this->_object->__mgdschema_class_name__)) |
|
227 | 227 | || $link['type'] == MGD_TYPE_GUID) { |
228 | 228 | $defaults[$property] = $this->_object->{$link['target']}; |
229 | - } elseif ( $property == $parent_property |
|
229 | + } elseif ($property == $parent_property |
|
230 | 230 | && midcom_helper_reflector::is_same_class($new_type, $this->_object->__mgdschema_class_name__)) { |
231 | 231 | $defaults[$property] = $this->_object->$parent_property; |
232 | 232 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | private function _populate_node_toolbar() |
22 | 22 | { |
23 | - if ( $this->_topic->can_do('midgard:update') |
|
23 | + if ($this->_topic->can_do('midgard:update') |
|
24 | 24 | && $this->_topic->can_do('midcom:component_config')) { |
25 | 25 | $workflow = $this->get_workflow('datamanager'); |
26 | 26 | $this->_node_toolbar->add_item($workflow->get_button($this->router->generate('config'), [ |
@@ -58,7 +58,7 @@ |
||
58 | 58 | } |
59 | 59 | $this->_view_toolbar->add_items($buttons); |
60 | 60 | |
61 | - if ( $this->_topic->can_do('midgard:update') |
|
61 | + if ($this->_topic->can_do('midgard:update') |
|
62 | 62 | && $this->_topic->can_do('midcom:component_config')) { |
63 | 63 | $this->_node_toolbar->add_item($workflow->get_button($this->router->generate('config'), [ |
64 | 64 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), |
@@ -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($this->router->generate('config'), [ |
@@ -87,7 +87,8 @@ discard block |
||
87 | 87 | $customer = org_openpsa_contacts_group_dba::get_cached($invoice->customer); |
88 | 88 | $entry['customer'] = "<a href=\"{$this->router->generate('list_customer_all', ['guid' => $customer->guid])}\">" . $customer->get_label() . "</a>"; |
89 | 89 | $entry['index_customer'] = $customer->get_label(); |
90 | - } catch (midcom_error) { |
|
90 | + } |
|
91 | + catch (midcom_error) { |
|
91 | 92 | $entry['customer'] = ''; |
92 | 93 | $entry['index_customer'] = ''; |
93 | 94 | } |
@@ -101,7 +102,8 @@ discard block |
||
101 | 102 | $entry['contact'] = "<a href=\"{$this->router->generate('list_customer_all', ['guid' => $contact->guid])}\">" . $contact->get_label() . "</a>"; |
102 | 103 | $entry['contact'] = $contact_widget->show_inline(); |
103 | 104 | $entry['index_contact'] = $contact->get_label(); |
104 | - } catch (midcom_error) { |
|
105 | + } |
|
106 | + catch (midcom_error) { |
|
105 | 107 | $entry['contact'] = ''; |
106 | 108 | $entry['index_contact'] = ''; |
107 | 109 | } |
@@ -248,7 +250,8 @@ discard block |
||
248 | 250 | { |
249 | 251 | try { |
250 | 252 | $this->_customer = new org_openpsa_contacts_group_dba($guid); |
251 | - } catch (midcom_error) { |
|
253 | + } |
|
254 | + catch (midcom_error) { |
|
252 | 255 | $this->_customer = new org_openpsa_contacts_person_dba($guid); |
253 | 256 | } |
254 | 257 | $data['customer'] = $this->_customer; |
@@ -67,7 +67,7 @@ |
||
67 | 67 | MIDCOM_TOOLBAR_ACCESSKEY => 'e', |
68 | 68 | ]); |
69 | 69 | |
70 | - if ( $this->task->reportedHours == 0 |
|
70 | + if ($this->task->reportedHours == 0 |
|
71 | 71 | && $this->task->can_do('midgard:delete')) { |
72 | 72 | $delete_workflow = $this->get_workflow('delete', ['object' => $this->task]); |
73 | 73 | $buttons[] = $delete_workflow->get_button($this->router->generate('task_delete', ['guid' => $this->task->guid])); |
@@ -109,7 +109,8 @@ |
||
109 | 109 | MIDCOM_TOOLBAR_GLYPHICON => 'money', |
110 | 110 | ]; |
111 | 111 | } |
112 | - } catch (midcom_error) { |
|
112 | + } |
|
113 | + catch (midcom_error) { |
|
113 | 114 | } |
114 | 115 | } |
115 | 116 |
@@ -169,7 +169,7 @@ |
||
169 | 169 | case 'proposed': |
170 | 170 | $html = $this->render_status($task->manager, "from %s"); |
171 | 171 | $task->get_members(); |
172 | - if ( $task->can_do('midgard:update') |
|
172 | + if ($task->can_do('midgard:update') |
|
173 | 173 | && isset($task->resources[midcom_connection::get_user()])) { |
174 | 174 | $html .= '<form method="post" action="' . $this->router->generate('workflow', ['guid' => $task->guid]) . '">'; |
175 | 175 | //TODO: If we need all resources to accept task hide tools when we have accepted and replace with "pending acceptance from..." |
@@ -255,7 +255,8 @@ discard block |
||
255 | 255 | $url = $this->router->generate('project', ['guid' => $project->guid]); |
256 | 256 | $ret['project'] = '<a href="' . $url . '">' . $project->title . '</a>'; |
257 | 257 | $ret['index_project'] = $project->title; |
258 | - } catch (midcom_error $e) { |
|
258 | + } |
|
259 | + catch (midcom_error $e) { |
|
259 | 260 | $e->log(); |
260 | 261 | } |
261 | 262 | |
@@ -267,7 +268,8 @@ discard block |
||
267 | 268 | $customer_url = "{$contacts_url}group/{$customer->guid}/"; |
268 | 269 | $ret['customer'] = "<a href='{$customer_url}' title='{$customer->official}'>{$customer->get_label()}</a>"; |
269 | 270 | $ret['index_customer'] = $customer->name; |
270 | - } catch (midcom_error) { |
|
271 | + } |
|
272 | + catch (midcom_error) { |
|
271 | 273 | $ret['customer'] = ''; |
272 | 274 | $ret['index_customer'] = ''; |
273 | 275 | } |
@@ -61,7 +61,8 @@ discard block |
||
61 | 61 | try { |
62 | 62 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($at_entry->arguments['deliverable']); |
63 | 63 | $salesproject = org_openpsa_sales_salesproject_dba::get_cached($deliverable->salesproject); |
64 | - } catch (midcom_error $e) { |
|
64 | + } |
|
65 | + catch (midcom_error $e) { |
|
65 | 66 | $e->log(); |
66 | 67 | return $invoice; |
67 | 68 | } |
@@ -103,7 +104,8 @@ discard block |
||
103 | 104 | $invoice[$fieldname] = '<a href="' . $sales_url . 'list/customer/' . $object->guid . '/">' . $invoice[$fieldname] . '</a>'; |
104 | 105 | } |
105 | 106 | $invoice['index_' . $fieldname] = $object->get_label(); |
106 | - } catch (midcom_error $e) { |
|
107 | + } |
|
108 | + catch (midcom_error $e) { |
|
107 | 109 | $e->log(); |
108 | 110 | } |
109 | 111 | } |
@@ -37,7 +37,6 @@ |
||
37 | 37 | - 1: MIDCOM_PRIVILEGE_ALLOW |
38 | 38 | - 2: MIDCOM_PRIVILEGE_DENY |
39 | 39 | - 3: MIDCOM_PRIVILEGE_INHERIT |
40 | - |
|
41 | 40 | * @property string $guid |
42 | 41 | * @package midcom |
43 | 42 | */ |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * The Default constructor creates an empty privilege, if you specify |
76 | 76 | * another privilege object in the constructor, a copy is constructed. |
77 | 77 | */ |
78 | - public function __construct(midcom_core_privilege_db|array|string $src = null) |
|
78 | + public function __construct(midcom_core_privilege_db | array | string $src = null) |
|
79 | 79 | { |
80 | 80 | if (is_array($src)) { |
81 | 81 | // Store given values to our privilege array |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * - Any midcom_core_user or midcom_core_group object or subtype thereof. |
211 | 211 | * - Any string identifier which can be resolved using midcom_services_auth::get_assignee(). |
212 | 212 | */ |
213 | - public function set_assignee(midcom_core_group|midcom_core_user|string $assignee) : bool |
|
213 | + public function set_assignee(midcom_core_group | midcom_core_user | string $assignee) : bool |
|
214 | 214 | { |
215 | 215 | if (is_string($assignee)) { |
216 | 216 | if ($this->is_magic_assignee($assignee)) { |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | - if ( !$this->is_magic_assignee() |
|
269 | + if (!$this->is_magic_assignee() |
|
270 | 270 | && !$this->get_assignee()) { |
271 | 271 | debug_add("The assignee identifier '{$this->assignee}' is invalid.", MIDCOM_LOG_INFO); |
272 | 272 | return false; |
273 | 273 | } |
274 | - if ( $this->assignee == 'OWNER' |
|
274 | + if ($this->assignee == 'OWNER' |
|
275 | 275 | && $this->privilegename == 'midgard:owner') { |
276 | 276 | debug_add("Tried to assign midgard:owner to the OWNER magic assignee, this is invalid.", MIDCOM_LOG_INFO); |
277 | 277 | return false; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | MIDCOM_LOG_INFO); |
284 | 284 | return false; |
285 | 285 | } |
286 | - if ( !$object->can_do('midgard:update') |
|
286 | + if (!$object->can_do('midgard:update') |
|
287 | 287 | || !$object->can_do('midgard:privileges')) { |
288 | 288 | debug_add("Insufficient privileges on the content object with the GUID '{$this->__guid}', midgard:update and midgard:privileges required.", |
289 | 289 | MIDCOM_LOG_INFO); |
@@ -112,7 +112,8 @@ |
||
112 | 112 | if ($this->__cached_object === null) { |
113 | 113 | try { |
114 | 114 | $this->__cached_object = midcom::get()->dbfactory->get_object_by_guid($this->objectguid); |
115 | - } catch (midcom_error) { |
|
115 | + } |
|
116 | + catch (midcom_error) { |
|
116 | 117 | return null; |
117 | 118 | } |
118 | 119 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | public function purify_content(FormEvent $event) |
42 | 42 | { |
43 | - if ( isset($this->config['Cache']['SerializerPath']) |
|
43 | + if (isset($this->config['Cache']['SerializerPath']) |
|
44 | 44 | && !file_exists($this->config['Cache']['SerializerPath'])) { |
45 | 45 | mkdir($this->config['Cache']['SerializerPath']); |
46 | 46 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | // Load custom element/attribute definitions |
56 | 56 | $definitions = $this->get_from_global_config('html_purify_HTMLDefinition'); |
57 | - if ( !empty($definitions) |
|
57 | + if (!empty($definitions) |
|
58 | 58 | && $def = $purifier_config->maybeGetRawHTMLDefinition()) { |
59 | 59 | if (!empty($definitions['addAttribute'])) { |
60 | 60 | foreach (array_filter((array) $definitions['addAttribute'], 'is_array') as $attrdef) { |
@@ -72,7 +72,8 @@ |
||
72 | 72 | $data = $event->getData(); |
73 | 73 | try { |
74 | 74 | $data = $purifier->purify($data); |
75 | - } catch (\Exception $e) { |
|
75 | + } |
|
76 | + catch (\Exception $e) { |
|
76 | 77 | debug_add("HTML Purifier failed: " . $e->getMessage(), MIDCOM_LOG_WARN); |
77 | 78 | } |
78 | 79 | $event->setData($data); |