function shareAlbum($album_id) { global $cfg, $db; authenticate('access_admin', false, true); if ($cfg['album_share_stream'] == false) { message(__FILE__, __LINE__, 'error', '[b]Error[/b][br]Share album disabled'); } $query = mysql_query('SELECT artist_alphabetic, album, year FROM album WHERE album_id = "' . mysql_real_escape_string($album_id) . '"'); $album = mysql_fetch_assoc($query); if ($album == false) { message(__FILE__, __LINE__, 'error', '[b]Error[/b][br]album_id not found in database'); } // formattedNavigator $nav = array(); $nav['name'][] = 'Media'; $nav['url'][] = 'index.php'; $nav['name'][] = $album['artist_alphabetic']; $nav['url'][] = 'index.php?action=view2&artist=' . rawurlencode($album['artist_alphabetic']); $nav['name'][] = $album['album']; $nav['url'][] = 'index.php?action=view3&album_id=' . $album_id; $nav['name'][] = 'Share stream'; require_once 'include/header.inc.php'; $expire_time = time() + $cfg['share_stream_lifetime']; $sid = randomKey(); mysql_query('INSERT INTO share_stream (sid, album_id, stream_id, expire_time) VALUES ( "' . mysql_real_escape_string($sid) . '", "' . mysql_real_escape_string($album_id) . '", ' . (int) $cfg['stream_id'] . ', ' . (int) $expire_time . ')'); $url = NJB_HOME_URL . 'stream.php?action=playlist&sid=' . $sid; $name = $album['artist_alphabetic'] . ' - '; $name .= $album['year'] ? $album['year'] . ' - ' : ''; $name .= $album['album']; // $name = encodeEscapeChar($name); $transcode = false; $exact = true; $extensions = array(); $miliseconds = 0; $query = mysql_query('SELECT track.filesize, cache.filesize AS cache_filesize, miliseconds, audio_bitrate, track_id, LOWER(SUBSTRING_INDEX(track.relative_file, ".", -1)) AS extension FROM track LEFT JOIN cache ON track.track_id = cache.id AND cache.profile = ' . (int) $cfg['stream_id'] . ' WHERE album_id = "' . mysql_real_escape_string($album_id) . '"'); while ($track = mysql_fetch_assoc($query)) { if (in_array($track['extension'], $extensions) == false) { $extensions[] = $track['extension']; } if (sourceFile($track['extension'], $track['audio_bitrate'], $cfg['stream_id']) == false) { $transcode = true; if ($track['cache_filesize'] == false) { $exact = false; } } $miliseconds += $track['miliseconds']; } sort($extensions); $source = implode($extensions, ', '); $profile_name = $transcode ? $cfg['encode_name'][$cfg['stream_id']] . ' (' . $source . ' source)' : 'Source (' . $source . ')'; if ($transcode && $exact) { $cache_txt = 'Transcoded:'; $cache_png = $cfg['img'] . 'small_check.png'; } elseif ($transcode && !$exact) { $cache_txt = 'Transcoded:'; $cache_png = $cfg['img'] . 'small_uncheck.png'; } else { $cache_txt = 'Source:'; $cache_png = $cfg['img'] . 'small_check.png'; } ?> <form action="" name="form" id="form"> <table cellspacing="0" cellpadding="0" class="border"> <tr class="header"> <td class="space"></td> <td colspan="3"><?php echo html($name); ?> </td> <td class="space"></td> </tr> <tr class="line"><td colspan="5"></td></tr> <tr class="odd"> <td></td> <td>Play time:</td> <td></td> <td><?php echo formattedTime($miliseconds); ?> </td> <td class="space"></td> </tr> <tr class="even"> <td class="space"></td> <td>Stream profile:</td> <td class="textspace"></td> <td><?php echo html($profile_name); ?> </td> <td class="space"></td> </tr> <tr class="odd"> <td></td> <td><?php echo $cache_txt; ?> </td> <td></td> <td><img src="<?php echo $cache_png; ?> " alt="" class="small"></td> <td class="space"></td> </tr> <tr class="even"> <td></td> <td>Mail:</td> <td></td> <td><a href="mailto:?SUBJECT=<?php echo rawurlencode($name); ?> &BODY=---%0APlay%20time%3A%20<?php echo rawurlencode(formattedTime($miliseconds)); ?> %0AStream%3A%20<?php echo rawurlencode($name); ?> %0A<?php echo rawurlencode(str_replace('&', '&', $url)); ?> %0A%0AThis%20stream%20will%20expire%20<?php echo rawurlencode(date($cfg['date_format'], $expire_time)); ?> %20and%20locked%20to%20the%20first%20used%20IP%20address."><img src="<?php echo $cfg['img']; ?> small_mail.png" alt="" class="small"></a></td> <td></td> </tr> <tr class="odd"> <td></td> <td>URL:</td> <td></td> <td><input type="text" value="<?php echo $url; ?> " readonly class="url" onClick="focus(this); select(this);"></td> <td></td> </tr> <tr class="even"> <td></td> <td>QR Code:</td> <td></td> <td><img src="qrcode.php?d=<?php echo rawurlencode(str_replace('&', '&', $url)); ?> &e=l&s=3" alt=""></td> <td></td> </tr> </table> </form> <?php require_once 'include/footer.inc.php'; }
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 mediaStatistics() { global $cfg, $db; authenticate('access_statistics'); @ob_flush(); flush(); $query = mysql_query('SELECT artist FROM album GROUP BY artist'); $artists = mysql_affected_rows($db); $query = mysql_query('SELECT COUNT(discs) AS albums, SUM(discs) AS discs FROM album'); $album = mysql_fetch_assoc($query); $query = mysql_query('SELECT COUNT(relative_file) AS all_tracks, SUM(miliseconds) AS sum_miliseconds, SUM(filesize) AS sum_size FROM track'); $track = mysql_fetch_assoc($query); $total_miliseconds = $track['sum_miliseconds']; $query = mysql_query('SELECT SUM(filesize) AS sum_size FROM cache'); $cache = mysql_fetch_assoc($query); $database_size = 0; $query = mysql_query('SHOW TABLE STATUS'); while ($database = mysql_fetch_assoc($query)) { $database_size += $database['Data_length'] + $database['Index_length']; } $query = mysql_query('SELECT artist, title, COUNT(artist) AS n1, COUNT(title) AS n2 FROM track GROUP BY artist, title HAVING n1 > 1 AND n2 > 1'); $duplicate_name = mysql_affected_rows($db); $query = mysql_query('SELECT SUBSTRING_INDEX( track_id, "_", -1 ) AS hash, filesize, COUNT( SUBSTRING_INDEX( track_id, "_", -1 ) ) AS n1, COUNT( filesize ) AS n2 FROM track GROUP BY filesize, hash HAVING n1 > 1 AND n2 > 1'); $duplicate_content = mysql_affected_rows($db); $media_total_space = disk_total_space($cfg['media_dir']); $media_free_space = disk_free_space($cfg['media_dir']); $media_used_space = $media_total_space - $media_free_space; $cache_total_space = disk_total_space(NJB_HOME_DIR . 'cache/'); $cache_free_space = disk_free_space(NJB_HOME_DIR . 'cache/'); $cache_used_space = $cache_total_space - $cache_free_space; // formattedNavigator $nav = array(); $nav['name'][] = 'Configuration'; $nav['url'][] = 'config.php'; $nav['name'][] = 'Media statistics'; require_once 'include/header.inc.php'; ?> <table cellspacing="0" cellpadding="0" class="border"> <tr class="header"> <td class="space"></td> <td>Quantity:</td> <td class="textspace"></td> <td></td> <td class="textspace"></td> <td colspan="3"></td> <td class="space"></td> </tr> <tr class="odd mouseover"> <td></td> <td>Number of album artists:</td> <td></td> <td align="right"><?php echo $artists; ?> </td> <td colspan="5"></td> </tr> <tr class="even mouseover"> <td></td> <td>Number of albums:</td> <td></td> <td align="right"><?php echo $album['albums']; ?> </td> <td colspan="5"></td> </tr> <!-- <tr class="odd mouseover"> <td></td> <td>Number of discs:</td> <td></td> <td align="right"><?php echo $album['discs']; ?> </td> <td colspan="5"></td> </tr> --> <tr class="even mouseover"> <td></td> <td>Number of tracks:</td> <td></td> <td align="right"><?php echo $track['all_tracks']; ?> </td> <td colspan="5"></td> </tr> <?php $max = 0; $max_year = 0; $histogram = array(); $histogram_year = array(); $date = new DateTime(); $query = mysql_query('SELECT album_add_time FROM album ORDER BY album_add_time DESC'); while ($rs = mysql_fetch_assoc($query)) { $date->setTimestamp($rs['album_add_time']); $period = $date->format('Y-m'); $period_year = $date->format('Y'); $histogram[$period] += 1; $histogram_year[$period_year] += 1; if ($histogram[$period] > $max) { $max = $histogram[$period]; } if ($histogram_year[$period_year] > $max_year) { $max_year = $histogram_year[$period_year]; } } $histogram_count = count($histogram); for ($i = 0; $i < $histogram_count; $i++) { if ($histogram[$i] > $max) { $max = $histogram[$i]; } } ?> <tr class="header"> <td class="space"></td> <td>Increase of albums:</td> <td class="textspace"></td> <td></td> <td class="textspace"></td> <td colspan="2"></td> <td></td> <td class="space"></td> </tr> <tr class="odd mouseover"> <td></td> <td>By year:</td> <td></td> <td align="right"> <?php foreach ($histogram_year as $key => $value) { echo '<div>' . $key . '</div>'; } ?> </td> <td></td> <td></td> <td class="bar"> <?php foreach ($histogram_year as $key => $value) { echo '<div><div class="out-statistics"><div style="width: ' . $value / $max_year * 100 . 'px;" class="in"></div></div></div>'; } ?> </td> <td> <?php foreach ($histogram_year as $key => $value) { echo '<div style="text-align: right;">' . $value . '</div>'; } ?> </td> <td></td> </tr> <tr class="odd mouseover"> <td></td> <td>By month:</td> <td></td> <td align="right"> <?php foreach ($histogram as $key => $value) { echo '<div>' . $key . '</div>'; } ?> </td> <td></td> <td></td> <td class="bar"> <?php foreach ($histogram as $key => $value) { echo '<div><div class="out-statistics"><div style="width: ' . $value / $max * 100 . 'px;" class="in"></div></div></div>'; } ?> </td> <td> <?php foreach ($histogram as $key => $value) { echo '<div style="text-align: right;">' . $value . '</div>'; } ?> </td> <td></td> </tr> <tr class="header"> <td></td> <td>Filesize:</td> <td colspan="7"></td> </tr> <tr class="odd mouseover"> <td></td> <td>Media:</td> <td></td> <td align="right"><?php echo formattedSize($track['sum_size']); ?> (<?php echo formattedSize($media_used_space) . ' [' . number_format($media_used_space / $media_total_space * 100, 1) . '%] used of ' . formattedSize($media_total_space) . ' total'; ?> )</td> <td></td> <td></td> <td class="bar" onMouseOver="return overlib('<?php echo number_format($media_used_space / $media_total_space * 100, 1) . '%<br>' . formattedSize($media_used_space) . ' / ' . formattedSize($media_total_space); ?> ');" onMouseOut="return nd();"><div class="out-statistics"><div style="width: <?php echo round($media_used_space / $media_total_space * 100); ?> px;" class="in"></div></div></td> <td></td> <td></td> </tr> <tr class="even mouseover"> <td></td> <td>Cache:</td> <td></td> <td align="right"><?php echo formattedSize($cache['sum_size']); ?> (<?php echo formattedSize($cache_used_space) . ' [' . number_format($cache_used_space / $cache_total_space * 100, 1) . '%] used of ' . formattedSize($cache_total_space) . ' total'; ?> )</td> <td></td> <td></td> <td class="bar" onMouseOver="return overlib('<?php echo number_format($cache_used_space / $cache_total_space * 100, 1) . '%<br>' . formattedSize($cache_used_space) . ' / ' . formattedSize($cache_total_space); ?> ');" onMouseOut="return nd();"><div class="out-statistics"><div style="width: <?php echo round($cache_used_space / $cache_total_space * 100); ?> px;" class="in"></div></div></td> <td></td> <td></td> </tr> <tr class="odd mouseover"> <td></td> <td>Database:</td> <td></td> <td align="right"><?php echo formattedSize($database_size); ?> </td> <td colspan="5"></td> </tr> <?php if (is_dir($cfg['external_storage'])) { $external_storage_total_space = disk_total_space($cfg['external_storage']); $external_storage_free_space = disk_free_space($cfg['external_storage']); $external_storage_used_space = $external_storage_total_space - $external_storage_free_space; ?> <tr class="even mouseover"> <td></td> <td>External storage:</td> <td></td> <td align="right"><?php echo formattedSize($external_storage_used_space); ?> </td> <td></td> <td></td> <td class="bar" onMouseOver="return overlib('<?php echo number_format($external_storage_used_space / $external_storage_total_space * 100, 1) . '%<br>' . formattedSize($external_storage_used_space) . ' / ' . formattedSize($external_storage_total_space); ?> ');" onMouseOut="return nd();"><div class="out-statistics"><div style="width: <?php echo round($external_storage_used_space / $external_storage_total_space * 100); ?> px; overflow: hidden;" class="in"></div></div></td> <td></td> <td></td> </tr> <?php } ?> <tr class="header"> <td></td> <td>Playtime:</td> <td colspan="7"></td> </tr> <?php $i = 0; $query = mysql_query('SELECT audio_dataformat FROM track WHERE audio_dataformat != "" AND video_dataformat = "" GROUP BY audio_dataformat ORDER BY audio_dataformat'); while ($track = mysql_fetch_assoc($query)) { $audio_dataformat = $track['audio_dataformat']; $track = mysql_fetch_assoc(mysql_query('SELECT SUM(miliseconds) AS sum_miliseconds FROM track WHERE audio_dataformat = "' . mysql_real_escape_string($audio_dataformat) . '" AND video_dataformat = ""')); ?> <tr class="<?php echo $i++ & 1 ? 'even' : 'odd'; ?> mouseover"> <td></td> <td><a href="statistics.php?audio_dataformat=<?php echo $audio_dataformat; ?> "><?php echo $audio_dataformat; ?> :</a></td> <td></td> <td align="right"><?php echo formattedTime($track['sum_miliseconds']); ?> [<?php echo number_format($track['sum_miliseconds'] / $total_miliseconds * 100, 1); ?> %]</td> <td></td> <td></td> <td class="bar" style="cursor: pointer;" onClick="window.location.href='<?php echo NJB_HOME_URL; ?> statistics.php?audio_dataformat=<?php echo $audio_dataformat; ?> ';" onMouseOver="return overlib('<?php echo number_format($track['sum_miliseconds'] / $total_miliseconds * 100, 1); ?> %');" onMouseOut="return nd();"><div class="out-statistics"><div style="width: <?php echo round($track['sum_miliseconds'] / $total_miliseconds * 100); ?> px; overflow: hidden;" class="in"></div></div></td> <td></td> <td></td> </tr> <?php } $query = mysql_query('SELECT video_dataformat FROM track WHERE video_dataformat != "" GROUP BY video_dataformat ORDER BY video_dataformat'); while ($track = mysql_fetch_assoc($query)) { $video_dataformat = $track['video_dataformat']; $track = mysql_fetch_assoc(mysql_query('SELECT SUM(miliseconds) AS sum_miliseconds FROM track WHERE video_dataformat = "' . mysql_real_escape_string($video_dataformat) . '"')); ?> <tr class="<?php echo $i++ & 1 ? 'even' : 'odd'; ?> mouseover nowrap"> <td></td> <td><a href="statistics.php?video_dataformat=<?php echo $video_dataformat; ?> "><?php echo $video_dataformat; ?> :</a></td> <td></td> <td align="right"><?php echo formattedTime($track['sum_miliseconds']); ?> [<?php echo number_format($track['sum_miliseconds'] / $total_miliseconds * 100, 1); ?> %]</td> <td></td> <td></td> <td class="bar" style="cursor: pointer;" onClick="window.location.href='<?php echo NJB_HOME_URL; ?> statistics.php?video_dataformat=<?php echo $video_dataformat; ?> ';" onMouseOver="return overlib('<?php echo number_format($track['sum_miliseconds'] / $total_miliseconds * 100, 1); ?> %');" onMouseOut="return nd();"><div class="out-statistics"><div style="width: <?php echo round($track['sum_miliseconds'] / $total_miliseconds * 100); ?> px; overflow: hidden;" class="in"></div></td> <td></td> <td></td> </tr> <?php } ?> <tr class="<?php echo $i++ & 1 ? 'even' : 'odd'; ?> mouseover nowrap"> <td></td> <td><a href="statistics.php?action=all">Total playtime:</a></td> <td></td> <td align="right"><?php echo formattedTime($total_miliseconds); ?> </td> <td colspan="5"></td> </tr> <?php if ($cfg['access_admin']) { ?> <tr class="header"> <td></td> <td>Duplicate:</td> <td colspan="7"></td> </tr> <tr class="odd mouseover"> <td></td> <td><a href="statistics.php?action=duplicateContent">Content:</a></td> <td></td> <td align="right"><?php echo (int) $duplicate_content; ?> </td> <td colspan="5"></td> </tr> <tr class="even mouseover"> <td></td> <td><a href="statistics.php?action=duplicateName">Name:</a></td> <td></td> <td align="right"><?php echo (int) $duplicate_name; ?> </td> <td colspan="5"></td> </tr> <?php } $i = 0; $no_image_front = mysql_num_rows(mysql_query('SELECT album_id FROM bitmap WHERE image_front = ""')); $no_image_front_cover = mysql_num_rows(mysql_query('SELECT album_id FROM bitmap WHERE image_front_width * image_front_height < ' . $cfg['image_front_cover_treshold'])); $no_image_back_cover = mysql_num_rows(mysql_query('SELECT album_id FROM bitmap WHERE image_back = ""')); if ($cfg['access_admin'] && ($no_image_front > 0 || $no_image_front_cover > 0 || $no_image_back_cover > 0)) { ?> <tr class="header"> <td></td> <td>No image:</td> <td colspan="7"></td> </tr> <?php if ($no_image_front > 0) { ?> <tr class="<?php echo $i++ & 1 ? 'even' : 'odd'; ?> mouseover"> <td></td> <td><a href="statistics.php?action=noImageFront"><?php echo $cfg['image_front']; ?> :</a></td> <td></td> <td align="right"><?php echo $no_image_front; ?> </td> <td colspan="5"></td> </tr> <?php } if ($no_image_front_cover > 0) { ?> <tr class="<?php echo $i++ & 1 ? 'even' : 'odd'; ?> mouseover"> <td></td> <td><a href="statistics.php?action=noImageFrontCover"><?php echo $cfg['image_front']; ?> for cover:</a></td> <td></td> <td align="right"><?php echo $no_image_front_cover; ?> </td> <td colspan="5"></td> </tr> <?php } /* if ($no_image_back_cover > 0) { ?> <tr class="<?php echo ($i++ & 1) ? 'even' : 'odd'; ?> mouseover"> <td></td> <td><a href="statistics.php?action=noImageBackCover"><?php echo $cfg['image_back']; ?> for cover:</a></td> <td></td> <td align="right"><?php echo $no_image_back_cover; ?></td> <td colspan="5"></td> </tr> <?php } */ } $error = mysql_num_rows(mysql_query('SELECT error FROM track WHERE error != ""')); if ($cfg['access_admin'] && $error > 0) { ?> <tr class="header"> <td></td> <td>File:</td> <td colspan="9"></td> </tr> <tr class="odd_error mouseover"> <td></td> <td><a href="statistics.php?action=fileError">Error:</a></td> <td></td> <td align="right"><?php echo $error; ?> </td> <td colspan="5"></td> </tr> <?php } if ($cfg['access_admin'] == false) { ?> <tr class="footer"> <td></td> <td colspan="7">Other rows are only visible with administrator rights.</td> <td></td> </tr> <?php } ?> </table> <?php require_once 'include/footer.inc.php'; }
<td id="track<?php echo $i; ?> _delete"><?php if ($cfg['access_play']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=deleteIndex&index=' . $i . '&menu=playlist\',deletePLitem);"><span class="typcn typcn-delete" style="font-size: 30px; color: #555555;"><span></a>'; } ?> </td> <td></td> <td align="right"><?php if (isset($table_track['miliseconds'])) { echo formattedTime($table_track['miliseconds']); } ?> </td> <td></td> </tr> <?php } ?> </table> <script type="text/javascript"> <!-- var previous_hash = '<?php echo $hash;
function executionTime() { $miliseconds = round((microtime(true) - NJB_START_TIME) * 1000); $seconds = round($miliseconds / 1000); if ($miliseconds < 1000) { return $miliseconds . ' ms'; } if ($seconds < 60) { return $seconds . ' seconds'; } return formattedTime($miliseconds); }
function online() { global $cfg, $db; authenticate('access_admin'); // formattedNavigator $nav = array(); $nav['name'][] = 'Configuration'; $nav['url'][] = 'config.php'; $nav['name'][] = 'Online'; require_once 'include/header.inc.php'; ?> <table cellspacing="0" cellpadding="0" class="border"> <tr class="header"> <td class="space"></td> <td>User</td> <td class="textspace"></td> <td align="right">Visit</td> <td class="textspace"></td> <td align="right">Hit</td> <td class="textspace"></td> <td>IP</td> <td align="right">Idle</td> <td class="space"></td> </tr> <tr class="line"><td colspan="13"></td></tr> <?php $i = 0; $cfg['ip_tools'] = str_replace('&', '&', $cfg['ip_tools']); $query = mysql_query('SELECT logged_in, hit_counter, visit_counter, idle_time, ip, user_agent, user.username, user.user_id FROM session, user WHERE idle_time > ' . (int) (time() - 86400) . ' AND hit_counter > 0 AND session.user_id = user.user_id ORDER BY idle_time DESC'); while ($session = mysql_fetch_assoc($query)) { $country_name = ''; // Get local network $ip = array(); $ip['lower'][] = '192.168.0.0'; $ip['upper'][] = '192.168.255.255'; $ip['name'][] = 'Local area network'; $ip['lower'][] = '172.16.0.0'; $ip['upper'][] = '172.31.255.255'; $ip['name'][] = 'Local area network'; $ip['lower'][] = '10.0.0.0'; $ip['upper'][] = '10.255.255.255'; $ip['name'][] = 'Local area network'; $ip['lower'][] = '169.254.0.0'; $ip['upper'][] = '169.254.255.255'; $ip['name'][] = 'Automatic private IP range'; $ip['lower'][] = '127.0.0.0'; $ip['upper'][] = '127.255.255.255'; $ip['name'][] = 'Loopback'; $session_ip = ip2long($session['ip']); foreach ($ip['name'] as $key => $value) { if ($session_ip >= ip2long($ip['lower'][$key]) && $session_ip <= ip2long($ip['upper'][$key])) { $country_name = $ip['name'][$key]; $flag = $cfg['img'] . 'small_uncheck.png'; break; } } if (in_array($session['ip'], array('::1', '0:0:0:0:0:0:0:1'))) { $country_name = 'Loopback'; $flag = $cfg['img'] . 'small_uncheck.png'; } if ($country_name == '') { // Get country code $reverse_ip = explode('.', $session['ip']); $reverse_ip = array_reverse($reverse_ip); $reverse_ip = implode('.', $reverse_ip); $lookup = $reverse_ip . '.zz.countries.nerd.dk'; $code = @gethostbyname($lookup); if ($code != $lookup) { $code = explode('.', $code); $code = 256 * (int) $code[2] + (int) $code[3]; $query3 = mysql_query('SELECT iso, name FROM country WHERE code = ' . (int) $code); $country = mysql_fetch_assoc($query3); if (is_file('skin/' . $cfg['skin'] . '/flag/' . $country['iso'] . '.png')) { $country_name = $country['name']; $flag = 'skin/' . rawurlencode($cfg['skin']) . '/flag/' . $country['iso'] . '.png'; } } } if ($country_name == '') { $country_name = 'Unresolved / Unknown'; $flag = $cfg['img'] . 'small_uncheck.png'; } ?> <tr class="<?php echo $i++ & 1 ? 'even' : 'odd'; ?> mouseover"> <td></td> <td><a href="users.php?action=editUser&user_id=<?php echo $session['user_id']; ?> "> <i class="fa fa-sign-<?php echo $session['logged_in'] ? 'in' : 'out'; ?> fa-fw icon-small"></i> <?php echo html($session['username']); ?> </a> <div><?php echo addslashes(html($session['user_agent'])); ?> </div> </td> <td></td> <td align="right"><?php echo $session['visit_counter']; ?> </td> <td></td> <td align="right"><?php echo $session['hit_counter']; ?> </td> <td></td> <td><a href="<?php echo str_replace('%ip', rawurlencode($session['ip']), $cfg['ip_tools']); ?> " target="_blank"><?php echo html($session['ip']); ?> </a></td> <td align="right"><?php echo formattedTime((time() - $session['idle_time']) * 1000); ?> </td> <td></td> </tr> <?php } $query = mysql_query('SELECT idle_time AS start_time FROM session WHERE logged_in ORDER BY idle_time ASC LIMIT 1'); $session = mysql_fetch_assoc($query); ?> <tr class="line"><td colspan="13"></td></tr> <tr class="footer"> <td class="space"></td> <td colspan="11">Visit and hit count since: <?php echo date($cfg['date_format'], $session['start_time']); ?> </td> <td class="space"></td> </tr> </table> <br> <div class="buttons"> <span><a href="users.php?action=online">Refresh</a></span> <span><a onclick="return confirm('Are you sure you want to reset all sessions?')" href="users.php?action=resetSessions&sign=<?php echo $cfg['sign']; ?> ">Reset</a></span> </div> <?php require_once 'include/footer.inc.php'; }
function view3all() { global $cfg, $db; authenticate('access_media'); $artist = get('artist'); $title = get('title'); $filter = get('filter') or $filter = 'start'; $order = get('order') or $order = 'title'; $sort = get('sort') == 'desc' ? 'desc' : 'asc'; $sort_artist = 'asc'; $sort_title = 'asc'; $sort_featuring = 'asc'; $sort_album = 'asc'; $order_bitmap_artist = '<span class="typcn"></span>'; $order_bitmap_title = '<span class="typcn"></span>'; $order_bitmap_featuring = '<span class="typcn"></span>'; $order_bitmap_album = '<span class="typcn"></span>'; if (strlen($title) >= 1) { // formattedNavigator $nav = array(); $nav['name'][] = 'Library'; $nav['url'][] = 'index.php'; $nav['name'][] = $title; require_once 'include/header.inc.php'; if ($filter == 'start') { /* $title = strtolower($title); $separator = $cfg['separator']; $count = count($separator); $i=0; for ($i=0; $i<$count; $i++) { $pos = strpos($title,strtolower($separator[$i])); if ($pos !== false) { $title = trim(substr($title, 0 , $pos)); //break; } } */ $separator = $cfg['separator']; $count = count($separator); $title = findCoreTrackTitle($title); $title = mysql_real_escape_like($title); $query_string = ''; $i = 0; for ($i = 0; $i < $count; $i++) { $query_string = $query_string . ' OR LOWER(track.title) LIKE "' . $title . $separator[$i] . '%"'; } $filter_query = 'WHERE (LOWER(track.title) = "' . $title . '" ' . $query_string . ') AND track.album_id = album.album_id'; //echo $filter_query; } elseif ($filter == 'smart') { $filter_query = 'WHERE (track.title LIKE "%' . mysql_real_escape_like($title) . '%" OR track.title SOUNDS LIKE "' . mysql_real_escape_string($title) . '") AND track.album_id = album.album_id'; } elseif ($filter == 'exact') { $filter_query = 'WHERE track.title = "' . mysql_real_escape_string($title) . '" AND track.album_id = album.album_id'; } else { message(__FILE__, __LINE__, 'error', '[b]Unsupported input value for[/b][br]filter'); } $url = 'index.php?action=view3all&title=' . rawurlencode($title) . '&filter=' . $filter; } elseif (strlen($artist) >= 1) { // formattedNavigator $nav = array(); $nav['name'][] = 'Library'; $nav['url'][] = 'index.php'; $nav['name'][] = $artist; $nav['url'][] = 'index.php?action=view2&artist=' . rawurlencode($artist) . '&order=year'; $nav['name'][] = 'All tracks'; require_once 'include/header.inc.php'; $filter_query = 'WHERE track.artist="' . mysql_real_escape_string($artist) . '" AND track.album_id = album.album_id'; //$filter_query = 'WHERE track.artist="' . mysql_real_escape_string($artist) . '"'; $url = 'index.php?action=view3all&artist=' . rawurlencode($artist); } else { message(__FILE__, __LINE__, 'warning', '[b]Search string too short - min. 2 characters[/b][br][url=index.php][img]small_back.png[/img]Back to previous page[/url]'); } if ($order == 'artist' && $sort == 'asc') { $order_query = 'ORDER BY artist, title'; $order_bitmap_artist = '<span class="fa fa-sort-alpha-asc"></span>'; $sort_artist = 'desc'; } elseif ($order == 'artist' && $sort == 'desc') { $order_query = 'ORDER BY artist DESC, title DESC'; $order_bitmap_artist = '<span class="fa fa-sort-alpha-desc"></span>'; $sort_artist = 'asc'; } elseif ($order == 'title' && $sort == 'asc') { $order_query = 'ORDER BY title, album'; $order_bitmap_title = '<span class="fa fa-sort-alpha-asc"></span>'; $sort_title = 'desc'; } elseif ($order == 'title' && $sort == 'desc') { $order_query = 'ORDER BY title DESC, album DESC'; $order_bitmap_title = '<span class="fa fa-sort-alpha-desc"></span>'; $sort_title = 'asc'; } elseif ($order == 'featuring' && $sort == 'asc') { $order_query = 'ORDER BY featuring, title, artist'; $order_bitmap_featuring = '<span class="fa fa-sort-alpha-asc"></span>'; $sort_featuring = 'desc'; } elseif ($order == 'featuring' && $sort == 'desc') { $order_query = 'ORDER BY featuring DESC, title DESC, artist DESC'; $order_bitmap_featuring = '<span class="fa fa-sort-alpha-desc"></span>'; $sort_featuring = 'asc'; } elseif ($order == 'album' && $sort == 'asc') { $order_query = 'ORDER BY album, relative_file'; $order_bitmap_album = '<span class="fa fa-sort-alpha-asc"></span>'; $sort_album = 'desc'; } elseif ($order == 'album' && $sort == 'desc') { $order_query = 'ORDER BY album DESC, relative_file DESC'; $order_bitmap_album = '<span class="fa fa-sort-alpha-desc"></span>'; $sort_album = 'asc'; } else { message(__FILE__, __LINE__, 'error', '[b]Unsupported input value for[/b][br]order'); } /*$query = mysql_query('SELECT featuring FROM track, album ' . $filter_query . ' AND featuring <> ""'); if (mysql_fetch_row($query)) $featuring = true; else $featuring = false; */ ?> <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"><a <?php echo $order_bitmap_artist == '<span class="typcn"></span>' ? '' : 'class="sort_selected"'; ?> href="<?php echo $url; ?> &order=artist&sort=<?php echo $sort_artist; ?> ">Artist <?php echo $order_bitmap_artist; ?> </a></td> <td><a <?php echo $order_bitmap_title == '<span class="typcn"></span>' ? '' : 'class="sort_selected"'; ?> href="<?php echo $url; ?> &order=title&sort=<?php echo $sort_title; ?> ">Title <?php echo $order_bitmap_title; ?> </a></td> <td><a <?php echo $order_bitmap_album == '<span class="typcn"></span>' ? '' : 'class="sort_selected"'; ?> href="<?php echo $url; ?> &order=album&sort=<?php echo $sort_album; ?> ">Album <?php echo $order_bitmap_album; ?> </a></td> <td align="right" class="time">Time</td> <td class="space right"></td> </tr> <?php $i = 0; $query = mysql_query('SELECT track.artist, track.title, track.number, track.featuring, track.album_id, track.track_id, track.miliseconds, track.relative_file, album.image_id, album.album FROM track, album ' . $filter_query . ' ' . $order_query); //$query = mysql_query('SELECT track.artist, track.title, track.featuring, track.album_id, track.track_id, track.miliseconds FROM track ' . $filter_query . ' ' . $order_query); 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; ?> "> <div onclick='toggleMenuSub(<?php echo $i; ?> );'> <i id="menu-icon<?php echo $i; ?> " 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['track_id'] . '\');" 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 artist="' . mysql_real_escape_string($track['artist']) . '"')) > 1) { echo '<a href="index.php?action=view2&artist=' . rawurlencode($track['artist']) . '&order=year">' . html($track['artist']) . '</a>'; } else { echo html($track['artist']); } ?> </td> <td><?php if ($cfg['access_play']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=insertSelect&playAfterInsert=yes&track_id=' . $track['track_id'] . '\');" onMouseOver="return overlib(\'Play track\');" onMouseOut="return nd();">' . html($track['title']) . '</a>'; } elseif ($cfg['access_add']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=addSelect&track_id=' . $track['track_id'] . '\');" 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['track_id'] . '&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['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 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; ?> " onclick='offMenuSub(<?php echo $i; ?> );'> <div><?php if ($cfg['access_play']) { echo '<a href="javascript:ajaxRequest(\'play.php?action=insertSelect&playAfterInsert=yes&track_id=' . $track['track_id'] . '\');" 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['track_id'] . '\');" 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['track_id'] . '\');" 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['track_id'] . '\');" 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['track_id'] . '&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['track_id'] . '&download_id=' . $cfg['download_id'] . '" ' . onmouseoverDownloadTrack($track['track_id']) . '><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>' . "\n"; require_once 'include/footer.inc.php'; }