Feature: Sistema multi-idioma con LibreTranslate
- Nuevo includes/i18n.php con funciones t() para traducción - Selector de idioma en navbar y login - Traducciones aplicadas a: dashboard, login, mensajes programados, crear mensaje, sistema - Usa idiomas activados desde admin/languages.php - Caché de traducciones incluido
This commit is contained in:
@@ -8,7 +8,9 @@ if (!isAdmin()) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$pageTitle = 'Sistema - Admin';
|
||||
require_once __DIR__ . '/../includes/i18n.php';
|
||||
|
||||
$pageTitle = t('Sistema') . ' - Admin';
|
||||
|
||||
$dbHost = $_ENV['DB_HOST'] ?? getenv('DB_HOST') ?? 'localhost';
|
||||
$dbPort = $_ENV['DB_PORT'] ?? getenv('DB_PORT') ?? '3306';
|
||||
@@ -27,14 +29,14 @@ 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>
|
||||
<h2><i class="bi bi-hdd-stack"></i> <?= t('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>
|
||||
<h5 class="mb-0"><i class="bi bi-database"></i> <?= t('Base de Datos') ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if (isset($dbError)): ?>
|
||||
@@ -42,27 +44,27 @@ require_once __DIR__ . '/../templates/header.php';
|
||||
<?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 class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;"><?= t('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 class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;"><?= t('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 class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;"><?= t('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 class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;"><?= t('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 class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;"><?= t('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 class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;"><?= t('Tablas') ?></td>
|
||||
<td style="font-family: 'Share Tech Mono', monospace;"><?= $tableCount ?? '0' ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -74,28 +76,28 @@ require_once __DIR__ . '/../templates/header.php';
|
||||
<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>
|
||||
<h5 class="mb-0"><i class="bi bi-server"></i> <?= t('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 class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;"><?= t('Versión PHP') ?></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 class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;"><?= t('Software Servidor') ?></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 class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;"><?= t('Nombre Servidor') ?></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 class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;"><?= t('Raíz Documentos') ?></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 class="text-muted text-uppercase" style="font-size: 0.75rem; letter-spacing: 1px;"><?= t('Zona Horaria') ?></td>
|
||||
<td style="font-family: 'Share Tech Mono', monospace;"><?= date_default_timezone_get() ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -6,6 +6,7 @@ require_once __DIR__ . '/includes/message_handler.php';
|
||||
require_once __DIR__ . '/includes/schedule_helpers.php';
|
||||
require_once __DIR__ . '/common/helpers/sender_factory.php';
|
||||
require_once __DIR__ . '/common/helpers/converter_factory.php';
|
||||
require_once __DIR__ . '/includes/i18n.php';
|
||||
|
||||
function getTranslationButtons(PDO $pdo, string $text): array
|
||||
{
|
||||
@@ -69,7 +70,7 @@ function buildDiscordTranslationButtons(array $languages, string $text): array
|
||||
];
|
||||
}
|
||||
|
||||
$pageTitle = 'Crear Mensaje - Sistema de Mensajería';
|
||||
$pageTitle = t('Crear Mensaje');
|
||||
|
||||
$recipients = [];
|
||||
$templates = [];
|
||||
@@ -202,10 +203,10 @@ require_once __DIR__ . '/templates/header.php';
|
||||
?>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2><i class="bi bi-plus-circle"></i> Crear Mensaje</h2>
|
||||
<h2><i class="bi bi-pencil-square"></i> <?= t('Crear Mensaje') ?></h2>
|
||||
<div class="btn-group">
|
||||
<a href="preview_message.php" class="btn btn-outline-secondary" target="_blank">
|
||||
<i class="bi bi-eye"></i> Previsualizar
|
||||
<i class="bi bi-eye"></i> <?= t('Previsualizar') ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -220,14 +221,14 @@ require_once __DIR__ . '/templates/header.php';
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card border-0 shadow-sm mb-4">
|
||||
<div class="card-header bg-white border-0">
|
||||
<h5 class="mb-0">Contenido del Mensaje</h5>
|
||||
<div class="card-header border-0">
|
||||
<h5 class="mb-0"><?= t('Contenido del Mensaje') ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Plantilla (opcional)</label>
|
||||
<label class="form-label"><?= t('Plantilla (opcional)') ?></label>
|
||||
<select class="form-select" id="templateSelect">
|
||||
<option value="">-- Seleccionar plantilla --</option>
|
||||
<option value="">-- <?= t('Seleccionar plantilla') ?> --</option>
|
||||
<?php foreach ($templates as $template): ?>
|
||||
<option value="<?= htmlspecialchars($template['message_content']) ?>">
|
||||
<?= htmlspecialchars($template['name']) ?>
|
||||
@@ -237,7 +238,7 @@ require_once __DIR__ . '/templates/header.php';
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Mensaje</label>
|
||||
<label class="form-label"><?= t('Mensaje') ?></label>
|
||||
<textarea name="content" id="messageContent" class="form-control" rows="12"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
@@ -246,62 +247,62 @@ require_once __DIR__ . '/templates/header.php';
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="card border-0 shadow-sm mb-4">
|
||||
<div class="card-header bg-white border-0">
|
||||
<h5 class="mb-0">Destinatario</h5>
|
||||
<div class="card-header border-0">
|
||||
<h5 class="mb-0"><?= t('Destinatario') ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Plataforma</label>
|
||||
<label class="form-label"><?= t('Plataforma') ?></label>
|
||||
<select name="platform" id="platformSelect" class="form-select" required>
|
||||
<option value="">-- Seleccionar --</option>
|
||||
<option value="">-- <?= t('Seleccionar') ?> --</option>
|
||||
<option value="discord">Discord</option>
|
||||
<option value="telegram">Telegram</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Destinatario</label>
|
||||
<label class="form-label"><?= t('Destinatario') ?></label>
|
||||
<select name="recipient_id" id="recipientSelect" class="form-select" required disabled>
|
||||
<option value="">Selecciona una plataforma primero</option>
|
||||
<option value=""><?= t('Selecciona una plataforma primero') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-0 shadow-sm mb-4">
|
||||
<div class="card-header bg-white border-0">
|
||||
<h5 class="mb-0">Programación</h5>
|
||||
<div class="card-header border-0">
|
||||
<h5 class="mb-0"><?= t('Programación') ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tipo de envío</label>
|
||||
<label class="form-label"><?= t('Tipo de envío') ?></label>
|
||||
<select name="send_type" id="sendType" class="form-select" required>
|
||||
<option value="now">Enviar ahora</option>
|
||||
<option value="later">Programar para después</option>
|
||||
<option value="recurring">Recurrente</option>
|
||||
<option value="now"><?= t('Enviar ahora') ?></option>
|
||||
<option value="later"><?= t('Programar para después') ?></option>
|
||||
<option value="recurring"><?= t('Recurrente') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3" id="datetimeField" style="display: none;">
|
||||
<label class="form-label">Fecha y hora</label>
|
||||
<label class="form-label"><?= t('Fecha y hora') ?></label>
|
||||
<input type="datetime-local" name="send_datetime" class="form-control">
|
||||
</div>
|
||||
|
||||
<div id="recurringFields" style="display: none;">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Días</label>
|
||||
<label class="form-label"><?= t('Días') ?></label>
|
||||
<select name="recurring_days" class="form-select">
|
||||
<option value="monday">Lunes</option>
|
||||
<option value="tuesday">Martes</option>
|
||||
<option value="wednesday">Miércoles</option>
|
||||
<option value="thursday">Jueves</option>
|
||||
<option value="friday">Viernes</option>
|
||||
<option value="saturday">Sábado</option>
|
||||
<option value="sunday">Domingo</option>
|
||||
<option value="monday"><?= t('Lunes') ?></option>
|
||||
<option value="tuesday"><?= t('Martes') ?></option>
|
||||
<option value="wednesday"><?= t('Miércoles') ?></option>
|
||||
<option value="thursday"><?= t('Jueves') ?></option>
|
||||
<option value="friday"><?= t('Viernes') ?></option>
|
||||
<option value="saturday"><?= t('Sábado') ?></option>
|
||||
<option value="sunday"><?= t('Domingo') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Hora</label>
|
||||
<label class="form-label"><?= t('Hora') ?></label>
|
||||
<input type="time" name="recurring_time" class="form-control" value="09:00">
|
||||
</div>
|
||||
</div>
|
||||
@@ -310,9 +311,9 @@ require_once __DIR__ . '/templates/header.php';
|
||||
|
||||
<div class="d-grid gap-2">
|
||||
<button type="submit" class="btn btn-primary btn-lg">
|
||||
<i class="bi bi-send"></i> Enviar
|
||||
<i class="bi bi-send"></i> <?= t('Enviar') ?>
|
||||
</button>
|
||||
<a href="index.php" class="btn btn-outline-secondary">Cancelar</a>
|
||||
<a href="index.php" class="btn btn-outline-secondary"><?= t('Cancelar') ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -323,7 +324,7 @@ require_once __DIR__ . '/templates/header.php';
|
||||
<div class="modal-dialog modal-lg modal-dialog-scrollable">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="bi bi-images"></i> Galería de Imágenes</h5>
|
||||
<h5 class="modal-title"><i class="bi bi-images"></i> <?= t('Galería de Imágenes') ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@@ -331,7 +332,7 @@ require_once __DIR__ . '/templates/header.php';
|
||||
<?php if (empty($galleryImages)): ?>
|
||||
<div class="col-12 text-center text-muted py-5">
|
||||
<i class="bi bi-images" style="font-size: 3rem;"></i>
|
||||
<p class="mt-3">No hay imágenes en la galería</p>
|
||||
<p class="mt-3"><?= t('No hay imágenes en la galería') ?></p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($galleryImages as $image): ?>
|
||||
|
||||
131
includes/i18n.php
Normal file
131
includes/i18n.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/env_loader.php';
|
||||
require_once __DIR__ . '/../src/Translate.php';
|
||||
|
||||
session_start();
|
||||
|
||||
function getCurrentLanguage(): string
|
||||
{
|
||||
if (isset($_SESSION['user_language'])) {
|
||||
return $_SESSION['user_language'];
|
||||
}
|
||||
|
||||
if (isset($_COOKIE['user_language'])) {
|
||||
$_SESSION['user_language'] = $_COOKIE['user_language'];
|
||||
return $_COOKIE['user_language'];
|
||||
}
|
||||
|
||||
$defaultLang = 'es';
|
||||
$_SESSION['user_language'] = $defaultLang;
|
||||
return $defaultLang;
|
||||
}
|
||||
|
||||
function setCurrentLanguage(string $langCode): void
|
||||
{
|
||||
$_SESSION['user_language'] = $langCode;
|
||||
setcookie('user_language', $langCode, [
|
||||
'expires' => time() + (365 * 24 * 60 * 60),
|
||||
'path' => '/',
|
||||
'secure' => true,
|
||||
'httponly' => true,
|
||||
'samesite' => 'Strict'
|
||||
]);
|
||||
}
|
||||
|
||||
function getActiveLanguages(): array
|
||||
{
|
||||
static $languages = null;
|
||||
|
||||
if ($languages !== null) {
|
||||
return $languages;
|
||||
}
|
||||
|
||||
try {
|
||||
$pdo = getDbConnection();
|
||||
$stmt = $pdo->query("SELECT * FROM supported_languages WHERE is_active = 1 ORDER BY language_name");
|
||||
$languages = $stmt->fetchAll();
|
||||
} catch (Exception $e) {
|
||||
$languages = [];
|
||||
}
|
||||
|
||||
return $languages;
|
||||
}
|
||||
|
||||
function getBaseLanguage(): string
|
||||
{
|
||||
return 'es';
|
||||
}
|
||||
|
||||
function t(string $text, ?string $targetLang = null): string
|
||||
{
|
||||
if (empty(trim($text))) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
$targetLang = $targetLang ?? getCurrentLanguage();
|
||||
$baseLang = getBaseLanguage();
|
||||
|
||||
if ($targetLang === $baseLang) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
static $translator = null;
|
||||
static $cache = [];
|
||||
|
||||
$cacheKey = md5($text . $targetLang);
|
||||
|
||||
if (isset($cache[$cacheKey])) {
|
||||
return $cache[$cacheKey];
|
||||
}
|
||||
|
||||
if ($translator === null) {
|
||||
$translator = new \src\Translate();
|
||||
}
|
||||
|
||||
try {
|
||||
$translated = $translator->translate($text, $baseLang, $targetLang);
|
||||
|
||||
if ($translated !== null) {
|
||||
$cache[$cacheKey] = $translated;
|
||||
return $translated;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
error_log("Translation error for '$text': " . $e->getMessage());
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function ta(array $texts): array
|
||||
{
|
||||
$result = [];
|
||||
foreach ($texts as $key => $text) {
|
||||
$result[$key] = t($text);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function handleLanguageChange(): void
|
||||
{
|
||||
if (isset($_GET['lang'])) {
|
||||
$lang = $_GET['lang'];
|
||||
$activeLanguages = getActiveLanguages();
|
||||
$validLangs = array_column($activeLanguages, 'language_code');
|
||||
|
||||
if (in_array($lang, $validLangs) || $lang === 'es') {
|
||||
setCurrentLanguage($lang);
|
||||
}
|
||||
|
||||
$redirectUrl = strtok($_SERVER['REQUEST_URI'], '?');
|
||||
$queryParams = $_GET;
|
||||
unset($queryParams['lang']);
|
||||
|
||||
if (!empty($queryParams)) {
|
||||
$redirectUrl .= '?' . http_build_query($queryParams);
|
||||
}
|
||||
|
||||
header('Location: ' . $redirectUrl);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
34
index.php
34
index.php
@@ -14,9 +14,9 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
|
||||
?>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2><i class="bi bi-crosshair"></i> Dashboard</h2>
|
||||
<h2><i class="bi bi-crosshair"></i> <?= t('Dashboard') ?></h2>
|
||||
<span class="text-muted" style="font-family: 'Share Tech Mono', monospace; font-size: 0.8rem;">
|
||||
// BIENVENIDO, <?= strtoupper(htmlspecialchars(getCurrentUsername())) ?>
|
||||
// <?= t('BIENVENIDO') ?>, <?= strtoupper(htmlspecialchars(getCurrentUsername())) ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
|
||||
</div>
|
||||
<div>
|
||||
<div style="font-family: 'Share Tech Mono', monospace; font-size: 2rem; color: var(--accent-orange);"><?= $pendingCount ?></div>
|
||||
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;">Pendientes</small>
|
||||
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;"><?= t('Pendientes') ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -46,7 +46,7 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
|
||||
</div>
|
||||
<div>
|
||||
<div style="font-family: 'Share Tech Mono', monospace; font-size: 2rem; color: var(--hud-cyan);"><?= $sentToday ?></div>
|
||||
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;">Enviados Hoy</small>
|
||||
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;"><?= t('Enviados Hoy') ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,7 +64,7 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
|
||||
<div style="font-family: 'Share Tech Mono', monospace; font-size: 2rem; color: var(--discord-color);">
|
||||
<?= count(array_filter($scheduledMessages, fn($m) => $m['platform'] === 'discord')) ?>
|
||||
</div>
|
||||
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;">Discord</small>
|
||||
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;"><?= t('Discord') ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -82,7 +82,7 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
|
||||
<div style="font-family: 'Share Tech Mono', monospace; font-size: 2rem; color: var(--telegram-color);">
|
||||
<?= count(array_filter($scheduledMessages, fn($m) => $m['platform'] === 'telegram')) ?>
|
||||
</div>
|
||||
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;">Telegram</small>
|
||||
<small class="text-muted text-uppercase" style="letter-spacing: 1px; font-size: 0.7rem;"><?= t('Telegram') ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -94,20 +94,20 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
|
||||
<div class="col-md-8">
|
||||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-header border-0">
|
||||
<h5 class="mb-0"><i class="bi bi-list-check"></i> Próximos Mensajes</h5>
|
||||
<h5 class="mb-0"><i class="bi bi-list-check"></i> <?= t('Próximos Mensajes') ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if (empty($scheduledMessages)): ?>
|
||||
<p class="text-muted text-center py-4">// NO HAY MENSAJES PROGRAMADOS</p>
|
||||
<p class="text-muted text-center py-4">// <?= t('NO HAY MENSAJES PROGRAMADOS') ?></p>
|
||||
<?php else: ?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Destinatario</th>
|
||||
<th>Plataforma</th>
|
||||
<th>Fecha</th>
|
||||
<th>Estado</th>
|
||||
<th><?= t('Destinatario') ?></th>
|
||||
<th><?= t('Plataforma') ?></th>
|
||||
<th><?= t('Fecha') ?></th>
|
||||
<th><?= t('Estado') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -131,7 +131,7 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
|
||||
'disabled' => 'secondary',
|
||||
default => 'light'
|
||||
} ?>">
|
||||
<?= $msg['status'] ?>
|
||||
<?= t($msg['status']) ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -147,18 +147,18 @@ $sentToday = count(array_filter($sentMessages, fn($m) => date('Y-m-d', strtotime
|
||||
<div class="col-md-4">
|
||||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-header border-0">
|
||||
<h5 class="mb-0"><i class="bi bi-lightning"></i> Acciones Rápidas</h5>
|
||||
<h5 class="mb-0"><i class="bi bi-lightning"></i> <?= t('Acciones Rápidas') ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-grid gap-2">
|
||||
<a href="create_message.php" class="btn btn-primary">
|
||||
<i class="bi bi-pencil-square"></i> Nuevo Mensaje
|
||||
<i class="bi bi-pencil-square"></i> <?= t('Nuevo Mensaje') ?>
|
||||
</a>
|
||||
<a href="recurrentes.php" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-collection"></i> Ver Plantillas
|
||||
<i class="bi bi-collection"></i> <?= t('Ver Plantillas') ?>
|
||||
</a>
|
||||
<a href="scheduled_messages.php" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-list"></i> Ver Todos los Programados
|
||||
<i class="bi bi-list"></i> <?= t('Ver Todos los Programados') ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
76
login.php
76
login.php
@@ -2,6 +2,9 @@
|
||||
require_once __DIR__ . '/includes/db.php';
|
||||
require_once __DIR__ . '/includes/env_loader.php';
|
||||
require_once __DIR__ . '/includes/auth.php';
|
||||
require_once __DIR__ . '/includes/i18n.php';
|
||||
|
||||
handleLanguageChange();
|
||||
|
||||
$domain = $_ENV['APP_URL'] ?? getenv('APP_URL') ?? '';
|
||||
if ($domain) {
|
||||
@@ -28,6 +31,8 @@ if (isset($_SESSION['user_id'])) {
|
||||
|
||||
$error = '';
|
||||
$theme = $_COOKIE['theme'] ?? 'light';
|
||||
$currentLang = getCurrentLanguage();
|
||||
$activeLanguages = getActiveLanguages();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$username = $_POST['username'] ?? '';
|
||||
@@ -39,7 +44,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
} else {
|
||||
$error = 'Usuario o contraseña incorrectos';
|
||||
$error = t('Usuario o contraseña incorrectos');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -270,6 +275,45 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
.corner-tr { top: -2px; right: -2px; border-left: none; border-bottom: none; }
|
||||
.corner-bl { bottom: -2px; left: -2px; border-right: none; border-top: none; }
|
||||
.corner-br { bottom: -2px; right: -2px; border-left: none; border-top: none; }
|
||||
|
||||
.lang-selector-login {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.lang-selector-login .btn {
|
||||
background: transparent;
|
||||
border: 1px solid var(--military-green);
|
||||
color: var(--military-sand);
|
||||
border-radius: 0;
|
||||
padding: 4px 10px;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.lang-selector-login .btn:hover {
|
||||
background: rgba(61, 74, 50, 0.5);
|
||||
border-color: var(--accent-orange);
|
||||
}
|
||||
|
||||
.lang-selector-login .dropdown-menu {
|
||||
background: var(--military-dark);
|
||||
border: 1px solid var(--military-green);
|
||||
border-radius: 0;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.lang-selector-login .dropdown-item {
|
||||
color: var(--military-sand);
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.lang-selector-login .dropdown-item:hover,
|
||||
.lang-selector-login .dropdown-item.active {
|
||||
background: rgba(90, 107, 74, 0.4);
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -282,9 +326,29 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<div class="corner-decoration corner-bl"></div>
|
||||
<div class="corner-decoration corner-br"></div>
|
||||
|
||||
<div class="lang-selector-login dropdown">
|
||||
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown">
|
||||
<?php
|
||||
$currentLangData = array_filter($activeLanguages, fn($l) => $l['language_code'] === $currentLang);
|
||||
$currentLangData = reset($currentLangData);
|
||||
if ($currentLang === 'es' || !$currentLangData) {
|
||||
echo '🇲🇽';
|
||||
} else {
|
||||
echo htmlspecialchars($currentLangData['flag_emoji']);
|
||||
}
|
||||
?>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a class="dropdown-item <?= $currentLang === 'es' ? 'active' : '' ?>" href="?lang=es">🇲🇽 <?= t('Español') ?></a></li>
|
||||
<?php foreach ($activeLanguages as $lang): ?>
|
||||
<li><a class="dropdown-item <?= $currentLang === $lang['language_code'] ? 'active' : '' ?>" href="?lang=<?= urlencode($lang['language_code']) ?>"><?= htmlspecialchars($lang['flag_emoji']) ?> <?= t($lang['language_name']) ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="login-header">
|
||||
<div class="login-title">◈ LASTWAR</div>
|
||||
<div class="login-subtitle">Comms Center</div>
|
||||
<div class="login-subtitle"><?= t('Centro de Comunicaciones') ?></div>
|
||||
</div>
|
||||
<div class="login-body">
|
||||
<?php if ($error): ?>
|
||||
@@ -293,15 +357,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
<form method="POST">
|
||||
<div class="mb-4">
|
||||
<label class="form-label">Usuario</label>
|
||||
<input type="text" name="username" class="form-control" placeholder="Ingrese su usuario" required autofocus>
|
||||
<label class="form-label"><?= t('Usuario') ?></label>
|
||||
<input type="text" name="username" class="form-control" placeholder="<?= t('Ingrese su usuario') ?>" required autofocus>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="form-label">Contraseña</label>
|
||||
<label class="form-label"><?= t('Contraseña') ?></label>
|
||||
<input type="password" name="password" class="form-control" placeholder="••••••••" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-login">
|
||||
<i class="bi bi-shield-lock"></i> Acceder
|
||||
<i class="bi bi-shield-lock"></i> <?= t('Acceder') ?>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@ checkSession();
|
||||
require_once __DIR__ . '/includes/message_handler.php';
|
||||
require_once __DIR__ . '/includes/schedule_actions.php';
|
||||
|
||||
$pageTitle = 'Mensajes Programados';
|
||||
$pageTitle = t('Mensajes Programados');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
|
||||
$scheduleId = (int) $_POST['schedule_id'];
|
||||
@@ -24,32 +24,32 @@ require_once __DIR__ . '/templates/header.php';
|
||||
?>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2><i class="bi bi-clock"></i> Mensajes Programados</h2>
|
||||
<h2><i class="bi bi-stopwatch"></i> <?= t('Mensajes Programados') ?></h2>
|
||||
<a href="create_message.php" class="btn btn-primary">
|
||||
<i class="bi bi-plus-circle"></i> Nuevo Mensaje
|
||||
<i class="bi bi-plus-circle"></i> <?= t('Nuevo Mensaje') ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['success'])): ?>
|
||||
<div class="alert alert-success">Mensaje creado exitosamente</div>
|
||||
<div class="alert alert-success"><?= t('Mensaje creado exitosamente') ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body">
|
||||
<?php if (empty($messages)): ?>
|
||||
<p class="text-muted text-center py-4">No hay mensajes programados</p>
|
||||
<p class="text-muted text-center py-4"><?= t('No hay mensajes programados') ?></p>
|
||||
<?php else: ?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Destinatario</th>
|
||||
<th>Plataforma</th>
|
||||
<th>Fecha de Envío</th>
|
||||
<th>Tipo</th>
|
||||
<th>Estado</th>
|
||||
<th>Acciones</th>
|
||||
<th><?= t('ID') ?></th>
|
||||
<th><?= t('Destinatario') ?></th>
|
||||
<th><?= t('Plataforma') ?></th>
|
||||
<th><?= t('Fecha de Envío') ?></th>
|
||||
<th><?= t('Tipo') ?></th>
|
||||
<th><?= t('Estado') ?></th>
|
||||
<th><?= t('Acciones') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -67,9 +67,9 @@ require_once __DIR__ . '/templates/header.php';
|
||||
<td><?= date('d/m/Y H:i', strtotime($msg['send_time'])) ?></td>
|
||||
<td>
|
||||
<?php if ($msg['is_recurring']): ?>
|
||||
<span class="badge bg-info">Recurrente</span>
|
||||
<span class="badge bg-info"><?= t('Recurrente') ?></span>
|
||||
<?php else: ?>
|
||||
<span class="badge bg-secondary">Único</span>
|
||||
<span class="badge bg-secondary"><?= t('Único') ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
@@ -82,7 +82,7 @@ require_once __DIR__ . '/templates/header.php';
|
||||
'cancelled' => 'dark',
|
||||
default => 'light'
|
||||
} ?>">
|
||||
<?= $msg['status'] ?>
|
||||
<?= t($msg['status']) ?>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
@@ -91,7 +91,7 @@ require_once __DIR__ . '/templates/header.php';
|
||||
<form method="POST" class="d-inline">
|
||||
<input type="hidden" name="schedule_id" value="<?= $msg['id'] ?>">
|
||||
<input type="hidden" name="action" value="disable">
|
||||
<button type="submit" class="btn btn-outline-warning" title="Deshabilitar">
|
||||
<button type="submit" class="btn btn-outline-warning" title="<?= t('Deshabilitar') ?>">
|
||||
<i class="bi bi-pause"></i>
|
||||
</button>
|
||||
</form>
|
||||
@@ -99,7 +99,7 @@ require_once __DIR__ . '/templates/header.php';
|
||||
<form method="POST" class="d-inline">
|
||||
<input type="hidden" name="schedule_id" value="<?= $msg['id'] ?>">
|
||||
<input type="hidden" name="action" value="enable">
|
||||
<button type="submit" class="btn btn-outline-success" title="Habilitar">
|
||||
<button type="submit" class="btn btn-outline-success" title="<?= t('Habilitar') ?>">
|
||||
<i class="bi bi-play"></i>
|
||||
</button>
|
||||
</form>
|
||||
@@ -107,26 +107,26 @@ require_once __DIR__ . '/templates/header.php';
|
||||
<form method="POST" class="d-inline">
|
||||
<input type="hidden" name="schedule_id" value="<?= $msg['id'] ?>">
|
||||
<input type="hidden" name="action" value="retry">
|
||||
<button type="submit" class="btn btn-outline-info" title="Reintentar">
|
||||
<button type="submit" class="btn btn-outline-info" title="<?= t('Reintentar') ?>">
|
||||
<i class="bi bi-arrow-clockwise"></i>
|
||||
</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($msg['status'] !== 'sent'): ?>
|
||||
<form method="POST" class="d-inline" onsubmit="return confirm('¿Cancelar este mensaje?');">
|
||||
<form method="POST" class="d-inline" onsubmit="return confirm('<?= t('¿Cancelar este mensaje?') ?>');">
|
||||
<input type="hidden" name="schedule_id" value="<?= $msg['id'] ?>">
|
||||
<input type="hidden" name="action" value="cancel">
|
||||
<button type="submit" class="btn btn-outline-secondary" title="Cancelar">
|
||||
<button type="submit" class="btn btn-outline-secondary" title="<?= t('Cancelar') ?>">
|
||||
<i class="bi bi-x-circle"></i>
|
||||
</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="POST" class="d-inline" onsubmit="return confirm('¿Eliminar este mensaje?');">
|
||||
<form method="POST" class="d-inline" onsubmit="return confirm('<?= t('¿Eliminar este mensaje?') ?>');">
|
||||
<input type="hidden" name="schedule_id" value="<?= $msg['id'] ?>">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<button type="submit" class="btn btn-outline-danger" title="Eliminar">
|
||||
<button type="submit" class="btn btn-outline-danger" title="<?= t('Eliminar') ?>">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
session_start();
|
||||
require_once __DIR__ . '/../includes/session_check.php';
|
||||
require_once __DIR__ . '/../includes/url_helper.php';
|
||||
require_once __DIR__ . '/../includes/i18n.php';
|
||||
|
||||
handleLanguageChange();
|
||||
|
||||
$currentPage = basename($_SERVER['PHP_SELF']);
|
||||
$theme = $_COOKIE['theme'] ?? 'light';
|
||||
$currentLang = getCurrentLanguage();
|
||||
$activeLanguages = getActiveLanguages();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="es" data-bs-theme="<?= $theme ?>">
|
||||
@@ -607,32 +612,32 @@ $theme = $_COOKIE['theme'] ?? 'light';
|
||||
<ul class="navbar-nav me-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link nav-link-main <?= $currentPage === 'index.php' ? 'active' : '' ?>" href="/index.php">
|
||||
<i class="bi bi-crosshair"></i> Dashboard
|
||||
<i class="bi bi-crosshair"></i> <?= t('Dashboard') ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link nav-link-main <?= $currentPage === 'create_message.php' ? 'active' : '' ?>" href="/create_message.php">
|
||||
<i class="bi bi-pencil-square"></i> Crear
|
||||
<i class="bi bi-pencil-square"></i> <?= t('Crear') ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link nav-link-main <?= $currentPage === 'scheduled_messages.php' ? 'active' : '' ?>" href="/scheduled_messages.php">
|
||||
<i class="bi bi-stopwatch"></i> Programados
|
||||
<i class="bi bi-stopwatch"></i> <?= t('Programados') ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link nav-link-main <?= $currentPage === 'recurrentes.php' ? 'active' : '' ?>" href="/recurrentes.php">
|
||||
<i class="bi bi-collection"></i> Plantillas
|
||||
<i class="bi bi-collection"></i> <?= t('Plantillas') ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link nav-link-main <?= $currentPage === 'sent_messages.php' ? 'active' : '' ?>" href="/sent_messages.php">
|
||||
<i class="bi bi-check2-all"></i> Enviados
|
||||
<i class="bi bi-check2-all"></i> <?= t('Enviados') ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link nav-link-main <?= $currentPage === 'gallery.php' ? 'active' : '' ?>" href="/gallery.php">
|
||||
<i class="bi bi-images"></i> Galería
|
||||
<i class="bi bi-images"></i> <?= t('Galería') ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -640,45 +645,72 @@ $theme = $_COOKIE['theme'] ?? 'light';
|
||||
<div class="nav-divider d-none d-lg-block"></div>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle-military dropdown-toggle" href="#" data-bs-toggle="dropdown">
|
||||
<i class="bi bi-shield-lock"></i> COMANDO
|
||||
<i class="bi bi-shield-lock"></i> <?= t('COMANDO') ?>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-military">
|
||||
<li><a class="dropdown-item <?= $currentPage === 'users.php' ? 'active' : '' ?>" href="/admin/users.php"><i class="bi bi-people"></i> Usuarios</a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'recipients.php' ? 'active' : '' ?>" href="/admin/recipients.php"><i class="bi bi-person-check"></i> Destinatarios</a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'languages.php' ? 'active' : '' ?>" href="/admin/languages.php"><i class="bi bi-translate"></i> Idiomas</a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'comandos.php' ? 'active' : '' ?>" href="/admin/comandos.php"><i class="bi bi-terminal"></i> Comandos</a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'users.php' ? 'active' : '' ?>" href="/admin/users.php"><i class="bi bi-people"></i> <?= t('Usuarios') ?></a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'recipients.php' ? 'active' : '' ?>" href="/admin/recipients.php"><i class="bi bi-person-check"></i> <?= t('Destinatarios') ?></a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'languages.php' ? 'active' : '' ?>" href="/admin/languages.php"><i class="bi bi-translate"></i> <?= t('Idiomas') ?></a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'comandos.php' ? 'active' : '' ?>" href="/admin/comandos.php"><i class="bi bi-terminal"></i> <?= t('Comandos') ?></a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'test_discord_connection.php' ? 'active' : '' ?>" href="/admin/test_discord_connection.php"><i class="bi bi-discord"></i> Test Discord</a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'ia_agent.php' ? 'active' : '' ?>" href="/admin/ia_agent.php"><i class="bi bi-cpu"></i> Config IA</a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'test_discord_connection.php' ? 'active' : '' ?>" href="/admin/test_discord_connection.php"><i class="bi bi-discord"></i> <?= t('Test Discord') ?></a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'ia_agent.php' ? 'active' : '' ?>" href="/admin/ia_agent.php"><i class="bi bi-cpu"></i> <?= t('Config IA') ?></a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'set_webhook.php' ? 'active' : '' ?>" href="/set_webhook.php"><i class="bi bi-telegram"></i> Webhook TG</a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'chat_telegram.php' ? 'active' : '' ?>" href="/chat_telegram.php"><i class="bi bi-chat-dots"></i> Chat TG</a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'telegram_bot_interactions.php' ? 'active' : '' ?>" href="/telegram/admin/telegram_bot_interactions.php"><i class="bi bi-robot"></i> Bot Telegram</a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'telegram_welcome.php' ? 'active' : '' ?>" href="/telegram/admin/telegram_welcome.php"><i class="bi bi-person-plus"></i> Bienvenida</a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'set_webhook.php' ? 'active' : '' ?>" href="/set_webhook.php"><i class="bi bi-telegram"></i> <?= t('Webhook TG') ?></a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'chat_telegram.php' ? 'active' : '' ?>" href="/chat_telegram.php"><i class="bi bi-chat-dots"></i> <?= t('Chat TG') ?></a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'telegram_bot_interactions.php' ? 'active' : '' ?>" href="/telegram/admin/telegram_bot_interactions.php"><i class="bi bi-robot"></i> <?= t('Bot Telegram') ?></a></li>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'telegram_welcome.php' ? 'active' : '' ?>" href="/telegram/admin/telegram_welcome.php"><i class="bi bi-person-plus"></i> <?= t('Bienvenida') ?></a></li>
|
||||
<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><a class="dropdown-item <?= $currentPage === 'translate_message.php' ? 'active' : '' ?>" href="/translate_message.php"><i class="bi bi-translate"></i> <?= t('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> <?= t('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>
|
||||
<li><a class="dropdown-item <?= $currentPage === 'system.php' ? 'active' : '' ?>" href="/admin/system.php"><i class="bi bi-hdd-stack"></i> <?= t('Sistema') ?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle-military dropdown-toggle lang-selector" href="#" data-bs-toggle="dropdown" title="<?= t('Idioma') ?>">
|
||||
<?php
|
||||
$currentLangData = array_filter($activeLanguages, fn($l) => $l['language_code'] === $currentLang);
|
||||
$currentLangData = reset($currentLangData);
|
||||
if ($currentLang === 'es' || !$currentLangData) {
|
||||
echo '<span>🇲🇽</span>';
|
||||
} else {
|
||||
echo '<span>' . htmlspecialchars($currentLangData['flag_emoji']) . '</span>';
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-military dropdown-menu-end">
|
||||
<li>
|
||||
<a class="dropdown-item <?= $currentLang === 'es' ? 'active' : '' ?>" href="?lang=es">
|
||||
🇲🇽 <?= t('Español') ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php foreach ($activeLanguages as $lang): ?>
|
||||
<li>
|
||||
<a class="dropdown-item <?= $currentLang === $lang['language_code'] ? 'active' : '' ?>" href="?lang=<?= urlencode($lang['language_code']) ?>">
|
||||
<?= htmlspecialchars($lang['flag_emoji']) ?> <?= t($lang['language_name']) ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button class="btn" id="theme-toggle" title="Cambiar tema">
|
||||
<button class="btn" id="theme-toggle" title="<?= t('Cambiar tema') ?>">
|
||||
<i class="bi bi-moon-fill"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link nav-link-main <?= $currentPage === 'profile.php' ? 'active' : '' ?>" href="/profile.php">
|
||||
<i class="bi bi-person"></i> Perfil
|
||||
<i class="bi bi-person"></i> <?= t('Perfil') ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link nav-link-main" href="/logout.php">
|
||||
<i class="bi bi-box-arrow-left"></i> Salir
|
||||
<i class="bi bi-box-arrow-left"></i> <?= t('Salir') ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user