diff --git a/kernel/AdminController.php b/kernel/AdminController.php index 33918e7..a1e8fcf 100755 --- a/kernel/AdminController.php +++ b/kernel/AdminController.php @@ -5,14 +5,17 @@ namespace kernel; use kernel\Controller; use kernel\helpers\Debug; use kernel\services\AdminThemeService; +use kernel\services\ThemeService; class AdminController extends Controller { protected AdminThemeService $adminThemeService; + protected ThemeService $themeService; protected function init(): void { $this->adminThemeService = new AdminThemeService(); + $this->themeService = new ThemeService(); $active_theme = $this->adminThemeService->getActiveAdminThemeInfo(); $this->cgView->layoutPath = getConst($active_theme['layout_path']); $this->cgView->layout = "/" . $active_theme['layout']; diff --git a/kernel/App.php b/kernel/App.php index f185ce8..7ce9803 100755 --- a/kernel/App.php +++ b/kernel/App.php @@ -7,6 +7,7 @@ namespace kernel; use kernel\helpers\Debug; use kernel\modules\user\models\User; use kernel\services\ModuleService; +use kernel\services\ThemeService; use Phroute\Phroute\Dispatcher; class App @@ -24,6 +25,8 @@ class App public ModuleService $moduleService; + public ThemeService $themeService; + public static Database $db; public function run(): void @@ -53,6 +56,12 @@ class App foreach ($modules_routs as $rout){ include "$rout"; } + + $themeService = new ThemeService(); + $activeTheme = getConst($themeService->getActiveTheme()); + if (!empty($activeTheme)){ + include $activeTheme . "/" . $themeService->getThemeRout($activeTheme); + } } public static function create(): App diff --git a/kernel/Assets.php b/kernel/Assets.php new file mode 100644 index 0000000..30c2c8b --- /dev/null +++ b/kernel/Assets.php @@ -0,0 +1,66 @@ +setResourceURI($resourceURI); + $this->createCSS(); + $this->createJS(); + } + + protected function createCSS(){} + protected function createJS(){} + + public function setResourceURI(string $resourceURI): void + { + $this->resourceURI = $resourceURI; + } + + public function registerJS(string $slug, string $resource, bool $body = true, bool $addResourceURI = true): void + { + $resource = $addResourceURI ? $this->resourceURI . $resource : $resource; + if ($body) { + $this->jsBody[$slug] = $resource; + } else { + $this->jsHeader[$slug] = $resource; + } + } + + public function registerCSS(string $slug, string $resource, bool $addResourceURI = true): void + { + $resource = $addResourceURI ? $this->resourceURI . $resource : $resource; + $this->css[$slug] = $resource; + } + + public function getJSAsStr(bool $body = true): void + { + if ($body) { + foreach ($this->jsBody as $key => $item){ + echo ""; + } + } + else { + foreach ($this->jsHeader as $key => $item){ + echo ""; + } + } + } + + public function getCSSAsSTR(): void + { + foreach ($this->css as $key => $item){ + echo ""; + } + } + +} \ No newline at end of file diff --git a/kernel/CgView.php b/kernel/CgView.php index 5934f82..68237bb 100755 --- a/kernel/CgView.php +++ b/kernel/CgView.php @@ -2,6 +2,8 @@ namespace kernel; +use kernel\helpers\Debug; + class CgView { public string $viewPath = ''; @@ -61,6 +63,13 @@ class CgView private function createContent(string $viewFile, array $data = []): false|string { ob_start(); + + if ($this->varToLayout){ + foreach ($this->varToLayout as $key => $datum) { + ${"$key"} = $datum; + } + } + $view = $this; foreach ($data as $key => $datum) { ${"$key"} = $datum; diff --git a/kernel/RestController.php b/kernel/RestController.php index 2d7596d..99ba279 100755 --- a/kernel/RestController.php +++ b/kernel/RestController.php @@ -17,13 +17,32 @@ class RestController return []; } + protected function filters(): array + { + return []; + } + #[NoReturn] public function actionIndex(): void { $request = new Request(); + $get = $request->get(); $page = $request->get('page') ?? 1; $perPage = $request->get('per_page') ?? 10; $query = $this->model->query(); + if ($this->filters()) { + foreach ($this->filters() as $filter){ + if (key_exists($filter, $get)){ + if (is_numeric($get[$filter])){ + $query->where($filter, $get[$filter]); + } + elseif (is_string($get[$filter])){ + $query->where($filter,'like', '%' . $get[$filter] . '%'); + } + } + } + } + if ($page > 1) { $query->skip(($page - 1) * $perPage)->take($perPage); } else { @@ -31,7 +50,7 @@ class RestController } $expand = $this->expand(); - $expandParams = explode( ",", $request->get('expand') ?? ""); + $expandParams = explode(",", $request->get('expand') ?? ""); $finalExpand = array_intersect($expandParams, $expand); if ($finalExpand) { $res = $query->get()->load($finalExpand)->toArray(); @@ -46,14 +65,14 @@ class RestController { $expand = $this->expand(); $request = new Request(); - $expandParams = explode( ",", $request->get('expand') ?? ""); + $expandParams = explode(",", $request->get('expand') ?? ""); $model = $this->model->where("id", $id)->first(); $finalExpand = array_intersect($expandParams, $expand); - if ($finalExpand){ + if ($finalExpand) { $model->load($finalExpand); } $res = []; - if ($model){ + if ($model) { $res = $model->toArray(); } @@ -64,7 +83,7 @@ class RestController { $model = $this->model->where("id", $id)->first(); $res = []; - if ($model){ + if ($model) { $res = $model->toArray(); } @@ -78,7 +97,7 @@ class RestController { $request = new Request(); $data = $request->post(); - foreach ($this->model->getFillable() as $item){ + foreach ($this->model->getFillable() as $item) { $this->model->{$item} = $data[$item] ?? null; } $this->model->save(); @@ -93,8 +112,8 @@ class RestController $model = $this->model->where('id', $id)->first(); - foreach ($model->getFillable() as $item){ - if (!empty($data[$item])){ + foreach ($model->getFillable() as $item) { + if (!empty($data[$item])) { $model->{$item} = $data[$item] ?? null; } } @@ -117,5 +136,4 @@ class RestController } - } \ No newline at end of file diff --git a/kernel/admin_themes/default/DefaultAdminThemeAssets.php b/kernel/admin_themes/default/DefaultAdminThemeAssets.php new file mode 100644 index 0000000..7c5cf70 --- /dev/null +++ b/kernel/admin_themes/default/DefaultAdminThemeAssets.php @@ -0,0 +1,25 @@ +registerJS(slug: "jquery", resource: "/js/jquery.min.js"); + $this->registerJS(slug: "popper", resource: "/js/popper.js"); + $this->registerJS(slug: "bootstrap", resource: "/js/bootstrap.min.js"); + $this->registerJS(slug: "main", resource: "/js/main.js"); + } + + protected function createCSS() + { + $this->registerCSS(slug: "font-awesome", resource: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css", addResourceURI: false); + $this->registerCSS(slug: "bootstrap", resource: "/css/bootstrap.min.css"); + $this->registerCSS(slug: "style", resource: "/css/style.css"); + } + +} \ No newline at end of file diff --git a/kernel/admin_themes/default/layout/main.php b/kernel/admin_themes/default/layout/main.php index 98be7fb..a015dda 100755 --- a/kernel/admin_themes/default/layout/main.php +++ b/kernel/admin_themes/default/layout/main.php @@ -6,6 +6,7 @@ * @var \kernel\CgView $view */ \Josantonius\Session\Facades\Session::start(); +$assets = new \kernel\admin_themes\default\DefaultAdminThemeAssets($resources) ?> @@ -17,9 +18,8 @@ - - - + getCSSAsSTR(); ?> + getJSAsStr(body: false); ?> @@ -92,9 +92,6 @@ - - - - +getJSAsStr(); ?> \ No newline at end of file diff --git a/kernel/admin_themes/default/manifest.json b/kernel/admin_themes/default/manifest.json index f0f5f94..2da3b4f 100755 --- a/kernel/admin_themes/default/manifest.json +++ b/kernel/admin_themes/default/manifest.json @@ -3,10 +3,11 @@ "version": "0.1", "author": "ItGuild", "slug": "default", + "type": "admin_theme", "description": "Default admin theme", "preview": "preview.png", - "resource": "/resources/default", - "resource_path": "{RESOURCES}/default", + "resource": "/resources/admin_themes/default", + "resource_path": "{RESOURCES}/admin_themes/default", "layout": "main.php", "layout_path": "{KERNEL_ADMIN_THEMES}/default/layout" } diff --git a/kernel/admin_themes/simple/manifest.json b/kernel/admin_themes/simple/manifest.json index 40bc403..410215c 100755 --- a/kernel/admin_themes/simple/manifest.json +++ b/kernel/admin_themes/simple/manifest.json @@ -5,8 +5,8 @@ "slug": "simple", "description": "Simple admin theme", "preview": "preview.png", - "resource": "/resources/simple", - "resource_path": "{RESOURCES}/simple", + "resource": "/resources/admin_themes/simple", + "resource_path": "{RESOURCES}/admin_themes/simple", "layout": "main.php", "layout_path": "{KERNEL_ADMIN_THEMES}/simple/layout" } diff --git a/kernel/console/controllers/AdminConsoleController.php b/kernel/console/controllers/AdminConsoleController.php index 0af6f7b..4791fec 100755 --- a/kernel/console/controllers/AdminConsoleController.php +++ b/kernel/console/controllers/AdminConsoleController.php @@ -63,6 +63,20 @@ class AdminConsoleController extends ConsoleController ); $this->out->r("create option active_admin_theme", "green"); + $this->optionService->createFromParams( + key: "theme_paths", + value: "{\"paths\": [\"{KERNEL}/themes\", \"{APP}/themes\"]}", + label: "Пути к темам сайта" + ); + $this->out->r("create option theme_paths", "green"); + + $this->optionService->createFromParams( + key: "active_theme", + value: "{KERNEL}/themes/default", + label: "Активная тема сайта" + ); + $this->out->r("create option active_theme", "green"); + $this->optionService->createFromParams( key: "module_paths", value: "{\"paths\": [\"{KERNEL_MODULES}\", \"{APP}/modules\"]}", @@ -72,7 +86,7 @@ class AdminConsoleController extends ConsoleController $this->optionService->createFromParams( key: "active_modules", - value: "{\"modules\":[\"admin_themes\", \"secure\", \"user\", \"menu\", \"post\", \"option\"]}", + value: "{\"modules\":[\"admin_themes\",\"themes\",\"secure\", \"user\", \"menu\", \"post\", \"option\"]}", label: "Активные модули" ); $this->out->r("create option active_modules", "green"); @@ -133,6 +147,14 @@ class AdminConsoleController extends ConsoleController ]); $this->out->r("create item menu admin-themes", "green"); + $this->menuService->createItem([ + "label" => "Темы сайта", + "url" => "/admin/settings/themes", + "slug" => "themes", + "parent_slug" => "settings" + ]); + $this->out->r("create item menu themes", "green"); + $this->menuService->createItem([ "label" => "Меню", "url" => "/admin/settings/menu", diff --git a/kernel/console/controllers/ThemeController.php b/kernel/console/controllers/ThemeController.php new file mode 100644 index 0000000..1c3d762 --- /dev/null +++ b/kernel/console/controllers/ThemeController.php @@ -0,0 +1,73 @@ +argv['path'])) { + throw new \Exception('Missing theme path "--path" specified'); + } + + if (file_exists(ROOT_DIR . $this->argv['path'])) { + $themeService = new ThemeService(); + if ($themeService->install($this->argv['path'])) { + $this->out->r("Тема сайта установлена", 'green'); + } else { + $this->out->r("Ошибка установки темы сайта", 'red'); + } + } else { + $this->out->r("Тема сайта не найдена", 'red'); + } + } + + /** + * @throws \Exception + */ + public function actionUninstallTheme(): void + { + if (!isset($this->argv['path'])) { + throw new \Exception('Missing theme path "--path" specified'); + } + + if (file_exists(ROOT_DIR . $this->argv['path'])) { + $themeService = new ThemeService(); + $themeService->uninstall($this->argv['path']); + $this->out->r("Тема сайта удалена", 'green'); + } else { + $this->out->r("Тема сайта не найдена", 'red'); + } + } + + /** + * @throws \Exception + */ + public function actionPackTheme(): void + { + if (!isset($this->argv['path'])) { + throw new \Exception('Missing theme path "--path" specified'); + } + + if (file_exists(ROOT_DIR . $this->argv['path'])) { + $themeService = new ThemeService(); + $themeService->pack($this->argv['path']); + $this->out->r("Тема сайта заархивирована", 'green'); + } else { + $this->out->r("Тема сайта не найдена", 'red'); + } + } + +} \ No newline at end of file diff --git a/kernel/console/routs/cli.php b/kernel/console/routs/cli.php index 4676cc7..68f06c7 100755 --- a/kernel/console/routs/cli.php +++ b/kernel/console/routs/cli.php @@ -41,6 +41,21 @@ App::$collector->group(["prefix" => "admin-theme"], callback: function (RouteCol ); }); +App::$collector->group(["prefix" => "theme"], callback: function (RouteCollector $router){ + App::$collector->console('install', + [\kernel\console\controllers\ThemeController::class, 'actionInstallTheme'], + additionalInfo: ['description' => 'Установить тему сайта', 'params' => ['--path' => 'Путь к устанавливаемой теме']] + ); + App::$collector->console('uninstall', + [\kernel\console\controllers\ThemeController::class, 'actionUninstallTheme'], + additionalInfo: ['description' => 'Удалить тему сайта', 'params' => ['--path' => 'Путь к удаляемой теме']] + ); + App::$collector->console('pack', + [\kernel\console\controllers\ThemeController::class, 'actionPackTheme'], + additionalInfo: ['description' => 'Заархивировать тему сайта', 'params' => ['--path' => 'Путь к теме, которую нужно заархивировать']] + ); +}); + App::$collector->group(["prefix" => "secure"], callback: function (RouteCollector $router){ App::$collector->console('create-secret-key', [\kernel\console\controllers\SecureController::class, 'actionCreateSecretKey'], diff --git a/kernel/helpers/ImageGD.php b/kernel/helpers/ImageGD.php new file mode 100644 index 0000000..3b15b05 --- /dev/null +++ b/kernel/helpers/ImageGD.php @@ -0,0 +1,48 @@ +img = imagecreatefrompng($resource); + } + else { + $this->img = imagecreatetruecolor($width, $height); + } + imagesavealpha($this->img, true); + } + + public function addText(string $font_size, int $degree, int $x, int $y, string $color, string $font, string $text): void + { + $rgbArr = $this->hexToRgb($color); + $color = imagecolorallocate($this->img, $rgbArr[0], $rgbArr[1], $rgbArr[2]); + imagettftext($this->img, $font_size, $degree, $x, $y, $color, $font, $text); + } + + public function addImg(\GdImage $gdImage, int $location_x, int $location_y, int $offset_src_x, int $offset_src_y, int $src_width, int $src_height, int $no_transparent): void + { + imagecopymerge($this->img, $gdImage, $location_x, $location_y, $offset_src_x, $offset_src_y, $src_width, $src_height, $no_transparent); + } + + public function getImg() + { + return $this->img; + } + + public function save(string $path): void + { + imagepng($this->img, $path); + imagedestroy($this->img); + } + + protected function hexToRgb(string $hex) + { + return sscanf($hex, "#%02x%02x%02x"); + } + +} \ No newline at end of file diff --git a/kernel/manifest.json b/kernel/manifest.json index 6521135..c621680 100755 --- a/kernel/manifest.json +++ b/kernel/manifest.json @@ -1,6 +1,6 @@ { "name": "Kernel", - "version": "0.1.1", + "version": "0.1.4", "author": "ITGuild", "slug": "kernel", "type": "kernel", diff --git a/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php b/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php index 13c4e6c..e856224 100755 --- a/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php +++ b/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php @@ -5,6 +5,7 @@ namespace kernel\modules\module_shop_client\controllers; use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; use JetBrains\PhpStorm\NoReturn; +use Josantonius\Session\Facades\Session; use kernel\AdminController; use kernel\Flash; use kernel\helpers\Debug; @@ -16,6 +17,7 @@ use kernel\services\AdminThemeService; use kernel\services\KernelService; use kernel\services\ModuleService; use kernel\services\ModuleShopService; +use kernel\services\ThemeService; use PHPMailer\PHPMailer\Exception; class ModuleShopClientController extends AdminController @@ -59,6 +61,7 @@ class ModuleShopClientController extends AdminController 'per_page' => $per_page, 'kernelService' => new KernelService(), 'adminThemeService' => new AdminThemeService(), + 'themeService' => new ThemeService(), ]); } else { $this->cgView->render("module_shop_error_connection.php"); @@ -156,49 +159,6 @@ class ModuleShopClientController extends AdminController $this->redirect('/admin/module_shop_client', 302); } -// public function actionSearch(int $page_number = 1): void -// { -// $request = new Request(); -// $filters = $request->get(); -//// Debug::dd($filters); -// if ($this->moduleService->issetModuleShopToken()) { -// if ($this->moduleService->isServerAvailable()) { -// $modules_info = []; -// $per_page = 8; -// $modules = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug'); -// $modules = json_decode($modules->getBody()->getContents(), true); -// foreach ($modules as $module) { -// foreach ($filters as $key => $value) { -// if ($value === '') continue; -// if ($module[$key] !== $value) { -// break; -// } -// -// $modules_info[] = $module; -// } -// } -// $module_count = count($modules_info); -// $modules_info = array_slice($modules_info, $per_page * ($page_number - 1), $per_page); -// -// $this->cgView->render("index.php", [ -// 'modules_info' => $modules_info, -// 'moduleService' => $this->moduleService, -// 'page_number' => $page_number, -// 'module_count' => $module_count, -// 'per_page' => $per_page, -// 'kernelService' => new KernelService(), -// 'adminThemeService' => new AdminThemeService(), -// 'filterValues' => $filters -// ]); -// } else { -// $this->cgView->render("module_shop_error_connection.php"); -// } -// -// } else { -// $this->cgView->render("login_at_module_shop.php"); -// } -// } - public function actionSearch(int $page_number = 1): void { $request = new Request(); @@ -285,4 +245,108 @@ class ModuleShopClientController extends AdminController $this->cgView->render('module_shop_error_connection.php'); } + #[NoReturn] public function actionAdminThemeInstall(): void + { + $request = new Request(); + $id = $request->get("id"); + $adminThemeInfo = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/install/' . $id); + + $adminThemeInfo = json_decode($adminThemeInfo->getBody()->getContents(), true); + Files::uploadByUrl($_ENV['MODULE_SHOP_URL'] . $adminThemeInfo['path_to_archive'], RESOURCES_DIR . "/tmp/admin_themes"); + if ($this->adminThemeService->install('/resources/tmp/admin_themes/' . basename($adminThemeInfo['path_to_archive']))) { + Flash::setMessage("success", "Тема админ-панели успешно установлена."); + } else { + Session::start(); + Session::set("error", implode(";", $this->adminThemeService->getErrors())); + } + + $this->redirect('/admin/module_shop_client', 302); + } + + #[NoReturn] public function actionAdminThemeUpdate(): void + { + $request = new Request(); + $slug = $request->get("slug"); + $modules_info = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug'); + + $modules_info = json_decode($modules_info->getBody()->getContents(), true); + foreach ($modules_info as $module) { + if ($module['slug'] === $slug) { + $path = $module['path_to_archive']; + } + } + if (isset($path)) { + Files::uploadByUrl($_ENV['MODULE_SHOP_URL'] . $path, RESOURCES_DIR . "/tmp/admin_themes"); + $this->adminThemeService->update('/resources/tmp/admin_themes/' . basename($path)); + Flash::setMessage("success", "Тема админ-панели успешно обновлена."); + } else { + Flash::setMessage("error", "Ошибка обновления темы админ-панели."); + } + + $this->redirect('/admin/module_shop_client', 302); + } + + #[NoReturn] public function actionAdminThemeDelete(): void + { + $request = new Request(); + $slug = $request->get("slug"); + $adminThemeInfo = $this->adminThemeService->getAdminThemeInfoBySlug($slug); + $this->adminThemeService->uninstall($adminThemeInfo['path']); + + Flash::setMessage("success", "Тема админ-панели успешно удалена."); + $this->redirect('/admin/module_shop_client', 302); + } + + #[NoReturn] public function actionThemeInstall(): void + { + $request = new Request(); + $id = $request->get("id"); + $themeInfo = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/install/' . $id); + + $themeInfo = json_decode($themeInfo->getBody()->getContents(), true); + Files::uploadByUrl($_ENV['MODULE_SHOP_URL'] . $themeInfo['path_to_archive'], RESOURCES_DIR . "/tmp/themes"); + if ($this->themeService->install('/resources/tmp/themes/' . basename($themeInfo['path_to_archive']))) { + Flash::setMessage("success", "Тема сайта успешно установлена."); + } else { + Session::start(); + Session::set("error", implode(";", $this->themeService->getErrors())); + } + + $this->redirect('/admin/module_shop_client', 302); + } + + #[NoReturn] public function actionThemeUpdate(): void + { + $request = new Request(); + $slug = $request->get("slug"); + $modules_info = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug'); + + $modules_info = json_decode($modules_info->getBody()->getContents(), true); + foreach ($modules_info as $module) { + if ($module['slug'] === $slug) { + $path = $module['path_to_archive']; + } + } + if (isset($path)) { + Files::uploadByUrl($_ENV['MODULE_SHOP_URL'] . $path, RESOURCES_DIR . "/tmp/themes"); + $this->themeService->update('/resources/tmp/themes/' . basename($path)); + Flash::setMessage("success", "Тема сайта успешно обновлена."); + } else { + Flash::setMessage("error", "Ошибка обновления темы сайта."); + } + + $this->redirect('/admin/module_shop_client', 302); + } + + #[NoReturn] public function actionThemeDelete(): void + { + $request = new Request(); + $slug = $request->get("slug"); + $themeInfo = $this->themeService->getThemeInfoBySlug($slug); + $this->themeService->uninstall($themeInfo['path']); + + Flash::setMessage("success", "Тема сайта успешно удалена."); + $this->redirect('/admin/module_shop_client', 302); + } + } \ No newline at end of file diff --git a/kernel/modules/module_shop_client/routs/module_shop_client.php b/kernel/modules/module_shop_client/routs/module_shop_client.php index 945ccd2..9c98e9a 100755 --- a/kernel/modules/module_shop_client/routs/module_shop_client.php +++ b/kernel/modules/module_shop_client/routs/module_shop_client.php @@ -24,7 +24,13 @@ App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){ }); App::$collector->group(["prefix" => "admin_theme"], function (RouteCollector $router) { App::$collector->get('/install', [\kernel\modules\module_shop_client\controllers\ModuleShopClientController::class, 'actionAdminThemeInstall']); - App::$collector->post('/update', [\kernel\modules\module_shop_client\controllers\ModuleShopClientController::class, 'actionAdminThemeUpdate']); + App::$collector->get('/update', [\kernel\modules\module_shop_client\controllers\ModuleShopClientController::class, 'actionAdminThemeUpdate']); + App::$collector->get('/delete', [\kernel\modules\module_shop_client\controllers\ModuleShopClientController::class, 'actionAdminThemeDelete']); + }); + App::$collector->group(["prefix" => "theme"], function (RouteCollector $router) { + App::$collector->get('/install', [\kernel\modules\module_shop_client\controllers\ModuleShopClientController::class, 'actionThemeInstall']); + App::$collector->get('/update', [\kernel\modules\module_shop_client\controllers\ModuleShopClientController::class, 'actionThemeUpdate']); + App::$collector->get('/delete', [\kernel\modules\module_shop_client\controllers\ModuleShopClientController::class, 'actionThemeDelete']); }); }); }); diff --git a/kernel/modules/module_shop_client/views/index.php b/kernel/modules/module_shop_client/views/index.php index f3474d4..010e158 100755 --- a/kernel/modules/module_shop_client/views/index.php +++ b/kernel/modules/module_shop_client/views/index.php @@ -7,6 +7,7 @@ * @var \kernel\services\ModuleService $moduleService * @var \kernel\services\KernelService $kernelService * @var \kernel\services\AdminThemeService $adminThemeService + * @var \kernel\services\ThemeService $themeService * @var array $filterValues */ @@ -104,7 +105,7 @@ $table->addAction(function ($row, $url) use ($adminThemeService) { $slug = $row['slug']; if ($adminThemeService->isInstall($slug)) { if (!$adminThemeService->isLastVersion($slug)) { - $url = "$url/admin_theme/update/"; + $url = "$url/admin_theme/update/?slug=" . $row['slug']; return \kernel\widgets\IconBtn\IconBtnUpdateWidget::create(['url' => $url])->run(); } @@ -114,6 +115,53 @@ $table->addAction(function ($row, $url) use ($adminThemeService) { return false; }); +$table->addAction(function ($row, $url) use ($adminThemeService) { + if ($row['type'] === 'admin_theme') { + if ($adminThemeService->isInstall($row['slug'])) { + $url = "$url/admin_theme/delete/?slug=" . $row['slug']; + + return \kernel\widgets\IconBtn\IconBtnDeleteWidget::create(['url' => $url])->run(); + } else { + $url = "$url/admin_theme/install/?id=" . $row['id']; + + return \kernel\widgets\IconBtn\IconBtnInstallWidget::create(['url' => $url])->run(); + } + } + + return false; +}); + +$table->addAction(function ($row, $url) use ($themeService) { + if ($row['type'] === 'theme') { + $slug = $row['slug']; + if ($themeService->isInstall($slug)) { + if (!$themeService->isLastVersion($slug)) { + $url = "$url/theme/update/?slug=" . $row['slug']; + + return \kernel\widgets\IconBtn\IconBtnUpdateWidget::create(['url' => $url])->run(); + } + } + } + + return false; +}); + +$table->addAction(function ($row, $url) use ($themeService) { + if ($row['type'] === 'theme') { + if ($themeService->isInstall($row['slug'])) { + $url = "$url/theme/delete/?slug=" . $row['slug']; + + return \kernel\widgets\IconBtn\IconBtnDeleteWidget::create(['url' => $url])->run(); + } else { + $url = "$url/theme/install/?id=" . $row['id']; + + return \kernel\widgets\IconBtn\IconBtnInstallWidget::create(['url' => $url])->run(); + } + } + + return false; +}); + $table->afterPrint(function () { return \kernel\IGTabel\btn\PrimaryBtn::create('Сбросить все фильтры', '/admin/module_shop_client')->fetch(); }); diff --git a/kernel/modules/secure/services/SecureService.php b/kernel/modules/secure/services/SecureService.php index b47f4d4..1699b6a 100755 --- a/kernel/modules/secure/services/SecureService.php +++ b/kernel/modules/secure/services/SecureService.php @@ -13,21 +13,28 @@ use kernel\services\TokenService; class SecureService { - public static function createSecretCode(User $user): void + public static function createSecretCode(User $user): SecretCode { $secretCode = new SecretCode(); $secretCode->user_id = $user->id; $secretCode->code = mt_rand(100000, 999999); $secretCode->code_expires_at = date("Y-m-d H:i:s", strtotime("+5 minutes"));; $secretCode->save(); + + return $secretCode; } - public static function updateSecretCode(User $user): void + public static function updateSecretCode(User $user): SecretCode { $secretCode = SecretCode::where('user_id', $user->id)->first(); + if(!$secretCode){ + return self::createSecretCode($user); + } $secretCode->code = mt_rand(100000, 999999); $secretCode->code_expires_at = date("Y-m-d H:i:s", strtotime("+5 minutes"));; $secretCode->save(); + + return $secretCode; } public static function getCodeByUserId(int $user_id) diff --git a/kernel/modules/themes/ThemesModule.php b/kernel/modules/themes/ThemesModule.php new file mode 100644 index 0000000..adbedb4 --- /dev/null +++ b/kernel/modules/themes/ThemesModule.php @@ -0,0 +1,33 @@ +menuService = new MenuService(); + } + + /** + * @throws \Exception + */ + public function init(): void + { + $this->menuService->createItem([ + "label" => "Темы сайта", + "url" => "/admin/settings/themes", + "slug" => "themes", + "parent_slug" => "settings" + ]); + } + + public function deactivate(): void + { + $this->menuService->removeItemBySlug("themes"); + } +} \ No newline at end of file diff --git a/kernel/modules/themes/controllers/ThemeController.php b/kernel/modules/themes/controllers/ThemeController.php new file mode 100644 index 0000000..fbc23a3 --- /dev/null +++ b/kernel/modules/themes/controllers/ThemeController.php @@ -0,0 +1,73 @@ +cgView->viewPath = KERNEL_MODULES_DIR . "/themes/views/"; + } + + public function actionIndex(): void + { + $themePaths = Option::where("key", "theme_paths")->first(); + + $dirs = []; + if ($themePaths){ + $path = json_decode($themePaths->value); + foreach ($path->paths as $p){ + $dirs[] = getConst($p); + } + } + + $infoToTable = []; + $meta = []; + $meta['columns'] = [ + "preview" => "Превью", + "name" => "Название", + "author" => "Автор", + "version" => "Версия", + "description" => "Описание" + ]; + $meta['params'] = ["class" => "table table-bordered"]; + $meta['perPage'] = 10; + $meta['baseUrl'] = "/admin/settings/themes"; + $meta['currentPage'] = 1; + + $infoToTable['meta'] = $meta; + + $themesInfo = []; + foreach ($dirs as $dir){ + $i = 1; + foreach (new DirectoryIterator($dir) as $fileInfo) { + $info = []; + if($fileInfo->isDot()) continue; + $info['id'] = $i; + $themesInfo[] = array_merge($info, $this->themeService->getThemeInfo($fileInfo->getPathname())); + $i++; + } + } + $infoToTable['meta']['total'] = count($themesInfo); + $infoToTable['data'] = $themesInfo; + + $this->cgView->render("index.php", ['json' => json_encode($infoToTable, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)]); + } + + #[NoReturn] public function actionActivate(): void + { + $request = new Request(); + $this->themeService->setActiveTheme($request->get("p")); + + $this->cgView->render("view.php", ['data' => $this->themeService->getThemeInfo($request->get("p"))]); + } + +} \ No newline at end of file diff --git a/kernel/modules/themes/manifest.json b/kernel/modules/themes/manifest.json new file mode 100644 index 0000000..91bb70a --- /dev/null +++ b/kernel/modules/themes/manifest.json @@ -0,0 +1,10 @@ +{ + "name": "Themes", + "version": "0.1", + "author": "ITGuild", + "slug": "themes", + "description": "Themes module", + "module_class": "kernel\\modules\\themes\\ThemesModule", + "module_class_file": "{KERNEL_MODULES}/themes/ThemesModule.php", + "routs": "routs/themes.php" +} \ No newline at end of file diff --git a/kernel/modules/themes/routs/themes.php b/kernel/modules/themes/routs/themes.php new file mode 100644 index 0000000..5131e25 --- /dev/null +++ b/kernel/modules/themes/routs/themes.php @@ -0,0 +1,16 @@ +group(["prefix" => "admin"], function (RouteCollector $router){ + App::$collector->group(["before" => "auth"], function (RouteCollector $router) { + App::$collector->group(["prefix" => "settings"], function (RouteCollector $router) { + App::$collector->group(["prefix" => "themes"], function (RouteCollector $router) { + App::$collector->get('/', [\kernel\modules\themes\controllers\ThemeController::class, 'actionIndex']); + App::$collector->get('/activate', [\kernel\modules\themes\controllers\ThemeController::class, 'actionActivate']); + }); + }); + }); +}); \ No newline at end of file diff --git a/kernel/modules/themes/views/index.php b/kernel/modules/themes/views/index.php new file mode 100644 index 0000000..795940b --- /dev/null +++ b/kernel/modules/themes/views/index.php @@ -0,0 +1,25 @@ +columns([ + 'preview' => function ($data) { + return ""; + } +]); +$table->addAction(function ($row, $url){ + $active_admin_theme = \kernel\modules\option\service\OptionService::getItem('active_theme'); + + if ($row['path'] === $active_admin_theme){ + return "Активна"; + } else { + $url = "$url/activate/?p=" . $row['path']; + + return \kernel\widgets\IconBtn\IconBtnActivateWidget::create(['url' => $url])->run(); + } +}); +$table->create(); +$table->render(); \ No newline at end of file diff --git a/kernel/modules/themes/views/view.php b/kernel/modules/themes/views/view.php new file mode 100644 index 0000000..6591b7c --- /dev/null +++ b/kernel/modules/themes/views/view.php @@ -0,0 +1,25 @@ + [ + "rows" => ["preview" => "Превью", "name" => "Название", "version" => "Версия", "description" => "Описание"], + "params" => ["class" => "table table-bordered"], + "baseUrl" => "/admin/settings/themes", + ], + "data" => $data +]; + +$table = new \Itguild\Tables\ViewJsonTable(json_encode($table_info, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); +$table->rows([ + 'preview' => function ($data) { + return ""; + } +]); +$table->beforePrint(function () { + return \kernel\widgets\IconBtn\IconBtnListWidget::create(['url' => '/admin/settings/themes'])->run(); +}); +$table->create(); +$table->render(); \ No newline at end of file diff --git a/kernel/modules/user/routs/user.php b/kernel/modules/user/routs/user.php index 25eda62..d5dc543 100755 --- a/kernel/modules/user/routs/user.php +++ b/kernel/modules/user/routs/user.php @@ -20,7 +20,7 @@ App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){ App::$collector->group(["prefix" => "profile"], callback: function (RouteCollector $router) { App::$collector->get('/', [\kernel\modules\user\controllers\UserController::class, 'actionProfile']); App::$collector->get('/update', [\kernel\modules\user\controllers\UserController::class, 'actionProfileUpdate']); - App::$collector->post('/edit', [\kernel\modules\user\controllers\UserController::class, 'actionProfileEdit']); + App::$collector->any('/edit', [\kernel\modules\user\controllers\UserController::class, 'actionProfileEdit']); }); }); }); diff --git a/kernel/modules/user/service/UserService.php b/kernel/modules/user/service/UserService.php index 9915c2a..ebb26bc 100755 --- a/kernel/modules/user/service/UserService.php +++ b/kernel/modules/user/service/UserService.php @@ -11,7 +11,11 @@ class UserService public function create(FormModel $form_model): false|User { - $model = new User(); + $model = User::where("username", $form_model->getItem('username'))->first(); + if ($model){ + return $model; + } + $model = new User(); $model->username = $form_model->getItem('username'); $model->email = $form_model->getItem('email'); $model->password_hash = password_hash($form_model->getItem('password'), PASSWORD_DEFAULT); diff --git a/kernel/services/AdminThemeService.php b/kernel/services/AdminThemeService.php index f8d5aea..e01ef1c 100755 --- a/kernel/services/AdminThemeService.php +++ b/kernel/services/AdminThemeService.php @@ -16,6 +16,7 @@ class AdminThemeService protected Option $option; protected string $active_theme; + protected ModuleService $moduleService; @@ -82,12 +83,22 @@ class AdminThemeService return $info; } - public function getAdminThemeInfoBySlug(string $slug) + public function getAdminThemeInfoBySlug(string $slug): false|array|string { - // TODO + $dirs = $this->getAdminThemeDirs(); + foreach ($dirs as $dir) { + foreach (new DirectoryIterator($dir) as $fileInfo) { + if ($fileInfo->isDot()) continue; + if ($this->getAdminThemeInfo($fileInfo->getPathname())['slug'] === $slug) { + return $this->getAdminThemeInfo($fileInfo->getPathname()); + } + } + } + + return false; } - public function isInstall(string $slug): bool + public function getAdminThemeDirs(): array { $adminThemePaths = Option::where("key", "admin_theme_paths")->first(); $dirs = []; @@ -97,6 +108,12 @@ class AdminThemeService $dirs[] = getConst($p); } } + return $dirs; + } + + public function isInstall(string $slug): bool + { + $dirs = $this->getAdminThemeDirs(); foreach ($dirs as $dir) { foreach (new DirectoryIterator($dir) as $fileInfo) { if ($fileInfo->isDot()) continue; @@ -116,8 +133,7 @@ class AdminThemeService $modulesInfo = json_decode($modulesInfo->getBody()->getContents(), true); - $themeInfo = $this->getAdminThemeInfo($slug); -// Debug::dd($themeInfo); + $themeInfo = $this->getAdminThemeInfoBySlug($slug); foreach ($modulesInfo as $mod) { if ($mod['slug'] === $themeInfo['slug'] && $mod['version'] === $themeInfo['version']) { return true; @@ -136,7 +152,7 @@ class AdminThemeService $fileHelper = new Files(); $fileHelper->copy_folder(ROOT_DIR . $path, $tmpThemeDirFull . 'meta/'); - $fileHelper->copy_folder(RESOURCES_DIR . '/' . $themeName, $tmpThemeDirFull . 'resources/'); + $fileHelper->copy_folder(RESOURCES_DIR . '/admin_themes/' . $themeName, $tmpThemeDirFull . 'resources/'); if (!is_dir(RESOURCES_DIR . '/tmp/admin_themes')) { $old_mask = umask(0); @@ -178,7 +194,7 @@ class AdminThemeService if (isset($manifest['resource_path'])) { $fileHelper->copy_folder($tmpThemeDirFull . "resources", $manifest['resource_path']); } else { - $fileHelper->copy_folder($tmpThemeDirFull . "resources", RESOURCES_DIR . '/' . $manifest['slug']); + $fileHelper->copy_folder($tmpThemeDirFull . "resources", RESOURCES_DIR . '/admin_themes/' . $manifest['slug']); } $fileHelper->recursiveRemoveDir($tmpThemeDirFull); @@ -195,11 +211,20 @@ class AdminThemeService $this->setActiveAdminTheme(KERNEL_ADMIN_THEMES_DIR . '/default'); } $fileHelper = new Files(); - if (file_exists(ROOT_DIR . $path)) { - $fileHelper->recursiveRemoveDir(ROOT_DIR . $path); + if (file_exists($path)) { + $fileHelper->recursiveRemoveDir($path); } - if (file_exists(RESOURCES_DIR . '/' . $themeInfo['slug'])) { - $fileHelper->recursiveRemoveDir(RESOURCES_DIR . '/' . $themeInfo['slug']); + if (file_exists(RESOURCES_DIR . '/admin_themes/' . $themeInfo['slug'])) { + $fileHelper->recursiveRemoveDir(RESOURCES_DIR . '/admin_themes/' . $themeInfo['slug']); } } + + public function update(string $path): bool + { + if ($this->install($path)) { + return true; + } + + return false; + } } \ No newline at end of file diff --git a/kernel/services/ThemeService.php b/kernel/services/ThemeService.php new file mode 100644 index 0000000..4185852 --- /dev/null +++ b/kernel/services/ThemeService.php @@ -0,0 +1,260 @@ +option = new Option(); + $this->findActiveTheme(); + $this->moduleService = new ModuleService(); + } + + /** + * @return array + */ + public function getErrors(): array + { + return $this->errors; + } + + /** + * @param $msg + * @return void + */ + public function addError($msg): void + { + $this->errors[] = $msg; + } + + public function findActiveTheme(): void + { + $model = $this->option::where("key", "active_theme")->first(); + $this->active_theme = $model->value; + } + + public function getActiveTheme(): string + { + return $this->active_theme; + } + + public function setActiveTheme(string $theme): void + { + $activeTheme = $this->option::where("key", "active_theme")->first(); + + $themeInfo = $this->getThemeInfo(getConst($theme)); + if (isset($themeInfo['dependence'])) { + $dependence_array = explode(',', $themeInfo['dependence']); + foreach ($dependence_array as $depend) { + $this->moduleService->runInitScript($depend); + } + } + + $currentThemeInfo = $this->getActiveThemeInfo(); + + if (isset($currentThemeInfo['dependence'])) { + $dependence_array = explode(',', $currentThemeInfo['dependence']); + foreach ($dependence_array as $depend) { + $this->moduleService->runDeactivateScript($depend); + } + } + + $activeTheme->value = getConst($theme); + $activeTheme->save(); + } + + public function getActiveThemeInfo(): false|array|string + { + return $this->getThemeInfo($this->active_theme); + } + + public function getThemeInfo(string $theme): false|array|string + { + $info = []; + $theme = getConst($theme); + $info['path'] = $theme; + if (file_exists($theme . "/manifest.json")) { + $manifest = file_get_contents($theme . "/manifest.json"); + $manifest = Manifest::getWithVars($manifest); + $manifest['preview'] = $manifest['resource'] . "/" . $manifest['preview']; + $info = array_merge($info, $manifest); + } + + return $info; + } + + public function getThemeInfoBySlug(string $slug): false|array|string + { + $dirs = $this->getThemeDirs(); + foreach ($dirs as $dir) { + foreach (new DirectoryIterator($dir) as $fileInfo) { + if ($fileInfo->isDot()) continue; + if ($this->getThemeInfo($fileInfo->getPathname())['slug'] === $slug) { + return $this->getThemeInfo($fileInfo->getPathname()); + } + } + } + + return false; + } + + public function getThemeDirs(): array + { + $ThemePaths = Option::where("key", "theme_paths")->first(); + $dirs = []; + if ($ThemePaths) { + $path = json_decode($ThemePaths->value); + foreach ($path->paths as $p) { + $dirs[] = getConst($p); + } + } + return $dirs; + } + + public function isInstall(string $slug): bool + { + $dirs = $this->getThemeDirs(); + foreach ($dirs as $dir) { + foreach (new DirectoryIterator($dir) as $fileInfo) { + if ($fileInfo->isDot()) continue; + if ($this->getThemeInfo($fileInfo->getPathname())['slug'] === $slug) { + return true; + } + } + } + + return false; + } + + public function isLastVersion(string $slug): bool + { + if ($this->moduleService->isServerAvailable()) { + $modulesInfo = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug'); + + $modulesInfo = json_decode($modulesInfo->getBody()->getContents(), true); + + $themeInfo = $this->getThemeInfoBySlug($slug); + foreach ($modulesInfo as $mod) { + if ($mod['slug'] === $themeInfo['slug'] && $mod['version'] === $themeInfo['version']) { + return true; + } + } + } + + return false; + } + + public function pack(string $path): void + { + $themeName = basename($path); + + $tmpThemeDirFull = RESOURCES_DIR . '/tmp/ad/' . $themeName . "/"; + + $fileHelper = new Files(); + $fileHelper->copy_folder(ROOT_DIR . $path, $tmpThemeDirFull . 'meta/'); + $fileHelper->copy_folder(RESOURCES_DIR . '/themes/' . $themeName, $tmpThemeDirFull . 'resources/'); + + if (!is_dir(RESOURCES_DIR . '/tmp/themes')) { + $old_mask = umask(0); + mkdir(RESOURCES_DIR . '/tmp/themes', 0775, true); + umask($old_mask); + } + $fileHelper->pack($tmpThemeDirFull, RESOURCES_DIR . '/tmp/themes/' . $themeName . '.igt'); + } + + public function install(string $path): bool + { + $zip = new ZipArchive; + $tmpThemeDir = md5(time()); + $res = $zip->open(ROOT_DIR . $path); + if ($res === TRUE) { + $tmpThemeDirFull = RESOURCES_DIR . '/tmp/ad/' . $tmpThemeDir . "/"; + $zip->extractTo($tmpThemeDirFull); + $zip->close(); + } else { + $this->addError('unable to open zip archive'); + return false; + } + + if (!file_exists($tmpThemeDirFull . "meta/manifest.json")){ + $this->addError('manifest.json not found'); + return false; + } + + $manifestJson = getConst(file_get_contents($tmpThemeDirFull . "meta/manifest.json")); + $manifest = Manifest::getWithVars($manifestJson); + + $fileHelper = new Files(); + if (isset($manifest['theme_path'])) { + $fileHelper->copy_folder($tmpThemeDirFull . "meta", $manifest['theme_path']); + } else { + $fileHelper->copy_folder($tmpThemeDirFull . "meta", APP_DIR . '/themes/' . $manifest['slug']); + } + + if (isset($manifest['resource_path'])) { + $fileHelper->copy_folder($tmpThemeDirFull . "resources", $manifest['resource_path']); + } else { + $fileHelper->copy_folder($tmpThemeDirFull . "resources", RESOURCES_DIR . '/themes/' . $manifest['slug']); + } + + $fileHelper->recursiveRemoveDir($tmpThemeDirFull); + unlink(ROOT_DIR . $path); + return true; + } + + public function uninstall(string $path): void + { + $themeInfo = $this->getThemeInfo(APP_DIR . '/themes/' . basename($path)); + + $active_theme = $this->option::where("key", "active_theme")->first(); + if ($active_theme->value === ROOT_DIR . $path) { + $this->setActiveTheme(KERNEL_DIR . '/themes/default'); + } + $fileHelper = new Files(); + if (file_exists($path)) { + $fileHelper->recursiveRemoveDir($path); + } + if (file_exists(RESOURCES_DIR . '/themes/' . $themeInfo['slug'])) { + $fileHelper->recursiveRemoveDir(RESOURCES_DIR . '/themes/' . $themeInfo['slug']); + } + } + + public function update(string $path): bool + { + if ($this->install($path)) { + return true; + } + + return false; + } + + public function getThemeRout(string $path) + { + if (file_exists($path . "/manifest.json")){ + $manifest = json_decode(file_get_contents($path . "/manifest.json"), true); + if ($manifest['routs']) { + return $manifest['routs']; + } + } + + return false; + } + +} \ No newline at end of file diff --git a/kernel/themes/default/assets/DefaultThemesAssets.php b/kernel/themes/default/assets/DefaultThemesAssets.php new file mode 100644 index 0000000..0576814 --- /dev/null +++ b/kernel/themes/default/assets/DefaultThemesAssets.php @@ -0,0 +1,18 @@ +registerCSS(slug: "main", resource: "/css/styles.css"); + } + + protected function createJS(): void + { + $this->registerJS(slug: "webpack", resource: "/js/scripts.js"); + } +} \ No newline at end of file diff --git a/kernel/themes/default/controllers/MainController.php b/kernel/themes/default/controllers/MainController.php new file mode 100644 index 0000000..57e83c0 --- /dev/null +++ b/kernel/themes/default/controllers/MainController.php @@ -0,0 +1,28 @@ +cgView->viewPath = KERNEL_DIR . "/themes/default/views/main/"; + $this->cgView->layout = "main.php"; + $this->cgView->layoutPath = KERNEL_DIR . "/themes/default/views/layout/"; + $this->cgView->addVarToLayout("resources", "/resources/themes/default"); + } + + public function actionIndex(): void + { + $this->cgView->render("index.php"); + } + + public function actionAbout(): void + { + $this->cgView->render("about.php"); + } +} \ No newline at end of file diff --git a/kernel/themes/default/manifest.json b/kernel/themes/default/manifest.json new file mode 100644 index 0000000..b33030a --- /dev/null +++ b/kernel/themes/default/manifest.json @@ -0,0 +1,13 @@ +{ + "name": "Default", + "version": "0.1", + "author": "ItGuild", + "slug": "default", + "type": "theme", + "description": "Default theme", + "preview": "preview.png", + "resource": "/resources/themes/default", + "resource_path": "{RESOURCES}/themes/default", + "routs": "routs/default.php", + "dependence": "user,option,menu,secure" +} \ No newline at end of file diff --git a/kernel/themes/default/routs/default.php b/kernel/themes/default/routs/default.php new file mode 100644 index 0000000..8c643ec --- /dev/null +++ b/kernel/themes/default/routs/default.php @@ -0,0 +1,12 @@ +get('/', [\kernel\themes\default\controllers\MainController::class, 'actionIndex']); +App::$collector->get('/about', [\kernel\themes\default\controllers\MainController::class, 'actionAbout']); +//App::$collector->get('/page/{page_number}', [\app\modules\tag\controllers\TagController::class, 'actionIndex']); +//App::$collector->get('/create', [\app\modules\tag\controllers\TagController::class, 'actionCreate']); + + + diff --git a/kernel/themes/default/views/layout/main.php b/kernel/themes/default/views/layout/main.php new file mode 100644 index 0000000..824482e --- /dev/null +++ b/kernel/themes/default/views/layout/main.php @@ -0,0 +1,92 @@ + + + + + + + getCSSAsSTR(); ?> + + + <?= $title ?> + getMeta() ?> + + + + + + + + + + + + + + + + + + + +getJSAsStr(); ?> + + diff --git a/kernel/themes/default/views/main/about.php b/kernel/themes/default/views/main/about.php new file mode 100644 index 0000000..47b9fde --- /dev/null +++ b/kernel/themes/default/views/main/about.php @@ -0,0 +1,36 @@ +setTitle("Старт Bootstrap"); +$view->setMeta([ + 'description' => 'Дефолтная bootstrap тема' +]); +?> + +
+
+
+
+
+

About Me

+ This is what I do. +
+
+
+
+
+ +
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe nostrum ullam eveniet pariatur voluptates odit, fuga atque ea nobis sit soluta odio, adipisci quas excepturi maxime quae totam ducimus consectetur?

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius praesentium recusandae illo eaque architecto error, repellendus iusto reprehenderit, doloribus, minus sunt. Numquam at quae voluptatum in officia voluptas voluptatibus, minus!

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut consequuntur magnam, excepturi aliquid ex itaque esse est vero natus quae optio aperiam soluta voluptatibus corporis atque iste neque sit tempora!

+
+
+
+
\ No newline at end of file diff --git a/kernel/themes/default/views/main/index.php b/kernel/themes/default/views/main/index.php new file mode 100644 index 0000000..e7e33c1 --- /dev/null +++ b/kernel/themes/default/views/main/index.php @@ -0,0 +1,86 @@ +setTitle("IT Guild Micro Framework"); +$view->setMeta([ + 'description' => 'Default IT Guild Micro Framework theme' +]); +?> + +
+
+
+
+
+

Clean Blog

+ A Blog Theme by IT Guild Micro Framework +
+
+
+
+
+ +
+
+ +
+
\ No newline at end of file