From 10f74d90ba22b27156d12f7b706c2c91e0ae9c4c Mon Sep 17 00:00:00 2001 From: abijah Date: Sat, 8 Jan 2011 01:26:04 +0000 Subject: [PATCH] Fixed a bug with 2 digit years git-svn-id: file:///svn-source/pmgr/branches/v0.3_work/site@1003 97e9348a-65ac-dc4b-aefc-98561f571b83 --- app_controller.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app_controller.php b/app_controller.php index c081397..dc53904 100644 --- a/app_controller.php +++ b/app_controller.php @@ -952,7 +952,9 @@ class AppController extends Controller { foreach ($searches AS &$search) { if (preg_match('/(_date|stamp)$/', $search['field']) && preg_match('%(\d{1,2})[-/](\d{1,2})[-/](\d{2,4})%', $search['value'], $matches)) { - $search['value'] = sprintf('%04d%02d%02d', $matches[3], $matches[2], $matches[1]); + $search['value'] = sprintf('%04d%02d%02d', + $matches[3] + ($matches[3] < 50 ? 2000 : ($matches[3] < 100 ? 1900 : 0)), + $matches[2], $matches[1]); } } unset($search);