numerous event fixes - mostly related to editing an event
This commit is contained in:
parent
054d5e100f
commit
913fd1d22e
@ -165,7 +165,7 @@ function event_store_event($arr) {
|
|||||||
return $r[0];
|
return $r[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$event_hash = $r[0]['event_hash'];
|
$hash = $r[0]['event_hash'];
|
||||||
|
|
||||||
// The event changed. Update it.
|
// The event changed. Update it.
|
||||||
|
|
||||||
|
@ -77,32 +77,51 @@ function events_post(&$a) {
|
|||||||
|
|
||||||
$channel = $a->get_channel();
|
$channel = $a->get_channel();
|
||||||
|
|
||||||
if($share) {
|
if($event_id) {
|
||||||
$str_group_allow = perms2str($_POST['group_allow']);
|
$x = q("select * from event where id = %d and uid = %d limit 1",
|
||||||
$str_contact_allow = perms2str($_POST['contact_allow']);
|
intval($event_id),
|
||||||
$str_group_deny = perms2str($_POST['group_deny']);
|
intval(local_user())
|
||||||
$str_contact_deny = perms2str($_POST['contact_deny']);
|
);
|
||||||
|
if(! $x) {
|
||||||
// Undo the pseudo-contact of self, since there are real contacts now
|
notice( t('Event not found.') . EOL);
|
||||||
if( strpos($str_contact_allow, '<' . $channel['channel_hash'] . '>') !== false )
|
return;
|
||||||
{
|
|
||||||
$str_contact_allow = str_replace('<' . $channel['channel_hash'] . '>', '', $str_contact_allow);
|
|
||||||
}
|
}
|
||||||
// Make sure to set the `private` field as true. This is necessary to
|
if($x[0]['allow_cid'] === '<' . $channel['channel_hash'] . '>'
|
||||||
// have the posts show up correctly in Diaspora if an event is created
|
&& $x[0]['allow_gid'] === '' && $x[0]['deny_cid'] === '' && $x[0]['deny_gid'] === '') {
|
||||||
// as visible only to self at first, but then edited to display to others.
|
$share = false;
|
||||||
if( strlen($str_group_allow) or strlen($str_contact_allow) or strlen($str_group_deny) or strlen($str_contact_deny) )
|
}
|
||||||
{
|
else {
|
||||||
$private_event = true;
|
$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 {
|
else {
|
||||||
// Note: do not set `private` field for self-only events. It will
|
if($share) {
|
||||||
// keep even you from seeing them!
|
$str_group_allow = perms2str($_POST['group_allow']);
|
||||||
$str_contact_allow = '<' . $channel['channel_hash'] . '>';
|
$str_contact_allow = perms2str($_POST['contact_allow']);
|
||||||
$str_group_allow = $str_contact_deny = $str_group_deny = '';
|
$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 = array();
|
||||||
$datarray['start'] = $start;
|
$datarray['start'] = $start;
|
||||||
@ -406,7 +425,7 @@ function events_content(&$a) {
|
|||||||
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
|
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
|
||||||
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
|
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
|
||||||
$t_orig = ((x($orig_event)) ? $orig_event['summary'] : '');
|
$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'] : '');
|
$l_orig = ((x($orig_event)) ? $orig_event['location'] : '');
|
||||||
$eid = ((x($orig_event)) ? $orig_event['id'] : 0);
|
$eid = ((x($orig_event)) ? $orig_event['id'] : 0);
|
||||||
$event_xchan = ((x($orig_event)) ? $orig_event['event_xchan'] : $channel['channel_hash']);
|
$event_xchan = ((x($orig_event)) ? $orig_event['event_xchan'] : $channel['channel_hash']);
|
||||||
|
Reference in New Issue
Block a user