public static function check_time_format($timestring)
{
if (!preg_match("/([0-9]{1,2})\\.([0-9]{1,2})\\.([0-9]{2,4})-([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $timestring)) {
return false;
// WRONG format
}
$ok = 1;
$hours = substr($timestring, 11, 2);
$minutes = substr($timestring, 14, 2);
$seconds = substr($timestring, 17, 2);
if ((int) $hours >= 24) {
$ok = 0;
}
if ((int) $minutes >= 60) {
$ok = 0;
}
if ((int) $seconds >= 60) {
$ok = 0;
}
Kimai_Logger::logfile("timecheck: " . $ok);
$day = substr($timestring, 0, 2);
$month = substr($timestring, 3, 2);
$year = substr($timestring, 6, 4);
if (!checkdate((int) $month, (int) $day, (int) $year)) {
$ok = 0;
}
Kimai_Logger::logfile("time/datecheck: " . $ok);
if ($ok) {
return true;
}
return false;
}