<?

function avatar($ID, $link = true, $dir = '50', $w = '50')
{
	/**
	* 
	* @var / Аватар, модифицировали функцию с целью облегчения кода
	* 
	*/
	$avatar = mysql_fetch_array(query("SELECT id,id_gallery,ras FROM `gallery_foto` WHERE `id_user` = '$ID' AND `avatar` = '1' LIMIT 1"));
	$anks = mysql_fetch_array(mysql_query("SELECT id,pol FROM `user` WHERE `id` = ($ID) LIMIT 1"));
	if (is_file(H.'sys/gallery/' . $dir . '/' . $avatar['id'] . '.' . $avatar['ras'])) {
		return ($link == true ? '<a id="photo-' . $avatar['id'] . '" href="/foto/' . $ID . '/' . $avatar['id_gallery'] . '/' . $avatar['id'] . '/">' : false) . '
	<img class="avatar" src="/foto/foto' . $dir . '/' . $avatar['id'] . '.' . $avatar['ras'] . '" alt="Avatar"  width="' . $w . '" />' . ($link == true ? '</a>' : false);
	} else {
	return '<img class="avatar" src="/style/user/noavatar_'.($anks["pol"]== 1 ? 1 : 0).'.png" width="50" alt="No Avatar" />';
	}
	
}

function avatar_ank($ID, $link = true, $dir = '128', $w = '128')
{
	/**
	* 
	* @var / Аватар, модифицировали функцию с целью облегчения кода
	* 
	*/
	$avatar = mysql_fetch_array(query("SELECT id,id_gallery,ras FROM `gallery_foto` WHERE `id_user` = '$ID' AND `avatar` = '1' LIMIT 1"));
	$anks = mysql_fetch_array(mysql_query("SELECT id,pol FROM `user` WHERE `id` = ($ID) LIMIT 1"));
	if (is_file(H.'sys/gallery/' . $dir . '/' . $avatar['id'] . '.' . $avatar['ras'])) {
		return ($link == true ? '<a id="photo-' . $avatar['id'] . '" href="/foto/' . $ID . '/' . $avatar['id_gallery'] . '/' . $avatar['id'] . '/">' : false) . '
	<img class="avatar" src="/foto/foto' . $dir . '/' . $avatar['id'] . '.' . $avatar['ras'] . '" alt="Avatar"  width="' . $w . '" />' . ($link == true ? '</a>' : false);
	} else {
	return '<img class="avatar" src="/style/user/noavatar_'.($anks["pol"]== 1 ? 1 : 0).'.png" width="128" alt="No Avatar" />';
	}
	
}

?>