<?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);

if (!empty($_GET['from']) && is_numeric($_GET['from'])) $from = abs(intval($_GET['from'])); else go(URL);

	$arr_group = mysql_fetch_array(mysql_query("SELECT * FROM `groups` WHERE `id` = '".abs(intval($_GET['from']))."' LIMIT 1"));
	if (in_array($user_id, explode("||", substr($arr_group['blacklist'], 1, -1)))) go(URL.'/groups/?id='.abs(intval($_GET['from'])));

	require_once 'handler/del_cache.php';
	require_once 'handler/upload.php';

$title = lang('Загрузить фотографии','Завантажити фотографії');
require_once '../../incfiles/head.php';
echo group_access($arr_group);

echo '<div class="title">'.lang('Загрузить фотографию','Завантажити фотографію').'</div>';

	$arr_wall_cache = false;
	if (mysql_result(mysql_query("SELECT COUNT(`id`) FROM `wall_cache` WHERE `user_id` = '".$user_id."' LIMIT 1"),0) == true) $arr_wall_cache = mysql_fetch_array(mysql_query("SELECT * FROM `wall_cache` WHERE `user_id` = '".$user_id."' LIMIT 1"));

if ($arr_wall_cache == true && !empty($arr_wall_cache['photos']))
{
	echo '<div class="block">';
	$q = explode("||", substr($arr_wall_cache['photos'], 1, -1));
	$count = count($q);
	for ($i = 0; $i < $count; $i++)
	{
		echo '<a id="'.$i.'" class="del_cache" href="'.URL.'/groups/wall/upload.php?del_photo='.$q[$i].'&from='.$from.'"><img class="preview_icons" src="'.URL.'/files/'.($group_wall_cache==true?'groups/wall/'.$from:'wall/'.$user_id).'/photos/icons/'.$q[$i].'"/></a>';
	}
	echo '</div>';
}

if ($arr_wall_cache['count_photos'] < 10)
{
	echo '<div class="block">
	<form id="form_upload" action="'.URL.'/groups/wall/upload.php?from='.$from.'" method="post" enctype="multipart/form-data">
	<input class="input2" name="file" type="file" accept="image/jpeg,image/png,image/gif"/>
	<input class="button2" type="submit" name="upl" value="'.lang('Загрузить','Завантажити').'"/>
	</form>
	</div>';
}
echo '<div class="block"><a href="'.URL.'/groups/?id='.$from.'" onclick="Page.Go(this.href); return false">Назад</a></div>
<div class="title">'.lang('Прикрепить','Прикріпити').'</div>
<div class="content_block">
<a href="'.URL.'/photos/?id='.$user_id.'&target=group_wall&from='.$from.'" onclick="Page.Go(this.href); return false"><li>'.lang('Фотографию','Фотографію').'</li></a>
<a href="'.URL.'/audio/?id='.$user_id.'&target=group_wall&from='.$from.'" onclick="Page.Go(this.href); return false"><li>'.lang('Аудиозапись','Аудіозапис').'</li></a>
</div>';


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

?>