saveXML();
//}
//else{
$menu =explode(',',$ansv['page']['PageMenu']);
$config['TopMenu'] =GetXMLMenu($ansv['XML']->index,$REQUEST_URI,$menu[0],'h');
$config['sideMenu'] = GetSideXMLMenu($ansv['XML']->index,$REQUEST_URI,$menu[0]);
$config['SiteMenu'] =GetXMLMenu($ansv['XML']->index,$REQUEST_URI,$menu[1],'h');
// && $config['REQUEST_URI']=='/'
if (empty($config['TopMenu'])) {
if ($_SESSION['Login'] == 'false') {
$_SESSION['formType'] = 'log_err';
} else {
$_SESSION['formType']= 'log_on';
}
}
# Подключение страницы или вывод ошибки
if (is_file($path . $config['page_url'].".page.php")) {
$xmlstr = simplexml_load_file($path . $config['page_url'].".page.php");
} else {
if (!isset($_GET['handleJsonRpcRequestAction'])) {
error405(true, $config['encoding']);
}
}
//$EditPage['url'] =$path .'content/scan/index.page.php';
//$EditPage['page'] =simplexml_load_file($EditPage['url']);
$config['sitename'] .=' > '.$config['title'];
$config['ctitle'] =$xmlstr->content['tclass'];
$config['cfloat'] =$xmlstr->content['bclass'];
$access =FindPageUser($ansv['page']['users'],$_SESSION['username']);
if ($access) {
# Формируем левые блоки
$config['left'] = GetBlock($xmlstr->lblock->block, 'left');
$config['left'] = "
" . $config['left'] . "
";
# Формируем правые блоки
$config['right'] = GetBlock($xmlstr->rblock->block, 'right');
$config['right'] = "" . $config['right'] . "
";
# Формируем центральные блоки
$center = '' . GetBlock($xmlstr->cblock->block, 'center') . '
';
$config['content'] = $xmlstr->content->{$config['lng']};
} else {
if ($_SESSION['log_in']) {
$xmlstr = simplexml_load_file($path . 'content/adm/user.page.php');
} else {
$xmlstr = simplexml_load_file($path . 'content/adm/access.page.php');
}
# Формируем левые блоки
$config['left'] = '';
# Формируем правые блоки
$config['right'] = '';
# Формируем центральные блоки
$center = '
' . GetBlock($xmlstr->cblock->block, 'center') . '
';
$config['content'] = $xmlstr->content->$config['lng'];
}
foreach ($config as $key=>$value)if ($key!="request_url")
$config['content'] =str_replace('%'.$key.'%', $value, $config['content']);
$config['content'] =str_replace('%center%', $center, $config['content']);
$config['home'] ='index.html';
if (isset($_SESSION['username'])) {
$config['User'] = $_SESSION['username'];
}
else{
$config['User'] = 'Гость';
}
#Подключение шаблона, редактора и основных файлов
$html = "";
$html .= '';
$html .= '';
$html .= file_get_contents($path . 'data/top.php');
$html .= file_get_contents($path . 'template/'.$config['template'].'/page.php');
$html .= file_get_contents($path . 'data/foot.php');
$html .= '';
$lang = include $path . 'data/lang.php';
$lng = $_SESSION['lng'] ?? 'en';
$Js = file_get_contents($path . 'data/Basic_functions.js');
foreach ($lang[$lng] as $key => $value) {
$Js = str_replace('{{' . $key . '}}', $value, $Js);
}
$html .= '';
$html .= '';
$html .= includePhp();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$raw = file_get_contents('php://input');
$input = json_decode($raw, true);
if (json_last_error() === JSON_ERROR_NONE && !empty($input['handleJsonRpcRequestAction'])) {
handleJsonRpcRequest($input['handleJsonRpcRequestAction']);
}
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['handleRequestAction']) {
handleRequest($_POST['handleRequestAction']);
}
foreach ($config as $key=>$value)if ($key!="request_url")
$html =str_replace('%'.$key.'%', $value, $html);
# Заголовок кодировки
header('Content-type: text/html; charset='. $config['encoding']);
if ($_POST['handleRequestAction'] && $_POST['handleRequestAction'] != 'API' && $_POST['handleRequestAction'] != 'managerClipboard') {
exit;
}
if (!empty($input['handleJsonRpcRequestAction']) && $input['handleJsonRpcRequestAction'] != 'API' && $input['handleJsonRpcRequestAction'] != 'managerClipboard') {
exit;
}
unset($_SESSION['page_url']);
if ($_POST['handleRequestAction'] == 'API' && !isset($_POST['lng'])) {
exit;
}
if (!empty($input['handleJsonRpcRequestAction']) && $input['handleJsonRpcRequestAction'] == 'API' && (!isset($input['params']['lng']) || $input['params']['lng'] === '')) {
exit;
}
if ($_POST['handleRequestAction'] || !empty($input['handleJsonRpcRequestAction'])) {
if ($_POST['handleRequestAction'] != 'managerClipboard' && $input['handleJsonRpcRequestAction'] != 'managerClipboard') {
echo $html;
}
} else {
echo $html;
}
/* $_SESSION['managerClipboardFile'] = $_SESSION['managerClipboardFile']; */
//var_dump($REQUEST_URI);
//echo password_hash("gena", PASSWORD_DEFAULT); //a004b486e740bb4580a04125975893b0 gettype(
//}s
?>