HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/bwcsports-site/wp-content/plugins/fooevents/classes/icshelper.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
class FooEvents_ICS_helper {
    
    public $data;
    public $name;
    public $Config;

    function __construct($Config) {
        
        $this->Config = $Config;
        
    }
    
    /**
     * Builds add to calendar .ics file
     * 
     * @param string $start
     * @param string $end
     * @param string $name
     * @param string $description
     * @param string $location
     */
    function build_ICS($start,$end,$name,$description,$location = '') {
        
        $this->name = $name;
        
        if(empty($this->name)) {
            
            $this->name = 'Event';
            
        }
        
        $start = (string) date("Ymd\THis",strtotime($start));
        $end = (string) date("Ymd\THis",strtotime($end));
        
        $this->data .= "VERSION:2.0\nMETHOD:PUBLISH\nBEGIN:VEVENT\nDTSTART:".$start."\nDTEND:".$end."\nLOCATION:".$location."\nTRANSP: OPAQUE\nSEQUENCE:0\nUID:\nDTSTAMP:".date("Ymd\THis")."\nSUMMARY:".$name."\nDESCRIPTION:".$description."\nPRIORITY:1\nCLASS:PUBLIC\nBEGIN:VALARM\nTRIGGER:-PT10080M\nACTION:DISPLAY\nDESCRIPTION:Reminder\nEND:VALARM\nEND:VEVENT\n";
    
    }
    
    /**
     * Saves ICS file.
     * 
     */
    function save() {
        
        file_put_contents($this->name.".ics",$this->data);
        
    }
    
    /**
     * Download the ICS file.
     * 
     */
    function show() {
        
        $data = "BEGIN:VCALENDAR\n".$this->data."END:VCALENDAR\n";
        
        header("Content-type:text/calendar");
        header('Content-Disposition: attachment; filename="'.$this->name.'.ics"');
        Header('Content-Length: '.strlen($data));
        Header('Connection: close');
        echo $data;
        
    }
}