@@ -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 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | return $data; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - $preg='/s:([0-9]+):"(.*?)";/ms'; |
|
| 255 | + $preg = '/s:([0-9]+):"(.*?)";/ms'; |
|
| 256 | 256 | preg_match_all($preg, $data, $matches); |
| 257 | 257 | $cache = []; |
| 258 | 258 | |
@@ -348,13 +348,13 @@ discard block |
||
| 348 | 348 | $theme_path = implode('/', $path_array); |
| 349 | 349 | $candidates = []; |
| 350 | 350 | if ($substyle) { |
| 351 | - $candidates[] = $theme_root . $theme_path . "/style/{$substyle}/{$element_name}.php"; |
|
| 351 | + $candidates[] = $theme_root . $theme_path . "/style/{$substyle}/{$element_name}.php"; |
|
| 352 | 352 | } |
| 353 | 353 | if ($page) { |
| 354 | - $candidates[] = $theme_root . $theme_path . "/style{$page}/{$element_name}.php"; |
|
| 354 | + $candidates[] = $theme_root . $theme_path . "/style{$page}/{$element_name}.php"; |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - $candidates[] = $theme_root . $theme_path . "/style/{$element_name}.php"; |
|
| 357 | + $candidates[] = $theme_root . $theme_path . "/style/{$element_name}.php"; |
|
| 358 | 358 | |
| 359 | 359 | foreach (array_filter($candidates, 'file_exists') as $candidate) { |
| 360 | 360 | return file_get_contents($candidate); |
@@ -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[] = [ |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $result_cache[$cache_key] = []; |
| 77 | - $ret =& $result_cache[$cache_key]; |
|
| 77 | + $ret = & $result_cache[$cache_key]; |
|
| 78 | 78 | |
| 79 | 79 | if (empty($up)) { |
| 80 | 80 | // TODO: use reflection to see what kind of property this is ? |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | $value_properties[] = $keyproperty; |
| 95 | 95 | } |
| 96 | 96 | foreach ($label_fields as $fieldname) { |
| 97 | - if ( $fieldname != 'id' |
|
| 97 | + if ($fieldname != 'id' |
|
| 98 | 98 | && $fieldname != $keyproperty) { |
| 99 | 99 | $value_properties[] = $fieldname; |
| 100 | 100 | continue; |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $mc = org_openpsa_products_product_group_dba::new_collector('up', (int)$up); |
|
| 104 | + $mc = org_openpsa_products_product_group_dba::new_collector('up', (int) $up); |
|
| 105 | 105 | if ($order_by_score) { |
| 106 | 106 | $mc->add_order('metadata.score', 'DESC'); |
| 107 | 107 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | $properties = ['fromClass', 'toClass', 'fromGuid', 'toGuid', 'fromComponent', 'toComponent', 'status', 'toExtra', 'toExtra']; |
| 93 | 93 | foreach ($properties as $property) { |
| 94 | - if ( !empty($defaults->$property) |
|
| 94 | + if (!empty($defaults->$property) |
|
| 95 | 95 | && empty($link->$property)) { |
| 96 | 96 | debug_add("Copying property '{$property}' ('{$defaults->$property}') from defaults"); |
| 97 | 97 | $link->$property = $defaults->$property; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | if ($component) { |
| 101 | 101 | debug_add('$component given, guessing direction'); |
| 102 | - if ( empty($link->toComponent) |
|
| 102 | + if (empty($link->toComponent) |
|
| 103 | 103 | && !empty($link->fromComponent)) { |
| 104 | 104 | debug_add("Setting property 'toComponent' to '{$component}'"); |
| 105 | 105 | $link->toComponent = $component; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | if (is_object($obj)) { |
| 112 | 112 | debug_add('$obj given, guessing direction'); |
| 113 | - if ( empty($link->toGuid) |
|
| 113 | + if (empty($link->toGuid) |
|
| 114 | 114 | && !empty($link->fromGuid)) { |
| 115 | 115 | $link->toClass = get_class($obj); |
| 116 | 116 | $link->toGuid = $obj->guid; |
@@ -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; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | // elfinder tmp detection doesn't work on OS X |
| 19 | 19 | $this->tmpPath = midcom::get()->config->get('midcom_tempdir'); |
| 20 | 20 | // elfinder calls exit(), so we need to make sure we write caches |
| 21 | - register_shutdown_function(function () { |
|
| 21 | + register_shutdown_function(function() { |
|
| 22 | 22 | midcom::get()->finish(); |
| 23 | 23 | }); |
| 24 | 24 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | if (($dir = $this->dir($dst)) == false) { |
| 46 | - return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst); |
|
| 46 | + return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#' . $dst); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if (!$dir['write']) { |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | if ($file && $file['name'] === $name) { // file exists and check filename for item ID based filesystem |
| 86 | 86 | // check POST data `overwrite` for 3rd party uploader |
| 87 | - $overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite']; |
|
| 87 | + $overwrite = isset($_POST['overwrite']) ? (bool) $_POST['overwrite'] : $this->options['uploadOverwrite']; |
|
| 88 | 88 | if ($overwrite) { |
| 89 | 89 | if (!$file['write']) { |
| 90 | 90 | return $this->setError(elFinder::ERROR_PERM_DENIED); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $output = [$object->get_label()]; |
| 251 | 251 | |
| 252 | 252 | $parent = $object->get_parent(); |
| 253 | - while ( $parent |
|
| 253 | + while ($parent |
|
| 254 | 254 | && $parent->component == 'org.openpsa.documents') { |
| 255 | 255 | $output[] = $parent->extra; |
| 256 | 256 | $parent = $parent->get_parent(); |
@@ -347,12 +347,12 @@ discard block |
||
| 347 | 347 | $data['mime'] = 'directory'; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if ( $owner |
|
| 350 | + if ($owner |
|
| 351 | 351 | && $group = midcom::get()->auth->get_assignee($owner)) { |
| 352 | 352 | $data['group'] = $group->name; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - if ( $this->root !== $path |
|
| 355 | + if ($this->root !== $path |
|
| 356 | 356 | && $parent = $object->get_parent()) { |
| 357 | 357 | $data['phash'] = $this->encode($parent->guid); |
| 358 | 358 | } |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | * @param string $mode open mode |
| 412 | 412 | * @return resource|false |
| 413 | 413 | */ |
| 414 | - protected function _fopen($path, $mode="rb") |
|
| 414 | + protected function _fopen($path, $mode = "rb") |
|
| 415 | 415 | { |
| 416 | 416 | $document = org_openpsa_documents_document_dba::get_cached($path); |
| 417 | 417 | $attachments = org_openpsa_helpers::get_dm2_attachments($document, 'document'); |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | * @param string $path file path |
| 430 | 430 | * @return bool |
| 431 | 431 | */ |
| 432 | - protected function _fclose($fp, $path='') |
|
| 432 | + protected function _fclose($fp, $path = '') |
|
| 433 | 433 | { |
| 434 | 434 | fclose($fp); |
| 435 | 435 | return true; |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | { |
| 614 | 614 | $filename = midcom_db_attachment::safe_filename($name, true); |
| 615 | 615 | $att = $doc->create_attachment($filename, $name, $mimetype); |
| 616 | - if ( !$att |
|
| 616 | + if (!$att |
|
| 617 | 617 | || !$att->copy_from_handle($fp)) { |
| 618 | 618 | return false; |
| 619 | 619 | } |