diff --git a/README.md b/README.md
index 1cd86ee..a681f11 100755
--- a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
-# unchainer
+# Unchainer
Mutual aid Telegram chat-robot
diff --git a/author/project/system/controllers/index.php b/author/project/system/controllers/index.php
deleted file mode 100755
index fda9f84..0000000
--- a/author/project/system/controllers/index.php
+++ /dev/null
@@ -1,70 +0,0 @@
-
- */
-final class index extends core
-{
- /**
- * Errors
- *
- * @var array $errors Registry of errors
- */
- protected array $errors = [
- 'session' => []
- ];
-
- /**
- * Main page
- *
- * @return null
- */
- public function index(): null
- {
- if (str_contains($this->request->headers['accept'], content::any->value)) {
- // Request for any response
-
- // Render page
- $page = $this->view->render('index.html');
-
- // Sending response
- $this->response
- ->start()
- ->clean()
- ->sse()
- ->write($page)
- ->validate($this->request)
- ?->body()
- ->end();
-
- // Deinitializing rendered page
- unset($page);
-
- // Exit (success)
- return null;
- }
-
- // Exit (fail)
- return null;
- }
-}
diff --git a/author/project/system/models/core.php b/author/project/system/models/core.php
deleted file mode 100755
index 426f895..0000000
--- a/author/project/system/models/core.php
+++ /dev/null
@@ -1,230 +0,0 @@
-
- */
-class core extends model
-{
- /**
- * ArangoDB connection daa
- *
- * @var string ARANGODB Path to the file with ArangoDB session connection data
- */
- final public const string ARANGODB = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'settings' . DIRECTORY_SEPARATOR . 'arangodb.php';
-
- /**
- * ArangoDB
- *
- * @var arangodb $arangodb Instance of the ArangoDB session
- */
- protected static arangodb $arangodb;
-
- /**
- * Constructor
- *
- * @param bool $initialize Initialize a model?
- * @param ?arangodb $arangodb Instance of the ArangoDB session
- *
- * @return void
- */
- public function __construct(bool $initialize = true, ?arangodb $arangodb = null)
- {
- // For the extends system
- parent::__construct($initialize);
-
- if ($initialize) {
- // Initializing is requested
-
- // Writing an instance of a session of ArangoDB to the property
- self::$arangodb = $arangodb ?? new arangodb(require static::ARANGODB);
- }
- }
-
- /**
- * Read document from ArangoDB
- *
- * @param string $filter Expression for filtering (AQL)
- * @param string $sort Expression for sorting (AQL)
- * @param int $amount Amount of documents for collect
- * @param int $page Page
- * @param string $return Expression describing the parameters to return (AQL)
- * @param array $parameters Binded parameters for placeholders ['placeholder' => parameter]
- * @param array &$errors Registry of errors
- *
- * @return mixed An array of instances of documents from ArangoDB, if they are found
- */
- public static function _read(
- string $filter = '',
- string $sort = 'd.created DESC, d._key DESC',
- int $amount = 1,
- int $page = 1,
- string $return = 'd',
- array $parameters = [],
- array &$errors = []
- ): _document|static|array|null {
- try {
- if (collection::initialize(static::COLLECTION, static::TYPE)) {
- // Initialized the collection
-
- // Read from ArangoDB
- $result = collection::execute(
- sprintf(
- <<<'AQL'
- FOR d IN @@collection
- %s
- %s
- LIMIT @offset, @amount
- RETURN %s
- AQL,
- empty($filter) ? '' : "FILTER $filter",
- empty($sort) ? '' : "SORT $sort",
- empty($return) ? 'd' : $return
- ),
- [
- '@collection' => static::COLLECTION,
- 'offset' => --$page <= 0 ? 0 : $page * $amount,
- 'amount' => $amount
- ] + $parameters,
- errors: $errors
- );
-
- if ($amount === 1 && $result instanceof _document) {
- // Received only 1 document and @todo rebuild
-
- // Initializing the object
- $object = new static;
-
- if (method_exists($object, '__document')) {
- // Object can implement a document from ArangoDB
-
- // Writing the instance of document from ArangoDB to the implement object
- $object->__document($result);
-
- // Exit (success)
- return $object;
- }
- }
-
- // Exit (success)
- return $result;
- } else throw new exception('Failed to initialize ' . static::TYPE . ' collection: ' . static::COLLECTION);
- } catch (exception $e) {
- // Writing to registry of errors
- $errors[] = [
- 'text' => $e->getMessage(),
- 'file' => $e->getFile(),
- 'line' => $e->getLine(),
- 'stack' => $e->getTrace()
- ];
- }
-
- // Exit (fail)
- return null;
- }
-
- /**
- * Write
- *
- * @param string $name Name of the property
- * @param mixed $value Value of the property
- *
- * @return void
- */
- public function __set(string $name, mixed $value = null): void
- {
- match ($name) {
- 'arangodb' => (function () use ($value) {
- if (isset(static::$arangodb)) throw new exception('Forbidden to reinitialize the ArangoDB session($this::$arangodb)', status::internal_server_error->value);
- else if ($value instanceof arangodb) self::$arangodb = $value;
- else throw new exception('Session of connection to ArangoDB ($this::$arangodb) is need to be mirzaev\arangodb\connection', status::internal_server_error->value);
- })(),
- default => parent::__set($name, $value)
- };
- }
-
- /**
- * Read
- *
- * @param string $name Name of the property
- *
- * @return mixed Content of the property, if they are found
- */
- public function __get(string $name): mixed
- {
- return match ($name) {
- default => parent::__get($name)
- };
- }
-
- /**
- * Delete
- *
- * @param string $name Name of the property
- *
- * @return void
- */
- public function __unset(string $name): void
- {
- // Deleting a property and exit (success)
- parent::__unset($name);
- }
-
- /**
- * Check of initialization
- *
- * @param string $name Name of the property
- *
- * @return bool The property is initialized?
- */
- public function __isset(string $name): bool
- {
- // Check of initialization of the property and exit (success)
- return parent::__isset($name);
- }
-
- /**
- * Call a static property or method
- *
- * @param string $name Name of the property or the method
- * @param array $arguments Arguments for the method
- */
- public static function __callStatic(string $name, array $arguments): mixed
- {
- return match ($name) {
- 'arangodb' => (new static)->__get('arangodb'),
- default => throw new exception("Not found: $name", 500)
- };
- }
-}
-
diff --git a/author/project/system/models/enumerations/session.php b/author/project/system/models/enumerations/session.php
deleted file mode 100755
index 7bc2961..0000000
--- a/author/project/system/models/enumerations/session.php
+++ /dev/null
@@ -1,21 +0,0 @@
-
- */
-enum session
-{
- case hash_only;
- case hash_else_address;
-}
diff --git a/author/project/system/models/interfaces/collection.php b/author/project/system/models/interfaces/collection.php
deleted file mode 100755
index 5f5d712..0000000
--- a/author/project/system/models/interfaces/collection.php
+++ /dev/null
@@ -1,31 +0,0 @@
-
- */
-interface collection
-{
- /**
- * Name of the collection in ArangoDB
- */
- public const string COLLECTION = 'THIS_COLLECTION_SHOULD_NOT_EXIST';
-
- /**
- * Type of the collection in ArangoDB
- */
- public const type TYPE = type::document;
-}
diff --git a/author/project/system/models/interfaces/document.php b/author/project/system/models/interfaces/document.php
deleted file mode 100755
index afd4815..0000000
--- a/author/project/system/models/interfaces/document.php
+++ /dev/null
@@ -1,81 +0,0 @@
-
- */
-interface document
-{
- /**
- * Write
- *
- * Write a property into an instance of the ArangoDB document
- *
- * @param string $name Name of the property
- * @param mixed $value Content of the property
- *
- * @return void
- */
- public function __set(string $name, mixed $value = null): void;
-
- /**
- * Read
- *
- * Read a property from an instance of the ArangoDB docuemnt
- *
- * @param string $name Name of the property
- *
- * @return mixed Content of the property
- */
- public function __get(string $name): mixed;
-
-
- /**
- * Delete
- *
- * Deinitialize the property in an instance of the ArangoDB document
- *
- * @param string $name Name of the property
- *
- * @return void
- */
- public function __unset(string $name): void;
-
- /**
- * Check of initialization
- *
- * Check of initialization of the property into an instance of the ArangoDB document
- *
- * @param string $name Name of the property
- *
- * @return bool The property is initialized?
- */
- public function __isset(string $name): bool;
-
- /**
- * Execute a method
- *
- * Execute a method from an instance of the ArangoDB document
- *
- * @param string $name Name of the method
- * @param array $arguments Arguments for the method
- *
- * @return mixed Result of execution of the method
- */
- public function __call(string $name, array $arguments = []): mixed;
-}
diff --git a/author/project/system/models/session.php b/author/project/system/models/session.php
deleted file mode 100755
index d7e3a1d..0000000
--- a/author/project/system/models/session.php
+++ /dev/null
@@ -1,233 +0,0 @@
-
- */
-final class session extends core implements document_interface, collection_interface
-{
- use status, document_trait, buffer, cart {
- buffer::write as write;
- cart::initialize as cart;
- }
-
- /**
- * Collection name
- *
- * @var string COLLECTION Name of the collection in ArangoDB
- */
- final public const string COLLECTION = 'session';
-
- /**
- * Session verification type
- *
- * @var verification VERIFICATION Type of session verification
- */
- final public const verification VERIFICATION = verification::hash_else_address;
-
- /**
- * Constructor
- *
- * Initialize session and write into the $this->document property
- *
- * @param ?string $hash Hash of the session in ArangoDB
- * @param ?int $expires Date of expiring of the session (used for creating a new session)
- * @param array &$errors Registry of errors
- *
- * @return void
- */
- public function __construct(?string $hash = null, ?int $expires = null, array &$errors = [])
- {
- try {
- if (collection::initialize(static::COLLECTION, static::TYPE, errors: $errors)) {
- // Initialized the collection
-
- if (isset($hash) && $document = $this->hash($hash, errors: $errors)) {
- // Found the instance of the ArangoDB document of session and received a session hash
-
- // Writing document instance of the session from ArangoDB to the property of the implementing object
- $this->__document($document);
- } else if (static::VERIFICATION === verification::hash_else_address && $document = $this->address($_SERVER['REMOTE_ADDR'], errors: $errors)) {
- // Found the instance of the ArangoDB document of session and received a session hash
-
- // Writing document instance of the session from ArangoDB to the property of the implementing object
- $this->__document($document);
- } else {
- // Not found the instance of the ArangoDB document of session
-
- // Initializing a new session and write they into ArangoDB
- $_id = document::write(
- static::COLLECTION,
- [
- 'active' => true,
- 'expires' => $expires ?? time() + 604800,
- 'address' => $_SERVER['REMOTE_ADDR'],
- 'x-forwarded-for' => $_SERVER['HTTP_X_FORWARDED_FOR'] ?? null,
- 'referer' => $_SERVER['HTTP_REFERER'] ?? null,
- 'useragent' => $_SERVER['HTTP_USER_AGENT'] ?? null
- ]
- );
-
- if ($session = collection::execute(
- <<<'AQL'
- FOR d IN @@collection
- FILTER d._id == @_id && d.expires > @time && d.active == true
- RETURN d
- AQL,
- [
- '@collection' => static::COLLECTION,
- '_id' => $_id,
- 'time' => time()
- ],
- errors: $errors
- )) {
- // Found the instance of just created new session
-
- // Generating a hash and write into the instance of the ArangoDB document of session property
- $session->hash = sodium_bin2hex(sodium_crypto_generichash($_id));
-
- if (document::update($session, errors: $errors)) {
- // Writed to ArangoDB
-
- // Writing instance of the session document from ArangoDB to the property of the implementing object
- $this->__document($session);
- } else throw new exception('Failed to write the session data');
- } else throw new exception('Failed to create or find just created session');
- }
- } else throw new exception('Failed to initialize ' . static::TYPE . ' collection: ' . static::COLLECTION);
- } catch (exception $e) {
- // Writing to the registry of errors
- $errors[] = [
- 'text' => $e->getMessage(),
- 'file' => $e->getFile(),
- 'line' => $e->getLine(),
- 'stack' => $e->getTrace()
- ];
- }
- }
-
- /**
- * Search by hash
- *
- * Search for the session in ArangoDB by hash
- *
- * @param string $hash Hash of the session in ArangoDB
- * @param array &$errors Registry of errors
- *
- * @return _document|null instance of document of the session in ArangoDB
- */
- public static function hash(string $hash, array &$errors = []): ?_document
- {
- try {
- if (collection::initialize(static::COLLECTION, static::TYPE, errors: $errors)) {
- // Collection initialized
-
- // Search the session data in ArangoDB
- return collection::execute(
- <<<'AQL'
- FOR d IN @@collection
- FILTER d.hash == @hash && d.expires > @time && d.active == true
- RETURN d
- AQL,
- [
- '@collection' => static::COLLECTION,
- 'hash' => $hash,
- 'time' => time()
- ],
- errors: $errors
- );
- } else throw new exception('Failed to initialize ' . static::TYPE . ' collection: ' . static::COLLECTION);
- } catch (exception $e) {
- // Writing to the registry of errors
- $errors[] = [
- 'text' => $e->getMessage(),
- 'file' => $e->getFile(),
- 'line' => $e->getLine(),
- 'stack' => $e->getTrace()
- ];
- }
-
- // Exit (fail)
- return null;
- }
-
- /**
- * Search by IP-address
- *
- * Search for the session in ArangoDB by IP-address
- *
- * @param string $address IP-address writed to the session in ArangoDB
- * @param array &$errors Registry of errors
- *
- * @return _document|null instance of document of the session in ArangoDB
- */
- public static function address(string $address, array &$errors = []): ?_document
- {
- try {
- if (collection::initialize(static::COLLECTION, static::TYPE, errors: $errors)) {
- // Collection initialized
-
- // Search the session data in ArangoDB
- return collection::execute(
- <<<'AQL'
- FOR d IN @@collection
- FILTER d.address == @address && d.expires > @time && d.active == true
- SORT d.updated DESC
- LIMIT 1
- RETURN d
- AQL,
- [
- '@collection' => static::COLLECTION,
- 'address' => $address,
- 'time' => time()
- ],
- errors: $errors
- );
- } else throw new exception('Failed to initialize ' . static::TYPE . ' collection: ' . static::COLLECTION);
- } catch (exception $e) {
- // Writing to the registry of errors
- $errors[] = [
- 'text' => $e->getMessage(),
- 'file' => $e->getFile(),
- 'line' => $e->getLine(),
- 'stack' => $e->getTrace()
- ];
- }
-
- // Exit (fail)
- return null;
- }}
diff --git a/author/project/system/models/traits/buffer.php b/author/project/system/models/traits/buffer.php
deleted file mode 100755
index b8ee453..0000000
--- a/author/project/system/models/traits/buffer.php
+++ /dev/null
@@ -1,84 +0,0 @@
-
- */
-trait buffer
-{
- /**
- * Write to buffer of the document
- *
- * @param array $data Data for writing (merge)
- * @param array &$errors Registry of errors
- *
- * @return bool Is data has written into the document from ArangoDB?
- */
- public function write(array $data, array &$errors = []): bool
- {
- try {
- if (collection::initialize(static::COLLECTION, static::TYPE, errors: $errors)) {
- // Initialized the collection
-
- // Is the instance of the document from ArangoDB are initialized?
- if (!isset($this->document)) throw new exception('The instance of the sessoin document from ArangoDB is not initialized');
-
- // Writing data into buffer of the instance of the document from ArangoDB
- $this->document->buffer = array_replace_recursive($this->document->buffer ?? [], $data);
-
- // Is the buffer of the instance of the document from ArangoDB exceed 10 megabytes?
- if (mb_strlen(json_encode($this->document->buffer)) > 10485760) throw new exception('The buffer size exceeds 10 megabytes');
-
- // Serializing parameters
- if ($this->document->language instanceof language) $this->document->language = $this->document->language->name;
-
- // Writing to ArangoDB and exit (success)
- return document::update($this->document, errors: $errors);
- } else throw new exception('Failed to initialize ' . static::TYPE . ' collection: ' . static::COLLECTION);
- } catch (exception $e) {
- // Writing to the registry of errors
- $errors[] = [
- 'text' => $e->getMessage(),
- 'file' => $e->getFile(),
- 'line' => $e->getLine(),
- 'stack' => $e->getTrace()
- ];
- }
-
- // Exit (fail)
- return false;
- }
-}
diff --git a/author/project/system/models/traits/document.php b/author/project/system/models/traits/document.php
deleted file mode 100755
index c9741f5..0000000
--- a/author/project/system/models/traits/document.php
+++ /dev/null
@@ -1,206 +0,0 @@
-
- */
-trait document
-{
- /**
- * Document
- *
- * @var _document $document An instance of the document from ArangoDB
- */
- protected readonly _document $document;
-
- /**
- * Constructor
- *
- * @param bool $initialize Initialize a model?
- * @param ?arangodb $arangodb Instance of a session of ArangoDB
- * @param _document|null|false $document An instance of the ArangoDB document
- *
- * @return void
- */
- public function __construct(
- bool $initialize = true,
- ?arangodb $arangodb = null,
- _document|null|false $document = false
- ) {
- // For the extends system
- parent::__construct($initialize, $arangodb);
-
- // Writing to the property
- if ($document instanceof _document) $this->__document($document);
- else if ($document === null) throw new exception('Failed to initialize an instance of the document from ArangoDB');
- }
-
- /**
- * Write or read document
- *
- * @param _document|null $document Instance of document from ArangoDB
- *
- * @return _document|null Instance of document from ArangoDB
- */
- public function __document(?_document $document = null): ?_document
- {
- // Writing a property storing a document instance to ArangoDB
- if ($document) $this->document ??= $document;
-
- // Read a property storing a document instance to ArangoDB and exit (success)
- return $this->document ?? null;
- }
-
- /**
- * Connect
- *
- * @param collecton_interface $document Document
- * @param array &$errors Registry of errors
- *
- * @return string|null The identifier of the created edge of the "connect" collection, if created
- */
- public function connect(collection_interface $document, array &$errors = []): ?string
- {
- try {
- if (collection::initialize(static::COLLECTION, static::TYPE, errors: $errors)) {
- if (collection::initialize(connect::COLLECTION, connect::TYPE, errors: $errors)) {
- if (collection::initialize($document::COLLECTION, $document::TYPE, errors: $errors)) {
- // Initialized collections
-
- if ($this->document instanceof _document) {
- // Initialized instance of the document from ArangoDB
-
- // Writing document and exit (success)
- return framework_document::write(
- connect::COLLECTION,
- [
- '_from' => $document->getId(),
- '_to' => $this->document->getId()
- ],
- errors: $errors
- );
- } else throw new exception('The instance of the document from ArangoDB is not initialized');
- } else throw new exception('Failed to initialize ' . $document::TYPE . ' collection: ' . $document::COLLECTION);
- } else throw new exception('Failed to initialize ' . connect::TYPE . ' collection: ' . connect::COLLECTION);
- } else throw new exception('Failed to initialize ' . static::TYPE . ' collection: ' . static::COLLECTION);
- } catch (exception $e) {
- // Writing to the registry of errors
- $errors[] = [
- 'text' => $e->getMessage(),
- 'file' => $e->getFile(),
- 'line' => $e->getLine(),
- 'stack' => $e->getTrace()
- ];
- }
-
- // Exit (fail)
- return null;
- }
-
- /**
- * Write
- *
- * Write a property into an instance of the ArangoDB document
- *
- * @param string $name Name of the property
- * @param mixed $value Content of the property
- *
- * @return void
- */
- public function __set(string $name, mixed $value = null): void
- {
- // Writing to the property into an instance of the ArangoDB document and exit (success)
- $this->document->{$name} = $value;
- }
-
- /**
- * Read
- *
- * Read a property from an instance of the ArangoDB docuemnt
- *
- * @param string $name Name of the property
- *
- * @return mixed Content of the property
- */
- public function __get(string $name): mixed
- {
- // Read a property from an instance of the ArangoDB document and exit (success)
- return match ($name) {
- default => $this->document->{$name}
- };
- }
-
- /**
- * Delete
- *
- * Deinitialize the property in an instance of the ArangoDB document
- *
- * @param string $name Name of the property
- *
- * @return void
- */
- public function __unset(string $name): void
- {
- // Delete the property in an instance of the ArangoDB document and exit (success)
- unset($this->document->{$name});
- }
-
- /**
- * Check of initialization
- *
- * Check of initialization of the property into an instance of the ArangoDB document
- *
- * @param string $name Name of the property
- *
- * @return bool The property is initialized?
- */
- public function __isset(string $name): bool
- {
- // Check of initializatio nof the property and exit (success)
- return isset($this->document->{$name});
- }
-
- /**
- * Execute a method
- *
- * Execute a method from an instance of the ArangoDB document
- *
- * @param string $name Name of the method
- * @param array $arguments Arguments for the method
- *
- * @return mixed Result of execution of the method
- */
- public function __call(string $name, array $arguments = []): mixed
- {
- // Execute the method and exit (success)
- return method_exists($this->document, $name) ? $this->document->{$name}($arguments) ?? null : null;
- }
-}
diff --git a/author/project/system/models/traits/files.php b/author/project/system/models/traits/files.php
deleted file mode 100755
index f34ae22..0000000
--- a/author/project/system/models/traits/files.php
+++ /dev/null
@@ -1,66 +0,0 @@
-
- */
-trait files
-{
- /**
- * Delete
- *
- * Delete files recursively
- *
- * @param string $directory Directory
- * @param array &$errors Registry of errors
- *
- * @return void
- */
- private static function delete(string $directory, array &$errors = []): void
- {
- try {
- if (file_exists($directory)) {
- // Directory exists
-
- // Deleting descendant files and directories (enter to the recursion)
- foreach (scandir($directory) as $file) {
- if ($file === '.' || $file === '..') continue;
- else if (is_dir("$directory/$file")) static::delete("$directory/$file", $errors);
- else unlink("$directory/$file");
- }
-
- // Deleting the directory
- rmdir($directory);
-
- // Exit (success)
- return;
- } else throw new exception('Directory does not exist');
- } catch (exception $e) {
- // Writing to the registry of errors
- $errors[] = [
- 'text' => $e->getMessage(),
- 'file' => $e->getFile(),
- 'line' => $e->getLine(),
- 'stack' => $e->getTrace()
- ];
- }
-
- // Exit (fail)
- return;
- }
-}
diff --git a/author/project/system/models/traits/status.php b/author/project/system/models/traits/status.php
deleted file mode 100755
index a49171f..0000000
--- a/author/project/system/models/traits/status.php
+++ /dev/null
@@ -1,59 +0,0 @@
-
- */
-trait status
-{
- /**
- * Status
- *
- * Check document by its status
- *
- * @param array &$errors Registry of errors
- *
- * @return ?bool Status, if found
- */
- public function status(array &$errors = []): ?bool
- {
- try {
- // Read from ArangoDB and exit (success)
- return $this->document->active ?? false;
- } catch (exception $e) {
- // Writing to the registry of errors
- $errors[] = [
- 'text' => $e->getMessage(),
- 'file' => $e->getFile(),
- 'line' => $e->getLine(),
- 'stack' => $e->getTrace()
- ];
- }
-
- // Exit (fail)
- return null;
- }
-}
-
diff --git a/author/project/system/public/css/fonts/dejavu.css b/author/project/system/public/css/fonts/dejavu.css
deleted file mode 100755
index 5012ff4..0000000
--- a/author/project/system/public/css/fonts/dejavu.css
+++ /dev/null
@@ -1,34 +0,0 @@
-@font-face {
- font-family: 'DejaVu';
- src: url("/fonts/dejavu/DejaVuLGCSans-ExtraLight.ttf");
- font-weight: 200;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'DejaVu';
- src: url("/fonts/dejavu/DejaVuLGCSans.ttf");
- font-weight: 400;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'DejaVu';
- src: url("/fonts/dejavu/DejaVuLGCSans-Oblique.ttf");
- font-weight: 400;
- font-style: italic;
-}
-
-@font-face {
- font-family: 'DejaVu';
- src: url("/fonts/dejavu/DejaVuLGCSans-Bold.ttf");
- font-weight: 500;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'DejaVu';
- src: url("/fonts/dejavu/DejaVuLGCSans-BoldOblique.ttf");
- font-weight: 500;
- font-style: italic;
-}
diff --git a/author/project/system/public/css/fonts/fira.css b/author/project/system/public/css/fonts/fira.css
deleted file mode 100755
index 074cfc0..0000000
--- a/author/project/system/public/css/fonts/fira.css
+++ /dev/null
@@ -1,139 +0,0 @@
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-Hair.woff2') format('woff2'), url('/fonts/fira/FiraSans-Hair.woff') format('woff');
- font-weight: 100;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-HairItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-HairItalic.woff') format('woff');
- font-weight: 100;
- font-style: italic;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-UltraLight.woff2') format('woff2'), url('/fonts/fira/FiraSans-UltraLight.woff') format('woff');
- font-weight: 200;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-UltraLightItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-UltraLightItalic.woff') format('woff');
- font-weight: 200;
- font-style: italic;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-Light.woff2') format('woff2'), url('/fonts/fira/FiraSans-Light.woff') format('woff');
- font-weight: 300;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-LightItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-LightItalic.woff') format('woff');
- font-weight: 300;
- font-style: italic;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-Regular.woff2') format('woff2'), url('/fonts/fira/FiraSans-Regular.woff') format('woff');
- font-weight: 400;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-Italic.woff2') format('woff2'), url('/fonts/fira/FiraSans-Italic.woff') format('woff');
- font-weight: 400;
- font-style: italic;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraMono-Medium.woff2') format('woff2'), url('/fonts/fira/FiraMono-Medium.woff') format('woff');
- font-weight: 500;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-MediumItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-MediumItalic.woff') format('woff');
- font-weight: 500;
- font-style: italic;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-SemiBold.woff2') format('woff2'), url('/fonts/fira/FiraSans-SemiBold.woff') format('woff');
- font-weight: 600;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-SemiBoldItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-SemiBoldItalic.woff') format('woff');
- font-weight: 600;
- font-style: italic;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-Bold.woff2') format('woff2'), url('/fonts/fira/FiraSans-Bold.woff') format('woff');
- font-weight: 700;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-BoldItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-BoldItalic.woff') format('woff');
- font-weight: 700;
- font-style: italic;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-ExtraBold.woff2') format('woff2'), url('/fonts/fira/FiraSans-ExtraBold.woff') format('woff');
- font-weight: 800;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-ExtraBoldItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-ExtraBoldItalic.woff') format('woff');
- font-weight: 800;
- font-style: italic;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-Heavy.woff2') format('woff2'), url('/fonts/fira/FiraSans-Heavy.woff') format('woff');
- font-weight: 900;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'Fira';
- src: url('/fonts/fira/FiraSans-HeavyItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-HeavyItalic.woff') format('woff');
- font-weight: 900;
- font-style: italic;
-}
-
-@font-face {
- font-family: 'Fira' Mono;
- src: url('/fonts/fira/FiraMono-Regular.woff2') format('woff2'), url('/fonts/fira/FiraMono-Regular.woff') format('woff');
- font-weight: 400;
- font-style: normal;
-}
-
-@font-face {
- font-family: 'Fira' Mono;
- src: url('/fonts/fira/FiraMono-Bold.woff2') format('woff2'), url('/fonts/fira/FiraMono-Bold.woff') format('woff');
- font-weight: 600;
- font-style: normal;
-}
diff --git a/author/project/system/public/css/fonts/hack.css b/author/project/system/public/css/fonts/hack.css
deleted file mode 100755
index ea1ca63..0000000
--- a/author/project/system/public/css/fonts/hack.css
+++ /dev/null
@@ -1,31 +0,0 @@
-@font-face {
- font-family: 'Hack';
- src: url('/fonts/hack/hack-regular.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-regular.woff?sha=3114f1256') format('woff');
- font-weight: 400;
- font-style: normal;
- font-display: swap;
-}
-
-@font-face {
- font-family: 'Hack';
- src: url('/fonts/hack/hack-bold.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-bold.woff?sha=3114f1256') format('woff');
- font-weight: 700;
- font-style: normal;
- font-display: swap;
-}
-
-@font-face {
- font-family: 'Hack';
- src: url('/fonts/hack/hack-italic.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-italic.woff?sha=3114f1256') format('woff');
- font-weight: 400;
- font-style: italic;
- font-display: swap;
-}
-
-@font-face {
- font-family: 'Hack';
- src: url('/fonts/hack/hack-bolditalic.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-bolditalic.woff?sha=3114f1256') format('woff');
- font-weight: 700;
- font-style: italic;
- font-display: swap;
-}
diff --git a/author/project/system/public/fonts/commissioner.ttf b/author/project/system/public/fonts/commissioner.ttf
deleted file mode 100755
index 5072c39..0000000
Binary files a/author/project/system/public/fonts/commissioner.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Bold.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Bold.ttf
deleted file mode 100755
index 78584c4..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Bold.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-BoldOblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-BoldOblique.ttf
deleted file mode 100755
index a013892..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-BoldOblique.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-ExtraLight.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-ExtraLight.ttf
deleted file mode 100755
index 60dd47e..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-ExtraLight.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Oblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Oblique.ttf
deleted file mode 100755
index 37e6daf..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Oblique.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSans.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSans.ttf
deleted file mode 100755
index 6060dfb..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSans.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Bold.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Bold.ttf
deleted file mode 100755
index 68908d7..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Bold.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-BoldOblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-BoldOblique.ttf
deleted file mode 100755
index 1a2d58d..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-BoldOblique.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Oblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Oblique.ttf
deleted file mode 100755
index 6d25e67..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Oblique.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed.ttf
deleted file mode 100755
index 95aaba6..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Bold.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Bold.ttf
deleted file mode 100755
index c2465b3..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Bold.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-BoldOblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-BoldOblique.ttf
deleted file mode 100755
index 303202f..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-BoldOblique.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Oblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Oblique.ttf
deleted file mode 100755
index 1df5133..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Oblique.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono.ttf
deleted file mode 100755
index 3206a82..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Bold.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Bold.ttf
deleted file mode 100755
index 2be31a1..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Bold.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-BoldItalic.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-BoldItalic.ttf
deleted file mode 100755
index 2c6daba..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-BoldItalic.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Italic.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Italic.ttf
deleted file mode 100755
index c52d49f..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Italic.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif.ttf
deleted file mode 100755
index 046c102..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Bold.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Bold.ttf
deleted file mode 100755
index fc164c7..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Bold.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-BoldItalic.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-BoldItalic.ttf
deleted file mode 100755
index f01089d..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-BoldItalic.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Italic.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Italic.ttf
deleted file mode 100755
index 6254c8b..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Italic.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed.ttf
deleted file mode 100755
index 6e42557..0000000
Binary files a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed.ttf and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraMono-Bold.woff b/author/project/system/public/fonts/fira/FiraMono-Bold.woff
deleted file mode 100755
index e7da594..0000000
Binary files a/author/project/system/public/fonts/fira/FiraMono-Bold.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraMono-Bold.woff2 b/author/project/system/public/fonts/fira/FiraMono-Bold.woff2
deleted file mode 100755
index 7a3a102..0000000
Binary files a/author/project/system/public/fonts/fira/FiraMono-Bold.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraMono-Medium.woff b/author/project/system/public/fonts/fira/FiraMono-Medium.woff
deleted file mode 100755
index f08fde9..0000000
Binary files a/author/project/system/public/fonts/fira/FiraMono-Medium.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraMono-Medium.woff2 b/author/project/system/public/fonts/fira/FiraMono-Medium.woff2
deleted file mode 100755
index 3c9553d..0000000
Binary files a/author/project/system/public/fonts/fira/FiraMono-Medium.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraMono-Regular.woff b/author/project/system/public/fonts/fira/FiraMono-Regular.woff
deleted file mode 100755
index 64e33d3..0000000
Binary files a/author/project/system/public/fonts/fira/FiraMono-Regular.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraMono-Regular.woff2 b/author/project/system/public/fonts/fira/FiraMono-Regular.woff2
deleted file mode 100755
index bb452d4..0000000
Binary files a/author/project/system/public/fonts/fira/FiraMono-Regular.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Bold.woff b/author/project/system/public/fonts/fira/FiraSans-Bold.woff
deleted file mode 100755
index 8001b79..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Bold.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Bold.woff2 b/author/project/system/public/fonts/fira/FiraSans-Bold.woff2
deleted file mode 100755
index ce8013e..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Bold.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff b/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff
deleted file mode 100755
index 9c1da3a..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff2
deleted file mode 100755
index cf90d9a..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Book.woff b/author/project/system/public/fonts/fira/FiraSans-Book.woff
deleted file mode 100755
index 299c884..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Book.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Book.woff2 b/author/project/system/public/fonts/fira/FiraSans-Book.woff2
deleted file mode 100755
index 6f9e54d..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Book.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff b/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff
deleted file mode 100755
index cc29ba7..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff2
deleted file mode 100755
index 1275913..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Eight.woff b/author/project/system/public/fonts/fira/FiraSans-Eight.woff
deleted file mode 100755
index 9261a69..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Eight.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Eight.woff2 b/author/project/system/public/fonts/fira/FiraSans-Eight.woff2
deleted file mode 100755
index 729ba54..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Eight.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff b/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff
deleted file mode 100755
index 000003c..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff2
deleted file mode 100755
index e651af6..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff b/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff
deleted file mode 100755
index 8289f9f..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff2 b/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff2
deleted file mode 100755
index a14dbce..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff b/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff
deleted file mode 100755
index 5dfa8da..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff2
deleted file mode 100755
index 828a57d..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff b/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff
deleted file mode 100755
index 16ec788..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff2 b/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff2
deleted file mode 100755
index 8e98c42..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff b/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff
deleted file mode 100755
index 99ce8e5..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff2
deleted file mode 100755
index 2ea8212..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Four.woff b/author/project/system/public/fonts/fira/FiraSans-Four.woff
deleted file mode 100755
index 518fd5f..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Four.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Four.woff2 b/author/project/system/public/fonts/fira/FiraSans-Four.woff2
deleted file mode 100755
index 33473a6..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Four.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff b/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff
deleted file mode 100755
index b407c43..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff2
deleted file mode 100755
index 0e64a9c..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Hair.woff b/author/project/system/public/fonts/fira/FiraSans-Hair.woff
deleted file mode 100755
index ce65bcc..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Hair.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Hair.woff2 b/author/project/system/public/fonts/fira/FiraSans-Hair.woff2
deleted file mode 100755
index 64cef84..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Hair.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff b/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff
deleted file mode 100755
index 08abd3a..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff2
deleted file mode 100755
index b063e87..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Heavy.woff b/author/project/system/public/fonts/fira/FiraSans-Heavy.woff
deleted file mode 100755
index ff18652..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Heavy.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Heavy.woff2 b/author/project/system/public/fonts/fira/FiraSans-Heavy.woff2
deleted file mode 100755
index 0cafdba..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Heavy.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff b/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff
deleted file mode 100755
index 77c1d55..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff2
deleted file mode 100755
index 8d48a7f..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Italic.woff b/author/project/system/public/fonts/fira/FiraSans-Italic.woff
deleted file mode 100755
index d200976..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Italic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Italic.woff2 b/author/project/system/public/fonts/fira/FiraSans-Italic.woff2
deleted file mode 100755
index f7857e9..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Italic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Light.woff b/author/project/system/public/fonts/fira/FiraSans-Light.woff
deleted file mode 100755
index 309ecf2..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Light.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Light.woff2 b/author/project/system/public/fonts/fira/FiraSans-Light.woff2
deleted file mode 100755
index 24e6444..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Light.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff b/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff
deleted file mode 100755
index 9f3c250..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff2
deleted file mode 100755
index f456ca5..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Medium.woff b/author/project/system/public/fonts/fira/FiraSans-Medium.woff
deleted file mode 100755
index 1701b41..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Medium.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Medium.woff2 b/author/project/system/public/fonts/fira/FiraSans-Medium.woff2
deleted file mode 100755
index 71d8ed5..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Medium.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff b/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff
deleted file mode 100755
index 029099b..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff2
deleted file mode 100755
index 97b96c6..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Regular.woff b/author/project/system/public/fonts/fira/FiraSans-Regular.woff
deleted file mode 100755
index 10c41a7..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Regular.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Regular.woff2 b/author/project/system/public/fonts/fira/FiraSans-Regular.woff2
deleted file mode 100755
index f77c427..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Regular.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff b/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff
deleted file mode 100755
index 3ccdeb4..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff2 b/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff2
deleted file mode 100755
index 29ef538..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff b/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff
deleted file mode 100755
index 378fde9..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff2
deleted file mode 100755
index 91182a7..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Thin.woff b/author/project/system/public/fonts/fira/FiraSans-Thin.woff
deleted file mode 100755
index 21e509d..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Thin.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Thin.woff2 b/author/project/system/public/fonts/fira/FiraSans-Thin.woff2
deleted file mode 100755
index c494caa..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Thin.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff b/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff
deleted file mode 100755
index a75b761..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff2
deleted file mode 100755
index 4f432d6..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Two.woff b/author/project/system/public/fonts/fira/FiraSans-Two.woff
deleted file mode 100755
index 3b77a84..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Two.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Two.woff2 b/author/project/system/public/fonts/fira/FiraSans-Two.woff2
deleted file mode 100755
index 6842f0c..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Two.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff b/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff
deleted file mode 100755
index c2a549d..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff2
deleted file mode 100755
index 6b176c7..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Ultra.woff b/author/project/system/public/fonts/fira/FiraSans-Ultra.woff
deleted file mode 100755
index 705346e..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Ultra.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-Ultra.woff2 b/author/project/system/public/fonts/fira/FiraSans-Ultra.woff2
deleted file mode 100755
index 25e5e6a..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-Ultra.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff b/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff
deleted file mode 100755
index 1790a76..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff2
deleted file mode 100755
index 7b9b43b..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff b/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff
deleted file mode 100755
index cbc1f31..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff2 b/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff2
deleted file mode 100755
index 82046b1..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff b/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff
deleted file mode 100755
index 5f0ef24..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff2
deleted file mode 100755
index a50a5df..0000000
Binary files a/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-bold-subset.woff b/author/project/system/public/fonts/hack/hack-bold-subset.woff
deleted file mode 100755
index 99e9e7b..0000000
Binary files a/author/project/system/public/fonts/hack/hack-bold-subset.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-bold-subset.woff2 b/author/project/system/public/fonts/hack/hack-bold-subset.woff2
deleted file mode 100755
index ae3694f..0000000
Binary files a/author/project/system/public/fonts/hack/hack-bold-subset.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-bold.woff b/author/project/system/public/fonts/hack/hack-bold.woff
deleted file mode 100755
index 7a64513..0000000
Binary files a/author/project/system/public/fonts/hack/hack-bold.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-bold.woff2 b/author/project/system/public/fonts/hack/hack-bold.woff2
deleted file mode 100755
index a25b27d..0000000
Binary files a/author/project/system/public/fonts/hack/hack-bold.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-bolditalic-subset.woff b/author/project/system/public/fonts/hack/hack-bolditalic-subset.woff
deleted file mode 100755
index 91399f9..0000000
Binary files a/author/project/system/public/fonts/hack/hack-bolditalic-subset.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-bolditalic-subset.woff2 b/author/project/system/public/fonts/hack/hack-bolditalic-subset.woff2
deleted file mode 100755
index 55d67b8..0000000
Binary files a/author/project/system/public/fonts/hack/hack-bolditalic-subset.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-bolditalic.woff b/author/project/system/public/fonts/hack/hack-bolditalic.woff
deleted file mode 100755
index 993d05a..0000000
Binary files a/author/project/system/public/fonts/hack/hack-bolditalic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-bolditalic.woff2 b/author/project/system/public/fonts/hack/hack-bolditalic.woff2
deleted file mode 100755
index 5415871..0000000
Binary files a/author/project/system/public/fonts/hack/hack-bolditalic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-italic-subset.woff b/author/project/system/public/fonts/hack/hack-italic-subset.woff
deleted file mode 100755
index 4d747c7..0000000
Binary files a/author/project/system/public/fonts/hack/hack-italic-subset.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-italic-subset.woff2 b/author/project/system/public/fonts/hack/hack-italic-subset.woff2
deleted file mode 100755
index bbb6240..0000000
Binary files a/author/project/system/public/fonts/hack/hack-italic-subset.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-italic.woff b/author/project/system/public/fonts/hack/hack-italic.woff
deleted file mode 100755
index b79f9e4..0000000
Binary files a/author/project/system/public/fonts/hack/hack-italic.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-italic.woff2 b/author/project/system/public/fonts/hack/hack-italic.woff2
deleted file mode 100755
index 40522cc..0000000
Binary files a/author/project/system/public/fonts/hack/hack-italic.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-regular-subset.woff b/author/project/system/public/fonts/hack/hack-regular-subset.woff
deleted file mode 100755
index 65a07e4..0000000
Binary files a/author/project/system/public/fonts/hack/hack-regular-subset.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-regular-subset.woff2 b/author/project/system/public/fonts/hack/hack-regular-subset.woff2
deleted file mode 100755
index ae9eca7..0000000
Binary files a/author/project/system/public/fonts/hack/hack-regular-subset.woff2 and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-regular.woff b/author/project/system/public/fonts/hack/hack-regular.woff
deleted file mode 100755
index 07d1b32..0000000
Binary files a/author/project/system/public/fonts/hack/hack-regular.woff and /dev/null differ
diff --git a/author/project/system/public/fonts/hack/hack-regular.woff2 b/author/project/system/public/fonts/hack/hack-regular.woff2
deleted file mode 100755
index cc862c7..0000000
Binary files a/author/project/system/public/fonts/hack/hack-regular.woff2 and /dev/null differ
diff --git a/author/project/system/public/index.php b/author/project/system/public/index.php
deleted file mode 100755
index 7eba2a5..0000000
--- a/author/project/system/public/index.php
+++ /dev/null
@@ -1,46 +0,0 @@
-router
- ->write('/', new route('index', 'index'), 'GET')
-;
-
-// Handling request
-$core->start();
diff --git a/author/project/system/public/themes/default/css/aside.css b/author/project/system/public/themes/default/css/aside.css
deleted file mode 100644
index faf9c91..0000000
--- a/author/project/system/public/themes/default/css/aside.css
+++ /dev/null
@@ -1,4 +0,0 @@
-@charset "UTF-8";
-
-aside {
-}
diff --git a/author/project/system/public/themes/default/css/colors.css b/author/project/system/public/themes/default/css/colors.css
deleted file mode 100644
index 9eaf50b..0000000
--- a/author/project/system/public/themes/default/css/colors.css
+++ /dev/null
@@ -1,37 +0,0 @@
-@charset "UTF-8";
-
-@media (prefers-color-scheme: dark) {
- :root {
- --text-color: initial;
- --text-color-hover: initial;
- --text-color-active: initial;
- --text-notice-color: initial;
- --text-warning-color: initial;
- --text-selected-color: initial;
- --text-selected-background-color: initial;
-
- --link-color: initial;
- --link-color-hover: initial;
- --link-color-active: initial;
-
- color: var(--text-color);
- }
-}
-
-@media (prefers-color-scheme: light) {
- :root {
- --text-color: initial;
- --text-color-hover: initial;
- --text-color-active: initial;
- --text-notice-color: initial;
- --text-warning-color: initial;
- --text-selected-color: initial;
- --text-selected-background-color: initial;
-
- --link-color: initial;
- --link-color-hover: initial;
- --link-color-active: initial;
-
- color: var(--text-color);
- }
-}
diff --git a/author/project/system/public/themes/default/css/fonts.css b/author/project/system/public/themes/default/css/fonts.css
deleted file mode 100755
index 84f16b4..0000000
--- a/author/project/system/public/themes/default/css/fonts.css
+++ /dev/null
@@ -1,9 +0,0 @@
-@import url('/css/fonts/fira.css');
-@import url('/css/fonts/hack.css');
-@import url('/css/fonts/dejavu.css');
-
-@font-face {
- font-family: 'Commissioner';
- src: url('/fonts/commissioner.ttf');
- font-weight: 400;
-}
diff --git a/author/project/system/public/themes/default/css/footer.css b/author/project/system/public/themes/default/css/footer.css
deleted file mode 100644
index 605243b..0000000
--- a/author/project/system/public/themes/default/css/footer.css
+++ /dev/null
@@ -1,4 +0,0 @@
-@charset "UTF-8";
-
-footer {
-}
\ No newline at end of file
diff --git a/author/project/system/public/themes/default/css/header.css b/author/project/system/public/themes/default/css/header.css
deleted file mode 100644
index b440dd5..0000000
--- a/author/project/system/public/themes/default/css/header.css
+++ /dev/null
@@ -1,4 +0,0 @@
-@charset "UTF-8";
-
-header {
-}
diff --git a/author/project/system/public/themes/default/css/main.css b/author/project/system/public/themes/default/css/main.css
deleted file mode 100755
index ac799a9..0000000
--- a/author/project/system/public/themes/default/css/main.css
+++ /dev/null
@@ -1,9 +0,0 @@
-@charset "UTF-8";
-
-main {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: var(--gap);
- transition: 0s;
-}
\ No newline at end of file
diff --git a/author/project/system/public/themes/default/css/system.css b/author/project/system/public/themes/default/css/system.css
deleted file mode 100644
index 1137f56..0000000
--- a/author/project/system/public/themes/default/css/system.css
+++ /dev/null
@@ -1,34 +0,0 @@
-@charset "UTF-8";
-
-:root {
- --gap: min(12px, 1rem);
-
- /* font-family: , system-ui, sans-serif; */
- font-family: "dejavu";
- text-decoration: none;
- outline: none;
- border: none;
- transition: 0.1s ease-out;
-}
-
-/* Selection */
-::selection {
- color: var(--text-selected-color);
- background: var(--text-selected-background-color);
-}
-
-::-moz-selection {
- color: var(--text-selected-color);
- background: var(--text-selected-background-color);
-}
-
-
-.unselectable {
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-
diff --git a/author/project/system/settings/arangodb.php.sample b/author/project/system/settings/arangodb.php.sample
deleted file mode 100755
index df2836a..0000000
--- a/author/project/system/settings/arangodb.php.sample
+++ /dev/null
@@ -1,8 +0,0 @@
- 'unix:///var/run/arangodb3/arango.sock',
- 'database' => 'unchainer',
- 'name' => 'unchainer',
- 'password' => ''
-];
diff --git a/author/project/system/views/templater.php b/author/project/system/views/templater.php
deleted file mode 100755
index c7f5f3d..0000000
--- a/author/project/system/views/templater.php
+++ /dev/null
@@ -1,214 +0,0 @@
-
- */
-final class templater extends controller implements array_access
-{
- /**
- * Twig
- *
- * @var twig $twig Instance of the twig templater
- */
- readonly public twig $twig;
-
- /**
- * Variables
- *
- * @var array $variables Registry of view global variables
- */
- public array $variables = [];
-
- /**
- * Constructor of an instance
- *
- * @param ?session $session Instance of the session in ArangoDB
- *
- * @return void
- */
- public function __construct(?session &$session = null)
- {
- // Initializing the Twig instance
- $this->twig = new twig(new FilesystemLoader(VIEWS));
-
- // Initializing global variables
- $this->twig->addGlobal('theme', 'default');
- $this->twig->addGlobal('server', $_SERVER);
- $this->twig->addGlobal('cookies', $_COOKIE);
- if (!empty($session->status())) $this->twig->addGlobal('session', $session);
- $this->twig->addGlobal('language', $language = $session?->buffer['language'] ?? language::en);
- }
-
- /**
- * Render
- *
- * Render the HTML-document
- *
- * @param string $file Related path to a HTML-document
- * @param array $variables Registry of variables to push into registry of global variables
- *
- * @return ?string HTML-document
- */
- public function render(string $file, array $variables = []): ?string
- {
- // Generation and exit (success)
- return $this->twig->render('themes' . DIRECTORY_SEPARATOR . $this->twig->getGlobals()['theme'] . DIRECTORY_SEPARATOR . $file, $variables + $this->variables);
-
- }
-
- /**
- * Write
- *
- * Write the variable into the registry of the view global variables
- *
- * @param string $name Name of the variable
- * @param mixed $value Value of the variable
- *
- * @return void
- */
- public function __set(string $name, mixed $value = null): void
- {
- // Write the variable and exit (success)
- $this->variables[$name] = $value;
- }
-
- /**
- * Read
- *
- * Read the variable from the registry of the view global variables
- *
- * @param string $name Name of the variable
- *
- * @return mixed Content of the variable, if they are found
- */
- public function __get(string $name): mixed
- {
- // Read the variable and exit (success)
- return $this->variables[$name];
- }
-
- /**
- * Delete
- *
- * Delete the variable from the registry of the view global variables
- *
- * @param string $name Name of the variable
- *
- * @return void
- */
- public function __unset(string $name): void
- {
- // Delete the variable and exit (success)
- unset($this->variables[$name]);
- }
-
- /**
- * Check of initialization
- *
- * Check of initialization in the registry of the view global variables
- *
- * @param string $name Name of the variable
- *
- * @return bool The variable is initialized?
- */
- public function __isset(string $name): bool
- {
- // Check of initialization of the variable and exit (success)
- return isset($this->variables[$name]);
- }
-
- /**
- * Write
- *
- * Write the variable into the registry of the view global variables
- *
- * @param mixed $name Name of an offset of the variable
- * @param mixed $value Value of the variable
- *
- * @return void
- */
- public function offsetSet(mixed $name, mixed $value): void
- {
- // Write the variable and exit (success)
- $this->variables[$name] = $value;
- }
-
- /**
- * Read
- *
- * Read the variable from the registry of the view global variables
- *
- * @param mixed $name Name of the variable
- *
- * @return mixed Content of the variable, if they are found
- */
- public function offsetGet(mixed $name): mixed
- {
- // Read the variable and exit (success)
- return $this->variables[$name];
- }
-
- /**
- * Delete
- *
- * Delete the variable from the registry of the view global variables
- *
- * @param mixed $name Name of the variable
- *
- * @return void
- */
- public function offsetUnset(mixed $name): void
- {
- // Delete the variable and exit (success)
- unset($this->variables[$name]);
- }
-
- /**
- * Check of initialization
- *
- * Check of initialization in the registry of the view global variables
- *
- * @param mixed $name Name of the variable
- *
- * @return bool The variable is initialized?
- */
- public function offsetExists(mixed $name): bool
- {
- // Check of initialization of the variable and exit (success)
- return isset($this->variables[$name]);
- }
-}
-
diff --git a/author/project/system/views/themes/default/aside.html b/author/project/system/views/themes/default/aside.html
deleted file mode 100644
index afb2aa1..0000000
--- a/author/project/system/views/themes/default/aside.html
+++ /dev/null
@@ -1,10 +0,0 @@
-{% block css %}
-{% endblock %}
-
-{% block body %}
-
-{% endblock %}
-
-{% block js %}
-{% endblock %}
\ No newline at end of file
diff --git a/author/project/system/views/themes/default/core.html b/author/project/system/views/themes/default/core.html
deleted file mode 100755
index 1bb43a7..0000000
--- a/author/project/system/views/themes/default/core.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
- {% use '/themes/default/head.html' with title as head_title, meta as head_meta, css as head_css %}
-
- {% block title %}
- {{ block('head_title') }}
- {% endblock %}
-
- {% block meta %}
- {{ block('head_meta') }}
- {% endblock %}
-
- {{ block('head_css') }}
- {% block css %}
- {% endblock %}
-
-
-
- {% block body %}
- {% endblock %}
-
- {% include '/themes/default/js.html' %}
- {% block js %}
- {% endblock %}
-
-
-
-
diff --git a/author/project/system/views/themes/default/footer.html b/author/project/system/views/themes/default/footer.html
deleted file mode 100755
index 8322f33..0000000
--- a/author/project/system/views/themes/default/footer.html
+++ /dev/null
@@ -1,10 +0,0 @@
-{% block css %}
-{% endblock %}
-
-{% block body %}
-
-{% endblock %}
-
-{% block js %}
-{% endblock %}
diff --git a/author/project/system/views/themes/default/head.html b/author/project/system/views/themes/default/head.html
deleted file mode 100755
index 0be0e8b..0000000
--- a/author/project/system/views/themes/default/head.html
+++ /dev/null
@@ -1,24 +0,0 @@
-{% block title %}
-{% if head.title != empty %}{{ head.title }}{% else %}unchainer by mirzaev{% endif %}
-{% endblock %}
-
-{% block meta %}
-
-
-{% for meta in head.metas %}
-
-{% endfor %}
-{% endblock %}
-
-{% block css %}
-{% for element in css %}
-
-{% endfor %}
-
-
-
-
-
-
-
-{% endblock %}
diff --git a/author/project/system/views/themes/default/header.html b/author/project/system/views/themes/default/header.html
deleted file mode 100755
index 430650a..0000000
--- a/author/project/system/views/themes/default/header.html
+++ /dev/null
@@ -1,10 +0,0 @@
-{% block css %}
-{% endblock %}
-
-{% block body %}
-
-{% endblock %}
-
-{% block js %}
-{% endblock %}
diff --git a/author/project/system/views/themes/default/index.html b/author/project/system/views/themes/default/index.html
deleted file mode 100755
index 474fd75..0000000
--- a/author/project/system/views/themes/default/index.html
+++ /dev/null
@@ -1,28 +0,0 @@
-{% extends "/themes/default/core.html" %}
-
-{% use "/themes/default/header.html" with css as header_css, body as header, js as header_js %}
-{% use "/themes/default/aside.html" with css as aside_css, body as aside, js as aside_js %}
-{% use "/themes/default/footer.html" with css as footer_css, body as footer, js as footer_js %}
-
-{% block css %}
-{{ block('header_css') }}
-{{ block('aside_css') }}
-{{ block('footer_css') }}
-{% endblock %}
-
-{% block body %}
-{{ block('header') }}
-{{ block('aside') }}
-
- {% block main %}
- {{ main|raw }}
- {% endblock %}
-
-{{ block('footer') }}
-{% endblock %}
-
-{% block js %}
-{{ block('footer_js') }}
-{{ block('header_js') }}
-{{ block('aside_js') }}
-{% endblock %}
diff --git a/author/project/system/views/themes/default/js.html b/author/project/system/views/themes/default/js.html
deleted file mode 100755
index 784e58d..0000000
--- a/author/project/system/views/themes/default/js.html
+++ /dev/null
@@ -1,5 +0,0 @@
-{% block js %}
-{% for element in js %}
-
-{% endfor %}
-{% endblock %}
diff --git a/composer.json b/composer.json
index 3adfce9..be402ab 100755
--- a/composer.json
+++ b/composer.json
@@ -1,36 +1,36 @@
{
"name": "mirzaev/unchainer",
"description": "Mutual aid Telegram chat-robot",
- "homepage": "https://git.mirzaev.sexy/mirzaev/unchainer",
- "type": "site",
+ "homepage": "https://git.svoboda.works/mirzaev/unchainer",
+ "type": "chat-robot",
"keywords": [
- "minimal"
+ "mirzaev",
+ "telegram",
+ "minimal",
+ "mutual aid",
+ "anarchism"
],
"readme": "README.md",
"license": "WTFPL",
"authors": [
{
- "name": "mirzaev",
- "email": "mirzaev@gmail.com",
- "homepage": "https://mirzaev.page",
+ "name": "Arsen Mirzaev Tatyano-Muradovich",
+ "email": "arsen@mirzaev.sexy",
+ "homepage": "https://mirzaev.sexy",
"role": "Programmer"
}
],
"support": {
- "wiki": "https://git.mirzaev.sexy/mirzaev/unchainer/wiki",
- "issues": "https://git.mirzaev.sexy/mirzaev/unchainer/issues"
+ "wiki": "https://git.svoboda.works/mirzaev/unchainer/wiki",
+ "issues": "https://git.svoboda.works/mirzaev/unchainer/issues"
},
"require": {
"php": "^8.4",
- "triagens/arangodb": "^3.8",
- "mirzaev/minimal": "^3.2.0",
- "mirzaev/arangodb": "^1.3",
- "twig/twig": "^3.10",
- "twig/extra-bundle": "^3.7",
- "twig/intl-extra": "^3.10"
- },
- "require-dev": {
- "phpunit/phpunit": "~9.5"
+ "mirzaev/minimal": "^3.4.0",
+ "mirzaev/baza": "^3.1.0",
+ "svoboda/time": "^1.0",
+ "badfarm/zanzara": "^0.9.1",
+ "react/filesystem": "^0.1.2"
},
"autoload": {
"psr-4": {
@@ -44,5 +44,11 @@
},
"scripts": {
"pre-update-cmd": "./install.sh"
+ },
+ "config": {
+ "allow-plugins": {
+ "php-http/discovery": false,
+ "wyrihaximus/composer-update-bin-autoload-path": true
+ }
}
}
diff --git a/examples/systemd/unchainer-telegram.service b/examples/systemd/unchainer-telegram.service
new file mode 100755
index 0000000..9584814
--- /dev/null
+++ b/examples/systemd/unchainer-telegram.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Telegram chat-robot: @domain_of_your_robot_here
+
+Wants=network.target
+After=syslog.target network-online.target
+
+[Service]
+ExecStart=sudo -u www-data /usr/bin/php /var/www/project/mirzaev/unchainer/system/public/telegram.php
+PIDFile=/var/run/php/unchainer-telegram.pid
+RemainAfterExit=no
+RuntimeMaxSec=3600s
+Restart=always
+RestartSec=5s
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/author/project/system/controllers/core.php b/mirzaev/unchainer/system/controllers/core.php
similarity index 50%
rename from author/project/system/controllers/core.php
rename to mirzaev/unchainer/system/controllers/core.php
index fdda609..80aeb9e 100755
--- a/author/project/system/controllers/core.php
+++ b/mirzaev/unchainer/system/controllers/core.php
@@ -2,13 +2,10 @@
declare(strict_types=1);
-namespace mirzaev\unchainer\controllers;
+namespace svoboda\negotiator\controllers;
// Files of the project
-use mirzaev\unchainer\views\templater,
- mirzaev\unchainer\models\core as models,
- mirzaev\unchainer\models\session,
- mirzaev\unchainer\models\enumerations\language;
+use svoboda\negotiator\models\core as models;
// Framework for PHP
use mirzaev\minimal\core as minimal,
@@ -19,9 +16,8 @@ use mirzaev\minimal\core as minimal,
/**
* Controllers core
*
- * @package mirzaev\unchainer\controllers
+ * @package svoboda\negotiator\controllers
*
- * @param session $session Instance of the session
* @param language $language Language
* @param response $response Response
* @param array $errors Registry of errors
@@ -29,17 +25,10 @@ use mirzaev\minimal\core as minimal,
* @method void __construct(minimal $minimal, bool $initialize) Constructor
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
- * @author mirzaev
+ * @author svoboda
*/
class core extends controller
{
- /**
- * Session
- *
- * @var session|null $session Instance of the session
- */
- protected readonly session $session;
-
/**
* Language
*
@@ -65,8 +54,6 @@ class core extends controller
* @var array $errors Registry of errors
*/
protected array $errors = [
- 'session' => [],
- 'account' => []
];
/**
@@ -84,43 +71,5 @@ class core extends controller
// For the extends system
parent::__construct(core: $core);
-
- if ($initialize) {
- // Requestet initializing
-
- // Initializing core of the models
- new models();
-
- // Initializing of the date until which the session will be active
- $expires = strtotime('+1 week');
-
- // Initializing of default value of hash of the session
- $_COOKIE["session"] ??= null;
-
- // Initializing of session
- $this->session = new session($_COOKIE["session"], $expires, $this->errors['session']);
-
- // Handle a problems with initializing a session
- if (!empty($this->errors['session'])) die;
- else if ($_COOKIE["session"] !== $this->session->hash) {
- // Hash of the session is changed (implies that the session has expired and recreated)
-
- // Write a new hash of the session to cookies
- setcookie(
- 'session',
- $this->session->hash,
- [
- 'expires' => $expires,
- 'path' => '/',
- 'secure' => true,
- 'httponly' => true,
- 'samesite' => 'strict'
- ]
- );
- }
-
- // Initializing of preprocessor of views
- $this->view = new templater($this->session);
- }
}
}
diff --git a/mirzaev/unchainer/system/localizations/english.php b/mirzaev/unchainer/system/localizations/english.php
new file mode 100644
index 0000000..4ef4825
--- /dev/null
+++ b/mirzaev/unchainer/system/localizations/english.php
@@ -0,0 +1,39 @@
+ 'Svoboda',
+ 'empty' => 'Empty',
+
+ // Main menu
+ 'menu_title' => 'Main menu',
+ 'menu_requests' => 'Requests:',
+ 'menu_accounts' => 'Accounts:',
+ 'menu_foundation' => 'Foundation reserve:',
+ 'menu_statistic_day' => 'Day:',
+ 'menu_statistic_week' => 'Week:',
+ 'menu_statistic_month' => 'Month:',
+ 'menu_statistic_year' => 'Year:',
+ 'menu_statistic_total' => 'All time:',
+ 'menu_button_request' => 'Request',
+ 'menu_button_search' => 'Search',
+ 'menu_button_account' => 'Account',
+ 'menu_button_unchainers' => 'Unchainers',
+
+ // Language selection
+ 'select_language_title' => 'Select language',
+ 'select_language_description' => 'The selected language will be used in the current process',
+ 'select_language_button_add' => 'Add a language',
+
+ // Language setting
+ 'settings_select_language_title' => 'Select language',
+ 'settings_select_language_description' => 'The selected language will be writed in your account settings',
+ 'settings_language_update_success' => 'Language replaced:',
+ 'settings_language_update_fail' => 'Failed to replace language',
+
+ // Authorization
+ 'not_authorized_system' => 'You do not have access to the system',
+ 'not_authorized_settings' => 'You do not have access to the settings',
+ 'not_authorized_system_settings' => 'You do not have access to the system settings',
+];
diff --git a/mirzaev/unchainer/system/localizations/russian.php b/mirzaev/unchainer/system/localizations/russian.php
new file mode 100644
index 0000000..0f9afae
--- /dev/null
+++ b/mirzaev/unchainer/system/localizations/russian.php
@@ -0,0 +1,41 @@
+ 'Свобода',
+ 'empty' => 'Пусто',
+
+ // Главное меню
+ 'menu_title' => 'Главное меню',
+ 'menu_requests' => 'Запросы:',
+ 'menu_accounts' => 'Аккаунты:',
+ 'menu_foundation' => 'Запас фонда:',
+ 'menu_statistic_day' => 'День:',
+ 'menu_statistic_week' => 'Неделя:',
+ 'menu_statistic_month' => 'Месяц:',
+ 'menu_statistic_year' => 'Год:',
+ 'menu_statistic_total' => 'Всё время:',
+ 'menu_button_request' => 'Запросить',
+ 'menu_button_search' => 'Поиск',
+ 'menu_button_account' => 'Аккаунт',
+ 'menu_button_unchainers' => 'Освободители',
+
+ // Выбор языка
+ 'select_language_title' => 'Выбери язык',
+ 'select_language_description' => 'Выбранный язык будет использован в текущем процессе',
+ 'select_language_button_add' => 'Добавить язык',
+
+ // Настройки
+ 'settings_select_language_title' => 'Выбери язык',
+ 'settings_select_language_description' => 'Выбранный язык будет записан в настройки аккаунта',
+ 'settings_language_update_success' => 'Язык заменён:',
+ 'settings_language_update_fail' => 'Не удалось заменить язык',
+
+ // Авторизация
+ 'not_authorized_system' => 'У тебя нет доступа к системе',
+ 'not_authorized_contact' => 'У тебя нет доступа к коммуникации с организацией',
+ 'not_authorized_request' => 'У тебя нет доступа к отправке запросов в организацию',
+ 'not_authorized_settings' => 'У тебя нет доступа к настройкам',
+ 'not_authorized_system_settings' => 'У тебя нет доступа к системным настройкам',
+];
diff --git a/mirzaev/unchainer/system/models/account.php b/mirzaev/unchainer/system/models/account.php
new file mode 100755
index 0000000..410e378
--- /dev/null
+++ b/mirzaev/unchainer/system/models/account.php
@@ -0,0 +1,199 @@
+
+ */
+final class account extends core
+{
+ /**
+ * File
+ *
+ * @var string $database Path to the database file
+ */
+ protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'accounts.baza';
+
+ /**
+ * Database
+ *
+ * @var database $database The database
+ */
+ public protected(set) database $database;
+
+ /**
+ * Constructor
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ // Initializing the database
+ $this->database = new database()
+ ->encoding(encoding::utf8)
+ ->columns(
+ new column('identifier', type::integer_unsigned),
+ new column('identifier_telegram', type::integer),
+ new column('domain', type::string, ['length' => 32]),
+ new column('name_first', type::string, ['length' => 64]),
+ new column('name_second', type::string, ['length' => 64]),
+ new column('language', type::string, ['length' => 2]),
+ new column('robot', type::char),
+ new column('authorized_system', type::char),
+ new column('authorized_settings', type::char),
+ new column('authorized_system_settings', type::char),
+ new column('created', type::integer_unsigned),
+ new column('updated', type::integer_unsigned)
+ )
+ ->connect($this->file);
+ }
+
+ /**
+ * Initialize
+ *
+ * Searches for the account record in the database, and if it does not find it, it creates it
+ *
+ * @param telegram $telegram The telegram account
+ *
+ * @throws exception_runtime if update the account record in the database by the telegram account values
+ * @throws exception_runtime if failed to find the registered account
+ * @throws exception_runtime if failed to registrate the account
+ *
+ * @return record The account record from the database
+ */
+ public function initialize(telegram $telegram): record
+ {
+ // Searching for the account in the database
+ $account = $this->database->read(filter: fn(record $record) => $record->identifier_telegram === $telegram->getId(), amount: 1)[0] ?? null;
+
+ if ($account instanceof record) {
+ // Found the account record
+
+ if (
+ $account->name_first !== $telegram->getFirstName() ||
+ $account->name_second !== $telegram->getLastName() ||
+ $account->domain !== $telegram->getUsername()
+ ) {
+ // The telegram account was updated
+
+ // Updating the account in the database
+ $updated = $this->database->read(
+ filter: fn(record $record) => $record->identifier_telegram === $telegram->getId(),
+ update: function (record &$record) use ($telegram){
+ // Writing new values into the record
+ $record->name_first = $telegram->getFirstName();
+ $record->name_second = $telegram->getLastName();
+ $record->domain = $telegram->getUsername();
+ $record->updated = svoboda::timestamp();
+ },
+ amount: 1
+ )[0] ?? null;
+
+ if ($updated instanceof record && $updated->values() !== $account->values()) {
+ // Updated the account in the database
+
+ // Exit (success)
+ return $updated;
+ } else {
+ // Not updated the account in the database
+
+ // Exit (fail)
+ throw new exception_runtime('Failed to update the account record in the database by the telegram account values');
+ }
+ }
+
+ // Exit (success)
+ return $account;
+ } else {
+ // Not found the account record
+
+ if ($this->registrate($telegram)) {
+ // Registered the account
+
+ // Searching for the registered account in the database
+ $account = $this->database->read(filter: fn(record $record) => $record->identifier_telegram === $telegram->getId(), amount: 1)[0] ?? null;
+
+ if ($account instanceof record) {
+ // Found the registered account
+
+ // Exit (success)
+ return $account;
+ } else {
+ // Not found the registered account
+
+ // Exit (fail)
+ throw new exception_runtime('Failed to find the registered account');
+ }
+ } else {
+ // Not registered the account
+
+ // Exit (fail)
+ throw new exception_runtime('Failed to registrate the account');
+ }
+ }
+ }
+
+ /**
+ * Registrate
+ *
+ * Creates the account record in the database
+ *
+ * @param telegram $telegram The telegram account
+ *
+ * @return int|false The record identifier, if created
+ */
+ public function registrate(telegram $telegram): int|false
+ {
+ // Initializing the identifier
+ $identifier = $this->database->count() + 1;
+
+ // Initializing the record
+ $record = $this->database->record(
+ $identifier,
+ (int) $telegram->getId(),
+ $telegram->getFirstName(),
+ $telegram->getLastName(),
+ $telegram->getUsername(),
+ $telegram->getLanguageCode(),
+ (int) $telegram->isBot(),
+ 1,
+ 1,
+ 0,
+ svoboda::timestamp(),
+ svoboda::timestamp()
+ );
+
+ // Creating the accound record in the database
+ $created = $this->database->write($record);
+
+ // Exit (success)
+ return $created ? $identifier : false;
+ }
+}
diff --git a/mirzaev/unchainer/system/models/core.php b/mirzaev/unchainer/system/models/core.php
new file mode 100755
index 0000000..b1ec259
--- /dev/null
+++ b/mirzaev/unchainer/system/models/core.php
@@ -0,0 +1,98 @@
+
+ */
+class core extends model
+{
+ /**
+ * Write
+ *
+ * @param string $name Name of the property
+ * @param mixed $value Value of the property
+ *
+ * @return void
+ */
+ public function __set(string $name, mixed $value = null): void
+ {
+ match ($name) {
+ default => parent::__set($name, $value)
+ };
+ }
+
+ /**
+ * Read
+ *
+ * @param string $name Name of the property
+ *
+ * @return mixed Content of the property, if they are found
+ */
+ public function __get(string $name): mixed
+ {
+ return match ($name) {
+ default => parent::__get($name)
+ };
+ }
+
+ /**
+ * Delete
+ *
+ * @param string $name Name of the property
+ *
+ * @return void
+ */
+ public function __unset(string $name): void
+ {
+ // Deleting a property and exit (success)
+ parent::__unset($name);
+ }
+
+ /**
+ * Check of initialization
+ *
+ * @param string $name Name of the property
+ *
+ * @return bool The property is initialized?
+ */
+ public function __isset(string $name): bool
+ {
+ // Check of initialization of the property and exit (success)
+ return parent::__isset($name);
+ }
+
+ /**
+ * Call a static property or method
+ *
+ * @param string $name Name of the property or the method
+ * @param array $arguments Arguments for the method
+ */
+ public static function __callStatic(string $name, array $arguments): mixed
+ {
+ return match ($name) {
+ default => throw new exception("Not found: $name", 500)
+ };
+ }
+}
+
diff --git a/author/project/system/models/enumerations/language.php b/mirzaev/unchainer/system/models/enumerations/language.php
similarity index 77%
rename from author/project/system/models/enumerations/language.php
rename to mirzaev/unchainer/system/models/enumerations/language.php
index f246e36..230760c 100755
--- a/author/project/system/models/enumerations/language.php
+++ b/mirzaev/unchainer/system/models/enumerations/language.php
@@ -13,7 +13,6 @@ namespace mirzaev\unchainer\models\enumerations;
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich
- * @author mirzaev
*/
enum language
{
@@ -28,10 +27,6 @@ enum language
* @param language|null $language Language into which to translate
*
* @return string Translated label of the language
- *
- * @todo
- * 1. More languages
- * 2. Cases???
*/
public function label(?language $language = language::en): string
{
@@ -47,4 +42,20 @@ enum language
}
};
}
+
+ /**
+ * Flag
+ *
+ * Initialize the flag emoji of the language
+ *
+ * @return string The flag emoji of the language
+ */
+ public function flag(): string
+ {
+ // Exit (success)
+ return match ($this) {
+ language::en => '🇺🇸',
+ language::ru => '🇷🇺'
+ };
+ }
}
diff --git a/mirzaev/unchainer/system/models/telegram/buttons/distribution/registration.php b/mirzaev/unchainer/system/models/telegram/buttons/distribution/registration.php
new file mode 100755
index 0000000..d1cceb3
--- /dev/null
+++ b/mirzaev/unchainer/system/models/telegram/buttons/distribution/registration.php
@@ -0,0 +1,277 @@
+
+ */
+final class registration extends core
+{
+ /**
+ * Language
+ *
+ * Send the language selection menu
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function language(context $context)
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_registration')
+ ->then(function ($distribution) use ($context, $account, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution) {
+ // Found started registration process
+
+ // Sending the language selection
+ selections::language(
+ context: $context,
+ prefix: 'distribution_registration_select_language_',
+ title: '🌏 *' . $localization['distribution_registration_select_language_title'] . '*',
+ description: '🌏 *' . $localization['distribution_registration_select_language_description'] . '*'
+ );
+ } else {
+ // Not found started registretion process
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
+ }
+ });
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Name
+ *
+ * Request to enter name
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function name(context $context)
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_registration')
+ ->then(function ($distribution) use ($context, $account, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution) {
+ // Found started registration process
+
+ // Sending the message
+ $context->sendMessage('📄 *' . $localization['distribution_registration_name_request'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Writing into the distribution registration buffer
+ $context->nextStep([process_distribution_registration::class, 'name']);
+ });
+ } else {
+ // Not found started registretion process
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
+ }
+ });
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Location
+ *
+ * Request to send location
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function location(context $context)
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_registration')
+ ->then(function ($distribution) use ($context, $account, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution) {
+ // Found started registration process
+
+ // Initializing the message title
+ $title = '🗺 *' . $localization['distribution_registration_location_send_title'] . '*';
+
+ // Initializing the message description
+ $description = $localization['distribution_registration_location_send_description'];
+
+ // Sending the message
+ $context->sendMessage(
+ << [
+ 'keyboard' => [
+ [
+ [
+ 'text' => '🗺 ' . $localization['distribution_registration_button_location_send'],
+ 'request_location' => true
+ ]
+ ],
+ ],
+ 'disable_notification' => true
+ ]
+ ]
+
+ )
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Writing into the distribution registration buffer
+ $context->nextStep([process_distribution_registration::class, 'location']);
+ });
+ } else {
+ // Not found started registretion process
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
+ }
+ });
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+}
diff --git a/mirzaev/unchainer/system/models/telegram/commands.php b/mirzaev/unchainer/system/models/telegram/commands.php
new file mode 100755
index 0000000..ec81f1a
--- /dev/null
+++ b/mirzaev/unchainer/system/models/telegram/commands.php
@@ -0,0 +1,383 @@
+
+ */
+final class commands extends core
+{
+ /**
+ * Menu
+ *
+ * Responce for the commands: "/start", '/menu'
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function menu(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Initializing the title
+ $title = '📋 *' . $localization['menu_title'] . '*';
+
+ // Initializing accounts
+ /* $accounts = '*' . $localization['menu_accounts'] . '* ' . (new account->database->count() ?? 0); */
+ $accounts = '*' . $localization['menu_accounts'] . '* ' . ((new account)->database->count() ?? 0);
+
+ // Initializing requests
+ $requests = '*' . $localization['menu_requests'] . '* ' . 0 . ' 🔗';
+
+ // Initializing foundation
+ $foundation = '*' . $localization['menu_foundation'] . '* ' . 0 . ' ⭐️';
+
+ // Initializing day statistic
+ $day = '*' . $localization['menu_statistic_day'] . '* ' . 0 . ' ⛓️💥' . ', ' . 0 . ' ⭐️';
+
+ // Initializing week statistic
+ $week = '*' . $localization['menu_statistic_week'] . '* ' . 0 . ' ⛓️💥' . ', ' . 0 . ' ⭐️';
+
+ // Initializing month statistic
+ $month = '*' . $localization['menu_statistic_month'] . '* ' . 0 . ' ⛓️💥' . ', ' . 0 . ' ⭐️';
+
+ // Initializing year statistic
+ $year = '*' . $localization['menu_statistic_year'] . '* ' . 0 . ' ⛓️💥' . ', ' . 0 . ' ⭐️';
+
+ // Initializing total statistic
+ $total = '*' . $localization['menu_statistic_total'] . '* ' . 0 . ' ⛓️💥' . ', ' . 0 . ' ⭐️';
+
+ // Sending the message
+ $context->sendMessage(
+ << [
+ 'inline_keyboard' => [
+ [
+ [
+ 'text' => '⛓️💥 ' . $localization['menu_button_request'],
+ 'callback_data' => 'request'
+ ],
+ [
+ 'text' => '🔎 ' . $localization['menu_button_search'],
+ 'callback_data' => 'search'
+ ]
+ ],
+ [
+ [
+ 'text' => '📕 ' . $localization['menu_button_account'],
+ 'callback_data' => 'account'
+ ]
+ ],
+ /* [
+ [
+ 'text' => '❤️🩹 ' . $localization['menu_button_unchainers'],
+ 'callback_data' => 'unchainers'
+ ]
+ ] */
+ ],
+ 'disable_notification' => true,
+ 'remove_keyboard' => true
+ ],
+ ]
+
+ )
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+
+ });
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Distributions
+ *
+ * Responce for the command: "/distributions"
+ *
+ * Sends the distributions menu
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function distributions(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language instanceof language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Initializing the message title
+ $title = '🏘 *' . $localization['distributions_title'] . '*';
+
+ // Initializing the message description
+ $description = $localization['distributions_description'];
+
+ // Initializing the distribution model
+ $model = new distribution;
+
+ // Initializing the message "registered" row
+ $registered = '*' . $localization['distributions_registered'] . ':* ' . $model->database->count();
+
+ // Sending the message
+ $context->sendMessage(
+ << [
+ 'inline_keyboard' => [
+ [
+ [
+ 'text' => '📋 ' . $localization['distributions_button_register'],
+ 'callback_data' => 'distribution_registration_start'
+ ],
+ [
+ 'text' => '🔎 ' . $localization['distributions_button_search'],
+ 'callback_data' => 'distribution_search_start'
+ ]
+ ]
+ ],
+ 'disable_notification' => true,
+ 'remove_keyboard' => true
+ ],
+ ]
+ );
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Language
+ *
+ * Responce for the command: "/language"
+ *
+ * Send the language selection menu
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function language(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language instanceof language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Sending the language selection
+ selections::language(
+ context: $context,
+ prefix: 'settings_language_',
+ title: '🌏 *' . $localization['settings_select_language_title'] . '*',
+ description: '🌏 *' . $localization['settings_select_language_description'] . '*'
+ );
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Author
+ *
+ * Responce for the command: "/author"
+ *
+ * Sends information about author and menu
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function author(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Sending the message
+ $context->sendPhoto(
+ new file_input(STORAGE . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'mushroom.jpg'),
+ [
+ 'caption' => $localization['why_so_shroomious'],
+ 'disable_notification' => true
+ ]
+ );
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+}
diff --git a/mirzaev/unchainer/system/models/telegram/middlewares.php b/mirzaev/unchainer/system/models/telegram/middlewares.php
new file mode 100755
index 0000000..ba9bc04
--- /dev/null
+++ b/mirzaev/unchainer/system/models/telegram/middlewares.php
@@ -0,0 +1,548 @@
+
+ */
+final class middlewares extends core
+{
+ /**
+ * Account (middleware)
+ *
+ * Initialize or registrate the account and write it to the `account` variable inside the `$context`
+ *
+ * @param context $context
+ * @param node $next
+ *
+ * @return void
+ */
+ public static function account(context $context, node $next): void
+ {
+ // Is the process stopped?
+ if ($context->get('stop')) return;
+
+ // Initializing the telegram account
+ $telegram = $context->getEffectiveUser();
+
+ // Initializing the account
+ /* $account = new account()->initialize($telegram); */
+ $account = (new account())->initialize($telegram);
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Writing the account into the context variable
+ $context->set('account', $account);
+
+ // Continuation of the process
+ $next($context);
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Language (middleware)
+ *
+ * Implement the account language
+ *
+ * @param context $context
+ * @param node $next
+ *
+ * @return void
+ */
+ public static function language(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
+
+ if ($account->language) {
+ // Initialized the language parameter
+
+ try {
+ // Writing the account language into the context variable
+ $context->set('language', language::{$account->language});
+ } catch (error $error) {
+ // Not initialized the language
+
+ // Writing the default language into the context variable
+ $context->set('language', language::en);
+ }
+ } else {
+ // Not initialized the language parameter
+
+ // Writing the default language into the context variable
+ $context->set('language', language::en);
+ }
+
+ // Continuation of the process
+ $next($context);
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Localization (middleware)
+ *
+ * Implement the account language and initialize the localization file
+ *
+ * @param context $context
+ * @param node $next
+ *
+ * @return void
+ */
+ public static function localization(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 the language
+ $language = $context->get('language');
+
+ if ($language instanceof language) {
+ // Initialized the language
+
+ // Initializing path to the localization file
+ $file = LOCALIZATIONS . DIRECTORY_SEPARATOR . strtolower($language->label()) . '.php';
+
+ if (file_exists($file) && is_readable($file)) {
+ // Found the localization file
+
+ // Initializing localization
+ $localization = require($file);
+
+ if (is_array($localization)) {
+ // Initializae localization
+
+ // Writing localization into the context variable
+ $context->set('localization', $localization);
+
+ // Continuation of the process
+ $next($context);
+ } else {
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not found the localization file
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize the localization file*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * System (middleware)
+ *
+ * Check the account for access to the system
+ *
+ * @param context $context
+ * @param node $next
+ *
+ * @return void
+ */
+ public static function system(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
+
+ if ($account->authorized_system) {
+ // Authorized the account to the system
+
+ // Continuation of the process
+ $next($context);
+ } else {
+ // Not authorized the account to the system
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Sending the message
+ $context->sendMessage('⛔ *' . $localization['not_authorized_system'] . '*')
+ ->then(function (message $message) use ($context) {
+ // 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) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Contact (middleware)
+ *
+ * Check the account for access to contact with the organization
+ *
+ * @param context $context
+ * @param node $next
+ *
+ * @return void
+ */
+ public static function contact(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
+
+ if ($account->authorized_contact) {
+ // Authorized the account to contact with the organization
+
+ // Continuation of the process
+ $next($context);
+ } else {
+ // Not authorized the account to contact with the organization
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Sending the message
+ $context->sendMessage('⛔ *' . $localization['not_authorized_contact'] . '*')
+ ->then(function (message $message) use ($context) {
+ // 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) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Request (middleware)
+ *
+ * Check the account for access to request to the organization
+ *
+ * @param context $context
+ * @param node $next
+ *
+ * @return void
+ */
+ public static function request(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
+
+ if ($account->authorized_request) {
+ // Authorized the account to request to the organization
+
+ // Continuation of the process
+ $next($context);
+ } else {
+ // Not authorized the account to request to the organization
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Sending the message
+ $context->sendMessage('⛔ *' . $localization['not_authorized_request'] . '*')
+ ->then(function (message $message) use ($context) {
+ // 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) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Settings (middleware)
+ *
+ * Check the account for access to the settings
+ *
+ * @param context $context
+ * @param node $next
+ *
+ * @return void
+ */
+ public static function settings(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
+
+ if ($account->authorized_settings) {
+ // Authorized the account to the settings
+
+ // Continuation of the process
+ $next($context);
+ } else {
+ // Not authorized the account to the settings
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Sending the message
+ $context->sendMessage('⛔ *' . $localization['not_authorized_settings'] . '*')
+ ->then(function (message $message) use ($context) {
+ // 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) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * System settings (middleware)
+ *
+ * Check the account for access to the system settings
+ *
+ * @param context $context
+ * @param node $next
+ *
+ * @return void
+ */
+ public static function system_settings(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
+
+ if ($account->authorized_system_settings) {
+ // Authorized the account to the system settings
+
+ // Continuation of the process
+ $next($context);
+ } else {
+ // Not authorized the account to the system settings
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Sending the message
+ $context->sendMessage('⛔ *' . $localization['not_authorized_system_settings'] . '*')
+ ->then(function (message $message) use ($context) {
+ // 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) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+}
diff --git a/mirzaev/unchainer/system/models/telegram/processes/distribution/localization.php b/mirzaev/unchainer/system/models/telegram/processes/distribution/localization.php
new file mode 100755
index 0000000..6eb6caf
--- /dev/null
+++ b/mirzaev/unchainer/system/models/telegram/processes/distribution/localization.php
@@ -0,0 +1,238 @@
+
+ */
+final class localization extends core
+{
+ /**
+ * Start
+ *
+ * Starting the distribution localization process
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function start(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language instanceof language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_localization')
+ ->then(function ($distribution_localization) use ($context, $account, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution_localization) {
+ // Found started localization process
+
+ // Sending the message
+ $context->sendMessage('🌏 *' . $localization['distribution_localization_continiued'] . '*')
+ ->then(function (message $message) use ($context, $localization) {
+ // Sended the message
+
+ // Sending the localization generation menu
+ static::generation($context);
+ });
+ } else {
+ // Not found started localization process
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_registration')
+ ->then(function ($distribution) use ($context, $account, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution instanceof record) {
+ // Found started registration process
+
+ // Writing to the telegram user buffer
+ $context->setUserDataItem('distribution_localization', ['distribution' => $distribution])
+ ->then(function () use ($context, $localization) {
+ // Writed to the telegram user buffer
+
+ // Sending the message
+ $context->sendMessage('🌏 *' . $localization['distribution_localization_started'] . '*')
+ ->then(function (message $message) use ($context, $localization) {
+ // Sended the message
+
+ // Sending the localization generation menu
+ static::generation($context);
+ });
+ });
+ } else {
+ // Not found started registration process
+
+ // Здесь надо просить выбрать дистрибутив
+
+ // Проверять на то, что он creator дистрибутива, иначе посылать
+ }
+ });
+ }
+ });
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Generation
+ *
+ * Send the generation menu
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ protected static function generation(context $context): array
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_localization')
+ ->then(function ($distribution_localization) use ($context, $account, $language, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution_localization) {
+ // Found started localization process
+
+ // Initializing the buffer of generated keyboard with languages
+ $keyboard = [
+ [
+ [
+ 'text' => (empty($distribution_localization['language']) ? language::{$distribution_localization['language']}->flag() : '🟢') . ' ' . $localization['distribution_localization_button_language'],
+ 'callback_data' => 'distribution_localization_language'
+ ]
+ ],
+ [
+ [
+ 'text' => (empty($distribution_localization['name']) ? '🔴 ' : '🟢 ') . $localization['distribution_localization_button_name'],
+ 'callback_data' => 'distribution_localization_name'
+ ]
+ ],
+ ];
+
+ // Sending the message
+ $context->sendMessage(
+ '🌏 *' . $localization['distribution_localization_generation_menu'] . '*',
+ [
+ 'reply_markup' => [
+ 'inline_keyboard' => $keyboard
+ ],
+ 'disable_notification' => true
+ ]
+ );
+ }
+ });
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ // Exit (success)
+ return [];
+ }
+}
diff --git a/mirzaev/unchainer/system/models/telegram/processes/distribution/registration.php b/mirzaev/unchainer/system/models/telegram/processes/distribution/registration.php
new file mode 100755
index 0000000..d827bc0
--- /dev/null
+++ b/mirzaev/unchainer/system/models/telegram/processes/distribution/registration.php
@@ -0,0 +1,1082 @@
+
+ */
+final class registration extends core
+{
+ /**
+ * Start
+ *
+ * Starting the distribution registration process
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function start(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language instanceof language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_registration')
+ ->then(function ($distribution) use ($context, $account, $language, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution) {
+ // Found started registration process
+
+ // Sending the message
+ $context->sendMessage('📂 *' . $localization['distribution_registration_continiued'] . '*')
+ ->then(function (message $message) use ($context, $account, $language, $localization) {
+ // Sended the message
+
+ // Sending the generation menu
+ static::generation($context);
+ });
+ } else {
+ // Not found started registretion process
+
+ // Initializing the distribution registration buffer
+ $distribution = [
+ 'latitude' => null,
+ 'longitude' => null,
+ 'localization' => [
+ 'language' => $language,
+ 'name' => ''
+ ]
+ ];
+
+ // Writing to the telegram user buffer
+ $context->setUserDataItem('distribution_registration', $distribution)
+ ->then(function () use ($context, $account, $localization) {
+ // Writed to the telegram user buffer
+
+ // Sending the message
+ $context->sendMessage('📂 *' . $localization['distribution_registration_started'] . '*')
+ ->then(function (message $message) use ($context, $account, $localization) {
+ // Sended the message
+
+ // Sending the generation menu
+ static::generation($context);
+ });
+ });
+ }
+ });
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Cancel
+ *
+ * Ending the distribution registration process
+ * without creating the distribution record in the database
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function cancel(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language instanceof language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_registration')
+ ->then(function ($distribution) use ($context, $account, $language, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution) {
+ // Found started registration process
+
+ // Deleting in the telegram user buffer
+ $context->deleteUserDataItem('distribution_registration')
+ ->then(function () use ($context, $account, $language, $localization) {
+ // Deleted in the telegram user buffer
+
+ // Sending the message
+ $context->sendMessage('🗑 *' . $localization['distribution_registration_canceled'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Sending the distributions menu
+ commands::distributions($context);
+ });
+ });
+ } else {
+ // Not found started registretion process
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
+ }
+ });
+ } 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 language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->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 your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * End
+ *
+ * Ending the distribution registration process
+ * and creating the distribution record in the database
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function end(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language instanceof language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_registration')
+ ->then(function ($distribution) use ($context, $account, $language, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution) {
+ // Found started registration process
+
+ // Creating the distribution
+ /* $created_distribution = new distribution->create( */
+ $created_distribution = (new distribution)->create(
+ creator: $account->identifier,
+ latitude: $distribution['latitude'],
+ longitude: $distribution['longitude']
+ );
+
+ if ($created_distribution) {
+ // Created the distribution
+
+ // Sending the message
+ $context->sendMessage('✏️ *' . $localization['distribution_registration_created_distribution'] . '*')
+ ->then(function (message $message) use ($context, $account, $language, $localization, $distribution, $created_distribution) {
+ // Sended the message
+
+ // Initializing the distribution localization
+ /* $created_localization = new distribution_localization->create( */
+ $created_localization = (new distribution_localization)->create(
+ distribution: $created_distribution,
+ language: $distribution['localization']['language'],
+ name: $distribution['localization']['name']
+ );
+
+ if ($created_localization) {
+ // Created the localization
+
+ // Sending the message
+ $context->sendMessage('✏️ *' . $localization['distribution_registration_created_localization'] . '*')
+ ->then(function (message $message) use ($context, $localization) {
+ // Sended the message
+
+ // Deleting from the telegram user buffer
+ $context->deleteUserDataItem('distribution_registration')
+ ->then(function () use ($context, $localization) {
+ // Deleted from the telegram user buffer
+
+ // Sending the message
+ $context->sendMessage('✅ *' . $localization['distribution_registration_completed'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Sending the distributions menu
+ commands::distributions($context);
+ });
+ });
+ });
+ } else {
+ // Not created the distribution localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_not_created_localization'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ });
+ } else {
+ // Not created the distribution
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_not_created_distribution'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not found started registretion process
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
+ }
+ });
+ } 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 language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->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 your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Generation
+ *
+ * Sends the generation menu with parameters: language, name, location
+ * When all parameters was initialized then sends the complete button
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ protected static function generation(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_registration')
+ ->then(function ($distribution) use ($context, $account, $language, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution) {
+ // Found started registration process
+
+ // Initializing the buffer of generated keyboard with languages
+ $keyboard = [
+ [
+ [
+ 'text' => empty($distribution['localization']['language']) ? '🟢 ' . $localization['distribution_registration_button_language'] : '🟢 ' . $localization['distribution_registration_button_language'] . ': ' . $distribution['localization']['language']->flag() . ' ' . $distribution['localization']['language']->label($language),
+ 'callback_data' => 'distribution_registration_language'
+ ]
+ ],
+ [
+ [
+ 'text' => empty($distribution['localization']['name']) ? '🔴 ' . $localization['distribution_registration_button_name'] : '🟢 ' . $localization['distribution_registration_button_name'] . ': ' . $distribution['localization']['name'],
+ 'callback_data' => 'distribution_registration_name'
+ ]
+ ],
+ [
+ [
+ 'text' => empty($distribution['latitude']) || empty('longitude') ? '🔴 ' . $localization['distribution_registration_button_location'] : '🟢 ' . $localization['distribution_registration_button_location'] . ': ' . $distribution['latitude'] . ', ' . $distribution['longitude'],
+ 'callback_data' => 'distribution_registration_location'
+ ]
+ ],
+ ];
+
+ // Initializing the index of last row
+ $last = count($keyboard);
+
+ // Initializing the last row
+ $keyboard[$last] ??= [];
+
+ // Initializing the button for canceling the generation process
+ $keyboard[$last][] = [
+ 'text' => '❎ ' . $localization['distribution_registration_button_cancel'],
+ 'callback_data' => 'distribution_registration_cancel'
+ ];
+
+ if (
+ !empty($distribution['localization']['language']) &&
+ !empty($distribution['localization']['name']) &&
+ !empty($distribution['latitude']) &&
+ !empty($distribution['longitude'])
+ ) {
+ // Initialized all requeired parameters
+
+ // Initializing the button for completing the generation process
+ $keyboard[$last][] = [
+ 'text' => '✅ ' . $localization['distribution_registration_button_confirm'],
+ 'callback_data' => 'distribution_registration_end'
+ ];
+ }
+
+ // Ending the conversation process
+ $context->endConversation()
+ ->then(function () use ($context, $localization, $keyboard) {
+
+ // Sending the message
+ $context->sendMessage(
+ '📀 *' . $localization['distribution_registration_generation'] . '*',
+ [
+ 'reply_markup' => [
+ 'inline_keyboard' => $keyboard,
+ 'disable_notification' => true,
+ 'remove_keyboard' => true
+ ],
+ ]
+ );
+ });
+ } else {
+ // Not found started registretion process
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
+ }
+ });
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Language
+ *
+ * Write language into the distribution registration buffer
+ *
+ * @param context $context Request data from Telegram
+ * @param language $new The language
+ *
+ * @return void
+ */
+ public static function language(context $context, language $new): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language instanceof language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_registration')
+ ->then(function ($distribution) use ($context, $account, $language, $localization, $new) {
+ // Readed from the telegram user buffer
+
+ if ($distribution) {
+ // Found started registration process
+
+ try {
+ // Initializing the old language
+ $old = $distribution['localization']['language'];
+
+ // Writing into the distribution registration process buffer
+ $distribution['localization']['language'] = $new;
+
+ // Writing to the telegram user buffer
+ $context->setUserDataItem('distribution_registration', $distribution)
+ ->then(function () use ($context, $account, $language, $localization, $new, $old) {
+ // Writed to the telegram user buffer
+
+ // Sending the message
+ $context->sendMessage('✅ *' . $localization['distribution_registration_language_update_success'] . '* ' . ($old->flag() ? $old->flag() . ' ' : '') . $old->label($language) . ' → *' . ($new->flag() ? $new->flag() . ' ' : '') . $new->label($language) . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Sending the generation menu
+ static::generation($context);
+ });
+ });
+ } catch (error $error) {
+ // Failed to send the message about language update
+
+ // Sending the message
+ $context->sendMessage('❎ *' . $localization['distribution_registration_language_update_fail'])
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not found started registretion process
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
+ }
+ });
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Name
+ *
+ * Write name into the distribution registration buffer
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function name(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_registration')
+ ->then(function ($distribution) use ($context, $account, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution) {
+ // Found started registration process
+
+ // Initializing the new name
+ $new = $context->getMessage()->getText();
+
+ if (!empty($new)) {
+ // Initialized the new name
+
+ if (mb_strlen($new) >= 3) {
+ // Passed minimum length check
+
+ if (mb_strlen($new) <= 32) {
+ // Passed maximum length check
+
+ // Search for restricted characters
+ preg_match_all('/[\W\d]/u', $new, $matches);
+
+ // Declaring the buffer of found restricted characters (except spaces)
+ $characters = [];
+
+ // Declaring the counter of found spaces
+ $spaces = 0;
+
+ foreach ($matches[0] as $match) {
+ // Iterating over found restricted characters
+
+ if ($match === ' ') {
+ // Space-character
+
+ // Increasing the counter of found spaces
+ ++$spaces;
+ } else {
+ // Not space-character
+
+ // Writing into the buffer of found restricted characers (except spaces)
+ $characters[] = $match;
+ }
+ }
+
+ if (empty($characters)) {
+ // Not found restricted characters
+
+ if ($spaces <= 2) {
+ // Number of spaces is not more than 2
+
+ try {
+ // Initializing the old name
+ $old = empty($distribution['localization']['name']) ? '_' . $localization['empty'] . '_' : $distribution['localization']['name'];
+
+ // Writing into the distribution registration process buffer
+ $distribution['localization']['name'] = $new;
+
+ // Writing to the telegram user buffer
+ $context->setUserDataItem('distribution_registration', $distribution)
+ ->then(function () use ($context, $account, $localization, $new, $old) {
+ // Writed to the telegram user buffer
+
+ // Sending the message
+ $context->sendMessage('✅ *' . $localization['distribution_registration_name_update_success'] . "* $old → *$new*")
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Sending the generation menu
+ static::generation($context);
+ });
+ });
+ } catch (error $error) {
+ // Failed to send the message about name update
+
+ // Sending the message
+ $context->sendMessage('❎ *' . $localization['distribution_registration_name_update_fail'])
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Number of spaces is more than 2
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_name_request_spaces'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Requesting to enter name again
+ button_distribution_registration::name($context);
+ });
+ }
+ } else {
+ // Found restricted characters
+
+ // Initializing title of the message
+ $title = '⚠️ *' . $localization['distribution_registration_name_request_restricted_characters_title'] . '*';
+
+ // Initializing description of the message
+ $description = '*' . $localization['distribution_registration_name_request_restricted_characters_description'] . '* \\' . implode(', \\', $characters);
+
+ // Sending the message
+ $context->sendMessage(
+ <<then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Requesting to enter name again
+ button_distribution_registration::name($context);
+ });
+ }
+ } else {
+ // Not passed maximum length check
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_name_request_too_long'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Requesting to enter name again
+ button_distribution_registration::name($context);
+ });
+ }
+ } else {
+ // Not passed minimum length check
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_name_request_too_short'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Requesting to enter name again
+ button_distribution_registration::name($context);
+ });
+ }
+ } else {
+ // Failed to initialize the new name
+
+ // Sending the message
+ $context->sendMessage('📄 *' . $localization['distribution_registration_name_request_not_acceptable'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Requesting to enter name again
+ button_distribution_registration::name($context);
+ });
+ }
+ } else {
+ // Not found started registretion process
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
+ }
+ });
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+
+ /**
+ * Location
+ *
+ * Write latitude and longitude into the distribution registration buffer
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function location(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Reading from the telegram user buffer
+ $context->getUserDataItem('distribution_registration')
+ ->then(function ($distribution) use ($context, $account, $localization) {
+ // Readed from the telegram user buffer
+
+ if ($distribution) {
+ // Found started registration process
+
+ // Initializing the new location
+ preg_match_all('/(\-?\d{1,2})\.?(\d*)/', $context->getMessage()->getText(), $matches);
+
+ if ($matches[0]) {
+ // Initialized the new location
+
+ // Initializing the new latitude
+ $latitude = round((float) $matches[0][0], 6);
+
+ // Initializing the new longitude
+ $longitude = round((float) $matches[0][1], 6);
+
+ if (!empty($latitude) && !empty($longitude)) {
+ // Initialized the new latitude and the new longitude
+
+ if ($latitude >= 0) {
+ // Passed latitude minimum value check
+
+ if ($latitude <= 90) {
+ // Passed latitude maximum value check
+
+ if ($longitude >= 0) {
+ // Passed longitude minimum value check
+
+ if ($longitude <= 180) {
+ // Passed longitude maximum value check
+
+ try {
+ // Initializing the old location
+ $old = str_replace('.', '\\.', (empty($distribution['latitude']) ? '_' . $localization['empty'] . '_' : $distribution['latitude']) . ', ' . (empty($distribution['longitude']) ? '_' . $localization['empty'] . '_' : $distribution['longitude']));
+
+ // Writing into the distribution registration process buffer
+ $distribution['latitude'] = $latitude;
+ $distribution['longitude'] = $longitude;
+
+ // Writing to the telegram user buffer
+ $context->setUserDataItem('distribution_registration', $distribution)
+ ->then(function () use ($context, $account, $localization, $latitude, $longitude, $old) {
+ // Writed to the telegram user buffer
+
+ // Initializing the new location
+ $new = str_replace('.', '\\.', $latitude . ', ' . $longitude);
+
+ // Sending the message
+ $context->sendMessage('✅ *' . $localization['distribution_registration_location_update_success'] . "*\n$old → *$new*")
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Sending the generation menu
+ static::generation($context);
+ });
+ });
+ } catch (error $error) {
+ // Failed to send the message about name update
+
+ // Sending the message
+ $context->sendMessage('❎ *' . $localization['distribution_registration_name_update_fail'])
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not passed longitude maximum value check
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_location_send_longitude_too_big'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Requesting to enter name again
+ button_distribution_registration::location($context);
+ });
+ }
+ } else {
+ // Not passed longitude minimum value check
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_location_send_longitude_too_small'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Requesting to enter name again
+ button_distribution_registration::location($context);
+ });
+ }
+ } else {
+ // Not passed latitude maximum value check
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_location_send_latitude_too_big'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Requesting to enter name again
+ button_distribution_registration::location($context);
+ });
+ }
+ } else {
+ // Not passed latitude minimum value check
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_location_send_latitude_too_small'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Requesting to enter name again
+ button_distribution_registration::location($context);
+ });
+ }
+ } else {
+ // Failed to initialize the new name
+
+ // Sending the message
+ $context->sendMessage('📄 *' . $localization['distribution_registration_location_send_not_acceptable'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Requesting to send location again
+ button_distribution_registration::location($context);
+ });
+ }
+ } else {
+ // Not initialized the new location
+
+ // Sending the message
+ $context->sendMessage('📄 *' . $localization['distribution_registration_location_send_not_acceptable'] . '*')
+ ->then(function (message $message) use ($context) {
+ // Sended the message
+
+ // Ending the conversation process
+ $context->endConversation();
+
+ // Requesting to send locaztion again
+ button_distribution_registration::location($context);
+ });
+ }
+ } else {
+ // Not found started registretion process
+
+ // Sending the message
+ $context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
+ }
+ });
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+}
diff --git a/mirzaev/unchainer/system/models/telegram/processes/distribution/search.php b/mirzaev/unchainer/system/models/telegram/processes/distribution/search.php
new file mode 100755
index 0000000..5f8daa1
--- /dev/null
+++ b/mirzaev/unchainer/system/models/telegram/processes/distribution/search.php
@@ -0,0 +1,148 @@
+
+ */
+final class search extends core
+{
+ /**
+ * Registry
+ *
+ * Registrate the distribution
+ *
+ * @param context $context Request data from Telegram
+ *
+ * @return void
+ */
+ public static function registry(context $context): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language instanceof language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Declaring the buffer of generated keyboard with languages
+ $keyboard = [];
+
+ // Initializing the iterator of rows
+ $row = 0;
+
+ // Initializing the distribution model
+ $model = new distribution;
+
+ // Initializing the distribution localization model
+ $model_localization = new distribution_localization;
+
+ foreach ($model->database->read(amount: PHP_INT_MAX) as $distribution) {
+ // Iterating over distributions
+
+ // Initializing the distribution localized values
+ $localized = $model_localization->database->read(filter: fn($record) => $record->identifier === $distribution->identifier && $record->language === $language->name, amount: 1)[0] ?? null;
+
+ // Initializing the row
+ $keyboard[$row] ??= [];
+
+ // Writing the language choose button into the buffer of generated keyboard with languages
+ $keyboard[$row][] = [
+ 'text' => $localized->name,
+ 'callback_data' => 'distributions_open_' . $distribution->identifier
+ ];
+
+ // When reaching 4 buttons in a row, move to the next row
+ if (count($keyboard[$row]) === 3) ++$row;
+ }
+
+ // Writing the button for helping lozalizing
+ $keyboard[++$row] = [
+ [
+ 'text' => '🗂 ' . $localization['settings_language_add'],
+ 'url' => 'https://git.svoboda.works/svoboda/negotiator/src/branch/stable/svoboda/negotiator/system/localizations'
+ ]
+ ];
+
+ // Sending the message
+ $context->sendMessage(
+ '🌏 *' . $localization['settings_language_title'] . '*',
+ [
+ 'reply_markup' => [
+ 'inline_keyboard' => $keyboard
+ ],
+ 'disable_notification' => true
+ ]
+ );
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function ($message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+}
diff --git a/mirzaev/unchainer/system/models/telegram/selections.php b/mirzaev/unchainer/system/models/telegram/selections.php
new file mode 100755
index 0000000..b78cba3
--- /dev/null
+++ b/mirzaev/unchainer/system/models/telegram/selections.php
@@ -0,0 +1,140 @@
+
+ */
+final class selections extends core
+{
+ /**
+ * Language
+ *
+ * The language choose menu
+ *
+ * @param context $context Request data from Telegram
+ * @param string $prefix Prefix for 'callback_data' (`$prefix . $language->name`)
+ * @param string $title Title of the message
+ * @param string $description Description of the message
+ *
+ * @return void
+ */
+ public static function language(context $context, string $prefix, string $title, string $description): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing language
+ $language = $context->get('language');
+
+ if ($language) {
+ // Initialized language
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Declaring the buffer of generated keyboard with languages
+ $keyboard = [];
+
+ // Initializing the iterator of rows
+ $row = 0;
+
+ // Initializing buffer of languages
+ $languages = language::cases();
+
+ // Deleting the actual language from buffer of languages
+ unset($languages[array_search($language, $languages, strict: true)]);
+
+ // Sorting buffer of languages by the actual language
+ $languages = [$language, ...$languages];
+
+ foreach ($languages as $language) {
+ // Iterating over languages
+
+ // Initializing the row
+ $keyboard[$row] ??= [];
+
+ // Writing the language choose button into the buffer of generated keyboard with languages
+ $keyboard[$row][] = [
+ 'text' => ($language->flag() ? $language->flag() . ' ' : '') . $language->label($language),
+ 'callback_data' => $prefix . $language->name
+ ];
+
+ // When reaching 4 buttons in a row, move to the next row
+ if (count($keyboard[$row]) === 4) ++$row;
+ }
+
+ // Writing the button for helping lozalizing
+ $keyboard[++$row] = [
+ [
+ 'text' => '🗂 ' . $localization['select_language_button_add'],
+ 'url' => 'https://git.svoboda.works/mirzaev/unchainer/src/branch/stable/mirzaev/unchainer/system/localizations'
+ ]
+ ];
+
+ // Sending the message
+ $context->sendMessage(
+ $title ?? '🌏 *' . $localization['select_language_title'] . "*\n" . ($description ?? $localization['select_language_description']),
+ [
+ 'reply_markup' => [
+ 'inline_keyboard' => $keyboard,
+ 'disable_notification' => true
+ ],
+ ]
+ );
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized language
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize language*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+}
diff --git a/mirzaev/unchainer/system/models/telegram/settings.php b/mirzaev/unchainer/system/models/telegram/settings.php
new file mode 100755
index 0000000..64ce1ab
--- /dev/null
+++ b/mirzaev/unchainer/system/models/telegram/settings.php
@@ -0,0 +1,156 @@
+
+ */
+final class settings extends core
+{
+ /**
+ * Language
+ *
+ * Write language into the account record
+ *
+ * @param context $context Request data from Telegram
+ * @param language $language The language
+ *
+ * @return void
+ */
+ public static function language(context $context, language $language): void
+ {
+ // Initializing the account
+ $account = $context->get('account');
+
+ if ($account instanceof record) {
+ // Initialized the account
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ // Initializing the account model
+ $model = new account();
+
+ // Updating the account in the database
+ $updated = $model->database->read(
+ filter: fn(record $record) => $record->identifier === $account->identifier,
+ update: function (record &$record) use ($language) {
+ // Writing new language value into the record
+ $record->language = $language->name;
+ },
+ amount: 1
+ )[0] ?? null;
+
+ if ($updated instanceof record) {
+ // Updated the account in the database
+
+ // Writing the updated account into the context variable
+ $context->set('account', $updated);
+
+ middlewares::language($context, new node(function (context $context) use ($account, $updated) {
+ // Updated language
+
+ middlewares::localization($context, new node(function (context $context) use ($account, $updated) {
+ // Updated localization
+
+ // Initializing localization
+ $localization = $context->get('localization');
+
+ if ($localization) {
+ // Initialized localization
+
+ try {
+ // Initializing the old language
+ $old = language::{$account->language};
+
+ // Initializing the new language
+ $new = language::{$updated->language};
+
+ // Sending the message
+ $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) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ } catch (error $error) {
+ // Failed to send the message about language update
+
+ // Sending the message
+ $context->sendMessage('❎ *' . $localization['settings_language_update_fail'])
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }));
+ }));
+ } else {
+ // Not updated the account in the database
+
+ // Sending the message
+ $context->sendMessage('❎ *' . $localization['settings_language_update_fail'])
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized localization
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize localization*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ } else {
+ // Not initialized the account
+
+ // Sending the message
+ $context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
+ ->then(function (message $message) use ($context) {
+ // Ending the conversation process
+ $context->endConversation();
+ });
+ }
+ }
+}
diff --git a/mirzaev/unchainer/system/public/telegram.php b/mirzaev/unchainer/system/public/telegram.php
new file mode 100755
index 0000000..530b4e5
--- /dev/null
+++ b/mirzaev/unchainer/system/public/telegram.php
@@ -0,0 +1,91 @@
+setParseMode(config::PARSE_MODE_MARKDOWN);
+$config->useReactFileSystem(true);
+
+// Initializing the robot
+$robot = new Zanzara(TELEGRAM_KEY, $config);
+
+// Initializing the updates listener
+$robot->onUpdate(function (Context $context): void {});
+
+// Initializing the robot middlewares
+$robot->middleware([middlewares::class, 'account']);
+$robot->middleware([middlewares::class, 'language']);
+$robot->middleware([middlewares::class, 'localization']);
+$robot->middleware([middlewares::class, 'system']);
+
+// Initializing the robot commands handlers
+$robot->onCommand('start', [commands::class, 'menu']);
+$robot->onCommand('menu', [commands::class, 'menu']);
+$robot->onCommand('language', [commands::class, 'language'])->middleware([middlewares::class, 'settings']);
+/* $robot->onCommand('society', [commands::class, 'society']); */
+
+// Initializing the robot settings language buttons handlers
+foreach (language::cases() as $language) {
+ // Iterating over languages
+
+ // Initializing language buttons
+ $robot->onCbQueryData(['settings_language_' . $language->name], fn(context $context) => settings::language($context, $language));
+};
+
+// Initializing the robot protected commands handlers
+/* $robot->onCommand('system_settings', [commands::class, 'system_settings'])->middleware([middlewares::class, 'system_settings']); */
+// Starting chat-robot
+$robot->run();
diff --git a/author/project/system/settings/.gitignore b/mirzaev/unchainer/system/settings/.gitignore
similarity index 100%
rename from author/project/system/settings/.gitignore
rename to mirzaev/unchainer/system/settings/.gitignore
diff --git a/mirzaev/unchainer/system/settings/telegram.php.sample b/mirzaev/unchainer/system/settings/telegram.php.sample
new file mode 100755
index 0000000..7679934
--- /dev/null
+++ b/mirzaev/unchainer/system/settings/telegram.php.sample
@@ -0,0 +1,3 @@
+