<?
$title = $l= "Блог - Чтение записи"; #Тайтл
require (CORE."head.php"); #Шапка
require('inc.php');
$note = DB :: $pdo -> queryFetch("SELECT * FROM `blog` WHERE `id` = ? LIMIT 1;", array(intval($_GET['note']))); #id блога
$ank = profile :: getUser($note['id_user']); #ID Юзера
// Подключаемые файлы //
if (isset($user['id']) && $user['id'] == $ank['id'] && isset($_GET['edit']))
{require('edit.php');exit;}
else if (isset($user['id']) && $user['id'] == $ank['id'] && isset($_GET['dell']))
{require('dell.php');exit;}
else if (isset($_GET['edit_komm']) && isset($user['id']) && DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `blog_comments` WHERE `id` = '".intval($_GET['edit_komm'])."' AND `id_user` = '".$user['id']."' AND `id_note` = '".$note['id']."' AND `time` > '".(time()-600)."'") > 0)
{require('edit_komm.php');exit;}
else if (isset($_GET['dell_komm']) && isset($user['id']) && $user['id'] == $ank['id'] && DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `blog_comments` WHERE `id` = '".intval($_GET['dell_komm'])."' AND `id_note` = '".$note['id']."'") > 0)
{require('dell_komm.php');exit;}
// Конец //
?>
<div class="app-container">
<div class="app-user--block">
<div class="app-user-b_top">
<div class="app-user-b_uavatar">
<span class="post-l emotion-show" data-emotions="<?=system::textOut($ank['emotions'])?>">
<?echo profile :: userAvatar($ank, 0);?>
</span>
</div>
<div class="app-user-b_lef">
<div class="app-user-b_username">
<?echo profile :: goPage($ank);?> <?=profile::vermini($ank)?>
</div>
<div class="app-user-b_date"> <?echo system :: times($note['time']);?></div>
</div>
</div>
<div class="app-user-b_content">
<?
echo Emoji :: Text(system :: textOut(($note['text'])));
?>
<?
if (DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `blog_files` WHERE `id_blog` = '".$note['id']."'") > 0)
{
?>
<div class="list_blog39">
<?
$query_f = DB :: $pdo -> query("SELECT * FROM `blog_files` WHERE `id_blog` = '".$note['id']."' ORDER BY `id` DESC");
while($r_f = $query_f -> fetch())
{
?>
<div class="llq_pdq--291">
<img class="liq-pdq--891" src="<?echo "".FILES_SERVER."/blog_files/".$r_f['id']."_m.jpg";?>" alt="*" />
</div>
<?
}
?>
</div>
<?
}
?>
</div>
</div>
<? if (isset($user['id']) && $user['id'] == $ank['id'])
{ ?>
<div class="app-user-b_bot _bg-blue">
<a class="app-link_spo" href="/blog/?note=<?echo $note['id'];?>&edit" title="Редактировать"><span class="ico ico-pencil"></span> Редактировать </a>
<a class="app-link_spo _fl-r" href="/blog/?note=<?echo $note['id'];?>&dell" title="Удалить"><span class="ico ico-dell"></span> Удалить </a>
</div>
<?}?>
<?
if (isset($user['id']))
{
if (isset($_GET['otvet']) && DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `blog_comments` WHERE `id` = '".intval($_GET['otvet'])."' AND `id_note` = '".$note['id']."'") > 0)
{
$g_p = DB :: $pdo -> queryFetch("SELECT * FROM `blog_comments` WHERE `id` = ? AND `id_note` = ? LIMIT 1;", array(intval($_GET['otvet']), $note['id']));
$otvet = profile :: getUser($g_p['id_user']);
if ($user['id'] == $otvet['id'])
{
$g_p['id'] = 0;
$otvet['id'] = 0;
}
} else {
$g_p['id'] = 0;
$otvet['id'] = 0;
}
require('send_komment.php');
?>
<div class="" style="border-top: 1px solid #eee;">
<?if ($otvet['id'] > 0)
{
?>
<form method="post" data-type="arbour" class="post-add" action="/blog/?note=<?echo $note['id'];?>&otvet=<?echo $g_p['id'];?>">
<?
} else {
?>
<form method="post" data-type="arbour" class="post-add" action="/blog/?note=<?echo $note['id'];?>">
<?
}
?>
<textarea name="komment" id="emoji-textarea" data-id="emoji-block_1" class="app-textarea" placeholder="Введите сообщение.."><?=@$message?></textarea>
<div class="list _bg-gray"><div class="_p-rel">
<input type="submit" class="main-btn" name="cfms" value="Отправить">
<? if ($otvet['id'] > 0)
{
?>
<span style="color: gray;margin: 5px;">
Ответ для <?echo profile :: goPage($otvet,folse);?>
(<a href="/blog/?note=<?echo $note['id'];?>">отменить</a>)
</span>
<?
} ?>
<?=emoji :: Smiles("emoji-block_1","emoji-textarea")?>
</div>
</div>
</form>
</div>
<?
}
$mess_cc = DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `blog_comments` WHERE `id_note` = '".$note['id']."'");
//Пагинация
if ($mess_cc > 10)
{
$p = (($_GET['p']) ? intval($_GET['p']) : 1);
$pagination = new pagination(10, $mess_cc, $p);
$total_lin = $pagination -> limit;
} else {
$total_lin = '';
}
// Конец
/* Разделитель */
if ($mess_cc > 0)
{ echo'<div style="border-top: 1px solid #eee;"></div>';
}
// Конец //
$query = DB :: $pdo -> query("SELECT * FROM `blog_comments` WHERE `id_note` = '".$note['id']."' ORDER BY `id` DESC ".$total_lin."");
while($r = $query -> fetch())
{
$post_ank = profile :: getUser($r['id_user']);
?>
<div class="post-list-all">
<div class="list">
<div>
<a class="toggle-menu-act" onclick="UI.toggleMenu(this);"><span></span></a>
<div class="toggle-menu">
<div class="toggle-menu-arrow"><span></span></div>
<ul class="toggle-menu-block">
<? if (isset($user['id']) && $user['id'] != $post_ank['id'])
{ ?> <a href="/blog/?note=<?echo $note['id'];?>&otvet=<?echo $r['id'];?>#otvet_menu">Ответить</a>
<? } ?>
<? if (isset($user['id']) && $user['id'] == $post_ank['id'] && $r['time'] > time()-300)
{?> <a href="/blog/?note=<?echo $note['id'];?>&edit_komm=<?echo $r['id'];?>">Редактировать</a>
<? } ?>
<? if (isset($user['id']) && $user['id'] == $ank['id'])
{ ?> <a href="/blog/?note=<?echo $note['id'];?>&dell_komm=<?echo $r['id'];?>">Удалить</a> <?}?>
</ul>
</div>
</div>
<div class="_oh"><div class="list-flex">
<div class="post-l emotion-show" >
<?echo profile :: userAvatar($post_ank, 4);?>
</div>
<div class="post-c">
<div style="display: block;"><span class="_name"><?=profile :: goPage($post_ank)?></span>
<div><span class="_font-m _gray"><?=system :: times($r['time'])?></span></div>
</div>
</div>
</div>
</div>
<div class="_oh"><span style="vertical-align: sub;">
<?php
if ($r['id_post'] > 0)
{
$g_pz = DB :: $pdo -> queryFetch("SELECT `id_user` FROM `blog_comments` WHERE `id` = ? LIMIT 1;", array($r['id_post']));
$post_ank2 = profile :: getUser($g_pz['id_user']);
?>
<span class="_name">
<?echo profile :: goPage($post_ank2, folse);?>
</span> ,
<?
}
?>
<?=emoji :: Text(system :: BBcode(system :: textOut($r['message'])))?> </span>
</div>
</div></div>
<?
}
// Пагинация
if ($mess_cc > 10)
{
echo $pagination -> printPages("/blog/?note=".$note['id']."&");
}
echo system :: touch("/blog/?id=".$ank['id']."", system :: icon("arr-l")."Назад"); #Ссылка назад
require (CORE."foot.php"); #Низ