Initial commit

This commit is contained in:
2020-12-26 07:42:48 +01:00
commit 55f70d036b
18 changed files with 1151 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
class utils
{
public static function globsafe(string $path) : string
{
$path = str_replace('[', '\[', $path);
$path = str_replace(']', '\]', $path);
$path = str_replace('\[', '[[]', $path);
$path = str_replace('\]', '[]]', $path);
return $path;
}
public static function recursive_zip_map($zip, $root, $path)
{
$files = glob($path . "/*");
foreach ($files as $file)
{
if (is_dir($file))
{
recursive_zip_map($zip, $root, $file);
}
else
{
$relative = str_replace(array("@-".$root."/", "@-".$root), "", "@-".$file);
$zip->addFile($file, $relative);
}
}
}
// $folder = $my_db[$beatmap_id];
// $name = basename($folder) . ".osz";
// echo "Zipping " . $name;
// $path = $collection_location . "/" . $name;
// $zip = new ZipArchive;
// $zip->open($path, ZipArchive::CREATE);
// echo ".";
// recursive_zip_map($zip, $fol
}