@@ -61,7 +61,7 @@ |
||
| 61 | 61 | public function get_link($key = 0, $rel = 'alternate') |
| 62 | 62 | { |
| 63 | 63 | $link = parent::get_link($key, $rel); |
| 64 | - if ( $rel !== 'alternate' |
|
| 64 | + if ($rel !== 'alternate' |
|
| 65 | 65 | || $key !== 0) { |
| 66 | 66 | return $link; |
| 67 | 67 | } |
@@ -408,7 +408,8 @@ |
||
| 408 | 408 | //Get the parent object |
| 409 | 409 | try { |
| 410 | 410 | $parent = midcom::get()->dbfactory->get_object_by_guid($this->objectguid); |
| 411 | - } catch (midcom_error $e) { |
|
| 411 | + } |
|
| 412 | + catch (midcom_error $e) { |
|
| 412 | 413 | $e->log(); |
| 413 | 414 | return false; |
| 414 | 415 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | // Set the status |
| 188 | - if ( $this->can_do('net.nehmer.comments:moderation') |
|
| 188 | + if ($this->can_do('net.nehmer.comments:moderation') |
|
| 189 | 189 | && !$this->_sudo_requested) { |
| 190 | 190 | $this->status = self::ABUSE; |
| 191 | 191 | } else { |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | return false; |
| 210 | 210 | } |
| 211 | 211 | // Set the status |
| 212 | - if ( !$this->can_do('net.nehmer.comments:moderation') |
|
| 212 | + if (!$this->can_do('net.nehmer.comments:moderation') |
|
| 213 | 213 | || $this->_sudo_requested) { |
| 214 | 214 | return false; |
| 215 | 215 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // Set the status |
| 236 | - if ( !$this->can_do('net.nehmer.comments:moderation') |
|
| 236 | + if (!$this->can_do('net.nehmer.comments:moderation') |
|
| 237 | 237 | || $this->_sudo_requested) { |
| 238 | 238 | return false; |
| 239 | 239 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function report_not_abuse() |
| 254 | 254 | { |
| 255 | - if ( !$this->can_do('net.nehmer.comments:moderation') |
|
| 255 | + if (!$this->can_do('net.nehmer.comments:moderation') |
|
| 256 | 256 | || $this->_sudo_requested) { |
| 257 | 257 | return false; |
| 258 | 258 | } |
@@ -351,8 +351,8 @@ discard block |
||
| 351 | 351 | { |
| 352 | 352 | $config = midcom_baseclasses_components_configuration::get('net.nehmer.comments', 'config'); |
| 353 | 353 | |
| 354 | - if ( $config->get('ratings_enable') |
|
| 355 | - && ( $config->get('ratings_cache_to_object') |
|
| 354 | + if ($config->get('ratings_enable') |
|
| 355 | + && ($config->get('ratings_cache_to_object') |
|
| 356 | 356 | || $config->get('comment_count_cache_to_object'))) { |
| 357 | 357 | // Handle ratings |
| 358 | 358 | $comments = self::list_by_objectguid($this->objectguid); |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | return false; |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | - if ( empty($this->title) |
|
| 412 | + if (empty($this->title) |
|
| 413 | 413 | && empty($this->content)) { |
| 414 | 414 | // No need to send notifications about empty rating entries |
| 415 | 415 | return false; |
@@ -658,7 +658,8 @@ |
||
| 658 | 658 | && mgd_is_guid($guid)) { |
| 659 | 659 | try { |
| 660 | 660 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
| 661 | - } catch (midcom_error $e) { |
|
| 661 | + } |
|
| 662 | + catch (midcom_error $e) { |
|
| 662 | 663 | debug_add("Failed to create a metadata instance for the GUID {$guid}: " . $e->getMessage(), MIDCOM_LOG_WARN); |
| 663 | 664 | debug_print_r("Source was:", $source); |
| 664 | 665 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | { |
| 321 | 321 | if (in_array($key, $this->field_config['timebased'])) { |
| 322 | 322 | // This is ugly, but seems the only possible way... |
| 323 | - if ( isset($this->__metadata->$key) |
|
| 323 | + if (isset($this->__metadata->$key) |
|
| 324 | 324 | && (string) $this->__metadata->$key !== "0001-01-01T00:00:00+00:00") { |
| 325 | 325 | return (int) $this->__metadata->$key->format('U'); |
| 326 | 326 | } |
@@ -385,11 +385,11 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | $now = time(); |
| 388 | - if ( $this->get('schedulestart') |
|
| 388 | + if ($this->get('schedulestart') |
|
| 389 | 389 | && $this->get('schedulestart') > $now) { |
| 390 | 390 | return false; |
| 391 | 391 | } |
| 392 | - if ( $this->get('scheduleend') |
|
| 392 | + if ($this->get('scheduleend') |
|
| 393 | 393 | && $this->get('scheduleend') < $now) { |
| 394 | 394 | return false; |
| 395 | 395 | } |
@@ -407,9 +407,9 @@ discard block |
||
| 407 | 407 | public function is_object_visible_onsite() |
| 408 | 408 | { |
| 409 | 409 | return |
| 410 | - ( ( midcom::get()->config->get('show_hidden_objects') |
|
| 410 | + ((midcom::get()->config->get('show_hidden_objects') |
|
| 411 | 411 | || $this->is_visible()) |
| 412 | - && ( midcom::get()->config->get('show_unapproved_objects') |
|
| 412 | + && (midcom::get()->config->get('show_unapproved_objects') |
|
| 413 | 413 | || $this->is_approved()) |
| 414 | 414 | ); |
| 415 | 415 | } |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | $guid = $source; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - if ( $object === null |
|
| 500 | + if ($object === null |
|
| 501 | 501 | && mgd_is_guid($guid)) { |
| 502 | 502 | try { |
| 503 | 503 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | // Lock was created by the user, return "not locked" |
| 535 | - if ( !empty(midcom::get()->auth->user->guid) |
|
| 535 | + if (!empty(midcom::get()->auth->user->guid) |
|
| 536 | 536 | && $this->get('locker') === midcom::get()->auth->user->guid) { |
| 537 | 537 | return false; |
| 538 | 538 | } |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | { |
| 551 | 551 | midcom::get()->auth->require_do('midgard:update', $this->__object); |
| 552 | 552 | |
| 553 | - if ( is_object($this->__object) |
|
| 553 | + if (is_object($this->__object) |
|
| 554 | 554 | && $this->__object->lock()) { |
| 555 | 555 | $this->_cache = []; |
| 556 | 556 | return true; |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | */ |
| 568 | 568 | public function can_unlock() |
| 569 | 569 | { |
| 570 | - return ( $this->__object->can_do('midcom:unlock') |
|
| 570 | + return ($this->__object->can_do('midcom:unlock') |
|
| 571 | 571 | || midcom::get()->auth->can_user_do('midcom:unlock', null, midcom_services_auth::class)); |
| 572 | 572 | } |
| 573 | 573 | |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | */ |
| 579 | 579 | public function unlock() |
| 580 | 580 | { |
| 581 | - if ( $this->can_unlock() |
|
| 581 | + if ($this->can_unlock() |
|
| 582 | 582 | && is_object($this->__object) |
| 583 | 583 | && $this->__object->unlock()) { |
| 584 | 584 | $this->_cache = []; |
@@ -69,7 +69,8 @@ |
||
| 69 | 69 | // Use the DB Factory to resolve the class and to get the object |
| 70 | 70 | try { |
| 71 | 71 | $object = midcom::get()->dbfactory->get_object_by_guid($identifier); |
| 72 | - } catch (midcom_error $e) { |
|
| 72 | + } |
|
| 73 | + catch (midcom_error $e) { |
|
| 73 | 74 | // This is probably a pseudo leaf, store the score to the current node |
| 74 | 75 | $this->_topic->set_parameter('midcom.helper.nav.score', $identifier, $score); |
| 75 | 76 | return true; |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Approve if possible |
| 92 | - if ( $approval_status |
|
| 92 | + if ($approval_status |
|
| 93 | 93 | && $object->can_do('midcom:approve')) { |
| 94 | 94 | $object->metadata->approve(); |
| 95 | 95 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | public function _on_loaded() |
| 31 | 31 | { |
| 32 | 32 | // if we are missing the component, use the nullcomponent. |
| 33 | - if ( !$this->component |
|
| 33 | + if (!$this->component |
|
| 34 | 34 | || !array_key_exists($this->component, midcom::get()->componentloader->manifests)) { |
| 35 | 35 | debug_add("Topic {$this->id} has no component assigned to it, using 'midcom.core.nullcomponent'.", |
| 36 | 36 | MIDCOM_LOG_INFO); |
@@ -132,7 +132,8 @@ |
||
| 132 | 132 | && $nodeobject = $nav->get_node($node->id)) { |
| 133 | 133 | $napobject = $nav->get_leaf($nodeobject[MIDCOM_NAV_ID] . '-' . $object->id); |
| 134 | 134 | } |
| 135 | - } catch (midcom_error $e) { |
|
| 135 | + } |
|
| 136 | + catch (midcom_error $e) { |
|
| 136 | 137 | $e->log(); |
| 137 | 138 | } |
| 138 | 139 | return $napobject; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | // Get parent from DB and compare to catch moves |
| 78 | 78 | if ($parent = $napobject[MIDCOM_NAV_OBJECT]->get_parent()) { |
| 79 | 79 | $parent_entry_from_object = $this->get_guid($parent->guid); |
| 80 | - if ( $parent_entry_from_object |
|
| 80 | + if ($parent_entry_from_object |
|
| 81 | 81 | && $parent_entry_from_object[MIDCOM_NAV_ID] != $cached_node_id) { |
| 82 | 82 | $this->_cache->delete($this->_prefix . '-' . $parent_entry_from_object[MIDCOM_NAV_ID] . '-leaves'); |
| 83 | 83 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $parent_id = $napobject[MIDCOM_NAV_NODEID]; |
| 93 | 93 | $parent_entry = $this->get_node($parent_id); |
| 94 | 94 | |
| 95 | - if ( $parent_entry |
|
| 95 | + if ($parent_entry |
|
| 96 | 96 | && array_key_exists(MIDCOM_NAV_SUBNODES, $parent_entry)) { |
| 97 | 97 | unset($parent_entry[MIDCOM_NAV_SUBNODES]); |
| 98 | 98 | $this->put_node($parent_id, $parent_entry); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if ($parent = $napobject[MIDCOM_NAV_OBJECT]->get_parent()) { |
| 103 | 103 | $parent_entry_from_object = $this->get_guid($parent->guid); |
| 104 | 104 | |
| 105 | - if ( !empty($parent_entry_from_object[MIDCOM_NAV_ID]) |
|
| 105 | + if (!empty($parent_entry_from_object[MIDCOM_NAV_ID]) |
|
| 106 | 106 | && !empty($parent_entry[MIDCOM_NAV_ID]) |
| 107 | 107 | && $parent_entry_from_object[MIDCOM_NAV_ID] != $parent_entry[MIDCOM_NAV_ID]) { |
| 108 | 108 | unset($parent_entry_from_object[MIDCOM_NAV_SUBNODES]); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $nav = new midcom_helper_nav; |
| 129 | 129 | if ($object instanceof midcom_db_topic) { |
| 130 | 130 | $napobject = $nav->get_node($object->id); |
| 131 | - } elseif ( ($node = $nav->find_closest_topic($object)) |
|
| 131 | + } elseif (($node = $nav->find_closest_topic($object)) |
|
| 132 | 132 | && $nodeobject = $nav->get_node($node->id)) { |
| 133 | 133 | $napobject = $nav->get_leaf($nodeobject[MIDCOM_NAV_ID] . '-' . $object->id); |
| 134 | 134 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | $lang_id = midcom::get()->i18n->get_current_language(); |
| 155 | 155 | $result = $this->_cache->fetch("{$this->_prefix}-{$key}"); |
| 156 | - if ( !is_array($result) |
|
| 156 | + if (!is_array($result) |
|
| 157 | 157 | || !isset($result[$lang_id])) { |
| 158 | 158 | return false; |
| 159 | 159 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | $lang_id = midcom::get()->i18n->get_current_language(); |
| 179 | 179 | $result = $this->_cache->fetch("{$this->_prefix}-{$key}"); |
| 180 | - if ( !is_array($result) |
|
| 180 | + if (!is_array($result) |
|
| 181 | 181 | || !isset($result[$lang_id])) { |
| 182 | 182 | return false; |
| 183 | 183 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | $lang_id = midcom::get()->i18n->get_current_language(); |
| 246 | 246 | $result = $this->_cache->fetch("{$this->_prefix}-{$guid}"); |
| 247 | - if ( !is_array($result) |
|
| 247 | + if (!is_array($result) |
|
| 248 | 248 | || !isset($result[$lang_id])) { |
| 249 | 249 | return false; |
| 250 | 250 | } |
@@ -72,7 +72,8 @@ |
||
| 72 | 72 | |
| 73 | 73 | try { |
| 74 | 74 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
| 75 | - } catch (midcom_error $e) { |
|
| 75 | + } |
|
| 76 | + catch (midcom_error $e) { |
|
| 76 | 77 | debug_add("Failed to resolve the GUID {$guid}, this is most probably an access denied error.", MIDCOM_LOG_ERROR); |
| 77 | 78 | debug_add('Last MidCOM error string: ' . $e->getMessage()); |
| 78 | 79 | return null; |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | if ($object instanceof midcom_db_attachment) { |
| 94 | 94 | // Faster linking to attachments |
| 95 | 95 | $parent = $object->get_parent(); |
| 96 | - if ( is_a($parent, midcom_db_topic::class) |
|
| 96 | + if (is_a($parent, midcom_db_topic::class) |
|
| 97 | 97 | && $nav->is_node_in_tree($parent->id, $nav->get_root_node())) { |
| 98 | 98 | $napobj = $nav->get_node($parent->id); |
| 99 | 99 | return $napobj[MIDCOM_NAV_FULLURL] . $object->name; |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | */ |
| 110 | 110 | public function members_to_fields() |
| 111 | 111 | { |
| 112 | - if ( empty($this->topic_guid) |
|
| 112 | + if (empty($this->topic_guid) |
|
| 113 | 113 | || empty($this->topic_url) |
| 114 | 114 | || empty($this->component)) { |
| 115 | 115 | //if one of those is missing, we override all three to ensure consistency |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | $this->add('Setting: upload_max_filesize', self::OK, ini_get('upload_max_filesize')); |
| 105 | 105 | } else { |
| 106 | 106 | $this->add('Setting: upload_max_filesize', |
| 107 | - self::WARNING, "To make bulk uploads (for exampe in the Image Gallery) useful, you should increase the Upload limit to something above 50 MB. (Current setting: {$upload_limit})"); |
|
| 107 | + self::WARNING, "To make bulk uploads (for exampe in the Image Gallery) useful, you should increase the Upload limit to something above 50 MB. (Current setting: {$upload_limit})"); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $post_limit = $this->ini_get_filesize('post_max_size'); |
@@ -74,7 +74,8 @@ |
||
| 74 | 74 | $config = new midcom_services_rcs_config($config); |
| 75 | 75 | $config->test_rcs_config(); |
| 76 | 76 | $this->add("MidCOM RCS", self::OK); |
| 77 | - } catch (midcom_error $e) { |
|
| 77 | + } |
|
| 78 | + catch (midcom_error $e) { |
|
| 78 | 79 | $this->add("MidCOM RCS", self::ERROR, $e->getMessage()); |
| 79 | 80 | } |
| 80 | 81 | } else { |