DEV: Консоль, добавлена команда (индексация)
и убраны все известные ошибки...
This commit is contained in:
parent
3ba6da0963
commit
d28536fe67
15
app/Commands/Indexing.php
Normal file
15
app/Commands/Indexing.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
class Indexing extends \Hleb\Scheme\App\Commands\MainTask
|
||||
{
|
||||
const DESCRIPTION = "indexing";
|
||||
|
||||
protected function execute()
|
||||
{
|
||||
(new \Modules\Admin\App\Console)->indexer();
|
||||
|
||||
echo PHP_EOL . __CLASS__ . " done." . PHP_EOL;
|
||||
}
|
||||
}
|
|
@ -8,9 +8,8 @@ class Stats extends \Hleb\Scheme\App\Commands\MainTask
|
|||
|
||||
protected function execute()
|
||||
{
|
||||
|
||||
(new \App\Controllers\Admin\СonsoleController)->updateCountPostTopic();
|
||||
(new \App\Controllers\Admin\СonsoleController)->updateCountUp();
|
||||
(new \Modules\Admin\App\Console)->up();
|
||||
(new \Modules\Admin\App\Console)->topic();
|
||||
|
||||
echo PHP_EOL . __CLASS__ . " done." . PHP_EOL;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class SettingController extends MainController
|
|||
'about' => $about,
|
||||
'template' => $template ?? 'default',
|
||||
'lang' => $lang ?? 'ru',
|
||||
'whisper' => $user['whisper'] ?? null,
|
||||
'whisper' => $user['whisper'] ?? '',
|
||||
'website' => Request::getPostString('website', null),
|
||||
'location' => Request::getPostString('location', null),
|
||||
'public_email' => $public_email ?? null,
|
||||
|
|
|
@ -49,7 +49,7 @@ class Content
|
|||
$content = preg_replace($regexpAu, "<dev class=\"txt-closed\"><i class=\"bi bi-unlock gray-600 mr5\"></i> $2$3</dev>", $content);
|
||||
} else {
|
||||
$content = preg_replace($regexpAu, "<dev class=\"txt-closed gray-600\"><i class=\"bi bi-lock mr5 red-200\"></i>" . Translate::get('text.closed') . "...</dev>", $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
|
@ -87,7 +87,7 @@ class Content
|
|||
}
|
||||
|
||||
if ($user_info) {
|
||||
$content = str_replace('@' . $login, '<a href="' . getUrlByName('profile', ['login' => $user_info['login']]) . '" class="to-user">@' . $user_info['login'] . '</a>', $content);
|
||||
$content = str_replace('@' . $login, '<a href="/@' . $user_info['login'] . '" class="to-user">@' . $user_info['login'] . '</a>', $content);
|
||||
|
||||
if ($to_uid) {
|
||||
$content_uid = str_replace('@' . $login, '@' . $user_info['id'], $content_uid);
|
||||
|
|
|
@ -407,7 +407,7 @@ class Forms
|
|||
$wrap_after = '<div class="text-sm gray-600">' . $wrap_after . '</div></' . $val['wrap_tag'] . '>';
|
||||
}
|
||||
|
||||
$output .= $wrap_before . $field . $after . $wrap_after ;
|
||||
$output .= $wrap_before . $field . $after . $wrap_after;
|
||||
else :
|
||||
$output .= $field;
|
||||
endif;
|
||||
|
@ -437,7 +437,7 @@ class Forms
|
|||
|
||||
foreach ($params as $opt) {
|
||||
|
||||
$tl = $opt['tl'] ?? 0;
|
||||
$tl = $opt['tl'] ?? 0;
|
||||
if ($user_tl >= $tl) {
|
||||
|
||||
foreach ($this->meaning as $arr) {
|
||||
|
|
|
@ -241,16 +241,17 @@ class Html
|
|||
}
|
||||
|
||||
// Getting a piece of text
|
||||
public static function fragment($str, $lenght = 100, $end = '...', $charset = 'UTF-8', $token = '~') {
|
||||
public static function fragment($str, $lenght = 100, $end = '...', $charset = 'UTF-8', $token = '~')
|
||||
{
|
||||
$str = strip_tags($str);
|
||||
if (mb_strlen($str, $charset) >= $lenght) {
|
||||
$wrap = wordwrap($str, $lenght, $token);
|
||||
$str_cut = mb_substr($wrap, 0, mb_strpos($wrap, $token, 0, $charset), $charset);
|
||||
$str_cut = mb_substr($wrap, 0, mb_strpos($wrap, $token, 0, $charset), $charset);
|
||||
return $str_cut .= $end;
|
||||
} else {
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function getMsg()
|
||||
|
@ -263,16 +264,16 @@ class Html
|
|||
|
||||
unset($_SESSION['msg']);
|
||||
|
||||
$html = '';
|
||||
if ($msg) {
|
||||
if ($msg['status'] == 'error') :
|
||||
$html = '';
|
||||
if ($msg) {
|
||||
if ($msg['status'] == 'error') :
|
||||
$html .= "Notiflix.Notify.failure('" . $msg['msg'] . "')";
|
||||
else :
|
||||
else :
|
||||
$html .= "Notiflix.Notify.info('" . $msg['msg'] . "')";
|
||||
endif;
|
||||
}
|
||||
|
||||
return $html;
|
||||
endif;
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public static function addMsg($msg, $status)
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Hleb\Constructor\Handlers\Request;
|
||||
|
||||
class Tpl
|
||||
{
|
||||
public static function agTheme($file)
|
||||
{
|
||||
$tpl_puth = self::userTheme() . DIRECTORY_SEPARATOR . $file;
|
||||
$tpl_puth = UserData::getUserTheme() . DIRECTORY_SEPARATOR . $file;
|
||||
|
||||
if (!file_exists(TEMPLATES . DIRECTORY_SEPARATOR . $tpl_puth . '.php')) {
|
||||
$tpl_puth = 'default' . $file;
|
||||
$tpl_puth = 'default/' . $file;
|
||||
}
|
||||
|
||||
return $tpl_puth;
|
||||
|
@ -46,7 +48,7 @@ class Tpl
|
|||
|
||||
unset($params);
|
||||
|
||||
$tpl_puth = self::userTheme() . DIRECTORY_SEPARATOR . trim($hlTemplatePath, '/\\');
|
||||
$tpl_puth = UserData::getUserTheme() . DIRECTORY_SEPARATOR . trim($hlTemplatePath, '/\\');
|
||||
|
||||
if (!file_exists(TEMPLATES . DIRECTORY_SEPARATOR . $tpl_puth . '.php')) {
|
||||
$tpl_puth = 'default' . $hlTemplatePath;
|
||||
|
@ -55,13 +57,6 @@ class Tpl
|
|||
require TEMPLATES . DIRECTORY_SEPARATOR . $tpl_puth . '.php';
|
||||
}
|
||||
|
||||
public static function userTheme()
|
||||
{
|
||||
$user = UserData::get();
|
||||
|
||||
return $user['template'];
|
||||
}
|
||||
|
||||
public static function pageNumber()
|
||||
{
|
||||
$string = Request::get();
|
||||
|
|
|
@ -23,7 +23,7 @@ class Translate
|
|||
// Возвращает перевод определенного ключа из текущей языковой локали.
|
||||
public static function get($localeKey, $parameters = [])
|
||||
{
|
||||
// static::checkInitialization();
|
||||
// static::checkInitialization();
|
||||
static::checkLoaded();
|
||||
|
||||
if (is_string($localeKey) && !empty(static::$loadedLocales[static::$currentLang][$localeKey])) {
|
||||
|
@ -44,7 +44,7 @@ class Translate
|
|||
// Set by default, and after authorization of the participant
|
||||
public static function setLang($language)
|
||||
{
|
||||
// static::checkInitialization();
|
||||
// static::checkInitialization();
|
||||
static::$currentLang = (!empty($language) && is_string($language)) ? $language : static::getClientLang();
|
||||
static::checkLoaded();
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class UserData
|
|||
// Administrator (level of trust 10)
|
||||
// Администратор (уровень доверия 10)
|
||||
const REGISTERED_ADMIN = 10;
|
||||
|
||||
|
||||
// Administrator ID
|
||||
// ID администратора
|
||||
const REGISTERED_ADMIN_ID = 1;
|
||||
|
@ -80,7 +80,6 @@ class UserData
|
|||
if ($user['ban_list'] == self::BANNED_USER) {
|
||||
(new \App\Controllers\Auth\SessionController())->annul($user['id']);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$remember = Request::getCookie('remember');
|
||||
|
@ -108,6 +107,17 @@ class UserData
|
|||
return $t['trust_level'] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the member template.
|
||||
* Возвращает шаблон участника.
|
||||
*/
|
||||
static public function getUserTheme()
|
||||
{
|
||||
$t = self::getAccount();
|
||||
|
||||
return $t['template'] ?? Config::get('general.template');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checking for registration by integer user type and comparison sign.
|
||||
* Проверка на регистрацию по числовому типу пользователя и знаку сравнения.
|
||||
|
|
|
@ -13,7 +13,7 @@ class Validation
|
|||
public static function Length($name, $content, $min, $max, $redirect)
|
||||
{
|
||||
$name = str_replace(" ", '', $name);
|
||||
if (Html::getStrlen($name) < $min || Html::getStrlen($name) > $max) {
|
||||
if (Html::getStrlen($name) < $min || Html::getStrlen($name) > $max) {
|
||||
$text = __('string.length', ['name' => '«' . __($content) . '»', 'min' => $min, 'max' => $max]);
|
||||
self::Returns($text, 'error', $redirect);
|
||||
}
|
||||
|
@ -28,13 +28,13 @@ class Validation
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static function Returns($text, $status, $redirect = '/')
|
||||
{
|
||||
Html::addMsg($text, $status);
|
||||
redirect($redirect);
|
||||
}
|
||||
|
||||
|
||||
public static function ComeBack($text, $status, $redirect = '/')
|
||||
{
|
||||
Html::addMsg(__($text), $status);
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace App\Middleware\After;
|
||||
|
||||
class DefaultMiddlewareAfter extends \MainMiddleware
|
||||
use Hleb\Scheme\App\Middleware\MainMiddleware;
|
||||
|
||||
class DefaultMiddlewareAfter extends MainMiddleware
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Matching names for the functions used.
|
||||
* Global "helper" functions.
|
||||
*
|
||||
* Сопоставление названий для используемых функций.
|
||||
* Глобальные «вспомогательные» функции.
|
||||
*/
|
||||
|
||||
if (! function_exists('__'))
|
||||
{
|
||||
// @param string|null $key
|
||||
// @param string|null $key
|
||||
function __(string $key = null, array $params = []) {
|
||||
if (is_null($key)) {
|
||||
return $key;
|
||||
|
@ -19,3 +19,15 @@ if (! function_exists('__'))
|
|||
return Translate::get($key, $params);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('url'))
|
||||
{
|
||||
// @param string|null $key
|
||||
function url(string $key = null, array $params = []) {
|
||||
if (is_null($key)) {
|
||||
return $key;
|
||||
}
|
||||
|
||||
return getUrlByName($key, $params);
|
||||
}
|
||||
}
|
|
@ -9,22 +9,22 @@
|
|||
|
||||
<body class="body-bg-fon mt30">
|
||||
|
||||
<main class="max-w780 mr-auto box">
|
||||
<h1 class="text-3xl font-normal gray m0">Opss</h1>
|
||||
<p class="gray-600"><?= __('under.reconstruction'); ?>...</p>
|
||||
<main class="max-w780 mr-auto box">
|
||||
<h1 class="text-3xl font-normal gray m0">Opss</h1>
|
||||
<p class="gray-600"><?= __('under.reconstruction'); ?>...</p>
|
||||
|
||||
<form class="mb20" action="/login" method="post">
|
||||
<?php csrf_field(); ?>
|
||||
<fieldset class="max-w640">
|
||||
<label for="email">E-mail</label>
|
||||
<input type="text" placeholder="<?= __('enter'); ?> e-mail" name="email">
|
||||
<label class="block mt20 mb5"><?= __('password'); ?></label>
|
||||
<input type="password" placeholder="<?= __('enter your password'); ?>" name="password" class="w-100 h30 pl5">
|
||||
</fieldset>
|
||||
<?= Html::sumbit(__('sign.in')); ?>
|
||||
</form>
|
||||
<form class="mb20" action="/login" method="post">
|
||||
<?php csrf_field(); ?>
|
||||
<fieldset class="max-w640">
|
||||
<label for="email">E-mail</label>
|
||||
<input type="text" placeholder="<?= __('enter'); ?> e-mail" name="email">
|
||||
<label class="block mt20 mb5"><?= __('password'); ?></label>
|
||||
<input type="password" placeholder="<?= __('enter your password'); ?>" name="password" class="w-100 h30 pl5">
|
||||
</fieldset>
|
||||
<?= Html::sumbit(__('sign.in')); ?>
|
||||
</form>
|
||||
|
||||
</main>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ class UserModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
name,
|
||||
avatar,
|
||||
created_at,
|
||||
whisper,
|
||||
updated_at,
|
||||
whisper,
|
||||
scroll,
|
||||
|
|
|
@ -112,24 +112,30 @@ class Users
|
|||
{
|
||||
$login = Request::getPost('login');
|
||||
$user_id = Request::getInt('id');
|
||||
$email = Request::getPost('email');
|
||||
$user_whisper = Request::getPost('whisper');
|
||||
$user_name = Request::getPost('name');
|
||||
$trust_level = Request::getPostInt('trust_level');
|
||||
|
||||
$redirect = getUrlByName('admin.users');
|
||||
if (!$user = UserModel::getUser($user_id, 'id')) {
|
||||
redirect(getUrlByName('admin.users'));
|
||||
redirect($redirect);
|
||||
}
|
||||
|
||||
$redirect = getUrlByName('admin.user.edit', ['id' => $user_id]);
|
||||
Validation::Length($login, 'login', '3', '11', $redirect);
|
||||
|
||||
if ($email) {
|
||||
Validation::Email($email, $redirect);
|
||||
}
|
||||
|
||||
SettingModel::edit(
|
||||
[
|
||||
'id' => $user_id,
|
||||
'login' => $login,
|
||||
'email' => Request::getPost('email'),
|
||||
'whisper' => $user_whisper ?? null,
|
||||
'name' => $user_name ?? null,
|
||||
'email' => $email,
|
||||
'whisper' => $user_whisper ?? '',
|
||||
'name' => $user_name ?? '',
|
||||
'activated' => Request::getPostInt('activated'),
|
||||
'limiting_mode' => Request::getPostInt('limiting_mode'),
|
||||
'template' => $user['template'] ?? 'default',
|
||||
|
|
|
@ -12,18 +12,18 @@
|
|||
</div>
|
||||
<div class="flex right">
|
||||
<ul class="mb-none">
|
||||
<li><a href="<?= getUrlByName('blogs.all'); ?>"><?= __('blogs'); ?></a></li>
|
||||
<li><a href="<?= getUrlByName('topics.all'); ?>"><?= __('topics'); ?></a></li>
|
||||
<li><a href="<?= getUrlByName('web'); ?>"><?= __('catalog'); ?></a></li>
|
||||
<li><a href="<?= url('blogs.all'); ?>"><?= __('blogs'); ?></a></li>
|
||||
<li><a href="<?= url('topics.all'); ?>"><?= __('topics'); ?></a></li>
|
||||
<li><a href="<?= url('web'); ?>"><?= __('catalog'); ?></a></li>
|
||||
</ul>
|
||||
<ul class="mb-none">
|
||||
<li><a href="<?= getUrlByName('users.all'); ?>"><?= __('users'); ?></a></li>
|
||||
<li><a href="<?= getUrlByName('answers'); ?>"><?= __('answers'); ?></a></li>
|
||||
<li><a href="<?= getUrlByName('comments'); ?>"><?= __('comments'); ?></a></li>
|
||||
<li><a href="<?= url('users.all'); ?>"><?= __('users'); ?></a></li>
|
||||
<li><a href="<?= url('answers'); ?>"><?= __('answers'); ?></a></li>
|
||||
<li><a href="<?= url('comments'); ?>"><?= __('comments'); ?></a></li>
|
||||
</ul>
|
||||
<ul class="mb-pl0">
|
||||
<li><a href="<?= getUrlByName('facet.article', ['facet_slug' => 'info', 'slug' => Config::get('facets.page-one')]); ?>"><?= __('info'); ?></a></li>
|
||||
<li><a href="<?= getUrlByName('facet.article', ['facet_slug' => 'info', 'slug' => Config::get('facets.page-two')]); ?>"><?= __('privacy'); ?></a></li>
|
||||
<li><a href="<?= url('facet.article', ['facet_slug' => 'info', 'slug' => Config::get('facets.page-one')]); ?>"><?= __('info'); ?></a></li>
|
||||
<li><a href="<?= url('facet.article', ['facet_slug' => 'info', 'slug' => Config::get('facets.page-two')]); ?>"><?= __('privacy'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Hleb\Constructor\Handlers\Request;
|
||||
|
||||
Request::getHead()->addStyles('/assets/css/style.css?12');
|
||||
$type = $data['type'] ?? false;
|
||||
$facet = $data['facet'] ?? false; ?>
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
<?php getRequestHead()->output(); ?>
|
||||
<link rel="icon" sizes="16x16" href="/favicon.ico" type="image/x-icon">
|
||||
<link rel="icon" sizes="120x120" href="/favicon-120.ico" type="image/x-icon">
|
||||
<meta name="csrf-token" content="<?= csrf_token(); ?>" >
|
||||
<meta name="csrf-token" content="<?= csrf_token(); ?>">
|
||||
</head>
|
|
@ -18,7 +18,7 @@
|
|||
);
|
||||
}));
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?= Html::getMsg(); ?>
|
||||
|
||||
<?php if ($scroll) : ?>
|
||||
|
|
|
@ -3,27 +3,27 @@
|
|||
?>
|
||||
|
||||
<div class="flex justify-between">
|
||||
<div class="bg-lj br3">
|
||||
<i class="icon-share lj" data-social="livejournal"></i>
|
||||
</div>
|
||||
<div class="bg-lj br3">
|
||||
<i class="icon-share lj" data-social="livejournal"></i>
|
||||
</div>
|
||||
|
||||
<div class="bg-vk br3">
|
||||
<i class="icon-share vk" data-social="vkontakte"></i>
|
||||
</div>
|
||||
<div class="bg-vk br3">
|
||||
<i class="icon-share vk" data-social="vkontakte"></i>
|
||||
</div>
|
||||
|
||||
<div class="bg-ok br3">
|
||||
<i class="icon-share ok" data-social="odnoklassniki"></i>
|
||||
</div>
|
||||
<div class="bg-ok br3">
|
||||
<i class="icon-share ok" data-social="odnoklassniki"></i>
|
||||
</div>
|
||||
|
||||
<!--div class="bg-fb br3">
|
||||
<!--div class="bg-fb br3">
|
||||
<i class="icon-share fb" data-social="facebook"></i>
|
||||
</div-->
|
||||
|
||||
<!--div class="bg-tw br3">
|
||||
<!--div class="bg-tw br3">
|
||||
<i class="icon-share tw" data-social="twitter"></i>
|
||||
</div-->
|
||||
|
||||
<div class="bg-tg br3">
|
||||
<i class="icon-share tg" data-social="telegram"></i>
|
||||
</div>
|
||||
<div class="bg-tg br3">
|
||||
<i class="icon-share tg" data-social="telegram"></i>
|
||||
</div>
|
||||
</div>
|
|
@ -28,7 +28,7 @@ $url = $fs['facet_type'] == 'category' ? getUrlByName('web.dir', ['cat' => 'cat'
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<div class="box max-w780">
|
||||
<form action="<?= getUrlByName('content.change', ['type' => $fs['facet_type']]); ?>" method="post" enctype="multipart/form-data">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</main>
|
||||
<aside>
|
||||
<?php if ($topic['facet_is_deleted'] == 0) : ?>
|
||||
<div class="box-flex bg-violet">
|
||||
<div class="box-flex justify-between bg-violet">
|
||||
<div class="center">
|
||||
<div class="uppercase text-sm gray-600"><?= __('posts'); ?></div>
|
||||
<?= $topic['facet_count']; ?>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="box-flex">
|
||||
<div class="box-flex justify-between">
|
||||
<ul class="nav">
|
||||
<?= Tpl::insert('/_block/navigation/nav', ['type' => $data['sheet'], 'user' => $user, 'list' => Config::get('navigation/nav.favorites')]); ?>
|
||||
</ul>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Hleb\Constructor\Handlers\Request;
|
||||
|
||||
Request::getHead()->addStyles('/assets/css/style.css?12');
|
||||
$type = $data['type'] ?? false;
|
||||
$facet = $data['facet'] ?? false; ?>
|
||||
|
|
Loading…
Reference in a new issue