DEV: локализация

* Уберем показ  собственных комментариев  в Sidebar
* Добавим страницу FAQ
* Мелкие исправления css
This commit is contained in:
Evg 2021-04-14 12:30:41 +03:00
parent c75559f851
commit d8654ad67f
18 changed files with 149 additions and 84 deletions

View file

@ -11,8 +11,9 @@ class InfoController extends \MainController
{
$uid = Base::getUid();
$data = [
'title' => 'Информация | ' . $GLOBALS['conf']['sitename'],
'description' => 'Информация о сайте и команде работающей над ' . $GLOBALS['conf']['sitename'],
'h1' => lang('Info'),
'title' => lang('Info') . ' | ' . $GLOBALS['conf']['sitename'],
'description' => lang('info-desc') . ' ' . $GLOBALS['conf']['sitename'],
];
return view("info/index", ['data' => $data, 'uid' => $uid]);
@ -20,7 +21,7 @@ class InfoController extends \MainController
public function stats()
{
// Получаем общее количество: участников, постов, комментариев и голосов за них
// Получаем общее количество: участников, постов, комментариев и голосов по ним
$user_num = InfoModel::getUsersNumAll();
$post_num = InfoModel::getPostsNumAll();
$comm_num = InfoModel::getCommentsNumAll();
@ -31,8 +32,9 @@ class InfoController extends \MainController
$uid = Base::getUid();
$data = [
'title' => 'Статистика | ' . $GLOBALS['conf']['sitename'],
'description' => 'Статистика сайта. Посты, комментарии, участники и голосование' . $GLOBALS['conf']['sitename'],
'h1' => lang('Statistics'),
'title' => lang('Statistics') . ' | ' . $GLOBALS['conf']['sitename'],
'description' => lang('stats-desc') .' ' . $GLOBALS['conf']['sitename'],
'user_num' => $user_num,
'post_num' => $post_num,
'comm_num' => $comm_num,
@ -47,8 +49,9 @@ class InfoController extends \MainController
{
$uid = Base::getUid();
$data = [
'title' => 'Правила сайта | ' . $GLOBALS['conf']['sitename'],
'description' => 'Правила сайта, политика почтительности ' . $GLOBALS['conf']['sitename'],
'h1' => lang('Rules'),
'title' => lang('Rules') . ' | ' . $GLOBALS['conf']['sitename'],
'description' => lang('rules-desc') . ' ' . $GLOBALS['conf']['sitename'],
];
return view('info/rules', ['data' => $data, 'uid' => $uid]);
@ -58,8 +61,9 @@ class InfoController extends \MainController
{
$uid = Base::getUid();
$data = [
'title' => 'О нас | ' . $GLOBALS['conf']['sitename'],
'description' => 'Информация о сайте и команде работающей над ' . $GLOBALS['conf']['sitename'],
'h1' => lang('About'),
'title' => lang('About') . ' | ' . $GLOBALS['conf']['sitename'],
'description' => lang('about-desc') . ' ' . $GLOBALS['conf']['sitename'],
];
return view('info/about', ['data' => $data, 'uid' => $uid]);
@ -69,19 +73,21 @@ class InfoController extends \MainController
{
$uid = Base::getUid();
$data = [
'title' => 'Политика конфиденциальности | ' . $GLOBALS['conf']['sitename'],
'description' => 'Политика конфиденциальности сайта ' . $GLOBALS['conf']['sitename'],
'h1' => lang('Privacy Policy'),
'title' => lang('Privacy Policy') . ' | ' . $GLOBALS['conf']['sitename'],
'description' => lang('privacy-desc') . ' ' . $GLOBALS['conf']['sitename'],
];
return view('info/privacy', ['data' => $data, 'uid' => $uid]);
}
public function trustlevel()
public function trustLevel()
{
$uid = Base::getUid();
$data = [
'title' => 'Уровень доверия (TL) | ' . $GLOBALS['conf']['sitename'],
'description' => 'Информация об уровни доверия пользователя (TL). Права, доступ. ' . $GLOBALS['conf']['sitename'],
'h1' => lang('Trust level') . ' (TL) ',
'title' => lang('Trust level') . ' (TL) | ' . $GLOBALS['conf']['sitename'],
'description' => lang('tl-desc') . ' ' . $GLOBALS['conf']['sitename'],
];
return view('info/trust-level', ['data' => $data, 'uid' => $uid]);
@ -91,8 +97,9 @@ class InfoController extends \MainController
{
$uid = Base::getUid();
$data = [
'title' => 'Ограничение | ' . $GLOBALS['conf']['sitename'],
'description' => 'Профиль проверяется ' . $GLOBALS['conf']['sitename'],
'h1' => lang('Restriction'),
'title' => lang('Restriction') . ' | ' . $GLOBALS['conf']['sitename'],
'description' => lang('Restriction') . ' ' . $GLOBALS['conf']['sitename'],
];
return view('info/restriction', ['data' => $data, 'uid' => $uid]);
@ -102,10 +109,23 @@ class InfoController extends \MainController
{
$uid = Base::getUid();
$data = [
'title' => 'Markdown (разметка) | ' . $GLOBALS['conf']['sitename'],
'description' => 'Мы используем Markdown (разметку) на сайте ' . $GLOBALS['conf']['sitename'],
'h1' => lang('Мarkdown'),
'title' => lang('Мarkdown') . ' | ' . $GLOBALS['conf']['sitename'],
'description' => lang('markdown-desc') . ' ' . $GLOBALS['conf']['sitename'],
];
return view('info/markdown', ['data' => $data, 'uid' => $uid]);
}
public function initialSetup()
{
$uid = Base::getUid();
$data = [
'h1' => lang('Initial Setup'),
'title' => lang('Initial Setup') . ' | ' . $GLOBALS['conf']['sitename'],
'description' => lang('init-setip-desc') . ' | ' . $GLOBALS['conf']['sitename'],
];
return view('info/initial-setup', ['data' => $data, 'uid' => $uid]);
}
}

View file

@ -58,7 +58,7 @@ class PostController extends \MainController
}
// Последние комментарии и отписанные пространства
$latest_comments = CommentModel::latestComments();
$latest_comments = CommentModel::latestComments($user_id);
$space_hide = SpaceModel::getSpaceUser($user_id);
$result_comm = Array();

View file

@ -71,7 +71,6 @@ class VotesCommController extends \MainController
'flow_space_id' => 0,
'flow_tl' => 0,
'flow_ip' => $ip,
];
FlowModel::FlowAdd($data_flow);

View file

@ -72,7 +72,6 @@ class VotesPostController extends \MainController
'flow_space_id' => 0,
'flow_tl' => 0,
'flow_ip' => $ip,
];
FlowModel::FlowAdd($data_flow);

View file

@ -15,6 +15,16 @@ return [
'forgot-password' => 'Forgot your password',
'repeat-password' => 'Repeat the password',
/* Info */
'init-setip-desc' => 'This page describes the requirements and steps for setting up and installing the site. Frequently asked questions.',
'markdown-desc' => 'We use Markdown (markup) on the site. Let take a look at the markup.',
'tl-desc' => 'Information about the users trust levels (TL). Rights, access.',
'privacy-desc' => 'The sites Privacy Policy. Site rules.',
'about-desc' => 'Information about the site and the team working on the community.',
'stats-desc' => 'Site statistics. Posts, comments, participants, and voting. Charts.',
'rules-desc' => 'Site rules, respect policy. No attacks, spam, violation of the laws of the country.',
'info-desc' => 'Reference documentation. Sections: rules, configuration and installation, trust level, statistics.',
'no-invate-txt' => 'Not a user yet? Signup is by invitation only to combat spam and increase accountability. If you know a <a href="/users">current user</a> of the site, ask them for an invitation.',
];

View file

@ -64,6 +64,21 @@ return [
'add_post' => 'добавил пост',
'add_up_post' => 'понравился пост',
'add_up_comm' => 'понравился комментарий',
/* Info */
'Initial Setup' => 'Начальная настройка',
'Мarkdown' => 'Мarkdown (разметка)',
'Rules' => 'Правила сайта',
'Privacy Policy' => 'Политика конфиденциальности',
'Restriction' => 'Ограничения',
'init-setip-desc' => 'На этой странице описаны требования и шаги по настройке и установке сайта. Часто задаваемые вопросы.',
'markdown-desc' => 'Мы используем Markdown (разметку) на сайте. Давайте ознакомимся с разметкой.',
'tl-desc' => 'Информация об уровни доверия пользователя (TL). Права, доступ.',
'privacy-desc' => 'Политика конфиденциальности сайта. Правила сайта.',
'about-desc' => 'Информация о сайте и команде работающей над сообществом.',
'stats-desc' => 'Статистика сайта. Посты, комментарии, участники и голосование. Графики.',
'rules-desc' => 'Правила сайта, политика почтительности. Нет нападкам, спаму, нарушению законов страны.',
'info-desc' => 'Справочная документация. Разделы: правила, настройка и установка, уровень доверия, статистика.',
'no-invate-txt' => 'Еще не пользователь? Регистрация осуществляется только по приглашению для борьбы со спамом и повышения ответственности. Если вы знаете <a href="/users">текущего пользователя</a> сайта, попросите у него приглашение.',
];

View file

@ -7,7 +7,6 @@ class CommentModel extends \MainModel
// Все комментарии
public static function getCommentsAll()
{
$q = XD::select('*')->from(['comments']);
$query = $q->leftJoin(['users'])->on(['id'], '=', ['comment_user_id'])
->leftJoin(['posts'])->on(['comment_post_id'], '=', ['post_id'])->orderBy(['comment_id'])->desc();
@ -20,20 +19,17 @@ class CommentModel extends \MainModel
// Получаем комментарии в посте
public static function getCommentsPost($post_id)
{
$q = XD::select('*')->from(['comments']);
$query = $q->leftJoin(['users'])->on(['id'], '=', ['comment_user_id'])->where(['comment_post_id'], '=', $post_id);
$result = $query->getSelect();
return $result;
}
// Страница комментариев участника
public static function getUsersComments($slug)
{
$q = XD::select('*')->from(['comments']);
$query = $q->leftJoin(['users'])->on(['id'], '=', ['comment_user_id'])
->leftJoin(['posts'])->on(['comment_post_id'], '=', ['post_id'])
@ -53,7 +49,6 @@ class CommentModel extends \MainModel
// $my_id - id автора ответа
public static function commentAdd($post_id, $ip, $comm_id, $comment, $my_id)
{
XD::insertInto(['comments'], '(', ['comment_post_id'], ',', ['comment_ip'], ',', ['comment_on'], ',', ['comment_content'], ',', ['comment_user_id'], ')')->values( '(', XD::setList([$post_id, $ip, $comm_id, $comment, $my_id]), ')' )->run();
// id последнего комментария
@ -64,29 +59,28 @@ class CommentModel extends \MainModel
XD::update(['comments'])->set(['comment_after'], '=', $otv)->where(['comment_id'], '=', $comm_id)->run();
return $last_id;
}
// Последние 5 комментариев
public static function latestComments()
public static function latestComments($user_id)
{
$q = XD::select('*')->from(['comments']);
$query = $q->leftJoin(['posts'])->on(['post_id'], '=', ['comment_post_id'])
->leftJoin(['users'])->on(['id'], '=', ['comment_user_id'])
->leftJoin(['space'])->on(['post_space_id'], '=', ['space_id'])
->where(['comment_del'], '=', 0)
->orderBy(['comment_id'])->desc()->limit(5);
$result = $query->getSelect();
return $result;
->leftJoin(['space'])->on(['post_space_id'], '=', ['space_id']);
if($user_id){
$result = $query->where(['comment_del'], '=', 0)->and(['comment_user_id'], '!=', $user_id);
} else {
$result = $query->where(['comment_del'], '=', 0);
}
return $result->orderBy(['comment_id'])->desc()->limit(5)->getSelect();
}
// Удаление комментария
public static function CommentsDel($id)
{
XD::update(['comments'])->set(['comment_del'], '=', 1)
->where(['comment_id'], '=', $id)->run();
@ -99,7 +93,6 @@ class CommentModel extends \MainModel
return XD::select('*')->from(['comments'])->where(['comment_id'], '=', $id)->getSelectOne();
}
// Редактируем комментарий
public static function CommentEdit($comm_id, $comment)
{
@ -111,7 +104,6 @@ class CommentModel extends \MainModel
// Частота размещения комментариев участника
public static function getCommentSpeed($uid)
{
$post = XD::select(['comment_id', 'comment_user_id', 'comment_date'])->from(['comments'])
->where(['comment_user_id'], '=', $uid)
->orderBy(['comment_id'])->desc()->getSelectOne();
@ -123,7 +115,6 @@ class CommentModel extends \MainModel
$result = $now->diff($happy_day);
return $result;
}
}

View file

@ -134,45 +134,35 @@ h3.suggested-topics-message a:hover {color: #f56400;}
.img-top-user {vertical-align: middle;width:32px;margin-right: 5px;border-radius: 3px;}
.img-blog {margin-top: 12px;}
.graph .labels.x-labels {
text-anchor: middle;
}
.graph .labels.y-labels {
text-anchor: end;
}
.graph {
height: 500px;
width: 800px;
}
.graph .grid {
stroke: #ccc;
stroke-dasharray: 0;
stroke-width: 1;
}
.labels {
font-size: 13px;
}
.label-title {
font-weight: bold;
text-transform: uppercase;
font-size: 12px;
fill: black;
}
.data {
fill: red;
stroke-width: 1;
}
@media (max-width: 720px){
.prof-txt{white-space: nowrap; overflow: hidden; padding: 5px; text-overflow: ellipsis;}
.prof-blog-2 {float: left;width: 33%;}

View file

@ -10,7 +10,7 @@
<a title="<?= lang('Info'); ?>" href="/info"><?= lang('Info'); ?></a>
</li>
</ul>
<h1>О нас</h1>
<h1><?= $data['h1']; ?></h1>
Средний размер файла и «вес» веб-сайтов стали немного смешными. В апреле 2016 года было отмечено, что средняя страница теперь <a rel="nofollow noreferrer" target="_blank" href="https://mobiforge.com/research-analysis/the-web-is-doom">больше, чем в игре DOOM.</a>
<br><br>
Это не дело!

View file

@ -10,22 +10,14 @@
<a title="<?= lang('Info'); ?>" href="/info"><?= lang('Info'); ?></a>
</li>
</ul>
<h1>Информация</h1>
<h1><?= $data['h1']; ?></h1>
Этот раздел содержит всевозможные официальные страницы типа документации.
<br><br>
Скачайте архив <i>AreaDev с GitHub:</i> <a rel="nofollow noreferrer" target="_blank" href="https://github.com/Toxu-ru/AreaDev">github.com/Toxu-ru/AreaDev</a>
<a href="/info/initial-setup">Начальная настройка</a> по установке локально и часто задаваемые вопросы.
<br><br>
Скачайте архив <i>AreaDev с GitHub:</i> <a rel="nofollow noreferrer" target="_blank" href="https://github.com/Toxu-ru/AreaDev">github.com/Toxu-ru/AreaDev</a><br>
<h3>Тестирование</h3>
<ul>
<li> Корневая папка проекта: public (настройте сервер)</li>
<li> Залейте: database/dev.sql</li>
<li> Пропишите настройки: database/dbase.config.php</li>
<li> Войдите в аккаунт используя данные: ss@sdf.ru / qwer14qwer14</li>
</ul>
Код сайта имеет лицензию <a rel="nofollow noreferrer" target="_blank" href="https://ru.wikipedia.org/wiki/%D0%9B%D0%B8%D1%86%D0%B5%D0%BD%D0%B7%D0%B8%D1%8F_MIT">MIT</a>.
<br><br>
С технической стороны сайт стремится использовать современные версии простых, надежных, «скучных» технологий. Это особенно важно для проекта с открытым исходным кодом, рассчитывающего на участие извне, поскольку это означает, что людям гораздо легче участвовать.
@ -42,23 +34,10 @@
<br><br>
Код был создан с учетом этого и использует различные методы для улучшения его качества и согласованности.
<br><br>
Если вы обнаружили проблему безопасности, пожалуйста, ответственно сообщите об этом, отправив письмо по адресу <i>budo@narod.ru</i>. Сайт не предлагает награды за ошибки.
Если вы обнаружили проблему безопасности, пожалуйста, ответственно сообщите об этом, отправив письмо по адресу <code>budo1@ya.ru</code>. Сайт не предлагает награды за ошибки.
<br><br>
По вопросам, связанным с пожертвованиями, другими предложениями, замечаниями пишите туда же.
<br> <br>
---------------
<p>Страница, на которую вы смотрите, генерируется динамически.</p>
<p>Если вы хотите отредактировать эту страницу, вы найдете ее по адресу:</p>
<pre><code>resources/views/info/index.php</code></pre>
<p>Соответствующий контроллер распологается:</p>
<pre><code>app/Controllers/InfoControllers.php</code></pre>
<br>
</div>
</main>

View file

@ -0,0 +1,59 @@
<?php include TEMPLATE_DIR . '/header.php'; ?>
<?php include TEMPLATE_DIR . '/menu.php'; ?>
<main class="info">
<div class="left-ots max-width">
<ul class="breadcrumb">
<li class="breadcrumb-item">
<a title="<?= lang('Home'); ?>" href="/"><?= lang('Home'); ?></a>
</li>
<li class="breadcrumb-item">
<a title="<?= lang('Info'); ?>" href="/info"><?= lang('Info'); ?></a>
</li>
</ul>
<h1><?= $data['h1']; ?></h1>
<b>Как мне установить скрипт?</b><br>
<ul>
<li>Корневая папка проекта: <i>public</i> (настройте сервер)</li>
<li>Залейте: <i>database/dev.sql</i></li>
<li>Пропишите настройки: <i>database/dbase.config.php</i></li>
<li>Войдите в аккаунт используя данные: <code>ss@sdf.ru / qwer14qwer14</code></li>
</ul>
<b>Как мне включить режим отладки?</b><br>
В файле: <i>start.hleb.php:</i><br>
<pre><code>define( 'HLEB_PROJECT_DEBUG', false );</code></pre>
<i>false</i> измените на <i>true</i>. <br>
Далее в файле: <i>app/Optional/MainConnector.php</i><br>
Необходимо расскоммнтировать строку: <br>
<pre><code>// "Phphleb\Debugpan\DPanel" => "vendor/phphleb/debugpan/DPanel.php"</code></pre>
А в файле: <i>public/index.php</i><br>
Необходимо закомментировать 2 строки связанные с <i>Content Security Policy</i>: <br>
<pre><code>header("Content-Security-Policy: default-src 'self'....</code></pre>
И строку:
<pre><code>header("Strict-Transport-Security: max-age=31536000....</code></pre>
На публичном сервере обязательно верните значения по умолчанию!
<br><br>
<b>Как мне изменить текст на страницах с информацией?</b><br>
Все эти страницы используют обычных html, и файлы вы можете найти в папке:
<pre><code>resources/views/info/*</code></pre>
В папке:
<pre><code>resources/views/*</code></pre>
как вы уже поняли располагаются шаблоны. Смелей меняйте их.
<br><br>
Скачайте архив <i>AreaDev с GitHub:</i> <a rel="nofollow noreferrer" target="_blank" href="https://github.com/Toxu-ru/AreaDev">github.com/Toxu-ru/AreaDev</a>
</div>
</main>
<?php include 'menu.php'; ?>
<?php include TEMPLATE_DIR . '/footer.php'; ?>

View file

@ -10,7 +10,7 @@
<a title="<?= lang('Info'); ?>" href="/info"><?= lang('Info'); ?></a>
</li>
</ul>
<h1>Markdown (разметка)</h1>
<h1><?= $data['h1']; ?></h1>
Сообщения на сайте форматируются с использованием варианта специального языка форматирования под названием <i>CommonMark</i> (который сам по себе является вариантом <i>Markdown</i>).
<br><br>

View file

@ -7,6 +7,8 @@
<a class="info-n<?php if($uri == '/info/trust-level') { ?> active<?php } ?>" href="/info/trust-level">~ <?= lang('Trust level'); ?> (TL)</a>
<a class="info-n<?php if($uri == '/info/about') { ?> active<?php } ?>" href="/info/about">~ <?= lang('About'); ?></a>
<div class="v-ots"></div>
<a class="info-n<?php if($uri == '/info/initial-setup') { ?> active<?php } ?>" href="/info/initial-setup">~ <?= lang('Initial Setup'); ?></a>
<div class="v-ots"></div>
<a class="info-n<?php if($uri == '/info/stats') { ?> active<?php } ?>" href="/info/stats">~ <?= lang('Statistics'); ?></a>
</div>
</aside>

View file

@ -11,7 +11,7 @@
</li>
</ul>
<h1>Политика конфиденциальности</h1>
<h1><?= $data['h1']; ?></h1>
<p>Это Интернет, у вас нет конфиденциальности.</p>

View file

@ -10,7 +10,7 @@
<a title="<?= lang('Info'); ?>" href="/info"><?= lang('Info'); ?></a>
</li>
</ul>
<h1>Правила</h1>
<h1><?= $data['h1']; ?></h1>
<p>Пожалуйста, относитесь к этому сайту с таким же уважением, как относитесь к собственному дому. </p>
<p>

View file

@ -12,7 +12,7 @@
</ul>
<center>
<h1>Статистика</h1>
<h1><?= $data['h1']; ?></h1>
<div class="canvas-telo">
<canvas id="canvas"> </canvas>
</div>

View file

@ -10,7 +10,7 @@
<a title="<?= lang('Info'); ?>" href="/info"><?= lang('Info'); ?></a>
</li>
</ul>
<h1>Уровень доверия (TL)</h1>
<h1><?= $data['h1']; ?></h1>
Система доверия пользователей является краеугольным камнем. Уровни доверия - это способ... <br>
<ul>

View file

@ -95,9 +95,10 @@ Route::get('/info/stats')->controller('InfoController@stats');
Route::get('/info/rules')->controller('InfoController@rules');
Route::get('/info/about')->controller('InfoController@about');
Route::get('/info/privacy')->controller('InfoController@privacy');
Route::get('/info/trust-level')->controller('InfoController@trustlevel');
Route::get('/info/trust-level')->controller('InfoController@trustLevel');
Route::get('/info/restriction')->controller('InfoController@restriction');
Route::get('/info/markdown')->controller('InfoController@markdown');
Route::get('/info/markdown')->controller('InfoController@markdown');
Route::get('/info/initial-setup')->controller('InfoController@initialSetup');
// Покажем пост в ленте
Route::type('post')->get('/post/shown')->controller('PostController@shownPost');