<?php
/*
* @package LabCMS
* @copyright (c) 2006 Alexander Levin aka Loki (loki_angel@mail.ru)
* @support http://labcms.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
function smarty_function_avatar($params, $template)
{
	$types=array(	1 => 'gif',
					2 => 'jpg',
					3 => 'png');
	if ($params['type'] && file_exists(LAB_PATH_STORAGE."/Image/avatars/".$params['user_id'].'.'.$types[$params['type']])) return str_replace(LAB_PATH_ROOT, '', LAB_PATH_STORAGE)."/Image/avatars/".$params['user_id'].'.'.$types[$params['type']];
	else return str_replace(LAB_PATH_ROOT, '', LAB_PATH_STORAGE)."/Image/avatars/blank.png";
}
?>