feat(addonsmanager): Phase 1 — Server Content Manager conversion
- Rename UI labels from "Addons Manager" to "Server Content Manager" - Add server_content_categories.php: central category map with 8 types - Bump module db_version 1→2 with safe VARCHAR(32) migration for addon_type - addons_manager.php: use category map for type list + comments - addons_installer.php: use category map + full TODO blocks for Phase 2+ - user_addons.php: dynamic category iteration via category map - monitor_buttons.php: updated header comment - English lang: updated all user-visible strings, added new type labels - global.php + gamemanager.php: updated LANG_addons_manager, LANG_user_addons, LANG_addons - Created SERVER_CONTENT_ROADMAP.md with full review and migration plan Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/1e8f1b08-96d6-4c47-8f27-efe972d7cf17 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
4176bf3bfa
commit
d562d849b7
10 changed files with 672 additions and 198 deletions
|
|
@ -2,31 +2,40 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2018 The OGP Development Team
|
||||
* GSP - Game Server Panel (a heavily customized fork of OGP maintained by WDS)
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
* Admin page: Server Content Manager (module: addonsmanager)
|
||||
* ─────────────────────────────────────────────────────────────────────────────
|
||||
* This page lets admins create, edit, and remove Server Content items.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
* A "Server Content item" is anything that can be pushed to a game server:
|
||||
* 1. A zip/file package extracted into the server directory.
|
||||
* 2. A downloaded file placed into the server directory.
|
||||
* 3. A script-driven installer (post_script only, no download required).
|
||||
* 4. A Minecraft server jar / version switcher (future: install_method=minecraft_jar).
|
||||
* 5. A DayZ/Epoch/Arma profile copy (future: install_method=profile_copy).
|
||||
* 6. A Steam Workshop content bundle (future: install_method=steam_workshop).
|
||||
* 7. A config preset (type=config).
|
||||
* 8. A full server profile built from multiple actions (type=profile).
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* DB table: OGP_DB_PREFIXaddons (unchanged for backward compatibility).
|
||||
* See SERVER_CONTENT_ROADMAP.md for the full migration plan.
|
||||
*
|
||||
*/
|
||||
|
||||
// Central category map — defines all valid addon_type values and their labels.
|
||||
require_once(dirname(__FILE__) . '/server_content_categories.php');
|
||||
|
||||
function exec_ogp_module() {
|
||||
|
||||
global $db;
|
||||
|
||||
|
||||
// Build the complete list of allowed content types from the category map.
|
||||
// Admins can create items of any registered type; the original three types
|
||||
// (plugin, mappack, config) are always included.
|
||||
$addon_types = get_server_content_type_keys(); // all keys
|
||||
$addon_type_labels = get_server_content_categories(); // key => label
|
||||
|
||||
if (isset($_POST['create_addon']) AND isset($_POST['name']) AND $_POST['url']=="")
|
||||
{
|
||||
print_failure(get_lang("fill_the_url_address_to_a_compressed_file"));
|
||||
|
|
@ -45,13 +54,13 @@ function exec_ogp_module() {
|
|||
}
|
||||
elseif (isset($_POST['create_addon']) AND isset($_POST['name']) AND isset($_POST['url']) AND isset($_POST['addon_type']) and isset($_POST['home_cfg_id']) )
|
||||
{
|
||||
$fields['name'] = $_POST['name'];
|
||||
$fields['url'] = $_POST['url'];
|
||||
$fields['path'] = $_POST['path'];
|
||||
$fields['addon_type'] = $_POST['addon_type'];
|
||||
$fields['name'] = $_POST['name'];
|
||||
$fields['url'] = $_POST['url'];
|
||||
$fields['path'] = $_POST['path'];
|
||||
$fields['addon_type'] = $_POST['addon_type'];
|
||||
$fields['home_cfg_id'] = $_POST['home_cfg_id'];
|
||||
$fields['post_script'] = $_POST['post_script'];
|
||||
$fields['group_id'] = $_POST['group_id'];
|
||||
$fields['group_id'] = $_POST['group_id'];
|
||||
if( is_numeric($db->resultInsertId( 'addons', $fields )) )
|
||||
{
|
||||
print_success(get_lang_f("addon_has_been_created",$_POST['name']));
|
||||
|
|
@ -61,14 +70,13 @@ function exec_ogp_module() {
|
|||
}
|
||||
|
||||
echo "<h2>".get_lang('addons_manager')."</h2>";
|
||||
$name = isset($_POST['name']) ? $_POST['name'] : "";
|
||||
$url = isset($_POST['url']) ? $_POST['url'] : "";
|
||||
$path = isset($_POST['path']) ? $_POST['path'] : "";
|
||||
$name = isset($_POST['name']) ? $_POST['name'] : "";
|
||||
$url = isset($_POST['url']) ? $_POST['url'] : "";
|
||||
$path = isset($_POST['path']) ? $_POST['path'] : "";
|
||||
$post_script = isset($_POST['post_script']) ? $_POST['post_script'] : "";
|
||||
$home_cfg_id = isset($_POST['home_cfg_id']) ? $_POST['home_cfg_id'] : "";
|
||||
$addon_type = isset($_POST['addon_type']) ? $_POST['addon_type'] : "";
|
||||
$group_id = isset($_POST['group_id']) ? $_POST['group_id'] : "";
|
||||
$addon_types = array('plugin', 'mappack', 'config');
|
||||
$addon_type = isset($_POST['addon_type']) ? $_POST['addon_type'] : "";
|
||||
$group_id = isset($_POST['group_id']) ? $_POST['group_id'] : "";
|
||||
|
||||
if (isset($_POST['addon_id']) && (int)$_POST['addon_id'] > 0 && isset($_POST['edit']))
|
||||
{
|
||||
|
|
@ -76,14 +84,14 @@ function exec_ogp_module() {
|
|||
if (!is_array($addons_rows)) {
|
||||
$addons_rows = [];
|
||||
}
|
||||
$addon_info = $addons_rows[0];
|
||||
$name = isset($addon_info['name']) ? $addon_info['name'] : "";
|
||||
$url = isset($addon_info['url']) ? $addon_info['url'] : "";
|
||||
$path = isset($addon_info['path']) ? $addon_info['path'] : "";
|
||||
$addon_info = $addons_rows[0];
|
||||
$name = isset($addon_info['name']) ? $addon_info['name'] : "";
|
||||
$url = isset($addon_info['url']) ? $addon_info['url'] : "";
|
||||
$path = isset($addon_info['path']) ? $addon_info['path'] : "";
|
||||
$post_script = isset($addon_info['post_script']) ? $addon_info['post_script'] : "";
|
||||
$home_cfg_id = isset($addon_info['home_cfg_id']) ? $addon_info['home_cfg_id'] : "";
|
||||
$addon_type = isset($addon_info['addon_type']) ? $addon_info['addon_type'] : "";
|
||||
$group_id = isset($addon_info['group_id']) ? $addon_info['group_id'] : "";
|
||||
$addon_type = isset($addon_info['addon_type']) ? $addon_info['addon_type'] : "";
|
||||
$group_id = isset($addon_info['group_id']) ? $addon_info['group_id'] : "";
|
||||
}
|
||||
?>
|
||||
<form action="" method="post">
|
||||
|
|
@ -104,7 +112,8 @@ function exec_ogp_module() {
|
|||
<input type="text" value="<?php echo $url; ?>" name="url" size="85" title="<?php print_lang('url_info'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- If any, you can set the destination path, should be a relative path to the main game server folder. -->
|
||||
<!-- Destination path — must be relative to the game server home directory.
|
||||
Path traversal (../) is not allowed; the agent enforces this. -->
|
||||
<tr>
|
||||
<td align="right">
|
||||
<b><?php print_lang('path'); ?></b>
|
||||
|
|
@ -174,11 +183,12 @@ function exec_ogp_module() {
|
|||
</td>
|
||||
<td align="left">
|
||||
<?php
|
||||
$types = array( 'plugin', 'mappack', 'config' );
|
||||
foreach ((array)$types as $type)
|
||||
// Render a radio button for every registered content type.
|
||||
// New types automatically appear here once added to server_content_categories.php.
|
||||
foreach ((array)$addon_type_labels as $type_key => $type_label)
|
||||
{
|
||||
$checked = ( isset($addon_type) AND $type == $addon_type) ? 'checked' : '';
|
||||
echo '<input type="radio" name="addon_type" value="'.$type.'" '.$checked.'>'.get_lang($type);
|
||||
$checked = ( isset($addon_type) AND $type_key == $addon_type) ? 'checked' : '';
|
||||
echo '<input type="radio" name="addon_type" value="'.htmlspecialchars($type_key).'" '.$checked.'>'.htmlspecialchars($type_label).' ';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
|
@ -276,14 +286,14 @@ function exec_ogp_module() {
|
|||
<?php
|
||||
$option = '';
|
||||
|
||||
foreach ((array)$addon_types as $k) {
|
||||
foreach ((array)$addon_type_labels as $k => $label) {
|
||||
$option .= '<option';
|
||||
|
||||
if (isset($_GET['addon_type']) && $_GET['addon_type'] == $k) {
|
||||
$option .= ' selected';
|
||||
}
|
||||
|
||||
$option .= ' value="'. $k .'">'.get_lang($k).'</option>';
|
||||
$option .= ' value="'. htmlspecialchars($k) .'">'.htmlspecialchars($label).'</option>';
|
||||
}
|
||||
|
||||
echo $option;
|
||||
|
|
@ -324,8 +334,9 @@ function exec_ogp_module() {
|
|||
}
|
||||
|
||||
$home_cfg_id = !empty($_GET['home_cfg_id']) && (int)$_GET['home_cfg_id'] > 0 ? (int)$_GET['home_cfg_id'] : 0;
|
||||
$addon_type = !empty($_GET['addon_type']) && is_array($addon_types) && in_array($_GET['addon_type'], $addon_types) ? $_GET['addon_type'] : "";
|
||||
$group_id = isset($_GET['group_id']) && is_numeric($_GET['group_id']) ? (int)$_GET['group_id'] : 0;
|
||||
// Validate the requested addon_type against the full category map so new types are accepted.
|
||||
$addon_type = !empty($_GET['addon_type']) && in_array($_GET['addon_type'], $addon_types) ? $_GET['addon_type'] : "";
|
||||
$group_id = isset($_GET['group_id']) && is_numeric($_GET['group_id']) ? (int)$_GET['group_id'] : 0;
|
||||
|
||||
if ( isset($_GET['show']) )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue