Ran PHPCBF on PHP files

This commit is contained in:
2019-08-27 00:31:46 +02:00
committed by Stefan Rohde-Enslin
parent f7140573e1
commit 4abb415054
16 changed files with 857 additions and 954 deletions

View File

@ -1,26 +1,26 @@
<?PHP
include_once("inc/zip.php");
require_once "inc/zip.php";
$fileTime = date("D, d M Y H:i:s T");
$fileDir='xml/';
$fileDir = 'xml/';
$zip = new Zip();
//$zip->setComment("Example Zip file.\nCreated on " . date('l jS \of F Y h:i:s A'));
//$zip->addFile("Hello World!", "hello.txt");
if ($handle = opendir($fileDir)) {
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
if (strpos($file, ".xml") !== false) {
$pathData = pathinfo($fileDir . $file);
$fileName = $pathData['filename'];
if ($file!='1.xml')
$zip->addFile(file_get_contents($fileDir . $file), $file, filectime($fileDir . $file));
}
}
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
if (strpos($file, ".xml") !== false) {
$pathData = pathinfo($fileDir . $file);
$fileName = $pathData['filename'];
if ($file != '1.xml')
$zip->addFile(file_get_contents($fileDir . $file), $file, filectime($fileDir . $file));
}
}
}
if (ini_get('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
ini_set('zlib.output_compression', 'Off');
}
$zip->finalize(); // Not scrictly necessary, the next line will call it anyway.
@ -35,23 +35,23 @@ header("Connection: close");
header("Content-Type: application/zip");
header('Content-Disposition: attachment; filename="csv_xml.zip";' );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ". $length);
header("Content-Length: " . $length);
echo $zipData;
function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
}
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir . "/" . $object) == "dir") rrmdir($dir . "/" . $object); else unlink($dir . "/" . $object);
}
}
reset($objects);
rmdir($dir);
}
$dir_name='xml';
}
$dir_name = 'xml';
rrmdir($dir_name);
?>