From 89e9cbb0b5e59e74d75fb702e2bad7e3fe0dfecd Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 17 Mar 2018 00:32:08 -0400 Subject: [PATCH] Remove private key from event array in Event::store --- mod/events.php | 2 +- src/Model/Event.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mod/events.php b/mod/events.php index 60827cac20..22a9b4677d 100644 --- a/mod/events.php +++ b/mod/events.php @@ -170,7 +170,7 @@ function events_post(App $a) { $datarray['allow_gid'] = $str_group_allow; $datarray['deny_cid'] = $str_contact_deny; $datarray['deny_gid'] = $str_group_deny; - $datarray['private'] = (($private_event) ? 1 : 0); + $datarray['private'] = $private_event; $datarray['id'] = $event_id; if (intval($_REQUEST['preview'])) { diff --git a/src/Model/Event.php b/src/Model/Event.php index a1790edab2..9387a25d68 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -223,17 +223,17 @@ class Event extends BaseObject * * Store the event in the event table and create an event item in the item table. * - * @param array $event Array with event data. - * @return int The event id. + * @param array $arr Array with event data. + * @return int The new event id. */ public static function store($arr) { $a = self::getApp(); - $event['uri'] = defaults($arr, 'uri' , item_new_uri($a->get_hostname(), $event['uid'])); $event['id'] = intval(defaults($arr, 'id' , 0)); $event['uid'] = intval(defaults($arr, 'uid' , 0)); $event['cid'] = intval(defaults($arr, 'cid' , 0)); + $event['uri'] = defaults($arr, 'uri' , item_new_uri($a->get_hostname(), $event['uid'])); $event['type'] = defaults($arr, 'type' , 'event'); $event['summary'] = defaults($arr, 'summary' , ''); $event['desc'] = defaults($arr, 'desc' , ''); @@ -242,7 +242,6 @@ class Event extends BaseObject $event['allow_gid'] = defaults($arr, 'allow_gid', ''); $event['deny_cid'] = defaults($arr, 'deny_cid' , ''); $event['deny_gid'] = defaults($arr, 'deny_gid' , ''); - $event['private'] = intval(defaults($arr, 'private' , 0)); $event['adjust'] = intval(defaults($arr, 'adjust' , 0)); $event['nofinish'] = intval(defaults($arr, 'nofinish' , !empty($event['start']) && empty($event['finish']))); @@ -253,6 +252,7 @@ class Event extends BaseObject if ($event['finish'] < NULL_DATE) { $event['finish'] = NULL_DATE; } + $private = intval(defaults($arr, 'private', 0)); $condition = ['uid' => $event['uid']]; if ($event['cid']) { @@ -330,7 +330,7 @@ class Event extends BaseObject $item_arr['allow_gid'] = $event['allow_gid']; $item_arr['deny_cid'] = $event['deny_cid']; $item_arr['deny_gid'] = $event['deny_gid']; - $item_arr['private'] = $event['private']; + $item_arr['private'] = $private; $item_arr['visible'] = 1; $item_arr['verb'] = ACTIVITY_POST; $item_arr['object-type'] = ACTIVITY_OBJ_EVENT; -- 2.39.5