Upload folder via GUI - admin

This commit is contained in:
Git Manager GUI
2026-04-29 21:07:44 +02:00
parent 29e1c487b4
commit 191b7728b4

View File

@@ -65,6 +65,11 @@ if ( ! function_exists('wbf_get_settings') ) {
'mc_bridge_enabled' => '0',
'mc_bridge_api_url' => '',
'mc_bridge_api_secret' => '',
'spigot_mysql_host' => 'localhost',
'spigot_mysql_port' => '3306',
'spigot_mysql_database' => '',
'spigot_mysql_username' => '',
'spigot_mysql_password' => '',
];
$saved = get_option( 'wbf_settings', [] );
@@ -167,6 +172,14 @@ function wbf_admin_settings() {
$settings['mc_bridge_api_url'] = esc_url_raw( trim( $_POST['mc_bridge_api_url'] ?? '' ) );
$settings['mc_bridge_api_secret'] = sanitize_text_field( $_POST['mc_bridge_api_secret'] ?? '' );
// Spigot MySQL (für Abo-Verwaltung)
$settings['spigot_mysql_host'] = sanitize_text_field( $_POST['spigot_mysql_host'] ?? 'localhost' );
$settings['spigot_mysql_port'] = sanitize_text_field( $_POST['spigot_mysql_port'] ?? '3306' );
$settings['spigot_mysql_database'] = sanitize_text_field( $_POST['spigot_mysql_database'] ?? '' );
$settings['spigot_mysql_username'] = sanitize_text_field( $_POST['spigot_mysql_username'] ?? '' );
if ( ! empty( $_POST['spigot_mysql_password'] ) )
$settings['spigot_mysql_password'] = $_POST['spigot_mysql_password'];
// Checkbox-Felder explizit als '0' speichern wenn nicht angehakt,
// damit array_filter(...,'strlen') sie nicht wegwirft und der Default '1' greift.
$checkbox_fields = ['maintenance_mode', 'rules_enabled', 'rules_accept_required', 'mc_bridge_enabled'];
@@ -850,6 +863,51 @@ function wbf_admin_settings() {
</div>
</div>
<!-- ══════════════════════════════════════════════════════
SPIGOT MYSQL — Abo-Verwaltung
══════════════════════════════════════════════════════ -->
<div class="wbf-settings-section">
<h2>🗄️ Spigot MySQL — Abo-Verwaltung</h2>
<p>Verbindung zur Spigot-Datenbank (gleiche Zugangsdaten wie im IngameShop-Plugin).<br>
Wird benötigt damit Spieler ihre Fly-Abos und Plot-Abos im Forum-Profil verwalten können.</p>
<table class="form-table">
<tr>
<th><label for="spigot_mysql_host">Host</label></th>
<td><input type="text" id="spigot_mysql_host" name="spigot_mysql_host"
value="<?php echo esc_attr( $s['spigot_mysql_host'] ?? 'localhost' ); ?>"
class="regular-text" placeholder="localhost"></td>
</tr>
<tr>
<th><label for="spigot_mysql_port">Port</label></th>
<td><input type="number" id="spigot_mysql_port" name="spigot_mysql_port"
value="<?php echo esc_attr( $s['spigot_mysql_port'] ?? '3306' ); ?>"
style="width:100px" placeholder="3306"></td>
</tr>
<tr>
<th><label for="spigot_mysql_database">Datenbank</label></th>
<td><input type="text" id="spigot_mysql_database" name="spigot_mysql_database"
value="<?php echo esc_attr( $s['spigot_mysql_database'] ?? '' ); ?>"
class="regular-text" placeholder="minecraft"></td>
</tr>
<tr>
<th><label for="spigot_mysql_username">Benutzername</label></th>
<td><input type="text" id="spigot_mysql_username" name="spigot_mysql_username"
value="<?php echo esc_attr( $s['spigot_mysql_username'] ?? '' ); ?>"
class="regular-text" placeholder="root"></td>
</tr>
<tr>
<th><label for="spigot_mysql_password">Passwort</label></th>
<td>
<input type="password" id="spigot_mysql_password" name="spigot_mysql_password"
value="" class="regular-text"
placeholder="Leer lassen um beizubehalten">
<p class="description">Nur ausfüllen wenn du das Passwort ändern möchtest.</p>
</td>
</tr>
</table>
</div>
<?php submit_button(
'💾 Einstellungen speichern',
'primary',