Panel/Panel/modules/addonsmanager/monitor_buttons.php
copilot-swe-agent[bot] d562d849b7
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>
2026-05-18 21:27:35 +00:00

39 lines
1.6 KiB
PHP

<?php
/*
*
* GSP - Game Server Panel (a heavily customized fork of OGP maintained by WDS)
*
* Monitor button: Server Content (module: addonsmanager)
* ─────────────────────────────────────────────────────────────────────────────
* Injects a "Server Content" button into the game monitor toolbar when at
* least one Server Content item is configured for the server's game type.
*
*/
$query_groups = "";
if($_SESSION['users_role'] != "admin")
{
$groups = $db->getUsersGroups($_SESSION['user_id']);
if (!is_array($groups)) {
$groups = [];
}
$query_groups .= " AND (";
foreach ((array)$groups as $group)
$query_groups .= "group_id=".$group['group_id']." OR ";
$query_groups .= "group_id=0 OR group_id IS NULL)";
}
$addons = $db->resultQuery("SELECT addon_id FROM OGP_DB_PREFIXaddons WHERE home_cfg_id=".$server_home['home_cfg_id'].$query_groups);
$addons_qty = is_array($addons) ? count((array)$addons) : 0;
if($addons and $addons_qty >= 1){
$module_buttons = array(
"<a class='monitorbutton' href='?m=addonsmanager&amp;p=user_addons&amp;home_id=".
$server_home['home_id']."&amp;mod_id=".$server_home['mod_id'].
"&amp;ip=".$server_home['ip']."&amp;port=".$server_home['port']."'>
<img src='" . check_theme_image("modules/administration/images/addons_manager.png") . "' title='". get_lang("addons") ."'>
<span>". get_lang("addons") ." (".$addons_qty.")</span>
</a>"
);
}
else
$module_buttons = array();
?>