aboutsummaryrefslogtreecommitdiffstats
path: root/include/event.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-04-04 15:41:58 +0000
committerMario <mario@mariovavti.com>2020-04-04 15:41:58 +0000
commit44b935f8756ea751371065f1edc4f6fab339ab3d (patch)
tree8d8271dfc87937d0d4cef3b2909a68ffc01e8899 /include/event.php
parentcade25a112d3884034090135db421dab805a93d6 (diff)
downloadvolse-hubzilla-44b935f8756ea751371065f1edc4f6fab339ab3d.tar.gz
volse-hubzilla-44b935f8756ea751371065f1edc4f6fab339ab3d.tar.bz2
volse-hubzilla-44b935f8756ea751371065f1edc4f6fab339ab3d.zip
another attempt to get events right
Diffstat (limited to 'include/event.php')
-rw-r--r--include/event.php43
1 files changed, 24 insertions, 19 deletions
diff --git a/include/event.php b/include/event.php
index b92d2c8a9..d39da227c 100644
--- a/include/event.php
+++ b/include/event.php
@@ -40,7 +40,7 @@ function format_event_html($ev) {
$o .= '<div class="event-start"><span class="event-label">' . t('Starts:') . '</span>&nbsp;<span class="dtstart" title="'
. datetime_convert('UTC', 'UTC', $ev['dtstart'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'
- . (($ev['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(),
+ . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
$ev['dtstart'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC',
$ev['dtstart'] , $bd_format)))
@@ -50,7 +50,7 @@ function format_event_html($ev) {
$o .= '<div class="event-end" ><span class="event-label">' . t('Finishes:') . '</span>&nbsp;<span class="dtend" title="'
. datetime_convert('UTC','UTC',$ev['dtend'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'
- . (($ev['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(),
+ . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
$ev['dtend'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC',
$ev['dtend'] , $bd_format )))
@@ -97,12 +97,12 @@ function format_event_obj($jobject) {
$event['header'] = replace_macros(get_markup_template('event_item_header.tpl'),array(
'$title' => zidify_links(smilies(bbcode($object['title']))),
'$dtstart_label' => t('Start:'),
- '$dtstart_title' => datetime_convert($tz, date_default_timezone_get(), $object['dtstart'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
- '$dtstart_dt' => (($object['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(), $object['dtstart'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['dtstart'] , $bd_format))),
+ '$dtstart_title' => datetime_convert('UTC', date_default_timezone_get(), $object['dtstart'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
+ '$dtstart_dt' => (($object['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtstart'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['dtstart'] , $bd_format))),
'$finish' => (($object['nofinish']) ? false : true),
'$dtend_label' => t('End:'),
- '$dtend_title' => datetime_convert($tz, date_default_timezone_get(), $object['dtend'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
- '$dtend_dt' => (($object['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(), $object['dtend'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['dtend'] , $bd_format ))),
+ '$dtend_title' => datetime_convert('UTC', date_default_timezone_get(), $object['dtend'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
+ '$dtend_dt' => (($object['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtend'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['dtend'] , $bd_format ))),
'$allday' => $allday,
'$oneday' => $oneday
));
@@ -257,7 +257,7 @@ function format_event_bbcode($ev, $utc = false) {
if($ev['event_vdata']) {
$o .= '[event]' . $ev['event_vdata'] . '[/event]';
}
-
+/*
if ($utc && $ev['event-timezone'] !== 'UTC') {
$ev['dtstart'] = datetime_convert($ev['timezone'],'UTC',$ev['dtstart']);
if ($ev['dtend'] && ! $ev['nofinish']) {
@@ -265,7 +265,7 @@ function format_event_bbcode($ev, $utc = false) {
}
$ev['timezone'] = 'UTC';
}
-
+*/
if($ev['summary'])
$o .= '[event-summary]' . $ev['summary'] . '[/event-summary]';
@@ -284,8 +284,8 @@ function format_event_bbcode($ev, $utc = false) {
if($ev['event_hash'])
$o .= '[event-id]' . $ev['event_hash'] . '[/event-id]';
- if($ev['timezone'])
- $o .= '[event-timezone]' . $ev['timezone'] . '[/event-timezone]';
+// if($ev['timezone'])
+// $o .= '[event-timezone]' . $ev['timezone'] . '[/event-timezone]';
if($ev['adjust'])
$o .= '[event-adjust]' . $ev['adjust'] . '[/event-adjust]';
@@ -1091,12 +1091,17 @@ function event_store_item($arr, $event) {
$item_arr['comment_policy'] = 'none';
}
- $r = q("SELECT * FROM item left join xchan on author_xchan = xchan_hash WHERE resource_id = '%s' AND resource_type = 'event' and uid = %d LIMIT 1",
+ $r = q("SELECT * FROM item WHERE resource_id = '%s' AND resource_type = 'event' and uid = %d LIMIT 1",
dbesc($event['event_hash']),
intval($arr['uid'])
);
if($r) {
+
+ set_iconfig($r[0]['id'], 'event', 'timezone', $arr['timezone'], true);
+ xchan_query($r);
+ $r = fetch_post_tags($r,true);
+
$object = json_encode(array(
'type' => ACTIVITY_OBJ_EVENT,
'id' => z_root() . '/event/' . $r[0]['resource_id'],
@@ -1111,13 +1116,13 @@ function event_store_item($arr, $event) {
'content' => format_event_bbcode($arr),
'attachment' => Activity::encode_attachment($r[0]),
'author' => array(
- 'name' => $r[0]['xchan_name'],
- 'address' => $r[0]['xchan_addr'],
- 'guid' => $r[0]['xchan_guid'],
- 'guid_sig' => $r[0]['xchan_guid_sig'],
+ 'name' => $r[0]['author']['xchan_name'],
+ 'address' => $r[0]['author']['xchan_addr'],
+ 'guid' => $r[0]['author']['xchan_guid'],
+ 'guid_sig' => $r[0]['author']['xchan_guid_sig'],
'link' => array(
- array('rel' => 'alternate', 'type' => 'text/html', 'href' => $r[0]['xchan_url']),
- array('rel' => 'photo', 'type' => $r[0]['xchan_photo_mimetype'], 'href' => $r[0]['xchan_photo_m'])
+ array('rel' => 'alternate', 'type' => 'text/html', 'href' => $r[0]['author']['xchan_url']),
+ array('rel' => 'photo', 'type' => $r[0]['author']['xchan_photo_mimetype'], 'href' => $r[0]['author']['xchan_photo_m'])
),
),
));
@@ -1167,7 +1172,6 @@ function event_store_item($arr, $event) {
}
$item_id = $r[0]['id'];
- set_iconfig($item_id, 'event', 'timezone', $arr['timezone'], true);
/**
* @hooks event_updated
@@ -1251,6 +1255,8 @@ function event_store_item($arr, $event) {
else
$item_arr['plink'] = z_root() . '/display/' . gen_link_id($item_arr['mid']);
+ set_iconfig($item_arr, 'event','timezone',$arr['timezone'],true);
+
$x = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($arr['event_xchan'])
);
@@ -1286,7 +1292,6 @@ function event_store_item($arr, $event) {
// activities refer to the item message_id as the parent.
set_iconfig($item_arr, 'system','event_id',$event['event_hash'],true);
- set_iconfig($item_arr, 'event','timezone',$arr['timezone'],true);
$res = item_store($item_arr);