From: <pdo...@us...> - 2022-12-06 11:42:25
|
Revision: 14979 http://sourceforge.net/p/squirrelmail/code/14979 Author: pdontthink Date: 2022-12-06 11:42:23 +0000 (Tue, 06 Dec 2022) Log Message: ----------- Fix poorly written timezone parsing Modified Paths: -------------- trunk/squirrelmail/functions/date.php Modified: trunk/squirrelmail/functions/date.php =================================================================== --- trunk/squirrelmail/functions/date.php 2022-12-06 11:40:20 UTC (rev 14978) +++ trunk/squirrelmail/functions/date.php 2022-12-06 11:42:23 UTC (rev 14979) @@ -83,13 +83,16 @@ break; } $neg = false; - if (substr($tzc, 0, 1) == '-') { - $neg = true; - } else if (substr($tzc, 0, 1) != '+') { - $tzc = '+'.$tzc; + if (preg_match('/^([+-]?)(\d\d)(\d\d)$/', $tzc, $matches)) { + if ($matches[1] === '-') + $neg = true; + $hh = $matches[2]; + $mm = $matches[3]; + } else { + // anything not listed above and not in the form +0400 + // defaults to UTC + $hh = $mm = 0; } - $hh = substr($tzc,1,2); - $mm = substr($tzc,3,2); $iTzc = ($hh * 60 + $mm) * 60; if ($neg) $iTzc = -1 * (int) $iTzc; /* stamp in gmt */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |