//echo "test";exit;
if ($_SERVER['REMOTE_ADDR'] != '195.239.40.130')
{
//die("Извините, проводятся временные технические работы, займут приблизительно 1 час");
}
$DOCUMENT_ROOT=$_SERVER["DOCUMENT_ROOT"];
//session_start();
function remove_lang($str,$lang)
{
$arr= explode ( "<".$lang.">",$str );
$out="";
$curr_closed=0;
while (list ($key, $val) = @each ($arr)) {
$carr=explode ( "".$lang.">",$val );
while (list ($key1, $val1) = @each ($carr)) {
$curr_closed+=($key1) ? 1:0;
if ($curr_closed>=$key):
$out.=$val1;
endif;
}
}
return $out;
}
function prr($a){print"
".print_r($a,1)."";die;}
// error_reporting(255);
include_once "com.php";
unset($UserID);unset($UserInfo);
ob_start();
session_start();
//include_once "com.php";
if ($logout):
session_register("UserID","UserInfo");
$UserID=0;
$UserInfo=array();
session_write_close();
header("Location: ".$PHP_SELF);
exit;
endif;
define("LANG",'RUS');
//clear_cache();
//if(strstr($_SERVER["REQUEST_URI"],'/partners_page/')){ include "part_auth.php"; }
list($path,)=explode("?",$REQUEST_URI,2);
$path=preg_replace("'index\.html$'","",$path);
if (!(in_array($path,array("/refstat.html","/letter.html","/enter.html","/invitation/form.html","/","", "/about/", "/bon_sys/","/news/","/events/zef/","/lib/", "/invitation/conditions/","/subscribe/","/BrandBook/","/rassilka-mnogocard/" ) ) || strstr($path,"partners_page") || strstr($path,"/BrandBook/") )):
exit(header("Location: /invitation/form.html"));
endif;
/*
>> https://www.welcome.mnogo.ru/letter.html
>> https://www.welcome.mnogo.ru/enter.html
>> https://www.welcome.mnogo.ru/invitation/form.html
>> https://www.welcome.mnogo.ru/index.html
>> https://www.welcome.mnogo.ru/about/
>> https://www.welcome.mnogo.ru/bon_sys/
>> https://www.welcome.mnogo.ru/news/
>> https://www.welcome.mnogo.ru/events/zef/?r__d=1
>> https://www.welcome.mnogo.ru/lib/
>> https://www.welcome.mnogo.ru/invitation/conditions/
>> https://www.welcome.mnogo.ru/subscribe/
*/
$sql="select * from ".$TAB_PR."urls where path='".addslashes($path)."' and rname_preg='' and status>3";
//error_log($sql);
$res=@club_db_query($DB,$sql);
$CatInfo=@mysql_fetch_assoc($res);
@mysql_free_result($res);
if (!$CatInfo):
@preg_match("'^/([^/]*)(.*)$'",$path,$regs);
$sql="select * from ".$TAB_PR."urls where path like '/".addslashes($regs[1])."/%' and rname_preg>'' and status>3";
$res=@club_db_query($DB,$sql);
while ($row=@mysql_fetch_assoc($res)):
if (@preg_match("'^".$row["path"].$row["rname_preg"]."'",$path,$path_regs)):
$CatInfo=$row;
break;
endif;
endwhile;
@mysql_free_result($res);
endif;
if(!$CatInfo):
@preg_match("'/([^/]*)/([^/]*)$'",$path,$regs);
$_fname=$regs[2];
$sql="select * from ".$TAB_PR."urls where path like '%/".addslashes($regs[1])."/%' and rname_preg='' and status>3";
$res=@club_db_query($DB,$sql);
$row=@mysql_fetch_assoc($res);
@mysql_free_result($res);
if ($row && $row["path"]!=$path && !$r__d):
header("Location: https://".$_SERVER["HTTP_HOST"].$row["path"].$_fname.( strstr($_fname,"?")? '&':'?')."r__d=1");
exit;
endif;
endif;
if(!$CatInfo):
$CatInfo=GetInfo(53,"".$TAB_PR."urls");
endif;
if ($al=$CatInfo["redirect"]):
Header("Location: $al");
exit;
endif;
$templates_arr=@GetInfo($CatInfo["prog_template_id"],$GLOBALS["TAB_PR"]."prog_templates");
$sub_templates=@unserialize($templates_arr["sub_templates"]);
$template=$templates_arr["html_txt"];
$templ=(trim($CatInfo["php_template"])) ? trim($CatInfo["php_template"]) : trim($templates_arr["filename"]);
$templ=($templ) ? $templ : "default.php";
$CatVars=@unserialize($CatInfo["properties"]);
if ($QUERY_STRING == "adm"):
$adm=1;
else:
$adm=0;
endif;
$main_["listpage"]='';
include_once $_SERVER["DOCUMENT_ROOT"]."/templates/$templ";
//определяем какой тут темплэйт
if (!$glob_templ_id):
$glob_templ_id=($print) ? 6:1;
$glob_templ_id=($sendbymail)? 13:$glob_templ_id;
endif;
$glob_template=GetInfo($glob_templ_id,"".$TAB_PR."prog_templates");
$glob_subs=@unserialize($glob_template["sub_templates"]);
//prr($glob_template["html_txt"]);
$template=str_replace("<%center_text%>",$main_["center_text"],$glob_template["html_txt"]);
$i=0;
while (list ($key, $class_fname) = @each ($page_objects)) {
if ($main_[$key]): continue;endif;
if (@preg_match_all("/<%".$key."(__(.*?)|)%>/s",$template,$matches,PREG_PATTERN_ORDER)):
//создаем объекты
//echo "".nl2br(HtmlSpecialChars($matches[2][1]))."
";
if ($class_fname):
@include_once($DOCUMENT_ROOT.$class_fname);
endif;
$i=0;
foreach($matches[1] as $key1 => $_addit_){
//echo "".nl2br(HtmlSpecialChars($_addit_))."
";
$obj_name=$key.($i++);
/*if (DEBUG):
$my_prof->startTimer( $key,"Creating object");
endif;*/
$$obj_name=new $key();
$$obj_name->parametres=$matches[2][$key1];
$main_[$key.$_addit_]=$$obj_name->out();
/*if (DEBUG):
$my_prof->stopTimer( $key);
endif;*/
}
endif;
}
$main_["vert_a"]=0;
$CatParent=GetInfo($CatInfo["id"],"".$TAB_PR."urls");
if($CatInfo["is_file"]=='Y'){ $main_["vert_a"]=1; $main_["vert_ref"]=$CatParent["path"];}
if($CatVars["vert_title"]) {$main_["vert_title"]=$CatVars["vert_title"]; $main_["no_vert_title"]=0; }
elseif($CatInfo["parent"]!=1){ //$CatVars["vert_title"];
if($CatParentVars["vert_title"]){$CatParentVars=@unserialize($CatParent["properties"]);
$main_["vert_title"]=$CatParentVars["vert_title"];
$main_["no_vert_title"]=0;
}
}
if($CatInfo["parent"]==108||
$CatInfo["id"]==108)
$main_["submenu_right"]=1; else $main_["submenu_right"]=0;
//prr($template);
$template= parse_tmpl($template,$main_);
$template= parse_tmpl($template,$CatVars);
$template= parse_tmpl($template,$main_,1);
//$template= parse_tmpl($template,array('captcha'=>"TEST"));
// echo nl2br(htmlspecialchars($template));
if (LANG=="ENG"):
$template=remove_lang($template,"RUS");
else:
$template=remove_lang($template,"ENG");
endif;
$template=preg_replace("'{0,1}(RUS|ENG)>'s","",$template);
header("HTTP/1.1 200 OK");
echo $template;
ob_end_flush();
?>