Steam Workshop – Admin'; $action = isset($_GET['action']) ? $_GET['action'] : ''; // ── POST: save a profile edit ───────────────────────────────────── if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save_profile'])) { sw_admin_save_profile($db); return; } // ── POST: sync profiles from XML configs ────────────────────────── if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['sync_profiles'])) { $n = sw_sync_profiles($db); sw_success("Sync complete. $n new profile(s) created."); } // ── GET: show edit form for one profile ─────────────────────────── 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; } // ── Default: list all profiles ──────────────────────────────────── sw_admin_list($db); } // ───────────────────────────────────────────────────────────────────────── // Helpers // ───────────────────────────────────────────────────────────────────────── 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; } // Collect and sanitize fields from POST. $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'] === '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'] ?? ''), ); $set_parts = array(); foreach ($fields as $col => $val) { $safe = $db->realEscapeSingle($val); $set_parts[] = "`$col` = '$safe'"; } $set_parts[] = "`updated_at` = NOW()"; $set_sql = implode(', ', $set_parts); $ok = $db->query( "UPDATE `OGP_DB_PREFIXsteam_workshop_game_profiles` SET $set_sql 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); ?>
Each game config XML gets one Workshop profile. Use Sync Profiles to auto-create rows for new game configs. Enable and configure each profile to activate Steam Workshop for that game.
No profiles yet. Click Sync Profiles to create them from the installed game configs.
| Config Name | Game Name | Workshop App ID | Enabled | Actions |
|---|---|---|---|---|
| = sw_h($p['config_name']) ?> | = sw_h($p['game_name']) ?> | = sw_h($p['workshop_app_id']) ?> | = $p['enabled'] ? 'Yes' : 'No' ?> | Edit |
Supported placeholders (use in path/script templates):
{HOME_ID}
{SERVER_ID}
{REMOTE_SERVER_ID}
{GAME_NAME}
{CONFIG_NAME}
{WORKSHOP_ID}
{MOD_NAME}
{FOLDER_NAME}
{STEAM_APP_ID}
{WORKSHOP_APP_ID}
{STEAMCMD_PATH}
{WORKSHOP_DOWNLOAD_DIR}
{SERVER_ROOT}
{INSTALL_PATH}
{MOD_FOLDER}
{SERVER_ROOT}/steamapps/workshop/content/{WORKSHOP_APP_ID}@{MOD_NAME}-mod=-serverMod=