@@ -197,7 +197,8 @@ |
||
| 197 | 197 | if ($this->_response === null) { |
| 198 | 198 | $this->_stop('Could not handle request, unknown method', 405); |
| 199 | 199 | } |
| 200 | - } catch (midcom_error $e) { |
|
| 200 | + } |
|
| 201 | + catch (midcom_error $e) { |
|
| 201 | 202 | $this->_responseStatus = $e->getCode(); |
| 202 | 203 | return $this->_send_response($e->getMessage()); |
| 203 | 204 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | { |
| 293 | 293 | if (in_array($key, $this->field_config['timebased'])) { |
| 294 | 294 | // This is ugly, but seems the only possible way... |
| 295 | - if ( isset($this->__metadata->$key) |
|
| 295 | + if (isset($this->__metadata->$key) |
|
| 296 | 296 | && (string) $this->__metadata->$key !== "0001-01-01T00:00:00+00:00") { |
| 297 | 297 | return (int) $this->__metadata->$key->format('U'); |
| 298 | 298 | } |
@@ -354,11 +354,11 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | $now = time(); |
| 357 | - if ( $this->get('schedulestart') |
|
| 357 | + if ($this->get('schedulestart') |
|
| 358 | 358 | && $this->get('schedulestart') > $now) { |
| 359 | 359 | return false; |
| 360 | 360 | } |
| 361 | - if ( $this->get('scheduleend') |
|
| 361 | + if ($this->get('scheduleend') |
|
| 362 | 362 | && $this->get('scheduleend') < $now) { |
| 363 | 363 | return false; |
| 364 | 364 | } |
@@ -374,9 +374,9 @@ discard block |
||
| 374 | 374 | public function is_object_visible_onsite() : bool |
| 375 | 375 | { |
| 376 | 376 | return |
| 377 | - ( ( midcom::get()->config->get('show_hidden_objects') |
|
| 377 | + ((midcom::get()->config->get('show_hidden_objects') |
|
| 378 | 378 | || $this->is_visible()) |
| 379 | - && ( midcom::get()->config->get('show_unapproved_objects') |
|
| 379 | + && (midcom::get()->config->get('show_unapproved_objects') |
|
| 380 | 380 | || $this->is_approved()) |
| 381 | 381 | ); |
| 382 | 382 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $guid = $source; |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - if ( $object === null |
|
| 447 | + if ($object === null |
|
| 448 | 448 | && mgd_is_guid($guid)) { |
| 449 | 449 | try { |
| 450 | 450 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | // Lock was created by the user, return "not locked" |
| 480 | - if ( !empty(midcom::get()->auth->user->guid) |
|
| 480 | + if (!empty(midcom::get()->auth->user->guid) |
|
| 481 | 481 | && $this->get('locker') === midcom::get()->auth->user->guid) { |
| 482 | 482 | return false; |
| 483 | 483 | } |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | { |
| 496 | 496 | midcom::get()->auth->require_do('midgard:update', $this->__object); |
| 497 | 497 | |
| 498 | - if ( is_object($this->__object) |
|
| 498 | + if (is_object($this->__object) |
|
| 499 | 499 | && $this->__object->lock()) { |
| 500 | 500 | $this->_cache = []; |
| 501 | 501 | return true; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | */ |
| 512 | 512 | public function can_unlock() : bool |
| 513 | 513 | { |
| 514 | - return ( $this->__object->can_do('midcom:unlock') |
|
| 514 | + return ($this->__object->can_do('midcom:unlock') |
|
| 515 | 515 | || midcom::get()->auth->can_user_do('midcom:unlock', null, midcom_services_auth::class)); |
| 516 | 516 | } |
| 517 | 517 | |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | public function unlock() : bool |
| 524 | 524 | { |
| 525 | - if ( $this->can_unlock() |
|
| 525 | + if ($this->can_unlock() |
|
| 526 | 526 | && is_object($this->__object) |
| 527 | 527 | && $this->__object->unlock()) { |
| 528 | 528 | $this->_cache = []; |