forked from radiowarwick/digiplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·104 lines (101 loc) · 3.97 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
<?php
require_once('pre.php');
$masthead = "<h1>Digiplay, from Radio Warwick</h1><p>A magical software suite run by miniature elves, which is amazing because elves are already very small by their nature.</p>";
MainTemplate::set_masthead($masthead);
function total_track_time($time_arr) {
$time_str = ($time_arr["days"])? $time_arr["days"]." days, " : "";
$time_str .= ($time_arr["hours"])? $time_arr["hours"]." hours, " : "";
$time_str .= ($time_arr["minutes"])? $time_arr["minutes"]." minutes, " : "";
$time_str .= ($time_arr["seconds"])? $time_arr["seconds"]." seconds" : "";
return $time_str;
}
$refer = preg_replace('/\&/', '?', $_REQUEST["refer"], 1);
if(isset($_REQUEST['refer']) && Session::is_user()) header("Location: ".SITE_LINK_ABS.$refer);
?>
<script type="text/javascript">
$(function () {
$('#username').focus();
$('.login-form').submit(function(event) {
event.preventDefault();
$('#submit').button('loading');
$('.help-inline').remove();
$.post('ajax/login', $(this).serialize(), function(data) {
if(data == "success") {
location.reload()
} else {
$('#submit').after('<span class="help-inline">'+data+'</span>');
$('#submit').button('reset');
}
})
});
});
</script>
<?php
MainTemplate::set_summary("
<div class=\"row\">
<div class=\"span4\">
<h3>Music Library</h3>
<dl>
<dt>Tracks Stored</dt>
<dd>".number_format(Tracks::get_total_tracks())."</dd>
<dt>Length of Tracks</dt>
<dd>".total_track_time(Time::seconds_to_dhms(Tracks::get_total_length()))."</dd>
<dt>Playlisted Tracks</dt>
<dd>".count(Tracks::get_playlisted())."</dd>
</dl>
</div>
<div class=\"span4\">
<h3>Sustainer Service</h3>
<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>
</div>
<div class=\"span4\">
".((Session::is_user())? "
<h3>Common Tasks</h3>
<a href=\"upload\" class=\"btn-primary btn\">Upload Audio »</a>
<a href=\"playlists\" class=\"btn-primary btn\">Edit Playlists »</a>
<a href=\"sue/schedule\" class=\"btn-primary btn\">Schedule Prerecorded Content »</a>
":"
<h3>Log In".(isset($_REQUEST['refer'])? "<small class=\"error\" style=\"font-size: 0.7em\"> to access restricted content</small>" : "")."</h3><br />
<form class=\"login-form form-horizontal\" action=\"ajax/login\" method=\"post\">
<fieldset>
<div class=\"control-group".(isset($_REQUEST['refer'])? " error" : "")."\">
<label for=\"username\" class=\"control-label\">Username</label>
<div class=\"controls\">
<input id=\"username\" name=\"username\" type=\"text\" class=\"required\">
</div>
</div>
<div class=\"control-group".(isset($_REQUEST['refer'])? " error" : "")."\">
<label for=\"password\" class=\"control-label\">Password</label>
<div class=\"controls\">
<input id=\"password\" name=\"password\" type=\"password\" class=\"required\">
</div>
</div>
<div class=\"control-group\">
<div class=\"controls\">
<input type=\"submit\" class=\"btn btn-primary\" id=\"submit\" name=\"submit\" value=\"Log In\">
</div>
</div>
</fieldset>
</form>
")."
</div>
</div>");
if(Session::is_user()) {
Output::set_title("Welcome, ".Session::get_first_name());
MainTemplate::set_subtitle("Enjoying your day?");
$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>";
};
?>