<?php
/*
---------------------------
Функция отображения времени
---------------------------
*/
FUNCTION FTIME($time = NULL)
{
GLOBAL $user;
IF ($time == NULL){ $time = TIME(); }
$timed = "j M Y, H:i";
$timep = "".DATE($timed, $time)."";
$time_p[0] = DATE("j n Y", $time);
$time_p[1] = DATE("H:i", $time);
IF ($time_p[0] == DATE("j n Y")){ $timep = DATE("H:i", $time); }
IF (ISSET($user)){
IF ($time_p[0] == DATE("j n Y", TIME()+60*60)){ $timep = DATE("H:i", $time); }
IF ($time_p[0] == DATE("j n Y", TIME()-60*60*(24))){ $timep="".LG('Вчера в')." $time_p[1]"; }
}ELSE{
IF ($time_p[0] == DATE("j n Y")){ $timep = DATE("H:i", $time); }
if ($time_p[0] == DATE("j n Y", TIME()-60*60*24)) $timep = "".LG('Вчера в')." $time_p[1]";
}
$timep = STR_REPLACE("Jan","".LG('Янв')."", $timep);
$timep = STR_REPLACE("Feb","".LG('Фев')."", $timep);
$timep = STR_REPLACE("Mar","".LG('Мар')."", $timep);
$timep = STR_REPLACE("May","".LG('Мая')."", $timep);
$timep = STR_REPLACE("Apr","".LG('Апр')."", $timep);
$timep = STR_REPLACE("Jun","".LG('Июн')."", $timep);
$timep = STR_REPLACE("Jul","".LG('Июл')."", $timep);
$timep = STR_REPLACE("Aug","".LG('Авг')."", $timep);
$timep = STR_REPLACE("Sep","".LG('Сен')."", $timep);
$timep = STR_REPLACE("Oct","".LG('Окт')."", $timep);
$timep = STR_REPLACE("Nov","".LG('Ноя')."", $timep);
$timep = STR_REPLACE("Dec","".LG('Дек')."", $timep);
RETURN $timep;
}
FUNCTION STIME($times) {
$lama = ROUND((TIME() - $times) / 60);
IF ($lama < 1) {
$lama = LG("только что");
}
IF ($lama >= 1 && $lama < 60) {
$lama = "$lama " . LG('м. назад') . "";
}
IF ($lama >= 60 && $lama < 1440) {
$lama = ROUND($lama / 60);
$lama = "$lama " . LG('ч. назад') . "";
}
IF ($lama >= 1440) {
$lama = ROUND($lama / 60 / 24);
$lama = "$lama " . LG('д. назад') . " (" . FTIME($times) . ")";
}
RETURN $lama;
}
?>