require_once("/home/castalbums/website/includes/cr-ezsql.php");
require_once("/home/castalbums/website/includes/cr-template.php");
require_once("/home/castalbums/website/includes/cr-functions.php");
require_once("/home/castalbums/website/includes/cr-star_rating.php");
require_once("/home/castalbums/website/includes/cr-tracks.php");
require_once("/home/castalbums/website/includes/cr-editing.php");
$id = $crdb->escape($id);
if (!$id) header("Location: /releases/");
$release = $crdb->get_row('SELECT * FROM releases WHERE release_id="'.$id.'"');
$recordings = $crdb->get_results('SELECT * FROM releases_to_recording LEFT JOIN recordings USING (recording_id) WHERE release_id="'.$id.'"');
$history = $crdb->get_results('SELECT * FROM history LEFT JOIN users ON (user_id_credit=user_id) WHERE (id_type="release" OR id_type="tracks") AND id="'.$id.'" ORDER BY submitted DESC');
if (!$recordings) Mini_Page('Error! No release #'.$id, 'Sorry, there is no release #'.$id);
$cr_page->breadcrumbs[] = 'Database';
$cr_page->breadcrumbs[] = 'Releases';
$cr_page->current_nav = 'Database';
$cr_page->id_of_cover_in_title = $recording->cover_cheat;
$cr_page->tabs[] = array(URL_to_Release($release), 'Info', ((!$include)?1:0));
//$cr_page->tabs[] = array(URL_to_Release($release).'/stats/', 'Stats', (($include=='stats')?1:0));
if ($a_user) $cr_page->tabs[] = array('/contribute/release.php?id='.$id, 'Edit Release');
if ($history) $cr_page->tabs[] = array(URL_to_Release($release).'/history/', 'History ('.count($history).')', (($include=='history')?1:0));
if ($include=='history') require_once($_SERVER['DOCUMENT_ROOT'].'/releases/single_history.php');
elseif ($include=='stats') require_once($_SERVER['DOCUMENT_ROOT'].'/releases/single_stats.php');
else require_once($_SERVER['DOCUMENT_ROOT'].'/releases/single_main.php');
?>