public static function tempfile($prefix)
    {
        global $settings;
        $folder = '/tmp';
        if (isset($settings['temporary_folder'])) {
            $folder = $settings['temporary_folder'];
        }
        return tempnam($folder, $prefix);
    }