1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-23 23:20:57 +01:00

Fix bans of form "5d", "1y", etc. for PHP7.2

This closes #301.
This commit is contained in:
Fredrick Brennan 2018-07-27 19:06:31 +08:00
parent 814b9246d4
commit 524d48110b

View File

@ -47,31 +47,31 @@ class Bans {
if (isset($matches[2])) {
// Years
$expire += $matches[2]*60*60*24*365;
$expire += (int)$matches[2]*60*60*24*365;
}
if (isset($matches[4])) {
// Months
$expire += $matches[4]*60*60*24*30;
$expire += (int)$matches[4]*60*60*24*30;
}
if (isset($matches[6])) {
// Weeks
$expire += $matches[6]*60*60*24*7;
$expire += (int)$matches[6]*60*60*24*7;
}
if (isset($matches[8])) {
// Days
$expire += $matches[8]*60*60*24;
$expire += (int)$matches[8]*60*60*24;
}
if (isset($matches[10])) {
// Hours
$expire += $matches[10]*60*60;
$expire += (int)$matches[10]*60*60;
}
if (isset($matches[12])) {
// Minutes
$expire += $matches[12]*60;
$expire += (int)$matches[12]*60;
}
if (isset($matches[14])) {
// Seconds
$expire += $matches[14];
$expire += (int)$matches[14];
}
return time() + $expire;