mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 12:36:03 +00:00
new branch windows
This commit is contained in:
parent
43d883559c
commit
b3d62294e6
@ -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 {
|
||||
|
@ -1,12 +1,14 @@
|
||||
<?php
|
||||
if (!empty($_POST)) {
|
||||
|
||||
if (DIRECTORY_SEPARATOR === '/') {
|
||||
file_put_contents("../d2um.conf", $_POST['path'].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 {
|
||||
|
||||
if (DIRECTORY_SEPARATOR === '\\') {
|
||||
file_put_contents("../d2um.conf", $_POST['path'].DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'global'.DIRECTORY_SEPARATOR.'excel'.DIRECTORY_SEPARATOR);
|
||||
file_put_contents("../d2um.conf", $_POST['path'].DIRECTORY_SEPARATOR);
|
||||
}
|
||||
header('Location: /');
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
// set new file location to copy to (backup)
|
||||
$newfile = $this->path.DIRECTORY_SEPARATOR."backup".DIRECTORY_SEPARATOR.$file;
|
||||
$oldfile = $this->path.$file;
|
||||
|
||||
if (!copy($file, $newfile)) {
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
// set new file location to copy to (backup)
|
||||
$newfile = $this->path."\\backup\\$file";
|
||||
} else {
|
||||
$newfile = $this->path."/backup/$file";
|
||||
}
|
||||
if (!copy($oldfile, $newfile)) {
|
||||
echo "Failed to create backup of $file...\n";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user