<?php 

// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
?>
<table border="0" width="100%" cellspacing="0" cellpadding="<?php echo CELLPADDING_SUB; ?>">
	<?php
		// BOF: Lango Added for template MOD
		if (SHOW_HEADING_TITLE_ORIGINAL == 'yes') {
			$header_text = '&nbsp;'
			//EOF: Lango Added for template MOD
	?>
	<tr>
		<td>
			<table border="0" width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="pageHeading"><?php echo TEXT_NEWSDESK_HEADING; ?></td>
				<td class="pageHeading" align="right">
					<?php echo tep_image(DIR_WS_IMAGES . 'table_background_reviews.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?>
				</td>
			</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
	</tr>
	<?php
		// BOF: Lango Added for template MOD
		}else{
			if (MAIN_TABLE_BORDER == 'yes'){
	?>	
		
		<tr>
			<td colspan="2" >	
				<table cellpadding="0" cellspacing="10" width="100%">
					<tr>
						<td class="infoBoxHeadingpage" valign="middle"><?php echo tep_template_image('arrow_1.gif','','align="absmiddle"') . '&nbsp;' .  TEXT_NEWSDESK_HEADING;?></td>
					</tr>
				</table>			
			</td>
		</tr>	
	<?php }
	}
		// EOF: Lango Added for template MOD
	?>
	<?php
		$product_info = tep_db_query("
		select p.newsdesk_id, pd.newsdesk_article_name, pd.newsdesk_article_description, pd.newsdesk_article_shorttext, 
		p.newsdesk_image, p.newsdesk_image_two, p.newsdesk_image_three, pd.newsdesk_article_url, pd.newsdesk_article_viewed, p.newsdesk_date_added, 
		p.newsdesk_date_available 
		from " . TABLE_NEWSDESK . " p, " . TABLE_NEWSDESK_DESCRIPTION . " pd where p.newsdesk_id = '" . $HTTP_GET_VARS['newsdesk_id'] . "' 
		and pd.newsdesk_id = '" . $HTTP_GET_VARS['newsdesk_id'] . "' and pd.language_id = '" . $languages_id . "'");
		if (!tep_db_num_rows($product_info)) { // product not found in database
	?>
	<table border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td class="main"><br><?php echo TEXT_NEWS_NOT_FOUND; ?></td>
		</tr>
		<tr>
		<td align="right">
			<br>
			<a href="<?php echo tep_href_link(FILENAME_DEFAULT, '', 'NONSSL'); ?>"><?php echo tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></a>
		</td>
		</tr>
	</table>
	<?php
		} else {
			tep_db_query("update " . TABLE_NEWSDESK_DESCRIPTION . " set newsdesk_article_viewed = newsdesk_article_viewed+1 where newsdesk_id = '" . $HTTP_GET_VARS['newsdesk_id'] . "' and language_id = '" . $languages_id . "'");
			$product_info_values = tep_db_fetch_array($product_info);
			
			if ($product_info_values['newsdesk_image'] != 'Array') {
				if (($product_info['newsdesk_image'] != 'Array') or ($product_info['newsdesk_image'] != '')) {
					$insert_image = '
					<table border="0" width="20%" cellspacing="0" cellpadding="0">
					<tr>
					<td>
					'. tep_image(DIR_WS_IMAGES . $product_info_values['newsdesk_image'], $product_info_values['newsdesk_article_name'], '200', '200', 
					'hspace="5" vspace="5"'). '
					</td>
					</tr>
					</table>
					';
				}
			}
			
			if ($product_info_values['newsdesk_image_two'] != '') {
				if (($product_info['newsdesk_image_two'] != 'Array') or ($product_info['newsdesk_image_two'] != '')) {
					$insert_image_two = '
					<table border="0" width="20%" cellspacing="0" cellpadding="0">
					<tr>
					<td>
					'. tep_image(DIR_WS_IMAGES . $product_info_values['newsdesk_image_two'], $product_info_values['newsdesk_article_name'], '200', '200', 
					'hspace="5" vspace="5"'). '
					</td>
					</tr>
					</table>
					';
				}
			}
			
			if ($product_info_values['newsdesk_image_three'] != '') {
				if (($product_info['newsdesk_image_three'] != 'Array') or ($product_info['newsdesk_image_three'] != '')) {
					$insert_image_three = '
					<table border="0" width="20%" cellspacing="0" cellpadding="0">
					<tr>
					<td>
					'. tep_image(DIR_WS_IMAGES . $product_info_values['newsdesk_image_three'], $product_info_values['newsdesk_article_name'], '200', '200', 
					'hspace="5" vspace="5"'). '
					</td>
					</tr>
					</table>
					';
				}
			}
		?>
		<tr>
			<td>
				<table border="0" width="100%" cellspacing="3" cellpadding="3">
					<tr>
						<td class="main" valign="top" colspan="2">
							<table border="0" width="100%" cellspacing="0" cellpadding="3">
							<tr class="headerNavigation">
								<td class="pageHeading" style="font-size:14px;"><?php echo $product_info_values['newsdesk_article_name']; ?></td>
							</tr>
							<tr>
								<td class="main">
									<?php echo sprintf(TEXT_NEWSDESK_DATE, tep_date_long($product_info_values['newsdesk_date_added']));; ?>
								</td>
							</tr>
							<tr>
								<td class="main"><?php echo TEXT_NEWSDESK_VIEWED . $product_info_values['newsdesk_article_viewed'] ?></td>
							</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td width="100%" class="main" valign="top">
							<table border="0" width="100%" cellspacing="0" cellpadding="0">
								<tr>
									<td class="footer"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
								</tr>
							</table>
							<table border="0" width="100%" cellspacing="0" cellpadding="0">
								<tr>
									<td class="footer"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
								</tr>
							</table>							
							<br>
							<!--<span style="float:left;margin:0px;padding:10px;">
								<?php echo tep_image(DIR_WS_IMAGES . $product_info_values['newsdesk_image'], $product_info_values['newsdesk_article_name'], '', '', 'hspace="5" vspace="5"')?>
							</span>-->
							<?php echo stripslashes($product_info_values['newsdesk_article_description']); ?>
							<div style="clear:both;"><br></div>
							<?php if ($product_info_values['newsdesk_article_url']) { ?>
							<br>
							<br>
							<table border="0" width="100%" cellspacing="0" cellpadding="0">
								<tr>
									<td class="main"><?php echo TEXT_NEWSDESK_LINK_HEADING; ?></td>
								</tr>
								<tr>
									<td class="footer"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
								</tr>
								<tr>
									<td class="main">
										<?php echo sprintf(TEXT_NEWSDESK_LINK, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info_values['newsdesk_article_url']), 'NONSSL', true, false)); ?>
									</td>
								</tr>
							</table>
							<?php } ?>
							<?php
								$reviews = tep_db_query("
								select count(*) as count from " . TABLE_NEWSDESK_REVIEWS . " where approved='1' and newsdesk_id = '" 
								. $HTTP_GET_VARS['newsdesk_id'] . "'
								");
								$reviews_values = tep_db_fetch_array($reviews);
							?>
							<br>
							<br>
							
						</td>
						<td class="main" valign="top" align="center">
							<?php
								echo $insert_image;
								echo $insert_image_two;
								echo $insert_image_three;
							?>
						</td>
					</tr>
					<tr>
						<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '20'); ?></td>
					</tr>
					<tr>
						<td colspan="2">
							<table border="0" width="100%" cellspacing="0" cellpadding="0">
								<tr class="main">
									<td class="main" nowrap="nowrap" style="font-weight:bold;"><?php echo TEXT_RELATED_LINKS;?></td>
								</tr>
								<tr>
									<td class="main" nowrap="nowrap">
										<?php 
											echo '<a style="color:#006699;" href="' . tep_href_link(FILENAME_NEWSDESK_REVIEWS_WRITE, $get_params, 'NONSSL') . '">' . tep_image_button('button_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a>';
										?>
									</td>
								</tr>	
								<tr>
									<td class="main" nowrap="nowrap">
										<a style="color:#006699;" href="<?php echo tep_href_link(FILENAME_NEWSDESK_REVIEWS_ARTICLE, substr(tep_get_all_get_params(), 0, -1)); ?>">
										<?php echo tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS); ?></a>
									</td>
								</tr>
							</table>	
						</td>
					</tr>	
					<?php
						// BOF: Lango Added for template MOD
						if (MAIN_TABLE_BORDER == 'yes'){
							//table_image_border_bottom();
						}
						// EOF: Lango Added for template MOD
					?>
				</table>
				<?php
					if ( DISPLAY_NEWSDESK_REVIEWS ) {
						if ($reviews_values['count'] > 0) {
							require FILENAME_NEWSDESK_ARTICLE_REQUIRE;
						}
					}
				?>
			</td>
			<td  width="150" valign="top" nowrap="nowrap">
				<table width="100%" border="0">
					<tr class="main">
						<td nowrap="nowrap"  class="main" style="font-weight:bold;" ><?php echo TEXT_RELATED_LINKS;?></td>
					</tr>
					<tr>
						<td class="main"  colspan="2" nowrap="nowrap">
							<?php 
								echo '<a style="color:#006699;" href="' . tep_href_link(FILENAME_NEWSDESK_REVIEWS_WRITE, $get_params, 'NONSSL') . '">' . IMAGE_BUTTON_WRITE_REVIEW . '</a>';
							?>
						</td>
					</tr>	
					<tr>
						<td class="main"  colspan="2" nowrap="nowrap">
							<a style="color:#006699;" href="<?php echo tep_href_link(FILENAME_NEWSDESK_REVIEWS_ARTICLE, substr(tep_get_all_get_params(), 0, -1)); ?>">
							<?php echo IMAGE_BUTTON_REVIEWS; ?></a>
						</td>
					</tr>
					<tr>
						<td colspan="2"  nowrap="nowrap"><?php echo tep_draw_separator('pixel_trans.gif', '1', '20'); ?></td>
					</tr>
					<tr class="main">
						<td class="main"  nowrap="nowrap" style="font-weight:bold;"><?php echo TEXT_RECENT_NEWS;?></td>
					</tr>
					<?php
						$newsdesk_info = tep_db_query("
						select p.newsdesk_id, pd.newsdesk_article_name, nc.categories_id from " . TABLE_NEWSDESK . " p, " . TABLE_NEWSDESK_DESCRIPTION . " pd,  
						" . TABLE_NEWSDESK_TO_CATEGORIES . " nd," . TABLE_NEWSDESK_CATEGORIES . " nc
						where nc.categories_id = nd.categories_id and p.newsdesk_id = nd.newsdesk_id and p.newsdesk_id = pd.newsdesk_id and
						nd.newsdesk_id != '" . $HTTP_GET_VARS['newsdesk_id'] . "' 
						and pd.language_id = '" . $languages_id . "' limit 5");
						while($newsdesk_info_values = tep_db_fetch_array($newsdesk_info)){
					?>	
					<tr>	
						<td class="main"  nowrap="nowrap">
							<?php $q = "newsPath=".$newsdesk_info_values['categories_id']."&newsdesk_id=".$newsdesk_info_values['newsdesk_id'];?>
							<a style="color:#006699;" href="<?php echo tep_href_link(FILENAME_NEWSDESK_INFO,$q,'NONSSL');?>"><?php echo $newsdesk_info_values['newsdesk_article_name'];?></a>
						</td>
					</tr>
					<?php }?>	
					<tr>
						<td colspan="2"  nowrap="nowrap"><?php echo tep_draw_separator('pixel_trans.gif', '1', '20'); ?></td>
					</tr>
					<tr class="main"  nowrap="nowrap">
						<td class="main" style="font-weight:bold;"><?php echo TEXT_RELEASE_ARCHIVE;?></td>
					</tr>
					<tr colspan="3">
						<td style="color:#006699;" class="main" nowrap="nowrap">
							<a href="<?php echo tep_href_link(FILENAME_NEWSDESK_ARCHIVE,'newsArchive='.date('Y').'','NONSSL');?>"><div class="main" style="float:left;color:#006699;"><?php echo date('Y');?></div></a>
							<a href="<?php echo tep_href_link(FILENAME_NEWSDESK_ARCHIVE,'newsArchive='.(date('Y')-1).'','NONSSL');?>"><div class="main" style="float:left;color:#006699;padding-left:25px;"><?php echo date('Y')-1;?></div></a>
							<a href="<?php echo tep_href_link(FILENAME_NEWSDESK_ARCHIVE,'newsArchive='.(date('Y')-2).'','NONSSL');?>"><div class="main" style="float:left;color:#006699;padding-left:25px;"><?php echo date('Y')-2;?></div></a>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<?php } ?>

<!-- body_text_eof //-->
<?php
/*

	osCommerce, Open Source E-Commerce Solutions ---- http://www.oscommerce.com
	Copyright (c) 2002 osCommerce
	Released under the GNU General Public License

	IMPORTANT NOTE:

	This script is not part of the official osC distribution but an add-on contributed to the osC community.
	Please read the NOTE and INSTALL documents that are provided with this file for further information and installation notes.

	script name:	NewsDesk
	version:		1.4.5
	date:			2003-08-31
	author:			Carsten aka moyashi
	web site:		www..com

*/
?>
