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

<?php echo tep_draw_form('product_reviews_write', tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'action=process&products_id=' . $HTTP_GET_VARS['products_id']), 'post', ''); ?>

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

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

 <tr>
	<td>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	      </tr>

		  <?php
	      if ($messageStack->size('review') > 0) {
	      ?>
	      <tr>
				<td><?php echo $messageStack->output('review'); ?></td>
	      </tr>
	      <tr>
	        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	      </tr>
	      <?php
	      }
	      ?>

			<tr>
				<td>
				   <table border="0"  width="100%" cellspacing="1" cellpadding="2" class="infoBox">
				    <tr class="infoBoxContents">
				     <td>
				      <table border="0" width="100%" cellspacing="0" cellpadding="2">
						<tr>
							<td align="left" valign="top">
								<table border="0" width="100%" cellspacing="0" cellpadding="2">
									<tr>
										<td align="left" valign="top">
											<?php echo $products_name; ?>
										</td>
									</tr>
							        <tr>
							            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
							        </tr>
									<tr>
										<td valign="top">
											<table border="0" width="100%" cellspacing="0" cellpadding="2">
												<tr>
													<td class="main"><?php echo '<b>' . SUB_TITLE_FROM . '</b> ' . tep_output_string_protected($customer['customers_firstname'] . ' ' . $customer['customers_lastname']); ?></td>
												</tr>
												<tr>
													<td class="main"><b><?php echo SUB_TITLE_REVIEW; ?></b></td>
												</tr>
												<tr>
													<td class="main"><?php echo tep_draw_textarea_field('review', 'soft', 48, 8); ?></td>
												</tr>
												<tr>
													<td class="smallText" align="left"><?php echo TEXT_NO_HTML; ?></td>
												</tr>
												<tr>
													<td class="main"><?php echo '<b>' . SUB_TITLE_RATING . '</b> ' . TEXT_BAD . ' ' . tep_draw_radio_field('rating', '1') . ' ' . tep_draw_radio_field('rating', '2') . ' ' . tep_draw_radio_field('rating', '3') . ' ' . tep_draw_radio_field('rating', '4') . ' ' . tep_draw_radio_field('rating', '5') . ' ' . TEXT_GOOD; ?></td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
							<td align="right" valign="top">
								<table border="0" cellspacing="0" cellpadding="10">
									<tr>
										<td align="right" valign="top" class="smallText">
											<?php
											if (tep_not_null($product_info['products_image'])) {
                                                echo tep_image(DIR_WS_IMAGES . $product_info['products_image'],'', SMALL_IMAGE_WIDTH*1.5, SMALL_IMAGE_HEIGHT*1.5,'','','','','',true);
											}
											?>
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<!-- // Points/Rewards Module V2.1rc2a bof //-->
						<?php
						   if ((USE_POINTS_SYSTEM == 'true') && (tep_not_null(USE_POINTS_FOR_REVIEWS))) {
						?>
						<tr>
						  <td class="main" colspan="2">
							<table border="0"  width="100%" cellspacing="1" cellpadding="2">
							  <tr>
								<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
							  </tr>
							  <tr>
								<td align="center" class="smallText" style="font-weight:bold"><?php echo sprintf(REVIEW_HELP_LINK, $currencies->format(tep_calc_shopping_pvalue(USE_POINTS_FOR_REVIEWS)), '<a class="boxLink" style="font-weight:bold" href="' . tep_href_link(FILENAME_MY_POINTS_HELP,'faq_item=13', 'NONSSL') . '" title="' . BOX_INFORMATION_MY_POINTS_HELP . '">' . BOX_INFORMATION_MY_POINTS_HELP . '</a>'); ?></td>
							  </tr>
							  <tr>
								<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
							  </tr>
							</table>
                          </td>
						</tr>
						<?php
						  }
						?>
						<!-- // Points/Rewards Module V2.1rc2a eof //-->
					  </table>
					 </td>
					</tr>
				   </table>
				</td>
			</tr>
		</table>
  </td>
 </tr>


 <!-- // BOF Anti Robot Registration v2.2-->
 <?php
 if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'product_reviews_write') &&  ACCOUNT_REVIEWS_VALIDATION == 'true') {
 ?>
 <tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
 </tr>
 <tr>
  <td>
		<fieldset>
		<legend><?php echo CATEGORY_ANTIROBOTREG; ?></legend>
			<table align="left" border="0" cellspacing="2" cellpadding="2" width="100%">
				<?php
				if ( strstr($PHP_SELF,'product_reviews_write') ) {
					$sql = "DELETE FROM " . TABLE_ANTI_ROBOT_REGISTRATION . " WHERE timestamp < '" . (time() - 3600) . "' OR session_id = '" . tep_session_id() . "'";
					if( !$result = tep_db_query($sql) ) { die('Could not delete validation key'); }
					$reg_key = gen_reg_key();
					$sql = "INSERT INTO ". TABLE_ANTI_ROBOT_REGISTRATION . " VALUES ('" . tep_session_id() . "', '" . $reg_key . "', '" . time() . "')";
					if( !$result = tep_db_query($sql) ) { die('Could not check registration information'); }
					?>
				<tr>
				<td class="main">
					<table border="0" width="100%" cellspacing="0" cellpadding="2">
						<tr>
							<td class="main">
								<table border="0" cellspacing="0" cellpadding="2" width="100%">
									<tr>
										<td class="main"><?php echo ENTRY_ANTIROBOTREG; ?></td>
										<td class="main" align="center">
											<table border="0" width="100%" cellspacing="0" cellpadding="2">
												<tr>
												<?php
												$check_anti_robotreg_query = tep_db_query("select session_id, reg_key, timestamp from anti_robotreg where session_id = '" . tep_session_id() . "'");
												$new_guery_anti_robotreg = tep_db_fetch_array($check_anti_robotreg_query);
												$validation_images = '<img src="validation_png.php?rsid=' . $new_guery_anti_robotreg['session_id'] . '">';
												if ($entry_antirobotreg_error == true) {
													?>
													<td>
														<?php
														echo $validation_images . '</td><td valign="middle">';
														echo tep_draw_input_field('antirobotreg') . '</td>';
												} else {
													?>
													<td>
														<?php
														echo $validation_images . '</td><td valign="middle">';
														echo tep_draw_input_field('antirobotreg', $account['entry_antirobotreg']) . '</td>';
												}
												?>
												</tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				  </td>
				</tr>
        <?php
        }
        ?>
		 </fieldset>
      </table>
  </td>
 </tr>
 <?php
 }
 ?>
 <!-- // EOF Anti Robot Registration v2.2-->

 <!-- 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">
       <tr>
        <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
        <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params(array('reviews_id', 'action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
        <td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
        <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
       </tr>
   </table>
  </td>
 </tr>
 <!-- Przyciski EOF -->

</table>