<?

function html($str)
{
return strtr(htmlspecialchars(stripcslashes($str),ENT_QUOTES,'UTF-8'), array('$'=>'$','%'=>'%','_'=>'_'));
}


function num($str)
{
return abs(intval($str));
}

function navigation($allpage,$query,$flp,$expanded)
{

$this_page = (isset($_GET['p'])) ? intval($_GET['p']) : 1 ;
if($this_page < 1 || $this_page > $allpage)$this_page = 1;
$prev_page = $this_page-1;
$pprev_page = $this_page-2;
$next_page = $this_page+1;
$nnext_page = $this_page+2;
if($this_page>2 && $flp == 1) $var .= "<a href='".str_replace('{p}',1,$query)."'>1</a> ... ";
if($pprev_page > 1 && $expanded == 1) $var .= "<a href='".str_replace('{p}',$pprev_page,$query)."'>$pprev_page</a> ";
$var .= ($prev_page < 1) ? "" : "<a href='".str_replace('{p}',$prev_page,$query)."'>$prev_page</a> ";
$var .= "<strong>$this_page</strong>";
$var .= ($next_page > $allpage) ? "" : " <a href='".str_replace('{p}',$next_page,$query)."'>$next_page</a>";
if($nnext_page < $allpage && $expanded == 1) $var .= " <a href='".str_replace('{p}',$nnext_page,$query)."'>$nnext_page</a>";
if($this_page<$allpage-1 && $flp == 1) $var .= " ... <a href='".str_replace('{p}',$allpage,$query)."'>$allpage</a>";

echo $var;
}

function date2($times=NULL)
{
global $db, $_GET;
$timesp=date("j M  Y в H:i", $times);
$timesp = strtr($timesp, array ("Jan" => "Янв","Feb" => "Фев","Mar" => "Марта","May" => "Мая","Apr" => "Апр","Jun" => "Июня","Jul" => "Июля","Aug" => "Авг","Sep" => "Сент","Oct" => "Окт","Nov" => "Ноября","Dec" => "Дек",));
if (isset($_GET['timesp']))$timesp='03';
return $timesp;
}

?>
