diff options
author | Mario Vavti <mario@mariovavti.com> | 2019-04-30 10:47:48 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2019-04-30 10:47:48 +0200 |
commit | 0b062d0b8ae89b40b4e036f874f6af3780c30451 (patch) | |
tree | dd37934714db3344ce7770c14755f7a62c92c25b /Zotlabs/Module/Cdav.php | |
parent | 9cc1eff15cae3884458a6f7171140f2780665ff7 (diff) | |
download | volse-hubzilla-0b062d0b8ae89b40b4e036f874f6af3780c30451.tar.gz volse-hubzilla-0b062d0b8ae89b40b4e036f874f6af3780c30451.tar.bz2 volse-hubzilla-0b062d0b8ae89b40b4e036f874f6af3780c30451.zip |
select event by event_hash instead of item_id
Diffstat (limited to 'Zotlabs/Module/Cdav.php')
-rw-r--r-- | Zotlabs/Module/Cdav.php | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index ce5b777f5..6e302935c 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -905,19 +905,18 @@ class Cdav extends Controller { head_add_js('/library/fullcalendar/packages/list/main.min.js'); $sources = ''; - $iid = ''; + $resource_id = ''; $resource = null; - if(argc() == 3 && intval(argv(2))) - $iid = argv(2); + if(argc() == 3) + $resource_id = argv(2); - if($iid) { - $r = q("SELECT event.*, item.author_xchan, item.owner_xchan, item.id as item_id FROM item LEFT JOIN event ON item.resource_id = event.event_hash - WHERE item.id = %d AND item.uid = %d LIMIT 1", - dbesc($iid), - intval(local_channel()) + if($resource_id) { + $r = q("SELECT event.*, item.author_xchan, item.owner_xchan, item.plink, item.id as item_id FROM event LEFT JOIN item ON event.event_hash = item.resource_id + WHERE event.uid = %d AND event.event_hash = '%s' LIMIT 1", + intval(local_channel()), + dbesc($resource_id) ); - if($r) { xchan_query($r); $r = fetch_post_tags($r,true); @@ -925,6 +924,8 @@ class Cdav extends Controller { $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')]; + $resource = $r[0]; $catsenabled = feature_enabled(local_channel(),'categories'); @@ -940,6 +941,12 @@ class Cdav extends Controller { } } + if($r[0]['dismissed'] == 0) { + q("UPDATE event SET dismissed = 1 WHERE event.uid = %d AND event.event_hash = '%s'", + intval(local_channel()), + dbesc($resource_id) + ); + } } } |