@@ -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 | } |
@@ -48,7 +48,8 @@ discard block |
||
| 48 | 48 | if ($sales_url) { |
| 49 | 49 | $entry['deliverable'] = '<a href="' . $sales_url . 'deliverable/' . $deliverable->guid . '/">' . $entry['deliverable'] . '</a>'; |
| 50 | 50 | } |
| 51 | - } catch (midcom_error $e) { |
|
| 51 | + } |
|
| 52 | + catch (midcom_error $e) { |
|
| 52 | 53 | $entry['deliverable'] = ''; |
| 53 | 54 | } |
| 54 | 55 | try { |
@@ -57,7 +58,8 @@ discard block |
||
| 57 | 58 | if ($projects_url) { |
| 58 | 59 | $entry['task'] = '<a href="' . $projects_url . 'task/' . $task->guid . '/">' . $entry['task'] . '</a>'; |
| 59 | 60 | } |
| 60 | - } catch (midcom_error $e) { |
|
| 61 | + } |
|
| 62 | + catch (midcom_error $e) { |
|
| 61 | 63 | $entry['task'] = ''; |
| 62 | 64 | } |
| 63 | 65 | |
@@ -195,7 +195,8 @@ discard block |
||
| 195 | 195 | try { |
| 196 | 196 | $event = new org_openpsa_calendar_event_dba($member->event); |
| 197 | 197 | $set_as_modified = true; |
| 198 | - } catch (midcom_error $e) { |
|
| 198 | + } |
|
| 199 | + catch (midcom_error $e) { |
|
| 199 | 200 | debug_add("event_resource #{$member->id} links to bogus event #{$member->event}, skipping and removing", MIDCOM_LOG_WARN); |
| 200 | 201 | $member->delete(); |
| 201 | 202 | return; |
@@ -223,7 +224,8 @@ discard block |
||
| 223 | 224 | |
| 224 | 225 | try { |
| 225 | 226 | $event = new org_openpsa_calendar_event_dba($member->eid); |
| 226 | - } catch (midcom_error $e) { |
|
| 227 | + } |
|
| 228 | + catch (midcom_error $e) { |
|
| 227 | 229 | debug_add("eventmember #{$member->id} links to bogus event #{$member->eid}, skipping and removing", MIDCOM_LOG_WARN); |
| 228 | 230 | $member->delete(); |
| 229 | 231 | 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(); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | if (array_key_exists($member->event, $modified_events)) { |
| 191 | - $event =& $modified_events[$member->event]; |
|
| 191 | + $event = & $modified_events[$member->event]; |
|
| 192 | 192 | $set_as_modified = false; |
| 193 | 193 | } else { |
| 194 | 194 | try { |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | debug_add("overlap found in event {$event->title} (#{$event->id})"); |
| 204 | 204 | |
| 205 | - if ( $event->tentative |
|
| 205 | + if ($event->tentative |
|
| 206 | 206 | && $rob_tentative) { |
| 207 | 207 | debug_add('event is tentative, robbing resources'); |
| 208 | 208 | $event->resources = array_diff_key($event->resources, $this->_event->resources); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | debug_add("overlap found in event {$event->title} (#{$event->id})"); |
| 231 | 231 | |
| 232 | - if ( $event->tentative |
|
| 232 | + if ($event->tentative |
|
| 233 | 233 | && $rob_tentative) { |
| 234 | 234 | debug_add('event is tentative, robbing participants'); |
| 235 | 235 | $event->participants = array_diff_key($event->participants, $this->_event->participants); |
@@ -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 | } |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if ( empty($input) |
|
| 37 | - || ( $input instanceof DateTime |
|
| 36 | + if (empty($input) |
|
| 37 | + || ($input instanceof DateTime |
|
| 38 | 38 | && $input->format('Y-m-d H:i:s') == '0001-01-01 00:00:00')) { |
| 39 | 39 | return $result; |
| 40 | 40 | } |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | throw new TransformationFailedException('Expected an array.'); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if ( empty($array['date']) |
|
| 63 | - || ( $array['date'] instanceof DateTime |
|
| 62 | + if (empty($array['date']) |
|
| 63 | + || ($array['date'] instanceof DateTime |
|
| 64 | 64 | && $array['date']->format('Y-m-d H:i:s') == '0001-01-01 00:00:00')) { |
| 65 | 65 | return; |
| 66 | 66 | } |
@@ -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 | */ |
@@ -128,7 +128,8 @@ |
||
| 128 | 128 | if ($this->__cached_object === null) { |
| 129 | 129 | try { |
| 130 | 130 | $this->__cached_object = midcom::get()->dbfactory->get_object_by_guid($this->objectguid); |
| 131 | - } catch (midcom_error $e) { |
|
| 131 | + } |
|
| 132 | + catch (midcom_error $e) { |
|
| 132 | 133 | return false; |
| 133 | 134 | } |
| 134 | 135 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function set_assignee($assignee) : bool |
| 248 | 248 | { |
| 249 | - if ( is_a($assignee, midcom_core_user::class) |
|
| 249 | + if (is_a($assignee, midcom_core_user::class) |
|
| 250 | 250 | || is_a($assignee, midcom_core_group::class)) { |
| 251 | 251 | $this->assignee = $assignee->id; |
| 252 | 252 | } elseif (is_string($assignee)) { |
@@ -305,12 +305,12 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - if ( !$this->is_magic_assignee() |
|
| 308 | + if (!$this->is_magic_assignee() |
|
| 309 | 309 | && !$this->get_assignee()) { |
| 310 | 310 | debug_add("The assignee identifier '{$this->assignee}' is invalid.", MIDCOM_LOG_INFO); |
| 311 | 311 | return false; |
| 312 | 312 | } |
| 313 | - if ( $this->assignee == 'OWNER' |
|
| 313 | + if ($this->assignee == 'OWNER' |
|
| 314 | 314 | && $this->privilegename == 'midgard:owner') { |
| 315 | 315 | debug_add("Tried to assign midgard:owner to the OWNER magic assignee, this is invalid.", MIDCOM_LOG_INFO); |
| 316 | 316 | return false; |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | MIDCOM_LOG_INFO); |
| 323 | 323 | return false; |
| 324 | 324 | } |
| 325 | - if ( !$object->can_do('midgard:update') |
|
| 325 | + if (!$object->can_do('midgard:update') |
|
| 326 | 326 | || !$object->can_do('midgard:privileges')) { |
| 327 | 327 | debug_add("Insufficient privileges on the content object with the GUID '{$this->__guid}', midgard:update and midgard:privileges required.", |
| 328 | 328 | MIDCOM_LOG_INFO); |
@@ -600,10 +600,10 @@ discard block |
||
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | //owner privileges override everything but person privileges, so we have to cross-check those here |
| 603 | - if ( $privilegename != 'midgard:owner' |
|
| 603 | + if ($privilegename != 'midgard:owner' |
|
| 604 | 604 | && $last_scope < MIDCOM_PRIVILEGE_SCOPE_OWNER) { |
| 605 | 605 | $owner_privileges = $this->get_owner_default_privileges(); |
| 606 | - if ( array_key_exists($privilegename, $owner_privileges) |
|
| 606 | + if (array_key_exists($privilegename, $owner_privileges) |
|
| 607 | 607 | && $this->_load_content_privilege('midgard:owner', $guid, $class, $user_id) |
| 608 | 608 | && self::$_content_privileges_cache[$cache_id]['midgard:owner']) { |
| 609 | 609 | self::$_content_privileges_cache[$cache_id][$privilegename] = ($owner_privileges[$privilegename] == MIDCOM_PRIVILEGE_ALLOW); |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | //if nothing was found, we try to recurse to parent |
| 620 | 620 | list ($parent_guid, $parent_class) = $this->get_parent_data($guid, $class); |
| 621 | 621 | |
| 622 | - if ( $parent_guid == $guid |
|
| 622 | + if ($parent_guid == $guid |
|
| 623 | 623 | || !mgd_is_guid($parent_guid)) { |
| 624 | 624 | return false; |
| 625 | 625 | } |
@@ -269,17 +269,17 @@ |
||
| 269 | 269 | private static $_default_magic_class_privileges = []; |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | - * Internal cache of the content privileges of users on content objects, this is |
|
| 273 | - * an associative array using a combination of the user identifier and the object's |
|
| 274 | - * guid as index. The privileges for the anonymous user use the magic |
|
| 275 | - * EVERYONE as user identifier. |
|
| 276 | - * |
|
| 277 | - * This must not be merged with the class-wide privileges_cache, because otherwise |
|
| 278 | - * class_default_privileges for child objects might be overridden by parent default |
|
| 279 | - * privileges |
|
| 280 | - * |
|
| 281 | - * @var Array |
|
| 282 | - */ |
|
| 272 | + * Internal cache of the content privileges of users on content objects, this is |
|
| 273 | + * an associative array using a combination of the user identifier and the object's |
|
| 274 | + * guid as index. The privileges for the anonymous user use the magic |
|
| 275 | + * EVERYONE as user identifier. |
|
| 276 | + * |
|
| 277 | + * This must not be merged with the class-wide privileges_cache, because otherwise |
|
| 278 | + * class_default_privileges for child objects might be overridden by parent default |
|
| 279 | + * privileges |
|
| 280 | + * |
|
| 281 | + * @var Array |
|
| 282 | + */ |
|
| 283 | 283 | private static $_content_privileges_cache = []; |
| 284 | 284 | |
| 285 | 285 | /** |
@@ -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); |
@@ -132,7 +132,8 @@ |
||
| 132 | 132 | try { |
| 133 | 133 | $object = call_user_func([$options['widget_config']['class'], 'get_cached'], $identifier); |
| 134 | 134 | $preset[$identifier] = autocomplete_helper::create_item_label($object, $options['widget_config']['result_headers'], $options['widget_config']['titlefield']); |
| 135 | - } catch (midcom_error $e) { |
|
| 135 | + } |
|
| 136 | + catch (midcom_error $e) { |
|
| 136 | 137 | $e->log(); |
| 137 | 138 | } |
| 138 | 139 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public function configureOptions(OptionsResolver $resolver) |
| 35 | 35 | { |
| 36 | 36 | $resolver->setDefault('error_bubbling', false); |
| 37 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
| 37 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
| 38 | 38 | $widget_defaults = [ |
| 39 | 39 | 'creation_mode_enabled' => false, |
| 40 | 40 | 'class' => null, |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | return helper::normalize($widget_defaults, $value); |
| 68 | 68 | }); |
| 69 | - $resolver->setNormalizer('type_config', function (Options $options, $value) { |
|
| 69 | + $resolver->setNormalizer('type_config', function(Options $options, $value) { |
|
| 70 | 70 | $type_defaults = [ |
| 71 | 71 | 'options' => [], |
| 72 | 72 | 'method' => 'GET', |