Steam Workshop – Admin'; sw_admin_print_styles(); $action = $_GET['action'] ?? ''; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save_profile'])) { sw_admin_save_profile($db); return; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['sync_profiles'])) { $n = sw_sync_profiles($db); sw_success("Sync complete. $n new profile(s) created."); } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['detect_defaults'])) { $profile = sw_get_profile_by_id($db, (int)($_POST['id'] ?? 0)); if (!$profile) { sw_error('Profile not found.'); sw_admin_list($db); return; } $detected = sw_detect_profile_defaults_from_xml($profile['config_name']); if (empty($detected)) { sw_error('No Steam defaults were detected in this game XML. You can still enter values manually.'); } else { sw_success('Detected XML defaults. Review and apply when ready.'); } sw_admin_edit_form($profile, $detected, true); return; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['apply_detected_defaults'])) { $profile = sw_get_profile_by_id($db, (int)($_POST['id'] ?? 0)); if (!$profile) { sw_error('Profile not found.'); sw_admin_list($db); return; } $detected = sw_detect_profile_defaults_from_xml($profile['config_name']); if (empty($detected)) { sw_error('No Steam defaults were detected in this game XML.'); sw_admin_edit_form($profile); return; } $overwrite = isset($_POST['overwrite_existing']) && $_POST['overwrite_existing'] === '1'; $updated = sw_apply_detected_profile_defaults($db, $profile, $detected, $overwrite); if ($updated > 0) { $overwriteMessage = $overwrite ? ' Existing values were allowed to be overwritten.' : ' Existing non-empty values were kept.'; sw_success("Applied $updated detected default value(s)." . $overwriteMessage); } else { sw_success('No profile values needed updating based on current overwrite setting.'); } $profile = sw_get_profile_by_id($db, (int)$profile['id']); sw_admin_edit_form($profile, $detected, true); return; } if ($action === 'edit' && isset($_GET['id'])) { $profile = sw_get_profile_by_id($db, (int)$_GET['id']); if ($profile) { sw_admin_edit_form($profile); } else { sw_error('Profile not found.'); sw_admin_list($db); } return; } sw_admin_list($db); } function sw_admin_save_profile($db) { $id = isset($_POST['id']) ? (int)$_POST['id'] : 0; if (!$id) { sw_error('Invalid profile ID.'); sw_admin_list($db); return; } $profile = sw_get_profile_by_id($db, $id); if (!$profile) { sw_error('Profile not found.'); sw_admin_list($db); return; } $fields = array( 'enabled' => isset($_POST['enabled']) ? 1 : 0, 'steam_app_id' => trim($_POST['steam_app_id'] ?? ''), 'workshop_app_id' => trim($_POST['workshop_app_id'] ?? ''), 'steam_login_required' => isset($_POST['steam_login_required']) ? 1 : 0, 'steamcmd_login_mode' => (($_POST['steamcmd_login_mode'] ?? 'anonymous') === 'account') ? 'account' : 'anonymous', 'steamcmd_path' => trim($_POST['steamcmd_path'] ?? ''), 'workshop_download_dir_template' => trim($_POST['workshop_download_dir_template'] ?? ''), 'server_root_template' => trim($_POST['server_root_template'] ?? ''), 'install_path_template' => trim($_POST['install_path_template'] ?? ''), 'folder_naming_format' => trim($_POST['folder_naming_format'] ?? ''), 'mod_launch_param_template' => trim($_POST['mod_launch_param_template'] ?? '-mod='), 'servermod_launch_param_template' => trim($_POST['servermod_launch_param_template'] ?? '-serverMod='), 'install_script_template' => trim($_POST['install_script_template'] ?? ''), 'update_script_template' => trim($_POST['update_script_template'] ?? ''), 'copy_bikeys_enabled' => isset($_POST['copy_bikeys_enabled']) ? 1 : 0, 'notes' => trim($_POST['notes'] ?? ''), ); // Per-profile default behavior fields $valid_update_modes = array('manual', 'on_restart', 'before_start', 'scheduled'); $valid_restart_behaviors = array('none', 'if_empty', 'immediate', 'next_restart'); $valid_hot_load = array('disabled', 'attempt'); $posted_um = $_POST['default_update_mode'] ?? 'manual'; $posted_rb = $_POST['default_restart_behavior'] ?? 'none'; $posted_hl = $_POST['default_hot_load'] ?? 'disabled'; $fields['default_update_mode'] = in_array($posted_um, $valid_update_modes, true) ? $posted_um : 'manual'; $fields['default_restart_behavior'] = in_array($posted_rb, $valid_restart_behaviors, true) ? $posted_rb : 'none'; $fields['default_hot_load'] = in_array($posted_hl, $valid_hot_load, true) ? $posted_hl : 'disabled'; $setParts = array(); foreach ($fields as $col => $val) { $setParts[] = "`$col` = '" . $db->realEscapeSingle($val) . "'"; } $setParts[] = "`updated_at` = NOW()"; $ok = $db->query( "UPDATE " . sw_table('steam_workshop_game_profiles') . " SET " . implode(', ', $setParts) . " WHERE `id` = $id LIMIT 1" ); if ($ok) { sw_success('Profile saved.'); } else { sw_error('Failed to save profile.'); } $profile = sw_get_profile_by_id($db, $id); if ($profile) { sw_admin_edit_form($profile); } else { sw_admin_list($db); } } function sw_admin_list($db) { $profiles = sw_get_profiles($db); ?>
Profiles map game XML configs to Steam Workshop defaults. Sync to create missing profiles, then edit each profile for game-specific paths and launch templates.
No profiles yet. Click Sync Profiles to create them from installed game configs.
| Config Name | Game Name | Steam App ID | Workshop App ID | Enabled | Actions |
|---|---|---|---|---|---|
= sw_h($p['config_name']) ?> |
= sw_h($p['game_name']) ?> | = sw_h($p['steam_app_id']) ?> | = sw_h($p['workshop_app_id']) ?> | = $p['enabled'] ? 'Yes' : 'No' ?> | Edit |
{SERVER_ROOT} {HOME_ID} {STEAM_APP_ID} {WORKSHOP_APP_ID} {MOD_FOLDER}
Use values detected from this game XML. Existing values are not overwritten unless you explicitly allow it.
= sw_h($detected['steam_app_id'] ?? '') ?>= sw_h($detected['workshop_app_id'] ?? '') ?>= sw_h($detected['steamcmd_path'] ?? '') ?>= sw_h($detected['workshop_download_dir_template'] ?? '') ?>= sw_h($detected['server_root_template'] ?? '') ?>= sw_h($detected['install_path_template'] ?? '') ?>