<?
/**
* & Author :: Igor Slepko
* & Nick :: Tw1nGo
* & Contacts :: http://gix.su/user/Tw1nGo
*/
include_once $_SERVER['DOCUMENT_ROOT'] . '/sys/inc/home.php';
include_once H.'sys/inc/start.php';
include_once H.'sys/inc/compress.php';
include_once H.'sys/inc/sess.php';
include_once H.'sys/inc/settings.php';
include_once H.'sys/inc/db_connect.php';
include_once H.'sys/inc/ipua.php';
include_once H.'sys/inc/fnc.php';
include_once H.'sys/inc/user.php';
// Если юзер в Бане
if (isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `razdel` = 'notes' AND `id_user` = '$user[id]' AND (`time` > '$time' OR `view` = '0' OR `navsegda` = '1')"), 0) != 0){
header('Location: /ban.php?'.SID);
exit;
}
if (isset($user)){
$ank['id'] = $user['id'];
}
if (isset($_GET['id'])){
$ank['id'] = intval($_GET['id']);
}
$ank = get_user($ank['id']);
if ($ank['id'] == 0 || !$ank){
$set['title'] = 'Ошибка!';
include_once H.'sys/inc/thead.php';
title();
?>
<div class="lc_br wbg font0 relative oh" id="header_path">
<a href="/" style="font-size:0;"> <img src="/style/i/lb/home.png" alt=""> </a>
<span class="lc_brw"> <img src="/style/i/lb/sep.png" alt="" class="lc_br_sep"> <span class="lc_br_text">Ошибка</span> </span>
</div>
<div class="wrapper"> <div class="link"> Пользователь не найден. </div> </div>
<?
include_once H.'sys/inc/tfoot.php';
exit;
}
if (isset($user))
{
// Запрещаем нам!
if ($user['id'] != $ank['id']){
// Лайк
if (isset($_GET['like'])){
$blog = mysql_fetch_assoc(mysql_query("SELECT * FROM `notes` WHERE `id` = '".intval($_GET['like'])."' LIMIT 1"));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_like` WHERE `id_user` = '".$user['id']."' AND `id_notes` = '".$blog['id']."' LIMIT 1"),0) == 0){
mysql_query("INSERT INTO `notes_like` (`id_notes`, `id_user`, `like`) VALUES ('$blog[id]', '$user[id]', '1')");
$mgs_like = "[b]".$user['nick']."[/b] понравился ваш блог!";
mysql_query("INSERT INTO `journal` (`user`, `time`, `act`, `opis`, `ank`, `url`) VALUES ('".$user['id']."', '".$time."', 'blogs', '".$mgs_like."', '".$ank['id']."', '/user/blogs/read/?id=".$blog['id']."')");
// Выводим в списке понравившихся в закладках
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `bookmarks_like` WHERE `id_user` = '".$user['id']."' AND `id_object` = '".$blog['id']."' AND `type` = 'blog' LIMIT 1"),0) == 0){
mysql_query("INSERT INTO `bookmarks_like` (`type`,`id_object`, `id_user`, `time`) VALUES ('blog','$blog[id]', '$user[id]', '$time')");
}
}
else{
$_SESSION['err'] = 'Вы уже голосовали за блог.';
}
header("Location: ?id=$ank[id]");
exit;
}
// Дизлайк
if (isset($_GET['dlike'])){
$blog = mysql_fetch_assoc(mysql_query("SELECT * FROM `notes` WHERE `id` = '".intval($_GET['dlike'])."' LIMIT 1"));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_like` WHERE `id_user` = '".$user['id']."' AND `id_notes` = '".$blog['id']."' LIMIT 1"),0) == 0){
mysql_query("INSERT INTO `notes_like` (`id_notes`, `id_user`, `like`) VALUES ('$blog[id]', '$user[id]', '0')");
}
else{
$_SESSION['err'] = 'Вы уже голосовали за блог.';
}
header("Location: ?id=$ank[id]");
exit;
}
}
}
if (isset($user)){
if(isset($_GET['sort'])){
mysql_query("UPDATE `user` SET `blog_view` = '".($user['blog_view'] == 1 ? '0' : '1')."' WHERE `id` = '$user[id]'");
header("Location: ?id=$ank[id]");
exit;
}
}
// Приветствие
if (isset($_POST['welcome_msg']) && isset($user) && $user['id'] == $ank['id'])
{
$msg = $_POST['welcome_msg'];
$mat = antimat($msg);
if ($mat)$err[] = 'В тексте приветствия обнаружен мат: '.$mat;
if (strlen2($msg) > 250){
$err = 'Приветствие не должно быть больше 2500 символов.';
}elseif (strlen2($msg) == 1){
$err = 'Слишком короткое приветствие.';
}
if($msg == null){
$ijha = null;
}elseif($msg > 1){
$ijha = my_esc($msg);
}else{
$ijha = my_esc($msg);
}
if(!isset($err)){
mysql_query("UPDATE `user` SET `ank_blogs` = '".$ijha."' WHERE `id` = '$user[id]'");
header("Location: ?id=$ank[id]");
exit;
}
}
$set['title'] = 'Блог : ' . $ank['nick'];
include_once H.'sys/inc/thead.php';
title();
?>
<div class="lc_br wbg font0 relative oh" id="header_path">
<a href="/" style="font-size:0;"> <img src="/style/i/lb/home.png" alt=""> </a>
<span class="lc_brw"> <img src="/style/i/lb/sep.png" alt="" class="lc_br_sep">
<a href="/user/?id=<?= $ank['id']?>"><?= $ank['nick']?></a>
</span>
<span class="lc_brw">
<img src="/style/i/lb/sep.png" alt="" class="lc_br_sep">
<a href="/user/blogs/view/?id=<?= $ank['id']?>">Блог</a>
</span>
</div>
<?
err();
if(isset($user) && $user['id'] == $ank['id'] || $user['level'] >= 3){
$komu_vidno = "";
}
else{
$komu_vidno = " AND `private` != '2'";
}
$set['p_str'] = '10';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `notes` WHERE `id_comm` = '0' AND `id_user` = '$ank[id]' $komu_vidno"),0);
if(isset($user) && $user['id'] == $ank['id'])
{
?>
<div class="wrapper"> <div class="bubble mt_0 mb0 word_break">
<a class="right" href="?id=<?= $ank['id']?>&welcome=new" style="margin-left: 5px;"><img src="/style/i/edit_info.png" alt="" class="p16"></a>
<div class="oh">
<?
if($ank['ank_blogs'] == null){
?>
<span class="grey">Описание не добавлено.</span>
<?
}else{
?>
<span class="grey"> <?= text($ank['ank_blogs'])?></span>
<?
}
?>
</div> </div></div>
<?
if (isset($user) && isset($_GET['welcome']) && $_GET['welcome'] == 'new'){
?>
<div class="wrapper" style="margin-top:0;">
<form action="?id=<?= $ank['id']?>" method="post">
<div class="block bord-botm">
<div> <div class="input-txt_wrapper"> <textarea class="input-txt" rows="5" cols="17" name="welcome_msg" maxlength="512"><?=text($ank['ank_blogs'])?></textarea> </div> </div>
</div>
<table class="table__wrap"> <tbody><tr>
<td class="table__cell" width="50%">
<!-- --><!-- --><!-- --><!-- --><!-- -->
<button type="submit" value="Сохранить" class=" link blue full is_final " id="cfms">
<!-- -->
<img src="/style/i/ok_blue.png" alt="" class="m">
<!-- -->
<span class="m"> Сохранить</span>
<!-- -->
</button>
<!-- --><!-- -->
</td>
<td class="table__cell table__cell_last" width="50%">
<a href="?id=<?= $ank['id']?>" class="link "> <span>Отменить</span> </a>
</td>
</tr> </tbody></table>
</form>
</div>
<?
}
?>
<div class="wrapper block oh">
<a href="/user/blogs/new/?" class="inl-link link-grey c-grey">
<!-- --><img src="/style/i/ico/blog.png" alt="" class="m"> <!-- --><span class="m b">Написать в блог</span><!-- --><!-- --><!-- --><!-- -->
</a>
<?
if($k_post > 0){
?>
<!-- -->
<span class="right">
<span class="inl_bl" onclick="short_mode_switch();" style="cursor: pointer;">
<span class="inl-link link-grey c-grey">
<!-- --><img src="/style/i/ico/extended.png" alt="" class="m"> <!-- --><span class="m">Вид</span><!-- --><!-- --><!-- --><!-- -->
</span><!-- -->
</span>
</span>
</div>
<div id="short_mode_switch" style="display: none">
<div class="wrapper">
<a href="?id=<?= $ank['id']?>&sort" class="link -full grey c-grey <?= ($user['blog_view'] == 1 ? 'b form-checkbox_checked' : '')?>">
<span><!-- --><img src="/style/i/ico/short.png" alt="" class="m"> <!-- --><span class="m">Краткий вид</span><!-- --></span>
</a>
<a href="?id=<?= $ank['id']?>&sort" class="link -full grey c-grey <?= ($user['blog_view'] != 1 ? 'b form-checkbox_checked' : '')?>">
<span><!-- --><img src="/style/i/ico/extended.png" alt="" class="m"> <!-- --><span class="m">Расширенный вид</span><!-- --></span>
</a>
</div>
<?
}
?>
</div>
<?
}else{
if($ank['ank_blogs'] != null){
?>
<div class="wrapper"> <div class="bubble mt_0 mb0 word_break">
<div class="oh">
<span class="grey"> <?= text($ank['ank_blogs'])?></span>
</div>
</div> </div>
<?
}
if(isset($user) && $user['id'] != $ank['id'] && $k_post > 0){
?>
<div class="wrapper block oh">
<!-- -->
<span class="right">
<span class="inl_bl" onclick="short_mode_switch();" style="cursor: pointer;">
<span class="inl-link link-grey c-grey">
<!-- --><img src="/style/i/ico/extended.png" alt="" class="m"> <!-- --><span class="m">Вид</span><!-- --><!-- --><!-- --><!-- -->
</span><!-- -->
</span>
</span>
</div>
<div id="short_mode_switch" style="display: none">
<div class="wrapper">
<a href="?id=<?= $ank['id']?>&sort" class="link -full grey c-grey <?= ($user['blog_view'] == 1 ? 'b form-checkbox_checked' : '')?>">
<span><!-- --><img src="/style/i/ico/short.png" alt="" class="m"> <!-- --><span class="m">Краткий вид</span><!-- --></span>
</a>
<a href="?id=<?= $ank['id']?>&sort" class="link -full grey c-grey <?= ($user['blog_view'] != 1 ? 'b form-checkbox_checked' : '')?>">
<span><!-- --><img src="/style/i/ico/extended.png" alt="" class="m"> <!-- --><span class="m">Расширенный вид</span><!-- --></span>
</a>
</div>
</div>
<?
}
}
$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 `notes` WHERE `id_comm` = '0' AND `id_user` = '$ank[id]' $komu_vidno order by `time` desc LIMIT $start, $set[p_str]");
if ($k_post == 0){
?>
<div class="wrapper"> <div class="link"> Блоги не найдены. </div> </div>
<?
}
else{
if(isset($user) && $user['blog_view'] == 1){
?>
<div class="wrapper bb0">
<?
}
while ($post = mysql_fetch_assoc($q))
{
$us_ank = get_user($post['id_user']);
$koment = mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_komm` WHERE `id_notes` = '".$post['id']."'"), 0);
$kan_post = mysql_fetch_assoc(mysql_query("SELECT * FROM `notes_dir` WHERE `id` = '".$post['id_dir']."' LIMIT 1"));
$like = mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_like` WHERE `like` = '1' AND `id_notes` = '".$post['id']."' LIMIT 1"),0);
$dlike = mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_like` WHERE `like` = '0' AND `id_notes` = '".$post['id']."' LIMIT 1"),0);
$us_like = mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_like` WHERE `like` = '1' AND `id_user` = '".$user['id']."' AND `id_notes` = '".$post['id']."' LIMIT 1"),0);
$us_dlike = mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_like` WHERE `like` = '0' AND `id_user` = '".$user['id']."' AND `id_notes` = '".$post['id']."' LIMIT 1"),0);
$_msg = text($post['msg']);
if (iconv_strlen($_msg, 'UTF-8') > 50) {
$_msg= iconv_substr($_msg, 0, 200, 'UTF-8');
$_msg = $_msg.'...';
}
if($post['private'] == 1)$ico_privat = '<img src="/style/i/ico/mode_fronl.png" alt="" class="m p16" title="Доступно друзьям"> ';
elseif($post['private'] == 2)$ico_privat = '<img src="/style/i/ico/mode_ownonl.png" alt="" class="m p16" title=""> ';
else
$ico_privat = '<img src="/style/i/ico/mode_na.png" alt="" class="m p16" title="Доступно всем"> ';
if(!isset($user) || $user['blog_view'] != 1){
?>
<div class="wrapper bb0">
<?
}
?>
<div class="block bord-botm relative attaches_limiter">
<div class="oh">
<span class="right">
<span class="grey m"><?= vremja($post['time'])?></span>
<?
if($post['adult'] == 1){
?>
<img src="/style/i/adult_ico.png" alt="" class="m p16" title="Только для взрослых">
<?
}
?>
<!-- -->
<?= $ico_privat?>
<!-- --><!-- -->
</span>
<div class="grey"> <?= group($us_ank['id'])?> <?= unick($us_ank['id'])?> </div>
<div class="cl pad_t_a"></div>
<?
if ($post['file_ves'] != 0 && $post['file_raz'] != NULL && is_file(H."user/blogs/files/".$post['id'].".dat"))
{
if ($post['file_raz'] == 'png' || $post['file_raz'] == 'gif' || $post['file_raz'] == 'jpg' || $post['file_raz'] == 'jpeg')
{
?>
<div class="left t-padd_right">
<div>
<span class="short_attach">
<div class="inl_bl">
<span class="pr">
<div class="inl_bl relative">
<img src="/user/blogs/file/<?= $post['id']?>.<?= $post['file_raz']?>" alt="" class="preview s81_80" style="width:80px;height:80px;">
</div>
</span>
</div>
</span>
</div>
</div>
<?
}
}
?>
<div class="oh">
<a class="arrow_link full_link" href="/user/blogs/read/?id=<?= $post['id']?>">
<b> <?= text($post['name'])?> </b>
</a>
<div> <?= $_msg?> </div>
</div> </div>
<?
if($koment > 0 || $kan_post['name'] != null || $post['count'] > 0){
?>
<div>
<div class="oh">
<div class="oh cl grey pad_t_a" style="padding-top: 5px;">
<?
if(isset($user) && $user['blog_view'] == 1 && $koment > 0){
?>
<span class="left">
<img src="/style/i/comm_ico.png" class="m p16" alt="">
<span class="m"><?= $koment?></span>
</span>
<?
}
if($kan_post['name'] != null){
?>
<span class="m <?= (isset($user) && $user['blog_view'] == 1 ? 'right' : '')?>"> <?= text($kan_post['name'])?> </span>
<?
}
if(!isset($user) || $user['blog_view'] != 1){
if($post['count'] > 0){
?>
<span class="right"> <!-- --><img src="/style/i/eye.png" alt="" class="m"> <!-- --><span class="m"><?= $post['count']?></span><!-- --> </span>
<?
}
}
?>
</div> <div class="cl"></div> </div> </div>
<?
}
if(isset($user) && $user['id'] != $ank['id']){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `notes_like` WHERE `id_user` = '".$user['id']."' AND `id_notes` = '".$post['id']."' LIMIT 1"),0) == 0){
$ico_vote_up = 'vote_up.png';
$ico_vote_down = 'vote_down.png';
}
else{
if($us_like){
$ico_vote_up = 'vote_up_on.png';
$ico_vote_down = 'vote_down.png';
}elseif($us_dlike){
$ico_vote_up = 'vote_up.png';
$ico_vote_down = 'vote_down_on.png';
}
}
}
elseif ($user['id'] == $ank['id'] || !isset($user)){
$ico_vote_up = 'vote_up_disabled.png';
$ico_vote_down = 'vote_down_disabled.png';
}
?>
<div class="cl"></div>
</div>
<?
if(!isset($user) || $user['blog_view'] != 1){
?>
<div class="oh bord-botm js-action_bar action-bar">
<table class="table__wrap table__wrap-fixed grey"> <tbody><tr>
<td class="table__cell relative m">
<a href="/user/blogs/read/?id=<?= $post['id']?>" class="link" title="Обсудить"> <img src="/style/i/action_bar/comment.png" alt="" class="m"> </a> </td>
<td class="table__cell relative m">
<span>
<span class="bmc t-padd_right">
<a href="?id=<?= $ank['id']?>&like=<?= $post['id']?>" class="arrow_link m"> <img src="/style/i/action_bar/<?= $ico_vote_up?>" alt="" class="m p16"> </a>
<span class="m <?= ($like == 0 ? 'hide' : '')?>"><?= $like?></span>
</span>
</span>
</td>
<td class="table__cell relative m bord-right0">
<span>
<span class="bmc">
<a href="?id=<?= $ank['id']?>&dlike=<?= $post['id']?>" class="arrow_link m"> <img src="/style/i/action_bar/<?= $ico_vote_down?>" alt="" class="m p16"> </a>
<span class="m <?= ($dlike == 0 ? 'hide' : '')?>"><?= $dlike?></span>
</span>
</span>
</td>
</tr> </tbody></table>
</div>
</div>
<?
}
}
if(isset($user) && $user['blog_view'] == 1){
?>
</div>
<?
}
}
?>
<a href="/user/?id=<?= $ank['id']?>" class="link darkblue return full_link"> <span class="ico ico_arrow-back"></span> Назад </a>
<?
include_once H.'sys/inc/tfoot.php';
?>