diff --git a/app/Controllers/ArticleController.php b/app/Controllers/ArticleController.php index 6b1fea4..93e7835 100644 --- a/app/Controllers/ArticleController.php +++ b/app/Controllers/ArticleController.php @@ -4,18 +4,19 @@ namespace App\Controllers; use Hleb\Scheme\App\Controllers\MainController; use Hleb\Constructor\Handlers\Request; -use Data, Content; +use Content, Translate; class ArticleController extends MainController { public function index($slug) { - if (!in_array($lang = Request::get('lang'), Data::LANG)) { + if (!in_array($lang = Request::get('lang'), config('general.lang'))) { redirect('/'); } - Data::lang($lang); - + $lang = $lang ?? config('general.default_lang'); + Translate::setLang($lang); + if (!$file = 'files/' . $lang . '/' . $slug . '.md') { return false; } diff --git a/app/Exception/ConfigException.php b/app/Exception/ConfigException.php new file mode 100644 index 0000000..7a36580 --- /dev/null +++ b/app/Exception/ConfigException.php @@ -0,0 +1,13 @@ +'; - const LOGO_SMALL = 'LibArea'; - - - public static function lang($lang = 'ru') - { - $lang = $lang ?? self::DEFAULT_LANG; - Translate::setLang($lang); - } -} diff --git a/app/helpers.php b/app/helpers.php new file mode 100644 index 0000000..556ab06 --- /dev/null +++ b/app/helpers.php @@ -0,0 +1,37 @@ +
- -
- - + + + + - - - + + + - \ No newline at end of file + diff --git a/resources/views/footer.php b/resources/views/footer.php index 3d456c6..df1facf 100644 --- a/resources/views/footer.php +++ b/resources/views/footer.php @@ -1,5 +1,4 @@ getBottomStyles(); ?> getBottomScripts(); ?> - \ No newline at end of file diff --git a/resources/views/header.php b/resources/views/header.php index 9621850..e034195 100644 --- a/resources/views/header.php +++ b/resources/views/header.php @@ -1,34 +1,29 @@ -addStyles('/assets/css/style.css?1'); -Request::getResources()->addBottomScript('/assets/js/app.js?1'); +addStyles('/assets/css/style.css?1'); +Request::getResources()->addBottomScript('/assets/js/app.js?1'); $bg = $type == 'main' ? 'bg' : 'no'; -$logo = $type == 'main' ? '
' : Data::LOGO_SMALL; +$logo = $type == 'main' ? '
' : config('general.logo_small'); ?> - - - - - - output(); ?> - - <?= $title; ?> | <?= Data::NAME; ?> + + + + + output(); ?> + + <?= $title; ?> | <?= config('general.name'); ?> - -
-
- -
-
\ No newline at end of file +
+
+ +
+
\ No newline at end of file diff --git a/resources/views/index.php b/resources/views/index.php index edeb25e..976c25b 100644 --- a/resources/views/index.php +++ b/resources/views/index.php @@ -1,14 +1,14 @@ $desc, 'title' => $title, 'type' => $type]); ?>
- +
- . -
-
+ . + +
Русский English -
+ - \ No newline at end of file + diff --git a/start.hleb.php b/start.hleb.php index 9cd944e..65c3981 100644 --- a/start.hleb.php +++ b/start.hleb.php @@ -180,5 +180,20 @@ error_reporting(E_ALL); */ define( 'HLEB_PROJECT_VALIDITY_URL', "/^[a-z0-9\_\-\/\.\@]+$/u" ); +/* + |----------------------------------------------------------------------------- + | The path to the configuration files + |----------------------------------------------------------------------------- + | + | Database configuration files and general site settings + | + |----------------------------------------------------------------------------- + | Путь к файлам конфигурации + |----------------------------------------------------------------------------- + | + | Файлы конфигурации базы данных и общие настройки сайта + | + */ +define('HLEB_SEARCH_DBASE_CONFIG_FILE', realpath(HLEB_GLOBAL_DIRECTORY . '/config'));