@@ -4,7 +4,7 @@ |
||
4 | 4 | midcom::get()->auth->require_admin_user(); |
5 | 5 | $post = Request::createFromGlobals()->request; |
6 | 6 | |
7 | -if ( !$post->get('to') |
|
7 | +if (!$post->get('to') |
|
8 | 8 | || !$post->get('from')) { |
9 | 9 | ?> |
10 | 10 | <h2>Send test email</h2> |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <div class="area org_openpsa_helper_box"> |
2 | -<h3><?php echo $data['l10n']->get('folders');?></h3> |
|
2 | +<h3><?php echo $data['l10n']->get('folders'); ?></h3> |
|
3 | 3 | <?php |
4 | 4 | $nap = new midcom_helper_nav(); |
5 | 5 | $current_node = $nap->get_node($nap->get_current_node()); |
6 | 6 | $url = $current_node[MIDCOM_NAV_RELATIVEURL]; |
7 | -midcom::get()->dynamic_load($url. "directory/navigation/"); |
|
7 | +midcom::get()->dynamic_load($url . "directory/navigation/"); |
|
8 | 8 | ?> |
9 | 9 | </div> |
10 | 10 | \ No newline at end of file |
@@ -4,7 +4,7 @@ |
||
4 | 4 | midcom::get()->auth->require_admin_user(); |
5 | 5 | $post = Request::createFromGlobals()->request; |
6 | 6 | |
7 | -if ( !$post->get('to') |
|
7 | +if (!$post->get('to') |
|
8 | 8 | || !$post->get('from')) { |
9 | 9 | ?> |
10 | 10 | <h2>Send test email</h2> |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $entries = array_merge($this->get_status_entries(), $this->get_journal_entries()); |
64 | 64 | |
65 | - usort($entries, function (array $a, array $b) { |
|
65 | + usort($entries, function(array $a, array $b) { |
|
66 | 66 | if ($a['timestamp'] == $b['timestamp']) { |
67 | 67 | return $b['order'] <=> $a['order']; |
68 | 68 | } |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | 'order' => 3 |
93 | 93 | ]; |
94 | 94 | } |
95 | - if ( $this->invoice->due |
|
96 | - && ( ( $this->invoice->due < time() |
|
95 | + if ($this->invoice->due |
|
96 | + && (($this->invoice->due < time() |
|
97 | 97 | && $this->invoice->paid == 0) |
98 | 98 | || $this->invoice->due < $this->invoice->paid)) { |
99 | 99 | $entries[] = [ |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $prefix = $nap->get_node($this->_topic->id)[MIDCOM_NAV_ABSOLUTEURL]; |
28 | 28 | |
29 | 29 | $tree = new org_openpsa_widgets_tree(org_openpsa_contacts_group_dba::class, 'owner'); |
30 | - $tree->link_callback = function (string $guid) use ($prefix) { |
|
30 | + $tree->link_callback = function(string $guid) use ($prefix) { |
|
31 | 31 | return $prefix . 'group/' . $guid . '/'; |
32 | 32 | }; |
33 | 33 | $tree->constraints[] = ['orgOpenpsaObtype', '<', org_openpsa_contacts_group_dba::ORGANIZATION]; |
@@ -109,7 +109,7 @@ |
||
109 | 109 | $attachment->update(); |
110 | 110 | } else { |
111 | 111 | $attachment = $this->invoice->create_attachment($filename, $this->invoice->get_label(), "application/pdf"); |
112 | - if ( !$attachment |
|
112 | + if (!$attachment |
|
113 | 113 | || !$this->invoice->set_parameter("midcom.helper.datamanager2.type.blobs", $name, $attachment->guid . ":" . $attachment->guid)) { |
114 | 114 | throw new midcom_error("Failed to create invoice attachment for pdf: " . midcom_connection::get_error_string()); |
115 | 115 | } |
@@ -125,7 +125,8 @@ discard block |
||
125 | 125 | try { |
126 | 126 | $pdf_helper->render_and_attach(); |
127 | 127 | return $this->reply(true, $this->_l10n->get('pdf created')); |
128 | - } catch (midcom_error $e) { |
|
128 | + } |
|
129 | + catch (midcom_error $e) { |
|
129 | 130 | return $this->reply(false, $this->_l10n->get('pdf creation failed') . ': ' . $e->getMessage()); |
130 | 131 | } |
131 | 132 | } |
@@ -136,7 +137,8 @@ discard block |
||
136 | 137 | try { |
137 | 138 | $pdf_helper->render_and_attach('reminder'); |
138 | 139 | return $this->reply(true, $this->_l10n->get('reminder pdf created')); |
139 | - } catch (midcom_error $e) { |
|
140 | + } |
|
141 | + catch (midcom_error $e) { |
|
140 | 142 | return $this->reply(false, $this->_l10n->get('reminder pdf creation failed') . ': ' . $e->getMessage()); |
141 | 143 | } |
142 | 144 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @see midcom_helper_toolbar::_check_index() |
224 | 224 | * @see midcom_helper_toolbar::clean_item() |
225 | 225 | */ |
226 | - public function add_item(array $item, string|int $before = -1) |
|
226 | + public function add_item(array $item, string | int $before = -1) |
|
227 | 227 | { |
228 | 228 | if ($before != -1) { |
229 | 229 | $before = $this->_check_index($before, false); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * it before a URL, an integer will insert it before a |
250 | 250 | * given index. |
251 | 251 | */ |
252 | - public function add_items(array $items, string|int $before = -1) |
|
252 | + public function add_items(array $items, string | int $before = -1) |
|
253 | 253 | { |
254 | 254 | foreach ($items as $item) { |
255 | 255 | $this->add_item($item, $before); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | $item = array_replace($defaults, $item); |
281 | 281 | |
282 | - if ( !empty($item[MIDCOM_TOOLBAR_ACCESSKEY]) |
|
282 | + if (!empty($item[MIDCOM_TOOLBAR_ACCESSKEY]) |
|
283 | 283 | && !array_key_exists($item[MIDCOM_TOOLBAR_ACCESSKEY], $used_access_keys)) { |
284 | 284 | // We have valid access key, add it to help text |
285 | 285 | $prefix = 'Alt-'; |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | private function set_url(array &$item, string $url) |
305 | 305 | { |
306 | 306 | $item[MIDCOM_TOOLBAR__ORIGINAL_URL] = $url; |
307 | - if ( ( empty($item[MIDCOM_TOOLBAR_OPTIONS]["rel"]) |
|
307 | + if ((empty($item[MIDCOM_TOOLBAR_OPTIONS]["rel"]) |
|
308 | 308 | // Some items may want to keep their links unmutilated |
309 | 309 | || $item[MIDCOM_TOOLBAR_OPTIONS]["rel"] != "directlink") |
310 | 310 | && !str_starts_with($url, '/') |
@@ -323,13 +323,13 @@ discard block |
||
323 | 323 | * @see midcom_helper_toolbar::get_index_from_url() |
324 | 324 | * @see midcom_helper_toolbar::_check_index() |
325 | 325 | */ |
326 | - public function remove_item(string|int $index) |
|
326 | + public function remove_item(string | int $index) |
|
327 | 327 | { |
328 | 328 | $index = $this->_check_index($index); |
329 | 329 | |
330 | 330 | if ($index == 0) { |
331 | 331 | array_shift($this->items); |
332 | - } elseif ($index == count($this->items) -1) { |
|
332 | + } elseif ($index == count($this->items) - 1) { |
|
333 | 333 | array_pop($this->items); |
334 | 334 | } else { |
335 | 335 | $this->items = array_merge(array_slice($this->items, 0, $index), |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @param string|int $index The integer index or URL of the item to enable. |
352 | 352 | */ |
353 | - public function enable_item(string|int $index) |
|
353 | + public function enable_item(string | int $index) |
|
354 | 354 | { |
355 | 355 | $index = $this->_check_index($index); |
356 | 356 | $this->items[$index][MIDCOM_TOOLBAR_ENABLED] = true; |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * |
362 | 362 | * @param string|int $index The integer index or URL of the item to disable. |
363 | 363 | */ |
364 | - public function disable_item(string|int $index) |
|
364 | + public function disable_item(string | int $index) |
|
365 | 365 | { |
366 | 366 | $index = $this->_check_index($index, false); |
367 | 367 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * |
376 | 376 | * @param string|int $index The integer index or URL of the item to hide. |
377 | 377 | */ |
378 | - public function hide_item(string|int $index) |
|
378 | + public function hide_item(string | int $index) |
|
379 | 379 | { |
380 | 380 | $index = $this->_check_index($index, false); |
381 | 381 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @param string|int $index The integer index or URL of the item to show. |
391 | 391 | */ |
392 | - public function show_item(string|int $index) |
|
392 | + public function show_item(string | int $index) |
|
393 | 393 | { |
394 | 394 | $index = $this->_check_index($index); |
395 | 395 | $this->items[$index][MIDCOM_TOOLBAR_HIDDEN] = false; |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | * @see midcom_helper_toolbar::_check_index() |
404 | 404 | * @see midcom_helper_toolbar::add_item() |
405 | 405 | */ |
406 | - public function update_item_url(string|int $index, string $url) |
|
406 | + public function update_item_url(string | int $index, string $url) |
|
407 | 407 | { |
408 | 408 | $index = $this->_check_index($index); |
409 | 409 | $this->set_url($this->items[$index], $url); |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | */ |
415 | 415 | public function render() : string |
416 | 416 | { |
417 | - $visible_items = array_filter($this->items, function ($item) { |
|
417 | + $visible_items = array_filter($this->items, function($item) { |
|
418 | 418 | return !$item[MIDCOM_TOOLBAR_HIDDEN]; |
419 | 419 | }); |
420 | 420 | $this->rendered = true; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | // Try finding uppercase version of the accesskey first |
481 | 481 | $accesskey = strtoupper($item[MIDCOM_TOOLBAR_ACCESSKEY]); |
482 | 482 | $position = strpos($label, $accesskey); |
483 | - if ( $position === false |
|
483 | + if ($position === false |
|
484 | 484 | && midcom::get()->i18n->get_current_language() == 'en') { |
485 | 485 | // Try lowercase, too |
486 | 486 | $accesskey = strtolower($accesskey); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | $attributes['title'] = $item[MIDCOM_TOOLBAR_HELPTEXT]; |
541 | 541 | } |
542 | 542 | |
543 | - if ( $item[MIDCOM_TOOLBAR_ENABLED] |
|
543 | + if ($item[MIDCOM_TOOLBAR_ENABLED] |
|
544 | 544 | && $item[MIDCOM_TOOLBAR_ACCESSKEY] !== null) { |
545 | 545 | $attributes['class'] = 'accesskey'; |
546 | 546 | $attributes['accesskey'] = $item[MIDCOM_TOOLBAR_ACCESSKEY]; |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | public function get_index_from_url(string $url) : ?int |
592 | 592 | { |
593 | 593 | foreach ($this->items as $i => $item) { |
594 | - if ( $item[MIDCOM_TOOLBAR_URL] == $url |
|
594 | + if ($item[MIDCOM_TOOLBAR_URL] == $url |
|
595 | 595 | || $item[MIDCOM_TOOLBAR__ORIGINAL_URL] == $url) { |
596 | 596 | return $i; |
597 | 597 | } |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | * |
610 | 610 | * @param string|int $index The integer index or URL to check |
611 | 611 | */ |
612 | - protected function _check_index(string|int $index, bool $raise_error = true) :?int |
|
612 | + protected function _check_index(string | int $index, bool $raise_error = true) : ?int |
|
613 | 613 | { |
614 | 614 | if (is_string($index)) { |
615 | 615 | $url = $index; |
@@ -71,7 +71,7 @@ |
||
71 | 71 | * |
72 | 72 | * @return boolean Indicating success. |
73 | 73 | */ |
74 | - public function index(midcom_services_indexer_document|array $documents) : bool |
|
74 | + public function index(midcom_services_indexer_document | array $documents) : bool |
|
75 | 75 | { |
76 | 76 | if ($this->_disabled) { |
77 | 77 | return true; |
@@ -93,7 +93,8 @@ discard block |
||
93 | 93 | try { |
94 | 94 | $this->_backend->index($documents); |
95 | 95 | return true; |
96 | - } catch (Exception $e) { |
|
96 | + } |
|
97 | + catch (Exception $e) { |
|
97 | 98 | if ($batch) { |
98 | 99 | throw $e; |
99 | 100 | } |
@@ -122,7 +123,8 @@ discard block |
||
122 | 123 | try { |
123 | 124 | $this->_backend->delete($RIs); |
124 | 125 | return true; |
125 | - } catch (Exception $e) { |
|
126 | + } |
|
127 | + catch (Exception $e) { |
|
126 | 128 | debug_add("Deleting error: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
127 | 129 | return false; |
128 | 130 | } |
@@ -142,7 +144,8 @@ discard block |
||
142 | 144 | try { |
143 | 145 | $this->_backend->delete_all($constraint); |
144 | 146 | return true; |
145 | - } catch (Exception $e) { |
|
147 | + } |
|
148 | + catch (Exception $e) { |
|
146 | 149 | debug_add("Deleting error: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
147 | 150 | return false; |
148 | 151 | } |
@@ -175,7 +178,8 @@ discard block |
||
175 | 178 | |
176 | 179 | try { |
177 | 180 | $result_raw = $this->_backend->query($query, $filter, $options); |
178 | - } catch (Exception $e) { |
|
181 | + } |
|
182 | + catch (Exception $e) { |
|
179 | 183 | debug_add("Query error: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
180 | 184 | return $result; |
181 | 185 | } |
@@ -196,7 +200,8 @@ discard block |
||
196 | 200 | if (!empty($document->topic_guid)) { |
197 | 201 | try { |
198 | 202 | midcom_db_topic::get_cached($document->topic_guid); |
199 | - } catch (midcom_error) { |
|
203 | + } |
|
204 | + catch (midcom_error) { |
|
200 | 205 | // Skip document, the object is hidden. |
201 | 206 | debug_add("Skipping the generic document {$document->title}, its topic seems to be invisible, we cannot proceed."); |
202 | 207 | continue; |
@@ -209,7 +214,8 @@ discard block |
||
209 | 214 | // Strip language code from end of RI if it looks like "<GUID>_<LANG>" |
210 | 215 | try { |
211 | 216 | midcom::get()->dbfactory->get_object_by_guid(preg_replace('/^([0-9a-f]{32,80})_[a-z]{2}$/', '\\1', $document->RI)); |
212 | - } catch (midcom_error) { |
|
217 | + } |
|
218 | + catch (midcom_error) { |
|
213 | 219 | // Skip document, the object is hidden, deleted or otherwise unavailable. |
214 | 220 | //@todo Maybe nonexistent objects should be removed from index? |
215 | 221 | continue; |