diff --git a/deeproots/deeproots/system/models/account.php b/deeproots/deeproots/system/models/account.php index 63e9864..9e645fd 100755 --- a/deeproots/deeproots/system/models/account.php +++ b/deeproots/deeproots/system/models/account.php @@ -60,12 +60,7 @@ final class account extends core $this->database = new database() ->encoding(encoding::utf8) ->columns( - /** - * FIXME: waiting on https://git.svoboda.works/mirzaev/baza/issues/25 - * baza is writing only the first half of 64bit integer/integer_unsigned - * to the database file. type::integer_unsigned should be used here. - */ - new column('identifier', type::long_long_unsigned), + new column('identifier', type::integer_unsigned), new column('name', type::string, ['length' => 64]), new column('language', type::string, ['length' => 2]), new column('authorized_system', type::char), diff --git a/deeproots/deeproots/system/models/answer.php b/deeproots/deeproots/system/models/answer.php index 9bf4a03..7a71e83 100755 --- a/deeproots/deeproots/system/models/answer.php +++ b/deeproots/deeproots/system/models/answer.php @@ -61,12 +61,7 @@ final class answer extends core $this->database = new database() ->encoding(encoding::ascii) ->columns( - /** - * FIXME: waiting on https://git.svoboda.works/mirzaev/baza/issues/25 - * baza is writing only the first half of 64bit integer/integer_unsigned - * to the database file. type::integer_unsigned should be used here. - */ - new column('identifier', type::long_long_unsigned), + new column('identifier', type::integer_unsigned), new column('A', type::char), new column('B', type::char), new column('C', type::char), diff --git a/deeproots/deeproots/system/models/connection.php b/deeproots/deeproots/system/models/connection.php index f794a74..571d53a 100755 --- a/deeproots/deeproots/system/models/connection.php +++ b/deeproots/deeproots/system/models/connection.php @@ -67,12 +67,7 @@ final class connection extends core ->columns( new column('identifier', type::integer_unsigned), new column('account', type::integer_unsigned), - /** - * FIXME: waiting on https://git.svoboda.works/mirzaev/baza/issues/25 - * baza is writing only the first half of 64bit integer/integer_unsigned - * to the database file. type::integer_unsigned should be used here. - */ - new column('telegram', type::long_long_unsigned), + new column('telegram', type::integer_unsigned), new column('active', type::char), new column('updated', type::integer_unsigned), new column('created', type::integer_unsigned) diff --git a/deeproots/deeproots/system/models/question/localization.php b/deeproots/deeproots/system/models/question/localization.php index fdccde2..906dad6 100755 --- a/deeproots/deeproots/system/models/question/localization.php +++ b/deeproots/deeproots/system/models/question/localization.php @@ -61,12 +61,7 @@ final class localization extends core $this->database = new database() ->encoding(encoding::ascii) ->columns( - /** - * FIXME: waiting on https://git.svoboda.works/mirzaev/baza/issues/25 - * baza is writing only the first half of 64bit integer/integer_unsigned - * to the database file. type::integer_unsigned should be used here. - */ - new column('identifier', type::long_long_unsigned), + new column('identifier', type::integer_unsigned), new column('text', type::string, ['length' => 256]), new column('A', type::string, ['length' => 128]), new column('B', type::string, ['length' => 128]), diff --git a/deeproots/deeproots/system/models/telegram.php b/deeproots/deeproots/system/models/telegram.php index a7043b4..d461f4a 100755 --- a/deeproots/deeproots/system/models/telegram.php +++ b/deeproots/deeproots/system/models/telegram.php @@ -60,12 +60,7 @@ final class telegram extends core $this->database = new database() ->encoding(encoding::utf8) ->columns( - /** - * FIXME: waiting on https://git.svoboda.works/mirzaev/baza/issues/25 - * baza is writing only the first half of 64bit integer/integer_unsigned - * to the database file. type::integer_unsigned should be used here. - */ - new column('identifier', type::long_long_unsigned), + new column('identifier', type::integer_unsigned), new column('domain', type::string, ['length' => 32]), new column('name_first', type::string, ['length' => 64]), new column('name_second', type::string, ['length' => 64]), diff --git a/deeproots/deeproots/system/models/telegram/commands.php b/deeproots/deeproots/system/models/telegram/commands.php index 35e59eb..56d1261 100755 --- a/deeproots/deeproots/system/models/telegram/commands.php +++ b/deeproots/deeproots/system/models/telegram/commands.php @@ -34,7 +34,7 @@ final class commands extends core /** * Menu * - * Responce for the commands: "/start", '/menu' + * Response for the commands: "/start", '/menu' * * @param context $context Request data from Telegram * @@ -87,7 +87,7 @@ final class commands extends core ], ] )->then(function (message $message) use ($context, $localization, $account) { - // Sended the message + // Sent the message if ( $account->authorized_system_accounts || @@ -397,17 +397,17 @@ final class commands extends core [ [ 'text' => '🏛️ ' . $localization['repository_button_code'], - 'url' => 'https://git.mirzaev.sexy/mirzaev/deeproots' + 'url' => 'https://git.svoboda.works/deeproots/deeproots' ] ], [ [ 'text' => '⚠️ ' . $localization['repository_button_issues'], - 'url' => 'https://git.mirzaev.sexy/mirzaev/deeproots/issues' + 'url' => 'https://git.svoboda.works/deeproots/deeproots/issues' ], [ 'text' => '🌱 ' . $localization['repository_button_suggestions'], - 'url' => 'https://git.mirzaev.sexy/mirzaev/deeproots/issues' + 'url' => 'https://git.svoboda.works/deeproots/deeproots/issues' ] ] ], diff --git a/deeproots/deeproots/system/models/telegram/middlewares.php b/deeproots/deeproots/system/models/telegram/middlewares.php index 39333d5..b4d9272 100755 --- a/deeproots/deeproots/system/models/telegram/middlewares.php +++ b/deeproots/deeproots/system/models/telegram/middlewares.php @@ -339,152 +339,6 @@ final class middlewares extends core } } - /** - * Contact (middleware) - * - * Check the account for access to contact with the organization - * - * @param context $context - * @param node $next - * - * @return void - */ - public static function contact(context $context, node $next): void - { - // Is the process stopped? - if ($context->get('stop')) return; - - // Initializing the account - $account = $context->get('account'); - - if ($account instanceof record) { - // Initialized the account - - if ($account->authorized_contact) { - // Authorized the account to contact with the organization - - // Continuation of the process - $next($context); - } else { - // Not authorized the account to contact with the organization - - // Initializing localization - $localization = $context->get('localization'); - - if ($localization) { - // Initialized localization - - // Sending the message - $context->sendMessage('⛔ *' . $localization['not_authorized_contact'] . '*') - ->then(function (message $message) use ($context) { - // Sended the message - - // Ending the conversation process - $context->endConversation(); - }); - - // Stopping the process - $context->set('stop', true); - } else { - // Not initialized localization - - // Sending the message - $context->sendMessage('⚠️ *Failed to initialize localization*') - ->then(function (message $message) use ($context) { - // Sended the message - - // Ending the conversation process - $context->endConversation(); - }); - } - } - } else { - // Not initialized the account - - // Sending the message - $context->sendMessage('⚠️ *Failed to initialize the account*') - ->then(function (message $message) use ($context) { - // Sended the message - - // Ending the conversation process - $context->endConversation(); - }); - } - } - - /** - * Settings (middleware) - * - * Check the account for access to settings - * - * @param context $context - * @param node $next - * - * @return void - */ - public static function settings(context $context, node $next): void - { - // Is the process stopped? - if ($context->get('stop')) return; - - // Initializing the account - $account = $context->get('account'); - - if ($account instanceof record) { - // Initialized the account - - if ($account->authorized_settings) { - // Authorized the account to the settings - - // Continuation of the process - $next($context); - } else { - // Not authorized the account to the settings - - // Initializing localization - $localization = $context->get('localization'); - - if ($localization) { - // Initialized localization - - // Sending the message - $context->sendMessage('⛔ *' . $localization['not_authorized_settings'] . '*') - ->then(function (message $message) use ($context) { - // Sended the message - - // Ending the conversation process - $context->endConversation(); - }); - - // Stopping the process - $context->set('stop', true); - } else { - // Not initialized localization - - // Sending the message - $context->sendMessage('⚠️ *Failed to initialize localization*') - ->then(function (message $message) use ($context) { - // Sended the message - - // Ending the conversation process - $context->endConversation(); - }); - } - } - } else { - // Not initialized the account - - // Sending the message - $context->sendMessage('⚠️ *Failed to initialize the account*') - ->then(function (message $message) use ($context) { - // Sended the message - - // Ending the conversation process - $context->endConversation(); - }); - } - } - /** * Questions (system) (middleware) * diff --git a/deeproots/deeproots/system/public/telegram.php b/deeproots/deeproots/system/public/telegram.php index 1a2dc2a..0e81616 100755 --- a/deeproots/deeproots/system/public/telegram.php +++ b/deeproots/deeproots/system/public/telegram.php @@ -89,12 +89,11 @@ $robot->onCommand('start', [commands::class, 'menu']); $robot->onCommand('menu', [commands::class, 'menu']); $robot->onCommand('account', [commands::class, 'account']); /* $robot->onCommand('svoboda', [commands::class, 'svoboda']); */ -$robot->onCommand('language', [commands::class, 'language'])->middleware([middlewares::class, 'settings']); +$robot->onCommand('language', [commands::class, 'language'])->middleware([middlewares::class, 'language']); $robot->onCommand('repository', [commands::class, 'repository']); /* $robot->onCommand('projects', [commands::class, 'projects']); */ $robot->onCommand('author', [commands::class, 'author']); $robot->onCommand('society', [commands::class, 'society']); -// $robot->onCommand('system_settings', [commands::class, 'system_settings'])->middleware([middlewares::class, 'system']); // Initializing the robot settings language buttons handlers foreach (language::cases() as $language) { diff --git a/deeproots/deeproots/system/settings/admins.php.sample b/deeproots/deeproots/system/settings/admins.php.sample new file mode 100755 index 0000000..0b67a5f --- /dev/null +++ b/deeproots/deeproots/system/settings/admins.php.sample @@ -0,0 +1,3 @@ +encoding(encoding::utf8) ->columns( - /** - * FIXME: waiting on https://git.svoboda.works/mirzaev/baza/issues/25 - * baza is writing only the first half of 64bit integer/integer_unsigned - * to the database file. type::integer_unsigned should be used here. - */ - new column('identifier', type::long_long_unsigned), + new column('identifier', type::integer_unsigned), new column('domain', type::string, ['length' => 32]), new column('name_first', type::string, ['length' => 64]), new column('name_second', type::string, ['length' => 64]),