View file fotov4/foto/inc/user_gallery.php

File size: 7.04Kb
<?
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']);

if (!$ank){header("Location: /foto/?".SID);exit;}

// Если вы в бане 
if (isset($user) && 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;
}


// заголовок страницы
$set['title'] = 'Фото : ' . $ank['nick']; 

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

include_once H.'sys/inc/thead.php';

title();
aut();


err();
?>
<link rel="stylesheet" href="/foto/style/style-foto.css" type="text/css" />
<div class="foto_head_bg">    
<?

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



?>
<div class="lc_br wbg font0 relative oh" id="header_path">  
<a href="/" style="font-size:0;"> <img src="/foto/style/ico/home.png" alt=""> </a>     
<span class="lc_brw"> 
<img src="/foto/style/ico/sep.png" alt="" class="lc_br_sep"> <a href="/info.php?id=<?= $ank['id']?>"><?= $ank['nick']?></a> 
</span>     
<span class="lc_brw"> 
<img src="/foto/style/ico/sep.png" alt="" class="lc_br_sep"> <a href="/foto/<?= $ank['id']?>/">Фото</a> 
</span>  
<?
if(isset($user) && $user['id'] == $ank['id']){
if (isset($_GET['act']) && $_GET['act'] == 'create'){
?>
<span class="lc_brw"> 
<img src="/foto/style/ico/sep.png" alt="" class="lc_br_sep"> <span class="lc_br_text">Создание папки</span> 
</span>
<?
}
}
?>     
</div>                 
<?


// Создание альбомов
include 'inc/gallery_new.php'; 

if (isset($user) && $ank['id'] == $user['id']){
?>
<div class="wrapper">   
<table class="table__wrap table__links"> <tbody><tr>  
<td class="table__cell" width="50%">     
<a href="?act=create" class="link -full  blue      "> 
<span><!--     --><img src="/foto/style/ico/dir_create.png" alt="" class="m"> <!--   --><span class="m">Создать папку</span><!--    --></span>  
</a>    
</td>  
<td class="table__cell table__cell_last" width="50%">     
<a href="?act=upload" class="link -full  blue      "> 
<span><!--     --><img src="/foto/style/ico/upload_blue.png" alt="" class="m"> <!--   --><span class="m"> Добавить файл</span><!--    --></span>  
</a>    
</td> 
</tr> </tbody></table>    
</div>
<?
}



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

?>
<div class="tabs_block oh">    
<div class="tab_item left tab_active black">  Папки  </div>   
<a href="/foto/<?= $ank['id']?>/all/" class="tab_item left">  Все файлы  </a>   
<a href="/foto/collections/<?= $ank['id']?>/" class="tab_item left">    Коллекции    </a>  
</div>

<?


$q = mysql_query("SELECT * FROM `gallery` WHERE `id_user` = '".$ank['id']."' AND `my` = '0' ORDER BY `id` DESC");
while ($post = mysql_fetch_assoc($q))
{
    $list[] = array('kat' => 1, 'post' => $post);
}

$q = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user` = '".$ank['id']."' AND id_gallery = '0' ORDER BY `id` DESC");
while ($post = mysql_fetch_assoc($q))
{
    $list[] = array('kat' => 0, 'post' => $post);
}

if (!isset($list))
{
    $k_post = 0;
} else {
    $k_post = sizeof($list);
}

if ($k_post == 0)
{
?>
<div class="wrapper"> <div class="block grey"> Список пуст. </div> </div>
<?
}
else{
    $set['p_str'] = '30';
    $k_page = k_page($k_post,$set['p_str']);
    $page = page($k_page);
    $start = $set['p_str']*$page-$set['p_str'];

?>
<div class="wrapper">
<div id="sz_gallery_loader" data-type="user" class="wbg oh tiles_block">
<?

    for ($i=$start; $i<$k_post && $i<$set['p_str']*$page; $i++)
    {

        if ($list[$i]['kat'] == 1)
        {

            $post = $list[$i]['post'];
            $k_c = 0;
            $k_c = $k_c+mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_user` = '".$ank['id']."' AND `id_gallery` = '".$post['id']."'"), 0);
            if (mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id_user` = '".$ank['id']."' AND `my` = '".$post['id']."'"), 0) > 0)
            {
                $q2 = mysql_query("SELECT * FROM `gallery` WHERE `id_user` = '".$ank['id']."' AND `my` = '".$post['id']."' ORDER BY `id` DESC");
                while ($post2 = mysql_fetch_assoc($q2))
                {
                    $k_c = $k_c+mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '".$post2['id']."'"), 0);
                }
            }    
    
// Cчетчик фотографий
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"),0);
$files = array('файл', 'файла', 'файлов');

if($post['pass'] != null){
$ico_name = 'dir_password';
}
else{

if($post['privat'] == 1){
$ico_name = 'dir_friends';
}
elseif($post['privat'] == 2){
$ico_name = 'dir_locked';
}
else{
$ico_name = 'dir_all';
}

}
// Хозяин
$ank_id = get_user($post['id_user']);

?>
<a class="link arrow oh" href="/foto/<?= $ank['id']?>/<?= $post['id']?>/"> 
<div class="left">   <img src="/foto/style/ico/<?= $ico_name?>.png" class="m p40" alt="">  </div> 
<div class="oh pre_content_wrap grey"> 
<b class="darkblue break-word"> <?= text($post['name'])?> </b>
<div class="pd_t5"> <?= des2num($k_c, $files)?> </div>
</div>
</a> 
<?

}
else{



$post = $list[$i]['post'];
$ank = get_user($post['id_user']);
$comm = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_komm` WHERE `id_foto` = '$post[id]'"),0);

?>
<div class=" tiled_item tiled_item-200" style="padding-top: 5px;">  
<div class="tiled_inner t_center relative">  
<span class="relative" style="display: inline-block;max-width: 100%; width: 100%;overflow: hidden;"> 
<div class="inl_bl22">        
<a class="tdn" href="/foto/<?= $ank['id']?>/<?= $post['id_gallery']?>/<?= $post['id']?>/">   
<img src="/foto/foto640/<?= $post['id']?>.<?= $post['ras']?>" class="preview preview99 s201_200"> 
<?
if ($post['metka'] == 1){
?> 
<img src="/foto/style/ico/adult.png" class="p16 f_18p" alt="">    
<?  
}
?>   
</a>             
</div>   
</span>   
<div class="tile_descr">        
<div class="pl_photo_image_info oh">  
<span class="tf grey"> 
<?
if($post['count'] > 0){
?>
<span class="inl_bl">  <img src="/foto/style/ico/eye.png" alt="" class="m">  <span class="m"><?= $post['count']?></span> </span>    
<?
}
if($comm > 0){
?>  
<span class="t-padd_left"> <img src="/foto/style/ico/com.png" class="m" alt=""> <span class="m"><?= $comm?></span> </span>    
<?
}
?>
</span>   
</div>   </div>   
</div> 
</div>
<?

}

}

?>
</div>
</div>
<?
// Вывод страниц
if ($k_page > 1)str('?', $k_page, $page); 
}
?>
<a href="/info.php?id=<?= $ank['id']?>" class="link darkblue return full_link">  <img src="/foto/style/ico/arr_back.png" alt="" class="ico_arrow-back">   Назад  </a>
<div style="height: 1px;"></div>   
</div>
<?

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