View file social/foto/inc/user_gallery_show.php

File size: 8.64Kb
<?

/*
* Autor :: Tw1nGo
* Sait ::: xSimka.Ru
*/

if (!isset($user) && !isset($_GET['id_user'])){ header("Location: /foto/?".SID);exit; }
if (isset($user))$ank['id'] = $user['id'];
if (isset($_GET['id_user']))$ank['id'] = intval($_GET['id_user']);

// Автор текущего альбома
$ank = get_user($ank['id']);

// Если не найден ID, то шлем в общие фото..
if (!$ank){header('Location: /foto/?' . SID);exit;}

// Если юзер в бане 
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `razdel` = 'foto' AND `id_user` = '$user[id]' AND (`time` > '$time' OR `view` = '0' OR `navsegda` = '1')"), 0)!=0)
{
	header('Location: /ban.php?'.SID);
	exit;
}

// Определяем ID альбома
$gallery['id'] = intval($_GET['id_gallery']);

if (mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id` = '$gallery[id]' AND `id_user` = '$ank[id]' LIMIT 1"),0) == 0)
{
	header('Location: /foto/' . $ank['id'] . '/?' . SID);
	exit;
}

$gallery = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery` WHERE `id` = '$gallery[id]' AND `id_user` = '$ank[id]' LIMIT 1"));

// заголовок страницы
$set['title'] = text($ank['nick']) . ' - ' . text($gallery['name']); 

// Редактирование альбома и загрузка фото
include 'inc/gallery_show_act.php';

include_once '../sys/inc/thead.php';
title();
aut();
err();

?><link rel="stylesheet" href="/foto/Tw1nGo.css" type="text/css" /><?

// Формы
include 'inc/gallery_show_form.php';

?>
<div class="lc_br wbg relative oh" id="header_path">  
<a href="/" style="font-size:0;" title="Главная"> <img src="/foto/img/home.png" alt="Tw1nGo"> </a>     
<span class="lc_brw"> <img src="/foto/img/sep.png" alt="Tw1nGo" class="lc_br_sep"> 
<a href="/info.php?id=<?= $ank['id']?>"><?= text($ank['nick'])?></a> </span>     
<span class="lc_brw"> <img src="/foto/img/sep.png" alt="Tw1nGo" class="lc_br_sep"> 
<a href="/foto/<?= $ank['id']?>/">Фото</a> </span>  
<span class="lc_brw"> <img src="/foto/img/sep.png" alt="Tw1nGo" class="lc_br_sep">
<a style="color: #000;"><?= text($gallery['name'])?> </a>   </span>
</div>
<?

// Подключаем приватность стр. 
include H.'sys/add/user.privace.php';

/*
* Если установлена приватность альбома
*/	
if ($gallery['privat'] == 1 && ($frend != 2 || !isset($user)) && $user['level'] <= $ank['level'] && $user['id'] != $ank['id'])
{
	echo '<div class="mess">';
	echo 'Просматривать альбом пользователя могут только его друзья!';
	echo '</div>';

	$block_foto = true;
}
elseif ($gallery['privat'] == 2 && $user['id'] != $ank['id'] && $user['level'] <= $ank['level'])
{
	echo '<div class="mess">';
	echo 'Пользователь запретил просмотр этого альбома!';
	echo '</div>';
	
	$block_foto = true;
}

/*--------------------Альбом под паролем-------------------*/
if ($user['id'] != $ank['id'] && $gallery['pass'] != NULL)
{
	if (isset($_POST['password']))
	{
		$_SESSION['pass'] = my_esc($_POST['password']);
		
		if ($_SESSION['pass'] != $gallery['pass'])
		{
			$_SESSION['message'] = 'Неверный пароль'; 
			$_SESSION['pass'] = NULL;
		}
		header("Location: ?");
	}

	if (!isset($_SESSION['pass']) || $_SESSION['pass'] != $gallery['pass'])
	{
		echo '<form action="?" method="POST">Пароль:<br /><input type="pass" name="password" value="" /><br />		
		<input type="submit" value="Войти"/></form>';
		
		echo '<div class="foot">';
		echo '<img src="/style/icons/str2.gif" alt="*"> ' . user::nick($ank['id']) . ' | <a href="/foto/' . $ank['id'] . '/">Альбомы</a> | <b>' . text($gallery['name']) . '</b>';
		echo '</div>';

		include_once '../sys/inc/tfoot.php';
		exit;
	}
}
/*---------------------------------------------------------*/

if (!isset($block_foto))
{

?>
<div class="tw1ngo_bg">
<?
if (isset($user) && $user['id'] == $ank['id']){
?>
<div class="widgets-group widgets-group_top-mrg"> 
<a href="/foto/<?= $ank['id']?>/<?= text($gallery['id'])?>/?act=upload" class="btn-single hover-item">          
<img src="/foto/img/upload_blue.png" alt="Tw1nGo" class="lc_br_sep">
<span class="list-link-blue">  Добавить фото  </span> </a>
</div>
<?
}


if (isset($user) && (user_access('foto_alb_del') || $user['id'] == $ank['id']))
{
?>
<div class="btn-single__wrap" style="margin: 10px 0;"><div class="btn-single__table-wrap dropdown-menu_top"><div class="user__tools  tl bb0 bt0" > 
<table class="table__wrap34"> <tbody><tr>  
<td class="table__cell345 tc" width="50%">  
<a class="btn-single hover-item korob" style=" margin-right: 10px;" href="/foto/<?= $ank['id']?>/<?= text($gallery['id'])?>/?edit=rename">              
<img src="/foto/img/k_edit.png" alt="Tw1nGo" class="lc_br_sep">      <span class="t list-link-blue">Редактировать</span>             
</a> </td>  
<td class="table__cell345 tc" width="50%" style="position: relative;">  
<a class="btn-single hover-item korob" href="/foto/<?= $ank['id']?>/<?= text($gallery['id'])?>/?act=delete">             
<img src="/foto/img/garbage.png" alt="Tw1nGo" class="lc_br_sep">     <span class="t list-link-blue">Удалить</span>             
</a> </td>  
</tr> </tbody></table> 
</div></div></div> 
<?
}

$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$gallery[id]'"),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];

if ($k_post == 0){
?>
<div class="widgets-group"><div class="busi"> Выбранный альбом пуст..</div></div>
<?
}

$q = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$gallery[id]' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
	
while ($post = mysql_fetch_assoc($q)){

$aaa = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_komm` WHERE `id_foto` = '$post[id]'"),0);
$Tw1nGo_avatarka = mysql_fetch_array(mysql_query("SELECT id,id_gallery,ras FROM `gallery_foto` WHERE `id_user` = '$ank[id]' AND `id` = '$post[id]' AND `avatar` = '1' LIMIT 1"));
if (isset($user) && $user['id'] == $ank['id']){
if($Tw1nGo_avatarka > 0){$diz_plus = 'padding-left: 10px;';}else{$diz_plus = '';}
}

?>
<div class="cont_usr">   
<a href="/foto/<?= $ank['id']?>/<?= $gallery['id']?>/<?= $post['id']?>/">
<div class="content-item3" style="margin-bottom:25px;">  
<div class="user__ava user__ava_big"> 
<div class="change_avatar_link js-my_avatar">
<img class="preview s81_80" style="border-radius: 5px;border: 2px solid #cdd4e1;padding:0 1px;" src="/foto/img.php?size=128&id=<?= $post['id']?>.<?= $post['ras']?>">
<?
if (isset($user) && $user['id'] == $ank['id']){
if ($Tw1nGo_avatarka > 0){
?>
<img src="/foto/img/oki_ava.png" alt="Tw1nGo" style="display:inline;margin-left:-21px;vertical-align:top;" title="Это фото установлено а аватаре..">
<?
}
}
?>
</div></div>
<div class="user__info" style="<?= $diz_plus?>">
<?
if ($post['metka'] == 1){
?><img src="/foto/img/adult_ico.png" alt="Tw1nGo" style="float:right;" title="Доступно только +18"><?
}
?>
<span class=" no_word_break"><?= text($post['name'])?></span>
<div class="user__descr">
<span class="mail__service mail__date m"><?= vremja($post['time'])?></span>
<?
if ($post['opis'] == null){ ?><br /><br /><? }else{
?><div class="mail__service mail__date m"><?= output_text($post['opis'])?></div><?
}
?>
</div></div>

</div>
</a>



<div class="user__tools user__tools_last"> 
<table class="table__wrap23 horiz_menu"> <tbody><tr> 
<?
if (isset($user) && $user['id'] == $ank['id']){
?>
<td class="table__cell" width="50%" style="border-left: 0;margin:0px;">
<?
if ($Tw1nGo_avatarka <= 1 ){
?>
<a href="/foto/<?= $ank['id']?>/<?= $gallery['id']?>/<?= $post['id']?>/?act=avatarka" class="user__tools-link mail__button" title="Поставить на Аватар">
<img src="/foto/img/foto.png" alt="Tw1nGo">
<?
}else{
?>
<a href="/foto/<?= $ank['id']?>/<?= $gallery['id']?>/<?= $post['id']?>/?act=no_avatar" class="user__tools-link mail__button" title="Убрать с Аватара">
<img src="/foto/img/piu.png" alt="Tw1nGo">
<?
}
?>
</a>
</td> 
<?
}
?> 
<td class="table__cell" width="50%" style="border-right: 0;border-left: 0;margin:0px;">
<a href="/foto/<?= $ank['id']?>/<?= $gallery['id']?>/<?= $post['id']?>/" class="user__tools-link mail__button" title="Просмотреть комментарии">
<span style="vertical-align: middle;"><img src="/foto/img/comm_ico.png" alt="Tw1nGo"></span> 
<span class="action-bar_cnt t"><?= $aaa?></span></a></td> 
</tr> </tbody></table> 
</div></div>
<?
}
	
?>
</div>
<?

// Вывод страниц
if ($k_page > 1)str('?', $k_page, $page); 
}

include_once '../sys/inc/tfoot.php';
exit;
?>