diff --git a/composer.json b/composer.json index 6c308c6..b5fc366 100755 --- a/composer.json +++ b/composer.json @@ -23,12 +23,13 @@ }, "require": { "php": "~8.2", - "ext-sodium": "~8.2", "mirzaev/minimal": "^2.0.x-dev", "mirzaev/arangodb": "^1.0.0", "triagens/arangodb": "~3.9.x-dev", "twig/twig": "^3.4", - "guzzlehttp/guzzle": "^7.5" + "guzzlehttp/guzzle": "^7.5", + "twig/markdown-extra": "^3.5", + "league/commonmark": "^2.3" }, "require-dev": { "phpunit/phpunit": "~9.5" diff --git a/composer.lock b/composer.lock index 3891039..ed2cb2b 100755 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,83 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "eb3974d37e16f19a4c1ca43c8ac73a61", + "content-hash": "b258b9722fd93eec6dac0f7fb73cd0fb", "packages": [ + { + "name": "dflydev/dot-access-data", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/dflydev/dflydev-dot-access-data.git", + "reference": "f41715465d65213d644d3141a6a93081be5d3549" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/f41715465d65213d644d3141a6a93081be5d3549", + "reference": "f41715465d65213d644d3141a6a93081be5d3549", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.42", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.3", + "scrutinizer/ocular": "1.6.0", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dflydev\\DotAccessData\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dragonfly Development Inc.", + "email": "info@dflydev.com", + "homepage": "http://dflydev.com" + }, + { + "name": "Beau Simensen", + "email": "beau@dflydev.com", + "homepage": "http://beausimensen.com" + }, + { + "name": "Carlos Frutos", + "email": "carlos@kiwing.it", + "homepage": "https://github.com/cfrutos" + }, + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com" + } + ], + "description": "Given a deep data structure, access data by dot notation.", + "homepage": "https://github.com/dflydev/dflydev-dot-access-data", + "keywords": [ + "access", + "data", + "dot", + "notation" + ], + "support": { + "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", + "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.2" + }, + "time": "2022-10-27T11:44:00+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "7.5.0", @@ -337,6 +412,194 @@ ], "time": "2022-10-26T14:07:24+00:00" }, + { + "name": "league/commonmark", + "version": "2.3.9", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/commonmark.git", + "reference": "c1e114f74e518daca2729ea8c4bf1167038fa4b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/c1e114f74e518daca2729ea8c4bf1167038fa4b5", + "reference": "c1e114f74e518daca2729ea8c4bf1167038fa4b5", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "league/config": "^1.1.1", + "php": "^7.4 || ^8.0", + "psr/event-dispatcher": "^1.0", + "symfony/deprecation-contracts": "^2.1 || ^3.0", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "cebe/markdown": "^1.0", + "commonmark/cmark": "0.30.0", + "commonmark/commonmark.js": "0.30.0", + "composer/package-versions-deprecated": "^1.8", + "embed/embed": "^4.4", + "erusev/parsedown": "^1.0", + "ext-json": "*", + "github/gfm": "0.29.0", + "michelf/php-markdown": "^1.4 || ^2.0", + "nyholm/psr7": "^1.5", + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.21", + "scrutinizer/ocular": "^1.8.1", + "symfony/finder": "^5.3 | ^6.0", + "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0", + "unleashedtech/php-coding-standard": "^3.1.1", + "vimeo/psalm": "^4.24.0 || ^5.0.0" + }, + "suggest": { + "symfony/yaml": "v2.3+ required if using the Front Matter extension" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.4-dev" + } + }, + "autoload": { + "psr-4": { + "League\\CommonMark\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)", + "homepage": "https://commonmark.thephpleague.com", + "keywords": [ + "commonmark", + "flavored", + "gfm", + "github", + "github-flavored", + "markdown", + "md", + "parser" + ], + "support": { + "docs": "https://commonmark.thephpleague.com/", + "forum": "https://github.com/thephpleague/commonmark/discussions", + "issues": "https://github.com/thephpleague/commonmark/issues", + "rss": "https://github.com/thephpleague/commonmark/releases.atom", + "source": "https://github.com/thephpleague/commonmark" + }, + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/commonmark", + "type": "tidelift" + } + ], + "time": "2023-02-15T14:07:24+00:00" + }, + { + "name": "league/config", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/config.git", + "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/config/zipball/754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", + "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", + "shasum": "" + }, + "require": { + "dflydev/dot-access-data": "^3.0.1", + "nette/schema": "^1.2", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.5", + "scrutinizer/ocular": "^1.8.1", + "unleashedtech/php-coding-standard": "^3.1", + "vimeo/psalm": "^4.7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Config\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Define configuration arrays with strict schemas and access values with dot notation", + "homepage": "https://config.thephpleague.com", + "keywords": [ + "array", + "config", + "configuration", + "dot", + "dot-access", + "nested", + "schema" + ], + "support": { + "docs": "https://config.thephpleague.com/", + "issues": "https://github.com/thephpleague/config/issues", + "rss": "https://github.com/thephpleague/config/releases.atom", + "source": "https://github.com/thephpleague/config" + }, + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + } + ], + "time": "2022-12-11T20:36:23+00:00" + }, { "name": "mirzaev/arangodb", "version": "1.0.2", @@ -432,6 +695,205 @@ }, "time": "2022-11-03T06:09:32+00:00" }, + { + "name": "nette/schema", + "version": "v1.2.3", + "source": { + "type": "git", + "url": "https://github.com/nette/schema.git", + "reference": "abbdbb70e0245d5f3bf77874cea1dfb0c930d06f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/schema/zipball/abbdbb70e0245d5f3bf77874cea1dfb0c930d06f", + "reference": "abbdbb70e0245d5f3bf77874cea1dfb0c930d06f", + "shasum": "" + }, + "require": { + "nette/utils": "^2.5.7 || ^3.1.5 || ^4.0", + "php": ">=7.1 <8.3" + }, + "require-dev": { + "nette/tester": "^2.3 || ^2.4", + "phpstan/phpstan-nette": "^1.0", + "tracy/tracy": "^2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "πŸ“ Nette Schema: validating data structures against a given Schema.", + "homepage": "https://nette.org", + "keywords": [ + "config", + "nette" + ], + "support": { + "issues": "https://github.com/nette/schema/issues", + "source": "https://github.com/nette/schema/tree/v1.2.3" + }, + "time": "2022-10-13T01:24:26+00:00" + }, + { + "name": "nette/utils", + "version": "v4.0.0", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "cacdbf5a91a657ede665c541eda28941d4b09c1e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/cacdbf5a91a657ede665c541eda28941d4b09c1e", + "reference": "cacdbf5a91a657ede665c541eda28941d4b09c1e", + "shasum": "" + }, + "require": { + "php": ">=8.0 <8.3" + }, + "conflict": { + "nette/finder": "<3", + "nette/schema": "<1.2.2" + }, + "require-dev": { + "jetbrains/phpstorm-attributes": "dev-master", + "nette/tester": "^2.4", + "phpstan/phpstan": "^1.0", + "tracy/tracy": "^2.9" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "πŸ›  Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "support": { + "issues": "https://github.com/nette/utils/issues", + "source": "https://github.com/nette/utils/tree/v4.0.0" + }, + "time": "2023-02-02T10:41:53+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, { "name": "psr/http-client", "version": "1.0.1", @@ -868,6 +1330,89 @@ ], "time": "2022-11-03T14:55:06+00:00" }, + { + "name": "symfony/polyfill-php80", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, { "name": "triagens/arangodb", "version": "3.9.x-dev", @@ -929,6 +1474,79 @@ }, "time": "2022-10-21T15:30:53+00:00" }, + { + "name": "twig/markdown-extra", + "version": "v3.5.1", + "source": { + "type": "git", + "url": "https://github.com/twigphp/markdown-extra.git", + "reference": "9474c89fd2787187a3809e5e964dfce2395ae5f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/markdown-extra/zipball/9474c89fd2787187a3809e5e964dfce2395ae5f0", + "reference": "9474c89fd2787187a3809e5e964dfce2395ae5f0", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "twig/twig": "^2.7|^3.0" + }, + "require-dev": { + "erusev/parsedown": "^1.7", + "league/commonmark": "^1.0|^2.0", + "league/html-to-markdown": "^4.8|^5.0", + "michelf/php-markdown": "^1.8|^2.0", + "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.5-dev" + } + }, + "autoload": { + "psr-4": { + "Twig\\Extra\\Markdown\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + } + ], + "description": "A Twig extension for Markdown", + "homepage": "https://twig.symfony.com", + "keywords": [ + "html", + "markdown", + "twig" + ], + "support": { + "source": "https://github.com/twigphp/markdown-extra/tree/v3.5.1" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2023-02-08T07:44:55+00:00" + }, { "name": "twig/twig", "version": "v3.5.1", @@ -2747,8 +3365,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "~8.2", - "ext-sodium": "~8.2" + "php": "~8.2" }, "platform-dev": [], "plugin-api-version": "2.3.0" diff --git "a/mirzaev/site/stdm/registry/system/\\" "b/mirzaev/site/stdm/registry/system/\\" new file mode 100644 index 0000000..853459e --- /dev/null +++ "b/mirzaev/site/stdm/registry/system/\\" @@ -0,0 +1,40 @@ +{% extends "core.html" %} + +{% use "core.html" with css as core_css, body as core_body, js as core_js, js_init as core_js_init %} +{% use "header.html" with css as header_css, body as header_body, js as header_js, js_init as header_js_init %} + +{% block css %} +{{ block('core_css') }} +{{ block('header_css') }} +{% endblock %} + +{% block body %} +{{ block('core_body') }} +{{ block('header_body') }} + +
+ {% block main %} + {% include 'search.html' %} + {% if errors is not empty %}

Π–ΡƒΡ€Π½Π°Π»

{% endif %} + {% for error in errors %} + + {% endfor %} + {% endblock %} +
+ +{# {% include 'footer.html' %} #} +{% endblock %} + +{% block js %} +{{ block('core_js') }} +{{ block('header_js') }} +{% endblock %} + +{% block js_init %} +{{ block('core_js_init') }} +{{ block('header_js_init') }} +{% endblock %} diff --git a/mirzaev/site/stdm/registry/system/controllers/index_controller.php b/mirzaev/site/stdm/registry/system/controllers/index_controller.php index 397616e..9641826 100755 --- a/mirzaev/site/stdm/registry/system/controllers/index_controller.php +++ b/mirzaev/site/stdm/registry/system/controllers/index_controller.php @@ -5,7 +5,9 @@ declare(strict_types=1); namespace mirzaev\site\stdm\registry\controllers; // Π€Π°ΠΉΠ»Ρ‹ ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π° -use mirzaev\site\stdm\registry\controllers\core; +use mirzaev\site\stdm\registry\controllers\core, + mirzaev\site\stdm\registry\models\account_model as account, + mirzaev\site\stdm\registry\models\part_model as part; /** * ΠšΠΎΠ½Ρ‚Ρ€ΠΎΠ»Π»Π΅Ρ€ основной страницы @@ -15,57 +17,34 @@ use mirzaev\site\stdm\registry\controllers\core; */ final class index_controller extends core { - /** - * Главная страница - * - * @param array $parameters ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ запроса - */ - public function index(array $parameters = []): ?string - { - // Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ Π·Π°Π³Ρ€ΡƒΠΆΠ°Π΅ΠΌΡ‹Ρ… ΠΊΠ°Ρ‚Π΅Π³ΠΎΡ€ΠΈΠΉ - $this->variables['include'] = [ - 'head' => ['self'], - 'body' => ['self'] - ]; + /** + * Главная страница + * + * @param array $parameters ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ запроса + */ + public function index(array $parameters = []): ?string + { + // Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ ΠΆΡƒΡ€Π½Π°Π»Π° ошибок + $this->variables['errors']['search'] = []; - // Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ Π±Π΅Π³ΡƒΡ‰Π΅ΠΉ строки - $this->variables['hotline'] = [ - 'id' => $this->variables['request']['id'] ?? 'hotline' - ]; + if (!empty($parameters['key']) && !empty($parameters['search'])) { + // ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½Ρ‹ Π΄Π°Π½Π½Ρ‹Π΅ поиска - // Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ΠΎΠ² Π±Π΅Π³ΡƒΡ‰Π΅ΠΉ строки - $this->variables['hotline']['parameters'] = [ - // 'step' => 2 - ]; + if (account::authorization($parameters['key'], $this->variables['errors']['account'])) { + // Авторизован запрос - // Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ Π°Ρ‚Ρ‚Ρ€ΠΈΠ±ΡƒΡ‚ΠΎΠ² Π±Π΅Π³ΡƒΡ‰Π΅ΠΉ строки - $this->variables['hotline']['attributes'] = [ - - ]; - - // Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ элСмСнтов Π±Π΅Π³ΡƒΡ‰Π΅ΠΉ строки - $this->variables['hotline']['elements'] = [ - ['content' => '1'], - [ - 'tag' => 'article', - 'content' => '2' - ], - ['content' => '3'], - ['content' => '4'], - ['content' => '5'], - ['content' => '6'], - ['content' => '7'], - ['content' => '8'], - ['content' => '9'], - ['content' => '10'], - ['content' => '11'], - ['content' => '12'], - ['content' => '13'], - ['content' => '14'], - ['content' => '15'] - ]; - - // ГСнСрация прСдставлСния - return $this->view->render(DIRECTORY_SEPARATOR . 'index.html', $this->variables); + // Поиск Π΄Π°Π½Π½Ρ‹Ρ… запчасти ΠΈ запись Π² ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½ΡƒΡŽ + $this->variables['result'] = part::search($parameters['search'], $this->variables['errors']['search'])->body ?? null; + } } + + // Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½Ρ‹Ρ… + $this->variables['key'] = $parameters['key'] ?? ''; + $this->variables['search'] = $parameters['search'] ?? ''; + +/* var_dump($this->variables); die; */ + + // ГСнСрация прСдставлСния + return $this->view->render(DIRECTORY_SEPARATOR . 'index.html', $this->variables); + } } diff --git a/mirzaev/site/stdm/registry/system/controllers/search_controller.php b/mirzaev/site/stdm/registry/system/controllers/search_controller.php deleted file mode 100755 index 71ae890..0000000 --- a/mirzaev/site/stdm/registry/system/controllers/search_controller.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ -final class search_controller extends core -{ - /** - * Поиск - * - * @param array $parameters ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ запроса - */ - public function search(array $parameters = []): ?string { - var_dump(account::authorization($parameters['key'], $this->variables['errors']['account'])); - return null; - } -} diff --git a/mirzaev/site/stdm/registry/system/models/keys_model.php b/mirzaev/site/stdm/registry/system/models/keys_model.php deleted file mode 100644 index 198f4f5..0000000 --- a/mirzaev/site/stdm/registry/system/models/keys_model.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ -final class keys_model extends core -{ - /** - * ΠšΠΎΠ»Π»Π΅ΠΊΡ†ΠΈΡ - */ - public const COLLECTION = 'keys'; -} diff --git a/mirzaev/site/stdm/registry/system/models/part_model.php b/mirzaev/site/stdm/registry/system/models/part_model.php new file mode 100644 index 0000000..e5d2941 --- /dev/null +++ b/mirzaev/site/stdm/registry/system/models/part_model.php @@ -0,0 +1,85 @@ + + */ +final class part_model extends core +{ + /** + * ΠšΠΎΠ»Π»Π΅ΠΊΡ†ΠΈΡ + */ + public const COLLECTION = 'part'; + + /** + * ΠšΠΎΠ»Π»Π΅ΠΊΡ†ΠΈΡ прСдставлСния + */ + public const COLLECTION_VIEW = 'search_part'; + + /** + * Поиск + * + * @param string $text ВСкст поиска + * @param array &$errors Π–ΡƒΡ€Π½Π°Π» ошибок + * + * @return ?_document Π˜Π½ΡΡ‚Π°Π½Ρ†ΠΈΡ запчасти, Ссли Π½Π°ΠΉΠ΄Π΅Π½Π° + */ + public static function search(string $text, array &$errors = []): ?_document { + try { + if (collection::init(static::$db->session, self::COLLECTION)) { + // Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·ΠΈΡ€ΠΎΠ²Π°Π½Ρ‹ ΠΊΠΎΠ»Π»Π΅ΠΊΡ†ΠΈΠΈ + + if ($part = collection::search(static::$db->session, sprintf( + << $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + return null; + } + +} diff --git a/mirzaev/site/stdm/registry/system/public/android-chrome-192x192.png b/mirzaev/site/stdm/registry/system/public/android-chrome-192x192.png new file mode 100644 index 0000000..f872da3 Binary files /dev/null and b/mirzaev/site/stdm/registry/system/public/android-chrome-192x192.png differ diff --git a/mirzaev/site/stdm/registry/system/public/android-chrome-512x512.png b/mirzaev/site/stdm/registry/system/public/android-chrome-512x512.png new file mode 100644 index 0000000..05f518b Binary files /dev/null and b/mirzaev/site/stdm/registry/system/public/android-chrome-512x512.png differ diff --git a/mirzaev/site/stdm/registry/system/public/apple-touch-icon.png b/mirzaev/site/stdm/registry/system/public/apple-touch-icon.png new file mode 100644 index 0000000..afe98cb Binary files /dev/null and b/mirzaev/site/stdm/registry/system/public/apple-touch-icon.png differ diff --git a/mirzaev/site/stdm/registry/system/public/css/main.css b/mirzaev/site/stdm/registry/system/public/css/main.css index 761ef39..636ceba 100755 --- a/mirzaev/site/stdm/registry/system/public/css/main.css +++ b/mirzaev/site/stdm/registry/system/public/css/main.css @@ -141,22 +141,25 @@ main>form#panel>label>svg * { color: var(--text-dark); } -main>form#panel>section#result.inactive { +main>form#panel>section#result:has(> svg) { cursor: not-allowed; } +main>h3 { + text-align: center; + margin: 30px 0 20px 0; +} + main>ol { - margin: 50px 100px; - font-size: 1.2rem; + margin: 0px; +} + +main>ol:last-of-type { + margin-bottom: 15px; } main>ol>li { - padding-left: 40px; - margin-bottom: 8px; -} - -main>ol>li::marker { - /* font-size: 1.3rem; */ + padding-left: 10px; } footer { diff --git a/mirzaev/site/stdm/registry/system/public/favicon-16x16.png b/mirzaev/site/stdm/registry/system/public/favicon-16x16.png new file mode 100644 index 0000000..3be89ee Binary files /dev/null and b/mirzaev/site/stdm/registry/system/public/favicon-16x16.png differ diff --git a/mirzaev/site/stdm/registry/system/public/favicon-32x32.png b/mirzaev/site/stdm/registry/system/public/favicon-32x32.png new file mode 100644 index 0000000..bf48c5a Binary files /dev/null and b/mirzaev/site/stdm/registry/system/public/favicon-32x32.png differ diff --git a/mirzaev/site/stdm/registry/system/public/favicon.ico b/mirzaev/site/stdm/registry/system/public/favicon.ico new file mode 100644 index 0000000..04fcf7f Binary files /dev/null and b/mirzaev/site/stdm/registry/system/public/favicon.ico differ diff --git a/mirzaev/site/stdm/registry/system/public/index.php b/mirzaev/site/stdm/registry/system/public/index.php index 2dc8933..c6bd264 100755 --- a/mirzaev/site/stdm/registry/system/public/index.php +++ b/mirzaev/site/stdm/registry/system/public/index.php @@ -23,7 +23,6 @@ $router = new router; // Π—Π°ΠΏΠΈΡΡŒ ΠΌΠ°Ρ€ΡˆΡ€ΡƒΡ‚ΠΎΠ² $router->write('/', 'index', 'index'); -$router->write('/search', 'search', 'search', 'POST'); // Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ ядра $core = new core(namespace: __NAMESPACE__, router: $router); diff --git a/mirzaev/site/stdm/registry/system/public/site.webmanifest b/mirzaev/site/stdm/registry/system/public/site.webmanifest new file mode 100644 index 0000000..45dc8a2 --- /dev/null +++ b/mirzaev/site/stdm/registry/system/public/site.webmanifest @@ -0,0 +1 @@ +{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} \ No newline at end of file diff --git a/mirzaev/site/stdm/registry/system/views/head.html b/mirzaev/site/stdm/registry/system/views/head.html index 23dc8d2..1e42d60 100755 --- a/mirzaev/site/stdm/registry/system/views/head.html +++ b/mirzaev/site/stdm/registry/system/views/head.html @@ -2,6 +2,11 @@ {% if head.title != empty %}{{head.title}}{% else %}РССстр запчастСй{% endif %} {% endblock %} + + + + + {% block meta %} diff --git a/mirzaev/site/stdm/registry/system/views/index.html b/mirzaev/site/stdm/registry/system/views/index.html index 64ea6e4..af1801a 100755 --- a/mirzaev/site/stdm/registry/system/views/index.html +++ b/mirzaev/site/stdm/registry/system/views/index.html @@ -15,6 +15,14 @@
{% block main %} {% include 'search.html' %} + {% if errors.account is not empty or errors.search is not empty %}

Π–ΡƒΡ€Π½Π°Π»

{% endif %} + {% for error in errors %} +
    + {% for data in error %} +
  1. {{ data.text }}
  2. + {% endfor %} +
+ {% endfor %} {% endblock %}
diff --git a/mirzaev/site/stdm/registry/system/views/manager.php b/mirzaev/site/stdm/registry/system/views/manager.php index 16c3698..2146bc1 100755 --- a/mirzaev/site/stdm/registry/system/views/manager.php +++ b/mirzaev/site/stdm/registry/system/views/manager.php @@ -4,22 +4,41 @@ declare(strict_types=1); namespace mirzaev\site\stdm\registry\views; +// Π€Π°ΠΉΠ»Ρ‹ ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π° use mirzaev\minimal\controller; -use Twig\Loader\FilesystemLoader; -use Twig\Environment as view; +// ΠŸΡ€Π΅ΠΏΡ€ΠΎΡ†Π΅ΡΡΠΎΡ€ для HTML +use Twig\Loader\FilesystemLoader, + Twig\Environment as view, + Twig\Extra\Markdown\MarkdownExtension, + Twig\Extra\Markdown\DefaultMarkdown, + Twig\Extra\Markdown\MarkdownRuntime, + Twig\RuntimeLoader\RuntimeLoaderInterface; /** * ΠœΠ΅Π½Π΅Π΄ΠΆΠ΅Ρ€ прСдставлСний * - * @package mirzaev\site\stdm\registry\controllers + * @package mirzaev\stdm\registry\virus\controllers * @author Arsen Mirzaev Tatyano-Muradovich */ final class manager extends controller { - public function render(string $file, array $vars = []): ?string - { - // ГСнСрация прСдставлСния - return (new view(new FilesystemLoader(VIEWS)))->render($file, $vars); - } + public function render(string $file, array $vars = []): ?string + { + // Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ ядра + $view = new view(new FilesystemLoader(VIEWS)); + + // Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ ΠΌΠΎΠ΄ΡƒΠ»Π΅ΠΉ + $view->addExtension(new MarkdownExtension); + $view->addRuntimeLoader(new class implements RuntimeLoaderInterface { + public function load($class) { + if (MarkdownRuntime::class === $class) { + return new MarkdownRuntime(new DefaultMarkdown()); + } + } + }); + + // ГСнСрация прСдставлСния + return $view->render($file, $vars); + } } diff --git a/mirzaev/site/stdm/registry/system/views/search.html b/mirzaev/site/stdm/registry/system/views/search.html index b2fd810..26532e8 100644 --- a/mirzaev/site/stdm/registry/system/views/search.html +++ b/mirzaev/site/stdm/registry/system/views/search.html @@ -1,4 +1,4 @@ -
+ -
+
+ {% if result is not empty %} + {{ result|markdown_to_html }} + {% else %} + {{ result }} + {% endif %}