?> mouseover"> <td></td> <td><a href="index.php?action=view2&artist=<?php echo rawurlencode($album['artist_alphabetic']); ?> "><?php echo html($album['artist_alphabetic']); ?> </a></td> <td></td> <td><a href="index.php?action=view3&album_id=<?php echo $album['album_id']; ?> " <?php echo $onmouseoverImage ? onmouseoverImage($album['image_id']) : ''; ?> ><?php echo html($album['album']); ?> </a></td> <td></td> </tr> <?php } ?> </table> <?php require_once 'include/footer.inc.php'; exit; // +------------------------------------------------------------------------+
function track_title() { global $cfg, $db, $size, $search_string, $group_found, $match_found; //$query = mysql_query('SELECT track.artist, track.title, track.featuring, track.album_id, track.track_id, track.miliseconds, album.image_id, album.album FROM track, album ' . $filter_query . ' ' . $order_query); $query = mysql_query('SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id, track.miliseconds, track.number, album.image_id, album.album, album.artist FROM track INNER JOIN album ON track.album_id = album.album_id WHERE track.title LIKE "%' . mysql_real_escape_string($search_string) . '%"'); /* $query = mysql_query('SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id, track.miliseconds, track.number, album.image_id, album.album, album.artist FROM track INNER JOIN album ON track.album_id = album.album_id WHERE track.title LIKE "%' . mysql_real_escape_string($search_string) . '%" ORDER BY track.artist, track.title'); */ $rows = mysql_num_rows($query); if ($rows > 0) { $match_found = true; if ($group_found == 'none') { $group_found = 'TT'; } ?> <h1 onclick='toggleSearchResults("TT");' class="pointer"><i id="iconSearchResultsTT" class="fa fa-chevron-circle-down icon-anchor"></i> Track title (<?php if ($rows > 1) { echo $rows . " matches found"; } else { $album = mysql_fetch_assoc($query); echo $rows . " match found: " . $album['track_artist']; } ?> ) </h1> <div id="searchResultsTT"> <table cellspacing="0" cellpadding="0" class="border"> <tr class="header"> <td class="icon"></td><!-- track menu --> <td class="icon"></td><!-- add track --> <td class="track-list-artist">Track artist </td> <td>Title </td> <td>Album </td> <td></td> <td align="right" class="time">Time</td> <td class="space right"></td> </tr> <?php $i = 0; /* $query = mysql_query('SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id, track.miliseconds, track.number, album.image_id, album.album, album.artist FROM track INNER JOIN album ON track.album_id = album.album_id WHERE track.title LIKE "%' . mysql_real_escape_string($search_string) . '%" ORDER BY track.artist, track.title'); */ $query = mysql_query('SELECT * FROM (SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.miliseconds, track.number, track.relative_file, album.image_id, album.album, album.artist FROM track INNER JOIN album ON track.album_id = album.album_id WHERE track.title LIKE "%' . mysql_real_escape_string($search_string) . '%") as a LEFT JOIN (SELECT track_id, favorite_id FROM favoriteitem WHERE favorite_id = "' . $cfg['favorite_id'] . '") as b ON b.track_id = a.tid ORDER BY a.title, a.artist, a.album'); while ($track = mysql_fetch_assoc($query)) { ?> <tr class="<?php echo $i++ & 1 ? 'even' : 'odd'; ?> mouseover"> <td class="icon"> <span id="menu-track<?php echo $i + 10000; ?> "> <div onclick='toggleMenuSub(<?php echo $i + 10000; ?> );'> <i id="menu-icon<?php echo $i + 10000; ?> " class="fa fa-bars icon-small"></i> </div> </span> </td> <td class="icon"> <span> <?php if ($cfg['access_add']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=addSelect&track_id=' . $track['tid'] . '\');" onMouseOver="return overlib(\'Add track ' . $track['number'] . '\');" onMouseOut="return nd();"><i class="fa fa-plus-circle fa-fw icon-small"></i></a>'; } ?> </span> </td> <td class="track-list-artist"><?php if (mysql_num_rows(mysql_query('SELECT track_id FROM track WHERE track.artist="' . mysql_real_escape_string($track['track_artist']) . '"')) > 1) { echo '<a href="index.php?action=view2&artist=' . rawurlencode($track['track_artist']) . '&order=year">' . html($track['track_artist']) . '</a>'; } else { echo html($track['track_artist']); } ?> </td> <td><?php if ($cfg['access_play']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=insertSelect&playAfterInsert=yes&track_id=' . $track['tid'] . '\');" onMouseOver="return overlib(\'Play track ' . $track['number'] . '\');" onMouseOut="return nd();">' . html($track['title']) . '</a>'; } elseif ($cfg['access_add']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=addSelect&track_id=' . $track['tid'] . '\');" onMouseOver="return overlib(\'Add track\');" onMouseOut="return nd();">' . html($track['title']) . '</a>'; } elseif ($cfg['access_stream']) { echo '<a href="stream.php?action=playlist&track_id=' . $track['tid'] . '&stream_id=' . $cfg['stream_id'] . '" onMouseOver="return overlib(\'Stream track\');" onMouseOut="return nd();">' . html($track['title']) . '</a>'; } else { echo html($track['title']); } ?> <span class="track-list-artist-narrow">by <?php echo html($track['track_artist']); ?> </span> </td> <td><a href="index.php?action=view3&album_id=<?php echo $track['album_id']; ?> " <?php echo onmouseoverImage($track['image_id']); ?> ><?php echo html($track['album']); ?> </a></td> <td onclick=" var action = ''; if ($('#favorite_star_TT-<?php echo $track['tid']; ?> ').attr('class') == 'fa fa-star-o') { action = 'add'; } else { action = 'remove'; } ajaxRequest('ajax-favorite.php?action=' + action + '&track_id=<?php echo $track['tid']; ?> &group_type=TT', setFavorite); " class="pl-favorites"><i class="fa fa-star<?php if ($track['favorite_id'] != $cfg['favorite_id']) { echo '-o'; } ?> " id="favorite_star_TT-<?php echo $track['tid']; ?> "></i></td> <td align="right"><?php echo formattedTime($track['miliseconds']); ?> </td> <td></td> </tr> <tr class="line"> <td></td> <td colspan="16"></td> </tr> <tr> <td colspan="20"> <div class="menuSub" id="menu-sub-track<?php echo $i + 10000; ?> " onclick='offMenuSub(<?php echo $i + 10000; ?> );'> <div><?php if ($cfg['access_play']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=insertSelect&playAfterInsert=yes&track_id=' . $track['tid'] . '\');" onMouseOver="return overlib(\'Play track ' . $track['number'] . '\');" onMouseOut="return nd();"><i class="fa fa-play-circle-o fa-fw icon-small"></i>Insert after currently playing track and play</a>'; } ?> </div> <div> <?php if ($cfg['access_add']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=insertSelect&track_id=' . $track['tid'] . '\');" onMouseOver="return overlib(\'Insert track ' . $track['number'] . '\');" onMouseOut="return nd();"><i class="fa fa-indent fa-fw icon-small"></i>Insert after currently playing track</a>'; } ?> </div> <div> <?php if ($cfg['access_add']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=addSelect&track_id=' . $track['tid'] . '\');" onMouseOver="return overlib(\'Add track ' . $track['number'] . '\');" onMouseOut="return nd();"><i class="fa fa-plus-circle fa-fw icon-small"></i>Add track to playlist</a>'; } ?> </div> <div><?php if ($cfg['access_play']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=playSelect&track_id=' . $track['tid'] . '\');" onMouseOver="return overlib(\'Play track ' . $track['number'] . '\');" onMouseOut="return nd();"><i class="fa fa-play-circle-o fa-fw icon-small"></i>Remove all from playlist and play track</a>'; } ?> </div> <div><?php if ($cfg['access_stream']) { echo '<a href="stream.php?action=playlist&track_id=' . $track['tid'] . '&stream_id=' . $cfg['stream_id'] . '" onMouseOver="return overlib(\'Stream track ' . $track['number'] . '\');" onMouseOut="return nd();"><i class="fa fa-rss fa-fw icon-small"></i>Stream track</a>'; } ?> </div> <div><?php if ($cfg['access_download']) { echo '<a href="download.php?action=downloadTrack&track_id=' . $track['tid'] . '&download_id=' . $cfg['download_id'] . '" ' . onmouseoverDownloadTrack($track['tid']) . '><i class="fa fa-download fa-fw icon-small"></i>Download track</a>'; } ?> </div> <div><?php if ($cfg['access_play']) { echo '<a href="getid3/demos/demo.browse.php?filename=' . $cfg['media_dir'] . urlencode($track['relative_file']) . '" onClick="showSpinner();"><i class="fa fa-info-circle fa-fw icon-small"></i>File details</a>'; } ?> </div> </div> </td> </tr> <?php } echo "</table>"; echo "</div>"; } }
function viewPopular() { global $cfg, $db; $period = get('period'); $user_id = (int) get('user_id'); $flag = (int) get('flag'); if ($period == 'week') { $days = 7; } elseif ($period == 'month') { $days = 31; } elseif ($period == 'year') { $days = 365; } elseif ($period == 'overall') { $days = 365 * 1000; } else { message(__FILE__, __LINE__, 'error', '[b]Unsupported input value for[/b][br]period'); } if ($user_id == 0) { authenticate('access_popular'); // formattedNavigator $nav = array(); $nav['name'][] = 'Library'; $nav['url'][] = 'index.php'; $nav['name'][] = 'Popular'; $query_pop = mysql_query('SELECT artist, artist_alphabetic, album, image_id, album.album_id, COUNT(*) AS counter FROM counter, album WHERE counter.flag <= 1 AND counter.time > ' . (int) (time() - 86400 * $days) . ' AND counter.album_id = album.album_id GROUP BY album.album_id ORDER BY counter DESC, time DESC LIMIT 50'); //echo 'num_rows: ' . mysql_num_rows($query); $url = 'index.php?action=viewPopular'; } else { authenticate('access_admin'); $cfg['menu'] = 'config'; $query = mysql_query('SELECT username FROM user WHERE user_id = ' . (int) $user_id); $user = mysql_fetch_assoc($query); if ($user == false) { message(__FILE__, __LINE__, 'error', '[b]Error[/b][br]user_id not found in database'); } // formattedNavigator $nav = array(); $nav['name'][] = 'Configuration'; $nav['url'][] = 'config.php'; $nav['name'][] = 'User statistics'; $nav['url'][] = 'users.php?action=userStatistics&period=' . $period; if ($flag == 0) { $nav['name'][] = 'Play: ' . $user['username']; } elseif ($flag == 1) { $nav['name'][] = 'Stream: ' . $user['username']; } elseif ($flag == 2) { $nav['name'][] = 'Download: ' . $user['username']; } elseif ($flag == 3) { $nav['name'][] = 'Cover: ' . $user['username']; } elseif ($flag == 4) { $nav['name'][] = 'Record: ' . $user['username']; } else { message(__FILE__, __LINE__, 'error', '[b]Unsupported input value for[/b][br]flag'); } $query_pop = mysql_query('SELECT artist, artist_alphabetic, album, image_id, album.album_id, COUNT(*) AS counter FROM counter, album WHERE user_id = ' . (int) $user_id . ' AND counter.flag = ' . $flag . ' AND counter.time > ' . (int) (time() - 86400 * $days) . ' AND counter.album_id = album.album_id GROUP BY album.album_id ORDER BY counter DESC, time DESC LIMIT 50'); $url = 'index.php?action=viewPopular&flag=' . $flag . '&user_id=' . $user_id; } require_once 'include/header.inc.php'; ?> <table cellspacing="0" cellpadding="0"> <tr> <td> <!-- --> <table cellspacing="0" cellpadding="0" class="tab"> <tr> <td class="<?php echo $period == 'week' ? 'tab_on' : 'tab_off'; ?> " onClick="location.href='<?php echo $url; ?> &period=week';">Week</td> <td class="tab_none tabspace"></td> <td class="<?php echo $period == 'month' ? 'tab_on' : 'tab_off'; ?> " onClick="location.href='<?php echo $url; ?> &period=month';">Month</td> <td class="tab_none tabspace"></td> <td class="<?php echo $period == 'year' ? 'tab_on' : 'tab_off'; ?> " onClick="location.href='<?php echo $url; ?> &period=year';">Year</td> <td class="tab_none tabspace"></td> <td class="<?php echo $period == 'overall' ? 'tab_on' : 'tab_off'; ?> " onClick="location.href='<?php echo $url; ?> &period=overall';">Overall</td> <td class="tab_none"> </td> </tr> </table> <table width="100%" cellspacing="0" cellpadding="0" class="tab_border"> <tr class="tab_header"> <td class="icon"></td><!-- menu --> <td<?php if ($cfg['access_play'] || $cfg['access_add'] || $cfg['access_stream']) { echo ' class="space"'; } ?> ></td> <td>Artist</td> <td class="textspace"></td> <td>Album</td> <td class="textspace"></td> <td colspan="2">Count</td> <td colspan="2"></td> <td class="space"></td> </tr> <?php $query = mysql_query('SELECT artist, artist_alphabetic, album, image_id, album.album_id, COUNT(*) AS counter FROM counter, album WHERE user_id = ' . (int) $user_id . ' AND counter.flag = ' . $flag . ' AND counter.time > ' . (int) (time() - 86400 * $days) . ' AND counter.album_id = album.album_id GROUP BY album.album_id ORDER BY counter DESC, time DESC LIMIT 50'); $i = 0; while ($album = mysql_fetch_assoc($query_pop)) { if ($i == 0) { $max = $album['counter']; } ?> <tr class="<?php echo $i++ & 1 ? 'even' : 'odd'; ?> mouseover"> <td class="icon"> <span id="menu-track<?php echo $i; ?> "> <div onclick='toggleMenuSub(<?php echo $i; ?> );'> <i id="menu-icon<?php echo $i; ?> " class="fa fa-bars icon-small"></i> </div> </span> </td> <td></td> <td><a href="index.php?action=view2&artist=<?php echo rawurlencode($album['artist_alphabetic']); ?> &order=year"><?php echo html($album['artist']); ?> </a></td> <td></td> <td><a href="index.php?action=view3&album_id=<?php echo $album['album_id']; ?> " <?php echo onmouseoverImage($album['image_id']); ?> ><?php echo html($album['album']); ?> </a></td> <td></td> <td class="bar_space"> </td> <td><?php echo $album['counter']; ?> </td> <td class="bar" onMouseOver="return overlib('<?php echo $album['counter']; ?> ');" onMouseOut="return nd();"> <div class="out-popular"><div style="width: <?php echo round($album['counter'] / $max * 100); ?> px;" class="in"></div></div> </td> <td class="bar_space"> </td> <td></td> </tr> <tr class="line"> <td></td> <td colspan="16"></td> </tr> <tr> <td colspan="16"> <div class="menuSub" id="menu-sub-track<?php echo $i; ?> " onclick='offMenuSub(<?php echo $i; ?> );'> <div><?php if ($cfg['access_play']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=playSelect&album_id=' . $album['album_id'] . '\');"><i class="fa fa-play-circle-o fa-fw icon-small"></i>Play album</a>'; } ?> </div> <div> <?php if ($cfg['access_add']) { echo '<a href="javascript:ajaxRequest(\'additional.php?action=updateAddPlay&album_id=' . $album['album_id'] . '\',updateAddPlay);"><i class="fa fa-plus-circle fa-fw icon-small"></i>Add to playlist</a>'; } ?> </div> <div> <?php if ($cfg['access_add']) { echo '<a href="stream.php?action=playlist&album_id=' . $album['album_id'] . '&stream_id=' . $cfg['stream_id'] . '"><i class="fa fa-rss fa-fw icon-small"></i>Stream album</a>'; } ?> </div> </div> </td> </tr> <?php } ?> </table> <!-- --> </td> </tr> </table> <?php require_once 'include/footer.inc.php'; }