<?php

/*

GENERIC PAGE TEMPLATE

*/


// All important root and globals.  Do not edit the next 3 lines
$DOCROOT = $_SERVER['DOCUMENT_ROOT'];
include($DOCROOT.'/includes/globals.inc');
global $GLOB;


/*************************
 Configure this part
*************************/

// This is the date of this page's last update.  Change it when you update.

$lastupdate = '4/10/2008';


// The title of the page that will display at the top of the browser

$pagetitle = 'Reviews';


// The image for the top banner

$topbanner = '/images/web-rustbanner01.jpg';


// The alternate text for the top banner

$topbanneralt = 'Exclusive Reviews';


// Breadcrumbs (the trail of links that tells you where you are)

$bcstyle = 'LEVEL1';			// This should be 'HOME', 'LEVEL1' or 'LEVEL2'


// If you set $bcstyle to LEVEL1 or LEVEL2, you need this part

$bclocation  = 'Reviews';		// The is the text that will print for your current location. 


// If you set $bcstyle to LEVEL2, you also need these two

$bcparentname = 'Some Name';		// The name of the parent page to display
$bcparentlink = '/somepage.php';	// The link to the parent page (so they can click it to get back)

/*************************
STOP CONFIGURING
The rest of the page is your content.  Enjoy. 
*************************/
?>

<?php
	// Start the HTML with whatever you want the page to be called.
	html_start($pagetitle);
	// html_start(<title>) will print the starting HTML along with whatever you want in the title
?>

<?php
	// Print a banner across the top
	html_banner($topbanner, $topbanneralt);
	// html_banner(<image>, <text>) will print a banner with an image and alternate text
?>


<table width="700" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
	<td colspan="3" class="breadcrumb">
<?php
	/*******************
	This breadcrumb section will print the right trail depending on your configuration at the top of the template.
	If you know what you want, you don't need the whole thin of course, but it is easier if you leave it.
	******************/

	if($bcstyle == 'HOME')
	{
		html_breadcrumbs($bcstyle);
	}
	elseif($bcstyle == 'LEVEL1')
	{
		html_breadcrumbs($bclocation);
	}
	elseif($bcstyle == 'LEVEL2')
	{
		$bcpage = array('name' => $bcparentname, 'link' => $bcparentlink);
		html_breadcrumbs($bclocation, $bcpage);
	}
	else
	{
		html_breadcrumbs('NONE');
	}

	/*******************
	END BREADCRUMB TRAIL
	******************/
?>

	</td>
</tr>
<tr>
	<td colspan="3">
		&nbsp;
	</td>
</tr>
<tr>
	<td valign="top" width="160" class="leftnavcolumn">

<?php
	// Print the navigation bar
	include($DOCROOT.'/includes/navbar.inc');
?>
	</td>
	<td class="bodytitle" width="15">
		&nbsp;
	</td>
	<td valign="top" id="bodycell">
	<!-- START BODY CONTENT SECTION -->
		<table width="100%" align="center" cellpadding="3" cellspacing="0" border="0">
		<tr>
			<td colspan="2" class="bodytitle">
				<span class="heading">Reviews</span>
			</td>
		</tr>
<?php
if(!isset($_REQUEST['review']))
{
	echo'
		<tr> 
			<td colspan="2"> 
				<!-- <p class="maintext">Our ultimate goal is to include as wide an array of genres that would be of interest to the Darksider community as possible on our Reviews page. If you feel certain areas aren\'t being represented, WE AGREE WITH YOU. We\'re looking for decent writers who can put together intelligent and concise reviews for albums on a timely basis. Of course, any submissions will be subject to our crack editorial team. We would appreciate working with new contributors!</p> -->
				<p class="maintext">If you read a book, see a movie, listen to a new album or discover a new band, we want to read about it! <a href="email.php">Click here and let us know what you found.</a></p>
			</td>

		</tr>';
}
?>

		<tr>
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
		<tr>
			<td colspan="2" height="25" class="bodysubtitle1 maintext">
				DISCLAIMER: Reviews are the opinions of the individual reviewer and do not necessarily represent the views of DarkTwinCities.com.
			</td>
		</tr> 
		<tr>
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
<?php /*******************************************/
if(isset($_REQUEST['review']))
{
	$rtypes = array(
		1 => array(
			'table' => 'reviewstheater', 
			'SQL' => 'SELECT id, datetime, author, title, venue, review, images FROM reviewstheater WHERE id='.$_REQUEST['review']
			),
		2 => array(
			'table' => 'reviewsmovies',
			'SQL' => 'SELECT id, datetime, author, title, review, images FROM reviewsmovies WHERE id='.$_REQUEST['review']
			),
		3 => array(
			'table' => 'musicreviews',
			'SQL' => 'SELECT id, datetime, author, artist, album, review, tracklist, images, labname, laburl FROM musicreviews WHERE id='.$_REQUEST['review']
			),
		4 => array(
			'table' => 'dvdreviews',
			'SQL' => 'SELECT id, datetime, title, reviewer, body FROM reviewsdvd WHERE id='.$_REQUEST['review']
			),
	);

	if($db = db_connect())
	{
		if(isset($_REQUEST['rtype']))
		{
			if(isset($rtypes[$_REQUEST['rtype']]))
			{
				$rtable = $rtypes[$_REQUEST['rtype']]['table'];
				$SQL = $rtypes[$_REQUEST['rtype']]['SQL'];
			}
			else
			{
				print'<pre>';print_r($rtypes);print'</pre>';
				die('bad review type');
			}
		
			if(!$result = mysql_query($SQL, $db))
			{
				die('Query failed '.mysql_error());
			}
			else
			{
				if($_REQUEST['rtype'] == 4)
				{
					while($set = mysql_fetch_assoc($result))
					{
						list($reviewdate, $reviewtime) = split(' ', $set['datetime']);
						echo '
						<tr>
							<td class="bodysubtitle1">
								<em>'.$set['title'].'</em><br /><a href="reviews.php">[return to reviews]</a>
							</td>
						</tr>
						<tr>
							<td class="bodysubtitle1 maintext" align="justify">
								Review by <a href="copyright.php#'.$set['reviewer'].'">'.$set['reviewer'].'</a>
							</td>
						</tr>
						<tr>
							<td class="maintext">
								&nbsp;
							</td>
						</tr>
						<tr>
							<td class="maintext">
								'.$set['body'].'
							</td>
						</tr>
						<tr>
							<td class="maintext">
								&nbsp;
							</td>
						</tr>';
					}
				}
				else
				{
					while($set = mysql_fetch_assoc($result))
					{
						$reviewimages = split(',', $set['images']);
						list($reviewdate, $reviewtime) = split(' ', $set['datetime']);
						if(isset($set['venue']))
						{
							$venue = ' - '.$set['venue'];
						}
						else
						{
							$venue = '';
						}
						echo '
						<tr>
							<td class="bodysubtitle1">
								<em>'.$set['title'].'</em> '.$venue.'<br /><a href="reviews.php">[return to reviews]</a>
							</td>
						</tr>
						<tr>
							<td class="bodysubtitle1 maintext" align="justify">
								Review by <a href="copyright.php#'.$set['author'].'">'.$set['author'].'</a>
							</td>
						</tr>
						<tr>
							<td class="maintext">
								&nbsp;
							</td>
						</tr>
						<tr>
							<td class="maintext">
								'.$set['review'].'
							</td>
						</tr>
						<tr>
							<td class="maintext">
								&nbsp;
							</td>
						</tr>';
					}
				}
			}
	
		}
		else
		{

		$SQL = 'SELECT id, datetime, author, artist, album, review, tracklist, images, labname, laburl FROM musicreviews WHERE id='.$_REQUEST['review'];
		if(!$result = mysql_query($SQL, $db))
		{
			die('Query failed '.mysql_error());
		}
		else
		{
			while($set = mysql_fetch_assoc($result))
			{
				$reviewimages = split(',', $set['images']);
				list($reviewdate, $reviewtime) = split(' ', $set['datetime']);
				echo '
				<tr>
					<td class="bodysubtitle1">
						'.$set['artist'].' - '.$set['album'].' <a href="reviews.php">[return to reviews]</a>
					</td>
				</tr>
';
				if(isset($set['labname'])){
					echo '
				<tr>
					<td class="bodysubtitle1 maintext" align="justify">
						Label: <a href="'.$set['laburl'].'">'.$set['labname'].'</a>
					</td>
				</tr>';
				}
				echo '
				<tr>
					<td class="bodysubtitle1 maintext" align="justify">
						Review by <a href="copyright.php#'.$set['author'].'">'.$set['author'].'</a>
					</td>
				</tr>
				<tr>
					<td class="maintext">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td class="maintext">
						'.$set['review'].'
					</td>
				</tr>
				<tr>
					<td class="maintext">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td class="bodysubtitle1">
						Tracklist
					</td>
				</tr>
				<tr>
					<td class="maintext">
						'.$set['tracklist'].'
					</td>
				</tr>';
			}
		}
		}
	}
	else
	{
		die('unable to connect to db');
	}
	db_close($db);
}
else
{
	include($DOCROOT.'/includes/reviews_summaries_new.inc');
}
/*******************************************/ ?>
		<tr>
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
		</table>
	<!-- STOP BODY CONTENT SECTION -->
	</td> 
</tr> 
<tr>
	<td colspan="3" class="bodytitle">
		&nbsp;
	</td>
</tr>
<tr>
	<td colspan="3" class="footer">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td>
				<?php html_footer(); ?>
			</td>
			<td width="150" class="lastupdate">
				Last update: <?php echo $lastupdate; ?>
			</td>
		</tr>
		</table>
	</td>
        <!-- end of main body subtable -->
</tr>
</table>

<?
include($DOCROOT.'/includes/foot.inc');
?>

</body>
</html>
