public function index() { if (!$this->input->get('url')) { redirect('/', 'refresh'); } $title = substr($this->input->get('url'), strpos($this->input->get('url'), 'song/') + 5); $username = substr($title, 0, strpos($title, '/')); $url_slug = substr($title, strpos($title, '/') + 1); $user = $this->User_model->get_user_info($username); if (!$user) { die('<strong>ERROR FETCHING DATA :: ENSURE YOUR URL IS CORRECT AND THERE IS A VALID USER.</strong>'); } $song = $this->Song_model->get_song_where(array('username' => $username, 'song_url' => $url_slug)); if (!$song) { die('<strong>ERROR FETCHING DATA :: ENSURE YOUR URL IS CORRECT AND THERE IS A VALID SONG.</strong>'); } $this->output->set_header('Content-Type: application/json; charset=utf-8'); $output_array = array('type' => 'rich', 'title' => $song->song_title, 'description' => $song->song_description, 'version' => '1.0', 'provider_name' => 'hiphopVIP', 'provider_url' => base_url(), 'html' => "<iframe src='" . base_url("embed/1/" . $username . "/" . $url_slug) . "' scrolling='no' width='100%' height='100' scrollbars='no' frameborder='0'><\\iframe>", 'width' => '100%', 'height' => '100', 'thumbnail_url' => song_img($song->username, $song->song_url, $song->song_image), 'url' => base_url('song/' . $username . '/' . $url_slug), 'album' => $song->album, 'producer' => $song->song_producer, 'buy_link' => $song->buy_link, 'author_name' => $song->song_artist, 'author_url' => base_url('u/' . $username)); $this->output->set_output(json_encode($output_array)); }
public function player($username = "", $tape_title = "") { $mixtape = $this->cache->model('Mixtape_model', 'get_mixtapes', array(array('mixtapes.tape_url' => $tape_title, 'username' => $username)), 300); if (!$mixtape) { redirect('errors/page_missing', 'refresh'); } $mixtape = $mixtape[0]; //mixtape isn't published yet, so don't allow access to the page. could maybe do this with jquery/javascript -- just hide the player and display info but idk what would be best at 5:36am right now if ($mixtape->status != 'published') { redirect('error/mixtape-processing', 'refresh'); } $this->data['tape'] = $mixtape; $this->data['username'] = $username; $this->data['playlist'] = $this->getPlaylistData($mixtape->id); $this->data['tracks'] = $this->cache->model('Mixtape_model', 'get_tracks', array(array('tape_id' => $mixtape->id), 'tape_order ASC'), 300); /* hotlinking protection */ $ip = $_SERVER['REMOTE_ADDR']; $salt = 'f**k!these&other$itesit$hiph0pvip0rd!e'; $path = $mixtape->file_name; $timestamp = time() + 2400; // file valid for 40 minutes $hash = md5($salt . $ip . $timestamp . $path); // order isn't important at all... just do the same when verifying $this->data['dl_time'] = $timestamp; $this->data['dl_hash'] = $hash; /* end hotlinking */ $meta_download = $mixtape->can_download === 'yes' ? 'Download ' : 'Listen to '; $meta_description = empty($mixtape->tape_description) ? $meta_download . htmlspecialchars($mixtape->tape_title, ENT_QUOTES) . ' by ' . htmlspecialchars($mixtape->tape_artist, ENT_QUOTES) : htmlspecialchars($mixtape->tape_description, ENT_QUOTES); $this->data['meta_name'] = array('description' => htmlspecialchars($meta_description, ENT_QUOTES), 'twitter:card' => 'player', 'twitter:site' => '@hiphopvip1', 'twitter:domain' => 'http://hiphopvip.com', 'twitter:title' => htmlspecialchars($mixtape->tape_artist, ENT_QUOTES) . ' - ' . htmlspecialchars($mixtape->tape_title, ENT_QUOTES), 'twitter:description' => htmlspecialchars($mixtape->tape_description, ENT_QUOTES), 'twitter:image' => tape_img($mixtape->username, $mixtape->tape_url, $mixtape->tape_image), 'twitter:player' => $this->config->item('secure_base_url') . '/embed/mixtape/1/' . $username . '/' . $mixtape->tape_url, 'twitter:player:width' => '480', 'twitter:player:height' => '325'); $this->data['meta_prop'] = array('og:title' => $meta_download . htmlspecialchars($mixtape->tape_artist . ' - ' . $mixtape->tape_title, ENT_QUOTES), 'og:url' => base_url('mixtape/' . $username . '/' . $mixtape->tape_url), 'og:image' => song_img($mixtape->username, $mixtape->tape_url, $mixtape->tape_image), 'og:site_name' => 'hiphopVIP', 'og:description' => $meta_description); $this->data['mixtape_subSection'] = $this->Mixtape_model->get_mixtapes(array('mixtapes.user_id' => $mixtape->user_id, 'mixtapes.status' => 'published'), 'id DESC', 5, 0); $this->data['tape_image'] = tape_img($mixtape->username, $mixtape->tape_url, $mixtape->tape_image, 300); $this->data['vendorCSS'] = array('apm/skin/hhvip.css', 'apm/skin/jquery-ui-slider.custom.css', 'social-likes/social-likes_classic.css'); $this->data['vendorJS'] = array('apm/lib/jquery-ui-slider-1.10.4.custom.min.js', 'apm/lib/modernizr-2.5.3-custom.min.js', 'apm/lib/soundmanager2-jsmin.js', 'apm/apmplayer.js', 'apm/apmplayer_ui.jquery.js', 'social-likes/social-likes.min.js'); $this->data['title'] = 'Download & Listen to ' . $mixtape->tape_title . ' by ' . $mixtape->tape_artist; $this->_render('mixtapes/player', $this->data); }
?> <item> <title><?php echo htmlspecialchars($song->song_artist . $featuring . ' - ' . $song->song_title, ENT_QUOTES); ?> </title> <link><?php echo base_url('song/' . $song->username . '/' . $song->song_url); ?> </link> <guid><?php echo base_url('song/' . $song->username . '/' . $song->song_url); ?> </guid> <image>http:<?php echo song_img($song->username, $song->song_url, $song->song_image, 150); ?> </image> <description><![CDATA[ <?php echo $description; ?> ]]></description> <pubDate><?php echo date('D, d M Y H:m:s', $song->published_date) . ' EST'; ?> </pubDate> </item> <?php } ?>
public function main($username = "", $song_title = "") { $song = $this->cache->model('Song_model', 'get_song_where', array(array('username' => $username, 'song_url' => $song_title)), 300); if (!$song) { $checkSong = $this->Song_model->getUpdatedUrl(array('old_url' => $song_title, 'users.username' => $username)); if ($checkSong) { redirect('song/' . $username . '/' . $checkSong->current_url, '301'); } else { redirect('songs/error', 'refresh'); } } $this->load->helper('status'); $this->data['song_status'] = status_message('song', $song->status); $this->data['song'] = $song; $this->data['username'] = $username; $song_artist_full = $song->song_artist; if (!empty($song->featuring)) { $song_artist_full .= ' Feat. ' . $song->featuring; } $meta_download = $song->can_download === 'yes' || !empty($song->buy_link) ? 'Stream & Download ' : 'Listen to '; $meta_description = empty($song->song_description) ? $meta_download . htmlspecialchars($song->song_title, ENT_QUOTES) . ' by ' . $song_artist_full : htmlspecialchars($song->song_description, ENT_QUOTES); if ($song->external_source == 'soundcloud') { $this->data['mp3Source'] = 'http://api.soundcloud.com/tracks/' . $song->external_file . '/stream?consumer_key=' . $this->config->item('soundcloud_client_id'); } else { $this->data['mp3Source'] = getSignedURL($this->config->item('cloudfront_music') . '/tracks/' . $username . '/' . $song->file_name, '1800'); } $this->data['twitter_via'] = !empty($song->twitter_handle) ? 'data-via="' . $song->twitter_handle . '"' : NULL; $this->data['meta_name'] = array('description' => htmlspecialchars($meta_description, ENT_QUOTES), 'twitter:card' => 'player', 'twitter:site' => '@hiphopvip1', 'twitter:title' => htmlspecialchars($song->song_artist, ENT_QUOTES) . ' - ' . htmlspecialchars($song->song_title, ENT_QUOTES), 'twitter:description' => htmlspecialchars($song->song_description, ENT_QUOTES), 'twitter:image' => song_img($song->username, $song->song_url, $song->song_image), 'twitter:player' => $this->config->item('secure_base_url') . '/embed/song/' . $username . '/' . $song->song_url, 'twitter:player:width' => '480', 'twitter:player:height' => '100', 'twitter:player:stream' => $this->data['mp3Source'], 'twitter:player:stream:content_type' => 'audio/mp3'); $this->data['meta_prop'] = array('og:title' => $meta_download . htmlspecialchars($song_artist_full . ' - ' . $song->song_title, ENT_QUOTES), 'og:url' => base_url('song/' . $username . '/' . $song->song_url), 'og:image' => song_img($song->username, $song->song_url, $song->song_image), 'og:site_name' => 'hiphopVIP', 'og:description' => htmlspecialchars($meta_description, ENT_QUOTES)); /* - display latest tracks if we cannot find songs by artist - */ $recentLimit = 10; $userRecentWhere = array('status' => 'published', 'song_url !=' => $song->song_url); $userRecentTracks = $this->cache->model('Song_model', 'search', array($userRecentWhere, $song->song_artist, $recentLimit, 0, 'song_id DESC'), 1800); $userRecentCount = count($userRecentTracks); $this->data['recent_count'] = $userRecentCount; if ($userRecentCount < 5) { $latestWhere = array('status' => 'published', 'song_url !=' => $song->song_url); $latestTracks = $this->cache->model('Song_model', 'get_songs_where', array($latestWhere, $recentLimit, 'song_id DESC'), 1800); $this->data['more_tracks'] = $latestTracks; $this->data['more_tracks_title'] = 'Other Songs You Might Like'; $this->data['start_a_playlist'] = FALSE; } else { $this->data['start_a_playlist'] = TRUE; $this->data['more_tracks'] = $userRecentTracks; $this->data['more_tracks_title'] = 'More Songs From ' . $song->song_artist; } /* VOTING BUTTONS, COLOR THEM WHEN LOGGED IN */ if ($this->ion_auth->logged_in()) { $voteIds = array(); foreach ($this->data['more_tracks'] as $key => $s) { $voteIds[] = $s->song_id; } $votes = $this->Vote_model->get_where_in('vote_song_id,vote_rating', $voteIds, $this->ion_auth->user()->row()->id); $this->data['userVotes'] = json_encode($votes); } else { $this->data['userVotes'] = ""; } /* - END display latest tracks - */ $nextSongSQL = array('song_id >' => $song->song_id, 'status' => 'published'); $nextSong = $this->cache->model('Song_model', 'get_songs_where', array($nextSongSQL, "1", "song_id ASC"), 1800); $prevSongSQL = array('song_id <' => $song->song_id, 'status' => 'published'); $prevSong = $this->cache->model('Song_model', 'get_songs_where', array($prevSongSQL, "1", "song_id DESC"), 1800); //get next and previous songs if ($nextSong) { foreach ($nextSong as $ns) { $this->data['nextSong'] = $ns; } } else { $this->data['nextSong'] = null; } if ($prevSong) { foreach ($prevSong as $ps) { $this->data['prevSong'] = $ps; } } else { $this->data['prevSong'] = NULL; } if ($this->ion_auth->logged_in()) { $this->data['favorite'] = $this->Social_model->get_favorite(array('song_id' => $song->song_id, 'user_id' => $this->ion_auth->user()->row()->id)) ? TRUE : FALSE; $this->load->model('Playlist_model'); $this->data['user_playlists'] = $this->Playlist_model->get(array('playlists.user_id' => $this->ion_auth->user()->row()->id), 'id DESC'); } $this->data['promoted'] = $this->cache->library('sorting', 'get_list', array('songs', 'promoted', 5)); $this->data['featuring'] = !empty($song->featuring) ? '<span style="display:block"><span style="font-weight:bold">Featuring: </span> ' . htmlspecialchars($song->featuring, ENT_QUOTES) . '</span>' : NULL; $this->data['producer'] = !empty($song->song_producer) ? '<span style="display:block"><span style="font-weight:bold">Producer: </span> ' . htmlspecialchars($song->song_producer, ENT_QUOTES) . '</span>' : NULL; $this->data['album'] = !empty($song->album) ? '<span style="display:block"><span style="font-weight:bold">Album: </span> ' . htmlspecialchars($song->album, ENT_QUOTES) . '</span>' : NULL; $this->data['releaseDate'] = date('m/d/Y', $song->published_date); $this->data['description'] = !empty($song->song_description) ? htmlspecialchars($song->song_description, ENT_QUOTES) : NULL; $this->data['visibility'] = $this->ion_auth->logged_in() && $this->ion_auth->user()->row()->username == $this->uri->segment(2) || $this->ion_auth->is_admin() ? '<span style="display:block"><span style="font-weight:bold">Visibility: </span>' . ucfirst($song->visibility) . '</span>' : NULL; $this->data['songArtist'] = htmlspecialchars($song->song_artist, ENT_QUOTES); $this->data['songTitle'] = htmlspecialchars($song->song_title, ENT_QUOTES); $this->data['featured_nav'] = $song->featured === 'yes' ? TRUE : FALSE; $this->data['promoted_nav'] = $song->promoted === 'yes' ? TRUE : FALSE; $this->data['copyright_status'] = $song->status === 'copyright' ? TRUE : FALSE; $this->data['coreJS'] = array('lists.js'); $this->data['vendorCSS'] = array('apm/skin/hhvip.css', 'apm/skin/jquery-ui-slider.custom.css', 'social-likes/social-likes_classic.css'); $this->data['vendorJS'] = array('apm/lib/jquery-ui-slider-1.10.4.custom.min.js', 'apm/lib/modernizr-2.5.3-custom.min.js', 'apm/lib/soundmanager2-jsmin.js', 'apm/apmplayer.js', 'apm/apmplayer_ui.jquery.js', 'social-likes/social-likes.min.js'); $this->data['title'] = $meta_download . $song->song_artist . ' - ' . $song->song_title . ' on ' . SITE_TITLE; $this->data['title'] = htmlspecialchars($this->data['title'], ENT_QUOTES); $this->_render('player/main', $this->data); }
echo base_url('song/' . $list->username . '/' . $list->song_url); ?> " title="Listen and Download <?php echo $listArtist . ' - ' . $listTitle; ?> "> <div id="votes_<?php echo $list->song_id; ?> " class="style-review-score sidebar-review-score"> <?php echo $this->voting->vote_sum($list->upvotes, $list->downvotes); ?> </div> <img src="<?php echo song_img($list->username, $list->song_url, $list->song_image, 64); ?> " width="54" height="54" alt="Listen to and download <?php echo $listTitle . ' by ' . $listArtist; ?> "> </a> </figure> <div class="media-body"> <h3 class="sidebar-list-title"> <a href="<?php echo base_url('song/' . $list->username . '/' . $list->song_url); ?> " title="Listen and Download <?php echo $listArtist . ' - ' . $listTitle; ?>
echo base_url('song/' . $mt->username . '/' . $mt->song_url); ?> " rel="bookmark"> <img src="<?php echo song_img($mt->username, $mt->song_url, $mt->song_image, 150); ?> " data-src="<?php echo song_img($mt->username, $mt->song_url, $mt->song_image, 150); ?> " alt="Listen to <?php echo $mtTitle . ' by ' . $mtArtist; ?> "/> <noscript> <img src="<?php echo song_img($mt->username, $mt->song_url, $mt->song_image, 150); ?> " alt="Listen to <?php echo $mtTitle . ' by ' . $mtArtist; ?> "/> </noscript> </a> </figure> <header class="entry-header"> <h3 class="list-title"> <div id="votes_<?php echo $mt->song_id; ?> " class="style-review-score list-review-score" style="background-color:<?php
echo $this->lang->line('vote_nope'); ?> </a></div> </div> <figure class="media-object pull-left list-image" style="height:65px"> <div id="votes_<?php echo $var->song_id; ?> " class="style-review-score"> <?php echo $this->voting->vote_sum($var->upvotes, $var->downvotes); ?> </div> <img src="<?php echo song_img($var->username, $var->song_url, $var->song_image, 64); ?> " width="54px" height="54px"> </figure> <header class="entry-header"> <h3 class="list-title blck"><a href="<?php echo base_url('song/' . $var->username . '/' . $var->song_url); ?> " rel="bookmark"><?php echo $var->song_title; ?> <br /><span class="orange"><?php echo $var->song_artist; ?> </span> <span class="gray"><?php echo $var->featuring;
/** * retrieves data from the Playlist model for a playlist and sets up the data array to be used with APM media player * @param integer $id - playlist Track ID * @return json encoded playlist array that should be used with APM Player */ public function buildTrackData($id) { $playlist = $this->cache->model('Playlist_model', 'get', array(array('playlists.id' => $id)), 300); $tracks = $this->cache->model('Playlist_model', 'get_tracks', array(array('playlist_id' => $id), 'position ASC'), 300); $playlist = $playlist[0]; if (!$tracks) { return "''"; } else { foreach ($tracks as $t) { if ($t->external_source == 'soundcloud') { $http_file_path = 'http://api.soundcloud.com/tracks/' . $t->external_file . '/stream?consumer_key=' . $this->config->item('soundcloud_client_id'); } else { $http_file_path = getSignedURL($this->config->item('cloudfront_music') . '/tracks/' . $t->username . '/' . $t->file_name, '86400'); } $producer = !empty($t->song_producer) ? ' (Prod. ' . htmlspecialchars($t->song_producer, ENT_QUOTES) . ')' : NULL; $featuring = !empty($t->featuring) ? ' (Feat. ' . htmlspecialchars($t->featuring, ENT_QUOTES) . ') ' : NULL; $data[] = array('identifier' => $t->id, 'list_id' => $id, 'type' => 'audio', 'host' => $t->id, 'title' => htmlspecialchars($t->song_title, ENT_QUOTES), 'artist' => htmlspecialchars($t->song_artist, ENT_QUOTES), 'program' => $featuring . $producer, 'image_lg' => song_img($t->username, $t->song_url, $t->song_image, 300), 'image_sm' => $t->file_name, 'url' => base_url('song/' . $t->username . '/' . $t->song_url), 'external_url' => $t->external_url, 'http_file_path' => $http_file_path); } return json_encode($data, JSON_UNESCAPED_SLASHES); } }
echo base_url('song/' . $promoted->username . '/' . $promoted->song_url); ?> " rel="bookmark"> <img src="<?php echo song_img($promoted->username, $promoted->song_url, $promoted->song_image, 150); ?> " data-src="<?php echo song_img($promoted->username, $promoted->song_url, $promoted->song_image, 150); ?> " alt="Listen to <?php echo $promoted_title . ' by ' . $promoted_artist; ?> "/> <noscript> <img src="<?php echo song_img($promoted->username, $promoted->song_url, $promoted->song_image, 150); ?> "/> </noscript> </a> </figure> <header class="entry-header"> <h3 class="list-title promoted-title"> <a href="<?php echo base_url('song/' . $promoted->username . '/' . $promoted->song_url); ?> " rel="bookmark"> <span style="font-size:18px;display:block;font-weight:100;padding-bottom:3px"> <?php
?> </h2> <figure class="entry-thumbnail"> <div class="overlay overlay-primary"></div> <!-- to disable lazy loading, remove data-src and data-src-retina --> <img src="<?php echo song_img($nextSong->username, $nextSong->song_url, $nextSong->song_image, '300'); ?> " data-src="<?php echo song_img($nextSong->username, $nextSong->song_url, $nextSong->song_image, '300'); ?> " data-src-retina="<?php echo song_img($nextSong->username, $nextSong->song_url, $nextSong->song_image, '300'); ?> " width="480" height="280" alt=""> <!--fallback for no javascript browsers--> <noscript> <img src="../uploads/480x280_3.jpg" alt=""> </noscript> </figure> </a> </article> <?php } ?>
public function get_playlist_songs($user_id) { $where = array('user_id' => $user_id, 'status' => 'published'); $playlist = $this->cache->model('Song_model', 'get_songs_where', array($where, 10, 'song_id DESC'), 120); // keep for 2 minutes if (!$playlist) { return "''"; } else { foreach ($playlist as $i) { if (!empty($i->featuring)) { $featuring = ' (Feat. ' . $i->featuring . ')'; } else { $featuring = NULL; } $song_id = $i->song_id; $song_title = $i->song_title; $song_artist = $i->song_artist . $featuring; $user_id = $i->user_id; $username = $i->username; $file_uid = $i->file_uid; $url = $i->song_url; $file_name = $i->file_name; $upload_date = $i->upload_date; $image_sm = song_img($username, $url, $i->song_image, 64); $data[] = array('identifier' => $song_title, 'type' => 'audio', 'description' => $i->song_description, 'date' => $i->published_date, 'image_sm' => $image_sm, 'title' => $song_title, 'program' => $song_artist, 'http_file_path' => getSignedURL($this->config->item('cloudfront_music') . '/tracks/' . $username . '/' . $file_name, '6000'), 'detail' => $url); } return json_encode($data); } }