Feature: Página de sistema (DB info) + Fix tema claro

This commit is contained in:
2026-02-20 14:54:56 -06:00
parent 4437deb505
commit 6a50e64b42
3 changed files with 216 additions and 0 deletions

107
admin/system.php Normal file
View File

@@ -0,0 +1,107 @@
<?php
require_once __DIR__ . '/../includes/db.php';
require_once __DIR__ . '/../includes/session_check.php';
checkSession();
if (!isAdmin()) {
header('Location: /index.php');
exit;
}
$pageTitle = 'Sistema - Admin';
$dbHost = $_ENV['DB_HOST'] ?? getenv('DB_HOST') ?? 'localhost';
$dbPort = $_ENV['DB_PORT'] ?? getenv('DB_PORT') ?? '3306';
$dbName = $_ENV['DB_NAME'] ?? getenv('DB_NAME') ?? 'bot';
try {
$pdo = getDbConnection();
$dbVersion = $pdo->query('SELECT VERSION()')->fetchColumn();
$dbSize = $pdo->query("SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS size_mb FROM information_schema.tables WHERE table_schema = '$dbName'")->fetchColumn();
$tableCount = $pdo->query("SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '$dbName'")->fetchColumn();
} catch (Exception $e) {
$dbError = $e->getMessage();
}
require_once __DIR__ . '/../templates/header.php';
?>
<div class="d-flex justify-content-between align-items-center mb-4">
<h2><i class="bi bi-hdd-stack"></i> Sistema</h2>
</div>
<div class="row">
<div class="col-md-6">
<div class="card border-0 shadow-sm mb-4">
<div class="card-header border-0">
<h5 class="mb-0"><i class="bi bi-database"></i> Base de Datos</h5>
</div>
<div class="card-body">
<?php if (isset($dbError)): ?>
<div class="alert alert-danger"><?= htmlspecialchars($dbError) ?></div>
<?php else: ?>
<table class="table table-borderless mb-0">
<tr>
<td class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Host / IP</td>
<td style="font-family: 'Share Tech Mono', monospace; color: var(--hud-cyan);"><?= htmlspecialchars($dbHost) ?></td>
</tr>
<tr>
<td class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Puerto</td>
<td style="font-family: 'Share Tech Mono', monospace; color: var(--hud-cyan);"><?= htmlspecialchars($dbPort) ?></td>
</tr>
<tr>
<td class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Base de Datos</td>
<td style="font-family: 'Share Tech Mono', monospace; color: var(--accent-orange);"><?= htmlspecialchars($dbName) ?></td>
</tr>
<tr>
<td class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Versión MySQL</td>
<td style="font-family: 'Share Tech Mono', monospace;"><?= htmlspecialchars($dbVersion ?? 'N/A') ?></td>
</tr>
<tr>
<td class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Tamaño</td>
<td style="font-family: 'Share Tech Mono', monospace;"><?= $dbSize ?? '0' ?> MB</td>
</tr>
<tr>
<td class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Tablas</td>
<td style="font-family: 'Share Tech Mono', monospace;"><?= $tableCount ?? '0' ?></td>
</tr>
</table>
<?php endif; ?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card border-0 shadow-sm mb-4">
<div class="card-header border-0">
<h5 class="mb-0"><i class="bi bi-server"></i> Servidor</h5>
</div>
<div class="card-body">
<table class="table table-borderless mb-0">
<tr>
<td class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">PHP Version</td>
<td style="font-family: 'Share Tech Mono', monospace;"><?= phpversion() ?></td>
</tr>
<tr>
<td class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Server Software</td>
<td style="font-family: 'Share Tech Mono', monospace;"><?= $_SERVER['SERVER_SOFTWARE'] ?? 'N/A' ?></td>
</tr>
<tr>
<td class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Server Name</td>
<td style="font-family: 'Share Tech Mono', monospace;"><?= $_SERVER['SERVER_NAME'] ?? 'N/A' ?></td>
</tr>
<tr>
<td class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Document Root</td>
<td style="font-family: 'Share Tech Mono', monospace; font-size: 0.85rem;"><?= $_SERVER['DOCUMENT_ROOT'] ?? 'N/A' ?></td>
</tr>
<tr>
<td class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;">Timezone</td>
<td style="font-family: 'Share Tech Mono', monospace;"><?= date_default_timezone_get() ?></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<?php require_once __DIR__ . '/../templates/footer.php'; ?>

View File

@@ -105,6 +105,42 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
background: linear-gradient(135deg, #3d4a32 0%, #2a3024 100%);
}
[data-bs-theme="light"] .login-card {
background: rgba(245, 243, 237, 0.95);
}
[data-bs-theme="light"] .login-body {
background: rgba(245, 243, 237, 0.5);
}
[data-bs-theme="light"] .form-label {
color: #1a1f16;
}
[data-bs-theme="light"] .form-control {
background: rgba(255, 255, 255, 0.9);
color: #1a1f16;
}
[data-bs-theme="light"] .form-control:focus {
background: #fff;
color: #1a1f16;
}
[data-bs-theme="light"] .form-control::placeholder {
color: rgba(26, 31, 22, 0.5);
}
[data-bs-theme="light"] .login-subtitle {
color: #1a1f16;
}
[data-bs-theme="light"] .alert-danger {
background: rgba(139, 58, 58, 0.15);
color: #8b3a3a;
border-color: #8b3a3a;
}
.login-card {
background: rgba(26, 31, 22, 0.95);
border: 2px solid var(--military-green);

View File

@@ -49,6 +49,77 @@ $theme = $_COOKIE['theme'] ?? 'light';
--bs-card-bg: #f5f3ed;
--bs-border-color: #8b7355;
--navbar-bg: linear-gradient(180deg, #3d4a32 0%, #2a3024 100%);
--military-dark: #2a3024;
--military-sand: #e8e4d9;
}
[data-bs-theme="light"] .nav-link-main,
[data-bs-theme="light"] .dropdown-toggle-military {
color: var(--military-sand) !important;
}
[data-bs-theme="light"] .nav-link-main:hover,
[data-bs-theme="light"] .nav-link-main.active,
[data-bs-theme="light"] .dropdown-toggle-military:hover,
[data-bs-theme="light"] .dropdown-toggle-military.show {
color: #fff !important;
}
[data-bs-theme="light"] .navbar-brand small {
color: var(--military-sand);
}
[data-bs-theme="light"] .dropdown-menu-military {
background: var(--bs-card-bg);
}
[data-bs-theme="light"] .dropdown-menu-military .dropdown-item {
color: var(--bs-body-color);
}
[data-bs-theme="light"] .dropdown-menu-military .dropdown-item:hover {
background: rgba(61, 74, 50, 0.3);
}
[data-bs-theme="light"] #theme-toggle {
color: var(--military-sand);
border-color: rgba(255,255,255,0.3);
}
[data-bs-theme="light"] .text-muted {
color: #5a6b4a !important;
}
[data-bs-theme="light"] .table thead th {
background-color: rgba(61, 74, 50, 0.2);
color: var(--bs-body-color);
}
[data-bs-theme="light"] .card-header {
background-color: rgba(61, 74, 50, 0.15);
color: var(--bs-body-color);
}
[data-bs-theme="light"] .alert-danger {
background-color: rgba(139, 58, 58, 0.15);
color: #8b3a3a;
}
[data-bs-theme="light"] .alert-success {
background-color: rgba(74, 156, 140, 0.15);
color: #2d6b61;
}
[data-bs-theme="light"] ::-webkit-scrollbar-track {
background: #d4d0c5;
}
[data-bs-theme="light"] ::-webkit-scrollbar-thumb {
background: #8b7355;
}
[data-bs-theme="light"] ::-webkit-scrollbar-thumb:hover {
background: var(--accent-orange);
}
body {
@@ -587,6 +658,8 @@ $theme = $_COOKIE['theme'] ?? 'light';
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item <?= $currentPage === 'translate_message.php' ? 'active' : '' ?>" href="/translate_message.php"><i class="bi bi-translate"></i> Traductor</a></li>
<li><a class="dropdown-item <?= $currentPage === 'admin_send_message.php' ? 'active' : '' ?>" href="/admin_send_message.php"><i class="bi bi-lightning"></i> Enviar Directo</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item <?= $currentPage === 'system.php' ? 'active' : '' ?>" href="/admin/system.php"><i class="bi bi-hdd-stack"></i> Sistema</a></li>
</ul>
</li>
<?php endif; ?>