From 34d1f797778c71357989d793a6356ed9f8aeefed Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 20 May 2019 12:26:33 +0200 Subject: calendar merge: initial commit for timezone support --- Zotlabs/Module/Cdav.php | 50 ++++++++++++++++--------- Zotlabs/Module/Channel_calendar.php | 73 ++++++++++++------------------------- 2 files changed, 56 insertions(+), 67 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index 6b4f57ea5..275873db5 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -271,11 +271,14 @@ class Cdav extends Controller { if(!cdav_perms($id[0],$calendars,true)) return; + $timezone = ((x($_POST,'timezone_select')) ? escape_tags(trim($_POST['timezone_select'])) : ''); + $tz = (($timezone) ? $timezone : date_default_timezone_get()); + $title = $_REQUEST['title']; - $start = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtstart']); + $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']); $dtstart = new \DateTime($start); if($_REQUEST['dtend']) { - $end = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtend']); + $end = datetime_convert($tz, 'UTC', $_REQUEST['dtend']); $dtend = new \DateTime($end); } $description = $_REQUEST['description']; @@ -303,14 +306,14 @@ class Cdav extends Controller { ]); if($dtend) { $vcalendar->VEVENT->add('DTEND', $dtend); - $vcalendar->VEVENT->DTEND['TZID'] = App::$timezone; + $vcalendar->VEVENT->DTEND['TZID'] = $tz; } if($description) $vcalendar->VEVENT->add('DESCRIPTION', $description); if($location) $vcalendar->VEVENT->add('LOCATION', $location); - $vcalendar->VEVENT->DTSTART['TZID'] = App::$timezone; + $vcalendar->VEVENT->DTSTART['TZID'] = $tz; $calendarData = $vcalendar->serialize(); @@ -348,12 +351,15 @@ class Cdav extends Controller { if(!cdav_perms($id[0],$calendars,true)) return; + $timezone = ((x($_POST,'timezone_select')) ? escape_tags(trim($_POST['timezone_select'])) : ''); + $tz = (($timezone) ? $timezone : date_default_timezone_get()); + $uri = $_REQUEST['uri']; $title = $_REQUEST['title']; - $start = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtstart']); + $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']); $dtstart = new \DateTime($start); if($_REQUEST['dtend']) { - $end = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtend']); + $end = datetime_convert($tz, 'UTC', $_REQUEST['dtend']); $dtend = new \DateTime($end); } $description = $_REQUEST['description']; @@ -406,11 +412,14 @@ class Cdav extends Controller { if(!cdav_perms($id[0],$calendars,true)) return; + $timezone = ((x($_POST,'timezone_select')) ? escape_tags(trim($_POST['timezone_select'])) : ''); + $tz = (($timezone) ? $timezone : date_default_timezone_get()); + $uri = $_REQUEST['uri']; - $start = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtstart']); + $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']); $dtstart = new \DateTime($start); if($_REQUEST['dtend']) { - $end = datetime_convert(App::$timezone, 'UTC', $_REQUEST['dtend']); + $end = datetime_convert($tz, 'UTC', $_REQUEST['dtend']); $dtend = new \DateTime($end); } @@ -915,8 +924,13 @@ class Cdav extends Controller { xchan_query($r); $r = fetch_post_tags($r,true); - $r[0]['dtstart'] = (($r[0]['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$r[0]['dtstart'], 'c') : datetime_convert('UTC','UTC',$r[0]['dtstart'],'c')); - $r[0]['dtend'] = (($r[0]['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$r[0]['dtend'], 'c') : datetime_convert('UTC','UTC',$r[0]['dtend'],'c')); + $tz = get_iconfig($r[0], 'event', 'timezone'); + if(! $tz) + $tz = 'UTC'; + + $r[0]['timezone'] = $tz; + $r[0]['dtstart'] = (($r[0]['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $r[0]['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $r[0]['dtstart'], 'c')); + $r[0]['dtend'] = (($r[0]['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $r[0]['dtend'], 'c') : datetime_convert('UTC', 'UTC' ,$r[0]['dtend'], 'c')); $r[0]['plink'] = [$r[0]['plink'], t('Link to source')]; @@ -984,7 +998,7 @@ class Cdav extends Controller { $first_day = feature_enabled(local_channel(), 'cal_first_day'); $first_day = (($first_day) ? $first_day : 0); - $title = ['title', t('Event title')]; + $title = ['title', t('Event title') ]; $dtstart = ['dtstart', t('Start date and time')]; $dtend = ['dtend', t('End date and time')]; $description = ['description', t('Description')]; @@ -1000,14 +1014,13 @@ class Cdav extends Controller { //$acl = (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults), false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'))); $acl = populate_acl($perm_defaults, false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream')); - //$permissions = ((x($orig_event)) ? $orig_event : $perm_defaults); - $permissions = $perm_defaults; + $permissions = (($resource_id) ? $resource : $perm_defaults); $o .= replace_macros(get_markup_template('cdav_calendar.tpl'), [ '$sources' => $sources, '$color' => $color, '$lang' => App::$language, - '$timezone' => App::$timezone, + '$timezone' => date_default_timezone_get(), '$first_day' => $first_day, '$prev' => t('Previous'), '$next' => t('Next'), @@ -1047,7 +1060,9 @@ class Cdav extends Controller { '$categories_label' => t('Categories'), '$resource' => json_encode($resource), - '$categories' => $categories + '$categories' => $categories, + '$timezone_select' => ((feature_enabled(local_channel(),'event_tz_select')) ? ['timezone_select' , t('Timezone:'), date_default_timezone_get(), '', get_timezones()] : []) + ]); return $o; @@ -1118,8 +1133,9 @@ class Cdav extends Controller { 'calendar_id' => $id, 'uri' => $object['uri'], 'title' => $title, - 'start' => datetime_convert($timezone, $timezone, $dtstart, 'c'), - 'end' => (($dtend) ? datetime_convert($timezone, $timezone, $dtend, 'c') : ''), + 'timezone' => $timezone, + 'start' => datetime_convert($timezone, date_default_timezone_get(), $dtstart, 'c'), + 'end' => (($dtend) ? datetime_convert($timezone, date_default_timezone_get(), $dtend, 'c') : ''), 'description' => $description, 'location' => $location, 'allDay' => $allDay, diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 9229e6eb2..45f5870d0 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -22,52 +22,20 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $xchan = ((x($_POST,'xchan')) ? dbesc($_POST['xchan']) : ''); $uid = local_channel(); - - $start_text = escape_tags($_REQUEST['dtstart']); - $finish_text = escape_tags($_REQUEST['dtend']); - - $adjust = intval($_POST['adjust']); - $nofinish = intval($_POST['nofinish']); - - $timezone = ((x($_POST,'timezone_select')) ? notags(trim($_POST['timezone_select'])) : ''); - - $tz = (($timezone) ? $timezone : date_default_timezone_get()); - $categories = escape_tags(trim($_POST['categories'])); - // only allow editing your own events. - if(($xchan) && ($xchan !== get_observer_hash())) return; - - if($start_text) { - $start = $start_text; - } - else { - $start = sprintf('%d-%d-%d %d:%d:0',$startyear,$startmonth,$startday,$starthour,$startminute); - } - if($finish_text) { - $finish = $finish_text; - } - else { - $finish = sprintf('%d-%d-%d %d:%d:0',$finishyear,$finishmonth,$finishday,$finishhour,$finishminute); - } + $timezone = ((x($_POST,'timezone_select')) ? escape_tags(trim($_POST['timezone_select'])) : ''); + $tz = (($timezone) ? $timezone : date_default_timezone_get()); - if($nofinish) { - $finish = NULL_DATE; - } + $categories = escape_tags(trim($_POST['categories'])); + + $adjust = intval($_POST['adjust']); - if($adjust) { - $start = datetime_convert($tz,'UTC',$start); - if(! $nofinish) - $finish = datetime_convert($tz,'UTC',$finish); - } - else { - $start = datetime_convert('UTC','UTC',$start); - if(! $nofinish) - $finish = datetime_convert('UTC','UTC',$finish); - } + $start = (($adjust) ? datetime_convert($tz, 'UTC', escape_tags($_REQUEST['dtstart'])) : datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtstart']))); + $finish = (($adjust) ? datetime_convert($tz, 'UTC', escape_tags($_REQUEST['dtend'])) : datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtend']))); $summary = escape_tags(trim($_POST['summary'])); $desc = escape_tags(trim($_POST['desc'])); @@ -176,7 +144,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $datarray['location'] = $location; $datarray['etype'] = $type; $datarray['adjust'] = $adjust; - $datarray['nofinish'] = $nofinish; + $datarray['nofinish'] = 0; $datarray['uid'] = local_channel(); $datarray['account'] = get_account_id(); $datarray['event_xchan'] = $channel['channel_hash']; @@ -188,6 +156,8 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $datarray['id'] = $event_id; $datarray['created'] = $created; $datarray['edited'] = $edited; + $datarray['timezone'] = $tz; + if(intval($_REQUEST['preview'])) { $html = format_event_html($datarray); @@ -322,10 +292,9 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $start = datetime_convert('UTC','UTC',$start); $finish = datetime_convert('UTC','UTC',$finish); - $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start); $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish); - + if (x($_GET,'id')){ $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id from event left join item on item.resource_id = event.event_hash @@ -347,23 +316,21 @@ class Channel_calendar extends \Zotlabs\Web\Controller { // Ultimately the finish date shouldn't be involved in the query. $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id - from event left join item on event.event_hash = item.resource_id - where item.resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored - AND (( event.adjust = 0 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' ) - OR ( event.adjust = 1 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )) ", + from event left join item on event_hash = resource_id + where resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored + AND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' ) + OR ( adjust = 1 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )) ", intval(local_channel()), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish) ); - } if($r && ! $export) { xchan_query($r); $r = fetch_post_tags($r,true); - $r = sort_by_date($r); } @@ -373,11 +340,16 @@ class Channel_calendar extends \Zotlabs\Web\Controller { foreach($r as $rr) { - $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'c') : datetime_convert('UTC','UTC',$rr['dtstart'],'c')); + $tz = get_iconfig($rr, 'event', 'timezone'); + + if(! $tz) + $tz = 'UTC'; + + $start = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); if ($rr['nofinish']){ $end = null; } else { - $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtend'], 'c') : datetime_convert('UTC','UTC',$rr['dtend'],'c')); + $end = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c')); // give a fake end to birthdays so they get crammed into a // single day on the calendar @@ -416,6 +388,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller { 'rw' => true, 'id'=>$rr['id'], 'uri' => $rr['event_hash'], + 'timezone' => $tz, 'start'=> $start, 'end' => $end, 'drop' => $drop, -- cgit v1.2.3 From e44f0c497f3634b88d8ed4df33a204fc4cbdc1b9 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 20 May 2019 12:34:05 +0200 Subject: be more precise with table selection --- Zotlabs/Module/Channel_calendar.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 45f5870d0..87bac2762 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -316,10 +316,10 @@ class Channel_calendar extends \Zotlabs\Web\Controller { // Ultimately the finish date shouldn't be involved in the query. $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id - from event left join item on event_hash = resource_id - where resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored - AND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' ) - OR ( adjust = 1 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )) ", + from event left join item on event.event_hash = item.resource_id + where item.resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored + AND (( event.adjust = 0 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' ) + OR ( event.adjust = 1 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )) ", intval(local_channel()), dbesc($start), dbesc($finish), -- cgit v1.2.3 From c9d64d75f3acab6b44d28cd7bcc6e7e5dd042e77 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 20 May 2019 13:51:53 +0200 Subject: move smart birthday feature to calendar settings and override the adjust flag at display time instead of import --- Zotlabs/Module/Channel_calendar.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 87bac2762..96d32039e 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -345,6 +345,9 @@ class Channel_calendar extends \Zotlabs\Web\Controller { if(! $tz) $tz = 'UTC'; + if($rr['etype'] === 'birthday') + $rr['adjust'] = intval(feature_enabled(local_channel(), 'smart_birthdays')); + $start = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); if ($rr['nofinish']){ $end = null; -- cgit v1.2.3 From f96958adf84f7f2a45aa7860e52198f3de74f9e0 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 21 May 2019 12:29:00 +0200 Subject: fix all day events for caldav calendars --- Zotlabs/Module/Cdav.php | 60 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 15 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index 275873db5..0c3450c70 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -274,9 +274,12 @@ class Cdav extends Controller { $timezone = ((x($_POST,'timezone_select')) ? escape_tags(trim($_POST['timezone_select'])) : ''); $tz = (($timezone) ? $timezone : date_default_timezone_get()); + $allday = $_REQUEST['allday']; + $title = $_REQUEST['title']; $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']); $dtstart = new \DateTime($start); + if($_REQUEST['dtend']) { $end = datetime_convert($tz, 'UTC', $_REQUEST['dtend']); $dtend = new \DateTime($end); @@ -304,16 +307,23 @@ class Cdav extends Controller { 'DTSTART' => $dtstart ] ]); + if($dtend) { $vcalendar->VEVENT->add('DTEND', $dtend); - $vcalendar->VEVENT->DTEND['TZID'] = $tz; + if($allday) + $vcalendar->VEVENT->DTEND['VALUE'] = 'DATE'; + else + $vcalendar->VEVENT->DTEND['TZID'] = $tz; } if($description) $vcalendar->VEVENT->add('DESCRIPTION', $description); if($location) $vcalendar->VEVENT->add('LOCATION', $location); - $vcalendar->VEVENT->DTSTART['TZID'] = $tz; + if($allday) + $vcalendar->VEVENT->DTSTART['VALUE'] = 'DATE'; + else + $vcalendar->VEVENT->DTSTART['TZID'] = $tz; $calendarData = $vcalendar->serialize(); @@ -354,6 +364,8 @@ class Cdav extends Controller { $timezone = ((x($_POST,'timezone_select')) ? escape_tags(trim($_POST['timezone_select'])) : ''); $tz = (($timezone) ? $timezone : date_default_timezone_get()); + $allday = $_REQUEST['allday']; + $uri = $_REQUEST['uri']; $title = $_REQUEST['title']; $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']); @@ -371,12 +383,23 @@ class Cdav extends Controller { if($title) $vcalendar->VEVENT->SUMMARY = $title; - if($dtstart) + if($dtstart) { $vcalendar->VEVENT->DTSTART = $dtstart; - if($dtend) + if($allday) + $vcalendar->VEVENT->DTSTART['VALUE'] = 'DATE'; + else + $vcalendar->VEVENT->DTSTART['TZID'] = $tz; + } + if($dtend) { $vcalendar->VEVENT->DTEND = $dtend; + if($allday) + $vcalendar->VEVENT->DTEND['VALUE'] = 'DATE'; + else + $vcalendar->VEVENT->DTEND['TZID'] = $tz; + } else unset($vcalendar->VEVENT->DTEND); + if($description) $vcalendar->VEVENT->DESCRIPTION = $description; if($location) @@ -415,6 +438,8 @@ class Cdav extends Controller { $timezone = ((x($_POST,'timezone_select')) ? escape_tags(trim($_POST['timezone_select'])) : ''); $tz = (($timezone) ? $timezone : date_default_timezone_get()); + $allday = $_REQUEST['allday']; + $uri = $_REQUEST['uri']; $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']); $dtstart = new \DateTime($start); @@ -429,13 +454,20 @@ class Cdav extends Controller { if($dtstart) { $vcalendar->VEVENT->DTSTART = $dtstart; + if($allday) + $vcalendar->VEVENT->DTSTART['VALUE'] = 'DATE'; + else + $vcalendar->VEVENT->DTSTART['TZID'] = $tz; } if($dtend) { $vcalendar->VEVENT->DTEND = $dtend; + if($allday) + $vcalendar->VEVENT->DTEND['VALUE'] = 'DATE'; + else + $vcalendar->VEVENT->DTEND['TZID'] = $tz; } - else { + else unset($vcalendar->VEVENT->DTEND); - } $calendarData = $vcalendar->serialize(); @@ -1001,6 +1033,9 @@ class Cdav extends Controller { $title = ['title', t('Event title') ]; $dtstart = ['dtstart', t('Start date and time')]; $dtend = ['dtend', t('End date and time')]; + $timezone_select = ['timezone_select' , t('Timezone:'), date_default_timezone_get(), '', get_timezones()]; + $allday = ['allday', t('All day event'), '', '', [t('No'), t('Yes')]]; + $description = ['description', t('Description')]; $location = ['location', t('Location')]; @@ -1061,7 +1096,8 @@ class Cdav extends Controller { '$resource' => json_encode($resource), '$categories' => $categories, - '$timezone_select' => ((feature_enabled(local_channel(),'event_tz_select')) ? ['timezone_select' , t('Timezone:'), date_default_timezone_get(), '', get_timezones()] : []) + '$timezone_select' => ((feature_enabled(local_channel(),'event_tz_select')) ? $timezone_select : ''), + '$allday' => $allday ]); @@ -1091,8 +1127,8 @@ class Cdav extends Controller { $filters['comp-filters'][0]['time-range']['end'] = $end; $uris = $caldavBackend->calendarQuery($id, $filters); - if($uris) { + $objects = $caldavBackend->getMultipleCalendarObjects($id, $uris); foreach($objects as $object) { @@ -1121,13 +1157,7 @@ class Cdav extends Controller { $timezone = $recurrent_timezone; } - $allDay = false; - - // allDay event rules - if(!strpos($dtstart, 'T') && !strpos($dtend, 'T')) - $allDay = true; - if(strpos($dtstart, 'T000000') && strpos($dtend, 'T000000')) - $allDay = true; + $allDay = (((string)$vevent->DTSTART['VALUE'] == 'DATE') ? true : false); $events[] = [ 'calendar_id' => $id, -- cgit v1.2.3 From e834c7fe3e421a7a52e27b274d8ea35bd2ad5bec Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 21 May 2019 12:31:50 +0200 Subject: remove unused code --- Zotlabs/Module/Cdav.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index 0c3450c70..08d27c850 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -1034,7 +1034,6 @@ class Cdav extends Controller { $dtstart = ['dtstart', t('Start date and time')]; $dtend = ['dtend', t('End date and time')]; $timezone_select = ['timezone_select' , t('Timezone:'), date_default_timezone_get(), '', get_timezones()]; - $allday = ['allday', t('All day event'), '', '', [t('No'), t('Yes')]]; $description = ['description', t('Description')]; $location = ['location', t('Location')]; @@ -1096,9 +1095,7 @@ class Cdav extends Controller { '$resource' => json_encode($resource), '$categories' => $categories, - '$timezone_select' => ((feature_enabled(local_channel(),'event_tz_select')) ? $timezone_select : ''), - '$allday' => $allday - + '$timezone_select' => ((feature_enabled(local_channel(),'event_tz_select')) ? $timezone_select : '') ]); return $o; -- cgit v1.2.3 From 39613aa2d9298e13629b5b4a7c6b6f1bbe7edca5 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 22 May 2019 12:40:37 +0200 Subject: improve timezone detection for caldav and remove smart birthday feature. Force adjust birthdays until we agree on how to deal with this. --- Zotlabs/Module/Cdav.php | 12 ++++++++++-- Zotlabs/Module/Channel_calendar.php | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index 08d27c850..de639e281 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -1144,16 +1144,24 @@ class Cdav extends Controller { $dtend = (string)$vevent->DTEND; $description = (string)$vevent->DESCRIPTION; $location = (string)$vevent->LOCATION; - $timezone = (string)$vevent->DTSTART['TZID']; + $timezone_str = (string)$vevent->DTSTART['TZID']; $rw = ((cdav_perms($id[0],$calendars,true)) ? true : false); $editable = $rw ? true : false; $recurrent = ((isset($vevent->{'RECURRENCE-ID'})) ? true : false); if($recurrent) { $editable = false; - $timezone = $recurrent_timezone; + $timezone_str = $recurrent_timezone; } + // Try to get an usable olson format timezone + $timezone_obj = \Sabre\VObject\TimeZoneUtil::getTimeZone($timezone_str, $vcalendar); + $timezone = $timezone_obj->getName(); + + // If we got nothing fallback to UTC + if(! $timezone) + $timezone = 'UTC'; + $allDay = (((string)$vevent->DTSTART['VALUE'] == 'DATE') ? true : false); $events[] = [ diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 96d32039e..44fe261e8 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -345,8 +345,9 @@ class Channel_calendar extends \Zotlabs\Web\Controller { if(! $tz) $tz = 'UTC'; - if($rr['etype'] === 'birthday') - $rr['adjust'] = intval(feature_enabled(local_channel(), 'smart_birthdays')); + if($rr['etype'] === 'birthday') { + $rr['adjust'] = 1; //intval(feature_enabled(local_channel(), 'smart_birthdays')); + } $start = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); if ($rr['nofinish']){ @@ -356,7 +357,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller { // give a fake end to birthdays so they get crammed into a // single day on the calendar - if($rr['etype'] === 'birthday') $end = null; } @@ -374,13 +374,13 @@ class Channel_calendar extends \Zotlabs\Web\Controller { } } - $allDay = false; + //$allDay = false; // allDay event rules - if(!strpos($start, 'T') && !strpos($end, 'T')) - $allDay = true; - if(strpos($start, 'T00:00:00') && strpos($end, 'T00:00:00')) - $allDay = true; + //if(!strpos($start, 'T') && !strpos($end, 'T')) + // $allDay = true; + //if(strpos($start, 'T00:00:00') && strpos($end, 'T00:00:00')) + // $allDay = true; $edit = ((local_channel() && $rr['author_xchan'] == get_observer_hash()) ? array(z_root().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'','') : false); @@ -395,10 +395,10 @@ class Channel_calendar extends \Zotlabs\Web\Controller { 'start'=> $start, 'end' => $end, 'drop' => $drop, - 'allDay' => $allDay, + 'allDay' => (($rr['adjust']) ? 0 : 1), 'title' => htmlentities($rr['summary'], ENT_COMPAT, 'UTF-8', false), 'editable' => $edit ? true : false, - 'item'=>$rr, + 'item' => $rr, 'plink' => [$rr['plink'], t('Link to source')], 'description' => htmlentities($rr['description'], ENT_COMPAT, 'UTF-8', false), 'location' => htmlentities($rr['location'], ENT_COMPAT, 'UTF-8', false), -- cgit v1.2.3 From e466d72058b2543bec69c77d2730828acada38a1 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 26 May 2019 18:05:11 +0200 Subject: adjust birthday handling according to community decision and slightly change display of allday event items --- Zotlabs/Module/Channel_calendar.php | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 44fe261e8..13f879d84 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -345,20 +345,11 @@ class Channel_calendar extends \Zotlabs\Web\Controller { if(! $tz) $tz = 'UTC'; - if($rr['etype'] === 'birthday') { - $rr['adjust'] = 1; //intval(feature_enabled(local_channel(), 'smart_birthdays')); - } - $start = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); if ($rr['nofinish']){ $end = null; } else { $end = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c')); - - // give a fake end to birthdays so they get crammed into a - // single day on the calendar - if($rr['etype'] === 'birthday') - $end = null; } $catsenabled = feature_enabled(local_channel(),'categories'); @@ -374,14 +365,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller { } } - //$allDay = false; - - // allDay event rules - //if(!strpos($start, 'T') && !strpos($end, 'T')) - // $allDay = true; - //if(strpos($start, 'T00:00:00') && strpos($end, 'T00:00:00')) - // $allDay = true; - $edit = ((local_channel() && $rr['author_xchan'] == get_observer_hash()) ? array(z_root().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'','') : false); $drop = array(z_root().'/events/drop/'.$rr['event_hash'],t('Delete event'),'',''); -- cgit v1.2.3 From f1b61d5882cba9584ef35f574b29050397cb8d58 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 26 May 2019 20:22:40 +0200 Subject: mod cal band-aid fixes --- Zotlabs/Module/Cal.php | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php index 70098a2a1..49489f912 100644 --- a/Zotlabs/Module/Cal.php +++ b/Zotlabs/Module/Cal.php @@ -84,6 +84,7 @@ class Cal extends \Zotlabs\Web\Controller { '$module_url' => '/cal/' . $channel['channel_address'], '$modparams' => 2, '$lang' => \App::$language, + '$timezone' => date_default_timezone_get(), '$first_day' => $first_day )); @@ -215,8 +216,8 @@ class Cal extends \Zotlabs\Web\Controller { $sql_extra .= " and etype != 'birthday' "; if (x($_GET,'id')){ - $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan - from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d $sql_extra limit 1", + $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id + from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d $sql_extra limit 1", intval($channel['channel_id']), intval($_GET['id']) ); @@ -227,12 +228,12 @@ class Cal extends \Zotlabs\Web\Controller { // Noting this for now - it will need to be fixed here and in Friendica. // Ultimately the finish date shouldn't be involved in the query. - $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan - from event left join item on event_hash = resource_id - where resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored - AND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' ) - OR ( adjust = 1 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )) $sql_extra ", - intval($channel['channel_id']), + $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id + from event left join item on event.event_hash = item.resource_id + where item.resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored + AND (( event.adjust = 0 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' ) + OR ( event.adjust = 1 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )) ", + intval(local_channel()), dbesc($start), dbesc($finish), dbesc($adjust_start), @@ -266,16 +267,23 @@ class Cal extends \Zotlabs\Web\Controller { if($r) { foreach($r as $rr) { - - $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j')); - $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], $fmt) : datetime_convert('UTC','UTC',$rr['dtstart'],$fmt)); + + $tz = get_iconfig($rr, 'event', 'timezone'); + + if(! $tz) + $tz = 'UTC'; + + $rr['timezone'] = $tz; + + $j = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j')); + $d = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtstart'], $fmt) : datetime_convert('UTC','UTC',$rr['dtstart'],$fmt)); $d = day_translate($d); - $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'c') : datetime_convert('UTC','UTC',$rr['dtstart'],'c')); + $start = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtstart'], 'c') : datetime_convert('UTC','UTC',$rr['dtstart'],'c')); if ($rr['nofinish']){ $end = null; } else { - $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtend'], 'c') : datetime_convert('UTC','UTC',$rr['dtend'],'c')); + $end = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtend'], 'c') : datetime_convert('UTC','UTC',$rr['dtend'],'c')); } @@ -302,7 +310,7 @@ class Cal extends \Zotlabs\Web\Controller { 'start'=> $start, 'end' => $end, 'drop' => $drop, - 'allDay' => false, + 'allDay' => (($rr['adjust']) ? 0 : 1), 'title' => $title, 'j' => $j, -- cgit v1.2.3 From 52f8429218ae8a0f8c2ff193728e3b4422985207 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 28 May 2019 16:28:03 -0700 Subject: support 'expires' over Zot6 --- Zotlabs/Module/Apschema.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Apschema.php b/Zotlabs/Module/Apschema.php index 5b249bfe8..d217041f2 100644 --- a/Zotlabs/Module/Apschema.php +++ b/Zotlabs/Module/Apschema.php @@ -27,6 +27,7 @@ class Apschema extends \Zotlabs\Web\Controller { 'nomadicLocation' => 'zot:nomadicLocation', 'nomadicHubs' => 'zot:nomadicHubs', 'emojiReaction' => 'zot:emojiReaction', + 'expires' => 'zot:expires', 'magicEnv' => [ '@id' => 'zot:magicEnv', -- cgit v1.2.3 From b6267ec7c2e5d820c900603fcba5bf46cf2e5f90 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 29 May 2019 17:04:27 -0700 Subject: live-update not triggering on mod_search --- Zotlabs/Module/Search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index 838f9d6b9..214ece9a3 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -38,8 +38,8 @@ class Search extends \Zotlabs\Web\Controller { $observer_hash = (($observer) ? $observer['xchan_hash'] : ''); $o = '' . "\r\n"; - - $o = '
' . "\r\n"; + + $o .= '
' . "\r\n"; $o .= '

' . t('Search') . '

'; -- cgit v1.2.3 From 66c6c6c7d1c87aa50ac0fe701505802110b8eecb Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 3 Jun 2019 11:25:48 +0000 Subject: regard timezones in calendar import/export (cherry picked from commit 5b4aa1afc2d3811aae93706299dfb5d5c703198f) --- Zotlabs/Module/Channel_calendar.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 13f879d84..4f08eb27c 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -304,7 +304,9 @@ class Channel_calendar extends \Zotlabs\Web\Controller { ); } elseif($export) { - $r = q("SELECT * from event where uid = %d and dtstart > '%s' and dtend > dtstart", + $r = q("SELECT event.*, item.id as item_id + from event left join item on item.resource_id = event.event_hash + where event.uid = %d and event.dtstart > '%s' and event.dtend > event.dtstart", intval(local_channel()), dbesc(NULL_DATE) ); -- cgit v1.2.3 From ebc2b23c3a2c83ad62ba301d0b94671e4691689a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 7 Jun 2019 08:45:08 +0200 Subject: fix embedphotos image size --- Zotlabs/Module/Embedphotos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Embedphotos.php b/Zotlabs/Module/Embedphotos.php index 8b0421457..6a88513dc 100644 --- a/Zotlabs/Module/Embedphotos.php +++ b/Zotlabs/Module/Embedphotos.php @@ -53,7 +53,7 @@ class Embedphotos extends \Zotlabs\Web\Controller { $channel = \App::get_channel(); $output = EMPTY_STR; if($channel) { - $resolution = ((feature_enabled($channel['channel_id'],'large_photos')) ? 2 : 3); + $resolution = ((feature_enabled($channel['channel_id'],'large_photos')) ? 1 : 2); $r = q("select mimetype, height, width from photo where resource_id = '%s' and $resolution = %d and uid = %d limit 1", dbesc($resource), intval($resolution), -- cgit v1.2.3 From 9ac9c693adaa6d3262e1a8639c83474419059730 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 12 Jun 2019 10:07:18 +0200 Subject: initial support for deleting event items if an event is removed --- Zotlabs/Module/Channel_calendar.php | 65 +++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 4f08eb27c..fcb3ca58b 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -422,13 +422,72 @@ class Channel_calendar extends \Zotlabs\Web\Controller { dbesc($event_id), intval(local_channel()) ); + if($r) { - $r = q("update item set resource_type = '', resource_id = '' where resource_type = 'event' and resource_id = '%s' and uid = %d", + + $sync_event['event_deleted'] = 1; + build_sync_packet(0,array('event' => array($sync_event))); + + $i = q("select * from item where resource_type = 'event' and resource_id = '%s' and uid = %d", dbesc($event_id), intval(local_channel()) ); - $sync_event['event_deleted'] = 1; - build_sync_packet(0,array('event' => array($sync_event))); + + if ($i) { + + $can_delete = false; + $local_delete = true; + + $ob_hash = get_observer_hash(); + if($ob_hash && ($ob_hash === $i[0]['author_xchan'] || $ob_hash === $i[0]['owner_xchan'] || $ob_hash === $i[0]['source_xchan'])) { + $can_delete = true; + } + + // The site admin can delete any post/item on the site. + // If the item originated on this site+channel the deletion will propagate downstream. + // Otherwise just the local copy is removed. + + if(is_site_admin()) { + $local_delete = true; + if(intval($i[0]['item_origin'])) + $can_delete = true; + } + + if($can_delete || $local_delete) { + + q("update item set resource_type = '', resource_id = '' where resource_type = 'event' and resource_id = '%s' and uid = %d", + dbesc($event_id), + intval(local_channel()) + ); + + // if this is a different page type or it's just a local delete + // but not by the item author or owner, do a simple deletion + + $complex = false; + + if(intval($i[0]['item_type']) || ($local_delete && (! $can_delete))) { + drop_item($i[0]['id']); + } + else { + // complex deletion that needs to propagate and be performed in phases + drop_item($i[0]['id'],true,DROPITEM_PHASE1); + $complex = true; + } + + $ii = q("select * from item where id = %d", + intval($i[0]['id']) + ); + if($ii) { + xchan_query($ii); + $sync_item = fetch_post_tags($ii); + build_sync_packet($i[0]['uid'],array('item' => array(encode_item($sync_item[0],true)))); + } + + if($complex) { + tag_deliver($i[0]['uid'],$i[0]['id']); + } + } + } killme(); } notice( t('Failed to remove event' ) . EOL); -- cgit v1.2.3 From 801ab611ede45921d1d6869fa65fc3fbf941d666 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 13 Jun 2019 13:34:04 +0200 Subject: more work on linked item/resource deletion for photos and events, deprecate the force flag in drop_item() and comment out goaway() in drop_item(). --- Zotlabs/Module/Channel_calendar.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index fcb3ca58b..ac08dfa96 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -455,11 +455,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller { if($can_delete || $local_delete) { - q("update item set resource_type = '', resource_id = '' where resource_type = 'event' and resource_id = '%s' and uid = %d", - dbesc($event_id), - intval(local_channel()) - ); - // if this is a different page type or it's just a local delete // but not by the item author or owner, do a simple deletion -- cgit v1.2.3 From a26774b99e1cf3e69df4f527e2c4c4443dce63ad Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 14 Jun 2019 09:52:54 +0200 Subject: fix mod cal regression --- Zotlabs/Module/Cal.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php index 49489f912..731998c1a 100644 --- a/Zotlabs/Module/Cal.php +++ b/Zotlabs/Module/Cal.php @@ -233,13 +233,12 @@ class Cal extends \Zotlabs\Web\Controller { where item.resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored AND (( event.adjust = 0 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' ) OR ( event.adjust = 1 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )) ", - intval(local_channel()), + intval($channel['channel_id']), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish) ); - } $links = array(); -- cgit v1.2.3 From 4da3933f244d9bb820305d49b0fe09679e297a6e Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 14 Jun 2019 20:52:21 +0200 Subject: Add signatures processing for private messages --- Zotlabs/Module/Mail.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php index 3202d38a5..c454a2331 100644 --- a/Zotlabs/Module/Mail.php +++ b/Zotlabs/Module/Mail.php @@ -25,6 +25,7 @@ class Mail extends \Zotlabs\Web\Controller { $expires = ((x($_REQUEST,'expires')) ? datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expires']) : NULL_DATE); $raw = ((x($_REQUEST,'raw')) ? intval($_REQUEST['raw']) : 0); $mimetype = ((x($_REQUEST,'mimetype')) ? notags(trim($_REQUEST['mimetype'])) : 'text/bbcode'); + $sig = ((x($_REQUEST,'signature')) ? trim($_REQUEST['signature']) : ''); if($preview) { @@ -123,7 +124,7 @@ class Mail extends \Zotlabs\Web\Controller { // We have a local_channel, let send_message use the session channel and save a lookup - $ret = send_message(0, $recipient, $body, $subject, $replyto, $expires, $mimetype, $raw); + $ret = send_message(0, $recipient, $body, $subject, $replyto, $expires, $mimetype, $raw, $sig); if($ret['success']) { xchan_mail_query($ret['mail']); @@ -396,8 +397,9 @@ class Mail extends \Zotlabs\Web\Controller { 'can_recall' => ($channel['channel_hash'] == $message['from_xchan']), 'is_recalled' => (intval($message['mail_recalled']) ? t('Message has been recalled.') : ''), 'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'], 'c'), + 'sig' => $message['sig'] ); - + $seen = $message['seen']; } -- cgit v1.2.3 From c9615cc19ccf09873fbc4c18438f110f81ac0864 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 14 Jun 2019 21:08:53 +0200 Subject: Formatting --- Zotlabs/Module/Mail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php index c454a2331..4e4c18cae 100644 --- a/Zotlabs/Module/Mail.php +++ b/Zotlabs/Module/Mail.php @@ -25,7 +25,7 @@ class Mail extends \Zotlabs\Web\Controller { $expires = ((x($_REQUEST,'expires')) ? datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expires']) : NULL_DATE); $raw = ((x($_REQUEST,'raw')) ? intval($_REQUEST['raw']) : 0); $mimetype = ((x($_REQUEST,'mimetype')) ? notags(trim($_REQUEST['mimetype'])) : 'text/bbcode'); - $sig = ((x($_REQUEST,'signature')) ? trim($_REQUEST['signature']) : ''); + $sig = ((x($_REQUEST,'signature')) ? trim($_REQUEST['signature']) : ''); if($preview) { -- cgit v1.2.3 From 335394aaa110d1fd7cc5804cee1c7b56ccfdd63e Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 15 Jun 2019 15:58:55 +0200 Subject: Add base64 decode if signature encoded --- Zotlabs/Module/Mail.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php index 4e4c18cae..67d9642b9 100644 --- a/Zotlabs/Module/Mail.php +++ b/Zotlabs/Module/Mail.php @@ -25,7 +25,10 @@ class Mail extends \Zotlabs\Web\Controller { $expires = ((x($_REQUEST,'expires')) ? datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expires']) : NULL_DATE); $raw = ((x($_REQUEST,'raw')) ? intval($_REQUEST['raw']) : 0); $mimetype = ((x($_REQUEST,'mimetype')) ? notags(trim($_REQUEST['mimetype'])) : 'text/bbcode'); + $sig = ((x($_REQUEST,'signature')) ? trim($_REQUEST['signature']) : ''); + if(strpos($sig,'b64.') === 0) + $sig = base64_decode(str_replace('b64.', '', $sig)); if($preview) { -- cgit v1.2.3 From 43cec4398d0d035dd9446988134b814513a73080 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 15 Jun 2019 16:03:35 +0200 Subject: base64 encode message signature --- Zotlabs/Module/Mail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php index 67d9642b9..7c344966b 100644 --- a/Zotlabs/Module/Mail.php +++ b/Zotlabs/Module/Mail.php @@ -400,7 +400,7 @@ class Mail extends \Zotlabs\Web\Controller { 'can_recall' => ($channel['channel_hash'] == $message['from_xchan']), 'is_recalled' => (intval($message['mail_recalled']) ? t('Message has been recalled.') : ''), 'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'], 'c'), - 'sig' => $message['sig'] + 'sig' => base64_encode($message['sig']) ); $seen = $message['seen']; -- cgit v1.2.3 From c9604eaabf400ff60a7be24214ca4945561e6ec2 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 17 Jun 2019 10:07:00 +0200 Subject: revisit mod cal --- Zotlabs/Module/Cal.php | 432 ++++++++++++++++--------------------------------- 1 file changed, 142 insertions(+), 290 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php index 731998c1a..dca100dad 100644 --- a/Zotlabs/Module/Cal.php +++ b/Zotlabs/Module/Cal.php @@ -1,6 +1,10 @@ 1) { $nick = argv(1); @@ -25,19 +27,21 @@ class Cal extends \Zotlabs\Web\Controller { $channelx = channelx_by_nick($nick); - if(! $channelx) + if(! $channelx) { + notice( t('Channel not found.') . EOL); return; + } - \App::$data['channel'] = $channelx; + App::$data['channel'] = $channelx; - $observer = \App::get_observer(); - \App::$data['observer'] = $observer; + $observer = App::get_observer(); + App::$data['observer'] = $observer; $observer_xchan = (($observer) ? $observer['xchan_hash'] : ''); - head_set_icon(\App::$data['channel']['xchan_photo_s']); + head_set_icon(App::$data['channel']['xchan_photo_s']); - \App::$page['htmlhead'] .= "" ; + App::$page['htmlhead'] .= "" ; } @@ -52,18 +56,8 @@ class Cal extends \Zotlabs\Web\Controller { return; } - $channel = null; - - if(argc() > 1) { - $channel = channelx_by_nick(argv(1)); - } - - - if(! $channel) { - notice( t('Channel not found.') . EOL); - return; - } - + $channel = App::$data['channel']; + // since we don't currently have an event permission - use the stream permission if(! perm_is_allowed($channel['channel_id'], get_observer_hash(), 'view_stream')) { @@ -72,294 +66,152 @@ class Cal extends \Zotlabs\Web\Controller { } nav_set_selected('Calendar'); - - $sql_extra = permissions_sql($channel['channel_id'],get_observer_hash(),'event'); + + head_add_css('/library/fullcalendar/packages/core/main.min.css'); + head_add_css('/library/fullcalendar/packages/daygrid/main.min.css'); + head_add_css('cdav_calendar.css'); + + head_add_js('/library/fullcalendar/packages/core/main.min.js'); + head_add_js('/library/fullcalendar/packages/daygrid/main.min.js'); + + $sql_extra = permissions_sql($channel['channel_id'], get_observer_hash(), 'event'); + + if(! perm_is_allowed($channel['channel_id'], get_observer_hash(), 'view_contacts') || App::$profile['hide_friends']) + $sql_extra .= " and etype != 'birthday' "; $first_day = feature_enabled($channel['channel_id'], 'events_cal_first_day'); $first_day = (($first_day) ? $first_day : 0); - $htpl = get_markup_template('event_head.tpl'); - \App::$page['htmlhead'] .= replace_macros($htpl,array( - '$baseurl' => z_root(), - '$module_url' => '/cal/' . $channel['channel_address'], - '$modparams' => 2, - '$lang' => \App::$language, - '$timezone' => date_default_timezone_get(), - '$first_day' => $first_day - )); - - $o = ''; - - $mode = 'view'; - $y = 0; - $m = 0; - $ignored = ((x($_REQUEST,'ignored')) ? " and dismissed = " . intval($_REQUEST['ignored']) . " " : ''); - - // logger('args: ' . print_r(\App::$argv,true)); + $start = ''; + $finish = ''; + + if (argv(2) === 'json') { + if (x($_GET,'start')) $start = $_GET['start']; + if (x($_GET,'end')) $finish = $_GET['end']; + } - if(argc() > 3 && intval(argv(2)) && intval(argv(3))) { - $mode = 'view'; - $y = intval(argv(2)); - $m = intval(argv(3)); + $start = datetime_convert('UTC','UTC',$start); + $finish = datetime_convert('UTC','UTC',$finish); + $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start); + $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish); + + if (x($_GET, 'id')) { + $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id + from event left join item on item.resource_id = event.event_hash + where item.resource_type = 'event' and event.uid = %d and event.id = %d $sql_extra limit 1", + intval($channel['channel_id']), + intval($_GET['id']) + ); } - if(argc() <= 3) { - $mode = 'view'; - $event_id = argv(2); + else { + // fixed an issue with "nofinish" events not showing up in the calendar. + // There's still an issue if the finish date crosses the end of month. + // Noting this for now - it will need to be fixed here and in Friendica. + // Ultimately the finish date shouldn't be involved in the query. + $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id + from event left join item on event.event_hash = item.resource_id + where item.resource_type = 'event' and event.uid = %d and event.uid = item.uid + AND (( event.adjust = 0 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' ) + OR ( event.adjust = 1 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )) + $sql_extra", + intval($channel['channel_id']), + dbesc($start), + dbesc($finish), + dbesc($adjust_start), + dbesc($adjust_finish) + ); } - if($mode == 'view') { - - /* edit/create form */ - if($event_id) { - $r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1", - dbesc($event_id), - intval($channel['channel_id']) - ); - if(count($r)) - $orig_event = $r[0]; - } - - - // Passed parameters overrides anything found in the DB - if(!x($orig_event)) - $orig_event = array(); - - - - $tz = date_default_timezone_get(); - if(x($orig_event)) - $tz = (($orig_event['adjust']) ? date_default_timezone_get() : 'UTC'); - - $syear = datetime_convert('UTC', $tz, $sdt, 'Y'); - $smonth = datetime_convert('UTC', $tz, $sdt, 'm'); - $sday = datetime_convert('UTC', $tz, $sdt, 'd'); - $shour = datetime_convert('UTC', $tz, $sdt, 'H'); - $sminute = datetime_convert('UTC', $tz, $sdt, 'i'); - - $stext = datetime_convert('UTC',$tz,$sdt); - $stext = substr($stext,0,14) . "00:00"; - - $fyear = datetime_convert('UTC', $tz, $fdt, 'Y'); - $fmonth = datetime_convert('UTC', $tz, $fdt, 'm'); - $fday = datetime_convert('UTC', $tz, $fdt, 'd'); - $fhour = datetime_convert('UTC', $tz, $fdt, 'H'); - $fminute = datetime_convert('UTC', $tz, $fdt, 'i'); - - $ftext = datetime_convert('UTC',$tz,$fdt); - $ftext = substr($ftext,0,14) . "00:00"; - - $type = ((x($orig_event)) ? $orig_event['etype'] : 'event'); - - $f = get_config('system','event_input_format'); - if(! $f) - $f = 'ymd'; - - $catsenabled = feature_enabled($channel['channel_id'],'categories'); - - - $show_bd = perm_is_allowed($channel['channel_id'], get_observer_hash(), 'view_contacts'); - if(! $show_bd) { - $sql_extra .= " and event.etype != 'birthday' "; - } - - - $category = ''; - - $thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y'); - $thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m'); - if(! $y) - $y = intval($thisyear); - if(! $m) - $m = intval($thismonth); - - // Put some limits on dates. The PHP date functions don't seem to do so well before 1900. - // An upper limit was chosen to keep search engines from exploring links millions of years in the future. - - if($y < 1901) - $y = 1900; - if($y > 2099) - $y = 2100; - - $nextyear = $y; - $nextmonth = $m + 1; - if($nextmonth > 12) { - $nextmonth = 1; - $nextyear ++; - } - - $prevyear = $y; - if($m > 1) - $prevmonth = $m - 1; - else { - $prevmonth = 12; - $prevyear --; - } - - $dim = get_dim($y,$m); - $start = sprintf('%d-%d-%d %d:%d:%d',$y,$m,1,0,0,0); - $finish = sprintf('%d-%d-%d %d:%d:%d',$y,$m,$dim,23,59,59); - - - if (argv(2) === 'json'){ - if (x($_GET,'start')) $start = $_GET['start']; - if (x($_GET,'end')) $finish = $_GET['end']; - } - - $start = datetime_convert('UTC','UTC',$start); - $finish = datetime_convert('UTC','UTC',$finish); - - $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start); - $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish); - - - if(! perm_is_allowed(\App::$profile['uid'],get_observer_hash(),'view_contacts')) - $sql_extra .= " and etype != 'birthday' "; + if($r) { + xchan_query($r); + $r = fetch_post_tags($r,true); + $r = sort_by_date($r); + } - if (x($_GET,'id')){ - $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id - from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d $sql_extra limit 1", - intval($channel['channel_id']), - intval($_GET['id']) - ); - } - else { - // fixed an issue with "nofinish" events not showing up in the calendar. - // There's still an issue if the finish date crosses the end of month. - // Noting this for now - it will need to be fixed here and in Friendica. - // Ultimately the finish date shouldn't be involved in the query. + $events = []; - $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id - from event left join item on event.event_hash = item.resource_id - where item.resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored - AND (( event.adjust = 0 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' ) - OR ( event.adjust = 1 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )) ", - intval($channel['channel_id']), - dbesc($start), - dbesc($finish), - dbesc($adjust_start), - dbesc($adjust_finish) - ); - } - - $links = array(); - - if($r) { - xchan_query($r); - $r = fetch_post_tags($r,true); - - $r = sort_by_date($r); - } - - if($r) { - foreach($r as $rr) { - $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j')); - if(! x($links,$j)) - $links[$j] = z_root() . '/' . \App::$cmd . '#link-' . $j; - } - } - - $events=array(); - - $last_date = ''; - $fmt = t('l, F j'); - - if($r) { - - foreach($r as $rr) { + if($r) { - $tz = get_iconfig($rr, 'event', 'timezone'); + foreach($r as $rr) { - if(! $tz) - $tz = 'UTC'; + $tz = get_iconfig($rr, 'event', 'timezone'); + if(! $tz) + $tz = 'UTC'; - $rr['timezone'] = $tz; + $start = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); + if ($rr['nofinish']){ + $end = null; + } else { + $end = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c')); + } - $j = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j')); - $d = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtstart'], $fmt) : datetime_convert('UTC','UTC',$rr['dtstart'],$fmt)); - $d = day_translate($d); - - $start = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtstart'], 'c') : datetime_convert('UTC','UTC',$rr['dtstart'],'c')); - if ($rr['nofinish']){ - $end = null; - } else { - $end = (($rr['adjust']) ? datetime_convert($tz,date_default_timezone_get(),$rr['dtend'], 'c') : datetime_convert('UTC','UTC',$rr['dtend'],'c')); - } - - - $is_first = ($d !== $last_date); - - $last_date = $d; - - $edit = false; - - $drop = false; - - $title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8')); - if(! $title) { - list($title, $_trash) = explode("$rr['id'], - 'hash' => $rr['event_hash'], - 'start'=> $start, - 'end' => $end, - 'drop' => $drop, - 'allDay' => (($rr['adjust']) ? 0 : 1), - 'title' => $title, - - 'j' => $j, - 'd' => $d, - 'edit' => $edit, - 'is_first'=>$is_first, - 'item'=>$rr, - 'html'=>$html, - 'plink' => array($rr['plink'],t('Link to Source'),'',''), - ); - - } + + $events[] = array( + 'calendar_id' => 'channel_calendar', + 'rw' => true, + 'id'=>$rr['id'], + 'uri' => $rr['event_hash'], + 'timezone' => $tz, + 'start'=> $start, + 'end' => $end, + 'drop' => $drop, + 'allDay' => (($rr['adjust']) ? 0 : 1), + 'title' => htmlentities($rr['summary'], ENT_COMPAT, 'UTF-8', false), + 'editable' => $edit ? true : false, + 'item' => $rr, + 'plink' => [$rr['plink'], t('Link to source')], + 'description' => htmlentities($rr['description'], ENT_COMPAT, 'UTF-8', false), + 'location' => htmlentities($rr['location'], ENT_COMPAT, 'UTF-8', false), + 'allow_cid' => expand_acl($rr['allow_cid']), + 'allow_gid' => expand_acl($rr['allow_gid']), + 'deny_cid' => expand_acl($rr['deny_cid']), + 'deny_gid' => expand_acl($rr['deny_gid']), + 'html' => $html + ); } + } + + if (argv(2) === 'json') { + echo json_encode($events); + killme(); + } - if (argv(2) === 'json'){ - echo json_encode($events); killme(); - } - - // links: array('href', 'text', 'extra css classes', 'title') - if (x($_GET,'id')){ - $tpl = get_markup_template("event_cal.tpl"); - } - else { - $tpl = get_markup_template("events_cal-js.tpl"); - } - - $nick = $channel['channel_address']; - - $o = replace_macros($tpl, array( - '$baseurl' => z_root(), - '$new_event' => array(z_root().'/cal',(($event_id) ? t('Edit Event') : t('Create Event')),'',''), - '$previus' => array(z_root()."/cal/$nick/$prevyear/$prevmonth",t('Previous'),'',''), - '$next' => array(z_root()."/cal/$nick/$nextyear/$nextmonth",t('Next'),'',''), - '$export' => array(z_root()."/cal/$nick/$y/$m/export",t('Export'),'',''), - '$calendar' => cal($y,$m,$links, ' eventcal'), - '$events' => $events, - '$upload' => t('Import'), - '$submit' => t('Submit'), - '$prev' => t('Previous'), - '$next' => t('Next'), - '$today' => t('Today'), - '$form' => $form, - '$expandform' => ((x($_GET,'expandform')) ? true : false) - )); - - if (x($_GET,'id')){ echo $o; killme(); } - - return $o; + if (x($_GET,'id')) { + $o = replace_macros(get_markup_template("cal_event.tpl"), [ + '$events' => $events + ]); + echo $o; + killme(); } + + $nick = $channel['channel_address']; + + $sources = '{ + id: \'channel_calendar\', + url: \'/cal/' . $nick . '/json/\', + color: \'#3a87ad\' + }'; + + $o = replace_macros(get_markup_template("cal_calendar.tpl"), [ + '$sources' => $sources, + '$lang' => App::$language, + '$timezone' => date_default_timezone_get(), + '$first_day' => $first_day, + '$prev' => t('Previous'), + '$next' => t('Next'), + '$today' => t('Today'), + '$title' => $title, + '$dtstart' => $dtstart, + '$dtend' => $dtend, + '$nick' => $nick + ]); + + return $o; } -- cgit v1.2.3 From 8535eb7bf5a3836502a4e5ded93c453abf723370 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 17 Jun 2019 10:10:44 +0200 Subject: update feature set --- Zotlabs/Module/Cal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php index dca100dad..a84116e76 100644 --- a/Zotlabs/Module/Cal.php +++ b/Zotlabs/Module/Cal.php @@ -79,7 +79,7 @@ class Cal extends Controller { if(! perm_is_allowed($channel['channel_id'], get_observer_hash(), 'view_contacts') || App::$profile['hide_friends']) $sql_extra .= " and etype != 'birthday' "; - $first_day = feature_enabled($channel['channel_id'], 'events_cal_first_day'); + $first_day = feature_enabled($channel['channel_id'], 'cal_first_day'); $first_day = (($first_day) ? $first_day : 0); $start = ''; -- cgit v1.2.3 From 9507f191b02c05d4cbbbe0ab3072f5a8211b1312 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 17 Jun 2019 10:16:49 +0200 Subject: disable events module. it is now disfunctional --- Zotlabs/Module/Events.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index e883db49f..dcdbfd233 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -11,6 +11,9 @@ require_once('include/html2plain.php'); class Events extends \Zotlabs\Web\Controller { function post() { + + // this module is deprecated + return; logger('post: ' . print_r($_REQUEST,true), LOGGER_DATA); @@ -245,6 +248,9 @@ class Events extends \Zotlabs\Web\Controller { function get() { + + // this module is deprecated + return; if(argc() > 2 && argv(1) == 'ical') { $event_id = argv(2); -- cgit v1.2.3 From becaa3b920bfe87c031c01bdf35d35db5c82e31e Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 17 Jun 2019 18:30:05 -0700 Subject: minor zot6 compatibility issues uncovered through daily use --- Zotlabs/Module/Item.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 6bc8c645f..965cbf173 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -96,11 +96,12 @@ class Item extends Controller { } // if we don't have a parent id belonging to the signer see if we can obtain one as a visitor that we have permission to access + // with a bias towards those items owned by channels on this site (item_wall = 1) $sql_extra = item_permissions_sql(0); if (! $i) { - $i = q("select id as item_id from item where mid = '%s' $item_normal $sql_extra limit 1", + $i = q("select id as item_id from item where mid = '%s' $item_normal $sql_extra order by item_wall desc limit 1", dbesc($r[0]['parent_mid']) ); } -- cgit v1.2.3 From db8e46184bc6fae92d05a8992acab8c14e67aef1 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Wed, 19 Jun 2019 13:20:32 +0200 Subject: Use html_entity_decode() for cached photo URL --- Zotlabs/Module/Photo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index 0dc6d0194..a53b00282 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -169,7 +169,7 @@ class Photo extends \Zotlabs\Web\Controller { ); call_hooks('cache_url_hook', $cache); if(! $cache['status']) { - $url = htmlspecialchars_decode($r[0]['display_path']); + $url = html_entity_decode($r[0]['display_path'], ENT_QUOTES); // SSLify if needed if(strpos(z_root(),'https:') !== false && strpos($url,'https:') === false) $url = z_root() . '/sslify/' . $filename . '?f=&url=' . urlencode($url); -- cgit v1.2.3 From 9d156141b1205e48bbb3008f2a3040caa4c33192 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 19 Jun 2019 17:32:38 -0700 Subject: changes to support direct messages in zot6 (set item.item_private = 2 when private mentions are used and federate with zot:directMessage attribute which aligns with litepub:directMessage) --- Zotlabs/Module/Apschema.php | 3 ++- Zotlabs/Module/Item.php | 11 +++++------ Zotlabs/Module/Lockview.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Apschema.php b/Zotlabs/Module/Apschema.php index d217041f2..ef2264bc0 100644 --- a/Zotlabs/Module/Apschema.php +++ b/Zotlabs/Module/Apschema.php @@ -28,7 +28,8 @@ class Apschema extends \Zotlabs\Web\Controller { 'nomadicHubs' => 'zot:nomadicHubs', 'emojiReaction' => 'zot:emojiReaction', 'expires' => 'zot:expires', - + 'directMessage' => 'zot:directMessage', + 'magicEnv' => [ '@id' => 'zot:magicEnv', '@type' => '@id' diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 965cbf173..901f54c72 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -551,10 +551,10 @@ class Item extends Controller { $public_policy = $orig_post['public_policy']; $private = $orig_post['item_private']; } - - if($private || $public_policy || $acl->is_private()) - $private = 1; - + + if($public_policy || $acl->is_private()) { + $private = (($private) ? $private : 1); + } $location = $orig_post['location']; $coord = $orig_post['coord']; @@ -631,12 +631,11 @@ class Item extends Controller { $allow_empty = ((array_key_exists('allow_empty',$_REQUEST)) ? intval($_REQUEST['allow_empty']) : 0); - $private = intval($acl->is_private() || ($public_policy)); + $private = (($private) ? $private : intval($acl->is_private() || ($public_policy))); // If this is a comment, set the permissions from the parent. if($parent_item) { - $private = 0; $acl->set($parent_item); $private = intval($acl->is_private() || $parent_item['item_private']); $public_policy = $parent_item['public_policy']; diff --git a/Zotlabs/Module/Lockview.php b/Zotlabs/Module/Lockview.php index d7ed07a53..8c8519c57 100644 --- a/Zotlabs/Module/Lockview.php +++ b/Zotlabs/Module/Lockview.php @@ -76,7 +76,7 @@ class Lockview extends \Zotlabs\Web\Controller { killme(); } - if(($item['item_private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid'])) + if(intval($item['item_private']) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid'])) && (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) { // if the post is private, but public_policy is blank ("visible to the internet"), and there aren't any -- cgit v1.2.3 From c1cc76119cf055c50045af24df07040fa32d2bf6 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 19 Jun 2019 21:41:46 -0700 Subject: events: don't use htmlentities on local (hz) event titles as they are not being used in textareas and umlauts for instance are getting mangled on the calendar display --- Zotlabs/Module/Channel_calendar.php | 4 ++-- Zotlabs/Module/Events.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 4f08eb27c..9a735ffc5 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -381,7 +381,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller { 'end' => $end, 'drop' => $drop, 'allDay' => (($rr['adjust']) ? 0 : 1), - 'title' => htmlentities($rr['summary'], ENT_COMPAT, 'UTF-8', false), + 'title' => $rr['summary'], 'editable' => $edit ? true : false, 'item' => $rr, 'plink' => [$rr['plink'], t('Link to source')], @@ -402,7 +402,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller { echo ical_wrapper($r); killme(); } - + if (\App::$argv[1] === 'json'){ json_return_and_die($events); } diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index e883db49f..056d0cd5a 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -662,9 +662,10 @@ class Events extends \Zotlabs\Web\Controller { 'html'=>$html, 'plink' => array($rr['plink'],t('Link to Source'),'',''), ); + } } - + if($export) { header('Content-type: text/calendar'); header('content-disposition: attachment; filename="' . t('calendar') . '-' . $channel['channel_address'] . '.ics"' ); -- cgit v1.2.3 From 952e466d9121726f00c94b6527ff01255529b82c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 19 Jun 2019 22:13:03 -0700 Subject: tweak to event title encoding to ensure it works with German, Russian, as well as angle chars --- Zotlabs/Module/Channel_calendar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 9a735ffc5..cacee57ef 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -381,7 +381,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller { 'end' => $end, 'drop' => $drop, 'allDay' => (($rr['adjust']) ? 0 : 1), - 'title' => $rr['summary'], + 'title' => html_entity_decode($rr['summary'],ENT_COMPAT,'UTF-8'), 'editable' => $edit ? true : false, 'item' => $rr, 'plink' => [$rr['plink'], t('Link to source')], -- cgit v1.2.3 From f37387de8061aab7221dde7697402be564d596d5 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 20 Jun 2019 18:34:44 +0200 Subject: fix encoding also for description and location --- Zotlabs/Module/Channel_calendar.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index bb0c9f857..109b18f37 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -381,12 +381,12 @@ class Channel_calendar extends \Zotlabs\Web\Controller { 'end' => $end, 'drop' => $drop, 'allDay' => (($rr['adjust']) ? 0 : 1), - 'title' => html_entity_decode($rr['summary'],ENT_COMPAT,'UTF-8'), + 'title' => html_entity_decode($rr['summary'], ENT_COMPAT, 'UTF-8'), 'editable' => $edit ? true : false, 'item' => $rr, 'plink' => [$rr['plink'], t('Link to source')], - 'description' => htmlentities($rr['description'], ENT_COMPAT, 'UTF-8', false), - 'location' => htmlentities($rr['location'], ENT_COMPAT, 'UTF-8', false), + 'description' => html_entity_decode($rr['description'], ENT_COMPAT, 'UTF-8'), + 'location' => html_entity_decode($rr['location'], ENT_COMPAT, 'UTF-8'), 'allow_cid' => expand_acl($rr['allow_cid']), 'allow_gid' => expand_acl($rr['allow_gid']), 'deny_cid' => expand_acl($rr['deny_cid']), -- cgit v1.2.3 From 24b0f8e27e2f5e035b9a8f488bae8d79a10398a4 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 20 Jun 2019 18:44:23 +0200 Subject: apply calendar encoding fixes to mod cal --- Zotlabs/Module/Cal.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php index a84116e76..07bee38bd 100644 --- a/Zotlabs/Module/Cal.php +++ b/Zotlabs/Module/Cal.php @@ -161,12 +161,12 @@ class Cal extends Controller { 'end' => $end, 'drop' => $drop, 'allDay' => (($rr['adjust']) ? 0 : 1), - 'title' => htmlentities($rr['summary'], ENT_COMPAT, 'UTF-8', false), + 'title' => html_entity_decode($rr['summary'], ENT_COMPAT, 'UTF-8'), 'editable' => $edit ? true : false, 'item' => $rr, 'plink' => [$rr['plink'], t('Link to source')], - 'description' => htmlentities($rr['description'], ENT_COMPAT, 'UTF-8', false), - 'location' => htmlentities($rr['location'], ENT_COMPAT, 'UTF-8', false), + 'description' => html_entity_decode($rr['description'], ENT_COMPAT, 'UTF-8'), + 'location' => html_entity_decode($rr['location'], ENT_COMPAT, 'UTF-8'), 'allow_cid' => expand_acl($rr['allow_cid']), 'allow_gid' => expand_acl($rr['allow_gid']), 'deny_cid' => expand_acl($rr['deny_cid']), -- cgit v1.2.3 From 5ee70092712be1604ce1450a8735154fdb7c9485 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 25 Jun 2019 18:37:27 -0700 Subject: provide auto redirect from zot6 /item permalinks --- Zotlabs/Module/Item.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 901f54c72..3eac2b6a0 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -193,6 +193,25 @@ class Item extends Controller { killme(); } + + if(argc() > 1 && argv(1) !== 'drop') { + $x = q("select uid, item_wall, llink, mid from item where mid = '%s' ", + dbesc(z_root() . '/item/' . argv(1)) + ); + if($x) { + foreach($x as $xv) { + if (intval($xv['item_wall'])) { + $c = channelx_by_n($xv['uid']); + if ($c) { + goaway($c['xchan_url'] . '?mid=' . gen_link_id($xv['mid'])); + } + } + } + goaway($x[0]['llink']); + } + http_status_exit(404, 'Not found'); + } + } -- cgit v1.2.3 From cf844cb27c02c3aae636eb1aa1587b1d5e3e81a0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 26 Jun 2019 21:45:21 -0700 Subject: http signature consolidation --- Zotlabs/Module/Cdav.php | 5 +++-- Zotlabs/Module/Channel.php | 2 +- Zotlabs/Module/Dav.php | 9 +++++---- Zotlabs/Module/Getfile.php | 6 ++++-- Zotlabs/Module/Id.php | 2 +- Zotlabs/Module/Item.php | 2 +- Zotlabs/Module/Magic.php | 7 ++++--- Zotlabs/Module/Owa.php | 6 ++++-- Zotlabs/Module/Zfinger.php | 8 ++++---- Zotlabs/Module/Zot_probe.php | 2 +- 10 files changed, 28 insertions(+), 21 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index de639e281..b199019c1 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -4,6 +4,7 @@ namespace Zotlabs\Module; use App; use Zotlabs\Lib\Apps; use Zotlabs\Web\Controller; +use Zotlabs\Web\HTTPSig; require_once('include/event.php'); @@ -41,7 +42,7 @@ class Cdav extends Controller { continue; } - $sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER[$head]); + $sigblock = HTTPSig::parse_sigheader($_SERVER[$head]); if($sigblock) { $keyId = str_replace('acct:','',$sigblock['keyId']); if($keyId) { @@ -64,7 +65,7 @@ class Cdav extends Controller { continue; if($record) { - $verified = \Zotlabs\Web\HTTPSig::verify('',$record['channel']['channel_pubkey']); + $verified = HTTPSig::verify('',$record['channel']['channel_pubkey']); if(! ($verified && $verified['header_signed'] && $verified['header_valid'])) { $record = null; } diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 144c2472a..afd82ed2f 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -6,7 +6,7 @@ namespace Zotlabs\Module; use App; use Zotlabs\Web\Controller; use Zotlabs\Lib\PermissionDescription; -use Zotlabs\Zot6\HTTPSig; +use Zotlabs\Web\HTTPSig; use Zotlabs\Lib\Libzot; require_once('include/items.php'); diff --git a/Zotlabs/Module/Dav.php b/Zotlabs/Module/Dav.php index 9f64e2fea..866520461 100644 --- a/Zotlabs/Module/Dav.php +++ b/Zotlabs/Module/Dav.php @@ -8,8 +8,9 @@ namespace Zotlabs\Module; -use \Sabre\DAV as SDAV; -use \Zotlabs\Storage; +use Sabre\DAV as SDAV; +use Zotlabs\Storage; +use Zotlabs\Web\HTTPSig; require_once('include/attach.php'); require_once('include/auth.php'); @@ -46,7 +47,7 @@ class Dav extends \Zotlabs\Web\Controller { continue; } - $sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER[$head]); + $sigblock = HTTPSig::parse_sigheader($_SERVER[$head]); if($sigblock) { $keyId = str_replace('acct:','',$sigblock['keyId']); if($keyId) { @@ -69,7 +70,7 @@ class Dav extends \Zotlabs\Web\Controller { continue; if($record) { - $verified = \Zotlabs\Web\HTTPSig::verify('',$record['channel']['channel_pubkey']); + $verified = HTTPSig::verify('',$record['channel']['channel_pubkey']); if(! ($verified && $verified['header_signed'] && $verified['header_valid'])) { $record = null; } diff --git a/Zotlabs/Module/Getfile.php b/Zotlabs/Module/Getfile.php index 583cf38f0..6d31d23fd 100644 --- a/Zotlabs/Module/Getfile.php +++ b/Zotlabs/Module/Getfile.php @@ -1,6 +1,8 @@ $headers ]); if($x['success']) { diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index cf116a96c..89f83bf8f 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -2,6 +2,8 @@ namespace Zotlabs\Module; +use Zotlabs\Web\HTTPSig; + /** * OpenWebAuth verifier and token generator * See https://macgirvin.com/wiki/mike/OpenWebAuth/Home @@ -25,7 +27,7 @@ class Owa extends \Zotlabs\Web\Controller { continue; } - $sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER[$head]); + $sigblock = HTTPSig::parse_sigheader($_SERVER[$head]); if($sigblock) { $keyId = $sigblock['keyId']; @@ -65,7 +67,7 @@ class Owa extends \Zotlabs\Web\Controller { if ($r) { foreach($r as $hubloc) { - $verified = \Zotlabs\Web\HTTPSig::verify(file_get_contents('php://input'),$hubloc['xchan_pubkey']); + $verified = HTTPSig::verify(file_get_contents('php://input'),$hubloc['xchan_pubkey']); if($verified && $verified['header_signed'] && $verified['header_valid']) { logger('OWA header: ' . print_r($verified,true),LOGGER_DATA); logger('OWA success: ' . $hubloc['hubloc_addr'],LOGGER_DATA); diff --git a/Zotlabs/Module/Zfinger.php b/Zotlabs/Module/Zfinger.php index 6ed001df5..3a20144a5 100644 --- a/Zotlabs/Module/Zfinger.php +++ b/Zotlabs/Module/Zfinger.php @@ -1,6 +1,7 @@ $v) { diff --git a/Zotlabs/Module/Zot_probe.php b/Zotlabs/Module/Zot_probe.php index d0c7e688f..648ed2175 100644 --- a/Zotlabs/Module/Zot_probe.php +++ b/Zotlabs/Module/Zot_probe.php @@ -3,7 +3,7 @@ namespace Zotlabs\Module; use Zotlabs\Lib\Zotfinger; -use Zotlabs\Zot6\HTTPSig; +use Zotlabs\Web\HTTPSig; class Zot_probe extends \Zotlabs\Web\Controller { -- cgit v1.2.3 From ddde4e19659862f6147c304224c390119bdb4d0a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 28 Jun 2019 01:37:36 +0000 Subject: extend definition of direct message to anything with allow_cid but *not* allow_gid. (cherry picked from commit 96a99935ef4f2da899275166b127537287966dac) --- Zotlabs/Module/Item.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index cb78e4047..d03b6ee30 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -760,7 +760,12 @@ class Item extends Controller { } } } - + + if(($str_contact_allow) && (! $str_group_allow)) { + // direct message - private between individual channels but not groups + $private = 2; + } + /** * -- cgit v1.2.3 From 42526fc2dc3a25ab3bb3741bb55733370f630f49 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 28 Jun 2019 13:09:44 +0200 Subject: decode encoded mid --- Zotlabs/Module/Ping.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 3dabe0f7b..6e8042eaf 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -282,8 +282,8 @@ class Ping extends \Zotlabs\Web\Controller { if(strpos($message, $tt['xname']) === 0) $message = substr($message, strlen($tt['xname']) + 1); - $mid = basename($tt['link']); + $mid = ((strpos($mid, 'b64.') === 0) ? @base64url_decode(substr($mid, 4)) : $mid); if(in_array($tt['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) { // we need the thread parent @@ -291,7 +291,6 @@ class Ping extends \Zotlabs\Web\Controller { dbesc($mid), intval(local_channel()) ); - $b64mid = ((strpos($r[0]['thr_parent'], 'b64.') === 0) ? $r[0]['thr_parent'] : 'b64.' . base64url_encode($r[0]['thr_parent'])); } else { -- cgit v1.2.3 From 5ad6eeccdf7d1d260392031c6d4fc0e5308cc6b9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 29 Jun 2019 16:34:06 -0700 Subject: add opengraph meta info to channel page --- Zotlabs/Module/Channel.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index afd82ed2f..b1639b213 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -111,6 +111,17 @@ class Channel extends Controller { // we start loading content profile_load($which,$profile); + + App::$page['htmlhead'] .= '' . "\r\n"; + App::$page['htmlhead'] .= '' . "\r\n"; + + if(App::$profile['about'] && perm_is_allowed($channel['channel_id'],get_observer_hash(),'view_profile')) { + App::$page['htmlhead'] .= '' . "\r\n"; + } + else { + App::$page['htmlhead'] .= '' . "\r\n"; + } + } function get($update = 0, $load = false) { -- cgit v1.2.3 From 276ab3eae32458b019af9261b49acf31739ed09e Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 1 Jul 2019 23:28:31 -0700 Subject: I'm pretty sure the LD construct 'diaspora:guid' isn't actually legal without a definition of 'diaspora' in the current or parent LD context. --- Zotlabs/Module/Apschema.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Apschema.php b/Zotlabs/Module/Apschema.php index ef2264bc0..12cc0e00a 100644 --- a/Zotlabs/Module/Apschema.php +++ b/Zotlabs/Module/Apschema.php @@ -41,8 +41,11 @@ class Apschema extends \Zotlabs\Web\Controller { ], 'ostatus' => 'http://ostatus.org#', - 'conversation' => 'ostatus:conversation' + 'conversation' => 'ostatus:conversation', + 'diaspora' => 'https://diasporafoundation.org/ns/', + 'guid' => 'diaspora:guid' + ] ]; -- cgit v1.2.3 From 87668f7fa8b22526918463bda7602d138385cc35 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 3 Jul 2019 22:13:14 +0200 Subject: fix typo --- Zotlabs/Module/Dirsearch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php index 26cb82044..92b33df0c 100644 --- a/Zotlabs/Module/Dirsearch.php +++ b/Zotlabs/Module/Dirsearch.php @@ -394,7 +394,7 @@ class Dirsearch extends \Zotlabs\Web\Controller { $quoted_string = false; } else - $curr['value'] .= ' ' . trim(q); + $curr['value'] .= ' ' . trim($q); } } } -- cgit v1.2.3 From 407b02bde8cc8492eefc9260c8ae6becfee2211a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 11 Jul 2019 11:12:27 +0200 Subject: calendar: revert back to UTC strings for dates due to better legibility. Strip timezone info from UTC string and always treat values as UTC. --- Zotlabs/Module/Cdav.php | 12 ++++++------ Zotlabs/Module/Channel_calendar.php | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index b199019c1..e2855d2b6 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -278,11 +278,11 @@ class Cdav extends Controller { $allday = $_REQUEST['allday']; $title = $_REQUEST['title']; - $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']); + $start = datetime_convert('UTC', 'UTC', $_REQUEST['dtstart']); $dtstart = new \DateTime($start); if($_REQUEST['dtend']) { - $end = datetime_convert($tz, 'UTC', $_REQUEST['dtend']); + $end = datetime_convert('UTC', 'UTC', $_REQUEST['dtend']); $dtend = new \DateTime($end); } $description = $_REQUEST['description']; @@ -369,10 +369,10 @@ class Cdav extends Controller { $uri = $_REQUEST['uri']; $title = $_REQUEST['title']; - $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']); + $start = datetime_convert('UTC', 'UTC', $_REQUEST['dtstart']); $dtstart = new \DateTime($start); if($_REQUEST['dtend']) { - $end = datetime_convert($tz, 'UTC', $_REQUEST['dtend']); + $end = datetime_convert('UTC', 'UTC', $_REQUEST['dtend']); $dtend = new \DateTime($end); } $description = $_REQUEST['description']; @@ -442,10 +442,10 @@ class Cdav extends Controller { $allday = $_REQUEST['allday']; $uri = $_REQUEST['uri']; - $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']); + $start = datetime_convert('UTC', 'UTC', $_REQUEST['dtstart']); $dtstart = new \DateTime($start); if($_REQUEST['dtend']) { - $end = datetime_convert($tz, 'UTC', $_REQUEST['dtend']); + $end = datetime_convert('UTC', 'UTC', $_REQUEST['dtend']); $dtend = new \DateTime($end); } diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 109b18f37..7d75a7e41 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -21,7 +21,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $event_hash = ((x($_POST,'event_hash')) ? $_POST['event_hash'] : ''); $xchan = ((x($_POST,'xchan')) ? dbesc($_POST['xchan']) : ''); - $uid = local_channel(); + $uid = local_channel(); // only allow editing your own events. if(($xchan) && ($xchan !== get_observer_hash())) @@ -34,8 +34,8 @@ class Channel_calendar extends \Zotlabs\Web\Controller { $adjust = intval($_POST['adjust']); - $start = (($adjust) ? datetime_convert($tz, 'UTC', escape_tags($_REQUEST['dtstart'])) : datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtstart']))); - $finish = (($adjust) ? datetime_convert($tz, 'UTC', escape_tags($_REQUEST['dtend'])) : datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtend']))); + $start = datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtstart'])); + $finish = datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtend'])); $summary = escape_tags(trim($_POST['summary'])); $desc = escape_tags(trim($_POST['desc'])); -- cgit v1.2.3 From a6f06c2d943cabc4475fa8de67e0cd03725d475e Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 15 Jul 2019 10:57:04 +0200 Subject: Fix ETag quotes --- Zotlabs/Module/Photo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index a53b00282..59dc709e1 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -222,7 +222,7 @@ class Photo extends \Zotlabs\Web\Controller { if(! $data) killme(); - $etag = md5($data . $modified); + $etag = '"' . md5($data . $modified) . '"'; if($modified == 0) $modified = time(); -- cgit v1.2.3 From 6ca7527ec9043571525187c0d33e75f03c5a8e1b Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 18 Jul 2019 14:19:32 +0200 Subject: add hashtag to appschema and bump appschema rev --- Zotlabs/Module/Apschema.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Apschema.php b/Zotlabs/Module/Apschema.php index 12cc0e00a..756057a8a 100644 --- a/Zotlabs/Module/Apschema.php +++ b/Zotlabs/Module/Apschema.php @@ -44,7 +44,9 @@ class Apschema extends \Zotlabs\Web\Controller { 'conversation' => 'ostatus:conversation', 'diaspora' => 'https://diasporafoundation.org/ns/', - 'guid' => 'diaspora:guid' + 'guid' => 'diaspora:guid', + + 'Hashtag' => 'as:Hashtag' ] ]; @@ -58,4 +60,4 @@ class Apschema extends \Zotlabs\Web\Controller { -} \ No newline at end of file +} -- cgit v1.2.3 From 81ecea29c839c8f914be59acbddd4955673ee2f6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 22 Jul 2019 19:11:52 +0200 Subject: reflect repeats in notifications, use force flag for import_xchan_photo() in cron --- Zotlabs/Module/Share.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php index 53a06b072..a18a81937 100644 --- a/Zotlabs/Module/Share.php +++ b/Zotlabs/Module/Share.php @@ -106,7 +106,7 @@ class Share extends \Zotlabs\Web\Controller { $arr['owner_xchan'] = $item['author_xchan']; $arr['obj'] = Activity::encode_item($item); $arr['obj_type'] = $item['obj_type']; - $arr['verb'] = 'Announce'; + $arr['verb'] = ACTIVITY_SHARE; $post = item_store($arr); -- cgit v1.2.3 From feea137dbfb807278a3b922396332b867f123049 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 28 Jul 2019 23:46:38 -0700 Subject: hz core issue #1386 - function name must be a string --- Zotlabs/Module/Group.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Group.php b/Zotlabs/Module/Group.php index 12edf8428..f836978ee 100644 --- a/Zotlabs/Module/Group.php +++ b/Zotlabs/Module/Group.php @@ -177,7 +177,7 @@ class Group extends Controller { if($r) $result = group_rmv(local_channel(),$r[0]['gname']); if($result) { - $hookinfo = [ 'pgrp_extras' => '', 'group'=>$argv(2) ]; + $hookinfo = [ 'pgrp_extras' => '', 'group' => argv(2) ]; call_hooks ('privacygroup_extras_drop',$hookinfo); info( t('Privacy group removed.') . EOL); } -- cgit v1.2.3 From af690b64d6b0615c0f5f71ece2e2c75326d58092 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 9 Aug 2019 16:59:14 +0200 Subject: More intelligent quotation shortening while link embedding --- Zotlabs/Module/Linkinfo.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php index b9f90deec..1551d1f26 100644 --- a/Zotlabs/Module/Linkinfo.php +++ b/Zotlabs/Module/Linkinfo.php @@ -275,7 +275,7 @@ class Linkinfo extends \Zotlabs\Web\Controller { // Check codepage in HTTP headers or HTML if not exist $cp = (preg_match('/Content-Type: text\/html; charset=(.+)\r\n/i', $header, $o) ? $o[1] : ''); if(empty($cp)) - $cp = (preg_match('/meta.+content=["|\']text\/html; charset=([^"|\']+)/i', $body, $o) ? $o[1] : 'AUTO'); + $cp = (preg_match('/meta.+content=["\']text\/html; charset=([^"\']+)/i', $body, $o) ? $o[1] : 'AUTO'); $body = mb_convert_encoding($body, 'UTF-8', $cp); $body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8"); @@ -444,8 +444,9 @@ class Linkinfo extends \Zotlabs\Web\Controller { while (strpos($text, " ")) $text = trim(str_replace(" ", " ", $text)); - - $siteinfo["text"] = html_entity_decode(substr($text,0,350), ENT_QUOTES, "UTF-8").'...'; + + $text = substr(html_entity_decode($text, ENT_QUOTES, "UTF-8"), 0, 350); + $siteinfo["text"] = rtrim(substr($text, 0, strrpos($text, " ")), "?.,:;!-") . '...'; } } -- cgit v1.2.3 From 38f7d9ad371380763c129b66b44a227cc7035e1e Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 9 Aug 2019 19:01:21 +0200 Subject: Replace plink URL with 'share' tag if possible --- Zotlabs/Module/Linkinfo.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php index 1551d1f26..7d6ff4043 100644 --- a/Zotlabs/Module/Linkinfo.php +++ b/Zotlabs/Module/Linkinfo.php @@ -2,9 +2,6 @@ namespace Zotlabs\Module; - - - class Linkinfo extends \Zotlabs\Web\Controller { function get() { @@ -48,7 +45,20 @@ class Linkinfo extends \Zotlabs\Web\Controller { } logger('linkinfo: ' . $url); - + + // Replace plink URL with 'share' tag if possible + if (preg_match("/mid=b64\.(\w+)(&.+)?$/", $url, $mid)) { + + $r = q("SELECT id FROM item WHERE mid = '%s' AND uid = %d LIMIT 1", + dbesc(base64url_decode($mid[1])), + intval(local_channel()) + ); + if ($r) { + echo "[share=" . $r[0]['id'] . "][/share]"; + killme(); + } + } + $result = z_fetch_url($url,false,0,array('novalidate' => true, 'nobody' => true)); if($result['success']) { $hdrs=array(); -- cgit v1.2.3 From 0ce1a200f70c831aee2d2af3329133ef654f6b77 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 10 Aug 2019 11:15:48 +0200 Subject: Improve plink to share tag detection --- Zotlabs/Module/Linkinfo.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php index 7d6ff4043..fcf8a6aa1 100644 --- a/Zotlabs/Module/Linkinfo.php +++ b/Zotlabs/Module/Linkinfo.php @@ -46,18 +46,20 @@ class Linkinfo extends \Zotlabs\Web\Controller { logger('linkinfo: ' . $url); - // Replace plink URL with 'share' tag if possible - if (preg_match("/mid=b64\.(\w+)(&.+)?$/", $url, $mid)) { - - $r = q("SELECT id FROM item WHERE mid = '%s' AND uid = %d LIMIT 1", - dbesc(base64url_decode($mid[1])), - intval(local_channel()) - ); - if ($r) { - echo "[share=" . $r[0]['id'] . "][/share]"; - killme(); - } - } + // Replace plink URL with 'share' tag if possible + preg_match("/(mid=b64\.|display\/|posts\/)([\w\-]+)(&.+)?$/", $url, $mid); + + if (!empty($mid) && $mid[1] == 'mid=b64.') + $mid[2] = base64_decode($mid[2]); + + $r = q("SELECT id FROM item WHERE mid = '%s' AND uid = %d LIMIT 1", + dbesc((empty($mid) ? $url : $mid[2])), + intval(local_channel()) + ); + if ($r) { + echo "[share=" . $r[0]['id'] . "][/share]"; + killme(); + } $result = z_fetch_url($url,false,0,array('novalidate' => true, 'nobody' => true)); if($result['success']) { -- cgit v1.2.3