<?php
/*
 osCommerce, Open Source E-Commerce Solutions 
http://www.oscommerce.com 

Copyright (c) 2003 osCommerce 

 

    osConcert Seat Booking Software
    https://www.osconcert.com
    Copyright (c) 2024 osConcert

Released under the GNU General Public License 
*/

// Check to ensure this file is included in osConcert!
defined('_FEXEC') or die();

//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//Site thema configuration
  $configuration_query = tep_db_query("select  configuration_value as template_selected from " . TABLE_CONFIGURATION . " where configuration_id = '10'");
  $configuration = tep_db_fetch_array($configuration_query);

	if (tep_not_null($configuration['template_selected'])) 
	{
	define('TEMPLATE_NAME', $configuration['template_selected']);
	define('TEMPLATE_STYLE', DIR_WS_TEMPLATES . TEMPLATE_NAME . "/css/engine.css");
	}else{
	define('TEMPLATE_NAME', DEFAULT_TEMPLATE);
	define(TEMPLATE_STYLE, DIR_WS_TEMPLATES . DEFAULT_TEMPLATE . "/css/engine.css");
	}
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if ( file_exists(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/extra_html_output.php')) {
  require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/extra_html_output.php');
}
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

  $template_query = tep_db_query("select * from " . TABLE_TEMPLATE . " where template_name = '" . tep_db_input(TEMPLATE_NAME) . "'");
  $template = tep_db_fetch_array($template_query);

	define('TEMPLATE_ID', $template['template_id']);
	define('TEMPLATE_COLOR', $template['template_color']);
	define('TEMPLATE_HERO', $template['template_hero']);
	define('TEMPLATE_FONT', $template['template_font']);
	define('DISPLAY_COLUMN_LEFT', $template['include_column_left']); 
	define('DISPLAY_COLUMN_RIGHT', $template['include_column_right']);
	define('SHOW_FOOTER', $template['show_footer']); 
	define('HEADER_HEIGHT', $template['header_height']); 
	define('BOX_WIDTH_LEFT', $template['howto']); 
	define('HEADER_BANNER', $template['header_banner']);
	define('SHOW_CONTAINER_BORDER', $template['container_border']);
	define('SHOW_LANGUAGES_IN_HEADER', $template['languages_in_header']);
	define('SHOW_THEME_MODE', $template['theme_mode']);
	define('SHOW_CUSTOMER_GREETING', $template['customer_greeting']);
	define('SHOW_BREADCRUMB', $template['show_breadcrumb']);
	define('SHOW_HEADER_PANE', $template['show_header_pane']);
	define('SHOW_TOP_BAR', $template['show_topbar']);
	define('SHOW_LOGIN', $template['show_page_login']);
 
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

//for templatebox
//if ($FREQUEST->getvalue('action')) {
//    switch ($FREQUEST->getvalue('action')) {
//      case 'update_template':
//
//      if ($template >= '1'){
//         $thema_template = tep_db_input($FREQUEST->postvalue('template'));
//           tep_db_query("update " . TABLE_CUSTOMERS . " set customers_selected_template = '$thema_template' where customers_id = '" . tep_db_input($FSESSION->customer_id) . "'");
//          tep_redirect(tep_href_link(basename(FILENAME_DEFAULT)));
//             }
//         break;
//    }
//  }

	if ($FREQUEST->getvalue('action')) 
	{
    switch ($FREQUEST->getvalue('action')) 
	{
      case 'update_template':

      if ($template >= '1')
	  {
         $thema_template = tep_db_input($FREQUEST->postvalue('template'));
           tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '$thema_template' where configuration_id = '10'");
          tep_redirect(tep_href_link(basename(FILENAME_DEFAULT)));
             }
         break;
    }
  }
?>