Skip to content

Commit

Permalink
Update configure.php
Browse files Browse the repository at this point in the history
server-wide api key by default
  • Loading branch information
cowpod committed Nov 12, 2024
1 parent 6663449 commit 97ad5b4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
$name = $_POST['author'];
$pass = $_POST['pass'];
$api_key = $_POST['api_key'];
$api_key_serverwide = isset($_POST['api_key_serverwide']) ? $_POST['api_key_serverwide'] : "off";
$api_key_serverwide = isset($_POST['api_key_serverwide']) ? TRUE : FALSE;

if (!preg_match('/^[\w\.\-\+]+@[a-zA-Z\d\.-]+\.[a-zA-Z]{2,}$/', $email)) {
die('Bad input data; email');
Expand Down Expand Up @@ -99,7 +99,7 @@
'configured'=>true,
'config_version'=>CONFIG_VERSION
];
if ($api_key_serverwide=="on") {
if ($api_key_serverwide) {
$config_contents['api_key'] = $api_key;
}

Expand All @@ -115,7 +115,7 @@
name TEXT PRIMARY KEY,
time_stamp INTEGER,
info TEXT
";
)";
$db->execute($sql);
$sql = "CREATE TABLE modpacks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
Expand Down Expand Up @@ -191,7 +191,7 @@
name VARCHAR(128) PRIMARY KEY,
time_stamp BIGINT UNSIGNED,
info TEXT
";
)";
$db->execute($sql);
$sql = "CREATE TABLE modpacks (
id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY,
Expand Down Expand Up @@ -265,10 +265,10 @@
}

// if user already exists, replace
$userexistsq = $db->query("SELECT 1 FORM users WHERE name='".$db->sanitize($email)."'");
$userexistsq = $db->query("SELECT 1 FROM users WHERE name='".$db->sanitize($email)."'");
if ($userexistsq && sizeof($userexistsq)==1) { // `name` is unique
if (OVERWRITE_USER) {
$db->execute("DELETE FORM users WHERE name='".$db->sanitize($email)."'");
$db->execute("DELETE FROM users WHERE name='".$db->sanitize($email)."'");
} else {
die("User with that email exists. Please go back and try again with different information.");
}
Expand Down Expand Up @@ -370,8 +370,8 @@
<label for="api_key">Technic Solder API Key</label>
<input id="api_key" name="api_key" type="text" class="form-control" placeholder="API Key" required>
<div class="form-check">
<input id="api_key_serverwide" name="api_key_serverwide" type="checkbox" class="form-check-input">
<label for="api_key_serverwide" class="form-check-label ">Server-wide</label>
<input id="api_key_serverwide" name="api_key_serverwide" type="checkbox" class="form-check-input" checked>
<label for="api_key_serverwide" class="form-check-label">Server-wide</label>
</div>
<small class="form-text text-muted">
You can find your API Key in your profile at
Expand Down

0 comments on commit 97ad5b4

Please sign in to comment.