2021-03-26 18:31:13 +00:00
|
|
|
<?php
|
2021-03-28 08:12:25 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright (C) 2021 Hash Borgir
|
|
|
|
|
|
|
|
This file is part of D2Modder
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with
|
|
|
|
or without modification, are permitted provided that the
|
|
|
|
following conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer.
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer in the documentation and/or other
|
|
|
|
materials provided with the distribution.
|
|
|
|
|
|
|
|
* This software must not be used for commercial purposes
|
|
|
|
* without my consent. Any sales or commercial use are prohibited
|
|
|
|
* without my express knowledge and consent.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY!
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
|
|
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
|
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
|
|
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
*/
|
2021-03-27 08:53:26 +00:00
|
|
|
session_start();
|
|
|
|
include "./_pdo.php";
|
2021-03-28 09:22:23 +00:00
|
|
|
include "./config.php";
|
2021-03-27 08:53:26 +00:00
|
|
|
// if config db exists, connect to it and grab list of mods
|
2021-03-28 09:22:23 +00:00
|
|
|
if (file_exists(APP_DB)) {
|
|
|
|
PDO_Connect("sqlite:".APP_DB);
|
2021-03-27 08:53:26 +00:00
|
|
|
|
2021-03-28 09:22:23 +00:00
|
|
|
$sql = "SELECT * FROM D2Modder";
|
2021-03-27 08:53:26 +00:00
|
|
|
$mods = PDO_FetchAll($sql);
|
|
|
|
|
|
|
|
if (!empty($_POST)) {
|
2021-03-28 09:22:23 +00:00
|
|
|
$sql = "SELECT * FROM D2Modder WHERE `modname`='{$_POST['modname']}'";
|
2021-03-27 08:53:26 +00:00
|
|
|
$mod = PDO_FetchRow($sql);
|
|
|
|
|
2021-03-28 07:38:12 +00:00
|
|
|
if (isset($_POST['deletemod'])) {
|
2021-03-28 09:22:23 +00:00
|
|
|
$sql = "DELETE FROM D2Modder WHERE modname='{$_POST['modname']}'";
|
2021-03-28 07:38:12 +00:00
|
|
|
PDO_Execute($sql);
|
|
|
|
unlink($_POST['modname'] . ".db");
|
|
|
|
header("Refresh:0");
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$_SESSION['modname'] = $mod['modname'];
|
|
|
|
$_SESSION['path'] = $mod['path'];
|
|
|
|
header("Location: /");
|
|
|
|
}
|
2021-03-27 08:53:26 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// if config db does not exist, go to config page
|
|
|
|
header("Location: /src/D2Config.php");
|
2021-03-26 18:31:13 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
|
|
|
<?php
|
|
|
|
/* Require the <head> section */
|
|
|
|
require_once "src/head.php";
|
|
|
|
?>
|
|
|
|
<body style="background: white;">
|
|
|
|
<div class="center container container-top">
|
|
|
|
|
|
|
|
<h1><img src="/img/Diablo2.png" style="float:left">D2 Item Maker, v3. By HashCasper</h1>
|
|
|
|
<a class="btn btn-outline-danger" style="color:red; font-size: 18px;float:right;" href="/">X</a>
|
|
|
|
<hr style="margin: 60px;">
|
|
|
|
<div class="offset-2 col-8">
|
2021-03-28 07:38:12 +00:00
|
|
|
<h2>Manage Mods</h2>
|
2021-03-26 18:31:13 +00:00
|
|
|
<div style="margin-top: 20px;" class="ctrl-config">
|
|
|
|
<form class="" enctype="multipart/form-data" style="font-family: Lato; font-size: 14pt;text-align:center;" action="" method="post">
|
|
|
|
<p>
|
|
|
|
<select id="mods" name="modname" required="required" class="custom-select"> <?php foreach ($mods as $mod) { ?>
|
2021-03-28 07:38:12 +00:00
|
|
|
<option value="<?php echo $mod['modname'] ?>">
|
|
|
|
<?php echo $mod['modname'] ?>: <?php echo $mod['path'] ?>
|
|
|
|
</option>
|
2021-03-26 18:31:13 +00:00
|
|
|
<?php } ?>
|
|
|
|
</select>
|
|
|
|
</p>
|
|
|
|
<p>
|
2021-03-28 07:38:12 +00:00
|
|
|
<input type="submit" value="Select" name="submit" class="btn-outline-success btn">
|
|
|
|
|
|
|
|
<a style="font-weight: bold;" class="btn btn-outline-warning" href="/">Cancel</a>
|
|
|
|
<input style="float:right;" type="submit" value="Delete Mod" name="deletemod" class="btn btn-outline-danger">
|
2021-03-26 18:31:13 +00:00
|
|
|
</p>
|
2021-03-28 07:38:12 +00:00
|
|
|
<p style="font-family: lato;font-size: 14px;">Set active mod for D2Modder. <br>If you delete a mod, select another mod to make it active. <br>Deleting a mod here will only delete the .db database file, and remove the mod entry from D2Modder. <br>Your mod files will not be deleted.</p>
|
2021-03-26 18:31:13 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|