From 3c714dc6d5b2d3e6036130dd870c9b661adadbad Mon Sep 17 00:00:00 2001 From: AndreaChirulescu Date: Mon, 28 Mar 2022 20:49:35 +0200 Subject: added function to clean file name before ical export --- includes/ical_export.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/ical_export.php b/includes/ical_export.php index 637bb58..ec45b13 100644 --- a/includes/ical_export.php +++ b/includes/ical_export.php @@ -11,6 +11,12 @@ if ( ! class_exists( "GiglogAdmin_IcalExport" ) ) { class Giglogadmin_IcalExport { + static function textclean(string $txt) : string + { + $cleantext = preg_replace("/[^A-Za-z0-9 ]/", "",$txt); + $cleantext = str_replace(' ','_',$cleantext); + return($cleantext); + } public static function export_ical() { $evid = $_GET['evid']; @@ -20,6 +26,8 @@ if ( ! class_exists( "GiglogAdmin_IcalExport" ) ) $cshortname=substr($cfullname,0,20); $fdate = strtotime($concert->cdate()); $newformat = date('Ymd',$fdate); + $filename='Concert '.$concert->venue()->name().' '.$newformat.' '.substr($concert->cname(),0,30); + $filename=Giglogadmin_IcalExport::textclean($filename); // create a new calendar $vcalendar = Vcalendar::factory( [ Vcalendar::UNIQUE_ID => "kigkonsult.se", ] ) // with calendaring info -- cgit v1.2.3