2525use Sabre \VObject \Parameter ;
2626use Sabre \VObject \Property ;
2727use Sabre \VObject \Recur \EventIterator ;
28+ use function htmlspecialchars ;
2829
2930class IMipService {
3031
@@ -80,10 +81,10 @@ private function generateDiffString(VEvent $vevent, VEvent $oldVEvent, string $p
8081 if (!isset ($ vevent ->$ property )) {
8182 return $ default ;
8283 }
83- $ newstring = $ vevent ->$ property ->getValue ();
84+ $ newstring = htmlspecialchars ( $ vevent ->$ property ->getValue () );
8485 if (isset ($ oldVEvent ->$ property ) && $ oldVEvent ->$ property ->getValue () !== $ newstring ) {
8586 $ oldstring = $ oldVEvent ->$ property ->getValue ();
86- return sprintf ($ strikethrough , $ oldstring , $ newstring );
87+ return sprintf ($ strikethrough , htmlspecialchars ( $ oldstring) , $ newstring );
8788 }
8889 return $ newstring ;
8990 }
@@ -96,8 +97,8 @@ private function generateLinkifiedDiffString(VEvent $vevent, VEvent $oldVEvent,
9697 return $ default ;
9798 }
9899 /** @var string|null $newString */
99- $ newString = $ vevent ->$ property ->getValue ();
100- $ oldString = isset ($ oldVEvent ->$ property ) ? $ oldVEvent ->$ property ->getValue () : null ;
100+ $ newString = htmlspecialchars ( $ vevent ->$ property ->getValue () );
101+ $ oldString = isset ($ oldVEvent ->$ property ) ? htmlspecialchars ( $ oldVEvent ->$ property ->getValue () ) : null ;
101102 if ($ oldString !== $ newString ) {
102103 return sprintf (
103104 "<span style='text-decoration: line-through'>%s</span><br />%s " ,
@@ -797,10 +798,10 @@ public function buildCancelledBodyData(VEvent $vEvent): array {
797798 $ strikethrough = "<span style='text-decoration: line-through'>%s</span> " ;
798799
799800 $ newMeetingWhen = $ this ->generateWhenString ($ eventReaderCurrent );
800- $ newSummary = isset ($ vEvent ->SUMMARY ) && (string )$ vEvent ->SUMMARY !== '' ? (string )$ vEvent ->SUMMARY : $ this ->l10n ->t ('Untitled event ' );
801- $ newDescription = isset ($ vEvent ->DESCRIPTION ) && (string )$ vEvent ->DESCRIPTION !== '' ? (string )$ vEvent ->DESCRIPTION : $ defaultVal ;
801+ $ newSummary = htmlspecialchars ( isset ($ vEvent ->SUMMARY ) && (string )$ vEvent ->SUMMARY !== '' ? (string )$ vEvent ->SUMMARY : $ this ->l10n ->t ('Untitled event ' ) );
802+ $ newDescription = htmlspecialchars ( isset ($ vEvent ->DESCRIPTION ) && (string )$ vEvent ->DESCRIPTION !== '' ? (string )$ vEvent ->DESCRIPTION : $ defaultVal) ;
802803 $ newUrl = isset ($ vEvent ->URL ) && (string )$ vEvent ->URL !== '' ? sprintf ('<a href="%1$s">%1$s</a> ' , $ vEvent ->URL ) : $ defaultVal ;
803- $ newLocation = isset ($ vEvent ->LOCATION ) && (string )$ vEvent ->LOCATION !== '' ? (string )$ vEvent ->LOCATION : $ defaultVal ;
804+ $ newLocation = htmlspecialchars ( isset ($ vEvent ->LOCATION ) && (string )$ vEvent ->LOCATION !== '' ? (string )$ vEvent ->LOCATION : $ defaultVal) ;
804805 $ newLocationHtml = $ this ->linkify ($ newLocation ) ?? $ newLocation ;
805806
806807 $ data = [];
@@ -1067,30 +1068,30 @@ public function addAttendees(IEMailTemplate $template, VEvent $vevent) {
10671068 */
10681069 public function addBulletList (IEMailTemplate $ template , VEvent $ vevent , $ data ) {
10691070 $ template ->addBodyListItem (
1070- $ data ['meeting_title_html ' ] ?? $ data ['meeting_title ' ], $ this ->l10n ->t ('Title: ' ),
1071+ $ data ['meeting_title_html ' ] ?? htmlspecialchars ( $ data ['meeting_title ' ]) , $ this ->l10n ->t ('Title: ' ),
10711072 $ this ->getAbsoluteImagePath ('caldav/title.png ' ), $ data ['meeting_title ' ], '' , IMipPlugin::IMIP_INDENT );
10721073 if ($ data ['meeting_when ' ] !== '' ) {
1073- $ template ->addBodyListItem ($ data ['meeting_when_html ' ] ?? $ data ['meeting_when ' ], $ this ->l10n ->t ('When: ' ),
1074+ $ template ->addBodyListItem ($ data ['meeting_when_html ' ] ?? htmlspecialchars ( $ data ['meeting_when ' ]) , $ this ->l10n ->t ('When: ' ),
10741075 $ this ->getAbsoluteImagePath ('caldav/time.png ' ), $ data ['meeting_when ' ], '' , IMipPlugin::IMIP_INDENT );
10751076 }
10761077 if ($ data ['meeting_location ' ] !== '' ) {
1077- $ template ->addBodyListItem ($ data ['meeting_location_html ' ] ?? $ data ['meeting_location ' ], $ this ->l10n ->t ('Location: ' ),
1078+ $ template ->addBodyListItem ($ data ['meeting_location_html ' ] ?? htmlspecialchars ( $ data ['meeting_location ' ]) , $ this ->l10n ->t ('Location: ' ),
10781079 $ this ->getAbsoluteImagePath ('caldav/location.png ' ), $ data ['meeting_location ' ], '' , IMipPlugin::IMIP_INDENT );
10791080 }
10801081 if ($ data ['meeting_url ' ] !== '' ) {
1081- $ template ->addBodyListItem ($ data ['meeting_url_html ' ] ?? $ data ['meeting_url ' ], $ this ->l10n ->t ('Link: ' ),
1082+ $ template ->addBodyListItem ($ data ['meeting_url_html ' ] ?? htmlspecialchars ( $ data ['meeting_url ' ]) , $ this ->l10n ->t ('Link: ' ),
10821083 $ this ->getAbsoluteImagePath ('caldav/link.png ' ), $ data ['meeting_url ' ], '' , IMipPlugin::IMIP_INDENT );
10831084 }
10841085 if (isset ($ data ['meeting_occurring ' ])) {
1085- $ template ->addBodyListItem ($ data ['meeting_occurring_html ' ] ?? $ data ['meeting_occurring ' ], $ this ->l10n ->t ('Occurring: ' ),
1086+ $ template ->addBodyListItem ($ data ['meeting_occurring_html ' ] ?? htmlspecialchars ( $ data ['meeting_occurring ' ]) , $ this ->l10n ->t ('Occurring: ' ),
10861087 $ this ->getAbsoluteImagePath ('caldav/time.png ' ), $ data ['meeting_occurring ' ], '' , IMipPlugin::IMIP_INDENT );
10871088 }
10881089
10891090 $ this ->addAttendees ($ template , $ vevent );
10901091
10911092 /* Put description last, like an email body, since it can be arbitrarily long */
10921093 if ($ data ['meeting_description ' ]) {
1093- $ template ->addBodyListItem ($ data ['meeting_description_html ' ] ?? $ data ['meeting_description ' ], $ this ->l10n ->t ('Description: ' ),
1094+ $ template ->addBodyListItem ($ data ['meeting_description_html ' ] ?? htmlspecialchars ( $ data ['meeting_description ' ]) , $ this ->l10n ->t ('Description: ' ),
10941095 $ this ->getAbsoluteImagePath ('caldav/description.png ' ), $ data ['meeting_description ' ], '' , IMipPlugin::IMIP_INDENT );
10951096 }
10961097 }
0 commit comments