@@ -338,8 +338,8 @@ discard block |
||
| 338 | 338 | $classes = []; |
| 339 | 339 | |
| 340 | 340 | if ($child[MIDCOM_NAV_TYPE] === 'node') { |
| 341 | - if ( $item[MIDCOM_NAV_ID] === $this->_nap->get_current_node() |
|
| 342 | - && ( !$this->_nap->get_current_leaf() |
|
| 341 | + if ($item[MIDCOM_NAV_ID] === $this->_nap->get_current_node() |
|
| 342 | + && (!$this->_nap->get_current_leaf() |
|
| 343 | 343 | || !$this->_nap->get_leaf($this->_nap->get_current_leaf()))) { |
| 344 | 344 | $classes[] = $this->css_active; |
| 345 | 345 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | // Add information about the object's status |
| 389 | - if ( $this->object_status_to_class |
|
| 389 | + if ($this->object_status_to_class |
|
| 390 | 390 | && isset($item[MIDCOM_NAV_OBJECT]) |
| 391 | 391 | && $css_status_class = midcom::get()->metadata->get_object_classes($item[MIDCOM_NAV_OBJECT])) { |
| 392 | 392 | $classes[] = $css_status_class; |
@@ -405,12 +405,12 @@ discard block |
||
| 405 | 405 | echo "<a href=\"{$item[MIDCOM_NAV_ABSOLUTEURL]}\"{$link_class}>{$item[MIDCOM_NAV_NAME]}</a>"; |
| 406 | 406 | // If either of the follow nodes switches is on, follow all the nodes |
| 407 | 407 | |
| 408 | - if ( $item[MIDCOM_NAV_TYPE] === 'node' |
|
| 408 | + if ($item[MIDCOM_NAV_TYPE] === 'node' |
|
| 409 | 409 | && !$this->show_only_current |
| 410 | - && ( $this->list_levels === 0 |
|
| 410 | + && ($this->list_levels === 0 |
|
| 411 | 411 | || $this->_level < $this->list_levels)) { |
| 412 | - if ( $this->follow_all |
|
| 413 | - || ( $this->follow_selected |
|
| 412 | + if ($this->follow_all |
|
| 413 | + || ($this->follow_selected |
|
| 414 | 414 | && in_array($item[MIDCOM_NAV_ID], $this->node_path, true))) { |
| 415 | 415 | $this->_level++; |
| 416 | 416 | $this->_list_child_elements($item[MIDCOM_NAV_ID]); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $entries = array_merge($this->get_status_entries(), $this->get_journal_entries()); |
| 87 | 87 | |
| 88 | - usort($entries, function ($a, $b) { |
|
| 88 | + usort($entries, function($a, $b) { |
|
| 89 | 89 | if ($a['timestamp'] == $b['timestamp']) { |
| 90 | 90 | if ($a['order'] == $b['order']) { |
| 91 | 91 | return 0; |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | 'order' => 3 |
| 123 | 123 | ]; |
| 124 | 124 | } |
| 125 | - if ( $this->invoice->due |
|
| 126 | - && ( ( $this->invoice->due < time() |
|
| 125 | + if ($this->invoice->due |
|
| 126 | + && (($this->invoice->due < time() |
|
| 127 | 127 | && $this->invoice->paid == 0) |
| 128 | 128 | || $this->invoice->due < $this->invoice->paid)) { |
| 129 | 129 | $entries[] = [ |
@@ -123,7 +123,8 @@ |
||
| 123 | 123 | $row = []; |
| 124 | 124 | try { |
| 125 | 125 | $row['person'] = org_openpsa_contacts_person_dba::get_cached($hour->person); |
| 126 | - } catch (midcom_error $e) { |
|
| 126 | + } |
|
| 127 | + catch (midcom_error $e) { |
|
| 127 | 128 | $e->log(); |
| 128 | 129 | continue; |
| 129 | 130 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $qb_hr = org_openpsa_expenses_hour_report_dba::new_query_builder(); |
| 44 | 44 | $qb_hr->add_constraint('date', '<=', (int) $this->_request_data['query_data']['end']); |
| 45 | 45 | $qb_hr->add_constraint('date', '>=', (int) $this->_request_data['query_data']['start']); |
| 46 | - if ( array_key_exists('invoiceable_filter', $this->_request_data['query_data']) |
|
| 46 | + if (array_key_exists('invoiceable_filter', $this->_request_data['query_data']) |
|
| 47 | 47 | && $this->_request_data['query_data']['invoiceable_filter'] != -1) { |
| 48 | 48 | $qb_hr->add_constraint('invoiceable', '=', (bool) $this->_request_data['query_data']['invoiceable_filter']); |
| 49 | 49 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $tasks = $this->_expand_task($this->_request_data['query_data']['task']); |
| 60 | 60 | $qb_hr->add_constraint('task', 'IN', $tasks); |
| 61 | 61 | } |
| 62 | - if ( array_key_exists('hour_type_filter', $this->_request_data['query_data']) |
|
| 62 | + if (array_key_exists('hour_type_filter', $this->_request_data['query_data']) |
|
| 63 | 63 | && $this->_request_data['query_data']['hour_type_filter'] != 'builtin:all') { |
| 64 | 64 | $qb_hr->add_constraint('reportType', '=', $this->_request_data['query_data']['hour_type_filter']); |
| 65 | 65 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | private function add_to_group($new_row, $matching, $sort, $title) |
| 152 | 152 | { |
| 153 | - $rows =& $this->_request_data['report']['rows']; |
|
| 153 | + $rows = & $this->_request_data['report']['rows']; |
|
| 154 | 154 | if (array_key_exists($matching, $rows)) { |
| 155 | 155 | $rows[$matching]['rows'][] = $new_row; |
| 156 | 156 | $rows[$matching]['total_hours'] += $new_row['hour']->hours; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | $recipient = $_ENV["RECIPIENT"]; |
| 47 | 47 | $token_length = strlen($recipient) - strlen($prefix) - strlen($suffix); |
| 48 | -if ( $token_length <= 0 |
|
| 48 | +if ($token_length <= 0 |
|
| 49 | 49 | || substr($recipient, 0, strlen($prefix)) != $prefix |
| 50 | 50 | || substr($recipient, strlen($prefix) + $token_length) != $suffix) { |
| 51 | 51 | error_log("Recipient address does not match address template: $recipient"); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | fclose($fh); |
| 62 | 62 | exit(0); |
| 63 | 63 | } |
| 64 | -} elseif ( substr($BOUNCE_LOGGER, 0, strlen("http://")) == "http://" |
|
| 64 | +} elseif (substr($BOUNCE_LOGGER, 0, strlen("http://")) == "http://" |
|
| 65 | 65 | || substr($BOUNCE_LOGGER, 0, strlen("https://")) == "https://") { |
| 66 | 66 | $client = new org_openpsa_httplib(); |
| 67 | 67 | $client->post($BOUNCE_LOGGER, ["token" => $token]); |
@@ -222,7 +222,8 @@ discard block |
||
| 222 | 222 | $this->_backend->send($person, $member, $token, $subject, $content, $from); |
| 223 | 223 | self::$_messages_sent++; |
| 224 | 224 | $status = org_openpsa_directmarketing_campaign_messagereceipt_dba::SENT; |
| 225 | - } catch (midcom_error $e) { |
|
| 225 | + } |
|
| 226 | + catch (midcom_error $e) { |
|
| 226 | 227 | $status = org_openpsa_directmarketing_campaign_messagereceipt_dba::FAILURE; |
| 227 | 228 | if (!$this->test_mode) { |
| 228 | 229 | $params[] = [ |
@@ -279,7 +280,8 @@ discard block |
||
| 279 | 280 | { |
| 280 | 281 | try { |
| 281 | 282 | $person = org_openpsa_contacts_person_dba::get_cached($member->person); |
| 282 | - } catch (midcom_error $e) { |
|
| 283 | + } |
|
| 284 | + catch (midcom_error $e) { |
|
| 283 | 285 | debug_add("Person #{$member->person} deleted or missing, removing member (member #{$member->id})"); |
| 284 | 286 | $member->orgOpenpsaObtype = org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED; |
| 285 | 287 | $member->delete(); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | parent::__construct(); |
| 81 | 81 | $this->_message = $message; |
| 82 | 82 | |
| 83 | - if ( $this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_TEXT |
|
| 83 | + if ($this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_TEXT |
|
| 84 | 84 | && $this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_HTML) { |
| 85 | 85 | throw new midcom_error('unsupported message type'); |
| 86 | 86 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $token .= midcom_helper_misc::random_string($this->token_size - 1, 'abcdefghijklmnopqrstuvwxyz0123456789'); |
| 248 | 248 | |
| 249 | 249 | //If token is not free or (very, very unlikely) matches our dummy token, recurse. |
| 250 | - if ( $token === 'dummy' |
|
| 250 | + if ($token === 'dummy' |
|
| 251 | 251 | || !org_openpsa_directmarketing_campaign_messagereceipt_dba::token_is_free($token)) { |
| 252 | 252 | return $this->_create_token(); |
| 253 | 253 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | return false; |
| 272 | 272 | } |
| 273 | 273 | $type = $this->_backend->get_type(); |
| 274 | - if ( $person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
| 274 | + if ($person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
| 275 | 275 | || $person->get_parameter('org.openpsa.directmarketing', "send_{$type}_denied")) { |
| 276 | 276 | debug_add("Sending {$type} messages to person {$person->rname} is denied, unsubscribing member (member #{$member->id})"); |
| 277 | 277 | $member->orgOpenpsaObtype = org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | return; |
| 75 | 75 | } |
| 76 | 76 | $parent = $this->get_parent(); |
| 77 | - if ( $parent |
|
| 77 | + if ($parent |
|
| 78 | 78 | && $parent->component == 'org.openpsa.documents') { |
| 79 | 79 | midcom::get()->auth->request_sudo('org.openpsa.documents'); |
| 80 | 80 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * if nothing matched so far and the subtype is alphanumeric, uppercase it on the theory |
| 171 | 171 | * that it's probably a file extension |
| 172 | 172 | */ |
| 173 | - if ( $st_orig == $subtype |
|
| 173 | + if ($st_orig == $subtype |
|
| 174 | 174 | && preg_match('/^[a-z0-9]+$/', $subtype)) { |
| 175 | 175 | $subtype = strtoupper($subtype); |
| 176 | 176 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $properties = $this->get_properties(); |
| 186 | 186 | // Copy current properties |
| 187 | 187 | foreach ($properties as $key) { |
| 188 | - if ( $key != 'guid' |
|
| 188 | + if ($key != 'guid' |
|
| 189 | 189 | && $key != 'id' |
| 190 | 190 | && $key != 'metadata') { |
| 191 | 191 | $backup->$key = $this->{$key}; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $backup_attachment = $backup->create_attachment($original_attachment->name, $original_attachment->title, $original_attachment->mimetype); |
| 218 | 218 | |
| 219 | 219 | $original_handle = $original_attachment->open('r'); |
| 220 | - if ( !$backup_attachment |
|
| 220 | + if (!$backup_attachment |
|
| 221 | 221 | || !$original_handle) { |
| 222 | 222 | // Failed to copy the attachment, abort |
| 223 | 223 | return $backup->delete(); |
@@ -93,8 +93,8 @@ |
||
| 93 | 93 | |
| 94 | 94 | private function prepare_url($url) |
| 95 | 95 | { |
| 96 | - if ( substr($url, 0, 1) != '/' |
|
| 97 | - && ! preg_match('|^https?://|', $url)) { |
|
| 96 | + if (substr($url, 0, 1) != '/' |
|
| 97 | + && !preg_match('|^https?://|', $url)) { |
|
| 98 | 98 | $url = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . $url; |
| 99 | 99 | } |
| 100 | 100 | return '"' . $url . '"'; |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | private function load_controller(org_openpsa_invoices_billing_data_dba $bd) |
| 31 | 31 | { |
| 32 | 32 | $schemadb = schemadb::from_path($this->_config->get('schemadb_billing_data')); |
| 33 | - $vat =& $schemadb->get('default')->get_field('vat'); |
|
| 34 | - $due =& $schemadb->get('default')->get_field('due'); |
|
| 33 | + $vat = & $schemadb->get('default')->get_field('vat'); |
|
| 34 | + $due = & $schemadb->get('default')->get_field('due'); |
|
| 35 | 35 | // Fill VAT select |
| 36 | 36 | $vat_array = explode(',', $this->_config->get('vat_percentages')); |
| 37 | 37 | if (!empty($vat_array)) { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $data['controller'] = $this->load_controller($bd); |
| 75 | 75 | |
| 76 | 76 | $workflow = $this->get_workflow('datamanager', ['controller' => $data['controller']]); |
| 77 | - if ( $mode == 'edit' |
|
| 77 | + if ($mode == 'edit' |
|
| 78 | 78 | && $bd->can_do('midgard:delete')) { |
| 79 | 79 | $delete = $this->get_workflow('delete', [ |
| 80 | 80 | 'object' => $bd, |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // OPML subscription list import support |
| 85 | - if ( array_key_exists('net_nemein_rss_manage_opml', $_FILES) |
|
| 85 | + if (array_key_exists('net_nemein_rss_manage_opml', $_FILES) |
|
| 86 | 86 | && is_uploaded_file($_FILES['net_nemein_rss_manage_opml']['tmp_name'])) { |
| 87 | 87 | $opml_file = $_FILES['net_nemein_rss_manage_opml']['tmp_name']; |
| 88 | 88 | |