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

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

	<?php
//	$modules_query = tep_db_query("select configuration_id, configuration_description, configuration_title, configuration_value, location, max_display, info_id, header from " . TABLE_MODULES_CONFIGURATION . "  order by location ");
	$modules_query = tep_db_query("select configuration_id, configuration_description, configuration_title, configuration_value, location, max_display, info_id, header  from " . TABLE_MODULES_CONFIGURATION . " WHERE configuration_value = 'yes'");

	while ($modul = tep_db_fetch_array($modules_query)) {
		if ($modul['configuration_value'] == 'yes') {

			if ($modul['configuration_title'] != 'info_pages') {

				$plik = $modules_folder . $modul['configuration_title']. '.php';
				if (file_exists($plik)) {
					if (strpos($modul['configuration_title'],'special')) {
						if (SPECIAL_PRICES_HIDE=='false') {
						    $ilosc_maksymalna = (int)$modul['max_display'];
							?>
							<tr>
								<td align="center"><?php include($modules_folder . $modul['configuration_title']. '.php'); ?></td>
							</tr>
						<?php }
						} else {
							$ilosc_maksymalna = (int)$modul['max_display'];
							?>
							<tr>
								<td align="center"><?php include($modules_folder . $modul['configuration_title']. '.php'); ?></td>
							</tr>
					<?php }
				}
				} else {

					if ($modul['configuration_title'] == 'info_pages') {
						//
						$p_query = tep_db_query("select pages_id,pages_title,pages_html_text from " .TABLE_PAGES_DESCRIPTION . " where pages_id = '".(int)$modul['info_id']."' and language_id = '" .(int)$languages_id . "'");
						$pages = tep_db_fetch_array($p_query);
						//
						if ($modul['header'] == 1) {
						?>
					    <!-- Naglowek BOF -->
					    <tr>
					        <td>
					            <?php $info_box_contents = array();
					            $info_box_contents[] = array('text' => sprintf($pages['pages_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
						} ?>
						<tr><td style="padding-bottom:5px">
						<?php
						if ($modul['header'] == 1) {
						?>
					    <table width="100%" cellspacing="0" cellpadding="0" class="TableFrame"><tr><td>
							<table border="0" width="100%" cellspacing="0" cellpadding="4">
								<tr>
									<td class="main">
									<?php } ?>
									
									<?php
									$page_tresc = $pages['pages_html_text'];
									if (strpos($page_tresc,'<***>') > 0) {
										$pagetext = substr($page_tresc,0,strpos($page_tresc,'<***>'));
										$pagetext_more = substr($page_tresc,strpos($page_tresc,'<***>')+5,strlen($page_tresc));
									  } else {
										$pagetext = $page_tresc;
										$pagetext_more = '';
									}			
									?>
									<?php 
									echo $pagetext; 
									if (tep_not_null($pagetext_more)) {
										echo '<br><a class="smallText" href="' . tep_href_link(FILENAME_PAGES, 'pages_id=' . $pages['pages_id']) . '">&nbsp;['.TEXT_NEWSDESK_READMORE.']</a>';
									}
									?>
									<?php
									if ($modul['header'] == 1) {
									?>
									</td>
								</tr>
							</table>
					    </td></tr></table>
						<?php } ?>
						</td></tr>
				<?php } ?>
			<?php }
		}
	}
	?>
</table>