new branch windows

This commit is contained in:
Hash Borgir 2021-03-22 05:09:38 -06:00
parent 43d883559c
commit b3d62294e6
3 changed files with 20 additions and 12 deletions

View File

@ -84,12 +84,13 @@ option {
margin: 30px auto;
padding: 10px;
background: white;
font-family: "Exocet";
font-weight: 900;
}
body {
background: black;
font-family: "Exocet";
font-weight: 900;
}
footer, .options {

View File

@ -1,13 +1,15 @@
<?php
if (!empty($_POST)) {
if (DIRECTORY_SEPARATOR === '/') {
file_put_contents("../d2um.conf", $_POST['path'].DIRECTORY_SEPARATOR);
}
if (DIRECTORY_SEPARATOR === '\\') {
file_put_contents("../d2um.conf", $_POST['path'].DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'global'.DIRECTORY_SEPARATOR.'excel'.DIRECTORY_SEPARATOR);
}
// write the d2um.conf file and replace \ with \\
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$path = str_replace('\\', '\\', $_POST['path']);
$path .= '\\data\\global\\excel\\';
file_put_contents("../d2um.conf", $path);
} else {
file_put_contents("../d2um.conf", $_POST['path'].DIRECTORY_SEPARATOR);
}
header('Location: /');
}
?>

View File

@ -49,10 +49,15 @@ class saveFile {
// if dir doesn't exist, create it
if (!is_dir($this->path.DIRECTORY_SEPARATOR."backup")) mkdir($this->path."backup", 0700);
$oldfile = $this->path.$file;
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
// set new file location to copy to (backup)
$newfile = $this->path.DIRECTORY_SEPARATOR."backup".DIRECTORY_SEPARATOR.$file;
if (!copy($file, $newfile)) {
$newfile = $this->path."\\backup\\$file";
} else {
$newfile = $this->path."/backup/$file";
}
if (!copy($oldfile, $newfile)) {
echo "Failed to create backup of $file...\n";
}
}