phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: felamimail/inc class.bocompose.inc.php,1.1.1.1.


From: Lars Kneschke <address@hidden>
Subject: [Phpgroupware-cvs] CVS: felamimail/inc class.bocompose.inc.php,1.1.1.1.2.8,1.1.1.1.2.9 class.bofelamimail.inc.php,1.2.2.10,1.2.2.11 class.bofilter.inc.php,1.1.2.1,1.1.2.2 class.bopreferences.inc.php,1.1.1.1.2.8,1.1.1.1.2.9 class.phpmailer.inc.php,1.1.1.1,1.1.1.1.2.1 class.smtp.php,1.1.1.1,1.1.1.1.2.1 class.socaching.inc.php,1.1.1.1.2.5,1.1.1.1.2.6 class.uicompose.inc.php,1.1.1.1.2.7,1.1.1.1.2.8 class.uidisplay.inc.php,1.1.2.2,1.1.2.3 class.uifelamimail.inc.php,1.2.2.10,1.2.2.11 class.uifilter.inc.php,1.1.2.3,1.1.2.4 hook_home.inc.php,1.1.1.1.2.4,1.1.1.1.2.5 hook_preferences.inc.php,1.2.2.5,1.2.2.6 hook_settings.inc.php,1.1.2.1,1.1.2.2
Date: Mon, 10 Mar 2003 16:54:43 -0500

Update of /cvsroot/phpgroupware/felamimail/inc
In directory subversions:/tmp/cvs-serv5806/inc

Modified Files:
      Tag: Version-0_9_14-branch
        class.bocompose.inc.php class.bofelamimail.inc.php 
        class.bofilter.inc.php class.bopreferences.inc.php 
        class.phpmailer.inc.php class.smtp.php class.socaching.inc.php 
        class.uicompose.inc.php class.uidisplay.inc.php 
        class.uifelamimail.inc.php class.uifilter.inc.php 
        hook_home.inc.php hook_preferences.inc.php 
        hook_settings.inc.php 
Log Message:
commit my work of the last weeks


Index: class.bocompose.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.bocompose.inc.php,v
retrieving revision 1.1.1.1.2.8
retrieving revision 1.1.1.1.2.9
diff -C2 -r1.1.1.1.2.8 -r1.1.1.1.2.9
*** class.bocompose.inc.php     27 Oct 2002 19:39:32 -0000      1.1.1.1.2.8
--- class.bocompose.inc.php     10 Mar 2003 21:54:39 -0000      1.1.1.1.2.9
***************
*** 100,103 ****
--- 100,104 ----
                        
                        $this->saveSessionData();
+                       #print"<pre>";print_r($this->sessionData);print"</pre>";
                }
                
***************
*** 118,121 ****
--- 119,133 ----
                }
                
+               function getErrorInfo()
+               {
+                       if(isset($this->errorInfo))
+                       {
+                               $errorInfo = $this->errorInfo;
+                               unset($this->errorInfo);
+                               return $errorInfo;
+                       }
+                       return false;
+               }
+               
                function getForwardData($_uid)
                {
***************
*** 124,128 ****
                        
                        // get message headers for specified message
!                       $headers        = 
$bofelamimail->getMessageHeaders($_uid, ST_UID);
                        
                        // check for Re: in subject header
--- 136,140 ----
                        
                        // get message headers for specified message
!                       $headers        = 
$bofelamimail->getMessageHeader($_uid);
                        
                        // check for Re: in subject header
***************
*** 142,146 ****
                        
                        // iterate through message parts
!                       if(is_array($sections))
                        {
                                for($x=0; $x<sizeof($sections); $x++)
--- 154,164 ----
                        
                        // iterate through message parts
!                       // get the body
!                       $bodyParts = $bofelamimail->getMessageBody($_uid);
!                       for($i=0; $i<count($bodyParts); $i++)
!                       {
!                               $this->sessionData['body']      .= 
$bodyParts[$i];
!                       }
! /*                    if(is_array($sections))
                        {
                                for($x=0; $x<sizeof($sections); $x++)
***************
*** 159,163 ****
                                $this->sessionData['body']      .= 
$bofelamimail->getMessageBody($_uid, '', ST_UID);
                        }
!                                                                               
                                                
                        $this->sessionData['body']       .= "\n\n               
   -----------Originalnachricht-----------\n\n";
                                        
--- 177,181 ----
                                $this->sessionData['body']      .= 
$bofelamimail->getMessageBody($_uid, '', ST_UID);
                        }
! */                                                                            
                                                
                        $this->sessionData['body']       .= "\n\n               
   -----------Originalnachricht-----------\n\n";
                                        
***************
*** 270,280 ****
                        }
                        
!                       $this->sessionData['body']      = "On " . 
$headers->Date . ", you wrote: \n>";
                        
                        // get the body
                        $bodyParts = $bofelamimail->getMessageBody($_uid);
                        for($i=0; $i<count($bodyParts); $i++)
                        {
!                               $this->sessionData['body']      .= 
str_replace("\n", "\n>", $bodyParts[$i]);
                        }
                                                                                
                                                
--- 288,311 ----
                        }
                        
!                       $this->sessionData['body']      = $headers->fromaddress 
. " ".lang("wrote").": \n>";
                        
                        // get the body
                        $bodyParts = $bofelamimail->getMessageBody($_uid);
+ 
                        for($i=0; $i<count($bodyParts); $i++)
                        {
!                               if(!empty($this->sessionData['body'])) 
$$this->sessionData['body'] .= "\n\n";
!                               // add line breaks to $bodyParts
!                               $newBody        = explode("\n",$bodyParts[$i]);
!                               
!                               // create it new, with good line breaks
!                               reset($newBody);
!                               while(list($key,$value) = @each($newBody))
!                               {
!                                       $value .= "\n";
!                                       $bodyAppend = 
wordwrap($value,70,"\n",1);
!                                       $bodyAppend = str_replace("\n", "\n>", 
$bodyAppend);
!                                       $this->sessionData['body'] .= 
htmlentities($bodyAppend);
!                               }
                        }
                                                                                
                                                
***************
*** 328,331 ****
--- 359,363 ----
                {
                        $this->sessionData = 
$GLOBALS['phpgw']->session->appsession('compose_session_data_'.$this->composeID);
+                       #print "bocompose after 
restore<pre>";print_r($this->sessionData);print"</pre>";
                }
                
***************
*** 337,340 ****
--- 369,374 ----
                function send($_formData)
                {
+                       $bofelamimail    = 
CreateObject('felamimail.bofelamimail');
+                       
                        $this->sessionData['to']        = $_formData['to'];
                        $this->sessionData['cc']        = $_formData['cc'];
***************
*** 359,367 ****
                        $mail->IsSMTP();
                        $mail->From     = $this->preferences['emailAddress'];
!                       $mail->FromName = $this->preferences['realname'];
                        $mail->Host     = 
$this->preferences['smtpServerAddress'];
                        $mail->Priority = $this->sessionData['priority'];
                        $mail->Encoding = '8bit';
                        $mail->PluginDir = PHPGW_SERVER_ROOT."/felamimail/inc/";
  
                        if (!empty($this->sessionData['to']))
--- 393,404 ----
                        $mail->IsSMTP();
                        $mail->From     = $this->preferences['emailAddress'];
!                       $mail->FromName = 
$bofelamimail->encodeHeader($this->preferences['realname']);
                        $mail->Host     = 
$this->preferences['smtpServerAddress'];
                        $mail->Priority = $this->sessionData['priority'];
                        $mail->Encoding = '8bit';
                        $mail->PluginDir = PHPGW_SERVER_ROOT."/felamimail/inc/";
+                       $mail->AddCustomHeader("X-Mailer: FeLaMiMail version 
0.9.4");
+                       if(isset($this->preferences['organizationName']))
+                               $mail->AddCustomHeader("Organization: 
".$this->preferences['organizationName']);
  
                        if (!empty($this->sessionData['to']))
***************
*** 373,377 ****
                                        {
                                                $emailAddress = 
$address_array[$i]->mailbox."@".$address_array[$i]->host;
!                                               $emailName = 
$address_array[$i]->personal;
                                                
$mail->AddAddress($emailAddress,$emailName);
                                        }
--- 410,414 ----
                                        {
                                                $emailAddress = 
$address_array[$i]->mailbox."@".$address_array[$i]->host;
!                                               $emailName = 
$bofelamimail->encodeHeader($address_array[$i]->personal);
                                                
$mail->AddAddress($emailAddress,$emailName);
                                        }
***************
*** 387,391 ****
                                        {
                                                $emailAddress = 
$address_array[$i]->mailbox."@".$address_array[$i]->host;
!                                               $emailName = 
$address_array[$i]->personal;
                                                
$mail->AddCC($emailAddress,$emailName);
                                        }
--- 424,428 ----
                                        {
                                                $emailAddress = 
$address_array[$i]->mailbox."@".$address_array[$i]->host;
!                                               $emailName = 
$bofelamimail->encodeHeader($address_array[$i]->personal);
                                                
$mail->AddCC($emailAddress,$emailName);
                                        }
***************
*** 401,405 ****
                                        {
                                                $emailAddress = 
$address_array[$i]->mailbox."@".$address_array[$i]->host;
!                                               $emailName = 
$address_array[$i]->personal;
                                                
$mail->AddBCC($emailAddress,$emailName);
                                        }
--- 438,442 ----
                                        {
                                                $emailAddress = 
$address_array[$i]->mailbox."@".$address_array[$i]->host;
!                                               $emailName = 
$bofelamimail->encodeHeader($address_array[$i]->personal);
                                                
$mail->AddBCC($emailAddress,$emailName);
                                        }
***************
*** 413,417 ****
                                {
                                        $emailAddress = 
$address_array[0]->mailbox."@".$address_array[0]->host;
!                                       $emailName = 
$address_array[0]->personal;
                                        
$mail->AddReplyTo($emailAddress,$emailName);
                                }
--- 450,454 ----
                                {
                                        $emailAddress = 
$address_array[0]->mailbox."@".$address_array[0]->host;
!                                       $emailName = 
$bofelamimail->encodeHeader($address_array[0]->personal);
                                        
$mail->AddReplyTo($emailAddress,$emailName);
                                }
***************
*** 419,423 ****
                        
                        $mail->WordWrap = 76;
!                       $mail->Subject = 
"=?iso-8859-1?Q?".imap_8bit($this->sessionData['subject'])."?=";
                        $mail->IsHTML(false);
                        $mail->Body    = $this->sessionData['body'];
--- 456,460 ----
                        
                        $mail->WordWrap = 76;
!                       $mail->Subject = 
$bofelamimail->encodeHeader($this->sessionData['subject'],'q');
                        $mail->IsHTML(false);
                        $mail->Body    = $this->sessionData['body'];
***************
*** 442,476 ****
                        #$mail->AltBody = $this->sessionData['body'];
                        
                        if(!$mail->Send())
                        {
!                               echo "Message could not be sent. <p>";
!                               echo "Mailer Error: " . $mail->ErrorInfo;
!                               exit;
!                       }
! 
!                       if ($this->preferences['move_to_sent'] == "true")
!                       {
!                               $username               = 
$this->preferences['username'];
!                               $key                    = 
$this->preferences['key'];
!                               $imapServerAddress      = 
$this->preferences['imapServerAddress'];
!                               $imapPort               = 
$this->preferences['imapPort'];
!                               $sent_folder            = 
$this->preferences['sent_folder'];
!                       
!                               include(PHPGW_APP_ROOT . 
"/inc/imap_general.php");
!                               include(PHPGW_APP_ROOT . 
"/inc/imap_mailbox.php");
!                               include(PHPGW_APP_ROOT . "/inc/smtp.php");
!                       
!                               $imap_stream = sqimap_login($username, $key, 
$imapServerAddress, $imapPort, 1);
!                               $sent_folder = trim($sent_folder);
!                               if (sqimap_mailbox_exists ($imap_stream, 
$sent_folder)) 
!                               {
!                                       sqimap_append ($imap_stream, 
$sent_folder, 
!                                               
strlen($mail->create_header())+strlen($mail->create_body()));
!                                       fputs ($imap_stream, 
$mail->create_header());
!                                       fputs ($imap_stream, 
$mail->create_body());
!                                       sqimap_append_done ($imap_stream);
!                               }
!                               sqimap_logout($imap_stream);
                        }
                        if(isset($this->sessionData['uid']))
                        {
--- 479,506 ----
                        #$mail->AltBody = $this->sessionData['body'];
                        
+                       // SMTP Auth??
+                       if($this->preferences['smtpAuth'] == 'yes')
+                       {
+                               $mail->SMTPAuth = true;
+                               $mail->Username = 
$this->preferences['username'];
+                               $mail->Password = $this->preferences['key'];
+                       }
+                       
+                       #$mail->SMTPDebug = 10;
                        if(!$mail->Send())
                        {
!                               $this->errorInfo = $mail->ErrorInfo;
!                               return false;
                        }
+ 
+                       if (isset($this->preferences['sentFolder']))
+                       {
+                               // mark message as answered
+                               $bofelamimail = 
CreateObject('felamimail.bofelamimail');
+                               
$bofelamimail->openConnection($this->preferences['sentFolder']);
+                               
$bofelamimail->appendMessage($this->preferences['sentFolder'],$mail->sentHeader,$mail->sentBody);
+                               $bofelamimail->closeConnection();
+                       }
+ 
                        if(isset($this->sessionData['uid']))
                        {
***************
*** 481,484 ****
--- 511,515 ----
                                $bofelamimail->closeConnection();
                        }
+ 
                        while(list($key,$value) = 
@each($this->sessionData['attachments']))
                        {
***************
*** 489,492 ****
--- 520,525 ----
                        $this->sessionData = '';
                        $this->saveSessionData();
+                       
+                       return true;
                }
                

Index: class.bofelamimail.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.bofelamimail.inc.php,v
retrieving revision 1.2.2.10
retrieving revision 1.2.2.11
diff -C2 -r1.2.2.10 -r1.2.2.11
*** class.bofelamimail.inc.php  27 Oct 2002 19:39:32 -0000      1.2.2.10
--- class.bofelamimail.inc.php  10 Mar 2003 21:54:40 -0000      1.2.2.11
***************
*** 18,22 ****
                var $public_functions = array
                (
-                       'updateImapStatus'      => True,
                        'flagMessages'          => True
                );
--- 18,21 ----
***************
*** 46,49 ****
--- 45,50 ----
                                // default start message
                                $this->sessionData['startMessage']      = 1;
+                               // default mailbox for preferences pages
+                               $this->sessionData['preferences']['mailbox']    
= "INBOX";
                                // default sorting
                                
if(!empty($GLOBALS['phpgw_info']['user']['preferences']['felamimail']['sortOrder']))
***************
*** 69,77 ****
                }
                
                function closeConnection()
                {
                        imap_close($this->mbox);
                }
! 
                function compressFolder()
                {
--- 70,120 ----
                }
                
+               function appendMessage($_folder, $_header, $_body)
+               {
+                       #print "<pre>$_header.$_body</pre>";
+                       $mailboxString = $this->createMailboxString($_folder);
+                       $header = str_replace("\n","\r\n",$_header);
+                       $body   = str_replace("\n","\r\n",$_body);
+                       #$result = @imap_append($this->mbox, $mailboxString, 
"$header"."$_body");
+                       $result = @imap_append($this->mbox, $mailboxString, 
"$header"."$body");
+                       print imap_last_error();
+                       return $result;
+               }
+               
                function closeConnection()
                {
                        imap_close($this->mbox);
                }
!               
!               // creates the mailbox string needed for the various imap 
functions
!               function createMailboxString($_folderName='')
!               {
!                       switch($this->mailPreferences['imap_server_type'])
!                       {
!                               case "imap":
!                                       $mailboxString = 
sprintf("{%s:%s/novalidate-cert}%s",
!                                                       
$this->mailPreferences['imapServerAddress'],
!                                                       
$this->mailPreferences['imapPort'],
!                                                       $_folderName);
!                                       break;
!                                       
!                               case "imaps-encr-only":
!                                       $mailboxString = 
sprintf("{%s:%s/ssl/novalidate-cert}%s",
!                                               
$this->mailPreferences['imapServerAddress'],
!                                               
$this->mailPreferences['imapPort'],
!                                               $_folderName);
!                                       break;
!                                       
!                               case "imaps-encr-auth":
!                                       $mailboxString = 
sprintf("{%s:%s/ssl}%s",
!                                               
$this->mailPreferences['imapServerAddress'],
!                                               
$this->mailPreferences['imapPort'],
!                                               $_folderName);
!                                       break;
!                       }
!                       
!                       return imap_utf7_encode($mailboxString);
!               }
!               
                function compressFolder()
                {
***************
*** 101,123 ****
                }
  
-               function decode_header2($_charset, $_string)
-               {
-                       $_string = str_replace('_', ' ', $_string);
-                       $string = quoted_printable_decode($_string);
-                       return $string;
-               }
- 
                function decode_header($string)
                {
!                       /* Decode from qp or base64 form */
!                       if (preg_match("/\=\?(.*?)\?b\?/i", $string))
                        {
!                               $string = ereg_replace("'", "\'", $string);
!                               $string = 
preg_replace("/\=\?(.*?)\?b\?(.*?)\?\=/ieU","base64_decode('\\2')",$string);
                                return $string;
                        }
!                       if (preg_match("/\=\?(.*?)\?q\?/i", $string))
                        {
!                               $string = 
preg_replace("/\=\?(.*?)\?q\?(.*?)\?\=/ie","\$this->decode_header2('\\1','\\2')",$string);
                                return $string;
                        }
--- 144,173 ----
                }
  
                function decode_header($string)
                {
!                       /* Decode from base64 form */
!                       if (preg_match_all("/\=\?(.*?)\?b\?(.*?)\?\=/i", 
$string, $matches, PREG_SET_ORDER))
                        {
!                               for($i=0; $i < count($matches); $i++)
!                               {
!                                       #print "Match 
0:".$matches[$i][0]."<br>";
!                                       #print "Match 
1:".$matches[$i][1]."<br>";
!                                       #print "Match 
2:".$matches[$i][2]."<br>";
!                                       $string = 
str_replace($matches[$i][0],base64_decode($matches[$i][2]),$string);
!                               }
                                return $string;
                        }
!                       /* Decode from qp */
!                       elseif (preg_match_all("/\=\?(.*?)\?q\?(.*?)\?\=/i", 
$string, $matches, PREG_SET_ORDER))
                        {
!                               for($i=0; $i < count($matches); $i++)
!                               {
!                                       #print "Match 
0:".$matches[$i][0]."<br>";
!                                       #print "Match 
1:".$matches[$i][1]."<br>";
!                                       #print "Match 
2:".$matches[$i][2]."<br>";
!                                       // replace any _ with " ". You define " 
" as " " or "_" in qouted printable
!                                       $matches[$i][2] = str_replace("_"," 
",$matches[$i][2]);
!                                       $string = 
str_replace($matches[$i][0],imap_qprint($matches[$i][2]),$string);
!                               }
                                return $string;
                        }
***************
*** 186,189 ****
--- 236,268 ----
                }
                
+               function encodeHeader($_string, $_encoding="q")
+               {
+                       switch($_encoding)
+                       {
+                               case "q":
+                                       
if(!preg_match("/[\x80-\xFF]/",$_string))
+                                       {
+                                               // nothing to quote, only 7 bit 
ascii
+                                               return $_string;
+                                       }
+                                       
+                                       $string = imap_8bit($_string);
+                                       $stringParts = explode("=\r\n",$string);
+                                       while(list($key,$value) = 
each($stringParts))
+                                       {
+                                               if(!empty($retString)) 
$retString .= " ";
+                                               $value = str_replace(" 
","_",$value);
+                                               // imap_8bit does not convert 
"?"
+                                               // it does not need, but it 
should
+                                               $value = 
str_replace("?","=3F",$value);
+                                               $retString .= 
"=?ISO-8859-1?Q?".$value."?=";
+                                       }
+                                       #exit;
+                                       return $retString;
+                                       break;
+                               default:
+                                       return $_string;
+                       }
+               }
                function flagMessages($_flag, $_messageUID)
                {
***************
*** 226,239 ****
                        // parse message structure
                        $structure = imap_fetchstructure($this->mbox, $_uid, 
FT_UID);
!                       $sections = $this->parse($structure);
                        
                        // look for specified part
!                       for($x=0; $x<sizeof($sections); $x++)
                        {
!                               if($sections[$x]["pid"] == $_partID)
                                {
!                                       $type = $sections[$x]["type"];
!                                       $encoding = $sections[$x]["Encoding"];
!                                       $filename = $sections[$x]["name"];
                                }
                        }
--- 305,321 ----
                        // parse message structure
                        $structure = imap_fetchstructure($this->mbox, $_uid, 
FT_UID);
!                       $this->structure = array();
!                       $this->parse2($structure);
!                       $sections = $this->structure;
                        
                        // look for specified part
!                       while(list($key,$value) = each($sections))
                        {
!                               #print $value["pid"]." ".$_partID."<br>";
!                               if($value["pid"] == $_partID)
                                {
!                                       $type = $value["type"];
!                                       $encoding = $value["encoding"];
!                                       $filename = $value["name"];
                                }
                        }
***************
*** 272,280 ****
                function get_attachments($arr)
                {
!                       for($x=0; $x<sizeof($arr); $x++)
                        {
!                               if($arr[$x]["disposition"] == "attachment")
                                {
!                                       $ret[] = $arr[$x];
                                }
                        }
--- 354,365 ----
                function get_attachments($arr)
                {
!                       reset($arr);
!                       while(list($key,$value) = @each($arr))
                        {
!                               if(strtolower($value["disposition"])            
== "attachment" ||
!                                       strtolower($value["disposition"])       
== "inline" ||
!                                       ($value["type"] != "text/plain" && 
substr($value["type"],0,9) != "multipart"))
                                {
!                                       $ret[] = $value;
                                }
                        }
***************
*** 283,292 ****
                }
                
!               function getFolderList($_subscribedOnly)
                {
!                       $mailboxString = sprintf("{%s:%s}%s",
                                        
$this->mailPreferences['imapServerAddress'],
                                        $this->mailPreferences['imapPort'],
!                                       imap_utf7_encode($this->imapBaseDir));
                
                        if($_subscribedOnly == 'true')
--- 368,396 ----
                }
                
!               function getFolderStatus($_folderName)
                {
!                       // now we have the keys as values
!                       $subscribedFolders = $this->getFolderList(true);
!                       #print_r($subscribedFolders);
!                       #print $subscribedFolders[$_folderName]." - 
$_folderName<br>";
!                       if(isset($subscribedFolders[$_folderName]))
!                       {
!                               $retValue['subscribed'] = true;
!                       }
!                       else
!                       {
!                               $retValue['subscribed'] = false;
!                       }
!                       
!                       return $retValue;
!               }
!               
!               function getFolderList($_subscribedOnly=false)
!               {
!                       /*$mailboxString = sprintf("{%s:%s}%s",
                                        
$this->mailPreferences['imapServerAddress'],
                                        $this->mailPreferences['imapPort'],
!                                       imap_utf7_encode($this->imapBaseDir));*/
!                       $mailboxString = 
$this->createMailboxString($this->imapBaseDir);
                
                        if($_subscribedOnly == 'true')
***************
*** 303,310 ****
                                while (list($key, $val) = each($list))
                                {
!                                       $folders[] = 
preg_replace("/{.*}/","",$val->name);
!                                       
                                }
!                               sort($folders,SORT_STRING);
                                reset($folders);
                                return $folders;
--- 407,431 ----
                                while (list($key, $val) = each($list))
                                {
!                                       // remove the {host:port/imap/...} part
!                                       $folderNameIMAP = 
imap_utf7_decode(preg_replace("/{.*}/","",$val->name));
!                                       $folderParts = 
explode(".",$folderNameIMAP);
!                                       reset($folderParts);
!                                       $displayName = "";
!                                       #print_r($folderParts);print"<br>";
!                                       for($i=0; $i<count($folderParts); $i++)
!                                       {
!                                               if($i+1 == count($folderParts))
!                                               {
!                                                       $displayName .= 
$folderParts[$i];
!                                               }
!                                               else
!                                               {
!                                                       $displayName .= ". . ";
!                                               }
!                                       }
!                                       $folders["$folderNameIMAP"] = 
$displayName;
                                }
!                               #exit;
!                               ksort($folders,SORT_STRING);
                                reset($folders);
                                return $folders;
***************
*** 353,367 ****
                                        $attachments = 
$this->get_attachments($sections);
                                        
!                                       if (isset($header->date))
!                                       {
!                                               $header->date = ereg_replace('  
', ' ', $header->date);
!                                               $tmpdate = explode(' ', 
trim($header->date));
!                                       }
!                                       else
!                                       {
!                                               $tmpdate = $date = 
array("","","","","","");
!                                       }
!                                       $messageData['date']            = 
date("Y-m-d H:i:s",$transformdate->getTimeStamp($tmpdate));
!                                       
                                        $messageData['subject']         = 
$header->subject;
                                        $messageData['to_name']         = 
$header->to[0]->personal;
--- 474,478 ----
                                        $attachments = 
$this->get_attachments($sections);
                                        
!                                       $messageData['date']            = 
$header->udate;
                                        $messageData['subject']         = 
$header->subject;
                                        $messageData['to_name']         = 
$header->to[0]->personal;
***************
*** 405,419 ****
                                        $attachments = 
$this->get_attachments($sections);
                                
!                                       if (isset($header->date)) 
!                                       {       
!                                               $header->date = ereg_replace('  
', ' ', $header->date);
!                                               $tmpdate = explode(' ', 
trim($header->date));
!                                       }
!                                       else
!                                       {
!                                               $tmpdate = $date = 
array("","","","","","");    
!                                       }
!                                       $messageData['date']            = 
date("Y-m-d H:i:s",$transformdate->getTimeStamp($tmpdate));
!                               
                                        $messageData['subject']         = 
$header->subject;
                                        $messageData['to_name']         = 
$header->to[0]->personal;
--- 516,520 ----
                                        $attachments = 
$this->get_attachments($sections);
                                
!                                       $messageData['date']            = 
$header->udate;
                                        $messageData['subject']         = 
$header->subject;
                                        $messageData['to_name']         = 
$header->to[0]->personal;
***************
*** 462,466 ****
                        // now lets gets the important messages
                        $filterList = $bofilter->getFilterList();
!                       $activeFilter = $this->sessionData['activeFilter'];
                        $filter = $filterList[$activeFilter];
                        $displayHeaders = $caching->getHeaders($_startMessage, 
$_numberOfMessages, $_sort, $filter);
--- 563,567 ----
                        // now lets gets the important messages
                        $filterList = $bofilter->getFilterList();
!                       $activeFilter = $bofilter->getActiveFilter();
                        $filter = $filterList[$activeFilter];
                        $displayHeaders = $caching->getHeaders($_startMessage, 
$_numberOfMessages, $_sort, $filter);
***************
*** 470,473 ****
--- 571,577 ----
                        {
                                $header = 
imap_fetch_overview($this->mbox,$displayHeaders[$i]['uid'],FT_UID);
+                               #print $header[0]->date;print "<br>";
+                               #print_r($displayHeaders[$i]);print "<br>";
+                               #print_r($header);exit;
  
                                #$rawHeader = 
imap_fetchheader($this->mbox,$displayHeaders[$i]['uid'],FT_UID);
***************
*** 481,495 ****
                                $retValue['header'][$count]['attachments']      
= $displayHeaders[$i]['attachments'];
                                $retValue['header'][$count]['size']             
= $header[0]->size;
-                               if (isset($header[0]->date)) 
-                               {       
-                                       $header[0]->date = ereg_replace('  ', ' 
', $header[0]->date);
-                                       $tmpdate = explode(' ', 
trim($header[0]->date));
-                               }
-                               else
-                               {
-                                       $tmpdate = $date = 
array("","","","","","");    
-                               }
  
!                               $timestamp = 
$transformdate->getTimeStamp($tmpdate);
                                $timestamp7DaysAgo = 
                                        mktime(date("H"), date("i"), date("s"), 
date("m"), date("d")-7, date("Y"));
--- 585,590 ----
                                $retValue['header'][$count]['attachments']      
= $displayHeaders[$i]['attachments'];
                                $retValue['header'][$count]['size']             
= $header[0]->size;
  
!                               $timestamp = $displayHeaders[$i]['date'];
                                $timestamp7DaysAgo = 
                                        mktime(date("H"), date("i"), date("s"), 
date("m"), date("d")-7, date("Y"));
***************
*** 511,514 ****
--- 606,610 ----
                                        $retValue['header'][$count]['date'] = 
lang(date("l",$timestamp));
                                        #$retValue['header'][$count]['date'] = 
date("Y-m-d H:i:s",$timestamp7DaysAgo)." - ".date("Y-m-d",$timestamp);
+                                       $retValue['header'][$count]['date'] = 
date("H:i:s",$timestamp)."(".lang(date("D",$timestamp)).")";
                                }
                                else
***************
*** 542,552 ****
                        }
                }
! 
                function getMessageAttachments($_uid)
                {
                        $structure = imap_fetchstructure($this->mbox, $_uid, 
FT_UID);
!                       if(sizeof($structure->parts) > 1)
                        {
!                               $sections = $this->parse($structure);
                                return $this->get_attachments($sections);
                        }
--- 638,656 ----
                        }
                }
!               
!               function getMailPreferences()
!               {
!                       return $this->mailPreferences;
!               }
!               
                function getMessageAttachments($_uid)
                {
                        $structure = imap_fetchstructure($this->mbox, $_uid, 
FT_UID);
!                       if(sizeof($structure->parts) > 0 && 
is_array($structure->parts))
                        {
!                               $this->structure = array();
!                               $this->parse2($structure);
!                               $sections = $this->structure;
!                               #$sections = $this->parse($structure);
                                return $this->get_attachments($sections);
                        }
***************
*** 556,593 ****
                {
                        $structure = imap_fetchstructure($this->mbox, $_uid, 
FT_UID);
!                       if(sizeof($structure->parts) > 1)
                        {
!                               $sections = $this->parse($structure);
                        }
                        
                        if(is_array($sections))
                        {
!                               for($x=0; $x<sizeof($sections); $x++)
                                {
                                        unset($newPart);
!                                       #print "getMessageBody<br>";
!                                       #print $sections[$x]["type"]."<br>";
!                                       #print 
$sections[$x]["disposition"]."<br>";
!                                       #print 
$sections[$x]["disposition"]."<br>";
!                                       #print 
stripslashes(trim(imap_fetchbody($this->mbox, $_uid, $sections[$x]["pid"], 
FT_UID)))."<br>";
!                                       if(($sections[$x]["type"] == 
"text/plain" || 
!                                               $sections[$x]["type"] == 
"message/rfc822") && 
!                                               $sections[$x]["disposition"] != 
"attachment")
!                                       {
!                                               $newPart = 
stripslashes(trim(imap_fetchbody($this->mbox, $_uid, $sections[$x]["pid"], 
FT_UID)));
!                                       }
!                                       
!                                       // a hack for Outlook
!                                       // fetch x.1 because this is the text 
part
!                                       if($sections[$x]["type"] == 
"multipart/alternative" &&
!                                               $sections[$x]["disposition"] != 
"attachment")
!                                       {
!                                               $newPart = 
stripslashes(trim(imap_fetchbody($this->mbox, $_uid, $sections[$x]["pid"].".1", 
FT_UID)));
!                                               // hack!!!
!                                               $sections[$x]['Encoding'] = 
ENCQUOTEDPRINTABLE;
                                        }
                                        if(isset($newPart)) 
                                        {
!                                       switch ($sections[$x]['Encoding']) 
                                        {
                                                case ENCBASE64:
--- 660,690 ----
                {
                        $structure = imap_fetchstructure($this->mbox, $_uid, 
FT_UID);
!                       if(sizeof($structure->parts) > 0 && 
is_array($structure->parts))
                        {
!                               #print 
"<pre>";print_r($structure);print"</pre>";
!                               $this->structure = array();
!                               $this->parse2($structure);
!                               $sections = $this->structure;
!                               #print 
"<hr><pre>";print_r($this->structure);print"</pre>";
                        }
                        
                        if(is_array($sections))
                        {
!                               reset($sections);
!                               while(list($key,$value) = each($sections))
!                               #for($x=0; $x<sizeof($sections); $x++)
                                {
                                        unset($newPart);
!                                       if(($value["type"] == "text/plain" || 
!                                               $value["type"] == 
"message/rfc822") && 
!                                               
strtolower($value["disposition"]) != "attachment")
!                                       {
!                                               $newPart = 
stripslashes(trim(imap_fetchbody($this->mbox, $_uid, $value["pid"], FT_UID)));
!                                               $newPart = 
imap_fetchbody($this->mbox, $_uid, $value["pid"], FT_UID);
                                        }
+                                       
                                        if(isset($newPart)) 
                                        {
!                                       switch ($value['encoding']) 
                                        {
                                                case ENCBASE64:
***************
*** 611,629 ****
                        else
                        {
!                               $newPart = 
stripslashes(trim(imap_body($this->mbox, $_uid, FT_UID)));
                                switch ($structure->encoding) 
                                {
                                        case ENCBASE64:
                                                // use imap_base64 to decode
                                                $newPart = 
imap_base64($newPart);
                                                break;
                                        case ENCQUOTEDPRINTABLE:
                                                // use imap_qprint to decode
!                                               $newPart = 
imap_qprint($newPart);
                                                break;
                                        case ENCOTHER:
                                                // not sure if this needs 
decoding at all
                                                break;
                                        default:
                                                // it is either not encoded or 
we don't know about it
                                }
--- 708,731 ----
                        else
                        {
!                               #print imap_body($this->mbox, $_uid, FT_UID);
                                switch ($structure->encoding) 
                                {
                                        case ENCBASE64:
                                                // use imap_base64 to decode
+                                               $newPart = 
stripslashes(trim(imap_body($this->mbox, $_uid, FT_UID)));
                                                $newPart = 
imap_base64($newPart);
                                                break;
                                        case ENCQUOTEDPRINTABLE:
                                                // use imap_qprint to decode
!                                               $newPart = 
imap_body($this->mbox, $_uid, FT_UID);
!                                               $newPart = 
quoted_printable_decode($newPart);
                                                break;
                                        case ENCOTHER:
+                                               $newPart = 
stripslashes(trim(imap_body($this->mbox, $_uid, FT_UID)));
                                                // not sure if this needs 
decoding at all
                                                break;
                                        default:
+                                               $newPart = 
stripslashes(trim(imap_body($this->mbox, $_uid, FT_UID)));
+                                               $newPart = 
imap_body($this->mbox, $_uid, FT_UID);
                                                // it is either not encoded or 
we don't know about it
                                }
***************
*** 649,653 ****
--- 751,802 ----
                        return imap_fetchstructure($this->mbox, $_uid, FT_UID);
                }
+               
+               function imap_createmailbox($_folderName, $_subscribe = False)
+               {
+                       $mailboxString = 
$this->createMailboxString($_folderName);
+                       
+                       $result = 
@imap_createmailbox($this->mbox,$mailboxString);
+                       
+                       if($_subscribe)
+                       {
+                               return 
@imap_subscribe($this->mbox,$mailboxString);
+                       }
+                       
+                       return $result;
+               }
+               
+               function imap_deletemailbox($_folderName)
+               {
+                       $mailboxString = 
$this->createMailboxString($_folderName);
+                       
+                       $result = imap_deletemailbox($this->mbox, 
$mailboxString);
+                       
+                       #print imap_last_error();
+                       
+                       return $result;
+               }
  
+               function imap_get_quotaroot($_folderName)
+               {
+                       return @imap_get_quotaroot($this->mbox, $_folderName);
+               }
+               
+               function imap_renamemailbox($_oldMailboxName, $_newMailboxName)
+               {
+                       if(strcasecmp("inbox",$_oldMailboxName) == 0 || 
strcasecmp("inbox",$_newMailboxName) == 0)
+                       {
+                               return False;
+                       }
+                       
+                       $oldMailboxName = 
$this->createMailboxString($_oldMailboxName);
+                       $newMailboxName = 
$this->createMailboxString($_newMailboxName);
+                       
+                       $result =  
@imap_renamemailbox($this->mbox,$oldMailboxName, $newMailboxName);
+                       
+                       #print imap_last_error();
+                       
+                       return $result;
+               }
+               
                function moveMessages($_foldername, $_messageUID)
                {
***************
*** 688,702 ****
                }
  
!               function openConnection($_folderName='')
                {
!                       $mailboxString = sprintf("{%s:%s}%s",
!                                       
$this->mailPreferences['imapServerAddress'],
!                                       $this->mailPreferences['imapPort'],
!                                       
imap_utf7_encode($this->sessionData['mailbox']));
! 
!                       $this->mbox = imap_open ($mailboxString, 
!                                       $this->mailPreferences['username'], 
$this->mailPreferences['key']);
                        
                }               
                // this function is based on a on "Building A PHP-Based Mail 
Client"
                // http://www.devshed.com
--- 837,863 ----
                }
  
!               function openConnection($_folderName='',$_options=0)
                {
!                       if($_folderName == '')
!                       {
!                               $_folderName = $this->sessionData['mailbox'];
!                       }
!                       
!                       $mailboxString = 
$this->createMailboxString($_folderName);
!                       
!                       if(!$this->mbox = @imap_open ($mailboxString, 
!                                       $this->mailPreferences['username'], 
$this->mailPreferences['key'], $_options))
!                       {
!                               return imap_last_error();
!                       }
!                       else
!                       {
!                               #$header = imap_headerinfo($this->mbox, 107);
!                               
#print"<pre>";print_r($header);print"</pre>";exit;
!                               return True;
!                       }
                        
                }               
+ 
                // this function is based on a on "Building A PHP-Based Mail 
Client"
                // http://www.devshed.com
***************
*** 709,713 ****
                        $parts = $structure->parts;
                                                                                
                                
-                       
                        for($x=0; $x<sizeof($parts); $x++)
                        {
--- 870,873 ----
***************
*** 734,738 ****
                                
                                        $params = $part->dparameters;
!                                       foreach ($params as $p)
                                        {
                                                if($p->attribute == "FILENAME")
--- 894,906 ----
                                
                                        $params = $part->dparameters;
!                                       #foreach ($params as $p)
!                                       #{
!                                       #       if($p->attribute == "FILENAME")
!                                       #       {
!                                       #               $ret[$x]["name"] = 
$p->value;
!                                       #               break;
!                                       #       }
!                                       #}
!                                       while (list(, $p) = @each($params)) 
                                        {
                                                if($p->attribute == "FILENAME")
***************
*** 748,751 ****
--- 916,1166 ----
                }
                
+ 
+               // this function is based on
+               // 
http://www.bitsense.com/PHPNotes/IMAP/imap_fetchstructure.asp/
+               function parse2($this_part,$part_no="")
+               {
+                               if ($this_part->ifdisposition && 
strtolower($this_part->disposition) == "attachment") 
+                               {
+                                       // See if it has a disposition
+                                       // The only thing I know of that this
+                                       // would be used for would be an 
attachment
+                                       // Lets check anyway
+                                       if (strtolower($this_part->disposition) 
== "attachment" ||
+                                               
strtolower($this_part->disposition) == "inline" ) 
+                                       {
+                                               
$this->structure[$part_no]['encoding']  = $this_part->encoding;
+                                               
$this->structure[$part_no]['size']      = $this_part->bytes;
+                                               
$this->structure[$part_no]['disposition']       = $this_part->disposition;
+                                               
$this->structure[$part_no]['pid']       = $part_no;
+                                               
$this->structure[$part_no]["type"]      = $mime_type."/". 
strtolower($this_part->subtype);
+                                               // If it is an attachment, then 
we let people download it
+                                               // First see if they sent a 
filename
+                                               $att_name = lang("unknown");
+                                               if($this_part->ifparameters)
+                                               {
+                                                       for ($lcv = 0; $lcv < 
count($this_part->parameters); $lcv++) 
+                                                       {
+                                                               $param = 
$this_part->parameters[$lcv];
+                                                               if 
(strtolower($param->attribute) == "name") 
+                                                               {
+                                                                       
$this->structure[$part_no]["name"] = $param->value;
+                                                                       break;
+                                                               }
+                                                       }
+                                               }
+                                               if($this_part->ifdparameters)
+                                               {
+                                                       for ($lcv = 0; $lcv < 
count($this_part->dparameters); $lcv++) 
+                                                       {
+                                                               $param = 
$this_part->dparameters[$lcv];
+                                                               if 
(strtolower($param->attribute) == "filename") 
+                                                               {
+                                                                       
$this->structure[$part_no]["name"] = $param->value;
+                                                                       break;
+                                                               }
+                                                       }
+                                               }
+                                               // You could give a link to 
download the attachment here....
+                                               switch ($this_part->type) 
+                                               {
+                                                       case TYPETEXT:
+                                                               $mime_type = 
"text";
+                                                               break;
+                                                       case TYPEMULTIPART:
+                                                               $mime_type = 
"multipart";
+                                                               break;
+                                                       case TYPEMESSAGE:
+                                                               $mime_type = 
"message";
+                                                               break;
+                                                       case TYPEAPPLICATION:
+                                                               $mime_type = 
"application";
+                                                               break;
+                                                       case TYPEAUDIO:
+                                                               $mime_type = 
"audio";
+                                                               break;
+                                                       case TYPEIMAGE:
+                                                               $mime_type = 
"image";
+                                                               break;
+                                                       case TYPEVIDEO:
+                                                               $mime_type = 
"video";
+                                                               break;
+                                                       case TYPEMODEL:
+                                                               $mime_type = 
"model";
+                                                               break;
+                                                       default:
+                                                               $mime_type = 
"unknown";
+                                                               // hmmm....
+                                               }
+                                               
$this->structure[$part_no]["type"] = $mime_type."/". 
strtolower($this_part->subtype);
+                                       } 
+                                       else 
+                                       {
+                                               // disposition can also be used 
for images in HTML (Inline)
+                                       }
+                               }
+                               else
+                               {
+                                       // Not an attachment, lets see what 
this part is...
+                                       #print "Type: ".$this_part->type."<br>";
+                                       switch ($this_part->type) 
+                                       {
+                                               case TYPETEXT:
+                                                       $mime_type = "text";
+                                                       
$this->structure[$part_no]['encoding']  = $this_part->encoding;
+                                                       
$this->structure[$part_no]['size']      = $this_part->bytes;
+                                                       
$this->structure[$part_no]['pid']       = $part_no;
+                                                       
$this->structure[$part_no]["type"]      = $mime_type."/". 
strtolower($this_part->subtype);
+                                                       
$this->structure[$part_no]["name"]      = lang("unknown");
+                                                       for ($lcv = 0; $lcv < 
count($this_part->parameters); $lcv++) 
+                                                       {
+                                                               $param = 
$this_part->parameters[$lcv];
+                                                               if 
(strtolower($param->attribute) == "name") 
+                                                               {
+                                                                       
$this->structure[$part_no]["name"] = $param->value;
+                                                                       break;
+                                                               }
+                                                       }
+                                                       break;
+                                               
+                                               case TYPEMULTIPART:
+                                                       $mime_type = 
"multipart";
+                                                       #print "found 
$mime_type<br>";
+                                                       // Hey, why not use 
this function to deal with all the parts
+                                                       // of this multipart 
part :)
+                                                       for ($i = 0; $i < 
count($this_part->parts); $i++) 
+                                                       {
+                                                               if ($part_no != 
"") 
+                                                               {
+                                                                       
$part_no = $part_no.".";
+                                                               }
+                                                               
$this->structure[$part_no.($i + 1)]['encoding'] = $this_part->encoding;
+                                                               
$this->structure[$part_no.($i + 1)]['size']     = $this_part->bytes;
+                                                               
$this->structure[$part_no.($i + 1)]['pid']      = $part_no.($i + 1);
+                                                               
$this->structure[$part_no.($i + 1)]["type"]     = $mime_type."/". 
strtolower($this_part->subtype);
+                                                               for ($i = 0; $i 
< count($this_part->parts); $i++) 
+                                                               {
+                                                                       
$this->parse2($this_part->parts[$i], $part_no.($i + 1));
+                                                               }
+                                                       }
+                                                       break;
+                                               case TYPEMESSAGE:
+                                                       $mime_type = "message";
+                                                       
$this->structure[$part_no]['encoding']  = $this_part->encoding;
+                                                       
$this->structure[$part_no]['size']      = $this_part->bytes;
+                                                       
$this->structure[$part_no]['pid']       = $part_no;
+                                                       
$this->structure[$part_no]["type"]      = $mime_type."/". 
strtolower($this_part->subtype);
+                                                       $att_name = "unknown";
+                                                       for ($lcv = 0; $lcv < 
count($this_part->parameters); $lcv++) 
+                                                       {
+                                                               $param = 
$this_part->parameters[$lcv];
+                                                               if 
($param->attribute == "NAME" ||
+                                                                       
$param->attribute == "name") 
+                                                               {
+                                                                       
$this->structure[$part_no]["name"] = $param->value;
+                                                                       break;
+                                                               }
+                                                       }
+                                                       break;
+                                               case TYPEAPPLICATION:
+                                                       $mime_type = 
"application";
+                                                       
$this->structure[$part_no]['encoding']  = $this_part->encoding;
+                                                       
$this->structure[$part_no]['size']      = $this_part->bytes;
+                                                       
$this->structure[$part_no]['pid']       = $part_no;
+                                                       
$this->structure[$part_no]["type"]      = $mime_type."/". 
strtolower($this_part->subtype);
+                                                       $att_name = "unknown";
+                                                       for ($lcv = 0; $lcv < 
count($this_part->parameters); $lcv++) 
+                                                       {
+                                                               $param = 
$this_part->parameters[$lcv];
+                                                               if 
($param->attribute == "NAME" ||
+                                                                       
$param->attribute == "name") 
+                                                               {
+                                                                       
$this->structure[$part_no]["name"] = $param->value;
+                                                                       break;
+                                                               }
+                                                       }
+                                                       break;
+                                               case TYPEAUDIO:
+                                                       $mime_type = "audio";
+                                                       
$this->structure[$part_no]['encoding']  = $this_part->encoding;
+                                                       
$this->structure[$part_no]['size']      = $this_part->bytes;
+                                                       
$this->structure[$part_no]['pid']       = $part_no;
+                                                       
$this->structure[$part_no]["type"]      = $mime_type."/". 
strtolower($this_part->subtype);
+                                                       $att_name = "unknown";
+                                                       for ($lcv = 0; $lcv < 
count($this_part->parameters); $lcv++) 
+                                                       {
+                                                               $param = 
$this_part->parameters[$lcv];
+                                                               if 
($param->attribute == "NAME" ||
+                                                                       
$param->attribute == "name") 
+                                                               {
+                                                                       
$this->structure[$part_no]["name"] = $param->value;
+                                                                       break;
+                                                               }
+                                                       }
+                                                       break;
+                                               case TYPEIMAGE:
+                                                       $mime_type = "image";
+                                                       
$this->structure[$part_no]['encoding']  = $this_part->encoding;
+                                                       
$this->structure[$part_no]['size']      = $this_part->bytes;
+                                                       
$this->structure[$part_no]['pid']       = $part_no;
+                                                       
$this->structure[$part_no]["type"]      = $mime_type."/". 
strtolower($this_part->subtype);
+                                                       $att_name = "unknown";
+                                                       for ($lcv = 0; $lcv < 
count($this_part->parameters); $lcv++) 
+                                                       {
+                                                               $param = 
$this_part->parameters[$lcv];
+                                                               if 
($param->attribute == "NAME" ||
+                                                                       
$param->attribute == "name") 
+                                                               {
+                                                                       
$this->structure[$part_no]["name"] = $param->value;
+                                                                       break;
+                                                               }
+                                                       }
+                                                       break;
+                                               case TYPEVIDEO:
+                                                       $mime_type = "video";
+                                                       
$this->structure[$part_no]['encoding']  = $this_part->encoding;
+                                                       
$this->structure[$part_no]['size']      = $this_part->bytes;
+                                                       
$this->structure[$part_no]['pid']       = $part_no;
+                                                       
$this->structure[$part_no]["type"]      = $mime_type."/". 
strtolower($this_part->subtype);
+                                                       $att_name = "unknown";
+                                                       for ($lcv = 0; $lcv < 
count($this_part->parameters); $lcv++) 
+                                                       {
+                                                               $param = 
$this_part->parameters[$lcv];
+                                                               if 
($param->attribute == "NAME" ||
+                                                                       
$param->attribute == "name") 
+                                                               {
+                                                                       
$this->structure[$part_no]["name"] = $param->value;
+                                                                       break;
+                                                               }
+                                                       }
+                                                       break;
+                                               case TYPEMODEL:
+                                                       $mime_type = "model";
+                                                       break;
+                                               default:
+                                                       $mime_type = "unknown";
+                                                       // hmmm....
+                                       }
+                                       $full_mime_type = 
$mime_type."/".$this_part->subtype;
+                                       
+                                       // Decide what you what to do with this 
part
+                                       // If you want to show it, figure out 
the encoding and echo away
+                                       switch ($this_part->encoding) 
+                                       {
+                                               case ENCBASE64:
+                                                       // use imap_base64 to 
decode
+                                                       break;
+                                               case ENCQUOTEDPRINTABLE:
+                                                       // use imap_qprint to 
decode
+                                                       break;
+                                               case ENCOTHER:
+                                                       // not sure if this 
needs decoding at all
+                                                       break;
+                                               default:
+                                                       // it is either not 
encoded or we don't know about it
+                                       }
+                               }
+               }
+               
                function restoreSessionData()
                {
***************
*** 769,772 ****
--- 1184,1188 ----
                        $this->saveSessionData();
                }
+               
                function saveSessionData()
                {
***************
*** 774,777 ****
--- 1190,1211 ----
                }
                
+               function subscribe($_folderName, $_status)
+               {
+                       #$this->mailPreferences['imapServerAddress']
+                       #$this->mailPreferences['imapPort'],
+                       
+                       $folderName = imap_utf7_encode($_folderName);
+                       $folderName = 
"{".$this->mailPreferences['imapServerAddress'].":".$this->mailPreferences['imapPort']."}".$folderName;
+                       
+                       if($_status == 'unsubscribe')
+                       {
+                               return 
imap_unsubscribe($this->mbox,$folderName);
+                       }
+                       else
+                       {
+                               return imap_subscribe($this->mbox,$folderName);
+                       }
+               }
+               
                function toggleFilter()
                {
***************
*** 786,790 ****
                        $this->saveSessionData();
                }
!               
                function validate_email($_emailAddress)
                {
--- 1220,1224 ----
                        $this->saveSessionData();
                }
! 
                function validate_email($_emailAddress)
                {

Index: class.bofilter.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.bofilter.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** class.bofilter.inc.php      16 Oct 2002 17:18:24 -0000      1.1.2.1
--- class.bofilter.inc.php      10 Mar 2003 21:54:40 -0000      1.1.2.2
***************
*** 18,22 ****
                var $public_functions = array
                (
!                       'updateImapStatus'      => True,
                        'flagMessages'          => True
                );
--- 18,22 ----
                var $public_functions = array
                (
!                       'getActiveFilter'       => True,
                        'flagMessages'          => True
                );
***************
*** 28,35 ****
--- 28,45 ----
                        $this->bopreferences    = 
CreateObject('felamimail.bopreferences');
                        $this->sofelamimail     = 
CreateObject('felamimail.sofelamimail');
+                       $this->sofilter         = 
CreateObject('felamimail.sofilter');
                        
                        $this->mailPreferences  = 
$this->bopreferences->getPreferences();
+                       $this->sessionData['activeFilter'] = "-1";
                        
                        $this->restoreSessionData();
+                       
+                       if(!is_array($this->sessionData['filter']))
+                       {
+                               $this->sessionData['filter'][0]['filterName'] = 
lang('Quicksearch');
+                               $this->saveSessionData();
+                       }
+                       if(!isset($this->sessionData['activeFilter']))
+                               $this->sessionData['activeFilter'] = "-1";
                }
                
***************
*** 39,43 ****
                        $this->saveSessionData();
                }
! 
                function getFilterList()
                {
--- 49,58 ----
                        $this->saveSessionData();
                }
!               
!               function getActiveFilter()
!               {
!                       return $this->sessionData['activeFilter'];
!               }
!               
                function getFilterList()
                {
***************
*** 47,51 ****
                function restoreSessionData()
                {
!                       $this->sessionData = 
$GLOBALS['phpgw']->session->appsession('session_data');
                }
                
--- 62,67 ----
                function restoreSessionData()
                {
!                       $this->sessionData = 
$GLOBALS['phpgw']->session->appsession('filter_session_data');
!                       $this->sessionData['filter'] = 
$this->sofilter->restoreFilter();
                }
                
***************
*** 74,84 ****
                        }
                        $this->saveSessionData();
                }
                function saveSessionData()
                {
!                       
$GLOBALS['phpgw']->session->appsession('session_data','',$this->sessionData);
                }
                
!               function toggleFilter()
                {
                        if($this->sessionData['filter']['filterActive'] == 
'true')
--- 90,109 ----
                        }
                        $this->saveSessionData();
+                       
+                       
$this->sofilter->saveFilter($this->sessionData['filter']);
                }
+               
                function saveSessionData()
                {
!                       
$GLOBALS['phpgw']->session->appsession('filter_session_data','',$this->sessionData);
!               }
!               
!               function setActiveFilter($_filter)
!               {
!                       $this->sessionData['activeFilter'] = "$_filter";
!                       $this->saveSessionData();
                }
                
! /*            function toggleFilter()
                {
                        if($this->sessionData['filter']['filterActive'] == 
'true')
***************
*** 91,94 ****
--- 116,147 ----
                        }
                        $this->saveSessionData();
+               }*/
+               
+               function updateFilter($_data)
+               {
+                       $filter = $this->getFilterList();
+                       $activeFilter = $this->getActiveFilter();
+                       
+                       // check for new quickfilter
+                       if($activeFilter == $_data['filter'] && 
isset($_data['quickSearch']))
+                       {
+                               #print "new Quickfilter $_quickSearch";exit;
+                               if($_data['quickSearch'] == '')
+                               {
+                                       $this->setActiveFilter("-1");
+                               }
+                               else
+                               {
+                                       $this->setActiveFilter("0");
+                                       $data['filterName']     = 
lang('Quicksearch');
+                                       $data['subject']        = 
$_data['quickSearch'];
+                                       $data['from']           = 
$_data['quickSearch'];
+                                       $this->saveFilter($data, '0');
+                               }
+                       }
+                       else
+                       {
+                               $this->setActiveFilter($_data['filter']);
+                       }
                }
        }

Index: class.bopreferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.bopreferences.inc.php,v
retrieving revision 1.1.1.1.2.8
retrieving revision 1.1.1.1.2.9
diff -C2 -r1.1.1.1.2.8 -r1.1.1.1.2.9
*** class.bopreferences.inc.php 16 Oct 2002 08:09:38 -0000      1.1.1.1.2.8
--- class.bopreferences.inc.php 10 Mar 2003 21:54:40 -0000      1.1.1.1.2.9
***************
*** 24,28 ****
                function bopreferences()
                {
-                       #$this->bocompose       = 
CreateObject('felamimail.bocompose');
                }
                
--- 24,27 ----
***************
*** 53,58 ****
                        $data['imapServerAddress']      = 
$GLOBALS['phpgw_info']['server']['mail_server'];
                        $data['key']                    = 
$GLOBALS['phpgw_info']['user']['passwd'];
!                       $data['username']               = 
$GLOBALS['phpgw_info']['user']['userid'];
!                       $data['imap_server_type']       = 
strtolower($GLOBALS['phpgw_info']["server"]["imap_server_type"]);
                        $data['realname']               = 
$GLOBALS['phpgw_info']['user']['fullname'];
                        $data['defaultDomainname']      = 
$GLOBALS['phpgw_info']["server"]["mail_suffix"];
--- 52,60 ----
                        $data['imapServerAddress']      = 
$GLOBALS['phpgw_info']['server']['mail_server'];
                        $data['key']                    = 
$GLOBALS['phpgw_info']['user']['passwd'];
!                       if ($felamimailConfig["mailLoginType"] == 'vmailmgr')
!                               $data['username']               = 
$GLOBALS['phpgw_info']['user']['userid']."@".$felamimailConfig["mailSuffix"];
!                       else
!                               $data['username']               = 
$GLOBALS['phpgw_info']['user']['userid'];
!                       $data['imap_server_type']       = 
strtolower($felamimailConfig["imapServerMode"]);
                        $data['realname']               = 
$GLOBALS['phpgw_info']['user']['fullname'];
                        $data['defaultDomainname']      = 
$GLOBALS['phpgw_info']["server"]["mail_suffix"];
***************
*** 61,65 ****
                        $data['smtpPort']               = 
$GLOBALS['phpgw_info']["server"]["smtp_port"];
  
!                       $data['imapPort']               = 143;
                        
                        // check for felamimail specific settings
--- 63,76 ----
                        $data['smtpPort']               = 
$GLOBALS['phpgw_info']["server"]["smtp_port"];
  
!                       switch($data['imap_server_type'])
!                       {
!                               case "imaps-encr-only":
!                               case "imaps-encr-auth":
!                                       $data['imapPort']       = 993;
!                                       break;
!                               default:
!                                       $data['imapPort']       = 143;
!                                       break;
!                       }
                        
                        // check for felamimail specific settings
***************
*** 76,80 ****
--- 87,95 ----
                                $data['defaultDomainname']      = 
$felamimailConfig['mailSuffix'];
  
+                       if(!empty($felamimailConfig['organizationName']))
+                               $data['organizationName']       = 
$felamimailConfig['organizationName'];
+ 
                        $data['emailAddress']           = 
$data['username']."@".$data['defaultDomainname'];
+                       $data['smtpAuth']               = 
$felamimailConfig['smtpAuth'];
  
                        
if($GLOBALS['phpgw_info']['server']['account_repository'] == 'ldap')
***************
*** 121,146 ****
  
                                
if(!empty($GLOBALS['phpgw_info']['user']['preferences']['email']['imap_server_type']))
!                                       $data['imap_server_type']       = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['email']['imap_server_type']);
                        }
                        
!                       // preferences
!                       $data['deleteOptions']          = 
$GLOBALS['phpgw_info']['user']['preferences']['felamimail']['deleteOptions'];
!                       if(empty($data['deleteOptions']))
                        {
!                               $data['deleteOptions'] = 'remove_immediately';
                        }
!                       
!                       $data['trash_folder']           = 
$GLOBALS['phpgw_info']['user']['preferences']['felamimail']['trashFolder'];
!                       if(empty($data['trash_folder']))
                        {
!                               $data['trash_folder'] = 'INBOX.Trash';
                        }
! 
!                       $data['sent_folder']            = 
$GLOBALS['phpgw_info']['user']['preferences']['felamimail']['sent_folder'];
! 
!                       if (empty($data['sent_folder']))
                        {
!                               $data['sent_folder'] = 'INBOX.Sent'; 
                        }
  
                        if (!empty($data['trash_folder'])) 
--- 136,163 ----
  
                                
if(!empty($GLOBALS['phpgw_info']['user']['preferences']['email']['imap_server_type']))
!                                       $data['imap_server_type']       = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type']);
                        }
                        
!                       $GLOBALS['phpgw']->preferences->read_repository();
!                       $userPrefs = 
$GLOBALS['phpgw_info']['user']['preferences'];
!                       
!                       // how to handle deleted messages
!                       if(isset($userPrefs['felamimail']['deleteOptions']))
                        {
!                               $data['deleteOptions'] = 
$userPrefs['felamimail']['deleteOptions'];
                        }
!                       else
                        {
!                               $data['deleteOptions'] = 'mark_as_deleted';
                        }
!                       
!                       // where is the trash folder
!                       $data['trash_folder']           = 
$userPrefs['felamimail']['trashFolder'];
!                       if(!empty($userPrefs['felamimail']['sentFolder']))
                        {
!                               $data['sent_folder']            = 
$userPrefs['felamimail']['sentFolder'];
!                               $data['sentFolder']             = 
$userPrefs['felamimail']['sentFolder'];
                        }
+                       $data['refreshTime']            = 
$userPrefs['felamimail']['refreshTime'];
  
                        if (!empty($data['trash_folder'])) 
***************
*** 148,154 ****
                        if (!empty($data['sent_folder'])) 
                                $data['move_to_sent']   = True;
!                       $data['signature']              = 
$GLOBALS['phpgw_info']['user']['preferences']['felamimail']['email_sig'];
  
!               //      _debug_array($data);
                        return $data;
                }
--- 165,171 ----
                        if (!empty($data['sent_folder'])) 
                                $data['move_to_sent']   = True;
!                       $data['signature']              = 
$userPrefs['felamimail']['email_sig'];
  
!                       #_debug_array($data);
                        return $data;
                }

Index: class.phpmailer.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.phpmailer.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -C2 -r1.1.1.1 -r1.1.1.1.2.1
*** class.phpmailer.inc.php     31 Dec 2001 00:59:04 -0000      1.1.1.1
--- class.phpmailer.inc.php     10 Mar 2003 21:54:40 -0000      1.1.1.1.2.1
***************
*** 3,7 ****
  // phpmailer - PHP email class
  //
! // Version 1.50, Created 11/08/2001
  //
  // Class for sending email using either
--- 3,7 ----
  // phpmailer - PHP email class
  //
! // Version 1.65, Created 08/09/2002
  //
[...2263 lines suppressed...]
!         $mime[] = sprintf("Content-Type: %s; charset = \"%s\"%s", 
!                           $this->ContentType, $this->CharSet, $this->LE);
!         $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $this->Encoding, 
!                           $this->LE);
!         
!         if(strlen($this->Disposition) > 0)
!         {
!             $mime[] = sprintf("Content-Disposition: %s;");
!             if(strlen($this->FileName) > 0)
!                 $mime[] = sprinf("filename=\"%s\"", $this->FileName);
!         }
!         
!         if($bLineEnding)
!             $mime[] = $this->LE;
! 
!         return join("", $mime);
!     }
! }
! 
  ?>

Index: class.smtp.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.smtp.php,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -C2 -r1.1.1.1 -r1.1.1.1.2.1
*** class.smtp.php      31 Dec 2001 00:59:04 -0000      1.1.1.1
--- class.smtp.php      10 Mar 2003 21:54:40 -0000      1.1.1.1.2.1
***************
*** 1,1005 ****
! <?php
!     /*
!      * File: smtp.php
!      *
!      * Description: Define an SMTP class that can be used to connect
!      *              and communicate with any SMTP server. It implements
!      *              all the SMTP functions defined in RFC821 except TURN.
!      *
!      * Creator: Chris Ryan <address@hidden>
!      * Created: 03/26/2001
[...1981 lines suppressed...]
!                 echo "SMTP -> get_lines(): \$data was \"$data\"" .
!                          $this->CRLF;
!                 echo "SMTP -> get_lines(): \$str is \"$str\"" .
!                          $this->CRLF;
!             }
!             $data .= $str;
!             if($this->do_debug >= 4) {
!                 echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
!             }
!             # if the 4th character is a space then we are done reading
!             # so just break the loop
!             if(substr($str,3,1) == " ") { break; }
!         }
!         return $data;
!     }
! 
! }
! 
! 
!  ?>

Index: class.socaching.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.socaching.inc.php,v
retrieving revision 1.1.1.1.2.5
retrieving revision 1.1.1.1.2.6
diff -C2 -r1.1.1.1.2.5 -r1.1.1.1.2.6
*** class.socaching.inc.php     16 Oct 2002 08:09:38 -0000      1.1.1.1.2.5
--- class.socaching.inc.php     10 Mar 2003 21:54:40 -0000      1.1.1.1.2.6
***************
*** 74,91 ****
                        }
                        
!                       while(list($key,$value) = @each($_filter))
                        {
!                               switch($key)
                                {
!                                       case "from":
!                                               $filter .= " and (sender_name 
like '%$value%' or sender_address like '%$value%') ";
!                                               break;
!                                       case "to":
!                                               $filter .= " and (to_name like 
'%$value%' or to_address like '%$value%') ";
!                                               break;
!                                       case "subject":
!                                               $filter .= " and subject like 
'%$value%' ";
!                                               break;
                                }
                        }
                        
--- 74,97 ----
                        }
                        
!                       if(is_array($_filter))
                        {
!                               $filter = '';
!                               while(list($key,$value) = @each($_filter))
                                {
!                                       if($filter != '') $filter .= " or ";
!                                       switch($key)
!                                       {
!                                               case "from":
!                                                       $filter .= 
"(sender_name like '%$value%' or sender_address like '%$value%') ";
!                                                       break;
!                                               case "to":
!                                                       $filter .= "(to_name 
like '%$value%' or to_address like '%$value%') ";
!                                                       break;
!                                               case "subject":
!                                                       $filter .= "subject 
like '%$value%' ";
!                                                       break;
!                                       }
                                }
+                               $filter = " and ($filter) ";
                        }
                        
***************
*** 113,117 ****
                                                'to_name'               => 
$this->db->f('to_name'), 
                                                'to_address'            => 
$this->db->f('to_address'),
!                                               'attachments'           => 
$this->db->f('attachments')
                                                );
                        }
--- 119,124 ----
                                                'to_name'               => 
$this->db->f('to_name'), 
                                                'to_address'            => 
$this->db->f('to_address'),
!                                               'attachments'           => 
$this->db->f('attachments'),
!                                               'date'                  => 
$this->db->f('date')
                                                );
                        }
***************
*** 159,176 ****
                function getMessageCounter($_filter)
                {
!                       while(list($key,$value) = @each($_filter))
                        {
!                               switch($key)
                                {
!                                       case "from":
!                                               $filter .= " and (sender_name 
like '%$value%' or sender_address like '%$value%') ";
!                                               break;
!                                       case "to":
!                                               $filter .= " and (to_name like 
'%$value%' or to_address like '%$value%') ";
!                                               break;
!                                       case "subject":
!                                               $filter .= " and subject like 
'%$value%' ";
!                                               break;
                                }
                        }
                        
--- 166,189 ----
                function getMessageCounter($_filter)
                {
!                       if(is_array($_filter))
                        {
!                               $filter = '';
!                               while(list($key,$value) = @each($_filter))
                                {
!                                       if($filter != '') $filter .= " or ";
!                                       switch($key)
!                                       {
!                                               case "from":
!                                                       $filter .= 
"(sender_name like '%$value%' or sender_address like '%$value%') ";
!                                                       break;
!                                               case "to":
!                                                       $filter .= "(to_name 
like '%$value%' or to_address like '%$value%') ";
!                                                       break;
!                                               case "subject":
!                                                       $filter .= "subject 
like '%$value%' ";
!                                                       break;
!                                       }
                                }
+                               $filter = " and ($filter) ";
                        }
                        

Index: class.uicompose.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.uicompose.inc.php,v
retrieving revision 1.1.1.1.2.7
retrieving revision 1.1.1.1.2.8
diff -C2 -r1.1.1.1.2.7 -r1.1.1.1.2.8
*** class.uicompose.inc.php     27 Oct 2002 19:39:32 -0000      1.1.1.1.2.7
--- class.uicompose.inc.php     10 Mar 2003 21:54:40 -0000      1.1.1.1.2.8
***************
*** 105,109 ****
                                        
                                case "send":
!                                       $this->bocompose->send($formData);
                                        $linkData = array
                                        (
--- 105,114 ----
                                        
                                case "send":
!                                       if(!$this->bocompose->send($formData))
!                                       {
!                                               $this->compose();
!                                               return;
!                                       }
!                                       
                                        $linkData = array
                                        (
***************
*** 118,122 ****
                }
                
!               function compose()
                {
                        // read the data from session
--- 123,127 ----
                }
                
!               function compose($_focusElement="to")
                {
                        // read the data from session
***************
*** 127,131 ****
                        if (!empty($GLOBALS['HTTP_GET_VARS']['send_to']))
                        {
!                               $sessionData['to'] = 
urldecode($GLOBALS['HTTP_GET_VARS']['send_to']);
                        }
                        
--- 132,136 ----
                        if (!empty($GLOBALS['HTTP_GET_VARS']['send_to']))
                        {
!                               $sessionData['to'] = 
stripslashes(urldecode($GLOBALS['HTTP_GET_VARS']['send_to']));
                        }
                        
***************
*** 142,145 ****
--- 147,151 ----
                        
                        
$this->t->set_var("link_addressbook",$GLOBALS['phpgw']->link('/felamimail/addressbook.php'));
+                       $this->t->set_var("focusElement",$_focusElement);
  
                        $linkData = array
***************
*** 157,167 ****
                        
$this->t->set_var('folder_name',$this->bofelamimail->sessionData['mailbox']);
  
                        // header
!                       
$this->t->set_var("from",htmlentities($this->bocompose->getUserName()));
!                       
$this->t->set_var("to",htmlentities($sessionData['to']));
!                       
$this->t->set_var("cc",htmlentities($sessionData['cc']));
!                       
$this->t->set_var("bcc",htmlentities($sessionData['bcc']));
!                       
$this->t->set_var("reply_to",htmlentities($sessionData['reply_to']));
!                       
$this->t->set_var("subject",htmlentities($sessionData['subject']));
                        $this->t->pparse("out","header");
  
--- 163,183 ----
                        
$this->t->set_var('folder_name',$this->bofelamimail->sessionData['mailbox']);
  
+                       // check for some error messages from last posting 
attempt
+                       if($errorInfo = $this->bocompose->getErrorInfo())
+                       {
+                               $this->t->set_var('errorInfo',"<font 
color=\"red\"><b>$errorInfo</b></font>");
+                       }
+                       else
+                       {
+                               $this->t->set_var('errorInfo','&nbsp;');
+                       }
+                       
                        // header
!                       
$this->t->set_var("from",htmlentities($this->bocompose->getUserName(),ENT_QUOTES));
!                       
$this->t->set_var("to",htmlentities($sessionData['to'],ENT_QUOTES));
!                       
$this->t->set_var("cc",htmlentities($sessionData['cc'],ENT_QUOTES));
!                       
$this->t->set_var("bcc",htmlentities($sessionData['bcc'],ENT_QUOTES));
!                       
$this->t->set_var("reply_to",htmlentities($sessionData['reply_to'],ENT_QUOTES));
!                       
$this->t->set_var("subject",htmlentities($sessionData['subject'],ENT_QUOTES));
                        $this->t->pparse("out","header");
  
***************
*** 223,227 ****
                                $this->bocompose->getReplyData('single', 
$replyID);
                        }
!                       $this->compose();
                }
                
--- 239,243 ----
                                $this->bocompose->getReplyData('single', 
$replyID);
                        }
!                       $this->compose('body');
                }
                
***************
*** 234,238 ****
                                $this->bocompose->getReplyData('all', $replyID);
                        }
!                       $this->compose();
                }
                
--- 250,254 ----
                                $this->bocompose->getReplyData('all', $replyID);
                        }
!                       $this->compose('body');
                }
                

Index: class.uidisplay.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.uidisplay.inc.php,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** class.uidisplay.inc.php     24 Nov 2002 01:44:55 -0000      1.1.2.2
--- class.uidisplay.inc.php     10 Mar 2003 21:54:40 -0000      1.1.2.3
***************
*** 36,40 ****
                        $this->rowColor[1] = 
$GLOBALS['phpgw_info']["theme"]["bg02"];
  
! 
                }
                
--- 36,44 ----
                        $this->rowColor[1] = 
$GLOBALS['phpgw_info']["theme"]["bg02"];
  
!                       if($GLOBALS['HTTP_GET_VARS']['showHeader'] == "false")
!                       {
!                               $this->bofelamimail->sessionData['showHeader'] 
= 'False';
!                               $this->bofelamimail->saveSessionData();
!                       }
                }
                
***************
*** 46,57 ****
                function display()
                {
                        $headers        = 
$this->bofelamimail->getMessageHeader($this->uid);
                        $rawheaders     = 
$this->bofelamimail->getMessageRawHeader($this->uid);
                        $bodyParts      = 
$this->bofelamimail->getMessageBody($this->uid);
                        $attachments    = 
$this->bofelamimail->getMessageAttachments($this->uid);
                        
                        $this->bofelamimail->closeConnection();
! 
!                       $this->display_app_header();
                        
                        $this->t->set_file(array("displayMsg" => 
"view_message.tpl"));
--- 50,102 ----
                function display()
                {
+                       $transformdate  = 
CreateObject('felamimail.transformdate');
+ 
                        $headers        = 
$this->bofelamimail->getMessageHeader($this->uid);
                        $rawheaders     = 
$this->bofelamimail->getMessageRawHeader($this->uid);
                        $bodyParts      = 
$this->bofelamimail->getMessageBody($this->uid);
                        $attachments    = 
$this->bofelamimail->getMessageAttachments($this->uid);
+ 
+                       #print "<pre>";print_r($rawheaders);print"</pre>";exit;
+ 
+                       // add line breaks to $rawheaders
+                       $newRawHeaders = explode("\n",$rawheaders);
+                       reset($newRawHeaders);
+                       // find the Organization header
+                       // the header can also span multiple rows
+                       while(is_array($newRawHeaders) && list($key,$value) = 
each($newRawHeaders))
+                       {
+                               #print $value."<br>";
+                               if(preg_match("/Organization: 
(.*)/",$value,$matches))
+                               {
+                                       $organization = 
$this->bofelamimail->decode_header(chop($matches[1]));
+                                       #$organization = chop($matches[1]);
+                                       continue;
+                               }
+                               if(!empty($organization) && 
preg_match("/^\s+(.*)/",$value,$matches))
+                               {
+                                       $organization .= 
$this->bofelamimail->decode_header(chop($matches[1]));
+                                       break;
+                               }
+                               elseif(!empty($organization))
+                               {
+                                       break;
+                               }
+                       }
+                       
+                       // reset $rawheaders
+                       $rawheaders     = "";
+                       // create it new, with good line breaks
+                       reset($newRawHeaders);
+                       while(list($key,$value) = @each($newRawHeaders))
+                       {
+                               $rawheaders .= wordwrap($value,90,"\n     ");
+                       }
                        
                        $this->bofelamimail->closeConnection();
!                       
!                       if(!isset($GLOBALS['HTTP_GET_VARS']['printable']))
!                       {
!                               $this->display_app_header();
!                       }
                        
                        $this->t->set_file(array("displayMsg" => 
"view_message.tpl"));
***************
*** 60,135 ****
                        $this->t->set_block('displayMsg','message_raw_header');
                        $this->t->set_block('displayMsg','message_navbar');
                        $this->t->set_block('displayMsg','message_cc');
                        
$this->t->set_block('displayMsg','message_attachement_row');
                        
                        $this->translate();
                        
!                       // navbar
!                       $linkData = array
!                       (
!                               'menuaction'    => 
'felamimail.uifelamimail.viewMainScreen'
!                       );
!                       
$this->t->set_var("link_message_list",$GLOBALS['phpgw']->link('/felamimail/index.php',$linkData));
! 
!                       $linkData = array
!                       (
!                               'menuaction'    => 
'felamimail.uicompose.compose',
!                               'composeid'     => $this->composeID
!                       );
!                       
$this->t->set_var("link_compose",$GLOBALS['phpgw']->link('/index.php',$linkData));
!                       
$this->t->set_var('folder_name',$this->bofelamimail->sessionData['mailbox']);
! 
!                       $linkData = array
!                       (
!                               'menuaction'    => 'felamimail.uicompose.reply',
!                               'reply_id'      => $this->uid
!                       );
!                       
$this->t->set_var("link_reply",$GLOBALS['phpgw']->link('/index.php',$linkData));
! 
!                       $linkData = array
!                       (
!                               'menuaction'    => 
'felamimail.uicompose.replyAll',
!                               'reply_id'      => $this->uid
!                       );
!                       
$this->t->set_var("link_reply_all",$GLOBALS['phpgw']->link('/index.php',$linkData));
! 
!                       $linkData = array
!                       (
!                               'menuaction'    => 
'felamimail.uicompose.forward',
!                               'reply_id'      => $this->uid
!                       );
!                       
$this->t->set_var("link_forward",$GLOBALS['phpgw']->link('/index.php',$linkData));
! 
!                       $linkData = array
!                       (
!                               'menuaction'    => 
'felamimail.uifelamimail.deleteMessage',
!                               'message'       => $this->uid
!                       );
!                       
$this->t->set_var("link_delete",$GLOBALS['phpgw']->link('/index.php',$linkData));
! 
!                       $linkData = array
!                       (
!                               'menuaction'    => 
'felamimail.uidisplay.showHeader',
!                               'uid'           => $this->uid
!                       );
!                       
$this->t->set_var("link_header",$GLOBALS['phpgw']->link('/index.php',$linkData));
  
!                       $langArray = array
!                       (
!                               'lang_messagelist'      => lang('Message List'),
!                               'lang_compose'          => lang('Compose'),
!                               'lang_delete'           => lang('Delete'),
!                               'lang_forward'          => lang('Forward'),
!                               'lang_reply'            => lang('Reply'),
!                               'lang_reply_all'        => lang('Reply All'),
!                               'lang_back_to_folder'   => lang('back to 
folder'),
!                               'app_image_path'        => PHPGW_IMAGES
!                       );
!                       $this->t->set_var($langArray);
!                       $this->t->parse('navbar','message_navbar',True);
                        
                        
                        // rawheader
!                       if($this->bofelamimail->sessionData['showHeader'] == 
'True')
                        {
                                
$this->t->set_var("raw_header_data",htmlentities($rawheaders));
--- 105,208 ----
                        $this->t->set_block('displayMsg','message_raw_header');
                        $this->t->set_block('displayMsg','message_navbar');
+                       
$this->t->set_block('displayMsg','message_navbar_print');
                        $this->t->set_block('displayMsg','message_cc');
+                       
$this->t->set_block('displayMsg','message_organization');
                        
$this->t->set_block('displayMsg','message_attachement_row');
                        
                        $this->translate();
                        
!                       if(!isset($GLOBALS['HTTP_GET_VARS']['printable']))
!                       {
  
!                               // navbar
!                               $linkData = array
!                               (
!                                       'menuaction'    => 
'felamimail.uifelamimail.viewMainScreen'
!                               );
!                               
$this->t->set_var("link_message_list",$GLOBALS['phpgw']->link('/felamimail/index.php',$linkData));
!       
!                               $linkData = array
!                               (
!                                       'menuaction'    => 
'felamimail.uicompose.compose'
!                               );
!                               
$this->t->set_var("link_compose",$GLOBALS['phpgw']->link('/index.php',$linkData));
!                               
$this->t->set_var('folder_name',$this->bofelamimail->sessionData['mailbox']);
! 
!                               $linkData = array
!                               (
!                                       'menuaction'    => 
'felamimail.uicompose.reply',
!                                       'reply_id'      => $this->uid
!                               );
!                               
$this->t->set_var("link_reply",$GLOBALS['phpgw']->link('/index.php',$linkData));
! 
!                               $linkData = array
!                               (
!                                       'menuaction'    => 
'felamimail.uicompose.replyAll',
!                                       'reply_id'      => $this->uid
!                               );
!                               
$this->t->set_var("link_reply_all",$GLOBALS['phpgw']->link('/index.php',$linkData));
! 
!                               $linkData = array
!                               (
!                                       'menuaction'    => 
'felamimail.uicompose.forward',
!                                       'reply_id'      => $this->uid
!                               );
!                               
$this->t->set_var("link_forward",$GLOBALS['phpgw']->link('/index.php',$linkData));
      
! 
!                               $linkData = array
!                               (
!                                       'menuaction'    => 
'felamimail.uifelamimail.deleteMessage',
!                                       'message'       => $this->uid
!                               );
!                               
$this->t->set_var("link_delete",$GLOBALS['phpgw']->link('/index.php',$linkData));
! 
!                               $linkData = array
!                               (
!                                       'menuaction'    => 
'felamimail.uidisplay.showHeader',
!                                       'uid'           => $this->uid
!                               );
!                               
$this->t->set_var("link_header",$GLOBALS['phpgw']->link('/index.php',$linkData));
! 
!                               $linkData = array
!                               (
!                                       'menuaction'    => 
'felamimail.uidisplay.display',
!                                       'printable'     => 1,
!                                       'uid'           => $this->uid
!                               );
!                               
$this->t->set_var("link_printable",$GLOBALS['phpgw']->link('/index.php',$linkData));
!       
!                               $langArray = array
!                               (
!                                       'lang_messagelist'      => 
lang('Message List'),
!                                       'lang_compose'          => 
lang('Compose'),
!                                       'lang_delete'           => 
lang('Delete'),
!                                       'lang_forward'          => 
lang('Forward'),
!                                       'lang_reply'            => 
lang('Reply'),
!                                       'lang_reply_all'        => lang('Reply 
All'),
!                                       'lang_back_to_folder'   => lang('back 
to folder'),
!                                       'app_image_path'        => PHPGW_IMAGES
!                               );
!                               $this->t->set_var($langArray);
!                               $this->t->parse('navbar','message_navbar',True);
!                       }
!                       else
!                       {       
!                               $langArray = array
!                               (
!                                       'lang_print_this_page'  => lang('print 
this page'),
!                                       'lang_close_this_page'  => lang('close 
this page'),
!                                       'lang_printable'        => '',
!                                       'lang_reply'            => 
lang('Reply'),
!                                       'lang_reply_all'        => lang('Reply 
All'),
!                                       'lang_back_to_folder'   => lang('back 
to folder'),
!                                       'app_image_path'        => PHPGW_IMAGES
!                               );
!                               $this->t->set_var($langArray);
!                               
$this->t->parse('navbar','message_navbar_print',True);
!                       }
                        
                        
                        // rawheader
! /*                    if($this->bofelamimail->sessionData['showHeader'] == 
'True')
                        {
                                
$this->t->set_var("raw_header_data",htmlentities($rawheaders));
***************
*** 142,153 ****
                                $this->t->set_var("view_header",lang('show 
header'));
                        }
                        
  
                        // header
!                       
$this->t->set_var("from_data",htmlentities($this->bofelamimail->decode_header($headers->fromaddress)));
!                       
$this->t->set_var("to_data",htmlentities($this->bofelamimail->decode_header($headers->toaddress)));
                        if($headers->ccaddress)
                        {
!                               
$this->t->set_var("cc_data",htmlentities($this->bofelamimail->decode_header($headers->ccaddress)));
                                
$this->t->parse('cc_data_part','message_cc',True);
                        }
--- 215,249 ----
                                $this->t->set_var("view_header",lang('show 
header'));
                        }
+ */
                        
  
                        // header
!                       // sent by a mailinglist??
!                       // parse the from header
!                       if($headers->senderaddress != $headers->fromaddress)
!                       {
!                               $senderAddress = 
$this->emailAddressToHTML($headers->senderaddress);
!                               $fromAddress   = 
$this->emailAddressToHTML($headers->fromaddress);
!                               $this->t->set_var("from_data",
!                                       $senderAddress.
!                                       "&nbsp;".lang('on behalf of')."&nbsp;".
!                                       $fromAddress);
!                       }
!                       else
!                       {
!                               $fromAddress   = 
$this->emailAddressToHTML($headers->fromaddress);
!                               $this->t->set_var("from_data",
!                                       $fromAddress);
!                       }
!                       
!                       // parse the to header
!                       $toAddress = 
$this->emailAddressToHTML($headers->toaddress);
!                       $this->t->set_var("to_data",$toAddress);
!                       
!                       // parse the cc header
                        if($headers->ccaddress)
                        {
!                               $ccAddress = 
$this->emailAddressToHTML($headers->ccaddress);
!                               $this->t->set_var("cc_data",$ccAddress);
                                
$this->t->parse('cc_data_part','message_cc',True);
                        }
***************
*** 156,169 ****
                                $this->t->set_var("cc_data_part",'');
                        }
!                       
$this->t->set_var("date_data",htmlentities($GLOBALS['phpgw']->common->show_date($headers->udate)));
                        
$this->t->set_var("subject_data",htmlentities($this->bofelamimail->decode_header($headers->subject)));
                        $this->t->parse("header","message_header",True);
  
                        // body
!                       for($i=0; $i<count($bodyParts); $i++ )
                        {
!                               if(!empty($body)) $body .= "<hr>";
!                               $body .= htmlentities($bodyParts[$i]);
                        }
                        $this->t->set_var("body",$body);
                        
$this->t->set_var("signature",$sessionData['signature']);
--- 252,351 ----
                                $this->t->set_var("cc_data_part",'');
                        }
! 
!                       // parse the cc header
!                       if(!empty($organization))
!                       {
!                               
$this->t->set_var("organization_data",$organization);
!                               
$this->t->parse('organization_data_part','message_organization',True);
!                       }
!                       else
!                       {
!                               $this->t->set_var("organization_data_part",'');
!                       }
! 
!                       if (isset($headers->date))
!                       {
!                               $headers->date = ereg_replace('  ', ' ', 
$headers->date);
!                               $tmpdate = explode(' ', trim($headers->date));
!                       }
!                       else
!                       {
!                               $tmpdate = $date = array("","","","","","");
!                       }
!                                                                               
                                                                                
                                                                                
                                                                  
!                       
$this->t->set_var("date_data",htmlentities($GLOBALS['phpgw']->common->show_date($transformdate->getTimeStamp($tmpdate))));
                        
$this->t->set_var("subject_data",htmlentities($this->bofelamimail->decode_header($headers->subject)));
+                       //if(isset($organization)) exit;
                        $this->t->parse("header","message_header",True);
  
                        // body
!                       if($this->bofelamimail->sessionData['showHeader'] == 
'True')
                        {
!                               
#$this->t->set_var("raw_header_data",htmlentities($rawheaders);
!                               $body = htmlentities($rawheaders);
!                               
#$this->t->parse("rawheader",'message_raw_header',True);
!                               $this->t->set_var("rawheader",'');
!                               $this->t->set_var("view_header",lang('hide 
header'));
                        }
+                       else
+                       {
+                               $body = '';
+                               $this->t->set_var("rawheader",'');
+                               $this->t->set_var("view_header",lang('show 
header'));
+                       }
+                       for($i=0; $i<count($bodyParts); $i++ )
+                       {
+                               // if($i > 0) $body .= "<br><br>Atachment 
-------------------<br><br>";
+                       
+                               // add line breaks to $bodyParts
+                               #$newBody       = explode("\n",$bodyParts[$i]);
+                               #$bodyAppend    = '';
+                               // create it new, with good line breaks
+                               #reset($newBody);
+                               #while(list($key,$value) = @each($newBody))
+                               #{
+                               #       $bodyAppend .= 
wordwrap($value,90,"\n",1);
+                               #}
+                               
+                               #$body .= 
htmlspecialchars($bodyAppend,ENT_QUOTES);
+ 
+                               // add line breaks to $bodyParts
+                               $newBody        = 
wordwrap($bodyParts[$i],90,"\n",1);
+                               $body .= htmlspecialchars($newBody,ENT_QUOTES);
+                               #print "<hr><pre>$body</pre><hr>";
+                       }
+                       
+                       // search http[s] links and make them as links 
available again
+                       // to understand what's going on here, have a look at 
+                       // 
http://www.php.net/manual/en/function.preg-replace.php
+                       
+                       #$body = preg_replace("/(\&gt\;)/", 
+                       #       "<font color=\"blue\">$1</font>", $body);
+                       
+                       
+                       // create links for websites
+                       #$body = 
preg_replace("/((http(s?):\/\/)|(www\.))([\w\.,-.,\/.,\?.,\=.,&amp;]+)/ie", 
+                       #       "'<a 
href=\"/phpgroupware/redirect.php?go='.htmlentities(urlencode('http$3://$4$5')).'\"
 target=\"_blank\"><font color=\"blue\">$2$4$5</font></a>'", $body);
+                       $body = 
preg_replace("/((http(s?):\/\/)|(www\.))([\w,\-,\/,\?,\=,\.,&amp;,!\n,\%,@,\*,#]+)/ie",
 
+                               "'<a 
href=\"/phpgroupware/redirect.php?go='.htmlentities(urlencode('http$3://$4$5')).'\"
 target=\"_blank\"><font color=\"blue\">$2$4$5</font></a>'", $body);
+                       
+                       // create links for ftp sites
+                       $body = 
preg_replace("/((ftp:\/\/)|(ftp\.))([\w\.,-.,\/.,\?.,\=.,&amp;]+)/i", 
+                               "<a href=\"ftp://$3$4\"; target=\"_blank\"><font 
color=\"blue\">$1$3$4</font></a>", $body);
+ 
+                       // create links for windows shares
+                       // \\\\\\\\ == '\\' in real life!! :)
+                       $body = preg_replace("/(\\\\\\\\)([\w,\\\\,-]+)/i", 
+                               "<a href=\"file:$1$2\" target=\"_blank\"><font 
color=\"blue\">$1$2</font></a>", $body);
+                       
+                       // create links for email addresses
+                       $linkData = array
+                       (
+                               'menuaction'    => 
'felamimail.uicompose.compose'
+                       );
+                       $link = $GLOBALS['phpgw']->link('/index.php',$linkData);
+                       $body = 
preg_replace("/([\w\.,-.,_.,0-9.]+)(@)([\w\.,-.,_.,0-9.]+)/i", 
+                               "<a href=\"$link&send_to=$0\"><font 
color=\"blue\">$0</font></a>", $body);
+                               
                        $this->t->set_var("body",$body);
                        
$this->t->set_var("signature",$sessionData['signature']);
***************
*** 180,184 ****
                                {
                                        
$this->t->set_var('row_color',$this->rowColor[($key+1)%2]);
!                                       
$this->t->set_var('filename',$value['name']);
                                        
$this->t->set_var('mimetype',$value['type']);
                                        
$this->t->set_var('size',$value['size']);
--- 362,366 ----
                                {
                                        
$this->t->set_var('row_color',$this->rowColor[($key+1)%2]);
!                                       
$this->t->set_var('filename',htmlentities($this->bofelamimail->decode_header($value['name'])));
                                        
$this->t->set_var('mimetype',$value['type']);
                                        
$this->t->set_var('size',$value['size']);
***************
*** 208,212 ****
                                $this->t->set_var('attachment_rows','');
                        }
! 
                        #$this->t->pparse("out","message_attachment_rows");
  
--- 390,394 ----
                                $this->t->set_var('attachment_rows','');
                        }
!                       
                        #$this->t->pparse("out","message_attachment_rows");
  
***************
*** 214,225 ****
                        $this->t->pparse("out","message_main");
  
-                       global $calendar_id;
-                       list(,$app,,,,$calendar_id) = 
explode('"',strstr($rawheaders,'X-phpGW-Type:'));
-                       if(!isset($GLOBALS['HTTP_GET_VARS']['printable']) && 
!empty($app))
-                       {
-                               echo '<table align="center" 
width="100%"><tr><td align="center">';
-                               $GLOBALS['phpgw']->hooks->single('email',$app);
-                               echo '</td></tr></table>';
-                       }
                }
  
--- 396,399 ----
***************
*** 229,237 ****
                        echo parse_navbar();
                }
                
                function getAttachment()
                {
                        
!                       $part   = $GLOBALS['HTTP_GET_VARS']['part'];
                        
                        $attachment     = 
$this->bofelamimail->getAttachment($this->uid,$part);
--- 403,459 ----
                        echo parse_navbar();
                }
+ 
+               function emailAddressToHTML($_emailAddress)
+               {               
+                       // create some nice formated HTML for senderaddress
+                       $addressData = imap_rfc822_parse_adrlist
+                                       
($this->bofelamimail->decode_header($_emailAddress),'');
+                       if(is_array($addressData))
+                       {
+                               $senderAddress = '';
+                               while(list($key,$val)=each($addressData))
+                               {
+                                       if(!empty($senderAddress)) 
$senderAddress .= ", ";
+                                       if(!empty($val->personal))
+                                       {
+                                               $tempSenderAddress = 
$val->mailbox."@".$val->host;
+                                               $newSenderAddress  = 
imap_rfc822_write_address($val->mailbox,
+                                                                       
$val->host,
+                                                                       
$val->personal);
+                                               $linkData = array
+                                               (
+                                                       'menuaction'    => 
'felamimail.uicompose.compose',
+                                                       'send_to'       => 
htmlentities($newSenderAddress)
+                                               );
+                                               $link = 
$GLOBALS['phpgw']->link('/index.php',$linkData);
+                                               $senderAddress .= sprintf('<a 
href="%s" title="%s">%s</a>',
+                                                                       $link,
+                                                                       
htmlentities($newSenderAddress),
+                                                                       
htmlentities($val->personal));
+                                       }
+                                       else
+                                       {
+                                               $tempSenderAddress = 
$val->mailbox."@".$val->host;
+                                               $linkData = array
+                                               (
+                                                       'menuaction'    => 
'felamimail.uicompose.compose',
+                                                       'send_to'       => 
$tempSenderAddress
+                                               );
+                                               $link = 
$GLOBALS['phpgw']->link('/index.php',$linkData);
+                                               $senderAddress .= sprintf('<a 
href="%s">%s</a>',
+                                                                       
$link,htmlentities($tempSenderAddress));
+                                       }
+                               }
+                               return $senderAddress;
+                       }
+                       
+                       // if something goes wrong, just return the original 
address
+                       return $_emailAddress;
+               }
                
                function getAttachment()
                {
                        
!                       $part           = $GLOBALS['HTTP_GET_VARS']['part'];
                        
                        $attachment     = 
$this->bofelamimail->getAttachment($this->uid,$part);
***************
*** 239,252 ****
                        $this->bofelamimail->closeConnection();
                        
                        if($GLOBALS['HTTP_GET_VARS']['mode'] == "save")
                        {
!                               header ("Content-Type: 
application/octet-stream");
                        }
                        else
                        {
!                               header ("Content-Type: ".$attachment['type']);
                        }
!                       header("Content-Disposition: 
filename=\"".$attachment['filename']."\"");
                        echo $attachment['attachment'];
                        $GLOBALS['phpgw']->common->phpgw_exit();
                        exit;
--- 461,482 ----
                        $this->bofelamimail->closeConnection();
                        
+                       header ("Content-Type: ".$attachment['type']."; 
name=\".$attachment['filename'].\"");
                        if($GLOBALS['HTTP_GET_VARS']['mode'] == "save")
                        {
!                               // ask for download
!                               header ("Content-Disposition: attachment; 
filename=\"".$attachment['filename']."\"");
                        }
                        else
                        {
!                               // display it
!                               header ("Content-Disposition: inline; 
filename=\"".$attachment['filename']."\"");
                        }
!                       header("Expires: 0");
!                       // the next headers are for IE and SSL
!                       header("Cache-Control: must-revalidate, post-check=0, 
pre-check=0");
!                       header("Pragma: public"); 
! 
                        echo $attachment['attachment'];
+                       
                        $GLOBALS['phpgw']->common->phpgw_exit();
                        exit;
***************
*** 293,297 ****
--- 523,529 ----
                        $this->t->set_var("lang_date",lang('date'));
                        $this->t->set_var("lang_view",lang('view'));
+                       
$this->t->set_var("lang_organization",lang('organization'));
                        $this->t->set_var("lang_save",lang('save'));
+                       $this->t->set_var("lang_printable",lang('print it'));
                        
                        
$this->t->set_var("th_bg",$GLOBALS['phpgw_info']["theme"]["th_bg"]);

Index: class.uifelamimail.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.uifelamimail.inc.php,v
retrieving revision 1.2.2.10
retrieving revision 1.2.2.11
diff -C2 -r1.2.2.10 -r1.2.2.11
*** class.uifelamimail.inc.php  27 Oct 2002 19:39:32 -0000      1.2.2.10
--- class.uifelamimail.inc.php  10 Mar 2003 21:54:40 -0000      1.2.2.11
***************
*** 19,27 ****
                (
                        'addVcard'              => True,
                        'deleteMessage'         => True,
                        'handleButtons'         => True,
                        'toggleFilter'          => True,
!                       'viewMainScreen'        => True,
!                       'compressFolder'        => True
                );
                
--- 19,28 ----
                (
                        'addVcard'              => True,
+                       'changeFilter'          => True,
+                       'compressFolder'        => True,
                        'deleteMessage'         => True,
                        'handleButtons'         => True,
                        'toggleFilter'          => True,
!                       'viewMainScreen'        => True
                );
                
***************
*** 46,64 ****
                                $GLOBALS['HTTP_POST_VARS']["mark_deleted"] = 
"true";
  
!                       $this->bofelamimail             = 
CreateObject('felamimail.bofelamimail');
                        
                        
!                       if($GLOBALS['HTTP_POST_VARS']["changeFilter"] == 
'changeFilter' &&
!                               isset($GLOBALS['HTTP_POST_VARS']["filter"]))
!                       {
!                               // change filter
!                               
$this->bofelamimail->sessionData['activeFilter'] = 
$GLOBALS['HTTP_POST_VARS']["filter"];
!                       }
!                       elseif(isset($GLOBALS['HTTP_GET_VARS']["filter"]))
!                       {
!                               // change filter
!                               
$this->bofelamimail->sessionData['activeFilter'] = 
$GLOBALS['HTTP_GET_VARS']["filter"];
!                       }
!                       elseif(isset($GLOBALS['HTTP_POST_VARS']["mailbox"]) && 
                                $GLOBALS['HTTP_GET_VARS']["menuaction"] == 
"felamimail.uifelamimail.handleButtons" &&
                                
empty($GLOBALS['HTTP_POST_VARS']["mark_unread"]) &&
--- 47,55 ----
                                $GLOBALS['HTTP_POST_VARS']["mark_deleted"] = 
"true";
  
!                       $this->bofelamimail     = 
CreateObject('felamimail.bofelamimail');
!                       $this->bofilter         = 
CreateObject('felamimail.bofilter');
                        
                        
!                       if(isset($GLOBALS['HTTP_POST_VARS']["mailbox"]) && 
                                $GLOBALS['HTTP_GET_VARS']["menuaction"] == 
"felamimail.uifelamimail.handleButtons" &&
                                
empty($GLOBALS['HTTP_POST_VARS']["mark_unread"]) &&
***************
*** 100,103 ****
--- 91,99 ----
                                
$this->bofelamimail->sessionData['startMessage']= 1;
                        }
+                       elseif(isset($GLOBALS['HTTP_POST_VARS']["filter"]) || 
isset($GLOBALS['HTTP_GET_VARS']["filter"]))
+                       {
+                               // new search filter defined, lets start with 
message 1
+                               
$this->bofelamimail->sessionData['startMessage']= 1;
+                       }
  
                        // navigate for and back
***************
*** 116,120 ****
                        $this->startMessage     = 
$this->bofelamimail->sessionData['startMessage'];
                        $this->sort             = 
$this->bofelamimail->sessionData['sort'];
!                       $this->filter           = 
$this->bofelamimail->sessionData['activeFilter'];
  
                        #$this->cats                    = 
CreateObject('phpgwapi.categories');
--- 112,116 ----
                        $this->startMessage     = 
$this->bofelamimail->sessionData['startMessage'];
                        $this->sort             = 
$this->bofelamimail->sessionData['sort'];
!                       #$this->filter          = 
$this->bofelamimail->sessionData['activeFilter'];
  
                        #$this->cats                    = 
CreateObject('phpgwapi.categories');
***************
*** 124,128 ****
                        #$this->grants                  = 
$phpgw->acl->get_grants('notes');
                        #$this->grants[$this->account]  = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
!                       $this->bofelamimail->openConnection();
  
                        $this->rowColor[0] = $phpgw_info["theme"]["row_on"];
--- 120,124 ----
                        #$this->grants                  = 
$phpgw->acl->get_grants('notes');
                        #$this->grants[$this->account]  = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
!                       $this->connectionStatus = 
$this->bofelamimail->openConnection();
  
                        $this->rowColor[0] = $phpgw_info["theme"]["row_on"];
***************
*** 165,168 ****
--- 161,195 ----
                        $GLOBALS['phpgw']->common->phpgw_exit();
                }
+               
+               function changeFilter()
+               {
+                       /*
+                       * The old code...
+                       *
+                       * if($GLOBALS['HTTP_POST_VARS']["changeFilter"] == 
'changeFilter' &&
+                       *       isset($GLOBALS['HTTP_POST_VARS']["filter"]))
+                       * {
+                       *       // change filter
+                       *       
$this->bofelamimail->sessionData['activeFilter'] = 
$GLOBALS['HTTP_POST_VARS']["filter"];
+                       * }
+                       * elseif(isset($GLOBALS['HTTP_GET_VARS']["filter"]))
+                       * {
+                       *       // change filter
+                       *       
$this->bofelamimail->sessionData['activeFilter'] = 
$GLOBALS['HTTP_GET_VARS']["filter"];
+                       * }
+                       */
+                       if(isset($GLOBALS['HTTP_POST_VARS']["filter"]))
+                       {
+                               $data['quickSearch']    = 
$GLOBALS['HTTP_POST_VARS']["quickSearch"];
+                               $data['filter']         = 
$GLOBALS['HTTP_POST_VARS']["filter"];
+                               $this->bofilter->updateFilter($data);
+                       }
+                       elseif(isset($GLOBALS['HTTP_GET_VARS']["filter"]))
+                       {
+                               $data['filter']         = 
$GLOBALS['HTTP_GET_VARS']["filter"];
+                               $this->bofilter->updateFilter($data);
+                       }
+                       $this->viewMainScreen();
+               }
  
                function compressFolder()
***************
*** 234,237 ****
--- 261,265 ----
                {
                        $bopreferences          = 
CreateObject('felamimail.bopreferences');
+                       $preferences            = 
$bopreferences->getPreferences();
                        $bofilter               = 
CreateObject('felamimail.bofilter');
                        $mailPreferences        = 
$bopreferences->getPreferences();
***************
*** 241,247 ****
                        $maxMessages = 
$GLOBALS['phpgw_info']["user"]["preferences"]["common"]["maxmatchs"];
                        
-                       $folders = $this->bofelamimail->getFolderList('true');
-                       
-                       $headers = 
$this->bofelamimail->getHeaders($this->startMessage, $maxMessages, $this->sort);
                
                        $this->display_app_header();
--- 269,272 ----
***************
*** 250,272 ****
                        $this->t->set_block('body','main');
                        $this->t->set_block('body','status_row_tpl');
!                       $this->t->set_block('body','header_row_S');
!                       $this->t->set_block('body','header_row_');
!                       $this->t->set_block('body','header_row_AS');
!                       $this->t->set_block('body','header_row_ADS');
!                       $this->t->set_block('body','header_row_F');
!                       $this->t->set_block('body','header_row_FA');
!                       $this->t->set_block('body','header_row_FS');
!                       $this->t->set_block('body','header_row_FAS');
!                       $this->t->set_block('body','header_row_R');
!                       $this->t->set_block('body','header_row_RS');
!                       $this->t->set_block('body','header_row_D');
!                       $this->t->set_block('body','header_row_DS');
!                       $this->t->set_block('body','header_row_A');
!               
                        $this->translate();
                        
                        $this->t->set_var('oldMailbox',$urlMailbox);
                        $this->t->set_var('image_path',PHPGW_IMAGES);
!                       $refreshTime = 
$GLOBALS['phpgw_info']['user']['preferences'][felamimail]['refreshTime'];
                        if($refreshTime > 0)
                        {
--- 275,288 ----
                        $this->t->set_block('body','main');
                        $this->t->set_block('body','status_row_tpl');
!                       $this->t->set_block('body','header_row');
!                       $this->t->set_block('body','error_message');
! 
                        $this->translate();
                        
                        $this->t->set_var('oldMailbox',$urlMailbox);
                        $this->t->set_var('image_path',PHPGW_IMAGES);
!                       
!                       // refresh settings
!                       $refreshTime = $preferences['refreshTime'];
                        if($refreshTime > 0)
                        {
***************
*** 284,287 ****
--- 300,304 ----
                        
$this->t->set_var('refresh_url',$GLOBALS['phpgw']->link('/index.php',$linkData));
                        
+                       
                        // set the default values for the sort links (sort by 
url)
                        $linkData = array
***************
*** 313,327 ****
                        // create the filter ui
                        $filterList = $bofilter->getFilterList();
!                       if($this->filter == -1)
!                               $filterUI .= "<option value=\"-1\">".lang('no 
filter')."</option>";
!                       else
                                $filterUI .= "<option value=\"-1\" 
selected>".lang('no filter')."</option>";
                        while(list($key,$value) = @each($filterList))
                        {
                                $selected="";
!                               if($this->filter == $key) $selected="selected";
                                $filterUI .= "<option value=".$key." 
$selected>".$value['filterName']."</option>";
                        }
                        $this->t->set_var('filter_options',$filterUI);
                        
                        // create the urls for sorting
--- 330,349 ----
                        // create the filter ui
                        $filterList = $bofilter->getFilterList();
!                       $activeFilter = $bofilter->getActiveFilter();
!                       // -1 == no filter selected
!                       if($activeFilter == -1)
                                $filterUI .= "<option value=\"-1\" 
selected>".lang('no filter')."</option>";
+                       else
+                               $filterUI .= "<option value=\"-1\">".lang('no 
filter')."</option>";
                        while(list($key,$value) = @each($filterList))
                        {
                                $selected="";
!                               if($activeFilter == $key) $selected="selected";
                                $filterUI .= "<option value=".$key." 
$selected>".$value['filterName']."</option>";
                        }
                        $this->t->set_var('filter_options',$filterUI);
+                       // 0 == quicksearch
+                       if($activeFilter == '0')
+                               
$this->t->set_var('quicksearch',$filterList[0]['subject']);
                        
                        // create the urls for sorting
***************
*** 360,488 ****
                        }
  
!                       // create the listing of subjects
!                       $maxSubjectLength = 80;
!                       $maxAddressLength = 30;
!                       for($i=0; $i<count($headers['header']); $i++)
                        {
!                               if (!empty($headers['header'][$i]['subject']))
                                {
!                                       
if(strlen($headers['header'][$i]['subject']) > $maxSubjectLength)
                                        {
!                                               
$headers['header'][$i]['subject'] = 
substr($headers['header'][$i]['subject'],0,$maxSubjectLength)."...";
                                        }
!                                       $headers['header'][$i]['subject'] = 
htmlentities($headers['header'][$i]['subject']);
!                                       
if($headers['header'][$i]['attachments'] == "true")
                                        {
!                                               $image = '<img 
src="'.PHPGW_IMAGES.'/attach.gif" border="0">';
!                                               
$headers['header'][$i]['subject'] = 
"$image&nbsp;".$headers['header'][$i]['subject'];
                                        }
-                                       $this->t->set_var('header_subject', 
$headers['header'][$i]['subject']);
-                                       
-                               }
-                               else
-                               {
-                                       
$this->t->set_var('header_subject',htmlentities("(".lang('no subject').")"));
-                               }
                                
!                               if ($mailPreferences['sent_folder'] == 
$this->mailbox)
!                               {
!                                       if 
(!empty($headers['header'][$i]['to_name']))
                                        {
!                                               $sender_name    = 
$headers['header'][$i]['to_name'];
!                                               $full_address   =
!                                                       
$headers['header'][$i]['to_name'].
!                                                       " <".
!                                                       
$headers['header'][$i]['to_address'].
!                                                       ">";
                                        }
                                        else
                                        {
!                                               $sender_name    = 
$headers['header'][$i]['to_address'];
!                                               $full_address   = 
$headers['header'][$i]['to_address'];
                                        }
!                                       
$this->t->set_var('lang_from',lang("to"));
!                               }
!                               else
!                               {
!                                       if 
(!empty($headers['header'][$i]['sender_name']))
                                        {
!                                               $sender_name    = 
$headers['header'][$i]['sender_name'];
!                                               $full_address   = 
!                                                       
$headers['header'][$i]['sender_name'].
!                                                       " <".
!                                                       
$headers['header'][$i]['sender_address'].
!                                                       ">";
                                        }
!                                       else
                                        {
!                                               $sender_name    = 
$headers['header'][$i]['sender_address'];
!                                               $full_address   = 
$headers['header'][$i]['sender_address'];
                                        }
-                                       
$this->t->set_var('lang_from',lang("from"));
-                               }
-                               if(strlen($sender_name) > $maxAddressLength)
-                               {
-                                       $sender_name = 
substr($sender_name,0,$maxAddressLength)."...";
-                               }
-                               $this->t->set_var('sender_name',$sender_name);
-                               $this->t->set_var('full_address',$full_address);
-                               
-                               if($GLOBALS['HTTP_GET_VARS']["select_all"] == 
"select_all")
-                               {
-                                       
$this->t->set_var('row_selected',"checked");
-                               }
  
!                               $this->t->set_var('message_counter',$i);
!                               
$this->t->set_var('message_uid',$headers['header'][$i]['uid']);
!                               
$this->t->set_var('date',$headers['header'][$i]['date']);
!                               
$this->t->set_var('size',$this->show_readable_size($headers['header'][$i]['size']));
!                               $flags = "";
!                               if(!empty($headers['header'][$i]['recent'])) 
$flags .= "R";
!                               if(!empty($headers['header'][$i]['flagged'])) 
$flags .= "F";
!                               if(!empty($headers['header'][$i]['answered'])) 
$flags .= "A";
!                               if(!empty($headers['header'][$i]['deleted'])) 
$flags .= "D";
!                               if(!empty($headers['header'][$i]['seen'])) 
$flags .= "S";
!                               #$this->t->set_var('flags',$flags);
! 
! #                             $linkData = array
! #                             (
! #                                     'mailbox'       => $urlMailbox,
! #                                     'passed_id'     => 
$headers['header'][$i]['id'],
! #                                     'uid'           => 
$headers['header'][$i]['uid'],
! #                             );
! #                             
$this->t->set_var('url_read_message',$GLOBALS['phpgw']->link('/felamimail/read_body.php',$linkData));
                                
!                               $linkData = array
!                               (
!                                       'menuaction'    => 
'felamimail.uidisplay.display',
!                                       'uid'           => 
$headers['header'][$i]['uid']
!                               );
!                               
$this->t->set_var('url_read_message',$GLOBALS['phpgw']->link('/index.php',$linkData));
!                               
!                               $linkData = array
!                               (
!                                       'menuaction'    => 
'felamimail.uicompose.compose',
!                                       'send_to'       => 
urlencode($headers['header'][$i]['sender_address'])
!                               );
!                               
$this->t->set_var('url_compose',$GLOBALS['phpgw']->link('/index.php',$linkData));
!                               
!                               $linkData = array
!                               (
!                                       'menuaction'    => 
'addressbook.uiaddressbook.add_email',
!                                       'add_email'     => 
urlencode($headers['header'][$i]['sender_address']),
!                                       'name'          => 
urlencode($headers['header'][$i]['sender_name']),
!                                       'referer'       => 
urlencode($GLOBALS['PHP_SELF'].'?'.$GLOBALS['QUERY_STRING'])
!                               );
!                               
$this->t->set_var('url_add_to_addressbook',$GLOBALS['phpgw']->link('/index.php',$linkData));
                                
!                               $this->t->set_var('phpgw_images',PHPGW_IMAGES);
                        
!                               
$this->t->parse('header_rows','header_row_'.$flags,True);
                        }
-                       $firstMessage = $headers['info']['first'];
-                       $lastMessage = $headers['info']['last'];
-                       $totalMessage = $headers['info']['total'];
-                       $langTotal = lang("total");
  
                        // set the select all/nothing link
                        if($GLOBALS['HTTP_GET_VARS']["select_all"] == 
"select_all")
--- 382,568 ----
                        }
  
!                       if($this->connectionStatus != 'True')
                        {
!                               
$this->t->set_var('message',$this->connectionStatus);
!                               
$this->t->parse('header_rows','error_message',True);
!                       }
!                       else
!                       {
!                               $folders = 
$this->bofelamimail->getFolderList('true');
!                       
!                               $headers = 
$this->bofelamimail->getHeaders($this->startMessage, $maxMessages, $this->sort);
!                       
!                               // create the listing of subjects
!                               $maxSubjectLength = 75;
!                               $maxAddressLength = 30;
!                               for($i=0; $i<count($headers['header']); $i++)
                                {
!                                       if 
(!empty($headers['header'][$i]['subject']))
                                        {
!                                               // make the subject shorter if 
it is to long
!                                               
if(strlen($headers['header'][$i]['subject']) > $maxSubjectLength)
!                                               {
!                                                       
$headers['header'][$i]['subject'] = 
substr($headers['header'][$i]['subject'],0,$maxSubjectLength)."...";
!                                               }
!                                               
$headers['header'][$i]['subject'] = 
htmlentities($headers['header'][$i]['subject']);
!                                               
if($headers['header'][$i]['attachments'] == "true")
!                                               {
!                                                       $image = '<img 
src="'.PHPGW_IMAGES.'/attach.gif" border="0">';
!                                                       
$headers['header'][$i]['subject'] = 
"$image&nbsp;".$headers['header'][$i]['subject'];
!                                               }
!                                               
$this->t->set_var('header_subject', $headers['header'][$i]['subject']);
!                                       
                                        }
!                                       else
                                        {
!                                               
$this->t->set_var('header_subject',htmlentities("(".lang('no subject').")"));
                                        }
                                
!                                       if ($mailPreferences['sent_folder'] == 
$this->mailbox)
                                        {
!                                               if 
(!empty($headers['header'][$i]['to_name']))
!                                               {
!                                                       $sender_name    = 
$headers['header'][$i]['to_name'];
!                                                       $full_address   =
!                                                               
$headers['header'][$i]['to_name'].
!                                                               " <".
!                                                               
$headers['header'][$i]['to_address'].
!                                                               ">";
!                                               }
!                                               else
!                                               {
!                                                       $sender_name    = 
$headers['header'][$i]['to_address'];
!                                                       $full_address   = 
$headers['header'][$i]['to_address'];
!                                               }
!                                               
$this->t->set_var('lang_from',lang("to"));
                                        }
                                        else
                                        {
!                                               if 
(!empty($headers['header'][$i]['sender_name']))
!                                               {
!                                                       $sender_name    = 
$headers['header'][$i]['sender_name'];
!                                                       $full_address   = 
!                                                               
$headers['header'][$i]['sender_name'].
!                                                               " <".
!                                                               
$headers['header'][$i]['sender_address'].
!                                                               ">";
!                                               }
!                                               else
!                                               {
!                                                       $sender_name    = 
$headers['header'][$i]['sender_address'];
!                                                       $full_address   = 
$headers['header'][$i]['sender_address'];
!                                               }
!                                               
$this->t->set_var('lang_from',lang("from"));
                                        }
!                                       if(strlen($sender_name) > 
$maxAddressLength)
                                        {
!                                               $sender_name = 
substr($sender_name,0,$maxAddressLength)."...";
                                        }
!                                       
$this->t->set_var('sender_name',$sender_name);
!                                       
$this->t->set_var('full_address',$full_address);
!                               
!                                       
if($GLOBALS['HTTP_GET_VARS']["select_all"] == "select_all")
                                        {
!                                               
$this->t->set_var('row_selected',"checked");
                                        }
  
!                                       $this->t->set_var('message_counter',$i);
!                                       
$this->t->set_var('message_uid',$headers['header'][$i]['uid']);
!                                       
$this->t->set_var('date',$headers['header'][$i]['date']);
!                                       
$this->t->set_var('size',$this->show_readable_size($headers['header'][$i]['size']));
!                                       $flags = "";
!                                       
if(!empty($headers['header'][$i]['recent'])) $flags .= "R";
!                                       
if(!empty($headers['header'][$i]['flagged'])) $flags .= "F";
!                                       
if(!empty($headers['header'][$i]['answered'])) $flags .= "A";
!                                       
if(!empty($headers['header'][$i]['deleted'])) $flags .= "D";
!                                       
if(!empty($headers['header'][$i]['seen'])) $flags .= "S";
!                                       #$this->t->set_var('flags',$flags);     
! 
! #                                     $linkData = array
! #                                     (
! #                                             'mailbox'       => $urlMailbox,
! #                                             'passed_id'     => 
$headers['header'][$i]['id'],
! #                                             'uid'           => 
$headers['header'][$i]['uid'],
! #                                     );
! #                                     
$this->t->set_var('url_read_message',$GLOBALS['phpgw']->link('/felamimail/read_body.php',$linkData));
                                
!                                       $linkData = array
!                                       (
!                                               'menuaction'    => 
'felamimail.uidisplay.display',
!                                               'showHeader'    => 'false',
!                                               'uid'           => 
$headers['header'][$i]['uid']
!                                       );
!                                       
$this->t->set_var('url_read_message',$GLOBALS['phpgw']->link('/index.php',$linkData));
                                
!                                       $linkData = array
!                                       (
!                                               'menuaction'    => 
'felamimail.uicompose.compose',
!                                               'send_to'       => 
urlencode($headers['header'][$i]['sender_address'])
!                                       );
!                                       
$this->t->set_var('url_compose',$GLOBALS['phpgw']->link('/index.php',$linkData));
!                                       
!                                       $linkData = array
!                                       (
!                                               'menuaction'    => 
'addressbook.uiaddressbook.add_email',
!                                               'add_email'     => 
urlencode($headers['header'][$i]['sender_address']),
!                                               'name'          => 
urlencode($headers['header'][$i]['sender_name']),
!                                               'referer'       => 
urlencode($GLOBALS['PHP_SELF'].'?'.$GLOBALS['QUERY_STRING'])
!                                       );
!                                       
$this->t->set_var('url_add_to_addressbook',$GLOBALS['phpgw']->link('/index.php',$linkData));
!                                       
!                                       
$this->t->set_var('phpgw_images',PHPGW_IMAGES);
!                                       
$this->t->set_var('row_css_class','header_row_'.$flags);
!                                       switch($flags)
!                                       {
!                                               case "":
!                                                       
$this->t->set_var('imageName','unread_small.png');
!                                                       
$this->t->set_var('row_text',lang('new'));
!                                                       break;
!                                               case "D":
!                                               case "DS":
!                                               case "ADS":
!                                                       
$this->t->set_var('imageName','unread_small.png');
!                                                       
$this->t->set_var('row_text',lang('deleted'));
!                                                       break;
!                                               case "F":
!                                                       
$this->t->set_var('imageName','unread_flagged_small.png');
!                                                       
$this->t->set_var('row_text',lang('new'));
!                                                       break;
!                                               case "FS":
!                                                       
$this->t->set_var('imageName','read_flagged_small.png');
!                                                       
$this->t->set_var('row_text',lang('replied'));
!                                                       break;
!                                               case "FAS":
!                                                       
$this->t->set_var('imageName','read_answered_flagged_small.png');
!                                                       
$this->t->set_var('row_text',lang('replied'));
!                                                       break;
!                                               case "S":
!                                               case "RS":
!                                                       
$this->t->set_var('imageName','read_small.png');
!                                                       
$this->t->set_var('row_text',lang('read'));
!                                                       break;
!                                               case "R":
!                                                       
$this->t->set_var('imageName','recent_small.gif');
!                                                       
$this->t->set_var('row_text','*'.lang('recent').'*');
!                                                       break;
!                                               case "AS":
!                                                       
$this->t->set_var('imageName','read_answered_small.png');
!                                                       
$this->t->set_var('row_text',lang('replied'));
!                                                       break;
!                                               default:
!                                                       
$this->t->set_var('row_text',$flags);
!                                                       break;
!                                       }
                        
!                                       
$this->t->parse('header_rows','header_row',True);
!                               }
!                               $firstMessage = $headers['info']['first'];
!                               $lastMessage = $headers['info']['last'];
!                               $totalMessage = $headers['info']['total'];
!                               $langTotal = lang("total");             
                        }
  
+                       $this->t->set_var('maxMessages',$i);
+                       
                        // set the select all/nothing link
                        if($GLOBALS['HTTP_GET_VARS']["select_all"] == 
"select_all")
***************
*** 577,591 ****
                        $this->t->parse('status_row','status_row_tpl',True);
                        
!                       for($i=0; $i<count($folders); $i++)
                        {
                                $selected = '';
!                               if ($this->mailbox == $folders[$i]) 
                                {
                                        $selected = ' selected';
                                }
                                $options_folder .= sprintf('<option 
value="%s"%s>%s</option>',
!                                                       
htmlspecialchars($folders[$i]),
                                                        $selected,
!                                                       
htmlspecialchars($folders[$i]));
                        }
                        $this->t->set_var('options_folder',$options_folder);
--- 657,672 ----
                        $this->t->parse('status_row','status_row_tpl',True);
                        
!                       @reset($folders);
!                       while(list($key,$value) = @each($folders))
                        {
                                $selected = '';
!                               if ($this->mailbox == $key) 
                                {
                                        $selected = ' selected';
                                }
                                $options_folder .= sprintf('<option 
value="%s"%s>%s</option>',
!                                                       htmlspecialchars($key),
                                                        $selected,
!                                                       
htmlspecialchars($value));
                        }
                        $this->t->set_var('options_folder',$options_folder);
***************
*** 597,609 ****
                        
$this->t->set_var('url_compose_empty',$GLOBALS['phpgw']->link('/index.php',$linkData));
  
- /*                    $linkData = array
-                       (
-                               'menuaction'    => 
'felamimail.uifelamimail.toggleFilter',
-                               'mailbox'       => $urlMailbox,
-                               'startMessage'  => $this->startMessage,
-                               'sort'          => $this->sort,
-                       );
-                       
$this->t->set_var('url_status_filter',$GLOBALS['phpgw']->link('/index.php',$linkData));*/
- 
                        $linkData = array
                        (
--- 678,681 ----
***************
*** 617,627 ****
                        );
                        
$this->t->set_var('url_change_folder',$GLOBALS['phpgw']->link('/index.php',$linkData));
                        $this->t->set_var('lang_mark_messages_as',lang('mark 
messages as'));
!                       $this->t->set_var('lang_delete_selected',lang('delete 
selected messages'));
                                                                                
                                                                                
                                
                        $this->t->parse("out","main");
                        print $this->t->get('out','main');
                        
!                       $this->bofelamimail->closeConnection();
                        $GLOBALS['phpgw']->common->phpgw_footer();
                
--- 689,709 ----
                        );
                        
$this->t->set_var('url_change_folder',$GLOBALS['phpgw']->link('/index.php',$linkData));
+ 
+                       $linkData = array
+                       (
+                               'menuaction'    => 
'felamimail.uifelamimail.changeFilter'
+                       );
+                       
$this->t->set_var('url_search_settings',$GLOBALS['phpgw']->link('/index.php',$linkData));
+ 
                        $this->t->set_var('lang_mark_messages_as',lang('mark 
messages as'));
!                       $this->t->set_var('lang_delete',lang('delete'));
                                                                                
                                                                                
                                
                        $this->t->parse("out","main");
                        print $this->t->get('out','main');
                        
!                       if($this->connectionStatus == 'True')
!                       {
!                               $this->bofelamimail->closeConnection();
!                       }
                        $GLOBALS['phpgw']->common->phpgw_footer();
                
***************
*** 679,682 ****
--- 761,765 ----
                        $this->t->set_var('lang_date',lang("date"));
                        $this->t->set_var('lang_size',lang("size"));
+                       
$this->t->set_var('lang_quicksearch',lang("Quicksearch"));
                        $this->t->set_var('lang_replied',lang("replied"));
                        $this->t->set_var('lang_read',lang("read"));
***************
*** 689,692 ****
--- 772,776 ----
                        $this->t->set_var('lang_add_to_addressbook',lang("add 
to addressbook"));
                        $this->t->set_var('lang_no_filter',lang("no filter"));
+                       $this->t->set_var('lang_connection_failed',lang("The 
connection to the IMAP Server failed!!"));
                }
        }

Index: class.uifilter.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/class.uifilter.inc.php,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** class.uifilter.inc.php      16 Oct 2002 08:09:38 -0000      1.1.2.3
--- class.uifilter.inc.php      10 Mar 2003 21:54:40 -0000      1.1.2.4
***************
*** 191,195 ****
                                $linkData = array
                                (
!                                       'menuaction'    => 
'felamimail.uifelamimail.viewMainScreen',
                                        'filter'        => $key
                                );
--- 191,195 ----
                                $linkData = array
                                (
!                                       'menuaction'    => 
'felamimail.uifelamimail.changeFilter',
                                        'filter'        => $key
                                );

Index: hook_home.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/hook_home.inc.php,v
retrieving revision 1.1.1.1.2.4
retrieving revision 1.1.1.1.2.5
diff -C2 -r1.1.1.1.2.4 -r1.1.1.1.2.5
*** hook_home.inc.php   21 Oct 2002 20:27:10 -0000      1.1.1.1.2.4
--- hook_home.inc.php   10 Mar 2003 21:54:40 -0000      1.1.1.1.2.5
***************
*** 22,51 ****
        $tmp_app_inc = $GLOBALS['phpgw']->common->get_inc_dir('felamimail');
  
!       if 
($GLOBALS['phpgw_info']['user']['preferences']['felamimail']['mainscreen_showmail']
 == True)
!       {
!               // ----  Create the base email Msg Class    -----
                $GLOBALS['phpgw']->translation->add_app('felamimail');
                $GLOBALS['phpgw']->msg = CreateObject("email.mail_msg");
!               $args_array = Array();
!               $args_array['folder'] = 'INBOX';
!               $args_array['do_login'] = True;
!               $GLOBALS['phpgw']->msg->begin_request($args_array);
! 
!               if (!$GLOBALS['phpgw']->msg->mailsvr_stream)
!               {
!                       $error_msg = '<b>Mail error:</b> Can not open 
connection to mail server';
!                       echo "\r\n"
!                       .'<tr>'."\r\n"
!                               .'<td align="left">'."\r\n"
!                                       .'<!-- start Mailbox info -->'."\r\n"
!                                       .$error_msg."\r\n"
!                                       .'<!-- ends Mailox info -->'."\r\n"
!                               .'</td>'."\r\n"
!                       .'</tr>'."\r\n";
!                       //$GLOBALS['phpgw']->common->phpgw_exit(True);
!               }
!               else
!               {
!                       $title = '<font 
color="#FFFFFF">'.lang('E-Mail').'</font>';
                
                        $portalbox = CreateObject('phpgwapi.listbox',
--- 22,51 ----
        $tmp_app_inc = $GLOBALS['phpgw']->common->get_inc_dir('felamimail');
  
! #     if 
($GLOBALS['phpgw_info']['user']['preferences']['felamimail']['mainscreen_showmail']
 == True)
! #     {
! #             // ----  Create the base email Msg Class    -----
                $GLOBALS['phpgw']->translation->add_app('felamimail');
                $GLOBALS['phpgw']->msg = CreateObject("email.mail_msg");
! #             $args_array = Array();
! #             $args_array['folder'] = 'INBOX';
! #             $args_array['do_login'] = True;
! #             $GLOBALS['phpgw']->msg->begin_request($args_array);
! 
! #             if (!$GLOBALS['phpgw']->msg->mailsvr_stream)
! #             {
! #                     $error_msg = '<b>Mail error:</b> Can not open 
connection to mail server';
! #                     echo "\r\n"
! #                     .'<tr>'."\r\n"
! #                             .'<td align="left">'."\r\n"
! #                                     .'<!-- start Mailbox info -->'."\r\n"
! #                                     .$error_msg."\r\n"
! #                                     .'<!-- ends Mailox info -->'."\r\n"
! #                             .'</td>'."\r\n"
! #                     .'</tr>'."\r\n";
! #                     //$GLOBALS['phpgw']->common->phpgw_exit(True);
! #             }
! #             else
! #             {
!                       $title = '<font 
color="#FFFFFF">'.lang('felamimail').'</font>';
                
                        $portalbox = CreateObject('phpgwapi.listbox',
***************
*** 57,61 ****
                                        'width' => '100%',
                                        'outerborderwidth'      => '0',
!                                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi/templates/default','bg_filler')
                                )
                        );
--- 57,61 ----
                                        'width' => '100%',
                                        'outerborderwidth'      => '0',
!                                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi/templates/phpgw_website','bg_filler.gif')
                                )
                        );
***************
*** 79,152 ****
  
                
!                       /*  // this is the structure you will get
!                         $inbox_data['is_imap'] boolean - pop3 server do not 
know what is "new" or not
!                         $inbox_data['folder_checked'] string - the folder 
checked, as processed by the msg class
!                         $inbox_data['alert_string'] string - what to show the 
user about this inbox check
!                         $inbox_data['number_new'] integer - for IMAP is 
number "unseen"; for pop3 is number messages
!                         $inbox_data['number_all'] integer - for IMAP and pop3 
is total number messages in that inbox
!                       */
!                       $inbox_data = Array();
!                       $inbox_data = 
$GLOBALS['phpgw']->msg->new_message_check();
! 
!                       if($inbox_data['number_all'] >= 5)
!                       {
!                               $check_msgs = 5;
!                       }
!                       else
!                       {
!                               $check_msgs = $inbox_data['number_all'];
!                       }
! 
!                       if ($inbox_data['number_all'] > 0)
!                       {
!                               $msg_array = array();
!                               $msg_array = 
$GLOBALS['phpgw']->msg->get_message_list();
!                       }
!                       for($i=0; $i<$check_msgs; $i++)
!                       {
!                               $msg = 
$GLOBALS['phpgw']->dcom->header($GLOBALS['phpgw']->msg->mailsvr_stream,$msg_array[$i]);
!                               $subject = 
$GLOBALS['phpgw']->msg->get_subject($msg,'');
!                               if (strlen($subject) > 65)
!                               {
!                                       $subject = substr($subject,0,65).' ...';
!                               }
!                               $linkData = array
!                               (
!                                       'mailbox'       => 
$GLOBALS['phpgw']->msg->prep_folder_out(''),
!                                       'passed_id'     => $msg_array[$i],
!                                       'startMessage'  => 1,
!                                       'show_more'     => 0
!                               );
!                               $data[] = array(
!                                       'data'  => $subject,
!                                       'link'  => 
$GLOBALS['phpgw']->link('/felamimail/read_body.php',$linkData)
!                               );
!                       }
!                       // ADD FOLDER LISTBOX TO HOME PAGE (Needs to be 
TEMPLATED)
!                       // Does This Mailbox Support Folders (i.e. more than 
just INBOX)?
!                       if 
($GLOBALS['phpgw']->msg->get_mailsvr_supports_folders() == False)
!                       {
!                               $extra_data = '';
!                       }
!                       else
!                       {
!                               // FUTURE: this will pick up the user option to 
show num unseen msgs in dropdown list
!                               //$listbox_show_unseen = True;
!                               $listbox_show_unseen = False;
!                               $switchbox_listbox = '<select name="mailbox" 
onChange="document.switchbox.submit()">'
!                                               . '<option>' . lang('switch 
current folder to') . ':'
!                                               . 
$GLOBALS['phpgw']->msg->all_folders_listbox('','','',$listbox_show_unseen)
!                                               . '</select>';
!                               // make it another TR we can insert
!                               $switchbox_action = 
$GLOBALS['phpgw']->link('/felamimail/index.php');
!                               $extra_data = '<form name="switchbox" 
action="'.$switchbox_action.'" method="post">'."\r\n"
!                                       .'<td align="left">'."\r\n"
!                                       .'&nbsp;<strong>'.lang('E-Mail 
Folders').':</strong>&nbsp;'.$switchbox_listbox
!                                       .'<input type="hidden" 
name="startMessage" value="1">'
!                                       .'</td>'."\r\n"
!                                       .'</form>'."\r\n";
!                       }
!                       $GLOBALS['phpgw']->msg->end_request();
! 
                        if($data)
                        {
--- 79,152 ----
  
                
! #                     /*  // this is the structure you will get
! #                       $inbox_data['is_imap'] boolean - pop3 server do not 
know what is "new" or not
! #                       $inbox_data['folder_checked'] string - the folder 
checked, as processed by the msg class
! #                       $inbox_data['alert_string'] string - what to show the 
user about this inbox check
! #                       $inbox_data['number_new'] integer - for IMAP is 
number "unseen"; for pop3 is number messages
! #                       $inbox_data['number_all'] integer - for IMAP and pop3 
is total number messages in that inbox
! #                     */
! #                     $inbox_data = Array();
! #                     $inbox_data = 
$GLOBALS['phpgw']->msg->new_message_check();
! #
! #                     if($inbox_data['number_all'] >= 5)
! #                     {
! #                             $check_msgs = 5;
! #                     }
! #                     else
! #                     {
! #                             $check_msgs = $inbox_data['number_all'];
! #                     }
! 
! #                     if ($inbox_data['number_all'] > 0)
! #                     {
! #                             $msg_array = array();
! #                             $msg_array = 
$GLOBALS['phpgw']->msg->get_message_list();
! #                     }
! #                     for($i=0; $i<$check_msgs; $i++)
! #                     {
! #                             $msg = 
$GLOBALS['phpgw']->dcom->header($GLOBALS['phpgw']->msg->mailsvr_stream,$msg_array[$i]);
! #                             $subject = 
$GLOBALS['phpgw']->msg->get_subject($msg,'');
! #                             if (strlen($subject) > 65)
! #                             {
! #                                     $subject = substr($subject,0,65).' ...';
! #                             }
! #                             $linkData = array
! #                             (
! #                                     'mailbox'       => 
$GLOBALS['phpgw']->msg->prep_folder_out(''),
! #                                     'passed_id'     => $msg_array[$i],
! #                                     'startMessage'  => 1,
! #                                     'show_more'     => 0
! ##                            );
! #                             $data[] = array(
! #                                     'data'  => $subject,
! #                                     'link'  => 
$GLOBALS['phpgw']->link('/felamimail/read_body.php',$linkData)
! #                             );
! #                     }
! #                     // ADD FOLDER LISTBOX TO HOME PAGE (Needs to be 
TEMPLATED)
! #                     // Does This Mailbox Support Folders (i.e. more than 
just INBOX)?
! #                     if 
($GLOBALS['phpgw']->msg->get_mailsvr_supports_folders() == False)
! #                     {
! #                             $extra_data = '';
! #                     }
! #                     else
! #                     {
! #                             // FUTURE: this will pick up the user option to 
show num unseen msgs in dropdown list
! #                             //$listbox_show_unseen = True;
! #                             $listbox_show_unseen = False;
! #                             $switchbox_listbox = '<select name="mailbox" 
onChange="document.switchbox.submit()">'
! #                                             . '<option>' . lang('switch 
current folder to') . ':'
! #                                             . 
$GLOBALS['phpgw']->msg->all_folders_listbox('','','',$listbox_show_unseen)
! #                                             . '</select>';
! #                             // make it another TR we can insert
! #                             $switchbox_action = 
$GLOBALS['phpgw']->link('/felamimail/index.php');
! #                             $extra_data = '<form name="switchbox" 
action="'.$switchbox_action.'" method="post">'."\r\n"
! #                                     .'<td align="left">'."\r\n"
! #                                     .'&nbsp;<strong>'.lang('E-Mail 
Folders').':</strong>&nbsp;'.$switchbox_listbox
! #                                     .'<input type="hidden" 
name="startMessage" value="1">'
! #                                     .'</td>'."\r\n"
! #                                     .'</form>'."\r\n";
! #                     }
! #                     $GLOBALS['phpgw']->msg->end_request();
! #
                        if($data)
                        {
***************
*** 158,162 ****
                                .$portalbox->draw($extra_data)
                                .'<!-- ends Mailox info -->'."\r\n";
!               }
!       }
  ?>
--- 158,162 ----
                                .$portalbox->draw($extra_data)
                                .'<!-- ends Mailox info -->'."\r\n";
! #             }
! #     }
  ?>

Index: hook_preferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/hook_preferences.inc.php,v
retrieving revision 1.2.2.5
retrieving revision 1.2.2.6
diff -C2 -r1.2.2.5 -r1.2.2.6
*** hook_preferences.inc.php    16 Oct 2002 08:09:38 -0000      1.2.2.5
--- hook_preferences.inc.php    10 Mar 2003 21:54:40 -0000      1.2.2.6
***************
*** 22,34 ****
                                          
        $file = array(
!               'Mail Settings '          => 
$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=felamimail'),
!               'Mail Settings'           => 
$GLOBALS['phpgw']->link('/felamimail/preferences_email.php'),
!               'Message Highlighting'    => 
$GLOBALS['phpgw']->link('/felamimail/preferences_highlight.php'),
!               'Index Order'             => 
$GLOBALS['phpgw']->link('/felamimail/preferences_index_order.php'),
!               'Translation Preferences' => 
$GLOBALS['phpgw']->link('/felamimail/preferences_translate.php'),
!               'Display Preferences'     => 
$GLOBALS['phpgw']->link('/felamimail/preferences_display.php'),
                'Manage Sieve'            => 
$GLOBALS['phpgw']->link('/index.php',$sieveLinkData),
!               'Folder Preferences'      => 
$GLOBALS['phpgw']->link('/felamimail/preferences_folder.php'),
!               'Manage Folders'          => 
$GLOBALS['phpgw']->link('/felamimail/folders.php') 
        );
  //Do not modify below this line
--- 22,33 ----
                                          
        $file = array(
!               'Preferences'             => 
$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=felamimail'),
! /*            'Mail Settings'           => 
$GLOBALS['phpgw']->link('/felamimail/preferences_email.php'),*/
! /*            'Message Highlighting'    => 
$GLOBALS['phpgw']->link('/felamimail/preferences_highlight.php'),*/
! /*            'Index Order'             => 
$GLOBALS['phpgw']->link('/felamimail/preferences_index_order.php'),*/
! /*            'Translation Preferences' => 
$GLOBALS['phpgw']->link('/felamimail/preferences_translate.php'),*/
! /*            'Display Preferences'     => 
$GLOBALS['phpgw']->link('/felamimail/preferences_display.php'),*/
                'Manage Sieve'            => 
$GLOBALS['phpgw']->link('/index.php',$sieveLinkData),
!               'Manage Folders'          => 
$GLOBALS['phpgw']->link('/index.php','menuaction=felamimail.uipreferences.listFolder')
     
        );
  //Do not modify below this line

Index: hook_settings.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/felamimail/inc/hook_settings.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** hook_settings.inc.php       16 Oct 2002 17:18:24 -0000      1.1.2.1
--- hook_settings.inc.php       10 Mar 2003 21:54:40 -0000      1.1.2.2
***************
*** 12,27 ****
        /* $Id$ */
  
!       $templates = $GLOBALS['phpgw']->common->list_templates();
!       while (list($var,$value) = each($templates))
!       {
!               $_templates[$var] = $templates[$var]['title'];
!       }
! 
!       $themes = $GLOBALS['phpgw']->common->list_themes();
!       while (list(,$value) = each($themes))
!       {
!               $_themes[$value] = $value;
!       }
! 
  
        $refreshTime = array(
--- 12,21 ----
        /* $Id$ */
  
!       $this->bofelamimail = CreateObject('felamimail.bofelamimail');
!       $this->bofelamimail->openConnection('',OP_HALFOPEN);
!       $folderList = $this->bofelamimail->getFolderList();
!       reset($folderList);
!       
!       $this->bofelamimail->closeConnection();
  
        $refreshTime = array(
***************
*** 42,51 ****
        );
        create_select_box('Refresh time in minutes','refreshTime',$refreshTime);
!       create_text_area('email signature','email_sig',3,30);
!       $selectOptions = array(
                '0' => lang('date(newest first)'),
                '1' => lang('date(oldest first)')
        );
!       create_select_box('Default sorting order','sortOrder',$selectOptions);
        $selectOptions = array(
                '0' => lang('no'),
--- 36,48 ----
        );
        create_select_box('Refresh time in minutes','refreshTime',$refreshTime);
! 
!       create_text_area('email signature','email_sig',3,40);
! 
!       $sortOrder = array(
                '0' => lang('date(newest first)'),
                '1' => lang('date(oldest first)')
        );
!       create_select_box('Default sorting order','sortOrder',$sortOrder);
! 
        $selectOptions = array(
                '0' => lang('no'),
***************
*** 53,56 ****
--- 50,74 ----
        );
        create_select_box('show new messages on main 
screen','mainscreen_showmail',$selectOptions);
+ 
+       $deleteOptions = array(
+               'move_to_trash'         => lang('move to trash'),
+               'mark_as_deleted'       => lang('mark as deleted'),
+               'remove_immediately'    => lang('remove immediately')
+       );
+       create_select_box('when deleting 
messages','deleteOptions',$deleteOptions);
+ 
+       $trashOptions = array_merge(
+               array(
+               'none' => lang("Don't use Trash")),
+               $folderList
+       );
+       create_select_box('trash folder','trashFolder',$trashOptions);
+ 
+       $sentOptions = array_merge(
+               array(
+               'none' => lang("Don't use Sent")),
+               $folderList
+       );
+       create_select_box('sent folder','sentFolder',$sentOptions);
        
  /*    create_input_box('Max matches per page','maxmatchs');





reply via email to

[Prev in Thread] Current Thread [Next in Thread]