X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FEvent.php;h=992b77badabaf8042907aae3df0b7d5af4eb0353;hb=0bc2fe66f54717a3f2e86fd9626dc565e9d00fd7;hp=da386a77b7dbd39540d9fe11916f19f878a48775;hpb=ca2c316de03ad0be95326b4d06edfec076c1a85f;p=friendica.git
diff --git a/src/Model/Event.php b/src/Model/Event.php
index da386a77b7..992b77bada 100644
--- a/src/Model/Event.php
+++ b/src/Model/Event.php
@@ -48,9 +48,13 @@ class Event extends BaseObject
}
if ($simple) {
- $o = "
" . BBCode::convert($event['summary'], false, $simple) . "
";
+ if (!empty($event['summary'])) {
+ $o = "" . BBCode::convert($event['summary'], false, $simple) . "
";
+ }
- $o .= "" . BBCode::convert($event['desc'], false, $simple) . "
";
+ if (!empty($event['desc'])) {
+ $o .= "" . BBCode::convert($event['desc'], false, $simple) . "
";
+ }
$o .= "" . L10n::t('Starts:') . "
" . $event_start . "
";
@@ -58,7 +62,7 @@ class Event extends BaseObject
$o .= "" . L10n::t('Finishes:') . "
" . $event_end . "
";
}
- if (strlen($event['location'])) {
+ if (!empty($event['location'])) {
$o .= "" . L10n::t('Location:') . "
" . BBCode::convert($event['location'], false, $simple) . "
";
}
@@ -76,14 +80,16 @@ class Event extends BaseObject
if (!$event['nofinish']) {
$o .= '' . L10n::t('Finishes:') . ' ' . $event_end
. '
' . "\r\n";
}
- $o .= '' . BBCode::convert($event['desc'], false, $simple) . '
' . "\r\n";
+ if (!empty($event['desc'])) {
+ $o .= '' . BBCode::convert($event['desc'], false, $simple) . '
' . "\r\n";
+ }
- if (strlen($event['location'])) {
+ if (!empty($event['location'])) {
$o .= '' . L10n::t('Location:') . ' '
. BBCode::convert($event['location'], false, $simple)
. '
' . "\r\n";
@@ -307,7 +313,7 @@ class Event extends BaseObject
Addon::callHooks('event_updated', $event['id']);
} else {
- $event['guid'] = System::createGUID(32);
+ $event['guid'] = defaults($arr, 'guid', System::createGUID(32));
// New event. Store it.
DBA::insert('event', $event);
@@ -321,6 +327,7 @@ class Event extends BaseObject
$item_arr['uri'] = $event['uri'];
$item_arr['parent-uri'] = $event['uri'];
$item_arr['guid'] = $event['guid'];
+ $item_arr['plink'] = defaults($arr, 'plink', '');
$item_arr['post-type'] = Item::PT_EVENT;
$item_arr['wall'] = $event['cid'] ? 0 : 1;
$item_arr['contact-id'] = $contact['id'];
@@ -543,10 +550,13 @@ class Event extends BaseObject
$fmt = L10n::t('l, F j');
foreach ($event_result as $event) {
$item = Item::selectFirst(['plink', 'author-name', 'author-avatar', 'author-link'], ['id' => $event['itemid']]);
- if (DBA::isResult($item)) {
- $event = array_merge($event, $item);
+ if (!DBA::isResult($item)) {
+ // Using default values when no item had been found
+ $item = ['plink' => '', 'author-name' => '', 'author-avatar' => '', 'author-link' => ''];
}
+ $event = array_merge($event, $item);
+
$start = $event['adjust'] ? DateTimeFormat::local($event['start'], 'c') : DateTimeFormat::utc($event['start'], 'c');
$j = $event['adjust'] ? DateTimeFormat::local($event['start'], 'j') : DateTimeFormat::utc($event['start'], 'j');
$day = $event['adjust'] ? DateTimeFormat::local($event['start'], $fmt) : DateTimeFormat::utc($event['start'], $fmt);