From 0f2f22b2809603a4225d1b524ea24dfa7c093c66 Mon Sep 17 00:00:00 2001 From: Junior Date: Sat, 18 Apr 2020 14:50:06 -0400 Subject: [PATCH] Make christmas songs impossible to queue when it isn't December --- ajax_queuesong.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ajax_queuesong.php b/ajax_queuesong.php index 2c70cf1..b895b23 100644 --- a/ajax_queuesong.php +++ b/ajax_queuesong.php @@ -5,13 +5,14 @@ require 'header.php'; if ( !isset($_REQUEST['songid']) ) { exit(); } -$songid = intval($_REQUEST['songid']); +$song = new Song($_REQUEST['songid']); +if ( (substr($song->getPath(), 0, 10) == "Christmas/") && (intval(date("n")) != 12) ) exit(); if ( $_SESSION['queuetarget'] == 0 ) { $query = "INSERT INTO " . INSTANTQTABLE . " (songid) VALUES(:songid)"; $sth = $globaldbh->prepare($query); $fields = array(); - $fields[':songid'] = $songid; + $fields[':songid'] = $song->getID(); $sth->execute($fields); } else { if ( RESTRICTQUEUES && (substr($_SERVER['REMOTE_ADDR'], 0, strlen(LOCALNETWORK)) != LOCALNETWORK) ) exit(); @@ -19,7 +20,7 @@ if ( $_SESSION['queuetarget'] == 0 ) { $sth = $globaldbh->prepare($query); $fields = array(); $fields[':qid'] = $_SESSION['queuetarget']; - $fields[':songid'] = $songid; + $fields[':songid'] = $song->getID(); $sth->execute($fields); }