d2tools/index.php

75 lines
1.7 KiB
PHP
Raw Normal View History

2021-03-21 03:10:59 +00:00
<?php
/*
D2UniqueMaker
GPLv2 (C) <2021> <HashCasper>
This file is part of D2UM.
D2UM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
D2UM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with D2UM. If not, see <http://www.gnu.org/licenses/>.
*/
ini_set('display_errors', 1);
2021-03-21 19:47:29 +00:00
ini_set('log_errors', 1);
2021-03-22 08:59:48 +00:00
$filename = 'd2um.conf';
2021-03-22 08:59:48 +00:00
if (file_exists($filename)) {
$p = file_get_contents($filename);
if(is_dir($p)) {
$path = $p;
define('TXT_PATH', $p);
} else {
$path = DIRECTORY_SEPARATOR."txt".DIRECTORY_SEPARATOR;
// if entered mod path is incorrect, use 1.10 txt files in /txt/ folder
define('TXT_PATH', './txt/');
}
// Misc functions
require_once "./src/functions.php";
2021-03-21 19:47:29 +00:00
2021-03-22 08:59:48 +00:00
// $path is a shorter alias to writing $path a lot.
$path = $path;
2021-03-21 19:47:29 +00:00
// Txt Parser
2021-03-22 08:59:48 +00:00
require_once './src/txtParser.php';
2021-03-21 19:47:29 +00:00
// parse txt data
2021-03-22 08:59:48 +00:00
$txtParser = new txtParser();
$parser = $txtParser->getData();
$armor = $parser['a'];
$weapon = $parser['w'];
$prop = $parser['p'];
$uni = $parser['u'];
$files = $txtParser->getFiles();
$u = $files['u'];
if (!empty($_POST)) {
// Saver Object
require_once './src/saveFile.php';
$saver = new saveFile();
// save files
$saver->saveTxt($u);
$saver->saveTblEnries($path);
}
// load app
require_once './src/D2UM.php';
} else {
header('Location: ./src/config.php');
}
2021-03-22 09:23:04 +00:00
?>