@@ -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 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | public function set_storage(midcom_core_dbaobject $storage = null, string $schemaname = null) : self |
75 | 75 | { |
76 | - if ( $schemaname === null |
|
76 | + if ($schemaname === null |
|
77 | 77 | && !empty($storage->id)) { |
78 | 78 | $schemaname = $storage->get_parameter('midcom.helper.datamanager2', 'schema_name'); |
79 | 79 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | $name = $this->get_name($name); |
166 | 166 | |
167 | - if ( $this->form === null |
|
167 | + if ($this->form === null |
|
168 | 168 | || $this->form->getName() != $name) { |
169 | 169 | $this->build_form($this->get_builder($name)); |
170 | 170 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | { |
262 | 262 | $ret = true; |
263 | 263 | foreach ($this->storage as $field) { |
264 | - if ( $field instanceof recreateable |
|
264 | + if ($field instanceof recreateable |
|
265 | 265 | && !$field->recreate()) { |
266 | 266 | $ret = false; |
267 | 267 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function set_privilege($privilege, $assignee = null, int $value = MIDCOM_PRIVILEGE_ALLOW, string $classname = '') : bool |
66 | 66 | { |
67 | - if ( !$this->can_do('midgard:update') |
|
67 | + if (!$this->can_do('midgard:update') |
|
68 | 68 | || !$this->can_do('midgard:privileges')) { |
69 | 69 | debug_add("Failed to set a privilege, midgard:update or midgard:privileges on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
70 | 70 | MIDCOM_LOG_ERROR); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function unset_privilege($privilege, $assignee = null, string $classname = '') : bool |
96 | 96 | { |
97 | - if ( !$this->can_do('midgard:update') |
|
97 | + if (!$this->can_do('midgard:update') |
|
98 | 98 | || !$this->can_do('midgard:privileges')) { |
99 | 99 | debug_add("Failed to unset a privilege, midgard:update or midgard:privileges on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
100 | 100 | MIDCOM_LOG_ERROR); |
@@ -100,7 +100,7 @@ |
||
100 | 100 | private function _confirm(InputInterface $input, OutputInterface $output, string $question) : bool |
101 | 101 | { |
102 | 102 | $options = [true => 'y', false => 'N']; |
103 | - $question = '<question>' . $question . ' [' . implode('|', $options). ']</question> '; |
|
103 | + $question = '<question>' . $question . ' [' . implode('|', $options) . ']</question> '; |
|
104 | 104 | $question = new ConfirmationQuestion($question, false); |
105 | 105 | $dialog = $this->getHelperSet()->get('question'); |
106 | 106 | return $dialog->ask($input, $output, $question); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | private function _update_cache() |
140 | 140 | { |
141 | 141 | $this->_merged = $this->_global; |
142 | - if ( !empty($this->_local) |
|
142 | + if (!empty($this->_local) |
|
143 | 143 | && is_array($this->_local)) { |
144 | 144 | $this->_merged = array_merge($this->_merged, $this->_local); |
145 | 145 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function store(array $params, bool $reset = true) |
180 | 180 | { |
181 | - if ( !$this->_object_stored |
|
181 | + if (!$this->_object_stored |
|
182 | 182 | && $this->_object) { |
183 | 183 | $this->_store_from_object(); |
184 | 184 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function get_all() : array |
259 | 259 | { |
260 | - if ( !$this->_object_stored |
|
260 | + if (!$this->_object_stored |
|
261 | 261 | && $this->_object) { |
262 | 262 | $this->_store_from_object(); |
263 | 263 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function exists(string $key) : bool |
272 | 272 | { |
273 | - if ( !$this->_object_stored |
|
273 | + if (!$this->_object_stored |
|
274 | 274 | && $this->_object) { |
275 | 275 | $this->_store_from_object(); |
276 | 276 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | debug_add("The File {$filename} is not writable.", MIDCOM_LOG_ERROR); |
188 | 188 | return false; |
189 | 189 | } |
190 | - if ( !empty($this->_filename) |
|
190 | + if (!empty($this->_filename) |
|
191 | 191 | && $this->_filename !== $filename) { |
192 | 192 | $this->_tmpfiles[] = $this->_filename; |
193 | 193 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $tmpfile = null; |
393 | 393 | $imagesize = getimagesize($this->_filename); |
394 | 394 | |
395 | - if ( $imagesize[2] == IMAGETYPE_JPEG |
|
395 | + if ($imagesize[2] == IMAGETYPE_JPEG |
|
396 | 396 | && $this->_jpegtran_available()) { |
397 | 397 | /* jpegtran */ |
398 | 398 | $operations = [ |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $imagesize = getimagesize($this->_filename); |
461 | 461 | |
462 | 462 | // Try lossless jpegtran rotation if possible |
463 | - if ( $imagesize[2] == IMAGETYPE_JPEG |
|
463 | + if ($imagesize[2] == IMAGETYPE_JPEG |
|
464 | 464 | && ($rotate % 90 == 0) |
465 | 465 | && $this->_jpegtran_available()) { |
466 | 466 | $tmpfile = $this->_get_tempfile(); |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | */ |
591 | 591 | public function fill($x = null, $y = null, $color = null, string $gravity = 'center') |
592 | 592 | { |
593 | - if ( empty($x) |
|
593 | + if (empty($x) |
|
594 | 594 | || empty($y) |
595 | 595 | || empty($color)) { |
596 | 596 | //This is a bit silly, but here for backwards compatibility... |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | public function get_url(midcom_db_article $article, bool $allow_external = false) : string |
17 | 17 | { |
18 | - if ( $allow_external |
|
18 | + if ($allow_external |
|
19 | 19 | && $this->_config->get('link_to_external_url') |
20 | 20 | && !empty($article->url)) { |
21 | 21 | return $article->url; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | $qb->add_constraint('topic.guid', 'IN', $topic_guids); |
69 | 69 | |
70 | - if ( count($topic_guids) > 1 |
|
70 | + if (count($topic_guids) > 1 |
|
71 | 71 | && $list_from_folders_categories = $this->_config->get('list_from_folders_categories')) { |
72 | 72 | $list_from_folders_categories = explode(',', $list_from_folders_categories); |
73 | 73 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | // Hide the articles that have the publish time in the future and if |
85 | 85 | // the user is not administrator |
86 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
86 | + if ($this->_config->get('enable_scheduled_publishing') |
|
87 | 87 | && !midcom::get()->auth->admin) { |
88 | 88 | // Show the article only if the publishing time has passed or the viewer |
89 | 89 | // is the author |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | public function write_acls(midcom_core_dbaobject $object, $owner_id, int $accesstype) : bool |
17 | 17 | { |
18 | - if ( empty($owner_id) |
|
18 | + if (empty($owner_id) |
|
19 | 19 | || empty($accesstype)) { |
20 | 20 | return false; |
21 | 21 | } |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | |
64 | 64 | if ($privileges) { |
65 | 65 | foreach ($privileges as $privilege) { |
66 | - if ( !empty($needed_privileges[$privilege->privilegename]) |
|
66 | + if (!empty($needed_privileges[$privilege->privilegename]) |
|
67 | 67 | && $needed_privileges[$privilege->privilegename]['assignee'] == $privilege->assignee |
68 | 68 | && $needed_privileges[$privilege->privilegename]['value'] == $privilege->value) { |
69 | 69 | unset($needed_privileges[$privilege->privilegename]); |
70 | 70 | continue; |
71 | 71 | } |
72 | 72 | // Clear old ACLs applying to others than current user or selected owner group |
73 | - if ( $privilege->assignee != midcom::get()->auth->user->id |
|
73 | + if ($privilege->assignee != midcom::get()->auth->user->id |
|
74 | 74 | && $privilege->assignee != $owner_id) { |
75 | 75 | debug_add("Removing privilege {$privilege->privilegename} from {$privilege->assignee}"); |
76 | 76 | $object->unset_privilege($privilege->privilegename, $privilege->assignee); |