From 4647e1bbb5beba82605695c4dc989ca867e53244 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 23 Mar 2006 17:32:47 -0500
Subject: [PATCH] Started implementing search function

---
 program/lib/imap.inc |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index bef2de9..73eb970 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -39,6 +39,7 @@
 		- Added BCC and REFERENCE to the list of headers to fetch in iil_C_FetchHeaders()
 		- Leave messageID unchanged in iil_C_FetchHeaders()
 		- Avoid stripslahes in iil_Connect()
+		- Added patch to iil_SortHeaders() by Richard Green
 		- Removed <br> from error messages (better for logging)
 		- Removed some debuggers (echo ...)
 
@@ -1396,7 +1397,7 @@
 	if (empty($flag)) $flag="ASC";
 	$flag=strtoupper($flag);
 	$stripArr = ($field=='subject') ? array('Re: ','Fwd: ','Fw: ',"\"") : array("\"");
-	
+
 	$c=count($a);
 	if ($c>0){
 		/*
@@ -1410,8 +1411,18 @@
 		$index=array();
 		reset($a);
 		while (list($key, $val)=each($a)){
-			$data=$a[$key]->$field;
-			if (is_string($data)) $data=strtoupper(str_replace($stripArr, "", $data));
+
+			if ($field=="timestamp"){
+				$data = @strtotime($value->date);
+				if ($data != false)
+					$data = $timestamp;
+				}
+			else {
+				$data=$a[$key]->$field;
+				if (is_string($data))
+					$data=strtoupper(str_replace($stripArr, "", $data));
+				}
+
 			$index[$key]=$data;
 		}
 		

--
Gitblit v1.9.1