Auto commit: 2026-02-19T18:04:59.724Z
This commit is contained in:
parent
a24dbf6e16
commit
1dc006d161
@ -59,6 +59,24 @@ if ($method === 'POST') {
|
||||
}
|
||||
}
|
||||
|
||||
// Send Email Notification
|
||||
try {
|
||||
require_once __DIR__ . '/../mail/MailService.php';
|
||||
$subject = "Nueva Petición de Canción: $artist - $song";
|
||||
$htmlBody = "
|
||||
<h3>Nueva Petición de Canción</h3>
|
||||
<p><strong>De:</strong> $requester</p>
|
||||
<p><strong>Artista:</strong> $artist</p>
|
||||
<p><strong>Canción:</strong> $song</p>
|
||||
<p><strong>Fuente:</strong> $source</p>
|
||||
<p><strong>Fecha:</strong> " . date('Y-m-d H:i:s') . "</p>
|
||||
";
|
||||
MailService::sendMail(null, $subject, $htmlBody);
|
||||
} catch (Exception $e) {
|
||||
// Silently fail email but log it
|
||||
error_log("Email request failed: " . $e->getMessage());
|
||||
}
|
||||
|
||||
// Check if this user is now the #1 listener of the week
|
||||
$topStmt = $db->query("
|
||||
SELECT requester, COUNT(*) as total_requests
|
||||
|
||||
129
index.php
129
index.php
@ -1652,7 +1652,7 @@ $twitter_link = "https://twitter.com/";
|
||||
<button onclick="openShopModal()" style="background: linear-gradient(135deg, #facc15, #fbbf24); border: none; color: #000; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 0 15px rgba(250, 204, 21, 0.4); transition: all 0.3s; z-index: 101;" title="Tienda de la Radio">
|
||||
<i class="bi bi-shop"></i>
|
||||
</button>
|
||||
<button onclick="toggleTheme()" id="theme-toggle" style="background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-color); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(5px); transition: all 0.3s;" title="Cambiar tema">
|
||||
<button onclick="toggleTheme()" id="theme-toggle" style="background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-color); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(5px); transition: all 0.3s;" title="Cambiar modo claro/oscuro">
|
||||
<i class="bi bi-moon-fill"></i>
|
||||
</button>
|
||||
<a href="history.php" style="background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-color); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(5px); transition: all 0.3s; text-decoration: none;" title="Historial de canciones">
|
||||
@ -1665,6 +1665,16 @@ $twitter_link = "https://twitter.com/";
|
||||
</div>
|
||||
<h1>Lili Records</h1>
|
||||
<p>Siente la música, vive el ritmo.</p>
|
||||
<div style="display: flex; justify-content: center; margin-top: 1rem;">
|
||||
<div class="theme-switch-wrapper" onclick="toggleTheme()" style="display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.05); padding: 5px 15px; border-radius: 20px; cursor: pointer; border: 1px solid var(--glass-border); transition: all 0.3s;">
|
||||
<i class="bi bi-sun-fill" style="font-size: 0.9rem; color: #facc15;"></i>
|
||||
<div style="width: 40px; height: 20px; background: rgba(255,255,255,0.2); border-radius: 10px; position: relative;">
|
||||
<div id="theme-switch-dot" style="position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: white; border-radius: 50%; transition: all 0.3s;"></div>
|
||||
</div>
|
||||
<i class="bi bi-moon-fill" style="font-size: 0.9rem; color: #94a3b8;"></i>
|
||||
<span style="font-size: 0.7rem; font-weight: 700; text-transform: uppercase; margin-left: 5px;">Modo Oscuro</span>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="radio-player">
|
||||
@ -1887,6 +1897,31 @@ $twitter_link = "https://twitter.com/";
|
||||
|
||||
<!-- Interaction Center: Live Chat -->
|
||||
<section class="interaction-center">
|
||||
<!-- New Dedicated Request Section -->
|
||||
<div class="glass-card mb-4" style="margin-bottom: 1.5rem; background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(0, 200, 83, 0.1)); border-color: var(--primary-color);">
|
||||
<h3 style="font-size: 1.3rem; margin-bottom: 1rem; color: #fff; display: flex; align-items: center; gap: 10px;">
|
||||
<i class="bi bi-music-note-beamed" style="color: var(--primary-color);"></i> ¿QUÉ QUIERES ESCUCHAR?
|
||||
</h3>
|
||||
<p style="font-size: 0.8rem; opacity: 0.8; margin-bottom: 1.2rem;">Envía tu petición o saludo. ¡Te leeremos en vivo y te notificaremos por email!</p>
|
||||
<div class="interaction-form" style="margin-top: 0;">
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label for="req-artist-new">ARTISTA</label>
|
||||
<input type="text" id="req-artist-new" placeholder="Ej: Bad Bunny">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="req-song-new">CANCIÓN / SALUDO</label>
|
||||
<input type="text" id="req-song-new" placeholder="Ej: Tití Me Preguntó">
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; gap: 1rem; margin-top: 1rem;">
|
||||
<button onclick="submitSongRequestNew()" id="submit-req-btn-new" style="flex: 2; background: var(--primary-color); color: white; border: none; padding: 1rem; border-radius: 12px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.8rem; transition: all 0.3s; box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);">
|
||||
<i class="bi bi-send-check-fill"></i> ENVIAR PETICIÓN
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Live Web Chat -->
|
||||
<div class="glass-card chat-window" style="height: 500px; display: flex; flex-direction: column;">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem;">
|
||||
@ -1931,26 +1966,6 @@ $twitter_link = "https://twitter.com/";
|
||||
<h3 style="font-size: 1.2rem; margin-bottom: 1rem; color: var(--accent-color);">
|
||||
<i class="bi bi-music-note-beamed"></i> PETICIONES EN VIVO
|
||||
</h3>
|
||||
<div class="interaction-form" style="margin-bottom: 1.5rem; background: rgba(255,255,255,0.03); padding: 1rem; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05);">
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label for="req-artist">ARTISTA</label>
|
||||
<input type="text" id="req-artist" placeholder="Ej: Bad Bunny">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="req-song">CANCIÓN</label>
|
||||
<input type="text" id="req-song" placeholder="Ej: Tití Me Preguntó">
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; gap: 0.8rem; margin-top: 0.8rem;">
|
||||
<button onclick="submitSongRequest()" id="submit-req-btn" style="flex: 1; background: var(--primary-color); color: white; border: none; padding: 0.8rem; border-radius: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.5rem; transition: all 0.3s;">
|
||||
<i class="bi bi-plus-circle-fill"></i> PEDIR CANCIÓN
|
||||
</button>
|
||||
<button onclick="sendToWhatsApp()" style="flex: 1; background: #25D366; color: white; border: none; padding: 0.8rem; border-radius: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.5rem; transition: all 0.3s;">
|
||||
<i class="bi bi-whatsapp"></i> POR WHATSAPP
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="song-requests-list" class="request-list">
|
||||
<div style="opacity: 0.5; font-size: 0.85rem; text-align: center; padding: 2rem;">No hay peticiones recientes.</div>
|
||||
</div>
|
||||
@ -2886,6 +2901,71 @@ $twitter_link = "https://twitter.com/";
|
||||
// --- End Chat Functionality ---
|
||||
|
||||
// --- Song Request Functionality ---
|
||||
async function submitSongRequestNew() {
|
||||
const artistInput = document.getElementById('req-artist-new');
|
||||
const songInput = document.getElementById('req-song-new');
|
||||
const artist = artistInput.value.trim();
|
||||
const song = songInput.value.trim();
|
||||
const requester = document.getElementById('user-name').value.trim() || 'Anónimo';
|
||||
|
||||
if (!artist || !song) {
|
||||
alert('Por favor, ingresa el artista y el nombre de la canción o saludo.');
|
||||
if (!artist) artistInput.style.borderColor = '#ff4444';
|
||||
if (!song) songInput.style.borderColor = '#ff4444';
|
||||
return;
|
||||
}
|
||||
|
||||
const btn = document.getElementById('submit-req-btn-new');
|
||||
const originalContent = btn.innerHTML;
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<i class="bi bi-hourglass-split"></i> PROCESANDO...';
|
||||
|
||||
try {
|
||||
const formData = new FormData();
|
||||
formData.append('artist', artist);
|
||||
formData.append('song', song);
|
||||
formData.append('requester', requester);
|
||||
formData.append('source', 'web_dedicated');
|
||||
|
||||
const response = await fetch('api/song_requests.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
const result = await response.json();
|
||||
if (result.success) {
|
||||
artistInput.value = '';
|
||||
songInput.value = '';
|
||||
artistInput.style.borderColor = '';
|
||||
songInput.style.borderColor = '';
|
||||
|
||||
if (typeof fetchSongRequests === 'function') fetchSongRequests();
|
||||
|
||||
btn.innerHTML = '<i class="bi bi-check-circle-fill"></i> ¡ENVIADO CON ÉXITO!';
|
||||
btn.style.backgroundColor = 'var(--accent-color)';
|
||||
|
||||
confetti({
|
||||
particleCount: 150,
|
||||
spread: 70,
|
||||
origin: { y: 0.6 }
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = originalContent;
|
||||
btn.style.backgroundColor = '';
|
||||
}, 3000);
|
||||
} else {
|
||||
alert('Error: ' + (result.error || 'No se pudo enviar la petición'));
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = originalContent;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error submitting request:', error);
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = originalContent;
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchSongRequests() {
|
||||
try {
|
||||
const response = await fetch('api/song_requests.php');
|
||||
@ -3679,6 +3759,7 @@ $twitter_link = "https://twitter.com/";
|
||||
const currentTheme = body.getAttribute('data-theme');
|
||||
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
|
||||
const themeBtn = document.getElementById('theme-toggle').querySelector('i');
|
||||
const switchDot = document.getElementById('theme-switch-dot');
|
||||
|
||||
body.setAttribute('data-theme', newTheme);
|
||||
localStorage.setItem('theme', newTheme);
|
||||
@ -3686,20 +3767,26 @@ $twitter_link = "https://twitter.com/";
|
||||
if (newTheme === 'light') {
|
||||
themeBtn.classList.remove('bi-moon-fill');
|
||||
themeBtn.classList.add('bi-sun-fill');
|
||||
if (switchDot) switchDot.style.left = '2px';
|
||||
} else {
|
||||
themeBtn.classList.remove('bi-sun-fill');
|
||||
themeBtn.classList.add('bi-moon-fill');
|
||||
if (switchDot) switchDot.style.left = '22px';
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize Theme
|
||||
(function() {
|
||||
const savedTheme = localStorage.getItem('theme') || 'dark';
|
||||
const switchDot = document.getElementById('theme-switch-dot');
|
||||
if (savedTheme === 'light') {
|
||||
document.body.setAttribute('data-theme', 'light');
|
||||
const themeBtn = document.getElementById('theme-toggle').querySelector('i');
|
||||
themeBtn.classList.remove('bi-moon-fill');
|
||||
themeBtn.classList.add('bi-sun-fill');
|
||||
if (switchDot) switchDot.style.left = '2px';
|
||||
} else {
|
||||
if (switchDot) switchDot.style.left = '22px';
|
||||
}
|
||||
|
||||
// Welcome logic for new users
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user