diff options
author | friendica <info@friendica.com> | 2014-07-06 22:31:39 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-07-06 22:31:39 -0700 |
commit | 913fd1d22ecdf847c45ec498cfc302e0f4572415 (patch) | |
tree | 09d65a693f4e0c3753f54e2da02ca118f297ae9e /mod/events.php | |
parent | 054d5e100fbb5245055d775b03657d002b823889 (diff) | |
download | volse-hubzilla-913fd1d22ecdf847c45ec498cfc302e0f4572415.tar.gz volse-hubzilla-913fd1d22ecdf847c45ec498cfc302e0f4572415.tar.bz2 volse-hubzilla-913fd1d22ecdf847c45ec498cfc302e0f4572415.zip |
numerous event fixes - mostly related to editing an event
Diffstat (limited to 'mod/events.php')
-rwxr-xr-x | mod/events.php | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/mod/events.php b/mod/events.php index 7c4d6c191..02a9d1ed9 100755 --- a/mod/events.php +++ b/mod/events.php @@ -77,33 +77,52 @@ function events_post(&$a) { $channel = $a->get_channel(); - if($share) { - $str_group_allow = perms2str($_POST['group_allow']); - $str_contact_allow = perms2str($_POST['contact_allow']); - $str_group_deny = perms2str($_POST['group_deny']); - $str_contact_deny = perms2str($_POST['contact_deny']); - - // Undo the pseudo-contact of self, since there are real contacts now - if( strpos($str_contact_allow, '<' . $channel['channel_hash'] . '>') !== false ) - { - $str_contact_allow = str_replace('<' . $channel['channel_hash'] . '>', '', $str_contact_allow); + if($event_id) { + $x = q("select * from event where id = %d and uid = %d limit 1", + intval($event_id), + intval(local_user()) + ); + if(! $x) { + notice( t('Event not found.') . EOL); + return; + } + if($x[0]['allow_cid'] === '<' . $channel['channel_hash'] . '>' + && $x[0]['allow_gid'] === '' && $x[0]['deny_cid'] === '' && $x[0]['deny_gid'] === '') { + $share = false; } - // Make sure to set the `private` field as true. This is necessary to - // have the posts show up correctly in Diaspora if an event is created - // as visible only to self at first, but then edited to display to others. - if( strlen($str_group_allow) or strlen($str_contact_allow) or strlen($str_group_deny) or strlen($str_contact_deny) ) - { - $private_event = true; + else { + $share = true; + $str_group_allow = $x[0]['allow_gid']; + $str_contact_allow = $x[0]['allow_cid']; + $str_group_deny = $x[0]['deny_gid']; + $str_contact_deny = $x[0]['deny_cid']; + + if(strlen($str_group_allow) || strlen($str_contact_allow) + || strlen($str_group_deny) || strlen($str_contact_deny)) { + $private_event = true; + } } } else { - // Note: do not set `private` field for self-only events. It will - // keep even you from seeing them! - $str_contact_allow = '<' . $channel['channel_hash'] . '>'; - $str_group_allow = $str_contact_deny = $str_group_deny = ''; + if($share) { + $str_group_allow = perms2str($_POST['group_allow']); + $str_contact_allow = perms2str($_POST['contact_allow']); + $str_group_deny = perms2str($_POST['group_deny']); + $str_contact_deny = perms2str($_POST['contact_deny']); + + if(strlen($str_group_allow) || strlen($str_contact_allow) + || strlen($str_group_deny) || strlen($str_contact_deny)) { + $private_event = true; + } + } + else { + // Note: do not set `private` field for self-only events. It will + // keep even you from seeing them! + $str_contact_allow = '<' . $channel['channel_hash'] . '>'; + $str_group_allow = $str_contact_deny = $str_group_deny = ''; + } } - $datarray = array(); $datarray['start'] = $start; $datarray['finish'] = $finish; @@ -406,7 +425,7 @@ function events_content(&$a) { $n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : ''); $a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : ''); $t_orig = ((x($orig_event)) ? $orig_event['summary'] : ''); - $d_orig = ((x($orig_event)) ? $orig_event['desc'] : ''); + $d_orig = ((x($orig_event)) ? $orig_event['description'] : ''); $l_orig = ((x($orig_event)) ? $orig_event['location'] : ''); $eid = ((x($orig_event)) ? $orig_event['id'] : 0); $event_xchan = ((x($orig_event)) ? $orig_event['event_xchan'] : $channel['channel_hash']); |