X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fevent.php;h=8d47b5fba56838d1f841359f3375739b79e7cd2b;hb=3b2cd854837e5df38f75f323aab24e31098812d4;hp=e36aa4262d13db99ede8bcfb3e01db3eff7fa6e5;hpb=553428d1b197c73f845855cdfd46efe3614db032;p=friendica.git
diff --git a/include/event.php b/include/event.php
index e36aa4262d..8d47b5fba5 100644
--- a/include/event.php
+++ b/include/event.php
@@ -5,14 +5,15 @@
*/
use Friendica\App;
+use Friendica\Core\PConfig;
use Friendica\Core\System;
+use Friendica\Database\DBM;
require_once 'include/bbcode.php';
require_once 'include/map.php';
require_once 'include/datetime.php';
function format_event_html($ev, $simple = false) {
-
if (! ((is_array($ev)) && count($ev))) {
return '';
}
@@ -32,7 +33,7 @@ function format_event_html($ev, $simple = false) {
if ($simple) {
$o = "
" . bbcode($ev['summary']) . "
";
- $o .= "" . bbcode($ev['desc']) . "
";
+ $o .= "" . bbcode($ev['desc']) . "
";
$o .= "" . t('Starts:') . "
" . $event_start . "
";
@@ -49,27 +50,26 @@ function format_event_html($ev, $simple = false) {
$o = '' . "\r\n";
+ $o .= '
' . bbcode($ev['summary']) . '
' . "\r\n";
- $o .= '
' . bbcode($ev['summary']) . '
' . "\r\n";
-
- $o .= '
' . bbcode($ev['desc']) . '
' . "\r\n";
-
- $o .= '
' . t('Starts:') . ' ' . t('Starts:') . ' '.$event_start
- . '
' . "\r\n";
+ . '
' . "\r\n";
if (! $ev['nofinish']) {
- $o .= '' . t('Finishes:') . ' ' . t('Finishes:') . ' '.$event_end
- . '
' . "\r\n";
+ . '' . "\r\n";
}
+ $o .= '' . bbcode($ev['desc']) . '
' . "\r\n";
+
if (strlen($ev['location'])) {
- $o .= ' ' . t('Location:') . ' '
+ $o .= '' . t('Location:') . ' '
. bbcode($ev['location'])
- . '' . "\r\n";
+ . '
' . "\r\n";
// Include a map of the location if the [map] BBCode is used.
if (strpos($ev['location'], "[map") !== false) {
@@ -255,7 +255,7 @@ function event_store($arr) {
);
}
- if (dbm::is_result($c)) {
+ if (DBM::is_result($c)) {
$contact = $c[0];
}
@@ -270,7 +270,7 @@ function event_store($arr) {
intval($arr['id']),
intval($arr['uid'])
);
- if ((! dbm::is_result($r)) || ($r[0]['edited'] === $arr['edited'])) {
+ if ((! DBM::is_result($r)) || ($r[0]['edited'] === $arr['edited'])) {
// Nothing has changed. Grab the item id to return.
@@ -278,7 +278,7 @@ function event_store($arr) {
intval($arr['id']),
intval($arr['uid'])
);
- return ((dbm::is_result($r)) ? $r[0]['id'] : 0);
+ return ((DBM::is_result($r)) ? $r[0]['id'] : 0);
}
// The event changed. Update it.
@@ -311,7 +311,7 @@ function event_store($arr) {
intval($arr['id']),
intval($arr['uid'])
);
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
$object = '' . "\n";
@@ -362,7 +362,7 @@ function event_store($arr) {
dbesc($arr['uri']),
intval($arr['uid'])
);
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
$event = $r[0];
}
@@ -405,7 +405,7 @@ function event_store($arr) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($arr['uid'])
);
- //if (dbm::is_result($r))
+ //if (DBM::is_result($r))
// $plink = System::baseUrl() . '/display/' . $r[0]['nickname'] . '/' . $item_id;
@@ -437,7 +437,7 @@ function event_store($arr) {
function get_event_strings() {
// First day of the week (0 = Sunday).
- $firstDay = get_pconfig(local_user(), 'system', 'first_day_of_week');
+ $firstDay = PConfig::get(local_user(), 'system', 'first_day_of_week');
if ($firstDay === false) {
$firstDay = 0;
}
@@ -548,7 +548,7 @@ function event_by_id($owner_uid = 0, $event_params, $sql_extra = '') {
intval($event_params["event_id"])
);
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
return event_remove_duplicates($r);
}
}
@@ -592,7 +592,7 @@ function events_by_date($owner_uid = 0, $event_params, $sql_extra = '') {
dbesc($event_params["adjust_finish"])
);
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
return event_remove_duplicates($r);
}
}
@@ -629,6 +629,7 @@ function process_events($arr) {
// is a real event (no bithdays).
if (local_user() && local_user() == $rr['uid'] && $rr['type'] == 'event') {
$edit = ((! $rr['cid']) ? array(System::baseUrl() . '/events/event/' . $rr['id'], t('Edit event'), '', '') : null);
+ $copy = ((! $rr['cid']) ? array(System::baseUrl() . '/events/copy/' . $rr['id'], t('Duplicate event'), '', '') : null);
$drop = array(System::baseUrl() . '/events/drop/' . $rr['id'], t('Delete event'), '', '');
}
@@ -652,6 +653,7 @@ function process_events($arr) {
'd' => $d,
'edit' => $edit,
'drop' => $drop,
+ 'copy' => $copy,
'is_first' => $is_first,
'item' => $rr,
'html' => $html,
@@ -804,7 +806,7 @@ function events_by_uid($uid = 0, $sql_extra = '') {
);
}
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
return $r;
}
}
@@ -828,7 +830,7 @@ function event_export($uid, $format = 'ical') {
// We are allowed to show events.
// Get the timezone the user is in.
$r = q("SELECT `timezone` FROM `user` WHERE `uid` = %d LIMIT 1", intval($uid));
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
$timezone = $r[0]['timezone'];
}
@@ -959,9 +961,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'] = '' . generate_named_map($evloc['address']) . '
';
@@ -969,6 +973,14 @@ function format_event_item($item) {
$location['map'] = '' . generate_map(str_replace('/', ' ', $evloc['coordinates'])) . '
';
}
+ // 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 +999,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'),