force_recache = TRUE; if (!$slug) Header("Location: ".GetLinkToShow($id)); $show = $crdb->get_row("SELECT * FROM shows WHERE show_id=$id"); if (!$show) Mini_Page('Shows', 'Error! No show matches this id: '.$id); $songs=$crdb->get_results("SELECT song_id, song_title, song_num_recordings, songs.notes, alternate, GROUP_CONCAT(DISTINCT CONCAT(person_name,'^',person_id,'^',credits,'^',role) ORDER BY role, person_name SEPARATOR '\n') AS role FROM songs LEFT JOIN roles ON (song_id=id AND id_type='song') LEFT JOIN people USING (person_id, variation) WHERE show_id='$id' GROUP BY song_id ORDER BY alternate, song_title_order"); $links=$crdb->get_results("SELECT * FROM links WHERE (related_id='$id' AND related_type='show') OR (related_type='recording' AND related_id IN (SELECT recording_id FROM recordings WHERE show_id='$id')) ORDER BY related_type"); //$threads = $crdb->get_results("SELECT thread_id, subject, num_replies, user_name, last_user_id, DATE_FORMAT(last_date,'%a, %c/%e/%y, %l:%i %p') as last_date // FROM comment_threads LEFT JOIN comment_taxonomy USING (thread_id) // LEFT JOIN users ON (user_id=last_user_id) // WHERE related_type='Shows' AND related_id='$id' ORDER BY comment_id"); //$threads = $crdb->get_results('SELECT * FROM forum_taxonomy LEFT JOIN forum_threads USING (thread_id) // LEFT JOIN forums ON (forum_threads.forum_id=forums.forum_id) // WHERE related_type="show" AND related_id="'.$id.'" ORDER BY main DESC, thread_last_reply_date DESC;'); $threads = $crdb->get_results('(SELECT * FROM forum_taxonomy LEFT JOIN forum_threads USING (thread_id) LEFT JOIN forums ON (forum_threads.forum_id=forums.forum_id) WHERE related_type="show" AND related_id="'.$id.'" ORDER BY main DESC, thread_last_reply_date DESC) UNION (SELECT * FROM forum_taxonomy LEFT JOIN forum_threads USING (thread_id) LEFT JOIN forums ON (forum_threads.forum_id=forums.forum_id) WHERE related_type="recording" AND related_id IN (SELECT recording_id FROM recordings WHERE show_id="'.$id.'") ORDER BY main DESC, thread_last_reply_date DESC)'); $blog_posts = R_Blog_Posts($id, 'show'); $ors = 'SELECT recording_id, recording_title, year, source, cover_cheat, recording_image_id, soundclips, GROUP_CONCAT(DISTINCT CONCAT(songs.song_id,":",song_title) SEPARATOR "^") AS songs FROM songs LEFT JOIN songs_to_release USING (song_id) LEFT JOIN recordings USING (recording_id) WHERE songs.show_id="'.$id.'" AND recordings.show_id!="'.$id.'" '; if ($filter->type) $ors .= 'AND recordings.subtype="'.$filter->type.'" '; $ors .= 'GROUP BY recording_id'; if ($filter->order=='Date') $ors .= ' ORDER BY IF((YEAR(year)="0000"), 1, 0), YEAR(year), recording_title_order'; elseif ($filter->order=='Date Reverse') $ors .= ' ORDER BY IF((YEAR(year)="0000"), 1, 0), YEAR(year) DESC, recording_title_order'; elseif ($filter->order=='Source') $ors .= ' ORDER BY source, recording_title_order, IF((YEAR(year)="0000"), 1, 0), YEAR(year)'; else $ors .= ' ORDER BY recording_title_order, IF((YEAR(year)="0000"), 1, 0), YEAR(year), source'; $ors = $crdb->get_results($ors); $history = $crdb->get_results('SELECT * FROM history LEFT JOIN users ON (user_id_credit=user_id) WHERE id_type="show" AND id="'.$id.'" ORDER BY submitted DESC'); $cr_page->breadcrumbs[] = 'Database'; $cr_page->breadcrumbs[] = 'Shows'; $cr_page->breadcrumbs[] = $show->show_title; $cr_page->shortlink = 's'.$id; $cr_page->title = $show->show_title; if ($include=='history') $cr_page->title = 'Editing History: '.$cr_page->title.''; if ($include=='history') $prefix = URL_to_Show($show); else $prefix=''; $cr_page->tabs[] = array($prefix.'#recordings', 'Recordings ('.$show->show_num_recordings.')', (($include!='history')?1:0)); if ($ors) $cr_page->tabs[] = array($prefix.'#covers', 'Covers ('.count($ors).')'); $cr_page->tabs[] = array($prefix.'#songs', 'Songs ('.count($songs).')'); //$cr_page->tabs[] = array($prefix.'#discussion', 'Discussion ('.(count($threads)+count($blog_posts)).')'); //$cr_page->tabs[] = array($prefix.'#links', 'Links ('.count($links).')'); if ($a_user->user_id) $cr_page->tabs[] = array('/contribute/show.php?id='.$id, 'Edit Show'); if ($history) $cr_page->tabs[] = array(URL_to_Show($show).'history/', 'History ('.count($history).')', (($include=='history')?1:0)); if ($include=='history') require_once($_SERVER['DOCUMENT_ROOT'].'/shows/single_history.php'); else require_once($_SERVER['DOCUMENT_ROOT'].'/shows/single_recordings.php'); $cr_page->End(); ?>