<?php

require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';

if (empty($user_id)) {go(URL.'/');}

$title = lang('Мои Новости','Мої Новини');
require_once '../incfiles/head.php';

echo '<div class="title for_pc">
	<a href="'.URL.'/feed/" onclick="Page.Go(this.href); return false;">Записи</a>
	<a class="title_a_hover" href="'.URL.'/feed/photos.php" onclick="Page.Go(this.href); return false;">Фото</a>
	<a href="'.URL.'/feed/update.php" onclick="Page.Go(this.href); return false;">'.lang('Обновления','Оновлення').'</a>
	<a href="'.URL.'/feed/groups.php" onclick="Page.Go(this.href); return false;">'.lang('Сообщества','Спільноти').'</a>
	<a href="'.URL.'/feed/search.php" onclick="Page.Go(this.href); return false;">'.lang('Поиск','Пошук').'</a>
	</div>';
	
?>
<html>
<head>
<script type="text/javascript">
function Menu(id)
{
var menu = document.getElementById('menu_' + id).style;
if (menu.display == 'none')
{
menu.display = 'block';
}
else
{
menu.display = 'none';
}
}
</script>
</head>
</body> 
</html>


<div class="block for_mobile"><a class=" " li onclick="javascript:Menu('1')"><? echo'<img src="'.URL.'/design/img/filter.jpg" width="25" height="25" alt="filter news"/> '.lang('Фильтр новостей','Фільтр новин').''; ?></li/></div>
</a>
<ul id="menu_1" style="display:none;" >
<div class="content_block for_mobile">
<?echo'
<a href="'.URL.'/feed/" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/feed.png"/>'.lang('Записи','Записи').'</li></a>
<a href="'.URL.'/feed/photos.php" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/photo.png"/>'.lang('Фото','Фото').'  &#10004;</li></a>
<a href="'.URL.'/feed/update.php" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/users.png"/>'.lang('Обновления','Оновлення').'</li></a>
<a href="'.URL.'/feed/groups.php" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/groups.png"/>'.lang('Сообщества','Спільноти').'</li></a>
<a href="'.URL.'/feed/search.php" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/journal.png"/>'.lang('Поиск','Пошук').'</li></a>
';
?>

</div>

</ul></div>
	
	<?php	
	
	
	
	
	

$res = mysql_query("SELECT SQL_CALC_FOUND_ROWS tb1.user_id, tb1.friend_id, tb2.user_id, tb2.count_photos FROM `friends` tb1,`photos_albums` tb2 WHERE tb1.user_id = '".$user_id."' AND tb1.friend_id = tb2.user_id AND tb2.count_photos > 0");
	$all = mysql_num_rows($res);
	if ($all == true)
	{
		$cp = ceil($all/5);
		$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
		$start = $p*5-5;

		$res = mysql_query("SELECT SQL_CALC_FOUND_ROWS tb1.user_id, tb1.friend_id, tb2.id, tb2.user_id, tb2.name, tb2.uptime, tb2.count_photos FROM `friends` tb1,`photos_albums` tb2 WHERE tb2.count_photos > 0 AND tb1.user_id = '".$user_id."' AND tb1.friend_id = tb2.user_id ORDER by tb2.uptime DESC LIMIT $start,5");
		while ($arr = mysql_fetch_array($res))
		{
			echo '<div class="block2">'.user_name($arr['user_id']).'<ul><a href="'.URL.'/photos/album.php?id='.$arr['id'].'" onclick="Page.Go(this.href); return false;"><b>'.$arr['name'].'</b></a> ('.$arr['count_photos'].' фото)</ul></div><div class="block"><center>';
			$result = mysql_query("SELECT * FROM `photos_file` WHERE `aid` = '".$arr['id']."' ORDER by `time` DESC LIMIT 3");
			while ($array = mysql_fetch_array($result)) echo '<a href="'.URL.'/photos/preview.php?fid='.$array['id'].'" onclick="Page.Go(this.href); return false;"><img class="preview_mini" src="'.URL.'/files/photos/'.$arr['user_id'].'/mini/'.$array['name'].'"/></a>';
			echo '</center></div>';
		}
		navi($p,$cp,'/feed/photos.php?');
	}
	

require_once '../incfiles/foot.php';

?>