Compare commits

...

50 Commits

Author SHA1 Message Date
Arsen Mirzaev Tatyano-Muradovich d3a47b04fb body margin unset 2025-04-10 22:47:34 +07:00
Arsen Mirzaev Tatyano-Muradovich 1a05a0413d returned templater 2025-04-10 22:33:05 +07:00
Arsen Mirzaev Tatyano-Muradovich 8c777e72c7 $ to $$ 2025-03-30 00:37:01 +07:00
Arsen Mirzaev Tatyano-Muradovich a62b5ad3e5 resolved #13, resolved #14, resolved #15 2025-02-26 13:40:06 +07:00
Arsen Mirzaev Tatyano-Muradovich 4eecb4c5ed resolved #13, resolved #14 2025-02-26 13:27:59 +07:00
Arsen Mirzaev Tatyano-Muradovich ff663e7bf7 resolved #12 2025-02-21 12:07:50 +07:00
Arsen Mirzaev Tatyano-Muradovich 32d92bcc7e resolved #11 2025-02-21 12:07:15 +07:00
Arsen Mirzaev Tatyano-Muradovich 5c06ec423a resolved #10 2025-02-21 11:57:23 +07:00
Arsen Mirzaev Tatyano-Muradovich 41c0e2717c "/css/themes/default" to "/themes/default/css" 2024-12-17 15:17:45 +07:00
Arsen Mirzaev Tatyano-Muradovich 6109c2dd2f added fonts 2024-12-17 15:02:07 +07:00
Arsen Mirzaev Tatyano-Muradovich 9f375114ef deleted spaces 2024-12-17 14:25:47 +07:00
Arsen Mirzaev Tatyano-Muradovich f8f6119ef6 added dynamic load css 2024-12-17 14:25:10 +07:00
Arsen Mirzaev Tatyano-Muradovich 9ef52e1dfc "javascript" to "js" 2024-12-17 14:22:47 +07:00
Arsen Mirzaev Tatyano-Muradovich d3775bf96d some syntax errors 2024-12-16 23:23:46 +07:00
Arsen Mirzaev Tatyano-Muradovich 510a80665b added "/themes/default/" 2024-12-16 23:21:31 +07:00
Arsen Mirzaev Tatyano-Muradovich e805fe9e76 fixed for core.html 2024-12-16 23:21:10 +07:00
Arsen Mirzaev Tatyano-Muradovich 2c29d0c842 added "/themes/default/" 2024-12-16 23:18:03 +07:00
Arsen Mirzaev Tatyano-Muradovich 93311f1857 `getGlobal` to `getGlobals()` 2024-12-16 22:47:43 +07:00
Arsen Mirzaev Tatyano-Muradovich b86e856fe7 `views\manager` to `views\templater` 2024-12-16 22:44:36 +07:00
Arsen Mirzaev Tatyano-Muradovich a893aa6b5a $minimal to $core 2024-12-16 22:42:08 +07:00
Arsen Mirzaev Tatyano-Muradovich 321c28a53e ${REPO_OWNER}\${REPO_NAME}\models\enumerations\language 2024-12-16 22:23:31 +07:00
Arsen Mirzaev Tatyano-Muradovich 9b958b6a88 $$router to $$core 2024-12-16 20:01:33 +07:00
Arsen Mirzaev Tatyano-Muradovich 24fcef43f7 `PUBLIC` to `INDEX` lol 2024-12-16 20:00:20 +07:00
Arsen Mirzaev Tatyano-Muradovich c9e5cb3762 mirzaev\minimal\http\enumerations\content 2024-12-16 19:50:07 +07:00
Arsen Mirzaev Tatyano-Muradovich 2c6ed07ded {{ theme }} to "default" back 2024-12-16 18:33:58 +07:00
Arsen Mirzaev Tatyano-Muradovich 96388c220e any type instead fixed "module" 2024-12-16 18:25:49 +07:00
Arsen Mirzaev Tatyano-Muradovich c2cba489d1 added dynamic load javascript 2024-12-16 18:23:15 +07:00
Arsen Mirzaev Tatyano-Muradovich aad0a5a051 forget about it 2024-12-16 18:16:53 +07:00
Arsen Mirzaev Tatyano-Muradovich 8159f6866d created main.html 2024-12-16 18:15:28 +07:00
Arsen Mirzaev Tatyano-Muradovich 9dccb451f6 added aside.html 2024-12-16 18:13:59 +07:00
Arsen Mirzaev Tatyano-Muradovich 9f3b87c1ed created aside.html 2024-12-16 18:13:16 +07:00
Arsen Mirzaev Tatyano-Muradovich e0845e2ef1 added colors.css 2024-12-16 17:08:39 +07:00
Arsen Mirzaev Tatyano-Muradovich 5c0f1815c0 created colors.css 2024-12-16 17:07:28 +07:00
Arsen Mirzaev Tatyano-Muradovich 6a4cfb8e2f deleted EOL 2024-12-16 17:05:44 +07:00
Arsen Mirzaev Tatyano-Muradovich 7ddf05ead3 Обновить author/project/system/public/css/themes/default/system.css 2024-12-16 17:04:53 +07:00
Arsen Mirzaev Tatyano-Muradovich b6d2725848 separated 2024-12-16 17:04:30 +07:00
Arsen Mirzaev Tatyano-Muradovich 3a2e102e11 created footer.css 2024-12-16 17:04:01 +07:00
Arsen Mirzaev Tatyano-Muradovich 3aa8936fc5 created aside.css 2024-12-16 17:03:32 +07:00
Arsen Mirzaev Tatyano-Muradovich 3af08b07ed created header.css 2024-12-16 17:03:13 +07:00
Arsen Mirzaev Tatyano-Muradovich 4f4d31b64a created system.css 2024-12-16 17:02:39 +07:00
Arsen Mirzaev Tatyano-Muradovich c0515a4171 separating main.css 2024-12-16 16:59:26 +07:00
Arsen Mirzaev Tatyano-Muradovich 02d1350982 {{ theme }} 2024-12-16 16:54:55 +07:00
Arsen Mirzaev Tatyano-Muradovich 37ae0546fd `INDEX` to `PUBLIC` 2024-12-16 15:52:52 +07:00
Arsen Mirzaev Tatyano-Muradovich 0510dca375 removed dublicate 2024-12-16 15:52:20 +07:00
Arsen Mirzaev Tatyano-Muradovich 2b3f624199 resolved #1 2024-12-15 22:16:01 +07:00
Arsen Mirzaev Tatyano-Muradovich 0843fd83a5 PHP 8.4 + MINIMAL 3.2.0 + many improvements 2024-12-15 00:20:44 +03:00
Arsen Mirzaev Tatyano-Muradovich 7f7cdced69 Обновить composer.json 2024-09-08 15:37:23 +07:00
Arsen Mirzaev Tatyano-Muradovich 04f8b49075 added other directories to indexing 2024-01-11 06:52:03 +07:00
Arsen Mirzaev Tatyano-Muradovich a634e1b7c1 composer script fix 2024-01-11 06:17:52 +07:00
Arsen Mirzaev Tatyano-Muradovich 56f27f6f62 composer fix and installer fix 2024-01-11 05:58:38 +07:00
141 changed files with 722 additions and 840 deletions

2
.gitea/template Normal file → Executable file
View File

@ -1 +1 @@
*
**

0
.gitignore vendored Normal file → Executable file
View File

128
author/project/system/controllers/core.php Normal file → Executable file
View File

@ -5,117 +5,79 @@ declare(strict_types=1);
namespace ${REPO_OWNER}\${REPO_NAME}\controllers;
// Files of the project
use ${REPO_OWNER}\${REPO_NAME}\views\manager,
use ${REPO_OWNER}\${REPO_NAME}\views\templater,
${REPO_OWNER}\${REPO_NAME}\models\core as models,
${REPO_OWNER}\${REPO_NAME}\models\account_model as account,
${REPO_OWNER}\${REPO_NAME}\models\session_model as session;
// Library for ArangoDB
use ArangoDBClient\Document as _document;
${REPO_OWNER}\${REPO_NAME}\models\session,
${REPO_OWNER}\${REPO_NAME}\models\enumerations\language;
// Framework for PHP
use mirzaev\minimal\controller;
use mirzaev\minimal\core as minimal,
mirzaev\minimal\controller,
mirzaev\minimal\http\response,
mirzaev\minimal\http\enumerations\status;
/**
* Core of controllers
* Controllers core
*
* @package ${REPO_OWNER}\${REPO_NAME}\controllers
* @author ${REPO_OWNER} < mail >
*
* @param language $$language Language
* @param response $$response Response
* @param array $$errors Registry of errors
*
* @method void __construct(minimal $$minimal) Constructor
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
* @author ${REPO_OWNER} <mail@domain.zone>
*/
class core extends controller
{
/**
* Postfix for name of controllers files
* Language
*
* @var language $$language Language
*/
final public const POSTFIX = '';
protected language $$language = language::en;
/**
* Instance of a session
* Response
*
* @see https://wiki.php.net/rfc/property-hooks (find a table about backed and virtual hooks)
*
* @var response $$response Response
*/
protected readonly session $session;
protected response $$response {
// Read
get => $$this->response ??= $$this->request->response();
}
/**
* Instance of an account
* Errors
*
* @var array $$errors Registry of errors
*/
protected readonly ?account $account;
/**
* Registry of errors
*/
protected array $errors = [
'session' => [],
'account' => []
protected array $$errors = [
'system' => []
];
/**
* Constructor of an instance
* Constructor
*
* @param bool $initialize Initialize a controller?
* @param minimal $$core Instance of the MINIMAL
* @param bool $$initialize Initialize a controller?
*
* @return void
*/
public function __construct(bool $initialize = true)
public function __construct(minimal $$core)
{
// Blocking requests from CloudFlare (better to write this blocking into nginx config file)
if ($_SERVER['HTTP_USER_AGENT'] === 'nginx-ssl early hints') return;
if (isset($$_SERVER['HTTP_USER_AGENT']) && $$_SERVER['HTTP_USER_AGENT'] === 'nginx-ssl early hints') return status::bruh->label;
// Initializing the view template engine instance
$$this->view = new templater($$this->session);
// For the extends system
parent::__construct($initialize);
if ($initialize) {
// Initializing is requested
// Initializing of models core (connect to ArangoDB...)
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);
}
parent::__construct(core: $$core);
}
/**
* Check of initialization
*
* Checks whether a property is initialized in a document instance from ArangoDB
*
* @param string $name Name of the property from ArangoDB
*
* @return bool The property is initialized?
*/
public function __isset(string $name): bool
{
// Check of initialization of the property and exit (success)
return match ($name) {
default => isset($this->{$name})
};
}
}

55
author/project/system/controllers/index.php Normal file → Executable file
View File

@ -7,24 +7,63 @@ namespace ${REPO_OWNER}\${REPO_NAME}\controllers;
// Files of the project
use ${REPO_OWNER}\${REPO_NAME}\controllers\core;
// Framework for PHP
use mirzaev\minimal\http\enumerations\content,
mirzaev\minimal\http\enumerations\status;
/**
* Index controller
* Index
*
* @package ${REPO_OWNER}\${REPO_NAME}\controllers
* @author ${REPO_OWNER} < mail >
*
* @param array $$errors Registry of errors
*
* @method null index() Main page
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
* @author ${REPO_OWNER} <mail@domain.zone>
*/
final class index extends core
{
/**
* Render the main page
* Errors
*
* @param array $parameters Parameters of the request (POST + GET)
* @var array $$errors Registry of errors
*/
public function index(array $parameters = []): ?string
protected array $$errors = [
'system' => []
];
/**
* Main page
*
* @return null
*/
public function index(): null
{
// Exit (success)
if ($_SERVER['REQUEST_METHOD'] === 'GET') return $this->view->render(DIRECTORY_SEPARATOR . 'index.html');
else if ($_SERVER['REQUEST_METHOD'] === 'POST') return $main;
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;

View File

@ -0,0 +1,3 @@
!.gitignore
*.baza
*.php

284
author/project/system/models/core.php Normal file → Executable file
View File

@ -5,285 +5,41 @@ declare(strict_types=1);
namespace ${REPO_OWNER}\${REPO_NAME}\models;
// Framework for PHP
use mirzaev\minimal\model;
// Framework for ArangoDB
use mirzaev\arangodb\connection as arangodb,
mirzaev\arangodb\collection,
mirzaev\arangodb\document;
// Libraries for ArangoDB
use ArangoDBClient\Document as _document,
ArangoDBClient\DocumentHandler as _document_handler;
use mirzaev\minimal\model,
mirzaev\minimal\http\enumerations\status;
// Built-in libraries
use exception;
/**
* Core of models
* Models core
*
* @package ${REPO_OWNER}\${REPO_NAME}\controllers
* @author ${REPO_OWNER} < mail >
* @package ${REPO_OWNER}\${REPO_NAME}\models
*
* @method void __construct() Constructor
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
* @author ${REPO_OWNER} <mail@domain.zone>
*/
class core extends model
{
/**
* Postfix for name of models files
*/
final public const POSTFIX = '';
/**
* Path to the file with settings of connecting to the ArangoDB
*/
final public const ARANGODB = '../settings/arangodb.php';
/**
* Instance of the session of ArangoDB
*/
protected static arangodb $arangodb;
/**
* Name of the collection in ArangoDB
*/
public const COLLECTION = 'THIS_COLLECTION_SHOULD_NOT_EXIST_REPLACE_IT_IN_THE_MODEL';
/**
* Constructor of an instance
* File
*
* @param bool $initialize Initialize a model?
* @param ?arangodb $arangodb Instance of a session of ArangoDB
* @var string $database Path to the database file
*/
protected string $$file = DATABASES . DIRECTORY_SEPARATOR . 'example.baza';
/**
* Constructor
*
* Initialize the database
*
* @return void
*/
public function __construct(bool $initialize = true, ?arangodb $arangodb = null)
public function __construct()
{
// For the extends system
parent::__construct($initialize);
if ($initialize) {
// Initializing is requested
if (isset($arangodb)) {
// Recieved an instance of a session of ArangoDB
// Write an instance of a session of ArangoDB to the property
$this->__set('arangodb', $arangodb);
} else {
// Not recieved an instance of a session of ArangoDB
// Initializing of an instance of a session of ArangoDB
$this->__get('arangodb');
}
}
}
/**
* Read 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 &$errors The registry on errors
*
* @return _document|array|null 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 &$errors = []
): _document|array|null {
try {
if (collection::init(static::$arangodb->session, static::COLLECTION)) {
// Initialized the collection
// Read from ArangoDB and exit (success)
return collection::search(
static::$arangodb->session,
sprintf(
<<<'AQL'
FOR d IN %s
%s
%s
LIMIT %d, %d
RETURN %s
AQL,
static::COLLECTION,
empty($filter) ? '' : "FILTER $filter",
empty($sort) ? '' : "SORT $sort",
--$page <= 0 ? 0 : $amount * $page,
$amount,
$return
)
);
} else throw new exception('Failed to initialize the collection');
} catch (exception $e) {
// Write to the registry of errors
$errors[] = [
'text' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'stack' => $e->getTrace()
];
}
// Exit (fail)
return null;
}
/**
* Delete from ArangoDB
*
* @param _document $instance Instance of the document from ArangoDB
* @param array &$errors The registry on errors
*
* @return bool Deleted from ArangoDB without errors?
*/
public static function delete(_document $instance, array &$errors = []): bool
{
try {
if (collection::init(static::$arangodb->session, static::COLLECTION)) {
// Initialized the collection
// Delete from ArangoDB and exit (success)
return (new _document_handler(static::$arangodb->session))->remove($instance);
} else throw new exception('Failed to initialize the collection');
} catch (exception $e) {
// Write to the registry of errors
$errors[] = [
'text' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'stack' => $e->getTrace()
];
}
// Exit (fail)
return false;
}
/**
* Update in ArangoDB
*
* @param _document $instance Instance of the document from ArangoDB
*
* @return bool Writed to ArangoDB without errors?
*/
public static function update(_document $instance): bool
{
// Update in ArangoDB and exit (success)
return document::update(static::$arangodb->session, $instance);
}
/**
* 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 ($this->__isset('arangodb')) {
// Is alredy initialized
// Exit (fail)
throw new exception('Forbidden to reinitialize the session of ArangoDB ($this::$arangodb)', 500);
} else {
// Is not already initialized
if ($value instanceof arangodb) {
// Recieved an appropriate value
// Write the property and exit (success)
self::$arangodb = $value;
} else {
// Recieved an inappropriate value
// Exit (fail)
throw new exception('Session of ArangoDB ($this::$arangodb) is need to be mirzaev\arangodb\connection', 500);
}
}
})(),
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) {
'arangodb' => (function () {
try {
if (!$this->__isset('arangodb')) {
// Is not initialized
// Initializing of a default value from settings
$this->__set('arangodb', new arangodb(require static::ARANGODB));
}
// Exit (success)
return self::$arangodb;
} catch (exception) {
// Exit (fail)
return null;
}
})(),
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
{
match ($name) {
'arangodb' => (new static)->__get('arangodb'),
default => throw new exception("Not found: $name", 500)
};
}
}

View File

@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
namespace ${REPO_OWNER}\${REPO_NAME}\models\enumerations;
/**
* Language
*
* Types of languages by ISO 639-1 standart
*
* @package ${REPO_OWNER}\${REPO_NAME}\models\enumerations
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
* @author ${REPO_OWNER} <mail@domain.zone>
*/
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
*/
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 => 'Русский'
}
};
}
/**
* 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 => '🇷🇺'
};
}
}

View File

@ -1,276 +0,0 @@
<?php
declare(strict_types=1);
namespace ${REPO_OWNER}\${REPO_NAME}\models;
// Files of the project
use mirzaev\ebala\models\account,
mirzaev\ebala\models\traits\status;
// Framework for ArangoDB
use mirzaev\arangodb\collection,
mirzaev\arangodb\document;
// Library для ArangoDB
use ArangoDBClient\Document as _document;
// Built-in libraries
use exception;
/**
* Model of session
*
* @package ${REPO_OWNER}\${REPO_NAME}\controllers
* @author ${REPO_OWNER} < mail >
*/
final class session extends core
{
/**
* Name of the collection in ArangoDB
*/
final public const COLLECTION = 'session';
/**
* An instance of the ArangoDB document from ArangoDB
*/
protected readonly _document $document;
/**
* Constructor of an instance
*
* Initialize of a session and write them to 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 static instance of the ArangoDB document of session
*/
public function __construct(?string $hash = null, ?int $expires = null, array &$errors = [])
{
try {
if (collection::init(static::$arangodb->session, self::COLLECTION)) {
// Initialized the collection
if ($this->search($hash, $errors)) {
// Found an instance of the ArangoDB document of session and received a session hash
} else {
// Not found an instance of the ArangoDB document of session
// Initializing a new session and write they into ArangoDB
$_id = document::write($this::$arangodb->session, self::COLLECTION, [
'active' => true,
'expires' => $expires ?? time() + 604800,
'ip' => $_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::search($this::$arangodb->session, sprintf(
<<<AQL
FOR d IN %s
FILTER d._id == '%s' && d.expires > %d && d.active == true
RETURN d
AQL,
self::COLLECTION,
$_id,
time()
))) {
// Found an instance of just created new session
// Generate a hash and write into an instance of the ArangoDB document of session property
$session->hash = sodium_bin2hex(sodium_crypto_generichash($_id));
if (document::update($this::$arangodb->session, $session)) {
// Is writed update
// Write instance of the ArangoDB document of session into property and exit (success)
$this->document = $session;
} else throw new exception('Could not write the session data');
} else throw new exception('Could not create or find just created session');
}
} else throw new exception('Could not initialize the collection');
} catch (exception $e) {
// Write to the registry of errors
$errors[] = [
'text' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'stack' => $e->getTrace()
];
}
}
/**
* Search
*
* Search for the session in ArangoDB by hash and write they into $this->document property if they are found
*
* @param ?string $hash Hash of the session in ArangoDB
* @param array &$errors Registry of errors
*
* @return static instance of the ArangoDB document of session
*/
public function search(?string $hash, array &$errors = []): bool
{
try {
if (isset($hash)) {
// Recieved a hash
// Search the session data in ArangoDB
$_document = $session = collection::search($this::$arangodb->session, sprintf(
<<<AQL
FOR d IN %s
FILTER d.hash == '%s' && d.expires > %d && d.active == true
RETURN d
AQL,
self::COLLECTION,
$hash,
time()
));
if ($_document instanceof _document) {
// An instance of the ArangoDB document of session is found
// Write the session data to the property
$this->document = $_document;
// Exit (success)
return true;
}
}
} catch (exception $e) {
// Write to the registry of errors
$errors[] = [
'text' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'stack' => $e->getTrace()
];
}
// Exit (fail)
return false;
}
/**
* Write to buffer of the session
*
* @param array $data Data for merging
* @param array &$errors Registry of errors
*
* @return bool Is data has written into the session buffer?
*/
public function write(array $data, array &$errors = []): bool
{
try {
if (collection::init($this::$arangodb->session, self::COLLECTION)) {
// Initialized the collection
// An instance of the ArangoDB document of session is initialized?
if (!isset($this->document)) throw new exception('An instance of the ArangoDB document of session is not initialized');
// Write data into buffwer of an instance of the ArangoDB document of session
$this->document->buffer = array_replace_recursive(
$this->document->buffer ?? [],
[$_SERVER['INTERFACE'] => array_replace_recursive($this->document->buffer[$_SERVER['INTERFACE']] ?? [], $data)]
);
// Write to ArangoDB and exit (success)
return document::update($this::$arangodb->session, $this->document) ? true : throw new exception('Не удалось записать данные в буфер сессии');
} else throw new exception('Could not initialize the collection');
} catch (exception $e) {
// Write to the registry of errors
$errors[] = [
'text' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'stack' => $e->getTrace()
];
}
return false;
}
/**
* 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
{
// Write 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) {
'arangodb' => $this::$arangodb,
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)
if (method_exists($this->document, $name)) return $this->document->{$name}($arguments);
}
}

View File

@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace ${REPO_OWNER}\${REPO_NAME}\models\traits;
// Built-in libraries
use exception;
/**
* Files
*
* Trait with files handlers
*
* @method static void delete(string $$directory, array &$$errors)
*
* @package ${REPO_OWNER}\${REPO_NAME}\models\traits
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
* @author ${REPO_OWNER} <mail@domain.zone>
*/
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;
}
}

View File

@ -1,45 +0,0 @@
<?php
declare(strict_types=1);
namespace ${REPO_OWNER}\${REPO_NAME}\models\traits;
// Built-in libraries
use exception;
/**
* Trait fo initialization of a status
*
* @package ${REPO_OWNER}\${REPO_NAME}\models\traits
*
* @author ${REPO_OWNER} < mail >
*/
trait status
{
/**
* Initialize of a status
*
* @param array &$errors Registry of errors
*
* @return ?bool Status, if they are found
*/
public function status(array &$errors = []): ?bool
{
try {
// Read from ArangoDB and exit (success)
return $this->document->active ?? false;
} catch (exception $e) {
// Write to the registry of errors
$errors[] = [
'text' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'stack' => $e->getTrace()
];
}
// Exit (fail)
return null;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More