@@ -50,12 +50,12 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public static function compile(string $content) : string |
| 52 | 52 | { |
| 53 | - return preg_replace_callback("%&\(([^)]*)\);%i", function ($variable) |
|
| 53 | + return preg_replace_callback("%&\(([^)]*)\);%i", function($variable) |
|
| 54 | 54 | { |
| 55 | 55 | $parts = explode(':', $variable[1]); |
| 56 | 56 | $variable = '$' . str_replace('.', '->', $parts[0]); |
| 57 | 57 | |
| 58 | - if ( isset($parts[1]) |
|
| 58 | + if (isset($parts[1]) |
|
| 59 | 59 | && array_key_exists($parts[1], self::$_filters)) { |
| 60 | 60 | if ($parts[1] == 'p') { |
| 61 | 61 | $command = 'eval(\'?>\' . ' . $variable . ')'; |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | $count = count($data['navigation_items']); |
| 5 | 5 | |
| 6 | 6 | foreach ($data['navigation_items'] as $i => $item) { |
| 7 | - if ( isset($item[MIDCOM_NAV_SORTABLE]) |
|
| 7 | + if (isset($item[MIDCOM_NAV_SORTABLE]) |
|
| 8 | 8 | && !$item[MIDCOM_NAV_SORTABLE]) { |
| 9 | 9 | continue; |
| 10 | 10 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $style = ''; |
| 16 | 16 | |
| 17 | 17 | // Skip all components that return the default icon |
| 18 | - if ( isset($item[MIDCOM_NAV_COMPONENT]) |
|
| 18 | + if (isset($item[MIDCOM_NAV_COMPONENT]) |
|
| 19 | 19 | && ($tmp = midcom::get()->componentloader->get_component_icon($item[MIDCOM_NAV_COMPONENT], false))) { |
| 20 | 20 | $icon = '<i class="fa fa-' . $tmp . '"></i>'; |
| 21 | 21 | } elseif (!$item[MIDCOM_NAV_GUID]) { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | // User is or has been subscriber earlier, update status |
| 134 | 134 | $member = $members[0]; |
| 135 | 135 | |
| 136 | - if ( $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED |
|
| 136 | + if ($member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED |
|
| 137 | 137 | || $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::NORMAL) { |
| 138 | 138 | $this->_import_status['already_subscribed']++; |
| 139 | 139 | return; |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $qb = org_openpsa_contacts_group_dba::new_query_builder(); |
| 175 | 175 | $schema = $this->_schemadbs['organization']->get('default'); |
| 176 | - if ( $schema->has_field('company_id') |
|
| 176 | + if ($schema->has_field('company_id') |
|
| 177 | 177 | && !empty($subscriber['organization']['company_id'])) { |
| 178 | 178 | // Imported data has a company id, we use that instead of name |
| 179 | 179 | $qb->add_constraint($schema->get_field('company_id')['storage']['location'], '=', $subscriber['organization']['company_id']); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | // Seek by official name |
| 182 | 182 | $qb->add_constraint('official', '=', $subscriber['organization']['official']); |
| 183 | 183 | |
| 184 | - if ( $schema->has_field('city') |
|
| 184 | + if ($schema->has_field('city') |
|
| 185 | 185 | && !empty($subscriber['organization']['city'])) { |
| 186 | 186 | // Imported data has a city, we use also that for matching |
| 187 | 187 | $qb->add_constraint($schema->get_field('city')['storage']['location'], '=', $subscriber['organization']['city']); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $invoices_url = $siteconfig->get_node_full_url('org.openpsa.invoices'); |
| 106 | 106 | $user_url = $siteconfig->get_node_full_url('org.openpsa.user'); |
| 107 | 107 | |
| 108 | - if ( $invoices_url |
|
| 108 | + if ($invoices_url |
|
| 109 | 109 | && midcom::get()->auth->can_user_do('midgard:create', null, org_openpsa_invoices_invoice_dba::class) |
| 110 | 110 | && $this->_contact->can_do('midgard:update')) { |
| 111 | 111 | $buttons[] = $workflow->get_button($invoices_url . "billingdata/" . $this->_contact->guid . '/', [ |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | ]); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if ( $user_url |
|
| 118 | - && ( midcom::get()->auth->user->guid == $this->_contact->guid |
|
| 117 | + if ($user_url |
|
| 118 | + && (midcom::get()->auth->user->guid == $this->_contact->guid |
|
| 119 | 119 | || midcom::get()->auth->can_user_do('org.openpsa.user:access', null, org_openpsa_user_interface::class))) { |
| 120 | 120 | $buttons[] = [ |
| 121 | 121 | MIDCOM_TOOLBAR_URL => $user_url . "view/{$this->_contact->guid}/", |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | protected function match(string $property, array $data1, array $data2) : bool |
| 115 | 115 | { |
| 116 | - if ( !empty($data1[$property]) |
|
| 116 | + if (!empty($data1[$property]) |
|
| 117 | 117 | && $data1[$property] == $data2[$property]) { |
| 118 | 118 | return true; |
| 119 | 119 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | continue; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if ( $obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid) |
|
| 198 | + if ($obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid) |
|
| 199 | 199 | || $obj2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj1->guid)) { |
| 200 | 200 | // Not-duplicate parameter found, returning zero probability |
| 201 | 201 | continue; |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | // if user's lastname is part of the email address, check to see if the difference is only in the domain part |
| 43 | 43 | $email1 = preg_replace('/@.+/', '', $person1['email']); |
| 44 | 44 | $email2 = preg_replace('/@.+/', '', $person2['email']); |
| 45 | - if ( str_contains($email1, $person1['lastname']) |
|
| 45 | + if (str_contains($email1, $person1['lastname']) |
|
| 46 | 46 | && $email1 == $email2) { |
| 47 | 47 | $p += 0.5; |
| 48 | 48 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | private function load_next() |
| 61 | 61 | { |
| 62 | - $i =& $this->_request_data['loop_i']; |
|
| 62 | + $i = & $this->_request_data['loop_i']; |
|
| 63 | 63 | while ($i < 100) { |
| 64 | 64 | debug_add("Loop iteration {$i}"); |
| 65 | 65 | $qb = new midgard_query_builder('midgard_parameter'); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | continue; |
| 88 | 88 | } |
| 89 | 89 | // Make sure we actually have enough rights to do this |
| 90 | - if ( !$object1->can_do('midgard:update') |
|
| 90 | + if (!$object1->can_do('midgard:update') |
|
| 91 | 91 | || !$object1->can_do('midgard:delete') |
| 92 | 92 | || !$object2->can_do('midgard:update') |
| 93 | 93 | || !$object2->can_do('midgard:delete')) { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | continue; |
| 97 | 97 | } |
| 98 | 98 | // Extra sanity check (in case of semi-successful not-duplicate mark) |
| 99 | - if ( $object1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $object2->guid) |
|
| 99 | + if ($object1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $object2->guid) |
|
| 100 | 100 | || $object2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $object1->guid)) { |
| 101 | 101 | debug_add("It seems these two (#{$object1->id} and #{$object2->id}) have also marked as not duplicates, some cleanup might be a good thing", MIDCOM_LOG_WARN); |
| 102 | 102 | $i++; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | if ($keep == 'both') { |
| 129 | 129 | $option1->require_do('midgard:update'); |
| 130 | 130 | $option2->require_do('midgard:update'); |
| 131 | - if ( $option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
| 131 | + if ($option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
| 132 | 132 | && $option2->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option1->guid, time())) { |
| 133 | 133 | // Clear the possible duplicate parameters |
| 134 | 134 | $option1->delete_parameter('org.openpsa.contacts.duplicates:possible_duplicate', $option2->guid); |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | } else { |
| 148 | 148 | if ($keep == $option1->guid) { |
| 149 | - $object1 =& $option1; |
|
| 150 | - $object2 =& $option2; |
|
| 149 | + $object1 = & $option1; |
|
| 150 | + $object2 = & $option2; |
|
| 151 | 151 | } elseif ($keep == $option2->guid) { |
| 152 | - $object1 =& $option2; |
|
| 153 | - $object2 =& $option1; |
|
| 152 | + $object1 = & $option2; |
|
| 153 | + $object2 = & $option1; |
|
| 154 | 154 | } else { |
| 155 | 155 | throw new midcom_error('Something weird happened (basically we got bogus data)'); |
| 156 | 156 | } |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | |
| 65 | 65 | if ($path === '') { |
| 66 | 66 | // Infinite loop, set an UI message and stop executing |
| 67 | - if ( !isset($schema['extends']['name']) |
|
| 67 | + if (!isset($schema['extends']['name']) |
|
| 68 | 68 | || $schema['extends']['name'] === $schema_name) { |
| 69 | 69 | throw new midcom_error('schema ' . $schema_name . ' extends itself'); |
| 70 | 70 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | private function _process_category_constraint(org_openpsa_qbpager $qb) |
| 77 | 77 | { |
| 78 | - if ( !in_array($this->category, $this->_request_data['categories']) |
|
| 78 | + if (!in_array($this->category, $this->_request_data['categories']) |
|
| 79 | 79 | && !$this->_config->get('categories_custom_enable')) { |
| 80 | 80 | throw new midcom_error('Custom categories are not allowed'); |
| 81 | 81 | // TODO: Check here if there are actually items in this cat? |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | midcom::get()->head->set_pagetitle($this->_request_data['page_title']); |
| 89 | 89 | |
| 90 | 90 | // Activate correct leaf |
| 91 | - if ( $this->_config->get('show_navigation_pseudo_leaves') |
|
| 91 | + if ($this->_config->get('show_navigation_pseudo_leaves') |
|
| 92 | 92 | && in_array($this->category, $this->_request_data['categories'])) { |
| 93 | 93 | $this->set_active_leaf($this->_topic->id . '_CAT_' . $this->category); |
| 94 | 94 | } |