protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $loc = 1; $sql = "SELECT v_tree_aw_sets.*, aw_sets_users.user_id AS userid\n from v_tree_aw_sets LEFT OUTER JOIN aw_sets_users\n ON aw_sets_users.set_id = v_tree_aw_sets.id\n\t\t\tWHERE v_tree_aw_sets.userid = " . $cfg['DPS']['systemUserID'] . " \n\t\t\t\tAND v_tree_aw_sets.permissions & B'" . $cfg['DPS']['fileR'] . "' = '" . $cfg['DPS']['fileR'] . "'"; // station awsets $awsets = $db->getAll($sql); $sql = "SELECT val FROM configuration \n\t\t\tWHERE location = {$loc} \n\t\t\t\tAND parameter = 'station_aw_set'"; $userset = $db->getOne($sql); foreach ($awsets as &$awset) { if ($userset == $awset['id']) { $awset['active'] = 't'; } else { $awset['active'] = 'f'; } $sql = "SELECT BIT_OR(permissions) \n\t\t\t\tFROM v_tree_dir \n\t\t\t\tWHERE v_tree_dir.id = {$awset['parent']}\n\t\t\t\t\tAND v_tree_dir.userid = {$cfg['DPS']['systemUserID']}"; $awset['parentperm'] = $db->getOne($sql); $awset['userid'] = AuthUtil::getUsername($awset['userid']); } $this->assign('access_playlist', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 33), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('awsets', $awsets); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $scriptID = pg_escape_string($this->fieldData['scriptID']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $date = time(); if (is_numeric($scriptID)) { $script_query = "SELECT bit_or(permissions) \n\t\t\t\tFROM v_tree_script\n\t\t\t\tWHERE id = {$scriptID}\n\t\t\t\t\tAND userid = {$userID}"; $checkScripts = $db->getOne($script_query); if (substr($checkScripts, 0, 1) == "1") { if (substr($checkScripts, 1, 1) == "1") { $this->assign('write', 't'); } else { $this->assign('write', 'f'); } $script_sql = "SELECT * FROM scripts WHERE id = " . $scriptID; $script = $db->getRow($script_sql); $script['m'] = (int) ($script['length'] / 60); $script['s'] = $script['length'] - $script['m'] * 60; $script['niceProducer'] = AuthUtil::getUsername($script['creator']); $this->assign('script', $script); } else { $this->assign('error', 'You do not have permission to edit that script.'); } } else { $this->assign('error', 'Invalid Show ID supplied'); } $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $count_query = "SELECT count(*) FROM requests"; $requestedNum = $db->getOne($count_query); $query = "SELECT * FROM requests ORDER BY date DESC"; $requestedResult = $db->getAll($query); $i = 0; foreach ($requestedResult as $key => &$track) { $track['number'] = $i; $track['rtime'] = date("m/d/y", $track['date']); $track['user'] = AuthUtil::getUsername($track['userid']); $i++; } $trackCount = $i; $auth = Auth::getInstance(); $userID = $auth->getUserID(); $this->assign('CensorTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 30), $userID)); $this->assign('RequestTrack', 't'); $this->assign('RemoveRequestTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 29), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('requestedTracks', $requestedResult); $this->assign('requestedNum', $requestedNum); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $auth = Auth::getInstance(); $ID = $this->fieldData['guid']; $realmID = substr($this->fieldData['id'], 3); $type = $this->fieldData['treeUser']; if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) { header("Content-type: application/xhtml+xml"); } else { header("Content-type: text/xml"); } if ($type == 'group') { $treeInfo = AuthSubRealmViewer::singleRealmTree($realmID, $ID, true); } else { $treeInfo = AuthSubRealmViewer::singleRealmTree($realmID, $ID, false); } echo "<?xml version='1.0' encoding='iso-8859-1'?>\n"; if ($realmID == 0) { $realmID = 0; } else { $realmID = "rlm" . $realmID; } $treeInfo = '<tree id="' . $realmID . '">' . $treeInfo . '</tree>'; echo $treeInfo; }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $trackIDs = explode(";", $this->fieldData['trackID']); $tracksDetails = array(); foreach ($trackIDs as $trackID) { $sql = "SELECT audio.*, albums.name AS album \n\t\t\tFROM audio, albums \n\t\t\tWHERE audio.music_album = albums.id \n\t\t\t\tAND audio.id = " . pg_escape_string($trackID); $trackDetails = $db->getRow($sql); $sql = "SELECT DISTINCT artists.name AS name \n\t\t\tFROM artists, audioartists \n\t\t\tWHERE audioartists.audioid = " . pg_escape_string($trackID) . " \n\t\t\t\tAND audioartists.artistid = artists.id"; $trackDetails['artist'] = $db->getColumn($sql); $sql = "SELECT DISTINCT keywords.name AS name \n\t\t\tFROM keywords, audiokeywords \n\t\t\tWHERE audiokeywords.audioid = " . pg_escape_string($trackID) . " \n\t\t\t\tAND audiokeywords.keywordid = keywords.id"; $trackDetails['keywords'] = $db->getColumn($sql); $samples = $trackDetails['length_smpl']; $trackDetails['length'] = $tracksLen = round($samples / 44100 / 60) . "mins " . $samples / 44100 % 60 . "secs."; $sql = "SELECT * FROM audiocomments \n\t\t\tWHERE audioid = " . pg_escape_string($trackID) . " \n\t\t\tORDER BY creationdate ASC"; $trackDetails['comments'] = $db->getAll($sql); foreach ($trackDetails['comments'] as &$comment) { $comment['username'] = AuthUtil::getUsername($comment['userid']); $comment['comment'] = str_replace("\n", "<br>", $comment['comment']); $comment['ctime'] = substr($comment['creationdate'], 0, 10); } $tracksDetails[] = $trackDetails; } $auth = Auth::getInstance(); $userID = $auth->getUserID(); $this->assign('RequestTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 29), $userID)); $this->assign('Access_CommentTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 34), $userID)); $this->assign('Access_EditTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 27), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('tracksDetails', $tracksDetails); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $trackid = $this->fieldData['trackID']; if (is_numeric($trackid)) { $query = "SELECT title, artist, md5, path FROM v_audio \n\t\t\t\tWHERE id = " . $trackid; $file = $db->getRow($query); //$filename = escapeshellarg($file['path']) . "/" . // escapeshellarg($file['md5'][0]) . "/" . // escapeshellarg($file['md5']); $filename = $file['path'] . "/" . $file['md5'][0] . "/" . $file['md5']; header('Pragma: public'); header('Expires: 0'); header('Content-Transfer-Encoding: binary'); #header('Cache-Control: no-store,no-cache,must-revalidate'); header('Content-Length: 180373'); $fileN = str_replace(' ', '_', $file['title']) . '-' . str_replace(' ', '_', $file['artist']) . '.mp3'; $fileN = str_replace('"', "", $fileN); $headstr = 'Content-Disposition: attachment; filename="' . $fileN . "\""; header($headstr); header('Content-type: audio/mpeg'); passthru($cfg['general']['toolkitRoot'] . "/DPS/encode-digiplay-file.sh " . $filename); } }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $scriptID = pg_escape_string($this->fieldData['scriptID']); if (!is_numeric($scriptID)) { $this->assign('permError', 't'); } else { $sql = "SELECT count(*) FROM v_tree_script\n\t\t\t\tWHERE id = {$scriptID}\n\t\t\t\t\tAND\tuserid = {$userID}\n\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'"; if ($db->getOne($sql) > 0) { $sql = "SELECT dirid FROM scriptsdir\n\t\t\t\t\tWHERE scriptid = {$scriptID}"; $dirID = $db->getOne($sql); "SELECT count(*) FROM v_tree_dir\n\t\t\t\t\tWHERE id = {$dirID}\n\t\t\t\t\t\tAND\tuserid = {$userID}\n\t\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'"; if ($db->getOne($sql) > 0) { $flag = true; } } if ($flag) { $sql = "SELECT * FROM scripts WHERE id = {$scriptID}"; $script = $db->getRow($sql); $sql = "SELECT count(*) FROM v_tree_script\n\t\t\t\t\tWHERE id = {$scriptID}\n\t\t\t\t\t\tAND\tuserid = {$userID}\n\t\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileO'] . "' = '" . $cfg['DPS']['fileO'] . "'"; $check = $db->getOne($sql); if ($check > 0) { $this->assign('own', 't'); } $this->assign('script', $script); $this->assign('treeType', ''); } else { $this->assign('permError', 't'); } } }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $dirID = pg_escape_string($this->fieldData['rootdir']); if (!is_numeric($dirID)) { $this->assign('permError', 't'); } else { $flag = false; $sql = "SELECT count(*) FROM v_tree_dir\n\t\t\t\tWHERE id = {$dirID}\n\t\t\t\t\tAND\tuserid = {$userID}\n\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'"; if ($db->getOne($sql) > 0) { $flag = true; } if ($flag) { $sql = "SELECT * FROM dir WHERE id = {$dirID}"; $folder = $db->getRow($sql); $this->assign('folder', $folder); } else { $this->assign('permError', 't'); } } }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); //Sue playing now/next $query = "SELECT audio.title AS title, audio.id AS id \n\t\t\tFROM sustschedule, audio \n\t\t\tWHERE sustschedule.audioid = audio.id \n\t\t\tORDER BY sustschedule.id asc"; $suePlaylist = $db->getAll($query); foreach ($suePlaylist as $key => &$track) { $sql = "SELECT DISTINCT artists.name AS name \n\t\t\t\tFROM artists, audioartists \n\t\t\t\tWHERE audioartists.audioid = " . $track['id'] . " \n\t\t\t\t\tAND audioartists.artistid = artists.id"; $artists = $db->getAll($sql); foreach ($artists as $artist) { $track['artist'] = $track['artist'] . $artist['name'] . " & "; } $track['artist'] = rtrim($track['artist'], " & "); } $auth = Auth::getInstance(); $userID = $auth->getUserID(); $this->assign('Access_ViewSue', AuthUtil::getDetailedUserrealmAccess(array(58, 60, 3), $userID)); $this->assign('Access_EditSue', AuthUtil::getDetailedUserrealmAccess(array(58, 60, 66), $userID)); $this->assign('Access_SueStats', AuthUtil::getDetailedUserrealmAccess(array(58, 60, 2), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('storedTracks', $systemTracks); $this->assign('sueLastTrack', $suePlaylist[0]); $this->assign('sueNextTrack', $suePlaylist[1]); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $audioID = pg_escape_string($this->fieldData['audioID']); $sql = "SELECT jinglepkgid FROM audiojinglepkgs WHERE audioid = {$audioID}"; $jinglepkgID = $db->getOne($sql); $sql = "SELECT name FROM jinglepkgs WHERE id = {$jinglepkgID}"; $currentpkg = $db->getOne($sql); if ($currentpkg == '') { $currentpkg = 'Default'; } $sql = "SELECT title FROM audio WHERE id = {$audioID}"; $jinglename = $db->getOne($sql); $sql = "SELECT name, id FROM jinglepkgs"; $jinglepkgs = $db->getAll($sql); $this->assign('access_playlist', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 33), $userID)); $this->assign('access_sue', AuthUtil::getDetailedUserrealmAccess(array(24, 20, 3), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('jinglepkgs', $jinglepkgs); $this->assign('currentpkg', $currentpkg); $this->assign('currentpkgid', $jinglepkgID); $this->assign('jinglename', $jinglename); $this->assign('jingleID', $audioID); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $dirID = substr($this->fieldData['id'], 3); $type = $this->fieldData['treeUser']; if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) { header("Content-type: application/xhtml+xml"); } else { header("Content-type: text/xml"); } if ($type == 'group') { $treeInfo = DPS::singleGroupTreeSetup($dirID, $cfg['Auth']['defaultNewUserGroup'], $this->fieldData['treeType']); } else { $treeInfo = DPS::singleTreeSetup($dirID, $userID, $this->fieldData['treeType']); } echo "<?xml version='1.0' encoding='iso-8859-1'?>\n"; if ($dirID == 1) { $dirID = 0; } else { $dirID = "dir" . $dirID; } $treeInfo = '<tree id="' . $dirID . '">' . $treeInfo . '</tree>'; echo $treeInfo; }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $loginTplID = MVCUtils::getTemplateID('login.tpl'); $this->assign('fwdtid', end($this->templateIDStack)); $this->assign('loginTplID', $loginTplID); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $offset = $this->fieldData['dpsSearchPage']; if ($offset == "") { $offset = 0; } else { $offset--; } $searchValue = trim($this->fieldData['dpsSearchVal']); $searchType = $this->fieldData['dpsSearchType']; $letter = pg_escape_string($this->fieldData['dpsSearchLetter']); if ($searchType == '' && $letter != '') { if ($letter == "*") { $searchType = 'Number'; } else { $searchType = 'Letter'; } } if ($this->fieldData['dpsSortType'] != '') { $sesh = Session::getInstance(); $sortType = $this->fieldData['dpsSortType']; $sesh->setValue("dpsSortType", $sortType); } else { $sesh = Session::getInstance(); if ($sesh->keyExists("dpsSortType")) { $sortType = $sesh->getValue("dpsSortType"); } else { $sortType = "title"; } } if ($searchValue != '') { $searchResult = DPS::searchAudio($searchValue, $searchType, $sortType, $offset, ''); $rNum = DPS::searchPageAudio($searchValue, $searchType, ''); $searchInfo = "Found {$rNum} results matching your query"; } $pages = ceil($rNum / $cfg['DPS']['resultLimit']); //fill the $pageArray array with values from 1 to $pages $pageArray = range(1, $pages); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $this->assign('RequestTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 29), $userID)); $this->assign('CensorTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 30), $userID)); $this->assign('ReportTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 43), $userID)); $this->assign('EditTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 27), $userID)); $this->assign('DeleteTrack', AuthUtil::getDetailedUserrealmAccess(array(2, 21, 32), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('page', $offset); $this->assign('searchResult', $searchResult); $this->assign('searchInfo', $searchInfo); $this->assign('pages', $pageArray); $this->assign('searchType', $searchType); $this->assign('searchValue', $searchValue); $this->assign('sortType', $sortType); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $this->assign('treeType', 'jacspmr'); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); }
protected function setupTemplate() { parent::setupTemplate(); global $cfg; $db = Database::getInstance($cfg['DPS']['dsn']); $sql = "SELECT DISTINCT location as locid, location as locname \n\t\t\tFROM configuration \n\t\t\tWHERE location != -1 AND \n\t\t\t\tlocation != 0\n\t\t\tORDER BY location ASC"; $locs = $db->getAll($sql); $this->assign('locs', $locs); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $this->assign('RequestTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 29), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $trackID = $this->fieldData['trackID']; $auth = Auth::getInstance(); $userID = $auth->getUserID(); //As there is no general audio view $sql = "SELECT count(*) FROM v_tree_jingle \n\t\t\tWHERE id = " . pg_escape_string($trackID) . " \n\t\t\t\tAND userid = " . $userID . " \n\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'"; $check = $db->getOne($sql); $sql = "SELECT count(*) FROM v_tree_advert \n\t\t\tWHERE id = " . pg_escape_string($trackID) . " \n\t\t\t\tAND userid = " . $userID . " \n\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'"; $check = $check + $db->getOne($sql); $sql = "SELECT count(*) FROM v_tree_prerec \n\t\t\tWHERE id = " . pg_escape_string($trackID) . " \n\t\t\t\tAND userid = " . $userID . " \n\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'"; $check = $check + $db->getOne($sql); if ($check < 1) { $this->assign('authError', 't'); } else { $sql = "SELECT audio.* FROM audio \n\t\t\t\tWHERE audio.id = " . pg_escape_string($trackID); $trackDetails = $db->getRow($sql); $sql = "SELECT DISTINCT artists.name AS name, artists.id AS id \n\t\t\t\tFROM artists, audioartists \n\t\t\t\tWHERE audioartists.audioid = " . pg_escape_string($trackID) . " \n\t\t\t\t\tAND audioartists.artistid = artists.id"; $trackDetails['artist'] = $db->getAll($sql); $i = 0; foreach ($trackDetails['artist'] as &$artist) { $artist['number'] = $i; $i++; } $artistNum = $i; $sql = "SELECT DISTINCT keywords.name AS name, keywords.id AS id \n\t\t\t\tFROM keywords, audiokeywords \n\t\t\t\tWHERE audiokeywords.track = " . pg_escape_string($trackID) . " \n\t\t\t\t\tAND audiokeywords.keyword = keywords.id"; $trackDetails['keywords'] = $db->getAll($sql); $i = 0; foreach ($trackDetails['keywords'] as &$keyword) { $keyword['number'] = $i; $i++; } $keywordNum = $i; $samples = $trackDetails['length_smpl']; $trackDetails['length'] = $tracksLen = floor($samples / 44100 / 60) . "mins " . $samples / 44100 % 60 . "secs."; $sql = "SELECT * from audiocomments \n\t\t\t\tWHERE audioid = " . pg_escape_string($trackID) . "\n\t\t\t\tORDER BY creationdate ASC"; $trackDetails['comments'] = $db->getAll($sql); foreach ($trackDetails['comments'] as &$comment) { $comment['username'] = AuthUtil::getUsername($comment['userid']); $comment['comment'] = str_replace("\n", "<br>", $comment['comment']); $comment['ctime'] = substr($comment['creationdate'], 0, 10); } $this->assign('trackDetails', $trackDetails); $this->assign('keywordNum', $keywordNum); $this->assign('artistNum', $artistNum); $this->assign('trackID', $trackID); } $this->assign('access_playlist', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 33), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('studioAccess', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 34), $userID)); }
protected function setupTemplate() { parent::setupTemplate(); global $cfg; $db = Database::getInstance($cfg['DPS']['dsn']); $sql = "SELECT * FROM configuration ORDER BY location, parameter ASC"; $configs = $db->getAll($sql); $sql = "SELECT DISTINCT location FROM configuration ORDER BY location ASC"; $locs = $db->getAll($sql); $this->assign('configs', $configs); $this->assign('locs', $locs); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); if ($userID == $cfg['Auth']['anonuserID']) { $this->assign('Guest', 't'); } else { $this->assign('Guest', 'f'); } }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); //System Track count $query = "SELECT count(audio.id) FROM audio"; $systemTracks = $db->getOne($query); //System Track length $query = "SELECT sum(audio.length_smpl) FROM audio"; $systemSamps = $db->getOne($query); $days = floor($systemSamps / 44100 / 60 / 60 / 24); $hours = floor($systemSamps / 44100 / 60 / 60 - $days * 24); $mins = round($systemSamps / 44100 / 60 - $hours * 60 - $days * 24 * 60); $systemLength = $days . "days " . $hours . "h " . $mins . "m"; //Sue Track count $query = "SELECT count(audio.id) FROM audio WHERE sustainer = 't'"; $sueTracks = $db->getOne($query); //Sue Track length $query = "SELECT sum(audio.length_smpl) FROM audio WHERE sustainer = 't'"; $sueSamps = $db->getOne($query); $days = floor($sueSamps / 44100 / 60 / 60 / 24); $hours = floor($sueSamps / 44100 / 60 / 60 - $days * 24); $mins = round($sueSamps / 44100 / 60 - $hours * 60 - $days * 24 * 60); $sueLength = $days . "days " . $hours . "h " . $mins . "m"; //Sue playing now/next $query = "SELECT audio.title AS title, audio.id AS id \n\t\tFROM sustschedule, audio \n\t\tWHERE sustschedule.audioid = audio.id \n\t\tORDER BY sustschedule.id asc"; $suePlaylist = $db->getAll($query); foreach ($suePlaylist as $key => &$track) { $sql = "SELECT DISTINCT artists.name as name \n\t\t\tFROM artists, audioartists \n\t\t\tWHERE audioartists.audioid = " . $track['id'] . " AND\n\t\t\t\taudioartists.artistid = artists.id"; $artists = $db->getAll($sql); foreach ($artists as $artist) { $track['artist'] = $track['artist'] . $artist['name'] . " & "; } $track['artist'] = rtrim($track['artist'], " & "); } $auth = Auth::getInstance(); $userID = $auth->getUserID(); $this->assign('Access_EditSue', AuthUtil::getDetailedUserrealmAccess(array(24, 20, 3), $userID)); $this->assign('Access_ViewSue', AuthUtil::getDetailedUserrealmAccess(array(26, 20, 3), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('storedTracks', $systemTracks); $this->assign('lengthOfTracks', $systemLength); $this->assign('suePlaylistTracks', $sueTracks); $this->assign('suePlaylistLength', $sueLength); $this->assign('sueLastTrack', $suePlaylist[0]); $this->assign('sueNextTrack', $suePlaylist[1]); $this->assign('suePlaylist', $suePlaylist); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $loc = 1; $sql = "SELECT * from jinglepkgs ORDER BY name"; $jinglepkgs = $db->getAll($sql); $this->assign('access_playlist', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 33), $userID)); $this->assign('access_sue', AuthUtil::getDetailedUserrealmAccess(array(3, 20, 24), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('jinglepkgs', $jinglepkgs); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $jinglepkgID = pg_escape_string($this->fieldData['jinglepkgID']); $sql = "SELECT * FROM jinglepkgs WHERE id = {$jinglepkgID}"; $jinglepkg = $db->getRow($sql); $sql = "SELECT audio.title, audio.id FROM audio INNER JOIN audiojinglepkgs ON audio.id = audiojinglepkgs.audioid WHERE audiojinglepkgs.jinglepkgid = {$jinglepkgID} ORDER BY audio.title"; $jingles = $db->getAll($sql); $this->assign('access_playlist', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 33), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('jinglepkg', $jinglepkg); $this->assign('jingles', $jingles); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $count_query = "SELECT count(audio.id) \n\t\tFROM audio \n\t\tWHERE audio.flagged='t'"; $flaggedNum = $db->getOne($count_query); $query = "SELECT DISTINCT audio.title AS title, audio.id AS id \n\t\tFROM audio \n\t\tWHERE audio.flagged='t'"; $flaggedResult = $db->getAll($query); $i = 0; foreach ($flaggedResult as $key => &$track) { $sql = "SELECT DISTINCT artists.name AS name \n\t\t\tFROM artists, audioartists \n\t\t\tWHERE audioartists.audioid = " . $track['id'] . " \n\t\t\t\tAND audioartists.artistid = artists.id"; $artists = $db->getAll($sql); foreach ($artists as $artist) { $track['artist'] = $track['artist'] . $artist['name'] . " & "; } $track['artist'] = rtrim($track['artist'], " & "); $track['searchNumber'] = $i; $i++; } $count_query = "SELECT count(audio.id) \n\t\tFROM audio \n\t\tWHERE audio.censor='t'"; $censoredNum = $db->getOne($count_query); $query = "SELECT DISTINCT audio.title AS title, audio.id AS id \n\t\tFROM audio \n\t\tWHERE audio.censor='t'"; $censoredResult = $db->getAll($query); $i = 0; foreach ($censoredResult as $key => &$track) { $sql = "SELECT DISTINCT artists.name AS name \n\t\t\tFROM artists, audioartists \n\t\t\tWHERE audioartists.audioid = " . $track['id'] . " \n\t\t\t\tAND audioartists.artistid = artists.id"; $artists = $db->getAll($sql); foreach ($artists as $artist) { $track['artist'] = $track['artist'] . $artist['name'] . " & "; } $track['artist'] = rtrim($track['artist'], " & "); $track['searchNumber'] = $i; $i++; } $auth = Auth::getInstance(); $userID = $auth->getUserID(); $this->assign('RequestTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 29), $userID)); $this->assign('CensorTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 30), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('flaggedTracks', $flaggedResult); $this->assign('censoredTracks', $censoredResult); $this->assign('flagNum', $flaggedNum); $this->assign('censorNum', $censoredNum); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $dirID = pg_escape_string($this->fieldData['rootdir']); if (!is_numeric($dirID)) { $this->assign('permError', 't'); } else { $flag = false; $sql = "SELECT count(*) FROM v_tree_dir\n\t\t\t\tWHERE id = {$dirID}\n\t\t\t\t\tAND\tuserid = {$userID}\n\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'"; if ($db->getOne($sql) > 0) { $flag = true; } if ($flag) { $sql = "SELECT * FROM dir WHERE id = {$dirID}"; $folder = $db->getRow($sql); $sql = "SELECT count(*) FROM v_tree_dir\n\t\t\t\t\tWHERE id = {$dirID}\n\t\t\t\t\t\tAND\tuserid = {$userID}\n\t\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileO'] . "' = '" . $cfg['DPS']['fileO'] . "'"; if ($db->getOne($sql) > 0) { $this->assign('dirown', 't'); } $sql = "SELECT bit_or(permissions) FROM (SELECT bit_or(permissions) AS permissions \n\t\t\t\t\tFROM v_tree_dir_explicit \n\t\t\t\t\tWHERE causetype = 'group'\n\t\t\t\t\t\tAND cause = " . $cfg['Auth']['defaultNewUserGroup'] . "\n\t\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileR'] . "' = '" . $cfg['DPS']['fileR'] . "') AS Q1 \n\t\t\t\tUNION (SELECT bit_or(permissions) AS permissions \n\t\t\t\t\tFROM v_tree_dir_inherited \n\t\t\t\t\tWHERE causetype = 'group'\n\t\t\t\t\t\tAND cause = " . $cfg['Auth']['defaultNewUserGroup'] . "\n\t\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileR'] . "' = '" . $cfg['DPS']['fileR'] . "')"; $perm = $db->getOne($sql); if ($perm[0] == "1") { $this->assign('dirpub', 't'); } $sql = "SELECT bit_or(permissions) FROM dirgroups\n\t\t\t\t\tWHERE dirid = {$dirID}\n\t\t\t\t\t\tAND groupid = " . $cfg['Auth']['defaultNewUserGroup']; $perm = $db->getOne($sql); if ($perm[1] == "1") { $this->assign('dirrw', 't'); } elseif ($perm[0] == "1") { $this->assign('dirr', 't'); } else { $this->assign('priv', 't'); } $this->assign('folder', $folder); } else { $this->assign('permError', 't'); } } }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $trackID = $this->fieldData['audioID']; if (!is_numeric($trackID)) { $this->assign('permError', 't'); } else { //As there is no general audio view $sql = "SELECT count(*) FROM v_tree_jingle \n\t\t\t\tWHERE id = " . pg_escape_string($trackID) . " \n\t\t\t\t\tAND userid = " . $userID . " \n\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'"; $check = $db->getOne($sql); $sql = "SELECT count(*) FROM v_tree_advert \n\t\t\t\tWHERE id = " . pg_escape_string($trackID) . " \n\t\t\t\t\tAND userid = " . $userID . " \n\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'"; $check = $check + $db->getOne($sql); $sql = "SELECT count(*) FROM v_tree_prerec \n\t\t\t\tWHERE id = " . pg_escape_string($trackID) . " \n\t\t\t\t\tAND userid = " . $userID . " \n\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'"; $check = $check + $db->getOne($sql); if ($check > 0) { $flag = true; } if ($flag) { $sql = "SELECT * FROM audio \n\t\t\t\t\tWHERE id = " . pg_escape_string($trackID); $audio = $db->getRow($sql); //As there is no general audio view $sql = "SELECT count(*) FROM v_tree_jingle \n\t\t\t\t\tWHERE id = " . pg_escape_string($trackID) . " \n\t\t\t\t\t\tAND userid = " . $userID . " \n\t\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileO'] . "' = '" . $cfg['DPS']['fileO'] . "'"; $check = $db->getOne($sql); $sql = "SELECT count(*) FROM v_tree_advert \n\t\t\t\t\tWHERE id = " . pg_escape_string($trackID) . " \n\t\t\t\t\t\tAND userid = " . $userID . " \n\t\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileO'] . "' = '" . $cfg['DPS']['fileO'] . "'"; $check = $check + $db->getOne($sql); $sql = "SELECT count(*) FROM v_tree_prerec \n\t\t\t\t\tWHERE id = " . pg_escape_string($trackID) . " \n\t\t\t\t\t\tAND userid = " . $userID . " \n\t\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileO'] . "' = '" . $cfg['DPS']['fileO'] . "'"; $check = $check + $db->getOne($sql); if ($check > 0) { $this->assign('own', 't'); } $this->assign('audio', $audio); $this->assign('treeType', ''); } else { $this->assign('permError', 't'); } } }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $sql = "SELECT\n playlists.id, playlists.name, count(audioplaylists.id) AS count\n FROM\n playlists\n LEFT OUTER JOIN\n audioplaylists\n ON\n playlists.id = audioplaylists.playlistid\n GROUP BY\n playlists.id, playlists.name\n ORDER BY\n playlists.name"; $playlists = $db->getAll($sql); $playlist = null; $playlistID = $this->fieldData['dpsPlaylistID']; if ($playlistID != '') { $sql = "SELECT * FROM playlists WHERE id = {$playlistID}"; $playlist = $db->getRow($sql); } $auth = Auth::getInstance(); $userID = $auth->getUserID(); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('studioAccess', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 33), $userID)); $this->assign('playlists', $playlists); $this->assign('playlist', $playlist); $this->assign('Action', $this->fieldData['dpsAction']); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $date = time(); $show_query = "SELECT DISTINCT showplans.*, v_tree_showplan.permissions \n\t\t\tFROM showplans, v_tree_showplan \n\t\t\tWHERE showplans.id = v_tree_showplan.id AND \n\t\t\t\tv_tree_showplan.userid = {$userID} AND \n\t\t\t\tshowplans.showdate >= " . $date . " AND \n\t\t\t\tv_tree_showplan.permissions & B'" . $cfg['DPS']['fileR'] . "' = '" . $cfg['DPS']['fileR'] . "' \n\t\t\tORDER BY name asc"; $partShows = $db->getAll($show_query); $show_query = "SELECT DISTINCT showplans.*, v_tree_showplan.permissions \n\t\t\tFROM showplans, v_tree_showplan \n\t\t\tWHERE showplans.id = v_tree_showplan.id AND \n\t\t\t\tv_tree_showplan.userid = {$userID} AND \n\t\t\t\tshowplans.showdate < " . $date . " AND \n\t\t\t\tv_tree_showplan.permissions & B'" . $cfg['DPS']['fileR'] . "' = '" . $cfg['DPS']['fileR'] . "' \n\t\t\tORDER BY name asc"; $doneShows = $db->getAll($show_query); foreach ($partShows as &$show) { $show['niceAirDate'] = date("d/m/y", $show['showdate']); $show['niceAirTime'] = date("H:i", $show['showdate']); $show['niceCreateDate'] = date("d/m/y", $show['creationdate']); $show['niceCreateTime'] = date("H:i", $show['creationdate']); $show['text'] = $show['name'] . " - " . $show['niceAirDate'] . " - " . $show['niceAirTime'] . " (" . AuthUtil::getUsername($show['userid']) . ")"; $sql = "SELECT BIT_OR(v_tree_dir.permissions) \n\t\t\t\tFROM v_tree_showplan, v_tree_dir \n\t\t\t\tWHERE v_tree_showplan.id = {$show['id']}\n\t\t\t\t\tAND v_tree_showplan.parent = v_tree_dir.id\n\t\t\t\t\tAND v_tree_dir.userid = {$userID}"; $show['parentperm'] = $db->getOne($sql); } foreach ($doneShows as &$show) { $show['niceAirDate'] = date("d/m/y", $show['showdate']); $show['niceAirTime'] = date("H:i", $show['showdate']); $show['niceCreateDate'] = date("d/m/y", $show['creationdate']); $show['niceCreateTime'] = date("H:i", $show['creationdate']); $show['text'] = $show['name'] . " - " . $show['niceAirDate'] . " - " . $show['niceAirTime'] . " (" . AuthUtil::getUsername($show['userid']) . ")"; $sql = "SELECT BIT_OR(v_tree_dir.permissions) \n\t\t\t\tFROM v_tree_showplan, v_tree_dir \n\t\t\t\tWHERE v_tree_showplan.id = {$show['id']}\n\t\t\t\t\tAND v_tree_showplan.parent = v_tree_dir.id\n\t\t\t\t\tAND v_tree_dir.userid = {$userID}"; $show['parentperm'] = $db->getOne($sql); } $pShowCount = count($partShows); $dShowCount = count($doneShows); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('partShows', $partShows); $this->assign('pShowCount', $pShowCount); $this->assign('doneShows', $doneShows); $this->assign('dShowCount', $dShowCount); $this->assign('deleteID', $this->fieldData['deleteID']); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $date = time(); $script_query = "SELECT scripts.*, v_tree_script.permissions\n\t\t\t\tFROM v_tree_script, scripts\n\t\t\t\tWHERE v_tree_script.userid = {$userID}\n\t\t\t\t\tAND v_tree_script.id = scripts.id\n\t\t\t\t\tAND v_tree_script.permissions & B'{$cfg['DPS']['fileR']}' = '{$cfg['DPS']['fileR']}'\n\t\t\tORDER BY scripts.name asc"; $scripts = $db->getAll($script_query); $scriptCount = count($scripts); foreach ($scripts as &$script) { $script['niceCreateDate'] = date("d/m/y", $script['creationdate']); $script['niceCreateTime'] = date("g a", $script['creationdate']); $script['text'] = $script['name'] . " - " . $script['niceCreateDate'] . " - " . $script['niceCreateTime'] . " (" . AuthUtil::getUsername($script['userid']) . ")"; $sql = "SELECT BIT_OR(v_tree_dir.permissions) \n\t\t\t\tFROM v_tree_script, v_tree_dir \n\t\t\t\tWHERE v_tree_script.id = {$script['id']}\n\t\t\t\t\tAND v_tree_script.parent = v_tree_dir.id\n\t\t\t\t\tAND v_tree_dir.userid = {$userID}"; $script['parentperm'] = $db->getOne($sql); } $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('scripts', $scripts); $this->assign('scriptCount', $scriptCount); $this->assign('deleteID', $this->fieldData['deleteID']); }
protected function setupTemplate() { global $cfg; parent::setupTemplate(); // user awsets $db = Database::getInstance($cfg['DPS']['dsn']); $auth = Auth::getInstance(); $userID = $auth->getUserID(); $loc = 1; $sql = "SELECT usersconfigs.val FROM configs, usersconfigs\n\t\t\tWHERE configs.id = usersconfigs.configid\n\t\t\t\tAND configs.name = 'default_aw_set'\n\t\t\t\tAND usersconfigs.userid = " . $userID; $userset = $db->getOne($sql); $sql = "SELECT val FROM configuration \n\t\t\tWHERE location = {$loc}\n\t\t\t\tAND parameter='station_aw_set'"; $stationset = $db->getOne($sql); if ($stationset != '') { $sql = "SELECT aw_sets.id as id, aw_sets.name as name,\n\t\t\t\t\taw_sets.description as desc\n\t\t\t\tFROM aw_sets\n\t\t\t\tWHERE id = {$stationset}"; $sawset = $db->getRow($sql); } else { $sawset = "None"; } $sql = "SELECT v_tree_aw_sets.*, aw_sets_users.user_id AS userid\n FROM v_tree_aw_sets LEFT OUTER JOIN aw_sets_users\n ON aw_sets_users.set_id = v_tree_aw_sets.id\n\t\t\tWHERE v_tree_aw_sets.userid = {$userID} \n\t\t\t\tAND v_tree_aw_sets.permissions & B'" . $cfg['DPS']['fileR'] . "' = '" . $cfg['DPS']['fileR'] . "'"; $awsets = $db->getAll($sql); foreach ($awsets as &$awset) { if ($userset == $awset['id']) { $awset['active'] = 't'; } else { $awset['active'] = 'f'; } $sql = "SELECT BIT_OR(permissions) \n\t\t\t\tFROM v_tree_dir \n\t\t\t\tWHERE v_tree_dir.id = {$awset['parent']}\n\t\t\t\t\tAND v_tree_dir.userid = {$userID}"; $awset['parentperm'] = $db->getOne($sql); $awset['userid'] = AuthUtil::getUsername($awset['userid']); } $this->assign('access_playlist', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 33), $userID)); $this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID)); $this->assign('studioAccess', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 35), $userID)); $this->assign('awsets', $awsets); $this->assign('stationawset', $sawset); }