diff options
author | Yehuda Katz <yehuda@ymkatz.net> | 2012-02-14 20:29:20 -0500 |
---|---|---|
committer | Yehuda Katz <yehuda@ymkatz.net> | 2012-02-14 20:29:20 -0500 |
commit | 4d148b596e8fa30df5cdf615518482c1ee30f735 (patch) | |
tree | dfda4240882259a65a71f26e0f0f354a88a5f406 /usr | |
parent | eaf23c171704362fdf3d7e27200ffdf540642c20 (diff) | |
download | pfsense-4d148b596e8fa30df5cdf615518482c1ee30f735.zip pfsense-4d148b596e8fa30df5cdf615518482c1ee30f735.tar.gz |
Convert strtotime() to DateTime object to fix 2038 roll-over issue.
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/system_usermanager.php | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/usr/local/www/system_usermanager.php b/usr/local/www/system_usermanager.php index 07a0241..2051a60 100644 --- a/usr/local/www/system_usermanager.php +++ b/usr/local/www/system_usermanager.php @@ -231,22 +231,18 @@ if ($_POST) { /* * Check for a valid expirationdate if one is set at all (valid means, - * strtotime() puts out a time stamp so any strtotime compatible time + * DateTime puts out a time stamp so any DateTime compatible time * format may be used. to keep it simple for the enduser, we only * claim to accept MM/DD/YYYY as inputs. Advanced users may use inputs * like "+1 day", which will be converted to MM/DD/YYYY based on "now". * Otherwhise such an entry would lead to an invalid expiration data. */ if ($_POST['expires']){ - if(strtotime($_POST['expires']) > 0){ - if (strtotime("-1 day") > strtotime(date("m/d/Y",strtotime($_POST['expires'])))) { - // Allow items to lie in the past which ends up disabling. - } else { - //convert from any strtotime compatible date to MM/DD/YYYY - $expdate = strtotime($_POST['expires']); - $_POST['expires'] = date("m/d/Y",$expdate); - } - } else { + try { + $expdate = new DateTime($_POST['expires']); + //convert from any DateTime compatible date to MM/DD/YYYY + $_POST['expires'] = $expdate->format("m/d/Y"); + } catch ( Exception $ex ) { $input_errors[] = gettext("Invalid expiration date format; use MM/DD/YYYY instead."); } } |