@@ -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 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | if ($handler_id == 'feed-category-rss2') { |
53 | 53 | // This is not a predefined category from configuration, check if site maintainer allows us to show it |
54 | - if ( !in_array($args[0], $data['categories']) |
|
54 | + if (!in_array($args[0], $data['categories']) |
|
55 | 55 | && !$this->_config->get('categories_custom_enable')) { |
56 | 56 | throw new midcom_error('Custom category support is disabled'); |
57 | 57 | } |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | $this->_uncached = $config->get('cache_module_content_uncached'); |
172 | 172 | $this->_headers_strategy = $this->get_strategy('cache_module_content_headers_strategy'); |
173 | 173 | $this->_headers_strategy_authenticated = $this->get_strategy('cache_module_content_headers_strategy_authenticated'); |
174 | - $this->_default_lifetime = (int)$config->get('cache_module_content_default_lifetime'); |
|
175 | - $this->_default_lifetime_authenticated = (int)$config->get('cache_module_content_default_lifetime_authenticated'); |
|
174 | + $this->_default_lifetime = (int) $config->get('cache_module_content_default_lifetime'); |
|
175 | + $this->_default_lifetime_authenticated = (int) $config->get('cache_module_content_default_lifetime_authenticated'); |
|
176 | 176 | |
177 | 177 | if ($this->_headers_strategy == 'no-cache') { |
178 | 178 | // we can't call no_cache() here, because it would try to call back to this class via the global getter |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | */ |
456 | 456 | public function expires(int $timestamp) |
457 | 457 | { |
458 | - if ( $this->_expires === null |
|
458 | + if ($this->_expires === null |
|
459 | 459 | || $this->_expires > $timestamp) { |
460 | 460 | $this->_expires = $timestamp; |
461 | 461 | } |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | */ |
568 | 568 | public function write_meta_cache(string $content_id, Request $request, Response $response) |
569 | 569 | { |
570 | - if ( $this->_uncached |
|
570 | + if ($this->_uncached |
|
571 | 571 | || $this->_no_cache) { |
572 | 572 | return; |
573 | 573 | } |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | |
637 | 637 | public function store_dl_content(int $context, string $dl_cache_data, Request $request) |
638 | 638 | { |
639 | - if ( $this->_no_cache |
|
639 | + if ($this->_no_cache |
|
640 | 640 | || $this->_uncached) { |
641 | 641 | return; |
642 | 642 | } |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | |
677 | 677 | /* TODO: Doublecheck the way this is handled, now we just don't send it |
678 | 678 | * if headers_strategy implies caching */ |
679 | - if ( !$response->headers->has('Content-Length') |
|
679 | + if (!$response->headers->has('Content-Length') |
|
680 | 680 | && !in_array($this->_headers_strategy, ['public', 'private'])) { |
681 | 681 | $response->headers->set("Content-Length", strlen($response->getContent())); |
682 | 682 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | while ($parent = $object->get_parent()) { |
337 | 337 | // Verify that this topic is within the current sites tree, if it is not, |
338 | 338 | // we ignore it. |
339 | - if ( is_a($parent, midcom_db_topic::class) |
|
339 | + if (is_a($parent, midcom_db_topic::class) |
|
340 | 340 | && $this->is_node_in_tree($parent->id, $this->get_root_node())) { |
341 | 341 | return $parent; |
342 | 342 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | $entry = "<span class=\"{$current_class}\">{$entry}</span>"; |
391 | 391 | } |
392 | 392 | } else { |
393 | - if ( !empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
393 | + if (!empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
394 | 394 | && in_array($data['napobject'][MIDCOM_NAV_GUID], $skip_guids)) { |
395 | 395 | continue; |
396 | 396 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | $id = "custom-{$key}"; |
505 | 505 | |
506 | 506 | $url = "{$prefix}{$entry[MIDCOM_NAV_URL]}"; |
507 | - if ( str_starts_with($entry[MIDCOM_NAV_URL], '/') |
|
507 | + if (str_starts_with($entry[MIDCOM_NAV_URL], '/') |
|
508 | 508 | || preg_match('|^https?://|', $entry[MIDCOM_NAV_URL])) { |
509 | 509 | $url = $entry[MIDCOM_NAV_URL]; |
510 | 510 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $temp = array_shift($_FILES); |
21 | 21 | |
22 | 22 | // Verify file extension |
23 | - if ( is_uploaded_file($temp['tmp_name']) |
|
23 | + if (is_uploaded_file($temp['tmp_name']) |
|
24 | 24 | && !in_array(strtolower(pathinfo($temp['name'], PATHINFO_EXTENSION)), ["gif", "jpg", "png"])) { |
25 | 25 | throw new midcom_error('Invalid extension.'); |
26 | 26 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $this->calculate_price(false); |
80 | 80 | |
81 | - if ( $this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
81 | + if ($this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
82 | 82 | && $this->continuous) { |
83 | 83 | $this->end = 0; |
84 | 84 | } elseif ($this->end < $this->start) { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $calculator->run($this); |
167 | 167 | $cost = $calculator->get_cost(); |
168 | 168 | $price = $calculator->get_price(); |
169 | - if ( $price != $this->price |
|
169 | + if ($price != $this->price |
|
170 | 170 | || $cost != $this->cost) { |
171 | 171 | $this->price = $price; |
172 | 172 | $this->cost = $cost; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $units = $agreement_hours['invoiceable']; |
214 | 214 | $uninvoiceableUnits = $agreement_hours['reported'] - ($agreement_hours['invoiceable'] + $agreement_hours['invoiced']); |
215 | 215 | |
216 | - if ( $units != $this->units |
|
216 | + if ($units != $this->units |
|
217 | 217 | || $uninvoiceableUnits != $this->uninvoiceableUnits) { |
218 | 218 | debug_add("agreement values have changed, setting units to " . $units . ", uninvoiceable: " . $uninvoiceableUnits); |
219 | 219 | $this->units = $units; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | public function invoice() : bool |
269 | 269 | { |
270 | - if ( $this->state >= self::STATE_INVOICED |
|
270 | + if ($this->state >= self::STATE_INVOICED |
|
271 | 271 | || $this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) { |
272 | 272 | return false; |
273 | 273 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | } |
362 | 362 | |
363 | 363 | // Check if we need to create task or ship goods |
364 | - if ( $update_deliveries |
|
364 | + if ($update_deliveries |
|
365 | 365 | && $product->orgOpenpsaObtype === org_openpsa_products_product_dba::TYPE_SERVICE) { |
366 | 366 | // Change status of tasks connected to the deliverable |
367 | 367 | $qb = org_openpsa_projects_task_dba::new_query_builder(); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | public function _on_creating() : bool |
27 | 27 | { |
28 | - if ( !$this->referrer |
|
28 | + if (!$this->referrer |
|
29 | 29 | && !empty($_SERVER['HTTP_REFERER'])) { |
30 | 30 | $this->referrer = $_SERVER['HTTP_REFERER']; |
31 | 31 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | } |
121 | 121 | $profit = $value - $cost; |
122 | - if ( $this->value != $value |
|
122 | + if ($this->value != $value |
|
123 | 123 | || $this->profit != $profit) { |
124 | 124 | $this->value = $value; |
125 | 125 | $this->profit = $value - $cost; |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | |
185 | 185 | public function _on_updating() : bool |
186 | 186 | { |
187 | - if ( $this->state != self::STATE_ACTIVE |
|
187 | + if ($this->state != self::STATE_ACTIVE |
|
188 | 188 | && !$this->end) { |
189 | 189 | //Not active anymore and end not set, set it to now |
190 | 190 | $this->end = time(); |
191 | 191 | } |
192 | - if ( $this->end |
|
192 | + if ($this->end |
|
193 | 193 | && $this->state == self::STATE_ACTIVE) { |
194 | 194 | //Returned to active state, clear the end marker. |
195 | 195 | $this->end = 0; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | public function _on_creating() : bool |
27 | 27 | { |
28 | - if ( $this->invoice |
|
28 | + if ($this->invoice |
|
29 | 29 | && $this->position == 0) { |
30 | 30 | $invoice = org_openpsa_invoices_invoice_dba::get_cached($this->invoice); |
31 | 31 | $this->position = count($invoice->get_invoice_items()) + 1; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } catch (midcom_error $e) { |
76 | 76 | } |
77 | 77 | } |
78 | - if ( $url == '' |
|
78 | + if ($url == '' |
|
79 | 79 | && $sales_url) { |
80 | 80 | try { |
81 | 81 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($this->deliverable); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $invoice = new org_openpsa_invoices_invoice_dba($this->invoice); |
98 | 98 | $old_sum = $invoice->sum; |
99 | 99 | self::update_invoice($invoice); |
100 | - if ( $old_sum != $invoice->sum |
|
100 | + if ($old_sum != $invoice->sum |
|
101 | 101 | && !empty($this->deliverable)) { |
102 | 102 | $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($this->deliverable); |
103 | 103 | self::update_deliverable($deliverable); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | if ($invoiced != $deliverable->invoiced) { |
137 | 137 | $deliverable->invoiced = $invoiced; |
138 | - if ( $deliverable->orgOpenpsaObtype !== org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
138 | + if ($deliverable->orgOpenpsaObtype !== org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
139 | 139 | && $deliverable->state < org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED) { |
140 | 140 | $deliverable->state = org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED; |
141 | 141 | } |