<?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=str_replace(LAB_PATH_ROOT, '', LAB_PATH_STORAGE)
		."/Image/avatars/".$params['user_id'].'.'.$types[$params['type']];
	} elseif (!$file=config::get('core.default_avatar')) {
			$file=str_replace(LAB_PATH_ROOT, '', LAB_PATH_TEMPLATE)."/default/img/blank_avatar.png";
	}
	return $file;
}

