Added "months" for the ban length field

This commit is contained in:
Savetheinternet 2011-02-27 17:30:33 +11:00
parent 37f7c96f6f
commit c27027d3e0

24
mod.php
View File

@ -720,30 +720,34 @@
// 1yr2hrs30mins // 1yr2hrs30mins
// 1y2h30m // 1y2h30m
$expire = 0; $expire = 0;
if(preg_match('/^((\d+)\s?ye?a?r?s?)?\s?+((\d+)\s?we?e?k?s?)?\s?+((\d+)\s?da?y?s?)?((\d+)\s?ho?u?r?s?)?\s?+((\d+)\s?mi?n?u?t?e?s?)?\s?+((\d+)\s?se?c?o?n?d?s?)?$/', $_POST['length'], $m)) { if(preg_match('/^((\d+)\s?ye?a?r?s?)?\s?+((\d+)\s?mon?t?h?s?)?\s?+((\d+)\s?we?e?k?s?)?\s?+((\d+)\s?da?y?s?)?((\d+)\s?ho?u?r?s?)?\s?+((\d+)\s?mi?n?u?t?e?s?)?\s?+((\d+)\s?se?c?o?n?d?s?)?$/', $_POST['length'], $m)) {
if(isset($m[2])) { if(isset($m[2])) {
// Years // Years
$expire += $m[2]*60*60*24*365; $expire += $m[2]*60*60*24*365;
} }
if(isset($m[4])) { if(isset($m[4])) {
// Weeks // Months
$expire += $m[4]*60*60*24*7; $expire += $m[4]*60*60*24*30;
} }
if(isset($m[6])) { if(isset($m[6])) {
// Days // Weeks
$expire += $m[6]*60*60*24; $expire += $m[6]*60*60*24*7;
} }
if(isset($m[8])) { if(isset($m[8])) {
// Hours // Days
$expire += $m[8]*60*60; $expire += $m[8]*60*60*24;
} }
if(isset($m[10])) { if(isset($m[10])) {
// Minutes // Hours
$expire += $m[10]*60; $expire += $m[10]*60*60;
} }
if(isset($m[12])) { if(isset($m[12])) {
// Minutes
$expire += $m[12]*60;
}
if(isset($m[14])) {
// Seconds // Seconds
$expire += $m[12]; $expire += $m[14];
} }
} }
if($expire) { if($expire) {