Compare commits
36 Commits
2.3.0
...
a76e11fb9f
| Author | SHA1 | Date | |
|---|---|---|---|
| a76e11fb9f | |||
| 190ef8eabd | |||
| 41fcf9319b | |||
| 8b5a49747b | |||
| f2eb59336e | |||
| 913dfb8a92 | |||
| 372d008545 | |||
| e38a870e71 | |||
| 36b48d14d1 | |||
| 1261738c3d | |||
| 9718bec887 | |||
| 7f8525789e | |||
| c6f7f65360 | |||
| c65f7d4055 | |||
| bdef194b68 | |||
| a3eeacc4b4 | |||
| da69b20491 | |||
| 1d4d3e5f24 | |||
| 2b417f1649 | |||
| 1ee4c9a7dd | |||
| ece40a8644 | |||
| 6e5339a7d9 | |||
| b989a89e2b | |||
| fbcb72a47b | |||
| 485ac59c69 | |||
| 315f9bb7e3 | |||
| 9baf88d93c | |||
| d3a47b04fb | |||
| 1a05a0413d | |||
| 8c777e72c7 | |||
| a62b5ad3e5 | |||
| 4eecb4c5ed | |||
| ff663e7bf7 | |||
| 32d92bcc7e | |||
| 5c06ec423a | |||
| 41c0e2717c |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,3 @@
|
|||||||
!.gitignore
|
!.gitignore
|
||||||
composer.phar
|
composer.phar
|
||||||
composer.lock
|
|
||||||
vendor
|
vendor
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ namespace ${REPO_OWNER}\${REPO_NAME}\controllers;
|
|||||||
|
|
||||||
// Files of the project
|
// Files of the project
|
||||||
use ${REPO_OWNER}\${REPO_NAME}\views\templater,
|
use ${REPO_OWNER}\${REPO_NAME}\views\templater,
|
||||||
${REPO_OWNER}\${REPO_NAME}\models\core as models,
|
${REPO_OWNER}\${REPO_NAME}\models\core as models;
|
||||||
${REPO_OWNER}\${REPO_NAME}\models\session,
|
|
||||||
${REPO_OWNER}\${REPO_NAME}\models\enumerations\language;
|
// Library for languages support
|
||||||
|
use mirzaev\languages\language;
|
||||||
|
|
||||||
// Framework for PHP
|
// Framework for PHP
|
||||||
use mirzaev\minimal\core as minimal,
|
use mirzaev\minimal\core as minimal,
|
||||||
@@ -21,25 +22,17 @@ use mirzaev\minimal\core as minimal,
|
|||||||
*
|
*
|
||||||
* @package ${REPO_OWNER}\${REPO_NAME}\controllers
|
* @package ${REPO_OWNER}\${REPO_NAME}\controllers
|
||||||
*
|
*
|
||||||
* @param session $$session Instance of the session
|
|
||||||
* @param language $$language Language
|
* @param language $$language Language
|
||||||
* @param response $$response Response
|
* @param response $$response Response
|
||||||
* @param array $$errors Registry of errors
|
* @param array $$errors Registry of errors
|
||||||
*
|
*
|
||||||
* @method void __construct(minimal $$minimal, bool $$initialize) Constructor
|
* @method void __construct(minimal $$minimal) Constructor
|
||||||
*
|
*
|
||||||
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
* @author ${REPO_OWNER} <mail@domain.zone>
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
*/
|
*/
|
||||||
class core extends controller
|
class core extends controller
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Session
|
|
||||||
*
|
|
||||||
* @var session|null $$session Instance of the session
|
|
||||||
*/
|
|
||||||
protected readonly session $$session;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language
|
* Language
|
||||||
*
|
*
|
||||||
@@ -65,8 +58,7 @@ class core extends controller
|
|||||||
* @var array $$errors Registry of errors
|
* @var array $$errors Registry of errors
|
||||||
*/
|
*/
|
||||||
protected array $$errors = [
|
protected array $$errors = [
|
||||||
'session' => [],
|
'system' => []
|
||||||
'account' => []
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,50 +69,15 @@ class core extends controller
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(minimal $$core, bool $$initialize = true)
|
public function __construct(minimal $$core)
|
||||||
{
|
{
|
||||||
// Blocking requests from CloudFlare (better to write this blocking into nginx config file)
|
// Blocking requests from CloudFlare (better to write this blocking into nginx config file)
|
||||||
if (isset($$_SERVER['HTTP_USER_AGENT']) && $$_SERVER['HTTP_USER_AGENT'] === 'nginx-ssl early hints') return status::bruh->label;
|
if (isset($$_SERVER['HTTP_USER_AGENT']) && $$_SERVER['HTTP_USER_AGENT'] === 'nginx-ssl early hints') return status::bruh->label;
|
||||||
|
|
||||||
|
// Initializing the view template engine instance
|
||||||
|
$$this->view = new templater();
|
||||||
|
|
||||||
// For the extends system
|
// For the extends system
|
||||||
parent::__construct(core: $$core);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ use mirzaev\minimal\http\enumerations\content,
|
|||||||
* @method null index() Main page
|
* @method null index() Main page
|
||||||
*
|
*
|
||||||
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
* @author ${REPO_OWNER} <mail@domain.zone>
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
*/
|
*/
|
||||||
final class index extends core
|
final class index extends core
|
||||||
{
|
{
|
||||||
@@ -31,7 +31,7 @@ final class index extends core
|
|||||||
* @var array $$errors Registry of errors
|
* @var array $$errors Registry of errors
|
||||||
*/
|
*/
|
||||||
protected array $$errors = [
|
protected array $$errors = [
|
||||||
'session' => []
|
'system' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,8 +41,8 @@ final class index extends core
|
|||||||
*/
|
*/
|
||||||
public function index(): null
|
public function index(): null
|
||||||
{
|
{
|
||||||
if (str_contains($$this->request->headers['accept'], content::any->value)) {
|
if (str_contains($$this->request->headers['accept'] ?? '', content::html->value)) {
|
||||||
// Request for any response
|
// Request for HTML response
|
||||||
|
|
||||||
// Render page
|
// Render page
|
||||||
$$page = $$this->view->render('index.html');
|
$$page = $$this->view->render('index.html');
|
||||||
|
|||||||
3
author/project/system/databases/.gitignore
vendored
Normal file
3
author/project/system/databases/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
!.gitignore
|
||||||
|
!*.php
|
||||||
|
*.baza
|
||||||
71
author/project/system/databases/scripts/account.php
Normal file
71
author/project/system/databases/scripts/account.php
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ${REPO_OWNER}\${REPO_NAME};
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use ${REPO_OWNER}\${REPO_NAME}\models\account,
|
||||||
|
${REPO_OWNER}\${REPO_NAME}\models\authorizations,
|
||||||
|
${REPO_OWNER}\${REPO_NAME}\models\chat,
|
||||||
|
${REPO_OWNER}\${REPO_NAME}\models\tariff;
|
||||||
|
|
||||||
|
// Svoboda time
|
||||||
|
use svoboda\time\statement as svoboda;
|
||||||
|
|
||||||
|
// Baza database
|
||||||
|
use mirzaev\baza\record;
|
||||||
|
|
||||||
|
// Enabling debugging
|
||||||
|
/* ini_set('error_reporting', E_ALL);
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1); */
|
||||||
|
|
||||||
|
// Initializing path to the public directory
|
||||||
|
define('INDEX', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'public');
|
||||||
|
|
||||||
|
// Initializing path to the root directory
|
||||||
|
define('ROOT', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
|
// Initializing path to the settings directory
|
||||||
|
define('SETTINGS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'settings');
|
||||||
|
|
||||||
|
// Initializing path to the storage directory
|
||||||
|
define('STORAGE', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'storage');
|
||||||
|
|
||||||
|
// Initializing path to the databases directory
|
||||||
|
define('DATABASES', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'databases');
|
||||||
|
|
||||||
|
// Initializing path to the localizations directory
|
||||||
|
define('LOCALIZATIONS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'localizations');
|
||||||
|
|
||||||
|
// Initiailizing telegram data
|
||||||
|
require(SETTINGS . DIRECTORY_SEPARATOR . 'telegram.php');
|
||||||
|
|
||||||
|
// Initializing dependencies
|
||||||
|
require ROOT . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
// Initializing the account model
|
||||||
|
$$account_model = new account();
|
||||||
|
|
||||||
|
// Searching for the account
|
||||||
|
$$account = $$account_model->database->read(
|
||||||
|
filter: fn(record $$record) => $$record->domain === 'buddy_volkodav',
|
||||||
|
amount: 1,
|
||||||
|
offset: 0
|
||||||
|
)[0] ?? null;
|
||||||
|
|
||||||
|
var_dump($$account);
|
||||||
|
|
||||||
|
// Initializing the account authorizations model
|
||||||
|
$$authorizations_model = new authorizations();
|
||||||
|
|
||||||
|
// Searching for the account authorizations
|
||||||
|
$$authorizations = $$authorizations_model->database->read(
|
||||||
|
filter: fn(record $$record) => $$record->account === $$account->identifier,
|
||||||
|
amount: 1,
|
||||||
|
offset: 0
|
||||||
|
|||||||