diff options
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Cal.php | 36 | ||||
-rw-r--r-- | Zotlabs/Module/Channel_calendar.php | 17 | ||||
-rw-r--r-- | Zotlabs/Photo/PhotoDriver.php | 2 |
4 files changed, 24 insertions, 33 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 9bf987027..976ed22fa 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -2766,7 +2766,7 @@ class Libzot { $profile['description'] = $p[0]['pdesc']; $profile['birthday'] = $p[0]['dob']; - if(($profile['birthday'] != '0000-00-00') && (($bd = z_birthday($p[0]['dob'],$e['channel_timezone'])) !== '')) + if(($profile['birthday'] != '0000-00-00') && (($bd = z_birthday($p[0]['dob'],'UTC')) !== '')) $profile['next_birthday'] = $bd; if($age = age($p[0]['dob'],$e['channel_timezone'],'')) 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, 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'),'',''); diff --git a/Zotlabs/Photo/PhotoDriver.php b/Zotlabs/Photo/PhotoDriver.php index bacf926ff..146ef0ae4 100644 --- a/Zotlabs/Photo/PhotoDriver.php +++ b/Zotlabs/Photo/PhotoDriver.php @@ -509,7 +509,7 @@ abstract class PhotoDriver { $arr['imgscale'] = $scale; if(boolval(get_config('system','filesystem_storage_thumbnails', 0)) && $scale > 0) { - $channel = \App::get_channel(); + $channel = channelx_by_n($arr['uid']); $arr['os_storage'] = 1; $arr['os_syspath'] = 'store/' . $channel['channel_address'] . '/' . $arr['os_path'] . '-' . $scale; if(! $this->saveImage($arr['os_syspath'])) |