This repository has been archived by the owner on Dec 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.php
executable file
·120 lines (114 loc) · 5.26 KB
/
index.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
if(isset($_REQUEST['refer']) && Session::is_user()) {
$refer = preg_replace('/\&/', '?', $_REQUEST["refer"], 1);
header("Location: ".LINK_ABS.$refer);
}
MainTemplate::set_feature_image(LINK_ABS."img/homepage.png");
echo("
<script type=\"text/javascript\">
$(function () {
$('#username').focus();
$('.form-signin').submit(function(event) {
event.preventDefault();
$('#submit').button('loading');
$('.help-inline').remove();
$.post('ajax/login.php', $(this).serialize(), function(data) {
if(data == \"success\") {
location.reload()
} else {
$('#submit').after('<span class=\"help-inline\">'+data+'</span>');
$('#submit').button('reset');
}
})
});
});
</script>");
$feature = "
<div class=\"row\">
<div class=\"col-sm-8\">
<h1>Digiplay <small>by Radio Warwick</small></h1>
<p>A magical software suite run by miniature elves, which is amazing because elves are already very small by their nature.</p>
</div>
<div class=\"col-sm-4\">
".((Session::is_user())? "
<h2>Common Tasks</h2>
".((Session::is_group_user("Importer")) ? "<a href=\"music/upload/\" class=\"btn btn-primary btn-large btn-block\">".Bootstrap::fontawesome("upload", "fa-lg fa-fw fa-pull-left")."Upload Audio</a>" : "")."
<a href=\"playlists/\" class=\"btn btn-primary btn-large btn-block\">".Bootstrap::fontawesome("list-ul", "fa-lg fa-fw fa-pull-left")."View Playlists</a>
".((Session::is_group_user("Sustainer Admin")) ? "<a href=\"sustainer/schedule.php\" class=\"btn btn-primary btn-large btn-block\">".Bootstrap::fontawesome("clock", "fa-lg fa-fw fa-pull-left")."Schedule Prerecorded Content</a>" : "")."
<a href=\"faults/\" class=\"btn btn-primary btn-large btn-block\">".Bootstrap::fontawesome("exclamation-triangle", "fa-lg fa-fw fa-pull-left")."Report a Fault</a>
".((Session::is_group_user("Studio Admin")) ? "<a href=\"reset.php\" class=\"btn btn-primary btn-large btn-block\">".Bootstrap::fontawesome("power-off", "fa-lg fa-fw fa-pull-left")."Manage Playout Systems</a>" : "")."
":"
<form class=\"form-signin\" action=\"ajax/login.php\" method=\"post\">
<div class=\"form-group".(isset($_REQUEST['refer'])? " has-error" : "")."\">
<input id=\"username\" name=\"username\" type=\"text\" class=\"form-control input-lg\" placeholder=\"Username\">
</div>
<div class=\"form-group".(isset($_REQUEST['refer'])? " has-error" : "")."\">
<input id=\"password\" name=\"password\" type=\"password\" class=\"form-control input-lg\" placeholder=\"Password\">
</div>
<div class=\"form-group\">
<input type=\"submit\" class=\"btn btn-lg ".(isset($_REQUEST['refer'])? "btn-danger" : "btn-primary")." btn-block\" id=\"submit\" name=\"submit\" value=\"Log In\">
</div>
</form>
")."
</div>
</div>
";
MainTemplate::set_feature_html($feature);
echo("<div class=\"row\">
<div class=\"col-sm-4\">
<h2>Music Library</h2>
<dl>
<dt>Tracks Stored</dt>
<dd>".number_format(Tracks::get_total_tracks())."</dd>
<dt>Length of Tracks</dt>
<dd>".Time::format_pretty(Tracks::get_total_length())."</dd>
<dt>Playlisted Tracks</dt>
<dd>".(count(Tracks::get_playlisted()) - count(Tracks::get_playlisted(Playlists::get(0))))."</dd>
</dl>
</div>
<div class=\"col-sm-4\">
<h2>Sustainer Service</h2>
<dl>
<dt>Tracks on Sustainer</dt>
<dd>".Sustainer::get_total_tracks()."</dd>
<dt>Length of Sustainer Playlist</dt>
<dd>".Sustainer::get_total_length_formatted()."</dd>
</dl>
");
if(Session::is_group_user("Sustainer Admin")) {
echo("<a class=\"btn btn-primary btn-block\" href=\"".LINK_ABS."sustainer/\">".Bootstrap::fontawesome("headphones", "fa-lg fa-fw fa-pull-left")."Sustainer Control Centre</a>");
}
echo("<a class=\"btn btn-primary btn-block\" href=\"".LINK_ABS."playlists/detail/0\">".Bootstrap::fontawesome("list-ul", "fa-lg fa-fw fa-pull-left")."View Sustainer Playlist</a>
</div>
<div class=\"col-sm-4\">
<h2>Newest Tracks</h2>");
$tracks = Tracks::get_newest(4);
echo("<table class=\"table table-striped table-hover table-condensed\" cellspacing=\"0\">");
foreach($tracks as $track) {
echo("
<tr>
<td class=\"icon\">
<a href=\"".LINK_ABS."music/detail/".$track->get_id()."\" class=\"track-info\">
".Bootstrap::fontawesome("info-circle")."
</a>
</td>
<td class=\"title\">".$track->get_title()." by ".$track->get_artists_str()."</td>
</tr>");
}
echo("
</table>
<a class=\"btn btn-primary btn-block\" href=\"".LINK_ABS."music/\">".Bootstrap::fontawesome("chevron-circle-right", "fa-lg fa-fw fa-pull-left")."More</a>
</div>
</div>");
if(Session::is_user()) {
$lastlogin = Session::get_lastlogin();
if($lastlogin) echo("<p class=\"text-success\">You last logged in: ".strftime("%A %e %B %G %H:%M", $lastlogin)."</p>");
else echo ("<p class=\"text-success\">You've never logged in before! Welcome to the Digiplay Web Management System.</p>");
echo"<h4>Tracks of the Day:</h4><ul>";
$tracks = Tracks::get_tracks_of_the_day(3);
foreach( $tracks as $track ) {
echo"<li><a href=\"music/detail/".$track->get_id()."\">".$track->get_artists_str()." - ".$track->get_title()."</a></li>";
}
echo "</ul>";
};
?>