PATH:
var
/
www
/
vhosts
/
sandbox.dos-group.com
/
beacons.sandbox.dos-group.com
/
vendor
/
dos
/
common
/
src
/
Dos
/
File
<?php /** * Created by PhpStorm. * User: claudio.mandica * Date: 01/06/15 * Time: 11:55 */ namespace Dos\File; /** * Class FileManagerCsv * @package Dos\File */ class FileManagerOutputCsv extends FileManagerBase { /** * @param $filename * @param string $mode */ public function __construct($filename, $mode = 'w') { header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header('Content-Description: File Transfer'); header("Content-type: text/csv; charset=UTF-8"); header("Content-Disposition: attachment; filename=".$filename); header("Expires: 0"); header("Pragma: public"); $this->handle = fopen( 'php://output', $mode ); } /** * @param $fields array * @param string $delimiter * @param string $enclosure */ public function write($fields, $delimiter = ',', $enclosure = '"') { $this->fwritecsv($this->handle, $fields, $delimiter, $enclosure); } /** * @param $handle * @param $fields * @param string $delimiter * @param string $enclosure * @return bool|int */ private function fwritecsv($handle, $fields, $delimiter = ',', $enclosure = '"') { # Check if $fields is an array if (!is_array($fields)) { return false; } # Walk through the data array for ($i = 0, $n = count($fields); $i < $n; $i ++) { # Only 'correct' non-numeric values if (!is_numeric($fields[$i])) { # Duplicate in-value $enclusure's and put the value in $enclosure's $fields[$i] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $fields[$i]) . $enclosure; } # If $delimiter is a dot (.), also correct numeric values if (($delimiter == '.') && (is_numeric($fields[$i]))) { # Put the value in $enclosure's $fields[$i] = $enclosure . $fields[$i] . $enclosure; } } # Combine the data array with $delimiter and write it to the file $line = implode($delimiter, $fields) . "\n"; fwrite($handle, $line); # Return the length of the written data return strlen($line); } }
[-] FileManagerOutputCsv.php
[open]
[+]
..
[-] FileManagerBase.php
[open]
[-] FileManagerOutput.php
[open]
[-] FileManager.php
[open]