@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | private function send(int $httpcode, string $message) |
| 112 | 112 | { |
| 113 | 113 | $error_actions = midcom::get()->config->get('error_actions'); |
| 114 | - if ( !isset($error_actions[$httpcode]) |
|
| 114 | + if (!isset($error_actions[$httpcode]) |
|
| 115 | 115 | || !isset($error_actions[$httpcode]['action'])) { |
| 116 | 116 | // No action specified for this error code, skip |
| 117 | 117 | return; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | return; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - if ( !is_writable($config['filename']) |
|
| 144 | + if (!is_writable($config['filename']) |
|
| 145 | 145 | && !is_writable(dirname($config['filename']))) { |
| 146 | 146 | debug_add("Error logging file {$config['filename']} is not writable", MIDCOM_LOG_WARN); |
| 147 | 147 | return; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | parent::__construct(); |
| 44 | 44 | |
| 45 | 45 | $this->_object = $object; |
| 46 | - $this->_request_data =& $request_data; |
|
| 46 | + $this->_request_data = & $request_data; |
|
| 47 | 47 | |
| 48 | 48 | $this->root_types = midcom_helper_reflector_tree::get_root_classes(); |
| 49 | 49 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | // we go through the path bottom up and show the first root type we find |
| 60 | 60 | foreach (array_reverse($this->_object_path) as $node) { |
| 61 | 61 | foreach ($this->root_types as $root_type) { |
| 62 | - if ( is_a($node, $root_type) |
|
| 62 | + if (is_a($node, $root_type) |
|
| 63 | 63 | || midcom_helper_reflector::is_same_class($root_type, $node->__midcom_class_name__)) { |
| 64 | 64 | $this->expanded_root_types[] = $root_type; |
| 65 | 65 | break; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | protected function _is_collapsed(string $type, int $total) : bool |
| 73 | 73 | { |
| 74 | - return ( $total > $this->_config->get('max_navigation_entries') |
|
| 74 | + return ($total > $this->_config->get('max_navigation_entries') |
|
| 75 | 75 | && empty($_GET['show_all_' . $type])); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | foreach ($ref->get_child_classes() as $class) { |
| 88 | 88 | $qb = $ref->_child_objects_type_qb($class, $object, false); |
| 89 | 89 | |
| 90 | - if ( !$qb |
|
| 90 | + if (!$qb |
|
| 91 | 91 | || !($count = $qb->count_unchecked())) { |
| 92 | 92 | continue; |
| 93 | 93 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | $qb = $ref->_root_objects_qb(false); |
| 135 | 135 | |
| 136 | - if ( !$qb |
|
| 136 | + if (!$qb |
|
| 137 | 137 | || !($total = $qb->count_unchecked())) { |
| 138 | 138 | return; |
| 139 | 139 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $label = html_entity_decode($label); |
| 213 | 213 | |
| 214 | 214 | echo "<a href=\"" . midcom_connection::get_url('self') . "__mfa/asgard/object/{$mode}/{$object->guid}/\" title=\"GUID: {$object->guid}, ID: {$object->id}\">{$icon}{$label}</a>\n"; |
| 215 | - if ( $selected |
|
| 215 | + if ($selected |
|
| 216 | 216 | || $autoexpand) { |
| 217 | 217 | $this->_list_child_elements($object, $level + 1); |
| 218 | 218 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | continue; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - if ( method_exists($class, 'navigation') |
|
| 235 | + if (method_exists($class, 'navigation') |
|
| 236 | 236 | && ($this->_request_data['plugin_name'] == "asgard_{$component}")) { |
| 237 | 237 | $this->_request_data['expanded'] = true; |
| 238 | 238 | midcom_show_style('midgard_admin_asgard_navigation_section_header'); |
@@ -266,13 +266,13 @@ discard block |
||
| 266 | 266 | if ($this->_is_selected($object)) { |
| 267 | 267 | $css_class .= ' selected'; |
| 268 | 268 | } |
| 269 | - if ( is_object($this->_object) |
|
| 270 | - && ( $object->guid == $this->_object->guid |
|
| 271 | - || ( is_a($this->_object, midcom_db_parameter::class) |
|
| 269 | + if (is_object($this->_object) |
|
| 270 | + && ($object->guid == $this->_object->guid |
|
| 271 | + || (is_a($this->_object, midcom_db_parameter::class) |
|
| 272 | 272 | && $object->guid == $this->_object->parentguid))) { |
| 273 | 273 | $css_class .= ' current'; |
| 274 | 274 | } |
| 275 | - if ( !$object->can_do('midgard:update')) { |
|
| 275 | + if (!$object->can_do('midgard:update')) { |
|
| 276 | 276 | $css_class .= ' readonly'; |
| 277 | 277 | } |
| 278 | 278 | return $css_class; |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | // If the regular expression has been set, check which types should be shown |
| 317 | 317 | if ($regexp !== '//') { |
| 318 | - $label_mapping = array_filter($label_mapping, function ($root_type) use ($regexp, $exclude) { |
|
| 318 | + $label_mapping = array_filter($label_mapping, function($root_type) use ($regexp, $exclude) { |
|
| 319 | 319 | return preg_match($regexp, $root_type) == $exclude; |
| 320 | 320 | }, ARRAY_FILTER_USE_KEY); |
| 321 | 321 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | * click if nothing is expanded |
| 346 | 346 | */ |
| 347 | 347 | $types_shown = false; |
| 348 | - if ( !empty($expanded_types) |
|
| 348 | + if (!empty($expanded_types) |
|
| 349 | 349 | && midgard_admin_asgard_plugin::get_preference('navigation_type') === 'dropdown') { |
| 350 | 350 | $this->_draw_select_navigation(); |
| 351 | 351 | $types_shown = true; |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | echo " <li class=\"mgdschema-type\">"; |
| 385 | 385 | |
| 386 | 386 | $dbaclass = midcom::get()->dbclassloader->get_midcom_class_name_for_mgdschema_object($type); |
| 387 | - if ( $dbaclass |
|
| 387 | + if ($dbaclass |
|
| 388 | 388 | && class_exists($dbaclass)) { |
| 389 | 389 | $object = new $dbaclass; |
| 390 | 390 | } else { |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $account = $this->get_account(); |
| 155 | 155 | if (!empty($new_password)) { |
| 156 | 156 | //check if the new encrypted password was already used |
| 157 | - if ( !$this->check_password_reuse($new_password, true) |
|
| 157 | + if (!$this->check_password_reuse($new_password, true) |
|
| 158 | 158 | || !$this->check_password_strength($new_password, true)) { |
| 159 | 159 | $this->errstr = "password strength too low"; |
| 160 | 160 | return false; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $password_length = mb_strlen($password); |
| 294 | 294 | |
| 295 | 295 | if ($password_length < $this->_config->get('min_password_length')) { |
| 296 | - if ($show_ui_message){ |
|
| 296 | + if ($show_ui_message) { |
|
| 297 | 297 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.user'), $this->_l10n->get('password too short'), 'error'); |
| 298 | 298 | } |
| 299 | 299 | return false; |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | if ($score < $this->_config->get('min_password_score')) { |
| 314 | - if ($show_ui_message){ |
|
| 314 | + if ($show_ui_message) { |
|
| 315 | 315 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.user'), $this->_l10n->get('password weak'), 'error'); |
| 316 | 316 | } |
| 317 | 317 | return false; |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | public static function get_person_by_formdata(array $data) |
| 441 | 441 | { |
| 442 | - if ( empty($data['username']) |
|
| 442 | + if (empty($data['username']) |
|
| 443 | 443 | || empty($data['password'])) { |
| 444 | 444 | return false; |
| 445 | 445 | } |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | $max_attempts = midcom_baseclasses_components_configuration::get($component, 'config')->get('max_password_attempts'); |
| 472 | 472 | $timeframe = midcom_baseclasses_components_configuration::get($component, 'config')->get('password_block_timeframe_min'); |
| 473 | 473 | |
| 474 | - if ( $max_attempts == 0 |
|
| 474 | + if ($max_attempts == 0 |
|
| 475 | 475 | || $timeframe == 0) { |
| 476 | 476 | return $stat; |
| 477 | 477 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * If the maximum number of attempts is reached and the oldest attempt |
| 494 | 494 | * on the stack is within our defined timeframe, we block the account |
| 495 | 495 | */ |
| 496 | - if ( count($attempts) >= $max_attempts |
|
| 496 | + if (count($attempts) >= $max_attempts |
|
| 497 | 497 | && $attempts[$max_attempts - 1] >= (time() - ($timeframe * 60))) { |
| 498 | 498 | $this->disable_account(); |
| 499 | 499 | $stat = false; |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public static function create($from_obj, string $from_component, $to_obj, string $to_component, int $status = null, array $extra = []) : ?org_openpsa_relatedto_dba |
| 33 | 33 | { |
| 34 | - if ( !is_object($from_obj) |
|
| 34 | + if (!is_object($from_obj) |
|
| 35 | 35 | || !is_object($to_obj)) { |
| 36 | 36 | return null; |
| 37 | 37 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | { |
| 138 | 138 | debug_add("task->start() called with user #" . midcom_connection::get_user()); |
| 139 | 139 | //PONDER: Check actual status objects for more accurate logic ? |
| 140 | - if ( $task->status >= org_openpsa_projects_task_status_dba::STARTED |
|
| 140 | + if ($task->status >= org_openpsa_projects_task_status_dba::STARTED |
|
| 141 | 141 | && $task->status <= org_openpsa_projects_task_status_dba::APPROVED) { |
| 142 | 142 | //We already have started status |
| 143 | 143 | debug_add('Task has already been started'); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | private static function is_manager(org_openpsa_projects_task_dba $task) : bool |
| 320 | 320 | { |
| 321 | - return ( $task->manager == 0 |
|
| 321 | + return ($task->manager == 0 |
|
| 322 | 322 | || midcom_connection::get_user() == $task->manager); |
| 323 | 323 | } |
| 324 | 324 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $qb_receipts->add_constraint('message', '=', $this->_message->id); |
| 44 | 44 | $qb_receipts->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_messagereceipt_dba::SENT); |
| 45 | 45 | $receipts = $qb_receipts->execute_unchecked(); |
| 46 | - $receipt_data =& $this->_request_data['report']['receipt_data']; |
|
| 46 | + $receipt_data = & $this->_request_data['report']['receipt_data']; |
|
| 47 | 47 | $receipt_data['first_send'] = $receipts[0]->timestamp ?? 0; |
| 48 | 48 | $receipt_data['last_send'] = 0; |
| 49 | 49 | $receipt_data['sent'] = count($receipts); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | private function _get_campaign_data(int $first_send) |
| 78 | 78 | { |
| 79 | - $campaign_data =& $this->_request_data['report']['campaign_data']; |
|
| 79 | + $campaign_data = & $this->_request_data['report']['campaign_data']; |
|
| 80 | 80 | $qb_unsub = org_openpsa_directmarketing_campaign_member_dba::new_query_builder(); |
| 81 | 81 | $qb_unsub->add_constraint('campaign', '=', $this->_message->campaign); |
| 82 | 82 | $qb_unsub->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | private function _get_link_data($segmentation_param) |
| 101 | 101 | { |
| 102 | 102 | $this->_request_data['report']['link_data'] = []; |
| 103 | - $link_data =& $this->_request_data['report']['link_data']; |
|
| 103 | + $link_data = & $this->_request_data['report']['link_data']; |
|
| 104 | 104 | |
| 105 | 105 | $link_data['counts'] = []; |
| 106 | 106 | $link_data['percentages'] = ['of_links' => [], 'of_recipients' => []]; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | foreach ($links as $link) { |
| 127 | 127 | $segment = ''; |
| 128 | 128 | $segment_notfound = false; |
| 129 | - if ( $segmentation_param |
|
| 129 | + if ($segmentation_param |
|
| 130 | 130 | && !empty($link->person)) { |
| 131 | 131 | try { |
| 132 | 132 | $person = org_openpsa_contacts_person_dba::get_cached($link->person); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | if (!isset($link_data['segments'][$segment])) { |
| 141 | 141 | $link_data['segments'][$segment] = $segment_prototype; |
| 142 | 142 | } |
| 143 | - $segment_data =& $link_data['segments'][$segment]; |
|
| 143 | + $segment_data = & $link_data['segments'][$segment]; |
|
| 144 | 144 | } else { |
| 145 | 145 | $segment_data = $segment_prototype; |
| 146 | 146 | } |
@@ -250,15 +250,15 @@ discard block |
||
| 250 | 250 | $this->_initialize_field($array['percentages']['of_links'], $link); |
| 251 | 251 | $this->_initialize_field($array['percentages']['of_recipients'], $link); |
| 252 | 252 | |
| 253 | - $link_data =& $this->_request_data['report']['link_data']; |
|
| 254 | - $array['percentages']['of_links'][$link->target]['total'] = ($array['counts'][$link->target]['total']/$link_data['total'])*100; |
|
| 255 | - $array['percentages']['of_links'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token]/$link_data['total'])*100; |
|
| 253 | + $link_data = & $this->_request_data['report']['link_data']; |
|
| 254 | + $array['percentages']['of_links'][$link->target]['total'] = ($array['counts'][$link->target]['total'] / $link_data['total']) * 100; |
|
| 255 | + $array['percentages']['of_links'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token] / $link_data['total']) * 100; |
|
| 256 | 256 | |
| 257 | - $receipt_data =& $this->_request_data['report']['receipt_data']; |
|
| 258 | - $array['percentages']['of_recipients'][$link->target]['total'] = ((count($array['counts'][$link->target])-1)/($receipt_data['sent']-$receipt_data['bounced']))*100; |
|
| 259 | - $array['percentages']['of_recipients'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token]/($receipt_data['sent']-$receipt_data['bounced']))*100; |
|
| 257 | + $receipt_data = & $this->_request_data['report']['receipt_data']; |
|
| 258 | + $array['percentages']['of_recipients'][$link->target]['total'] = ((count($array['counts'][$link->target]) - 1) / ($receipt_data['sent'] - $receipt_data['bounced'])) * 100; |
|
| 259 | + $array['percentages']['of_recipients'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token] / ($receipt_data['sent'] - $receipt_data['bounced'])) * 100; |
|
| 260 | 260 | |
| 261 | - if ( !isset($array['percentages']['of_recipients']['total']) |
|
| 261 | + if (!isset($array['percentages']['of_recipients']['total']) |
|
| 262 | 262 | || $array['percentages']['of_recipients'][$link->target]['total'] > $array['percentages']['of_recipients']['total']) { |
| 263 | 263 | $array['percentages']['of_recipients']['total'] = $array['percentages']['of_recipients'][$link->target]['total']; |
| 264 | 264 | } |