@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // Hide the articles that have the publish time in the future and if |
| 43 | 43 | // the user is not administrator |
| 44 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
| 44 | + if ($this->_config->get('enable_scheduled_publishing') |
|
| 45 | 45 | && !midcom::get()->auth->admin) { |
| 46 | 46 | // Show the article only if the publishing time has passed or the viewer |
| 47 | 47 | // is the author |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | private function _add_pseudo_leaves(array &$leaves) |
| 85 | 85 | { |
| 86 | - if ( $this->_config->get('archive_enable') |
|
| 86 | + if ($this->_config->get('archive_enable') |
|
| 87 | 87 | && $this->_config->get('archive_in_navigation')) { |
| 88 | 88 | $leaves["{$this->_topic->id}_ARCHIVE"] = [ |
| 89 | 89 | MIDCOM_NAV_URL => "archive/", |
| 90 | 90 | MIDCOM_NAV_NAME => $this->_l10n->get('archive'), |
| 91 | 91 | ]; |
| 92 | 92 | } |
| 93 | - if ( $this->_config->get('rss_enable') |
|
| 93 | + if ($this->_config->get('rss_enable') |
|
| 94 | 94 | && $this->_config->get('feeds_in_navigation')) { |
| 95 | 95 | $leaves[self::LEAFID_FEEDS] = [ |
| 96 | 96 | MIDCOM_NAV_URL => "feeds/", |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | ]; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( $this->_config->get('categories_in_navigation') |
|
| 101 | + if ($this->_config->get('categories_in_navigation') |
|
| 102 | 102 | && $this->_config->get('categories') != '') { |
| 103 | 103 | $categories = explode(',', $this->_config->get('categories')); |
| 104 | 104 | foreach ($categories as $category) { |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if ( $this->_config->get('archive_years_in_navigation') |
|
| 112 | + if ($this->_config->get('archive_years_in_navigation') |
|
| 113 | 113 | && $this->_config->get('archive_years_enable')) { |
| 114 | 114 | $qb = midcom_db_article::new_query_builder(); |
| 115 | 115 | $qb->add_constraint('topic', '=', $this->_topic->id); |
| 116 | 116 | |
| 117 | 117 | // Hide the articles that have the publish time in the future and if |
| 118 | 118 | // the user is not administrator |
| 119 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
| 119 | + if ($this->_config->get('enable_scheduled_publishing') |
|
| 120 | 120 | && !midcom::get()->auth->admin) { |
| 121 | 121 | // Show the article only if the publishing time has passed or the viewer |
| 122 | 122 | // is the author |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if ( $this->_topic->can_do('midgard:update') |
|
| 76 | + if ($this->_topic->can_do('midgard:update') |
|
| 77 | 77 | && $this->_topic->can_do('midcom:component_config')) { |
| 78 | 78 | $buttons[] = $workflow->get_button('config/', [ |
| 79 | 79 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | private static function _check_permissions($deleted) |
| 159 | 159 | { |
| 160 | 160 | // PONDER: Check for some generic user privilege instead ?? |
| 161 | - if ( $deleted |
|
| 161 | + if ($deleted |
|
| 162 | 162 | && !midcom_connection::is_admin() |
| 163 | 163 | && !midcom::get()->auth->is_component_sudo()) { |
| 164 | 164 | debug_add('Non-admins are not allowed to list deleted objects', MIDCOM_LOG_ERROR); |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | 'target' => $ref->get_link_target($field) |
| 249 | 249 | ]; |
| 250 | 250 | $linked_class = $ref->get_link_name($field); |
| 251 | - if ( empty($linked_class) |
|
| 251 | + if (empty($linked_class) |
|
| 252 | 252 | && $info['type'] === MGD_TYPE_GUID) { |
| 253 | 253 | // Guid link without class specification, valid for all classes |
| 254 | 254 | if (empty($info['target'])) { |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $field_type = $field_data['type']; |
| 299 | 299 | $field = $field_data['name']; |
| 300 | 300 | |
| 301 | - if ( !$field_target |
|
| 301 | + if (!$field_target |
|
| 302 | 302 | || !isset($for_object->$field_target)) { |
| 303 | 303 | // Why return false ??? |
| 304 | 304 | return false; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $parent_property = midgard_object_class::get_property_parent($schema_type); |
| 415 | 415 | $up_property = midgard_object_class::get_property_up($schema_type); |
| 416 | 416 | |
| 417 | - if ( !$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class) |
|
| 417 | + if (!$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class) |
|
| 418 | 418 | && !$this->_resolve_child_classes_links_back($up_property, $schema_type, $this->mgdschema_class)) { |
| 419 | 419 | continue; |
| 420 | 420 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | $ref = new midgard_reflection_property($prospect_type); |
| 441 | 441 | $link_class = $ref->get_link_name($property); |
| 442 | - if ( empty($link_class) |
|
| 442 | + if (empty($link_class) |
|
| 443 | 443 | && $ref->get_midgard_type($property) === MGD_TYPE_GUID) { |
| 444 | 444 | return true; |
| 445 | 445 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | ]); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if ( midcom::get()->config->get('midcom_services_rcs_enable') |
|
| 57 | + if (midcom::get()->config->get('midcom_services_rcs_enable') |
|
| 58 | 58 | && $object->can_do('midgard:update') |
| 59 | 59 | && $object->_use_rcs) { |
| 60 | 60 | $buttons[] = [ |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $icon = 'stock-icons/16x16/page-' . $icontype . '.png'; |
| 87 | - if ( !midcom::get()->config->get('show_hidden_objects') |
|
| 87 | + if (!midcom::get()->config->get('show_hidden_objects') |
|
| 88 | 88 | && !$object->metadata->is_visible()) { |
| 89 | 89 | // Take scheduling into account |
| 90 | 90 | $icon = 'stock-icons/16x16/page-' . $icontype . '-notpublished.png'; |
@@ -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[] = [ |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | $rows = $mc->get_rows(['id', 'name', 'guid'], 'id'); |
| 151 | 151 | |
| 152 | 152 | foreach ($images as $image) { |
| 153 | - if ( !isset($rows[$image->attachment]) |
|
| 153 | + if (!isset($rows[$image->attachment]) |
|
| 154 | 154 | || !isset($rows[$image->image]) |
| 155 | 155 | || !isset($rows[$image->thumbnail])) { |
| 156 | 156 | continue; |
@@ -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]); |
@@ -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(); |