]> git.mxchange.org Git - friendica.git/commitdiff
Remove private key from event array in Event::store
authorHypolite Petovan <mrpetovan@gmail.com>
Sat, 17 Mar 2018 04:32:08 +0000 (00:32 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Fri, 23 Mar 2018 10:34:21 +0000 (06:34 -0400)
mod/events.php
src/Model/Event.php

index 60827cac2052ac156ac94ce7fddf26574783f64c..22a9b4677db4045c77f68656ce552ae60b8fcc93 100644 (file)
@@ -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'])) {
index a1790edab20318de7de0540ecc90babb69074448..9387a25d6812686826204304f6b48621dea1b096 100644 (file)
@@ -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;