View file blog/comments.php

File size: 4.79Kb
<?
#-----------------------------------------------#
#             	Аuthor:  Nu3oN                  #
#                  ICQ : 100-50-97              #
#-----------------------------------------------#
require_once ('../includes/start.php');
require_once ('../includes/functions.php');
require_once ('../includes/header.php');
require_once ('distribution/db.php');
require_once ('distribution/fnc.php');
include_once ('../themes/'.$config['themes'].'/index.php');
show_title('partners.gif', 'Блоги / Комментарии');

if ($blog_kel = mysql_fetch_array(mysql_query("SELECT * FROM `directly_blogs` WHERE `id` = '".$id."'")))
{


if (is_user()) 
{




if (isset($_POST['new_comm']) and $_POST['text_new_comment'])
{
if ((iconv_strlen($_POST['text_new_comment'], 'UTF-8') > 3) and (iconv_strlen($_POST['text_new_comment'], 'UTF-8') < 1000)):

$_addMess = mysql_query("INSERT INTO `blog_comments` SET 
`id_category` = '".$blog_kel['id_blog_category']."',
`id_blog` = '".$id."',
`time_comment` = '".SITETIME."',
`author_comment` = '".$log."',
`text_comment` = '".no_br(check($_POST['text_new_comment']), '<br />')."'");
if (trim($_addMess))
{
header('Refresh: 1; url='.$config['home'].'/blog/comments.php?id='.$id.'&'.SID);
outputMessage(' Сообщение успешно добавлено ');
echo '<br />
<img src="../images/img/back.gif" alt="Image" /> <a href="comments.php?id='.$id.'&amp;'.SID.'">Назад</a><br />
<img src="../images/img/back.gif" alt="Image" /> <a href="index.php?'.SID.'">В блоги</a><br />
<img src="../images/img/homepage.gif" alt="Image" /> <a href="../index.php?'.SID.'">На главную</a>';
include_once ('../themes/'.$config['themes'].'/foot.php'); die;
}
else
{
outputMessage(' Error writing to database ', 'err');
}

else: outputMessage(' Недопустимое количество символов в сооющении ', 'err'); endif;
}

echo '<form action="comments.php?id='.$id.'" method="post"><div class="form"
<b>Сообщение:</b><br><textarea cols="25" rows="3" name="text_new_comment"></textarea>
<br /> <input name="new_comm" type="submit" value="Написать"> </div> </form>';

}
else
{
 echo '<div class="form">Посетители, находящиеся в группе Гости, не могут оставлять комментарии.</div><br />';
}




$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_comments` WHERE `id_blog` = '".$id."'"),0);
if ($start > $total) $start = false;
if ($total < $start + $config['navig_blog']) $end = $total;
else $end = $start + $config['navig_blog'];


$blog_ver = mysql_query("SELECT * FROM `blog_comments` WHERE `id_blog` = '".$id."' ORDER BY `id` DESC LIMIT ".$start.",".$config['navig_blog']."");

if (mysql_num_rows($blog_ver))
{


while($blog_comm = mysql_fetch_array($blog_ver)){
echo'<div class=b> ';
$usere = @file(BASEDIR."local/profil/".$blog_comm['author_comment'].".prof"); 
$user = explode(':||:',$usere['0']);

if(!empty($udata['45']))
{

if ($user['43']!="" && $user['43']!="noavatar.gif")
{
echo'<img src="../'.$user['43'].'" alt="Image" /> ';
}
else
{
echo'<img src="../images/avators/noavatar.gif" alt="Image" /> ';
}
}
else
{
echo'<img src="../images/img/edit.gif" alt="Image" /> ';
}

if (@trim($usere))
{
echo '<a href="../pages/anketa.php?uz='.$blog_comm['author_comment'].'">
<b>'.nickname($blog_comm['author_comment']).'</b></a> '.user_online($blog_comm['author_comment']);
}
else
{
echo '<b>'.nickname($blog_comm['author_comment']).'</b> <span style="color:#ff0000">[Удален]</span> ';
}
if (is_user() and is_admin(array(101,102,103,104,105)))
{
echo '<a href="index.php?do=del_comm&amp;id='.$blog_comm['id'].'&amp;start='.$id.'"><font color="#FF0000">[Del]</font></a>';}

echo '<br /><small>Добавлено: '.date_fixed($blog_comm['time_comment']).'</small>
</div>
<div>'.smiles(bb_code($blog_comm['text_comment'])).'</div>';
}


if ($total > $config['navig_blog'])
{
page_jumpnavigation('comments.php?id='.$id.'&amp;', $config['navig_blog'], $start, $total);
page_strnavigation('comments.php?id='.$id.'&amp;', $config['navig_blog'], $start, $total);
}

}
else
{
echo '<div class="b"><b> Комментариев еще нет! </b><br /> Будь первым =) </div>';
}











echo '<img src="../images/img/back.gif" alt=""> <a href="index.php?do=blog&id='.$id.'">Назад</a>';
}else{ 
echo '<div class="b"><b> Такого блога не существует! </b> </div>';
}

echo '<br /><img src="../images/img/back.gif" alt="Image" /> <a href="index.php?'.SID.'">В блоги</a><br />
<img src="../images/img/homepage.gif" alt="Image" /> <a href="../index.php?'.SID.'">На главную</a>';


include_once ('../themes/'.$config['themes'].'/foot.php'); 
?>