commit 235d6a3a18f9a709ddc9d2558f500e765be8856b Author: Slava Date: Thu Nov 6 19:20:41 2025 +0200 init diff --git a/index.php b/index.php new file mode 100644 index 0000000..3100012 --- /dev/null +++ b/index.php @@ -0,0 +1,210 @@ +saveXML(); } else{ */ + +/** @brief Массив элементов меню страницы */ +$menu = explode(',', $ansv['page']['PageMenu']); + +/** @brief Верхнее меню сайта */ +$config['TopMenu'] = GetXMLMenu($ansv['XML']->index, $REQUEST_URI, $menu[0], 'h'); + +/** @brief Боковое меню сайта */ +$config['sideMenu'] = GetSideXMLMenu($ansv['XML']->index, $REQUEST_URI, $menu[0]); + +/** @brief Основное меню сайта */ +$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 { + error405(true, $config['encoding']); +} + +/* $EditPage['url'] = $path .'content/scan/index.page.php'; $EditPage['page'] = simplexml_load_file($EditPage['url']); */ + +/** @brief Полное название сайта с текущей страницей */ +$config['sitename'] .= ' > ' . $config['title']; + +/** @brief CSS-класс заголовка контента */ +$config['ctitle'] = $xmlstr->content['tclass']; + +/** @brief CSS-класс блока контента */ +$config['cfloat'] = $xmlstr->content['bclass']; + +/** @brief Права доступа текущего пользователя к странице */ +$access = FindPageUser($ansv['page']['users'], $_SESSION['username']); + +if ($access) { + $config['left'] = GetBlock($xmlstr->lblock->block, 'left'); + $config['left'] .= getNews($xmlstr->lblock->block, 'left'); + $config['left'] = "
" . $config['left'] . "
"; + + $config['right'] = GetBlock($xmlstr->rblock->block, 'right'); + $config['right'] .= getNews($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'] = 'Гость'; +} +setcookie('User', $config['User'], time() + 2419200, '/'); + +$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 .= loadPluginsInCenterBlock(); +$html .= includePlugin(['plugin' => 'siteSettings']); +$html .= includePlugin(['plugin' => 'auth']); +/* $html .= includePlugin(['plugin' => 'editor']); */ +/* $html .= includePlugin(['plugin' => 'manager']); */ +/* $html .= includePlugin(['plugin' => 'site_tree']); */ +/* $html .= includePlugin(['plugin' => 'pickr']); */ + +$html .= '
'.getNews($xmlstr->rblock->block, "center").'
'; + +foreach ($config as $key=>$value)if ($key!="request_url") + $html =str_replace('%'.$key.'%', $value, $html); + +header('Content-type: text/html; charset='. $config['encoding']); + +echo $html; + +/* var_dump($REQUEST_URI); echo password_hash("gena", PASSWORD_DEFAULT); //a004b486e740bb4580a04125975893b0 gettype( } */ +?> \ No newline at end of file