DEV: Слияние, закрепление поста (вторая часть)
This commit is contained in:
parent
458d31d138
commit
277dee174c
|
@ -94,10 +94,15 @@ class PostController extends \MainController
|
|||
if($slug != $post_new['post_slug']) {
|
||||
redirect('/post/' . $post_new['post_id'] . '/' . $post_new['post_slug']);
|
||||
}
|
||||
|
||||
|
||||
$post = PostModel::postSlug($slug, $uid['id'], $uid['trust_level']);
|
||||
Base::PageError404($post);
|
||||
|
||||
|
||||
// Редирект для слияния
|
||||
if($post['post_merged_id'] > 0) {
|
||||
redirect('/post/' . $post['post_merged_id']);
|
||||
}
|
||||
|
||||
// Просмотры поста
|
||||
if (!isset($_SESSION['pagenumbers'])) {
|
||||
$_SESSION['pagenumbers'] = array();
|
||||
|
|
|
@ -53,7 +53,7 @@ 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_type, p.post_draft, p.post_user_id, p.post_space_id, p.post_answers_num, p.post_translation, p.post_tl,
|
||||
$sql = "SELECT p.post_id, p.post_title, p.post_slug, p.post_type, p.post_draft, p.post_user_id, p.post_space_id, p.post_answers_num, p.post_translation, p.post_merged_id, p.post_tl,
|
||||
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, post_url_domain,
|
||||
p.post_content_img, p.post_thumb_img, p.post_content,
|
||||
u.id, u.login, u.avatar,
|
||||
|
|
|
@ -64,9 +64,9 @@ class SpaceModel extends \MainModel
|
|||
|
||||
if ($type == 'feed') {
|
||||
if($space_tags_id) {
|
||||
$result = $q->and(['post_tag_id'], '=', $space_tags_id)->orderBy(['post_date'])->desc()->getSelect();
|
||||
$result = $q->and(['post_tag_id'], '=', $space_tags_id)->orderBy(['post_top'])->desc(',', ['post_date'])->desc()->getSelect();
|
||||
} else {
|
||||
$result = $q->orderBy(['post_date'])->desc()->getSelect();
|
||||
$result = $q->orderBy(['post_top'])->desc(',', ['post_date'])->desc()->getSelect();
|
||||
}
|
||||
} else {
|
||||
|
||||
|
@ -74,8 +74,8 @@ class SpaceModel extends \MainModel
|
|||
$result = $q->and(['post_tag_id'], '=', $space_tags_id)->orderBy(['post_answers_num'])->desc()->getSelect();
|
||||
} else {
|
||||
$result = $q->orderBy(['post_answers_num'])->desc()->getSelect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ i.icon {
|
|||
}
|
||||
|
||||
.info i.icon {
|
||||
margin: 0 1px;
|
||||
margin: 0 1px;
|
||||
}
|
||||
|
||||
.sticky i.icon {
|
||||
|
@ -1192,7 +1192,7 @@ ol.comment-telo {
|
|||
.qa-footer {
|
||||
width: 120px;
|
||||
margin: 0;
|
||||
padding: 10px 0px 10px 0px;
|
||||
padding: 10px 0px 10px 0;
|
||||
margin-left: 10px;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #ddd;
|
||||
|
@ -1660,7 +1660,6 @@ i.github {
|
|||
.text-oth { width: 46%; }
|
||||
.text-info { width: 40%; }
|
||||
.nav { margin-left: 15px; }
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 704px) {
|
||||
|
|
|
@ -81,6 +81,9 @@
|
|||
<?php if($post['post_tl'] > 0) { ?>
|
||||
<span class="trust-level">tl<?= $post['post_tl']; ?></span>
|
||||
<?php } ?>
|
||||
<?php if($post['post_merged_id'] > 0) { ?>
|
||||
<i class="icon graph red"></i>
|
||||
<?php } ?>
|
||||
</a>
|
||||
|
||||
<?php if($post['post_url_domain']) { ?>
|
||||
|
|
|
@ -129,6 +129,9 @@
|
|||
<?php if($post['post_tl'] > 0) { ?>
|
||||
<span class="trust-level">tl<?= $post['post_tl']; ?></span>
|
||||
<?php } ?>
|
||||
<?php if($post['post_merged_id'] > 0) { ?>
|
||||
<i class="icon graph red"></i>
|
||||
<?php } ?>
|
||||
</a>
|
||||
<?php if($post['st_id']) { ?>
|
||||
<a class="space-u tag-u" href="/s/<?= $space_info['space_slug']; ?>/<?= $post['st_id']; ?>" title="<?= $post['st_title']; ?>"><?= $post['st_title']; ?></a>
|
||||
|
|
|
@ -133,6 +133,7 @@ Route::endGroup();
|
|||
|
||||
// Пост в ленте и полный пост
|
||||
Route::type('post')->get('/post/shown')->controller('PostController@shownPost');
|
||||
Route::get('/post/{id}')->controller('PostController@viewPost')->where(['id' => '[0-9-]+']);
|
||||
Route::get('/post/{id}/{slug}')->controller('PostController@viewPost')->where(['id' => '[0-9-]+', 'slug' => '[A-Za-z0-9-]+']);
|
||||
|
||||
// Информация
|
||||
|
|
Loading…
Reference in a new issue