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

<?php echo tep_draw_form('polecony', tep_href_link(FILENAME_FORM_POLECONY, 'action=send')); ?>

  <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_TITLE));
        new contentBoxHeading($info_box_contents);
        ?>
      </td>
    </tr>
    <tr>
      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
    </tr>
    <!-- Naglowek EOF -->

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

    if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
    ?>
      <tr>
        <td align="center" class="main">
            <table border="0" width="100%" cellspacing="1" cellpadding="2" class="TableFrame">
                <tr><td class="main" align="center"><br><?php echo TEXT_SUCCESS; ?><br>&nbsp;</td></tr>
            </table>
        </td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
      </tr>
      <tr>
        <td>
          <table border="0" width="100%" cellspacing="1" cellpadding="2" class="TableFrame">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
          </table>
        </td>
      </tr>
      <?php
    } else {
      if ($order_error == false) {
        ?>
        <tr>
          <td>
                 <fieldset>
                 <legend><?php echo HEADING_TITLE; ?></legend>
	               <table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="main"><?php echo ENTRY_NAME; ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo tep_draw_input_field('name', $from_name); ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo ENTRY_EMAIL; ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo tep_draw_input_field('fromemail', $from_email_address); ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo TO_EMAIL; ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo tep_draw_input_field('toemail', ( isset($to_email_address) ? $to_email_address : '' )); ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo ENTRY_ENQUIRY; ?></td>
                  </tr>
                  <tr>
                    <td><?php echo tep_draw_textarea_field('enquiry', 'soft', 80, 8, ( isset($_POST['enquiry']) ? tep_sanitize_string($_POST['enquiry']) : '' ), '', false); ?></td>
                  </tr>
                    </table>
             </fieldset>
            </td>
        </tr>
        <?php
        // BOF Anti Robot Registration v2.5
        if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'polecony_form') &&  POLECONY_VALIDATION == 'true') {
        ?>
				<tr>
					<td>
						 <fieldset>
						 <legend><?php echo CATEGORY_ANTIROBOTREG; ?></legend>
	             <table border="0" cellspacing="0" cellpadding="0" width="100%">
								<?php
                if ( strstr($PHP_SELF,'polecony_form') ) {
									$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">
																	<?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 ( isset($entry_antirobotreg_error) && $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', '') . '</td>';
                                  }
                                  ?>
                                </td>
                              </tr>
                            </table>
                          </td>
                        </tr>
                      </table>
                    </td>
                  </tr>
                  <?php
                }
                ?>
               </table>
						 </fieldset>
					</td>
				</tr>
        <?php
        }
        // EOF Anti Robot Registration v2.5
        ?>
        <!-- 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 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>
        <?php
      } else {
        ?>
        <!-- Przyciski BOF -->
        <tr>
          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
        </tr>
        <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 width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                    <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
                    <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                  </tr>
                </table>
	             </td>
              </tr>
            </table>
          </td>
        </tr>
        <?php
      }
    }
    ?>
  </table>
</form>