0 "; } $req = "SELECT temp_int FROM {$jamroom_db['temp']} WHERE temp_key = 'spotlight_rotation' LIMIT 1"; $_rt = dbQuery($req,'SINGLE'); if (!is_numeric($_rt['temp_int'])) { $_rt['temp_int'] = 0; $create_new = 'yes'; } $req = "SELECT i.band_id FROM {$jamroom_db['song_info']} s LEFT JOIN {$jamroom_db['song_hifi']} h ON h.song_id = s.song_id LEFT JOIN {$jamroom_db['song_lofi']} l ON l.song_id = s.song_id LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = s.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota {$ad1} WHERE i.band_update != 99 AND i.band_id > {$_rt['temp_int']} AND i.band_time <= {$config['new_ignore']} AND s.song_show != 'no' AND (h.hifi_size > 0 OR l.lofi_size > 0) AND q.quota_spot = 'yes' {$ad2} GROUP BY i.band_id ORDER BY i.band_id ASC LIMIT {$count}"; if (is_numeric($count) && $count > 1) { $_bi = dbQuery($req,'NUMERIC'); $_sv = end($_bi); $sid = $_sv['band_id']; $updt = 'yes'; foreach ($_bi as $_if) { $band[] = $_if['band_id']; } } else { $_bi = dbQuery($req,'SINGLE'); $sid = $_bi['band_id']; $updt = 'yes'; $band = $_bi['band_id']; } if (!is_numeric($band) && !is_array($band)) { $req = "SELECT i.band_id FROM {$jamroom_db['song_info']} s LEFT JOIN {$jamroom_db['song_hifi']} h ON h.song_id = s.song_id LEFT JOIN {$jamroom_db['song_lofi']} l ON l.song_id = s.song_id LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = s.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota {$ad1} WHERE i.band_update != 99 AND q.quota_spot = 'yes' AND s.song_show != 'no' AND (h.hifi_size > 0 OR l.lofi_size > 0) AND i.band_time <= {$config['new_ignore']} {$ad2} GROUP BY i.band_id ORDER BY i.band_id ASC LIMIT {$count}"; if (is_numeric($count) && $count > 1) { $_bi = dbQuery($req,'NUMERIC'); $_sv = end($_bi); $sid = $_sv['band_id']; $updt = 'yes'; foreach ($_bi as $_if) { $band[] = $_if['band_id']; } } else { $_bi = dbQuery($req,'SINGLE'); $sid = $_bi['band_id']; $updt = 'yes'; $band = $_bi['band_id']; } } if ((isset($updt) && $updt == 'yes') && $create_new != 'yes') { $req = "UPDATE {$jamroom_db['temp']} SET temp_int = {$sid} WHERE temp_key = 'spotlight_rotation' LIMIT 1"; $cnt = dbQuery($req,'COUNT'); } elseif (is_numeric($band)) { $req = "DELETE FROM {$jamroom_db['temp']} WHERE temp_key = 'spotlight_rotation'"; $res = dbQuery($req); $req = "INSERT INTO {$jamroom_db['temp']} (temp_key, temp_int) VALUES ('spotlight_rotation',{$sid})"; $cnt = dbQuery($req,'COUNT'); } $_bi = array(); unset($_bi,$cnt); } $rv = "SELECT s.song_id, s.song_time, s.song_name, s.song_album, s.song_label, s.song_credits, s.song_advise, s.song_isrc, s.song_alicense, s.song_slicense, s.song_lyrics, s.song_history, i.band_id, i.band_time, i.band_name, i.band_url, i.band_location, i.band_story, i.band_website, i.band_influence, i.band_soundlike, q.quota_id, q.quota_name, q.quota_disk, q.quota_max, q.quota_message, q.quota_search, q.quota_radio, q.quota_store, q.quota_rate, q.quota_remrate, q.quota_calendar, q.quota_comments, h.hifi_time, h.hifi_update, h.hifi_name, h.hifi_type, h.hifi_size, h.hifi_download, h.hifi_extension, h.hifi_bitrate, h.hifi_smprate, h.hifi_length, l.lofi_time, l.lofi_update, l.lofi_name, l.lofi_type, l.lofi_size, l.lofi_download, l.lofi_extension, l.lofi_bitrate, l.lofi_smprate, l.lofi_length, c.hifi_scount_total AS hifi_streams, c.lofi_scount_total AS lofi_streams, c.hifi_dcount_total AS hifi_downloads, c.lofi_dcount_total AS lofi_downloads, SUM( c.hifi_scount_total + c.lofi_scount_total ) AS total_stream, SUM( c.hifi_dcount_total + c.lofi_dcount_total ) AS total_download, SUM( c.hifi_scount_total + c.lofi_scount_total + c.hifi_dcount_total + c.lofi_dcount_total ) AS total_count, c.spot_count_total, g.genre_name, t.rating_1 AS song_rating_1, t.rating_2 AS song_rating_2, t.rating_3 AS song_rating_3, t.rating_4 AS song_rating_4, t.rating_5 AS song_rating_5, t.rating_number AS song_rating_number, t.rating_average AS song_rating_average, r.rating_1, r.rating_2, r.rating_3, r.rating_4, r.rating_5, "; if (isset($config['rating_method']) && $config['rating_method'] == 'band') { $rv .= "r.rating_number, r.rating_average, "; } else { $rv .= "SUM(r.rating_number) AS rating_number, ROUND(SUM(r.rating_average) / COUNT(r.rating_average),2) as rating_average, "; } $rv .= " v.server_id, v.server_ip, v.server_name, v.server_url FROM {$jamroom_db['song_info']} s LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = s.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota "; if ($config['spotlight_images'] == 'yes') { $rv .= "LEFT JOIN {$jamroom_db['band_image']} m ON m.band_id = i.band_id "; } $rv .= "LEFT JOIN {$jamroom_db['song_hifi']} h ON h.song_id = s.song_id LEFT JOIN {$jamroom_db['song_lofi']} l ON l.song_id = s.song_id LEFT JOIN {$jamroom_db['scounter']} c ON c.song_id = s.song_id LEFT JOIN {$jamroom_db['song_genre']} g ON g.genre_id = s.song_genre LEFT JOIN {$jamroom_db['rating']} t ON (t.song_id = s.song_id AND t.rating_type = 'song') "; if (isset($config['rating_method']) && $config['rating_method'] == 'band') { $rv .= "LEFT JOIN {$jamroom_db['rating']} r ON (r.band_id = i.band_id AND r.rating_type = 'band') "; } else { $rv .= "LEFT JOIN {$jamroom_db['rating']} r ON (r.song_id = t.song_id AND r.rating_type = 'song') "; } $rv .= "LEFT JOIN {$jamroom_db['servers']} v ON v.server_id = i.band_server WHERE i.band_update != 99 AND i.band_time <= {$config['new_ignore']} AND q.quota_spot = 'yes' AND s.song_show != 'no' AND (h.hifi_size > 0 OR l.lofi_size > 0) "; if ($config['spotlight_images'] == 'yes') { $rv .= "AND m.image_size > 0 "; } if (is_array($genre)) { foreach ($genre as $k => $gen) { $genre["$k"] = urldecode($gen); } $rv .= "AND g.genre_name IN ('". @implode("','",$genre) ."') "; } elseif (!empty($genre) && $genre != 'null') { $genre = urldecode($genre); $rv .= "AND g.genre_name = '{$genre}' "; } if (is_numeric($quota)) { $rv .= "AND q.quota_id = {$quota} "; } elseif (is_array($quota)) { $rv .= "AND q.quota_id IN(". @implode(',',$quota) .") "; } if (is_numeric($song)) { $rv .= "AND s.song_id = {$song} "; } elseif (is_array($song)) { $rv .= "AND s.song_id IN (". @implode(',',$song) .") "; } if (is_numeric($band)) { $rv .= "AND i.band_id = {$band} GROUP BY s.song_id ORDER BY RAND() LIMIT 1"; } elseif (is_array($band)) { $rv .= "AND i.band_id IN (". @implode(',',$band) .") GROUP BY i.band_id ORDER BY RAND() LIMIT {$count}"; } else { if (is_numeric($config['spotlight_mode']) && $config['spotlight_mode'] == 2) { $rv .= "GROUP BY s.song_id ORDER BY c.spot_count_total ASC LIMIT {$count}"; } else { $rv .= "GROUP BY s.song_id ORDER BY RAND() LIMIT {$count}"; } } $_out = dbQuery($rv,'NUMERIC'); dbClose(); return $_out; } function rankVideoArtist($band = 'null',$count = '1',$genre = 'null',$quota = 'null',$video = 'null') { global $config, $jamroom_db, $con; if ((is_numeric($config['spotlight_mode']) && $config['spotlight_mode'] == 3) && (empty($band) || $band == 'null')) { if ($config['spotlight_images'] == 'yes') { $ad1 = " LEFT JOIN {$jamroom_db['band_image']} m ON m.band_id = i.band_id "; $ad2 = " AND m.image_size > 0 "; } $req = "SELECT temp_int FROM {$jamroom_db['temp']} WHERE temp_key = 'video_rotation' LIMIT 1"; $_rt = dbQuery($req,'SINGLE'); if (!is_numeric($_rt['temp_int'])) { $_rt['temp_int'] = 0; $create_new = 'yes'; } $req = "SELECT i.band_id FROM {$jamroom_db['video']} v LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = v.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota {$ad1} WHERE i.band_update != 99 AND i.band_id > {$_rt['temp_int']} AND i.band_time <= {$config['new_ignore']} AND q.quota_spot = 'yes' {$ad2} GROUP BY i.band_id ORDER BY i.band_id ASC LIMIT {$count}"; if (is_numeric($count) && $count > 1) { $_bi = dbQuery($req,'NUMERIC'); $_sv = end($_bi); $sid = $_sv['band_id']; $updt = 'yes'; foreach ($_bi as $_if) { $band[] = $_if['band_id']; } } else { $_bi = dbQuery($req,'SINGLE'); $sid = $_bi['band_id']; $updt = 'yes'; $band = $_bi['band_id']; } if (!is_numeric($band) && !is_array($band)) { $req = "SELECT i.band_id FROM {$jamroom_db['video']} v LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = v.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota {$ad1} WHERE q.quota_spot = 'yes' AND i.band_update != 99 AND i.band_time <= {$config['new_ignore']} {$ad2} GROUP BY i.band_id ORDER BY i.band_id ASC LIMIT {$count}"; if (is_numeric($count) && $count > 1) { $_bi = dbQuery($req,'NUMERIC'); $_sv = end($_bi); $sid = $_sv['band_id']; $updt = 'yes'; foreach ($_bi as $_if) { $band[] = $_if['band_id']; } } else { $_bi = dbQuery($req,'SINGLE'); $sid = $_bi['band_id']; $updt = 'yes'; $band = $_bi['band_id']; } } if ((isset($updt) && $updt == 'yes') && $create_new != 'yes') { $req = "UPDATE {$jamroom_db['temp']} SET temp_int = {$sid} WHERE temp_key = 'video_rotation' LIMIT 1"; $cnt = dbQuery($req,'COUNT'); } elseif (is_numeric($band)) { $req = "DELETE FROM {$jamroom_db['temp']} WHERE temp_key = 'video_rotation'"; $res = dbQuery($req); $req = "INSERT INTO {$jamroom_db['temp']} (temp_key, temp_int) VALUES ('video_rotation',{$sid})"; $cnt = dbQuery($req,'COUNT'); } $_bi = array(); unset($_bi,$cnt); } $rv = "SELECT v.video_id, v.video_created, v.video_updated, v.video_name, v.video_caption, v.video_size, v.video_download, v.video_filename, v.video_extension, v.video_bitrate, v.video_resolution, v.video_length, v.video_license, v.video_genre, v.video_credits, v.video_advise, v.video_type, i.band_id, i.band_time, i.band_name, i.band_url, i.band_location, i.band_story, i.band_website, i.band_influence, i.band_soundlike, q.quota_id, q.quota_name, q.quota_disk, q.quota_max, q.quota_message, q.quota_search, q.quota_radio, q.quota_store, q.quota_rate, q.quota_remrate, q.quota_calendar, q.quota_comments, SUM(c.video_scount + c.video_dcount) AS video_total_count, c.video_scount, c.video_dcount, c.video_scount_total, c.video_dcount_total, g.genre_name, t.rating_1 AS video_rating_1, t.rating_2 AS video_rating_2, t.rating_3 AS video_rating_3, t.rating_4 AS video_rating_4, t.rating_5 AS video_rating_5, t.rating_number AS video_rating_number, t.rating_average AS video_rating_average, r.rating_1, r.rating_2, r.rating_3, r.rating_4, r.rating_5, "; if (isset($config['rating_method']) && $config['rating_method'] == 'band') { $rv .= "r.rating_number, r.rating_average, "; } else { $rv .= "SUM(r.rating_number) AS rating_number, ROUND(SUM(r.rating_average) / COUNT(r.rating_average),2) as rating_average, "; } $rv .= " s.server_id, s.server_ip, s.server_name, s.server_url FROM {$jamroom_db['video']} v LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = v.band_id LEFT JOIN {$jamroom_db['band_image']} m ON m.band_id = i.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota "; $rv .= "LEFT JOIN {$jamroom_db['vcounter']} c ON c.video_id = v.video_id LEFT JOIN {$jamroom_db['video_genre']} g ON g.genre_id = v.video_genre LEFT JOIN {$jamroom_db['rating']} t ON (t.song_id = v.video_id AND t.rating_type = 'video') "; if (isset($config['rating_method']) && $config['rating_method'] == 'band') { $rv .= "LEFT JOIN {$jamroom_db['rating']} r ON (r.band_id = i.band_id AND r.rating_type = 'band') "; } else { $rv .= "LEFT JOIN {$jamroom_db['rating']} r ON (r.song_id = t.song_id AND r.rating_type = 'video') "; } $rv .= "LEFT JOIN {$jamroom_db['servers']} s ON s.server_id = i.band_server WHERE i.band_update != 99 AND i.band_time <= {$config['new_ignore']} AND q.quota_spot = 'yes' AND v.video_show != 'no' AND v.video_size > 0 "; if ($config['spotlight_images'] == 'yes') { $rv .= "AND m.image_size > 0 "; } if (is_array($genre)) { foreach ($genre as $k => $gen) { $genre["$k"] = urldecode($gen); } $rv .= "AND g.genre_name IN ('". @implode("','",$genre) ."') "; } elseif (!empty($genre) && $genre != 'null') { $genre = urldecode($genre); $rv .= "AND g.genre_name = '{$genre}' "; } if (is_numeric($quota)) { $rv .= "AND q.quota_id = {$quota} "; } elseif (is_array($quota)) { $rv .= "AND q.quota_id IN(". @implode(',',$quota) .") "; } if (is_numeric($video)) { $rv .= "AND v.video_id = {$video} "; } elseif (is_array($video)) { $rv .= "AND v.video_id IN (". @implode(',',$video) .") "; } if (is_numeric($band)) { $rv .= "AND i.band_id = {$band} GROUP BY v.video_id ORDER BY RAND() LIMIT 1"; } elseif (is_array($band)) { $rv .= "AND i.band_id IN (". @implode(',',$band) .") GROUP BY i.band_id ORDER BY RAND() LIMIT {$count}"; } else { if (is_numeric($config['spotlight_mode']) && $config['spotlight_mode'] == 2) { $rv .= "GROUP BY v.video_id ORDER BY c.video_spot_total ASC LIMIT {$count}"; } else { $rv .= "GROUP BY v.video_id ORDER BY RAND() LIMIT {$count}"; } } $_out = dbQuery($rv,'NUMERIC'); dbClose(); return $_out; } function rankAllLinks(&$_rep) { global $jamroom, $_row; $_rep['PLAYALL_HIFI_MP3_URL'] = "{$jamroom['jm_htm']}/play.php?mode=song_hifi&band_id={$_row['band_id']}&song_id=all&type=mp3"; $_rep['PLAYALL_HIFI_WMA_URL'] = "{$jamroom['jm_htm']}/play.php?mode=song_hifi&band_id={$_row['band_id']}&song_id=all&type=wma"; $_rep['PLAYALL_HIFI_OGG_URL'] = "{$jamroom['jm_htm']}/play.php?mode=song_hifi&band_id={$_row['band_id']}&song_id=all&type=ogg"; $_rep['PLAYALL_LOFI_MP3_URL'] = "{$jamroom['jm_htm']}/play.php?mode=song_lofi&band_id={$_row['band_id']}&song_id=all&type=mp3"; $_rep['PLAYALL_LOFI_WMA_URL'] = "{$jamroom['jm_htm']}/play.php?mode=song_lofi&band_id={$_row['band_id']}&song_id=all&type=wma"; $_rep['PLAYALL_LOFI_OGG_URL'] = "{$jamroom['jm_htm']}/play.php?mode=song_lofi&band_id={$_row['band_id']}&song_id=all&type=ogg"; return(true); } function rankPlayLinks($url,&$_rep) { global $jamroom, $_row; if ($_row['hifi_download'] == 'nos') { $_rep['SONG_HIFI_PLAY_URL'] = ''; $_rep['HIFI_ALLOW_STREAM'] = 'no'; } else { $_rep['SONG_HIFI_PLAY_URL'] = "{$jamroom['jm_htm']}/play.php?band_id={$_row['band_id']}&song_id={$_row['song_id']}&mode=song_hifi"; $_rep['HIFI_ALLOW_STREAM'] = 'yes'; } if ($_row['hifi_download'] == 'yes') { $_rep['SONG_HIFI_DOWNLOAD_URL'] = "{$url}/download.php?band_id={$_row['band_id']}&song_id={$_row['song_id']}&mode=song_hifi"; $_rep['HIFI_ALLOW_DOWNLOAD'] = 'yes'; } else { $_rep['SONG_HIFI_DOWNLOAD_URL'] = ''; $_rep['HIFI_ALLOW_DOWNLOAD'] = 'no'; } if ($_row['lofi_download'] == 'nos') { $_rep['SONG_LOFI_PLAY_URL'] = ''; $_rep['LOFI_ALLOW_STREAM'] = 'no'; } else { $_rep['SONG_LOFI_PLAY_URL'] = "{$jamroom['jm_htm']}/play.php?band_id={$_row['band_id']}&song_id={$_row['song_id']}&mode=song_lofi"; $_rep['LOFI_ALLOW_STREAM'] = 'yes'; } if ($_row['lofi_download'] == 'yes') { $_rep['SONG_LOFI_DOWNLOAD_URL'] = "{$url}/download.php?band_id={$_row['band_id']}&song_id={$_row['song_id']}&mode=song_lofi"; $_rep['LOFI_ALLOW_DOWNLOAD'] = 'yes'; } else { $_rep['SONG_LOFI_DOWNLOAD_URL'] = ''; $_rep['LOFI_ALLOW_DOWNLOAD'] = 'no'; } } function rankQuotaVars(&$_rep) { global $_row; foreach ($_row as $key => $val) { if (strpos($key,'uota_')) { $_rep["$key"] = $val; } } $_rep = array_change_key_case($_rep,CASE_UPPER); return(true); } if (is_numeric($config['new_ignore']) && $config['new_ignore'] > 1) { $config['new_ignore'] = time() - ($config['new_ignore'] * 60); } else { $config['new_ignore'] = time(); } $_post = getPostVars(); if (empty($_post['order']) || !is_numeric($_post['order'])) { $_post['order'] = 1; } switch($_post['mode']) { case 'band': if ($_post['order'] > 15 || $_post['order'] < 1) { $_post['order'] = 1; } break; case 'song': if ($_post['order'] > 15 || $_post['order'] < 1) { $_post['order'] = 1; } break; case 'video': if ($_post['order'] > 15 || $_post['order'] < 1) { $_post['order'] = 1; } break; case 'user': if ($_post['order'] > 5 || $_post['order'] < 1) { $_post['order'] = 1; } break; case 'store': if ($_post['order'] > 7 || $_post['order'] < 1) { $_post['order'] = 1; } break; case 'radio': if ($_post['order'] > 6 || $_post['order'] < 1) { $_post['order'] = 1; } break; case 'photo': if ($_post['order'] > 8 || $_post['order'] < 1) { $_post['order'] = 1; } break; case 'page': if ($_post['order'] > 3 || $_post['order'] < 1) { $_post['order'] = 1; } break; case 'spotlight': case 'video_spotlight': break; default: $_post['mode'] = 'band'; $_post['order'] = 1; break; } $next_url = "{$jamroom['jm_htm']}/ranking.php?mode={$_post['mode']}&order={$_post['order']}"; $prev_url = "{$jamroom['jm_htm']}/ranking.php?mode={$_post['mode']}&order={$_post['order']}"; if (isset($_post['show']) && is_numeric($_post['show'])) { if ($_post['show'] > $config['number_limit'] || $_post['show'] < 0) { $_post['show'] = $config['number_limit']; } unset($_post['pagebreak'],$_post['pagenum']); $next_url .= "&show={$_post['show']}"; $prev_url .= "&show={$_post['show']}"; } if (isset($_post['pagebreak']) && is_numeric($_post['pagebreak'])) { if ($_post['pagebreak'] > $config['page_results']) { $_post['pagebreak'] = $config['page_results']; } if ((!isset($_post['pagenum']) || !is_numeric($_post['pagenum'])) || empty($_post['pagenum'])) { $_post['pagenum'] = '1'; } if (!isset($_post['show']) || !is_numeric($_post['show'])) { $_post['show'] = $_post['pagebreak']; } } elseif ((isset($_post['show']) && is_numeric($_post['show'])) && $_post['show'] < $config['page_results']) { $_post['pagebreak'] = $_post['show']; } else { $_post['pagebreak'] = $config['page_results']; } if (is_numeric($_post['pagebreak']) && is_numeric($_post['pagenum']) && $_post['mode'] != 'spotlight') { $beg = ($_post['pagenum'] - 1) * $_post['pagebreak']; $rnum = $beg + 1; $next = $_post['pagenum'] + 1; if ($_post['pagenum'] <= 1) { $prev = 1; } else { $prev = $_post['pagenum'] - 1; } $next_url .= "&pagebreak={$_post['pagebreak']}&pagenum={$next}"; $prev_url .= "&pagebreak={$_post['pagebreak']}&pagenum={$prev}"; $_page = array( 'THIS_PAGE' => $_post['pagenum'], 'NEXT_PAGE_NUM' => $next, 'PREV_PAGE_NUM' => $prev, 'PAGEBREAK' => $_post['pagebreak'], 'ORDER' => $_post['order'] ); } else { $rnum = 1; $_page = array( 'THIS_PAGE' => 1, 'NEXT_PAGE_NUM' => '', 'PREV_PAGE_NUM' => '', 'PAGEBREAK' => $_post['pagebreak'], 'ORDER' => $_post['order'] ); } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { foreach ($_post['letter'] as $letter) { $next_url .= "&letter[]={$letter}"; $prev_url .= "&letter[]={$letter}"; } $letter_key = @implode('',$_post['letter']); } elseif (strlen($_post['letter']) == 1) { $next_url .= "&letter={$_post['letter']}"; $prev_url .= "&letter={$_post['letter']}"; $letter_key = $_post['letter']; } } if (isset($_post['quota']) && is_array($_post['quota'])) { $quota_key = @implode('-',$_post['quota']); foreach ($_post['quota'] as $in_quota) { $prev_url .= ""a[]={$in_quota}"; $next_url .= ""a[]={$in_quota}"; } } elseif (isset($_post['quota']) && is_numeric($_post['quota'])) { $quota_key = $_post['quota']; $prev_url .= ""a={$_post['quota']}"; $next_url .= ""a={$_post['quota']}"; } else { $quota_key = ''; } if (isset($_post['band_id']) && is_numeric($_post['band_id'])) { $band_cache = $_post['band_id']; } elseif (is_array($_post['band_id'])) { $band_cache = @implode('-',$_post['band_id']); } else { $band_cache = ''; } if (isset($_post['song_id']) && is_numeric($_post['song_id'])) { $song_cache = $_post['song_id']; } elseif (is_array($_post['song_id'])) { $song_cache = @implode('-',$_post['song_id']); } else { $song_cache = ''; } if (isset($_post['genre']) && is_array($_post['genre'])) { $genre_cache = @implode('-',$_post['genre']); foreach ($_post['genre'] as $gen) { $next_url .= '&genre[]='. urlencode($gen); $prev_url .= '&genre[]='. urlencode($gen); } $_page['SELECTED_GENRE'] = ''; } elseif (strlen($_post['genre']) > 0) { $genre_cache = $_post['genre']; $next_url .= '&genre='. urlencode($_post['genre']); $_page['SELECTED_GENRE'] = urldecode($_post['genre']); } else { $genre_cache = ''; $_page['SELECTED_GENRE'] = ''; } if (isset($_post['mode']) && $_post['mode'] != 'spotlight') { $_karray = array( $config['show_system_radio'], $quota_key, $letter_key, $_post['header_template'], $_post['row_template'], $_post['footer_template'], $_post['order'], $_post['mode'], $_post['pagebreak'], $_post['pagenum'], $band_cache, $_post['show'], $_post['type'], $_post['genre'], $song_cache ); $cache_key = "NR-" . md5(@implode('-',$_karray)); $cached = isCached($cache_key); if ($cached) { ob_start(); echo $cached; ob_end_flush(); exit; } $_karray = array(); unset($_karray); } ob_start(); $tpl_dir = "{$jamroom['jm_dir']}/templates/ranking"; if (isset($_post['mode']) && $_post['mode'] == 'spotlight') { $req = "SELECT message_id AS song_id, COUNT(comment_id) AS comment_count FROM {$jamroom_db['comments']} WHERE message_id != 0 "; if (is_numeric($_post['song_id'])) { $rv .= "AND message_id = {$_post['song_id']} "; } elseif (is_array($_post['song_id'])) { $rv .= "AND message_id IN (". @implode(',',$_post['song_id']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND band_id IN (". @implode(',',$_post['band_id']) .") "; } $req .= "AND comment_type = 'song' GROUP BY message_id"; $_cc = dbQuery($req,'song_id'); if (!is_numeric($_post['show'])) { $_post['show'] = 1; } $_tmp = rankSpotArtist($_post['band_id'],$_post['show'],$_post['genre'],$_post['quota'],$_post['song_id']); if (!is_array($_tmp)) { ob_end_clean(); jmErrorPage("there were no valid artists returned from the DB query - verify settings"); exit; } foreach ($_tmp as $_row) { $aurl = getJamroomUrl($_row['band_id'],$_row['server_url']); $btim = convertTime($_row['band_time'],$config['server_offset']); $stim = convertTime($_row['song_time'],$config['server_offset']); $_rep = array( 'MODE' => 'spotlight', 'BAND_ID' => $_row['band_id'], 'BAND_CREATED' => $_row['band_time'], 'BAND_DATE1' => gmstrftime($config['date1'],$btim), 'BAND_DATE2' => gmstrftime($config['date2'],$btim), 'BAND_DATE3' => gmstrftime($config['date3'],$btim), 'BAND_NAME' => stripHtml($_row['band_name']), 'BAND_URL_NAME' => $_row['band_url'], 'BAND_INFO' => bbDecode($_row['band_story']), 'BAND_LOCATION' => trim($_row['band_location']), 'BAND_WEBSITE' => $_row['band_website'], 'BAND_INFLUENCE' => $_row['band_influence'], 'BAND_SOUNDLIKE' => $_row['band_soundlike'], 'BAND_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['band_id']}&mode=band_image", 'BAND_RATING_FORM_URL' => "{$jamroom['jm_htm']}/rating.php?mode=rate_band&band_id={$_row['band_id']}", 'BAND_RATING_NUMBER' => $_row['rating_number'], 'BAND_RATING_AVERAGE' => $_row['rating_average'], 'BAND_RATING_1' => $_row['rating_1'], 'BAND_RATING_2' => $_row['rating_2'], 'BAND_RATING_3' => $_row['rating_3'], 'BAND_RATING_4' => $_row['rating_4'], 'BAND_RATING_5' => $_row['rating_5'], 'BAND_QUOTA' => $_row['quota_id'], 'SONG_ID' => $_row['song_id'], 'SONG_CREATED' => $_row['song_time'], 'SONG_DATE1' => gmstrftime($config['date1'],$stim), 'SONG_DATE2' => gmstrftime($config['date2'],$stim), 'SONG_DATE3' => gmstrftime($config['date3'],$stim), 'SONG_NAME' => stripHtml($_row['song_name']), 'SONG_ALBUM' => $_row['song_album'], 'SONG_LABEL' => $_row['song_label'], 'SONG_GENRE' => $_row['genre_name'], 'SONG_GENRE_URL' => urlencode($_row['genre_name']), 'SONG_CREDITS' => $_row['song_credits'], 'SONG_ADVISE' => $_row['song_advise'], 'SONG_ISRC' => $_row['song_isrc'], 'SONG_ALICENSE' => $_row['song_alicense'], 'SONG_SLICENSE' => $_row['song_slicense'], 'SONG_LYRICS' => bbDecode($_row['song_lyrics']), 'SONG_INFO' => bbDecode($_row['song_history']), 'SONG_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['band_id']}&song_id={$_row['song_id']}&mode=song_image", 'SONG_HIFI_TIME' => $_row['hifi_update'], 'SONG_LOFI_TIME' => $_row['lofi_update'], 'SONG_HIFI_NAME' => $_row['hifi_name'], 'SONG_LOFI_NAME' => $_row['lofi_name'], 'SONG_HIFI_TYPE' => $_row['hifi_type'], 'SONG_LOFI_TYPE' => $_row['lofi_type'], 'SONG_HIFI_SIZE' => $_row['hifi_size'], 'SONG_LOFI_SIZE' => $_row['lofi_size'], 'SONG_HIFI_DOWNLOAD' => $_row['hifi_download'], 'SONG_LOFI_DOWNLOAD' => $_row['lofi_download'], 'SONG_HIFI_EXTENSION' => $_row['hifi_extension'], 'SONG_LOFI_EXTENSION' => $_row['lofi_extension'], 'SONG_HIFI_BITRATE' => $_row['hifi_bitrate'], 'SONG_LOFI_BITRATE' => $_row['lofi_bitrate'], 'SONG_HIFI_SMPRATE' => $_row['hifi_smprate'], 'SONG_LOFI_SMPRATE' => $_row['lofi_smprate'], 'SONG_HIFI_LENGTH' => $_row['hifi_length'], 'SONG_LOFI_LENGTH' => $_row['lofi_length'], 'SONG_STREAM_COUNT' => $_row['total_stream'], 'SONG_DOWNLOAD_COUNT' => $_row['total_download'], 'SONG_TOTAL_COUNT' => $_row['total_count'], 'SONG_RATING_FORM_URL' => "{$jamroom['jm_htm']}/rating.php?mode=rate_song&band_id={$_row['band_id']}&song_id={$_row['song_id']}", 'SONG_RATING_NUMBER' => $_row['song_rating_number'], 'SONG_RATING_AVERAGE' => $_row['song_rating_average'], 'SONG_RATING_1' => $_row['song_rating_1'], 'SONG_RATING_2' => $_row['song_rating_2'], 'SONG_RATING_3' => $_row['song_rating_3'], 'SONG_RATING_4' => $_row['song_rating_4'], 'SONG_RATING_5' => $_row['song_rating_5'], 'ARTIST_URL' => "{$aurl}/{$config['artist_dir']}/{$_row['band_id']}/", 'SERVER_URL' => $aurl ); $_rep['COMMENT_COUNT'] = '0'; if (is_numeric($_cc["{$_row['song_id']}"]['comment_count'])) { $_rep['COMMENT_COUNT'] = $_cc["{$_row['song_id']}"]['comment_count']; } rankPlayLinks($aurl,$_rep); rankAllLinks($_rep); rankQuotaVars($_rep); if (isset($_post['row_template']) && is_array($_rep)) { htmlShowTemplate($_post['row_template'],array_merge($_page,$_rep),$tpl_dir); } jmSongCounter($_row['band_id'],$_row['song_id'],'spot_count','no'); } } elseif ((isset($_post['mode']) && $_post['mode'] == 'video_spotlight') && is_file("{$jamroom['jm_dir']}/video.php")) { $req = "SELECT message_id AS video_id, COUNT(comment_id) AS comment_count FROM {$jamroom_db['comments']} WHERE message_id != 0 "; if (is_numeric($_post['video_id'])) { $rv .= "AND message_id = {$_post['video_id']} "; } elseif (is_array($_post['video_id'])) { $rv .= "AND message_id IN (". @implode(',',$_post['video_id']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND band_id IN (". @implode(',',$_post['band_id']) .") "; } $req .= "AND comment_type = 'video' GROUP BY message_id"; $_cc = dbQuery($req,'video_id'); if (!is_numeric($_post['show'])) { $_post['show'] = 1; } $_tmp = rankVideoArtist($_post['band_id'],$_post['show'],$_post['genre'],$_post['quota'],$_post['video_id']); if (!is_array($_tmp)) { ob_end_clean(); jmErrorPage("there were no valid artists returned from the DB query - verify settings"); exit; } foreach ($_tmp as $_row) { $aurl = getJamroomUrl($_row['band_id'],$_row['server_url']); $btim = convertTime($_row['band_time'],$config['server_offset']); $_rep = array( 'MODE' => 'video_spotlight', 'BAND_ID' => $_row['band_id'], 'BAND_CREATED' => $_row['band_time'], 'BAND_DATE1' => gmstrftime($config['date1'],$btim), 'BAND_DATE2' => gmstrftime($config['date2'],$btim), 'BAND_DATE3' => gmstrftime($config['date3'],$btim), 'BAND_NAME' => stripHtml($_row['band_name']), 'BAND_URL_NAME' => $_row['band_url'], 'BAND_INFO' => bbDecode($_row['band_story']), 'BAND_LOCATION' => trim($_row['band_location']), 'BAND_WEBSITE' => $_row['band_website'], 'BAND_INFLUENCE' => $_row['band_influence'], 'BAND_SOUNDLIKE' => $_row['band_soundlike'], 'BAND_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['band_id']}&mode=band_image", 'BAND_RATING_FORM_URL' => "{$jamroom['jm_htm']}/rating.php?mode=rate_band&band_id={$_row['band_id']}", 'BAND_RATING_NUMBER' => $_row['rating_number'], 'BAND_RATING_AVERAGE' => $_row['rating_average'], 'BAND_RATING_1' => $_row['rating_1'], 'BAND_RATING_2' => $_row['rating_2'], 'BAND_RATING_3' => $_row['rating_3'], 'BAND_RATING_4' => $_row['rating_4'], 'BAND_RATING_5' => $_row['rating_5'], 'BAND_QUOTA' => $_row['quota_id'], 'VIDEO_ID' => $_row['video_id'], 'VIDEO_CREATED' => $_row['video_created'], 'VIDEO_UPDATED' => $_row['video_updated'], 'VIDEO_ORDER' => $_row['video_order'], 'VIDEO_NAME' => stripHtml($_row['video_name']), 'VIDEO_ALBUM' => $_row['video_album'], 'VIDEO_CAPTION' => bbDecode($_row['video_name']), 'VIDEO_SIZE' => $_row['video_size'], 'VIDEO_DOWNLOAD' => $_row['video_download'], 'VIDEO_FILENAME' => $_row['video_filename'], 'VIDEO_EXTENSION' => $_row['video_extension'], 'VIDEO_BITRATE' => $_row['video_bitrate'], 'VIDEO_RESOLUTION' => $_row['video_resolution'], 'VIDEO_LENGTH' => $_row['video_length'], 'VIDEO_LICENSE' => $_row['video_license'], 'VIDEO_GENRE' => $_row['genre_name'], 'VIDEO_GENRE_URL' => urlencode($_row['genre_name']), 'VIDEO_CREDITS' => $_row['video_credits'], 'VIDEO_ADVISE' => $_row['video_advise'], 'VIDEO_MIMETYPE' => $_row['video_type'], 'VIDEO_PLAY_URL' => "{$jamroom['jm_htm']}/play.php?band_id={$_row['band_id']}&video_id={$_row['video_id']}&mode=video", 'PLAYALL_WMV_URL' => "{$jamroom['jm_htm']}/play.php?mode=video&band_id={$_row['band_id']}&video_id=all&type=wmv", 'VIDEO_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['band_id']}&video_id={$_row['video_id']}&mode=video_image", 'VIDEO_STREAM_COUNT' => $_row['video_scount'], 'VIDEO_DOWNLOAD_COUNT' => $_row['video_dcount'], 'VIDEO_TOTAL_COUNT' => $_row['video_total_count'], 'VIDEO_RATING_FORM_URL' => "{$jamroom['jm_htm']}/rating.php?mode=rating_form&type=video&band_id={$_row['band_id']}&video_id={$_row['video_id']}", 'VIDEO_RATING_NUMBER' => $_row['video_rating_number'], 'VIDEO_RATING_AVERAGE' => $_row['video_rating_average'], 'VIDEO_RATING_1' => $_row['video_rating_1'], 'VIDEO_RATING_2' => $_row['video_rating_2'], 'VIDEO_RATING_3' => $_row['video_rating_3'], 'VIDEO_RATING_4' => $_row['video_rating_4'], 'VIDEO_RATING_5' => $_row['video_rating_5'], 'ARTIST_URL' => "{$aurl}/{$config['artist_dir']}/{$_row['band_id']}/", 'SERVER_URL' => $aurl ); $_rep['COMMENT_COUNT'] = '0'; if (is_numeric($_cc["{$_row['video_id']}"]['comment_count'])) { $_rep['COMMENT_COUNT'] = $_cc["{$_row['video_id']}"]['comment_count']; } if ($_row['video_download'] == 'nos') { $_rep['VIDEO_PLAY_URL'] = ''; $_rep['VIDEO_ALLOW_STREAM'] = 'no'; } else { $_rep['VIDEO_PLAY_URL'] = "{$jamroom['jm_htm']}/play.php?band_id={$_row['band_id']}&video_id={$_row['video_id']}&mode=video"; $_rep['VIDEO_ALLOW_STREAM'] = 'yes'; } if ($_row['video_download'] == 'yes') { $_rep['VIDEO_DOWNLOAD_URL'] = "{$url}/download.php?band_id={$_row['band_id']}&video_id={$_row['video_id']}&mode=video"; $_rep['VIDEO_ALLOW_DOWNLOAD'] = 'yes'; } else { $_rep['VIDEO_DOWNLOAD_URL'] = ''; $_rep['VIDEO_ALLOW_DOWNLOAD'] = 'no'; } rankQuotaVars($_rep); if (isset($_post['row_template']) && is_array($_rep)) { htmlShowTemplate($_post['row_template'],array_merge($_page,$_rep),$tpl_dir); } jmVideoCounter($_row['band_id'],$_row['video_id'],'video_spot'); } } elseif (isset($_post['mode']) && $_post['mode'] == 'band') { $req = "SELECT band_id, COUNT(comment_id) as comment_count FROM {$jamroom_db['comments']} WHERE message_id = 0 AND comment_type = 'band' GROUP BY band_id"; $_cc = dbQuery($req,'band_id'); if (is_numeric($_post['pagebreak'])) { $rv = "SELECT count(i.band_id) AS num FROM {$jamroom_db['band_info']} i LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota WHERE i.band_update != 99 AND i.band_time < {$config['new_ignore']} AND q.quota_rank = 'yes' "; if (is_numeric($_post['band_id'])) { $rv .= "AND i.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND i.band_id IN (". @implode(',',$_post['band_id']) .") "; } if (is_numeric($_post['quota'])) { $rv .= "AND q.quota_id = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND q.quota_id IN (". @implode(',',$_post['quota']) .") "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(i.band_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(i.band_name,1) = '{$_post['letter']}' "; } } $rv .= "GROUP BY q.quota_rank "; $_n = dbQuery($rv,'SINGLE'); } $rv = "SELECT i.band_id, i.band_time, i.band_name, i.band_url, i.band_location, i.band_story, i.band_website, i.band_influence, i.band_soundlike, m.image_time, m.image_name, m.image_type, m.image_size, m.image_extension, SUM( s.hifi_scount_total + s.lofi_scount_total ) AS total_stream, SUM( s.hifi_dcount_total + s.lofi_dcount_total ) AS total_download, SUM( s.hifi_scount_total + s.lofi_scount_total + s.hifi_dcount_total + s.lofi_dcount_total ) AS total_count, q.quota_id, q.quota_name, q.quota_disk, q.quota_max, q.quota_message, q.quota_search, q.quota_radio, q.quota_store, q.quota_rate, q.quota_remrate, q.quota_calendar, q.quota_comments, r.rating_1, r.rating_2, r.rating_3, r.rating_4, r.rating_5, "; if (isset($config['rating_method']) && $config['rating_method'] == 'band') { $rv .= "r.rating_number, r.rating_average, "; } else { $rv .= "SUM(r.rating_number) AS rating_number, ROUND(SUM(r.rating_average) / COUNT(r.rating_average),2) as rating_average, "; } $rv .= " v.server_id, v.server_ip, v.server_name, v.server_url FROM {$jamroom_db['band_info']} i LEFT JOIN {$jamroom_db['band_image']} m ON m.band_id = i.band_id LEFT JOIN {$jamroom_db['scounter']} s ON s.band_id = i.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota "; if (isset($config['rating_method']) && $config['rating_method'] == 'band') { $rv .= "LEFT JOIN {$jamroom_db['rating']} r ON (r.band_id = i.band_id AND r.song_id = 0) "; } else { $rv .= "LEFT JOIN {$jamroom_db['rating']} r ON (r.band_id = i.band_id AND r.song_id = s.song_id AND r.song_id != 0) "; } $rv .= " LEFT JOIN {$jamroom_db['servers']} v ON v.server_id = i.band_server WHERE i.band_update != 99 AND i.band_time < {$config['new_ignore']} AND q.quota_rank = 'yes' "; if (is_numeric($_post['band_id'])) { $rv .= "AND i.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND i.band_id IN (". @implode(',',$_post['band_id']) .") "; } if (is_numeric($_post['quota'])) { $rv .= "AND q.quota_id = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND q.quota_id IN (". @implode(',',$_post['quota']) .") "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(i.band_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(i.band_name,1) = '{$_post['letter']}' "; } } switch ($_post['order']) { case '1': $rv .= "GROUP BY i.band_id ORDER BY i.band_name ASC "; break; case '2': $rv .= "GROUP BY i.band_id ORDER BY i.band_time ASC "; break; case '3': $rv .= "GROUP BY i.band_id ORDER BY i.band_time DESC "; break; case '4': $rv .= "GROUP BY i.band_id ORDER BY total_stream DESC "; break; case '5': $rv .= "GROUP BY i.band_id ORDER BY total_count DESC "; break; case '6': $rv .= "AND LENGTH(i.band_location) > 1 GROUP BY i.band_id ORDER BY i.band_location ASC "; break; case '7': $rv .= "AND r.rating_number > 0 GROUP BY i.band_id ORDER BY r.rating_number DESC, rating_average DESC "; break; case '8': $rv .= "AND r.rating_number > 0 GROUP BY i.band_id ORDER BY r.rating_number ASC, rating_average ASC "; break; case '9': $rv .= "AND r.rating_number > 0 GROUP BY i.band_id ORDER BY rating_average DESC, r.rating_number DESC "; break; case '10': $rv .= "AND r.rating_number > 0 GROUP BY i.band_id ORDER BY rating_average ASC, r.rating_number ASC "; break; case '11': $rv .= "GROUP BY i.band_id ORDER BY RAND() "; break; case '12': $rv .= "GROUP BY i.band_id ORDER BY total_download DESC "; break; case '13': $rv .= "GROUP BY i.band_id ORDER BY total_stream ASC "; break; case '14': $rv .= "GROUP BY i.band_id ORDER BY total_count ASC "; break; case '15': $rv .= "GROUP BY i.band_id ORDER BY total_download ASC "; break; default: $rv .= "GROUP BY i.band_id ORDER BY i.band_name DESC "; break; } if (isset($beg) && isset($_post['pagebreak'])) { $rv .= "LIMIT {$beg},{$_post['pagebreak']}"; } else { if (is_numeric($_post['show'])) { $rv .= "LIMIT {$_post['show']}"; } } $_rank = dbQuery($rv,'NUMERIC'); dbClose(); if (!is_array($_rank)) { $_rank = array(); } $_page['ARTIST_COUNT'] = count($_rank); $_page['BAND_COUNT'] = $_page['ARTIST_COUNT']; $pnum = 0; foreach ($_rank as $k => $_row) { $aurl = getJamroomUrl($_row['band_id'],$_row['server_url']); $ttim = convertTime($_row['band_time'],$config['server_offset']); $_rep = array( 'MODE' => 'band', 'BAND_ID' => $_row['band_id'], 'BAND_CREATED' => $_row['band_time'], 'BAND_TIME' => $_row['band_time'], 'BAND_DATE1' => gmstrftime($config['date1'],$ttim), 'BAND_DATE2' => gmstrftime($config['date2'],$ttim), 'BAND_DATE3' => gmstrftime($config['date3'],$ttim), 'BAND_NAME' => stripHtml($_row['band_name']), 'BAND_URL_NAME' => $_row['band_url'], 'BAND_INFO' => bbDecode($_row['band_story']), 'BAND_RANK' => $rnum, 'BAND_LOCATION' => trim($_row['band_location']), 'BAND_WEBSITE' => $_row['band_website'], 'BAND_INFLUENCE' => $_row['band_influence'], 'BAND_SOUNDLIKE' => $_row['band_soundlike'], 'BAND_STREAM_COUNT' => $_row['total_stream'], 'BAND_DOWNLOAD_COUNT' => $_row['total_download'], 'BAND_TOTAL_COUNT' => $_row['total_count'], 'BAND_IMAGE_TIME' => $_row['image_time'], 'BAND_IMAGE_NAME' => $_row['image_name'], 'BAND_IMAGE_TYPE' => $_row['image_type'], 'BAND_IMAGE_SIZE' => $_row['image_size'], 'BAND_IMAGE_EXTENSION' => $_row['image_extension'], 'BAND_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['band_id']}&mode=band_image", 'BAND_RATING_FORM_URL' => "{$jamroom['jm_htm']}/rating.php?mode=rate_band&band_id={$_row['band_id']}", 'BAND_RATING_NUMBER' => $_row['rating_number'], 'BAND_RATING_AVERAGE' => $_row['rating_average'], 'BAND_RATING_1' => $_row['rating_1'], 'BAND_RATING_2' => $_row['rating_2'], 'BAND_RATING_3' => $_row['rating_3'], 'BAND_RATING_4' => $_row['rating_4'], 'BAND_RATING_5' => $_row['rating_5'], 'ARTIST_URL' => "{$aurl}/{$config['artist_dir']}/{$_row['band_id']}/", 'SERVER_URL' => $aurl ); $_rep['COMMENT_COUNT'] = '0'; if (is_numeric($_cc["{$_row['band_id']}"]['comment_count'])) { $_rep['COMMENT_COUNT'] = $_cc["{$_row['band_id']}"]['comment_count']; } rankAllLinks($_rep); rankQuotaVars($_rep); $rnum++; $pnum++; if (isset($_post['row_template']) && is_array($_rep)) { htmlShowTemplate($_post['row_template'],array_merge($_page,$_rep),$tpl_dir); } } } elseif (isset($_post['mode']) && $_post['mode'] == 'song') { $req = "SELECT message_id AS song_id, COUNT(comment_id) AS comment_count FROM {$jamroom_db['comments']} WHERE message_id != 0 AND comment_type = 'song' GROUP BY message_id"; $_cc = dbQuery($req,'song_id'); if (is_numeric($_post['pagebreak'])) { $rv = "SELECT count(1) AS num FROM {$jamroom_db['song_info']} s LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = s.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota LEFT JOIN {$jamroom_db['song_hifi']} h ON h.song_id = s.song_id LEFT JOIN {$jamroom_db['song_lofi']} l ON l.song_id = s.song_id LEFT JOIN {$jamroom_db['song_genre']} g ON g.genre_id = s.song_genre WHERE s.song_show != 'no' AND i.band_time < {$config['new_ignore']} AND q.quota_rank = 'yes' AND (h.hifi_size > 0 OR l.lofi_size > 0) "; if (is_numeric($_post['song_id'])) { $rv .= "AND s.song_id = {$_post['song_id']} "; } elseif (is_array($_post['song_id'])) { $rv .= "AND s.song_id IN (". @implode(',',$_post['song_id']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND i.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND i.band_id IN (". @implode(',',$_post['band_id']) .") "; } if (is_array($_post['genre'])) { foreach ($_post['genre'] as $k => $gen) { $_post['genre']["$k"] = trim(urldecode($gen)); } $rv .= "AND g.genre_name IN ('". @implode("','",$_post['genre']) ."') "; } elseif (strlen($_post['genre']) > 0) { $rv .= "AND g.genre_name = '". trim(urldecode($_post['genre'])) ."' "; } if (is_numeric($_post['quota'])) { $rv .= "AND i.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND i.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(s.song_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(s.song_name,1) = '{$_post['letter']}' "; } } if (!empty($_post['type'])) { switch (strtolower($_post['type'])) { case 'mp3': case 'ogg': case 'wma': case 'wav': break; default: unset($_post['type']); break; } if (isset($_post['type'])) { $rv .= "AND (h.hifi_extension = '{$_post['type']}' OR l.lofi_extension = '{$_post['type']}') "; } } $_n = dbQuery($rv,'SINGLE'); } $rv = "SELECT s.song_id, s.song_time, s.song_name, s.song_album, s.song_label, s.song_genre, s.song_credits, s.song_advise, s.song_isrc, s.song_alicense, s.song_slicense, s.song_lyrics, s.song_history, i.band_id, i.band_time, i.band_name, i.band_url, i.band_location, i.band_quota, i.band_website, q.quota_id, q.quota_name, q.quota_disk, q.quota_max, q.quota_message, q.quota_search, q.quota_radio, q.quota_store, q.quota_rate, q.quota_remrate, q.quota_calendar, q.quota_comments, h.hifi_time, h.hifi_update, h.hifi_name, h.hifi_type, h.hifi_size, h.hifi_download, h.hifi_extension, h.hifi_bitrate, h.hifi_smprate, h.hifi_length, l.lofi_time, l.lofi_update, l.lofi_name, l.lofi_type, l.lofi_size, l.lofi_download, l.lofi_extension, l.lofi_bitrate, l.lofi_smprate, l.lofi_length, SUM( c.hifi_scount_total + c.lofi_scount_total ) AS total_stream, SUM( c.hifi_dcount_total + c.lofi_dcount_total ) AS total_download, SUM( (c.hifi_scount_total + c.lofi_scount_total) + (c.hifi_dcount_total + c.lofi_dcount_total) ) AS total_count, g.genre_name, r.rating_number, r.rating_1, r.rating_2, r.rating_3, r.rating_4, r.rating_5, r.rating_average, v.server_id, v.server_ip, v.server_name, v.server_url FROM {$jamroom_db['song_info']} s LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = s.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota LEFT JOIN {$jamroom_db['song_hifi']} h ON h.song_id = s.song_id LEFT JOIN {$jamroom_db['song_lofi']} l ON l.song_id = s.song_id LEFT JOIN {$jamroom_db['scounter']} c ON c.song_id = s.song_id LEFT JOIN {$jamroom_db['song_genre']} g ON g.genre_id = s.song_genre LEFT JOIN {$jamroom_db['rating']} r ON r.song_id = s.song_id LEFT JOIN {$jamroom_db['servers']} v ON v.server_id = i.band_server WHERE s.song_show != 'no' AND i.band_time < {$config['new_ignore']} AND q.quota_rank = 'yes' AND (h.hifi_size > 0 OR l.lofi_size > 0) "; if (is_numeric($_post['song_id'])) { $rv .= "AND s.song_id = {$_post['song_id']} "; } elseif (is_array($_post['song_id'])) { $rv .= "AND s.song_id IN (". @implode(',',$_post['song_id']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND i.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND i.band_id IN (". @implode(',',$_post['band_id']) .") "; } if (is_array($_post['genre'])) { foreach ($_post['genre'] as $k => $gen) { $_post['genre']["$k"] = trim(urldecode($gen)); } $rv .= "AND g.genre_name IN ('". @implode("','",$_post['genre']) ."') "; } elseif (strlen($_post['genre']) > 0) { $rv .= "AND g.genre_name = '". trim(urldecode($_post['genre'])) ."' "; } if (is_numeric($_post['quota'])) { $rv .= "AND i.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND i.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(s.song_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(s.song_name,1) = '{$_post['letter']}' "; } } if (!empty($_post['type'])) { switch (strtolower($_post['type'])) { case 'mp3': case 'ogg': case 'wma': break; default: unset($_post['type']); } if (isset($_post['type'])) { $rv .= "AND (h.hifi_extension = '{$_post['type']}' OR l.lofi_extension = '{$_post['type']}') "; } } switch ($_post['order']) { case '1': $rv .= "GROUP BY s.song_id ORDER BY s.song_name ASC "; break; case '2': $rv .= "GROUP BY s.song_id ORDER BY s.song_time ASC "; break; case '3': $rv .= "GROUP BY s.song_id ORDER BY s.song_time DESC "; break; case '4': $rv .= "GROUP BY s.song_id ORDER BY total_stream DESC "; break; case '5': $rv .= "GROUP BY s.song_id ORDER BY total_count DESC "; break; case '6': $rv .= "GROUP BY s.song_genre ORDER BY g.genre_name ASC "; break; case '7': $rv .= "AND r.rating_number > 0 GROUP BY s.song_id ORDER BY r.rating_number DESC, r.rating_average DESC "; break; case '8': $rv .= "AND r.rating_number > 0 GROUP BY s.song_id ORDER BY r.rating_number ASC, r.rating_average ASC "; break; case '9': $rv .= "AND r.rating_number > 0 GROUP BY s.song_id ORDER BY r.rating_average DESC, r.rating_number DESC "; break; case '10': $rv .= "AND r.rating_number > 0 GROUP BY s.song_id ORDER BY r.rating_average ASC, r.rating_number ASC "; break; case '11': $rv .= "GROUP BY s.song_id ORDER BY RAND() "; break; case '12': $rv .= "GROUP BY s.song_id ORDER BY total_download DESC "; break; case '13': $rv .= "GROUP BY s.song_id ORDER BY total_stream ASC "; break; case '14': $rv .= "GROUP BY s.song_id ORDER BY total_count ASC "; break; case '15': $rv .= "GROUP BY s.song_id ORDER BY total_download ASC "; break; default: $rv .= "GROUP BY s.song_id ORDER BY total_count DESC "; break; } if (isset($beg) && isset($_post['pagebreak'])) { $rv .= "LIMIT {$beg},{$_post['pagebreak']}"; } elseif (is_numeric($_post['show'])) { $rv .= "LIMIT {$_post['show']}"; } elseif (is_numeric($config['page_results'])) { $rv .= "LIMIT {$config['page_results']}"; } $_rank = dbQuery($rv,'NUMERIC'); dbClose(); if (!is_array($_rank)) { $_rank = array(); } $_vars['PLAYPAGE_HIFI_MP3_URL'] = "{$jamroom['jm_htm']}/play.php?band_id=all&type=mp3&mode=song_hifi"; $_vars['PLAYPAGE_HIFI_WMA_URL'] = "{$jamroom['jm_htm']}/play.php?band_id=all&type=wma&mode=song_hifi"; $_vars['PLAYPAGE_HIFI_OGG_URL'] = "{$jamroom['jm_htm']}/play.php?band_id=all&type=ogg&mode=song_hifi"; $_vars['PLAYPAGE_LOFI_MP3_URL'] = "{$jamroom['jm_htm']}/play.php?band_id=all&type=mp3&mode=song_lofi"; $_vars['PLAYPAGE_LOFI_WMA_URL'] = "{$jamroom['jm_htm']}/play.php?band_id=all&type=wma&mode=song_lofi"; $_vars['PLAYPAGE_LOFI_OGG_URL'] = "{$jamroom['jm_htm']}/play.php?band_id=all&type=ogg&mode=song_lofi"; $_vars['SONG_COUNT'] = count($_rank); $pnum = 0; foreach ($_rank as $k => $_row) { $aurl = getJamroomUrl($_row['band_id'],$_row['server_url']); $ttim = convertTime($_row['song_time'],$config['server_offset']); $_rep = array( 'MODE' => 'song', 'BAND_ID' => $_row['band_id'], 'BAND_NAME' => stripHtml($_row['band_name']), 'BAND_URL_NAME' => $_row['band_url'], 'BAND_LOCATION' => trim($_row['band_location']), 'BAND_WEBSITE' => $_row['band_website'], 'BAND_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['band_id']}&mode=band_image", 'BAND_RATING_FORM_URL' => "{$jamroom['jm_htm']}/rating.php?mode=rate_band&band_id={$_row['band_id']}", 'SONG_ID' => $_row['song_id'], 'SONG_CREATED' => $_row['song_time'], 'SONG_DATE1' => gmstrftime($config['date1'],$ttim), 'SONG_DATE2' => gmstrftime($config['date2'],$ttim), 'SONG_DATE3' => gmstrftime($config['date3'],$ttim), 'SONG_NAME' => stripHtml($_row['song_name']), 'SONG_ALBUM' => $_row['song_album'], 'SONG_LABEL' => $_row['song_label'], 'SONG_GENRE' => $_row['genre_name'], 'SONG_GENRE_URL' => urlencode($_row['genre_name']), 'SONG_CREDITS' => $_row['song_credits'], 'SONG_ADVISE' => $_row['song_advise'], 'SONG_ISRC' => $_row['song_isrc'], 'SONG_ALICENSE' => $_row['song_alicense'], 'SONG_SLICENSE' => $_row['song_slicense'], 'SONG_LYRICS' => bbDecode($_row['song_lyrics']), 'SONG_INFO' => bbDecode($_row['song_history']), 'SONG_IMAGE' => "{$aurl}/image.php?band_id={$_row['band_id']}&song_id={$_row['song_id']}&mode=song_image", 'SONG_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['band_id']}&song_id={$_row['song_id']}&mode=song_image", 'SONG_RANK' => $rnum, 'SONG_HIFI_TIME' => $_row['hifi_update'], 'SONG_LOFI_TIME' => $_row['lofi_update'], 'SONG_HIFI_NAME' => $_row['hifi_name'], 'SONG_LOFI_NAME' => $_row['lofi_name'], 'SONG_HIFI_TYPE' => $_row['hifi_type'], 'SONG_LOFI_TYPE' => $_row['lofi_type'], 'SONG_HIFI_SIZE' => $_row['hifi_size'], 'SONG_LOFI_SIZE' => $_row['lofi_size'], 'SONG_HIFI_DOWNLOAD' => $_row['hifi_download'], 'SONG_LOFI_DOWNLOAD' => $_row['lofi_download'], 'SONG_HIFI_EXTENSION' => $_row['hifi_extension'], 'SONG_LOFI_EXTENSION' => $_row['lofi_extension'], 'SONG_HIFI_BITRATE' => $_row['hifi_bitrate'], 'SONG_LOFI_BITRATE' => $_row['lofi_bitrate'], 'SONG_HIFI_SMPRATE' => $_row['hifi_smprate'], 'SONG_LOFI_SMPRATE' => $_row['lofi_smprate'], 'SONG_HIFI_LENGTH' => $_row['hifi_length'], 'SONG_LOFI_LENGTH' => $_row['lofi_length'], 'SONG_STREAM_COUNT' => $_row['total_stream'], 'SONG_DOWNLOAD_COUNT' => $_row['total_download'], 'SONG_TOTAL_COUNT' => $_row['total_count'], 'SONG_RATING_FORM_URL' => "{$jamroom['jm_htm']}/rating.php?mode=rate_song&band_id={$_row['band_id']}&song_id={$_row['song_id']}", 'SONG_RATING_NUMBER' => $_row['rating_number'], 'SONG_RATING_AVERAGE' => $_row['rating_average'], 'SONG_RATING_1' => $_row['rating_1'], 'SONG_RATING_2' => $_row['rating_2'], 'SONG_RATING_3' => $_row['rating_3'], 'SONG_RATING_4' => $_row['rating_4'], 'SONG_RATING_5' => $_row['rating_5'], 'ARTIST_URL' => "{$aurl}/{$config['artist_dir']}/{$_row['band_id']}/", 'SERVER_URL' => $aurl ); $_rep['COMMENT_COUNT'] = '0'; if (is_numeric($_cc["{$_row['song_id']}"]['comment_count'])) { $_rep['COMMENT_COUNT'] = $_cc["{$_row['song_id']}"]['comment_count']; } $rnum++; $pnum++; rankPlayLinks($aurl,$_rep); rankAllLinks($_rep); rankQuotaVars($_rep); if (isset($_post['row_template']) && is_array($_rep)) { htmlShowTemplate($_post['row_template'],array_merge($_page,$_rep),$tpl_dir); } $hifi_ext = strtoupper($_row['hifi_extension']); $lofi_ext = strtoupper($_row['lofi_extension']); $_vars["PLAYPAGE_HIFI_{$hifi_ext}_URL"] .= "&song_id[]={$_row['song_id']}"; $_vars["PLAYPAGE_LOFI_{$lofi_ext}_URL"] .= "&song_id[]={$_row['song_id']}"; } } elseif ((isset($_post['mode']) && $_post['mode'] == 'video') && is_file("{$jamroom['jm_dir']}/video.php")) { $req = "SELECT message_id AS video_id, COUNT(comment_id) AS comment_count FROM {$jamroom_db['comments']} WHERE message_id != 0 AND comment_type = 'video' GROUP BY message_id"; $_cc = dbQuery($req,'video_id'); if (is_numeric($_post['pagebreak'])) { $rv = "SELECT count(1) AS num FROM {$jamroom_db['video']} v LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = v.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota LEFT JOIN {$jamroom_db['video_genre']} g ON g.genre_id = v.video_genre WHERE v.video_show != 'no' AND i.band_time < {$config['new_ignore']} AND q.quota_rank = 'yes' AND v.video_size > 0 "; if (is_numeric($_post['video_id'])) { $rv .= "AND v.video_id = {$_post['video_id']} "; } elseif (is_array($_post['video_id'])) { $rv .= "AND v.video_id IN (". @implode(',',$_post['video_id']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND i.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND i.band_id IN (". @implode(',',$_post['band_id']) .") "; } if (is_array($_post['genre'])) { foreach ($_post['genre'] as $k => $gen) { $_post['genre']["$k"] = trim(urldecode($gen)); } $rv .= "AND g.genre_name IN ('". @implode("','",$_post['genre']) ."') "; } elseif (strlen($_post['genre']) > 0) { $rv .= "AND g.genre_name = '". trim(urldecode($_post['genre'])) ."' "; } if (is_numeric($_post['quota'])) { $rv .= "AND i.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND i.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(v.video_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(v.video_name,1) = '{$_post['letter']}' "; } } if (!empty($_post['type'])) { switch (strtolower($_post['type'])) { case 'wmv': break; default: unset($_post['type']); break; } if (isset($_post['type'])) { $rv .= "AND v.video_extension = '{$_post['type']}' "; } } $_n = dbQuery($rv,'SINGLE'); } $rv = "SELECT v.*, i.band_id, i.band_time, i.band_name, i.band_url, i.band_location, i.band_quota, i.band_website, q.*, c.video_scount_total AS total_stream, c.video_dcount_total AS total_download, SUM(c.video_scount_total + c.video_dcount_total) AS total_count, g.genre_name, r.rating_number, r.rating_1, r.rating_2, r.rating_3, r.rating_4, r.rating_5, r.rating_average, s.server_id, s.server_ip, s.server_name, s.server_url FROM {$jamroom_db['video']} v LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = v.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota LEFT JOIN {$jamroom_db['vcounter']} c ON c.video_id = v.video_id LEFT JOIN {$jamroom_db['video_genre']} g ON g.genre_id = v.video_genre LEFT JOIN {$jamroom_db['rating']} r ON (r.song_id = v.video_id AND r.rating_type = 'video') LEFT JOIN {$jamroom_db['servers']} s ON s.server_id = i.band_server WHERE v.video_show != 'no' AND i.band_time < {$config['new_ignore']} AND q.quota_rank = 'yes' AND v.video_size > 0 "; if (is_numeric($_post['video_id'])) { $rv .= "AND v.video_id = {$_post['video_id']} "; } elseif (is_array($_post['video_id'])) { $rv .= "AND v.video_id IN (". @implode(',',$_post['video_id']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND i.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND i.band_id IN (". @implode(',',$_post['band_id']) .") "; } if (is_array($_post['genre'])) { foreach ($_post['genre'] as $k => $gen) { $_post['genre']["$k"] = trim(urldecode($gen)); } $rv .= "AND g.genre_name IN ('". @implode("','",$_post['genre']) ."') "; } elseif (strlen($_post['genre']) > 0) { $rv .= "AND g.genre_name = '". trim(urldecode($_post['genre'])) ."' "; } if (is_numeric($_post['quota'])) { $rv .= "AND i.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND i.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(v.video_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(v.video_name,1) = '{$_post['letter']}' "; } } if (!empty($_post['type'])) { switch (strtolower($_post['type'])) { case 'wmv': break; default: unset($_post['type']); } if (isset($_post['type'])) { $rv .= "AND v.video_extension = '{$_post['type']}' "; } } switch ($_post['order']) { case '1': $rv .= "GROUP BY v.video_id ORDER BY v.video_name ASC "; break; case '2': $rv .= "GROUP BY v.video_id ORDER BY v.video_created ASC "; break; case '3': $rv .= "GROUP BY v.video_id ORDER BY v.video_created DESC "; break; case '4': $rv .= "GROUP BY v.video_id ORDER BY total_stream DESC "; break; case '5': $rv .= "GROUP BY v.video_id ORDER BY total_count DESC "; break; case '6': $rv .= "GROUP BY v.video_genre ORDER BY g.genre_name ASC "; break; case '7': $rv .= "AND r.rating_number > 0 GROUP BY v.video_id ORDER BY r.rating_number DESC, r.rating_average DESC "; break; case '8': $rv .= "AND r.rating_number > 0 GROUP BY v.video_id ORDER BY r.rating_number ASC, r.rating_average ASC "; break; case '9': $rv .= "AND r.rating_number > 0 GROUP BY v.video_id ORDER BY r.rating_average DESC, r.rating_number DESC "; break; case '10': $rv .= "AND r.rating_number > 0 GROUP BY v.video_id ORDER BY r.rating_average ASC, r.rating_number ASC "; break; case '11': $rv .= "GROUP BY v.video_id ORDER BY RAND() "; break; case '12': $rv .= "GROUP BY v.video_id ORDER BY total_download DESC "; break; case '13': $rv .= "GROUP BY v.video_id ORDER BY total_stream ASC "; break; case '14': $rv .= "GROUP BY v.video_id ORDER BY total_count ASC "; break; case '15': $rv .= "GROUP BY v.video_id ORDER BY total_download ASC "; break; default: $rv .= "GROUP BY v.video_id ORDER BY total_count DESC "; break; } if (isset($beg) && isset($_post['pagebreak'])) { $rv .= "LIMIT {$beg},{$_post['pagebreak']}"; } elseif (is_numeric($_post['show'])) { $rv .= "LIMIT {$_post['show']}"; } elseif (is_numeric($config['page_results'])) { $rv .= "LIMIT {$config['page_results']}"; } $_rank = dbQuery($rv,'NUMERIC'); dbClose(); if (!is_array($_rank)) { $_rank = array(); } $_vars['PLAYALL_WMV_URL'] = "{$jamroom['jm_htm']}/play.php?band_id=all&type=wmv&mode=video"; $_vars['VIDEO_COUNT'] = count($_rank); $pnum = 0; foreach ($_rank as $k => $_row) { $aurl = getJamroomUrl($_row['band_id'],$_row['server_url']); $_rep = array( 'MODE' => 'video', 'BAND_ID' => $_row['band_id'], 'BAND_NAME' => stripHtml($_row['band_name']), 'BAND_URL_NAME' => $_row['band_url'], 'BAND_LOCATION' => trim($_row['band_location']), 'BAND_WEBSITE' => $_row['band_website'], 'BAND_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['band_id']}&mode=band_image", 'BAND_RATING_FORM_URL' => "{$jamroom['jm_htm']}/rating.php?mode=rate_band&band_id={$_row['band_id']}", 'VIDEO_RANK' => $rnum, 'VIDEO_ID' => $_row['video_id'], 'VIDEO_CREATED' => $_row['video_created'], 'VIDEO_UPDATED' => $_row['video_updated'], 'VIDEO_ORDER' => $_row['video_order'], 'VIDEO_NAME' => stripHtml($_row['video_name']), 'VIDEO_ALBUM' => $_row['video_album'], 'VIDEO_CAPTION' => bbDecode($_row['video_name']), 'VIDEO_SIZE' => $_row['video_size'], 'VIDEO_DOWNLOAD' => $_row['video_download'], 'VIDEO_FILENAME' => $_row['video_filename'], 'VIDEO_EXTENSION' => $_row['video_extension'], 'VIDEO_BITRATE' => $_row['video_bitrate'], 'VIDEO_RESOLUTION' => $_row['video_resolution'], 'VIDEO_LENGTH' => $_row['video_length'], 'VIDEO_LICENSE' => $_row['video_license'], 'VIDEO_GENRE' => $_row['genre_name'], 'VIDEO_GENRE_URL' => urlencode($_row['genre_name']), 'VIDEO_CREDITS' => $_row['video_credits'], 'VIDEO_ADVISE' => $_row['video_advise'], 'VIDEO_MIMETYPE' => $_row['video_type'], 'VIDEO_PLAY_URL' => "{$jamroom['jm_htm']}/play.php?band_id={$_row['band_id']}&video_id={$_row['video_id']}&mode=video", 'PLAYALL_WMV_URL' => "{$jamroom['jm_htm']}/play.php?mode=video&band_id={$_row['band_id']}&video_id=all&type=wmv", 'VIDEO_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['band_id']}&video_id={$_row['video_id']}&mode=video_image", 'VIDEO_STREAM_COUNT' => $_row['total_stream'], 'VIDEO_DOWNLOAD_COUNT' => $_row['total_download'], 'VIDEO_TOTAL_COUNT' => $_row['total_count'], 'VIDEO_RATING_FORM_URL' => "{$jamroom['jm_htm']}/rating.php?mode=rating_form&type=video&band_id={$_row['band_id']}&video_id={$_row['video_id']}", 'VIDEO_RATING_NUMBER' => $_row['rating_number'], 'VIDEO_RATING_AVERAGE' => $_row['rating_average'], 'VIDEO_RATING_1' => $_row['rating_1'], 'VIDEO_RATING_2' => $_row['rating_2'], 'VIDEO_RATING_3' => $_row['rating_3'], 'VIDEO_RATING_4' => $_row['rating_4'], 'VIDEO_RATING_5' => $_row['rating_5'], 'ARTIST_URL' => "{$aurl}/{$config['artist_dir']}/{$_row['band_id']}/", 'SERVER_URL' => $aurl ); $_rep['COMMENT_COUNT'] = '0'; if (is_numeric($_cc["{$_row['video_id']}"]['comment_count'])) { $_rep['COMMENT_COUNT'] = $_cc["{$_row['video_id']}"]['comment_count']; } $rnum++; $pnum++; rankQuotaVars($_rep); if (isset($_post['row_template']) && is_array($_rep)) { htmlShowTemplate($_post['row_template'],array_merge($_page,$_rep),$tpl_dir); } $_vars['PLAYALL_WMV_URL'] .= "&video_id[]={$_row['video_id']}"; } } elseif (isset($_post['mode']) && $_post['mode'] == 'store') { if (is_numeric($_post['pagebreak'])) { $rv = "SELECT count(1) AS num FROM {$jamroom_db['store']} i LEFT JOIN {$jamroom_db['band_info']} a ON a.band_id = i.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = a.band_quota WHERE i.item_show != 'no' AND q.quota_rank = 'yes' "; if (is_numeric($_post['quota'])) { $rv .= "AND a.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND a.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND i.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND i.band_id IN (". @implode(',',$_post['band_id']) .") "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(i.item_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(i.item_name,1) = '{$_post['letter']}' "; } } $_n = dbQuery($rv,'SINGLE'); } $rv = "SELECT i.item_id, i.band_id, i.item_name, i.item_desc, i.item_cost, i.item_email, i.item_number, i.item_ccode, i.item_created, i.item_updated, m.image_name, m.image_type, m.image_size, m.image_extension, a.band_id, a.band_time, a.band_name, a.band_url, a.band_location, a.band_quota, a.band_website, q.quota_id, q.quota_name, q.quota_disk, q.quota_max, q.quota_message, q.quota_search, q.quota_radio, q.quota_store, q.quota_rate, q.quota_remrate, q.quota_calendar, v.server_id, v.server_ip, v.server_name, v.server_url FROM {$jamroom_db['store']} i LEFT JOIN {$jamroom_db['store_image']} m ON m.item_id = i.item_id LEFT JOIN {$jamroom_db['band_info']} a ON a.band_id = i.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = a.band_quota LEFT JOIN {$jamroom_db['servers']} v ON v.server_id = a.band_server WHERE i.item_show != 'no' AND q.quota_rank = 'yes' "; if (is_numeric($_post['quota'])) { $rv .= "AND a.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND a.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND a.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND a.band_id IN (". @implode(',',$_post['band_id']) .") "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(i.item_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(i.item_name,1) = '{$_post['letter']}' "; } } switch ($_post['order']) { case '1': $rv .= "GROUP BY i.item_id ORDER BY i.item_name ASC "; break; case '2': $rv .= "GROUP BY i.item_id ORDER BY i.item_name DESC "; break; case '3': $rv .= "GROUP BY i.item_id ORDER BY (i.item_cost + 0) ASC "; break; case '4': $rv .= "GROUP BY i.item_id ORDER BY (i.item_cost + 0) DESC "; break; case '5': $rv .= "GROUP BY i.item_id ORDER BY RAND() "; break; case '6': $rv .= "GROUP BY i.item_id ORDER BY i.item_created ASC "; break; case '7': $rv .= "GROUP BY i.item_id ORDER BY i.item_created DESC "; break; default: $rv .= "GROUP BY i.item_id ORDER BY i.item_name ASC "; break; } if (isset($beg) && isset($_post['pagebreak'])) { $rv .= "LIMIT {$beg},{$_post['pagebreak']}"; } elseif (is_numeric($_post['show'])) { $rv .= "LIMIT {$_post['show']}"; } elseif (is_numeric($config['page_results'])) { $rv .= "LIMIT {$config['page_results']}"; } $_rank = dbQuery($rv,'NUMERIC'); dbClose(); if (!is_array($_rank)) { $_rank = array(); } $_page['ITEM_COUNT'] = count($_rank); $pnum = 0; foreach ($_rank as $k => $_row) { $aurl = getJamroomUrl($_row['band_id'],$_row['server_url']); $_rep = array( 'MODE' => 'store', 'ITEM_RANK' => $rnum, 'ITEM_ID' => $_row['item_id'], 'BAND_ID' => $_row['band_id'], 'BAND_NAME' => stripHtml($_row['band_name']), 'BAND_URL_NAME' => $_row['band_url'], 'BAND_LOCATION' => trim($_row['band_location']), 'BAND_WEBSITE' => $_row['band_website'], 'BAND_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['band_id']}&mode=band_image", 'ITEM_NAME' => $_row['item_name'], 'ITEM_CREATED' => $_row['item_created'], 'ITEM_UPDATED' => $_row['item_updated'], 'ITEM_DESCRIPTION' => bbDecode($_row['item_desc']), 'ITEM_COST' => $_row['item_cost'], 'ITEM_EMAIL' => encodeString($_row['item_email']), 'ITEM_IMAGE' => "{$aurl}/image.php?mode=item_image&item_id={$_row['item_id']}&band_id={$_row['band_id']}", 'ITEM_IMAGE_URL' => "{$aurl}/image.php?mode=item_image&item_id={$_row['item_id']}&band_id={$_row['band_id']}", 'ITEM_NUMBER' => $_row['item_number'], 'ITEM_CCODE' => $_row['item_ccode'], 'ITEM_PAYPAL_FORM' => "
", 'ARTIST_URL' => "{$aurl}/{$config['artist_dir']}/{$_row['band_id']}/", 'SERVER_URL' => $aurl ); switch ($_row['item_ccode']) { case 'AUD': $_rep['ITEM_CURRENCY_SYMBOL'] = '$'; break; case 'USD': $_rep['ITEM_CURRENCY_SYMBOL'] = '$'; break; case 'CAD': $_rep['ITEM_CURRENCY_SYMBOL'] = '$'; break; case 'EUR': $_rep['ITEM_CURRENCY_SYMBOL'] = ''; break; case 'GBP': $_rep['ITEM_CURRENCY_SYMBOL'] = '£'; break; case 'JPY': $_rep['ITEM_CURRENCY_SYMBOL'] = '¥'; break; default: $_rep['ITEM_CURRENCY_SYMBOL'] = '$'; break; } $rnum++; $pnum++; rankQuotaVars($_rep); if (isset($_post['row_template']) && is_array($_rep)) { htmlShowTemplate($_post['row_template'],array_merge($_page,$_rep),$tpl_dir); } } } elseif (isset($_post['mode']) && $_post['mode'] == 'radio') { if (is_numeric($_post['pagebreak'])) { $rv = "SELECT count(1) AS num FROM {$jamroom_db['radio']} r LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = r.radio_band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota WHERE (LENGTH(r.radio_include) > 0 OR LENGTH(r.radio_genres) > 0 OR LENGTH(r.radio_songs) > 0) AND (q.quota_rank = 'yes' || r.radio_band_id = 0) "; if (is_numeric($_post['quota'])) { $rv .= "AND i.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND i.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND r.radio_band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND r.radio_band_id IN (". @implode(',',$_post['band_id']) .") "; } if (isset($config['show_system_radio']) && $config['show_system_radio'] == 'no') { $rv .= "AND r.radio_band_id != 0 "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(r.radio_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(r.radio_name,1) = '{$_post['letter']}' "; } } $_n = dbQuery($rv,'SINGLE'); } $rv = "SELECT r.radio_id, r.radio_time, r.radio_name, r.radio_desc, r.radio_band_id, r.radio_type, r.radio_mode, r.radio_limit, r.radio_include, r.radio_songs, c.count, i.band_name, i.band_url, i.band_quota, q.quota_id, q.quota_name, q.quota_disk, q.quota_max, q.quota_message, q.quota_search, q.quota_radio, q.quota_store, q.quota_rate, q.quota_remrate, q.quota_calendar, v.server_id, v.server_ip, v.server_name, v.server_url FROM {$jamroom_db['radio']} r LEFT JOIN {$jamroom_db['rcounter']} c ON c.radio_id = r.radio_id LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = r.radio_band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota LEFT JOIN {$jamroom_db['servers']} v ON v.server_id = i.band_server WHERE (LENGTH(r.radio_include) > 0 OR LENGTH(r.radio_genres) > 0 OR LENGTH(r.radio_songs) > 0) AND (q.quota_rank = 'yes' || r.radio_band_id = 0) "; if (is_numeric($_post['quota'])) { $rv .= "AND i.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND i.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND r.radio_band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND r.radio_band_id IN (". @implode(',',$_post['band_id']) .") "; } if (isset($config['show_system_radio']) && $config['show_system_radio'] == 'no') { $rv .= "AND r.radio_band_id != 0 "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(r.radio_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(r.radio_name,1) = '{$_post['letter']}' "; } } switch ($_post['order']) { case '1': $rv .= "GROUP BY r.radio_id ORDER BY r.radio_name ASC "; break; case '2': $rv .= "GROUP BY r.radio_id ORDER BY r.radio_name DESC "; break; case '3': $rv .= "GROUP BY r.radio_id ORDER BY r.radio_time DESC "; break; case '4': $rv .= "GROUP BY r.radio_id ORDER BY r.radio_time ASC "; break; case '5': $rv .= "GROUP BY r.radio_id ORDER BY c.count DESC "; break; case '6': $rv .= "GROUP BY r.radio_id ORDER BY RAND() "; break; default: $rv .= "GROUP BY r.radio_id ORDER BY r.radio_name ASC "; break; } if (isset($beg) && isset($_post['pagebreak'])) { $rv .= "LIMIT {$beg},{$_post['pagebreak']}"; } elseif (is_numeric($_post['show'])) { $rv .= "LIMIT {$_post['show']}"; } elseif (is_numeric($config['page_results'])) { $rv .= "LIMIT {$config['page_results']}"; } $_rank = dbQuery($rv,'NUMERIC'); dbClose(); if (!is_array($_rank)) { $_rank = array(); } $_page['RADIO_COUNT'] = count($_rank); $pnum = 0; foreach ($_rank as $k => $_row) { $aurl = getJamroomUrl($_row['radio_band_id'],$_row['server_url']); $ttim = convertTime($_row['radio_time'],$config['server_offset']); $_rep = array( 'MODE' => 'radio', 'RADIO_RANK' => $rnum, 'RADIO_ID' => $_row['radio_id'], 'RADIO_CREATED' => $_row['radio_time'], 'RADIO_DATE1' => gmstrftime($config['date1'],$ttim), 'RADIO_DATE2' => gmstrftime($config['date2'],$ttim), 'RADIO_DATE3' => gmstrftime($config['date3'],$ttim), 'RADIO_NAME' => stripHtml($_row['radio_name']), 'RADIO_DESCRIPTION' => $_row['radio_desc'], 'RADIO_BAND_ID' => $_row['radio_band_id'], 'RADIO_BAND_NAME' => stripHtml($_row['band_name']), 'RADIO_BAND_URL_NAME' => $_row['band_url'], 'RADIO_TYPE' => $_row['radio_type'], 'RADIO_LIMIT' => $_row['radio_limit'], 'RADIO_IMAGE' => "{$aurl}/image.php?band_id={$_row['radio_band_id']}&radio_id={$_row['radio_id']}&mode=radio_image", 'RADIO_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['radio_band_id']}&radio_id={$_row['radio_id']}&mode=radio_image", 'RADIO_NUM_BANDS' => substr_count($_row['radio_include'],';') + 1, 'RADIO_NUM_SONGS' => substr_count($_row['radio_songs'],';') + 1, 'ARTIST_URL' => "{$aurl}/{$config['artist_dir']}/{$_row['radio_band_id']}/", 'SERVER_URL' => $aurl ); if ($_row['radio_mode'] == 'song_hifi') { $_rep['RADIO_MODE'] = 'hifi'; $_rep['RADIO_PLAY_URL'] = "{$jamroom['jm_htm']}/play.php?mode=radio&id={$_row['radio_id']}"; } else { $_rep['RADIO_MODE'] = 'lofi'; $_rep['RADIO_PLAY_URL'] = "{$jamroom['jm_htm']}/play.php?mode=radio&id={$_row['radio_id']}"; } if (empty($_row['count'])) { $_rep['RADIO_PLAYS'] = '0'; } else { $_rep['RADIO_PLAYS'] = $_row['count']; } $rnum++; $pnum++; rankQuotaVars($_rep); if (isset($_post['row_template']) && is_array($_rep)) { htmlShowTemplate($_post['row_template'],array_merge($_page,$_rep),$tpl_dir); } } } elseif ((isset($_post['mode']) && $_post['mode'] == 'photo') && is_file("{$jamroom['jm_dir']}/photo.php")) { if (is_numeric($_post['pagebreak'])) { $rv = "SELECT count(1) AS num FROM {$jamroom_db['images']} m LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = m.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota WHERE q.quota_rank = 'yes' AND m.image_show = 'yes' "; if (is_numeric($_post['quota'])) { $rv .= "AND i.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND i.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND i.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND i.band_id IN (". @implode(',',$_post['band_id']) .") "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(m.image_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(m.image_name,1) = '{$_post['letter']}' "; } } $_n = dbQuery($rv,'SINGLE'); } $rv = "SELECT m.image_id, m.image_time, m.image_name, m.image_type, m.image_size, m.image_extension, m.image_title, m.image_credits, m.image_category, m.image_caption, m.image_order, i.band_id, i.band_name, i.band_url, i.band_quota, q.quota_id, q.quota_name, q.quota_disk, q.quota_max, q.quota_message, q.quota_search, q.quota_radio, q.quota_store, q.quota_rate, q.quota_remrate, q.quota_calendar, v.server_id, v.server_ip, v.server_name, v.server_url FROM {$jamroom_db['images']} m LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = m.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota LEFT JOIN {$jamroom_db['servers']} v ON v.server_id = i.band_server WHERE q.quota_rank = 'yes' AND m.image_show = 'yes' "; if (is_numeric($_post['quota'])) { $rv .= "AND i.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND i.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND i.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND i.band_id IN (". @implode(',',$_post['band_id']) .") "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(m.image_name,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(m.image_name,1) = '{$_post['letter']}' "; } } switch ($_post['order']) { case '1': $rv .= "GROUP BY m.image_id ORDER BY m.image_name ASC "; break; case '2': $rv .= "GROUP BY m.image_id ORDER BY m.image_name DESC "; break; case '3': $rv .= "GROUP BY m.image_id ORDER BY m.image_time ASC "; break; case '4': $rv .= "GROUP BY m.image_id ORDER BY m.image_time DESC "; break; case '5': $rv .= "GROUP BY m.image_id ORDER BY m.image_size ASC "; break; case '6': $rv .= "GROUP BY m.image_id ORDER BY m.image_size DESC "; break; case '7': $rv .= "GROUP BY m.image_id ORDER BY m.image_category ASC "; break; case '8': $rv .= "GROUP BY m.image_id ORDER BY RAND() "; break; default: $rv .= "GROUP BY m.image_id ORDER BY m.image_name ASC "; break; } if (isset($beg) && isset($_post['pagebreak'])) { $rv .= "LIMIT {$beg},{$_post['pagebreak']}"; } elseif (is_numeric($_post['show'])) { $rv .= "LIMIT {$_post['show']}"; } elseif (is_numeric($config['page_results'])) { $rv .= "LIMIT {$config['page_results']}"; } $_rank = dbQuery($rv,'NUMERIC'); dbClose(); if (!is_array($_rank)) { $_rank = array(); } $_page['PHOTO_COUNT'] = count($_rank); $pnum = 0; foreach ($_rank as $k => $_row) { $aurl = getJamroomUrl($_row['band_id'],$_row['server_url']); $ttim = convertTime($_row['image_time'],$config['server_offset']); $_rep = array( 'MODE' => 'photo', 'PHOTO_RANK' => $rnum, 'PHOTO_ID' => $_row['image_id'], 'PHOTO_CREATED' => $_row['image_time'], 'PHOTO_DATE1' => gmstrftime($config['date1'],$ttim), 'PHOTO_DATE2' => gmstrftime($config['date2'],$ttim), 'PHOTO_DATE3' => gmstrftime($config['date3'],$ttim), 'PHOTO_NAME' => stripHtml($_row['image_name']), 'PHOTO_TYPE' => $_row['image_type'], 'PHOTO_SIZE' => $_row['image_size'], 'PHOTO_EXTENSION' => $_row['image_extension'], 'PHOTO_TITLE' => $_row['image_title'], 'PHOTO_CREDITS' => $_row['image_credits'], 'PHOTO_CATEGORY' => $_row['image_category'], 'PHOTO_CAPTION' => $_row['image_caption'], 'PHOTO_IMAGE' => "{$aurl}/image.php?mode=photo_image&band_id={$_row['band_id']}&image_id={$_row['image_id']}", 'PHOTO_IMAGE_URL' => "{$aurl}/image.php?mode=photo_image&band_id={$_row['band_id']}&image_id={$_row['image_id']}", 'BAND_ID' => $_row['band_id'], 'BAND_NAME' => $_row['band_name'], 'ARTIST_URL' => "{$aurl}/{$config['artist_dir']}/{$_row['band_id']}/", 'SERVER_URL' => $aurl ); $rnum++; $pnum++; rankQuotaVars($_rep); if (isset($_post['row_template']) && is_array($_rep)) { htmlShowTemplate($_post['row_template'],array_merge($_page,$_rep),$tpl_dir); } } } elseif (isset($_post['mode']) && $_post['mode'] == 'user') { if (is_numeric($_post['pagebreak'])) { $rv = "SELECT count(1) AS num FROM {$jamroom_db['user']} u LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = u.user_band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota WHERE q.quota_rank = 'yes' AND u.user_deleted = 'no' "; if ($config['show_admins'] == 'no') { $rv .= "AND u.user_group_id != '0' "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(u.user_nickname,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(u.user_nickname,1) = '{$_post['letter']}' "; } } $_n = dbQuery($rv,'SINGLE'); } $rv = "SELECT u.user_id, u.user_band_id, u.user_created, u.user_fullname, u.user_nickname, u.user_emailadr, u.user_homepage, u.user_imnumber, i.band_name, i.band_location, q.quota_id, v.server_id, v.server_ip, v.server_name, v.server_url FROM {$jamroom_db['user']} u LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = u.user_band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota LEFT JOIN {$jamroom_db['servers']} v ON v.server_id = i.band_server WHERE q.quota_rank = 'yes' AND u.user_deleted = 'no' "; if ($config['show_admins'] == 'no') { $rv .= "AND u.user_group_id != '0' "; } if (isset($_post['letter'])) { if (is_array($_post['letter'])) { $rv .= "AND LEFT(u.user_nickname,1) IN ('". @implode("','",$_post['letter']) ."') "; } elseif (strlen($_post['letter']) == 1) { $rv .= "AND LEFT(u.user_nickname,1) = '{$_post['letter']}' "; } } switch ($_post['order']) { case '1': $rv .= "GROUP BY u.user_id ORDER BY u.user_nickname ASC "; break; case '2': $rv .= "GROUP BY u.user_id ORDER BY u.user_nickname DESC "; break; case '3': $rv .= "GROUP BY u.user_id ORDER BY u.user_created ASC "; break; case '4': $rv .= "GROUP BY u.user_id ORDER BY u.user_created DESC "; break; case '5': $rv .= "GROUP BY u.user_id ORDER BY RAND() "; break; default: $rv .= "GROUP BY u.user_id ORDER BY u.user_nickname ASC "; break; } if (isset($beg) && isset($_post['pagebreak'])) { $rv .= "LIMIT {$beg},{$_post['pagebreak']}"; } elseif (is_numeric($_post['show'])) { $rv .= "LIMIT {$_post['show']}"; } elseif (is_numeric($config['page_results'])) { $rv .= "LIMIT {$config['page_results']}"; } $_rank = dbQuery($rv,'NUMERIC'); dbClose(); if (!is_array($_rank)) { $_rank = array(); } $_page['USER_COUNT'] = count($_rank); $pnum = 0; foreach ($_rank as $k => $_row) { $aurl = getJamroomUrl($_row['band_id'],$_row['server_url']); $ttim = convertTime($_row['user_created'],$config['server_offset']); $_rep = array( 'MODE' => 'user', 'USER_RANK' => $rnum, 'USER_ID' => $_row['user_id'], 'USER_CREATED' => $_row['user_created'], 'USER_DATE1' => gmstrftime($config['date1'],$ttim), 'USER_DATE2' => gmstrftime($config['date2'],$ttim), 'USER_DATE3' => gmstrftime($config['date3'],$ttim), 'USER_NICKNAME' => $_row['user_nickname'], 'USER_FULLNAME' => stripHtml($_row['user_fullname']), 'USER_EMAIL' => encodeString($_row['user_emailadr']), 'USER_WWW' => $_row['user_homepage'], 'USER_IM' => $_row['user_imnumber'], 'USER_BAND' => $_row['user_band_id'], 'USER_BAND_ID' => $_row['user_band_id'], 'USER_BAND_NAME' => $_row['band_name'], 'USER_BAND_LOCATION' => trim($_row['band_location']), 'QUOTA_ID' => $_row['quota_id'], 'ARTIST_URL' => "{$aurl}/{$config['artist_dir']}/{$_row['user_band_id']}/", 'SERVER_URL' => $aurl ); $rnum++; $pnum++; if (isset($_post['row_template']) && is_array($_rep)) { htmlShowTemplate($_post['row_template'],array_merge($_page,$_rep),$tpl_dir); } } } elseif (isset($_post['mode']) && $_post['mode'] == 'page') { if (is_numeric($_post['pagebreak'])) { $rv = "SELECT count(1) AS num FROM {$jamroom_db['pcounter']} p LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = p.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota WHERE q.quota_rank = 'yes' "; if (is_numeric($_post['quota'])) { $rv .= "AND i.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND i.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND i.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND i.band_id IN (". @implode(',',$_post['band_id']) .") "; } $_n = dbQuery($rv,'SINGLE'); } $rv = "SELECT p.filename, p.count, i.band_id, i.band_time, i.band_name, i.band_url, i.band_location, i.band_story, i.band_quota, i.band_website, i.band_server, i.band_influence, i.band_soundlike, v.server_id, v.server_ip, v.server_name, v.server_url FROM {$jamroom_db['pcounter']} p LEFT JOIN {$jamroom_db['band_info']} i ON i.band_id = p.band_id LEFT JOIN {$jamroom_db['quota']} q ON q.quota_id = i.band_quota LEFT JOIN {$jamroom_db['servers']} v ON v.server_id = i.band_server WHERE q.quota_rank = 'yes' "; if (is_numeric($_post['quota'])) { $rv .= "AND i.band_quota = {$_post['quota']} "; } elseif (is_array($_post['quota'])) { $rv .= "AND i.band_quota IN (". @implode(',',$_post['quota']) .") "; } if (is_numeric($_post['band_id'])) { $rv .= "AND i.band_id = {$_post['band_id']} "; } elseif (is_array($_post['band_id'])) { $rv .= "AND i.band_id IN (". @implode(',',$_post['band_id']) .") "; } switch ($_post['order']) { case '1': $rv .= "ORDER BY p.count DESC "; break; case '2': $rv .= "ORDER BY p.count ASC "; break; case '3': $rv .= "ORDER BY RAND() "; break; default: $rv .= "ORDER BY p.count DESC "; break; } if (isset($beg) && isset($_post['pagebreak'])) { $rv .= "LIMIT {$beg},{$_post['pagebreak']}"; } elseif (is_numeric($_post['show'])) { $rv .= "LIMIT {$_post['show']}"; } elseif (is_numeric($config['page_results'])) { $rv .= "LIMIT {$config['page_results']}"; } $_rank = dbQuery($rv,'NUMERIC'); dbClose(); if (!is_array($_rank)) { $_rank = array(); } $_page['PAGE_COUNT'] = count($_rank); $pnum = 0; foreach ($_rank as $k => $_row) { $aurl = getJamroomUrl($_row['band_id'],$_row['server_url']); $ttim = convertTime($_row['band_time'],$config['server_offset']); $_rep = array( 'MODE' => 'page', 'BAND_ID' => $_row['band_id'], 'BAND_CREATED' => $_row['band_time'], 'BAND_NAME' => stripHtml($_row['band_name']), 'BAND_URL_NAME' => $_row['band_url'], 'BAND_INFO' => bbDecode($_row['band_story']), 'BAND_LOCATION' => trim($_row['band_location']), 'BAND_WEBSITE' => $_row['band_website'], 'BAND_INFLUENCE' => $_row['band_influence'], 'BAND_SOUNDLIKE' => $_row['band_soundlike'], 'BAND_IMAGE_URL' => "{$aurl}/image.php?band_id={$_row['band_id']}&mode=band_image", 'BAND_QUOTA' => $_row['band_quota'], 'PAGE_RANK' => $rnum, 'PAGE_FILENAME' => $_row['filename'], 'PAGE_VIEWCOUNT' => $_row['count'], 'ARTIST_URL' => "{$aurl}/{$config['artist_dir']}/{$_row['band_id']}/", 'SERVER_URL' => $aurl ); $rnum++; $pnum++; if (isset($_post['row_template']) && is_array($_rep)) { htmlShowTemplate($_post['row_template'],array_merge($_page,$_rep),$tpl_dir); } } } else { exit; } $rows = ob_get_contents(); ob_end_clean(); if (isset($_post['header_template'])) { $next_url .= "&header_template={$_post['header_template']}"; $prev_url .= "&header_template={$_post['header_template']}"; } if (isset($_post['row_template'])) { $next_url .= "&row_template={$_post['row_template']}"; $prev_url .= "&row_template={$_post['row_template']}"; } if (isset($_post['footer_template'])) { $next_url .= "&footer_template={$_post['footer_template']}"; $prev_url .= "&footer_template={$_post['footer_template']}"; } if (is_array($_post['replace'])) { foreach ($_post['replace'] as $key => $rep) { $_page["REPLACE_{$key}"] = htmlentities(stripHtml(stripslashes(urldecode($rep)))); } } if ($_post['pagenum'] == '1' || empty($_post['pagenum'])) { $_page['PREV_PAGE'] = ''; $_page['PREV_PAGE_URL'] = ''; $_page['PREV_PAGE_NUM'] = ''; } else { $_page['PREV_PAGE'] = "{$config['page_prev']}"; $_page['PREV_PAGE_URL'] = $prev_url; } if (($pnum < $_post['pagebreak'] && is_array($_rep)) || (is_numeric($rnum) && ($rnum > $_n['num'] || $rnum <= $_post['show']))) { $_page['NEXT_PAGE'] = ''; $_page['NEXT_PAGE_URL'] = ''; $_page['NEXT_PAGE_NUM'] = ''; } else { $_page['NEXT_PAGE'] = "{$config['page_next']}"; $_page['NEXT_PAGE_URL'] = $next_url; } ob_start(); if (!is_array($_vars)) { $_vars = array(); } if (isset($_post['header_template'])) { $_page = @array_merge($_page,$_vars); htmlShowTemplate($_post['header_template'],$_page,$tpl_dir); } echo $rows; if (isset($_post['footer_template'])) { $_page = @array_merge($_page,$_vars); htmlShowTemplate($_post['footer_template'],$_page,$tpl_dir); } if (isset($_post['mode']) && $_post['mode'] != 'spotlight') { addToCache($cache_key,ob_get_contents()); } ob_end_flush(); exit; ?>