]> git.mxchange.org Git - friendica.git/blobdiff - include/event.php
Merge pull request #3868 from rabuzarus/20171104_-_use_best_link_url_for_events
[friendica.git] / include / event.php
index 88e559a7f30b37038333c5dca5b598ca4e972b39..b9988badfa1aaddbc110b03bfc8c43770ad5c9b8 100644 (file)
@@ -959,9 +959,11 @@ function format_event_item($item) {
 
        // Format the event location.
        $evloc = event_location2array($item['event-location']);
-       $location = array(
-               'name' => prepare_text($evloc['name'])
-       );
+       $location = array();
+
+       if (isset($evloc['name'])) {
+               $location['name'] = prepare_text($evloc['name']);
+       }
        // Construct the map HTML.
        if (isset($evloc['address'])) {
                $location['map'] = '<div class="map">' . generate_named_map($evloc['address']) . '</div>';
@@ -969,6 +971,14 @@ function format_event_item($item) {
                $location['map'] = '<div class="map">' . generate_map(str_replace('/', ' ', $evloc['coordinates'])) . '</div>';
        }
 
+       // Construct the profile link (magic-auth).
+       $sp = false;
+       $profile_link = best_link_url($item, $sp);
+
+       if (!$sp) {
+               $profile_link = zrl($profile_link);
+       }
+
        $event = replace_macros(get_markup_template('event_stream_item.tpl'), array(
                '$id'             => $item['event-id'],
                '$title'          => prepare_text($item['event-summary']),
@@ -987,9 +997,9 @@ function format_event_item($item) {
                '$end_time'       => $end_time,
                '$end_short'      => $end_short,
                '$author_name'    => $item['author-name'],
-               '$author_link'    => $item['author-link'],
+               '$author_link'    => $profile_link,
                '$author_avatar'  => $item['author-avatar'],
-               '$description'    => prepare_text($item['event-desc']),
+               '$description'    => prepare_text($item['event-desc']),
                '$location_label' => t('Location:'),
                '$show_map_label' => t('Show map'),
                '$hide_map_label' => t('Hide map'),