function iTunesUpdate() { global $DOWNLOAD, $info, $iTunes, $currentTrack; $currentTrack = $iTunes->CurrentTrack; if ($currentTrack) { $position = $iTunes->PlayerPosition; $info["refresh"] = true; $info["status"] = $iTunes->PlayerState; $info["name"] = $currentTrack->Name; // $info['name'] = 'Hello World! You are awesome! ...and stuff.'; $info["num"] = $currentTrack->TrackNumber; $info["album"] = $currentTrack->Album; $info["artist"] = $currentTrack->Artist; $info["duration"] = $currentTrack->duration; $info["position"] = $position; $info["elapsed"] = secondsToMinutes($position); $info["remaining"] = "-" . secondsToMinutes($info["duration"] - $position); $info["volume"] = $iTunes->SoundVolume; $info["rating"] = $currentTrack->Rating; $info["genre"] = $currentTrack->Genre; $info["bitrate"] = $currentTrack->bitrate; $info["filesize"] = $currentTrack->size; $info["type"] = $currentTrack->kind; $info["download"] = $DOWNLOAD; // Javascript $myFile = "C:/xampp/htdocs/itrc/sync.txt"; $fh = fopen($myFile, 'r'); $data = fread($fh, filesize($myFile)); fclose($fh); $syncFile = json_decode($data, true); $info["syncState"] = $syncFile['syncState']; $info["javascript"] = $syncFile['javascript']; $info["register"] = $syncFile['register']; } }
function getQueue($session_code) { global $connection; $query = "SELECT * FROM Tracks WHERE session_code='" . $session_code . "' AND status='queued' ORDER BY votes DESC, id"; $tracks = mysqli_query($connection, $query); $numTracks = mysqli_num_rows($tracks); while ($track = mysqli_fetch_array($tracks)) { echo '<button class="queue-item text-left" onclick="promoteTrack(' . $track['id'] . ')">'; echo '<span class="title">' . $track['title'] . '</span>'; echo '<span class="length">' . secondsToMinutes($track['length']) . '</span>'; echo '<span class="artist">' . $track['artist'] . '</span>'; echo '<span class=divider">-</span>'; echo '<span class="album">' . $track['album'] . '</span>'; echo '<span class="votes">' . $track['votes'] . '</span>'; //echo '<a class="remove" onclick="removeTrack(' . $track['id'] . ')"><i class="icon-remove-sign"></i></a>'; echo '</button>'; } return true; }
function getPlaying($session_code) { global $connection; $query = "SELECT * FROM Tracks WHERE session_code='" . $session_code . "' AND status='playing'"; $tracks = mysqli_query($connection, $query); $track = mysqli_fetch_array($tracks); echo '<div>'; echo '<div id="progress"></div>'; echo '<span id="now-playing" href="' . $track['spotify_uri'] . '">'; echo '<span class="title">' . $track['title'] . '</span>'; echo '<span class="length">' . secondsToMinutes($track['length']) . '</span>'; echo '<span class="secs" style="display:none">' . $track['length'] . '</span>'; echo '<span class="artist">' . $track['artist'] . '</span>'; echo '<span class=divider">-</span>'; echo '<span class="album">' . $track['album'] . '</span>'; echo '<span class="votes">' . $track['votes'] . '</span>'; echo '</span>'; echo '</div>'; return true; }
break; // end default // end default case 'post': $title = stripinput(trim($_POST['post']['title'])); $text = clean_xhtml(trim($_POST['post']['text'])); if ($title == null) { $ERRORS[] = 'You must specify a title.'; } elseif (strlen($title) > 60) { $ERRORS[] = 'There is a maxlength=60 on that field for a reason.'; } if ($text == null) { $ERRORS[] = 'No message specified. It is possible that your HTML was so badly mal-formed that it was dropped by the HTML filter.'; } if (strtotime($User->getDatetimeLastPost()) + $APP_CONFIG['post_interval'] > time()) { $text = secondsToMinutes($APP_CONFIG['post_interval']); $ERRORS[] = "You may only post once every {$text}."; } // end user posted too quickly if (sizeof($ERRORS) > 0) { draw_errors($ERRORS); $POST = array('board_id' => stripinput($_REQUEST['board_id']), 'title' => $title, 'message' => $text); $renderer->assign('post', $POST); $renderer->display('boards/new_thread_error.tpl'); } else { $thread = new BoardThread($db); $thread->create(array('board_id' => $board->getBoardId(), 'thread_name' => $title, 'user_id' => $User->getUserId(), 'thread_created_datetime' => $thread->sysdate(), 'thread_last_posted_datetime' => $thread->sysdate(), 'stickied' => 1, 'locked' => 'N')); $post = new BoardPost($db); $post->create(array('board_thread_id' => $thread->getBoardThreadId(), 'user_id' => $User->getUserId(), 'posted_datetime' => $post->sysdate(), 'post_text' => $text)); $_SESSION['board_notice'] = 'Your thread has been created.'; redirect(null, null, "threads/{$board->getBoardId()}");
$seed = substr(rand(), -1) . substr(rand(), -1) . substr(rand(), -1) . substr(rand(), -1); srand(floor(time() / 2) * 1207); $seed2 = "0." . substr(rand(), -1) . substr(rand(), -1) . substr(rand(), -1) . substr(rand(), -1); $musicId = substr(rand() * rand(), -1) . substr(rand() * rand(), -1) . substr(rand() * 17, -1) . substr(rand() * 8 - rand(), -1); if ($currentTrack) { $position = $iTunes->PlayerPosition; $info["status"] = $iTunes->PlayerState; // $info["name"] = $currentTrack->Name; $info['name'] = 'Hello World! You are awesome! ...and stuff.'; $info["num"] = $currentTrack->TrackNumber; $info["album"] = $currentTrack->Album; $info["artist"] = $currentTrack->Artist; $info["duration"] = $currentTrack->duration; $info["position"] = $position; $info["elapsed"] = secondsToMinutes($position); $info["remaining"] = "-" . secondsToMinutes($info["duration"] - $position); $info["volume"] = $iTunes->SoundVolume; $info["update"] = $update; $info["seed"] = $seed; $info["rating"] = $currentTrack->Rating; $info["genre"] = $currentTrack->Genre; $info["bitrate"] = $currentTrack->bitrate; $info["filesize"] = $currentTrack->size; $info["type"] = $currentTrack->kind; $info["download"] = $downloadMusic; $info["seed2"] = $seed2; $myFile = "C:/xampp/htdocs/itrc/sync.txt"; $fh = fopen($myFile, 'r'); $data = fread($fh, filesize($myFile)); fclose($fh); $syncFile = json_decode($data, true);