<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/
?>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

 <!-- Naglowek BOF -->
 <tr>
  <td>
   <?php
   $info_box_contents = array();
   $info_box_contents[] = array('text' => sprintf(TEXT_NEWSDESK_HEADING));
   new contentBoxHeading($info_box_contents);
   ?>
  </td>
 </tr>
 <tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
 </tr>
 <!-- Naglowek EOF -->

 <tr>
  <td>
   <table border="0" width="100%" cellspacing="1" cellpadding="2" class="TableFrame">
       <tr>
        <td>
         <?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_url_name, 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" width="100%" cellspacing="3" cellpadding="3">
          <tr>
           <td class="main"><br><?php echo TEXT_NEWS_NOT_FOUND; ?></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'] != '') {
           if (($product_info['newsdesk_image'] != 'Array') or ($product_info['newsdesk_image'] != '')) {
            $insert_image = '<table border="0" cellspacing="0" cellpadding="0"><tr><td>'. tep_image(DIR_WS_IMAGES . $product_info_values['newsdesk_image'], $product_info_values['newsdesk_article_name'], '', '', '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" cellspacing="0" cellpadding="0"><tr><td>'. tep_image(DIR_WS_IMAGES . $product_info_values['newsdesk_image_two'], $product_info_values['newsdesk_article_name'], '', '', '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" cellspacing="0" cellpadding="0"><tr><td>'. tep_image(DIR_WS_IMAGES . $product_info_values['newsdesk_image_three'], $product_info_values['newsdesk_article_name'], '', '', 'hspace="5" vspace="5"'). '</td></tr></table>';
           }
          }
          ?>

          <!-- News Tytul i data BOF -->
          <table border="0" width="100%" cellspacing="0" cellpadding="3">
           <tr>
            <td class="smallText"><b><?php echo $product_info_values['newsdesk_article_name']; ?></b></td>
            <td class="headerNavigation" align="right">&nbsp;
			 <?php if (NEWS_CZY_DATA != '0' || !defined('NEWS_CZY_DATA')) { ?>
                <?php echo sprintf(TEXT_NEWSDESK_DATE, tep_date_long($product_info_values['newsdesk_date_added']));; ?>
			 <?php } ?>
            </td>
           </tr>
          </table>
          <!-- News Tytul i data EOF -->

          <!-- News zawartosc BOF -->
          <table border="0" width="100%" cellspacing="3" cellpadding="3">
           <tr>
            <td width="100%" class="main" valign="top">
			 <?php if (NEWS_CZY_WSTEP != '0' || !defined('NEWS_CZY_WSTEP')) { ?>
			   	<?php if (NEWS_CZY_WSTEP_NAGL != '0' || !defined('NEWS_CZY_WSTEP_NAGL')) { ?>
	             <table border="0" width="100%" cellspacing="0" cellpadding="0">
	              <tr>
	               <td class="main"><?php echo TEXT_NEWSDESK_SUMMARY; ?></td>
	              </tr>
	              <tr>
	               <td class="footer"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
	              </tr>
	             </table>
				 <?php } ?>
             <?php echo stripslashes($product_info_values['newsdesk_article_shorttext']); ?>
             <br><br>
			 <?php } ?>


			 <?php if (NEWS_CZY_TRESC != '0' || !defined('NEWS_CZY_TRESC')) { ?>
			    <?php if (NEWS_CZY_TRESC_NAGL != '0' || !defined('NEWS_CZY_TRESC_NAGL')) { ?>
	             <table border="0" width="100%" cellspacing="0" cellpadding="0">
	              <tr>
	               <td class="main"><?php echo TEXT_NEWSDESK_CONTENT; ?></td>
	              </tr>
	              <tr>
	               <td class="footer"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
	              </tr>
	             </table>
				<?php }
			 echo stripslashes($product_info_values['newsdesk_article_description']);
			 }

			 if (NEWS_CZY_LINK != '0' || !defined('NEWS_CZY_LINK')) {

			 if ($product_info_values['newsdesk_article_url']) {
			 ?>
			 <?php if (NEWS_CZY_TRESC != '0' || !defined('NEWS_CZY_TRESC')) { ?>
				<br><br>
			 <?php } ?>

             <table border="0" width="100%" cellspacing="0" cellpadding="0">
			  <?php if (NEWS_CZY_LINK_NAGL != '0' || !defined('NEWS_CZY_LINK_NAGL')) { ?>
              <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>
			  <?php } ?>
              <tr>
               <td class="main">
                <?php $newslink = ($product_info_values['newsdesk_article_url_name']); ?>
                <?php echo sprintf(TEXT_NEWSDESK_LINK . '<a href="%s" target="_blank"><u>' . $newslink . '</u></a>.', tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info_values['newsdesk_article_url']), 'NONSSL', true, false)); ?>
               </td>
              </tr>
             </table>
             <?php
			 } }
		    ?>
            </td>
            <td width="" class="main" valign="top" align="center">
			<?php if (NEWS_CZY_FOTO != '0' || !defined('NEWS_CZY_FOTO')) {
            if (isset($insert_image)) echo $insert_image;
            if (isset($insert_image_two)) echo $insert_image_two;
            if (isset($insert_image_three)) echo $insert_image_three;
            } ?>
            </td>
           </tr>
		   <?php
			 if (NEWS_CZY_STAT != '0' || !defined('NEWS_CZY_STAT')) {

			 $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);
             ?>
			 <tr><td colspan="2">
	             <table border="0" width="100%" cellspacing="0" cellpadding="0">
				  <?php if (NEWS_CZY_STAT_NAGL != '0' || !defined('NEWS_CZY_STAT_NAGL')) { ?>
	              <tr>
	               <td class="main"><?php echo TEXT_NEWSDESK_REVIEWS_HEADING; ?></td>
	              </tr>
				  <?php } ?>
	              <tr>
	               <td class="footer"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
	              </tr>
	              <tr>
	               <td class="main"><?php echo TEXT_NEWSDESK_VIEWED . $product_info_values['newsdesk_article_viewed'] ?></td>
	              </tr>
	              <?php
	              if ( DISPLAY_NEWSDESK_REVIEWS ) {
	              ?>
	              <tr>
	               <td class="main"><?php echo TEXT_NEWSDESK_REVIEWS . ' ' . $reviews_values['count']; ?></td>
	              </tr>
	              <?php
	              }
	              ?>
		           <tr>
		            <td>
		             <?php
		             if ( DISPLAY_NEWSDESK_REVIEWS ) {
		              if ($reviews_values['count'] > 0) {
		               require FILENAME_NEWSDESK_ARTICLE_REQUIRE;
		              }
		             }
		             ?>
		            </td>
		           </tr>				  
	             </table>
			 </td></tr>
			 <?php } ?>		   
          </table>
         <?php
         }
         ?>
         </td>
        </tr>
    </table>
   </td>
  </tr>

 <!-- Przyciski BOF -->
 <tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
 </tr>
 <tr>
  <td>
   <table border="0" width="100%" cellspacing="0" cellpadding="2" class="TableFrame">
       <tr>
        <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
        <td align="left">
         <?php
         if ( DISPLAY_NEWSDESK_REVIEWS ) {
	      echo '<a href="' . tep_href_link(FILENAME_NEWSDESK_REVIEWS_WRITE, $get_params, 'NONSSL') . '">' . tep_image_button('button_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a>';
         }
         ?>
		</td>

		 <?php
         // BOF Wolfen added code for button case
         if ($get_backpath_back = $get_backpath) {
          echo '<td align="right" class="main"><a href="' . tep_href_link(FILENAME_NEWSDESK_INDEX, $get_backpath) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>' . tep_draw_separator('pixel_trans.gif', '10', '1') . '<a href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a></td>';
         } else {
          echo '<td align="right" class="main"><a href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a></td>';
         }
         // EOF Wolfen added code for button case
         ?>
        <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
       </tr>
      </table>
  </td>
 </tr>
 <!-- Przyciski BOF -->

</table>