HEX
Server: LiteSpeed
System: Linux 112.webhostingindonesia.co.id 5.14.0-570.62.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 10:10:59 EST 2025 x86_64
User: iyfwylsv (10313)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //proc/self/cwd/wp-content/plugins/ultimate-maps-by-supsystic/classes/filegenerator.php
<?php
/**
 * Class to generate fiels and output them in attachment by http (https) protocol
 */
class filegeneratorUms {
    static protected $_instances = array();
    protected $_filename = '';
    protected $_data = '';
    protected $_type = '';
    public function __construct($filename, $data, $type) {
        $this->_filename = $filename;
        $this->_data = $data;
        $this->_type = strtolower($type);
    }
    static public function getInstance($filename, $data, $type) {
        $name = md5($filename. $data. $type);
        if(!isset(self::$_instances[$name])) {
            self::$_instances[$name] = new filegeneratorUms($filename, $data, $type);
        }
        return self::$_instances[$name];
    }
    static public function _($filename, $data, $type) {
        return self::getInstance($filename, $data, $type);
    }
    public function generate() {
        switch($this->_type) {
            case 'txt':
                $this->_getTxtHeader();
                break;
            case 'csv':
                $this->_getCsvHeader();
                break;
            default:
                $this->_getDefaultHeader();
                break;
        }
        echo $this->_data;
        exit();
    }
    protected function _getTxtHeader() {
        header('Content-Disposition: attachment; filename="'. $this->_filename. '.txt"');
        header('Content-type: text/plain');
    }
    protected function _getCsvHeader() {
        header('Content-Disposition: attachment; filename="'. $this->_filename. '.csv"');
        header('Content-type: application/csv');
    }
    protected function _getDefaultHeader() {
        header('Content-Disposition: attachment; filename="'. $this->_filename. '"');
        header('Content-type: '. $this->_type);
    }
}