Panel/Panel/modules/dashboard/dashboard.php
2026-06-17 09:15:42 -05:00

113 lines
5 KiB
PHP

<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* 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.
*
* 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.
*
*/
function exec_ogp_module()
{
global $settings;
$projectRequestUrl = htmlspecialchars(gsp_project_request_url(), ENT_QUOTES, 'UTF-8');
$discordInviteUrl = htmlspecialchars(gsp_discord_invite_url(), ENT_QUOTES, 'UTF-8');
$serverStatusUrl = htmlspecialchars(gsp_server_status_url(), ENT_QUOTES, 'UTF-8');
$theme = isset($settings['theme']) ? $settings['theme'] : 'SimpleBootstrap';
$themeBase = 'themes/' . htmlspecialchars($theme, ENT_QUOTES, 'UTF-8') . '/images/icons/';
$cards = array(
array(
'title' => 'Account Overview',
'copy' => 'Review your assigned game servers and open the Game Monitor.',
'button_label' => 'View My Servers',
'button_class' => 'dashboard-cta-button',
'url' => 'home.php?m=gamemanager&p=game_monitor',
'icon' => $themeBase . 'game_monitor.png',
),
array(
'title' => 'Custom Server Code',
'copy' => 'Need something beyond the standard server options? Our developers can customize, repair, automate, or extend your game server with mods, scripts, integrations, migrations, and server-specific tools.',
'secondary' => 'Tell us what you want to build or improve, and we will review the request with you.',
'button_label' => 'Request Custom Development',
'button_class' => 'dashboard-cta-button',
'url' => $projectRequestUrl,
'icon' => $themeBase . 'folder.png',
'external' => true,
),
array(
'title' => 'Support',
'copy' => 'Need help with an existing service? Create a support ticket or join our Discord support server.',
'secondary' => 'Support covers service problems, broken functionality, routine troubleshooting, and help using the features already included with your server.',
'button_label' => 'Create Support Ticket',
'button_class' => 'dashboard-support-link',
'url' => 'home.php?m=tickets&p=submitticket',
'icon' => $themeBase . 'support.png',
'secondary_button_label' => 'Join Discord',
'secondary_button_class' => 'dashboard-support-link dashboard-support-link-secondary',
'secondary_url' => $discordInviteUrl,
'secondary_external' => true,
),
array(
'title' => 'Server Status',
'copy' => 'View the current availability of all configured game-server locations.',
'secondary' => 'Status checks run only when you open the status page, so normal dashboard loading stays fast.',
'button_label' => 'View Server Status',
'button_class' => 'dashboard-cta-button',
'url' => $serverStatusUrl,
'icon' => $themeBase . 'game_monitor.png',
'external' => true,
),
);
if (isset($settings['welcome_title']) && $settings['welcome_title'] == "1" && isset($settings['welcome_title_message']) && !empty($settings['welcome_title_message'])) {
echo "<div class='dashboard-welcome'>" . $settings['welcome_title_message'] . "</div>";
}
echo "<div class='dashboard-card-grid'>";
foreach ($cards as $card) {
echo "<section class='dashboard-action-card'>";
echo "<div class='dashboard-card-header'>";
echo "<h3>" . htmlspecialchars($card['title'], ENT_QUOTES, 'UTF-8') . "</h3>";
if (!empty($card['icon'])) {
echo "<img src='" . $card['icon'] . "' class='dashboard-widget-icon' alt=''>";
}
echo "</div>";
echo "<p>" . htmlspecialchars($card['copy'], ENT_QUOTES, 'UTF-8') . "</p>";
if (!empty($card['secondary'])) {
echo "<p class='dashboard-card-note'>" . htmlspecialchars($card['secondary'], ENT_QUOTES, 'UTF-8') . "</p>";
}
echo "<div class='dashboard-link-group'>";
echo "<a class='" . htmlspecialchars($card['button_class'], ENT_QUOTES, 'UTF-8') . "' href='" . htmlspecialchars($card['url'], ENT_QUOTES, 'UTF-8') . "'";
if (!empty($card['external'])) {
echo " target='_blank' rel='noopener noreferrer'";
}
echo ">" . htmlspecialchars($card['button_label'], ENT_QUOTES, 'UTF-8') . "</a>";
if (!empty($card['secondary_button_label']) && !empty($card['secondary_url'])) {
echo "<a class='" . htmlspecialchars($card['secondary_button_class'], ENT_QUOTES, 'UTF-8') . "' href='" . htmlspecialchars($card['secondary_url'], ENT_QUOTES, 'UTF-8') . "'";
if (!empty($card['secondary_external'])) {
echo " target='_blank' rel='noopener noreferrer'";
}
echo ">" . htmlspecialchars($card['secondary_button_label'], ENT_QUOTES, 'UTF-8') . "</a>";
}
echo "</div>";
echo "</section>";
}
echo "</div>";
}
?>