From 1dc006d161de534fd01d13006619c1e2c615984e Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Thu, 19 Feb 2026 18:04:59 +0000 Subject: [PATCH] Auto commit: 2026-02-19T18:04:59.724Z --- api/song_requests.php | 18 ++++++ index.php | 129 +++++++++++++++++++++++++++++++++++------- 2 files changed, 126 insertions(+), 21 deletions(-) diff --git a/api/song_requests.php b/api/song_requests.php index 136b6cf..491f511 100644 --- a/api/song_requests.php +++ b/api/song_requests.php @@ -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 = " +

Nueva Petición de Canción

+

De: $requester

+

Artista: $artist

+

Canción: $song

+

Fuente: $source

+

Fecha: " . date('Y-m-d H:i:s') . "

+ "; + 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 diff --git a/index.php b/index.php index 018ab95..4f80eec 100644 --- a/index.php +++ b/index.php @@ -1652,7 +1652,7 @@ $twitter_link = "https://twitter.com/"; - @@ -1665,6 +1665,16 @@ $twitter_link = "https://twitter.com/";

Lili Records

Siente la música, vive el ritmo.

+
+
+ +
+
+
+ + Modo Oscuro +
+
@@ -1887,6 +1897,31 @@ $twitter_link = "https://twitter.com/";
+ +
+

+ ¿QUÉ QUIERES ESCUCHAR? +

+

Envía tu petición o saludo. ¡Te leeremos en vivo y te notificaremos por email!

+
+
+
+ + +
+
+ + +
+
+
+ +
+
+
+
@@ -1931,26 +1966,6 @@ $twitter_link = "https://twitter.com/";

PETICIONES EN VIVO

-
-
-
- - -
-
- - -
-
-
- - -
-
No hay peticiones recientes.
@@ -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 = ' 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 = ' ¡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