Make christmas songs impossible to queue when it isn't December

This commit is contained in:
Junior 2020-04-18 14:50:06 -04:00
parent e3d2333dde
commit 0f2f22b280

View File

@ -5,13 +5,14 @@ require 'header.php';
if ( !isset($_REQUEST['songid']) ) { if ( !isset($_REQUEST['songid']) ) {
exit(); 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 ) { if ( $_SESSION['queuetarget'] == 0 ) {
$query = "INSERT INTO " . INSTANTQTABLE . " (songid) VALUES(:songid)"; $query = "INSERT INTO " . INSTANTQTABLE . " (songid) VALUES(:songid)";
$sth = $globaldbh->prepare($query); $sth = $globaldbh->prepare($query);
$fields = array(); $fields = array();
$fields[':songid'] = $songid; $fields[':songid'] = $song->getID();
$sth->execute($fields); $sth->execute($fields);
} else { } else {
if ( RESTRICTQUEUES && (substr($_SERVER['REMOTE_ADDR'], 0, strlen(LOCALNETWORK)) != LOCALNETWORK) ) exit(); if ( RESTRICTQUEUES && (substr($_SERVER['REMOTE_ADDR'], 0, strlen(LOCALNETWORK)) != LOCALNETWORK) ) exit();
@ -19,7 +20,7 @@ if ( $_SESSION['queuetarget'] == 0 ) {
$sth = $globaldbh->prepare($query); $sth = $globaldbh->prepare($query);
$fields = array(); $fields = array();
$fields[':qid'] = $_SESSION['queuetarget']; $fields[':qid'] = $_SESSION['queuetarget'];
$fields[':songid'] = $songid; $fields[':songid'] = $song->getID();
$sth->execute($fields); $sth->execute($fields);
} }