DEV: Фиксация ошибок и изм. шаблона Q&A (2)

This commit is contained in:
Evg 2022-04-16 12:10:23 +03:00
parent da77321adc
commit 485833a7e0
20 changed files with 238 additions and 239 deletions

View file

@ -51,7 +51,6 @@ class EditAnswerController extends MainController
{
$answer_id = Request::getPostInt('answer_id');
$content = $_POST['content']; // для Markdown
$post = PostModel::getPost($post_id, 'id', $this->user);
// If the user is frozen
// Если пользователь заморожен
@ -64,6 +63,7 @@ class EditAnswerController extends MainController
redirect('/');
}
$post = PostModel::getPost($answer['answer_post_id'], 'id', $this->user);
$url = getUrlByName('post', ['id' => $answer['answer_post_id'], 'slug' => $post['post_slug']]);
Validation::Length($content, Translate::get('bodies'), '6', '5000', '/' . $url);

View file

@ -12,9 +12,9 @@
<fieldset>
<?= Html::sumbit(__('reset')); ?>
<?php if (Config::get('general.invite') == false) { ?>
<?php if (Config::get('general.invite') == false) : ?>
<span class="mr5 ml15 text-sm"><a href="<?= getUrlByName('register'); ?>"><?= __('registration'); ?></a></span>
<?php } ?>
<?php endif; ?>
<span class="mr5 ml15 text-sm"><a href="<?= getUrlByName('login'); ?>"><?= __('sign.in'); ?></a></span>
</fieldset>
</form>

View file

@ -64,7 +64,7 @@ if ($blog['facet_is_deleted'] == 0) : ?>
<div class="sticky top0 top-sm">
<div class="bg-violet box text-sm">
<h3 class="uppercase-box"><?= __('pages'); ?></h3>
<?php foreach ($data['pages'] as $ind => $row) ; ?>
<?php foreach ($data['pages'] as $ind => $row) : ?>
<div class="mb5">
<a class="relative pt5 pb5 hidden" href="<?= getUrlByName('blog.article', ['slug' => $blog['facet_slug'], 'post_slug' => $row['post_slug']]); ?>">
<?= $row['post_title']; ?>

View file

@ -57,7 +57,7 @@
</a>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php else : ?>
<?= Tpl::insert('/_block/no-content', ['type' => 'small', 'text' => __('no'), 'icon' => 'bi-info-lg']); ?>

View file

@ -3,5 +3,5 @@
<?= Html::image($user['avatar'], $user['login'], 'ava-sm', 'avatar', 'max'); ?>
<?= $user['login']; ?>
</a>
<?php endif; ?>
<?php endforeach; ?>

View file

@ -12,14 +12,14 @@
<div class="help">6 - 250 <?= __('characters'); ?></div>
</fieldset>
<?php if (!empty($data['blog'])) { ?>
<?php if (!empty($data['blog'])) : ?>
<?= Tpl::insert('/_block/form/select/blog', [
'data' => $data,
'action' => 'add',
'type' => 'blog',
'title' => __('blogs'),
]); ?>
<?php } ?>
<?php endif; ?>
<?= Tpl::insert('/_block/form/select/select', [
'data' => $data['facets'],
@ -30,7 +30,7 @@
'red' => 'red'
]); ?>
<?php if ($user['trust_level'] >= Config::get('trust-levels.tl_add_url')) { ?>
<?php if ($user['trust_level'] >= Config::get('trust-levels.tl_add_url')) : ?>
<fieldset>
<div class="left w-70">
<input id="link" placeholder="URL" class="post_url" type="text" name="post_url" />
@ -39,7 +39,7 @@
<input id="graburl" readonly="readonly" class="btn btn-outline-primary" name="submit_url" value="<?= __('to.extract'); ?>" />
</div>
</fieldset>
<?php } ?>
<?php endif; ?>
<div class="file-upload mb20" id="file-drag">
<div class="flex">
@ -60,7 +60,7 @@
<?= Tpl::insert('/_block/editor/editor', ['height' => '250px', 'type' => 'post-telo', 'id' => 0]); ?>
<?php if ($user['trust_level'] > UserData::USER_FIRST_LEVEL) { ?>
<?php if ($user['trust_level'] > UserData::USER_FIRST_LEVEL) : ?>
<?= Tpl::insert('/_block/form/radio', [
'data' => [
[
@ -87,7 +87,7 @@
],
]
]); ?>
<?php } ?>
<?php endif; ?>
<?= Tpl::insert('/_block/form/radio', [
'data' => [
@ -98,7 +98,7 @@
]
]); ?>
<?php if (UserData::checkAdmin()) { ?>
<?php if (UserData::checkAdmin()) : ?>
<?= Tpl::insert('/_block/form/radio', [
'data' => [
[
@ -107,7 +107,7 @@
],
]
]); ?>
<?php } ?>
<?php endif; ?>
<?= Tpl::insert('/_block/form/select/related-posts', [
'data' => [],

View file

@ -34,22 +34,22 @@
'red' => 'red'
]); ?>
<?php if ($post['post_url']) { ?>
<?php if ($post['post_url']) : ?>
<div class="mb20 2flex">
<div class="mb5" for="post_title">URL:
<a target="_blank" rel="noreferrer ugc" href="<?= $post['post_url']; ?>" class="text-sm">
<?= $post['post_url']; ?>
</a>
</div>
<?php if ($post['post_thumb_img']) { ?>
<?php if ($post['post_thumb_img']) : ?>
<?= Html::image($post['post_thumb_img'], $post['post_title'], 'w94', 'post', 'thumbnails'); ?>
<?php } ?>
<?php endif; ?>
</div>
<?php } ?>
<?php endif; ?>
<div class="file-upload mb20" id="file-drag">
<div class="flex">
<?php if ($post['post_content_img']) { ?>
<?php if ($post['post_content_img']) : ?>
<div class="mr20">
<?= Html::image($post['post_content_img'], $post['post_title'], 'w160', 'post', 'cover'); ?>
<input type="hidden" name="images" value="<?= $post['post_content_img']; ?>">
@ -57,7 +57,7 @@
<?= __('remove'); ?>
</a>
</div>
<?php } ?>
<?php endif; ?>
<img id="file-image" src="/assets/images/1px.jpg" alt="" class="mr20 w94 h94 br-gray">
<div id="start">
@ -72,8 +72,8 @@
<?= Tpl::insert('/_block/editor/editor', ['height' => '300px', 'content' => $post['post_content'], 'type' => 'post-telo', 'id' => $post['post_id']]); ?>
<?php if ($user['trust_level'] > UserData::USER_FIRST_LEVEL) { ?>
<?php if ($post['post_draft'] == 1) { ?>
<?php if ($user['trust_level'] > UserData::USER_FIRST_LEVEL) : ?>
<?php if ($post['post_draft'] == 1) : ?>
<?= Tpl::insert('/_block/form/radio', [
'data' => [
[
@ -83,8 +83,8 @@
],
]
]); ?>
<?php } ?>
<?php } ?>
<?php endif; ?>
<?php endif; ?>
<?= Tpl::insert('/_block/form/select/content-tl', [
'data' => $post['post_tl'],
@ -116,7 +116,7 @@
]
]); ?>
<?php if (UserData::checkAdmin()) { ?>
<?php if (UserData::checkAdmin()) : ?>
<?= Tpl::insert('/_block/form/radio', [
'data' => [
[
@ -135,7 +135,7 @@
'title' => __('author'),
'help' => __('necessarily'),
]); ?>
<?php } ?>
<?php endif; ?>
<?= Tpl::insert('/_block/form/select/related-posts', [
'data' => $data,
@ -146,9 +146,9 @@
]); ?>
<p>
<?php if ($post['post_draft'] == 1) { ?>
<?php if ($post['post_draft'] == 1) : ?>
<input type="hidden" name="draft" id="draft" value="1">
<?php } ?>
<?php endif; ?>
<input type="hidden" name="post_id" id="post_id" value="<?= $post['post_id']; ?>">
<?= Html::sumbit(__('edit')); ?>
</p>

View file

@ -1,15 +1,15 @@
<main class="col-two">
<div class="box">
<?php if ($data['site']['item_title']) { ?>
<?php if ($data['site']['item_title']) : ?>
<div class="right mt10">
<?= Html::votes($user['id'], $data['site'], 'item', 'ps', 'mr10'); ?>
</div>
<h1><?= $data['site']['item_title']; ?>
<?php if ($user['trust_level'] > 4) { ?>
<?php if ($user['trust_level'] > 4) : ?>
<a class="text-sm ml5" title="<?= __('edit'); ?>" href="<?= getUrlByName('web.edit', ['id' => $data['site']['item_id']]); ?>">
<i class="bi-pencil"></i>
</a>
<?php } ?>
<?php endif; ?>
</h1>
<div class="gray">
<?= Html::fragment(Content::text($data['site']['item_content'], 'line'), 200); ?>
@ -21,9 +21,9 @@
</a>
<span class="right gray-600"><i class="bi-journal mr5"></i> <?= $data['site']['item_count']; ?></span>
</div>
<?php } else { ?>
<?php else : ?>
<h1><?= __('domain') . ': ' . $data['domain']; ?></h1>
<?php } ?>
<?php endif; ?>
</div>
<?= Tpl::insert('/content/post/post', ['data' => $data, 'user' => $user]); ?>

View file

@ -1,10 +1,10 @@
<?php if (!empty($data['posts'])) { ?>
<?php if (!empty($data['posts'])) : ?>
<?php $n = 0;
foreach ($data['posts'] as $post) {
foreach ($data['posts'] as $post) :
$n++; ?>
<?php if ($user['id'] == 0 && $n == 6) { ?>
<?php if ($user['id'] == 0 && $n == 6) : ?>
<?= Tpl::insert('/_block/no-login-screensaver'); ?>
<?php } ?>
<?php endif; ?>
<?php $post_url = getUrlByName('post', ['id' => $post['post_id'], 'slug' => $post['post_slug']]); ?>
<div class="flex br-bottom p10 article_<?= $post['post_id']; ?>">
<div class="flex mb-inline mr15">
@ -25,9 +25,9 @@
<div class="w-100 mr15">
<div class="mt0 mb0">
<?php if ($bg_url) { ?>
<?php if ($bg_url) : ?>
<span><?= __('news'); ?>:</span>
<?php } ?>
<?php endif; ?>
<a href="<?= $post_url; ?>">
<span class="font-normal text-xl">
<?= $post['post_title']; ?>
@ -39,11 +39,11 @@
<div class="flex-auto">
<?= Html::facets($post['facet_list'], 'blog', 'blog', 'gray text-xs mr15'); ?>
<?= Html::facets($post['facet_list'], 'topic', 'topic', 'tags-xs'); ?>
<?php if ($post['post_url_domain']) { ?>
<?php if ($post['post_url_domain']) : ?>
<a class="gray-600 text-sm ml10" href="<?= getUrlByName('domain', ['domain' => $post['post_url_domain']]); ?>">
<i class="bi-link-45deg middle"></i> <?= $post['post_url_domain']; ?>
</a>
<?php } ?>
<?php endif; ?>
</div>
<div class="gray-600 text-xs">
@ -55,15 +55,15 @@
</div>
</div>
<?php if ($data['sheet'] == 'subscribed') { ?>
<?php if ($data['sheet'] == 'subscribed') : ?>
<div data-id="<?= $post['post_id']; ?>" data-type="post" class="focus-id bg-violet text-sm right">
<?= __('unsubscribe'); ?>
</div>
<?php } ?>
<?php endif; ?>
</div>
</div>
<?php } ?>
<?php } else { ?>
<?php endforeach; ?>
<?php else : ?>
<?php if (UserData::checkActiveUser()) : ?>
<?= Tpl::insert('/_block/recommended-topics', ['data' => $data]); ?>
<?php endif; ?>
@ -71,4 +71,4 @@
<i class="bi-journal-richtext block text-8xl"></i>
<?= __('no.posts'); ?>
</div>
<?php } ?>
<?php endif; ?>

View file

@ -9,25 +9,25 @@
</div>
<main>
<article class="post-full <?php if ($post['post_is_deleted'] == 1) { ?> bg-red-200<?php } ?>">
<?php if ($post['post_is_deleted'] == 0 || UserData::checkAdmin()) { ?>
<?php if ($post['post_is_deleted'] == 0 || UserData::checkAdmin()) : ?>
<div class="post-body">
<div class="flex flex-row items-center">
<?php if (!empty($data['blog'])) { ?>
<?php if (!empty($data['blog'])) : ?>
<a title="<?= $data['blog'][0]['facet_title']; ?>" class="mr10 gray-600 text-sm" href="/blog/<?= $data['blog'][0]['facet_slug']; ?>">
<?= $data['blog'][0]['facet_title']; ?>
</a>
<?php } ?>
<?php endif; ?>
<?php if (!empty($data['facets'])) { ?>
<?php if (!empty($data['facets'])) : ?>
<div class="lowercase">
<?php foreach ($data['facets'] as $topic) { ?>
<?php foreach ($data['facets'] as $topic) : ?>
<a class="tags" href="<?= getUrlByName('topic', ['slug' => $topic['facet_slug']]); ?>">
<?= $topic['facet_title']; ?>
</a>
<?php } ?>
<?php endforeach; ?>
</div>
<?php } ?>
<?php endif; ?>
</div>
<h1><?= $post['post_title']; ?>
@ -35,65 +35,65 @@
</h1>
<div class="text-sm lowercase flex gray-600">
<?= Html::langDate($post['post_date']); ?>
<?php if ($post['modified']) { ?>
<?php if ($post['modified']) : ?>
(<?= __('ed'); ?>)
<?php } ?>
<?php endif; ?>
<?php if ($user['id']) { ?>
<?php if ($user['login'] == $post['login'] || UserData::checkAdmin()) { ?>
<?php if ($user['id']) : ?>
<?php if ($user['login'] == $post['login'] || UserData::checkAdmin()) : ?>
<a class="gray-600 mr10 ml10" href="<?= getUrlByName('content.edit', ['type' => 'post', 'id' => $post['post_id']]); ?>">
<?= __('edit'); ?>
</a>
<?php } ?>
<?php if ($user['login'] == $post['login']) { ?>
<?php if ($post['my_post'] == $post['post_id']) { ?>
<?php endif; ?>
<?php if ($user['login'] == $post['login']) : ?>
<?php if ($post['my_post'] == $post['post_id']) : ?>
<span class="add-profile active mr10 ml10" data-post="<?= $post['post_id']; ?>">
+ <?= __('in.profile'); ?>
</span>
<?php } else { ?>
<?php else : ?>
<span class="add-profile mr10 ml10" data-post="<?= $post['post_id']; ?>">
<?= __('in.profile'); ?>
</span>
<?php } ?>
<?php } ?>
<?php if (UserData::checkAdmin()) { ?>
<?php endif; ?>
<?php endif; ?>
<?php if (UserData::checkAdmin()) : ?>
<a data-type="post" data-id="<?= $post['post_id']; ?>" class="type-action gray-600 mr10 ml10">
<?php if ($post['post_is_deleted'] == 1) { ?>
<?php if ($post['post_is_deleted'] == 1) : ?>
<i class="bi-trash red"></i>
<?php } else { ?>
<?php else : ?>
<i class="bi-trash"></i>
<?php } ?>
<?php endif; ?>
</a>
<a data-id="<?= $post['post_id']; ?>" class="post-recommend gray-600 mr10 ml10">
<?php if ($post['post_is_recommend'] == 1) { ?>
<?php if ($post['post_is_recommend'] == 1) : ?>
<i class="bi-lightning sky"></i>
<?php } else { ?>
<?php else : ?>
<i class="bi-lightning"></i>
<?php } ?>
<?php endif; ?>
</a>
<?php } ?>
<?php endif; ?>
<?= Tpl::insert('/_block/show-ip', ['ip' => $post['post_ip'], 'user' => $user, 'publ' => $post['post_published']]); ?>
<?php } ?>
<?php endif; ?>
</div>
</div>
<?php if ($post['post_thumb_img']) { ?>
<?php if ($post['post_thumb_img']) : ?>
<?= Html::image($post['post_thumb_img'], $post['post_title'], 'thumb right ml15', 'post', 'thumbnails'); ?>
<?php } ?>
<?php endif; ?>
<div class="post-body max-w780 full">
<div class="post">
<?= Content::text($post['post_content'], 'text'); ?>
</div>
<?php if ($post['post_url_domain']) { ?>
<?php if ($post['post_url_domain']) : ?>
<div class="mb15">
<a rel="nofollow noreferrer ugc" target="_blank" class="btn btn-primary" href="<?= $post['post_url']; ?>">
<?= __('details.here'); ?>
<i class="bi-folder-symlink middle ml5"></i>
</a>
</div>
<?php } ?>
<?php if ($post['post_url_domain']) { ?>
<?php endif; ?>
<?php if ($post['post_url_domain']) : ?>
<h3 class="uppercase-box"><?= __('source'); ?></h3>
<div class="italic m15 mb15 p10 text-sm bg-lightgray table gray">
<div>
@ -103,7 +103,7 @@
</a>
</div>
</div>
<?php } ?>
<?php endif; ?>
<?= Tpl::insert('/_block/related-posts', ['related_posts' => $data['related_posts']]); ?>
</div>
@ -128,22 +128,22 @@
<?= __('last.answer'); ?>
</div>
<div class="center">
<?php if (!empty($data['last_user']['answer_id'])) { ?>
<?php if (!empty($data['last_user']['answer_id'])) : ?>
<a title="<?= $data['last_user']['login']; ?>" href="<?= getUrlByName('post', ['id' => $post['post_id'], 'slug' => $post['post_slug']]); ?>#answer_<?= $data['last_user']['answer_id']; ?>">
<?= Html::image($data['last_user']['avatar'], $data['last_user']['login'], 'ava-base', 'avatar', 'small'); ?>
</a>
<?php } else { ?>
<?php else : ?>
<span class="gray-600 text-sm"></span>
<?php } ?>
<?php endif; ?>
</div>
</li>
<li class="left p10 mb-none gray-600 text-2xl">
<div class="text-2xl center mb5">
<?php if ($post['post_hits_count'] == 0) { ?>
<?php if ($post['post_hits_count'] == 0) : ?>
<?php } else { ?>
<?php else : ?>
<?= $post['post_hits_count']; ?>
<?php } ?>
<?php endif; ?>
</div>
<div class="center text-sm">
<?= Html::numWord($post['post_hits_count'], __('num.view'), false); ?>
@ -151,11 +151,11 @@
</li>
<li class="left p10 mb-none gray-600 text-sm">
<div class="text-2xl center mb5">
<?php if ($post['amount_content'] == 0) { ?>
<?php if ($post['amount_content'] == 0) : ?>
<?php } else { ?>
<?php else : ?>
<?= $post['amount_content']; ?>
<?php } ?>
<?php endif; ?>
</div>
<div class="center">
<?= Html::numWord($post['amount_content'], __('num.answer'), false); ?>
@ -164,21 +164,21 @@
</ul>
<div class="mr15">
<?php if (UserData::checkActiveUser()) { ?>
<?php if (is_array($data['post_signed'])) { ?>
<?php if (UserData::checkActiveUser()) : ?>
<?php if (is_array($data['post_signed'])) : ?>
<div data-id="<?= $post['post_id']; ?>" data-type="post" class="focus-id right mt5 yes">
<?= __('unsubscribe'); ?>
</div>
<?php } else { ?>
<?php else : ?>
<div data-id="<?= $post['post_id']; ?>" data-type="post" class="focus-id right mt5 no">
+ <?= __('read'); ?>
</div>
<?php } ?>
<?php } else { ?>
<?php endif; ?>
<?php else : ?>
<a class="right mt5 focus-id no" href="<?= getUrlByName('login'); ?>">
+ <?= __('read'); ?>
</a>
<?php } ?>
<?php endif; ?>
</div>
<div class="right ml15 p10 none mb-block">
@ -186,8 +186,8 @@
</div>
</div>
<?php if (UserData::checkActiveUser()) { ?>
<?php if ($post['post_feature'] == 0 && $post['post_draft'] == 0 && $post['post_closed'] == 0) { ?>
<?php if (UserData::checkActiveUser()) : ?>
<?php if ($post['post_feature'] == 0 && $post['post_draft'] == 0 && $post['post_closed'] == 0) : ?>
<form action="<?= getUrlByName('content.create', ['type' => 'answer']); ?>" accept-charset="UTF-8" method="post">
<?= csrf_field() ?>
@ -201,89 +201,89 @@
</div>
</form>
<?php } ?>
<?php } ?>
<?php endif; ?>
<?php endif; ?>
<?php } else { ?>
<?php else : ?>
<div class="bg-red-200 p15 center mr10">
<?= sprintf(__('content.deleted'), __('post')); ?>...
</div>
<?php } ?>
<?php endif; ?>
</article>
<div id="comment"></div>
<?php if ($post['post_draft'] == 0) {
if ($post['post_feature'] == 0) {
<?php if ($post['post_draft'] == 0) :
if ($post['post_feature'] == 0) :
Tpl::insert('/_block/comments-view', ['data' => $data, 'post' => $post, 'user' => $user]);
if ($post['post_closed'] == 1) {
if ($post['post_closed'] == 1) :
echo Tpl::insert('/_block/no-content', ['type' => 'small', 'text' => __('post.closed'), 'icon' => 'bi-door-closed']);
}
} else {
endif;
else :
Tpl::insert('/_block/questions-view', ['data' => $data, 'post' => $post, 'user' => $user]);
if ($post['post_closed'] == 1) {
if ($post['post_closed'] == 1) :
echo Tpl::insert('/_block/no-content', ['type' => 'small', 'text' => __('question.closed'), 'icon' => 'bi-door-closed']);
}
}
} else {
echo Tpl::insert('/_block/no-content', ['type' => 'small', 'text' => __('this.draft'), 'icon' => 'bi-info-lg']);
} ?>
endif;
endif;
else :
echo Tpl::insert('/_block/no-content', ['type' => 'small', 'text' => __('this.draft'), 'icon' => 'bi-info-lg']);
endif; ?>
</main>
<aside>
<?php if (!empty($data['facets'])) { ?>
<?php if (!empty($data['facets'])) : ?>
<div class="box bg-violet">
<h3 class="uppercase-box"><?= __('topics'); ?></h3>
<?php foreach ($data['facets'] as $topic) { ?>
<?php foreach ($data['facets'] as $topic) : ?>
<?= Html::image($topic['facet_img'], $topic['facet_title'], 'img-base', 'logo', 'max'); ?>
<?php if (!$topic['signed_facet_id'] && $user['id']) { ?>
<?php if (!$topic['signed_facet_id'] && $user['id']) : ?>
<div data-id="<?= $topic['facet_id']; ?>" data-type="facet" class="focus-id right inline text-sm sky center mt5 mr5">
<i class="bi-plus"></i> <?= __('read'); ?>
<i class="bi-plus"></i> <?= __('read'); ?>
</div>
<?php } ?>
<?php endif; ?>
<a title="<?= $topic['facet_title']; ?>" class="black inline text-sm" href="<?= getUrlByName('topic', ['slug' => $topic['facet_slug']]); ?>">
<?= $topic['facet_title']; ?>
<?= $topic['facet_title']; ?>
</a>
<div class="text-sm mt5 pr15 mb-pr0 gray-600">
<?= $topic['facet_short_description']; ?>
</div>
<?php } ?>
<?php endforeach; ?>
</div>
<?php } ?>
<?php endif; ?>
<?php if ($post['post_content_img']) { ?>
<?php if ($post['post_content_img']) : ?>
<div class="box bg-violet">
<img class="preview w-100 br-rd5" src="<?= PATH_POSTS_COVER . $post['post_content_img']; ?>" alt="<?= $post['post_title']; ?>">
</div>
<?php } ?>
<?php endif; ?>
<div class="center box bg-violet">
<?= Tpl::insert('/share'); ?>
<?= Tpl::insert('/share'); ?>
</div>
<?php if ($data['recommend']) { ?>
<?php if ($data['recommend']) : ?>
<div class="box bg-violet sticky top-sm">
<h3 class="uppercase-box"><?= __('recommended'); ?></h3>
<?php foreach ($data['recommend'] as $rec_post) { ?>
<?php foreach ($data['recommend'] as $rec_post) : ?>
<div class="mb15 hidden flex text-sm">
<?php if ($rec_post['post_type'] == 'post') { ?>
<?php if ($rec_post['post_type'] == 'post') : ?>
<a class="gray" href="<?= getUrlByName('post', ['id' => $rec_post['post_id'], 'slug' => $rec_post['post_slug']]); ?>">
<?php if ($rec_post['post_answers_count'] > 0) { ?>
<?php if ($rec_post['post_answers_count'] > 0) : ?>
<div class="p5 pr10 pb5 pl10 bg-green br-rd3 white center mr15">
<?= $rec_post['post_answers_count'] ?>
</div>
<?php } else { ?>
<?php else : ?>
<div class="p5 pr10 pb5 pl10 bg-lightgray br-rd3 gray center mr15">0</div>
<?php } ?>
<?php endif; ?>
</a>
<?php } else { ?>
<?php else : ?>
<i class="bi-intersect gray-600 middle mr15 text-2xl"></i>
<?php } ?>
<?php endif; ?>
<a class="black" href="<?= getUrlByName('post', ['id' => $rec_post['post_id'], 'slug' => $rec_post['post_slug']]); ?>">
<?= $rec_post['post_title']; ?>
</a>
</div>
<?php } ?>
<?php endforeach; ?>
</div>
<?php } ?>
<?php endif; ?>
</aside>
<script nonce="<?= $_SERVER['nonce']; ?>">
document.addEventListener('DOMContentLoaded', () => {
@ -302,9 +302,9 @@
}
if (text) {
let comment = document.getElementById('qcomment');
let comment = document.getElementById('qcomment');
if (comment) {
comment.innerHTML = '> ' + text;
comment.innerHTML = '> ' + text;
}
}
}

View file

@ -5,7 +5,7 @@
<link><?= $data['url']; ?>/topic/<?= $topic['facet_slug']; ?></link>
<description>RSS feed for <?= $topic['facet_title']; ?></description>
<atom:link href="<?= $data['url']; ?>/rss-feed/topic/<?= $topic['facet_slug']; ?>" rel="self" type="application/rss+xml" />
<?php foreach ($data['posts'] as $post) { ?>
<?php foreach ($data['posts'] as $post) : ?>
<item>
<title><?= $post['post_title']; ?></title>
<description>
@ -15,6 +15,6 @@
<pubDate><?= date(DATE_RFC822, strtotime($post['post_date'])); ?></pubDate>
<guid><?= $data['url']; ?><?= getUrlByName('post', ['id' => $post['post_id'], 'slug' => $post['post_slug']]); ?></guid>
</item>
<?php } ?>
<?php endforeach; ?>
</channel>
</rss>

View file

@ -7,20 +7,20 @@
<changefreq>daily</changefreq>
</url>
<!-- Sitemap -->
<?php foreach ($data['topics'] as $topic) { ?>
<?php foreach ($data['topics'] as $topic) : ?>
<url>
<loc><?= $data['url']; ?>/topic/<?= $topic['facet_slug']; ?></loc>
<priority>0.5</priority>
<changefreq>daily</changefreq>
</url>
<?php } ?>
<?php foreach ($data['posts'] as $post) { ?>
<?php endforeach; ?>
<?php foreach ($data['posts'] as $post) : ?>
<url>
<loc><?= $data['url']; ?><?= getUrlByName('post', ['id' => $post['post_id'], 'slug' => $post['post_slug']]); ?></loc>
<priority>0.5</priority>
<changefreq>daily</changefreq>
</url>
<?php } ?>
<?php endforeach; ?>
<url>
<loc><?= $data['url']; ?>/info</loc>
<priority>0.5</priority>

View file

@ -5,7 +5,7 @@
<link><?= $data['url']; ?>/topic/<?= $topic['facet_slug']; ?></link>
<description><?= $topic['facet_description']; ?></description>
<language>ru</language>
<?php foreach ($data['posts'] as $post) { ?>
<?php foreach ($data['posts'] as $post) : ?>
<item turbo="true">
<link><?= $data['url']; ?><?= getUrlByName('post', ['id' => $post['post_id'], 'slug' => $post['post_slug']]); ?></link>
<pubDate><?= $post['post_date']; ?></pubDate>
@ -23,6 +23,6 @@
]]>
</turbo:content>
</item>
<?php } ?>
<?php endforeach; ?>
</channel>
</rss>

View file

@ -3,7 +3,7 @@
<p class="m0"><?= __($data['sheet']); ?></p>
</div>
<div class="p15">
<?php if ($user['trust_level'] > 1) { ?>
<?php if ($user['trust_level'] > 1) : ?>
<form method="post" action="<?= getUrlByName('invit.create'); ?>">
<?php csrf_field(); ?>
<fieldset>
@ -16,43 +16,43 @@
<h3><?= __('invited.guests'); ?></h3>
<?php if (!empty($data['invitations'])) { ?>
<?php if (!empty($data['invitations'])) : ?>
<?php foreach ($data['invitations'] as $invite) { ?>
<?php if ($invite['active_status'] == 1) { ?>
<?php foreach ($data['invitations'] as $invite) : ?>
<?php if ($invite['active_status'] == 1) : ?>
<div class="text-sm gray">
<?= Html::image($invite['avatar'], $invite['login'], 'ava', 'avatar', 'small'); ?>
<a href="<?= $invite['login']; ?>"><?= $invite['login']; ?></a>
- <?= __('registered'); ?>
</div>
<?php if (UserData::checkAdmin()) { ?>
<?php if (UserData::checkAdmin()) : ?>
<?= __('link.used'); ?>:
<?= $invite['invitation_email']; ?>
<code class="block w-90">
<?= Config::get('meta.url'); ?><?= getUrlByName('invite.reg', ['code' => $invite['invitation_code']]); ?>
</code>
<?php } ?>
<?php endif; ?>
<span class="text-sm gray"><?= __('link.used'); ?></span>
<?php } else { ?>
<?php else : ?>
<?= __('for'); ?> (<?= $invite['invitation_email']; ?>)
<?= __('can.send.this.link'); ?>:
<code class="block w-90">
<?= Config::get('meta.url'); ?><?= getUrlByName('invite.reg', ['code' => $invite['invitation_code']]); ?>
</code>
<?php } ?>
<?php endif; ?>
<br><br>
<?php } ?>
<?php endforeach; ?>
<?php } else { ?>
<?php else : ?>
<?= __('no.invites'); ?>
<?php } ?>
<?php endif; ?>
<?php } else { ?>
<?php else : ?>
<?= __('limit.tl.invitation'); ?>.
<?php } ?>
<?php endif; ?>
</div>
</main>
<aside>

View file

@ -5,12 +5,12 @@
<div class="box-flex">
<p class="m0"><?= __('answers'); ?> <b><?= $data['profile']['login']; ?></b></p>
</div>
<?php if (!empty($data['answers'])) { ?>
<?php if (!empty($data['answers'])) : ?>
<?= Tpl::insert('/content/answer/answer', ['data' => $data, 'user' => $user]); ?>
<?= Html::pagination($data['pNum'], $data['pagesCount'], $data['sheet'], '/@' . $data['profile']['login'] . '/answers'); ?>
<?php } else { ?>
<?php else : ?>
<?= Tpl::insert('/_block/no-content', ['type' => 'small', 'text' => __('no.answers'), 'icon' => 'bi-info-lg']); ?>
<?php } ?>
<?php endif; ?>
</main>
<aside>
<?= Tpl::insert('/content/user/profile/sidebar', ['user' => $user, 'data' => $data]); ?>

View file

@ -6,12 +6,12 @@
<div class="box-flex">
<p class="m0"><?= __('comments'); ?> <b><?= $data['profile']['login']; ?></b></p>
</div>
<?php if (!empty($data['comments'])) { ?>
<?php if (!empty($data['comments'])) : ?>
<?= Tpl::insert('/content/comment/comment', ['answer' => $data['comments'], 'user' => $user]); ?>
<?= Html::pagination($data['pNum'], $data['pagesCount'], $data['sheet'], '/@' . $data['profile']['login'] . '/comments'); ?>
<?php } else { ?>
<?php else : ?>
<?= Tpl::insert('/_block/no-content', ['type' => 'small', 'text' => __('no.comments'), 'icon' => 'bi-info-lg']); ?>
<?php } ?>
<?php endif; ?>
</main>
<aside>
<?= Tpl::insert('/content/user/profile/sidebar', ['user' => $user, 'data' => $data]); ?>

View file

@ -7,71 +7,71 @@ if ($profile['cover_art'] != 'cover_art.jpeg') {
?>
<div class="br-gray box">
<?php if ($profile['cover_art'] != 'cover_art.jpeg') { ?>
<?php if ($profile['cover_art'] != 'cover_art.jpeg') : ?>
<div class="profile-box-cover relative">
<img class="w-100 min-h100" src="<?= Html::coverUrl($profile['cover_art'], 'user'); ?>" alt="<?= $profile['login']; ?>">
</div>
<?php } else { ?>
<?php else : ?>
<div class="profile-box relative" style="background: <?= $profile['color']; ?>;min-height: 90px;"></div>
<?php } ?>
<?php endif; ?>
<div class="flex justify-between">
<div class="z-10 w-100">
<?= Html::image($profile['avatar'], $profile['login'], $css, 'avatar', 'max'); ?>
<?php if ($user['id']) { ?>
<?php if ($user['id']) : ?>
<div class="right m20">
<?php if ($profile['login'] == $user['login']) { ?>
<?php if ($profile['login'] == $user['login']) : ?>
<a class="btn btn-primary" title="<?= __('settings'); ?>" href="<?= getUrlByName('setting'); ?>">
<i class="bi-gear"></i>
</a>
<?php } else { ?>
<?php if ($data['button_pm'] === true) { ?>
<?php else : ?>
<?php if ($data['button_pm'] === true) : ?>
<a class="btn btn-primary" title="<?= __('write.message'); ?>" href="<?= getUrlByName('send.messages', ['login' => $profile['login']]); ?>">
<i class="bi-envelope"></i>
</a>
<?php } ?>
<?php } ?>
<?php endif; ?>
<?php endif; ?>
</div>
<?php } ?>
<?php endif; ?>
<div class="flex">
<h1 class="mb-block mb-text-xl m15 mb-mt15 flex">
<?= $profile['login']; ?>
<?php if ($profile['name']) { ?> / <?= $profile['name']; ?><?php } ?>
<?php if ($profile['up_count'] > 0) { ?>
<?php if ($profile['name']) : ?> / <?= $profile['name']; ?><?php endif; ?>
<?php if ($profile['up_count'] > 0) : ?>
<i class="up-id bi-heart red mr10 ml20 mb-ml5 text-sm inline"></i>
<sup class="text-sm gray-600 inline"><?= $profile['up_count']; ?></sup>
<?php } ?>
<?php endif; ?>
</h1>
<div class="ml120 mt10 mb-none">
<div class="flex justify-center">
<?php if ($data['count']['count_posts'] > 0) { ?>
<?php if ($data['count']['count_posts'] > 0) : ?>
<div class="ml15 mr15 center box-number">
<a class="focus-user sky" href="<?= getUrlByName('profile.posts', ['login' => $profile['login']]); ?>">
<?= $data['count']['count_posts']; ?>
</a>
<div class="uppercase mt5 text-sm gray-600"><?= __('posts'); ?></div>
</div>
<?php } ?>
<?php endif; ?>
<?php if ($data['count']['count_answers'] > 0) { ?>
<?php if ($data['count']['count_answers'] > 0) : ?>
<div class="ml15 mr15 center box-number">
<a class="focus-user sky" href="<?= getUrlByName('profile.answers', ['login' => $profile['login']]); ?>">
<?= $data['count']['count_answers']; ?>
</a>
<div class="uppercase mt5 text-sm gray-600"><?= __('answers'); ?></div>
</div>
<?php } ?>
<?php endif; ?>
<?php if ($data['count']['count_comments'] > 0) { ?>
<?php if ($data['count']['count_comments'] > 0) : ?>
<div class="ml15 mr15 center box-number">
<a class="focus-user sky" href="<?= getUrlByName('profile.comments', ['login' => $profile['login']]); ?>">
<?= $data['count']['count_comments']; ?>
</a>
<div class="uppercase mt5 text-sm gray-600"><?= __('comments'); ?></div>
</div>
<?php } ?>
<?php endif; ?>
</div>
</div>
</div>

View file

@ -1,5 +1,4 @@
<?php $profile = $data['profile']; ?>
<div class="mb-none">
<div class="bg-violet box">
@ -15,10 +14,10 @@
</div>
</div>
<?php if ($data['blogs']) { ?>
<?php if ($data['blogs']) : ?>
<div class="bg-violet box">
<h3 class="uppercase-box"><?= __('created.by'); ?></h3>
<?php foreach ($data['blogs'] as $blog) { ?>
<?php foreach ($data['blogs'] as $blog) : ?>
<div class="w-100 mb-w100 mb15 flex flex-row">
<a class="mr10" href="<?= getUrlByName($blog['facet_type'], ['slug' => $blog['facet_slug']]); ?>">
<?= Html::image($blog['facet_img'], $blog['facet_title'], 'img-lg', 'logo', 'max'); ?>
@ -32,19 +31,19 @@
<div class="flex mt5 text-sm">
<i class="bi-journal mr5"></i>
<?= $blog['facet_count']; ?>
<?php if ($blog['facet_focus_count'] > 0) { ?>
<?php if ($blog['facet_focus_count'] > 0) : ?>
<i class="bi-people ml15 mr5"></i>
<?= $blog['facet_focus_count']; ?>
<?php } ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php } ?>
<?php endforeach; ?>
</div>
<?php } ?>
<?php endif; ?>
<?php if ($profile['my_post'] != 0) { ?>
<?php if ($profile['my_post'] != 0) : ?>
<?php $post = $data['post']; ?>
<div class="bg-violet box">
<h3 class="uppercase-box"><?= __('selected.post'); ?></h3>
@ -52,109 +51,109 @@
<a href="<?= getUrlByName('post', ['id' => $post['post_id'], 'slug' => $post['post_slug']]); ?>">
<?= $post['post_title']; ?>
</a>
<?php if (UserData::checkActiveUser()) { ?>
<?php if ($profile['login'] == $user['login']) { ?>
<?php if (UserData::checkActiveUser()) : ?>
<?php if ($profile['login'] == $user['login']) : ?>
<a class="add-profile ml10" data-post="<?= $post['post_id']; ?>">
<i class="bi-trash red"></i>
</a>
<?php } ?>
<?php } ?>
<?php endif; ?>
<?php endif; ?>
<div class="text-sm lowercase">
<a class="gray" href="<?= getUrlByName('profile', ['login' => $profile['login']]); ?>">
<?= Html::image($profile['avatar'], $profile['login'], 'ava-sm', 'avatar', 'small'); ?>
<?= $profile['login']; ?>
</a>
<span class="gray-600 ml5"><?= $post['post_date'] ?></span>
<?php if ($post['post_answers_count'] != 0) { ?>
<?php if ($post['post_answers_count'] != 0) : ?>
<a class="gray-600 right" href="<?= getUrlByName('post', ['id' => $post['post_id'], 'slug' => $post['post_slug']]); ?>">
<i class="bi-chat-dots middle"></i>
<?= $post['post_answers_count']; ?>
</a>
<?php } ?>
<?php endif; ?>
</div>
</div>
</div>
<?php } ?>
<?php endif; ?>
<?php if ($data['topics']) { ?>
<?php if ($data['topics']) : ?>
<div class="bg-violet box">
<h3 class="uppercase-box"><?= __('is.reading'); ?></h3>
<?php foreach ($data['topics'] as $topic) { ?>
<?php foreach ($data['topics'] as $topic) : ?>
<div class="mt5 mb5">
<a class="flex relative items-center pt5 pb5 hidden gray" href="<?= getUrlByName('topic', ['slug' => $topic['facet_slug']]); ?>">
<?= Html::image($topic['facet_img'], $topic['facet_title'], 'img-base', 'logo', 'small'); ?>
<span class="bar-name text-sm"><?= $topic['facet_title']; ?></span>
</a>
</div>
<?php } ?>
<?php endforeach; ?>
</div>
<?php } ?>
<?php endif; ?>
<?php if (!empty($data['participation'][0]['facet_id'])) { ?>
<?php if (!empty($data['participation'][0]['facet_id'])) : ?>
<div class="bg-violet box">
<h3 class="uppercase-box"><?= __('understands'); ?></h3>
<?php foreach ($data['participation'] as $part) { ?>
<?php foreach ($data['participation'] as $part) : ?>
<a class="tags" href="<?= getUrlByName('topic', ['slug' => $part['facet_slug']]); ?>">
<?= $part['facet_title']; ?>
</a>
<?php } ?>
<?php endforeach; ?>
</div>
<?php } ?>
<?php endif; ?>
<div class="bg-violet box">
<h3 class="uppercase-box"><?= __('contacts'); ?></h3>
<?php foreach (Config::get('form/user-setting') as $block) { ?>
<?php if ($profile[$block['title']]) { ?>
<?php foreach (Config::get('form/user-setting') as $block) : ?>
<?php if ($profile[$block['title']]) : ?>
<div class="mt5">
<?= $block['lang']; ?>:
<?php if ($block['url']) { ?>
<a href="<?php if ($block['addition']) { ?><?= $block['addition']; ?><?php } ?><?= $profile[$block['url']]; ?>" rel="noopener nofollow ugc">
<?php if ($block['url']) : ?>
<a href="<?php if ($block['addition']) : ?><?= $block['addition']; ?><?php endif; ?><?= $profile[$block['url']]; ?>" rel="noopener nofollow ugc">
<span class="mr5 ml5"><?= $profile[$block['title']]; ?></span>
</a>
<?php } else { ?>
<?php else : ?>
<span class="mr5 ml5"><?= $profile[$block['title']]; ?></span>
<?php } ?>
<?php endif; ?>
</div>
<?php } else { ?>
<?php if ('location' == $block['title']) { ?>
<?php else : ?>
<?php if ('location' == $block['title']) : ?>
<div class="mb20">
<?= $block['lang']; ?>: ...
</div>
<?php } ?>
<?php } ?>
<?php } ?>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</div>
<div class="bg-violet box">
<h3 class="uppercase-box"><?= __('badges'); ?></h3>
<div class="m0 text-3xl">
<i title="<?= __('medal.registration'); ?>" class="bi-gift sky"></i>
<?php if ($profile['id'] < 50) { ?>
<?php if ($profile['id'] < 50) : ?>
<i title="<?= __('first.days'); ?>" class="bi-award green"></i>
<?php } ?>
<?php foreach ($data['badges'] as $badge) { ?>
<?php endif; ?>
<?php foreach ($data['badges'] as $badge) : ?>
<?= $badge['badge_icon']; ?>
<?php } ?>
<?php endforeach; ?>
</div>
</div>
<?php if (UserData::checkAdmin()) { ?>
<?php if (UserData::checkAdmin()) : ?>
<div class="boxe">
<h3 class="uppercase-box"><?= __('admin'); ?></h3>
<div class="mt5">
<?php if ($profile['trust_level'] != UserData::REGISTERED_ADMIN) { ?>
<?php if ($profile['ban_list'] == 1) { ?>
<?php if ($profile['trust_level'] != UserData::REGISTERED_ADMIN) : ?>
<?php if ($profile['ban_list'] == 1) : ?>
<span class="type-ban gray mb5 block" data-id="<?= $profile['id']; ?>" data-type="user">
<i class="bi-person-x-fill red middle mr5"></i>
<span class="red text-sm"><?= __('unban'); ?></span>
</span>
<?php } else { ?>
<?php else : ?>
<span class="type-ban text-sm gray mb5 block" data-id="<?= $profile['id']; ?>" data-type="user">
<i class="bi-person-x middle mr5"></i>
<?= __('ban.it'); ?>
</span>
<?php } ?>
<?php } ?>
<?php endif; ?>
<?php endif; ?>
<a class="gray mb5 block" href="<?= getUrlByName('admin.user.edit', ['id' => $profile['id']]); ?>">
<i class="bi-gear middle mr5"></i>
<span class="middle"><?= __('edit'); ?></span>
@ -163,15 +162,15 @@
<i class="bi-award middle mr5"></i>
<span class="middle"><?= __('reward.user'); ?></span>
</a>
<?php if ($profile['whisper']) { ?>
<?php if ($profile['whisper']) : ?>
<div class="tips text-sm pt15 pb10 gray-600">
<i class="bi-info-square green mr5"></i>
<?= $profile['whisper']; ?>
</div>
<?php } ?>
<?php endif; ?>
<hr>
<span class="gray">id<?= $profile['id']; ?> | Tl<?= $profile['trust_level']; ?> | <?= $profile['email']; ?></span>
</div>
</div>
<?php } ?>
<?php endif; ?>
</div>

View file

@ -26,18 +26,18 @@
<div class="file-upload mt20 mb10" id="file-drag">
<div class="flex">
<?php if ($data['user']['cover_art'] != 'cover_art.jpeg') { ?>
<?php if ($data['user']['cover_art'] != 'cover_art.jpeg') : ?>
<div class="relative mr15">
<img class="block br-gray max-w-100" src="<?= Html::coverUrl($data['user']['cover_art'], 'user'); ?>">
<a class="right text-sm" href="<?= getUrlByName('delete.cover', ['login' => $user['login']]); ?>">
<?= __('remove'); ?>
</a>
</div>
<?php } else { ?>
<?php else : ?>
<div class="block br-gray max-w-100 text-sm gray p20 mr15">
<?= __('no.cover'); ?>...
</div>
<?php } ?>
<?php endif; ?>
<div id="start">
<img id="file-image bi bi-cloud-download" src="/assets/images/1px.jpg" alt="" class="h94">

View file

@ -47,35 +47,35 @@
<?= __('template'); ?>
</label>
<select name="template">
<?php foreach (Config::get('general.templates') as $tpl) { ?>
<option <?php if ($data['user']['template'] == $tpl) { ?>selected<?php } ?> value="<?= $tpl; ?>">
<?php foreach (Config::get('general.templates') as $tpl) : ?>
<option <?php if ($data['user']['template'] == $tpl) : ?>selected<?php endif; ?> value="<?= $tpl; ?>">
<?= __($tpl); ?>
</option>
<?php } ?>
<?php endforeach; ?>
</select>
</fieldset>
<fieldset class="max-w300">
<label class="block mb5" for="post_content"><?= __('language'); ?></label>
<select name="lang">
<?php foreach (Config::get('general.languages') as $lang) { ?>
<option <?php if ($data['user']['lang'] == $lang) { ?>selected<?php } ?> value="<?= $lang; ?>">
<?php foreach (Config::get('general.languages') as $lang) : ?>
<option <?php if ($data['user']['lang'] == $lang) : ?>selected<?php endif; ?> value="<?= $lang; ?>">
<?= __($lang . '.language'); ?>
</option>
<?php } ?>
<?php endforeach; ?>
</select>
</fieldset>
<h3 class="mt15 mb15"><?= __('contacts'); ?></h3>
<?php foreach (Config::get('form/user-setting') as $block) { ?>
<?php foreach (Config::get('form/user-setting') as $block) : ?>
<fieldset class="max-w300">
<label for="post_title"><?= $block['lang']; ?></label>
<input maxlength="150" type="text" value="<?= $data['user'][$block['title']]; ?>" name="<?= $block['name']; ?>">
<?php if ($block['help']) { ?>
<?php if ($block['help']) : ?>
<div class="help"><?= $block['help']; ?></div>
<?php } ?>
<?php endif; ?>
</fieldset>
<?php } ?>
<?php endforeach; ?>
<fieldset>
<input type="hidden" name="nickname" id="nickname" value="">