forked from k3x/VoteMPD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajax.php
executable file
·102 lines (99 loc) · 3.48 KB
/
ajax.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
require("includes/settings.php");
require("includes/functions.php");
// error on no action
if(!isset($_GET["action"])) {
doError("No action specified");
}
//specify what to do on which action
switch($_GET["action"]) {
case("showhighscore"):
$r = doShowhighscore();
if($r===false) doError("Error while getting highscore");
else doOutput($r,"showhighscore");
break;
case("search"):
if(!isset($_POST["keyword"])) doError("No keyword specified");
$r = doSearch($_POST["keyword"]);
if($r===false) doError("Error while searching");
else doOutput($r,"search");
break;
case("vote"):
if(!isset($_GET["id"])) doError("No id specified");
$r = doVote($_SERVER['REMOTE_ADDR'],$_GET["id"]);
doOutput($r,"vote");
break;
case("getmyvotes"):
$r = doGetmyvotes();
if($r===false) doError("Error while getting your votes");
else doOutput($r,"getmyvotes");
break;
case("getnextsong"):
doOutput(getNextsongInHighscore(),"getnextsong");
break;
case("mpdcurrent"):
$r = getMpdCurrentSong();
if($r===false) doError("mpdcurrent failed");
else doOutput($r,"mpdcurrent");
break;
case("getfolderpic"):
if(!isset($_GET["id"])) doError("No id specified");
$folder = getFolderPic($_GET["id"]);
header('Content-type:image/png');
echo $folder->picture;
break;
case("browse-folders"):
if(!isset($_GET["id"])) doError("No id specified");
doOutput(getBrowseFolder(intval($_GET["id"])),"browse-folders");
break;
case("browse-artists"):
if(!isset($_POST["name"])) doError("No post-name specified");
doOutput(getBrowseArtist($_POST["name"]),"browse-artists");
break;
case("browse-albums"):
if(!isset($_POST["name"])) doError("No post-name specified");
doOutput(getBrowseAlbum($_POST["name"]),"browse-albums");
break;
case("browse-playlists"):
if(!isset($_POST["name"])) doError("No post-name specified");
doOutput(getBrowsePlaylist($_POST["name"]),"browse-playlists");
break;
case("browse-often-playlists"):
doOutput(getBrowseOftenPlaylist(),"browse-often-playlists");
break;
case("browse-often-played"):
doOutput(getBrowseOftenPlayed(),"browse-often-played");
break;
case("browse-often-votes"):
doOutput(getBrowseOftenVote(),"browse-often-votes");
break;
case("browse-playlog"):
doOutput(getBrowsePlaylog(),"browse-playlog");
break;
case("vote-skip-check"):
doOutput(getVoteSkipCheck(),"vote-skip-check");
break;
case("vote-skip-action"):
doOutput(getVoteSkipAction(),"vote-skip-action");
break;
case("upload-file"):
doUploadFile();
break;
case("download-file"):
doOutput(doDownloadFilelist(),"download-file");
break;
case("download-file-do"):
if(!isset($_GET["id"])) doError("No id specified");
doDownloadFileDo($_GET["id"]);
break;
case("download-playlist"):
if(!isset($_GET["name"])) doError("No name specified");
doDownloadPlaylistDo($_GET["name"]);
break;
case("remove-my-vote"):
if(!isset($_GET["id"])) doError("No id specified");
doOutput(doRemoveMyVote($_SERVER['REMOTE_ADDR'],$_GET["id"]),"remove-my-vote");
break;
default: doError("No valid action specified");
}
?>