// PHP permanent URL redirection
header("Location: http://www.bcgnijmegen.nl", true, 301);
exit();
session_start();
// Set language
if (strstr($_SERVER["HTTP_HOST"], ".nl")) {
$_SESSION['language'] = "nl";
} elseif (strstr($_SERVER["HTTP_HOST"], ".de")) {
$_SESSION['language'] = "de";
} else {
$_SESSION['language'] = "en";
}
include("system/cms_cnfg.php");
include("login/config_bcgs.php");
@include_once("dBug.php");
include("system/language/dict_$lng.php");
include_once('device_detection_v1.php');
//echo $u_settings['device_type'];
//echo'hallo';
if (($use_db) or (1)) {
// connect with database
$success = mysql_pconnect ($mysqlhost, $mysqluser, $mysqlpass);
if (!$success)
die ("" . $lang['db_connect']. "");
$success = mysql_select_db ($mysqldata);
if (!$success) {
die ("" . $lang['db_choose']. "");
}
}
// filter_input only for php >= 5.2
if (function_exists('filter_input')) {
if (!isset($get)) $get="home";
//echo $get.'';
$get = filter_input(INPUT_GET,"cnt", FILTER_SANITIZE_URL);
} else {
$get = htmlspecialchars($_GET['cnt']);
}
$get = strtr($get,"~!@#$%^&*()","xxxxxxxxxxx");
$get = htmlentities(strip_tags($get));
$get = trim($get, " /\\");
$_PATH = explode("/", $get);
$get = $_PATH[0];
//echo 'get='.$get;
if (strlen($get) <= 1) $get="home";
//echo $get;
//if ($get=="") {$get='\\';}
// get page info
if (($use_db) or (1)) {
//echo '';
$page = mysql_fetch_array(mysql_query("select * from `dbm_content2` where `url` = '$get' AND (`active`='1') AND `stat` = 1 limit 1;"));
//echo '1:'.$page['content'].'';
$dbg_txt='';
//if (!$page) exit;
// get template
//list($template) = mysql_fetch_array(mysql_query("select `template` from `templates` where `id` = '".$page['template_id']."' limit 1"));
$template = str_replace("[[__title__]]", $page['pag_titel'], $template);
$template = str_replace("[[__metads__]]", $page['tags_desc'], $template);
$template = str_replace("[[__metakw__]]", $page['tags_keyw'], $template);
$template = str_replace("[[__menu__]]", $page['menu'], $template);
$template = str_replace("[[__content__]]", $page['cnt'], $template);
$template = str_replace("[[__page_title__]]", $get, $template);
//echo'0';
//$template = str_replace("[[__content__]]", file_get_contents("cnt/".$get."_cnt.txt"), $template);
} elseif (file_exists("pages.csv")) {
$pages = array();
$fp = fopen('pages.csv', "r");
while (($data = fgetcsv($fp, 1000, ";")) !== FALSE) {
$pages[$data[1]] = array();
$pages[$data[1]]['template_id'] = $data[2];
$pages[$data[1]]['title'] = $data[3];
$pages[$data[1]]['meta_keywords'] = $data[4];
$pages[$data[1]]['meta_description'] = $data[5];
$pages[$data[1]]['meta_robots'] = $data[6];
$pages[$data[1]]['meta_organisation'] = $data[7];
$pages[$data[1]]['meta_author'] = $data[8];
$pages[$data[1]]['meta_publisher'] = $data[9];
$pages[$data[1]]['meta_copyright'] = $data[10];
$pages[$data[1]]['meta_language'] = $data[11];
$pages[$data[1]]['stat'] = $data[12];
}
fclose($fp);
if (!$pages[$get]['stat']) exit;
$template_id = $pages[$get]['template_id'];
if (!$template_id) exit;
}
$template_id=2;
// || $u_settings['device_type'] == "Androidtablet" || $u_settings['device_type'] == "Ipad"
if ($u_settings['device_type'] == "mobile" || $u_settings['device_type'] == "Generic" || $u_settings['device_type'] == "Windowsphone" || $u_settings['device_type'] == "Android" || $u_settings['device_type'] == "Blackberrytablet" || $u_settings['device_type'] == "Palm" || $u_settings['device_type'] == "Blackberry" || $u_settings['device_type'] == "Iphone" )
{
//$template_id='m';
}
{
//echo '1';
$template = @file_get_contents("templates/$template_id.htm");
//if (!$template) exit;
/*
$template = str_replace("[[__title__]]", $pages[$get]['title'], $template);
$template = str_replace("[[__metads__]]", $pages[$get]['meta_description'], $template);
$template = str_replace("[[__metakw__]]", $pages[$get]['meta_keywords'], $template);
$template = str_replace("[[__metarb__]]", $pages[$get]['meta_robots'], $template);
$template = str_replace("[[__metaor__]]", $pages[$get]['meta_organisation'], $template);
$template = str_replace("[[__metaau__]]", $pages[$get]['meta_author'], $template);
$template = str_replace("[[__metapb__]]", $pages[$get]['meta_publisher'], $template);
$template = str_replace("[[__metacp__]]", $pages[$get]['meta_copyright'], $template);
$template = str_replace("[[__metalg__]]", $pages[$get]['meta_language'], $template);
*/
$template = str_replace("[[__title__]]", $page['pag_titel'], $template);
$template = str_replace("[[__metads__]]", $page['tags_desc'], $template);
$template = str_replace("[[__metakw__]]", $page['tags_keyw'], $template);
$template = str_replace("[[__content__]]", stripslashes($page['cnt']), $template);
//$template = str_replace("[[__content__]]", file_get_contents("cnt/".$get."_cnt.txt"), $template);
// youtube
$youtube_tag1 = "[[__youtube:watch?v=";
$youtube_nr_start = strpos($template, $youtube_tag1);
if ($youtube_nr_start > 0) {
$youtube_nr_einde = strpos($template, "__]]", $youtube_nr_start);
$youtube_nr_lengte = $youtube_nr_einde - $youtube_nr_start - 20;
$youtube_text = substr($template, ($youtube_nr_start + 20), $youtube_nr_lengte);
// size and autoplay
$width = 290;
$height = 220;
$youtube_text_ar = explode('&size=', $youtube_text);
$youtube_nummer = $youtube_text_ar[0];
if (strstr($youtube_text_ar[1], '&autoplay=1')) {
$youtube_text_ar[1] = str_replace('&autoplay=1', '', $youtube_text_ar[1]);
$autoplay = '&autoplay=1';
} else {
$autoplay = '';
}
if ($youtube_text_ar[1]) {
$sizes = explode('x', $youtube_text_ar[1]);
$width = (int) $sizes[0];
$height = (int) $sizes[1];
}
$youtube = '';
$template = str_replace($youtube_tag1 . $youtube_text . "__]]", $youtube, $template);
}
// mail
if ($_SESSION['language'] == "en") {
$mail = "info@xxxer.co.uk";
} elseif ($_SESSION['language'] == "de") {
$mail = "info@xxxwer.de";
} else {
$mail = "info@xxxer.nl";
}
$template = str_replace("[[__mail__]]", $mail, $template);
require_once("login/config.php");
if (isset($_POST['submit_newsbrief'])) {
// add address to news_subscr table
if (strlen($_POST['email']) > 2) {
$email = htmlspecialchars(trim($_POST['email']));
$email_exist = mysql_num_rows(mysql_query("select * from `dbm_news_subscr` where `email` = '$email' limit 1"));
if (!$email_exist) {
$sql = "insert into `dbm_news_subscr` (`email`, `stat`, `datac`, `datnd`) values ('$email', '1', now(), now())";
mysql_query($sql);
header("Location: http://".$_SERVER['HTTP_HOST']. '/subscribe');
exit;
}
}
}
// get user config
$user_config = array();
$sql = "select name, value from `dbm_user_config` where `category` like '%|public|%' and `stat` = '1'";
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res)) {
$user_config[$row['name']] = $row['value'];
}
$template = str_replace("[[__bottext__]]", $user_config['www_tmpl_bottext'], $template);
// news right block
$template = str_replace("[[__news__]]", get_include_contents("get_news.php"), $template);
// news right block 2
$template = str_replace("[[__news2__]]", get_include_contents("get_news2.php"), $template);
// newslist
$template = str_replace("[[__newslist__]]", get_include_contents("get_news1.php"), $template);
$template = str_replace("[[__newsbanner__]]", get_include_contents("get_shortnews.php"), $template);
// leden
$template = str_replace("[[__leden__]]", get_include_contents("get_leden1_jmkb.php"), $template);
// contacts
$template = str_replace("[[__contactform__]]",get_include_contents("get_contactform.php"), $template);
$template = str_replace("[[__get_side_form__]]",get_include_contents("get_side_form.php"), $template);
// sitemap
$template = str_replace("[[__sitemap__]]",get_include_contents("get_sitemap.php"), $template);
// header photo
$template = str_replace("[[__header_photo__]]",get_include_contents("slideshow.php"), $template);
$template = str_replace("[[__header_photo_main__]]",get_include_contents("slideshow_main.php"), $template);
$template = str_replace("[[__page_title__]]", ucfirst($get), $template);
// menu
include_once("get_menu.php");
include_once("get_menu5.php");
$template = str_replace("[[__top_menu__]]", $top_menu_text, $template);
if (isset($sub_menu_text)) {
$template = str_replace("[[__sub_menu__]]", $sub_menu_text, $template);
} else {
$template = str_replace("[[__sub_menu__]]", '', $template);
}
$template = str_replace("[[__bot1_menu__]]", $bot1_menu_text, $template);
$template = str_replace("[[__bot2_menu__]]", $bot2_menu_text, $template);
$template = str_replace("[[__www_tmpl_bothead1__]]", $user_config['www_tmpl_bothead1'], $template);
$template = str_replace("[[__www_tmpl_bothead2__]]", $user_config['www_tmpl_bothead2'], $template);
$template = str_replace("[[__mobile_top_menu__]]", $mobile_top_menu_text, $template);
$template = str_replace("[[__punchline__]]", $user_config['www_tmpl_punchline'], $template);
//=BEPAAL-IPAG-KEYS=================================================
$filetxt=$template;
$links=array();
$klaar=0;
$teller=40;
//while (((strlen($filetxt)>0)||(!$klaar))&&$teller)
while ((!$klaar)&&$teller)
{
$occur1=strpos($filetxt,"[[__",$offset); // echo '
1:'.$occur1;
$occur2=strpos($filetxt,"__]]",$occur1); // echo '
2:'.$occur2;
if (is_numeric($occur1)&&is_numeric($occur2)&&($occur1>0)&&($occur2>1)&&($occur1<$occur2))
{
$links[]=substr($filetxt,$occur1,$occur2-$occur1+4);
//$filetxt=substr($filetxt,$occur2);
$offset=$occur2;
}
else
{
$klaar=1;
}
$teller--;
}
//==================================================================
// ====== WIS overige keys ===========
foreach($links as $key => $data)
{
$template=str_replace($data,$empty_mark,$template);
}
// ===================================
}
echo $template;
//echo $dbg_txt;
function get_include_contents($filename) {
global $get, $a_metatags, $_PATH;
if (is_file($filename)) {
ob_start();
include $filename;
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
return false;
}
?>