jsStart();
$this->jsEnd();
}
function run() {
$this->_default();
}
function _default() {
$sRoute = $_GET['route'];
$rgRoute = explode('/', $sRoute);
if (count($rgRoute)<1||!$rgRoute[0]) {
$rgRoute = array($this->sDefPage);
}
CHtml::$rgRoute = $rgRoute;
switch ($rgRoute[0]) {
case "action": $this->_action($rgRoute); break;
default: $this->_page($rgRoute); break;
}
}
function _page($rgRoute) {
$oPage = new CModelPage();
$oPageInfo = $oPage->get_item($rgRoute[0]);
if ($oPageInfo) {
CHtml::html_init_ohtml($oPageInfo, $rgRoute, $this, $this->sDefPage);
CHtml::shortcuts_parse_body();
switch ($rgRoute[0]) {
case "home.html": {
$this->_page_home();
} break;
}
$this->header();
$this->js_css();
echo '
'.CHtml::$oHtml['sText'].'
';
$this->footer();
} else {
header("Location: ".WWW_PATH.$this->sDefPage);
exit;
}
}
function _page_home() {
}
function die403() {
header('HTTP/1.1 403 Forbidden');
exit;
}
function _action($rgRoute) {
$rgAllowed = array(
'connect_connect', 'lang_sel'
);
if (!in_array($rgRoute[1], $rgAllowed)) {
$this->die403();
}
if (in_array($rgRoute[1], $rgAllowed)) {
$sMethod = '_action_'.$rgRoute[1];
$this->$sMethod($rgRoute);
}
}
function _action_connect_connect() {
return;
$sName = $this->prep_str($_POST['sConnectName']);
$sPhone = $this->prep_str($_POST['sConnectPhone']);
$sAddr = $this->prep_str($_POST['sConnectAddr']);
$sTariff = $this->prep_str($_POST['sTariff']);
$to = CONNECT_EMAIL;
$subject = 'Заявка на подключение';
$message = "Имя: ".$sName."\n"."Телефон: ".$sPhone."\n"."Адрес: ".$sAddr."\nТарифный пакет: ".$sTariff;
$headers = 'From: zpmaxx@gmail.com' . "\r\n" .
'Reply-To: zpmaxx@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$sError2 = null;
$fRes = mail($to, $subject, $message, $headers);
//var_dump($fRes);
if (!$fRes) {
$sError2 = 'Произошла ошибка при отправке запроса на подключение. Сожалеем об этом.';
}
$this->answer($_POST, array('sError2'=>$sError2));
}
function _action_lang_sel() {
$rgAllowed = array('ua', 'ru');
$sLang = $this->prep_str($_POST['sLang']);
if (!in_array($sLang, $rgAllowed)) {
return;
}
$_SESSION['sLang'] = $sLang;
$this->answer($_POST, $_POST);
}
/*function _action_login() {
$sUserName = $this->prep_str($_POST['sUserName']);
$sPassword = $this->prep_str($_POST['sPassword']);
$oModU = new CModelUser();
$oCurUser = $oModU->check($sUserName, $sPassword);
$fOk = null;
$sError = null;
if ($oCurUser&&$oCurUser['nId']) {
$fOk = 1;
$_SESSION['__sUserName'] = $sUserName;
$_SESSION['__sPassword'] = $sPassword;
} else {
$sError = MSG_LOGIN_MISMATCH;
}
$this->answer($_POST, array('fOk'=>$fOk, 'sError'=>$sError));
}*/
}
$oPage = new CPage();
$nTime1 = microtime(true);
ob_start();
$oPage->run();
ob_end_flush();
$nTime2 = microtime(true);
?>