ADD: Режим Q&A в посте (+ Open Graph, SEO)

This commit is contained in:
Evg 2021-05-05 00:07:59 +03:00
parent 2466f2869e
commit 783f1628b0
22 changed files with 602 additions and 286 deletions

View file

@ -128,10 +128,12 @@ class PostController extends \MainController
$post['post_content'] = $Parsedown->text($post['post_content']);
$post['post_date'] = Base::ru_date($post['post_date']);
$post['num_answers'] = Base::ru_num('answ', $post['post_answers_num']);
$post['num_comments'] = Base::ru_num('comm', $post['post_comments_num']);
$post['favorite_post'] = PostModel::getMyPostFavorite($post['post_id'], $uid['id']);
// Получим ответы
$post_answers = AnswerModel::getAnswersPost($post['post_id'], $uid['id']);
// post_type: 0 - дискуссия, 1 - Q&A
$post_answers = AnswerModel::getAnswersPost($post['post_id'], $uid['id'], $post['post_type']);
// Получим ЛО (временно)
// Возможно нам стоит просто поднять ответ на первое место?
@ -233,7 +235,8 @@ class PostController extends \MainController
$post_content_img = \Request::getPost('content_img');
$post_url = \Request::getPost('post_url');
$post_closed = \Request::getPostInt('closed');
$post_top = \Request::getPostInt('top');
$post_top = \Request::getPostInt('top');
$post_type = \Request::getPostInt('post_type');
// IP адрес и ID кто добавляет
$post_ip_int = \Request::getRemoteAddress();
@ -302,6 +305,7 @@ class PostController extends \MainController
'post_content_img' => $post_content_img,
'post_thumb_img' => $og_img,
'post_slug' => $post_slug,
'post_type' => $post_type,
'post_ip_int' => $post_ip_int,
'post_user_id' => $post_user_id,
'post_space_id' => $space_id,
@ -435,6 +439,7 @@ class PostController extends \MainController
$post_content = $_POST['post_content']; // не фильтруем
$post_content_preview = \Request::getPost('content_preview');
$post_content_img = \Request::getPost('content_img');
$post_type = \Request::getPostInt('post_type');
$post_closed = \Request::getPostInt('closed');
$post_top = \Request::getPostInt('top');
$post_space_id = \Request::getPostInt('space_id');
@ -484,6 +489,7 @@ class PostController extends \MainController
$data = [
'post_id' => $post_id,
'post_title' => $post_title,
'post_type' => $post_type,
'post_content' => $post_content,
'post_content_preview' => $post_content_preview,
'post_content_img' => $post_content_img,
@ -497,7 +503,7 @@ class PostController extends \MainController
// Перезапишем пост
PostModel::editPost($data);
redirect('/posts/' . $post['post_slug']);
redirect('/posts/' . $post['post_id'] . '/' . $post['post_slug']);
}
// Размещение своего поста у себя в профиле

View file

@ -63,11 +63,17 @@ class SpaceController extends \MainController
// Отписан участник от пространства или нет
$space_signed = SpaceModel::getMySpaceHide($space['space_id'], $uid['id']);
if($type == 'feed') {
$s_title = lang('space-feed-title');
} else {
$s_title = lang('space-top-title');
}
$data = [
'h1' => $space['space_name'],
'title' => $space['space_name'] . ' - посты по пространству | ' . $GLOBALS['conf']['sitename'],
'description'=> 'Страница постов по пространству ' . $space['space_name'] . ' на сайте ' . $GLOBALS['conf']['sitename'],
'title' => $space['space_name'] . ' | ' . $s_title . ' — ' . $GLOBALS['conf']['sitename'],
'description'=> $s_title . ' ' . $space['space_name'] . ' на сайте ' . $GLOBALS['conf']['sitename'],
];
return view(PR_VIEW_DIR . '/space/space-posts', ['data' => $data, 'uid' => $uid, 'posts' => $result, 'space_info' => $space, 'tags' => $tags, 'space_signed' => $space_signed, 'type' => $type]);

View file

@ -193,9 +193,9 @@ class UserController extends \MainController
$image->saveTo($path_img_small, $uid['id']);
$avatar = UserModel::getAvatar($uid['login']);
// Удалим старую аватарку, кроме дефолтной
if($avatar['avatar'] != 'noavatar.png') {
if($avatar['avatar'] != 'noavatar.png' && $avatar['avatar'] != 'img_' . $uid['id'] .'.'. $ext) {
chmod($path_img . $avatar['avatar'], 0777);
chmod($path_img_small . $avatar['avatar'], 0777);
unlink($path_img . $avatar['avatar']);

View file

@ -12,7 +12,9 @@ return [
'answers-desc' => 'All responses (to posts) in order of priority in the community',
'post-closed' => 'The post is closed',
'no-auth-comm' => 'You must be logged in to leave a comment',
'no-auth-answ' => 'You must be logged in to leave an answer to the question',
'write-something' => 'Write something',
'write-response' => 'Write the answer to the question',
'post-delete' => 'Post deleted',
'post-closed' => 'The post is closed',
'in-the-profile' => 'go to profile',
@ -52,6 +54,8 @@ return [
'desc-user-all' => 'List of all participants sorted by date of registration on the site',
'desc-profile' => 'Participant*s profile page (posts, comments)',
'top-desc' => 'List of popular posts in the community (by number of responses)',
'space-feed-title' => 'Feed of posts by space',
'space-top-title' => 'Popular posts by Space',
/* For notification and chat */
'add_comment' => 'added a comment',

View file

@ -95,7 +95,9 @@ return [
'site-banner-txt' => 'Loriup находится в стадии разработки',
'post-closed' => 'Пост закрыт',
'no-auth-comm' => 'Вы должны войти в систему, чтобы оставить комментарий',
'no-auth-answ' => 'Вы должны войти в систему, чтобы ответить на вопрос',
'write-something' => 'Напишите, что нибудь',
'write-response' => 'Напишите ответ на вопрос',
'post-delete' => 'Пост удален',
'in-the-profile' => 'в профиль',
'add-favorites' => 'В избранное',
@ -179,5 +181,7 @@ return [
'desc-profile' => 'Страница профиля учасника (посты, комментарии)',
'home-desc' => 'Главная страница сообщества, форум, посты',
'top-desc' => 'Список популярных постов в сообществе (по количеству ответов)',
'space-feed-title' => 'Лента постов по пространству',
'space-top-title' => 'Популярные посты по пространству',
];

View file

@ -37,19 +37,23 @@ class AnswerModel extends \MainModel
->and(['answer_lo'], '>', 0)->getSelectOne();
}
// Получаем комментарии в посте
public static function getAnswersPost($post_id, $uid)
// Получаем ответы в посте
public static function getAnswersPost($post_id, $uid, $type)
{
$q = XD::select('*')->from(['answers']);
$query = $q->leftJoin(['users'])->on(['id'], '=', ['answer_user_id'])
->leftJoin(['votes_answ'])->on(['votes_answ_item_id'], '=', ['answer_id'])
->and(['votes_answ_user_id'], '=', $uid)
->where(['answer_post_id'], '=', $post_id);
return $query->getSelect();
->and(['votes_answ_user_id'], '=', $uid)->where(['answer_post_id'], '=', $post_id);
// 0 - дискуссия, 1 - Q&A
if($type == 0) {
return $query->getSelect();
} else {
return $query->orderBy(['answer_votes'])->desc()->getSelect();
}
}
// Страница комментариев участника
// Страница ответов участника
public static function getUsersAnswers($slug)
{
$q = XD::select('*')->from(['answers']);

View file

@ -48,7 +48,9 @@ class PostModel extends \MainModel
$sort = 'ORDER BY p.post_answers_num DESC';
}
$sql = "SELECT p.post_id, p.post_title, p.post_slug, p.post_user_id, p.post_space_id, p.post_answers_num, p.post_date, p.post_votes, p.post_is_delete, p.post_closed, p.post_lo, p.post_top, p.post_url, p.post_content_preview, p.post_content_img,
$sql = "SELECT p.post_id, p.post_title, p.post_slug, p.post_type, p.post_user_id, p.post_space_id, p.post_answers_num,
p.post_comments_num, p.post_date, p.post_votes, p.post_is_delete, p.post_closed, p.post_lo, p.post_top, p.post_url,
p.post_content_preview, p.post_content_img,
u.id, u.login, u.avatar,
v.votes_post_item_id, v.votes_post_user_id,
s.space_id, s.space_slug, s.space_name, space_color
@ -187,6 +189,7 @@ class PostModel extends \MainModel
['post_content_img'], ',',
['post_thumb_img'], ',',
['post_slug'], ',',
['post_type'], ',',
['post_ip_int'], ',',
['post_user_id'], ',',
['post_space_id'], ',',
@ -202,7 +205,8 @@ class PostModel extends \MainModel
$data['post_content_preview'],
$data['post_content_img'],
$data['post_thumb_img'],
$data['post_slug'],
$data['post_slug'],
$data['post_type'],
$data['post_ip_int'],
$data['post_user_id'],
$data['post_space_id'],
@ -222,6 +226,7 @@ class PostModel extends \MainModel
XD::update(['posts'])->set(
['post_title'], '=', $data['post_title'], ',',
['post_type'], '=', $data['post_type'], ',',
['edit_date'], '=', $edit_date, ',',
['post_content'], '=', $data['post_content'], ',',
['post_content_preview'], '=', $data['post_content_preview'], ',',

View file

@ -194,6 +194,7 @@ CREATE TABLE `posts` (
`post_id` int(10) UNSIGNED NOT NULL,
`post_title` varchar(250) NOT NULL,
`post_slug` varchar(128) NOT NULL,
`post_type` smallint(1) NOT NULL DEFAULT 0,
`post_space_id` int(11) NOT NULL DEFAULT 0,
`post_tag_id` int(11) NOT NULL DEFAULT 0,
`post_date` timestamp NOT NULL DEFAULT current_timestamp(),
@ -221,10 +222,10 @@ CREATE TABLE `posts` (
-- Дамп данных таблицы `posts`
--
INSERT INTO `posts` (`post_id`, `post_title`, `post_slug`, `post_space_id`, `post_tag_id`, `post_date`, `edit_date`, `post_user_id`, `post_visible`, `post_ip_int`, `post_votes`, `post_karma`, `post_answers_num`, `post_comments_num`, `post_content`, `post_content_preview`, `post_content_img`, `post_thumb_img`, `post_closed`, `post_lo`, `post_top`, `post_url`, `post_url_domain`, `post_is_delete`) VALUES
(1, 'Муха села на варенье, Вот и всё стихотворенье...', 'muha-stih', 1, 0, '2021-02-28 12:08:09', '2021-03-05 10:05:25', 1, 'all', NULL, 0, 0, 0, 0, '> \"Нет не всё!\" - сказала Муха,\r\n\r\n> Почесала себе брюхо,\r\n\r\n> Свесив с блюдца две ноги,\r\n\r\n> Мне сказала:\"Погоди!\r\n\r\n> Прежде чем сесть на варенье,\r\n\r\n> Я прочла стихотворенье,\r\n\r\n> Неизвестного поэта,\r\n\r\n> Написавшего про это.\r\n\r\n\r\n## Заголовок\r\n\r\nЧто-то в модели много кода:\r\n\r\n```\r\n$db = \\Config\\Database::connect();\r\n$builder = $db->table(\'Posts AS a\');\r\n$builder->select(\'a.*, b.id, b.nickname, b.avatar\');\r\n$builder->join(\"users AS b\", \"b.id = a.post_user_id\");\r\n$builder->where(\'a.post_slug\', $slug);\r\n$builder->orderBy(\'a.post_id\', \'DESC\');\r\n```\r\n\r\nВот. Это первый пост.', NULL, NULL, NULL, 0, 0, 0, NULL, NULL, 0),
(2, 'Второй пост...', 'vtoroi-post', 2, 0, '2021-02-28 12:15:58', '2021-03-05 10:05:25', 2, 'all', NULL, 0, 0, 0, 0, 'Не будет тут про муху. Просто второй пост.\r\n\r\n> в лесу родилась ёлка, зеленая была...', NULL, NULL, NULL, 0, 0, 0, NULL, NULL, 0),
(3, 'Просто первый пост', 'prosto-pervyj-post', 2, 0, '2021-04-30 04:35:13', '2021-04-30 04:35:13', 1, 'all', '127.0.0.1', 0, 0, 1, 0, 'Просто первый пост', '', '', '', 0, 0, 0, '', '', 0);
INSERT INTO `posts` (`post_id`, `post_title`, `post_slug`, `post_type`, `post_space_id`, `post_tag_id`, `post_date`, `edit_date`, `post_user_id`, `post_visible`, `post_ip_int`, `post_votes`, `post_karma`, `post_answers_num`, `post_comments_num`, `post_content`, `post_content_preview`, `post_content_img`, `post_thumb_img`, `post_closed`, `post_lo`, `post_top`, `post_url`, `post_url_domain`, `post_is_delete`) VALUES
(1, 'Муха села на варенье, Вот и всё стихотворенье...', 'muha-stih', 0, 1, 0, '2021-02-28 12:08:09', '2021-03-05 10:05:25', 1, 'all', NULL, 0, 0, 0, 0, '> \"Нет не всё!\" - сказала Муха,\r\n\r\n> Почесала себе брюхо,\r\n\r\n> Свесив с блюдца две ноги,\r\n\r\n> Мне сказала:\"Погоди!\r\n\r\n> Прежде чем сесть на варенье,\r\n\r\n> Я прочла стихотворенье,\r\n\r\n> Неизвестного поэта,\r\n\r\n> Написавшего про это.\r\n\r\n\r\n## Заголовок\r\n\r\nЧто-то в модели много кода:\r\n\r\n```\r\n$db = \\Config\\Database::connect();\r\n$builder = $db->table(\'Posts AS a\');\r\n$builder->select(\'a.*, b.id, b.nickname, b.avatar\');\r\n$builder->join(\"users AS b\", \"b.id = a.post_user_id\");\r\n$builder->where(\'a.post_slug\', $slug);\r\n$builder->orderBy(\'a.post_id\', \'DESC\');\r\n```\r\n\r\nВот. Это первый пост.', NULL, NULL, NULL, 0, 0, 0, NULL, NULL, 0),
(2, 'Второй пост...', 'vtoroi-post', 0, 2, 0, '2021-02-28 12:15:58', '2021-03-05 10:05:25', 2, 'all', NULL, 0, 0, 0, 0, 'Не будет тут про муху. Просто второй пост.\r\n\r\n> в лесу родилась ёлка, зеленая была...', NULL, NULL, NULL, 0, 0, 0, NULL, NULL, 0),
(3, 'Просто первый пост', 'prosto-pervyj-post', 0, 2, 0, '2021-04-30 04:35:13', '2021-04-30 04:35:13', 1, 'all', '127.0.0.1', 0, 0, 1, 0, 'Просто первый пост', '', '', '', 0, 0, 0, '', '', 0);
-- --------------------------------------------------------

View file

@ -114,7 +114,6 @@ h1 {margin: 0;color:#f56400;font-size: 3em;font-family: Georgia,Arial,sans-serif
h3 {margin: 0;color: #666;font-weight: 300;font-size: 1.3em;}
hr.user {display: block;height: 1px;margin: 1em 0;width: 200px;border: 0;border-top-width: 0px;border-top-style:none;
border-top-color: currentcolor;border-top: 2px solid #999;padding: 0;}
.user-img{background: url(/static/img/dev.jpg);height: 119px;width:70%;}
.prof-glog-blog {max-width: 500px;}
.bord {border-bottom: 2px solid #f56400;max-width: 800px;padding-top:10px;}
.bord-2 {border-bottom: 1px solid #ddd;max-width: 600px;padding-top: 10px;}

View file

@ -124,9 +124,7 @@ h1 {
background-color: #fcf8e4;
}
h1.banner-h1 {
color: var(--color-gray-1);
margin: 0;
background-color: #fcf8e4;
display: table;
}
pre code {
@ -171,7 +169,7 @@ ul.breadcrumb {
.comm-telo-body a {
text-decoration: underline;
}
.comments h2 {
.answers h2 {
margin: 20px 0 0 4px;
font-weight: 300;
}
@ -756,12 +754,13 @@ a.space-u.tag-u {
font-size: 13px;
padding: 5px;
}
.space-text h2 {
.space-text h1 {
padding: 0;
margin: 0;
font-size: 21px;
font-weight: 300;
font-weight: 400;
margin-top: -4px;
color: #333;
}
.space-box-img, .space-img {
float: left;
@ -836,6 +835,13 @@ h1 span{
}
/* Ответы */
.line {
border-top: 2px dotted #ddd;
}
.line-qa {
border-top: 1px solid #eee;
margin-left: 30px;
}
ol.answer-telo {
padding: 0;
}
@ -882,9 +888,6 @@ ol.answer-telo {
.reply.active {
display: block;
}
.block-comments.line{
border-top: 2px dotted #ddd;
}
.authorpost {
color: #f8a853;
}
@ -929,6 +932,9 @@ ol.comment-telo {
.comm-telo-body {
margin: 5px 0;
}
.qa-comm .comm-telo-body {
margin: 2px 0 2px 0;
}
.comm-header a, .comm-header {
font-size: 9.5pt;
color: #888;
@ -978,10 +984,52 @@ ol.comment-telo {
bottom: 0;
}
/* Q&A */
.answers .comm-telo.qa-comm {
margin-top: 1px;
margin-bottom: 1px;
}
.qa-user, .qa-comm-info {
font-size: 9.5pt;
color: #888;
}
.qa-footer {
float: right;
margin-top: -20px;
min-width: 190px;
}
.qa-ava img {
width: 31px;
height: 31px;
float: right;
margin: 4px 0 0 10px;
}
.qa-login {
display: block;
color: #333;
}
.qa-ava-info, .qa-date {
text-align: right;
}
.qa-date, .qa-ava-info {
display: block;
font-size: 13px;
color: #888;
}
.qa-inline {
display: inline-block;
}
.answers .qa-comm .cm_add_link {
margin-left: 15px;
}
/* ЛС */
.red, .lo {
color: #e7672e;
}
.qa {
color: #339900;
}
.msg-telo {
margin-bottom: 15px;
}
@ -1182,7 +1230,7 @@ body.menuno nav {
main {width: calc(100% - 180px);}
}
@media (max-width: 880px) {
nav {display: none;}
nav, .no-mob {display: none;}
main, main.w-75, main.w-100 {width: 100%;}
.column {width: 19%;}
}
@ -1198,12 +1246,15 @@ body.menuno nav {
background: #222;
color: #fff;
}
.dark .titl {
.dark .titl, .dark .nav-tabs > li.active span, .dark .nav-tabs > li > a:hover {
color: #fff;
}
.dark a, .dark .footer .date, .dark footer, .dark footer a, .na, .dark a.menu.active,
.dark .nav-tabs > li.active span {
border-bottom: 2px solid #eee;
}
.dark a, .dark .footer .date, .dark footer, .dark footer a, .dark .na, .dark a.menu.active,
.dark .info-n.active, .dark .favcomm {
color: #999;
color: #ddd;
}
.dark a:hover {
color: #eee;
@ -1211,8 +1262,9 @@ body.menuno nav {
.dark blockquote, .dark .menu-info {
background-color: #555;
}
.dark .banner {
color: #333;
.dark .banner, .dark .space-no-user {
color: #eee;
background-color: #222;
}
.dark .banner a {
color: #09c;
@ -1274,4 +1326,5 @@ a:hover .icon:before {
.icon.home:before { content: "\e069"; }
.icon.fire:before { content: "\e01c"; }
.icon.diamond:before { content: "\e043"; }
.icon.doc:before { content: "\e085"; }
.icon.doc:before { content: "\e085"; }
.icon.question:before { content: "\e05d"; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
public/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 983 B

View file

@ -8,13 +8,30 @@
<?php if (isset($data['post']['post_is_delete'])) { ?>
<meta name="robots" content="noindex" />
<?php } ?>
<title><?= $data['title']; ?></title>
<meta name = "description" content = "<?= $data['description']; ?>" />
<link rel="stylesheet" href="/assets/css/style.css">
<meta property="og:title" content="<?= $data['title']; ?>">
<meta property="og:description" content="<?= $data['description']; ?>">
<meta property="og:site_name" content="<?= $GLOBALS['conf']['hometitle']; ?>">
<?php if (isset($data['post']['post_id'])) { ?>
<meta property="og:type" content="article">
<meta property="og:url" content="<?= $GLOBALS['conf']['url']; ?>/posts/<?=$data['post']['post_id']; ?>/<?=$data['post']['post_slug']; ?>">
<meta property="article:published_time" content="<?=$data['post']['post_date']; ?>">
<meta property="article:modified_time" content="<?=$data['post']['post_edit']; ?>">
<link rel="canonical" href="<?= $GLOBALS['conf']['url']; ?>/posts/<?=$data['post']['post_id']; ?>/<?=$data['post']['post_slug']; ?>">
<?php } else { ?>
<meta property="og:type" content="website">
<meta property="og:image" content="<?= $GLOBALS['conf']['url']; ?>/assets/images/areadev.jpg">
<meta property="og:image:type" content="image/jpeg">
<?php } ?>
<link rel="icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/favicon.png">
<link rel="stylesheet" href="/assets/css/style.css">
<?php if($uid['uri'] == '/flow') { ?>
<script src="/assets/js/flow.js"></script>
<link rel="stylesheet" href="/assets/css/flow.css">
@ -30,8 +47,8 @@
<a title="<?= lang('Home'); ?>" class="logo" href="/">LoriUP</a>
<?php } else { ?>
<a title="<?= lang('Home'); ?>" class="logo" href="/"><i class="icon home"></i></a>
<span class="slash">\</span>
<a title="<?= lang('LoriUP'); ?>" class="home" href="/"><?= lang('LoriUP'); ?></a>
<span class="slash no-mob">\</span>
<a title="<?= lang('LoriUP'); ?>" class="home no-mob" href="/"><?= lang('LoriUP'); ?></a>
<?php } ?>
</li>

View file

@ -3,9 +3,9 @@
<?php if (!$uid['id']) { ?>
<div class="banner">
<div class="banner-telo">
<img src="/assets/svg/loriup.svg" alt="За стеклом">
<img width="28" height="28" src="/assets/svg/loriup.svg" alt="За стеклом">
<h1 class="banner-h1"><?= lang('site-banner'); ?></h1>
<?= lang('site-banner-txt'); ?> <a href="/info"><?= lang('Read'); ?></a>...
<?= lang('site-banner-txt'); ?>. <a href="/info"><?= lang('Read'); ?></a>...
</div>
</div>
<?php } ?>
@ -74,6 +74,9 @@
<?php if($post['post_lo'] > 0) { ?>
<i class="icon trophy lo"></i>
<?php } ?>
<?php if($post['post_type'] == 1) { ?>
<i class="icon question qa"></i>
<?php } ?>
</a>
<div class="space-color space_<?= $post['space_color'] ?>"></div>
<a class="space-u" href="/s/<?= $post['space_slug']; ?>" title="<?= $post['space_name']; ?>">
@ -109,7 +112,11 @@
<?php if($post['post_answers_num'] !=0) { ?>
<span class="otst"> | </span>
<a class="u-url" href="/posts/<?= $post['post_id']; ?>/<?= $post['post_slug']; ?>">
<?= $post['post_answers_num']; ?> <?= $post['lang_num_answers']; ?>
<?php if($post['post_type'] ==0) { ?>
<?= $post['post_answers_num'] + $post['post_comments_num']; ?> коммент...
<?php } else { ?>
<?= $post['post_answers_num']; ?> <?= $post['lang_num_answers']; ?>
<?php } ?>
</a>
<?php } ?>
</div>
@ -149,7 +156,7 @@
<img class="ava" alt="<?= $answ['login']; ?>" src="/uploads/avatar/small/<?= $answ['avatar']; ?>">
<?= $answ['answer_date']; ?>
</div>
<a href="/posts/<?= $post['post_id']; ?>/<?= $answ['post_slug']; ?>#answ_<?= $answ['answer_id']; ?>">
<a href="/posts/<?= $answ['post_id']; ?>/<?= $answ['post_slug']; ?>#answ_<?= $answ['answer_id']; ?>">
<?= $answ['answer_content']; ?>...
</a>
</div>

View file

@ -29,6 +29,11 @@
<?php include TEMPLATE_DIR . '/post/md-forma.php'; ?>
</div>
<?php if($uid['trust_level'] > 0) { ?>
<div class="boxline">
<label for="post_content">Формат</label>
<input type="radio" name="post_type" checked value="0"> Обсуждение
<input type="radio" name="post_type" value="1" > Q&A
</div>
<div class="boxline">
<label for="post_content">Закрыть</label>
<input type="radio" name="closed" value="0"> <?= lang('No'); ?>

View file

@ -0,0 +1,211 @@
<?php if (!empty($answers)) { ?>
<div class="answers">
<h2> <?= $post['post_answers_num'] + $post['post_comments_num'] ?> <?= $post['num_comments'] ?></h2>
<?php foreach ($answers as $answ) { ?>
<div class="block-answer">
<?php if($answ['answer_del'] == 0) { ?>
<div class="line"></div>
<ol class="answer-telo">
<li class="answers_subtree" id="answ_<?= $answ['answer_id']; ?>">
<?php if (!$uid['id']) { ?>
<div class="voters">
<a rel="nofollow" href="/login"><div class="answ-up-id"></div></a>
<div class="score"><?= $answ['answer_votes']; ?></div>
</div>
<?php } else { ?>
<?php if ($answ['votes_answ_user_id'] == $uid['id'] || $uid['id'] == $answ['answer_user_id']) { ?>
<div class="voters active">
<div class="answ-up-id"></div>
<div class="score"><?= $answ['answer_votes']; ?></div>
</div>
<?php } else { ?>
<div id="up<?= $answ['answer_id']; ?>" class="voters">
<div data-id="<?= $answ['answer_id']; ?>" class="answ-up-id"></div>
<div class="score"><?= $answ['answer_votes']; ?></div>
</div>
<?php } ?>
<?php } ?>
<div class="answ-telo">
<div class="answ-header">
<img alt="<?= $answ['login']; ?>" class="ava" src="/uploads/avatar/small/<?= $answ['avatar'] ?>">
<span class="user">
<a href="/u/<?= $answ['login']; ?>"><?= $answ['login']; ?></a>
</span>
<span class="date">
<?= $answ['answer_date']; ?>
</span>
<?php if (empty($answ['edit'])) { ?>
<span class="date">
(<?= lang('ed'); ?>.)
</span>
<?php } ?>
<?php if ($post['post_user_id'] == $answ['answer_user_id']) { ?>
<span class="date ots">
<span class="authorpost">&#x21af;</span>
</span>
<?php } ?>
<span class="date ots">
<a rel="nofollow" href="/posts/<?= $post['post_id']; ?>/<?= $post['post_slug']; ?>#answ_<?= $answ['answer_id']; ?>">#</a>
</span>
<?php if ($uid['trust_level'] == 5) { ?>
<span class="date ots">
<?= $answ['answer_ip']; ?>
</span>
<?php } ?>
</div>
<div class="answ-telo-body">
<?= $answ['answer_content'] ?>
</div>
</div>
<?php if($post['post_closed'] == 0) { ?>
<?php if($post['post_is_delete'] == 0 || $uid['trust_level'] == 5) { ?>
<span id="cm_add_link<?= $answ['answer_id']; ?>" class="cm_add_link">
<a data-post_id="<?= $post['post_id']; ?>" data-answ_id="<?= $answ['answer_id']; ?>" class="addcomm"><?= lang('Reply'); ?></a>
</span>
<?php } ?>
<?php } ?>
<?php if($uid['id'] == $answ['answer_user_id'] || $uid['trust_level'] == 5) { ?>
<span id="answ_edit" class="answ_add_link">
<a data-answ_id="<?= $answ['answer_id']; ?>" class="editansw"><?= lang('Edit'); ?></a>
</span>
<?php } ?>
<?php if ($uid['id']) { ?>
<?php if ($answ['favorite_answ']){ ?>
<span class="user-answ-fav" data-answ="<?= $answ['answer_id']; ?>">
<span class="favcomm"><?= lang('remove-favorites'); ?></span>
</span>
<?php } else { ?>
<span class="user-answ-fav" data-answ="<?= $answ['answer_id']; ?>">
<span class="favcomm"><?= lang('add-favorites'); ?></span>
</span>
<?php } ?>
<?php } ?>
<?php if($uid['trust_level'] == 5) { ?>
<span id="answ_dell" class="answ_add_link">
<a data-id="<?= $answ['answer_id']; ?>" class="delansw"><?= lang('Remove'); ?></a>
</span>
<?php } ?>
<div id="answ_addentry<?= $answ['answer_id']; ?>" class="reply"></div>
</li>
</ol>
<?php } else { ?>
<ol class="dell answer-telo">
<li class="answers_subtree" id="answ_<?= $answ['answer_id']; ?>">
<span class="answ-deletes">~ <?= lang('answer-deleted'); ?></span>
</li>
</ol>
<?php } ?>
</div>
<?php foreach ($answ['comm'] as $comm) { ?>
<?php if($comm['comment_del'] == 0) { ?>
<ol class="comm-telo<?php if($comm['comment_comm_id'] > 0) { ?> step<?php } ?>">
<li class="comm_subtree" id="comm_<?= $comm['comment_id']; ?>">
<?php if (!$uid['id']) { ?>
<div class="voters">
<a rel="nofollow" href="/login"><div class="comm-up-id"></div></a>
<div class="score"><?= $comm['comment_votes']; ?></div>
</div>
<?php } else { ?>
<?php if ($comm['votes_comm_user_id'] == $uid['id'] || $uid['id'] == $comm['comment_user_id']) { ?>
<div class="voters active">
<div class="comm-up-id"></div>
<div class="score"><?= $comm['comment_votes']; ?></div>
</div>
<?php } else { ?>
<div id="up<?= $comm['comment_id']; ?>" class="voters">
<div data-id="<?= $comm['comment_id']; ?>" class="comm-up-id"></div>
<div class="score"><?= $comm['comment_votes']; ?></div>
</div>
<?php } ?>
<?php } ?>
<div class="comm-telo">
<div class="comm-header">
<img alt="<?= $comm['login']; ?>" class="ava" src="/uploads/avatar/small/<?= $comm['avatar'] ?>">
<span class="user">
<a href="/u/<?= $comm['login']; ?>"><?= $comm['login']; ?></a>
</span>
<span class="date">
<?= $comm['comment_date']; ?>
</span>
<?php if ($post['post_user_id'] == $comm['comment_user_id']) { ?>
<span class="date ots">
<span class="authorpost">&#x21af;</span>
</span>
<?php } ?>
<?php if($comm['comment_comm_id'] > 0) { ?>
<span class="date ots">
<a rel="nofollow" href="/posts/<?= $post['post_id']; ?>/<?= $post['post_slug']; ?>#comm_<?= $comm['comment_comm_id']; ?>">&uarr;</a>
</span>
<?php } else { ?>
<span class="date ots">
<a rel="nofollow" href="/posts/<?= $post['post_id']; ?>/<?= $post['post_slug']; ?>#answ_<?= $comm['comment_answ_id']; ?>">&uarr;</a>
</span>
<?php } ?>
<span class="date ots">
<a rel="nofollow" href="/posts/<?= $post['post_id']; ?>/<?= $post['post_slug']; ?>#comm_<?= $comm['comment_id']; ?>">#</a>
</span>
<?php if ($uid['trust_level'] == 5) { ?>
<span class="date ots">
<?= $comm['comment_ip']; ?>
</span>
<?php } ?>
</div>
<div class="comm-telo-body">
<?= $comm['comment_content'] ?>
</div>
</div>
<?php if($post['post_closed'] == 0) { ?>
<?php if($post['post_is_delete'] == 0 || $uid['trust_level'] == 5) { ?>
<span id="cm_add_link<?= $comm['comment_id']; ?>" class="cm_add_link">
<a data-post_id="<?= $post['post_id']; ?>" data-answ_id="<?= $answ['answer_id']; ?>" data-comm_id="<?= $comm['comment_id']; ?>" class="addcomm_re"><?= lang('Reply'); ?></a>
</span>
<?php } ?>
<?php } ?>
<?php if($uid['id'] == $comm['comment_user_id'] || $uid['trust_level'] == 5) { ?>
<span id="comm_edit" class="cm_add_link">
<a data-comm_id="<?= $comm['comment_id']; ?>" class="editcomm"><?= lang('Edit'); ?></a>
</span>
<?php } ?>
<?php if($uid['trust_level'] == 5) { ?>
<span id="comm_dell" class="cm_add_link">
<a data-comm_id="<?= $comm['comment_id']; ?>" class="delcomm"><?= lang('Remove'); ?></a>
</span>
<?php } ?>
<div id="comm_addentry<?= $comm['comment_id']; ?>" class="reply"></div>
</li>
</ol>
<?php } else { ?>
<ol class="dell comment-telo<?php if ($comm['level'] == 0) { ?> one<?php } ?><?php if ($comm['level'] == 2) { ?> two<?php } ?><?php if ($comm['level'] > 2) { ?> three<?php } ?>">
<li class="comments_subtree" id="comm_<?= $comm['comment_id']; ?>">
<span class="comm-deletes">~ <?= lang('comment-deleted'); ?></span>
</li>
</ol>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
<?php } else { ?>
<?php if($post['post_closed'] != 1) { ?>
<div class="no-answer"><?= lang('no-answer'); ?>...</div>
<?php } ?>
<?php } ?>

View file

@ -31,6 +31,11 @@
</div>
<?php if($uid['trust_level'] > 0) { ?>
<div class="boxline">
<label for="post_content">Формат</label>
<input type="radio" name="post_type" <?php if($post['post_type'] == 0) { ?>checked<?php } ?> value="0"> Обсуждение
<input type="radio" name="post_type" <?php if($post['post_type'] == 1) { ?>checked<?php } ?> value="1" > Q&A
</div>
<div class="boxline">
<label for="post_content">Закрыть</label>
<input type="radio" name="closed" <?php if($post['post_closed'] == 0) { ?>checked<?php } ?> value="0"> <?= lang('No'); ?>

View file

@ -0,0 +1,182 @@
<?php if (!empty($answers)) { ?>
<div class="answers">
<h2> <?= $post['post_answers_num'] ?> <?= $post['num_answers'] ?></h2>
<?php foreach ($answers as $answ) { ?>
<div class="block-answer">
<?php if($answ['answer_del'] == 0) { ?>
<?php if($uid['id'] == $answ['answer_user_id']) { ?> <?php $otvet = 1; ?> <?php } ?>
<div class="line"></div>
<ol class="answer-telo">
<li class="answers_subtree" id="answ_<?= $answ['answer_id']; ?>">
<?php if (!$uid['id']) { ?>
<div class="voters">
<a rel="nofollow" href="/login"><div class="answ-up-id"></div></a>
<div class="score"><?= $answ['answer_votes']; ?></div>
</div>
<?php } else { ?>
<?php if ($answ['votes_answ_user_id'] == $uid['id'] || $uid['id'] == $answ['answer_user_id']) { ?>
<div class="voters active">
<div class="answ-up-id"></div>
<div class="score"><?= $answ['answer_votes']; ?></div>
</div>
<?php } else { ?>
<div id="up<?= $answ['answer_id']; ?>" class="voters">
<div data-id="<?= $answ['answer_id']; ?>" class="answ-up-id"></div>
<div class="score"><?= $answ['answer_votes']; ?></div>
</div>
<?php } ?>
<?php } ?>
<div class="answ-telo qa-answ">
<?= $answ['answer_content'] ?>
</div>
<div class="qa-inline">
<?php if($post['post_closed'] == 0) { ?>
<?php if($post['post_is_delete'] == 0 || $uid['trust_level'] == 5) { ?>
<span id="cm_add_link<?= $answ['answer_id']; ?>" class="cm_add_link">
<a data-post_id="<?= $post['post_id']; ?>" data-answ_id="<?= $answ['answer_id']; ?>" class="addcomm"><?= lang('Reply'); ?></a>
</span>
<?php } ?>
<?php } ?>
<?php if($uid['id'] == $answ['answer_user_id'] || $uid['trust_level'] == 5) { ?>
<span id="answ_edit" class="answ_add_link">
<a data-answ_id="<?= $answ['answer_id']; ?>" class="editansw"><?= lang('Edit'); ?></a>
</span>
<?php } ?>
<?php if ($uid['id']) { ?>
<?php if ($answ['favorite_answ']){ ?>
<span class="user-answ-fav" data-answ="<?= $answ['answer_id']; ?>">
<span class="favcomm"><?= lang('remove-favorites'); ?></span>
</span>
<?php } else { ?>
<span class="user-answ-fav" data-answ="<?= $answ['answer_id']; ?>">
<span class="favcomm"><?= lang('add-favorites'); ?></span>
</span>
<?php } ?>
<?php } ?>
<?php if($uid['trust_level'] == 5) { ?>
<span id="answ_dell" class="answ_add_link">
<a data-id="<?= $answ['answer_id']; ?>" class="delansw"><?= lang('Remove'); ?></a>
</span>
<?php } ?>
</div>
<div class="qa-footer">
<?php if ($uid['trust_level'] == 5) { ?>
<div class="qa-date">
<?= $answ['answer_ip']; ?>
</div>
<?php } ?>
<div class="qa-ava">
<img alt="<?= $answ['login']; ?>" src="/uploads/avatar/<?= $answ['avatar'] ?>">
</div>
<div class="qa-ava-info">
<a class="qa-login" href="/u/<?= $answ['login']; ?>"><?= $answ['login']; ?></a>
<?= $answ['answer_date']; ?>
<?php if (empty($answ['edit'])) { ?>
(<?= lang('ed'); ?>.)
<?php } ?>
</div>
</div>
<div id="answ_addentry<?= $answ['answer_id']; ?>" class="reply"></div>
</li>
</ol>
<?php } else { ?>
<ol class="dell answer-telo">
<li class="answers_subtree" id="answ_<?= $answ['answer_id']; ?>">
<span class="answ-deletes">~ <?= lang('answer-deleted'); ?></span>
</li>
</ol>
<?php } ?>
</div>
<?php foreach ($answ['comm'] as $comm) { ?>
<?php if($comm['comment_del'] == 0) { ?>
<ol class="comm-telo qa-comm">
<li class="comm_subtree" id="comm_<?= $comm['comment_id']; ?>">
<div class="line-qa"></div>
<div class="comm-telo">
<div class="comm-telo-body">
<?= $comm['comment_content'] ?>
<span class="qa-comm-info">
<a class="qa-user" href="/u/<?= $comm['login']; ?>"><?= $comm['login']; ?></a>
&nbsp; <?= $comm['comment_date']; ?>
<?php if ($uid['trust_level'] == 5) { ?>
&nbsp; <?= $comm['comment_ip']; ?>
<?php } ?>
</span>
<?php if($post['post_closed'] == 0) { ?>
<?php if($post['post_is_delete'] == 0 || $uid['trust_level'] == 5) { ?>
<span id="cm_add_link<?= $comm['comment_id']; ?>" class="cm_add_link">
<a data-post_id="<?= $post['post_id']; ?>" data-answ_id="<?= $answ['answer_id']; ?>" data-comm_id="<?= $comm['comment_id']; ?>" class="addcomm_re"><?= lang('Reply'); ?></a>
</span>
<?php } ?>
<?php } ?>
<?php if($uid['id'] == $comm['comment_user_id'] || $uid['trust_level'] == 5) { ?>
<span id="comm_edit" class="cm_add_link">
<a data-comm_id="<?= $comm['comment_id']; ?>" class="editcomm"><?= lang('Edit'); ?></a>
</span>
<?php } ?>
<?php if($uid['trust_level'] == 5) { ?>
<span id="comm_dell" class="cm_add_link">
<a data-comm_id="<?= $comm['comment_id']; ?>" class="delcomm"><?= lang('Remove'); ?></a>
</span>
<?php } ?>
</div>
</div>
<div id="comm_addentry<?= $comm['comment_id']; ?>" class="reply"></div>
</li>
</ol>
<?php } else { ?>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
<?php } else { ?>
<?php if($post['post_closed'] != 1) { ?>
<div class="no-answer"><?= lang('no-answer'); ?>...
<br> Напишите свой первый ответ.</div>
<?php } ?>
<?php } ?>
<?php if(!empty($otvet)) { ?>
<div class="no-answer">Вы уже ответили на этот вопрос...</div>
<?php } else { ?>
<?php if ($uid['id']) { ?>
<?php if($post['post_closed'] == 0) { ?>
<form id="add_answ" class="new_answer" action="/answer/add" accept-charset="UTF-8" method="post">
<?= csrf_field() ?>
<textarea rows="5" placeholder="<?= lang('write-response'); ?>..." name="answer" id="answer"></textarea>
<div>
<input type="hidden" name="post_id" id="post_id" value="<?= $post['post_id']; ?>">
<input type="hidden" name="answ_id" id="answ_id" value="0">
<input type="submit" name="answit" value="<?= lang('Reply'); ?>" class="answer-post">
</div>
</form>
<?php } ?>
<?php } else { ?>
<br />
<textarea rows="5" disabled="disabled" placeholder="<?= lang('no-auth-answ'); ?>" name="answer" id="answer"></textarea>
<div>
<input type="submit" name="answit" value="<?= lang('Reply'); ?>" class="answer-post" disabled="disabled">
</div>
<?php } ?>
<?php } ?>

View file

@ -132,24 +132,26 @@
</a>
</span>
<?php } ?>
<?php if ($uid['id']) { ?>
<?php if($post['post_closed'] == 0) { ?>
<form id="add_answ" class="new_answer" action="/answer/add" accept-charset="UTF-8" method="post">
<?= csrf_field() ?>
<textarea rows="5" placeholder="<?= lang('write-something'); ?>..." name="answer" id="answer"></textarea>
<div>
<input type="hidden" name="post_id" id="post_id" value="<?= $post['post_id']; ?>">
<input type="hidden" name="answ_id" id="answ_id" value="0">
<input type="submit" name="answit" value="<?= lang('Reply'); ?>" class="answer-post">
</div>
</form>
<?php if($post['post_type'] == 0) { ?>
<?php if ($uid['id']) { ?>
<?php if($post['post_closed'] == 0) { ?>
<form id="add_answ" class="new_answer" action="/answer/add" accept-charset="UTF-8" method="post">
<?= csrf_field() ?>
<textarea rows="5" placeholder="<?= lang('write-something'); ?>..." name="answer" id="answer"></textarea>
<div>
<input type="hidden" name="post_id" id="post_id" value="<?= $post['post_id']; ?>">
<input type="hidden" name="answ_id" id="answ_id" value="0">
<input type="submit" name="answit" value="<?= lang('Reply'); ?>" class="answer-post">
</div>
</form>
<?php } ?>
<?php } else { ?>
<textarea rows="5" disabled="disabled" placeholder="<?= lang('no-auth-comm'); ?>" name="answer" id="answer"></textarea>
<div>
<input type="submit" name="answit" value="<?= lang('Reply'); ?>" class="answer-post" disabled="disabled">
</div>
<?php } ?>
<?php } else { ?>
<textarea rows="5" disabled="disabled" placeholder="<?= lang('no-auth-comm'); ?>" name="answer" id="answer"></textarea>
<div>
<input type="submit" name="answit" value="<?= lang('Reply'); ?>" class="answer-post" disabled="disabled">
</div>
<?php } ?>
</div>
</div>
@ -159,213 +161,18 @@
<?= lang('post-delete'); ?>...
</div>
<?php } ?>
<?php if (!empty($answers)) { ?>
<div class="answers">
<h2> <?= $post['post_answers_num'] ?> <?= $post['num_answers'] ?></h2>
<?php foreach ($answers as $answ) { ?>
<div class="block-answer">
<?php if($answ['answer_del'] == 0) { ?>
<ol class="answer-telo">
<li class="answers_subtree" id="answ_<?= $answ['answer_id']; ?>">
<?php if (!$uid['id']) { ?>
<div class="voters">
<a rel="nofollow" href="/login"><div class="answ-up-id"></div></a>
<div class="score"><?= $answ['answer_votes']; ?></div>
</div>
<?php } else { ?>
<?php if ($answ['votes_answ_user_id'] == $uid['id'] || $uid['id'] == $answ['answer_user_id']) { ?>
<div class="voters active">
<div class="answ-up-id"></div>
<div class="score"><?= $answ['answer_votes']; ?></div>
</div>
<?php } else { ?>
<div id="up<?= $answ['answer_id']; ?>" class="voters">
<div data-id="<?= $answ['answer_id']; ?>" class="answ-up-id"></div>
<div class="score"><?= $answ['answer_votes']; ?></div>
</div>
<?php } ?>
<?php } ?>
<div class="answ-telo">
<div class="answ-header">
<img alt="<?= $answ['login']; ?>" class="ava" src="/uploads/avatar/small/<?= $answ['avatar'] ?>">
<span class="user">
<a href="/u/<?= $answ['login']; ?>"><?= $answ['login']; ?></a>
</span>
<span class="date">
<?= $answ['answer_date']; ?>
</span>
<?php if (empty($answ['edit'])) { ?>
<span class="date">
(<?= lang('ed'); ?>.)
</span>
<?php } ?>
<?php if ($post['post_user_id'] == $answ['answer_user_id']) { ?>
<span class="date ots">
<span class="authorpost">&#x21af;</span>
</span>
<?php } ?>
<span class="date ots">
<a rel="nofollow" href="/posts/<?= $post['post_id']; ?>/<?= $post['post_slug']; ?>#answ_<?= $answ['answer_id']; ?>">#</a>
</span>
<?php if ($uid['trust_level'] == 5) { ?>
<span class="date ots">
<?= $answ['answer_ip']; ?>
</span>
<?php } ?>
</div>
<div class="answ-telo-body">
<?= $answ['answer_content'] ?>
</div>
</div>
<?php if($post['post_closed'] == 0) { ?>
<?php if($post['post_is_delete'] == 0 || $uid['trust_level'] == 5) { ?>
<span id="cm_add_link<?= $answ['answer_id']; ?>" class="cm_add_link">
<a data-post_id="<?= $post['post_id']; ?>" data-answ_id="<?= $answ['answer_id']; ?>" class="addcomm"><?= lang('Reply'); ?></a>
</span>
<?php } ?>
<?php } ?>
<?php if($uid['id'] == $answ['answer_user_id'] || $uid['trust_level'] == 5) { ?>
<span id="answ_edit" class="answ_add_link">
<a data-answ_id="<?= $answ['answer_id']; ?>" class="editansw"><?= lang('Edit'); ?></a>
</span>
<?php } ?>
<?php if ($uid['id']) { ?>
<?php if ($answ['favorite_answ']){ ?>
<span class="user-answ-fav" data-answ="<?= $answ['answer_id']; ?>">
<span class="favcomm"><?= lang('remove-favorites'); ?></span>
</span>
<?php } else { ?>
<span class="user-answ-fav" data-answ="<?= $answ['answer_id']; ?>">
<span class="favcomm"><?= lang('add-favorites'); ?></span>
</span>
<?php } ?>
<?php } ?>
<?php if($uid['trust_level'] == 5) { ?>
<span id="answ_dell" class="answ_add_link">
<a data-id="<?= $answ['answer_id']; ?>" class="delansw"><?= lang('Remove'); ?></a>
</span>
<?php } ?>
<div id="answ_addentry<?= $answ['answer_id']; ?>" class="reply"></div>
</li>
</ol>
<?php } else { ?>
<ol class="dell answer-telo">
<li class="answers_subtree" id="answ_<?= $answ['answer_id']; ?>">
<span class="answ-deletes">~ <?= lang('answer-deleted'); ?></span>
</li>
</ol>
<?php } ?>
</div>
<?php foreach ($answ['comm'] as $comm) { ?>
<?php if($comm['comment_del'] == 0) { ?>
<ol class="comm-telo<?php if($comm['comment_comm_id'] > 0) { ?> step<?php } ?>">
<li class="comm_subtree" id="comm_<?= $comm['comment_id']; ?>">
<?php if (!$uid['id']) { ?>
<div class="voters">
<a rel="nofollow" href="/login"><div class="comm-up-id"></div></a>
<div class="score"><?= $comm['comment_votes']; ?></div>
</div>
<?php } else { ?>
<?php if ($comm['votes_comm_user_id'] == $uid['id'] || $uid['id'] == $comm['comment_user_id']) { ?>
<div class="voters active">
<div class="comm-up-id"></div>
<div class="score"><?= $comm['comment_votes']; ?></div>
</div>
<?php } else { ?>
<div id="up<?= $comm['comment_id']; ?>" class="voters">
<div data-id="<?= $comm['comment_id']; ?>" class="comm-up-id"></div>
<div class="score"><?= $comm['comment_votes']; ?></div>
</div>
<?php } ?>
<?php } ?>
<div class="comm-telo">
<div class="comm-header">
<img alt="<?= $comm['login']; ?>" class="ava" src="/uploads/avatar/small/<?= $comm['avatar'] ?>">
<span class="user">
<a href="/u/<?= $comm['login']; ?>"><?= $comm['login']; ?></a>
</span>
<span class="date">
<?= $comm['comment_date']; ?>
</span>
<?php if ($post['post_user_id'] == $comm['comment_user_id']) { ?>
<span class="date ots">
<span class="authorpost">&#x21af;</span>
</span>
<?php } ?>
<span class="date ots">
<a rel="nofollow" href="/posts/<?= $post['post_id']; ?>/<?= $post['post_slug']; ?>#comm_<?= $comm['comment_id']; ?>">#</a>
</span>
<?php if ($uid['trust_level'] == 5) { ?>
<span class="date ots">
<?= $comm['comment_ip']; ?>
</span>
<?php } ?>
</div>
<div class="comm-telo-body">
<?= $comm['comment_content'] ?>
</div>
</div>
<?php if($post['post_closed'] == 0) { ?>
<?php if($post['post_is_delete'] == 0 || $uid['trust_level'] == 5) { ?>
<span id="cm_add_link<?= $comm['comment_id']; ?>" class="cm_add_link">
<a data-post_id="<?= $post['post_id']; ?>" data-answ_id="<?= $answ['answer_id']; ?>" data-comm_id="<?= $comm['comment_id']; ?>" class="addcomm_re"><?= lang('Reply'); ?></a>
</span>
<?php } ?>
<?php } ?>
<?php if($uid['id'] == $comm['comment_user_id'] || $uid['trust_level'] == 5) { ?>
<span id="comm_edit" class="cm_add_link">
<a data-comm_id="<?= $comm['comment_id']; ?>" class="editcomm"><?= lang('Edit'); ?></a>
</span>
<?php } ?>
<?php if($uid['trust_level'] == 5) { ?>
<span id="comm_dell" class="cm_add_link">
<a data-comm_id="<?= $comm['comment_id']; ?>" class="delcomm"><?= lang('Remove'); ?></a>
</span>
<?php } ?>
<div id="comm_addentry<?= $comm['comment_id']; ?>" class="reply"></div>
</li>
</ol>
<?php } else { ?>
<ol class="dell comment-telo<?php if ($comm['level'] == 0) { ?> one<?php } ?><?php if ($comm['level'] == 2) { ?> two<?php } ?><?php if ($comm['level'] > 2) { ?> three<?php } ?>">
<li class="comments_subtree" id="comm_<?= $comm['comment_id']; ?>">
<span class="comm-deletes">~ <?= lang('comment-deleted'); ?></span>
</li>
</ol>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
<?php } else { ?>
<?php if($post['post_closed'] != 1) { ?>
<div class="no-answer"><?= lang('no-answer'); ?>...</div>
<?php } ?>
<?php } ?>
<?php if($post['post_closed'] == 1) { ?>
<?php if($post['post_type'] == 0) { ?>
<?php include TEMPLATE_DIR . '/post/comm-view.php'; ?>
<?php if($post['post_closed'] == 1) { ?>
<p class="no-answer"><?= lang('post-closed'); ?>...</p>
<?php } ?>
<?php } ?>
<?php } else { ?>
<?php include TEMPLATE_DIR . '/post/qa-view.php'; ?>
<p class="no-answer">Вопрос закрыт...</p>
<?php } ?>
</article>
</main>

View file

@ -46,15 +46,17 @@
</a>
<?php if ($post['post_content_preview']) { ?>
<div class="show">
<span class="show_add_<?= $post['post_id']; ?>">
<a data-post_id="<?= $post['post_id']; ?>" class="showpost">
<div class="show_add_<?= $post['post_id']; ?>">
<div data-post_id="<?= $post['post_id']; ?>" class="showpost">
<span>&#9658;</span>
<?= $post['post_content_preview']; ?>...
</a>
</span>
</div>
<?= $post['post_content_preview']; ?>
<span class="s_<?= $post['post_id']; ?> show_detail">... </span>
</div>
</div>
<?php } ?>
<div id="show_<?= $post['post_id']; ?>" class="show_detail"></div>
<div class="footer">
@ -69,7 +71,7 @@
</span>
<?php if($post['post_answers_num'] !=0) { ?>
<span class="otst"> | </span>
<a class="u-url" href="/posts/<?= $post['post_slug']; ?>">
<a class="u-url" href="/posts/<?= $post['post_id']; ?>/<?= $post['post_slug']; ?>">
<?= $post['post_answers_num']; ?> <?= $post['lang_num_answers']; ?>
</a>
<?php } ?>

View file

@ -26,7 +26,9 @@
<?php } ?>
<div class="space-text">
<img class="space-box-img" src="/uploads/space/<?= $space_info['space_img']; ?>">
<h2><?= $space_info['space_name']; ?></h2>
<a title="<?= $space_info['space_name']; ?>" href="/s/<?= $space_info['space_slug']; ?>">
<h1><?= $space_info['space_name']; ?></h1>
</a>
<div class="data"><?= $space_info['space_date']; ?></div>
<?php if($uid['trust_level'] == 5 || $space_info['space_user_id'] == $uid['id']) { ?>
@ -42,25 +44,21 @@
<ul class="nav-tabs">
<?php if($type == 'feed') { ?>
<li class="active">
<i class="icon calendar"></i>
<span>Посты</span>
<span><?= lang('Feed'); ?></span>
</li>
<li>
<a href="/s/<?= $space_info['space_slug']; ?>/top">
<i class="icon fire"></i>
<span>Top</span>
<span>Top</span>
</a>
</li>
<?php } else { ?>
<li>
<a href="/s/<?= $space_info['space_slug']; ?>">
<i class="icon calendar"></i>
<span>Посты</span>
<span><?= lang('Feed'); ?></span>
</a>
</li>
<li class="active">
<i class="icon fire"></i>
<span>Top</span>
<span>Top</span>
</li>
<?php } ?>
</ul>
@ -117,7 +115,7 @@
</span>
<?php if($post['post_answers_num'] !=0) { ?>
<span class="otst"> | </span>
<a class="u-url" href="/posts/<?= $post['post_slug']; ?>">
<a class="u-url" href="/posts/<?= $post['post_id']; ?>/<?= $post['post_slug']; ?>">
<?= $post['post_answers_num']; ?> <?= $post['lang_num_answers']; ?>
</a>
<?php } ?>