commit 04847bbc531bf75b82c28a909f0c9fedf83ce1a6 Author: Arsen Mirzaev Tatyano-Muradovich Date: Tue Feb 4 18:05:54 2025 +0700 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..c26c9a5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +!.gitignore +composer.phar +composer.lock +vendor diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..e007a57 --- /dev/null +++ b/LICENSE @@ -0,0 +1,11 @@ +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +Version 2, December 2004 + +Copyright (C) 2004 Sam Hocevar + +Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. + +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/README.md b/README.md new file mode 100755 index 0000000..8ccadf4 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# comrader +Dating by political views Telegram chat-robot diff --git a/author/project/system/controllers/core.php b/author/project/system/controllers/core.php new file mode 100755 index 0000000..7574ee0 --- /dev/null +++ b/author/project/system/controllers/core.php @@ -0,0 +1,126 @@ + + */ +class core extends controller +{ + /** + * Session + * + * @var session|null $session Instance of the session + */ + protected readonly session $session; + + /** + * Language + * + * @var language $language Language + */ + protected language $language = language::en; + + /** + * Response + * + * @see https://wiki.php.net/rfc/property-hooks (find a table about backed and virtual hooks) + * + * @var response $response Response + */ + protected response $response { + // Read + get => $this->response ??= $this->request->response(); + } + + /** + * Errors + * + * @var array $errors Registry of errors + */ + protected array $errors = [ + 'session' => [], + 'account' => [] + ]; + + /** + * Constructor + * + * @param minimal $core Instance of the MINIMAL + * @param bool $initialize Initialize a controller? + * + * @return void + */ + public function __construct(minimal $core, bool $initialize = true) + { + // Blocking requests from CloudFlare (better to write this blocking into nginx config file) + if (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] === 'nginx-ssl early hints') return status::bruh->label; + + // 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/author/project/system/controllers/index.php b/author/project/system/controllers/index.php new file mode 100755 index 0000000..29015b7 --- /dev/null +++ b/author/project/system/controllers/index.php @@ -0,0 +1,70 @@ + + */ +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 new file mode 100755 index 0000000..8ce4ff5 --- /dev/null +++ b/author/project/system/models/core.php @@ -0,0 +1,230 @@ + + */ +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/language.php b/author/project/system/models/enumerations/language.php new file mode 100755 index 0000000..4b1f9c0 --- /dev/null +++ b/author/project/system/models/enumerations/language.php @@ -0,0 +1,50 @@ + + * @author mirzaev + */ +enum language +{ + case en; + case ru; + + /** + * Label + * + * Initialize label of the 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 + { + // Exit (success) + return match ($this) { + language::en => match ($language) { + language::en => 'English', + language::ru => 'Английский' + }, + language::ru => match ($language) { + language::en => 'Russian', + language::ru => 'Русский' + } + }; + } +} diff --git a/author/project/system/models/enumerations/session.php b/author/project/system/models/enumerations/session.php new file mode 100755 index 0000000..4307373 --- /dev/null +++ b/author/project/system/models/enumerations/session.php @@ -0,0 +1,21 @@ + + */ +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 new file mode 100755 index 0000000..abe4b2b --- /dev/null +++ b/author/project/system/models/interfaces/collection.php @@ -0,0 +1,31 @@ + + */ +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 new file mode 100755 index 0000000..e8e1357 --- /dev/null +++ b/author/project/system/models/interfaces/document.php @@ -0,0 +1,81 @@ + + */ +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 new file mode 100755 index 0000000..662d7c2 --- /dev/null +++ b/author/project/system/models/session.php @@ -0,0 +1,233 @@ + + */ +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 new file mode 100755 index 0000000..6913521 --- /dev/null +++ b/author/project/system/models/traits/buffer.php @@ -0,0 +1,84 @@ + + */ +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 new file mode 100755 index 0000000..bb7cf56 --- /dev/null +++ b/author/project/system/models/traits/document.php @@ -0,0 +1,206 @@ + + */ +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 new file mode 100755 index 0000000..4b94bc3 --- /dev/null +++ b/author/project/system/models/traits/files.php @@ -0,0 +1,66 @@ + + */ +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 new file mode 100755 index 0000000..4f13b32 --- /dev/null +++ b/author/project/system/models/traits/status.php @@ -0,0 +1,59 @@ + + */ +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 new file mode 100755 index 0000000..5012ff4 --- /dev/null +++ b/author/project/system/public/css/fonts/dejavu.css @@ -0,0 +1,34 @@ +@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 new file mode 100755 index 0000000..074cfc0 --- /dev/null +++ b/author/project/system/public/css/fonts/fira.css @@ -0,0 +1,139 @@ +@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 new file mode 100755 index 0000000..ea1ca63 --- /dev/null +++ b/author/project/system/public/css/fonts/hack.css @@ -0,0 +1,31 @@ +@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 new file mode 100755 index 0000000..5072c39 Binary files /dev/null and b/author/project/system/public/fonts/commissioner.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Bold.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Bold.ttf new file mode 100755 index 0000000..78584c4 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Bold.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-BoldOblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-BoldOblique.ttf new file mode 100755 index 0000000..a013892 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-BoldOblique.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-ExtraLight.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-ExtraLight.ttf new file mode 100755 index 0000000..60dd47e Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-ExtraLight.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Oblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Oblique.ttf new file mode 100755 index 0000000..37e6daf Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSans-Oblique.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSans.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSans.ttf new file mode 100755 index 0000000..6060dfb Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSans.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Bold.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Bold.ttf new file mode 100755 index 0000000..68908d7 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Bold.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-BoldOblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-BoldOblique.ttf new file mode 100755 index 0000000..1a2d58d Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-BoldOblique.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Oblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Oblique.ttf new file mode 100755 index 0000000..6d25e67 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed-Oblique.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed.ttf new file mode 100755 index 0000000..95aaba6 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSansCondensed.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Bold.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Bold.ttf new file mode 100755 index 0000000..c2465b3 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Bold.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-BoldOblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-BoldOblique.ttf new file mode 100755 index 0000000..303202f Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-BoldOblique.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Oblique.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Oblique.ttf new file mode 100755 index 0000000..1df5133 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono-Oblique.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono.ttf new file mode 100755 index 0000000..3206a82 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSansMono.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Bold.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Bold.ttf new file mode 100755 index 0000000..2be31a1 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Bold.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-BoldItalic.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-BoldItalic.ttf new file mode 100755 index 0000000..2c6daba Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-BoldItalic.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Italic.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Italic.ttf new file mode 100755 index 0000000..c52d49f Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif-Italic.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerif.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif.ttf new file mode 100755 index 0000000..046c102 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSerif.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Bold.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Bold.ttf new file mode 100755 index 0000000..fc164c7 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Bold.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-BoldItalic.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-BoldItalic.ttf new file mode 100755 index 0000000..f01089d Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-BoldItalic.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Italic.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Italic.ttf new file mode 100755 index 0000000..6254c8b Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed-Italic.ttf differ diff --git a/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed.ttf b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed.ttf new file mode 100755 index 0000000..6e42557 Binary files /dev/null and b/author/project/system/public/fonts/dejavu/DejaVuLGCSerifCondensed.ttf differ diff --git a/author/project/system/public/fonts/fira/FiraMono-Bold.woff b/author/project/system/public/fonts/fira/FiraMono-Bold.woff new file mode 100755 index 0000000..e7da594 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraMono-Bold.woff differ diff --git a/author/project/system/public/fonts/fira/FiraMono-Bold.woff2 b/author/project/system/public/fonts/fira/FiraMono-Bold.woff2 new file mode 100755 index 0000000..7a3a102 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraMono-Bold.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraMono-Medium.woff b/author/project/system/public/fonts/fira/FiraMono-Medium.woff new file mode 100755 index 0000000..f08fde9 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraMono-Medium.woff differ diff --git a/author/project/system/public/fonts/fira/FiraMono-Medium.woff2 b/author/project/system/public/fonts/fira/FiraMono-Medium.woff2 new file mode 100755 index 0000000..3c9553d Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraMono-Medium.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraMono-Regular.woff b/author/project/system/public/fonts/fira/FiraMono-Regular.woff new file mode 100755 index 0000000..64e33d3 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraMono-Regular.woff differ diff --git a/author/project/system/public/fonts/fira/FiraMono-Regular.woff2 b/author/project/system/public/fonts/fira/FiraMono-Regular.woff2 new file mode 100755 index 0000000..bb452d4 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraMono-Regular.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Bold.woff b/author/project/system/public/fonts/fira/FiraSans-Bold.woff new file mode 100755 index 0000000..8001b79 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Bold.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Bold.woff2 b/author/project/system/public/fonts/fira/FiraSans-Bold.woff2 new file mode 100755 index 0000000..ce8013e Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Bold.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff b/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff new file mode 100755 index 0000000..9c1da3a Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff2 new file mode 100755 index 0000000..cf90d9a Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-BoldItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Book.woff b/author/project/system/public/fonts/fira/FiraSans-Book.woff new file mode 100755 index 0000000..299c884 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Book.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Book.woff2 b/author/project/system/public/fonts/fira/FiraSans-Book.woff2 new file mode 100755 index 0000000..6f9e54d Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Book.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff b/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff new file mode 100755 index 0000000..cc29ba7 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff2 new file mode 100755 index 0000000..1275913 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-BookItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Eight.woff b/author/project/system/public/fonts/fira/FiraSans-Eight.woff new file mode 100755 index 0000000..9261a69 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Eight.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Eight.woff2 b/author/project/system/public/fonts/fira/FiraSans-Eight.woff2 new file mode 100755 index 0000000..729ba54 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Eight.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff b/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff new file mode 100755 index 0000000..000003c Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff2 new file mode 100755 index 0000000..e651af6 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-EightItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff b/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff new file mode 100755 index 0000000..8289f9f Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff2 b/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff2 new file mode 100755 index 0000000..a14dbce Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-ExtraBold.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff b/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff new file mode 100755 index 0000000..5dfa8da Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff2 new file mode 100755 index 0000000..828a57d Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff b/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff new file mode 100755 index 0000000..16ec788 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff2 b/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff2 new file mode 100755 index 0000000..8e98c42 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-ExtraLight.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff b/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff new file mode 100755 index 0000000..99ce8e5 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff2 new file mode 100755 index 0000000..2ea8212 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Four.woff b/author/project/system/public/fonts/fira/FiraSans-Four.woff new file mode 100755 index 0000000..518fd5f Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Four.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Four.woff2 b/author/project/system/public/fonts/fira/FiraSans-Four.woff2 new file mode 100755 index 0000000..33473a6 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Four.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff b/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff new file mode 100755 index 0000000..b407c43 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff2 new file mode 100755 index 0000000..0e64a9c Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-FourItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Hair.woff b/author/project/system/public/fonts/fira/FiraSans-Hair.woff new file mode 100755 index 0000000..ce65bcc Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Hair.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Hair.woff2 b/author/project/system/public/fonts/fira/FiraSans-Hair.woff2 new file mode 100755 index 0000000..64cef84 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Hair.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff b/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff new file mode 100755 index 0000000..08abd3a Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff2 new file mode 100755 index 0000000..b063e87 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-HairItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Heavy.woff b/author/project/system/public/fonts/fira/FiraSans-Heavy.woff new file mode 100755 index 0000000..ff18652 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Heavy.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Heavy.woff2 b/author/project/system/public/fonts/fira/FiraSans-Heavy.woff2 new file mode 100755 index 0000000..0cafdba Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Heavy.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff b/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff new file mode 100755 index 0000000..77c1d55 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff2 new file mode 100755 index 0000000..8d48a7f Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-HeavyItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Italic.woff b/author/project/system/public/fonts/fira/FiraSans-Italic.woff new file mode 100755 index 0000000..d200976 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Italic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Italic.woff2 b/author/project/system/public/fonts/fira/FiraSans-Italic.woff2 new file mode 100755 index 0000000..f7857e9 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Italic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Light.woff b/author/project/system/public/fonts/fira/FiraSans-Light.woff new file mode 100755 index 0000000..309ecf2 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Light.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Light.woff2 b/author/project/system/public/fonts/fira/FiraSans-Light.woff2 new file mode 100755 index 0000000..24e6444 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Light.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff b/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff new file mode 100755 index 0000000..9f3c250 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff2 new file mode 100755 index 0000000..f456ca5 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-LightItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Medium.woff b/author/project/system/public/fonts/fira/FiraSans-Medium.woff new file mode 100755 index 0000000..1701b41 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Medium.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Medium.woff2 b/author/project/system/public/fonts/fira/FiraSans-Medium.woff2 new file mode 100755 index 0000000..71d8ed5 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Medium.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff b/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff new file mode 100755 index 0000000..029099b Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff2 new file mode 100755 index 0000000..97b96c6 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-MediumItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Regular.woff b/author/project/system/public/fonts/fira/FiraSans-Regular.woff new file mode 100755 index 0000000..10c41a7 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Regular.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Regular.woff2 b/author/project/system/public/fonts/fira/FiraSans-Regular.woff2 new file mode 100755 index 0000000..f77c427 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Regular.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff b/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff new file mode 100755 index 0000000..3ccdeb4 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff2 b/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff2 new file mode 100755 index 0000000..29ef538 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-SemiBold.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff b/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff new file mode 100755 index 0000000..378fde9 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff2 new file mode 100755 index 0000000..91182a7 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Thin.woff b/author/project/system/public/fonts/fira/FiraSans-Thin.woff new file mode 100755 index 0000000..21e509d Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Thin.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Thin.woff2 b/author/project/system/public/fonts/fira/FiraSans-Thin.woff2 new file mode 100755 index 0000000..c494caa Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Thin.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff b/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff new file mode 100755 index 0000000..a75b761 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff2 new file mode 100755 index 0000000..4f432d6 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-ThinItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Two.woff b/author/project/system/public/fonts/fira/FiraSans-Two.woff new file mode 100755 index 0000000..3b77a84 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Two.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Two.woff2 b/author/project/system/public/fonts/fira/FiraSans-Two.woff2 new file mode 100755 index 0000000..6842f0c Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Two.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff b/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff new file mode 100755 index 0000000..c2a549d Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff2 new file mode 100755 index 0000000..6b176c7 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-TwoItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Ultra.woff b/author/project/system/public/fonts/fira/FiraSans-Ultra.woff new file mode 100755 index 0000000..705346e Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Ultra.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-Ultra.woff2 b/author/project/system/public/fonts/fira/FiraSans-Ultra.woff2 new file mode 100755 index 0000000..25e5e6a Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-Ultra.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff b/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff new file mode 100755 index 0000000..1790a76 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff2 new file mode 100755 index 0000000..7b9b43b Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-UltraItalic.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff b/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff new file mode 100755 index 0000000..cbc1f31 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff2 b/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff2 new file mode 100755 index 0000000..82046b1 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-UltraLight.woff2 differ diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff b/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff new file mode 100755 index 0000000..5f0ef24 Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff differ diff --git a/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff2 b/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff2 new file mode 100755 index 0000000..a50a5df Binary files /dev/null and b/author/project/system/public/fonts/fira/FiraSans-UltraLightItalic.woff2 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 new file mode 100755 index 0000000..99e9e7b Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-bold-subset.woff 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 new file mode 100755 index 0000000..ae3694f Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-bold-subset.woff2 differ diff --git a/author/project/system/public/fonts/hack/hack-bold.woff b/author/project/system/public/fonts/hack/hack-bold.woff new file mode 100755 index 0000000..7a64513 Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-bold.woff differ diff --git a/author/project/system/public/fonts/hack/hack-bold.woff2 b/author/project/system/public/fonts/hack/hack-bold.woff2 new file mode 100755 index 0000000..a25b27d Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-bold.woff2 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 new file mode 100755 index 0000000..91399f9 Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-bolditalic-subset.woff 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 new file mode 100755 index 0000000..55d67b8 Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-bolditalic-subset.woff2 differ diff --git a/author/project/system/public/fonts/hack/hack-bolditalic.woff b/author/project/system/public/fonts/hack/hack-bolditalic.woff new file mode 100755 index 0000000..993d05a Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-bolditalic.woff differ diff --git a/author/project/system/public/fonts/hack/hack-bolditalic.woff2 b/author/project/system/public/fonts/hack/hack-bolditalic.woff2 new file mode 100755 index 0000000..5415871 Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-bolditalic.woff2 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 new file mode 100755 index 0000000..4d747c7 Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-italic-subset.woff 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 new file mode 100755 index 0000000..bbb6240 Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-italic-subset.woff2 differ diff --git a/author/project/system/public/fonts/hack/hack-italic.woff b/author/project/system/public/fonts/hack/hack-italic.woff new file mode 100755 index 0000000..b79f9e4 Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-italic.woff differ diff --git a/author/project/system/public/fonts/hack/hack-italic.woff2 b/author/project/system/public/fonts/hack/hack-italic.woff2 new file mode 100755 index 0000000..40522cc Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-italic.woff2 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 new file mode 100755 index 0000000..65a07e4 Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-regular-subset.woff 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 new file mode 100755 index 0000000..ae9eca7 Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-regular-subset.woff2 differ diff --git a/author/project/system/public/fonts/hack/hack-regular.woff b/author/project/system/public/fonts/hack/hack-regular.woff new file mode 100755 index 0000000..07d1b32 Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-regular.woff differ diff --git a/author/project/system/public/fonts/hack/hack-regular.woff2 b/author/project/system/public/fonts/hack/hack-regular.woff2 new file mode 100755 index 0000000..cc862c7 Binary files /dev/null and b/author/project/system/public/fonts/hack/hack-regular.woff2 differ diff --git a/author/project/system/public/index.php b/author/project/system/public/index.php new file mode 100755 index 0000000..242bde7 --- /dev/null +++ b/author/project/system/public/index.php @@ -0,0 +1,46 @@ +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 new file mode 100644 index 0000000..faf9c91 --- /dev/null +++ b/author/project/system/public/themes/default/css/aside.css @@ -0,0 +1,4 @@ +@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 new file mode 100644 index 0000000..9eaf50b --- /dev/null +++ b/author/project/system/public/themes/default/css/colors.css @@ -0,0 +1,37 @@ +@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 new file mode 100755 index 0000000..84f16b4 --- /dev/null +++ b/author/project/system/public/themes/default/css/fonts.css @@ -0,0 +1,9 @@ +@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 new file mode 100644 index 0000000..605243b --- /dev/null +++ b/author/project/system/public/themes/default/css/footer.css @@ -0,0 +1,4 @@ +@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 new file mode 100644 index 0000000..b440dd5 --- /dev/null +++ b/author/project/system/public/themes/default/css/header.css @@ -0,0 +1,4 @@ +@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 new file mode 100755 index 0000000..ac799a9 --- /dev/null +++ b/author/project/system/public/themes/default/css/main.css @@ -0,0 +1,9 @@ +@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 new file mode 100644 index 0000000..1137f56 --- /dev/null +++ b/author/project/system/public/themes/default/css/system.css @@ -0,0 +1,34 @@ +@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/.gitignore b/author/project/system/settings/.gitignore new file mode 100755 index 0000000..2027072 --- /dev/null +++ b/author/project/system/settings/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!*.sample diff --git a/author/project/system/settings/arangodb.php.sample b/author/project/system/settings/arangodb.php.sample new file mode 100755 index 0000000..90ecb55 --- /dev/null +++ b/author/project/system/settings/arangodb.php.sample @@ -0,0 +1,8 @@ + 'unix:///var/run/arangodb3/arango.sock', + 'database' => 'comrader', + 'name' => 'comrader', + 'password' => '' +]; diff --git a/author/project/system/views/templater.php b/author/project/system/views/templater.php new file mode 100755 index 0000000..9c1f4a1 --- /dev/null +++ b/author/project/system/views/templater.php @@ -0,0 +1,214 @@ + + */ +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 new file mode 100644 index 0000000..afb2aa1 --- /dev/null +++ b/author/project/system/views/themes/default/aside.html @@ -0,0 +1,10 @@ +{% 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 new file mode 100755 index 0000000..1bb43a7 --- /dev/null +++ b/author/project/system/views/themes/default/core.html @@ -0,0 +1,31 @@ + + + + + + {% 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 new file mode 100755 index 0000000..8322f33 --- /dev/null +++ b/author/project/system/views/themes/default/footer.html @@ -0,0 +1,10 @@ +{% 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 new file mode 100755 index 0000000..1b6dba3 --- /dev/null +++ b/author/project/system/views/themes/default/head.html @@ -0,0 +1,24 @@ +{% block title %} +{% if head.title != empty %}{{ head.title }}{% else %}comrader 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 new file mode 100755 index 0000000..430650a --- /dev/null +++ b/author/project/system/views/themes/default/header.html @@ -0,0 +1,10 @@ +{% 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 new file mode 100755 index 0000000..474fd75 --- /dev/null +++ b/author/project/system/views/themes/default/index.html @@ -0,0 +1,28 @@ +{% 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 new file mode 100755 index 0000000..784e58d --- /dev/null +++ b/author/project/system/views/themes/default/js.html @@ -0,0 +1,5 @@ +{% block js %} +{% for element in js %} + +{% endfor %} +{% endblock %} diff --git a/composer.json b/composer.json new file mode 100755 index 0000000..dfa06ec --- /dev/null +++ b/composer.json @@ -0,0 +1,48 @@ +{ + "name": "mirzaev/comrader", + "description": "Dating by political views Telegram chat-robot", + "homepage": "https://git.mirzaev.sexy/mirzaev/comrader", + "type": "site", + "keywords": [ + "minimal" + ], + "readme": "README.md", + "license": "WTFPL", + "authors": [ + { + "name": "mirzaev", + "email": "mirzaev@gmail.com", + "homepage": "https://mirzaev.page", + "role": "Programmer" + } + ], + "support": { + "wiki": "https://git.mirzaev.sexy/mirzaev/comrader/wiki", + "issues": "https://git.mirzaev.sexy/mirzaev/comrader/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" + }, + "autoload": { + "psr-4": { + "mirzaev\\comrader\\": "mirzaev/comrader/system" + } + }, + "autoload-dev": { + "psr-4": { + "mirzaev\\comrader\\tests\\": "mirzaev/comrader/tests" + } + }, + "scripts": { + "pre-update-cmd": "./install.sh" + } +} diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..f1fad2c --- /dev/null +++ b/install.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -d author/project ]; then + mv author/project author/comrader +fi + +if [ -d author ]; then + mv author mirzaev +fi +