mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 08:24:24 -05:00
Filter and refactor
This commit is contained in:
39
index.php
39
index.php
@@ -23,6 +23,8 @@
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('log_errors', 1);
|
||||
|
||||
define('FILTER_PROPERTIES_FILE', 'filterProperties.txt');
|
||||
|
||||
$filename = 'd2im.conf';
|
||||
|
||||
if (file_exists($filename)) {
|
||||
@@ -58,21 +60,46 @@ if (file_exists($filename)) {
|
||||
|
||||
$u = $files->getFile("UniqueItems");
|
||||
$s = $files->getFile("SetItems");
|
||||
|
||||
|
||||
|
||||
// If there's data, process it and save
|
||||
if (!empty($_POST)) {
|
||||
require_once './src/D2SaveFile.php';
|
||||
$saver = new D2SaveFile();
|
||||
|
||||
// process post
|
||||
// combine armor/weapon codes
|
||||
$post = $_POST;
|
||||
if (!empty($post['code'])) {
|
||||
array_filter($post['code']);
|
||||
|
||||
if (!empty($post['code'][0])) {
|
||||
$post['code'] = $post['code'][0];
|
||||
} else {
|
||||
$post['code'] = $post['code'][1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if ladder or carry1 is 0, set empty field.
|
||||
if (!$post['ladder']){
|
||||
$post['ladder'] = '';
|
||||
}
|
||||
if (!$post['carry1']){
|
||||
$post['carry1'] = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($_POST['formtype'] == "uniqueitems") {
|
||||
$saver->save($u);
|
||||
$saver->saveTblEnries("UniqueItems.tbl.txt");
|
||||
}
|
||||
if ($_POST['formtype'] == "setitems") {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$saver->save($s);
|
||||
$saver->saveTblEnries("SetItems.tbl.txt");
|
||||
}
|
||||
|
Reference in New Issue
Block a user