<?
function Tpl_modifier_datetime($mask,$datetime=false,$default_str='',$strtolower = false){
	if(empty($datetime)){
	  return $default_str;
	}elseif(is_numeric($datetime) && $datetime>0){
	  $UNIX_TIMESTAMP = $datetime;
	}else{
		$UNIX_TIMESTAMP = strtotime($datetime);
		if($UNIX_TIMESTAMP<=0){
			return $default_str;
		}
	}

	if(date("dmY")==date("dmY",$UNIX_TIMESTAMP)){
		return "Сегодня, в ".date("H:i",$UNIX_TIMESTAMP);
	}
	return date($mask,$UNIX_TIMESTAMP);
}

function _declension($n, $form1, $form2, $form5){
      $n = abs($n) % 100;
      $n1 = $n % 10;
      if ($n > 10 && $n < 20) return $form5;
      if ($n1 > 1 && $n1 < 5) return $form2;
      if ($n1 == 1) return $form1;
      return $form5;
}
?>