@@ -582,6 +582,19 @@ private function onEditEvent()
582582
583583 $ eventID = $ _POST ['eventID ' ];
584584 $ type = $ _POST ['type ' ];
585+ $ calendar = new Calendar ($ this ->_siteID );
586+ $ eventRS = $ calendar ->get ($ eventID );
587+
588+ if (empty ($ eventRS ))
589+ {
590+ CommonErrors::fatal (COMMONERROR_BADINDEX , $ this , 'Invalid event ID. ' );
591+ }
592+
593+ if ($ eventRS ['enteredBy ' ] != $ this ->_userID &&
594+ $ this ->getUserAccessLevel ('calendar.show ' ) < ACCESS_LEVEL_SA )
595+ {
596+ CommonErrors::fatal (COMMONERROR_PERMISSION , $ this , 'Invalid user level for action. ' );
597+ }
585598
586599 if ($ _POST ['allDay ' ] == 1 )
587600 {
@@ -662,7 +675,6 @@ private function onEditEvent()
662675 if (!eval (Hooks::get ('CALENDAR_EDIT_PRE ' ))) return ;
663676
664677 /* Update the event. */
665- $ calendar = new Calendar ($ this ->_siteID );
666678 if (!$ calendar ->updateEvent ($ eventID , $ type , $ date , $ description ,
667679 $ allDay , $ dataItemID , $ dataItemType , 'NULL ' , $ title , $ duration ,
668680 $ reminderEnabled , $ reminderEmail , $ reminderTime , $ publicEntry ,
@@ -711,10 +723,22 @@ private function onDeleteEvent()
711723 }
712724
713725 $ eventID = $ _POST ['eventID ' ];
726+ $ calendar = new Calendar ($ this ->_siteID );
727+ $ eventRS = $ calendar ->get ($ eventID );
728+
729+ if (empty ($ eventRS ))
730+ {
731+ CommonErrors::fatal (COMMONERROR_BADINDEX , $ this , 'Invalid event ID. ' );
732+ }
733+
734+ if ($ eventRS ['enteredBy ' ] != $ this ->_userID &&
735+ $ this ->getUserAccessLevel ('calendar.show ' ) < ACCESS_LEVEL_SA )
736+ {
737+ CommonErrors::fatal (COMMONERROR_PERMISSION , $ this , 'Invalid user level for action. ' );
738+ }
714739
715740 if (!eval (Hooks::get ('CALENDAR_DELETE_PRE ' ))) return ;
716741
717- $ calendar = new Calendar ($ this ->_siteID );
718742 $ calendar ->deleteEvent ($ eventID );
719743
720744 if (!eval (Hooks::get ('CALENDAR_DELETE_POST ' ))) return ;
0 commit comments