From 04ddcce846063a74a3713084831fa689d6fa5883 Mon Sep 17 00:00:00 2001 From: "color.diff=auto" Date: Fri, 26 Mar 2021 13:09:05 -0600 Subject: [PATCH] Testing on windows --- .gitignore | 5 +++-- .gitignore~ | 2 -- index.php | 2 +- processFiles.php | 2 +- src/D2Config.php | 2 +- src/D2Database.php | 1 + src/D2TxtParser.php | 3 +-- 7 files changed, 8 insertions(+), 9 deletions(-) delete mode 100644 .gitignore~ diff --git a/.gitignore b/.gitignore index 5caa396..1e1597a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -db -txt/ \ No newline at end of file +*.db +txt/ +txt2/ \ No newline at end of file diff --git a/.gitignore~ b/.gitignore~ deleted file mode 100644 index 5caa396..0000000 --- a/.gitignore~ +++ /dev/null @@ -1,2 +0,0 @@ -db -txt/ \ No newline at end of file diff --git a/index.php b/index.php index e7ba1c1..4502980 100644 --- a/index.php +++ b/index.php @@ -45,7 +45,7 @@ if (file_exists("d2im.db") && (file_exists($_SESSION['modname'].".db"))){ // If there's data, process it and save if (!empty($_POST)) { - // save db name from post info conf file + // save db name from post into conf file require_once './src/D2SaveFile.php'; $saver = new D2SaveFile(); diff --git a/processFiles.php b/processFiles.php index 6eb008b..2f642eb 100644 --- a/processFiles.php +++ b/processFiles.php @@ -3,7 +3,7 @@ include "includes.php"; if (file_exists("d2im.db")) { - unlink(DB_FILE); + if(file_exists(DB_FILE)) unlink(DB_FILE); $files = new D2Files(); $parser = new D2TxtParser(); diff --git a/src/D2Config.php b/src/D2Config.php index dafa792..de9fae5 100644 --- a/src/D2Config.php +++ b/src/D2Config.php @@ -106,7 +106,7 @@ require_once "head.php";

Select Mod folder

-

Example: D:\Diablo II\MODS\you-mod-name\

+

Example: D:\Diablo II\MODS\your-mod-name\

Input path to D2 Mod Directory.

diff --git a/src/D2Database.php b/src/D2Database.php index d09b811..13be299 100644 --- a/src/D2Database.php +++ b/src/D2Database.php @@ -46,6 +46,7 @@ class D2Database { $tableName = basename($file); $tableName = strtolower(substr($tableName, 0, -4)); + $sql = ''; foreach ($data as $d) { $sql = "INSERT INTO `$tableName` ("; if (!empty($d)) { diff --git a/src/D2TxtParser.php b/src/D2TxtParser.php index 9a71ae8..a9f33e5 100644 --- a/src/D2TxtParser.php +++ b/src/D2TxtParser.php @@ -55,12 +55,11 @@ class D2TxtParser { } , file($file)); $header = array_shift($rows); + $data = null; foreach ($rows as $row) { $data[] = @array_combine($header, $row); } return $data; } - } - ?> \ No newline at end of file