force_recache = TRUE; if (!$slug) RedirectPage(URL_to_Person($id)); $person = $crdb->get_row("SELECT * FROM people WHERE person_id=$id"); if (!$person) Mini_Page('People', 'Error! No person matches this id: '.$id); $history = $crdb->get_results('SELECT * FROM history LEFT JOIN users ON (user_id_credit=user_id) WHERE id_type="person" AND id="'.$id.'" ORDER BY submitted DESC'); $cr_page->breadcrumbs[] = R_Link('Database', '/database/'); $cr_page->breadcrumbs[] = R_Link('People', '/people/'); $cr_page->breadcrumbs[] = R_Link_to_Person($person); $cr_page->shortlink = 'p'.$id; $num_songs = $crdb->get_var('SELECT count(*) FROM ( ( SELECT DISTINCT song_id FROM roles LEFT JOIN songs ON (songs.show_id=roles.id) WHERE person_id="'.$id.'" AND id_type="show" and (role="Music" OR role="Lyrics") AND song_id IS NOT NULL ) UNION ( SELECT id FROM roles WHERE person_id="'.$id.'" AND id_type="song" AND id IS NOT NULL ) ) as big'); $num_shows = $crdb->get_var('SELECT COUNT(DISTINCT id) FROM roles WHERE id_type="show" AND person_id="'.$id.'" AND id IS NOT NULL'); $num_threads = $crdb->get_var('SELECT count(*) FROM forum_taxonomy LEFT JOIN forum_threads USING (thread_id) LEFT JOIN forums ON (forum_threads.forum_id=forums.forum_id) WHERE related_type="person" AND related_id="'.$id.'" ORDER BY main DESC, thread_last_reply_date DESC'); $num_links=$crdb->get_var('SELECT count(*) FROM links WHERE (db_id="'.$id.'" AND db_type="people")'); $links=$crdb->get_results("SELECT * FROM links WHERE db_id='$id' AND db_type='people' ORDER BY db_type"); $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="people" AND related_id="'.$id.'" ORDER BY main DESC, thread_last_reply_date DESC'); $blog_posts = R_Blog_Posts($id, 'person'); $cr_page->tabs[] = array(R_URL_to_Person($person), 'Recordings', ((!$include)?1:0)); if ($num_shows) $cr_page->tabs[] = array(R_URL_to_Person($person).'/shows', 'Shows'.(($num_shows)?' ('.$num_shows.')':''), (($include=='shows')?1:0)); if ($num_songs) $cr_page->tabs[] = array(R_URL_to_Person($person).'/songs', 'Songs'.(($num_songs)?' ('.$num_songs.')':''), (($include=='songs')?1:0)); //$cr_page->tabs[] = array(R_Link_to_Person($person).'/discussion', 'Discussion'.(($num_threads)?' ('.$num_threads.')':'').' & Links '.(($num_links)?'('.$num_links.')':''), (($include=='discussion')?1:0)); if ($history) $cr_page->tabs[] = array(R_URL_to_Person($person).'/history', 'History'.(($history)?' ('.count($history).')':''), (($include=='history')?1:0)); if ($logged_in_id) $cr_page->tabs[] = array('/contribute/person.php?id='.$id, 'Edit this Person'); if ($include=='history') require_once($_SERVER['DOCUMENT_ROOT'].'/people/single_history.php'); elseif ($include=='shows') { $cr_page->title = 'Shows by '.R_Person_Name($person); require_once($_SERVER['DOCUMENT_ROOT'].'/people/single_shows.php'); } elseif ($include=='songs') { $cr_page->title = 'Songs by '.R_Person_Name($person); require_once($_SERVER['DOCUMENT_ROOT'].'/people/single_songs.php'); } //elseif ($include=='discussion') require_once($_SERVER['DOCUMENT_ROOT'].'/people/single_discussion.php'); else { $cr_page->title = R_Person_Name($person).' Discography'; require_once($_SERVER['DOCUMENT_ROOT'].'/people/single_recordings.php'); } $cr_page->End(); ?>