Файл: blog/list.php
Строк: 267
<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
/////////////////////////////
// Если указано TRUE то комментарии будут выводиться на той же странице где и сам дневник.
// Если указано FALSE то комментарии выводятся на отдельной странице
$komm_list=TRUE;
///////////////////////////
if(!isset($_GET['id']))
{
$set['title']='Ошибка';
include_once '../sys/inc/thead.php';
title();
aut();
echo "Нет такой записи!";
echo"<div class='foot'>n";
echo"<a href='index.php'>Дневники</a><br />n";
echo"</div>n";
include_once '../sys/inc/tfoot.php';
exit();
}
$id = intval($_GET['id']);
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_list` WHERE `id` = '".intval($_GET['id'])."'"),0) ==0)
{
$set['title']='Ошибка';
include_once '../sys/inc/thead.php';
title();
aut();
echo "Нет такой записи!";
echo"<div class='foot'>n";
echo"<a href='index.php'>Дневники</a><br />n";
echo"</div>n";
include_once '../sys/inc/tfoot.php';
exit();
}
$blog=mysql_fetch_array(mysql_query("select * from `blog_list` where `id`='".intval($_GET['id'])."';"));
if($blog['privat'] == 1)
{
if (($user['level'] < 4) && ($user['id'] !=$blog['id_user']))
{
$set['title']='Закрыто';
include_once '../sys/inc/thead.php';
title();
aut();
echo "Этот дневник закрыт!";
echo"<div class='foot'>n";
echo"<a href='index.php'>Дневники</a><br />n";
echo"</div>n";
include_once '../sys/inc/tfoot.php';
exit();
}
}
mysql_query("UPDATE `blog_list` SET `count` = '".($blog['count']+1)."' WHERE `id` = '$blog[id]' LIMIT 1");
$ank=get_user($blog['id_user']);
$set['title']='Блоги - '.$ank['nick'].'';
include_once '../sys/inc/thead.php';
title();
aut();
err();
echo"<div class='str'>n";
echo"<a href='index.php'>Блог</a> > <a href='user.php?id=$ank[id]'>$ank[nick]</a><br />n";
echo"</div>n";
echo "<table class='post'>n";
echo " <tr>n";
if ($set['set_show_icon']==2){
echo " <td class='icon48' rowspan='2'>n";
avatar($ank['id']);
echo " </td>n";
}
elseif ($set['set_show_icon']==1)
{
echo " <td class='icon14'>n";
echo "".status($ank['id'])."";
echo " </td>n";
}
echo " <td class='p_t'>n";
echo " <a href='/info.php?id=$ank[id]'>$ank[nick]</a> ".online($ank['id'])." (".vremja($blog['time']).")n";
echo " </td>n";
echo " </tr>n";
echo " <tr>n";
if ($set['set_show_icon']==1)echo " <td class='p_m' colspan='2'>n"; else echo " <td class='p_m'>n";
if ($ank['ank_vip']==4)echo "<span class="user_pro"><b>PRO</b></span><br />n";
else
if ($ank['ank_vip']==3)echo "<span class="user_garant"><b>Гарант</b></span><br />n";
else
if ($ank['ank_vip']==2)echo "<span class="user_vip_master"><b>VIP Мастер</b></span><br />n";
else
if ($ank['ank_vip']==1)echo "<span class="user_moshennik"><b>Мошенник</b></span><br />";
else
if ($ank['ank_wmid']!=NULL)echo "<span class="user_statys"><b>Юзер</b></span><br />n";
else
echo "<span class="user_gostj"><b>Гость</b></span><br />n";
echo "<hr/>";
echo "<b>".output_text($blog['name'])."</b> <br />n";
echo "".output_text($blog['msg'])." <br />n";
echo " </td>n";
echo " </tr>n";
echo "</table>n";
if (($user['level'] >= 4) || ($user['id'] ==$blog['id_user']))
{
echo"<div class='anton'>[<a href='edit.php?id=$blog[id]'>Редактировать</a> | <a href='edit.php?id=$blog[id]&del'>Удалить</a>]<br/></div>n";
}
if($komm_list)
{
################################################################################
if (isset($_POST['msg']) && isset($user))
{
$msg=$_POST['msg'];
if (isset($_POST['translit']) && $_POST['translit']==1)$msg=translit($msg);
if (strlen2($msg)>1024){$err='Сообщение слишком длинное';}
elseif (strlen2($msg)<2){$err='Короткое сообщение';}
elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_komm` WHERE `id_blog` = '".intval($_GET['id'])."' AND `id_user` = '$user[id]' AND `msg` = '".mysql_real_escape_string($msg)."' LIMIT 1"),0)!=0){$err='Ваше сообщение повторяет предыдущее';}
else{
mysql_query("INSERT INTO `blog_komm` (`id_user`, `time`, `msg`, `id_blog`) values('$user[id]', '$time', '".mysql_real_escape_string($msg)."', '".intval($_GET['id'])."')");
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
if($user['id']!=$blog['id_user']) { $msgrat5="В Вашем блоге [url=/blog/list.php?id=$blog[id]]$blog[name][/url] оставили новый комментарий."; mysql_query("INSERT INTO `jurnal` (`id_kont`, `msg`, `time`) values('$blog[id_user]', '$msgrat5', '$time')"); }
msg('Ваш комментарий успешно принят');
}
}
elseif (isset($_GET['del']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_komm` WHERE `id` = '".intval($_GET['del'])."' && `id_blog` = '".intval($_GET['id'])."'"),0))
{
if (isset($user) && ($user['level']>=4) || isset($user) && ($user['id']=$blog['id_user']))
{
mysql_query("DELETE FROM `blog_komm` WHERE `id` = '".intval($_GET['del'])."' LIMIT 1");
msg('Комментарий удален');
}
}
################################################################################
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_komm` WHERE `id_blog` = '".intval($_GET['id'])."'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `blog_komm` WHERE `id_blog` = '".intval($_GET['id'])."' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
echo "<table class='post'>n";
if ($k_post==0)
{
echo " <tr>n";
echo " <td class='p_t'>n";
echo "Нет комментариевn";
echo " </td>n";
echo " </tr>n";
}
while ($post = mysql_fetch_assoc($q))
{
//$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
$ank=get_user($post['id_user']);
echo " <tr>n";
if ($set['set_show_icon']==2){
echo " <td class='icon48' rowspan='2'>n";
avatar($ank['id']);
echo " </td>n";
}
elseif ($set['set_show_icon']==1)
{
echo " <td class='icon14'>n";
echo "".status($ank['id'])."";
echo " </td>n";
}
echo " <td class='p_t'>n";
echo " <a href='/info.php?id=$ank[id]'>$ank[nick]</a>".online($ank['id'])." (".vremja($post['time']).")n";
echo " </td>n";
echo " </tr>n";
echo " <tr>n";
if ($set['set_show_icon']==1)echo " <td class='p_m' colspan='2'>n"; else echo " <td class='p_m'>n";
if ($ank['ank_vip']==4)echo "<span class="user_pro"><b>PRO</b></span><br />n";
else
if ($ank['ank_vip']==3)echo "<span class="user_garant"><b>Гарант</b></span><br />n";
else
if ($ank['ank_vip']==2)echo "<span class="user_vip_master"><b>VIP Мастер</b></span><br />n";
else
if ($ank['ank_vip']==1)echo "<span class="user_moshennik"><b>Мошенник</b></span><br />";
else
if ($ank['ank_wmid']!=NULL)echo "<span class="user_statys"><b>Юзер</b></span><br />n";
else
echo "<span class="user_gostj"><b>Гость</b></span><br />n";
echo "<hr/>";
echo output_text($post['msg'])."<br />n";
if (isset($user) && $user['id']!=$ank['id'])if (isset($user) && ($user["level"]>=0) || isset($user) && ($user["id"]==$blog["id_user"])){ echo '<a href="otvet.php?id='.$post['id'].'">Ответить</a>'; }
if (isset($user) && ($user['level']>=4) || isset($user) && ($user['id'] == $blog['id_user']))
echo " <a href='?id=".intval($_GET['id'])."&del=$post[id]'>Удалить</a><br />n";
echo " </td>n";
echo " </tr>n";
}
echo "</table>n";
if ($k_page>1)str("?id=".intval($_GET['id']).'&',$k_page,$page); // Вывод страниц
if (isset($user))
{
echo "<form method="post" name='message' action="list.php?id=".intval($_GET['id'])."&page=$page">n";
if ($set['web'] && is_file(H.'style/themes/'.$set['set_them'].'/altername_post_form.php'))
include_once H.'style/themes/'.$set['set_them'].'/altername_post_form.php';
else
echo "Сообщение:<br />n<textarea name="msg"></textarea><br />n";
if ($user['set_translit']==1)echo "<label><input type="checkbox" name="translit" value="1" /> Транслит</label><br />n";
echo "<input value="Отправить" type="submit" />n";
echo "</form>n";
}
}
else
{
echo"<a href='komm.php?id=$blog[id]'>Комментарии</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_komm` WHERE `id_blog` = '$blog[id]'"),0).")<br/>";
}
echo "<div class='anton'>n";
echo "<a href='index.php'>Блоги</a><br />n";
echo "</div>n";
include_once '../sys/inc/tfoot.php';
?>