<?php if (Session::is_group_user('Playlist Admin')) { if ($_REQUEST["id"]) { $playlist = Playlists::get_by_id($_REQUEST["id"]); $playlist->delete(); if (Errors::occured()) { http_response_code(400); exit(json_encode(array("error" => "Something went wrong. You may have discovered a bug!", "detail" => Errors::report("array")))); Errors::clear(); } else { exit(json_encode(array('response' => 'success'))); } } } else { http_response_code(403); exit(json_encode(array('error' => 'Permission denied.'))); }
<?php if (Session::is_group_user("Uploader")) { $upload_handler = new UploadHandler(); }
<?php if (!Session::is_group_user("Group Admin")) { http_response_code(403); exit; } switch ($_REQUEST["action"]) { case "members": $members = array(); foreach (Groups::get_by_id($_REQUEST["group"])->get_users() as $user) { $members[$user->get_id()] = $user->get_username(); } for ($i == 1; $i <= 4; $i++) { unset($members[$i]); } // don't include system, root, nobody, guest echo json_encode($members); break; case "add-user": $group = Groups::get_by_id($_REQUEST["group"]); $user = Users::get_by_username($_REQUEST["user"]); if ($user) { $group->add_user($user); echo json_encode(array($user->get_id() => $user->get_username())); } else { echo json_encode(array(0, "")); } break; case "del-user": $group = Groups::get_by_id($_REQUEST["group"]); $user = Users::get_by_id($_REQUEST["user"]);
<?php if (is_numeric($_GET['id']) && Session::is_group_user("Email Viewer")) { $email = Emails::get_by_id($_REQUEST['id']); echo json_encode(array("subject" => $email->get_subject(), "sender" => $email->get_sender(), "message" => $email->get_body_formatted(false))); }
<?php if (Session::is_user()) { $a = AudiowallSets::get_by_id(pg_escape_string($_REQUEST['setid'])); if ($a->user_can_delete() || Session::is_group_user('Audiowalls Admin')) { $user = Users::get_by_username(pg_escape_string($_REQUEST['username'])); if (!is_null($user)) { $query = "permissions FROM aw_sets_permissions WHERE set_id = :set_id AND user_id = :user_id"; $data = array('set_id' => $a->get_id(), 'user_id' => $user->get_id()); $current = DigiplayDB::select($query, NULL, false, $data); if (!is_null($current)) { if ($_REQUEST['val'] == 'editor') { if ($current[2] == '1') { $new = '111'; } else { $new = '110'; } } elseif ($_REQUEST['val'] == 'viewer') { if ($current[2] == '1') { $new = '111'; } else { if ($current[1] == '1') { $new = '110'; } else { $new = '100'; } } } elseif ($_REQUEST['val'] == 'admin') { $new = '111'; } $data = array('permissions' => $new);
<?php if (!Session::is_group_user("Importer")) { Output::http_error(403); } else { if (!isset($_REQUEST["filename"])) { die(json_encode(array("error" => "invalid input file"))); } $uploaded_file = utf8_decode(FILE_ROOT . "uploads/" . $_REQUEST["filename"]); if (!isset($_REQUEST["type"])) { $_REQUEST["type"] = "music"; } if (!isset($_REQUEST["title"]) || $_REQUEST["title"] === "") { die(json_encode(array("error" => "You must specify a title"))); } $current_archive = Archives::get_playin(); $path = is_dir($current_archive->get_localpath()) ? $current_archive->get_localpath() : (is_dir($current_archive->get_remotepath()) ? $current_archive->get_remotepath() : die(json_encode(array('error' => 'Playin archive inaccessible')))); if (!is_writable($path)) { die(json_encode(array("error" => "Audio archive is not writable"))); } $tempfile = tempnam(sys_get_temp_dir(), 'dps') . "." . pathinfo($uploaded_file, PATHINFO_EXTENSION); copy($uploaded_file, $tempfile); $md5 = md5_file($tempfile); $output = array(); # Execute SoX to convert our audio # Trim silence from beginning and end (1% volume threshold) # Convert to 44.1kHz 16-bit stereo for consistency # Normalise to -0.1dB # Save as flac in inbox exec("sox \"" . $tempfile . "\" -b 16 \"" . $path . "/inbox/" . $md5 . ".flac\" silence 1 0.1 -72d reverse silence 1 0.1 -72d reverse channels 2 rate 44100 gain -n -0.1 2>&1", $output); if (strpos(implode($output), "FAIL")) {
echo "<strong>To flag a track for censorship, search for it in the music library, click the " . Bootstrap::glyphicon("info-sign") . " and click the \"Flag for censorship\" button.</strong>"; if ($flagged = Tracks::get_flagged()) { echo "\n<table class=\"table table-striped\" cellspacing=\"0\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th class=\"icon\"></th>\n\t\t\t<th class=\"artist\">Artist</th>\n\t\t\t<th class=\"title\">Title</th>\n\t\t\t" . (Session::is_group_user("Music Admin") ? "\n\t\t\t<th class=\"icon\"></th>" : "") . "\n\t\t</tr>\n\t</thead>"; foreach ($flagged as $flag) { echo "\n\t<tr id=\"" . $flag->get_id() . "\">\n\t\t<td class=\"icon\">\n\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $flag->get_id() . "\" class=\"track-info\">\n\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t</a>\n\t\t\t<div class=\"hover-info\">\n\t\t\t\t<strong>Artist:</strong> " . $flag->get_artists_str() . "<br />\n\t\t\t\t<strong>Album:</strong> " . $flag->get_album()->get_name() . "<br />\n\t\t\t\t<strong>Year:</strong> " . $flag->get_year() . "<br />\n\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($flag->get_length()) . "<br />\n\t\t\t\t<strong>Origin:</strong> " . $flag->get_origin() . "<br />\n\t\t\t\t" . ($flag->get_reclibid() ? "<strong>Reclib ID:</strong> " . $flag->get_reclibid() . "<br />" : "") . "\n\t\t\t</div>\n\t\t</td>\n\t\t<td class=\"artist\">" . $flag->get_artists_str() . "</td>\n\t\t<td class=\"title\">" . $flag->get_title() . "</td>\n\t\t" . (Session::is_group_user("Music Admin") ? "\n\t\t<td class=\"icon\"><a href=\"" . LINK_ABS . "music/censor/?censor=" . $flag->get_id() . "\" class=\"censor\" title=\"Approve censorship\" rel=\"twipsy\">" . Bootstrap::glyphicon("ok-sign") . "</td>\n\t\t<td class=\"icon\"><a href=\"" . LINK_ABS . "music/censor/?unflag=" . $flag->get_id() . "\" class=\"unflag\" title=\"Remove flag\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</td>" : "") . "\n\t</tr>"; } echo "\n</table>"; } else { echo "<h4>No tracks currently flagged for censorship.</h4>"; } $limit = isset($_REQUEST['n']) ? $_REQUEST['n'] : 10; $page = isset($_REQUEST['p']) ? $_REQUEST['p'] : 1; $num_of_censored = Tracks::count_censored(); if ($censored = Tracks::get_censored($limit, ($page - 1) * $limit)) { $pages = new Paginator(); $pages->items_per_page = $limit; $pages->querystring = NULL; $pages->mid_range = 5; $pages->items_total = $num_of_censored; $pages->paginate(); $low = ($page - 1) * $limit + 1; $high = $low + $limit - 1 > $num_of_censored ? $num_of_censored : $low + $limit - 1; echo "\n<h3>Censored Tracks</h3>\n<table class=\"table table-striped\" cellspacing=\"0\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th class=\"icon\"></th>\n\t\t\t<th class=\"artist\">Artist</th>\n\t\t\t<th class=\"title\">Title</th>\n\t\t\t" . (Session::is_group_user("Music Admin") ? "\n\t\t\t<th class=\"icon\"></th>" : "") . "\n\t\t</tr>\n\t</thead>"; foreach ($censored as $censor) { echo "\n\t<tr id=\"" . $censor->get_id() . "\">\n\t\t<td class=\"icon\">\n\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $censor->get_id() . "\" class=\"track-info\">\n\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t</a>\n\t\t\t<div class=\"hover-info\">\n\t\t\t\t<strong>Artist:</strong> " . $censor->get_artists_str() . "<br />\n\t\t\t\t<strong>Album:</strong> " . $censor->get_album()->get_name() . "<br />\n\t\t\t\t<strong>Year:</strong> " . $censor->get_year() . "<br />\n\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($censor->get_length()) . "<br />\n\t\t\t\t<strong>Origin:</strong> " . $censor->get_origin() . "<br />\n\t\t\t\t" . ($censor->get_reclibid() ? "<strong>Reclib ID:</strong> " . $censor->get_reclibid() . "<br />" : "") . "\n\t\t\t</div>\n\t\t</td>\n\t\t<td class=\"artist\">" . $censor->get_artists_str() . "</td>\n\t\t<td class=\"title\">" . $censor->get_title() . "</td>\n\t\t" . (Session::is_group_user("Music Admin") ? "<td class=\"icon\"><a href=\"" . LINK_ABS . "music/censor/?uncensor=" . $censor->get_id() . "\" class=\"uncensor\" title=\"Uncensor this track\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</td>" : "") . "\n\t</tr>"; } echo "\n</table>"; echo $pages->return; } else { echo "\n<strong>No censored tracks.</strong>"; }
<?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 "\n\t\t<script type=\"text/javascript\">\n\t\t\$(function () {\n\t\t\t\$('#username').focus();\n\t\t\t\$('.form-signin').submit(function(event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t\$('#submit').button('loading');\n\t\t\t\t\$('.help-inline').remove();\n\t\t\t\t\$.post('ajax/login.php', \$(this).serialize(), function(data) {\n\t\t\t\t\tif(data == \"success\") { \n\t\t\t\t\t\tlocation.reload()\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\$('#submit').after('<span class=\"help-inline\">'+data+'</span>');\n\t\t\t\t\t\t\$('#submit').button('reset');\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t});\n\t\t});\n\t\t</script>"; $feature = "\n\t\t\t<div class=\"row\">\n\t\t\t\t<div class=\"col-sm-8\">\n\t\t\t\t\t<h1>Digiplay <small>by Radio Warwick</small></h1>\n\t\t\t\t\t<p>A magical software suite run by miniature elves, which is amazing because elves are already very small by their nature.</p>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t" . (Session::is_user() ? "\n\t\t\t\t\t<h2>Common Tasks</h2>\n\t\t\t\t\t<a href=\"music/upload/\" class=\"btn btn-primary btn-large btn-block\">Upload Audio »</a>\n\t\t\t\t\t<a href=\"playlists/\" class=\"btn btn-primary btn-large btn-block\">Edit Playlists »</a>\n\t\t\t\t\t<a href=\"sustainer/\" class=\"btn btn-primary btn-large btn-block\">Schedule Prerecorded Content »</a>\n\t\t\t\t\t<a href=\"faults/\" class=\"btn btn-primary btn-large btn-block\">Report a Fault »</a>\n\t\t\t\t\t" . (Session::is_group_user("Studio Admin") ? "<a href=\"reset.php\" class=\"btn btn-primary btn-large btn-block\">Reset Playout Systems »</a>" : "") . "\n\t\t\t\t" : "\n\t\t\t\t\t<form class=\"form-signin\" action=\"ajax/login.php\" method=\"post\">\n\t\t\t\t\t\t<div class=\"form-group" . (isset($_REQUEST['refer']) ? " has-error" : "") . "\">\n\t\t\t\t\t\t\t<input id=\"username\" name=\"username\" type=\"text\" class=\"form-control input-lg\" placeholder=\"Username\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"form-group" . (isset($_REQUEST['refer']) ? " has-error" : "") . "\">\n\t\t\t\t\t\t\t<input id=\"password\" name=\"password\" type=\"password\" class=\"form-control input-lg\" placeholder=\"Password\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t\t<input type=\"submit\" class=\"btn btn-lg " . (isset($_REQUEST['refer']) ? "btn-danger" : "btn-primary") . " btn-block\" id=\"submit\" name=\"submit\" value=\"Log In\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\t\t\t\t") . "\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t"; MainTemplate::set_feature_html($feature); echo "<div class=\"row\">\n\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t<h2>Music Library</h2>\n\t\t\t\t<dl>\n\t\t\t\t\t<dt>Tracks Stored</dt>\n\t\t\t\t\t<dd>" . number_format(Tracks::get_total_tracks()) . "</dd>\n\t\t\t\t\t<dt>Length of Tracks</dt>\n\t\t\t\t\t<dd>" . Time::format_pretty(Tracks::get_total_length()) . "</dd>\n\t\t\t\t\t<dt>Playlisted Tracks</dt>\n\t\t\t\t\t<dd>" . (count(Tracks::get_playlisted()) - count(Tracks::get_playlisted(Playlists::get(0)))) . "</dd>\n\t\t\t\t</dl>\n\t\t\t</div>\n\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t<h2>Sustainer Service</h2>\n\t\t\t\t<dl>\n\t\t\t\t\t<dt>Tracks on Sustainer</dt>\n\t\t\t\t\t<dd>" . Sustainer::get_total_tracks() . "</dd>\n\t\t\t\t\t<dt>Length of Sustainer Playlist</dt>\n\t\t\t\t\t<dd>" . Sustainer::get_total_length_formatted() . "</dd>\n\t\t\t\t</dl>\n\t\t\t\t<a class=\"btn btn-primary btn-block\" href=\"" . LINK_ABS . "sustainer/\">" . Bootstrap::glyphicon("headphones") . "Now playing</a>\n\t\t\t\t<a class=\"btn btn-primary btn-block\" href=\"" . LINK_ABS . "playlists/detail/0\">" . Bootstrap::glyphicon("list") . "View playlist</a>\n\t\t\t</div>\n\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t<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 "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"icon\">\n\t\t\t\t\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $track->get_id() . "\" class=\"track-info\">\n\t\t\t\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class=\"title\">" . $track->get_title() . " by " . $track->get_artists_str() . "</td>\n\t\t\t\t\t</tr>"; } echo "\n\t\t\t\t</table>\n\t\t\t\t<a class=\"btn btn-primary btn-block\" href=\"" . LINK_ABS . "music/\">" . Bootstrap::glyphicon("chevron-right") . "More</a>\n\t\t\t</div>\n\t\t</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>"; }
<?php if (Session::is_group_user('Librarian')) { if ($_REQUEST["id"]) { $track = Tracks::get_by_id($_REQUEST["id"]); if ($track->move_to_trash()) { Search::update_index(); exit(json_encode(array('response' => 'success'))); } else { http_response_code(403); exit(json_encode(array('error' => 'Unknown error.'))); } } } else { http_response_code(403); exit(json_encode(array('error' => 'Permission denied.'))); }
<?php require_once 'pre.php'; Output::set_title("Playout Reset"); if (Session::is_group_user("Studio Admin")) { echo "<div class=\"row\">\n\t<div class=\"col-md-3 list-group\">\n\t\t<a href=\"./studio/manage?location=1\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-check\"></span> Manage Studio 1</a>\n\t\t<a href=\"./studio/manage?location=2\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-check\"></span> Manage Studio 2</a>\n\t</div>\n\t<div class=\"col-md-4 jumbotron\">\n\t\t<h1>Reset Playout 1</h1>\n\t\t<button id=\"playout1\" type=\"button\" class=\"btn btn-danger col-md-12\">Reset</button>\n\t</div>\n\t<div class=\"col-md-1\"></div>\n\t<div class=\"col-md-4 jumbotron\">\n\t\t<h1>Reset Playout 2</h1>\n\t\t<button id=\"playout2\" type=\"button\" class=\"btn btn-danger col-md-12\">Reset</button>\n\t</div>\n</div>"; echo "<script type=\"text/javascript\">\n\$('#playout1').click(function(){\n\t\$.ajax({\n\t\turl: './ajax/restart_playout1.php',\n\t\terror: function(xhr,text,error) {\n\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\talert(value.error);\n\t\t},\n\t\tsuccess: function(data,text,xhr) {\n\t\t\twindow.location.reload(true); \n\t\t}\n\t});\n\treturn(false);\n});\n\$('#playout2').click(function(){\n\t\$.ajax({\n\t\turl: './ajax/restart_playout2.php',\n\t\terror: function(xhr,text,error) {\n\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\talert(value.error);\n\t\t},\n\t\tsuccess: function(data,text,xhr) {\n\t\t\twindow.location.reload(true); \n\t\t}\n\t});\n\treturn(false);\n});\n</script>"; }
<?php if (Session::is_group_user('Playlist Editor')) { $track = Tracks::get($_REQUEST['trackid']); $playlist = Playlists::get($_REQUEST['playlistid']); $result = false; switch ($_REQUEST['action']) { case "add": $result = $playlist->add_track($track); break; case "del": $result = $playlist->del_track($track); break; } if ($result) { $new_playlists = $track->get_playlists_in(); $playlists_arr = array(); foreach ($new_playlists as $playlist) { $playlists_arr[] = $playlist->get_id(); } exit(json_encode(array('result' => 'success', 'playlists' => $playlists_arr))); } else { http_response_code(400); exit(json_encode(array('error' => 'Unable to add track to playlist.'))); } } else { http_response_code(403); }
echo "<strong>" . $track->get_title() . "</strong> by " . $track->get_artists_str() . "<br />"; } if ($count > 10) { echo "<br />and <strong>" . ($count - 10) . " more...<br />"; } echo "\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t<td class=\"title\">" . $playlist->get_name() . "</td>\n\t\t\t<td>" . count($playlist->get_tracks()) . "</td>\n\t"; if (Session::is_group_user("Playlist Admin")) { echo "\n\t\t\t<td>\n\t\t\t\t<a href=\"#\" data-toggle=\"modal\" data-target=\"#update-modal\" data-dps-id=\"" . $playlist->get_id() . "\" class=\"edit-playlist\" title=\"Edit playlist name\" rel=\"twipsy\">\n\t\t\t\t\t" . Bootstrap::glyphicon("pencil") . "\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<a href=\"#\" data-toggle=\"modal\" data-target=\"#delete-modal\" data-dps-id=\"" . $playlist->get_id() . "\" class=\"delete-playlist\" title=\"Delete this playlist\" rel=\"twipsy\">\n\t\t\t\t\t" . Bootstrap::glyphicon("remove-sign") . "\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<a href=\"#\" class=\"move\">\n\t\t\t\t\t" . Bootstrap::glyphicon("move move") . "\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t"; } echo "\n\t\t</tr>"; } echo "\n\t</tbody>\n</table>\n</div>\n</form>\n"; if (Session::is_group_user("Playlist Admin")) { echo "<h3>Sustainer playlists:</h3>"; echo "\n\t<div class=\"table-responsive\">\n\t<table class=\"table table-striped\">\n\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th class=\"icon\"></th>\n\t\t\t\t<th>Title</th>\n\t\t\t\t<th class=\"icon\">Items</th>\n\t\t\t\t<th class=\"icon\"></th>\n\t\t\t\t<th class=\"icon\"></th>\n\t\t\t\t<th class=\"icon\"></th>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody>\n\t"; foreach (Playlists::get_sustainer() as $playlist) { echo "\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"" . LINK_ABS . "playlists/detail/" . $playlist->get_id() . "\" class=\"info\">\n\t\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t\t\t\t<input type=\"hidden\" name=\"id[]\" value=\"" . $playlist->get_id() . "\">\n\t\t\t\t\t</a>\n\t\t\t\t\t<div class=\"hover-info\">\n\t\t\t\t\t"; $count = $playlist->count_tracks(); foreach ($playlist->get_tracks(10) as $track) { echo "<strong>" . $track->get_title() . "</strong> by " . $track->get_artists_str() . "<br />"; } if ($count > 10) { echo "<br />and <strong>" . ($count - 10) . " more...<br />"; } echo "\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"title\">" . $playlist->get_name() . "</td>\n\t\t\t\t<td>" . count($playlist->get_tracks()) . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"#\" data-toggle=\"modal\" data-target=\"#update-modal\" data-dps-id=\"" . $playlist->get_id() . "\" class=\"edit-playlist\" title=\"Edit playlist name\" rel=\"twipsy\">\n\t\t\t\t\t\t" . Bootstrap::glyphicon("pencil") . "\n\t\t\t\t\t</a>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"#\" data-toggle=\"modal\" data-target=\"#delete-modal\" data-dps-id=\"" . $playlist->get_id() . "\" class=\"delete-playlist\" title=\"Delete this playlist\" rel=\"twipsy\">\n\t\t\t\t\t\t" . Bootstrap::glyphicon("remove-sign") . "\n\t\t\t\t\t</a>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"#\" class=\"move\">\n\t\t\t\t\t\t" . Bootstrap::glyphicon("move move") . "\n\t\t\t\t\t</a>\n\t\t\t\t</td>\n\t\t\t</tr>"; } echo "\n\t\t</tbody>\n\t</table>\n\t</div>\n\t"; } if (Session::is_group_user("Playlist Admin")) { echo "<a href=\"#\" data-toggle=\"modal\" data-target=\"#addnew-modal\" id=\"add\">Add a new playlist »</a>" . Bootstrap::modal("addnew-modal", "\n\t\t<form class=\"form-horizontal\" action=\"" . LINK_ABS . "/ajax/add-update-playlist.php\" method=\"POST\">\n\t\t\t<fieldset>\n\t\t\t\t<div class=\"control-group\">\n\t\t\t\t\t<label class=\"control-label\" for=\"name\">Name</label>\n\t\t\t\t\t<div class=\"controls\">\n\t\t\t\t\t\t<input type=\"text\" class=\"form-control playlist-name\" id=\"name\">\n\t\t\t\t\t\t<p class=\"help-block\">Enter a name for the new playlist.</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t</form>\n\t", "Add new playlist", "<a class=\"btn btn-primary add-playlist\" href=\"#\">Save</a><a class=\"btn btn-default\" data-dismiss=\"modal\">Cancel</a>") . "</div>\n</div>" . Bootstrap::modal("update-modal", "\n\t\t<form class=\"form-horizontal\" action=\"" . LINK_ABS . "/ajax/add-update-playlist.php\" method=\"POST\">\n\t\t\t<fieldset>\n\t\t\t\t<div class=\"control-group\">\n\t\t\t\t\t<label class=\"control-label\" for=\"name\">Name</label>\n\t\t\t\t\t<div class=\"controls\">\n\t\t\t\t\t\t<input type=\"hidden\"class=\"update-id\">\n\t\t\t\t\t\t<input type=\"text\" class=\"form-control playlist-edit-name\">\n\t\t\t\t\t\t<p class=\"help-block\">Enter a name for the playlist.</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t</form>\n\t", "Edit playlist name", "<a class=\"btn btn-primary update-playlist\" href=\"#\">Save</a><a class=\"btn btn-default\" data-dismiss=\"modal\">Cancel</a>") . "</div>\n</div>" . Bootstrap::modal("delete-modal", "<p>Are you sure you want to permanently delete <span class=\"delete-playlist-title\">this playlist</span>? </p><p>(this does not delete any of the tracks on it)</p>", "Delete playlist", "<a href=\"#\" class=\"btn btn-primary yes-definitely-delete\">Yes</a> <a href=\"#\" class=\"btn btn-default\" data-dismiss=\"modal\">No</a>"); }
$tracks = Tracks::get_newest(); if ($tracks) { echo "<h3>10 newest tracks</h3>"; echo "<div class=\"table-responsive\"><table class=\"table table-striped\" cellspacing=\"0\">\r\n\t<thead>\r\n\t\t<tr>\r\n\t\t\t<th class=\"icon\"> </th>\r\n\t\t\t<th class=\"artist\">Artist</th>\r\n\t\t\t<th class=\"title\">Title</th>\r\n\t\t\t<th class=\"date-added nowrap\">Date Added</th>\r\n\t\t\t<th class=\"length nowrap\">Length</th> \r\n\t\t\t" . (Session::is_group_user("Playlist Editor") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t\t" . (Session::is_group_user("Librarian") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t</tr>\r\n\t</thead>"; foreach ($tracks as $track) { $import_date = date("d/m/Y H:i", $track->get_import_date()); echo "\r\n\t\t<tr id=\"" . $track->get_id() . "\">\r\n\t\t\t<td class=\"icon\">\r\n\t\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $track->get_id() . "\" class=\"track-info\">\r\n\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\r\n\t\t\t\t</a>\r\n\t\t\t\t<div class=\"hover-info\">\r\n\t\t\t\t\t<strong>Artist:</strong> " . $track->get_artists_str() . "<br />\r\n\t\t\t\t\t<strong>Album:</strong> " . $track->get_album()->get_name() . "<br />\r\n\t\t\t\t\t<strong>Year:</strong> " . $track->get_year() . "<br />\r\n\t\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($track->get_length()) . "<br />\r\n\t\t\t\t\t<strong>Origin:</strong> " . $track->get_origin() . "<br />\r\n\t\t\t\t\t" . ($track->get_reclibid() ? "<strong>Reclib ID:</strong> " . $track->get_reclibid() . "<br />" : "") . "\r\n\t\t\t\t\t<strong>Censored:</strong> " . ($track->is_censored() ? "Yes" : "No") . "<br /> \r\n\t\t\t\t</div>\r\n\t\t\t</td>\r\n\t\t\t<td class=\"artist\">" . $track->get_artists_str() . "</td>\r\n\t\t\t<td class=\"title\">" . $track->get_title() . "</td>\r\n\t\t\t<td class=\"date-added nowrap\">" . $import_date . "</td>\r\n\t\t\t<td class=\"length nowrap\">" . Time::format_succinct($track->get_length()) . "</td>\r\n\t\t\t"; if (Session::is_group_user("Playlist Editor")) { $playlists = array(); foreach ($track->get_playlists_in() as $playlist) { $playlists[] = $playlist->get_id(); } echo "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#playlist-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" data-playlists-in=\"" . implode(",", $playlists) . "\" class=\"playlist-add\" title=\"Add to playlist\" rel=\"twipsy\">" . Bootstrap::glyphicon("plus-sign") . "</i></a></td>"; } echo (Session::is_group_user("Librarian") ? "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#delete-modal\" data-dps-id=\"" . $track->get_id() . "\" class=\"track-delete\" title=\"Delete this track\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</i></a></td>" : "") . "\r\n\t\t</tr>"; } echo "</table></div>"; } else { echo "Sorry, no results"; } if (Session::is_group_user("Playlist Editor")) { $playlist_modal_content = "<p>Select a playlist to add/remove <span class=\"playlist-track-title\">this track</span> to/from:</p><ul class=\"nav nav-pills nav-stacked\">"; foreach (Playlists::get_all() as $playlist) { $playlist_modal_content .= "<li><a href=\"#\" class=\"playlist-select\" data-playlist-id=\"" . $playlist->get_id() . "\">" . Bootstrap::glyphicon("plus") . $playlist->get_name() . "</a></li>"; } $playlist_modal_content .= "</ul>"; echo Bootstrap::modal("playlist-modal", $playlist_modal_content, "Add to playlist", "<a href=\"#\" class=\"btn btn-primary\" data-dismiss=\"modal\">Done</a> <a href=\"" . LINK_ABS . "playlists\" class=\"btn btn-default\">Manage playlists</a>"); } if (Session::is_group_user("Librarian")) { echo Bootstrap::modal("delete-modal", "<p>Are you sure you want to move <span class=\"delete-track-title\">this track</span> to the trash?</p>", "Delete track", "<a href=\"#\" class=\"btn btn-primary yes-definitely-delete\">Yes</a> <a href=\"#\" class=\"btn btn-default\" data-dismiss=\"modal\">No</a>"); }
echo "<tr" . ($set->get_id() == $active ? ' class="success"' : '') . "><td class=\"wall-info\" >"; if ($set->user_can_delete()) { echo "<a href=\"users/users-viewers.php?setid=" . $set->get_id() . "\">" . Bootstrap::glyphicon("info-sign") . "</a>"; } echo "</td><td><strong>" . $set->get_name() . "</strong><br /><span class=\"description\">" . $set->get_description() . "</span></td>"; $station_aw = DigiplayDB::select("val FROM configuration WHERE parameter = 'station_aw_set' AND location = '1'"); if (!($set->get_id() == (int) $station_aw)) { if ($set->user_can_delete() || Session::is_group_user('Audiowalls Admin')) { echo "<td class=\"delete-aw-btn\" data-aw-name=\"" . $set->get_name() . "\" data-dps-set-id=\"" . $set->get_id() . "\" style=\"width:65px\"><a href=\"#\" class=\"btn btn-danger\">Delete</a></td>"; } else { echo "<td style=\"width:65px\"></td>"; } } else { echo "<td style=\"width:65px\"></td>"; } if ($set->user_can_edit() || Session::is_group_user('Audiowalls Admin')) { echo "<td style=\"width:65px\"><a href=\"edit.php?id=" . $set->get_id() . "\" class=\"btn btn-primary\">Edit</a></td>"; } else { echo "<td style=\"width:65px\"></td>"; } echo "<td style=\"width:185px\">"; if ($set->get_id() == $active) { echo "<a href=\"#\" class=\"btn btn-success disabled\" id=\"active-aw\" data-user-id=\"" . Session::get_id() . "\" onclick=\"javascript: return false;\">Active Personal Audiowall</a>"; } else { echo "<a href=\"#\" data-aw-id=\"" . $set->get_id() . "\" class=\"btn btn-default set-personal-audiowall\" onclick=\"javascript: return false;\">Use as Personal Audiowall</a>"; } echo "</td></tr>"; } echo "</tbody></table></div>"; echo Bootstrap::modal("add-audiowall-modal", "\n\t\t<form class=\"form-horizontal\" action=\"?\" method=\"POST\">\n\t\t\t<fieldset>\n\t\t\t\t<div class=\"control-group\">\n\t\t\t\t\t<label class=\"control-label\" for=\"audiowall-name\">Audiowall Name</label>\n\t\t\t\t\t<div class=\"controls\">\n\t\t\t\t\t\t<input type=\"text\" class=\"form-control add_aw_text\" id=\"audiowall-name\" placeholder=\"Enter audiowall title.\">\n\t\t\t\t\t</div>\n\t\t\t\t\t<br>\n\t\t\t\t\t<label class=\"control-label\" for=\"audiowall-description\">Audiowall Description</label>\n\t\t\t\t\t<div class=\"controls\">\n\t\t\t\t\t\t<textarea class=\"form-control add_aw_text\" id=\"audiowall-description\" placeholder=\"Enter audiowall description.\"></textarea>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t<input type=\"hidden\"class=\"update-id\" name=\"updateid\">\n\t\t</form>\n\t", "Create New Audiowall", "<a class=\"btn btn-success\" id=\"create-audiowall\" href=\"#\">Create New Audiowall</a><a class=\"btn btn-default\" data-dismiss=\"modal\">Cancel</a>"); echo "<div id=\"delete-audiowall-modal\" class=\"modal fade\">\n <div class=\"modal-dialog\">\n <div class=\"modal-content\"> \n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button><h4 class=\"modal-title\">Delete Audiowall</h4>\n </div>\n <div class=\"modal-body\">\n <div class=\"row\">\n <div class=\"col-md-8\">\n Are you sure you want to delete the page: \n </div>\n <div class=\"col-md-4\" id=\"wall-to-delete\"></div>\n </div>\n <p> </p>\n <div class=\"modal-footer clearfix\">\n <a href=\"#\" class=\"btn btn-primary\">Yes</a>\n <a href=\"#\" class=\"btn btn-danger\">No</a>\n </div>\n </div>\n </div>\n</div>\n</div>";
MainTemplate::set_subtitle("List tracks on a playlist, remove tracks"); $tracks = $playlist->get_tracks($limit, ($page - 1) * $limit); if ($tracks) { $pages = new Paginator(); $pages->items_per_page = $limit; $pages->querystring = $playlist->get_id(); $pages->mid_range = 5; $pages->items_total = $playlist->count_tracks(); $pages->paginate(); $low = ($page - 1) * $limit + 1; $high = $low + $limit - 1 > $pages->items_total ? $pages->items_total : $low + $limit - 1; echo "<script>\r\n\t\t\$(function () {\r\n\t\t\t\$('.track-info').popover({\r\n\t\t\t\t'html': true, \r\n\t\t\t\t'trigger': 'hover',\r\n\t\t\t\t'title': function() { \r\n\t\t\t\t\treturn(\$(this).parent().parent().find('.title').html())\r\n\t\t\t\t},\r\n\t\t\t\t'content': function() {\r\n\t\t\t\t\treturn(\$(this).parent().find('.hover-info').html());\r\n\t\t\t\t}\r\n\t\t\t});\r\n" . (Session::is_group_user("Playlist Editor") ? "\r\n\t\t\t\$('.track-remove').click(function() {\r\n\t\t\t\ttrackid = \$(this).attr('data-dps-track-id');\r\n\t\t\t\tplaylistid = \$(this).attr('data-dps-playlist-id');\r\n\t\t\t\t\$.ajax({\r\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\r\n\t\t\t\t\tdata: 'playlistid='+playlistid+'&trackid='+trackid+'&action=del',\r\n\t\t\t\t\ttype: 'POST',\r\n\t\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\t\talert(value.error);\r\n\t\t\t\t\t},\r\n\t\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\t\twindow.location.reload(true); \r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t});\r\n" : "") . "\t\t});\r\n\t</script>"; echo "<h3>Tracks on playlist '" . $playlist->get_name() . "'</h3>"; echo "<div class=\"row\"><div class=\"col-lg-5\"><h5>Showing results " . $low . " to " . $high . "</h5></div><div class=\"pull-right\">" . $pages->display_jump_menu() . $pages->display_items_per_page() . "</div></div>"; echo "<table class=\"table table-striped\" cellspacing=\"0\">\r\n\t<thead>\r\n\t\t<tr>\r\n\t\t\t<th class=\"icon\"> </th>\r\n\t\t\t<th class=\"artist\">Artist</th>\r\n\t\t\t<th class=\"title\">Title</th>\r\n\t\t\t<th class=\"album\">Album</th>\r\n\t\t\t<th class=\"length nowrap\">Length</th> \r\n\t\t\t" . (Session::is_group_user("Playlist Editor") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t</tr>\r\n\t</thead>"; foreach ($tracks as $track) { echo "\r\n\t\t<tr id=\"" . $track->get_id() . "\">\r\n\t\t\t<td class=\"icon\">\r\n\t\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $track->get_id() . "\" class=\"track-info\">\r\n\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\r\n\t\t\t\t</a>\r\n\t\t\t\t<div class=\"hover-info\">\r\n\t\t\t\t\t<strong>Artist:</strong> " . $track->get_artists_str() . "<br />\r\n\t\t\t\t\t<strong>Album:</strong> " . $track->get_album()->get_name() . "<br />\r\n\t\t\t\t\t<strong>Year:</strong> " . $track->get_year() . "<br />\r\n\t\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($track->get_length()) . "<br />\r\n\t\t\t\t\t<strong>Origin:</strong> " . $track->get_origin() . "<br />\r\n\t\t\t\t\t" . ($track->get_reclibid() ? "<strong>Reclib ID:</strong> " . $track->get_reclibid() . "<br />" : "") . "\r\n\t\t\t\t\t<strong>Censored:</strong> " . ($track->is_censored() ? "Yes" : "No") . "<br /> \r\n\t\t\t\t</div>\r\n\t\t\t</td>\r\n\t\t\t<td class=\"artist\">" . $track->get_artists_str() . "</td>\r\n\t\t\t<td class=\"title\">" . $track->get_title() . "</td>\r\n\t\t\t<td class=\"album\">" . $track->get_album()->get_name() . "</td>\r\n\t\t\t<td class=\"length nowrap\">" . Time::format_succinct($track->get_length()) . "</td>"; echo (Session::is_group_user("Playlist Editor") ? "<td class=\"icon\"><a href=\"#\" data-dps-track-id=\"" . $track->get_id() . "\" data-dps-playlist-id=\"" . $playlist->get_id() . "\" class=\"track-remove\" title=\"Remove this track\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</a></td>" : "") . "\r\n\t\t</tr>"; } echo "</table>"; echo $pages->return; } else { if ($playlist) { echo "<h3>Sorry, no tracks are on the playlist '" . $playlist->get_name() . "'</h3>"; if (Session::is_group_user("Playlist Editor")) { echo "<h4>You can add tracks by finding them in the music library and clicking the " . Bootstrap::glyphicon("plus-sign") . ".</h4>"; } } else { echo "Invalid playlist."; } }
<?php if (Session::is_group_user("Music Admin")) { $track_id = (int) $_REQUEST["id"]; $track = Audio::get_by_id($track_id); $md5 = $track->get_md5(); $archive = $track->get_archive(); $dir = $archive->get_localpath(); $folder = $md5[0]; $files = array(0 => ".flac", 1 => ".xml"); $tables = array(0 => 'audioartists', 1 => 'audiocomments', 2 => 'audiodir', 3 => 'audiogroups', 4 => 'audiojinglepkgs', 5 => 'audiokeywords', 6 => 'audioplaylists', 7 => 'audiousers'); $wherepre = "audioid = " . $track_id; $where = pg_escape_string($wherepre); $track_id_escaped = pg_escape_string($track_id); DigiplayDB::delete('audio', "id = " . $track_id_escaped); foreach ($tables as $table) { DigiplayDB::delete($table, $where); } foreach ($files as $file) { $path = $dir . "/" . $folder . "/" . $md5 . $file; $cmd = "rm " . $path; shell_exec($cmd); } if (Errors::occured()) { http_response_code(400); exit(json_encode(array("error" => "Something went wrong. You may have discovered a bug!", "detail" => Errors::report("array")))); Errors::clear(); } else { exit(json_encode(array('response' => 'success', 'id' => 1))); } } else {
public static function require_group($group) { self::require_user(); if (!Session::is_group_user($group)) { self::http_error(401); } }
<?php $session = Session::get_user(); $aw = AudiowallSets::get_by_id(pg_escape_string($_REQUEST['setid'])); $sessionpermissions = $aw->get_user_permissions($session->get_id()); if ($sessionpermissions[2] == '1' || Session::is_group_user('Audiowalls Admin')) { $ownerid = DigiplayDB::select("user_id FROM aw_sets_owner WHERE set_id = '" . $aw->get_id() . "'"); if (isset($ownerid)) { $user = Users::get_by_id($ownerid); $username = $user->get_display_name(); } else { $username = ""; } require_once 'pre.php'; Output::add_script("../aw.js"); Output::set_title("Audiowall Users"); MainTemplate::set_subtitle("<span style=\"margin-right:20px;\">Set: " . $aw->get_name() . "</span><span style=\"margin-right:20px;\">Owner: " . $username . "</span><span id=\"editor_edit_buttons\"><a href=\"#\" class=\"btn btn-success\">Add Viewer</a></span>"); echo "<style type=\"text/css\">\n\ttable { font-size:1.2em; }\n\tthead { display:none; }\n\t.description { font-size:0.8em; font-style:italic; }\n\t.hover-info { display:none; }\n\t.table tbody tr.success td { background-color: #DFF0D8; }\n\t</style>"; echo "<table class=\"table table-striped\" cellspacing=\"0\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th></th>\n\t\t\t\t\t\t<th style=\"width:65px\"></th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead><tbody>"; $aw_set = AudiowallSets::get_by_id($_REQUEST['setid']); $users = $aw_set->get_users_with_permissions(); if (!is_null($users) && count($users) > 1) { foreach ($users as $user) { $userclass = Users::get_by_id($user->get_id()); $username = $userclass->get_username(); $permissions = $aw_set->get_user_permissions($user->get_id()); if ($permissions[0] == "1" && $permissions[1] == '0') { echo "<tr><td><strong>" . $username . "</strong></td>"; echo "<td class=\"delete-aw-btn\" style=\"width:65px\"><a href=\"#\" class=\"btn btn-danger\">Delete</a></td>"; echo "</td></tr>"; }
Output::set_title("Requested Tracks"); Output::add_stylesheet(LINK_ABS . "css/music.css"); Output::add_script(LINK_ABS . "js/bootstrap-popover.js"); MainTemplate::set_subtitle("Want to play a track, but it's not in the database? Request it here"); if (isset($_REQUEST["name"]) && isset($_REQUEST["artistname"])) { $request = new Request(); $request->set_name($_REQUEST["name"]); $request->set_artist_name($_REQUEST["artistname"]); $request->set_user(Session::get_user()); $request->save(); } if (isset($_REQUEST["delete"])) { if (!Session::is_group_user("Music Admin")) { echo Bootstrap::alert_message_basic("error", "You are trying to delete a request, but you do not have the requred privelidges!", "Error!"); } else { $request = Requests::get_by_id($_REQUEST["delete"]); if ($request) { $request->delete(); } } } echo "\n<h3 style=\"margin-top: -4px\">Request a track</h3>\n<form action=\"\" method=\"post\" name=\"request-track\" class=\"form-inline\">\n\t<div class=\"form-group\">\n\t\t<input type=\"text\" name=\"artistname\" placeholder=\"Artist...\" class=\"form-control\">\n\t</div>\n\t<div class=\"form-group\">\n\t\t<input type=\"text\" name=\"name\" placeholder=\"Title...\" class=\"form-control\">\n\t</div>\n\t<div class=\"form-group\">\n\t\t<input type=\"submit\" value=\"Request\" class=\"btn btn-primary\">\n\t</div>\n</form>"; if ($requested = Requests::get_all()) { echo "\n<table class=\"table table-striped\" cellspacing=\"0\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th class=\"artist\">Artist</th>\n\t\t\t<th class=\"title\">Title</th>\n\t\t\t<th class=\"date nowrap\">Date Requested</th>\n\t\t\t<th class=\"requester nowrap\">Requester</th>\n\t\t\t" . (Session::is_group_user("Music Admin") ? "\n\t\t\t<th class=\"icon\"></th>" : "") . "\n\t\t</tr>\n\t</thead>"; foreach ($requested as $request) { echo "\n\t<tr id=\"" . $request->get_id() . "\">\n\t\t<td class=\"artist\">" . $request->get_artist_name() . "</td>\n\t\t<td class=\"title\">" . $request->get_name() . "</td>\n\t\t<td class=\"date nowrap\">" . date("d/m/Y H:i", $request->get_date()) . "</td>\n\t\t<td class=\"requester nowrap\">" . $request->get_user()->get_username() . "</td>\n\t\t" . (Session::is_group_user("Music Admin") ? "<td class=\"icon\"><a href=\"" . LINK_ABS . "music/request/?delete=" . $request->get_id() . "\" class=\"request-delete\" title=\"Delete this request\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</td>" : "") . "\n\t</tr>"; } echo "\n</table>"; } else { echo "\n<strong>No new requested tracks.</strong>"; }
<?php if (Session::is_group_user('Sustainer Admin')) { $slots = SustainerSlots::get_all(); foreach ($slots as $slot) { $compareValue = "slot-" . $slot->get_day() . "-" . $slot->get_time(); if ($compareValue == $_REQUEST["updateid"]) { $prerecordText = "Currently this hour is scheduled with the <b>" . Playlists::get_by_id($slot->get_playlist_id())->get_name() . "</b> playlist"; if ($slot->get_audio_id() != NULL) { $prerecordText .= " <i>AND</i> the prerecord <b>" . Prerecs::get_by_id($slot->get_audio_id())->get_title() . "</b> is scheduled."; } else { $prerecordText .= " <b>AND</b> there is no prerecord scheduled."; } break; } } if (Errors::occured()) { http_response_code(400); exit(json_encode(array("error" => "Something went wrong. You may have discovered a bug!", "detail" => Errors::report("array")))); Errors::clear(); } else { exit(json_encode(array('response' => 'success', 'status' => $prerecordText))); } } else { http_response_code(403); exit(json_encode(array('error' => 'Permission denied.'))); }
<?php if (Session::is_user()) { // Require a description for all audiowalls // Makes it easier for audiowall admins to manage if ($_REQUEST["awdescription"] == "") { http_response_code(400); exit(json_encode(array("error" => "Audiowall description missing", "detail" => "You must provide a description for the audiowall"))); Errors::clear(); } // Query number of audiowalls that the user currently has // If an audiowall already exists for that user, deny creation $numberOfAudiowalls = AudiowallSets::count_by_user(); if ($numberOfAudiowalls > 0 && !Session::is_group_user('Audiowalls Admin')) { http_response_code(400); exit(json_encode(array("error" => "Audiowall limit exceeded", "detail" => "You are limited to a single audiowall"))); Errors::clear(); } $aw_set = new AudiowallSet(); $aw_set->set_name(pg_escape_string($_REQUEST["awname"])); $aw_set->set_description(pg_escape_string($_REQUEST["awdescription"])); $aw_set->save(); // Add audiowall owner to the database $data = array('user_id' => Session::get_id(), 'set_id' => $aw_set->get_id()); DigiplayDB::insert("aw_sets_owner", $data); // Add audiowall permissions to current user // The bitmask is as follows (view, edit, delete) where a value of 1 grants the permission // INSERT INTO aw_sets_permissions (user_id, set_id, permissions) VALUES (Session::get_id(), $aw_set->get_id(), '111'); $data = array('user_id' => Session::get_id(), 'set_id' => $aw_set->get_id(), 'permissions' => '111'); DigiplayDB::insert("aw_sets_permissions", $data); if (Errors::occured()) {