switch tabs to spaces, editorconfig

This commit is contained in:
Little Fluffy Clouds 2025-07-11 15:45:27 +03:00
parent 468f454cab
commit a45eaca11f
28 changed files with 5277 additions and 5347 deletions

7
.editorconfig Normal file
View File

@ -0,0 +1,7 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4

View File

@ -1,56 +1,56 @@
{ {
"name": "mirzaev/deeproots", "name": "mirzaev/deeproots",
"description": "", "description": "",
"homepage": "https://git.svoboda.works/mirzaev/deeproots", "homepage": "https://git.svoboda.works/mirzaev/deeproots",
"type": "site", "type": "site",
"keywords": [ "keywords": [
"minimal", "minimal",
"baza" "baza"
], ],
"readme": "README.md", "readme": "README.md",
"license": "WTFPL", "license": "WTFPL",
"authors": [ "authors": [
{ {
"name": "mirzaev", "name": "mirzaev",
"email": "mirzaev@gmail.com", "email": "mirzaev@gmail.com",
"homepage": "https://mirzaev.page", "homepage": "https://mirzaev.page",
"role": "Programmer" "role": "Programmer"
} }
], ],
"support": { "support": {
"wiki": "https://git.svoboda.works/mirzaev/deeproots/wiki", "wiki": "https://git.svoboda.works/mirzaev/deeproots/wiki",
"issues": "https://git.svoboda.works/mirzaev/deeproots/issues" "issues": "https://git.svoboda.works/mirzaev/deeproots/issues"
}, },
"require": { "require": {
"php": "^8.4", "php": "^8.4",
"mirzaev/minimal": "^3.4", "mirzaev/minimal": "^3.4",
"mirzaev/baza": "^3.3", "mirzaev/baza": "^3.3",
"twig/twig": "^3.10", "twig/twig": "^3.10",
"twig/extra-bundle": "^3.7", "twig/extra-bundle": "^3.7",
"twig/intl-extra": "^3.10", "twig/intl-extra": "^3.10",
"svoboda/time": "^1.0", "svoboda/time": "^1.0",
"badfarm/zanzara": "^0.9.1", "badfarm/zanzara": "^0.9.1",
"nyholm/psr7": "^1.8", "nyholm/psr7": "^1.8",
"react/filesystem": "^0.1.2", "react/filesystem": "^0.1.2",
"react/async": "^4.3" "react/async": "^4.3"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"mirzaev\\deeproots\\": "mirzaev/deeproots/system" "mirzaev\\deeproots\\": "mirzaev/deeproots/system"
} }
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"mirzaev\\deeproots\\tests\\": "mirzaev/deeproots/tests" "mirzaev\\deeproots\\tests\\": "mirzaev/deeproots/tests"
} }
}, },
"scripts": { "scripts": {
"pre-update-cmd": "./install.sh" "pre-update-cmd": "./install.sh"
}, },
"config": { "config": {
"allow-plugins": { "allow-plugins": {
"php-http/discovery": true, "php-http/discovery": true,
"wyrihaximus/composer-update-bin-autoload-path": true "wyrihaximus/composer-update-bin-autoload-path": true
} }
} }
} }

View File

@ -1,10 +1,9 @@
#!/bin/bash #!/bin/bash
if [ -d author/project ]; then if [ -d author/project ]; then
mv author/project author/deeproots mv author/project author/deeproots
fi fi
if [ -d author ]; then if [ -d author ]; then
mv author mirzaev mv author mirzaev
fi fi

View File

@ -9,9 +9,9 @@ use mirzaev\deeproots\models\core as models;
// Framework for PHP // Framework for PHP
use mirzaev\minimal\core as minimal, use mirzaev\minimal\core as minimal,
mirzaev\minimal\controller, mirzaev\minimal\controller,
mirzaev\minimal\http\response, mirzaev\minimal\http\response,
mirzaev\minimal\http\enumerations\status; mirzaev\minimal\http\enumerations\status;
/** /**
* Controllers core * Controllers core
@ -29,47 +29,47 @@ use mirzaev\minimal\core as minimal,
*/ */
class core extends controller class core extends controller
{ {
/** /**
* Language * Language
* *
* @var language $language Language * @var language $language Language
*/ */
protected language $language = language::en; protected language $language = language::en;
/** /**
* Response * Response
* *
* @see https://wiki.php.net/rfc/property-hooks (find a table about backed and virtual hooks) * @see https://wiki.php.net/rfc/property-hooks (find a table about backed and virtual hooks)
* *
* @var response $response Response * @var response $response Response
*/ */
protected response $response { protected response $response {
// Read // Read
get => $this->response ??= $this->request->response(); get => $this->response ??= $this->request->response();
} }
/** /**
* Errors * Errors
* *
* @var array $errors Registry of errors * @var array $errors Registry of errors
*/ */
protected array $errors = [ protected array $errors = [
]; ];
/** /**
* Constructor * Constructor
* *
* @param minimal $core Instance of the MINIMAL * @param minimal $core Instance of the MINIMAL
* @param bool $initialize Initialize a controller? * @param bool $initialize Initialize a controller?
* *
* @return void * @return void
*/ */
public function __construct(minimal $core, bool $initialize = true) public function __construct(minimal $core, bool $initialize = true)
{ {
// Blocking requests from CloudFlare (better to write this blocking into nginx config file) // Blocking requests from CloudFlare (better to write this blocking into nginx config file)
if (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] === 'nginx-ssl early hints') return status::bruh->label; if (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] === 'nginx-ssl early hints') return status::bruh->label;
// For the extends system // For the extends system
parent::__construct(core: $core); parent::__construct(core: $core);
} }
} }

View File

@ -9,7 +9,7 @@ use mirzaev\deeproots\controllers\core;
// Framework for PHP // Framework for PHP
use mirzaev\minimal\http\enumerations\content, use mirzaev\minimal\http\enumerations\content,
mirzaev\minimal\http\enumerations\status; mirzaev\minimal\http\enumerations\status;
/** /**
* Index * Index
@ -26,46 +26,46 @@ use mirzaev\minimal\http\enumerations\content,
*/ */
final class index extends core final class index extends core
{ {
/** /**
* Errors * Errors
* *
* @var array $errors Registry of errors * @var array $errors Registry of errors
*/ */
protected array $errors = [ protected array $errors = [
'system' => [] 'system' => []
]; ];
/** /**
* Main page * Main page
* *
* @return null * @return null
*/ */
public function index(): null public function index(): null
{ {
if (str_contains($this->request->headers['accept'], content::any->value)) { if (str_contains($this->request->headers['accept'], content::any->value)) {
// Request for any response // Request for any response
// Render page // Render page
$page = $this->view->render('index.html'); $page = $this->view->render('index.html');
// Sending response // Sending response
$this->response $this->response
->start() ->start()
->clean() ->clean()
->sse() ->sse()
->write($page) ->write($page)
->validate($this->request) ->validate($this->request)
?->body() ?->body()
->end(); ->end();
// Deinitializing rendered page // Deinitializing rendered page
unset($page); unset($page);
// Exit (success) // Exit (success)
return null; return null;
} }
// Exit (fail) // Exit (fail)
return null; return null;
} }
} }

View File

@ -2,183 +2,183 @@
// Exit (success) // Exit (success)
return [ return [
// System // System
'deeproots' => 'DeepRoots', 'deeproots' => 'DeepRoots',
'empty' => 'Empty', 'empty' => 'Empty',
'yes' => 'Yes', 'yes' => 'Yes',
'no' => 'No', 'no' => 'No',
// Main menu // Main menu
'menu_title' => 'Main menu', 'menu_title' => 'Main menu',
'menu_button_start' => 'Start', 'menu_button_start' => 'Start',
'menu_button_rating' => 'Rating', 'menu_button_rating' => 'Rating',
'menu_button_balance' => 'Balance', 'menu_button_balance' => 'Balance',
'menu_button_system_accounts' => 'Accounts', 'menu_button_system_accounts' => 'Accounts',
'menu_button_system_questions' => 'Questions', 'menu_button_system_questions' => 'Questions',
'menu_button_system_settings' => 'Settings', 'menu_button_system_settings' => 'Settings',
'menu_system_authorized' => 'System authorization found', 'menu_system_authorized' => 'System authorization found',
// Account // Account
'account_title' => 'Account', 'account_title' => 'Account',
'account_identifier' => 'Identifier', 'account_identifier' => 'Identifier',
'account_authorized_system' => 'Access to the system', 'account_authorized_system' => 'Access to the system',
'account_authorized_game_play' => 'Access to play games', 'account_authorized_game_play' => 'Access to play games',
'account_authorized_rating_display' => 'Access to display in the rating', 'account_authorized_rating_display' => 'Access to display in the rating',
'account_authorized_balance_deposit' => 'Access to deposit into the balance', 'account_authorized_balance_deposit' => 'Access to deposit into the balance',
'account_authorized_balance_withdraw' => 'Access to withdraw from the balance', 'account_authorized_balance_withdraw' => 'Access to withdraw from the balance',
'account_authorized_settings' => 'Access to settings', 'account_authorized_settings' => 'Access to settings',
'account_authorized_system_accounts' => 'System access to accounts', 'account_authorized_system_accounts' => 'System access to accounts',
'account_authorized_system_questions' => 'System access to questions', 'account_authorized_system_questions' => 'System access to questions',
'account_authorized_system_settings' => 'System access to system settings', 'account_authorized_system_settings' => 'System access to system settings',
// Language setting // Language setting
'settings_select_language_title' => 'Select language', 'settings_select_language_title' => 'Select language',
'settings_select_language_description' => 'The selected language will be writed in your account settings', 'settings_select_language_description' => 'The selected language will be writed in your account settings',
'settings_language_update_success' => 'Language replaced:', 'settings_language_update_success' => 'Language replaced:',
'settings_language_update_fail' => 'Failed to replace language', 'settings_language_update_fail' => 'Failed to replace language',
// Language selection // Language selection
'select_language_title' => 'Select language', 'select_language_title' => 'Select language',
'select_language_description' => 'The selected language will be used in the current process', 'select_language_description' => 'The selected language will be used in the current process',
'select_language_button_add' => 'Add a language', 'select_language_button_add' => 'Add a language',
// Repository // Repository
'repository_title' => 'Repository', 'repository_title' => 'Repository',
'repository_text' => <<<TXT 'repository_text' => <<<TXT
Svoboder is written in [PHP](https://www.php.net/) using [Zanzara](https://github.com/badfarm/zanzara) for Telegram, Deeproots is written in [PHP](https://www.php.net/) using [Zanzara](https://github.com/badfarm/zanzara) for Telegram,
my [MINIMAL](https://git.svoboda.works/mirzaev/minimal) framework for PHP and my [Baza](https://git.svoboda.works/mirzaev/baza) database my [MINIMAL](https://git.svoboda.works/mirzaev/minimal) framework for PHP and my [Baza](https://git.svoboda.works/mirzaev/baza) database
The code is under the [WTFPL](https://en.wikipedia.org/wiki/WTFPL) license The code is under the [WTFPL](https://en.wikipedia.org/wiki/WTFPL) license
You can help me with the development, or use my code for free\! You can help me with the development, or use my code for free\!
TXT, TXT,
'repository_button_code' => 'The code', 'repository_button_code' => 'The code',
'repository_button_issues' => 'Issues', 'repository_button_issues' => 'Issues',
'repository_button_suggestions' => 'Suggestions', 'repository_button_suggestions' => 'Suggestions',
// Author // Author
'author_title' => 'Author', 'author_title' => 'Author',
'author_text' => <<<TXT 'author_text' => <<<TXT
*Arsen Mirzaev Tatyano\-Muradovich* *Arsen Mirzaev Tatyano\-Muradovich*
Programmer, anarchist, vegetarian Programmer, anarchist, vegetarian
TXT, TXT,
'author_button_neurojournal' => 'Neurojournal', 'author_button_neurojournal' => 'Neurojournal',
'author_button_projects' => 'Projects', 'author_button_projects' => 'Projects',
'author_button_twitter' => 'Twitter', 'author_button_twitter' => 'Twitter',
'author_button_bluesky' => 'Bluesky', 'author_button_bluesky' => 'Bluesky',
'author_button_bastyon' => 'Bastyon', 'author_button_bastyon' => 'Bastyon',
'author_button_youtube_english' => 'YouTube', 'author_button_youtube_english' => 'YouTube',
'author_button_youtube_russian' => 'YouTube', 'author_button_youtube_russian' => 'YouTube',
'author_button_message' => 'Send a message', 'author_button_message' => 'Send a message',
// Questions (system) // Questions (system)
'system_questions_title' => 'The questions registry', 'system_questions_title' => 'The questions registry',
'system_questions_questions' => 'Questions', 'system_questions_questions' => 'Questions',
'system_questions_answers' => 'Answers', 'system_questions_answers' => 'Answers',
'system_questions_answers_amount_matches' => 'The amount of questions matches the amount of answers', 'system_questions_answers_amount_matches' => 'The amount of questions matches the amount of answers',
'system_questions_answers_amount_different' => 'The amount of questions does not match the amount of answers', 'system_questions_answers_amount_different' => 'The amount of questions does not match the amount of answers',
'system_questions_amount_matches' => 'The amount of questions matches the amount of localizations', 'system_questions_amount_matches' => 'The amount of questions matches the amount of localizations',
'system_questions_amount_different' => 'The amount of questions does not match the amount of localizations', 'system_questions_amount_different' => 'The amount of questions does not match the amount of localizations',
'system_questions_localizations_amount_matches' => 'Amounts of localizations matches with each other', 'system_questions_localizations_amount_matches' => 'Amounts of localizations matches with each other',
'system_questions_localizations_amount_different' => 'Amounts of localizations does not match with each other', 'system_questions_localizations_amount_different' => 'Amounts of localizations does not match with each other',
'system_questions_button_search' => 'Search', 'system_questions_button_search' => 'Search',
'system_questions_button_create' => 'Create', 'system_questions_button_create' => 'Create',
// Question create (system) // Question create (system)
'system_questions_create_created' => 'The question was created', 'system_questions_create_created' => 'The question was created',
// Question search (system) // Question search (system)
'system_questions_search_title' => 'The question search process', 'system_questions_search_title' => 'The question search process',
'system_questions_search_continued' => 'The process of the question search found and continued', 'system_questions_search_continued' => 'The process of the question search found and continued',
'system_questions_search_started' => 'The process of the question search started', 'system_questions_search_started' => 'The process of the question search started',
'system_questions_search_not_started' => 'The process of the question search is not started', 'system_questions_search_not_started' => 'The process of the question search is not started',
'system_questions_search_ended' => 'The process of the question search ended', 'system_questions_search_ended' => 'The process of the question search ended',
'system_questions_search_page_next_exists' => 'There are more questions in the registry', 'system_questions_search_page_next_exists' => 'There are more questions in the registry',
'system_questions_search_page_next_not_exists' => 'There are no more questions in the registry', 'system_questions_search_page_next_not_exists' => 'There are no more questions in the registry',
'system_questions_search_empty' => 'No questions found', 'system_questions_search_empty' => 'No questions found',
'system_questions_search_question_title' => 'Question', 'system_questions_search_question_title' => 'Question',
'system_questions_search_question_answer' => 'Answer', 'system_questions_search_question_answer' => 'Answer',
'system_questions_search_identifier_request_title' => 'Enter identifier', 'system_questions_search_identifier_request_title' => 'Enter identifier',
'system_questions_search_identifier_request_not_acceptable' => 'Failed to process the identifier', 'system_questions_search_identifier_request_not_acceptable' => 'Failed to process the identifier',
'system_questions_search_identifier_request_too_short' => 'Identifier length must be \>\= 1 and \<\= 12', 'system_questions_search_identifier_request_too_short' => 'Identifier length must be \>\= 1 and \<\= 12',
'system_questions_search_identifier_request_too_long' => 'Identifier length must be \>\= 1 and \<\= 12', 'system_questions_search_identifier_request_too_long' => 'Identifier length must be \>\= 1 and \<\= 12',
'system_questions_search_identifier_request_restricted_characters_title' => "Restricted any characters except digits", 'system_questions_search_identifier_request_restricted_characters_title' => "Restricted any characters except digits",
'system_questions_search_identifier_request_restricted_characters_description' => "Remove these characters:", 'system_questions_search_identifier_request_restricted_characters_description' => "Remove these characters:",
'system_questions_search_identifier_cancel_success' => 'Cancelled the identifier replacing process', 'system_questions_search_identifier_cancel_success' => 'Cancelled the identifier replacing process',
'system_questions_search_identifier_delete_success' => 'Identifier deleted', 'system_questions_search_identifier_delete_success' => 'Identifier deleted',
'system_questions_search_identifier_update_success' => 'Identifier replaced:', 'system_questions_search_identifier_update_success' => 'Identifier replaced:',
'system_questions_search_identifier_update_fail' => 'Failed to replace identifier', 'system_questions_search_identifier_update_fail' => 'Failed to replace identifier',
'system_questions_search_text_request_title' => 'Enter text', 'system_questions_search_text_request_title' => 'Enter text',
'system_questions_search_text_request_not_acceptable' => 'Failed to process the text', 'system_questions_search_text_request_not_acceptable' => 'Failed to process the text',
'system_questions_search_text_request_too_short' => 'Text length must be \>\= 3 and \<\= 256', 'system_questions_search_text_request_too_short' => 'Text length must be \>\= 3 and \<\= 256',
'system_questions_search_text_request_too_long' => 'Text length must be \>\= 3 and \<\= 256', 'system_questions_search_text_request_too_long' => 'Text length must be \>\= 3 and \<\= 256',
'system_questions_search_text_cancel_success' => 'Cancelled the text replacing process', 'system_questions_search_text_cancel_success' => 'Cancelled the text replacing process',
'system_questions_search_text_delete_success' => 'Text deleted', 'system_questions_search_text_delete_success' => 'Text deleted',
'system_questions_search_text_update_success' => 'Text replaced:', 'system_questions_search_text_update_success' => 'Text replaced:',
'system_questions_search_text_update_fail' => 'Failed to replace text', 'system_questions_search_text_update_fail' => 'Failed to replace text',
'system_questions_search_a_request_title' => 'Enter A\-answer', 'system_questions_search_a_request_title' => 'Enter A\-answer',
'system_questions_search_a_request_not_acceptable' => 'Failed to process the A\-answer', 'system_questions_search_a_request_not_acceptable' => 'Failed to process the A\-answer',
'system_questions_search_a_request_too_short' => 'A\-answer length must be \>\= 3 and \<\= 128', 'system_questions_search_a_request_too_short' => 'A\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_a_request_too_long' => 'A\-answer length must be \>\= 3 and \<\= 128', 'system_questions_search_a_request_too_long' => 'A\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_a_cancel_success' => 'Cancelled the A\-answer replacing process', 'system_questions_search_a_cancel_success' => 'Cancelled the A\-answer replacing process',
'system_questions_search_a_delete_success' => 'A\-answer deleted', 'system_questions_search_a_delete_success' => 'A\-answer deleted',
'system_questions_search_a_update_success' => 'A\-answer replaced:', 'system_questions_search_a_update_success' => 'A\-answer replaced:',
'system_questions_search_a_update_fail' => 'Failed to replace A\-answer', 'system_questions_search_a_update_fail' => 'Failed to replace A\-answer',
'system_questions_search_b_request_title' => 'Enter B\-answer', 'system_questions_search_b_request_title' => 'Enter B\-answer',
'system_questions_search_b_request_not_acceptable' => 'Failed to process the B\-answer', 'system_questions_search_b_request_not_acceptable' => 'Failed to process the B\-answer',
'system_questions_search_b_request_too_short' => 'B\-answer length must be \>\= 3 and \<\= 128', 'system_questions_search_b_request_too_short' => 'B\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_b_request_too_long' => 'B\-answer length must be \>\= 3 and \<\= 128', 'system_questions_search_b_request_too_long' => 'B\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_b_cancel_success' => 'Cancelled the B\-answer replacing process', 'system_questions_search_b_cancel_success' => 'Cancelled the B\-answer replacing process',
'system_questions_search_b_delete_success' => 'B\-answer deleted', 'system_questions_search_b_delete_success' => 'B\-answer deleted',
'system_questions_search_b_update_success' => 'B\-answer replaced:', 'system_questions_search_b_update_success' => 'B\-answer replaced:',
'system_questions_search_b_update_fail' => 'Failed to replace B\-answer', 'system_questions_search_b_update_fail' => 'Failed to replace B\-answer',
'system_questions_search_c_request_title' => 'Enter C\-answer', 'system_questions_search_c_request_title' => 'Enter C\-answer',
'system_questions_search_c_request_not_acceptable' => 'Failed to process the C\-answer', 'system_questions_search_c_request_not_acceptable' => 'Failed to process the C\-answer',
'system_questions_search_c_request_too_short' => 'C\-answer length must be \>\= 3 and \<\= 128', 'system_questions_search_c_request_too_short' => 'C\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_c_request_too_long' => 'C\-answer length must be \>\= 3 and \<\= 128', 'system_questions_search_c_request_too_long' => 'C\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_c_cancel_success' => 'Cancelled the C\-answer replacing process', 'system_questions_search_c_cancel_success' => 'Cancelled the C\-answer replacing process',
'system_questions_search_c_delete_success' => 'C\-answer deleted', 'system_questions_search_c_delete_success' => 'C\-answer deleted',
'system_questions_search_c_update_success' => 'C\-answer replaced:', 'system_questions_search_c_update_success' => 'C\-answer replaced:',
'system_questions_search_c_update_fail' => 'Failed to replace C\-answer', 'system_questions_search_c_update_fail' => 'Failed to replace C\-answer',
'system_questions_search_d_request_title' => 'Enter D\-answer', 'system_questions_search_d_request_title' => 'Enter D\-answer',
'system_questions_search_d_request_not_acceptable' => 'Failed to process the D\-answer', 'system_questions_search_d_request_not_acceptable' => 'Failed to process the D\-answer',
'system_questions_search_d_request_too_short' => 'D\-answer length must be \>\= 3 and \<\= 128', 'system_questions_search_d_request_too_short' => 'D\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_d_request_too_long' => 'D\-answer length must be \>\= 3 and \<\= 128', 'system_questions_search_d_request_too_long' => 'D\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_d_cancel_success' => 'Cancelled the D\-answer replacing process', 'system_questions_search_d_cancel_success' => 'Cancelled the D\-answer replacing process',
'system_questions_search_d_delete_success' => 'D\-answer deleted', 'system_questions_search_d_delete_success' => 'D\-answer deleted',
'system_questions_search_d_update_success' => 'D\-answer replaced:', 'system_questions_search_d_update_success' => 'D\-answer replaced:',
'system_questions_search_d_update_fail' => 'Failed to replace D\-answer', 'system_questions_search_d_update_fail' => 'Failed to replace D\-answer',
'system_questions_search_button_delete' => 'Delete', 'system_questions_search_button_delete' => 'Delete',
'system_questions_search_button_author' => 'Author', 'system_questions_search_button_author' => 'Author',
'system_questions_search_button_active' => 'Active', 'system_questions_search_button_active' => 'Active',
'system_questions_search_button_inactive' => 'Inactive', 'system_questions_search_button_inactive' => 'Inactive',
'system_questions_search_button_answer' => 'Answer', 'system_questions_search_button_answer' => 'Answer',
'system_questions_search_button_localizations' => 'Localizations', 'system_questions_search_button_localizations' => 'Localizations',
'system_questions_search_button_identifier' => 'Identifier', 'system_questions_search_button_identifier' => 'Identifier',
'system_questions_search_button_text' => 'Text', 'system_questions_search_button_text' => 'Text',
'system_questions_search_button_a' => 'A', 'system_questions_search_button_a' => 'A',
'system_questions_search_button_b' => 'B', 'system_questions_search_button_b' => 'B',
'system_questions_search_button_c' => 'C', 'system_questions_search_button_c' => 'C',
'system_questions_search_button_d' => 'D', 'system_questions_search_button_d' => 'D',
'system_questions_search_button_delete' => 'Delete', 'system_questions_search_button_delete' => 'Delete',
'system_questions_search_button_cancel' => 'Cancel', 'system_questions_search_button_cancel' => 'Cancel',
'system_questions_search_button_page_next' => 'Next page', 'system_questions_search_button_page_next' => 'Next page',
'system_questions_search_button_end' => 'End the search process', 'system_questions_search_button_end' => 'End the search process',
'system_questions_search_not_localized' => 'Failed to initialize the question localization', 'system_questions_search_not_localized' => 'Failed to initialize the question localization',
// Question localization create (system) // Question localization create (system)
'system_questions_localization_create_created' => 'The question localization was created', 'system_questions_localization_create_created' => 'The question localization was created',
// Authorization // Authorization
'not_authorized_system' => 'You do not have access to the system', 'not_authorized_system' => 'You do not have access to the system',
'not_authorized_game_play' => 'You do not have access to play games', 'not_authorized_game_play' => 'You do not have access to play games',
'not_authorized_rating_display' => 'You do not have access to display in the rating', 'not_authorized_rating_display' => 'You do not have access to display in the rating',
'not_authorized_balance_deposit' => 'You do not have access to deposit into the balance', 'not_authorized_balance_deposit' => 'You do not have access to deposit into the balance',
'not_authorized_balance_withdraw' => 'You do not have access to withdraw from the balance', 'not_authorized_balance_withdraw' => 'You do not have access to withdraw from the balance',
'not_authorized_settings' => 'You do not have access to the settings', 'not_authorized_settings' => 'You do not have access to the settings',
'not_authorized_system_accounts' => 'You do not have system access to the accounts', 'not_authorized_system_accounts' => 'You do not have system access to the accounts',
'not_authorized_system_questions' => 'You do not have system access to the questions', 'not_authorized_system_questions' => 'You do not have system access to the questions',
'not_authorized_system_settings' => 'You do not have system access to the system settings', 'not_authorized_system_settings' => 'You do not have system access to the system settings',
// Other // Other
'why_so_shroomious' => 'why so shroomious', 'why_so_shroomious' => 'why so shroomious',
]; ];

View File

@ -2,183 +2,183 @@
// Exit (success) // Exit (success)
return [ return [
// Система // Система
'deeproots' => 'DeepRoots', 'deeproots' => 'DeepRoots',
'empty' => 'Пусто', 'empty' => 'Пусто',
'yes' => 'Да', 'yes' => 'Да',
'no' => 'Нет', 'no' => 'Нет',
// Главное меню // Главное меню
'menu_title' => 'Главное меню', 'menu_title' => 'Главное меню',
'menu_button_start' => 'Начать', 'menu_button_start' => 'Начать',
'menu_button_rating' => 'Рейтинг', 'menu_button_rating' => 'Рейтинг',
'menu_button_balance' => 'Баланс', 'menu_button_balance' => 'Баланс',
'menu_button_system_accounts' => 'Аккаунты', 'menu_button_system_accounts' => 'Аккаунты',
'menu_button_system_questions' => 'Вопросы', 'menu_button_system_questions' => 'Вопросы',
'menu_button_system_settings' => 'Настройки', 'menu_button_system_settings' => 'Настройки',
'menu_system_authorized' => 'Найдена системная авторизация', 'menu_system_authorized' => 'Найдена системная авторизация',
// Аккаунт // Аккаунт
'account_title' => 'Аккаунт', 'account_title' => 'Аккаунт',
'account_identifier' => 'Идентификатор', 'account_identifier' => 'Идентификатор',
'account_authorized_system' => 'Доступ к системе', 'account_authorized_system' => 'Доступ к системе',
'account_authorized_game_play' => 'Доступ к играм', 'account_authorized_game_play' => 'Доступ к играм',
'account_authorized_rating_display' => 'Доступ к отображению в рейтинге', 'account_authorized_rating_display' => 'Доступ к отображению в рейтинге',
'account_authorized_balance_deposit' => 'Доступ к пополнению баланса', 'account_authorized_balance_deposit' => 'Доступ к пополнению баланса',
'account_authorized_balance_withdraw' => 'Доступ к выводу баланса', 'account_authorized_balance_withdraw' => 'Доступ к выводу баланса',
'account_authorized_settings' => 'Доступ к настроекам', 'account_authorized_settings' => 'Доступ к настроекам',
'account_authorized_system_accounts' => 'Системный доступ к аккаунтам', 'account_authorized_system_accounts' => 'Системный доступ к аккаунтам',
'account_authorized_system_questions' => 'Системный доступ к вопросам', 'account_authorized_system_questions' => 'Системный доступ к вопросам',
'account_authorized_system_settings' => 'Системный доступ к системным настройкам', 'account_authorized_system_settings' => 'Системный доступ к системным настройкам',
// Настройки языка // Настройки языка
'settings_select_language_title' => 'Выбери язык', 'settings_select_language_title' => 'Выбери язык',
'settings_select_language_description' => 'Выбранный язык будет записан в настройки аккаунта', 'settings_select_language_description' => 'Выбранный язык будет записан в настройки аккаунта',
'settings_language_update_success' => 'Язык заменён:', 'settings_language_update_success' => 'Язык заменён:',
'settings_language_update_fail' => 'Не удалось заменить язык', 'settings_language_update_fail' => 'Не удалось заменить язык',
// Выбор языка // Выбор языка
'select_language_title' => 'Выбери язык', 'select_language_title' => 'Выбери язык',
'select_language_description' => 'Выбранный язык будет использован в текущем процессе', 'select_language_description' => 'Выбранный язык будет использован в текущем процессе',
'select_language_button_add' => 'Добавить язык', 'select_language_button_add' => 'Добавить язык',
// Репозиторий // Репозиторий
'repository_title' => 'Репозиторий', 'repository_title' => 'Репозиторий',
'repository_text' => <<<TXT 'repository_text' => <<<TXT
Svoboder написан на [PHP](https://www.php.net/) используя [Zanzara](https://github.com/badfarm/zanzara) для Telegram, Svoboder написан на [PHP](https://www.php.net/) используя [Zanzara](https://github.com/badfarm/zanzara) для Telegram,
мой [MINIMAL](https://git.svoboda.works/mirzaev/minimal) фреймворк для PHP и моя база данных [Baza](https://git.svoboda.works/mirzaev/baza) мой [MINIMAL](https://git.svoboda.works/mirzaev/minimal) фреймворк для PHP и моя база данных [Baza](https://git.svoboda.works/mirzaev/baza)
Код находится под лицензией [WTFPL](https://en.wikipedia.org/wiki/WTFPL) Код находится под лицензией [WTFPL](https://en.wikipedia.org/wiki/WTFPL)
Помогай с разработкой или используй мой код бесплатно\! Помогай с разработкой или используй мой код бесплатно\!
TXT, TXT,
'repository_button_code' => 'Код', 'repository_button_code' => 'Код',
'repository_button_issues' => 'Проблемы', 'repository_button_issues' => 'Проблемы',
'repository_button_suggestions' => 'Предложения', 'repository_button_suggestions' => 'Предложения',
// Автор // Автор
'author_title' => 'Автор', 'author_title' => 'Автор',
'author_text' => <<<TXT 'author_text' => <<<TXT
*Арсен Мирзаев Татьяно\-Мурадович* *Арсен Мирзаев Татьяно\-Мурадович*
Программист, анархист, вегетарианец Программист, анархист, вегетарианец
TXT, TXT,
'author_button_neurojournal' => 'Нейрожурнал', 'author_button_neurojournal' => 'Нейрожурнал',
'author_button_projects' => 'Проекты', 'author_button_projects' => 'Проекты',
'author_button_twitter' => 'Twitter', 'author_button_twitter' => 'Twitter',
'author_button_bluesky' => 'Bluesky', 'author_button_bluesky' => 'Bluesky',
'author_button_bastyon' => 'Bastyon', 'author_button_bastyon' => 'Bastyon',
'author_button_youtube_english' => 'YouTube', 'author_button_youtube_english' => 'YouTube',
'author_button_youtube_russian' => 'YouTube', 'author_button_youtube_russian' => 'YouTube',
'author_button_message' => 'Отправить сообщение', 'author_button_message' => 'Отправить сообщение',
// Вопросы (система) // Вопросы (система)
'system_questions_title' => 'Реестр вопросов', 'system_questions_title' => 'Реестр вопросов',
'system_questions_questions' => 'Вопросы', 'system_questions_questions' => 'Вопросы',
'system_questions_answers' => 'Ответы', 'system_questions_answers' => 'Ответы',
'system_questions_answers_amount_matches' => 'Количество вопросов совпадает с количеством ответов', 'system_questions_answers_amount_matches' => 'Количество вопросов совпадает с количеством ответов',
'system_questions_answers_amount_different' => 'Количество вопросов не совпадает с количеством ответов', 'system_questions_answers_amount_different' => 'Количество вопросов не совпадает с количеством ответов',
'system_questions_amount_matches' => 'Количество вопросов совпадает с количеством локализаций', 'system_questions_amount_matches' => 'Количество вопросов совпадает с количеством локализаций',
'system_questions_amount_different' => 'Количество вопросов не совпадает с количеством локализаций', 'system_questions_amount_different' => 'Количество вопросов не совпадает с количеством локализаций',
'system_questions_localizations_amount_matches' => 'Количества локализаций совпадает друг с другом', 'system_questions_localizations_amount_matches' => 'Количества локализаций совпадает друг с другом',
'system_questions_localizations_amount_different' => 'Количества локализаций не совпадает друг с другом', 'system_questions_localizations_amount_different' => 'Количества локализаций не совпадает друг с другом',
'system_questions_button_search' => 'Поиск', 'system_questions_button_search' => 'Поиск',
'system_questions_button_create' => 'Создать', 'system_questions_button_create' => 'Создать',
// Создание вопроса (система) // Создание вопроса (система)
'system_questions_create_created' => 'Создан вопрос', 'system_questions_create_created' => 'Создан вопрос',
// Поиск вопроса (система) // Поиск вопроса (система)
'system_questions_search_title' => 'Процесс поиска вопроса', 'system_questions_search_title' => 'Процесс поиска вопроса',
'system_questions_search_continued' => 'Процесс поиска вопроса найден и продолжен', 'system_questions_search_continued' => 'Процесс поиска вопроса найден и продолжен',
'system_questions_search_started' => 'Процесс поиска вопроса начат', 'system_questions_search_started' => 'Процесс поиска вопроса начат',
'system_questions_search_not_started' => 'Процесс поиска вопроса не начат', 'system_questions_search_not_started' => 'Процесс поиска вопроса не начат',
'system_questions_search_ended' => 'Процесс поиска вопроса завершён', 'system_questions_search_ended' => 'Процесс поиска вопроса завершён',
'system_questions_search_page_next_exists' => 'В реестре есть ещё вопросы', 'system_questions_search_page_next_exists' => 'В реестре есть ещё вопросы',
'system_questions_search_page_next_not_exists' => 'В реестре больше нет вопросов', 'system_questions_search_page_next_not_exists' => 'В реестре больше нет вопросов',
'system_questions_search_empty' => 'Вопросы не найдены', 'system_questions_search_empty' => 'Вопросы не найдены',
'system_questions_search_question_title' => 'Вопрос', 'system_questions_search_question_title' => 'Вопрос',
'system_questions_search_question_answer' => 'Ответ', 'system_questions_search_question_answer' => 'Ответ',
'system_questions_search_identifier_request_title' => 'Введи идентификатор', 'system_questions_search_identifier_request_title' => 'Введи идентификатор',
'system_questions_search_identifier_request_not_acceptable' => 'Не удалось обработать идентификатор', 'system_questions_search_identifier_request_not_acceptable' => 'Не удалось обработать идентификатор',
'system_questions_search_identifier_request_too_short' => 'Длина идентификатора должна быть \>\= 1 и \<\= 12', 'system_questions_search_identifier_request_too_short' => 'Длина идентификатора должна быть \>\= 1 и \<\= 12',
'system_questions_search_identifier_request_too_long' => 'Длина идентификатора должна быть \>\= 1 и \<\= 12', 'system_questions_search_identifier_request_too_long' => 'Длина идентификатора должна быть \>\= 1 и \<\= 12',
'system_questions_search_identifier_request_restricted_characters_title' => "Запрещены любые символы, кроме цифр", 'system_questions_search_identifier_request_restricted_characters_title' => "Запрещены любые символы, кроме цифр",
'system_questions_search_identifier_request_restricted_characters_description' => "Удали эти символы:", 'system_questions_search_identifier_request_restricted_characters_description' => "Удали эти символы:",
'system_questions_search_identifier_cancel_success' => 'Отменён процесс замены идентификатора', 'system_questions_search_identifier_cancel_success' => 'Отменён процесс замены идентификатора',
'system_questions_search_identifier_delete_success' => 'Идентификатор удалён', 'system_questions_search_identifier_delete_success' => 'Идентификатор удалён',
'system_questions_search_identifier_update_success' => 'Идентификатор заменён:', 'system_questions_search_identifier_update_success' => 'Идентификатор заменён:',
'system_questions_search_identifier_update_fail' => 'Не удалось заменить идентификатор', 'system_questions_search_identifier_update_fail' => 'Не удалось заменить идентификатор',
'system_questions_search_text_request_title' => 'Введи текст', 'system_questions_search_text_request_title' => 'Введи текст',
'system_questions_search_text_request_not_acceptable' => 'Не удалось обработать текст', 'system_questions_search_text_request_not_acceptable' => 'Не удалось обработать текст',
'system_questions_search_text_request_too_short' => 'Длина текста должна быть \>\= 3 и \<\= 256', 'system_questions_search_text_request_too_short' => 'Длина текста должна быть \>\= 3 и \<\= 256',
'system_questions_search_text_request_too_long' => 'Длина текста должна быть \>\= 3 и \<\= 256', 'system_questions_search_text_request_too_long' => 'Длина текста должна быть \>\= 3 и \<\= 256',
'system_questions_search_text_cancel_success' => 'Отменён процесс замены текста', 'system_questions_search_text_cancel_success' => 'Отменён процесс замены текста',
'system_questions_search_text_delete_success' => 'Текст удалён', 'system_questions_search_text_delete_success' => 'Текст удалён',
'system_questions_search_text_update_success' => 'Текст заменён:', 'system_questions_search_text_update_success' => 'Текст заменён:',
'system_questions_search_text_update_fail' => 'Не удалось заменить текст', 'system_questions_search_text_update_fail' => 'Не удалось заменить текст',
'system_questions_search_a_request_title' => 'Введи A\-ответ', 'system_questions_search_a_request_title' => 'Введи A\-ответ',
'system_questions_search_a_request_not_acceptable' => 'Не удалось обработать A\-ответ', 'system_questions_search_a_request_not_acceptable' => 'Не удалось обработать A\-ответ',
'system_questions_search_a_request_too_short' => 'Длина A\-ответа должна быть \>\= 3 и \<\= 128', 'system_questions_search_a_request_too_short' => 'Длина A\-ответа должна быть \>\= 3 и \<\= 128',
'system_questions_search_a_request_too_long' => 'Длина A\-ответа должна быть \>\= 3 и \<\= 128', 'system_questions_search_a_request_too_long' => 'Длина A\-ответа должна быть \>\= 3 и \<\= 128',
'system_questions_search_a_cancel_success' => 'Отменён процесс замены A\-ответа', 'system_questions_search_a_cancel_success' => 'Отменён процесс замены A\-ответа',
'system_questions_search_a_delete_success' => 'A\-ответ удалён', 'system_questions_search_a_delete_success' => 'A\-ответ удалён',
'system_questions_search_a_update_success' => 'A\-ответ заменён:', 'system_questions_search_a_update_success' => 'A\-ответ заменён:',
'system_questions_search_a_update_fail' => 'Не удалось заменить A\-ответ', 'system_questions_search_a_update_fail' => 'Не удалось заменить A\-ответ',
'system_questions_search_b_request_title' => 'Введи B\-ответ', 'system_questions_search_b_request_title' => 'Введи B\-ответ',
'system_questions_search_b_request_not_acceptable' => 'Не удалось обработать B\-ответ', 'system_questions_search_b_request_not_acceptable' => 'Не удалось обработать B\-ответ',
'system_questions_search_b_request_too_short' => 'Длина B\-ответа должна быть \>\= 3 и \<\= 128', 'system_questions_search_b_request_too_short' => 'Длина B\-ответа должна быть \>\= 3 и \<\= 128',
'system_questions_search_b_request_too_long' => 'Длина B\-ответа должна быть \>\= 3 и \<\= 128', 'system_questions_search_b_request_too_long' => 'Длина B\-ответа должна быть \>\= 3 и \<\= 128',
'system_questions_search_b_cancel_success' => 'Отменён процесс замены B\-ответа', 'system_questions_search_b_cancel_success' => 'Отменён процесс замены B\-ответа',
'system_questions_search_b_delete_success' => 'B\-ответ удалён', 'system_questions_search_b_delete_success' => 'B\-ответ удалён',
'system_questions_search_b_update_success' => 'B\-ответ заменён:', 'system_questions_search_b_update_success' => 'B\-ответ заменён:',
'system_questions_search_b_update_fail' => 'Не удалось заменить B\-ответ', 'system_questions_search_b_update_fail' => 'Не удалось заменить B\-ответ',
'system_questions_search_c_request_title' => 'Введи C\-ответ', 'system_questions_search_c_request_title' => 'Введи C\-ответ',
'system_questions_search_c_request_not_acceptable' => 'Не удалось обработать C\-ответ', 'system_questions_search_c_request_not_acceptable' => 'Не удалось обработать C\-ответ',
'system_questions_search_c_request_too_short' => 'Длина C\-ответа должна быть \>\= 3 и \<\= 128', 'system_questions_search_c_request_too_short' => 'Длина C\-ответа должна быть \>\= 3 и \<\= 128',
'system_questions_search_c_request_too_long' => 'Длина C\-ответа должна быть \>\= 3 и \<\= 128', 'system_questions_search_c_request_too_long' => 'Длина C\-ответа должна быть \>\= 3 и \<\= 128',
'system_questions_search_c_cancel_success' => 'Отменён процесс замены C\-ответа', 'system_questions_search_c_cancel_success' => 'Отменён процесс замены C\-ответа',
'system_questions_search_c_delete_success' => 'C\-ответ удалён', 'system_questions_search_c_delete_success' => 'C\-ответ удалён',
'system_questions_search_c_update_success' => 'C\-ответ заменён:', 'system_questions_search_c_update_success' => 'C\-ответ заменён:',
'system_questions_search_c_update_fail' => 'Не удалось заменить C\-ответ', 'system_questions_search_c_update_fail' => 'Не удалось заменить C\-ответ',
'system_questions_search_d_request_title' => 'Введи D\-ответ', 'system_questions_search_d_request_title' => 'Введи D\-ответ',
'system_questions_search_d_request_not_acceptable' => 'Не удалось обработать D\-ответ', 'system_questions_search_d_request_not_acceptable' => 'Не удалось обработать D\-ответ',
'system_questions_search_d_request_too_short' => 'Длина D\-ответа должна быть \>\= 3 и \<\= 128', 'system_questions_search_d_request_too_short' => 'Длина D\-ответа должна быть \>\= 3 и \<\= 128',
'system_questions_search_d_request_too_long' => 'Длина D\-ответа должна быть \>\= 3 и \<\= 128', 'system_questions_search_d_request_too_long' => 'Длина D\-ответа должна быть \>\= 3 и \<\= 128',
'system_questions_search_d_cancel_success' => 'Отменён процесс замены D\-ответа', 'system_questions_search_d_cancel_success' => 'Отменён процесс замены D\-ответа',
'system_questions_search_d_delete_success' => 'D\-ответ удалён', 'system_questions_search_d_delete_success' => 'D\-ответ удалён',
'system_questions_search_d_update_success' => 'D\-ответ заменён:', 'system_questions_search_d_update_success' => 'D\-ответ заменён:',
'system_questions_search_d_update_fail' => 'Не удалось заменить D\-ответ', 'system_questions_search_d_update_fail' => 'Не удалось заменить D\-ответ',
'system_questions_search_button_delete' => 'Удалить', 'system_questions_search_button_delete' => 'Удалить',
'system_questions_search_button_author' => 'Автор', 'system_questions_search_button_author' => 'Автор',
'system_questions_search_button_active' => 'Активен', 'system_questions_search_button_active' => 'Активен',
'system_questions_search_button_inactive' => 'Неактивен', 'system_questions_search_button_inactive' => 'Неактивен',
'system_questions_search_button_answer' => 'Ответ', 'system_questions_search_button_answer' => 'Ответ',
'system_questions_search_button_localizations' => 'Локализации', 'system_questions_search_button_localizations' => 'Локализации',
'system_questions_search_button_identifier' => 'Идентифиикатор', 'system_questions_search_button_identifier' => 'Идентифиикатор',
'system_questions_search_button_text' => 'Текст', 'system_questions_search_button_text' => 'Текст',
'system_questions_search_button_a' => 'А', 'system_questions_search_button_a' => 'А',
'system_questions_search_button_b' => 'Б', 'system_questions_search_button_b' => 'Б',
'system_questions_search_button_c' => 'В', 'system_questions_search_button_c' => 'В',
'system_questions_search_button_d' => 'Г', 'system_questions_search_button_d' => 'Г',
'system_questions_search_button_delete' => 'Удалить', 'system_questions_search_button_delete' => 'Удалить',
'system_questions_search_button_cancel' => 'Отменить', 'system_questions_search_button_cancel' => 'Отменить',
'system_questions_search_button_page_next' => 'Следующая страница', 'system_questions_search_button_page_next' => 'Следующая страница',
'system_questions_search_button_end' => 'Завершить процесс поиска', 'system_questions_search_button_end' => 'Завершить процесс поиска',
'system_questions_search_not_localized' => 'Не удалось инициализировать локализацию вопроса', 'system_questions_search_not_localized' => 'Не удалось инициализировать локализацию вопроса',
// Создание локализации вопроса (система) // Создание локализации вопроса (система)
'system_questions_localization_create_created' => 'Создана локализация вопроса', 'system_questions_localization_create_created' => 'Создана локализация вопроса',
// Авторизация // Авторизация
'not_authorized_system' => 'У тебя нет доступа к системе', 'not_authorized_system' => 'У тебя нет доступа к системе',
'not_authorized_game_play' => 'У тебя нет доступа к играм', 'not_authorized_game_play' => 'У тебя нет доступа к играм',
'not_authorized_rating_display' => 'У тебя нет доступа к отображению в рейтинге', 'not_authorized_rating_display' => 'У тебя нет доступа к отображению в рейтинге',
'not_authorized_balance_deposit' => 'У тебя нет доступа к пополнению баланса', 'not_authorized_balance_deposit' => 'У тебя нет доступа к пополнению баланса',
'not_authorized_balance_withdraw' => 'У тебя нет доступа к выводу баланса', 'not_authorized_balance_withdraw' => 'У тебя нет доступа к выводу баланса',
'not_authorized_settings' => 'У тебя нет доступа к настройкам', 'not_authorized_settings' => 'У тебя нет доступа к настройкам',
'not_authorized_system_accounts' => 'У тебя нет системного доступа к аккаунтам', 'not_authorized_system_accounts' => 'У тебя нет системного доступа к аккаунтам',
'not_authorized_system_questions' => 'У тебя нет системного доступа к вопросам', 'not_authorized_system_questions' => 'У тебя нет системного доступа к вопросам',
'not_authorized_system_settings' => 'У тебя нет системного доступа к системным настройкам', 'not_authorized_system_settings' => 'У тебя нет системного доступа к системным настройкам',
// Прочее // Прочее
'why_so_shroomious' => 'почему такой грибъёзный', 'why_so_shroomious' => 'почему такой грибъёзный',
]; ];

View File

@ -202,15 +202,15 @@ final class account extends core
$identifier, $identifier,
$name, $name,
$language->name, $language->name,
ACCOUNT_ACCESS_SYSTEM, 1, // ACCOUNT_ACCESS_SYSTEM
ACCOUNT_ACCESS_GAME_PLAY, 1, // ACCOUNT_ACCESS_GAME_PLAY
ACCOUNT_ACCESS_RATING_DISPLAY, 1, // ACCOUNT_ACCESS_RATING_DISPLAY
ACCOUNT_ACCESS_BALANCE_DEPOSIT, 1, // ACCOUNT_ACCESS_BALANCE_DEPOSIT
ACCOUNT_ACCESS_BALANCE_WITHDRAW, 1, // ACCOUNT_ACCESS_BALANCE_WITHDRAW
ACCOUNT_ACCESS_SETTINGS, 1, // ACCOUNT_ACCESS_SETTINGS
ACCOUNT_ACCESS_SYSTEM_ACCOUNTS, 0, // ACCOUNT_ACCESS_SYSTEM_ACCOUNTS
ACCOUNT_ACCESS_SYSTEM_QUESTIONS, 0, // ACCOUNT_ACCESS_SYSTEM_QUESTIONS
ACCOUNT_ACCESS_SYSTEM_SETTINGS, 0, // ACCOUNT_ACCESS_SYSTEM_SETTINGS
svoboda::timestamp(), svoboda::timestamp(),
svoboda::timestamp() svoboda::timestamp()
); );

View File

@ -6,22 +6,22 @@ namespace mirzaev\deeproots\models;
// Files of the project // Files of the project
use mirzaev\deeproots\models\core, use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\question, mirzaev\deeproots\models\question,
mirzaev\deeproots\models\enumerations\language; mirzaev\deeproots\models\enumerations\language;
// Svoboda time // Svoboda time
use svoboda\time\statement as svoboda; use svoboda\time\statement as svoboda;
// Baza database // Baza database
use mirzaev\baza\database, use mirzaev\baza\database,
mirzaev\baza\column, mirzaev\baza\column,
mirzaev\baza\record, mirzaev\baza\record,
mirzaev\baza\enumerations\encoding, mirzaev\baza\enumerations\encoding,
mirzaev\baza\enumerations\type; mirzaev\baza\enumerations\type;
// Built-in libraries // Built-in libraries
use Exception as exception, use Exception as exception,
RuntimeException as exception_runtime; RuntimeException as exception_runtime;
/** /**
* Answer * Answer
@ -34,77 +34,77 @@ use Exception as exception,
*/ */
final class answer extends core final class answer extends core
{ {
/** /**
* File * File
* *
* @var string $database Path to the database file * @var string $database Path to the database file
*/ */
protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'answers.baza'; protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'answers.baza';
/** /**
* Database * Database
* *
* @var database $database The database * @var database $database The database
*/ */
public protected(set) database $database; public protected(set) database $database;
/** /**
* Constructor * Constructor
* *
* @param language $language Questions language * @param language $language Questions language
* *
* @return void * @return void
*/ */
public function __construct() public function __construct()
{ {
// Initializing the database // Initializing the database
$this->database = new database() $this->database = new database()
->encoding(encoding::ascii) ->encoding(encoding::ascii)
->columns( ->columns(
new column('identifier', type::long_long_unsigned), new column('identifier', type::long_long_unsigned),
new column('A', type::char), new column('A', type::char),
new column('B', type::char), new column('B', type::char),
new column('C', type::char), new column('C', type::char),
new column('D', type::char), new column('D', type::char),
new column('updated', type::integer_unsigned), new column('updated', type::integer_unsigned),
new column('created', type::integer_unsigned) new column('created', type::integer_unsigned)
) )
->connect($this->file); ->connect($this->file);
} }
/** /**
* Create * Create
* *
* Creates the record in the database * Creates the record in the database
* *
* @param int $identifier Identifier (same for questions in every language) * @param int $identifier Identifier (same for questions in every language)
* @param int $a Number of points for answer A * @param int $a Number of points for answer A
* @param int $b Number of points for answer B * @param int $b Number of points for answer B
* @param int $c Number of points for answer C * @param int $c Number of points for answer C
* @param int $d Number of points for answer D * @param int $d Number of points for answer D
* *
* @return int|false The record identifier, if created * @return int|false The record identifier, if created
*/ */
public function create(?int $identifier, int $a = 0, int $b = 0, int $c = 0, int $d = 0): int|false public function create(?int $identifier, int $a = 0, int $b = 0, int $c = 0, int $d = 0): int|false
{ {
// Initializing the identifier // Initializing the identifier
$identifier ??= $this->database->count() + 1; $identifier ??= $this->database->count() + 1;
// Initializing the record // Initializing the record
$record = $this->database->record( $record = $this->database->record(
$identifier, $identifier,
$a, $a,
$b, $b,
$c, $c,
$d, $d,
svoboda::timestamp(), svoboda::timestamp(),
svoboda::timestamp() svoboda::timestamp()
); );
// Creating the record in the database // Creating the record in the database
$created = $this->database->write($record); $created = $this->database->write($record);
// Exit (success) // Exit (success)
return $created ? $identifier : false; return $created ? $identifier : false;
} }
} }

View File

@ -6,7 +6,7 @@ namespace mirzaev\deeproots\models;
// Framework for PHP // Framework for PHP
use mirzaev\minimal\model, use mirzaev\minimal\model,
mirzaev\minimal\http\enumerations\status; mirzaev\minimal\http\enumerations\status;
// Built-in libraries // Built-in libraries
use exception; use exception;
@ -23,22 +23,21 @@ use exception;
*/ */
class core extends model class core extends model
{ {
/** /**
* File * File
* *
* @var string database Path to the database file * @var string database Path to the database file
*/ */
protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'example.baza'; protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'example.baza';
/** /**
* Constructor * Constructor
* *
* Initialize the database * Initialize the database
* *
* @return void * @return void
*/ */
public function __construct() public function __construct()
{ {
} }
} }

View File

@ -6,22 +6,22 @@ namespace mirzaev\deeproots\models;
// Files of the project // Files of the project
use mirzaev\deeproots\models\core, use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\question\localization, mirzaev\deeproots\models\question\localization,
mirzaev\deeproots\models\enumerations\language; mirzaev\deeproots\models\enumerations\language;
// Svoboda time // Svoboda time
use svoboda\time\statement as svoboda; use svoboda\time\statement as svoboda;
// Baza database // Baza database
use mirzaev\baza\database, use mirzaev\baza\database,
mirzaev\baza\column, mirzaev\baza\column,
mirzaev\baza\record, mirzaev\baza\record,
mirzaev\baza\enumerations\encoding, mirzaev\baza\enumerations\encoding,
mirzaev\baza\enumerations\type; mirzaev\baza\enumerations\type;
// Built-in libraries // Built-in libraries
use Exception as exception, use Exception as exception,
RuntimeException as exception_runtime; RuntimeException as exception_runtime;
/** /**
* Question * Question
@ -34,65 +34,65 @@ use Exception as exception,
*/ */
final class question extends core final class question extends core
{ {
/** /**
* File * File
* *
* @var string $database Path to the database file * @var string $database Path to the database file
*/ */
protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'questions.baza'; protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'questions.baza';
/** /**
* Database * Database
* *
* @var database $database The database * @var database $database The database
*/ */
public protected(set) database $database; public protected(set) database $database;
/** /**
* Constructor * Constructor
* *
* @return void * @return void
*/ */
public function __construct() public function __construct()
{ {
// Initializing the database // Initializing the database
$this->database = new database() $this->database = new database()
->encoding(encoding::ascii) ->encoding(encoding::ascii)
->columns( ->columns(
new column('identifier', type::long_long_unsigned), new column('identifier', type::integer_unsigned),
new column('active', type::char), new column('active', type::char),
new column('updated', type::integer_unsigned), new column('updated', type::integer_unsigned),
new column('created', type::integer_unsigned) new column('created', type::integer_unsigned)
) )
->connect($this->file); ->connect($this->file);
} }
/** /**
* Create * Create
* *
* Creates the record in the database * Creates the record in the database
* *
* @param bool $active Is the question active? * @param bool $active Is the question active?
* *
* @return int|false The record identifier, if created * @return int|false The record identifier, if created
*/ */
public function create(bool $active = false): int|false public function create(bool $active = false): int|false
{ {
// Initializing the identifier // Initializing the identifier
$identifier ??= $this->database->count() + 1; $identifier ??= $this->database->count() + 1;
// Initializing the record // Initializing the record
$record = $this->database->record( $record = $this->database->record(
$identifier, $identifier,
(int) $active, (int) $active,
svoboda::timestamp(), svoboda::timestamp(),
svoboda::timestamp() svoboda::timestamp()
); );
// Creating the record in the database // Creating the record in the database
$created = $this->database->write($record); $created = $this->database->write($record);
// Exit (success) // Exit (success)
return $created ? $identifier : false; return $created ? $identifier : false;
} }
} }

View File

@ -6,22 +6,22 @@ namespace mirzaev\deeproots\models\question;
// Files of the project // Files of the project
use mirzaev\deeproots\models\core, use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\question, mirzaev\deeproots\models\question,
mirzaev\deeproots\models\enumerations\language; mirzaev\deeproots\models\enumerations\language;
// Svoboda time // Svoboda time
use svoboda\time\statement as svoboda; use svoboda\time\statement as svoboda;
// Baza database // Baza database
use mirzaev\baza\database, use mirzaev\baza\database,
mirzaev\baza\column, mirzaev\baza\column,
mirzaev\baza\record, mirzaev\baza\record,
mirzaev\baza\enumerations\encoding, mirzaev\baza\enumerations\encoding,
mirzaev\baza\enumerations\type; mirzaev\baza\enumerations\type;
// Built-in libraries // Built-in libraries
use Exception as exception, use Exception as exception,
RuntimeException as exception_runtime; RuntimeException as exception_runtime;
/** /**
* Question localization * Question localization
@ -34,77 +34,77 @@ use Exception as exception,
*/ */
final class localization extends core final class localization extends core
{ {
/** /**
* Files * Files
* *
* @var string $database Path to the database files * @var string $database Path to the database files
*/ */
protected string $files = DATABASES . DIRECTORY_SEPARATOR . 'questions' . DIRECTORY_SEPARATOR . 'localizations'; protected string $files = DATABASES . DIRECTORY_SEPARATOR . 'questions' . DIRECTORY_SEPARATOR . 'localizations';
/** /**
* Database * Database
* *
* @var database $database The database * @var database $database The database
*/ */
public protected(set) database $database; public protected(set) database $database;
/** /**
* Constructor * Constructor
* *
* @param language $language Language * @param language $language Language
* *
* @return void * @return void
*/ */
public function __construct(language $language) public function __construct(language $language)
{ {
// Initializing the database // Initializing the database
$this->database = new database() $this->database = new database()
->encoding(encoding::ascii) ->encoding(encoding::ascii)
->columns( ->columns(
new column('identifier', type::long_long_unsigned), new column('identifier', type::long_long_unsigned),
new column('text', type::string, ['length' => 256]), new column('text', type::string, ['length' => 256]),
new column('A', type::string, ['length' => 128]), new column('A', type::string, ['length' => 128]),
new column('B', type::string, ['length' => 128]), new column('B', type::string, ['length' => 128]),
new column('C', type::string, ['length' => 128]), new column('C', type::string, ['length' => 128]),
new column('D', type::string, ['length' => 128]), new column('D', type::string, ['length' => 128]),
new column('updated', type::integer_unsigned), new column('updated', type::integer_unsigned),
new column('created', type::integer_unsigned) new column('created', type::integer_unsigned)
) )
->connect($this->files . DIRECTORY_SEPARATOR . strtolower($language->label()) . '.baza'); ->connect($this->files . DIRECTORY_SEPARATOR . strtolower($language->label()) . '.baza');
} }
/** /**
* Create * Create
* *
* Creates the record in the database * Creates the record in the database
* *
* @param int $identifier Identifier of the question::class record * @param int $identifier Identifier of the question::class record
* @param string $text Text (length: 256) * @param string $text Text (length: 256)
* @param string $a Answer A (length: 128) * @param string $a Answer A (length: 128)
* @param string $b Answer B (length: 128) * @param string $b Answer B (length: 128)
* @param string $c Answer C (length: 128) * @param string $c Answer C (length: 128)
* @param string $d Answer D (length: 128) * @param string $d Answer D (length: 128)
* *
* @return int|false The record identifier, if created * @return int|false The record identifier, if created
*/ */
public function create(int $identifier, string $text, string $a, string $b, string $c, string $d): int|false public function create(int $identifier, string $text, string $a, string $b, string $c, string $d): int|false
{ {
// Initializing the record // Initializing the record
$record = $this->database->record( $record = $this->database->record(
$identifier, $identifier,
$text, $text,
$a, $a,
$b, $b,
$c, $c,
$d, $d,
svoboda::timestamp(), svoboda::timestamp(),
svoboda::timestamp() svoboda::timestamp()
); );
// Creating the record in the database // Creating the record in the database
$created = $this->database->write($record); $created = $this->database->write($record);
// Exit (success) // Exit (success)
return $created ? $identifier : false; return $created ? $identifier : false;
} }
} }

View File

@ -6,14 +6,14 @@ namespace svoboda\svoboder\models\telegram\buttons\account\localization;
// Files of the project // Files of the project
use svoboda\svoboder\models\core, use svoboda\svoboder\models\core,
svoboda\svoboder\models\enumerations\language, svoboda\svoboder\models\enumerations\language,
svoboda\svoboder\models\account, svoboda\svoboder\models\account,
svoboda\svoboder\models\telegram\selections, svoboda\svoboder\models\telegram\selections,
svoboda\svoboder\models\telegram\processes\account\localization\create as process_account_localization_create; svoboda\svoboder\models\telegram\processes\account\localization\create as process_account_localization_create;
// Framework for Telegram // Framework for Telegram
use Zanzara\Context as context, use Zanzara\Context as context,
Zanzara\Telegram\Type\Message as message; Zanzara\Telegram\Type\Message as message;
// Baza database // Baza database
use mirzaev\baza\record; use mirzaev\baza\record;
@ -28,201 +28,201 @@ use mirzaev\baza\record;
*/ */
final class create extends core final class create extends core
{ {
/** /**
* Language * Language
* *
* Send the language selection menu * Send the language selection menu
* *
* @param context $context Request data from Telegram * @param context $context Request data from Telegram
* *
* @return void * @return void
*/ */
public static function language(context $context) public static function language(context $context)
{ {
// Initializing the account // Initializing the account
$account = $context->get('account'); $account = $context->get('account');
if ($account instanceof record) { if ($account instanceof record) {
// Initialized the account // Initialized the account
// Initializing language // Initializing language
$language = $context->get('language'); $language = $context->get('language');
if ($language) { if ($language) {
// Initialized language // Initialized language
// Initializing localization // Initializing localization
$localization = $context->get('localization'); $localization = $context->get('localization');
if ($localization) { if ($localization) {
// Initialized localization // Initialized localization
// Reading from the telegram user buffer // Reading from the telegram user buffer
$context->getUserDataItem(process_account_localization_create::PROCESS) $context->getUserDataItem(process_account_localization_create::PROCESS)
->then(function (?array $process) use ($context, $account, $localization) { ->then(function (?array $process) use ($context, $account, $localization) {
// Readed from the telegram user buffer // Readed from the telegram user buffer
if ($process) { if ($process) {
// Found started account localization create process // Found started account localization create process
// Initializing the account model // Initializing the account model
$model_account = new account; $model_account = new account;
// Initializing the account localizations // Initializing the account localizations
$existed = $model_account->localization->database->read( $existed = $model_account->localization->database->read(
filter: fn(record $localization) => $localization->account === $account->identifier, filter: fn(record $localization) => $localization->account === $account->identifier,
amount: ACCOUNT_LOCALIZATION_CREATE_ACCOUNT_LOCALIZATIONS_AMOUNT amount: ACCOUNT_LOCALIZATION_CREATE_ACCOUNT_LOCALIZATIONS_AMOUNT
); );
// Declaring the buffer of languages to exclude // Declaring the buffer of languages to exclude
$exclude = []; $exclude = [];
// Initializing languages to exclude // Initializing languages to exclude
foreach ($existed as $record) $exclude[] = $record->language; foreach ($existed as $record) $exclude[] = $record->language;
if (count($exclude) !== count(language::cases())) { if (count($exclude) !== count(language::cases())) {
// Not all languages in the registry have localizations created (expected) // Not all languages in the registry have localizations created (expected)
// Sending the language selection // Sending the language selection
selections::language( selections::language(
context: $context, context: $context,
prefix: 'account_localization_create_select_language_', prefix: 'account_localization_create_select_language_',
title: '🌏 *' . $localization['account_localization_create_select_language_title'] . '*', title: '🌏 *' . $localization['account_localization_create_select_language_title'] . '*',
description: '🌏 *' . $localization['account_localization_create_select_language_description'] . '*', description: '🌏 *' . $localization['account_localization_create_select_language_description'] . '*',
exclude: $exclude exclude: $exclude
); );
} else { } else {
// All languages in the registry have localizations created (expected) // All languages in the registry have localizations created (expected)
// Sending the message // Sending the message
$context->sendMessage('⚠️ *' . $localization['account_localization_create_every_language_created'] . '*') $context->sendMessage('⚠️ *' . $localization['account_localization_create_every_language_created'] . '*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not found started account localization create process // Not found started account localization create process
// Sending the message // Sending the message
$context->sendMessage('⚠️ *' . $localization['account_localization_create_not_started'] . '*') $context->sendMessage('⚠️ *' . $localization['account_localization_create_not_started'] . '*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
}); });
} else { } else {
// Not initialized localization // Not initialized localization
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*') $context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not initialized language // Not initialized language
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize language*') $context->sendMessage('⚠️ *Failed to initialize language*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not initialized the account // Not initialized the account
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*') $context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} }
/** /**
* Name * Name
* *
* Request to enter name * Request to enter name
* *
* @param context $context Request data from Telegram * @param context $context Request data from Telegram
* *
* @return void * @return void
*/ */
public static function name(context $context) public static function name(context $context)
{ {
// Initializing the account // Initializing the account
$account = $context->get('account'); $account = $context->get('account');
if ($account instanceof record) { if ($account instanceof record) {
// Initialized the account // Initialized the account
// Initializing localization // Initializing localization
$localization = $context->get('localization'); $localization = $context->get('localization');
if ($localization) { if ($localization) {
// Initialized localization // Initialized localization
// Reading from the telegram user buffer // Reading from the telegram user buffer
$context->getUserDataItem(process_account_localization_create::PROCESS) $context->getUserDataItem(process_account_localization_create::PROCESS)
->then(function (?array $process) use ($context, $account, $localization) { ->then(function (?array $process) use ($context, $account, $localization) {
// Readed from the telegram user buffer // Readed from the telegram user buffer
if ($process) { if ($process) {
// Found started account localization create process // Found started account localization create process
// Sending the message // Sending the message
$context->sendMessage('📄 *' . $localization['account_localization_create_name_request'] . '*') $context->sendMessage('📄 *' . $localization['account_localization_create_name_request'] . '*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Writing into the account localization create buffer // Writing into the account localization create buffer
$context->nextStep([process_account_localization_create::class, 'name']); $context->nextStep([process_account_localization_create::class, 'name']);
}); });
} else { } else {
// Not found started account localization create process // Not found started account localization create process
// Sending the message // Sending the message
$context->sendMessage('⚠️ *' . $localization['account_localization_create_not_started'] . '*'); $context->sendMessage('⚠️ *' . $localization['account_localization_create_not_started'] . '*');
} }
}); });
} else { } else {
// Not initialized localization // Not initialized localization
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*') $context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not initialized the account // Not initialized the account
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*') $context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} }
} }

View File

@ -6,14 +6,14 @@ namespace svoboda\svoboder\models\telegram\buttons\account\localization;
// Files of the project // Files of the project
use svoboda\svoboder\models\core, use svoboda\svoboder\models\core,
svoboda\svoboder\models\enumerations\language, svoboda\svoboder\models\enumerations\language,
svoboda\svoboder\models\account, svoboda\svoboder\models\account,
svoboda\svoboder\models\telegram\selections, svoboda\svoboder\models\telegram\selections,
svoboda\svoboder\models\telegram\processes\account\localization\update as process_account_localization_update; svoboda\svoboder\models\telegram\processes\account\localization\update as process_account_localization_update;
// Framework for Telegram // Framework for Telegram
use Zanzara\Context as context, use Zanzara\Context as context,
Zanzara\Telegram\Type\Message as message; Zanzara\Telegram\Type\Message as message;
// Baza database // Baza database
use mirzaev\baza\record; use mirzaev\baza\record;
@ -28,75 +28,75 @@ use mirzaev\baza\record;
*/ */
final class update extends core final class update extends core
{ {
/** /**
* Name * Name
* *
* Request to enter name * Request to enter name
* *
* @param context $context Request data from Telegram * @param context $context Request data from Telegram
* *
* @return void * @return void
*/ */
public static function name(context $context) public static function name(context $context)
{ {
// Initializing the account // Initializing the account
$account = $context->get('account'); $account = $context->get('account');
if ($account instanceof record) { if ($account instanceof record) {
// Initialized the account // Initialized the account
// Initializing localization // Initializing localization
$localization = $context->get('localization'); $localization = $context->get('localization');
if ($localization) { if ($localization) {
// Initialized localization // Initialized localization
// Reading from the telegram user buffer // Reading from the telegram user buffer
$context->getUserDataItem(process_account_localization_update::PROCESS) $context->getUserDataItem(process_account_localization_update::PROCESS)
->then(function (?array $process) use ($context, $account, $localization) { ->then(function (?array $process) use ($context, $account, $localization) {
// Readed from the telegram user buffer // Readed from the telegram user buffer
if ($process) { if ($process) {
// Found started account localization update process // Found started account localization update process
// Sending the message // Sending the message
$context->sendMessage('📄 *' . $localization['account_localization_update_name_request'] . '*') $context->sendMessage('📄 *' . $localization['account_localization_update_name_request'] . '*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Writing into the account localization update buffer // Writing into the account localization update buffer
$context->nextStep([process_account_localization_update::class, 'name']); $context->nextStep([process_account_localization_update::class, 'name']);
}); });
} else { } else {
// Not found started account localization update process // Not found started account localization update process
// Sending the message // Sending the message
$context->sendMessage('⚠️ *' . $localization['account_localization_update_not_started'] . '*'); $context->sendMessage('⚠️ *' . $localization['account_localization_update_not_started'] . '*');
} }
}); });
} else { } else {
// Not initialized localization // Not initialized localization
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*') $context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not initialized the account // Not initialized the account
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*') $context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} }
} }

View File

@ -412,79 +412,6 @@ final class middlewares extends core
} }
} }
/**
* Join (middleware)
*
* Check the account for access to join to distributions
*
* @param context $context
* @param node $next
*
* @return void
*/
public static function join(context $context, node $next): void
{
// Is the process stopped?
if ($context->get('stop')) return;
// Initializing the account
$account = $context->get('account');
if ($account instanceof record) {
// Initialized the account
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
// Initialized localization
if ($account->authorized_joins) {
// Authorized the account to joint to distributions
// Continuation of the process
$next($context);
} else {
// Not authorized the account to joint to distributions
// Sending the message
$context->sendMessage('⛔ *' . $localization['not_authorized_joins'] . '*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
// Stopping the process
$context->set('stop', true);
}
} else {
// Not initialized localization
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
} else {
// Not initialized the account
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
}
/** /**
* Settings (middleware) * Settings (middleware)
* *

View File

@ -6,11 +6,11 @@ namespace mirzaev\deeproots\models\telegram\processes\language;
// Files of the project // Files of the project
use mirzaev\deeproots\models\core, use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\enumerations\language; mirzaev\deeproots\models\enumerations\language;
// Framework for Telegram // Framework for Telegram
use Zanzara\Context as context, use Zanzara\Context as context,
Zanzara\Telegram\Type\Message as message; Zanzara\Telegram\Type\Message as message;
// Baza database // Baza database
use mirzaev\baza\record; use mirzaev\baza\record;
@ -25,126 +25,126 @@ use mirzaev\baza\record;
*/ */
final class select extends core final class select extends core
{ {
/** /**
* Language * Language
* *
* Send the language choose menu * Send the language choose menu
* *
* @param context $context Request data from Telegram * @param context $context Request data from Telegram
* @param string $prefix Prefix for 'callback_data' (`$prefix . $language->name`) * @param string $prefix Prefix for 'callback_data' (`$prefix . $language->name`)
* @param string $title Title of the message * @param string $title Title of the message
* @param string $description Description of the message * @param string $description Description of the message
* @param array $exclude Languages that will be excluded ['ru', 'en'...] * @param array $exclude Languages that will be excluded ['ru', 'en'...]
* *
* @return void * @return void
*/ */
public static function menu(context $context, string $prefix, string $title, string $description, array $exclude = []): void public static function menu(context $context, string $prefix, string $title, string $description, array $exclude = []): void
{ {
// Initializing the account // Initializing the account
$account = $context->get('account'); $account = $context->get('account');
if ($account instanceof record) { if ($account instanceof record) {
// Initialized the account // Initialized the account
// Initializing language // Initializing language
$language = $context->get('language'); $language = $context->get('language');
if ($language) { if ($language) {
// Initialized language // Initialized language
// Initializing localization // Initializing localization
$localization = $context->get('localization'); $localization = $context->get('localization');
if ($localization) { if ($localization) {
// Initialized localization // Initialized localization
// Declaring the buffer of generated keyboard with languages // Declaring the buffer of generated keyboard with languages
$keyboard = []; $keyboard = [];
// Initializing the iterator of rows // Initializing the iterator of rows
$row = 0; $row = 0;
// Initializing buffer of languages // Initializing buffer of languages
$languages = language::cases(); $languages = language::cases();
// Deleting the actual language from buffer of languages // Deleting the actual language from buffer of languages
unset($languages[array_search($language, $languages, strict: true)]); unset($languages[array_search($language, $languages, strict: true)]);
// Sorting buffer of languages by the actual language // Sorting buffer of languages by the actual language
$languages = [$language, ...$languages]; $languages = [$language, ...$languages];
foreach ($languages as $language) { foreach ($languages as $language) {
// Iterating over languages // Iterating over languages
// Skipping excluded languages // Skipping excluded languages
if (array_search($language->name, $exclude, strict: true) !== false) continue; if (array_search($language->name, $exclude, strict: true) !== false) continue;
// Initializing the row // Initializing the row
$keyboard[$row] ??= []; $keyboard[$row] ??= [];
// Writing the language choose button into the buffer of generated keyboard with languages // Writing the language choose button into the buffer of generated keyboard with languages
$keyboard[$row][] = [ $keyboard[$row][] = [
'text' => ($language->flag() ? $language->flag() . ' ' : '') . $language->label($language), 'text' => ($language->flag() ? $language->flag() . ' ' : '') . $language->label($language),
'callback_data' => $prefix . $language->name 'callback_data' => $prefix . $language->name
]; ];
// When reaching 4 buttons in a row, move to the next row // When reaching 4 buttons in a row, move to the next row
if (count($keyboard[$row]) === 4) ++$row; if (count($keyboard[$row]) === 4) ++$row;
} }
// Writing the button for helping lozalizing // Writing the button for helping lozalizing
$keyboard[$row === 0 && empty($keyboard[0]) ? 0 : ++$row] = [ $keyboard[$row === 0 && empty($keyboard[0]) ? 0 : ++$row] = [
[ [
'text' => '🗂 ' . $localization['select_language_button_add'], 'text' => '🗂 ' . $localization['select_language_button_add'],
'url' => 'https://git.svoboda.works/mirzaev/deeproots/src/branch/stable/mirzaev/deeproots/system/localizations' 'url' => 'https://git.svoboda.works/mirzaev/deeproots/src/branch/stable/mirzaev/deeproots/system/localizations'
] ]
]; ];
// Sending the message // Sending the message
$context->sendMessage( $context->sendMessage(
$title ?? '🌏 *' . $localization['select_language_title'] . "*\n" . ($description ?? $localization['select_language_description']), $title ?? '🌏 *' . $localization['select_language_title'] . "*\n" . ($description ?? $localization['select_language_description']),
[ [
'reply_markup' => [ 'reply_markup' => [
'inline_keyboard' => $keyboard, 'inline_keyboard' => $keyboard,
'disable_notification' => true 'disable_notification' => true
], ],
] ]
); );
} else { } else {
// Not initialized localization // Not initialized localization
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*') $context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not initialized language // Not initialized language
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize language*') $context->sendMessage('⚠️ *Failed to initialize language*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not initialized the account // Not initialized the account
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*') $context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} }
} }

View File

@ -6,16 +6,16 @@ namespace mirzaev\deeproots\models\telegram\processes\question;
// Files of the project // Files of the project
use mirzaev\deeproots\models\core, use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\question, mirzaev\deeproots\models\question,
mirzaev\deeproots\models\question\localization, mirzaev\deeproots\models\question\localization,
mirzaev\deeproots\models\answer, mirzaev\deeproots\models\answer,
mirzaev\deeproots\models\enumerations\language, mirzaev\deeproots\models\enumerations\language,
mirzaev\deeproots\models\telegram\commands, mirzaev\deeproots\models\telegram\commands,
mirzaev\deeproots\models\telegram\processes\question\search as process_question_search; mirzaev\deeproots\models\telegram\processes\question\search as process_question_search;
// Framework for Telegram // Framework for Telegram
use Zanzara\Context as context, use Zanzara\Context as context,
Zanzara\Telegram\Type\Message as message; Zanzara\Telegram\Type\Message as message;
// Baza database // Baza database
use mirzaev\baza\record; use mirzaev\baza\record;
@ -30,95 +30,95 @@ use mirzaev\baza\record;
*/ */
final class create extends core final class create extends core
{ {
/** /**
* Process * Process
* *
* @var const string PROCESS Name of the process in the telegram user buffer * @var const string PROCESS Name of the process in the telegram user buffer
*/ */
public const string PROCESS = 'system_questions_create'; public const string PROCESS = 'system_questions_create';
/** /**
* Start * Start
* *
* Starting the process * Starting the process
* *
* @param context $context Request data from Telegram * @param context $context Request data from Telegram
* *
* @return void * @return void
*/ */
public static function start(context $context): void public static function start(context $context): void
{ {
// Initializing the account // Initializing the account
$account = $context->get('account'); $account = $context->get('account');
if ($account instanceof record) { if ($account instanceof record) {
// Initialized the account // Initialized the account
// Initializing language // Initializing language
$language = $context->get('language'); $language = $context->get('language');
if ($language instanceof language) { if ($language instanceof language) {
// Initialized language // Initialized language
// Initializing localization // Initializing localization
$localization = $context->get('localization'); $localization = $context->get('localization');
if ($localization) { if ($localization) {
// Initialized localization // Initialized localization
// Initializing the question model // Initializing the question model
$model_question = new question(); $model_question = new question();
// Creating the question // Creating the question
$question = $model_question->create(); $question = $model_question->create();
if ($question) { if ($question) {
// Created the question // Created the question
// Sending the message // Sending the message
$context->sendMessage('✅ *' . $localization[static::PROCESS . '_created'] . '*') $context->sendMessage('✅ *' . $localization[static::PROCESS . '_created'] . '*')
->then(function (message $message) use ($context, $question) { ->then(function (message $message) use ($context, $question) {
// Sended the message // Sended the message
// Sending the question search menu // Sending the question search menu
process_question_search::start($context, $question); process_question_search::start($context, $question);
}); });
}; };
} else { } else {
// Not initialized localization // Not initialized localization
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*') $context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not initialized language // Not initialized language
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize language*') $context->sendMessage('⚠️ *Failed to initialize language*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not initialized the account // Not initialized the account
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*') $context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Sended the message // Sended the message
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} }
} }

View File

@ -6,15 +6,15 @@ namespace mirzaev\deeproots\models\telegram;
// Files of the project // Files of the project
use mirzaev\deeproots\models\core, use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\account, mirzaev\deeproots\models\account,
mirzaev\deeproots\models\enumerations\language, mirzaev\deeproots\models\enumerations\language,
mirzaev\deeproots\models\telegram\middlewares; mirzaev\deeproots\models\telegram\middlewares;
// Framework for Telegram // Framework for Telegram
use Zanzara\Zanzara, use Zanzara\Zanzara,
Zanzara\Context as context, Zanzara\Context as context,
Zanzara\Telegram\Type\Message as message, Zanzara\Telegram\Type\Message as message,
Zanzara\Middleware\MiddlewareNode as node; Zanzara\Middleware\MiddlewareNode as node;
// Baza database // Baza database
use mirzaev\baza\record; use mirzaev\baza\record;
@ -32,125 +32,125 @@ use Error as error;
*/ */
final class settings extends core final class settings extends core
{ {
/** /**
* Language * Language
* *
* Write language into the account record * Write language into the account record
* *
* @param context $context Request data from Telegram * @param context $context Request data from Telegram
* @param language $language The language * @param language $language The language
* *
* @return void * @return void
*/ */
public static function language(context $context, language $language): void public static function language(context $context, language $language): void
{ {
// Initializing the account // Initializing the account
$account = $context->get('account'); $account = $context->get('account');
if ($account instanceof record) { if ($account instanceof record) {
// Initialized the account // Initialized the account
// Initializing localization // Initializing localization
$localization = $context->get('localization'); $localization = $context->get('localization');
if ($localization) { if ($localization) {
// Initialized localization // Initialized localization
// Initializing the account model // Initializing the account model
$model = new account(); $model = new account();
// Updating the account in the database // Updating the account in the database
$updated = $model->database->read( $updated = $model->database->read(
filter: fn(record $record) => $record->identifier === $account->identifier, filter: fn(record $record) => $record->identifier === $account->identifier,
update: function (record &$record) use ($language) { update: function (record &$record) use ($language) {
// Writing new language value into the record // Writing new language value into the record
$record->language = $language->name; $record->language = $language->name;
}, },
amount: 1 amount: 1
)[0] ?? null; )[0] ?? null;
if ($updated instanceof record) { if ($updated instanceof record) {
// Updated the account in the database // Updated the account in the database
// Writing the updated account into the context variable // Writing the updated account into the context variable
$context->set('account', $updated); $context->set('account', $updated);
middlewares::language($context, new node(function (context $context) use ($account, $updated) { middlewares::language($context, new node(function (context $context) use ($account, $updated) {
// Updated language // Updated language
middlewares::localization($context, new node(function (context $context) use ($account, $updated) { middlewares::localization($context, new node(function (context $context) use ($account, $updated) {
// Updated localization // Updated localization
// Initializing localization // Initializing localization
$localization = $context->get('localization'); $localization = $context->get('localization');
if ($localization) { if ($localization) {
// Initialized localization // Initialized localization
try { try {
// Initializing the old language // Initializing the old language
$old = language::{$account->language}; $old = language::{$account->language};
// Initializing the new language // Initializing the new language
$new = language::{$updated->language}; $new = language::{$updated->language};
// Sending the message // Sending the message
$context->sendMessage('✅ *' . $localization['settings_language_update_success'] . '* ' . ($old->flag() ? $old->flag() . ' ' : '') . $old->label($new) . ' → *' . ($new->flag() ? $new->flag() . ' ' : '') . $new->label($new) . '*') $context->sendMessage('✅ *' . $localization['settings_language_update_success'] . '* ' . ($old->flag() ? $old->flag() . ' ' : '') . $old->label($new) . ' → *' . ($new->flag() ? $new->flag() . ' ' : '') . $new->label($new) . '*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} catch (error $error) { } catch (error $error) {
// Failed to send the message about language update // Failed to send the message about language update
// Sending the message // Sending the message
$context->sendMessage('❎ *' . $localization['settings_language_update_fail']) $context->sendMessage('❎ *' . $localization['settings_language_update_fail'])
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not initialized localization // Not initialized localization
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*') $context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
})); }));
})); }));
} else { } else {
// Not updated the account in the database // Not updated the account in the database
// Sending the message // Sending the message
$context->sendMessage('❎ *' . $localization['settings_language_update_fail']) $context->sendMessage('❎ *' . $localization['settings_language_update_fail'])
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not initialized localization // Not initialized localization
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*') $context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} else { } else {
// Not initialized the account // Not initialized the account
// Sending the message // Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*') $context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) { ->then(function (message $message) use ($context) {
// Ending the conversation process // Ending the conversation process
$context->endConversation(); $context->endConversation();
}); });
} }
} }
} }

View File

@ -14,44 +14,44 @@ namespace mirzaev\deeproots\models\telegram\traits;
*/ */
trait escape trait escape
{ {
/** /**
* Markdown * Markdown
* *
* Escaping for markdown * Escaping for markdown
* *
* @param string $text Text * @param string $text Text
* @param array $exception Symbols excluded from escaping * @param array $exception Symbols excluded from escaping
* *
* @return string Escaped text * @return string Escaped text
*/ */
public static function markdown(string $text, array $exceptions = []): string public static function markdown(string $text, array $exceptions = []): string
{ {
// Initializing the registry of symbols for escaping // Initializing the registry of symbols for escaping
$from = array_diff( $from = array_diff(
[ [
'#', '#',
'*', '*',
'_', '_',
'=', '=',
'.', '.',
'[', '[',
']', ']',
'(', '(',
')', ')',
'-', '-',
'>', '>',
'<', '<',
'!', '!',
'`' '`'
], ],
$exceptions $exceptions
); );
// Initializing the registry of targets for escaping // Initializing the registry of targets for escaping
$to = []; $to = [];
foreach ($from as $symbol) $to[] = "\\$symbol"; foreach ($from as $symbol) $to[] = "\\$symbol";
// Escaping and exit (success) // Escaping and exit (success)
return str_replace($from, $to, $text); return str_replace($from, $to, $text);
} }
} }

View File

@ -78,7 +78,7 @@ $robot->onCommand('repository', [commands::class, 'repository']);
/* $robot->onCommand('projects', [commands::class, 'projects']); */ /* $robot->onCommand('projects', [commands::class, 'projects']); */
$robot->onCommand('author', [commands::class, 'author']); $robot->onCommand('author', [commands::class, 'author']);
$robot->onCommand('society', [commands::class, 'society']); $robot->onCommand('society', [commands::class, 'society']);
/* $robot->onCommand('system_settings', [commands::class, 'system_settings'])->middleware([middlewares::class, 'system_settings']); */ // $robot->onCommand('system_settings', [commands::class, 'system_settings'])->middleware([middlewares::class, 'system']);
// Initializing the robot settings language buttons handlers // Initializing the robot settings language buttons handlers
foreach (language::cases() as $language) { foreach (language::cases() as $language) {

View File

@ -12,14 +12,14 @@ use mirzaev\minimal\controller;
// Templater of views // Templater of views
use Twig\Loader\FilesystemLoader, use Twig\Loader\FilesystemLoader,
Twig\Environment as twig, Twig\Environment as twig,
Twig\Extra\Intl\IntlExtension as intl, Twig\Extra\Intl\IntlExtension as intl,
Twig\TwigFilter, Twig\TwigFilter,
Twig\TwigFunction; Twig\TwigFunction;
// Built-in libraries // Built-in libraries
use ArrayAccess as array_access, use ArrayAccess as array_access,
Error as error; Error as error;
/** /**
* Templater * Templater
@ -38,174 +38,173 @@ use ArrayAccess as array_access,
*/ */
final class templater extends controller implements array_access final class templater extends controller implements array_access
{ {
/** /**
* Twig * Twig
* *
* @var twig $twig Instance of the twig templater * @var twig $twig Instance of the twig templater
*/ */
readonly public twig $twig; readonly public twig $twig;
/** /**
* Variables * Variables
* *
* @var array $variables Registry of view global variables * @var array $variables Registry of view global variables
*/ */
public array $variables = []; public array $variables = [];
/** /**
* Constructor of an instance * Constructor of an instance
* *
* @return void * @return void
*/ */
public function __construct() public function __construct()
{ {
// Initializing the Twig instance // Initializing the Twig instance
$this->twig = new twig(new FilesystemLoader(VIEWS)); $this->twig = new twig(new FilesystemLoader(VIEWS));
// Initializing global variables // Initializing global variables
$this->twig->addGlobal('theme', 'default'); $this->twig->addGlobal('theme', 'default');
$this->twig->addGlobal('server', $_SERVER); $this->twig->addGlobal('server', $_SERVER);
$this->twig->addGlobal('cookies', $_COOKIE); $this->twig->addGlobal('cookies', $_COOKIE);
$this->twig->addGlobal('language', $language = $session?->buffer['language'] ?? language::en); $this->twig->addGlobal('language', $language = $session?->buffer['language'] ?? language::en);
} }
/** /**
* Render * Render
* *
* Render the HTML-document * Render the HTML-document
* *
* @param string $file Related path to a HTML-document * @param string $file Related path to a HTML-document
* @param array $variables Registry of variables to push into registry of global variables * @param array $variables Registry of variables to push into registry of global variables
* *
* @return ?string HTML-document * @return ?string HTML-document
*/ */
public function render(string $file, array $variables = []): ?string public function render(string $file, array $variables = []): ?string
{ {
// Generation and exit (success) // Generation and exit (success)
return $this->twig->render('themes' . DIRECTORY_SEPARATOR . $this->twig->getGlobals()['theme'] . DIRECTORY_SEPARATOR . $file, $variables + $this->variables); return $this->twig->render('themes' . DIRECTORY_SEPARATOR . $this->twig->getGlobals()['theme'] . DIRECTORY_SEPARATOR . $file, $variables + $this->variables);
} }
/** /**
* Write * Write
* *
* Write the variable into the registry of the view global variables * Write the variable into the registry of the view global variables
* *
* @param string $name Name of the variable * @param string $name Name of the variable
* @param mixed $value Value of the variable * @param mixed $value Value of the variable
* *
* @return void * @return void
*/ */
public function __set(string $name, mixed $value = null): void public function __set(string $name, mixed $value = null): void
{ {
// Write the variable and exit (success) // Write the variable and exit (success)
$this->variables[$name] = $value; $this->variables[$name] = $value;
} }
/** /**
* Read * Read
* *
* Read the variable from the registry of the view global variables * Read the variable from the registry of the view global variables
* *
* @param string $name Name of the variable * @param string $name Name of the variable
* *
* @return mixed Content of the variable, if they are found * @return mixed Content of the variable, if they are found
*/ */
public function __get(string $name): mixed public function __get(string $name): mixed
{ {
// Read the variable and exit (success) // Read the variable and exit (success)
return $this->variables[$name]; return $this->variables[$name];
} }
/** /**
* Delete * Delete
* *
* Delete the variable from the registry of the view global variables * Delete the variable from the registry of the view global variables
* *
* @param string $name Name of the variable * @param string $name Name of the variable
* *
* @return void * @return void
*/ */
public function __unset(string $name): void public function __unset(string $name): void
{ {
// Delete the variable and exit (success) // Delete the variable and exit (success)
unset($this->variables[$name]); unset($this->variables[$name]);
} }
/** /**
* Check of initialization * Check of initialization
* *
* Check of initialization in the registry of the view global variables * Check of initialization in the registry of the view global variables
* *
* @param string $name Name of the variable * @param string $name Name of the variable
* *
* @return bool The variable is initialized? * @return bool The variable is initialized?
*/ */
public function __isset(string $name): bool public function __isset(string $name): bool
{ {
// Check of initialization of the variable and exit (success) // Check of initialization of the variable and exit (success)
return isset($this->variables[$name]); return isset($this->variables[$name]);
} }
/** /**
* Write * Write
* *
* Write the variable into the registry of the view global variables * Write the variable into the registry of the view global variables
* *
* @param mixed $name Name of an offset of the variable * @param mixed $name Name of an offset of the variable
* @param mixed $value Value of the variable * @param mixed $value Value of the variable
* *
* @return void * @return void
*/ */
public function offsetSet(mixed $name, mixed $value): void public function offsetSet(mixed $name, mixed $value): void
{ {
// Write the variable and exit (success) // Write the variable and exit (success)
$this->variables[$name] = $value; $this->variables[$name] = $value;
} }
/** /**
* Read * Read
* *
* Read the variable from the registry of the view global variables * Read the variable from the registry of the view global variables
* *
* @param mixed $name Name of the variable * @param mixed $name Name of the variable
* *
* @return mixed Content of the variable, if they are found * @return mixed Content of the variable, if they are found
*/ */
public function offsetGet(mixed $name): mixed public function offsetGet(mixed $name): mixed
{ {
// Read the variable and exit (success) // Read the variable and exit (success)
return $this->variables[$name]; return $this->variables[$name];
} }
/** /**
* Delete * Delete
* *
* Delete the variable from the registry of the view global variables * Delete the variable from the registry of the view global variables
* *
* @param mixed $name Name of the variable * @param mixed $name Name of the variable
* *
* @return void * @return void
*/ */
public function offsetUnset(mixed $name): void public function offsetUnset(mixed $name): void
{ {
// Delete the variable and exit (success) // Delete the variable and exit (success)
unset($this->variables[$name]); unset($this->variables[$name]);
} }
/** /**
* Check of initialization * Check of initialization
* *
* Check of initialization in the registry of the view global variables * Check of initialization in the registry of the view global variables
* *
* @param mixed $name Name of the variable * @param mixed $name Name of the variable
* *
* @return bool The variable is initialized? * @return bool The variable is initialized?
*/ */
public function offsetExists(mixed $name): bool public function offsetExists(mixed $name): bool
{ {
// Check of initialization of the variable and exit (success) // Check of initialization of the variable and exit (success)
return isset($this->variables[$name]); return isset($this->variables[$name]);
} }
} }

View File

@ -2,30 +2,29 @@
<html lang="ru"> <html lang="ru">
<head> <head>
{% use '/themes/default/head.html' with title as head_title, meta as head_meta, css as head_css %} {% use '/themes/default/head.html' with title as head_title, meta as head_meta, css as head_css %}
{% block title %} {% block title %}
{{ block('head_title') }} {{ block('head_title') }}
{% endblock %} {% endblock %}
{% block meta %} {% block meta %}
{{ block('head_meta') }} {{ block('head_meta') }}
{% endblock %} {% endblock %}
{{ block('head_css') }} {{ block('head_css') }}
{% block css %} {% block css %}
{% endblock %} {% endblock %}
</head> </head>
<body> <body>
{% block body %} {% block body %}
{% endblock %} {% endblock %}
{% include '/themes/default/js.html' %} {% include '/themes/default/js.html' %}
{% block js %} {% block js %}
{% endblock %} {% endblock %}
</body> </body>
</html> </html>

View File

@ -14,9 +14,9 @@
{{ block('header') }} {{ block('header') }}
{{ block('aside') }} {{ block('aside') }}
<main> <main>
{% block main %} {% block main %}
{{ main|raw }} {{ main|raw }}
{% endblock %} {% endblock %}
</main> </main>
{{ block('footer') }} {{ block('footer') }}
{% endblock %} {% endblock %}