aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorSimon L'nu <simon.lnu@gmail.com>2012-05-03 00:25:56 -0400
committerSimon L'nu <simon.lnu@gmail.com>2012-05-03 00:25:56 -0400
commit0446766f0407b45c78031ad9e5029cc9218b025e (patch)
tree030c81fee9826ce80c0bd488f06fd469d2a6afa9 /mod
parent02dc116a9c646ea5683b8df199a7ff492ae6cfcb (diff)
parentff2ddc319d4307e56a1bf48f51f8f948fe0736ca (diff)
downloadvolse-hubzilla-0446766f0407b45c78031ad9e5029cc9218b025e.tar.gz
volse-hubzilla-0446766f0407b45c78031ad9e5029cc9218b025e.tar.bz2
volse-hubzilla-0446766f0407b45c78031ad9e5029cc9218b025e.zip
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
* remotes/upstream/master: diabook-theme: small fix diabook-theme: made boxes at right_aside sortable use cid rather than uid in perms Modify events_post() in mod/events.php to set the `private` field to true when an event is shared with specific people. This is necessary to have event posts show correctly in Diaspora if an event is created visible only to self, but modified later to be visible to others. use mysql replace on cache items fixing common friends rev update Moved Meta Viewport from global head.tpl to diabook's header * master:
Diffstat (limited to 'mod')
-rw-r--r--mod/events.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/mod/events.php b/mod/events.php
index e66a2dc44..069046ff9 100644
--- a/mod/events.php
+++ b/mod/events.php
@@ -28,6 +28,9 @@ function events_post(&$a) {
$adjust = intval($_POST['adjust']);
$nofinish = intval($_POST['nofinish']);
+ // The default setting for the `private` field in event_store() is false, so mirror that
+ $private_event = false;
+
$start = sprintf('%d-%d-%d %d:%d:0',$startyear,$startmonth,$startday,$starthour,$startminute);
if($nofinish)
@@ -65,14 +68,38 @@ function events_post(&$a) {
$share = ((intval($_POST['share'])) ? intval($_POST['share']) : 0);
+ $c = q("select id from contact where uid = %d and self = 1 limit 1",
+ intval(local_user())
+ );
+ if(count($c))
+ $self = $c[0]['id'];
+ else
+ $self = 0;
+
+
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, '<' . $self . '>') !== false )
+ {
+ $str_contact_allow = str_replace('<' . $self . '>', '', $str_contact_allow);
+ }
+ // 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 {
- $str_contact_allow = '<' . local_user() . '>';
+ // Note: do not set `private` field for self-only events. It will
+ // keep even you from seeing them!
+ $str_contact_allow = '<' . $self . '>';
$str_group_allow = $str_contact_deny = $str_group_deny = '';
}
@@ -91,6 +118,7 @@ function events_post(&$a) {
$datarray['allow_gid'] = $str_group_allow;
$datarray['deny_cid'] = $str_contact_deny;
$datarray['deny_gid'] = $str_group_deny;
+ $datarray['private'] = $private_event;
$datarray['id'] = $event_id;
$datarray['created'] = $created;
$datarray['edited'] = $edited;