Added shufflebutton

This commit is contained in:
Kasper Rynning-Tønnesen
2015-02-09 23:41:16 +01:00
parent d8e1e1511e
commit e2cb71d1af
5 changed files with 39 additions and 12 deletions

View File

@@ -24,11 +24,11 @@ $save = false; //declares t
if(isset($_REQUEST['shuffle'])){ //shuffle songs in list
$q = $data["conf"];
$q = array_key_exists("addsongs", $q);
$q = array_key_exists("adminpass", $q);
$pass = htmlspecialchars($_GET['pass']);
$x = explode("/", htmlspecialchars(strtolower($_SERVER["REQUEST_URI"])));
$pass=crypt($pass, '$6$rounds=9001$'.$x[1].'Fuck0ffuSn34kyn!ggerzZ$');
if($pass == $data['conf']['adminpass'] || $data['conf']['addsongs'] == "false" || $q != 1) {
if($pass == $data["conf"]["adminpass"]) {
//shuffle($data["songs"]);
foreach($data["songs"] as $k=>$v) {
@@ -39,7 +39,8 @@ if(isset($_REQUEST['shuffle'])){ //shuffle songs in list
array_multisort($sort['votes'], SORT_DESC, $sort['added'], SORT_ASC, $data["songs"]);
file_put_contents($list, json_encode($data));
//die("shuffeled");
echo "shuffled";
die();
}else{
die("wrong!");
}

View File

@@ -15,13 +15,11 @@ foreach($dir as $files){
$time_lasted = time() - filemtime('./lists/'.$files);
if($time_lasted > $to)
{
$file = file_get_contents('./lists/'.$files); //Checking if the channel has the setting for showing on the frontpage set to true.
$file = file_get_contents('./lists/'.$files);
$data = json_decode($file, TRUE);
$q = array_values($data["nowPlaying"]);
if($q[0]["id"] == "30H2Z8Lr-4c");
{
unlink("./lists/".$files);
}
}
if($time_lasted < $time){
$file = file_get_contents('./lists/'.$files); //Checking if the channel has the setting for showing on the frontpage set to true.

View File

@@ -1,4 +1,4 @@
<b>Admin Panel</b> <span id="setpass"></span>
<b>Admin Panel</b> <span id="setpass"></span><input type="button" class="button" value="Shuffle" onclick="shuffle(this.form);" title="Shuffle the playlist">
<form id="adminForm" onsubmit="return false" name="ufo" action="" class="daform nomargin" id="base">
<div class="toggles">
@@ -41,7 +41,6 @@
categories allowed<br>
songs after playing<br>
</div>
<input type="password" name="pass" id="passbox" class="passbox" placeholder="Password">
<input type="submit" class="button" value="Login/Save" onclick="submitAdmin(this.form);" title="Save settings/Login">
<input type="submit" class="button" value="Login/Save" onclick="submitAdmin(this.form);" title="Save settings/Login">
</form>