phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: email/inc class.boaction.inc.php,1.16,1.17 class


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: email/inc class.boaction.inc.php,1.16,1.17 class.boattach_file.inc.php,1.3,1.4 class.bocompose.inc.php,1.7,1.8 class.bofilters.inc.php,1.13,1.14 class.bofolder.inc.php,1.7,1.8 class.boindex.inc.php,1.29,1.30class.bojsaddressbook.inc.php,1.1,1.2 class.bomessage.inc.php,1.13,1.14class.bopreferences.inc.php,1.22,1.23 class.bosend.inc.php,1.10,1.11 class.html_widgets.inc.php,1.2,1.3 class.mail_dcom.inc.php,1.9,1.10class.mail_dcom_base.inc.php,1.8,1.9 class.mail_dcom_base_sock.inc.php,1.23,1.24 class.mail_dcom_imap.inc.php,1.20,1.21 class.mail_dcom_imap_sock.inc.php,1.14,1.15 class.mail_dcom_nntp.inc.php,1.3,1.4 class.mail_dcom_nntp_sock.inc.php,1.4,1.5 class.mail_dcom_pop3.inc.php,1.10,1.11 class.mail_dcom_pop3_sock.inc.php,1.19,1.20 class.mail_filters.inc.php,1.6,1.7 class.mail_msg.inc.php,1.3,1.4 class.mail_msg_base.inc.php,1.77,1.78 class.mail_msg_display.inc.php,1.39,1.40 class.mail_msg_wrappers.inc.php,1.36,1.37class.mail_send.inc.php,1.10,1.11 class.msg_bootstrap.inc.php,1.1,1.2 class.spell.inc.php,1.1,1.2 class.spell_struct.inc.php,1.1,1.2class.spell_svc_none.inc.php,1.1,1.2 class.spell_svc_php.inc.php,1.1,1.2class.svc_nextmatches.inc.php,1.1,1.2 class.ui_mail_debug.inc.php,1.1,1.2 class.uiattach_file.inc.php,1.1,1.2 class.uicompose.inc.php,1.3,1.4 class.uifilters.inc.php,1.11,1.12 class.uifolder.inc.php,1.3,1.4 class.uiindex.inc.php,1.20,1.21class.uijsaddressbook.inc.php,1.2,1.3 class.uimessage.inc.php,1.8,1.9 class.uipreferences.inc.php,1.15,1.16 functions.inc.php,1.115,1.116 hook_admin.inc.php,1.5,1.6 hook_home.inc.php,1.55,1.56 hook_manual.inc.php,1.7,1.8 hook_notifywindow.inc.php,1.10,1.11 hook_notifywindow_simple.inc.php,1.8,1.9 hook_preferences.inc.php,1.13,1.14 selectboxes.js,1.1,1.2 hook_add_def_pref.inc.php,1.1,NONE hook_help.inc.php,1.1,NONE
Date: Thu, 13 Mar 2003 23:04:11 -0500

Update of /cvsroot/phpgroupware/email/inc
In directory subversions:/tmp/cvs-serv14421/inc

Modified Files:
        class.boaction.inc.php class.boattach_file.inc.php 
        class.bocompose.inc.php class.bofilters.inc.php 
        class.bofolder.inc.php class.boindex.inc.php 
        class.bojsaddressbook.inc.php class.bomessage.inc.php 
        class.bopreferences.inc.php class.bosend.inc.php 
        class.html_widgets.inc.php class.mail_dcom.inc.php 
        class.mail_dcom_base.inc.php class.mail_dcom_base_sock.inc.php 
        class.mail_dcom_imap.inc.php class.mail_dcom_imap_sock.inc.php 
        class.mail_dcom_nntp.inc.php class.mail_dcom_nntp_sock.inc.php 
        class.mail_dcom_pop3.inc.php class.mail_dcom_pop3_sock.inc.php 
        class.mail_filters.inc.php class.mail_msg.inc.php 
        class.mail_msg_base.inc.php class.mail_msg_display.inc.php 
        class.mail_msg_wrappers.inc.php class.mail_send.inc.php 
        class.msg_bootstrap.inc.php class.spell.inc.php 
        class.spell_struct.inc.php class.spell_svc_none.inc.php 
        class.spell_svc_php.inc.php class.svc_nextmatches.inc.php 
        class.ui_mail_debug.inc.php class.uiattach_file.inc.php 
        class.uicompose.inc.php class.uifilters.inc.php 
        class.uifolder.inc.php class.uiindex.inc.php 
        class.uijsaddressbook.inc.php class.uimessage.inc.php 
        class.uipreferences.inc.php functions.inc.php 
        hook_admin.inc.php hook_home.inc.php hook_manual.inc.php 
        hook_notifywindow.inc.php hook_notifywindow_simple.inc.php 
        hook_preferences.inc.php selectboxes.js 
Removed Files:
        hook_add_def_pref.inc.php hook_help.inc.php 
Log Message:
final comit to make all changes from the import HEAD

Index: class.boaction.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.boaction.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** class.boaction.inc.php      15 Nov 2002 07:32:54 -0000      1.16
--- class.boaction.inc.php      14 Mar 2003 04:00:10 -0000      1.17
***************
*** 1,1091 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - email BO Class for Message Actions                        
                *
!       * http://www.anglemail.org                                              
                        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * Copyright (C) 2001, 2002 Angelo Tony Puglisi (Angles)                 
        *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
[...2157 lines suppressed...]
!                               $GLOBALS['phpgw']->redirect($html_reference);
!                               //$GLOBALS['phpgw']->common->phpgw_footer();
!                       }
!                       else
!                       {
!                               $GLOBALS['phpgw']->msg->end_request();
!                               //$GLOBALS['phpgw']->common->phpgw_footer();
!                       }
!                       // close down ALL mailserver streams
!                       $GLOBALS['phpgw']->msg->end_request();
!                       // destroy the object
!                       $GLOBALS['phpgw']->msg = '';
!                       unset($GLOBALS['phpgw']->msg);
!                       // shut down this transaction
!                       $GLOBALS['phpgw']->common->phpgw_exit(False);
!               }
!       
!       
!       }
! ?>

Index: class.boattach_file.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.boattach_file.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.boattach_file.inc.php 17 Nov 2002 00:11:48 -0000      1.3
--- class.boattach_file.inc.php 14 Mar 2003 04:00:10 -0000      1.4
***************
*** 147,151 ****
                we use this function to fill those vars from GPC values here, 
but in the future they could be filled 
                via some external method.  In the days before superglobals, 
these were simple vars "$action" and 
!               also "$delete", but such simple days are over. 
                */
                function fill_control_data_gpc()
--- 147,151 ----
                we use this function to fill those vars from GPC values here, 
but in the future they could be filled 
                via some external method.  In the days before superglobals, 
these were simple vars "$action" and 
!               also "$delete", but such simple days are over. 
                */
                function fill_control_data_gpc()
***************
*** 278,282 ****
                        {
                                echo 'emai.boattach_file.attach ('.__LINE__.'): 
ERROR: initial $this->var_holder needs to be set by this point in the code 
<br>';
!                       }
                        
                        // initialize some variables
--- 278,282 ----
                        {
                                echo 'emai.boattach_file.attach ('.__LINE__.'): 
ERROR: initial $this->var_holder needs to be set by this point in the code 
<br>';
!                       }
                        
                        // initialize some variables
***************
*** 286,290 ****
                        // ensure existance of PHPGROUPWARE temp dir
                        // note: this is different from apache temp dir, and 
different from any other temp file location set in php.ini
!                       if 
(!file_exists($GLOBALS['phpgw_info']['server']['temp_dir']))
                        {
                                
mkdir($GLOBALS['phpgw_info']['server']['temp_dir'],0700);
--- 286,291 ----
                        // ensure existance of PHPGROUPWARE temp dir
                        // note: this is different from apache temp dir, and 
different from any other temp file location set in php.ini
!                       //if 
(!file_exists($GLOBALS['phpgw_info']['server']['temp_dir']))
!                       if 
(!is_dir($GLOBALS['phpgw_info']['server']['temp_dir']))
                        {
                                
mkdir($GLOBALS['phpgw_info']['server']['temp_dir'],0700);
***************
*** 292,296 ****
                
                        // if we were NOT able to create this temp directory, 
then make an ERROR report
!                       if 
(!file_exists($GLOBALS['phpgw_info']['server']['temp_dir']))
                        {
                                $alert_msg .= 'Error:'.'<br>'
--- 293,298 ----
                
                        // if we were NOT able to create this temp directory, 
then make an ERROR report
!                       //if 
(!file_exists($GLOBALS['phpgw_info']['server']['temp_dir']))
!                       if 
(!is_dir($GLOBALS['phpgw_info']['server']['temp_dir']))
                        {
                                $alert_msg .= 'Error:'.'<br>'
***************
*** 301,314 ****
                        }
                
!                       if 
(!file_exists($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . 
$GLOBALS['phpgw_info']['user']['sessionid']))
!                       {
!                               
mkdir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . 
$GLOBALS['phpgw_info']['user']['sessionid'],0700);
!                       }
                
                        //$this->uploaddir = 
$GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . 
$GLOBALS['phpgw_info']['user']['sessionid'] . SEP;
                        $this->uploaddir = 
$GLOBALS['phpgw']->msg->att_files_dir;
                        
                        // if we were NOT able to create this temp directory, 
then make an ERROR report
!                       if (!file_exists($this->uploaddir))
                        {
                                $alert_msg .= 'Error:'.'<br>'
--- 303,322 ----
                        }
                
!                       //if 
(!file_exists($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . 
$GLOBALS['phpgw_info']['user']['sessionid']))
!                       //if 
(!is_dir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . 
$GLOBALS['phpgw_info']['user']['sessionid']))
!                       //{
!                       //      
mkdir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . 
$GLOBALS['phpgw_info']['user']['sessionid'],0700);
!                       //}
                
                        //$this->uploaddir = 
$GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . 
$GLOBALS['phpgw_info']['user']['sessionid'] . SEP;
                        $this->uploaddir = 
$GLOBALS['phpgw']->msg->att_files_dir;
+                       if (!is_dir($this->uploaddir))
+                       {
+                               mkdir($this->uploaddir,0700);
+                       }
                        
                        // if we were NOT able to create this temp directory, 
then make an ERROR report
!                       //if (!file_exists($this->uploaddir))
!                       if (!is_dir($this->uploaddir))
                        {
                                $alert_msg .= 'Error:'.'<br>'
***************
*** 318,322 ****
                                        . '<br>';
                        }
! 
                        // grab externally provided information
                        $this->fill_control_data_gpc();
--- 326,330 ----
                                        . '<br>';
                        }
!                       
                        // grab externally provided information
                        $this->fill_control_data_gpc();
***************
*** 326,333 ****
                        // Squirrelmail <Luke Ehresman> 
http://www.squirrelmail.org
                        // particularly the moving, temporary naming, and the 
".info" file code.
!                       if ($this->control_data['action'] == lang('Delete') ||
!                           $this->control_data['action'] == 
htmlentities(lang('Delete')))
                        {
!                               if ($this->debug > 1) { echo 
'boattach_file.attach ('.__LINE__.'): <b>REQUEST TO DELETE</b> detected 
$this->control_data[action] ('.$this->control_data['action'].') == lang(Delete) 
('.lang('Delete').'): <br>'; }
                                // sometimes $this->control_data[delete][] 
seems to have multiple entries for the same filename
                                for ($i=0; 
$i<count($this->control_data['delete']); $i++)
--- 334,342 ----
                        // Squirrelmail <Luke Ehresman> 
http://www.squirrelmail.org
                        // particularly the moving, temporary naming, and the 
".info" file code.
!                       
!                       if ($this->control_data['action'] == lang('Delete')
!                       || $this->control_data['action'] == 
htmlentities(lang('Delete')))
                        {
!                               if ($this->debug > 1) { echo 
'boattach_file.attach ('.__LINE__.'): <b>REQUEST TO DELETE</b> detected 
$this->control_data[action] ('.$this->control_data['action'].') == lang(Delete) 
('.lang('Delete').'): <br>'; } 
                                // sometimes $this->control_data[delete][] 
seems to have multiple entries for the same filename
                                for ($i=0; 
$i<count($this->control_data['delete']); $i++)
***************
*** 357,362 ****
                        }
                        
!                       if (($this->control_data['action'] == lang('Attach 
File') ||
!                            $this->control_data['action'] == 
htmlentities(lang('Attach File')))
                        && ($this->file_data['file_tmp_name'] != '')
                        && ($this->file_data['file_tmp_name'] != 'none'))
--- 366,371 ----
                        }
                        
!                       if (($this->control_data['action'] == lang('Attach 
File')
!                               || $this->control_data['action'] == 
htmlentities(lang('Attach File')))
                        && ($this->file_data['file_tmp_name'] != '')
                        && ($this->file_data['file_tmp_name'] != 'none'))
***************
*** 385,391 ****
                        {
                                $langed_attach_file = lang("Attach File");
!                               $alert_msg = lang('Input Error').':<br>'
!                                       . lang('Please submit a filename to 
attach').'.<br>'
!                                       . lang('You must click %1 for the file 
to actually upload','"'.lang('Attach File').'"').'.<br>'
                                        . '<br>';
                        }
--- 394,400 ----
                        {
                                $langed_attach_file = lang("Attach File");
!                               $alert_msg = lang('Input Error:').'<br>'
!                                       . lang('Please submit a filename to 
attach').'<br>'
!                                       . lang('You must click').' 
"'.lang('Attach File').'" '.lang('for the file to actually upload').'<br>'
                                        . '<br>';
                        }

Index: class.bocompose.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.bocompose.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.bocompose.inc.php     6 Dec 2002 23:49:47 -0000       1.7
--- class.bocompose.inc.php     14 Mar 2003 04:00:10 -0000      1.8
***************
*** 1,764 ****
! <?php
!       
/**************************************************************************\
!       * Anglemail - email BO Class Compose and SpellCheck                     
*
!       * http://www.anglemail.org                                              
                *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * Copyright 2001, 2002 Angelo "Angles" Puglisi 
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
[...1564 lines suppressed...]
!                                       
$this->xi['ischecked_checkbox_req_notify'] = False;
!                               }
!                       }
!                       else
!                       {
!                               // initial showing of compose page
!                               // ---- email_sig ----
!                               // initial showing of compose page only needs 
to care about the users pref for the signature
!                               // if we are going to show it then at this 
point we WILL check it because pref value has text
!                               $this->xi['ischecked_checkbox_sig'] = 
$this->xi['do_checkbox_sig'];
!                               // ---- req_notify ----
!                               // note that "req_notify" has no pref value, 
initial state is always unchecked
!                               $this->xi['ischecked_checkbox_req_notify'] = 
False;
!                       }
!                       
!               }
! 
! 
!       }
! ?>

Index: class.bofilters.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.bofilters.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** class.bofilters.inc.php     25 Oct 2002 12:45:52 -0000      1.13
--- class.bofilters.inc.php     14 Mar 2003 04:00:10 -0000      1.14
***************
*** 1,1877 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Filters                                            
                        *
!       * http://www.anglemail.org                                              
                        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * Copyright (C) 2001, 2002 Angelo Puglisi (Angles)                      
                *
!       * -----------------------------------------------                       
                                *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
[...3962 lines suppressed...]
!                               $this->result_set = $initial_result_set;
!                               if ($this->debug > 0) { echo 'bofilters: 
do_imap_search: number of matches = ' .count($this->result_set).'<br>'."\r\n"; }
!                               // make a "fake" folder_info array to make 
things simple for get_msg_list_display
!                               $this->fake_folder_info['is_imap'] = True;
!                               $this->fake_folder_info['folder_checked'] = 
$GLOBALS['phpgw']->msg->get_arg_value('folder');
!                               $this->fake_folder_info['alert_string'] = 'you 
have search results';
!                               $this->fake_folder_info['number_new'] = 
count($this->result_set);
!                               $this->fake_folder_info['number_all'] = 
count($this->result_set);
!                               // retrieve user displayable data for each 
message in the result set
!                               $this->result_set_mlist = 
$GLOBALS['phpgw']->msg->get_msg_list_display($this->fake_folder_info,$this->result_set);
!                       }
!                       $GLOBALS['phpgw']->msg->end_request();
!                       //echo 'bofilters: do_imap_search: returned:<br>'; 
var_dump($this->result_set); echo "<br>\r\n";
!               }
!               */
!               
!       
!       // end of class
!       }
! ?>

Index: class.bofolder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.bofolder.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.bofolder.inc.php      16 Nov 2002 23:13:49 -0000      1.7
--- class.bofolder.inc.php      14 Mar 2003 04:00:10 -0000      1.8
***************
*** 1,361 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - email BO Class for Folder Actions and List Display     
        *
!       * http://www.phpgroupware.org                                           
        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * xml-rpc and soap code template by Milosch and others                  
        *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       class bofolder
!       {
!               var $public_functions = array(
!                       'folder'                => True,
!                       'folder_action'         => True,
!                       'folder_data'           => True
!               );
!               var $nextmatchs;
!               var $msg_bootstrap;
!               var $index_base_link='';
!               //var $debug = True;
!               var $debug = False;
!               var $xi;
!               
!               function bofolder()
!               {
!                       return;
!               }
!               
!               
!               function folder()
!               {
!                       if ($this->debug) { echo 'ENTERING: 
email.bofolder.folder'.'<br>'; }
!                       // create class objects
!                       $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
!                       
!                       // make sure we have msg object and a server stream
!                       $this->msg_bootstrap = 
CreateObject("email.msg_bootstrap");
!                       
$this->msg_bootstrap->ensure_mail_msg_exists('email.bofolder.folder', 
$this->debug);
!                       
!                       // ----  Create or Delete or Rename a Folder ?  ----
!                       // "folder_action()" handles checking if any action 
should be taken
!                       $this->folder_action();
!                       
!                       
!                       // ----  Get a List Of All Folders  AND Display them 
----
!                       $this->folder_data();
!                       
!                       // end the email transaction
!                       //$GLOBALS['phpgw']->msg->end_request();
!                       // NO we may not be really done yet
!               }
!               
!               
!               
!               function folder_action()
!               {
!                       // ----  Create or Delete or Rename a Folder ?  ----
!                       if (($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'create')
!                       || ($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'delete')
!                       || ($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'rename')
!                       || ($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'create_expert')
!                       || ($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'delete_expert')
!                       || ($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'rename_expert'))
!                       {
!                               // we have been requested to do a folder action
!                               
!                               // basic sanity check
!                               if ( 
($GLOBALS['phpgw']->msg->get_isset_arg('["target_fldball"]["folder"]') == False)
!                               || 
($GLOBALS['phpgw']->msg->get_arg_value('["target_fldball"]["folder"]') == '') )
!                               {
!                                       // Error Result Message
!                                       $action_report = lang('Please type a 
folder name in the text box');
!                               }
!                               elseif ( 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename')
!                                 || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename_expert'))
!                               && 
(($GLOBALS['phpgw']->msg->get_isset_arg('["source_fldball"]["folder"]') == 
False)
!                                 || 
($GLOBALS['phpgw']->msg->get_arg_value('["source_fldball"]["folder"]') == '')) )
!                               {
!                                       // Error Result Message
!                                       $action_report = lang('Please select a 
folder to rename');
!                               }
!                               else
!                               {
!                                       $source_fldball = 
$GLOBALS['phpgw']->msg->get_arg_value('source_fldball');
!                                       $target_fldball = 
$GLOBALS['phpgw']->msg->get_arg_value('target_fldball');
!                                       
!                                       //  ----  Establish Email Server 
Connectivity Conventions  ----
!                                       $server_str = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_callstr');
!                                       $name_space = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_namespace');
!                                       $dot_or_slash = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_delimiter');
!                                       
!                                       // ---- Prep Target Folder
!                                       // get rid of the escape \ that 
magic_quotes HTTP POST will add
!                                       // " becomes \" and  '  becomes  \'  
and  \  becomes \\
!                                       $target_stripped = 
$GLOBALS['phpgw']->msg->stripslashes_gpc($target_fldball['folder']);
!                                       $target_fldball['folder'] = 
$target_stripped;
!                                       // == is that necessary ? == are folder 
names allowed with '  "  \  in them ? ===
!                                       // rfc2060 does NOT prohibit them
!                                       
!                                       // obtain propper folder names
!                                       // if this is a delete, the folder name 
will (should) already exist
!                                       // although the user had to type in the 
folder name
!                                       // for these actions,  the "expert" tag 
means:
!                                       // "do not add the name space for me, 
I'm an expert and I know what I'm doing"
!                                       if 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'create_expert')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'delete_expert')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename_expert'))
!                                       {
!                                               // other than stripslashes_gpc, 
 do nothing
!                                               // the user is an expert, do 
not alter the phpgw->msg->get_arg_value('target_folder') name at all
!                                       }
!                                       else
!                                       {
!                                               // since the user is not an 
"expert", we properly prepare the folder name
!                                               // see if the folder already 
exists in the folder lookup list
!                                               // this would be the case if 
the user is deleting a folder
!                                               $target_lookup = 
$GLOBALS['phpgw']->msg->folder_lookup('', $target_fldball['folder']);
!                                               if ($target_lookup != '')
!                                               {
!                                                       // 
phpgw->msg->get_arg_value('target_folder') returned an official long name from 
the lookup
!                                                       
$target_fldball['folder'] = $target_lookup;
!                                               }
!                                               else
!                                               {
!                                                       // the lookup failed, 
so this is not an existing folder
!                                                       // we have to add the 
namespace for the user
!                                                       $target_long = 
$GLOBALS['phpgw']->msg->get_folder_long($target_fldball['folder']);
!                                                       
$target_fldball['folder'] = $target_long;
!                                               }
!                                       }
!                                       
!                                       // add server string to target folder
!                                       $target_fldball['folder'] = 
$server_str.$target_fldball['folder'];
!                                       
!                                       // =====  NOTE:  maybe some "are you 
sure" code ????  =====
!                                       if 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'create')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'create_expert'))
!                                       {
!                                               $success = 
$GLOBALS['phpgw']->msg->phpgw_createmailbox($target_fldball);
!                                       }
!                                       elseif 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'delete')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'delete_expert'))
!                                       {
!                                               $success = 
$GLOBALS['phpgw']->msg->phpgw_deletemailbox($target_fldball);
!                                       }
!                                       elseif 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename_expert'))
!                                       {
!                                               // 
phpgw->msg->get_arg_value('source_folder') is taken directly from the listbox, 
so it *should* be official long name already
!                                               // but it does need to be 
prep'd in because we prep out the foldernames put in that listbox
!                                               $source_preped = 
$GLOBALS['phpgw']->msg->prep_folder_in($source_fldball['folder']);
!                                               $source_fldball['folder'] = 
$source_preped;
!                                               // add server string to source 
folder
!                                               $source_fldball['folder'] = 
$server_str.$source_fldball['folder'];
!                                               $success = 
$GLOBALS['phpgw']->msg->phpgw_renamemailbox($source_fldball, $target_fldball);
!                                       }
!                                       
!                                       // Result Message
!                                       if 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename_expert'))
!                                       {
!                                               $action_report =
!                                                       
$GLOBALS['phpgw']->msg->get_arg_value('action') .' '.lang('folder').' 
&quot;'.htmlspecialchars($source_fldball['folder']).'&quot; '
!                                                       .lang('to').' 
&quot;'.htmlspecialchars($target_fldball['folder']) .'&quot; '
!                                                       .lang('result').' : ';
!                                       }
!                                       else
!                                       {
!                                               $action_report = 
$GLOBALS['phpgw']->msg->get_arg_value('action').' '.lang('folder').' 
&quot;'.htmlspecialchars($target_fldball['folder']).'&quot; '
!                                               .lang('result').' : ';
!                                       }
!                                       // did it work or not
!                                       if ($success)
!                                       {
!                                               // assemble some feedback to 
show
!                                               $action_report = $action_report 
.lang('OK');
!                                       }
!                                       else
!                                       {
!                                               $imap_err = 
$GLOBALS['phpgw']->msg->phpgw_server_last_error();
!                                               if ($imap_err == '')
!                                               {
!                                                       $imap_err = 
lang('unknown error');
!                                               }
!                                               // assemble some feedback to 
show the user about this error
!                                               $action_report = $action_report 
.$imap_err;
!                                       }
!                               }
!                       }
!                       else
!                       {
!                               // we were NOT requested to do a folder action
!                               // we did not have the key data needed 
describing the desired action
!                               $action_report = '';
!                               $success = False;
!                       }
!                       
!                       // save the "action_report" to the $this->xi[] data 
array
!                       $this->xi['action_report'] = $action_report;
!                       
!                       // we may have been  called externally, return this 
action report
!                       //return $action_report;
!                       // we may have been  called externally, return if we 
succeeded or not
!                       return $success;
!               }
!               
!               
!               function folder_data()
!               {
!                       //  ----  Establish Email Server Connectivity 
Conventions  ----
!                       $server_str = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_callstr');
!                       $name_space = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_namespace');
!                       $dot_or_slash = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_delimiter');
!                       
!                       // ----  Get a List Of All Folders  AND Display them 
----
!                       //$folder_list = 
$GLOBALS['phpgw']->msg->get_folder_list();
!                       $folder_list = 
$GLOBALS['phpgw']->msg->get_arg_value('folder_list');
!                       //$folder_list =& 
$GLOBALS['phpgw']->msg->get_arg_value_ref('folder_list');
!                       
!                       if ($this->debug) { echo 'email.bofolder.folder_data: 
$folder_list[] dump:<pre>'; print_r($folder_list); echo '</pre>'; }
!                       
!                       $this->xi['folder_list_display'] = array();
!                       for ($i=0; $i<count($folder_list);$i++)
!                       {
!                               $folder_long = $folder_list[$i]['folder_long'];
!                               $folder_short = 
$folder_list[$i]['folder_short'];
!                               
!                               // SA_ALL gets the stats for the number of:  
messages, recent, unseen, uidnext, uidvalidity
!                               //$mailbox_status = 
$GLOBALS['phpgw']->msg->dcom->status($GLOBALS['phpgw']->msg->get_mailsvr_stream(),"$server_str"."$folder_long",SA_ALL);
!                               $mailbox_status = 
$GLOBALS['phpgw']->msg->phpgw_status("$folder_long");
!                               //$folder_info = array();
!                               //$folder_info = 
$GLOBALS['phpgw']->msg->get_folder_status_info();
!                               
!                               //debug
!                               //$real_long_name = 
$GLOBALS['phpgw']->msg->folder_lookup('',$folder_list[$i]['folder_short']);
!                               //if ($real_long_name != '')
!                               //{
!                               //      echo 'folder exists, official long 
name: '.$real_long_name.'<br>';
!                               //}
!                               
!                               $tr_color = 
$this->nextmatchs->alternate_row_color($tr_color);
!                               
$this->xi['folder_list_display'][$i]['list_backcolor'] = $tr_color;
!                               
$this->xi['folder_list_display'][$i]['folder_link'] = $GLOBALS['phpgw']->link(
!                                                               '/index.php',
!                                                               
'menuaction=email.uiindex.index'
!                                                               
.'&fldball[folder]='.$GLOBALS['phpgw']->msg->prep_folder_out($folder_long)
!                                                               
.'&fldball[acctnum]='.$GLOBALS['phpgw']->msg->get_acctnum());
!                               
!                               //if 
((isset($GLOBALS['phpgw']->msg->get_arg_value('show_long')))
!                               if 
(($GLOBALS['phpgw']->msg->get_isset_arg('show_long') == True)
!                               && 
($GLOBALS['phpgw']->msg->get_arg_value('show_long') != ''))
!                               {
!                                       
$this->xi['folder_list_display'][$i]['folder_name'] = $folder_long;
!                               }
!                               else
!                               {
!                                       
$this->xi['folder_list_display'][$i]['folder_name'] = $folder_short;
!                               }
!                               
//$this->xi['folder_list_display'][$i]['folder_name'] = 
$folder_list[$i]['folder_long']);
!                               
//$this->xi['folder_list_display'][$i]['folder_name'] = 
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($folder_long));
!                               
!                               
$this->xi['folder_list_display'][$i]['msgs_unseen'] = 
number_format($mailbox_status->unseen);
!                               
//$this->xi['folder_list_display'][$i]['msgs_unseen'] = 
number_format($folder_info['number_new']));
!                               
//$this->xi['folder_list_display'][$i]['msgs_total'] = $total_msgs);
!                               
$this->xi['folder_list_display'][$i]['msgs_total'] = 
number_format($mailbox_status->messages);
!                               
//$this->xi['folder_list_display'][$i]['msgs_total'] = 
number_format($folder_info['number_all']));
!                       }
!                       if ($this->debug) { echo 'email.bofolder.folder_data: 
$this->xi[folder_list_display] dump:<pre>'; 
print_r($this->xi['folder_list_display']); echo '</pre>'; }
!                       
!                       // information for target folder for create and delete, 
where no "source_fldball" is present
!                       // because you are NOT manipulating an *existing* folder
!                       $this->xi['hiddenvar_target_acctnum_name'] = 
'target_fldball[acctnum]';
!                       $this->xi['hiddenvar_target_acctnum_value'] = 
(string)$GLOBALS['phpgw']->msg->get_acctnum();
!                       $this->xi['target_fldball_boxname'] = 
'target_fldball[folder]';
!                       
!                       // make your HTML listbox of all folders
!                       // FUTURE: $show_num_new value should be picked up from 
the users preferences (need to add this pref)
!                       //$show_num_new = True;
!                       $show_num_new = False;
!                       // build the $feed_args array for the 
all_folders_listbox function
!                       // anything not specified will be replace with a 
default value if the function has one for that param
!                       $feed_args = Array(
!                               'mailsvr_stream'        => '',
!                               'pre_select_folder'     => '',
!                               'skip_folder'           => '',
!                               'show_num_new'          => $show_num_new,
!                               'widget_name'           => 
'source_fldball_fake_uri',
!                               'folder_key_name'       => 'folder',
!                               'acctnum_key_name'      => 'acctnum',
!                               'on_change'             => '',
!                               'first_line_txt'        => lang('choose for 
rename')
!                       );
!                       // get you custom built HTML listbox (a.k.a. selectbox) 
widget
!                       $this->xi['all_folders_listbox'] = 
$GLOBALS['phpgw']->msg->all_folders_listbox($feed_args);
!                       
!                       // ----  Set Up Form Variables  ---
!                       $this->xi['form_action'] = $GLOBALS['phpgw']->link(
!                                       '/index.php',
!                                       'menuaction=email.uifolder.folder');
!                       
//$GLOBALS['phpgw']->template->set_var('all_folders_listbox',$GLOBALS['phpgw']->msg->all_folders_listbox('','','',False));
!                       
//$GLOBALS['phpgw']->template->set_var('select_name_rename','source_folder');
!                       
!                       $this->xi['form_create_txt'] = lang('Create a folder');
!                       $this->xi['form_delete_txt'] = lang('Delete a folder');
!                       $this->xi['form_rename_txt'] = lang('Rename a folder');
!                       $this->xi['form_create_expert_txt'] = lang('Create 
(expert)');
!                       $this->xi['form_delete_expert_txt'] = lang('Delete 
(expert)');
!                       $this->xi['form_rename_expert_txt'] = lang('Rename 
(expert)');
!                       $this->xi['form_submit_txt'] = lang("submit");
!                       
!                       // ----  Set Up Other Variables  ---    
!                       $this->xi['title_backcolor'] = 
$GLOBALS['phpgw_info']['theme']['em_folder'];
!                       $this->xi['title_textcolor'] = 
$GLOBALS['phpgw_info']['theme']['em_folder_text'];
!                       $this->xi['title_text'] = lang('Folder Maintenance');
!                       $this->xi['label_name_text'] = lang('Folder name');
!                       //$this->xi['label_messages_text'] = lang('Messages');
!                       $this->xi['label_new_text'] = lang('New');
!                       $this->xi['label_total_text'] = lang('Total');
!                       // Check if we are supposed to show long or short 
folder names and create opposite link
!         if (($GLOBALS['phpgw']->msg->get_isset_arg('show_long') == true) && 
($GLOBALS['phpgw']->msg->get_arg_value('show_long') != '')) {
!             $this->xi['view_txt'] = lang('Show short names'); 
!             // $this->xi['view_short_lnk'] = 
$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/folder.php');
!             $this->xi['view_lnk'] = $GLOBALS['phpgw']->link('/index.php',
!                 'menuaction=email.uifolder.folder' . '&fldball[folder]=' . 
$GLOBALS['phpgw']->msg->prep_folder_out() . '&fldball[acctnum]=' . 
$GLOBALS['phpgw']->msg->get_acctnum());
!         } else {
!             $this->xi['view_txt'] = lang('Show long names'); 
!             // $this->xi['view_long_lnk'] = 
$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/folder.php?show_long=1');
!             $this->xi['view_lnk'] = $GLOBALS['phpgw']->link('/index.php',
!                 'menuaction=email.uifolder.folder' . '&fldball[folder]=' . 
$GLOBALS['phpgw']->msg->prep_folder_out() . '&fldball[acctnum]=' . 
$GLOBALS['phpgw']->msg->get_acctnum() . '&show_long=1');
!         } 
!               // Depreciated 
!               //      $this->xi['view_long_txt'] = lang('long names');
!                       //$this->xi['view_long_lnk'] = 
$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/folder.php?show_long=1');
!               //      $this->xi['view_long_lnk'] = $GLOBALS['phpgw']->link(
!               //                                      '/index.php',
!               //                                      
'menuaction=email.uifolder.folder'
!               //                                      
.'&fldball[folder]='.$GLOBALS['phpgw']->msg->prep_folder_out()
!               //                                      
.'&fldball[acctnum]='.$GLOBALS['phpgw']->msg->get_acctnum()
!               //                                      .'&show_long=1');
!                                                       
!               //      $this->xi['view_short_txt'] = lang('short names');
!                       //$this->xi['view_short_lnk'] = 
$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/folder.php');
!               //      $this->xi['view_short_lnk'] = $GLOBALS['phpgw']->link(
!               //                                      '/index.php',
!               //                                      
'menuaction=email.uifolder.folder'
!               //                                      
.'&fldball[folder]='.$GLOBALS['phpgw']->msg->prep_folder_out()
!               //                                      
.'&fldball[acctnum]='.$GLOBALS['phpgw']->msg->get_acctnum());
!               //      
!                       $this->xi['the_font'] = 
$GLOBALS['phpgw_info']['theme']['font'];
!                       $this->xi['th_backcolor'] = 
$GLOBALS['phpgw_info']['theme']['th_bg'];
!                       
!               }       
!       
!       }
! ?>
--- 1,393 ----
! <?php
!       
/**************************************************************************\
!       * AngleMail - email BO Class    for Folder Actions and List Display     
        *
!       * http://www.anglemail.org                                              
        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * Copyright 2001, 2002 Angelo (Angles) Puglisi                          
*
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       class bofolder
!       {
!               var $public_functions = array(
!                       'folder'                => True,
!                       'folder_action'         => True,
!                       'folder_data'           => True
!               );
!               var $nextmatchs;
!               var $msg_bootstrap;
!               // use the cachable function or the non-cachable status function
!               var $use_cachable_status = True;
!               //var $use_cachable_status = False;
!               var $debug = 0;
!               var $xi;
!               
!               function bofolder()
!               {
!                       //return;
!               }
!               
!               
!               function folder()
!               {
!                       if ($this->debug > 0) { echo 'ENTERING: 
email.bofolder.folder('.__LINE__.')'.'<br>'; }
!                       // create class objects
!                       $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
!                       
!                       // make sure we have msg object and a server stream
!                       $this->msg_bootstrap = 
CreateObject("email.msg_bootstrap");
!                       
$this->msg_bootstrap->ensure_mail_msg_exists('email.bofolder.folder', 
$this->debug);
!                       
!                       // ----  Create or Delete or Rename a Folder ?  ----
!                       // "folder_action()" handles checking if any action 
should be taken
!                       if ($this->debug > 1) { echo 
'email.bofolder.folder('.__LINE__.') calling $this->folder_action()'.'<br>'; }
!                       $this->folder_action();
!                       
!                       
!                       // ----  Get a List Of All Folders  AND Display them 
----
!                       if ($this->debug > 1) { echo 
'email.bofolder.folder('.__LINE__.') calling $this->folder_data()'.'<br>'; }
!                       $this->folder_data();
!                       
!                       // end the email transaction
!                       //$GLOBALS['phpgw']->msg->end_request();
!                       // NO we may not be really done yet
!                       if ($this->debug > 0) { echo 'LEAVING: 
email.bofolder.folder('.__LINE__.')'.'<br>'; }
!               }
!               
!               
!               
!               function folder_action()
!               {
!                       if ($this->debug > 0) { echo 'ENTERING: 
email.bofolder.folder_action('.__LINE__.')'.'<br>'; }
!                       // ----  Create or Delete or Rename a Folder ?  ----
!                       if (($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'create')
!                       || ($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'delete')
!                       || ($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'rename')
!                       || ($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'create_expert')
!                       || ($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'delete_expert')
!                       || ($GLOBALS['phpgw']->msg->get_arg_value('action') == 
'rename_expert'))
!                       {
!                               // we have been requested to do a folder action
!                               
!                               // basic sanity check
!                               if ( 
($GLOBALS['phpgw']->msg->get_isset_arg('["target_fldball"]["folder"]') == False)
!                               || 
($GLOBALS['phpgw']->msg->get_arg_value('["target_fldball"]["folder"]') == '') )
!                               {
!                                       // Error Result Message
!                                       $action_report = lang('Please type a 
folder name in the text box');
!                               }
!                               elseif ( 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename')
!                                 || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename_expert'))
!                               && 
(($GLOBALS['phpgw']->msg->get_isset_arg('["source_fldball"]["folder"]') == 
False)
!                                 || 
($GLOBALS['phpgw']->msg->get_arg_value('["source_fldball"]["folder"]') == '')) )
!                               {
!                                       // Error Result Message
!                                       $action_report = lang('Please select a 
folder to rename');
!                               }
!                               else
!                               {
!                                       $source_fldball = 
$GLOBALS['phpgw']->msg->get_arg_value('source_fldball');
!                                       $target_fldball = 
$GLOBALS['phpgw']->msg->get_arg_value('target_fldball');
!                                       
!                                       //  ----  Establish Email Server 
Connectivity Conventions  ----
!                                       $server_str = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_callstr');
!                                       $name_space = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_namespace');
!                                       $dot_or_slash = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_delimiter');
!                                       
!                                       // ---- Prep Target Folder
!                                       // get rid of the escape \ that 
magic_quotes HTTP POST will add
!                                       // " becomes \" and  '  becomes  \'  
and  \  becomes \\
!                                       $target_stripped = 
$GLOBALS['phpgw']->msg->stripslashes_gpc($target_fldball['folder']);
!                                       $target_fldball['folder'] = 
$target_stripped;
!                                       // == is that necessary ? == are folder 
names allowed with '  "  \  in them ? ===
!                                       // rfc2060 does NOT prohibit them
!                                       
!                                       // obtain propper folder names
!                                       // if this is a delete, the folder name 
will (should) already exist
!                                       // although the user had to type in the 
folder name
!                                       // for these actions,  the "expert" tag 
means:
!                                       // "do not add the name space for me, 
I'm an expert and I know what I'm doing"
!                                       if 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'create_expert')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'delete_expert')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename_expert'))
!                                       {
!                                               // other than stripslashes_gpc, 
 do nothing
!                                               // the user is an expert, do 
not alter the phpgw->msg->get_arg_value('target_folder') name at all
!                                       }
!                                       else
!                                       {
!                                               // since the user is not an 
"expert", we properly prepare the folder name
!                                               // see if the folder already 
exists in the folder lookup list
!                                               // this would be the case if 
the user is deleting a folder
!                                               $target_lookup = 
$GLOBALS['phpgw']->msg->folder_lookup('', $target_fldball['folder']);
!                                               if ($target_lookup != '')
!                                               {
!                                                       // 
phpgw->msg->get_arg_value('target_folder') returned an official long name from 
the lookup
!                                                       
$target_fldball['folder'] = $target_lookup;
!                                               }
!                                               else
!                                               {
!                                                       // the lookup failed, 
so this is not an existing folder
!                                                       // we have to add the 
namespace for the user
!                                                       $target_long = 
$GLOBALS['phpgw']->msg->get_folder_long($target_fldball['folder']);
!                                                       
$target_fldball['folder'] = $target_long;
!                                               }
!                                       }
!                                       
!                                       // add server string to target folder
!                                       $target_fldball['folder'] = 
$server_str.$target_fldball['folder'];
!                                       
!                                       // NOTE the dcom class will set a flag 
indicating a folder list change, ->dcom->folder_list_changed=True
!                                       // function ->msg->get_folder_list()  
checks for this flag to know when to expire cached folder list and get a new one
!                                       // since we call this folder change 
function before the folder display funcion, the folder display will 
!                                       // immediately get this flag if it has 
been set, and will get fresh folder list from the mailserver
!                                       
!                                       // =====  NOTE:  maybe some "are you 
sure" code ????  =====
!                                       if 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'create')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'create_expert'))
!                                       {
!                                               $success = 
$GLOBALS['phpgw']->msg->phpgw_createmailbox($target_fldball);
!                                       }
!                                       elseif 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'delete')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'delete_expert'))
!                                       {
!                                               $success = 
$GLOBALS['phpgw']->msg->phpgw_deletemailbox($target_fldball);
!                                       }
!                                       elseif 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename_expert'))
!                                       {
!                                               // 
phpgw->msg->get_arg_value('source_folder') is taken directly from the listbox, 
so it *should* be official long name already
!                                               // but it does need to be 
prep'd in because we prep out the foldernames put in that listbox
!                                               $source_preped = 
$GLOBALS['phpgw']->msg->prep_folder_in($source_fldball['folder']);
!                                               $source_fldball['folder'] = 
$source_preped;
!                                               // add server string to source 
folder
!                                               $source_fldball['folder'] = 
$server_str.$source_fldball['folder'];
!                                               $success = 
$GLOBALS['phpgw']->msg->phpgw_renamemailbox($source_fldball, $target_fldball);
!                                       }
!                                       
!                                       // Result Message
!                                       if 
(($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename')
!                                       || 
($GLOBALS['phpgw']->msg->get_arg_value('action') == 'rename_expert'))
!                                       {
!                                               $action_report =
!                                                       
$GLOBALS['phpgw']->msg->get_arg_value('action') .' '.lang('folder').' 
&quot;'.htmlspecialchars($source_fldball['folder']).'&quot; '
!                                                       .lang('to').' 
&quot;'.htmlspecialchars($target_fldball['folder']) .'&quot; '
!                                                       .lang('result').' : ';
!                                       }
!                                       else
!                                       {
!                                               $action_report = 
$GLOBALS['phpgw']->msg->get_arg_value('action').' '.lang('folder').' 
&quot;'.htmlspecialchars($target_fldball['folder']).'&quot; '
!                                               .lang('result').' : ';
!                                       }
!                                       // did it work or not
!                                       if ($success)
!                                       {
!                                               // assemble some feedback to 
show
!                                               $action_report = $action_report 
.lang('OK');
!                                       }
!                                       else
!                                       {
!                                               $imap_err = 
$GLOBALS['phpgw']->msg->phpgw_server_last_error();
!                                               if ($imap_err == '')
!                                               {
!                                                       $imap_err = 
lang('unknown error');
!                                               }
!                                               // assemble some feedback to 
show the user about this error
!                                               $action_report = $action_report 
.$imap_err;
!                                       }
!                               }
!                       }
!                       else
!                       {
!                               // we were NOT requested to do a folder action
!                               // we did not have the key data needed 
describing the desired action
!                               $action_report = '';
!                               $success = False;
!                       }
!                       
!                       // save the "action_report" to the $this->xi[] data 
array
!                       $this->xi['action_report'] = $action_report;
!                       
!                       // we may have been  called externally, return this 
action report
!                       //return $action_report;
!                       // we may have been  called externally, return if we 
succeeded or not
!                       if ($this->debug > 0) { echo 'LEAVING: 
email.bofolder.folder_action('.__LINE__.'), returning $success 
['.serialize($success).'], only matters if folder action was attempted'.'<br>'; 
}
!                       return $success;
!               }
!               
!               
!               function folder_data()
!               {
!                       if ($this->debug > 0) { echo 'ENTERING: 
email.bofolder.folder_data('.__LINE__.')'.'<br>'; } 
!                       //  ----  Establish Email Server Connectivity 
Conventions  ----
!                       $server_str = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_callstr');
!                       $name_space = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_namespace');
!                       $dot_or_slash = 
$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_delimiter');
!                       
!                       // ----  Get a List Of All Folders  AND Display them 
----
!                       //$folder_list = 
$GLOBALS['phpgw']->msg->get_folder_list();
!                       $folder_list = 
$GLOBALS['phpgw']->msg->get_arg_value('folder_list');
!                       //$folder_list =& 
$GLOBALS['phpgw']->msg->get_arg_value_ref('folder_list');
!                       
!                       if ($this->debug > 2) { echo 
'email.bofolder.folder_data('.__LINE__.'): $folder_list[] dump:<pre>'; 
print_r($folder_list); echo '</pre>'; }
!                       if ($this->debug > 1) { echo 
'email.bofolder.folder_data('.__LINE__.') USE CACHABLE? 
$this->use_cachable_status is 
['.serialize($this->use_cachable_status).']'.'<br>'; } 
!                       
!                       $this->xi['folder_list_display'] = array();
!                       for ($i=0; $i<count($folder_list);$i++)
!                       {
!                               $folder_long = $folder_list[$i]['folder_long'];
!                               $folder_short = 
$folder_list[$i]['folder_short'];
!                               
!                               if ($this->use_cachable_status == True)
!                               {
!                                       $feed_fldball = array();
!                                       $feed_fldball['folder'] = 
$GLOBALS['phpgw']->msg->prep_folder_out($folder_long);
!                                       $feed_fldball['acctnum'] = 
$GLOBALS['phpgw']->msg->get_acctnum();
!                                       $folder_status_info = array();
!                                       $folder_status_info = 
$GLOBALS['phpgw']->msg->get_folder_status_info($feed_fldball);
!                               }
!                               else
!                               {
!                                       // SA_ALL gets the stats for the number 
of:  messages, recent, unseen, uidnext, uidvalidity
!                                       // THIS DOES NOT USE THE CACHEABLE 
FUNCTION
!                                       $mailbox_status = 
$GLOBALS['phpgw']->msg->phpgw_status("$folder_long");
!                               }
!                               
!                               //debug
!                               //$real_long_name = 
$GLOBALS['phpgw']->msg->folder_lookup('',$folder_list[$i]['folder_short']);
!                               //if ($real_long_name != '')
!                               //{
!                               //      echo 'folder exists, official long 
name: '.$real_long_name.'<br>';
!                               //}
!                               
!                               // ROW BACK COLOR
!                               //$tr_color = 
$this->nextmatchs->alternate_row_color($tr_color);
!                               $tr_color = (($i + 1)/2 == floor(($i + 1)/2)) ? 
$GLOBALS['phpgw_info']['theme']['row_off'] : 
$GLOBALS['phpgw_info']['theme']['row_on'];
!                               $tr_color_class = (($i + 1)/2 == floor(($i + 
1)/2)) ? 'row_off' : 'row_on';
!                               
$this->xi['folder_list_display'][$i]['list_backcolor'] = $tr_color;
!                               
$this->xi['folder_list_display'][$i]['list_backcolor_class'] = $tr_color_class;
!                               
$this->xi['folder_list_display'][$i]['folder_link'] = $GLOBALS['phpgw']->link(
!                                                               '/index.php',
!                                                               
'menuaction=email.uiindex.index'
!                                                               
.'&fldball[folder]='.$GLOBALS['phpgw']->msg->prep_folder_out($folder_long)
!                                                               
.'&fldball[acctnum]='.$GLOBALS['phpgw']->msg->get_acctnum());
!                               
!                               if 
(($GLOBALS['phpgw']->msg->get_isset_arg('show_long') == True)
!                               && 
($GLOBALS['phpgw']->msg->get_arg_value('show_long') != ''))
!                               {
!                                       
$this->xi['folder_list_display'][$i]['folder_name'] = $folder_long;
!                               }
!                               else
!                               {
!                                       
$this->xi['folder_list_display'][$i]['folder_name'] = $folder_short;
!                               }
!                               // make sure unusual entities are encoded for 
html display
!                               
$this->xi['folder_list_display'][$i]['folder_name'] = 
!                                       
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($this->xi['folder_list_display'][$i]['folder_name']);
!                               
!                               if ($this->use_cachable_status == True)
!                               {
!                                       
$this->xi['folder_list_display'][$i]['msgs_unseen'] = 
number_format($folder_status_info['number_new']);
!                                       
$this->xi['folder_list_display'][$i]['msgs_total'] = 
number_format($folder_status_info['number_all']);
!                               }
!                               else
!                               {
!                                       
$this->xi['folder_list_display'][$i]['msgs_unseen'] = 
number_format($mailbox_status->unseen);
!                                       
$this->xi['folder_list_display'][$i]['msgs_total'] = 
number_format($mailbox_status->messages);
!                               }
!                       }
!                       if ($this->debug > 2) { echo 
'email.bofolder.folder_data('.__LINE__.'): $this->xi[folder_list_display] 
dump:<pre>'; print_r($this->xi['folder_list_display']); echo '</pre>'; }
!                       
!                       // information for target folder for create and delete, 
where no "source_fldball" is present
!                       // because you are NOT manipulating an *existing* folder
!                       $this->xi['hiddenvar_target_acctnum_name'] = 
'target_fldball[acctnum]';
!                       $this->xi['hiddenvar_target_acctnum_value'] = 
(string)$GLOBALS['phpgw']->msg->get_acctnum();
!                       $this->xi['target_fldball_boxname'] = 
'target_fldball[folder]';
!                       
!                       // make your HTML listbox of all folders
!                       // FUTURE: $show_num_new value should be picked up from 
the users preferences (need to add this pref)
!                       //$show_num_new = True;
!                       $show_num_new = False;
!                       // build the $feed_args array for the 
all_folders_listbox function
!                       // anything not specified will be replace with a 
default value if the function has one for that param
!                       $feed_args = Array(
!                               'mailsvr_stream'        => '',
!                               'pre_select_folder'     => '',
!                               'skip_folder'           => '',
!                               'show_num_new'          => $show_num_new,
!                               'widget_name'           => 
'source_fldball_fake_uri',
!                               'folder_key_name'       => 'folder',
!                               'acctnum_key_name'      => 'acctnum',
!                               'on_change'             => '',
!                               'first_line_txt'        => lang('choose for 
rename')
!                       );
!                       // get you custom built HTML listbox (a.k.a. selectbox) 
widget
!                       $this->xi['all_folders_listbox'] = 
$GLOBALS['phpgw']->msg->all_folders_listbox($feed_args);
!                       
!                       // ----  Set Up Form Variables  ---
!                       $this->xi['form_action'] = $GLOBALS['phpgw']->link(
!                                       '/index.php',
!                                       'menuaction=email.uifolder.folder');
!                       
//$GLOBALS['phpgw']->template->set_var('all_folders_listbox',$GLOBALS['phpgw']->msg->all_folders_listbox('','','',False));
!                       
//$GLOBALS['phpgw']->template->set_var('select_name_rename','source_folder');
!                       
!                       $this->xi['form_create_txt'] = lang('Create a folder');
!                       $this->xi['form_delete_txt'] = lang('Delete a folder');
!                       $this->xi['form_rename_txt'] = lang('Rename a folder');
!                       $this->xi['form_create_expert_txt'] = lang('Create 
(expert)');
!                       $this->xi['form_delete_expert_txt'] = lang('Delete 
(expert)');
!                       $this->xi['form_rename_expert_txt'] = lang('Rename 
(expert)');
!                       $this->xi['form_submit_txt'] = lang("submit");
!                       
!                       // ----  Set Up Other Variables  ---    
!                       $this->xi['title_backcolor'] = 
$GLOBALS['phpgw_info']['theme']['em_folder'];
!                       $this->xi['title_textcolor'] = 
$GLOBALS['phpgw_info']['theme']['em_folder_text'];
!                       $this->xi['title_text'] = lang('Folder Maintenance');
!                       $this->xi['label_name_text'] = lang('Folder name');
!                       //$this->xi['label_messages_text'] = lang('Messages');
!                       $this->xi['label_new_text'] = lang('New');
!                       $this->xi['label_total_text'] = lang('Total');
!                       // Check if we are supposed to show long or short 
folder names and create opposite link
!         if (($GLOBALS['phpgw']->msg->get_isset_arg('show_long') == true) && 
($GLOBALS['phpgw']->msg->get_arg_value('show_long') != '')) {
!             $this->xi['view_txt'] = lang('Show short names'); 
!             // $this->xi['view_short_lnk'] = 
$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/folder.php');
!             $this->xi['view_lnk'] = $GLOBALS['phpgw']->link('/index.php',
!                 'menuaction=email.uifolder.folder' . '&fldball[folder]=' . 
$GLOBALS['phpgw']->msg->prep_folder_out() . '&fldball[acctnum]=' . 
$GLOBALS['phpgw']->msg->get_acctnum());
!         } else {
!             $this->xi['view_txt'] = lang('Show long names'); 
!             // $this->xi['view_long_lnk'] = 
$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/folder.php?show_long=1');
!             $this->xi['view_lnk'] = $GLOBALS['phpgw']->link('/index.php',
!                 'menuaction=email.uifolder.folder' . '&fldball[folder]=' . 
$GLOBALS['phpgw']->msg->prep_folder_out() . '&fldball[acctnum]=' . 
$GLOBALS['phpgw']->msg->get_acctnum() . '&show_long=1');
!         } 
!               // Depreciated 
!               //      $this->xi['view_long_txt'] = lang('long names');
!                       //$this->xi['view_long_lnk'] = 
$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/folder.php?show_long=1');
!               //      $this->xi['view_long_lnk'] = $GLOBALS['phpgw']->link(
!               //                                      '/index.php',
!               //                                      
'menuaction=email.uifolder.folder'
!               //                                      
.'&fldball[folder]='.$GLOBALS['phpgw']->msg->prep_folder_out()
!               //                                      
.'&fldball[acctnum]='.$GLOBALS['phpgw']->msg->get_acctnum()
!               //                                      .'&show_long=1');
!                                                       
!               //      $this->xi['view_short_txt'] = lang('short names');
!                       //$this->xi['view_short_lnk'] = 
$GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/folder.php');
!               //      $this->xi['view_short_lnk'] = $GLOBALS['phpgw']->link(
!               //                                      '/index.php',
!               //                                      
'menuaction=email.uifolder.folder'
!               //                                      
.'&fldball[folder]='.$GLOBALS['phpgw']->msg->prep_folder_out()
!               //                                      
.'&fldball[acctnum]='.$GLOBALS['phpgw']->msg->get_acctnum());
!               //      
!                       $this->xi['the_font'] = 
$GLOBALS['phpgw_info']['theme']['font'];
!                       $this->xi['th_backcolor'] = 
$GLOBALS['phpgw_info']['theme']['th_bg'];
!                       
!                       if ($this->debug > 0) { echo 'LEAVING: 
email.bofolder.folder_data('.__LINE__.')'.'<br>'; } 
!               }       
!       
!       }
! ?>

Index: class.boindex.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.boindex.inc.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** class.boindex.inc.php       16 Nov 2002 11:36:33 -0000      1.29
--- class.boindex.inc.php       14 Mar 2003 04:00:10 -0000      1.30
***************
*** 1,1148 ****
! <?php
!       
/**************************************************************************\
!       * Anglemail - email BO Class for Message Lists                          
*
!       * http://www.anglemail.org                                              
        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * Copyright 2001, 2002 Angelo "Angles" Puglisi 
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
[...2385 lines suppressed...]
!                                       'skip_folder'           => 
$GLOBALS['phpgw']->msg->get_folder_short($GLOBALS['phpgw']->msg->get_arg_value('folder')),
!                                       'show_num_new'          => 
$this->xi['show_num_new'],
!                                       'widget_name'           => 'tofolder',
!                                       'on_change'             => 
'do_action(\'move\')',
!                                       'first_line_txt'        => lang('move 
selected messages into')
!                               );
!                               $this->xi['delmov_listbox'] = 
$GLOBALS['phpgw']->msg->all_folders_listbox($feed_args);
!                       }
!                       else
!                       {
!                               $this->xi['delmov_listbox'] = '&nbsp;';
!                       }
!                       $this->xi['ftr_backcolor'] = 
$GLOBALS['phpgw_info']['theme']['th_bg'];
!                       $this->xi['ftr_backcolor_class'] = 'th';
!                       if ($this->debug_index_data == True) { echo 'LEAVING: 
email.boindex: mlist_data'.'<br>'; }
!               }
!       
!       
!       }
! ?>

Index: class.bojsaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.bojsaddressbook.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.bojsaddressbook.inc.php       25 Oct 2002 12:56:57 -0000      1.1
--- class.bojsaddressbook.inc.php       14 Mar 2003 04:00:10 -0000      1.2
***************
*** 1,443 ****
! <?php
! /**************************************************************************\
!  * phpGroupWare - Todo list                                                 *
!  * http://www.phpgroupware.org                                              *
!  * Written by Alex Borges <address@hidden>                          *
!  * Low Level Design also by    Dave Hall address@hidden                       
   *
!  * UI Design and market research by Gerardo Ramirez address@hidden
!  *-----------------------------------------------                          *
!  *  This program is free software; you can redistribute it and/or modify it *
!  *  under the terms of the GNU General Public License as published by the   *
!  *  Free Software Foundation; either version 2 of the License, or (at your  *
!  *  option) any later version.                                              *
!  \**************************************************************************/
! 
! /*!
!   @class bojsaddressbiij
!   @abstract logic for the javascript addressbook is here
!   @author Lex 
!   @ discussion  Understand that
!   this is my first attempt to a bo,ui pair of objects
!   that will do the job. I turned to do this because
!   this thingie has to be available for use by all the
!   phpgw 0.9.14 apps.
!   My approach is to use abstraction as much as possible.
!   This class will handle all data. DATA you hear? 
!   This means that the state of the abstraction we call
!   the cool addressbook chooser is here.... THE STATE!
!   Nothing webish about this file. This file will no receive
!   ever variables from HTTP_POST or GET. That is for the UI class
!   to handle. This class has methods that receive parameters so you 
!   can use it from anyware.
!  */
!        class bojsaddressbook
!       {
!               //@param $contacts phpgwapi contacts object
!               var $contacts;
!               //@param destboxes array that has the state of the three 
possible destination boxes
!               //this thing will have the title of the destination boxes and 
their content
!               //this class is session cache enabled. When you solicit the 
content of 
!               //this boxes this class may get it from cache if it thinks its 
necesary
!               //the boxes are named toselectbox,ccselectbox  and 
bccselectbox. 
!               var $destboxes;
!               //@param contactquery this is an array that holds the parameters
!               //to make a query for  the contacts class. The contact class 
takes
!               //as parameters: integers: start,offset. The cols array that 
has the fields that should be returned.
!               //The query string that returns whatever matches the given 
string for the fields provided
!               //the filter string to match against non contact fields. The 
sort boolean and the extra sort_by parameter
!               //to sort by a given field.
!               var $contactquery;
!               //@param queryresult its the array with actual user data that 
we have gotten from contacts
!               var $queryresults;
!               //@param cachestate Its an internal var to tell us if we should 
expire the cache
!               var $cachestate="dirty";
!               var $debug = False;
!               //@param result Which has an array of results from querying the 
contacts backend.
!               var $result;
!               //@param mass_query_cols Is an array that tells the backends 
which fields to get from the
!               //contacts backend for FULL QUERIES. Full queries are made upon 
construction of this
!               //object. They are different from single queries in that full 
queries are supposed to get
!               //A list of contacts, each having their own fields given by 
this array.
!               var $mass_query_cols = array (
!                               'title'     => 'title',
!                               'n_given'    => 'n_given',
!                               'n_family'   => 'n_family',
!                               'email'      => 'email',
!                               'org_name' => 'org_name',
!                               'email_home'  => 'email_home'
!                               );
!               //@param single_query_cols This array is similar to the one 
above except this is for
!               //SINGLE QUERIES. This queries happen when you call the 
get_userdata method to get
!               //the record of a single entry in the contacts backend
!               //To add a field to fetch back from userdata
!               //u need to add the field u want here
!               //Also, in class.uijsaddressbook there is a translation array 
that has
!               //the names of each field in english. Use it to decide what 
values to add here
!               var $single_query_cols =  array (
!                               'title'     => 'title',
!                               'n_given'    => 'n_given',
!                               'n_family'   => 'n_family',
!                               'org_name' => 'org_name',
!                               'tel_work' => 'tel_work',
!                               'cat_id'  => 'cat_id'
!                               );
!               //@param use_session Not used at the moment
!               var $use_session=true;
! 
!               //@function bojsaddressbook 
!               //@abstract This class's contructor
!               //@param contactquery Its a query array in the form explained 
as:
!               //      order: Must be equal to the order in which you want the 
query...ASC or DESC
!               //      categories: Must have the categories string as 
constrained by the categories class
!               //                  ,1,2 or 1,2 are valid strings to say, 
category number 1 and 2
!               //      filter: This is a whole parameter in itself, will 
explain bellow in the parse_contactquery discussion
!               //      query: Freestyle query to match against any fields in a 
mass query
!               //      sort:  The field to sort by.... n_give will sort by 
name, for example
!               //      directory_uid: This field may be empty but, if it has a 
number in it
!               //      we will search in the contacts owned by the user whose 
uid matches this value
!               //@param queryresults UNUSED, might use it for caching state 
purposes later on
!               //@discussion 
!               //This function checks its cache. All parameters are optional. 
If called with no parameters
!               //the class will assume all that it needs is in the cache and 
will get it from there
!               //If a contactquery value is supplied, the class will desregard 
its cache and go fetch the whole
!               //query again. 
!               //To be truth, its actually quite stupid and we should be using 
more intelligence to decide
!               //if the cache is stale.... for example, caching the result 
form parse_contactquery and
!               //compare it with what results from parsing the incoming 
contactquery. If its the same,
!               //we shouldnt refetch.
!               function bojsaddressbook($contactquery="",$queryresults="")
!               {
!                       $this->contactsobject=CreateObject('phpgwapi.contacts');
!                       //the idea is that here, right here, nowhere else, do 
we decide what to keep
!                       //from the cache and what to go and query again
!                               $data=$this->read_sessiondata();
!                               if(is_array($contactquery))
!                               {
!                                       
$this->parse_contactquery($contactquery);
!                                       
$data['result']=$this->contactsobject->read($this->contactquery['start'],$this->contactquery['offset'],
!                                                       
$this->mass_query_cols,$this->contactquery['query'],
!                                                       
$this->contactquery['filter'],
!                                                       
$this->contactquery['sort'],
!                                                       $this->sortby);
!                                       $this->save_sessiondata($data);
!                               }
! 
!                               $this->result=$data['result'];
! 
!               }
!               //@function parse_contactquery 
!               //@param contactquery As described in the constructor's param
!               //@abstrcat Parses an incoming contactquery into what the 
contacts backend
!               //likes to see in a query
!               //@discussion This ignores the start and offset parameters as 
they are somehow
!               //obsolete in this version. Its strange, i know, but maybe we 
will want to optimize
!               //later what we want to fetch from the contacts backend by this 
parameters so all other
!               //functions respect and think that thisone builds the start and 
offset
!               function parse_contactquery($contactquery)
!               {
!                       $notfirsttime=False;
!                       while(list($k,$v)=each($contactquery))
!                       {
!                               switch($k)
!                               {
!                                       case 'filter':
!                                               {
!                                                       switch($v)
!                                                       {
! 
!                                                               case 'none':
!                                                                       {
!                                                                               
$this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
        ($notfirsttime ? "," :"")."tid=n";
!                                                                               
$notfirsttime=True;
!                                                                               
break;
!                                                                       }
!                                                               case 
'user_only':
!                                                                       {
!                                                                               
$this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
        ($notfirsttime ? "," :"").
!                                                                               
        'owner='.$GLOBALS['phpgw_info']['user']['account_id'];
!                                                                               
$notfirsttime=True;
!                                                                               
break;
!                                                                       }
!                                                               case 
'directory':
!                                                                       {
!                                                                               
if(!$contactquery['directory_uid'])
!                                                                               
{
! 
!                                                                               
        $this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
                ($notfirsttime ? "," :"")."tid=p";
!                                                                               
}
!                                                                               
else
!                                                                               
{
!                                                                               
         $this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
                      ($notfirsttime ? "," :"")."owner=".
!                                                                               
                      $contactquery['directory_uid'];
!                                                                               
}
!                                                                               
$notfirsttime=True;
!                                                                               
break;
!                                                                       }
!                                                               case 'private':
!                                                                       {
!                                                                               
$this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
        ($notfirsttime ? "," :"").'owner='.
!                                                                               
        $GLOBALS['phpgw_info']['user']['account_id'].
!                                                                               
        ',access=private';
!                                                                               
$notfirsttime=True;
!                                                                               
break;
!                                                                       }
!                                                       }
!                                                       $notfirsttime=false;
!                                                       break;
!                                               }
!                                       case 'categories':
!                                               {
!                                                       if($v)
!                                                       {
!                                                               
$this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
 ($notfirsttime ? "," :"")."cat_id=".$v;
!                                                       $notfirsttime=true;
!                                                       }
!                                                       break;
!                                               }
!                                       case 'query':
!                                               {
!                                                       if($v)
!                                                       {
!                                                               
$this->contactquery['query']=$v;
!                                                       }
!                                               }
!                                                       
!                               }//end switch
!                       }//end while
! //                    print "<BR> built query";
! //                    print_r($this->contactquery);
!               }//end function
!               
!               //@function forget_query
!               //@discussion
!               //Causes the class to forget its query cache. This does not 
forget the destination boxes, only
!               //the mass query
!               function forget_query()
!               {
!                               $this->save_sessiondata("");
!               }
!               //@function recordinfo
!               //@param addy_id The record's id in the contacts backend
!               //@abstract Gets the record info descirbed by the 
single_query_cols array
!               //@discussion This returns an array of field=>value that 
actually has
!               //the whole record for the given id. As u can see, the values 
it gets back are
!               //given by the single_query_cols attribute which u can change 
to get more data
!               function recordinfo($addy_id)
!               {
!                       $entry = 
$this->contactsobject->read("","",$this->single_query_cols,"","id=$addy_id");
!                       if(!$entry[0])
!                       {
!                               return false;
!                       }
!                       return $entry[0];       
!               }
!               //@function save_destboxes
!               //@param destboxes The array of destbox arrays that we want 
saveed in the cache
!               //@discussion This function saves the destboxes into the cache
!               function save_destboxes($destboxes)
!               {
!                       
!                       $this->save_sessiondata($destboxes,"destboxes");
!               }
!               //@function get_destboxes
!               //@abstract Function to get the destination boxes... .this 
parameter should exlusively be gotten this way
!               //@discussion This function sees if we have any destboxes 
present in the destboxes attribute
!               //if we do, it returns that, if we dont, it gets them from 
cache.
!               
!               function get_destboxes()
!               {
!                       if(!is_array($this->destboxes) || 
(count($this->destboxes)<1) )
!                       {
!                               
$this->destboxes=$this->read_sessiondata("destboxes");
!                       }
!                       return $this->destboxes;
!               }
!               //@function forget_destbox
!               //@param destboxname The name of the destbox which serves as 
key to the destboxes array
!               //@abstract Will unset the live destbox corresponding to 
destboxname
!               //@discussion 
!               //Note that this function will not forget the destbox from the 
cache... i thought it
!               //a bit unneded for the particular application since i wanted 
this function to 
!               //iterate through the destboxes array and unset them one by 
one. This means that
!               //thisone only operates on real, already in memory (not in 
cache) destboxes.
!               //For the cache to reflect this change, you need to 
$obj->save_destboxes($this->destboxes)
!               //after calling this.
!               function  forget_destbox($destboxname)
!               {
!                       $this->get_destboxes();
!                       if(is_array($this->destboxes[$destboxname]))  
!                       {
!                               unset($this->destboxes[$destboxname]); 
!                               return $this->destboxes;
!                       }  
!                       return false;
!                       
!               }
!               //@function forget_destboxes
!               //@abstract Will forget all the destboxes, then save the 
changes to the cache
!               
!               function forget_destboxes()
!               {
!                       if($this->get_destboxes())
!                       {
!                               while(list($name,$list)=each($this->destboxes))
!                               {
!                                       $this->forget_destbox($name);
!                               }
!                               $this->set_destboxes($this->destboxes);
!                       }
!               }
!               //@function set_destboxes
!               //@param aryboxes The new destboxes array
!               //@param deleted An array of booleans with keys similar to the 
destboxes array
!               //If a given destination box has a true entry here, it will be 
removed in the cache
!               //@abstract This functions saves in cache the destination boxes 
values
!               //@discussion Note that this function can be mistaken by the 
save_destboxes function.
!               //Different thigs completely. This one takes an array of 
destboxes. The keys to this array
!               // are the destboxes names. Inside each array, there are uid => 
name pairs. Note the absence
!               //of an email field. The incoming aryboxes have NO email field 
whatsoever.
!               //What we do here, is try and find the corresponding email 
fields either in cache or directly
!               //in our mass query cache and set that field correctly to save 
it in cache
!               //This function is redundant, inneficient and dead slow. Not to 
say complex and unreadable
!               //Please change this please please please.
!               //Previous disclaimer said, it works now, and will release this 
way.
!               function set_destboxes($aryboxes,$deleted='')
!               {
!                       //print_r($aryboxes);
! //                    print "<br> SAVed DESTBOXES <br>";
!                       //We get our own destboxes from the cache
!                       $saveddestboxes=$this->get_destboxes();
!               //      print_r($saveddestboxes);
!                       $found=false;
!                       //We iterate into each box
!                       while(list($ak,$li)=each($aryboxes))
!                       {
! //                            print $ak." ".$li."<BR>";
! //                            print_r($li);
! //                            print "<br>";
!                               //We make shure this box has an array in it
!                               if($aryboxes[$ak])
!                               {
!                                       //We iterate into the incoming box to 
search
!                                       //for its values in the cache
!                                       
while(list($numary,$ary)=each($aryboxes[$ak]))
!                                       {
! //                                            print "<br> Iterating aryboxes 
$numary";        
! //                                            print_r($ary);
!                                               list($id,$name)=each($ary);
!                                               //Look for this record in the 
cached destboxes
!                                               
if(is_array($saveddestboxes[$ak]))
!                                               {
!                                                       //Well, we found that 
we have this destboxed cached so
!                                                       //now we will iterate 
through that
!                                                       
while(list($numarysave,$arysave)=each($saveddestboxes[$ak]))
!                                                       {
!                                                               //We will try 
and get each addressbook key
!                                                               //out of the 
cached destbox
!                                                               
list($sid,$sname)=each($arysave);
!                                                               
! //                                                            print "<br> 
Iterating destboxes $id -> $name / $sid $sname";    
!                                                               //So we can 
compare it and set the email field in it
!                                                               if($id==$sid)
!                                                               {
! //                                                                    print 
"<br> found $id in $ak";
! //                                                                    print 
"<br> seting mail to $arysave[email]";
!                                                                       
$ary['email']=$arysave['email'];
!                                                                       
$aryboxes[$ak][$numary]=$ary;
!                                                                       
!                                                                       
$found=true;
!                                                               }
! 
!                                                       }
!                                                       
reset($saveddestboxes[$ak]);
!                                               }
!                                               //couldnt find it in saved 
destboxes, lookfor ir in result
!                                               //This redundant POSH makes me 
angry....
!                                               //Now we look into our names 
cache...im not shure why, if i 
!                                               //try and evade this search 
when i find it in the cache, 
!                                               //it all goes borken
!                                               //We iterate into the query 
cache
!                                               
while(list($num,$record)=each($this->result))
!                                               {
! //                                                    print "<br> Iterating 
results $id   ---> $name <br>$record[id]---> $record[email]";
!                                                       //Found what we are 
looking for
!                                                       if($id == $record["id"])
!                                                       {
!                                                               //Set the mail 
record to what it should be
! //                                                            print "<br> 
seting mail to $record[email] <br>";
!                                                               
$ary['email']=($record["email"] ? $record["email"] : $record["home_email"]);
!                                                               
$aryboxes[$ak][$numary]=$ary;
!                                                               
$retboxes[$ak][$id]['email']= $ary['email'];
!                                                               
$retboxes[$ak][$id]['name']= $name;
!                                                               
!                                                       }
!                                               }
!                                               reset($this->result);
!                                               $found=false;
!                                       }
! 
!                               }
!                               elseif(!$deleted[$ak])
!                               {
! //                                    print "<br>Saving $ak from destination 
data $deleted[$ak]<br>";
! //                                    print_r($deleted);
!                                       //Delete the destboxes that need 
deletion
!                                       $aryboxes[$ak]=$saveddestboxes[$ak];
!                               }
!                       }
! //                    print "<br>modified<br>";
! //                            print_r($aryboxes);
!                               reset($aryboxes);
!                       //Save the resulting destboxes
!                       $this->save_destboxes($aryboxes);
!                       //We return what we couldnt find in cache so the caller 
can evaluate
!                       //if he needs to refresh his info...
!                       return $retboxes; 
!                       
!               }
!               //@function save_sessiondata
!               //@param data The data to be saved
!               //@param location An extra string to save data in diferent 
locations
!               //@abstract Saves the data into the app session cache
!               //@discussion
!               //If you pass it no location, it will save into jsbook_data
!               //If you do, it will save into jsbook_data_location
!               //This is important cause we sometimes only need the destboxes 
and not
!               //the whole queries so we only get what we need
!               function save_sessiondata($data,$location="")
!               {
!                       if ($this->use_session)
!                       {
!                               
$GLOBALS['phpgw']->session->appsession('session_data',"jsbook_data".($location 
? '_'.$location :""),$data);
!                       }
!                       if($this->debug)
!                       {
!                               echo '<br>Saving: ';
!                               _debug_array($data);
!                       }
!               }
!               //@function read_sessiondata
!               //@param location
!               //@abstract gets data out of the appsesion cache
!               //@discussion
!               //The location field behaves like the one described in 
save_sessiondata
! 
!               function read_sessiondata($location="")
!               {
!                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data','jsbook_data'.($location 
? '_'.$location :""));
!                       if($this->debug)
!                       {
!                               echo '<br>Read: ';
!                               _debug_array($data);
!                       }
!                       return $data;
!               }
!               
!       }
! ?>
--- 1,443 ----
! <?php
! /**************************************************************************\
!  * phpGroupWare - Todo list                                                 *
!  * http://www.phpgroupware.org                                              *
!  * Written by Alex Borges <address@hidden>                          *
!  * Low Level Design also by    Dave Hall address@hidden                       
   *
!  * UI Design and market research by Gerardo Ramirez address@hidden
!  *-----------------------------------------------                          *
!  *  This program is free software; you can redistribute it and/or modify it *
!  *  under the terms of the GNU General Public License as published by the   *
!  *  Free Software Foundation; either version 2 of the License, or (at your  *
!  *  option) any later version.                                              *
!  \**************************************************************************/
! 
! /*!
!   @class bojsaddressbiij
!   @abstract logic for the javascript addressbook is here
!   @author Lex 
!   @ discussion  Understand that
!   this is my first attempt to a bo,ui pair of objects
!   that will do the job. I turned to do this because
!   this thingie has to be available for use by all the
!   phpgw 0.9.14 apps.
!   My approach is to use abstraction as much as possible.
!   This class will handle all data. DATA you hear? 
!   This means that the state of the abstraction we call
!   the cool addressbook chooser is here.... THE STATE!
!   Nothing webish about this file. This file will no receive
!   ever variables from HTTP_POST or GET. That is for the UI class
!   to handle. This class has methods that receive parameters so you 
!   can use it from anyware.
!  */
!        class bojsaddressbook
!       {
!               //@param $contacts phpgwapi contacts object
!               var $contacts;
!               //@param destboxes array that has the state of the three 
possible destination boxes
!               //this thing will have the title of the destination boxes and 
their content
!               //this class is session cache enabled. When you solicit the 
content of 
!               //this boxes this class may get it from cache if it thinks its 
necesary
!               //the boxes are named toselectbox,ccselectbox  and 
bccselectbox. 
!               var $destboxes;
!               //@param contactquery this is an array that holds the parameters
!               //to make a query for  the contacts class. The contact class 
takes
!               //as parameters: integers: start,offset. The cols array that 
has the fields that should be returned.
!               //The query string that returns whatever matches the given 
string for the fields provided
!               //the filter string to match against non contact fields. The 
sort boolean and the extra sort_by parameter
!               //to sort by a given field.
!               var $contactquery;
!               //@param queryresult its the array with actual user data that 
we have gotten from contacts
!               var $queryresults;
!               //@param cachestate Its an internal var to tell us if we should 
expire the cache
!               var $cachestate="dirty";
!               var $debug = False;
!               //@param result Which has an array of results from querying the 
contacts backend.
!               var $result;
!               //@param mass_query_cols Is an array that tells the backends 
which fields to get from the
!               //contacts backend for FULL QUERIES. Full queries are made upon 
construction of this
!               //object. They are different from single queries in that full 
queries are supposed to get
!               //A list of contacts, each having their own fields given by 
this array.
!               var $mass_query_cols = array (
!                               'title'     => 'title',
!                               'n_given'    => 'n_given',
!                               'n_family'   => 'n_family',
!                               'email'      => 'email',
!                               'org_name' => 'org_name',
!                               'email_home'  => 'email_home'
!                               );
!               //@param single_query_cols This array is similar to the one 
above except this is for
!               //SINGLE QUERIES. This queries happen when you call the 
get_userdata method to get
!               //the record of a single entry in the contacts backend
!               //To add a field to fetch back from userdata
!               //u need to add the field u want here
!               //Also, in class.uijsaddressbook there is a translation array 
that has
!               //the names of each field in english. Use it to decide what 
values to add here
!               var $single_query_cols =  array (
!                               'title'     => 'title',
!                               'n_given'    => 'n_given',
!                               'n_family'   => 'n_family',
!                               'org_name' => 'org_name',
!                               'tel_work' => 'tel_work',
!                               'cat_id'  => 'cat_id'
!                               );
!               //@param use_session Not used at the moment
!               var $use_session=true;
! 
!               //@function bojsaddressbook 
!               //@abstract This class's contructor
!               //@param contactquery Its a query array in the form explained 
as:
!               //      order: Must be equal to the order in which you want the 
query...ASC or DESC
!               //      categories: Must have the categories string as 
constrained by the categories class
!               //                  ,1,2 or 1,2 are valid strings to say, 
category number 1 and 2
!               //      filter: This is a whole parameter in itself, will 
explain bellow in the parse_contactquery discussion
!               //      query: Freestyle query to match against any fields in a 
mass query
!               //      sort:  The field to sort by.... n_give will sort by 
name, for example
!               //      directory_uid: This field may be empty but, if it has a 
number in it
!               //      we will search in the contacts owned by the user whose 
uid matches this value
!               //@param queryresults UNUSED, might use it for caching state 
purposes later on
!               //@discussion 
!               //This function checks its cache. All parameters are optional. 
If called with no parameters
!               //the class will assume all that it needs is in the cache and 
will get it from there
!               //If a contactquery value is supplied, the class will desregard 
its cache and go fetch the whole
!               //query again. 
!               //To be truth, its actually quite stupid and we should be using 
more intelligence to decide
!               //if the cache is stale.... for example, caching the result 
form parse_contactquery and
!               //compare it with what results from parsing the incoming 
contactquery. If its the same,
!               //we shouldnt refetch.
!               function bojsaddressbook($contactquery="",$queryresults="")
!               {
!                       $this->contactsobject=CreateObject('phpgwapi.contacts');
!                       //the idea is that here, right here, nowhere else, do 
we decide what to keep
!                       //from the cache and what to go and query again
!                               $data=$this->read_sessiondata();
!                               if(is_array($contactquery))
!                               {
!                                       
$this->parse_contactquery($contactquery);
!                                       
$data['result']=$this->contactsobject->read($this->contactquery['start'],$this->contactquery['offset'],
!                                                       
$this->mass_query_cols,$this->contactquery['query'],
!                                                       
$this->contactquery['filter'],
!                                                       
$this->contactquery['sort'],
!                                                       $this->sortby);
!                                       $this->save_sessiondata($data);
!                               }
! 
!                               $this->result=$data['result'];
! 
!               }
!               //@function parse_contactquery 
!               //@param contactquery As described in the constructor's param
!               //@abstrcat Parses an incoming contactquery into what the 
contacts backend
!               //likes to see in a query
!               //@discussion This ignores the start and offset parameters as 
they are somehow
!               //obsolete in this version. Its strange, i know, but maybe we 
will want to optimize
!               //later what we want to fetch from the contacts backend by this 
parameters so all other
!               //functions respect and think that thisone builds the start and 
offset
!               function parse_contactquery($contactquery)
!               {
!                       $notfirsttime=False;
!                       while(list($k,$v)=each($contactquery))
!                       {
!                               switch($k)
!                               {
!                                       case 'filter':
!                                               {
!                                                       switch($v)
!                                                       {
! 
!                                                               case 'none':
!                                                                       {
!                                                                               
$this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
        ($notfirsttime ? "," :"")."tid=n";
!                                                                               
$notfirsttime=True;
!                                                                               
break;
!                                                                       }
!                                                               case 
'user_only':
!                                                                       {
!                                                                               
$this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
        ($notfirsttime ? "," :"").
!                                                                               
        'owner='.$GLOBALS['phpgw_info']['user']['account_id'];
!                                                                               
$notfirsttime=True;
!                                                                               
break;
!                                                                       }
!                                                               case 
'directory':
!                                                                       {
!                                                                               
if(!$contactquery['directory_uid'])
!                                                                               
{
! 
!                                                                               
        $this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
                ($notfirsttime ? "," :"")."tid=p";
!                                                                               
}
!                                                                               
else
!                                                                               
{
!                                                                               
         $this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
                      ($notfirsttime ? "," :"")."owner=".
!                                                                               
                      $contactquery['directory_uid'];
!                                                                               
}
!                                                                               
$notfirsttime=True;
!                                                                               
break;
!                                                                       }
!                                                               case 'private':
!                                                                       {
!                                                                               
$this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
        ($notfirsttime ? "," :"").'owner='.
!                                                                               
        $GLOBALS['phpgw_info']['user']['account_id'].
!                                                                               
        ',access=private';
!                                                                               
$notfirsttime=True;
!                                                                               
break;
!                                                                       }
!                                                       }
!                                                       $notfirsttime=false;
!                                                       break;
!                                               }
!                                       case 'categories':
!                                               {
!                                                       if($v)
!                                                       {
!                                                               
$this->contactquery['filter']=$this->contactquery['filter'].
!                                                                               
 ($notfirsttime ? "," :"")."cat_id=".$v;
!                                                       $notfirsttime=true;
!                                                       }
!                                                       break;
!                                               }
!                                       case 'query':
!                                               {
!                                                       if($v)
!                                                       {
!                                                               
$this->contactquery['query']=$v;
!                                                       }
!                                               }
!                                                       
!                               }//end switch
!                       }//end while
! //                    print "<BR> built query";
! //                    print_r($this->contactquery);
!               }//end function
!               
!               //@function forget_query
!               //@discussion
!               //Causes the class to forget its query cache. This does not 
forget the destination boxes, only
!               //the mass query
!               function forget_query()
!               {
!                               $this->save_sessiondata("");
!               }
!               //@function recordinfo
!               //@param addy_id The record's id in the contacts backend
!               //@abstract Gets the record info descirbed by the 
single_query_cols array
!               //@discussion This returns an array of field=>value that 
actually has
!               //the whole record for the given id. As u can see, the values 
it gets back are
!               //given by the single_query_cols attribute which u can change 
to get more data
!               function recordinfo($addy_id)
!               {
!                       $entry = 
$this->contactsobject->read("","",$this->single_query_cols,"","id=$addy_id");
!                       if(!$entry[0])
!                       {
!                               return false;
!                       }
!                       return $entry[0];       
!               }
!               //@function save_destboxes
!               //@param destboxes The array of destbox arrays that we want 
saveed in the cache
!               //@discussion This function saves the destboxes into the cache
!               function save_destboxes($destboxes)
!               {
!                       
!                       $this->save_sessiondata($destboxes,"destboxes");
!               }
!               //@function get_destboxes
!               //@abstract Function to get the destination boxes... .this 
parameter should exlusively be gotten this way
!               //@discussion This function sees if we have any destboxes 
present in the destboxes attribute
!               //if we do, it returns that, if we dont, it gets them from 
cache.
!               
!               function get_destboxes()
!               {
!                       if(!is_array($this->destboxes) || 
(count($this->destboxes)<1) )
!                       {
!                               
$this->destboxes=$this->read_sessiondata("destboxes");
!                       }
!                       return $this->destboxes;
!               }
!               //@function forget_destbox
!               //@param destboxname The name of the destbox which serves as 
key to the destboxes array
!               //@abstract Will unset the live destbox corresponding to 
destboxname
!               //@discussion 
!               //Note that this function will not forget the destbox from the 
cache... i thought it
!               //a bit unneded for the particular application since i wanted 
this function to 
!               //iterate through the destboxes array and unset them one by 
one. This means that
!               //thisone only operates on real, already in memory (not in 
cache) destboxes.
!               //For the cache to reflect this change, you need to 
$obj->save_destboxes($this->destboxes)
!               //after calling this.
!               function  forget_destbox($destboxname)
!               {
!                       $this->get_destboxes();
!                       if(is_array($this->destboxes[$destboxname]))  
!                       {
!                               unset($this->destboxes[$destboxname]); 
!                               return $this->destboxes;
!                       }  
!                       return false;
!                       
!               }
!               //@function forget_destboxes
!               //@abstract Will forget all the destboxes, then save the 
changes to the cache
!               
!               function forget_destboxes()
!               {
!                       if($this->get_destboxes())
!                       {
!                               while(list($name,$list)=each($this->destboxes))
!                               {
!                                       $this->forget_destbox($name);
!                               }
!                               $this->set_destboxes($this->destboxes);
!                       }
!               }
!               //@function set_destboxes
!               //@param aryboxes The new destboxes array
!               //@param deleted An array of booleans with keys similar to the 
destboxes array
!               //If a given destination box has a true entry here, it will be 
removed in the cache
!               //@abstract This functions saves in cache the destination boxes 
values
!               //@discussion Note that this function can be mistaken by the 
save_destboxes function.
!               //Different thigs completely. This one takes an array of 
destboxes. The keys to this array
!               // are the destboxes names. Inside each array, there are uid => 
name pairs. Note the absence
!               //of an email field. The incoming aryboxes have NO email field 
whatsoever.
!               //What we do here, is try and find the corresponding email 
fields either in cache or directly
!               //in our mass query cache and set that field correctly to save 
it in cache
!               //This function is redundant, inneficient and dead slow. Not to 
say complex and unreadable
!               //Please change this please please please.
!               //Previous disclaimer said, it works now, and will release this 
way.
!               function set_destboxes($aryboxes,$deleted='')
!               {
!                       //print_r($aryboxes);
! //                    print "<br> SAVed DESTBOXES <br>";
!                       //We get our own destboxes from the cache
!                       $saveddestboxes=$this->get_destboxes();
!               //      print_r($saveddestboxes);
!                       $found=false;
!                       //We iterate into each box
!                       while(list($ak,$li)=each($aryboxes))
!                       {
! //                            print $ak." ".$li."<BR>";
! //                            print_r($li);
! //                            print "<br>";
!                               //We make shure this box has an array in it
!                               if($aryboxes[$ak])
!                               {
!                                       //We iterate into the incoming box to 
search
!                                       //for its values in the cache
!                                       
while(list($numary,$ary)=each($aryboxes[$ak]))
!                                       {
! //                                            print "<br> Iterating aryboxes 
$numary";        
! //                                            print_r($ary);
!                                               list($id,$name)=each($ary);
!                                               //Look for this record in the 
cached destboxes
!                                               
if(is_array($saveddestboxes[$ak]))
!                                               {
!                                                       //Well, we found that 
we have this destboxed cached so
!                                                       //now we will iterate 
through that
!                                                       
while(list($numarysave,$arysave)=each($saveddestboxes[$ak]))
!                                                       {
!                                                               //We will try 
and get each addressbook key
!                                                               //out of the 
cached destbox
!                                                               
list($sid,$sname)=each($arysave);
!                                                               
! //                                                            print "<br> 
Iterating destboxes $id -> $name / $sid $sname";    
!                                                               //So we can 
compare it and set the email field in it
!                                                               if($id==$sid)
!                                                               {
! //                                                                    print 
"<br> found $id in $ak";
! //                                                                    print 
"<br> seting mail to $arysave[email]";
!                                                                       
$ary['email']=$arysave['email'];
!                                                                       
$aryboxes[$ak][$numary]=$ary;
!                                                                       
!                                                                       
$found=true;
!                                                               }
! 
!                                                       }
!                                                       
reset($saveddestboxes[$ak]);
!                                               }
!                                               //couldnt find it in saved 
destboxes, lookfor ir in result
!                                               //This redundant POSH makes me 
angry....
!                                               //Now we look into our names 
cache...im not shure why, if i 
!                                               //try and evade this search 
when i find it in the cache, 
!                                               //it all goes borken
!                                               //We iterate into the query 
cache
!                                               
while(list($num,$record)=each($this->result))
!                                               {
! //                                                    print "<br> Iterating 
results $id   ---> $name <br>$record[id]---> $record[email]";
!                                                       //Found what we are 
looking for
!                                                       if($id == $record["id"])
!                                                       {
!                                                               //Set the mail 
record to what it should be
! //                                                            print "<br> 
seting mail to $record[email] <br>";
!                                                               
$ary['email']=($record["email"] ? $record["email"] : $record["home_email"]);
!                                                               
$aryboxes[$ak][$numary]=$ary;
!                                                               
$retboxes[$ak][$id]['email']= $ary['email'];
!                                                               
$retboxes[$ak][$id]['name']= $name;
!                                                               
!                                                       }
!                                               }
!                                               reset($this->result);
!                                               $found=false;
!                                       }
! 
!                               }
!                               elseif(!$deleted[$ak])
!                               {
! //                                    print "<br>Saving $ak from destination 
data $deleted[$ak]<br>";
! //                                    print_r($deleted);
!                                       //Delete the destboxes that need 
deletion
!                                       $aryboxes[$ak]=$saveddestboxes[$ak];
!                               }
!                       }
! //                    print "<br>modified<br>";
! //                            print_r($aryboxes);
!                               reset($aryboxes);
!                       //Save the resulting destboxes
!                       $this->save_destboxes($aryboxes);
!                       //We return what we couldnt find in cache so the caller 
can evaluate
!                       //if he needs to refresh his info...
!                       return $retboxes; 
!                       
!               }
!               //@function save_sessiondata
!               //@param data The data to be saved
!               //@param location An extra string to save data in diferent 
locations
!               //@abstract Saves the data into the app session cache
!               //@discussion
!               //If you pass it no location, it will save into jsbook_data
!               //If you do, it will save into jsbook_data_location
!               //This is important cause we sometimes only need the destboxes 
and not
!               //the whole queries so we only get what we need
!               function save_sessiondata($data,$location="")
!               {
!                       if ($this->use_session)
!                       {
!                               
$GLOBALS['phpgw']->session->appsession('session_data',"jsbook_data".($location 
? '_'.$location :""),$data);
!                       }
!                       if($this->debug)
!                       {
!                               echo '<br>Saving: ';
!                               _debug_array($data);
!                       }
!               }
!               //@function read_sessiondata
!               //@param location
!               //@abstract gets data out of the appsesion cache
!               //@discussion
!               //The location field behaves like the one described in 
save_sessiondata
! 
!               function read_sessiondata($location="")
!               {
!                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data','jsbook_data'.($location 
? '_'.$location :""));
!                       if($this->debug)
!                       {
!                               echo '<br>Read: ';
!                               _debug_array($data);
!                       }
!                       return $data;
!               }
!               
!       }
! ?>

Index: class.bomessage.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.bomessage.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** class.bomessage.inc.php     24 Nov 2002 01:57:46 -0000      1.13
--- class.bomessage.inc.php     14 Mar 2003 04:00:10 -0000      1.14
***************
*** 42,45 ****
--- 42,48 ----
                
                //no icon size option here, this page always uses the same size 
icons
+               // EXCEPT for the view option image, this will be filled this 
in with users preference
+               //var $icon_size='16';
+               var $icon_size='24';
                
                var $xi;
***************
*** 51,55 ****
                @abtract *constructor*
                @discussion fills the "langs" vars including the "lang_warn" 
langs which are use to notify user 
!               of some common "bad" message attachments or other bad content. 
                */
                function bomessage()
--- 54,58 ----
                @abtract *constructor*
                @discussion fills the "langs" vars including the "lang_warn" 
langs which are use to notify user 
!               of some common "bad" message attachments or other bad content. 
                */
                function bomessage()
***************
*** 85,88 ****
--- 88,92 ----
                        $this->xi['lang_view_formatted'] = lang('view 
formatted');
                        $this->xi['lang_view_unformatted'] = lang('view 
unformatted');
+                       $this->xi['lang_view_printable'] = lang('printable');
                        $this->xi['lang_charset'] = lang('charset');
                        $this->xi['lang_attachment'] = lang('Attachment');
***************
*** 91,94 ****
--- 95,100 ----
                        $this->xi['accounts_label'] = lang('Switch Accounts');
                        $this->xi['lang_move_this_message_into'] = lang('Move 
This Message into');
+                       $this->xi['lang_go_back_to'] = lang('Go Back To');
+                       $this->xi['lang_inbox'] = lang('INBOX');
                        
                        // THREAT LEVEL LANGS: 
***************
*** 177,183 ****
                        $svr_image_dir = PHPGW_IMAGES_DIR;
                        $image_dir = PHPGW_IMAGES;
                        $this->icon_theme = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_theme');
!                       //echo "icon theme is ".$this->icon_theme."<br>\r\n";
! 
                        
                        // ---- account switchbox  ----
--- 183,191 ----
                        $svr_image_dir = PHPGW_IMAGES_DIR;
                        $image_dir = PHPGW_IMAGES;
+                       //$icon_theme = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_theme',$acctnum);
+                       //$icon_size = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_size',$acctnum);
+                       // we do not really have to specify an acct num, the 
"current acctnum" will be used if we do not specify one here
                        $this->icon_theme = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_theme');
!                       $this->icon_size = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_size');
                        
                        // ---- account switchbox  ----
***************
*** 199,203 ****
                                                                '/index.php',
                                                                 
'menuaction=email.uipreferences.ex_accounts_list');
!                               $this->xi['accounts_img'] = 
$GLOBALS['phpgw']->msg->img_maketag($image_dir.'/'.$this->icon_theme.'-accounts-24.gif',$this->xi['folders_txt1'],'','','0');
                                $this->xi['ilnk_accounts'] = 
$GLOBALS['phpgw']->msg->href_maketag($this->xi['accounts_link'],$this->xi['accounts_img']);
                        }
--- 207,211 ----
                                                                '/index.php',
                                                                 
'menuaction=email.uipreferences.ex_accounts_list');
!                               $this->xi['accounts_img'] = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on($this->icon_theme.'/accounts-24','_on'),$this->xi['folders_txt1'],'','','0');
                                $this->xi['ilnk_accounts'] = 
$GLOBALS['phpgw']->msg->href_maketag($this->xi['accounts_link'],$this->xi['accounts_img']);
                        }
***************
*** 262,267 ****
                        
                        // ----  Fill Some Important Variables  -----
!                       //$sm_envelope_img = 
$GLOBALS['phpgw']->msg->img_maketag($image_dir.'/sm_envelope.gif',$this->xi['lang_add_to_address_book'],'8','10','0');
!                       $sm_envelope_img = 
$GLOBALS['phpgw']->msg->img_maketag($image_dir.'/'.$this->icon_theme.'-address-conduit-16.gif',$this->xi['lang_add_to_address_book'],'','','0');
                        $not_set = $GLOBALS['phpgw']->msg->not_set;
                        
--- 270,275 ----
                        
                        // ----  Fill Some Important Variables  -----
!                       $sm_envelope_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/address-conduit-16','_on'),$this->xi['land_add_to_address_book'],'','','0');
! 
                        $not_set = $GLOBALS['phpgw']->msg->not_set;
                        
***************
*** 328,331 ****
--- 336,354 ----
                        }
                        
+                       // if we are on INBOX translate it
+                       if 
($GLOBALS['phpgw']->msg->get_folder_short($msgball['folder']) == 'INBOX')
+                       {
+                               //$nice_folder_name = lang('INBOX');
+                               // try this for common folder related lang 
strings
+                               //$common_langs = 
$GLOBALS['phpgw']->msg->get_common_langs();
+                               //$nice_folder_name = 
$common_langs['lang_inbox'];
+                               // or try this shortcut, it works too
+                               $nice_folder_name = 
$GLOBALS['phpgw']->msg->get_common_langs('lang_inbox');
+                       }
+                       else
+                       {
+                               $nice_folder_name = 
$GLOBALS['phpgw']->msg->get_folder_short($msgball['folder']);
+                       }
+                       
                        // ----  What Folder To Return To  -----
                        $lnk_goback_folder = 
$GLOBALS['phpgw']->msg->href_maketag(
***************
*** 338,342 ****
                                        
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
                                        
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')),
!                               
$GLOBALS['phpgw']->msg->get_folder_short($msgball['folder']));
                        
                        // NOTE: msgnum int 0 is NOT to be confused with 
"empty" nor "boolean False"
--- 361,366 ----
                                        
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
                                        
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')),
!                               
//$GLOBALS['phpgw']->msg->get_folder_short($msgball['folder']));
!                               $nice_folder_name);
                        
                        // NOTE: msgnum int 0 is NOT to be confused with 
"empty" nor "boolean False"
***************
*** 359,368 ****
                                        
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
                                        .$this->no_fmt);
!                               $prev_msg_img = 
$GLOBALS['phpgw']->msg->img_maketag($image_dir.'/'.$this->icon_theme.'-arrow-left-24.gif',$this->xi['lang_previous_message'],'','','0');
                                $ilnk_prev_msg = 
$GLOBALS['phpgw']->msg->href_maketag($prev_msg_link,$prev_msg_img);
                        }
                        else
                        {
!                               $ilnk_prev_msg = 
$GLOBALS['phpgw']->msg->img_maketag($image_dir.'/'.$this->icon_theme.'-arrow-left-no-24.gif',$this->xi['lang_no_previous_message'],'','','0');
                        }
                        
--- 383,394 ----
                                        
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
                                        .$this->no_fmt);
!                               $prev_msg_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/arrow-left-24','_on'),$this->xi['lang_previous_message'],'','','0');
! 
                                $ilnk_prev_msg = 
$GLOBALS['phpgw']->msg->href_maketag($prev_msg_link,$prev_msg_img);
                        }
                        else
                        {
!                               $ilnk_prev_msg = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/arrow-left-no-24','_on'),$this->xi['lang_no_previous_message'],'','','0');
! 
                        }
                        
***************
*** 381,390 ****
                                        
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
                                        .$this->no_fmt);
!                               $next_msg_img = 
$GLOBALS['phpgw']->msg->img_maketag($image_dir.'/'.$this->icon_theme.'-arrow-right-24.gif',$this->xi['lang_next_message'],'','','0');
                                $ilnk_next_msg = 
$GLOBALS['phpgw']->msg->href_maketag($next_msg_link,$next_msg_img);
                        }
                        else
                        {
!                               $ilnk_next_msg = 
$GLOBALS['phpgw']->msg->img_maketag($image_dir.'/'.$this->icon_theme.'-arrow-right-no-24.gif',$this->xi['lang_no_next_message'],'','','0');
                        }
                        
--- 407,416 ----
                                        
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
                                        .$this->no_fmt);
!                               $next_msg_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/arrow-right-24','_on'),$this->xi['lang_next_message'],'','','0');
                                $ilnk_next_msg = 
$GLOBALS['phpgw']->msg->href_maketag($next_msg_link,$next_msg_img);
                        }
                        else
                        {
!                               $ilnk_next_msg = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/arrow-right-no-24','_on'),$this->xi['lang__no_next_message'],'','','0');
                        }
                        
***************
*** 420,429 ****
                                                
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
                                                
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
!                                               .$this->no_fmt);
                        }
                        
                        // ----  Labels and Colors for From, To, CC, Files, and 
Subject  -----
                        $this->xi['tofrom_labels_bkcolor'] = 
$GLOBALS['phpgw_info']['theme']['th_bg'];
                        $this->xi['tofrom_data_bkcolor'] = 
$GLOBALS['phpgw_info']['theme']['row_on'];
                        
                        // ----  From: Message Data  -----
--- 446,461 ----
                                                
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
                                                
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
!                                               // This "no_fmt" does not apply 
of we are going back to the index page, it only applies to viewing messages.
!                                               //.$this->no_fmt
!                                               );
                        }
                        
                        // ----  Labels and Colors for From, To, CC, Files, and 
Subject  -----
                        $this->xi['tofrom_labels_bkcolor'] = 
$GLOBALS['phpgw_info']['theme']['th_bg'];
+                       $this->xi['tofrom_labels_class'] = 'th';
+                       //$this->xi['tofrom_labels_bkcolor'] = 
$GLOBALS['phpgw_info']['theme']['row_off'];
+                       //$this->xi['tofrom_labels_class'] = 'row_off';
                        $this->xi['tofrom_data_bkcolor'] = 
$GLOBALS['phpgw_info']['theme']['row_on'];
+                       $this->xi['tofrom_data_class'] = 'row_on';
                        
                        // ----  From: Message Data  -----
***************
*** 719,723 ****
                        
                        // ----  Images and Hrefs For Reply, ReplyAll, Forward, 
and Delete  -----
!                       $reply_img = 
$GLOBALS['phpgw']->msg->img_maketag($image_dir.'/'.$this->icon_theme.'-reply.gif',$this->xi['lang_reply'],'','','0');
                        $reply_url = $GLOBALS['phpgw']->link(
                                        '/index.php',
--- 751,755 ----
                        
                        // ----  Images and Hrefs For Reply, ReplyAll, Forward, 
and Delete  -----
!                       $reply_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/reply','_on'),$this->xi['lang_reply'],'','','0');
                        $reply_url = $GLOBALS['phpgw']->link(
                                        '/index.php',
***************
*** 732,737 ****
                        $ilnk_reply = 
$GLOBALS['phpgw']->msg->href_maketag($reply_url, $reply_img);
                        
!                       
!                       $replyall_img = 
$GLOBALS['phpgw']->msg->img_maketag($image_dir 
.'/'.$this->icon_theme.'-reply-all.gif',$this->xi['lang_reply_all'],'','','0');
                        $replyall_url = $GLOBALS['phpgw']->link(
                                        '/index.php',
--- 764,768 ----
                        $ilnk_reply = 
$GLOBALS['phpgw']->msg->href_maketag($reply_url, $reply_img);
                        
!                       $replyall_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/reply-all','_on'),$this->xi['lang_reply_all'],'','','0');
                        $replyall_url = $GLOBALS['phpgw']->link(
                                        '/index.php',
***************
*** 746,751 ****
                        $ilnk_replyall = 
$GLOBALS['phpgw']->msg->href_maketag($replyall_url, $replyall_img);
                        
!                       
!                       $forward_img = 
$GLOBALS['phpgw']->msg->img_maketag($image_dir 
.'/'.$this->icon_theme.'-forward.gif',$this->xi['lang_forward'],'','','0');
                        $forward_url =  $GLOBALS['phpgw']->link(
                                        '/index.php',
--- 777,781 ----
                        $ilnk_replyall = 
$GLOBALS['phpgw']->msg->href_maketag($replyall_url, $replyall_img);
                        
!                       $forward_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/forward','_on'),$this->xi['lang_forward'],'','','0');
                        $forward_url =  $GLOBALS['phpgw']->link(
                                        '/index.php',
***************
*** 761,766 ****
                        $ilnk_forward = 
$GLOBALS['phpgw']->msg->href_maketag($forward_url, $forward_img);
                        
!                       
!                       $delete_img = 
$GLOBALS['phpgw']->msg->img_maketag($image_dir 
.'/'.$this->icon_theme.'-delete-message.gif',$this->xi['lang_delete'],'','','0');
                        $delete_url = $GLOBALS['phpgw']->link(
                                         '/index.php',
--- 791,795 ----
                        $ilnk_forward = 
$GLOBALS['phpgw']->msg->href_maketag($forward_url, $forward_img);
                        
!                       $delete_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$this->icon_theme.'/delete-message','_on'),$this->xi['lang_delete'],'','','0');
                        $delete_url = $GLOBALS['phpgw']->link(
                                         '/index.php',
***************
*** 771,775 ****
                                        
.'&sort='.$GLOBALS['phpgw']->msg->get_arg_value('sort')
                                        
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
!                                       
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start'));
                        $ilnk_delete = 
$GLOBALS['phpgw']->msg->href_maketag($delete_url, $delete_img);
                        
--- 800,805 ----
                                        
.'&sort='.$GLOBALS['phpgw']->msg->get_arg_value('sort')
                                        
.'&order='.$GLOBALS['phpgw']->msg->get_arg_value('order')
!                                       
.'&start='.$GLOBALS['phpgw']->msg->get_arg_value('start')
!                                       .$this->no_fmt);
                        $ilnk_delete = 
$GLOBALS['phpgw']->msg->href_maketag($delete_url, $delete_img);
                        
***************
*** 778,781 ****
--- 808,812 ----
                        $this->xi['reply_btns_text'] = 
$GLOBALS['phpgw_info']['theme']['em_folder_text'];
                        $this->xi['lnk_goback_folder'] = $lnk_goback_folder;
+                       $this->xi['go_back_to'] = $this->xi['lang_go_back_to'];
                        $this->xi['ilnk_reply'] = $ilnk_reply;
                        $this->xi['ilnk_replyall'] = $ilnk_replyall;
***************
*** 918,921 ****
--- 949,954 ----
                        // (1) "view formatted/unformatted" link goes there, 
(MAYBE CALL IT "PLAIN TEXT" INSTEAD?)
                        // this template var will be filled with something 
below if appropriate, else it stays empty
+                       $view_unformatted_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email','view_nofmt-'.$this->icon_size,'_on'),$this->xi['lang_view_unformatted'],'','','0');
+                       $view_formatted_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email','view_formatted-'.$this->icon_size,'_on'),$this->xi['lang_view_formatted'],'','','0');
                        $this->xi['view_option'] = '&nbsp';
                        // base URLs for the "view unformatted" or "view 
formatted" option
***************
*** 933,936 ****
--- 966,970 ----
                        
                        // (2) view headers option
+                       $view_headers_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email','view_headers-'.$this->icon_size,'_on'),$this->xi['lang_view_headers'],'','','0');
                        $this_msgball = $msgball;
                        $this_msgball['part_no'] = 0;
***************
*** 944,952 ****
                                .'&encoding=7bit'
                                );
-                       
                        $view_headers_href = '<a href="'.$view_headers_url.'" 
target="new">'.$this->xi['lang_view_headers'].'</a>';
                        $this->xi['view_headers_href'] = $view_headers_href;
                        
                        // (3) view or download the raw message, including 
headers
                        $this_msgball = $msgball;
                        $this_msgball['part_no'] = 'raw_message';
--- 978,988 ----
                                .'&encoding=7bit'
                                );
                        $view_headers_href = '<a href="'.$view_headers_url.'" 
target="new">'.$this->xi['lang_view_headers'].'</a>';
                        $this->xi['view_headers_href'] = $view_headers_href;
+                       $view_headers_ilnk = '<a href="'.$view_headers_url.'" 
target="new">'.$view_headers_img.'</a>';
+                       $this->xi['view_headers_ilnk'] = $view_headers_ilnk;
                        
                        // (3) view or download the raw message, including 
headers
+                       $view_raw_message_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email','view_raw-'.$this->icon_size,'_on'),$this->xi['lang_view_raw_message'],'','','0');
                        $this_msgball = $msgball;
                        $this_msgball['part_no'] = 'raw_message';
***************
*** 962,965 ****
--- 998,1016 ----
                        $view_raw_message_href = '<a 
href="'.$view_raw_message_url.'" 
target="new">'.$this->xi['lang_view_raw_message'].'</a>';
                        $this->xi['view_raw_message_href'] = 
$view_raw_message_href;
+                       $view_raw_message_ilnk = '<a 
href="'.$view_raw_message_url.'" target="new">'.$view_raw_message_img.'</a>';
+                       $this->xi['view_raw_message_ilnk'] = 
$view_raw_message_ilnk;
+                       
+                       // (4) view printer friendly version
+                       $view_printable_img = 
$GLOBALS['phpgw']->msg->img_maketag($GLOBALS['phpgw']->msg->_image_on('email','view_printable-'.$this->icon_size,'_on'),$this->xi['lang_view_printable'],'','','0');
+                       $view_printable_url = $GLOBALS['phpgw']->link(
+                               '/index.php',
+                                'menuaction=email.uimessage.printable'
+                               .'&'.$msgball['uri']
+                               );
+                       $view_printable_href = '<a 
href="'.$view_printable_url.'" 
target="new">'.$this->xi['lang_view_printable'].'</a>';
+                       $this->xi['view_printable_href'] = $view_printable_href;
+                       $view_printable_ilnk = '<a 
href="'.$view_printable_url.'" target="new">'.$view_printable_img.'</a>';
+                       $this->xi['view_printable_ilnk'] = $view_printable_ilnk;
+                       
                        
                        // Force Echo Out Unformatted Text for email with 1 
part which is a large text messages (in bytes) , such as a system report from 
cron
***************
*** 1441,1444 ****
--- 1492,1497 ----
                                                        // alternate (toggle) 
to view formatted
                                                        $view_option = 
$GLOBALS['phpgw']->msg->href_maketag($view_option_url, 
$this->xi['lang_view_formatted']);
+                                                       $view_option_ilnk = 
$GLOBALS['phpgw']->msg->href_maketag($view_option_url, $view_formatted_img);
+                                                       
$this->xi['view_option_ilnk'] = $view_option_ilnk;
                                                }
                                                else
***************
*** 1464,1467 ****
--- 1517,1522 ----
                                                        // alternate (toggle) 
to view unformatted, for this we add "&no_fmt=1" to the URL
                                                        $view_option = 
$GLOBALS['phpgw']->msg->href_maketag($view_option_url.'&no_fmt=1', 
$this->xi['lang_view_unformatted']);
+                                                       $view_option_ilnk = 
$GLOBALS['phpgw']->msg->href_maketag($view_option_url.'&no_fmt=1', 
$view_unformatted_img);
+                                                       
$this->xi['view_option_ilnk'] = $view_option_ilnk;
                                                }
                                                

Index: class.bopreferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.bopreferences.inc.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** class.bopreferences.inc.php 6 Dec 2002 23:49:47 -0000       1.22
--- class.bopreferences.inc.php 14 Mar 2003 04:00:15 -0000      1.23
***************
*** 1,1970 ****
! <?php
!       
/***********************************************************************\
!       * phpGroupWare - E-Mail Preferences Handlers                            
        *
!       * http://www.phpgroupware.org                                           
                        *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                                *
!       
\***********************************************************************/
[...3925 lines suppressed...]
!                       if ( (!isset($prelim_acctnum))
!                       || ($prelim_acctnum == $this->add_new_account_token)
!                       || ($prelim_acctnum == '##NOTHING##')
!                       || ((string)$prelim_acctnum == '')
!                       || ((string)$prelim_acctnum == '0') )
!                       {
!                               // get the next blank acctnum
!                               $final_acctnum = 
$this->get_first_empty_ex_acctnum();
!                       }
!                       else
!                       {
!                               $final_acctnum = $prelim_acctnum;
!                       }
!                       if ($this->debug_set_prefs > 0) { echo 
'email.bopreferences.obtain_ex_acctnum: LEAVING, returning $final_acctnum: 
['.serialize($final_acctnum).'] <br>'; }
!                       return $final_acctnum;
!               }
! 
! 
!       }
! ?>

Index: class.bosend.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.bosend.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.bosend.inc.php        25 Oct 2002 12:45:52 -0000      1.10
--- class.bosend.inc.php        14 Mar 2003 04:00:21 -0000      1.11
***************
*** 1,1178 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - email send non-SMTP functions                          
        *
!       * http://www.phpgroupware.org                                           
                        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
[...2340 lines suppressed...]
!                                       
$GLOBALS['phpgw']->common->phpgw_exit(False);
!                               }
!                       }
!                       else
!                       {
!                               // ERROR - mail NOT sent
!                               echo '<html><body>'."\r\n";
!                               echo '<h2>Your message could <b>not</b> be 
sent!</h2>'."\r\n";
!                               echo '<h3>The mail server 
returned:</h3>'."\r\n";
!                               echo '<pre>';
!                               print_r($GLOBALS['phpgw']->mail_send->err);
!                               echo '</pre>'."\r\n";
!                               echo '<p>To go back to the msg list, click <a 
href="'.$return_to_folder_href.'">here</a> </p>'."\r\n";
!                               echo '</body></html>';
!                               $this->send_message_cleanup();
!                       }
!               }
!       
!       }
! ?>

Index: class.html_widgets.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.html_widgets.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.html_widgets.inc.php  15 Nov 2002 08:41:32 -0000      1.2
--- class.html_widgets.inc.php  14 Mar 2003 04:00:42 -0000      1.3
***************
*** 69,73 ****
        /*!
        @class html_widgets
!       @abstract generate HTML widgets for use in web pages.
        @author Angles
        @access public
--- 69,73 ----
        /*!
        @class html_widgets
!       @abstract generate HTML widgets for use in web pages.
        @author Angles
        @access public
***************
*** 83,87 ****
                //var $debug = 3;
                var $debug_init = 0;
!               
                // bootstraper for the msg class
                var $msg_bootstrap;
--- 83,89 ----
                //var $debug = 3;
                var $debug_init = 0;
!               
!               // if calling from home page it is optional to force currentapp 
as a constructor param
!               var $my_currentapp='';
                // bootstraper for the msg class
                var $msg_bootstrap;
***************
*** 114,119 ****
                var $toolbar='';
                
                // RELOAD WIDGET
!               var $refresh_js='';
                
                
--- 116,134 ----
                var $toolbar='';
                
+               // ALL FOLDERS ALL ACCOUNTS MEGA LISTBOX
+               var $F_megalist_form_reference='';
+               var $F_megalist_widget_name='';
+               var $F_megalist_preselected_fldball='';
+               var $F_megalist_skip_fldball='';
+               var $F_megalist_first_item_text = '';
+               
                // RELOAD WIDGET
!               var $refresh_js='';
!               
!               // GENERIC ERROR REPORT
!               var $F_mindless_default_txt = 'error text not provided';
!               var $F_error_report_text='';
!               var $F_go_somewhere_link='';
!               var $F_go_home_link='';
                
                
***************
*** 123,128 ****
                function html_widgets()
                {
!                       if ($this->debug_init > 0) { echo 'ENTER,EXIT: 
email.html_widgets.CONSTRUCTOR'.'<br>'."\r\n"; }
!                       
                        /*!
                        @class requires including spell_struct header file
--- 138,142 ----
                function html_widgets()
                {
!                       if ($this->debug_init > 0) { echo 'ENTER: 
email.html_widgets.CONSTRUCTOR'.'<br>'."\r\n"; }
                        /*!
                        @class requires including spell_struct header file
***************
*** 131,137 ****
                        with the mail.spell  spellchecking class.
                        */
!                       $required_class = 'spell_struct';
!                       
require_once(PHPGW_INCLUDE_ROOT.'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/inc/class.'.$required_class.'.inc.php');
!                       
                        if ($this->debug_init > 0) { echo 'EXIT: 
email.html_widgets.CONSTRUCTOR'.'<br>'."\r\n"; }
                        return;
--- 145,157 ----
                        with the mail.spell  spellchecking class.
                        */
!                       $required_class = 'spell_struct';
!                       
!                       // if calling this class from the home page, then the 
currentapp will be 
!                       //set to "home" instead of "email", which messes up the 
include statement below, 
!                       // so set a local var to "email" to force considering 
the currentapp to be "email".
!                       $this->my_currentapp = 'email';
!                       
//require_once(PHPGW_INCLUDE_ROOT.'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/inc/class.'.$required_class.'.inc.php');
!                       
require_once(PHPGW_INCLUDE_ROOT.'/'.$this->my_currentapp.'/inc/class.'.$required_class.'.inc.php');
!                       
                        if ($this->debug_init > 0) { echo 'EXIT: 
email.html_widgets.CONSTRUCTOR'.'<br>'."\r\n"; }
                        return;
***************
*** 533,537 ****
                comboboxes more then one time, calling "get_combobox" will 
return the same combobox until you 
                clear it by calling "new_combobox", which you should ALWAYS do 
when starting a new combobox 
!               widget.
                @access public
                */
--- 553,559 ----
                comboboxes more then one time, calling "get_combobox" will 
return the same combobox until you 
                clear it by calling "new_combobox", which you should ALWAYS do 
when starting a new combobox 
!               widget. VALUES ARE NOT URLENCODED, except that the special 
spellcheck item stuff 
!               does it, but before this function, and this does not happen for 
the normal set cbox item. It IS 
!               html specialchars encoded here.
                @access public
                */
***************
*** 563,567 ****
                                                '<option 
value="'.$this->cbox_items[$i]->value.'"'.$selected_tag.'>'
                                                
.htmlspecialchars($this->cbox_items[$i]->text)
!                                               .'</option>';                   
                                }
                        }
--- 585,590 ----
                                                '<option 
value="'.$this->cbox_items[$i]->value.'"'.$selected_tag.'>'
                                                
.htmlspecialchars($this->cbox_items[$i]->text)
!                                               .'</option>';
!                                       $this->combobox .= "\r\n";
                                }
                        }
***************
*** 747,751 ****
                                                 '<input type="hidden" '
                                                
.'name="'.$this->form_hiddenvars[$i]->name.'" '
!                                               
.'value="'.$this->form_hiddenvars[$i]->value.'">';
                                }
                        }
--- 770,776 ----
                                                 '<input type="hidden" '
                                                
.'name="'.$this->form_hiddenvars[$i]->name.'" '
!                                               
.'value="'.$this->form_hiddenvars[$i]->value.'">';
!                                       // just to be safe, send a line break 
after every one of these
!                                       $this->form .= "\r\n";
                                }
                        }
***************
*** 888,894 ****
                        
                        // We use these over and over, so figure them out now
!                       // some fonts and font sizes
!                       
$this->tpl->set_var('toolbar_row1_bgcolor',$GLOBALS['phpgw_info']['theme']['row_off']);
!                       
$this->tpl->set_var('toolbar_row2_bgcolor',$GLOBALS['phpgw_info']['theme']['row_on']);
                        
$this->tpl->set_var('toolbar_font',$GLOBALS['phpgw_info']['theme']['font']);
                        $this->tpl->set_var('toolbar_font_size','2');
--- 913,923 ----
                        
                        // We use these over and over, so figure them out now
!                       // some fonts and font sizes
!                       $row1_rowcolor_key = 'row_off';
!                       $row2_rowcolor_key = 'row_on';
!                       
$this->tpl->set_var('row1_rowcolor_key',$row1_rowcolor_key);
!                       
$this->tpl->set_var('row2_rowcolor_key',$row2_rowcolor_key);
!                       
$this->tpl->set_var('toolbar_row1_bgcolor',$GLOBALS['phpgw_info']['theme'][$row1_rowcolor_key]);
!                       
$this->tpl->set_var('toolbar_row2_bgcolor',$GLOBALS['phpgw_info']['theme'][$row2_rowcolor_key]);
                        
$this->tpl->set_var('toolbar_font',$GLOBALS['phpgw_info']['theme']['font']);
                        $this->tpl->set_var('toolbar_font_size','2');
***************
*** 897,902 ****
                        $this->tpl->set_var('report_this', 
$GLOBALS['phpgw']->msg->report_moved_or_deleted());
                        
!                       $icon_theme = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_theme');
!                       $icon_size = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_size');
                        $svr_image_dir = PHPGW_IMAGES_DIR;
                        $image_dir = PHPGW_IMAGES;
--- 926,931 ----
                        $this->tpl->set_var('report_this', 
$GLOBALS['phpgw']->msg->report_moved_or_deleted());
                        
!                       $icon_theme = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_theme',$acctnum);
!                       $icon_size = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_size',$acctnum);
                        $svr_image_dir = PHPGW_IMAGES_DIR;
                        $image_dir = PHPGW_IMAGES;
***************
*** 973,992 ****
                                        //Create Compose Button
                                        $this->set_href_link($compose_link);
!                                       
$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-compose-message-'.$icon_size.'.gif',lang('Compose'),'','','0'));
                                        $this->tpl->set_var('compose_img_link', 
$this->get_href());
                                        $this->tpl->set_var('compose_txt_link', 
'&nbsp;');                      
                                        //Create Filter Button
                                        $this->set_href_link($filters_link);
!                                       
$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-filters-'.$icon_size.'.gif',lang('Filters'),'','','0'));
                                        $this->tpl->set_var('filters_img_link', 
$this->get_href());
                                        $this->tpl->set_var('filters_txt_link', 
'&nbsp;');
                                        //Create Accounts Button
                                        $this->set_href_link($accounts_link);
!                                       
$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-accounts-'.$icon_size.'.gif',lang('Accounts'),'','','0'));
                                        
$this->tpl->set_var('accounts_img_link', $this->get_href());
                                        
$this->tpl->set_var('accounts_txt_link', '&nbsp;');
                                        //Create Settings Button
                                        $this->set_href_link($email_prefs_link);
!                                       
$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-customize-'.$icon_size.'.gif',lang('Settings'),'','','0'));
                                        
$this->tpl->set_var('settings_img_link', $this->get_href());
                                        
$this->tpl->set_var('settings_txt_link', '&nbsp;');
--- 1002,1021 ----
                                        //Create Compose Button
                                        $this->set_href_link($compose_link);
!                                       
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/compose-message-'.$icon_size,'_on'),lang('Compose'),'','','0'));
                                        $this->tpl->set_var('compose_img_link', 
$this->get_href());
                                        $this->tpl->set_var('compose_txt_link', 
'&nbsp;');                      
                                        //Create Filter Button
                                        $this->set_href_link($filters_link);
!                                       
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/filters-'.$icon_size,'_on'),lang('Filters'),'','','0'));
                                        $this->tpl->set_var('filters_img_link', 
$this->get_href());
                                        $this->tpl->set_var('filters_txt_link', 
'&nbsp;');
                                        //Create Accounts Button
                                        $this->set_href_link($accounts_link);
!                                       
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/accounts-'.$icon_size,'_on'),lang('Accounts'),'','','0'));
                                        
$this->tpl->set_var('accounts_img_link', $this->get_href());
                                        
$this->tpl->set_var('accounts_txt_link', '&nbsp;');
                                        //Create Settings Button
                                        $this->set_href_link($email_prefs_link);
!                                       
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/customize-'.$icon_size,'_on'),lang('Settings'),'','','0'));
                                        
$this->tpl->set_var('settings_img_link', $this->get_href());
                                        
$this->tpl->set_var('settings_txt_link', '&nbsp;');
***************
*** 996,1000 ****
                                                //Create Folder Image Link
                                                
$this->set_href_link($folders_link);
!                                               
$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-folder-'.$icon_size.'.gif',lang('Folders'),'','','0'));
                                                
$this->tpl->set_var('folders_img_link', $this->get_href());
                                                
$this->tpl->set_var('folders_txt_link', '&nbsp;');
--- 1025,1029 ----
                                                //Create Folder Image Link
                                                
$this->set_href_link($folders_link);
!                                               
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/folder-'.$icon_size,'_on'),lang('Folders'),'','','0'));
                                                
$this->tpl->set_var('folders_img_link', $this->get_href());
                                                
$this->tpl->set_var('folders_txt_link', '&nbsp;');
***************
*** 1010,1014 ****
                                        //Create Compose Button
                                        $this->set_href_link($compose_link);
!                                       
$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-compose-message-'.$icon_size.'.gif',lang('Compose'),'','','0'));
                                        $this->tpl->set_var('compose_img_link', 
$this->get_href());
                                        $this->set_href_link($compose_link);
--- 1039,1043 ----
                                        //Create Compose Button
                                        $this->set_href_link($compose_link);
!                                       
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/compose-message-'.$icon_size,'_on'),lang('Compose'),'','','0'));
                                        $this->tpl->set_var('compose_img_link', 
$this->get_href());
                                        $this->set_href_link($compose_link);
***************
*** 1017,1021 ****
                                        //Create Filter Button
                                        $this->set_href_link($filters_link);
!                                       
$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-filters-'.$icon_size.'.gif',lang('Filters'),'','','0'));
                                        $this->tpl->set_var('filters_img_link', 
$this->get_href());
                                        $this->set_href_link($filters_link);
--- 1046,1050 ----
                                        //Create Filter Button
                                        $this->set_href_link($filters_link);
!                                       
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/filters-'.$icon_size,'_on'),lang('Filters'),'','','0'));
                                        $this->tpl->set_var('filters_img_link', 
$this->get_href());
                                        $this->set_href_link($filters_link);
***************
*** 1024,1028 ****
                                        //Create Accounts Button
                                        $this->set_href_link($accounts_link);
!                                       
$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-accounts-'.$icon_size.'.gif',lang('Accounts'),'','','0'));
                                        
$this->tpl->set_var('accounts_img_link', $this->get_href());
                                        $this->set_href_link($accounts_link);
--- 1053,1057 ----
                                        //Create Accounts Button
                                        $this->set_href_link($accounts_link);
!                                       
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/accounts-'.$icon_size,'_on'),lang('Accounts'),'','','0'));
                                        
$this->tpl->set_var('accounts_img_link', $this->get_href());
                                        $this->set_href_link($accounts_link);
***************
*** 1031,1035 ****
                                        //Create Settings Button
                                        $this->set_href_link($email_prefs_link);
!                                       
$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-customize-'.$icon_size.'.gif',lang('Settings'),'','','0'));
                                        
$this->tpl->set_var('settings_img_link', $this->get_href());
                                        $this->set_href_link($email_prefs_link);
--- 1060,1064 ----
                                        //Create Settings Button
                                        $this->set_href_link($email_prefs_link);
!                                       
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/customize-'.$icon_size,'_on'),lang('Settings'),'','','0'));
                                        
$this->tpl->set_var('settings_img_link', $this->get_href());
                                        $this->set_href_link($email_prefs_link);
***************
*** 1041,1045 ****
                                                //Create Folder Image Link
                                                
$this->set_href_link($folders_link);
!                                               
$this->set_href_clickme($this->img_maketag($image_dir.'/'.$icon_theme.'-folder-'.$icon_size.'.gif',lang('Folders'),'','','0'));
                                                
$this->tpl->set_var('folders_img_link', $this->get_href());
                                                //Create Folder Text Link
--- 1070,1074 ----
                                                //Create Folder Image Link
                                                
$this->set_href_link($folders_link);
!                                               
$this->set_href_clickme($this->img_maketag($GLOBALS['phpgw']->msg->_image_on('email',$icon_theme.'/folder-'.$icon_size,'_on'),lang('Folders'),'','','0'));
                                                
$this->tpl->set_var('folders_img_link', $this->get_href());
                                                //Create Folder Text Link
***************
*** 1137,1180 ****
                        // set_cbox_item(value, text, selected(optional, 
boolean, default false)
                        $this->set_cbox_item('', lang('switch current folder 
to'));
-                       // Save Origional Folder Name. $folder_status in the 
for statment below causes us to lose it.
-                       $origional_folder = 
$GLOBALS['phpgw']->msg->get_folder_short($GLOBALS['phpgw']->msg->prep_folder_out());
                        
                        // get the actual list of folders we are going to put 
into the combobox
                        //$folder_list = 
$GLOBALS['phpgw']->msg->get_folder_list();
!                       $folder_list = 
$GLOBALS['phpgw']->msg->get_arg_value('folder_list');
                        //$folder_list =& 
$GLOBALS['phpgw']->msg->get_arg_value_ref('folder_list');
                        
!                       //if 
($GLOBALS['phpgw_info']['user']['preferences']['email']['newmsg_combobox'] == 
True) {
!                       if 
($GLOBALS['phpgw']->msg->get_isset_pref('newmsg_combobox', $acctnum)) {
!                               $listbox_show_unseen = True;
!                       } else {
!                               $listbox_show_unseen = False;
!                       }
                        for ($i=0; $i<count($folder_list);$i++)
                        {
                                // folder long needs urlencoding ONCE, string 
can NOT be plain and can NOT be urlencoded more once.
!                               $folder_long = 
$GLOBALS['phpgw']->msg->ensure_one_urlencoding($folder_list[$i]['folder_long']);
!                               $folder_short = 
$folder_list[$i]['folder_short'];
                                $folder_acctnum = $folder_list[$i]['acctnum'];
! 
!                               if ($listbox_show_unseen == True) {
!                               $folder_status = 
$GLOBALS['phpgw']->msg->phpgw_status("$folder_long");
!                               $folder_unseen = 
number_format($folder_status->unseen);
                                }
                                
                                // set_cbox_item(value, text, 
selected(optional, boolean, default false)
!                               if ($listbox_show_unseen == True) {
                                        
$this->set_cbox_item('&folder='.$folder_long.'&acctnum='.$folder_acctnum, 
$folder_short . ' (' . $folder_unseen . ')');
!                               } else {
                                        
$this->set_cbox_item('&folder='.$folder_long.'&acctnum='.$folder_acctnum, 
$folder_short);
                                }
                        }
-                       if ($listbox_show_unseen == True) {
-                               $folder_status = 
$GLOBALS['phpgw']->msg->phpgw_status("$origional_folder");
-                       }
                        return $this->get_combobox();
                        
                }
                
                /*!
                @function all_accounts_combobox
--- 1166,1459 ----
                        // set_cbox_item(value, text, selected(optional, 
boolean, default false)
                        $this->set_cbox_item('', lang('switch current folder 
to'));
                        
                        // get the actual list of folders we are going to put 
into the combobox
                        //$folder_list = 
$GLOBALS['phpgw']->msg->get_folder_list();
!                       $folder_list = 
$GLOBALS['phpgw']->msg->get_arg_value('folder_list', $acctnum);
                        //$folder_list =& 
$GLOBALS['phpgw']->msg->get_arg_value_ref('folder_list');
                        
!                       $listbox_show_unseen = 
$GLOBALS['phpgw']->msg->get_isset_pref('newmsg_combobox', $acctnum);
!                       
                        for ($i=0; $i<count($folder_list);$i++)
                        {
                                // folder long needs urlencoding ONCE, string 
can NOT be plain and can NOT be urlencoded more once.
!                               $folder_long = 
$GLOBALS['phpgw']->msg->ensure_one_urlencoding($folder_list[$i]['folder_long']);
!                               // for display to the user, if this is the 
INBOX, then translate that using lang INBOX
!                               if ($folder_list[$i]['folder_short'] == 'INBOX')
!                               {
!                                   //$folder_short = lang('INBOX');
!                                       // try this for common folder related 
lang strings
!                                       //$common_langs = 
$GLOBALS['phpgw']->msg->get_common_langs();
!                                       //$folder_short = 
$common_langs['lang_inbox'];
!                                       // or try this shortcut, it works too
!                                       $folder_short = 
$GLOBALS['phpgw']->msg->get_common_langs('lang_inbox');
!                               }
!                               else
!                               {
!                                       // not inINBOX, so use actual folder 
name, no translation for the user is done
!                                       $folder_short = 
$folder_list[$i]['folder_short'];
!                               }
                                $folder_acctnum = $folder_list[$i]['acctnum'];
!                               
!                               if ($listbox_show_unseen == True)
!                               {
!                                       $tmp_fldball = array();
!                                       $tmp_fldball['folder'] = $folder_long;
!                                       $tmp_fldball['acctnum'] = 
$folder_acctnum;
!                                       $folder_status = 
$GLOBALS['phpgw']->msg->get_folder_status_info($tmp_fldball);
!                                       $folder_unseen = 
number_format($folder_status['number_new']);
!                                       $tmp_fldball = array();
                                }
                                
                                // set_cbox_item(value, text, 
selected(optional, boolean, default false)
!                               if ($listbox_show_unseen == True)
!                               {
                                        
$this->set_cbox_item('&folder='.$folder_long.'&acctnum='.$folder_acctnum, 
$folder_short . ' (' . $folder_unseen . ')');
!                               }
!                               else
!                               {
                                        
$this->set_cbox_item('&folder='.$folder_long.'&acctnum='.$folder_acctnum, 
$folder_short);
                                }
                        }
                        return $this->get_combobox();
                        
                }
                
+               
+               /*!
+               @function all_folders_mega_combobox
+               @abstract high level function, uses functions in mail_msg and 
this class html_widgets to make a listbox for 
+               all folders in all accounts.  DEPRECIATED. 
+               @param $form_reference (string) this combobox sets an 
"onChange" event, which will submit the form you put here. 
+               Default value is "document.folders_cbox.submit()" where "" is 
the default value for the $form_reference param. 
+               DEPRECIATED in favor of all_folders_megalist.
+               @result string representing an HTML listbox widget 
+               @author Angles
+               @discussion ?
+               @access private, maybe made public
+               */
+               function all_folders_mega_combobox_OLD($form_reference='')
+               {
+                               $feed_args = Array(
+                                       'mailsvr_stream'        => '',
+                                       'pre_select_folder'     => 
$pre_select_folder,
+                                       'pre_select_folder_acctnum' => 
$pre_select_folder_acctnum,
+                                       'skip_folder'           => '',
+                                       'show_num_new'          => 
$listbox_show_unseen,
+                                       'widget_name'           => 
$folder_listbox_name,
+                                       'folder_key_name'       => 'folder',
+                                       'acctnum_key_name'      => 'acctnum',
+                                       'on_change'                     => '',
+                                       'first_line_txt'        => lang('if 
fileto then select destination folder')
+                               );
+                               $folder_listbox = 
$GLOBALS['phpgw']->msg->folders_mega_listbox($feed_args);
+               }
+               
+               /*!
+               @function new_all_folders_megalist
+               @abstract Resets all Properties all_folders_megalist
+               @discussion Delphi style OOP property GetSet functions are 
used, this resets them all.
+               @author Angles
+               */
+               function new_all_folders_megalist()
+               {
+                               $this->F_megalist_form_reference = '';
+                               // this is the only think that actually needs a 
value
+                               $this->F_megalist_widget_name = 'not_provided';
+                               $this->F_megalist_preselected_fldball = '';
+                               $this->F_megalist_skip_fldball = '';
+                               // the first item can be used to display 
instructional text to the user
+                               $this->F_megalist_first_item_text = '';
+               }
+               
+               /*!
+               @function prop_megalist_form_reference
+               @abstract Property function form_reference for 
folders_mega_listbox, form_reference is used in onChange JS.
+               @discussion Delphi style OOP property GetSet function. 
+               @author Angles
+               */
+               function prop_megalist_form_reference($form_reference='')
+               {
+                       if ($form_reference)
+                       {
+                               $this->F_megalist_form_reference = 
$form_reference;
+                       }
+                       return $this->F_megalist_form_reference;
+               }
+               
+               /*!
+               @function prop__megalist_widget_name
+               @abstract Property function widget name for folders_mega_listbox
+               @discussion Delphi style OOP property GetSet function. 
+               @author Angles
+               */
+               function prop_megalist_widget_name($widget_name='')
+               {
+                       if ($widget_name)
+                       {
+                               $this->F_megalist_widget_name = $widget_name;
+                       }
+                       return $this->F_megalist_widget_name;
+               }
+               
+               /*!
+               @function prop_megalist_preselected_fldball
+               @abstract Property function preselected folder (in fldball 
form) for folders_mega_listbox
+               @discussion Delphi style OOP property GetSet function. 
+               @author Angles
+               */
+               function prop_megalist_preselected_fldball($fldball='')
+               {
+                       if ((isset($fldball))
+                       && ($fldball['folder'] != '')
+                       && ((string)$fldball['acctnum'] != ''))
+                       {
+                               $this->F_megalist_preselected_fldball = 
$fldball;
+                       }
+                       return $this->F_megalist_preselected_fldball;
+               }
+               
+               /*!
+               @function prop_megalist_skip_fldball
+               @abstract Property function folder (in fldball form) to NOT 
show in the folders_mega_listbox
+               @discussion Delphi style OOP property GetSet function. 
+               @author Angles
+               */
+               function prop_megalist_skip_fldball($fldball='')
+               {
+                       if ((isset($fldball))
+                       && ($fldball['folder'] != '')
+                       && ((string)$fldball['acctnum'] != ''))
+                       {
+                               $this->F_megalist_skip_fldball = $fldball;
+                       }
+                       return $this->F_megalist_skip_fldball;
+               }
+               
+               /*!
+               @function prop__megalist_widget_name
+               @abstract Property function for folders_mega_listbox, the first 
item can be used to display instructional text to the user
+               @discussion Delphi style OOP property GetSet function. 
+               @author Angles
+               */
+               function prop_megalist_first_item_text($first_item_text='')
+               {
+                       if ($first_item_text)
+                       {
+                               $this->F_megalist_first_item_text = 
$first_item_text;
+                       }
+                       return $this->F_megalist_first_item_text;
+               }
+               
+               /*!
+               @function all_folders_megalist
+               @abstract All accounts All Folders in a html listbox
+               @discussion UNDER DEVELOPMENT, right now the leading candidate 
to be THE folder list 
+               function, but now sure yet. 
+               @author Angles
+               */
+               function all_folders_megalist()
+               {
+                       $debug_mega_listbox = 0;
+                       //$debug_mega_listbox = 3;
+                       
+                       if ($debug_mega_listbox > 0) { echo 
'folders_mega_listbox('.__LINE__.'): ENTERING<br>'; }
+                       
+                       $this->new_combobox();
+                       $this->set_cbox_name($this->F_megalist_widget_name);
+                       
+                       // there is NO ON change right now, this is currently 
used on the filters page, we do not need action onChange there
+                       // default is "document.mega_folders_cbox.submit()"
+                       
//$this->set_cbox_onChange('document.'.$form_reference.'.submit()');
+                       
+                       // set_cbox_item(value, text, selected(optional, 
boolean, default false)
+                       if ($this->F_megalist_first_item_text)
+                       {
+                               $this->set_cbox_item('', 
$this->F_megalist_first_item_text);
+                       }
+                       
+                       // we need the loop to include the default account AS 
WELL AS the extra accounts
+                       for ($x=0; $x < 
count($GLOBALS['phpgw']->msg->extra_and_default_acounts); $x++)
+                       {
+                               $this_acctnum = 
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$x]['acctnum'];
+                               $this_status = 
$GLOBALS['phpgw']->msg->extra_and_default_acounts[$x]['status'];
+                               // do not enable this yet, maybe later
+                               //$listbox_show_unseen = 
$GLOBALS['phpgw']->msg->get_isset_pref('newmsg_combobox', $acctnum);
+                               $listbox_show_unseen = False;
+                               if ($this_status != 'enabled')
+                               {
+                                       // Do Nothing, This account is not in 
use
+                                       if ($debug_mega_listbox > 1) { echo 
'folders_mega_listbox('.__LINE__.'): $this_acctnum ['.$this_acctnum.'] is not 
in use, so skip folderlist<br>'; }
+                               }
+                               else
+                               {
+                                       $folder_list = 
$GLOBALS['phpgw']->msg->get_arg_value('folder_list', $this_acctnum);
+                                       if ($debug_mega_listbox > 1) { echo 
'folders_mega_listbox('.__LINE__.'): $this_acctnum ['.$this_acctnum.'] IS 
enabled, got folder list<br>'; }
+                                       if ($debug_mega_listbox > 2) { echo 
'folders_mega_listbox('.__LINE__.'): $folder_list for $this_acctnum 
['.$this_acctnum.'] DUMP<pre>'; print_r($folder_list); echo '</pre>'; }
+                                       
+                                       // iterate thru the folder list for 
this acctnum
+                                       for ($i=0; $i<count($folder_list);$i++)
+                                       {
+                                               $folder_long = 
$folder_list[$i]['folder_long'];
+                                               $folder_long_preped_out = 
$GLOBALS['phpgw']->msg->prep_folder_out($folder_long);
+                                               $folder_short = 
$folder_list[$i]['folder_short'];
+                                               // yes we need $folder_acctnum 
to help make the "folder ball", yes I know it *should* be the same as 
$this_acctnum
+                                               $folder_acctnum = 
$folder_list[$i]['acctnum'];
+                                               
+                                               // this logic determines we 
should not include a certain folder in the combobox list
+                                               if 
(($this->F_megalist_skip_fldball)
+                                               && ($folder_long_preped_out == 
$this->F_megalist_skip_fldball['folder'])
+                                               && ($folder_acctnum == 
$this->F_megalist_skip_fldball['acctnum']))
+                                               {
+                                                       // Do Nothing, this 
folder should not be included
+                                                       if ($debug_mega_listbox 
> 1) { echo 'folders_mega_listbox('.__LINE__.'): skipping 
$this->F_megalist_skip_fldball 
['.htmlspecialchars(serialize($this->F_megalist_skip_fldball)).'] has been 
matched<br>'; } 
+                                               }
+                                               else
+                                               {
+                                                       // this logic 
determines if the combobox should be initialized with certain folder already 
selected
+                                                       // we use "folder 
short" as the comparator because that way at least we know we are comparing 
syntatic-ally similar items
+                                                       if 
(($this->F_megalist_preselected_fldball)
+                                                       && 
($folder_long_preped_out == $this->F_megalist_preselected_fldball['folder'])
+                                                       && ($folder_acctnum == 
$this->F_megalist_preselected_fldball['acctnum']))
+                                                       {
+                                                               $preselected = 
True;
+                                                       }
+                                                       else
+                                                       {
+                                                               $preselected = 
False;
+                                                       }
+                                                       
+                                                       if 
($listbox_show_unseen == True)
+                                                       {
+                                                               $tmp_fldball = 
array();
+                                                               
$tmp_fldball['folder'] = $folder_long;
+                                                               
$tmp_fldball['acctnum'] = $folder_acctnum;
+                                                               $folder_status 
= $GLOBALS['phpgw']->msg->get_folder_status_info($tmp_fldball);
+                                                               $folder_unseen 
= number_format($folder_status['number_new']);
+                                                               // complete the 
text here so we do not need another if ... then below
+                                                               $folder_unseen 
= ' ('. $folder_unseen.')';
+                                                               $tmp_fldball = 
array();
+                                                       }
+                                                       else
+                                                       {
+                                                               $folder_unseen 
= '';
+                                                       }
+                                                       
+                                                       $option_value = 
'&folder='.$folder_long_preped_out.'&acctnum='.$folder_acctnum;
+                                                       //$option_value =       
'&folder='.$folder_long.'&acctnum='.$folder_acctnum;
+                                                       // if $folder_unseen 
has anything it gets added to the string here
+                                                       $text_blurb = 
'['.$folder_acctnum.'] '.$folder_short.$folder_unseen;
+                                                       
+                                                       // set_cbox_item(value, 
text, selected(optional, boolean, default false)
+                                                       
$this->set_cbox_item($option_value, $text_blurb, $preselected);
+                                               }
+                                       }
+                               }
+                       }
+                       if ($debug_mega_listbox > 0) { echo 
'folders_mega_listbox('.__LINE__.'): LEAVING<br>'; }
+                       return $this->get_combobox();
+               }
+               
+ 
+               
                /*!
                @function all_accounts_combobox
***************
*** 1246,1256 ****
                @function auto_refresh
                @example I know of 3 ways to get a page to reload, 2 of those 
ways are pretty much the same
!               (1) the http header 
                        Refresh: 5;
!               (2) the META http-equiv 
!                       <META HTTP-EQUIV="Refresh" CONTENT="5">
                both 1 and 2 have the same effect as hitting the "reload" 
button, which in *many* browsers will
                force a re-download of all the images on the page, i.e. the 
browser will NOT use the cached images
!               (3) java script combo of "window.setTimeout" with 
"window.location"
                        
window.setTimeout('window.location="http://example.com/phpgw/email/index.php";; 
',1800000);
                method 3 is the only one I know of that will use the images 
from the cache.
--- 1525,1535 ----
                @function auto_refresh
                @example I know of 3 ways to get a page to reload, 2 of those 
ways are pretty much the same
!               1. the http header 
                        Refresh: 5;
!               2. the META http-equiv 
!                       &lt;META HTTP-EQUIV="Refresh" CONTENT="60"&gt>
                both 1 and 2 have the same effect as hitting the "reload" 
button, which in *many* browsers will
                force a re-download of all the images on the page, i.e. the 
browser will NOT use the cached images
!               3. java script combo of "window.setTimeout" with 
"window.location"
                        
window.setTimeout('window.location="http://example.com/phpgw/email/index.php";; 
',1800000);
                method 3 is the only one I know of that will use the images 
from the cache.
***************
*** 1346,1350 ****
                        return $reload_js;
                }
!               
        }
  ?>
--- 1625,1753 ----
                        return $reload_js;
                }
!               
!               
/**************************************************************************\
!               *       GENERIC ERROR REPORT
!               
\**************************************************************************/    
!               
!               /*!
!               @capability GENERIC ERROR REPORT
!               @discussion This is not really a widget, but this is a good 
place to put this. In cases such 
!               as a login error, it is not user friendly to output a text only 
page with an echod out error. 
!               At the very least we should output the template as usual, and 
insert the error text where 
!               the page content would go. This way the user has all the links 
and buttons to click on 
!               to get out of the error page.
!               @author Angles
!               */
!               
!               /*!
!               @function init_error_report_values
!               @abstract Initialize error report with default text, please 
call this first.
!               @discussion Simple function to initialize the error report with 
some default text. 
!               I can not imagine how you could use this twice since the actual 
error report is a full 
!               template page output, BUT still this is how the initial default 
values are filled. Please 
!               call this first.
!               @author Angles
!               */
!               function init_error_report_values()
!               {
!                       $this->F_error_report_text = lang('error text not 
provided');
!                       $this->F_go_somewhere_link = '';
!                       $go_home_url = $GLOBALS['phpgw']->link('/home.php');
!                       $go_home_text = lang('click here to return to your home 
page.');
!                       $this->F_go_home_link = '<a 
href="'.$go_home_url.'">'.$go_home_text.'</a>';
!               }
!               
!               /*!
!               @function prop_error_report_text
!               @abstract Set or Get the error report text.
!               @param $error_report_text (string) the error to show the user.
!               @param $append (boolean) if true, then add to the error text. 
If false, replace error text.
!               @discussion It initialized with a generic "not provided" 
string, 
!               which you change to the real error report text with this 
function. 
!               It checks for the default generic text, and always replaces it 
even if append it true. 
!               So this way you can specify append but still never accidently 
keep the mindless 
!               default error text. 
!               @author Angles
!               */
!               function prop_error_report_text($error_report_text='', 
$append=False)
!               {
!                       if ($error_report_text)
!                       {
!                               // ALWAYS make sure to clear the mindless 
default text before you append
!                               if (($this->F_error_report_text == 
lang($this->F_mindless_default_txt))
!                               || ($append == False))
!                               {
!                                       $this->F_error_report_text = 
$error_report_text;
!                               }
!                               else
!                               {
!                                       $this->F_error_report_text .= 
$error_report_text;
!                               }
!                       }
!                       return $this->F_error_report_text;
!               }
!               
!               /*!
!               @function prop_go_somewhere_link
!               @abstract Set or Get the go somewhere link.
!               @param $go_somewhere_url (string in url form) a helpful link to 
show the user. 
!               @param $go_somewhere_text (string in url form) the text for the 
HREF for this helpful link to show the user. 
!               @discussion This is optional, in any case the "go home link" 
will be displayed, 
!               But with this function you can additionally show a link to 
something useful given 
!               the error the user just encountered, perhaps to the preferences 
page, for example. 
!               The two params are required for this function to make the HREF.
!               @author Angles
!               */
!               function prop_go_somewhere_link($go_somewhere_url='', 
$go_somewhere_text='')
!               {
!                       if (($go_somewhere_url) 
!                       && ($go_somewhere_text))
!                       {
!                               $this->set_href_link($go_somewhere_url);
!                               $this->set_href_clickme($go_somewhere_text);
!                               $this->F_go_somewhere_link = $this->get_href();
!                       }
!                       return $this->F_go_somewhere_link;
!               }
!               
!               /*!
!               @function display_error_report_page
!               @abstract A complete output of the template with your error 
report in the content section. 
!               @param $do_exit (boolean) if empty or false, then this function 
will NOT call common exit, 
!               if filled or True, it will call msg end_request and common EXIT.
!               @discussion Handles all necessary template parsing, you should 
set the error text and helpful 
!               href, call this function. Param $do_exit is useful if you are 
calling this report from within 
!               the msg object itself, then this function will call msg 
end_request and then the common phpgw exit.
!               @author Angles
!               */
!               function display_error_report_page($do_exit='')
!               {
!                       unset($GLOBALS['phpgw_info']['flags']['noheader']);
!                       unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
!                       $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
!                       $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
!                       $GLOBALS['phpgw']->common->phpgw_header();
!                       
!                       $GLOBALS['phpgw']->template->set_file(array(
!                               'T_error_report' => 'error_report.tpl'
!                       ));
!                       
$GLOBALS['phpgw']->template->set_var('error_report_text', 
$this->prop_error_report_text());
!                       
$GLOBALS['phpgw']->template->set_var('go_somewhere_link', 
$this->prop_go_somewhere_link());
!                       $GLOBALS['phpgw']->template->set_var('go_home_link', 
$this->F_go_home_link);
!                       
$GLOBALS['phpgw']->template->pfp('out','T_error_report');
!                       // do we exit the script here?
!                       if ($do_exit)
!                       {
!                               // kill this script, we re outa here...
!                               if (is_object($GLOBALS['phpgw']->msg))
!                               {
!                                       $GLOBALS['phpgw']->msg->end_request();
!                                       $GLOBALS['phpgw']->msg = '';
!                                       unset($GLOBALS['phpgw']->msg);
!                               }
!                               $GLOBALS['phpgw']->common->phpgw_exit();
!                       }
!               }
!               
        }
  ?>

Index: class.mail_dcom.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_dcom.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.mail_dcom.inc.php     25 Oct 2002 12:45:52 -0000      1.9
--- class.mail_dcom.inc.php     14 Mar 2003 04:00:42 -0000      1.10
***************
*** 1,123 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare API - php IMAP SO access object constructor              
        *
!       * This file written by Mark Peters <address@hidden>                     
*
!       * and Angelo Tony Puglisi (Angles) <address@hidden>             *
!       * Handles initializing the appropriate class dcom object                
                *
!       * Copyright (C) 2001 Mark Peters                                        
                *
!       * Copyright (C) 2001, 2002 Angelo "Angles" Puglisi                      
        *
!       * 
-------------------------------------------------------------------------       
              *
!       * This library is part of the phpGroupWare API                          
        *
!       * http://www.phpgroupware.org/api                                       
        * 
!       * 
------------------------------------------------------------------------        
              *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
        *
!       * or any later version.                                                 
        *
!       * This library is distributed in the hope that it will be useful, but   
        *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of            
*
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,       *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
*
!       
\**************************************************************************/
! 
!       //$debug_dcom = True;
!       $debug_dcom = False;
! 
!       
!       /*!
!       @class MAIL_DCOM
!       @abstract implements communication with the mail server. (not related 
to anything else called "dcom")
!       @discussion php may or may not have IMAP extension built in. This class 
will AUTO-DETECT that and 
!       load either (a) a class which mostly wraps the available builtin 
functions, or (b) a TOTAL REPLACEMENT 
!       to PHPs builtin imap extension. Currently, the POP3 socket class is 
fully implemented, basically a re-write 
!       of the UWash c-client, because all the logic contained in an imap 
server had to be emulated locally here, 
!       since a pop server provides only the most basic information, the rest 
must be deduced.
!       NOTE: the imap socket class is NOT COMPLETE!
!       @author Angles and others, each function has an authors list
!       @access private, only mail_msg access this directly
!       */
!       /* -----  any constructor params? ---- */
!       if (isset($p1)
!       && ($p1)
!       && ( (stristr($p1, 'imap') || stristr($p1, 'pop3') || stristr($p1, 
'nntp')) )
!       )
!       {
!               $mail_server_type = $p1;
!       }
!       else
!       {
!               $mail_server_type = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'];
!       }
! 
!       /* -----  is IMAP compiled into PHP */
!       //if (($debug_dcom == True)
!       //&& ((stristr($mail_server_type, 'pop'))
!       //      || (stristr($mail_server_type, 'imap')))
!       //)
!       if (($debug_dcom == True)
!       && ((strtolower($mail_server_type) == 'pop3')
!               || (strtolower($mail_server_type) == 'imap'))
!       )
!       {
!               $imap_builtin = False;
!               $sock_fname = '_sock';
!               if ($debug_dcom) { echo 'DCOM DEBUG: force socket class for 
$mail_server_type ['.$mail_server_type.']<br>'; }
!       }
!       elseif (extension_loaded('imap') && function_exists('imap_open'))
!       {
!               $imap_builtin = True;
!               $sock_fname = '';
!               if ($debug_dcom) { echo 'imap builtin extension is 
available<br>'; }
!       }
!       else
!       {
!               $imap_builtin = False;
!               $sock_fname = '_sock';
!               if ($debug_dcom) { echo 'imap builtin extension NOT available, 
using socket class<br>'; }
!       }
! 
!       /* -----  include SOCKET or PHP-BUILTIN classes as necessary */
!       if ($imap_builtin == False)
!       {
!               CreateObject('phpgwapi.network');
!               if ($debug_dcom) { echo 'created phpgwapi network class used 
with sockets<br>'; }
!       }
! 
!       //CreateObject('email.mail_dcom_base'.$sock_fname);
!       
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_base'.$sock_fname.'.inc.php');
!       if ($debug_dcom) { echo 'including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_base'.$sock_fname.'.inc.php<br>';
 }
! 
!       if (($mail_server_type == 'imap')
!       || ($mail_server_type == 'imaps'))
!         {
!               
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_imap'.$sock_fname.'.inc.php');
!               if ($debug_dcom) { echo 'including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_imap'.$sock_fname.'.inc.php<br>';
 }
!       }
!       elseif (($mail_server_type == 'pop3')
!       || ($mail_server_type == 'pop3s'))
!       {
!               
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_pop3'.$sock_fname.'.inc.php');
!               if ($debug_dcom) { echo 'including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_pop3'.$sock_fname.'.inc.php<br>';
 }
!       }
!       elseif ($mail_server_type == 'nntp')
!       {
!               
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_nntp'.$sock_fname.'.inc.php');
!               if ($debug_dcom) { echo 'including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_nntp'.$sock_fname.'.inc.php<br>';
 }
!       }
!       elseif ((isset($mail_server_type))
!       && ($mail_server_type != ''))
!       {
!               /* educated guess based on info being available: */
!               
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_'.$GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'].$sock_fname.'.inc.php');
!               if ($debug_dcom) { echo 'Educated Guess: including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_'.$GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'].$sock_fname.'.inc.php<br>';
 }
!       }
!       else
!       {
!               /* DEFAULT FALL BACK: */
!               
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_imap.inc.php');
!               if ($debug_dcom) { echo 'NO INFO DEFAULT: including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_imap.inc.php<br>'; }
!       }
! ?>
--- 1,123 ----
! <?php
!       
/**************************************************************************\
!       * phpGroupWare API - php IMAP SO access object constructor              
        *
!       * This file written by Mark Peters <address@hidden>                     
*
!       * and Angelo Tony Puglisi (Angles) <address@hidden>             *
!       * Handles initializing the appropriate class dcom object                
                *
!       * Copyright (C) 2001 Mark Peters                                        
                *
!       * Copyright (C) 2001, 2002 Angelo "Angles" Puglisi                      
        *
!       * 
-------------------------------------------------------------------------       
              *
!       * This library is part of the phpGroupWare API                          
        *
!       * http://www.phpgroupware.org/api                                       
        * 
!       * 
------------------------------------------------------------------------        
              *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
        *
!       * or any later version.                                                 
        *
!       * This library is distributed in the hope that it will be useful, but   
        *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of            
*
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,       *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
*
!       
\**************************************************************************/
! 
!       //$debug_dcom = True;
!       $debug_dcom = False;
! 
!       
!       /*!
!       @class MAIL_DCOM
!       @abstract implements communication with the mail server. (not related 
to anything else called "dcom")
!       @discussion php may or may not have IMAP extension built in. This class 
will AUTO-DETECT that and 
!       load either (a) a class which mostly wraps the available builtin 
functions, or (b) a TOTAL REPLACEMENT 
!       to PHPs builtin imap extension. Currently, the POP3 socket class is 
fully implemented, basically a re-write 
!       of the UWash c-client, because all the logic contained in an imap 
server had to be emulated locally here, 
!       since a pop server provides only the most basic information, the rest 
must be deduced.
!       NOTE: the imap socket class is NOT COMPLETE!
!       @author Angles and others, each function has an authors list
!       @access private, only mail_msg access this directly
!       */
!       /* -----  any constructor params? ---- */
!       if (isset($p1)
!       && ($p1)
!       && ( (stristr($p1, 'imap') || stristr($p1, 'pop3') || stristr($p1, 
'nntp')) )
!       )
!       {
!               $mail_server_type = $p1;
!       }
!       else
!       {
!               $mail_server_type = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'];
!       }
! 
!       /* -----  is IMAP compiled into PHP */
!       //if (($debug_dcom == True)
!       //&& ((stristr($mail_server_type, 'pop'))
!       //      || (stristr($mail_server_type, 'imap')))
!       //)
!       if (($debug_dcom == True)
!       && ((strtolower($mail_server_type) == 'pop3')
!               || (strtolower($mail_server_type) == 'imap'))
!       )
!       {
!               $imap_builtin = False;
!               $sock_fname = '_sock';
!               if ($debug_dcom) { echo 'DCOM DEBUG: force socket class for 
$mail_server_type ['.$mail_server_type.']<br>'; }
!       }
!       elseif (extension_loaded('imap') && function_exists('imap_open'))
!       {
!               $imap_builtin = True;
!               $sock_fname = '';
!               if ($debug_dcom) { echo 'imap builtin extension is 
available<br>'; }
!       }
!       else
!       {
!               $imap_builtin = False;
!               $sock_fname = '_sock';
!               if ($debug_dcom) { echo 'imap builtin extension NOT available, 
using socket class<br>'; }
!       }
! 
!       /* -----  include SOCKET or PHP-BUILTIN classes as necessary */
!       if ($imap_builtin == False)
!       {
!               CreateObject('phpgwapi.network');
!               if ($debug_dcom) { echo 'created phpgwapi network class used 
with sockets<br>'; }
!       }
! 
!       //CreateObject('email.mail_dcom_base'.$sock_fname);
!       
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_base'.$sock_fname.'.inc.php');
!       if ($debug_dcom) { echo 'including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_base'.$sock_fname.'.inc.php<br>';
 }
! 
!       if (($mail_server_type == 'imap')
!       || ($mail_server_type == 'imaps'))
!         {
!               
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_imap'.$sock_fname.'.inc.php');
!               if ($debug_dcom) { echo 'including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_imap'.$sock_fname.'.inc.php<br>';
 }
!       }
!       elseif (($mail_server_type == 'pop3')
!       || ($mail_server_type == 'pop3s'))
!       {
!               
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_pop3'.$sock_fname.'.inc.php');
!               if ($debug_dcom) { echo 'including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_pop3'.$sock_fname.'.inc.php<br>';
 }
!       }
!       elseif ($mail_server_type == 'nntp')
!       {
!               
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_nntp'.$sock_fname.'.inc.php');
!               if ($debug_dcom) { echo 'including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_nntp'.$sock_fname.'.inc.php<br>';
 }
!       }
!       elseif ((isset($mail_server_type))
!       && ($mail_server_type != ''))
!       {
!               /* educated guess based on info being available: */
!               
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_'.$GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'].$sock_fname.'.inc.php');
!               if ($debug_dcom) { echo 'Educated Guess: including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_'.$GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'].$sock_fname.'.inc.php<br>';
 }
!       }
!       else
!       {
!               /* DEFAULT FALL BACK: */
!               
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_imap.inc.php');
!               if ($debug_dcom) { echo 'NO INFO DEFAULT: including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_imap.inc.php<br>'; }
!       }
! ?>

Index: class.mail_dcom_base.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_dcom_base.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.mail_dcom_base.inc.php        24 Nov 2002 01:57:46 -0000      1.8
--- class.mail_dcom_base.inc.php        14 Mar 2003 04:00:44 -0000      1.9
***************
*** 288,292 ****
                                else
                                {
!                                       if ($this->debug_utf7 > 0) { echo ' _ 
mail_dcom_base: utf7_decode_string ('.__LINE__.'): returning decoded name, 
$name[] DUMP: ['.htmlspecialchars(serialize($name)).']<br>'; }
                                        return $name['translated'];
                                }
--- 288,292 ----
                                else
                                {
!                                       if ($this->debug_utf7 > 0) { echo ' _ 
mail_dcom_base: utf7_decode_string ('.__LINE__.'): returning decoded name, 
$name[] DUMP: ['.htmlspecialchars(serialize($name)).']<br>'; } 
                                        return $name['translated'];
                                }
***************
*** 300,303 ****
--- 300,304 ----
                function get_flag($stream,$msg_num,$flag)
                {
+                       // ralfbecker patch dated 021124
                        $header = 
explode("\n",$this->fetchheader($stream,$msg_num));
                        $flag = strtolower($flag);

Index: class.mail_dcom_base_sock.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_dcom_base_sock.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** class.mail_dcom_base_sock.inc.php   25 Oct 2002 12:45:53 -0000      1.23
--- class.mail_dcom_base_sock.inc.php   14 Mar 2003 04:00:48 -0000      1.24
***************
*** 1,1237 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare API - MAIL                                                   
                        *
!   * This file written by Mark Peters <address@hidden>                 *
!   * and Angelo "Angles" Puglisi <address@hidden>                              
*
!   * Handles general functionality for mail/mail structures                    
                *
!   * Copyright (C) 2001 Mark Peters                                            
                        *
!   * Copyright (C) 2001, 2002 Angelo "Angles" Puglisi                          
                *
!   * ------------------------------------------------------------------------- 
                *
!   * This library is part of the phpGroupWare API                             *
[...2445 lines suppressed...]
!                               {
!                                       $c0=(ord(substr($str[$i],$pos  ,1)) ^ 
0x20);
!                                       $c1=(ord(substr($str[$i],$pos+1,1)) ^ 
0x20);
!                                       $c2=(ord(substr($str[$i],$pos+2,1)) ^ 
0x20);
!                                       $file .= chr(((($c0 - ' ') & 077) << 2) 
| ((($c1 - ' ') & 077) >> 4));
!                                       $file .= chr(((($c1 - ' ') & 077) << 4) 
| ((($c2 - ' ') & 077) >> 2));
!                                       $pos+=3;
!                                       $d+=2;
!                               }
!                               if (($d+1<=$len) && ($pos+2<=strlen($str[$i])))
!                               {
!                                       $c0=(ord(substr($str[$i],$pos  ,1)) ^ 
0x20);
!                                       $c1=(ord(substr($str[$i],$pos+1,1)) ^ 
0x20);
!                                       $file .= chr(((($c0 - ' ') & 077) << 2) 
| ((($c1 - ' ') & 077) >> 4));
!                               }
!                       }
!                       return $file;
!               }
!       }
! ?>

Index: class.mail_dcom_imap.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_dcom_imap.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** class.mail_dcom_imap.inc.php        25 Oct 2002 12:45:53 -0000      1.20
--- class.mail_dcom_imap.inc.php        14 Mar 2003 04:00:51 -0000      1.21
***************
*** 1,394 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare Email - IMAP abstraction                             *
!   * http://www.phpgroupware.org/api                                   *
!   * This file written by Itzchak Rehberg <address@hidden>     *
!   * and Joseph Engo <address@hidden>                          *
!   * Mail function abstraction for IMAP servers                                
*
!   * Copyright (C) 2000, 2001 Itzchak Rehberg                          *
!   * ------------------------------------------------------------------------- 
        *
!   * This library is part of phpGroupWare (http://www.phpgroupware.org)       
* 
!   * This library is free software; you can redistribute it and/or modify it  *
!   * under the terms of the GNU Lesser General Public License as published by *
!   * the Free Software Foundation; either version 2.1 of the License,  *
!   * or any later version.                                                     
*
!   * This library is distributed in the hope that it will be useful, but       
*
!   * WITHOUT ANY WARRANTY; without even the implied warranty of        *
!   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.      *
!   * See the GNU Lesser General Public License for more details.               
*
!   * You should have received a copy of the GNU Lesser General Public License *
!   * along with this library; if not, write to the Free Software Foundation,  *
!   * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA     *
!   \**************************************************************************/
! 
!   /* $Id$ */
! 
!       class mail_dcom extends mail_dcom_base
!       {
!               function append($stream, $folder, $message, $flags=0)
!               {
!                       $folder = $this->utf7_encode($folder);
!                       return imap_append($stream, $folder, $message, $flags);
!               }
! 
!               function base64($text)
!               {
!                       return imap_base64($text);
!               }
! 
!               function close($stream,$flags='')
!               {
!                       return imap_close($stream,$flags);
!               }
! 
!               function createmailbox($stream,$mailbox)
!               {
!                       $mailbox = $this->utf7_encode($mailbox);
!                       $this->folder_list_changed = True;
!                       return imap_createmailbox($stream,$mailbox);
!               }
! 
!               function deletemailbox($stream,$mailbox)
!               {
!                       $this->folder_list_changed = True;
!                       $mailbox = $this->utf7_encode($mailbox);
!                       return imap_deletemailbox($stream,$mailbox);
!               } 
! 
!               function renamemailbox($stream,$mailbox_old,$mailbox_new)
!               {
!                       $this->folder_list_changed = True;
!                       $mailbox_old = $this->utf7_encode($mailbox_old);
!                       $mailbox_new = $this->utf7_encode($mailbox_new);
!                       return 
imap_renamemailbox($stream,$mailbox_old,$mailbox_new);
!               }
! 
!               function delete($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_delete($stream,$msg_num,$flags);
!               }
! 
!               function expunge($stream)
!               {
!                       return imap_expunge($stream);
!               }
! 
!               function fetchbody($stream,$msgnr,$partnr,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchbody($stream,$msgnr,$partnr,$flags);
!               }
! 
!               function 
header($stream,$msg_nr,$fromlength='',$tolength='',$defaulthost='')
!               {
!                       // do we need to temporarily switch to regular msg num 
sequence for this function?
!                       if ($this->force_msg_uids == True)
!                       {
!                               // this function can nothandle UIDs, switch to 
sequence number
!                               $new_msg_nr = imap_msgno($stream,$msg_nr);
!                               if ($new_msg_nr)
!                               {
!                                       $msg_nr = $new_msg_nr;
!                               }
!                       }
!                       return 
imap_header($stream,$msg_nr,$fromlength,$tolength,$defaulthost);
!               }
!               
!               function headers($stream)
!               {
!                       return imap_headers($stream);
!               } 
! 
!               function fetch_raw_mail($stream,$msg_num,$flags=0)
!               {
!                       $flags |= FT_PREFETCHTEXT;
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function fetchheader($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function fetchstructure($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchstructure($stream,$msg_num,$flags);
!               }
! 
!               function get_body($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_body($stream,$msg_num,$flags);
!               }
! 
!               function get_header($stream,$msg_num,$flags)
!               {
!                       // alias for compatibility with some old code
!                       return $this->fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function listmailbox($stream,$ref,$pattern)
!               {
!                       //return imap_listmailbox($stream,$ref,$pattern);
!                       $pattern = $this->utf7_encode($pattern);
!                       $return_list = imap_listmailbox($stream,$ref,$pattern);
!                       return $this->utf7_decode($return_list);
!               }
! 
!               function mailboxmsginfo($stream)
!               {
!                       return imap_mailboxmsginfo($stream);
!               }
! 
!               function mailcopy($stream,$msg_list,$mailbox,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & CP_UID)) )
!                       {
!                               $flags |= CP_UID;
!                       }
!                       $mailbox = $this->utf7_encode($mailbox);
!                       return 
imap_mail_copy($stream,$msg_list,$mailbox,$flags);
!               }
! 
!               function mail_move($stream,$msg_list,$mailbox,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & CP_UID)) )
!                       {
!                               $flags |= CP_UID;
!                       }
!                       $mailbox = $this->utf7_encode($mailbox, 'mail_move');
!                       return 
imap_mail_move($stream,$msg_list,$mailbox,$flags);
!               }
! 
!               function num_msg($stream) // returns number of messages in the 
mailbox
!               { 
!                       return imap_num_msg($stream);
!               }
!               
!               function noop_ping_test($stream)
!               { 
!                       return imap_ping($stream);
!               }
! 
!               function open($mailbox,$username,$password,$flags=0)
!               {
!                       $mailbox = $this->utf7_encode($mailbox);
!                       return imap_open($mailbox,$username,$password,$flags);
!               }
! 
!               function qprint($message)
!               {
!                       // return quoted_printable_decode($message);
!                       $str = quoted_printable_decode($message);
!                       return str_replace("=\n",'',$str);
!               }
! 
!               function reopen($stream,$mailbox,$flags=0)
!               {
!                       $mailbox = $this->utf7_encode($mailbox);
!                       return imap_reopen($stream,$mailbox,$flags);
!               }
! 
!               function server_last_error()
!               {
!                       // supported in PHP >= 3.0.12
!                       return imap_last_error();
!               }
! 
!               function i_search($stream,$criteria,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & SE_UID)) )
!                       {
!                               $flags |= SE_UID;
!                       }
!                       return imap_search($stream,$criteria,$flags);
!               }
!               
!               function sort($stream,$criteria,$reverse='',$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & SE_UID)) )
!                       {
!                               $flags |= SE_UID;
!                       }
!                       //echo 'class dcom: sort: $this->force_msg_uids= 
'.serialize($this->force_msg_uids).'; $flags: ['.serialize($flags).']<br>';
!                       return imap_sort($stream,$criteria,$reverse,$flags);
!               }
! 
!               function status($stream,$mailbox,$options=0)
!               {
!                       $mailbox = $this->utf7_encode($mailbox);
!                       return imap_status($stream,$mailbox,$options);
!               }
! 
!               function construct_folder_str($folder)
!               { 
!                       /* This is only used by the login() function */
!                       // Cyrus style: INBOX.Junque
!                       // UWash style: ./aeromail/Junque
!                       return $GLOBALS['phpgw']->msg->get_folder_long($folder);
!               }
! 
!               function deconstruct_folder_str($folder)
!               {
!                       //  This is only used by the login() function
!                       // Cyrus style: INBOX.Junque
!                       // UWash style: ./aeromail/Junque
!                       return 
$GLOBALS['phpgw']->msg->get_folder_short($folder);
!               }
! 
!               /* rfc_get_flag() is more "rfc safe", as RFC822 allows
!                       the content of the header to be on several lines.
! 
!                       Quote from RFC822 3.1.1:
!                       <quote>
!                               For convenience, the field-body  portion  of  
this  conceptual
!                               entity  can be split into a multiple-line 
representation; this
!                               is called "folding".  The general rule is that 
wherever  there
!                               may  be  linear-white-space  (NOT  simply  
LWSP-chars), a CRLF
!                               immediately followed by AT LEAST one LWSP-char 
may instead  be
!                               inserted.
!                       </quote>
! 
!                       Note:   $flag should _NOT_ begin with a space
!                       $field_no should be given strarting at 1
!               */
!               function rfc_get_flag($stream,$msg_num,$flags=0,$field_no=1)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       $fieldCount = 0;
!                       $header = imap_fetchheader ($stream, $msg_num, $flags);
!                       $header = explode("\n", $header);
!                       $flag = strtolower($flag);
! 
!                       for ($i=0; $i < count($header); $i++)
!                       {
!                               // The next check for the $flag _requires_ the 
field to
!                               // start at the first character (unless some 
person
!                               // adds a space in the beginning of $flag.
!                               // I believe this is correct according to the 
RFC.
! 
!                               if (strcmp 
(substr(strtolower($header[$i]),0,strlen($flag) + 1), $flag.':')==0)
!                               {
!                                       $fieldFound = true;
!                                       $fieldCount++;
!                               }
!                               else
!                               {
!                                       $fieldFound = false;
!                               }
!               
!                               if ($fieldFound && $fieldCount == $field_no)
!                               {
!                                       // We now need to see if the next lines 
belong to this  message. 
!                                       $header_begin = $i;
!                                       // make sure we don't go too far:)
!                                       // and if the line begins with a space 
then
!                                       // we'll increment the counter with one.
!                                       $i++;
! 
!                                       while ($i < count($header) 
!                                               && 
strcmp(substr($header[$i],0,1), ' ') == 0)
!                                       {
!                                               $i++;
!                                       }
! 
!                                       // Remove the "field:" from this string.
!                                       $return_tmp = explode (':', 
$header[$header_begin]);
!                                       $tmp_flag = $return_tmp[0];
!                                       $return_string = trim ($return_tmp[1]);
! 
!                                       if (strcasecmp ($flag, $tmp_flag) != 0)
!                                       {
!                                               return false;
!                                       }
!                                       // Houston, we have a _problem_
!                                       // add the rest of the content
! 
!                                       for ($j=$header_begin+1; $j < $i; $j++)
!                                       {
!                                               $return_string .= $header[$j];
!                                       }
! 
!                                       return $return_string;
!                               }
!                       }
!                       // failed to find $flag
!                       return false;
!               }
! 
!               /*
!               function get_flag($stream,$msg_num,$flag)
!               {
!                       // Call my new rfc_get_flag() function.
!                       // It should replace get_flag() as soon as it's 
!                       // accepted into cvs phpGW
!                       return $this->rfc_get_flag ($stream, $msg_num, $flag);
! 
!                       $header = imap_fetchheader($stream,$msg_num);
!                       $header = explode("\n",$header);
!                       $flag = strtolower($flag);
!                       for ($i=0;$i<count($header);$i++)
!                       {
!                               $pos = strpos($header[$i],':');
!                               if (is_int($pos) && $pos)
!                               {
!                                       $keyword = 
trim(substr($header[$i],0,$pos));
!                                       $content = 
trim(substr($header[$i],$pos+1));
!                                       if (strtolower($keyword) == $flag)
!                                       {
!                                               return $content;
!                                       }
!                               }
!                       }
!                       return false;
!               }
!               */
!       }
! ?>
--- 1,394 ----
! <?php
!   /**************************************************************************\
!   * phpGroupWare Email - IMAP abstraction                             *
!   * http://www.phpgroupware.org/api                                   *
!   * This file written by Itzchak Rehberg <address@hidden>     *
!   * and Joseph Engo <address@hidden>                          *
!   * Mail function abstraction for IMAP servers                                
*
!   * Copyright (C) 2000, 2001 Itzchak Rehberg                          *
!   * ------------------------------------------------------------------------- 
        *
!   * This library is part of phpGroupWare (http://www.phpgroupware.org)       
* 
!   * This library is free software; you can redistribute it and/or modify it  *
!   * under the terms of the GNU Lesser General Public License as published by *
!   * the Free Software Foundation; either version 2.1 of the License,  *
!   * or any later version.                                                     
*
!   * This library is distributed in the hope that it will be useful, but       
*
!   * WITHOUT ANY WARRANTY; without even the implied warranty of        *
!   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.      *
!   * See the GNU Lesser General Public License for more details.               
*
!   * You should have received a copy of the GNU Lesser General Public License *
!   * along with this library; if not, write to the Free Software Foundation,  *
!   * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA     *
!   \**************************************************************************/
! 
!   /* $Id$ */
! 
!       class mail_dcom extends mail_dcom_base
!       {
!               function append($stream, $folder, $message, $flags=0)
!               {
!                       $folder = $this->utf7_encode($folder);
!                       return imap_append($stream, $folder, $message, $flags);
!               }
! 
!               function base64($text)
!               {
!                       return imap_base64($text);
!               }
! 
!               function close($stream,$flags='')
!               {
!                       return imap_close($stream,$flags);
!               }
! 
!               function createmailbox($stream,$mailbox)
!               {
!                       $mailbox = $this->utf7_encode($mailbox);
!                       $this->folder_list_changed = True;
!                       return imap_createmailbox($stream,$mailbox);
!               }
! 
!               function deletemailbox($stream,$mailbox)
!               {
!                       $this->folder_list_changed = True;
!                       $mailbox = $this->utf7_encode($mailbox);
!                       return imap_deletemailbox($stream,$mailbox);
!               } 
! 
!               function renamemailbox($stream,$mailbox_old,$mailbox_new)
!               {
!                       $this->folder_list_changed = True;
!                       $mailbox_old = $this->utf7_encode($mailbox_old);
!                       $mailbox_new = $this->utf7_encode($mailbox_new);
!                       return 
imap_renamemailbox($stream,$mailbox_old,$mailbox_new);
!               }
! 
!               function delete($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_delete($stream,$msg_num,$flags);
!               }
! 
!               function expunge($stream)
!               {
!                       return imap_expunge($stream);
!               }
! 
!               function fetchbody($stream,$msgnr,$partnr,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchbody($stream,$msgnr,$partnr,$flags);
!               }
! 
!               function 
header($stream,$msg_nr,$fromlength='',$tolength='',$defaulthost='')
!               {
!                       // do we need to temporarily switch to regular msg num 
sequence for this function?
!                       if ($this->force_msg_uids == True)
!                       {
!                               // this function can nothandle UIDs, switch to 
sequence number
!                               $new_msg_nr = imap_msgno($stream,$msg_nr);
!                               if ($new_msg_nr)
!                               {
!                                       $msg_nr = $new_msg_nr;
!                               }
!                       }
!                       return 
imap_header($stream,$msg_nr,$fromlength,$tolength,$defaulthost);
!               }
!               
!               function headers($stream)
!               {
!                       return imap_headers($stream);
!               } 
! 
!               function fetch_raw_mail($stream,$msg_num,$flags=0)
!               {
!                       $flags |= FT_PREFETCHTEXT;
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function fetchheader($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function fetchstructure($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchstructure($stream,$msg_num,$flags);
!               }
! 
!               function get_body($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_body($stream,$msg_num,$flags);
!               }
! 
!               function get_header($stream,$msg_num,$flags)
!               {
!                       // alias for compatibility with some old code
!                       return $this->fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function listmailbox($stream,$ref,$pattern)
!               {
!                       //return imap_listmailbox($stream,$ref,$pattern);
!                       $pattern = $this->utf7_encode($pattern);
!                       $return_list = imap_listmailbox($stream,$ref,$pattern);
!                       return $this->utf7_decode($return_list);
!               }
! 
!               function mailboxmsginfo($stream)
!               {
!                       return imap_mailboxmsginfo($stream);
!               }
! 
!               function mailcopy($stream,$msg_list,$mailbox,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & CP_UID)) )
!                       {
!                               $flags |= CP_UID;
!                       }
!                       $mailbox = $this->utf7_encode($mailbox);
!                       return 
imap_mail_copy($stream,$msg_list,$mailbox,$flags);
!               }
! 
!               function mail_move($stream,$msg_list,$mailbox,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & CP_UID)) )
!                       {
!                               $flags |= CP_UID;
!                       }
!                       $mailbox = $this->utf7_encode($mailbox, 'mail_move');
!                       return 
imap_mail_move($stream,$msg_list,$mailbox,$flags);
!               }
! 
!               function num_msg($stream) // returns number of messages in the 
mailbox
!               { 
!                       return imap_num_msg($stream);
!               }
!               
!               function noop_ping_test($stream)
!               { 
!                       return imap_ping($stream);
!               }
! 
!               function open($mailbox,$username,$password,$flags=0)
!               {
!                       $mailbox = $this->utf7_encode($mailbox);
!                       return imap_open($mailbox,$username,$password,$flags);
!               }
! 
!               function qprint($message)
!               {
!                       // return quoted_printable_decode($message);
!                       $str = quoted_printable_decode($message);
!                       return str_replace("=\n",'',$str);
!               }
! 
!               function reopen($stream,$mailbox,$flags=0)
!               {
!                       $mailbox = $this->utf7_encode($mailbox);
!                       return imap_reopen($stream,$mailbox,$flags);
!               }
! 
!               function server_last_error()
!               {
!                       // supported in PHP >= 3.0.12
!                       return imap_last_error();
!               }
! 
!               function i_search($stream,$criteria,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & SE_UID)) )
!                       {
!                               $flags |= SE_UID;
!                       }
!                       return imap_search($stream,$criteria,$flags);
!               }
!               
!               function sort($stream,$criteria,$reverse='',$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & SE_UID)) )
!                       {
!                               $flags |= SE_UID;
!                       }
!                       //echo 'class dcom: sort: $this->force_msg_uids= 
'.serialize($this->force_msg_uids).'; $flags: ['.serialize($flags).']<br>';
!                       return imap_sort($stream,$criteria,$reverse,$flags);
!               }
! 
!               function status($stream,$mailbox,$options=0)
!               {
!                       $mailbox = $this->utf7_encode($mailbox);
!                       return imap_status($stream,$mailbox,$options);
!               }
! 
!               function construct_folder_str($folder)
!               { 
!                       /* This is only used by the login() function */
!                       // Cyrus style: INBOX.Junque
!                       // UWash style: ./aeromail/Junque
!                       return $GLOBALS['phpgw']->msg->get_folder_long($folder);
!               }
! 
!               function deconstruct_folder_str($folder)
!               {
!                       //  This is only used by the login() function
!                       // Cyrus style: INBOX.Junque
!                       // UWash style: ./aeromail/Junque
!                       return 
$GLOBALS['phpgw']->msg->get_folder_short($folder);
!               }
! 
!               /* rfc_get_flag() is more "rfc safe", as RFC822 allows
!                       the content of the header to be on several lines.
! 
!                       Quote from RFC822 3.1.1:
!                       <quote>
!                               For convenience, the field-body  portion  of  
this  conceptual
!                               entity  can be split into a multiple-line 
representation; this
!                               is called "folding".  The general rule is that 
wherever  there
!                               may  be  linear-white-space  (NOT  simply  
LWSP-chars), a CRLF
!                               immediately followed by AT LEAST one LWSP-char 
may instead  be
!                               inserted.
!                       </quote>
! 
!                       Note:   $flag should _NOT_ begin with a space
!                       $field_no should be given strarting at 1
!               */
!               function rfc_get_flag($stream,$msg_num,$flags=0,$field_no=1)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       $fieldCount = 0;
!                       $header = imap_fetchheader ($stream, $msg_num, $flags);
!                       $header = explode("\n", $header);
!                       $flag = strtolower($flag);
! 
!                       for ($i=0; $i < count($header); $i++)
!                       {
!                               // The next check for the $flag _requires_ the 
field to
!                               // start at the first character (unless some 
person
!                               // adds a space in the beginning of $flag.
!                               // I believe this is correct according to the 
RFC.
! 
!                               if (strcmp 
(substr(strtolower($header[$i]),0,strlen($flag) + 1), $flag.':')==0)
!                               {
!                                       $fieldFound = true;
!                                       $fieldCount++;
!                               }
!                               else
!                               {
!                                       $fieldFound = false;
!                               }
!               
!                               if ($fieldFound && $fieldCount == $field_no)
!                               {
!                                       // We now need to see if the next lines 
belong to this  message. 
!                                       $header_begin = $i;
!                                       // make sure we don't go too far:)
!                                       // and if the line begins with a space 
then
!                                       // we'll increment the counter with one.
!                                       $i++;
! 
!                                       while ($i < count($header) 
!                                               && 
strcmp(substr($header[$i],0,1), ' ') == 0)
!                                       {
!                                               $i++;
!                                       }
! 
!                                       // Remove the "field:" from this string.
!                                       $return_tmp = explode (':', 
$header[$header_begin]);
!                                       $tmp_flag = $return_tmp[0];
!                                       $return_string = trim ($return_tmp[1]);
! 
!                                       if (strcasecmp ($flag, $tmp_flag) != 0)
!                                       {
!                                               return false;
!                                       }
!                                       // Houston, we have a _problem_
!                                       // add the rest of the content
! 
!                                       for ($j=$header_begin+1; $j < $i; $j++)
!                                       {
!                                               $return_string .= $header[$j];
!                                       }
! 
!                                       return $return_string;
!                               }
!                       }
!                       // failed to find $flag
!                       return false;
!               }
! 
!               /*
!               function get_flag($stream,$msg_num,$flag)
!               {
!                       // Call my new rfc_get_flag() function.
!                       // It should replace get_flag() as soon as it's 
!                       // accepted into cvs phpGW
!                       return $this->rfc_get_flag ($stream, $msg_num, $flag);
! 
!                       $header = imap_fetchheader($stream,$msg_num);
!                       $header = explode("\n",$header);
!                       $flag = strtolower($flag);
!                       for ($i=0;$i<count($header);$i++)
!                       {
!                               $pos = strpos($header[$i],':');
!                               if (is_int($pos) && $pos)
!                               {
!                                       $keyword = 
trim(substr($header[$i],0,$pos));
!                                       $content = 
trim(substr($header[$i],$pos+1));
!                                       if (strtolower($keyword) == $flag)
!                                       {
!                                               return $content;
!                                       }
!                               }
!                       }
!                       return false;
!               }
!               */
!       }
! ?>

Index: class.mail_dcom_imap_sock.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_dcom_imap_sock.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** class.mail_dcom_imap_sock.inc.php   25 Oct 2002 12:45:53 -0000      1.14
--- class.mail_dcom_imap_sock.inc.php   14 Mar 2003 04:00:52 -0000      1.15
***************
*** 1,1362 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare API - IMAP                                               
   *
!       * This file written by Mark Peters <address@hidden>              *
!       * and Angelo "Angles" Puglisi <address@hidden>          *
!       * Handles specific operations in dealing with IMAP via Sockets          
               *
!       * Copyright (C) 2001 Mark Peters                                        
   *
!       * Copyright (C) 2001, 2002 Anglo "Angles" Puglisi *
!       * 
-------------------------------------------------------------------------*
!       * This library is part of the phpGroupWare API                          
   *
[...2695 lines suppressed...]
!               function 
fetchbody($stream_notused,$msg_num,$part_num="",$flags="")
!               {
!                       if ($this->debug_dcom >= 1) { echo 'imap: fetchbody  
NOT YET IMPLEMENTED imap sockets function<br>'; }
!                       return False;
!               }
!               
!               /*!
!               @function get_body
!               @abstract implements IMAP_BODY
!               */
!               function 
get_body($stream_notused,$msg_num,$flags='',$phpgw_include_header=True)
!               {
!                       // NEEDED: code for flags: FT_UID; maybe FT_INTERNAL; 
FT_NOT; flag FT_PEEK has no effect on POP3
!                       if ($this->debug_dcom >= 1) { echo 'imap: get_body  NOT 
YET IMPLEMENTED imap sockets function<br>'; }
!                       return False;
!               }
!               
!       }
! 
! ?>

Index: class.mail_dcom_nntp.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_dcom_nntp.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.mail_dcom_nntp.inc.php        25 Oct 2002 12:45:53 -0000      1.3
--- class.mail_dcom_nntp.inc.php        14 Mar 2003 04:00:55 -0000      1.4
***************
*** 1,208 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare Email - POP3 Mail Wrapper for Imap Enabled PHP               
                   *
!   * http://www.phpgroupware.org/                                          *   
                            *
!   * -------------------------------------------------------------------------*
!   * This library is part of phpGroupWare (http://www.phpgroupware.org)       *
!   * This library is free software; you can redistribute it and/or modify it  *
!   * under the terms of the GNU Lesser General Public License as published by *
!   * the Free Software Foundation; either version 2.1 of the License,         *
!   * or any later version.                                                    *
!   * This library is distributed in the hope that it will be useful, but      *
!   * WITHOUT ANY WARRANTY; without even the implied warranty of               *
!   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
!   * See the GNU Lesser General Public License for more details.              *
!   * You should have received a copy of the GNU Lesser General Public License *
!   * along with this library; if not, write to the Free Software Foundation,  *
!   * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
!   \**************************************************************************/
! 
!   /* $Id$ */
! 
!       class mail_dcom extends mail_dcom_base
!       {
!               function base64($text)
!               {
!                       return imap_base64($text);
!               }
! 
!               function close($stream,$flags='')
!               {
!                       return imap_close($stream,$flags);
!               }
! 
!               function createmailbox($stream,$mailbox) 
!               {
!                       // N/A for pop3
!                       return true;
!               }
! 
!               function deletemailbox($stream,$mailbox)
!               {
!                       // N/A for pop3
!                       return true;
!               } 
! 
!               function delete($stream,$msg_num,$flags='',$currentfolder='')
!               {
!                       return imap_delete($stream,$msg_num);
!               }
!      
!               function expunge($stream)
!               {
!                       // N/A for pop3
!                       return true;
!               }
!      
!               function fetchbody($stream,$msgnr,$partnr,$flags='')
!               {
!                       return imap_fetchbody($stream,$msgnr,$partnr,$flags);
!               }
! 
!               function 
header($stream,$msg_nr,$fromlength='',$tolength='',$defaulthost='')
!               {
!                       return 
imap_header($stream,$msg_nr,$fromlength,$tolength,$defaulthost);
!               }
! 
!               function fetch_raw_mail($stream,$msg_num)
!               {
!                       return 
imap_fetchheader($stream,$msg_num,FT_PREFETCHTEXT);
!               }
! 
!               function fetchheader($stream,$msg_num)
!               {
!                       return imap_fetchheader($stream,$msg_num);
!               }
! 
!               function get_header($stream,$msg_num)
!               {
!                       // alias for compatibility with some old code
!                       return $this->fetchheader($stream,$msg_num);
!               }
! 
!               function fetchstructure($stream,$msg_num,$flags='')
!               {
!                       return imap_fetchstructure($stream,$msg_num);
!               }
! 
!               function get_body($stream,$msg_num,$flags='')
!               {
!                       return imap_body($stream,$msg_num,$flags);
!               }
! 
!               function listmailbox($stream,$ref,$pattern)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function num_msg($stream) // returns number of messages in the 
mailbox
!               { 
!                       return imap_num_msg($stream);
!               }
! 
!               function mailboxmsginfo($stream) 
!               {
!                       return imap_mailboxmsginfo($stream);
!               }
! 
!               function mailcopy($stream,$msg_list,$mailbox,$flags)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function mail_move($stream,$msg_list,$mailbox)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function open($mailbox,$username,$password,$flags='')
!               {
!                       return imap_open($mailbox,$username,$password,$flags);
!               }
! 
!               function qprint($message)
!               {
!                       // return quoted_printable_decode($message);
!                       $str = quoted_printable_decode($message);
!                       return str_replace("=\n",'',$str);
!               } 
! 
!               function reopen($stream,$mailbox,$flags='')
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function 
sort($stream,$criteria,$reverse='',$options='',$msg_info='')
!               {
!                       return imap_sort($stream,$criteria,$reverse,$options);
!               }
! 
!               function status($stream,$mailbox,$options)
!               {
!                       return imap_status($stream,$mailbox,$options);
!                       //return imap_num_recent($stream);
!               }
! 
!               function append($stream,$folder='Sent',$header,$body,$flags='')
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function login($folder='INBOX')
!               {
!                       //$debug_logins = True;
!                       $debug_logins = False;
!                       if($debug_logins)
!                       {
!                               echo 'CALL TO LOGIN IN CLASS MSG 
POP3'.'<br>'.'userid='.$GLOBALS['phpgw_info']['user']['preferences']['email']['userid'];
!                       }
!       
!                       error_reporting(error_reporting() - 2);
!                       if($folder!='INBOX')
!                       {
!                               // pop3 has only 1 "folder" - inbox
!                               $folder='INBOX';
!                       }
! 
!                       // WORKAROUND FOR BUG IN EMAIL CUSTOM PASSWORDS (PHASED 
OUT 7/2/01)
!                       // $pass = $this->get_email_passwd();
!                       // === ISSET CHECK ==
!                       if ( 
(isset($GLOBALS['phpgw_info']['user']['preferences']['email']['userid']))
!                               && 
($GLOBALS['phpgw_info']['user']['preferences']['email']['userid'] != '')
!                               && 
(isset($GLOBALS['phpgw_info']['user']['preferences']['email']['passwd']))
!                               && 
($GLOBALS['phpgw_info']['user']['preferences']['email']['passwd'] != '') )
!                       {
!                               $user = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['userid'];
!                               $pass = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['passwd'];
!                       }
!                       else
!                       {
!                               // problem - invalid or nonexistant info for 
userid and/or passwd
!                               return False;
!                       }
! 
!                       $server_str = 
$GLOBALS['phpgw']->msg->get_mailsvr_callstr();
!                       $mbox = $this->open($server_str.$folder, $user, $pass);
! 
!                       error_reporting(error_reporting() + 2);
!                       return $mbox;
!               }
! 
!               function construct_folder_str($folder)
!               {
!                       $folder_str = 
$GLOBALS['phpgw']->msg->get_folder_long($folder);
!                       return $folder_str;
!               }
! 
!               function deconstruct_folder_str($folder)
!               {
!                       $folder_str = 
$GLOBALS['phpgw']->msg->get_folder_short($folder);
!                       return $folder_str;
!               }
!       } // end of class msg
! 
--- 1,208 ----
! <?php
!   /**************************************************************************\
!   * phpGroupWare Email - POP3 Mail Wrapper for Imap Enabled PHP               
                   *
!   * http://www.phpgroupware.org/                                          *   
                            *
!   * -------------------------------------------------------------------------*
!   * This library is part of phpGroupWare (http://www.phpgroupware.org)       *
!   * This library is free software; you can redistribute it and/or modify it  *
!   * under the terms of the GNU Lesser General Public License as published by *
!   * the Free Software Foundation; either version 2.1 of the License,         *
!   * or any later version.                                                    *
!   * This library is distributed in the hope that it will be useful, but      *
!   * WITHOUT ANY WARRANTY; without even the implied warranty of               *
!   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
!   * See the GNU Lesser General Public License for more details.              *
!   * You should have received a copy of the GNU Lesser General Public License *
!   * along with this library; if not, write to the Free Software Foundation,  *
!   * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
!   \**************************************************************************/
! 
!   /* $Id$ */
! 
!       class mail_dcom extends mail_dcom_base
!       {
!               function base64($text)
!               {
!                       return imap_base64($text);
!               }
! 
!               function close($stream,$flags='')
!               {
!                       return imap_close($stream,$flags);
!               }
! 
!               function createmailbox($stream,$mailbox) 
!               {
!                       // N/A for pop3
!                       return true;
!               }
! 
!               function deletemailbox($stream,$mailbox)
!               {
!                       // N/A for pop3
!                       return true;
!               } 
! 
!               function delete($stream,$msg_num,$flags='',$currentfolder='')
!               {
!                       return imap_delete($stream,$msg_num);
!               }
!      
!               function expunge($stream)
!               {
!                       // N/A for pop3
!                       return true;
!               }
!      
!               function fetchbody($stream,$msgnr,$partnr,$flags='')
!               {
!                       return imap_fetchbody($stream,$msgnr,$partnr,$flags);
!               }
! 
!               function 
header($stream,$msg_nr,$fromlength='',$tolength='',$defaulthost='')
!               {
!                       return 
imap_header($stream,$msg_nr,$fromlength,$tolength,$defaulthost);
!               }
! 
!               function fetch_raw_mail($stream,$msg_num)
!               {
!                       return 
imap_fetchheader($stream,$msg_num,FT_PREFETCHTEXT);
!               }
! 
!               function fetchheader($stream,$msg_num)
!               {
!                       return imap_fetchheader($stream,$msg_num);
!               }
! 
!               function get_header($stream,$msg_num)
!               {
!                       // alias for compatibility with some old code
!                       return $this->fetchheader($stream,$msg_num);
!               }
! 
!               function fetchstructure($stream,$msg_num,$flags='')
!               {
!                       return imap_fetchstructure($stream,$msg_num);
!               }
! 
!               function get_body($stream,$msg_num,$flags='')
!               {
!                       return imap_body($stream,$msg_num,$flags);
!               }
! 
!               function listmailbox($stream,$ref,$pattern)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function num_msg($stream) // returns number of messages in the 
mailbox
!               { 
!                       return imap_num_msg($stream);
!               }
! 
!               function mailboxmsginfo($stream) 
!               {
!                       return imap_mailboxmsginfo($stream);
!               }
! 
!               function mailcopy($stream,$msg_list,$mailbox,$flags)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function mail_move($stream,$msg_list,$mailbox)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function open($mailbox,$username,$password,$flags='')
!               {
!                       return imap_open($mailbox,$username,$password,$flags);
!               }
! 
!               function qprint($message)
!               {
!                       // return quoted_printable_decode($message);
!                       $str = quoted_printable_decode($message);
!                       return str_replace("=\n",'',$str);
!               } 
! 
!               function reopen($stream,$mailbox,$flags='')
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function 
sort($stream,$criteria,$reverse='',$options='',$msg_info='')
!               {
!                       return imap_sort($stream,$criteria,$reverse,$options);
!               }
! 
!               function status($stream,$mailbox,$options)
!               {
!                       return imap_status($stream,$mailbox,$options);
!                       //return imap_num_recent($stream);
!               }
! 
!               function append($stream,$folder='Sent',$header,$body,$flags='')
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function login($folder='INBOX')
!               {
!                       //$debug_logins = True;
!                       $debug_logins = False;
!                       if($debug_logins)
!                       {
!                               echo 'CALL TO LOGIN IN CLASS MSG 
POP3'.'<br>'.'userid='.$GLOBALS['phpgw_info']['user']['preferences']['email']['userid'];
!                       }
!       
!                       error_reporting(error_reporting() - 2);
!                       if($folder!='INBOX')
!                       {
!                               // pop3 has only 1 "folder" - inbox
!                               $folder='INBOX';
!                       }
! 
!                       // WORKAROUND FOR BUG IN EMAIL CUSTOM PASSWORDS (PHASED 
OUT 7/2/01)
!                       // $pass = $this->get_email_passwd();
!                       // === ISSET CHECK ==
!                       if ( 
(isset($GLOBALS['phpgw_info']['user']['preferences']['email']['userid']))
!                               && 
($GLOBALS['phpgw_info']['user']['preferences']['email']['userid'] != '')
!                               && 
(isset($GLOBALS['phpgw_info']['user']['preferences']['email']['passwd']))
!                               && 
($GLOBALS['phpgw_info']['user']['preferences']['email']['passwd'] != '') )
!                       {
!                               $user = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['userid'];
!                               $pass = 
$GLOBALS['phpgw_info']['user']['preferences']['email']['passwd'];
!                       }
!                       else
!                       {
!                               // problem - invalid or nonexistant info for 
userid and/or passwd
!                               return False;
!                       }
! 
!                       $server_str = 
$GLOBALS['phpgw']->msg->get_mailsvr_callstr();
!                       $mbox = $this->open($server_str.$folder, $user, $pass);
! 
!                       error_reporting(error_reporting() + 2);
!                       return $mbox;
!               }
! 
!               function construct_folder_str($folder)
!               {
!                       $folder_str = 
$GLOBALS['phpgw']->msg->get_folder_long($folder);
!                       return $folder_str;
!               }
! 
!               function deconstruct_folder_str($folder)
!               {
!                       $folder_str = 
$GLOBALS['phpgw']->msg->get_folder_short($folder);
!                       return $folder_str;
!               }
!       } // end of class msg
! 

Index: class.mail_dcom_nntp_sock.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_dcom_nntp_sock.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.mail_dcom_nntp_sock.inc.php   25 Oct 2002 12:45:53 -0000      1.4
--- class.mail_dcom_nntp_sock.inc.php   14 Mar 2003 04:00:55 -0000      1.5
***************
*** 1,324 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare API - NNTP                                                  *
!   * This file written by Mark Peters <address@hidden>              *
!   * Handles specific operations in dealing with NNTP                         *
!   * Copyright (C) 2001 Mark Peters                                           *
!   * -------------------------------------------------------------------------*
!   * This library is part of the phpGroupWare API                             *
!   * http://www.phpgroupware.org/api                                          
* 
!   * ------------------------------------------------------------------------ *
!   * This library is free software; you can redistribute it and/or modify it  *
!   * under the terms of the GNU Lesser General Public License as published by *
!   * the Free Software Foundation; either version 2.1 of the License,         *
!   * or any later version.                                                    *
!   * This library is distributed in the hope that it will be useful, but      *
!   * WITHOUT ANY WARRANTY; without even the implied warranty of               *
!   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
!   * See the GNU Lesser General Public License for more details.              *
!   * You should have received a copy of the GNU Lesser General Public License *
!   * along with this library; if not, write to the Free Software Foundation,  *
!   * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
!   \**************************************************************************/
! 
!   class mail_dcom extends mail_dcom_base
!   {
!       var $db;
!       var $folder;
!       var $start_msg;
!       var $end_msg;
! 
!       function mode_reader()
!       {
!               return $this->msg2socket('mode reader','^20[01]',&$response);
!       }
! 
!       function login ($user,$passwd,$server,$port,$folder = '')
!       {
!               global $phpgw;
!               
!               $this->db = $phpgw->db;
! 
!               if(@!$server)
!               {
!                       echo 'Error: Configuration Error! The administrator has 
not configured the NNTP Server.';
!               }
!               
!               if(@!$port)
!               {
!                       $port = 119;
!               }
! 
!               if (!$this->open_port($server,$port,15))
!               {
!                       $this->error();
!               }
!               $this->read_port();
! 
!               if ($user <> '' && $passwd <> '')
!               {
!                       if (!$this->msg2socket('authinfo user 
'.$user,'^381',&$response))
!                       {
!                               $this->error();
!                       }
!                       if (!$this->msg2socket('authinfo pass 
'.$passwd,'^281',&$response))
!                       {
!                               $this->error();
!                       }
!               }
!               if (!$this->mode_reader())
!               {
!                       $this->error();
!               }
!               if(!$folder)
!               {
!                       $folder = $this->get_first_folder();
!                       if(!$folder)
!                       {
!                               $this->error();
!                       }
!               }
!               $this->folder = $folder;
!               $this->mailbox = $this->get_mailbox_name($folder);
!               $this->num_msgs = $this->num_msg($this->mailbox);
!               $this->start_msg = $this->first_message($this->mailbox);
!               $this->end_msg = $this->last_message($this->mailbox);
!               echo 'Successful connection to '.$this->mailbox."<br>\n";
!       }
! 
!       function fix_folder($folder='')
!       {
!               if($folder=='')
!               {
!                       $mailbox = $this->mailbox;
!               }
!               elseif(is_int($folder))
!               {
!                       $mailbox = $this->get_mailbox_name($folder);
!               }
!               else
!               {
!                       $mailbox = $folder;
!               }
!               return $mailbox;
!       }
!       
!       function get_first_folder()
!       {
!               if(@!$GLOBALS['phpgw_info']['user']['preferences']['nntp'])
!               {
!                       $this->set_error('Configuration','User 
Preferences','You have not set your user preferences in NNTP.');
!                       $this->error();
!               }
!               else
!               {
!                       $pref = 
@each($GLOBALS['phpgw_info']['user']['preferences']['nntp']);
!                       return $pref[0];
!               }
!       }
! 
!       function get_mailbox_name($folder)
!       {
!               $active = False;
!               $this->db->query('SELECT name,active FROM newsgroups WHERE 
con='.$folder,_LINE__,__FILE__);
!               if ($this->db->num_rows() > 0)
!               {
!                       $this->db->next_record();
!                       $mailbox        = $this->db->f('name');
!               }
!               if ($this->db->f('active') != 'Y')
!               {
!                       $GLOBALS['phpgw']->preferences->delete('nntp',$folder);
!                       $GLOBALS['phpgw']->preferences->save_repository();
!                       
!                       $this->set_error('Administration','Automatic 
Disabling','The newsgroup '.$mailbox.' is not activated by the Administrator.');
!                       $this->error();
!               }
!               return $mailbox;
!       }
! 
!       function get_mailbox_counts($folder='',$index=1)
!       {
!               $mailbox = $this->fix_folder($folder);
!               if (!$this->msg2socket('group '.$mailbox,'^211',&$response))
!               {
!                       $this->error();
!               }
!               $temp_array = explode(' ',$response);
!               return $temp_array[$index];
!       }
! 
!       function num_msg($folder='')
!       {
!               if(($folder == '' || $folder == $this->mailbox) && 
isset($this->num_msgs))
!               {
!                       return $this->num_msgs;
!               }
!               return $this->get_mailbox_counts($folder,1);
!       }
! 
!       function first_message($folder='')
!       {
!               if(($folder == '' || $folder == $this->mailbox) && 
isset($this->start_msg))
!               {
!                       return $this->start_msg;
!               }
!               return $this->get_mailbox_counts($folder,2);
!       }
! 
!       function last_message($folder='')
!       {
!               if(($folder == '' || $folder == $this->mailbox) && 
isset($this->end_msg))
!               {
!                       return $this->end_msg;
!               }
!               return $this->get_mailbox_counts($folder,3);
!       }
! 
!       function mailboxmsginfo($folder='')
!       {
!               $info = new msg_mb_info;
!               if($folder=='' || $folder==$this->mailbox || 
$folder==$this->folder)
!               {
!                       if(isset($this->num_msgs))
!                       {
!                               $info->messages = $this->num_msgs;
!                       }
!                       else
!                       {
!                               if($folder==$this->folder)
!                               {
!                                       $this->mailbox = 
$this->get_mailbox_name($folder);
!                               }
!                               $info->messages = 
$this->num_msg($this->mailbox);
!                       }
!                       $info->size  = 0;
!                       if ($info->messages)
!                       {
!                               return $info;
!                       }
!                       else
!                       {
!                               return False;
!                       }
!               }
!               else
!               {
!                       $mailbox = $this->fix_folder($folder);
!               }
! 
!               $info->messages = $this->num_msgs($mailbox);
!               $info->size  = 0;
! 
!               $this->num_msgs($this->mailbox);
! 
!               if ($info->messages)
!               {
!                       return $info;
!               }
!               else
!               {
!                       return False;
!               }
!       }
! 
!       function fetch_field($start,$stop,$element)
!       {
!               if (!$this->msg2socket('XHDR '.$element.' 
'.$start.'-'.$stop,'^221',&$response))
!               {
!                       $this->error();
!               }
! 
!               $field_element = Array();
!               while ($line = $this->read_port())
!               {
!                       $line = chop($line);
!                       if ($line == '.')
!                       {
!                               break;
!                       }
!                       $breakpos = strpos($line,' ');
!                       
!                       $field_element[intval(substr($line,0,$breakpos-1))] = 
$this->phpGW_quoted_printable_decode2(substr($line,$breakpos+1));
!               }
!               return $field_element;
!       }
! 
!       function status($folder='',$options=SA_ALL)
!       {
!               $info = new mailbox_status;
!               $info->messages = $this->num_msg($folder);
!               return $info;
!       }
! 
!       function sort($folder='',$criteria=SORTDATE,$reverse=False,$options='')
!       {
!               if($folder == '' || $folder == $this->mailbox)
!               {
!                       $mailbox = $this->mailbox;
!                       $start_msg = $this->start_msg;
!                       $end_msg = $this->end_msg;
!               }
!               else
!               {
!                       $mailbox = $this->fix_folder($folder);
!                       $start_msg = $this->first_message($mailbox);
!                       $end_msg = $this->last_message($mailbox);
!               }
!               
!               switch($criteria)
!               {
!                       case SORTDATE:
!                               $old_list = 
$this->fetch_field($start_msg,$end_msg,'Date');
!                               $field_list = 
$this->convert_date_array($old_list);
!                               break;
!                       case SORTARRIVAL:
!                               break;
!                       case SORTFROM:
!                               $field_list = 
$this->fetch_field($start_msg,$end_msg,'From');
!                               break;
!                       case SORTSUBJECT:
!                               $field_list = 
$this->fetch_field($start_msg,$end_msg,'Subject');
!                               break;
!                       case SORTTO:
!                               $field_list = 
$this->fetch_field($start_msg,$end_msg,'To');
!                               break;
!                       case SORTCC:
!                               $field_list = 
$this->fetch_field($start_msg,$end_msg,'cc');
!                               break;
!                       case SORTSIZE:
!                               break;
!               }
!               @reset($field_list);
!               if($criteria == SORTSUBJECT)
!               {
!                       if(!$reverse)
!                       {
!                               
uasort($field_list,array($this,"ssort_ascending"));
!                       }
!                       else
!                       {
!                               
uasort($field_list,array($this,"ssort_decending"));
!                       }                       
!               }
!               elseif(!$reverse)
!               {
!                       asort($field_list);
!               }
!               else
!               {
!                       arsort($field_list);
!               }
!               $return_array = Array();
!               @reset($field_list);
!               $i = 1;
!               while(list($key,$value) = each($field_list))
!               {
!                       $return_array[] = $key;
!                       echo '('.$i++.') Field: <b>'.$value."</b>\t\tMsg Num: 
<b>".$key."</b><br>\n";
!               }
!               @reset($return_array);
!               return $return_array;
!       }
! }
! ?>
--- 1,324 ----
! <?php
!   /**************************************************************************\
!   * phpGroupWare API - NNTP                                                  *
!   * This file written by Mark Peters <address@hidden>              *
!   * Handles specific operations in dealing with NNTP                         *
!   * Copyright (C) 2001 Mark Peters                                           *
!   * -------------------------------------------------------------------------*
!   * This library is part of the phpGroupWare API                             *
!   * http://www.phpgroupware.org/api                                          
* 
!   * ------------------------------------------------------------------------ *
!   * This library is free software; you can redistribute it and/or modify it  *
!   * under the terms of the GNU Lesser General Public License as published by *
!   * the Free Software Foundation; either version 2.1 of the License,         *
!   * or any later version.                                                    *
!   * This library is distributed in the hope that it will be useful, but      *
!   * WITHOUT ANY WARRANTY; without even the implied warranty of               *
!   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
!   * See the GNU Lesser General Public License for more details.              *
!   * You should have received a copy of the GNU Lesser General Public License *
!   * along with this library; if not, write to the Free Software Foundation,  *
!   * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
!   \**************************************************************************/
! 
!   class mail_dcom extends mail_dcom_base
!   {
!       var $db;
!       var $folder;
!       var $start_msg;
!       var $end_msg;
! 
!       function mode_reader()
!       {
!               return $this->msg2socket('mode reader','^20[01]',&$response);
!       }
! 
!       function login ($user,$passwd,$server,$port,$folder = '')
!       {
!               global $phpgw;
!               
!               $this->db = $phpgw->db;
! 
!               if(@!$server)
!               {
!                       echo 'Error: Configuration Error! The administrator has 
not configured the NNTP Server.';
!               }
!               
!               if(@!$port)
!               {
!                       $port = 119;
!               }
! 
!               if (!$this->open_port($server,$port,15))
!               {
!                       $this->error();
!               }
!               $this->read_port();
! 
!               if ($user <> '' && $passwd <> '')
!               {
!                       if (!$this->msg2socket('authinfo user 
'.$user,'^381',&$response))
!                       {
!                               $this->error();
!                       }
!                       if (!$this->msg2socket('authinfo pass 
'.$passwd,'^281',&$response))
!                       {
!                               $this->error();
!                       }
!               }
!               if (!$this->mode_reader())
!               {
!                       $this->error();
!               }
!               if(!$folder)
!               {
!                       $folder = $this->get_first_folder();
!                       if(!$folder)
!                       {
!                               $this->error();
!                       }
!               }
!               $this->folder = $folder;
!               $this->mailbox = $this->get_mailbox_name($folder);
!               $this->num_msgs = $this->num_msg($this->mailbox);
!               $this->start_msg = $this->first_message($this->mailbox);
!               $this->end_msg = $this->last_message($this->mailbox);
!               echo 'Successful connection to '.$this->mailbox."<br>\n";
!       }
! 
!       function fix_folder($folder='')
!       {
!               if($folder=='')
!               {
!                       $mailbox = $this->mailbox;
!               }
!               elseif(is_int($folder))
!               {
!                       $mailbox = $this->get_mailbox_name($folder);
!               }
!               else
!               {
!                       $mailbox = $folder;
!               }
!               return $mailbox;
!       }
!       
!       function get_first_folder()
!       {
!               if(@!$GLOBALS['phpgw_info']['user']['preferences']['nntp'])
!               {
!                       $this->set_error('Configuration','User 
Preferences','You have not set your user preferences in NNTP.');
!                       $this->error();
!               }
!               else
!               {
!                       $pref = 
@each($GLOBALS['phpgw_info']['user']['preferences']['nntp']);
!                       return $pref[0];
!               }
!       }
! 
!       function get_mailbox_name($folder)
!       {
!               $active = False;
!               $this->db->query('SELECT name,active FROM newsgroups WHERE 
con='.$folder,_LINE__,__FILE__);
!               if ($this->db->num_rows() > 0)
!               {
!                       $this->db->next_record();
!                       $mailbox        = $this->db->f('name');
!               }
!               if ($this->db->f('active') != 'Y')
!               {
!                       $GLOBALS['phpgw']->preferences->delete('nntp',$folder);
!                       $GLOBALS['phpgw']->preferences->save_repository();
!                       
!                       $this->set_error('Administration','Automatic 
Disabling','The newsgroup '.$mailbox.' is not activated by the Administrator.');
!                       $this->error();
!               }
!               return $mailbox;
!       }
! 
!       function get_mailbox_counts($folder='',$index=1)
!       {
!               $mailbox = $this->fix_folder($folder);
!               if (!$this->msg2socket('group '.$mailbox,'^211',&$response))
!               {
!                       $this->error();
!               }
!               $temp_array = explode(' ',$response);
!               return $temp_array[$index];
!       }
! 
!       function num_msg($folder='')
!       {
!               if(($folder == '' || $folder == $this->mailbox) && 
isset($this->num_msgs))
!               {
!                       return $this->num_msgs;
!               }
!               return $this->get_mailbox_counts($folder,1);
!       }
! 
!       function first_message($folder='')
!       {
!               if(($folder == '' || $folder == $this->mailbox) && 
isset($this->start_msg))
!               {
!                       return $this->start_msg;
!               }
!               return $this->get_mailbox_counts($folder,2);
!       }
! 
!       function last_message($folder='')
!       {
!               if(($folder == '' || $folder == $this->mailbox) && 
isset($this->end_msg))
!               {
!                       return $this->end_msg;
!               }
!               return $this->get_mailbox_counts($folder,3);
!       }
! 
!       function mailboxmsginfo($folder='')
!       {
!               $info = new msg_mb_info;
!               if($folder=='' || $folder==$this->mailbox || 
$folder==$this->folder)
!               {
!                       if(isset($this->num_msgs))
!                       {
!                               $info->messages = $this->num_msgs;
!                       }
!                       else
!                       {
!                               if($folder==$this->folder)
!                               {
!                                       $this->mailbox = 
$this->get_mailbox_name($folder);
!                               }
!                               $info->messages = 
$this->num_msg($this->mailbox);
!                       }
!                       $info->size  = 0;
!                       if ($info->messages)
!                       {
!                               return $info;
!                       }
!                       else
!                       {
!                               return False;
!                       }
!               }
!               else
!               {
!                       $mailbox = $this->fix_folder($folder);
!               }
! 
!               $info->messages = $this->num_msgs($mailbox);
!               $info->size  = 0;
! 
!               $this->num_msgs($this->mailbox);
! 
!               if ($info->messages)
!               {
!                       return $info;
!               }
!               else
!               {
!                       return False;
!               }
!       }
! 
!       function fetch_field($start,$stop,$element)
!       {
!               if (!$this->msg2socket('XHDR '.$element.' 
'.$start.'-'.$stop,'^221',&$response))
!               {
!                       $this->error();
!               }
! 
!               $field_element = Array();
!               while ($line = $this->read_port())
!               {
!                       $line = chop($line);
!                       if ($line == '.')
!                       {
!                               break;
!                       }
!                       $breakpos = strpos($line,' ');
!                       
!                       $field_element[intval(substr($line,0,$breakpos-1))] = 
$this->phpGW_quoted_printable_decode2(substr($line,$breakpos+1));
!               }
!               return $field_element;
!       }
! 
!       function status($folder='',$options=SA_ALL)
!       {
!               $info = new mailbox_status;
!               $info->messages = $this->num_msg($folder);
!               return $info;
!       }
! 
!       function sort($folder='',$criteria=SORTDATE,$reverse=False,$options='')
!       {
!               if($folder == '' || $folder == $this->mailbox)
!               {
!                       $mailbox = $this->mailbox;
!                       $start_msg = $this->start_msg;
!                       $end_msg = $this->end_msg;
!               }
!               else
!               {
!                       $mailbox = $this->fix_folder($folder);
!                       $start_msg = $this->first_message($mailbox);
!                       $end_msg = $this->last_message($mailbox);
!               }
!               
!               switch($criteria)
!               {
!                       case SORTDATE:
!                               $old_list = 
$this->fetch_field($start_msg,$end_msg,'Date');
!                               $field_list = 
$this->convert_date_array($old_list);
!                               break;
!                       case SORTARRIVAL:
!                               break;
!                       case SORTFROM:
!                               $field_list = 
$this->fetch_field($start_msg,$end_msg,'From');
!                               break;
!                       case SORTSUBJECT:
!                               $field_list = 
$this->fetch_field($start_msg,$end_msg,'Subject');
!                               break;
!                       case SORTTO:
!                               $field_list = 
$this->fetch_field($start_msg,$end_msg,'To');
!                               break;
!                       case SORTCC:
!                               $field_list = 
$this->fetch_field($start_msg,$end_msg,'cc');
!                               break;
!                       case SORTSIZE:
!                               break;
!               }
!               @reset($field_list);
!               if($criteria == SORTSUBJECT)
!               {
!                       if(!$reverse)
!                       {
!                               
uasort($field_list,array($this,"ssort_ascending"));
!                       }
!                       else
!                       {
!                               
uasort($field_list,array($this,"ssort_decending"));
!                       }                       
!               }
!               elseif(!$reverse)
!               {
!                       asort($field_list);
!               }
!               else
!               {
!                       arsort($field_list);
!               }
!               $return_array = Array();
!               @reset($field_list);
!               $i = 1;
!               while(list($key,$value) = each($field_list))
!               {
!                       $return_array[] = $key;
!                       echo '('.$i++.') Field: <b>'.$value."</b>\t\tMsg Num: 
<b>".$key."</b><br>\n";
!               }
!               @reset($return_array);
!               return $return_array;
!       }
! }
! ?>

Index: class.mail_dcom_pop3.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_dcom_pop3.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.mail_dcom_pop3.inc.php        25 Oct 2002 12:45:53 -0000      1.10
--- class.mail_dcom_pop3.inc.php        14 Mar 2003 04:00:55 -0000      1.11
***************
*** 1,253 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare Email - POP3 Mail Wrapper for Imap Enabled PHP               
                   *
!   * http://www.phpgroupware.org/                                          *   
                            *
!   * -------------------------------------------------------------------------*
!   * This library is part of phpGroupWare (http://www.phpgroupware.org)       *
!   * This library is free software; you can redistribute it and/or modify it  *
!   * under the terms of the GNU Lesser General Public License as published by *
!   * the Free Software Foundation; either version 2.1 of the License,         *
!   * or any later version.                                                    *
!   * This library is distributed in the hope that it will be useful, but      *
!   * WITHOUT ANY WARRANTY; without even the implied warranty of               *
!   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
!   * See the GNU Lesser General Public License for more details.              *
!   * You should have received a copy of the GNU Lesser General Public License *
!   * along with this library; if not, write to the Free Software Foundation,  *
!   * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
!   \**************************************************************************/
! 
!   /* $Id$ */
! 
!       class mail_dcom extends mail_dcom_base
!       {
!               function append($stream, $folder = 'Sent', $header, $body, 
$flags=0)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function base64($text)
!               {
!                       return imap_base64($text);
!               }
! 
!               function close($stream,$flags=0)
!               {
!                       return imap_close($stream,$flags);
!               }
! 
!               function createmailbox($stream,$mailbox)
!               {
!                       // N/A for pop3
!                       return true;
!               }
! 
!               function deletemailbox($stream,$mailbox)
!               {
!                       // N/A for pop3
!                       return true;
!               } 
! 
!               function delete($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       $retval = imap_delete($stream,$msg_num,$flags);
!                       // some lame pop3 servers need this extra call to 
expunge, but RFC says not necessary
!                       imap_expunge($stream);
!                       return $retval;
!               }
!      
!               function expunge($stream)
!               {
!                       // N/A for pop3
!                       return true;
!               }
!      
!               function fetchbody($stream,$msgnr,$partnr,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchbody($stream,$msgnr,$partnr,$flags);
!               }
! 
!               function fetchheader($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function fetch_raw_mail($stream,$msg_num,$flags=0)
!               {
!                       $flags |= FT_PREFETCHTEXT;
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function fetchstructure($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchstructure($stream,$msg_num,$flags);
!               }
! 
!               function get_body($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_body($stream,$msg_num,$flags);
!               }
! 
!               function get_header($stream,$msg_num,$flags)
!               {
!                       // alias for compatibility with some old code
!                       return $this->fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function 
header($stream,$msg_nr,$fromlength='',$tolength='',$defaulthost='')
!               {
!                       // do we need to temporarily switch to regular msg num 
sequence for this function?
!                       if ($this->force_msg_uids == True)
!                       {
!                               // this function can nothandle UIDs, switch to 
sequence number
!                               $new_msg_nr = imap_msgno($stream,$msg_nr);
!                               if ($new_msg_nr)
!                               {
!                                       $msg_nr = $new_msg_nr;
!                               }
!                       }
!                       return 
imap_header($stream,$msg_nr,$fromlength,$tolength,$defaulthost);
!               }
! 
!               function listmailbox($stream,$ref,$pattern)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function mailboxmsginfo($stream) 
!               {
!                       return imap_mailboxmsginfo($stream);
!               }
! 
!               function mailcopy($stream,$msg_list,$mailbox,$flags)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function mail_move($stream,$msg_list,$mailbox,$flags)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function num_msg($stream) // returns number of messages in the 
mailbox
!               { 
!                       return imap_num_msg($stream);
!               }
!               
!               function noop_ping_test($stream)
!               { 
!                       return imap_ping($stream);
!               }
! 
!               function open($mailbox,$username,$password,$flags=0)
!               {
!                       return imap_open($mailbox,$username,$password,$flags);
!               }
! 
!               function qprint($message)
!               {
!                       //      return quoted_printable_decode($message);
!                       $str = quoted_printable_decode($message);
!                       return str_replace("=\n",'',$str);
!               }
! 
!               function reopen($stream,$mailbox,$flags='')
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function server_last_error()
!               {
!                       // supported in PHP >= 3.0.12
!                       //UNKNOWN if POP3 server errors also get put here
!                       return imap_last_error();
!               }
! 
!               // does this work for pop3?
!               function i_search($stream,$criteria,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & SE_UID)) )
!                       {
!                               $flags |= SE_UID;
!                       }
!                       return imap_search($stream,$criteria,$flags);
!               }
!               
!               //function 
sort($stream,$criteria,$reverse='',$options='',$msg_info='')
!               function sort($stream,$criteria,$reverse='',$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & SE_UID)) )
!                       {
!                               $flags |= SE_UID;
!                       }
!                       return imap_sort($stream,$criteria,$reverse,$flags);
!               }
! 
!               function status($stream,$mailbox,$options)
!               {
!                       // don't forget pop3 has 1 "folder": INBOX, any other 
folder name will not work
!                       return imap_status($stream,$mailbox,$options);
!               }
! 
!               function construct_folder_str($folder)
!               {
!                       // pop3 has only 1 "folder" - inbox
!                       $folder = 'INBOX';
!                       $folder_str = 
$GLOBALS['phpgw']->msg->get_folder_long($folder);
!                       return $folder_str;
!               }
! 
!               function deconstruct_folder_str($folder)
!               {
!                       // pop3 has only 1 "folder" - inbox
!                       $folder = 'INBOX';
!                       $folder_str = 
$GLOBALS['phpgw']->msg->get_folder_short($folder);
!                       return $folder_str;
!               }
! 
!       } // end of class msg
--- 1,253 ----
! <?php
!   /**************************************************************************\
!   * phpGroupWare Email - POP3 Mail Wrapper for Imap Enabled PHP               
                   *
!   * http://www.phpgroupware.org/                                          *   
                            *
!   * -------------------------------------------------------------------------*
!   * This library is part of phpGroupWare (http://www.phpgroupware.org)       *
!   * This library is free software; you can redistribute it and/or modify it  *
!   * under the terms of the GNU Lesser General Public License as published by *
!   * the Free Software Foundation; either version 2.1 of the License,         *
!   * or any later version.                                                    *
!   * This library is distributed in the hope that it will be useful, but      *
!   * WITHOUT ANY WARRANTY; without even the implied warranty of               *
!   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
!   * See the GNU Lesser General Public License for more details.              *
!   * You should have received a copy of the GNU Lesser General Public License *
!   * along with this library; if not, write to the Free Software Foundation,  *
!   * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
!   \**************************************************************************/
! 
!   /* $Id$ */
! 
!       class mail_dcom extends mail_dcom_base
!       {
!               function append($stream, $folder = 'Sent', $header, $body, 
$flags=0)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function base64($text)
!               {
!                       return imap_base64($text);
!               }
! 
!               function close($stream,$flags=0)
!               {
!                       return imap_close($stream,$flags);
!               }
! 
!               function createmailbox($stream,$mailbox)
!               {
!                       // N/A for pop3
!                       return true;
!               }
! 
!               function deletemailbox($stream,$mailbox)
!               {
!                       // N/A for pop3
!                       return true;
!               } 
! 
!               function delete($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       $retval = imap_delete($stream,$msg_num,$flags);
!                       // some lame pop3 servers need this extra call to 
expunge, but RFC says not necessary
!                       imap_expunge($stream);
!                       return $retval;
!               }
!      
!               function expunge($stream)
!               {
!                       // N/A for pop3
!                       return true;
!               }
!      
!               function fetchbody($stream,$msgnr,$partnr,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchbody($stream,$msgnr,$partnr,$flags);
!               }
! 
!               function fetchheader($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function fetch_raw_mail($stream,$msg_num,$flags=0)
!               {
!                       $flags |= FT_PREFETCHTEXT;
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function fetchstructure($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_fetchstructure($stream,$msg_num,$flags);
!               }
! 
!               function get_body($stream,$msg_num,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & FT_UID)) )
!                       {
!                               $flags |= FT_UID;
!                       }
!                       return imap_body($stream,$msg_num,$flags);
!               }
! 
!               function get_header($stream,$msg_num,$flags)
!               {
!                       // alias for compatibility with some old code
!                       return $this->fetchheader($stream,$msg_num,$flags);
!               }
! 
!               function 
header($stream,$msg_nr,$fromlength='',$tolength='',$defaulthost='')
!               {
!                       // do we need to temporarily switch to regular msg num 
sequence for this function?
!                       if ($this->force_msg_uids == True)
!                       {
!                               // this function can nothandle UIDs, switch to 
sequence number
!                               $new_msg_nr = imap_msgno($stream,$msg_nr);
!                               if ($new_msg_nr)
!                               {
!                                       $msg_nr = $new_msg_nr;
!                               }
!                       }
!                       return 
imap_header($stream,$msg_nr,$fromlength,$tolength,$defaulthost);
!               }
! 
!               function listmailbox($stream,$ref,$pattern)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function mailboxmsginfo($stream) 
!               {
!                       return imap_mailboxmsginfo($stream);
!               }
! 
!               function mailcopy($stream,$msg_list,$mailbox,$flags)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function mail_move($stream,$msg_list,$mailbox,$flags)
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function num_msg($stream) // returns number of messages in the 
mailbox
!               { 
!                       return imap_num_msg($stream);
!               }
!               
!               function noop_ping_test($stream)
!               { 
!                       return imap_ping($stream);
!               }
! 
!               function open($mailbox,$username,$password,$flags=0)
!               {
!                       return imap_open($mailbox,$username,$password,$flags);
!               }
! 
!               function qprint($message)
!               {
!                       //      return quoted_printable_decode($message);
!                       $str = quoted_printable_decode($message);
!                       return str_replace("=\n",'',$str);
!               }
! 
!               function reopen($stream,$mailbox,$flags='')
!               {
!                       // N/A for pop3
!                       return False;
!               }
! 
!               function server_last_error()
!               {
!                       // supported in PHP >= 3.0.12
!                       //UNKNOWN if POP3 server errors also get put here
!                       return imap_last_error();
!               }
! 
!               // does this work for pop3?
!               function i_search($stream,$criteria,$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & SE_UID)) )
!                       {
!                               $flags |= SE_UID;
!                       }
!                       return imap_search($stream,$criteria,$flags);
!               }
!               
!               //function 
sort($stream,$criteria,$reverse='',$options='',$msg_info='')
!               function sort($stream,$criteria,$reverse='',$flags=0)
!               {
!                       // do we force use of msg UID's 
!                       if ( ($this->force_msg_uids == True)
!                       && (!($flags & SE_UID)) )
!                       {
!                               $flags |= SE_UID;
!                       }
!                       return imap_sort($stream,$criteria,$reverse,$flags);
!               }
! 
!               function status($stream,$mailbox,$options)
!               {
!                       // don't forget pop3 has 1 "folder": INBOX, any other 
folder name will not work
!                       return imap_status($stream,$mailbox,$options);
!               }
! 
!               function construct_folder_str($folder)
!               {
!                       // pop3 has only 1 "folder" - inbox
!                       $folder = 'INBOX';
!                       $folder_str = 
$GLOBALS['phpgw']->msg->get_folder_long($folder);
!                       return $folder_str;
!               }
! 
!               function deconstruct_folder_str($folder)
!               {
!                       // pop3 has only 1 "folder" - inbox
!                       $folder = 'INBOX';
!                       $folder_str = 
$GLOBALS['phpgw']->msg->get_folder_short($folder);
!                       return $folder_str;
!               }
! 
!       } // end of class msg

Index: class.mail_dcom_pop3_sock.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_dcom_pop3_sock.inc.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** class.mail_dcom_pop3_sock.inc.php   25 Oct 2002 12:45:53 -0000      1.19
--- class.mail_dcom_pop3_sock.inc.php   14 Mar 2003 04:00:55 -0000      1.20
***************
*** 1,2287 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare API - POP3                                               
   *
!       * This file written by Angelo "Angles" Puglisi <address@hidden  *
!       * and Mark Peters <address@hidden>              *
!       * Handles specific operations in dealing with POP3                      
 *
!       * Copyright (C) 2001, 2002 Mark Peters and Angelo "Angles" Puglisi      
                 *
!       * 
-------------------------------------------------------------------------*
!       * This library is part of the phpGroupWare API                          
   *
!       * http://www.phpgroupware.org/api                                       
   * 
[...4545 lines suppressed...]
!                       // ---  Include Headers With Body Or Not  ---
!                       if (($flags == FT_NOT) || ($phpgw_include_header == 
True))
!                       {
!                               // we need to include the header here
!                               $body_glob = $header_glob ."\r\n" .$body_glob;
!                       }
!                       /*
!                       if ($this->debug_dcom >= 2)
!                       {
!                               echo 'pop3: get_body DUMP<br>= = = First DUMP: 
header_glob<br>';
!                               echo 
'<pre>'.htmlspecialchars($header_glob).'</pre><br><br>';
!                               echo 'pop3: get_body DUMP<br>= = = Second DUMP: 
body_glob<br>';
!                               echo 
'<pre>'.htmlspecialchars($body_glob).'</pre><br><br>';
!                       }
!                       */
!                       if ($this->debug_dcom >= 1) { echo 'pop3: Leaving 
get_body<br>'; }
!                       return $body_glob;
!               }
!       }
! ?>

Index: class.mail_filters.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_filters.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.mail_filters.inc.php  25 Oct 2002 12:56:57 -0000      1.6
--- class.mail_filters.inc.php  14 Mar 2003 04:00:55 -0000      1.7
***************
*** 1,392 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Filters                                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * Copyright (C) 2001, 2002 Angelo Puglisi (Angles)                      
                *
!       * -----------------------------------------------                       
                                *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       /*!
!       @class mail_filters
!       @abstract ?
!       @author Angles
!       */
!       class mail_filters
!       {
!               var $filters = Array();
!               var $template = '';
!               var $finished_mlist = '';
!               var $submit_mlist_to_class_form = '';
!               var $submit_flag = '';
!               //var $debug_level = 0;
!               var $debug_level = 1;
!               //var $debug_level = 2;
!               var $sieve_to_imap_fields=array();
!               var $result_set = Array();
!               var $result_set_mlist = Array();
!               var $fake_folder_info = array();
!               
!               /*!
!               @function mail_filters
!               @abstract constructor
!               @author Angles
!               */
!               function mail_filters()
!               {
!                       $this->sieve_to_imap_fields = Array(
!                               'from'          => 'FROM',
!                               'to'            => 'TO',
!                               'cc'            => 'CC',
!                               'bcc'           => 'BCC',
!                               'recipient'     => 'FIX_ME: TO or CC or BCC',
!                               'sender'        => 'SEARCHHEADER SENDER',
!                               'subject'       => 'SUBJECT',
!                               'header'        => 'FIX_ME SEARCHHEADER FIX_ME',
!                               'size_larger'   => 'LARGER',
!                               'size_smaller'  => 'SMALLER',
!                               'allmessages'   => 'FIX_ME (matches all 
messages)',
!                               'body'          => 'BODY'
!                       );
!               }
!               
!               /*!
!               @function distill_filter_args
!               @abstract ?
!               @author Angles
!               */
!               function distill_filter_args()
!               {
!                       // do we have data
!                       if  
(!isset($GLOBALS['HTTP_POST_VARS'][$this->submit_flag]))
!                       {
!                               if ($this->debug_level > 0) { echo 
'mail_filters: distill_filter_args: NO data submitted<br>'."\r\n"; }
!                               return Array();
!                       }
!                       
!                       // look for top level "filter_X" array
!                       while(list($key,$value) = 
each($GLOBALS['HTTP_POST_VARS']))
!                       {
!                               if (strstr($key, 'filter_'))
!                               {
!                                       // put the raw data dor this particular 
filter into a local var
!                                       $filter_X = 
$GLOBALS['HTTP_POST_VARS'][$key];
!                                       if ($this->debug_level > 0) { echo 
'mail_filters: distill_filter_args: filter_X dump <strong><pre>'; 
print_r($filter_X); echo "</pre></strong>\r\n"; }
!                                       
!                                       // prepare to fill your structured array
!                                       $this_idx = count($this->filters);
!                                       // grab the "filter name" associated 
with this data
!                                       $this->filters[$this_idx]['filtername'] 
= $filter_X['filtername'];
!                                       // what folder so we search
!                                       
$this->filters[$this_idx]['source_folder'] = $filter_X['source_folder'];
!                                       // init sub arrays
!                                       $this->filters[$this_idx]['matches'] = 
Array();
!                                       $this->filters[$this_idx]['actions'] = 
Array();
!                                       // extract match and action data from 
this filter_X data array
!                                       
while(list($filter_X_key,$filter_X_value) = each($filter_X))
!                                       {
!                       /*!
!                       @capability multidimentional filter data for Matching
!                       @author Angles
!                       @discussion extract multidimentional filter data 
embedded in this 1 dimentional array. 
!                       php3 limits POST arrays to one level of array key,value 
pairs. 
!                       Thus complex filtering instructions are containded in 
special strings submitted as controls names 
!                       matching instructions willlook something like this 
example. 
!                       @syntax * the "key" string "match_0_comparator" needs 
to be "decompressed" into an associative array
!                       $filter_X ['match_0_comparator'] => 'contains'
!                       * the string means this:
!                       a: we are dealing with "match" data
!                       b: when this data is "decompressed" this would be 
match[0] data
!                       c: that this should be match[0] ["comparator"] where 
"comparator" is the key, and
!                       d: that value of this match[0]["comparator"] = 
"contains"
!                       * thus, we are looking at a match to see if something 
"contains" a string that will be described in the next key,value iteration
!                       * such string may look like this in its raw form
!                       [match_0_matchthis] => "@spammer.com"
!                       * translates to this
!                       match[0]["matchthis"] = "@spammer.com"
!                                               */
!                                               if (strstr($filter_X_key, 
'match_'))
!                                               {
!                                                       // now we grab the 
index value from the key string
!                                                       $match_this_idx = 
(int)$filter_X_key[6];
!                                                       if ($this->debug_level 
> 1) { echo 'mail_filters: distill_filter_args: match_this_idx grabbed value: 
['.$match_this_idx.']<br>'; }
!                                                       // grab "key" that 
comes after that match_this_idx we just got
!                                                       // remember "substr" 
uses 1 as the first letter in a string, not 0, AND starts returning the letter 
AFTER the specified location
!                                                       $match_grabbed_key = 
substr($filter_X_key, 8);
!                                                       if ($this->debug_level 
> 1) { echo 'mail_filters: distill_filter_args: match_grabbed_key value: 
['.$match_grabbed_key.']<br>'; }
!                                                       
$this->filters[$this_idx]['matches'][$match_this_idx][$match_grabbed_key] = 
$filter_X[$filter_X_key];
!                                               }
!                       /*!
!                       @capability multidimentional filter data for Actions 
!                       @discussion  extract multidimentional filter data 
embedded in this 1 dimentional array. 
!                       php3 limits POST arrays to one level of array key,value 
pairs. 
!                       Thus complex filtering instructions are containded in 
special strings submitted as controls names 
!                       action instructions willlook something like this 
example.
!                       @author Angles
!                       @example * the "key" string "action_1_judgement" needs 
to be "decompressed" into an associative array 
!                       $filter_X ['action_1_judgement'] => 'fileinto' 
!                       * the string means this 
!                       a: we are dealing with "action" instructions 
!                       b: when this data is "decompressed" this would be 
action[1] data 
!                       c: that this should be action[1] ["judgement"] where 
"judgement" is the key, and 
!                       d: that value of this action[1] ["judgement"] = 
"fileinto" 
!                                               */
!                                               elseif (strstr($filter_X_key, 
'action_'))
!                                               {
!                                                       // now we grab the 
index value from the key string
!                                                       $action_this_idx = 
(int)$filter_X_key[7];
!                                                       if ($this->debug_level 
> 1) { echo 'mail_filters: distill_filter_args: action_this_idx grabbed value: 
['.$action_this_idx.']<br>'; }
!                                                       // grab "key" that 
comes after that match_this_idx we just got
!                                                       // remember "substr" 
uses 1 as the first letter in a string, not 0, AND starts returning the letter 
AFTER the specified location
!                                                       $action_grabbed_key = 
substr($filter_X_key, 9);
!                                                       if ($this->debug_level 
> 1) { echo 'mail_filters: distill_filter_args: action_grabbed_key value: 
['.$action_grabbed_key.']<br>'; }
!                                                       
$this->filters[$this_idx]['actions'][$action_this_idx][$action_grabbed_key] = 
$filter_X[$filter_X_key];
!                                               }
!                                       }
!                               }
!                       }
!                       if ($this->debug_level > 0) { echo 'mail_filters: 
distill_filter_args: this->filters[] dump <strong><pre>'; 
print_r($this->filters); echo "</pre></strong>\r\n"; }
!               }
! 
!               /*!
!               @function sieve_to_imap_string
!               @abstract ? 
!               @author Angles
!               */
!               function sieve_to_imap_string()
!               {
!                       if ($this->debug_level > 2) { echo 'mail_filters: 
sieve_to_imap_string: mappings are:<pre>'; 
print_r($this->sieve_to_imap_fields); echo "</pre>\r\n"; }
!                       $look_here_sieve = 
$this->filters[0]['matches'][0]['examine'];
!                       $look_here_imap = 
$this->sieve_to_imap_fields[$look_here_sieve];
!                       $for_this = 
$this->filters[0]['matches'][0]['matchthis'];
!                       
!                       $conv_error = '';
!                       if ((!isset($look_here_sieve))
!                       || (trim($look_here_sieve) == '')
!                       || ($look_here_imap == ''))
!                       {
!                               $conv_error = 'invalid or no examine data';
!                               if ($this->debug_level > 0) { echo '<b> *** 
error</b>: mail_filters: sieve_to_imap_string: error: '.$conv_error."<br> 
\r\n"; }
!                               return '';
!                       }
!                       elseif ((!isset($for_this))
!                       || (trim($for_this) == ''))
!                       {
!                               $conv_error = 'invalid or no search string 
data';
!                               if ($this->debug_level > 0) { echo '<b> *** 
error</b>: mail_filters: sieve_to_imap_string: error: '.$conv_error."<br> 
\r\n"; }
!                               return '';
!                       }
!                       
!                       $imap_str = $look_here_imap.' "'.$for_this.'"';
!                       if ($this->debug_level > 0) { echo 'mail_filters: 
sieve_to_imap_string: string is: '.$imap_str."<br>\r\n"; }
!                       return $imap_str;
!               }
! 
!               
!               /*!
!               @function do_imap_search
!               @abstract ? 
!               @author Angles
!               */
!               function do_imap_search()
!               {
!                       $imap_search_str = $this->sieve_to_imap_string();
!                       if (!$imap_search_str)
!                       {
!                               if ($this->debug_level > 0) { echo '<b> *** 
error</b>: mail_filters: do_imap_search: sieve_to_imap_string returned 
empty<br>'."\r\n"; }
!                               return array();
!                       }
!                       
!                       // make sure we have msg object
!                       //$this->msg_bootstrap = 
CreateObject("email.msg_bootstrap");
!                       
//$this->msg_bootstrap->ensure_mail_msg_exists('email.bofilters.do_imap_search',
 $this->debug_level);
!                       // need to replace below code with this bootstrap code
!                       
!                       
!                       //$attempt_reuse = True;
!                       $attempt_reuse = False;
!                       if (!is_object($GLOBALS['phpgw']->msg))
!                       {
!                               $GLOBALS['phpgw']->msg = 
CreateObject("email.mail_msg");
!                       }
!                       
!                       if ((is_object($GLOBALS['phpgw']->msg))
!                       && ($attempt_reuse == True))
!                       {
!                               // no not create, we will reuse existing
!                               echo 'mail_filters: do_imap_search: reusing 
existing mail_msg object'.'<br>';
!                               // we need to feed the existing object some 
params begin_request uses to re-fill the msg->args[] data
!                               $reuse_feed_args = 
$GLOBALS['phpgw']->msg->get_all_args();
!                               $args_array = Array();
!                               $args_array = $reuse_feed_args;
!                               if ((isset($this->filters[0]['source_folder']))
!                               && ($this->filters[0]['source_folder'] != ''))
!                               {
!                                       if ($this->debug_level > 0) { echo 
'mail_filters: do_imap_search: this->filters[0][source_folder] = ' 
.$this->filters[0]['source_folder'].'<br>'."\r\n"; }
!                                       $args_array['folder'] = 
$this->filters[0]['source_folder'];
!                               }
!                               else
!                               {
!                                       $args_array['folder'] = 'INBOX';
!                               }
!                               // add this to keep the error checking code 
(below) happy
!                               $args_array['do_login'] = True;
!                       }
!                       else
!                       {
!                               if ($this->debug_index_data == True) { echo 
'mail_filters: do_imap_search: creating new login email.mail_msg, cannot or not 
trying to reusing existing'.'<br>'; }
!                               // new login 
!                               // (1) folder (if specified) - can be left 
empty or unset, mail_msg will then assume INBOX
!                               $args_array = Array();
!                               if ((isset($this->filters[0]['source_folder']))
!                               && ($this->filters[0]['source_folder'] != ''))
!                               {
!                                       if ($this->debug_level > 0) { echo 
'mail_filters: do_imap_search: this->filters[0][source_folder] = ' 
.$this->filters[0]['source_folder'].'<br>'."\r\n"; }
!                                       $args_array['folder'] = 
$this->filters[0]['source_folder'];
!                               }
!                               else
!                               {
!                                       $args_array['folder'] = 'INBOX';
!                               }
!                               // (2) should we log in
!                               $args_array['do_login'] = True;
!                       }
! 
! 
!                       /*
!                       //$GLOBALS['phpgw']->msg = 
CreateObject("email.mail_msg");
!                       $args_array = Array();
!                       if ((isset($this->filters[0]['source_folder']))
!                       && ($this->filters[0]['source_folder'] != ''))
!                       {
!                               if ($this->debug_level > 0) { echo 
'mail_filters: do_imap_search: this->filters[0][source_folder] = ' 
.$this->filters[0]['source_folder'].'<br>'."\r\n"; }
!                               $args_array['folder'] = 
$this->filters[0]['source_folder'];
!                       }
!                       else
!                       {
!                               $args_array['folder'] = 'INBOX';
!                       }
!                       
!                       $args_array['do_login'] = True;
!                       */
!                       
!                       $GLOBALS['phpgw']->msg->begin_request($args_array);
!                       
!                       $initial_result_set = Array();
!                       $initial_result_set = 
$GLOBALS['phpgw']->msg->phpgw_search($imap_search_str);
!                       // sanity check on 1 returned hit, is it for real?
!                       if (($initial_result_set == False)
!                       || (count($initial_result_set) == 0))
!                       {
!                               echo 'mail_filters: do_imap_search: no hits or 
possible search error<br>'."\r\n";
!                               echo 'mail_filters: do_imap_search: 
server_last_error (if any) was: 
"'.$GLOBALS['phpgw']->msg->phpgw_server_last_error().'"'."\r\n";
!                               // we leave this->result_set_mlist an an empty 
array, as it was initialized on class creation
!                       }
!                       else
!                       {
!                               $this->result_set = $initial_result_set;
!                               if ($this->debug_level > 0) { echo 
'mail_filters: do_imap_search: number of matches = ' 
.count($this->result_set).'<br>'."\r\n"; }
!                               // make a "fake" folder_info array to make 
things simple for get_msg_list_display
!                               $this->fake_folder_info['is_imap'] = True;
!                               $this->fake_folder_info['folder_checked'] = 
$GLOBALS['phpgw']->msg->get_arg_value('folder');
!                               $this->fake_folder_info['alert_string'] = 'you 
have search results';
!                               $this->fake_folder_info['number_new'] = 
count($this->result_set);
!                               $this->fake_folder_info['number_all'] = 
count($this->result_set);
!                               // retrieve user displayable data for each 
message in the result set
!                               $this->result_set_mlist = 
$GLOBALS['phpgw']->msg->get_msg_list_display($this->fake_folder_info,$this->result_set);
!                       }
!                       $GLOBALS['phpgw']->msg->end_request();
!                       //echo 'mail_filters: do_imap_search: returned:<br>'; 
var_dump($this->result_set); echo "<br>\r\n";
!               }
! 
!               /*!
!               @function make_mlist_box
!               @abstract ?
!               @author Angles
!               */
!               function make_mlist_box()
!               {
!                       $this->template = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
!                       $this->template->set_file(array(                
!                               'T_index_blocks' => 'index_blocks.tpl'
!                       ));
!                       
$this->template->set_block('T_index_blocks','B_mlist_form_init','V_mlist_form_init');
!                       
$this->template->set_block('T_index_blocks','B_arrows_form_table','V_arrows_form_table');
!                       
$this->template->set_block('T_index_blocks','B_mlist_block','V_mlist_block');
!                       
$this->template->set_block('T_index_blocks','B_mlist_submit_form','V_mlist_submit_form');
!                       
!                       $tpl_vars = Array(
!                               'mlist_font'            => 
$GLOBALS['phpgw_info']['theme']['font'],
!                               'mlist_font_size'       => '2',
!                               'mlist_font_size_sm'    => '1',
!                               'V_mlist_form_init'     => ''
!                       );
!                       $this->template->set_var($tpl_vars);
!                       
!                       if (count($this->result_set_mlist) == 0)
!                       {
!                               $this->template->set_var('V_mlist_block','');   
                        
!                       }
!                       else
!                       {
!                               $this->template->set_var('V_no_messages','');   
                        
!                               
$this->template->set_var('mlist_attach','&nbsp;');
!                               for ($i=0; $i < count($this->result_set_mlist); 
$i++)
!                               {
!                                       if 
($this->result_set_mlist[$i]['is_unseen'])
!                                       {
!                                               
$this->template->set_var('open_newbold','<strong>');
!                                               
$this->template->set_var('close_newbold','</strong>');
!                                       }
!                                       else
!                                       {
!                                               
$this->template->set_var('open_newbold','');
!                                               
$this->template->set_var('close_newbold','');
!                                       }
!                                       $tpl_vars = Array(
!                                               'mlist_msg_num'         => 
$this->result_set_mlist[$i]['msg_num'],
!                                               'mlist_backcolor'       => 
$this->result_set_mlist[$i]['back_color'],
!                                               'mlist_subject'         => 
$this->result_set_mlist[$i]['subject'],
!                                               'mlist_subject_link'    => 
$this->result_set_mlist[$i]['subject_link'],
!                                               'mlist_from'            => 
$this->result_set_mlist[$i]['from_name'],
!                                               'mlist_from_extra'      => 
$this->result_set_mlist[$i]['display_address_from'],
!                                               'mlist_reply_link'      => 
$this->result_set_mlist[$i]['from_link'],
!                                               'mlist_date'            => 
$this->result_set_mlist[$i]['msg_date'],
!                                               'mlist_size'            => 
$this->result_set_mlist[$i]['size']
!                                       );
!                                       $this->template->set_var($tpl_vars);
!                                       
$this->template->parse('V_mlist_block','B_mlist_block',True);
!                               }
!                               $this->finished_mlist = 
$this->template->get_var('V_mlist_block');
!                               
!                               // MAKE SUBMIT TO MLIST FORM
!                               // make the voluminous MLIST hidden vars array
!                               $mlist_hidden_vars = '';
!                               for ($i=0; $i < count($this->result_set); $i++)
!                               {
!                                       $this_msg_num = 
(string)$this->result_set[$i];
!                                       $mlist_hidden_vars .= '<input 
type="hidden" name="mlist_set['.(string)$i.']" 
value="'.$this_msg_num.'">'."\r\n";
!                               }
!                               // preserve the folder we searched (raw posted 
source_folder was never preped in here, so it's ok to send out as is)
!                               $mlist_hidden_vars .= '<input type="hidden" 
name="folder" value="'.$this->filters[0]['source_folder'].'">'."\r\n";
!                               // make the first prev next last arrows
!                               
$this->template->set_var('mlist_submit_form_action', 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.mlist'));
!                               
$this->template->set_var('mlist_hidden_vars',$mlist_hidden_vars);
!                               
$this->template->parse('V_mlist_submit_form','B_mlist_submit_form');
!                               
!                               $this->submit_mlist_to_class_form = 
$this->template->get_var('V_mlist_submit_form');
!                       }
!                       
!               }
!               
!               
!       
!       // end of class
!       }
! ?>
--- 1,392 ----
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Filters                                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * Copyright (C) 2001, 2002 Angelo Puglisi (Angles)                      
                *
!       * -----------------------------------------------                       
                                *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       /*!
!       @class mail_filters
!       @abstract ?
!       @author Angles
!       */
!       class mail_filters
!       {
!               var $filters = Array();
!               var $template = '';
!               var $finished_mlist = '';
!               var $submit_mlist_to_class_form = '';
!               var $submit_flag = '';
!               //var $debug_level = 0;
!               var $debug_level = 1;
!               //var $debug_level = 2;
!               var $sieve_to_imap_fields=array();
!               var $result_set = Array();
!               var $result_set_mlist = Array();
!               var $fake_folder_info = array();
!               
!               /*!
!               @function mail_filters
!               @abstract constructor
!               @author Angles
!               */
!               function mail_filters()
!               {
!                       $this->sieve_to_imap_fields = Array(
!                               'from'          => 'FROM',
!                               'to'            => 'TO',
!                               'cc'            => 'CC',
!                               'bcc'           => 'BCC',
!                               'recipient'     => 'FIX_ME: TO or CC or BCC',
!                               'sender'        => 'SEARCHHEADER SENDER',
!                               'subject'       => 'SUBJECT',
!                               'header'        => 'FIX_ME SEARCHHEADER FIX_ME',
!                               'size_larger'   => 'LARGER',
!                               'size_smaller'  => 'SMALLER',
!                               'allmessages'   => 'FIX_ME (matches all 
messages)',
!                               'body'          => 'BODY'
!                       );
!               }
!               
!               /*!
!               @function distill_filter_args
!               @abstract ?
!               @author Angles
!               */
!               function distill_filter_args()
!               {
!                       // do we have data
!                       if  
(!isset($GLOBALS['HTTP_POST_VARS'][$this->submit_flag]))
!                       {
!                               if ($this->debug_level > 0) { echo 
'mail_filters: distill_filter_args: NO data submitted<br>'."\r\n"; }
!                               return Array();
!                       }
!                       
!                       // look for top level "filter_X" array
!                       while(list($key,$value) = 
each($GLOBALS['HTTP_POST_VARS']))
!                       {
!                               if (strstr($key, 'filter_'))
!                               {
!                                       // put the raw data dor this particular 
filter into a local var
!                                       $filter_X = 
$GLOBALS['HTTP_POST_VARS'][$key];
!                                       if ($this->debug_level > 0) { echo 
'mail_filters: distill_filter_args: filter_X dump <strong><pre>'; 
print_r($filter_X); echo "</pre></strong>\r\n"; }
!                                       
!                                       // prepare to fill your structured array
!                                       $this_idx = count($this->filters);
!                                       // grab the "filter name" associated 
with this data
!                                       $this->filters[$this_idx]['filtername'] 
= $filter_X['filtername'];
!                                       // what folder so we search
!                                       
$this->filters[$this_idx]['source_folder'] = $filter_X['source_folder'];
!                                       // init sub arrays
!                                       $this->filters[$this_idx]['matches'] = 
Array();
!                                       $this->filters[$this_idx]['actions'] = 
Array();
!                                       // extract match and action data from 
this filter_X data array
!                                       
while(list($filter_X_key,$filter_X_value) = each($filter_X))
!                                       {
!                       /*!
!                       @capability multidimentional filter data for Matching
!                       @author Angles
!                       @discussion extract multidimentional filter data 
embedded in this 1 dimentional array. 
!                       php3 limits POST arrays to one level of array key,value 
pairs. 
!                       Thus complex filtering instructions are containded in 
special strings submitted as controls names 
!                       matching instructions willlook something like this 
example. 
!                       @syntax * the "key" string "match_0_comparator" needs 
to be "decompressed" into an associative array
!                       $filter_X ['match_0_comparator'] => 'contains'
!                       * the string means this:
!                       a: we are dealing with "match" data
!                       b: when this data is "decompressed" this would be 
match[0] data
!                       c: that this should be match[0] ["comparator"] where 
"comparator" is the key, and
!                       d: that value of this match[0]["comparator"] = 
"contains"
!                       * thus, we are looking at a match to see if something 
"contains" a string that will be described in the next key,value iteration
!                       * such string may look like this in its raw form
!                       [match_0_matchthis] => "@spammer.com"
!                       * translates to this
!                       match[0]["matchthis"] = "@spammer.com"
!                                               */
!                                               if (strstr($filter_X_key, 
'match_'))
!                                               {
!                                                       // now we grab the 
index value from the key string
!                                                       $match_this_idx = 
(int)$filter_X_key[6];
!                                                       if ($this->debug_level 
> 1) { echo 'mail_filters: distill_filter_args: match_this_idx grabbed value: 
['.$match_this_idx.']<br>'; }
!                                                       // grab "key" that 
comes after that match_this_idx we just got
!                                                       // remember "substr" 
uses 1 as the first letter in a string, not 0, AND starts returning the letter 
AFTER the specified location
!                                                       $match_grabbed_key = 
substr($filter_X_key, 8);
!                                                       if ($this->debug_level 
> 1) { echo 'mail_filters: distill_filter_args: match_grabbed_key value: 
['.$match_grabbed_key.']<br>'; }
!                                                       
$this->filters[$this_idx]['matches'][$match_this_idx][$match_grabbed_key] = 
$filter_X[$filter_X_key];
!                                               }
!                       /*!
!                       @capability multidimentional filter data for Actions 
!                       @discussion  extract multidimentional filter data 
embedded in this 1 dimentional array. 
!                       php3 limits POST arrays to one level of array key,value 
pairs. 
!                       Thus complex filtering instructions are containded in 
special strings submitted as controls names 
!                       action instructions willlook something like this 
example.
!                       @author Angles
!                       @example * the "key" string "action_1_judgement" needs 
to be "decompressed" into an associative array 
!                       $filter_X ['action_1_judgement'] => 'fileinto' 
!                       * the string means this 
!                       a: we are dealing with "action" instructions 
!                       b: when this data is "decompressed" this would be 
action[1] data 
!                       c: that this should be action[1] ["judgement"] where 
"judgement" is the key, and 
!                       d: that value of this action[1] ["judgement"] = 
"fileinto" 
!                                               */
!                                               elseif (strstr($filter_X_key, 
'action_'))
!                                               {
!                                                       // now we grab the 
index value from the key string
!                                                       $action_this_idx = 
(int)$filter_X_key[7];
!                                                       if ($this->debug_level 
> 1) { echo 'mail_filters: distill_filter_args: action_this_idx grabbed value: 
['.$action_this_idx.']<br>'; }
!                                                       // grab "key" that 
comes after that match_this_idx we just got
!                                                       // remember "substr" 
uses 1 as the first letter in a string, not 0, AND starts returning the letter 
AFTER the specified location
!                                                       $action_grabbed_key = 
substr($filter_X_key, 9);
!                                                       if ($this->debug_level 
> 1) { echo 'mail_filters: distill_filter_args: action_grabbed_key value: 
['.$action_grabbed_key.']<br>'; }
!                                                       
$this->filters[$this_idx]['actions'][$action_this_idx][$action_grabbed_key] = 
$filter_X[$filter_X_key];
!                                               }
!                                       }
!                               }
!                       }
!                       if ($this->debug_level > 0) { echo 'mail_filters: 
distill_filter_args: this->filters[] dump <strong><pre>'; 
print_r($this->filters); echo "</pre></strong>\r\n"; }
!               }
! 
!               /*!
!               @function sieve_to_imap_string
!               @abstract ? 
!               @author Angles
!               */
!               function sieve_to_imap_string()
!               {
!                       if ($this->debug_level > 2) { echo 'mail_filters: 
sieve_to_imap_string: mappings are:<pre>'; 
print_r($this->sieve_to_imap_fields); echo "</pre>\r\n"; }
!                       $look_here_sieve = 
$this->filters[0]['matches'][0]['examine'];
!                       $look_here_imap = 
$this->sieve_to_imap_fields[$look_here_sieve];
!                       $for_this = 
$this->filters[0]['matches'][0]['matchthis'];
!                       
!                       $conv_error = '';
!                       if ((!isset($look_here_sieve))
!                       || (trim($look_here_sieve) == '')
!                       || ($look_here_imap == ''))
!                       {
!                               $conv_error = 'invalid or no examine data';
!                               if ($this->debug_level > 0) { echo '<b> *** 
error</b>: mail_filters: sieve_to_imap_string: error: '.$conv_error."<br> 
\r\n"; }
!                               return '';
!                       }
!                       elseif ((!isset($for_this))
!                       || (trim($for_this) == ''))
!                       {
!                               $conv_error = 'invalid or no search string 
data';
!                               if ($this->debug_level > 0) { echo '<b> *** 
error</b>: mail_filters: sieve_to_imap_string: error: '.$conv_error."<br> 
\r\n"; }
!                               return '';
!                       }
!                       
!                       $imap_str = $look_here_imap.' "'.$for_this.'"';
!                       if ($this->debug_level > 0) { echo 'mail_filters: 
sieve_to_imap_string: string is: '.$imap_str."<br>\r\n"; }
!                       return $imap_str;
!               }
! 
!               
!               /*!
!               @function do_imap_search
!               @abstract ? 
!               @author Angles
!               */
!               function do_imap_search()
!               {
!                       $imap_search_str = $this->sieve_to_imap_string();
!                       if (!$imap_search_str)
!                       {
!                               if ($this->debug_level > 0) { echo '<b> *** 
error</b>: mail_filters: do_imap_search: sieve_to_imap_string returned 
empty<br>'."\r\n"; }
!                               return array();
!                       }
!                       
!                       // make sure we have msg object
!                       //$this->msg_bootstrap = 
CreateObject("email.msg_bootstrap");
!                       
//$this->msg_bootstrap->ensure_mail_msg_exists('email.bofilters.do_imap_search',
 $this->debug_level);
!                       // need to replace below code with this bootstrap code
!                       
!                       
!                       //$attempt_reuse = True;
!                       $attempt_reuse = False;
!                       if (!is_object($GLOBALS['phpgw']->msg))
!                       {
!                               $GLOBALS['phpgw']->msg = 
CreateObject("email.mail_msg");
!                       }
!                       
!                       if ((is_object($GLOBALS['phpgw']->msg))
!                       && ($attempt_reuse == True))
!                       {
!                               // no not create, we will reuse existing
!                               echo 'mail_filters: do_imap_search: reusing 
existing mail_msg object'.'<br>';
!                               // we need to feed the existing object some 
params begin_request uses to re-fill the msg->args[] data
!                               $reuse_feed_args = 
$GLOBALS['phpgw']->msg->get_all_args();
!                               $args_array = Array();
!                               $args_array = $reuse_feed_args;
!                               if ((isset($this->filters[0]['source_folder']))
!                               && ($this->filters[0]['source_folder'] != ''))
!                               {
!                                       if ($this->debug_level > 0) { echo 
'mail_filters: do_imap_search: this->filters[0][source_folder] = ' 
.$this->filters[0]['source_folder'].'<br>'."\r\n"; }
!                                       $args_array['folder'] = 
$this->filters[0]['source_folder'];
!                               }
!                               else
!                               {
!                                       $args_array['folder'] = 'INBOX';
!                               }
!                               // add this to keep the error checking code 
(below) happy
!                               $args_array['do_login'] = True;
!                       }
!                       else
!                       {
!                               if ($this->debug_index_data == True) { echo 
'mail_filters: do_imap_search: creating new login email.mail_msg, cannot or not 
trying to reusing existing'.'<br>'; }
!                               // new login 
!                               // (1) folder (if specified) - can be left 
empty or unset, mail_msg will then assume INBOX
!                               $args_array = Array();
!                               if ((isset($this->filters[0]['source_folder']))
!                               && ($this->filters[0]['source_folder'] != ''))
!                               {
!                                       if ($this->debug_level > 0) { echo 
'mail_filters: do_imap_search: this->filters[0][source_folder] = ' 
.$this->filters[0]['source_folder'].'<br>'."\r\n"; }
!                                       $args_array['folder'] = 
$this->filters[0]['source_folder'];
!                               }
!                               else
!                               {
!                                       $args_array['folder'] = 'INBOX';
!                               }
!                               // (2) should we log in
!                               $args_array['do_login'] = True;
!                       }
! 
! 
!                       /*
!                       //$GLOBALS['phpgw']->msg = 
CreateObject("email.mail_msg");
!                       $args_array = Array();
!                       if ((isset($this->filters[0]['source_folder']))
!                       && ($this->filters[0]['source_folder'] != ''))
!                       {
!                               if ($this->debug_level > 0) { echo 
'mail_filters: do_imap_search: this->filters[0][source_folder] = ' 
.$this->filters[0]['source_folder'].'<br>'."\r\n"; }
!                               $args_array['folder'] = 
$this->filters[0]['source_folder'];
!                       }
!                       else
!                       {
!                               $args_array['folder'] = 'INBOX';
!                       }
!                       
!                       $args_array['do_login'] = True;
!                       */
!                       
!                       $GLOBALS['phpgw']->msg->begin_request($args_array);
!                       
!                       $initial_result_set = Array();
!                       $initial_result_set = 
$GLOBALS['phpgw']->msg->phpgw_search($imap_search_str);
!                       // sanity check on 1 returned hit, is it for real?
!                       if (($initial_result_set == False)
!                       || (count($initial_result_set) == 0))
!                       {
!                               echo 'mail_filters: do_imap_search: no hits or 
possible search error<br>'."\r\n";
!                               echo 'mail_filters: do_imap_search: 
server_last_error (if any) was: 
"'.$GLOBALS['phpgw']->msg->phpgw_server_last_error().'"'."\r\n";
!                               // we leave this->result_set_mlist an an empty 
array, as it was initialized on class creation
!                       }
!                       else
!                       {
!                               $this->result_set = $initial_result_set;
!                               if ($this->debug_level > 0) { echo 
'mail_filters: do_imap_search: number of matches = ' 
.count($this->result_set).'<br>'."\r\n"; }
!                               // make a "fake" folder_info array to make 
things simple for get_msg_list_display
!                               $this->fake_folder_info['is_imap'] = True;
!                               $this->fake_folder_info['folder_checked'] = 
$GLOBALS['phpgw']->msg->get_arg_value('folder');
!                               $this->fake_folder_info['alert_string'] = 'you 
have search results';
!                               $this->fake_folder_info['number_new'] = 
count($this->result_set);
!                               $this->fake_folder_info['number_all'] = 
count($this->result_set);
!                               // retrieve user displayable data for each 
message in the result set
!                               $this->result_set_mlist = 
$GLOBALS['phpgw']->msg->get_msg_list_display($this->fake_folder_info,$this->result_set);
!                       }
!                       $GLOBALS['phpgw']->msg->end_request();
!                       //echo 'mail_filters: do_imap_search: returned:<br>'; 
var_dump($this->result_set); echo "<br>\r\n";
!               }
! 
!               /*!
!               @function make_mlist_box
!               @abstract ?
!               @author Angles
!               */
!               function make_mlist_box()
!               {
!                       $this->template = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
!                       $this->template->set_file(array(                
!                               'T_index_blocks' => 'index_blocks.tpl'
!                       ));
!                       
$this->template->set_block('T_index_blocks','B_mlist_form_init','V_mlist_form_init');
!                       
$this->template->set_block('T_index_blocks','B_arrows_form_table','V_arrows_form_table');
!                       
$this->template->set_block('T_index_blocks','B_mlist_block','V_mlist_block');
!                       
$this->template->set_block('T_index_blocks','B_mlist_submit_form','V_mlist_submit_form');
!                       
!                       $tpl_vars = Array(
!                               'mlist_font'            => 
$GLOBALS['phpgw_info']['theme']['font'],
!                               'mlist_font_size'       => '2',
!                               'mlist_font_size_sm'    => '1',
!                               'V_mlist_form_init'     => ''
!                       );
!                       $this->template->set_var($tpl_vars);
!                       
!                       if (count($this->result_set_mlist) == 0)
!                       {
!                               $this->template->set_var('V_mlist_block','');   
                        
!                       }
!                       else
!                       {
!                               $this->template->set_var('V_no_messages','');   
                        
!                               
$this->template->set_var('mlist_attach','&nbsp;');
!                               for ($i=0; $i < count($this->result_set_mlist); 
$i++)
!                               {
!                                       if 
($this->result_set_mlist[$i]['is_unseen'])
!                                       {
!                                               
$this->template->set_var('open_newbold','<strong>');
!                                               
$this->template->set_var('close_newbold','</strong>');
!                                       }
!                                       else
!                                       {
!                                               
$this->template->set_var('open_newbold','');
!                                               
$this->template->set_var('close_newbold','');
!                                       }
!                                       $tpl_vars = Array(
!                                               'mlist_msg_num'         => 
$this->result_set_mlist[$i]['msg_num'],
!                                               'mlist_backcolor'       => 
$this->result_set_mlist[$i]['back_color'],
!                                               'mlist_subject'         => 
$this->result_set_mlist[$i]['subject'],
!                                               'mlist_subject_link'    => 
$this->result_set_mlist[$i]['subject_link'],
!                                               'mlist_from'            => 
$this->result_set_mlist[$i]['from_name'],
!                                               'mlist_from_extra'      => 
$this->result_set_mlist[$i]['display_address_from'],
!                                               'mlist_reply_link'      => 
$this->result_set_mlist[$i]['from_link'],
!                                               'mlist_date'            => 
$this->result_set_mlist[$i]['msg_date'],
!                                               'mlist_size'            => 
$this->result_set_mlist[$i]['size']
!                                       );
!                                       $this->template->set_var($tpl_vars);
!                                       
$this->template->parse('V_mlist_block','B_mlist_block',True);
!                               }
!                               $this->finished_mlist = 
$this->template->get_var('V_mlist_block');
!                               
!                               // MAKE SUBMIT TO MLIST FORM
!                               // make the voluminous MLIST hidden vars array
!                               $mlist_hidden_vars = '';
!                               for ($i=0; $i < count($this->result_set); $i++)
!                               {
!                                       $this_msg_num = 
(string)$this->result_set[$i];
!                                       $mlist_hidden_vars .= '<input 
type="hidden" name="mlist_set['.(string)$i.']" 
value="'.$this_msg_num.'">'."\r\n";
!                               }
!                               // preserve the folder we searched (raw posted 
source_folder was never preped in here, so it's ok to send out as is)
!                               $mlist_hidden_vars .= '<input type="hidden" 
name="folder" value="'.$this->filters[0]['source_folder'].'">'."\r\n";
!                               // make the first prev next last arrows
!                               
$this->template->set_var('mlist_submit_form_action', 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.mlist'));
!                               
$this->template->set_var('mlist_hidden_vars',$mlist_hidden_vars);
!                               
$this->template->parse('V_mlist_submit_form','B_mlist_submit_form');
!                               
!                               $this->submit_mlist_to_class_form = 
$this->template->get_var('V_mlist_submit_form');
!                       }
!                       
!               }
!               
!               
!       
!       // end of class
!       }
! ?>

Index: class.mail_msg.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_msg.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.mail_msg.inc.php      25 Oct 2002 12:45:53 -0000      1.3
--- class.mail_msg.inc.php      14 Mar 2003 04:00:55 -0000      1.4
***************
*** 1,34 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare - E-Mail Message Processing Functions                        
     *
!   * http://www.phpgroupware.org                                              *
!   */
!   /**************************************************************************\
!   * phpGroupWare API - E-Mail Message Processing Functions                    
     *
!   * This file written by Angelo Tony Puglisi (Angles) <address@hidden>      *
!   * Handles specific operations in manipulating email messages                
         *
!   * Copyright (C) 2001 Angelo Tony Puglisi (Angles)                           
                *
!   * -------------------------------------------------------------------------*
!   * This library is part of the phpGroupWare API                             *
!   * http://www.phpgroupware.org/api                                          
* 
!   * ------------------------------------------------------------------------ *
!   * This library is free software; you can redistribute it and/or modify it  *
!   * under the terms of the GNU Lesser General Public License as published by *
!   * the Free Software Foundation; either version 2.1 of the License,         *
!   * or any later version.                                                    *
!   * This library is distributed in the hope that it will be useful, but      *
!   * WITHOUT ANY WARRANTY; without even the implied warranty of               *
!   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
!   * See the GNU Lesser General Public License for more details.              *
!   * You should have received a copy of the GNU Lesser General Public License *
!   * along with this library; if not, write to the Free Software Foundation,  *
!   * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
!   \**************************************************************************/
! 
!   /* $Id$ */
! 
!       include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_msg_base.inc.php');
!       
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_msg_wrappers.inc.php');
!       include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_msg_display.inc.php');
! 
! ?>
--- 1,32 ----
! <?php
! /**************************************************************************\
! * AngleMail   http://www.anglemail.org                                        
                        *
! */
! /**************************************************************************\
! * AngleMail - E-Mail Message Processing Core Functions                        
                *
! * This file written by Angelo "Angles" Puglisi <address@hidden>       *
! * Copyright (C) 2001-2003 Angelo "Angles" Puglisi                             
                *
! * -------------------------------------------------------------------------   
                                        *
! * This file designed to work as part of a drop in module for phpGroupWare     
        *
! * http://www.phpgroupware.org                                                 
                * 
! * ------------------------------------------------------------------------    
                                        *
! * This library is free software; you can redistribute it and/or modify it     
        *
! * under the terms of the GNU Lesser General Public License as published by    
*
! * the Free Software Foundation; either version 2.1 of the License,            
        *
! * or any later version.                                                       
                                *
! * This library is distributed in the hope that it will be useful, but         
        *
! * WITHOUT ANY WARRANTY; without even the implied warranty of          *
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                *
! * See the GNU Lesser General Public License for more details.                 
        *
! * You should have received a copy of the GNU Lesser General Public License    
*
! * along with this library; if not, write to the Free Software Foundation,     
        *
! * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               
        *
! \**************************************************************************/
! 
!   /* $Id$ */
! 
!       
include_once(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_msg_base.inc.php');
!       
include_once(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_msg_wrappers.inc.php');
!       
include_once(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_msg_display.inc.php');
! 
! ?>

Index: class.mail_msg_base.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_msg_base.inc.php,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -r1.77 -r1.78
*** class.mail_msg_base.inc.php 16 Nov 2002 23:13:49 -0000      1.77
--- class.mail_msg_base.inc.php 14 Mar 2003 04:00:55 -0000      1.78
***************
*** 1,5346 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail     http://www.anglemail.org                                
                                *
!       */
!       
/**************************************************************************\
!       * AngleMail - E-Mail Message Processing Core Functions                  
                *
!       * This file written by Angelo "Angles" Puglisi <address@hidden> *
!       * Copyright (C) 2001-2002 Angelo "Angles" Puglisi                       
                        *
!       * 
-------------------------------------------------------------------------       
              *
!       * Originally Based on Aeromail by Mark Cushman <address@hidden>         
*
[...11039 lines suppressed...]
!                       }
!                       else
!                       {
!                               $width_tag = '';
!                       }
!                       if ($border != '')
!                       {
!                               $border_tag = ' border="' .$border .'"';
!                       }
!                       else
!                       {
!                               $border_tag = '';
!                       }
!                       $image_html = '<img src="'.$location.'"' .$height_tag 
.$width_tag .$border_tag .$alt_tag .'>';
!                       return $image_html;
!               }
!       
!       }
!       // end of class mail_msg
! ?>

Index: class.mail_msg_display.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_msg_display.inc.php,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** class.mail_msg_display.inc.php      16 Nov 2002 23:13:50 -0000      1.39
--- class.mail_msg_display.inc.php      14 Mar 2003 04:00:55 -0000      1.40
***************
*** 1,2446 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail     http://www.anglemail.org                                
                                *
!       */
!       
/**************************************************************************\
!       * AngleMail - E-Mail Message Processing Functions for MIME and Display  
*
!       * This file written by Angelo "Angles" Puglisi <address@hidden> *
!       * Copyright (C) 2001-2002 Angelo "Angles" Puglisi                       
                        *
!       * 
-------------------------------------------------------------------------       
              *
!       * This file designed to work as part of a drop in module for 
phpGroupWare               *
[...5202 lines suppressed...]
!       @discussion Email themes have a group of similar looking images grouped 
into a directory with 
!       somewhat standard names that AngleMail understands as a themed image 
set. phpgwapi does not 
!       currently support subdirectories under the template images directory. 
Params are only to match the 
!       phpgw api function, we do not really use them. As of this writting, Feb 
2003, images used for all themes, 
!       i.e. are not in a theme subdir but are used, are check and attach on 
the index page, they are not even 
!       sized, and, these are sized but not themed, on the message view page, 
are view_nofmt, view_formatted, 
!       view_headers, view_raw, and view_printable. Remember if these are 
themed they must be moved 
!       into the subdirs, all of them, even if they are copies, and removed 
from the main images dir, so it is 
!       obvious if they are group themed or not. 
!       @author Angles
!       */
!       function _image_on($appname,$image,$extension='_on',$navbar=False)
!       {
!               //$prefer_ext = '.gif';
!               $prefer_ext = '.png';
!               return 
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/templates/default/images'.'/'.$image.$prefer_ext;
!       }
! 
! } // end class mail_msg
! ?>

Index: class.mail_msg_wrappers.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_msg_wrappers.inc.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** class.mail_msg_wrappers.inc.php     6 Dec 2002 23:15:50 -0000       1.36
--- class.mail_msg_wrappers.inc.php     14 Mar 2003 04:01:03 -0000      1.37
***************
*** 1,4680 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Message Processing Functions                       
        *
!       * http://www.anglemail.org                                              
                        *
!       * http://www.phpgroupware.org                                           
                        *
!       */
!       
/**************************************************************************\
!       * AngleMail - E-Mail Message Processing Functions                       
                *
!       * This file written by Angelo Puglisi (Angles) <address@hidden> *
!       * Handles specific operations in manipulating email messages            
        *
[...10121 lines suppressed...]
!               // depreciated
!               //function get_folder($acctnum='')
!               //{
!               //      return $this->get_arg_value('folder');
!               //}
!               
!               // depreciated
!               //function get_msgnum($acctnum='')
!               //{
!               //      return $this->get_arg_value('["msgball"]["msgnum"]');
!               //}
!               
!               //function get_pref_layout($acctnum='')
!               //{
!               //      return $this->get_pref_value('layout', $acctnum);
!               //}
!               
!               
!       }  // end class mail_msg_wrappers
! ?>

Index: class.mail_send.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_send.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.mail_send.inc.php     25 Oct 2002 12:45:53 -0000      1.10
--- class.mail_send.inc.php     14 Mar 2003 04:01:08 -0000      1.11
***************
*** 1,390 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare API - smtp mailer                                        
                *
!       * This file written by Itzchak Rehberg <address@hidden>                 
*
!       * and Joseph Engo <address@hidden>                                      
*
!       * and Angelo "Angles" Puglisi <address@hidden>                  *
!       * This module should replace php's mail() function. It is fully syntax  
        *
!       * compatible. In addition, when an error occures, a detailed error info 
        *
!       * is stored in the array $send->err (see ../inc/email/global.inc.php 
for                *
!       * details on this variable).                                            
                *
!       * Copyright (C) 2000, 2001 Itzchak Rehberg, and                         
        *
!       * Copyright (C) 2001, 2002 Angelo Puglisi (Angles)                      
                *
!       * 
-------------------------------------------------------------------------       
              *
!       * This library is part of the phpGroupWare API                          
        *
!       * http://www.phpgroupware.org/api                                       
                * 
!       * 
------------------------------------------------------------------------        
              *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
        *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty               
*
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       
!       /*!
!       @class mail_send
!       @abstract sockets based SMTP class, will communicate with an MTA to 
send mail
!       @result returns True on success (mail was sent), returns False on error 
(no mail sent)
!       @discussion class provides for complex SMTP transactions, bypassing 
need for php's
!       builtin mail sending functions. Currently part of the email class 
group, when mature will
!       be moved to standard phpgroupware api.
!       @author (a) Itzchak Rehberg - initial implementation, SMTP 
communication and control flow, excellent work! 
!       and (b) Angelo Puglisi (Angles) - convert to multi-dimentional array 
driven architecture, expanded debugging,
!       RFC2822 and 2821 compliance, retain a copy for archiving option, fake 
send debug, handshake retention, other stuff...
!       */
!       class mail_send
!       {
!               var $err = array();
!               var $to_res = array();
!               var $default_smtp_port = 25;
!               
!               //var $debug_fake_send = True;
!               var $debug_fake_send = False;
!               
!               var $retain_copy = False;
!               
!               // trace flag 0 = none, 1 = server only, 2 = server and client, 
3 = totally extra verbose
!               var $trace_flag = 0;
!               var $trace_data = array();
!               
!               // some of the MTA communication should not go into the copy, 
like ELHO stuff
!               var $retain_copy_ignore = True;
!               var $assembled_copy = '';
! 
!               function mail_send()
!               {
!                       $this->err['code'] = '';
!                       $this->err['msg']  = '';
!                       $this->err['desc'] = '';
!                       $this->err['server_chat'] = "\r\n";
!               }
!               
!               function send_init()
!               {
!                       // depreciated
!               }
!               
!               function log_trace($prefix='', $data)
!               {
!                       $next_idx = count($this->trace_data);
!                       $this->trace_data[$next_idx] = $prefix.' : 
'.htmlspecialchars(rtrim($data));
!               }
!               // ===  some sub-functions  ===
! 
!               function socket2msg($socket)
!               {
!                       if ($this->debug_fake_send)
!                       {
!                               // we are not really sending mail, pretend the 
server accepted out data
!                               return True;
!                       }
!                       
!                       $followme = '-';
!                       $this->err["msg"] = '';
!                       do
!                       {
!                               //$rmsg = fgets($socket,255);
!                               $rmsg = fgets($socket,1024);
!                               $this->err['server_chat'] .= 
htmlspecialchars('s->c: '.$rmsg);
!                               if ($this->trace_flag > 0) { 
$this->log_trace('socket2msg: rmsg', $rmsg); }
!                               $this->err['code'] = substr($rmsg,0,3);
!                               if ($this->trace_flag > 2) { 
$this->log_trace('socket2msg: $this->err[code]', $this->err['code']); }
!                               $followme = substr($rmsg,3,1);
!                               if ($this->trace_flag > 2) { 
$this->log_trace('socket2msg: $followme', $followme); }
!                               $this->err['msg'] = substr($rmsg,4);
!                               if ($this->trace_flag > 2) { 
$this->log_trace('socket2msg: $this->err[msg]', $this->err['msg']); }
!                               if (substr($this->err['code'],0,1) != 2 && 
substr($this->err['code'],0,1) != 3)
!                               {
!                                       $rc  = fclose($socket);
!                                       return false;
!                               }
!                               
!                               if ($followme == ' ')
!                               {
!                                       break;
!                               }
!                       }
!                       while ($followme == '-');
!                       
!                       return true;
!               }
! 
!               function msg2socket($socket,$message)
!               {
!                       if ($this->debug_fake_send)
!                       {
!                               echo 
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($message);
!                               return True;
!                       }
!                       // if we need a copy of this message for the "sent" 
folder, assemble it here
!                       if (($this->retain_copy)
!                       && (!$this->retain_copy_ignore))
!                       {
!                               $this->assembled_copy .= "$message";
!                       }
!                       // on the contrary, server chat ONLY wants the pre- 
DATA stuff
!                       if ($this->retain_copy_ignore)
!                       {
!                               // "retain_copy_ignore" means we are still in 
the handshake phase, which is what "server_chat" wants
!                               $this->err['server_chat'] .= 
htmlspecialchars('c->s: '.$message);
!                       }
!                       
!                       if ($this->trace_flag > 1) { 
$this->log_trace('msg2socket: $message', $message); }
!                       
!                       $rc = fputs($socket,"$message");
!                       if (!$rc)
!                       {
!                               $this->err['code'] = '420';
!                               $this->err['msg']  = 'lost connection';
!                               $this->err['desc'] = 'Lost connection to smtp 
server.';
!                               $rc  = fclose($socket);
!                               return false;
!                       }
!                       return true;
!               }
! 
!               // ===== [ main function: smail_2822() ] =======
! 
!               function smail_2822($mail_out)
!               {
!                       // don't start retaining the email copy until after the 
MTA handshake
!                       $this->retain_copy_ignore = True;
!                       
!                       // error code and message of failed connection
!                       $errcode = '';
!                       $errmsg = '';
!                       // timeout in secs
!                       $timeout = 5;
!                       
!                       if ($this->debug_fake_send)
!                       {
!                               // arbitrary number, no significance
!                               // we do not actually communicate with the SMTP 
server for a fake send
!                               $socket = 41;
!                               // announce the fact this is echo'd debug 
output, not an actual session
!                               echo '<html><body><h2>FAKE SEND DEBUG:</h2> 
<h3>this is what the client *would* send to the SMTP server were this an actual 
send</h3>';
!                       }
!                       else
!                       {
!                               $smtp_server = 
$GLOBALS['phpgw_info']['server']['smtp_server'];
!                               $smtp_port = 
$GLOBALS['phpgw_info']['server']['smtp_port'];
!                               // some people do not set this up correctly in 
the site-wide admin for email
!                               if (empty($smtp_port))
!                               {
!                                       $smtp_port = $this->default_smtp_port;
!                               }
!                               
!                               // OPEN SOCKET - now we try to open the socket 
and check, if any smtp server responds
!                               $socket = 
fsockopen($smtp_server,$smtp_port,$errcode,$errmsg,$timeout);
!                               $this->err['server_chat'] .= 
htmlspecialchars('c->s: 
fsockopen('.$smtp_server.','.$smtp_port.','.$errcode.','.$errmsg.','.$timeout.')
 ; returned: '.$socket )."\r\n";
! 
!                       }
!                       if (!$socket)
!                       {
!                               $this->err['code'] = '420';
!                               $this->err['msg']  = $errcode.':'.$errmsg;
!                               $this->err['desc'] = 'Connection to 
'.$GLOBALS['phpgw_info']['server']['smtp_server'].':'.$GLOBALS['phpgw_info']['server']['smtp_port'].'
 failed - could not open socket.';
!                               return false;
!                       }
!                       else
!                       {
!                               $rrc = $this->socket2msg($socket);
!                       }
!                       
!                       $mymachine = $mail_out['mta_elho_mymachine'];
!                       $fromuser = $mail_out['mta_from'];
!                       // START SMTP SESSION - now we can send our message. 
1st we identify ourselves and the sender
!                       $cmds = array (
!                               "\$src = \$this->msg2socket(\$socket,\"EHLO 
\$mymachine\r\n\");",
!                               "\$rrc = \$this->socket2msg(\$socket);",
!                               "\$src = \$this->msg2socket(\$socket,\"MAIL 
FROM:\$fromuser\r\n\");",
!                               "\$rrc = \$this->socket2msg(\$socket);"
!                       );
!                       if ($this->debug_fake_send)
!                       {
!                               echo '<pre>';
!                       }
!                       for ($src=true,$rrc=true,$i=0; $i<count($cmds);$i++)
!                       {
!                               eval ($cmds[$i]);
!                               if (!$src || !$rrc)
!                               {
!                                       return false;
!                               }
!                       }
!                       
!                       // RCPT TO - now we've got to feed the to's and cc's
!                       for ($i=0; $i<count($mail_out['mta_to']); $i++)
!                       {
!                               $src = $this->msg2socket($socket,'RCPT 
TO:'.$mail_out['mta_to'][$i]."\r\n");
!                               $rrc = $this->socket2msg($socket);
!                               // for lateron validation
!                               $this->to_res[$i][addr] = 
$mail_out['mta_to'][$i];
!                               $this->to_res[$i][code] = $this->err['code'];
!                               $this->to_res[$i][msg]  = $this->err['msg'];
!                               $this->to_res[$i][desc] = $this->err['desc'];
!                       }
!                       
!                       if (!$this->debug_fake_send)
!                       {
!                               //now we have to make sure that at least one 
$to-address was accepted
!                               $stop = 1;
!                               for ($i=0;$i<count($this->to_res);$i++)
!                               {
!                                       $rc = 
substr($this->to_res[$i][code],0,1);
!                                       if ($rc == 2)
!                                       {
!                                               // at least to this address we 
can deliver
!                                               $stop = 0;
!                                       }
!                               }
!                               if ($stop)
!                               {
!                                       // no address found we can deliver to
!                                       return false;
!                               }
!                       }
!                       
!                       // HEADERS - now we can go to deliver the headers!
!                       if (!$this->msg2socket($socket,"DATA\r\n"))
!                       {
!                               return false;
!                       }
!                       if (!$this->socket2msg($socket))
!                       {
!                               return false;
!                       }
!                       
!                       // READY TO SEND MAIL: start retaining the email copy 
(if necessary)
!                       $this->retain_copy_ignore = False;
!                       
!                       // BEGIN THE DATA SEND
!                       for ($i=0; $i<count($mail_out['main_headers']); $i++)
!                       {
!                               if 
(!$this->msg2socket($socket,$mail_out['main_headers'][$i]."\r\n"))
!                               {
!                                       return false;
!                               }
!                       }
!                       // HEADERS TERMINATION - this CRLF terminates the 
header, signals the body will follow next (ONE CRLF ONLY)
!                       if (!$this->msg2socket($socket,"\r\n"))
!                       {
!                               return false;
!                       }
!                       // BODY - now we can go to deliver the body!
!                       for ($part_num=0; $part_num<count($mail_out['body']); 
$part_num++)
!                       {
!                               // mime headers for this mime part (if any)
!                               if (($mail_out['is_multipart'] == True)
!                               || ($mail_out['is_forward'] == True))
!                               {
!                                       for ($i=0; 
$i<count($mail_out['body'][$part_num]['mime_headers']); $i++)
!                                       {
!                                               $this_line = rtrim($this_line = 
$mail_out['body'][$part_num]['mime_headers'][$i])."\r\n";
!                                               if 
(!$this->msg2socket($socket,$this_line))
!                                               {
!                                                       return false;
!                                               }
!                                       }
!                                       // a space needs to seperate the mime 
part headers from the mime part content
!                                       if (!$this->msg2socket($socket,"\r\n"))
!                                       {
!                                               return false;
!                                       }
!                               }
!                               // the part itself
!                               for ($i=0; 
$i<count($mail_out['body'][$part_num]['mime_body']); $i++)
!                               {
!                                       $this_line = 
rtrim($mail_out['body'][$part_num]['mime_body'][$i])."\r\n";
!                                       // TRANSPARENCY - rfc2821 sect 4.5.2 - 
any line beginning with a dot, add another dot
!                                       if ((strlen($this_line) > 0)
!                                       && ($this_line[0] == '.'))
!                                       {
!                                               // rfc2821 add another dot to 
the begining of this line
!                                               $this_line = '.' .$this_line;
!                                       }
!                                       if 
(!$this->msg2socket($socket,$this_line))
!                                       {
!                                               return false;
!                                       }
!                                       // TESTING memory saving feature, clear 
already sent lines IF saving them in assembled_copy
!                                       if (($this->retain_copy)
!                                       && (!$this->retain_copy_ignore))
!                                       {
!                                               // we no longer need the array 
item, clear it from memory
!                                               
$mail_out['body'][$part_num]['mime_body'][$i] = '';
!                                       }
!                               }
!                               // this space will seperate this part from any 
following parts that may be coming
!                               if (!$this->msg2socket($socket,"\r\n"))
!                               {
!                                       return false;
!                               }
!                       }
!                       // FINAL BOUNDARY - at the end of a multipart email, we 
need to add the "final" boundary
!                       if (($mail_out['is_multipart'] == True)
!                       || ($mail_out['is_forward'] == True))
!                       {
!                               // attachments / parts have their own boundary 
preceeding them in their mime headers
!                               // this is: "--"boundary
!                               // all boundary strings are have 2 dashes "--" 
added to their begining
!                               // and the FINAL boundary string (after all 
other parts) ALSO has 
!                               // 2 dashes "--" tacked on tho the end of it, 
very important !! 
!                               //   the first or last \r\n is *probably* not 
necessary
!                               $final_boundary = '--' 
.$mail_out['boundary'].'--'."\r\n";
!                               if (!$this->msg2socket($socket,$final_boundary))
!                               {
!                                       return false;
!                               }
!                               // another blank line
!                               if (!$this->msg2socket($socket,"\r\n"))
!                               {
!                                       return false;
!                               }
!                       }
!                       
!                       // stop retaining the email copy, the message is over, 
only MTA closing handshake remainse
!                       $this->retain_copy_ignore = True;
!                       
!                       // DATA END - special string "DOTCRLF" signals the end 
of the body
!                       if (!$this->msg2socket($socket,".\r\n"))
!                       {
!                               return false;
!                       }
!                       if (!$this->socket2msg($socket))
!                       {
!                               return false;
!                       }
!                       // QUIT
!                       if (!$this->msg2socket($socket,"QUIT\r\n"))
!                       {
!                               return false;
!                       }
!                       
!                       if ($this->debug_fake_send)
!                       {
!                               echo '</pre><h3>end of Fake 
Send</h3></body></html>';
!                       }
!                       
!                       if (!$this->debug_fake_send)
!                       {
!                               do
!                               {
!                                       $closing = $this->socket2msg($socket);
!                               }
!                               while ($closing);
!                       }
!                       return true;
!               }
!               
!       // end of class
!       }
! ?>
--- 1,390 ----
! <?php
!       
/**************************************************************************\
!       * phpGroupWare API - smtp mailer                                        
                *
!       * This file written by Itzchak Rehberg <address@hidden>                 
*
!       * and Joseph Engo <address@hidden>                                      
*
!       * and Angelo "Angles" Puglisi <address@hidden>                  *
!       * This module should replace php's mail() function. It is fully syntax  
        *
!       * compatible. In addition, when an error occures, a detailed error info 
        *
!       * is stored in the array $send->err (see ../inc/email/global.inc.php 
for                *
!       * details on this variable).                                            
                *
!       * Copyright (C) 2000, 2001 Itzchak Rehberg, and                         
        *
!       * Copyright (C) 2001, 2002 Angelo Puglisi (Angles)                      
                *
!       * 
-------------------------------------------------------------------------       
              *
!       * This library is part of the phpGroupWare API                          
        *
!       * http://www.phpgroupware.org/api                                       
                * 
!       * 
------------------------------------------------------------------------        
              *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
        *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty               
*
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       
!       /*!
!       @class mail_send
!       @abstract sockets based SMTP class, will communicate with an MTA to 
send mail
!       @result returns True on success (mail was sent), returns False on error 
(no mail sent)
!       @discussion class provides for complex SMTP transactions, bypassing 
need for php's
!       builtin mail sending functions. Currently part of the email class 
group, when mature will
!       be moved to standard phpgroupware api.
!       @author (a) Itzchak Rehberg - initial implementation, SMTP 
communication and control flow, excellent work! 
!       and (b) Angelo Puglisi (Angles) - convert to multi-dimentional array 
driven architecture, expanded debugging,
!       RFC2822 and 2821 compliance, retain a copy for archiving option, fake 
send debug, handshake retention, other stuff...
!       */
!       class mail_send
!       {
!               var $err = array();
!               var $to_res = array();
!               var $default_smtp_port = 25;
!               
!               //var $debug_fake_send = True;
!               var $debug_fake_send = False;
!               
!               var $retain_copy = False;
!               
!               // trace flag 0 = none, 1 = server only, 2 = server and client, 
3 = totally extra verbose
!               var $trace_flag = 0;
!               var $trace_data = array();
!               
!               // some of the MTA communication should not go into the copy, 
like ELHO stuff
!               var $retain_copy_ignore = True;
!               var $assembled_copy = '';
! 
!               function mail_send()
!               {
!                       $this->err['code'] = '';
!                       $this->err['msg']  = '';
!                       $this->err['desc'] = '';
!                       $this->err['server_chat'] = "\r\n";
!               }
!               
!               function send_init()
!               {
!                       // depreciated
!               }
!               
!               function log_trace($prefix='', $data)
!               {
!                       $next_idx = count($this->trace_data);
!                       $this->trace_data[$next_idx] = $prefix.' : 
'.htmlspecialchars(rtrim($data));
!               }
!               // ===  some sub-functions  ===
! 
!               function socket2msg($socket)
!               {
!                       if ($this->debug_fake_send)
!                       {
!                               // we are not really sending mail, pretend the 
server accepted out data
!                               return True;
!                       }
!                       
!                       $followme = '-';
!                       $this->err["msg"] = '';
!                       do
!                       {
!                               //$rmsg = fgets($socket,255);
!                               $rmsg = fgets($socket,1024);
!                               $this->err['server_chat'] .= 
htmlspecialchars('s->c: '.$rmsg);
!                               if ($this->trace_flag > 0) { 
$this->log_trace('socket2msg: rmsg', $rmsg); }
!                               $this->err['code'] = substr($rmsg,0,3);
!                               if ($this->trace_flag > 2) { 
$this->log_trace('socket2msg: $this->err[code]', $this->err['code']); }
!                               $followme = substr($rmsg,3,1);
!                               if ($this->trace_flag > 2) { 
$this->log_trace('socket2msg: $followme', $followme); }
!                               $this->err['msg'] = substr($rmsg,4);
!                               if ($this->trace_flag > 2) { 
$this->log_trace('socket2msg: $this->err[msg]', $this->err['msg']); }
!                               if (substr($this->err['code'],0,1) != 2 && 
substr($this->err['code'],0,1) != 3)
!                               {
!                                       $rc  = fclose($socket);
!                                       return false;
!                               }
!                               
!                               if ($followme == ' ')
!                               {
!                                       break;
!                               }
!                       }
!                       while ($followme == '-');
!                       
!                       return true;
!               }
! 
!               function msg2socket($socket,$message)
!               {
!                       if ($this->debug_fake_send)
!                       {
!                               echo 
$GLOBALS['phpgw']->msg->htmlspecialchars_encode($message);
!                               return True;
!                       }
!                       // if we need a copy of this message for the "sent" 
folder, assemble it here
!                       if (($this->retain_copy)
!                       && (!$this->retain_copy_ignore))
!                       {
!                               $this->assembled_copy .= "$message";
!                       }
!                       // on the contrary, server chat ONLY wants the pre- 
DATA stuff
!                       if ($this->retain_copy_ignore)
!                       {
!                               // "retain_copy_ignore" means we are still in 
the handshake phase, which is what "server_chat" wants
!                               $this->err['server_chat'] .= 
htmlspecialchars('c->s: '.$message);
!                       }
!                       
!                       if ($this->trace_flag > 1) { 
$this->log_trace('msg2socket: $message', $message); }
!                       
!                       $rc = fputs($socket,"$message");
!                       if (!$rc)
!                       {
!                               $this->err['code'] = '420';
!                               $this->err['msg']  = 'lost connection';
!                               $this->err['desc'] = 'Lost connection to smtp 
server.';
!                               $rc  = fclose($socket);
!                               return false;
!                       }
!                       return true;
!               }
! 
!               // ===== [ main function: smail_2822() ] =======
! 
!               function smail_2822($mail_out)
!               {
!                       // don't start retaining the email copy until after the 
MTA handshake
!                       $this->retain_copy_ignore = True;
!                       
!                       // error code and message of failed connection
!                       $errcode = '';
!                       $errmsg = '';
!                       // timeout in secs
!                       $timeout = 5;
!                       
!                       if ($this->debug_fake_send)
!                       {
!                               // arbitrary number, no significance
!                               // we do not actually communicate with the SMTP 
server for a fake send
!                               $socket = 41;
!                               // announce the fact this is echo'd debug 
output, not an actual session
!                               echo '<html><body><h2>FAKE SEND DEBUG:</h2> 
<h3>this is what the client *would* send to the SMTP server were this an actual 
send</h3>';
!                       }
!                       else
!                       {
!                               $smtp_server = 
$GLOBALS['phpgw_info']['server']['smtp_server'];
!                               $smtp_port = 
$GLOBALS['phpgw_info']['server']['smtp_port'];
!                               // some people do not set this up correctly in 
the site-wide admin for email
!                               if (empty($smtp_port))
!                               {
!                                       $smtp_port = $this->default_smtp_port;
!                               }
!                               
!                               // OPEN SOCKET - now we try to open the socket 
and check, if any smtp server responds
!                               $socket = 
fsockopen($smtp_server,$smtp_port,$errcode,$errmsg,$timeout);
!                               $this->err['server_chat'] .= 
htmlspecialchars('c->s: 
fsockopen('.$smtp_server.','.$smtp_port.','.$errcode.','.$errmsg.','.$timeout.')
 ; returned: '.$socket )."\r\n";
! 
!                       }
!                       if (!$socket)
!                       {
!                               $this->err['code'] = '420';
!                               $this->err['msg']  = $errcode.':'.$errmsg;
!                               $this->err['desc'] = 'Connection to 
'.$GLOBALS['phpgw_info']['server']['smtp_server'].':'.$GLOBALS['phpgw_info']['server']['smtp_port'].'
 failed - could not open socket.';
!                               return false;
!                       }
!                       else
!                       {
!                               $rrc = $this->socket2msg($socket);
!                       }
!                       
!                       $mymachine = $mail_out['mta_elho_mymachine'];
!                       $fromuser = $mail_out['mta_from'];
!                       // START SMTP SESSION - now we can send our message. 
1st we identify ourselves and the sender
!                       $cmds = array (
!                               "\$src = \$this->msg2socket(\$socket,\"EHLO 
\$mymachine\r\n\");",
!                               "\$rrc = \$this->socket2msg(\$socket);",
!                               "\$src = \$this->msg2socket(\$socket,\"MAIL 
FROM:\$fromuser\r\n\");",
!                               "\$rrc = \$this->socket2msg(\$socket);"
!                       );
!                       if ($this->debug_fake_send)
!                       {
!                               echo '<pre>';
!                       }
!                       for ($src=true,$rrc=true,$i=0; $i<count($cmds);$i++)
!                       {
!                               eval ($cmds[$i]);
!                               if (!$src || !$rrc)
!                               {
!                                       return false;
!                               }
!                       }
!                       
!                       // RCPT TO - now we've got to feed the to's and cc's
!                       for ($i=0; $i<count($mail_out['mta_to']); $i++)
!                       {
!                               $src = $this->msg2socket($socket,'RCPT 
TO:'.$mail_out['mta_to'][$i]."\r\n");
!                               $rrc = $this->socket2msg($socket);
!                               // for lateron validation
!                               $this->to_res[$i][addr] = 
$mail_out['mta_to'][$i];
!                               $this->to_res[$i][code] = $this->err['code'];
!                               $this->to_res[$i][msg]  = $this->err['msg'];
!                               $this->to_res[$i][desc] = $this->err['desc'];
!                       }
!                       
!                       if (!$this->debug_fake_send)
!                       {
!                               //now we have to make sure that at least one 
$to-address was accepted
!                               $stop = 1;
!                               for ($i=0;$i<count($this->to_res);$i++)
!                               {
!                                       $rc = 
substr($this->to_res[$i][code],0,1);
!                                       if ($rc == 2)
!                                       {
!                                               // at least to this address we 
can deliver
!                                               $stop = 0;
!                                       }
!                               }
!                               if ($stop)
!                               {
!                                       // no address found we can deliver to
!                                       return false;
!                               }
!                       }
!                       
!                       // HEADERS - now we can go to deliver the headers!
!                       if (!$this->msg2socket($socket,"DATA\r\n"))
!                       {
!                               return false;
!                       }
!                       if (!$this->socket2msg($socket))
!                       {
!                               return false;
!                       }
!                       
!                       // READY TO SEND MAIL: start retaining the email copy 
(if necessary)
!                       $this->retain_copy_ignore = False;
!                       
!                       // BEGIN THE DATA SEND
!                       for ($i=0; $i<count($mail_out['main_headers']); $i++)
!                       {
!                               if 
(!$this->msg2socket($socket,$mail_out['main_headers'][$i]."\r\n"))
!                               {
!                                       return false;
!                               }
!                       }
!                       // HEADERS TERMINATION - this CRLF terminates the 
header, signals the body will follow next (ONE CRLF ONLY)
!                       if (!$this->msg2socket($socket,"\r\n"))
!                       {
!                               return false;
!                       }
!                       // BODY - now we can go to deliver the body!
!                       for ($part_num=0; $part_num<count($mail_out['body']); 
$part_num++)
!                       {
!                               // mime headers for this mime part (if any)
!                               if (($mail_out['is_multipart'] == True)
!                               || ($mail_out['is_forward'] == True))
!                               {
!                                       for ($i=0; 
$i<count($mail_out['body'][$part_num]['mime_headers']); $i++)
!                                       {
!                                               $this_line = rtrim($this_line = 
$mail_out['body'][$part_num]['mime_headers'][$i])."\r\n";
!                                               if 
(!$this->msg2socket($socket,$this_line))
!                                               {
!                                                       return false;
!                                               }
!                                       }
!                                       // a space needs to seperate the mime 
part headers from the mime part content
!                                       if (!$this->msg2socket($socket,"\r\n"))
!                                       {
!                                               return false;
!                                       }
!                               }
!                               // the part itself
!                               for ($i=0; 
$i<count($mail_out['body'][$part_num]['mime_body']); $i++)
!                               {
!                                       $this_line = 
rtrim($mail_out['body'][$part_num]['mime_body'][$i])."\r\n";
!                                       // TRANSPARENCY - rfc2821 sect 4.5.2 - 
any line beginning with a dot, add another dot
!                                       if ((strlen($this_line) > 0)
!                                       && ($this_line[0] == '.'))
!                                       {
!                                               // rfc2821 add another dot to 
the begining of this line
!                                               $this_line = '.' .$this_line;
!                                       }
!                                       if 
(!$this->msg2socket($socket,$this_line))
!                                       {
!                                               return false;
!                                       }
!                                       // TESTING memory saving feature, clear 
already sent lines IF saving them in assembled_copy
!                                       if (($this->retain_copy)
!                                       && (!$this->retain_copy_ignore))
!                                       {
!                                               // we no longer need the array 
item, clear it from memory
!                                               
$mail_out['body'][$part_num]['mime_body'][$i] = '';
!                                       }
!                               }
!                               // this space will seperate this part from any 
following parts that may be coming
!                               if (!$this->msg2socket($socket,"\r\n"))
!                               {
!                                       return false;
!                               }
!                       }
!                       // FINAL BOUNDARY - at the end of a multipart email, we 
need to add the "final" boundary
!                       if (($mail_out['is_multipart'] == True)
!                       || ($mail_out['is_forward'] == True))
!                       {
!                               // attachments / parts have their own boundary 
preceeding them in their mime headers
!                               // this is: "--"boundary
!                               // all boundary strings are have 2 dashes "--" 
added to their begining
!                               // and the FINAL boundary string (after all 
other parts) ALSO has 
!                               // 2 dashes "--" tacked on tho the end of it, 
very important !! 
!                               //   the first or last \r\n is *probably* not 
necessary
!                               $final_boundary = '--' 
.$mail_out['boundary'].'--'."\r\n";
!                               if (!$this->msg2socket($socket,$final_boundary))
!                               {
!                                       return false;
!                               }
!                               // another blank line
!                               if (!$this->msg2socket($socket,"\r\n"))
!                               {
!                                       return false;
!                               }
!                       }
!                       
!                       // stop retaining the email copy, the message is over, 
only MTA closing handshake remainse
!                       $this->retain_copy_ignore = True;
!                       
!                       // DATA END - special string "DOTCRLF" signals the end 
of the body
!                       if (!$this->msg2socket($socket,".\r\n"))
!                       {
!                               return false;
!                       }
!                       if (!$this->socket2msg($socket))
!                       {
!                               return false;
!                       }
!                       // QUIT
!                       if (!$this->msg2socket($socket,"QUIT\r\n"))
!                       {
!                               return false;
!                       }
!                       
!                       if ($this->debug_fake_send)
!                       {
!                               echo '</pre><h3>end of Fake 
Send</h3></body></html>';
!                       }
!                       
!                       if (!$this->debug_fake_send)
!                       {
!                               do
!                               {
!                                       $closing = $this->socket2msg($socket);
!                               }
!                               while ($closing);
!                       }
!                       return true;
!               }
!               
!       // end of class
!       }
! ?>

Index: class.msg_bootstrap.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.msg_bootstrap.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.msg_bootstrap.inc.php 25 Oct 2002 12:56:57 -0000      1.1
--- class.msg_bootstrap.inc.php 14 Mar 2003 04:01:08 -0000      1.2
***************
*** 1,322 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Module for phpGroupWare                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * http://www.phpgroupware.org                                           
                        * 
!       */
!       
/**************************************************************************\
!       * AngleMail - Bootstrap the mail_msg object                             
                *
!       * This file written by "Angles" Angelo Puglisi <address@hidden> *
!       * Bootstrap the mail_   msg object                                      
                                *
!       * Copyright (C) 2002 Angelo Tony Puglisi (Angles)                       
                *
!       * 
-------------------------------------------------------------------------       
      *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
                                *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of    *
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       
!       /*!
!       @class msg_bootstrap
!       @abstract Utility class shared throught out the email app which ensures 
the GLOBALS->msg exists and is logged in
!       @param $do_login (boolean) defaults to True, most often you do not need 
to change this.
!       @author Angles
!       @discussion  only has one function which bootstraps the GLOBALS->msg  
(if necessary). It should be safe to call 
!       CreateObject on this class at any time for object 
$GLOBALS[phpgw]->msg_bootstrap because api is smart 
!       enough to not re-create it and theres nothing in the constructor, so 
this bootstrap capability should be available 
!       at any time to any code file. If there is a problem logging in, 
function GLOBALS["phpgw"]->msg->login_error() is called, 
!       giving an error message, and the script exits.
!       @example 
!       $GLOBALS["phpgw"]->msg_bootstrap = CreateObject("email.msg_bootstrap");
!       $GLOBALS['phpgw']->msg_bootstrap->login();
!       ## OR, if you care about debug info, an alternative is to use this, 
does the same thing but gives debug info.
!       $GLOBALS['phpgw']->msg_bootstrap->ensure_mail_msg_exists('name of my 
function');
!       @access public
!       */
!       class msg_bootstrap
!       {
!               var $do_login = True;
!               //var $do_login = False;
!               var $do_login_ex = 0;
!               
!               function msg_bootstrap()
!               {
!                       if (defined(BS_LOGIN_NEVER) == False)
!                       {
!                               define('BS_LOGIN_NOT_SPECIFIED',0);
!                               // never log in no matter what
!                               define('BS_LOGIN_NEVER',1);
!                               // do not login unless required (caching in 
effect)
!                               define('BS_LOGIN_ONLY_IF_NEEDED',2);
!                               // login definately do it (if not caching)
!                               define('BS_LOGIN_YES',3);
!                               //define('BS_LOGIN_DEMAND_ONLY',3);
!                               //define('BS_LOGIN_NEEDED',4);
!                       }
!                       //return;
!               }
!               
!               
!               /* * * * 
!               @function set_do_login
!               @abstract whether to try to login to the mail server or not 
during a call to "ensure_mail_msg_exists". 
!               OPTIONAL, default is True. Behavior depends on caching method.
!               @param $do_login (boolean) 
!               @author Angles
!               @result (boolean) whatever the value var $this->do_login has on 
exiting the function.
!               @discussion OPTONAL, default of True works for most situations. 
This do_login value is 
!               used in this objects function "ensure_mail_msg_exists" where it 
is passed to the mail_msg class. 
!               Again, this is OPTONAL, default of True works for most 
situations, such as 
!               (1a) If session_cache_extreme is True, and do_login=True, this 
will _allow_ a server login, 
!               if needed, only if the app needs to get data that is not 
already cached.
!               (1b) If session_cache_extreme is False, and do_login=True, this 
will _always_ try to establish 
!               a mail server stream at the beginning of every script run. 
!               (2a and 2b) Setting do_login to False is useful in certain 
limited situations, such as the email settings page, 
!               or the preferences page. There you want to set or get email 
preference data but you do NOT 
!               require a login, or when there may be no preference data set 
yet, such as the first time a user 
!               sets the preferences, so a login is not even possible. The 
preference data will be handled by the 
!               mail_msg class as usual. Setting do_login to False for these 
occasions is OK no matter if 
!               session_cache_extreme is True or False. 
!               @access public
!               *
!               function set_do_login($do_login='##NOTHING##')
!               {
!                       if (is_bool($do_login))
!                       {
!                               $this->do_login = $do_login;
!                       }
!                       return $this->do_login;
!               }
!               */
!               
!               /*!
!               @function set_do_login REIMPLEMENTATION
!               @abstract whether to try to login to the mail server or not 
during a call to "ensure_mail_msg_exists". 
!               OPTIONAL, default is True. Behavior depends on caching method.
!               @param $do_login (boolean) 
!               @author Angles
!               @result (boolean) whatever the value var $this->do_login has on 
exiting the function.
!               @discussion OPTONAL, default of True works for most situations. 
This do_login value is 
!               used in this objects function "ensure_mail_msg_exists" where it 
is passed to the mail_msg class. 
!               Again, this is OPTONAL, default of True works for most 
situations, such as 
!               (1a) If session_cache_extreme is True, and do_login=True, this 
will _allow_ a server login, 
!               if needed, only if the app needs to get data that is not 
already cached.
!               (1b) If session_cache_extreme is False, and do_login=True, this 
will _always_ try to establish 
!               a mail server stream at the beginning of every script run. 
!               (2a and 2b) Setting do_login to False is useful in certain 
limited situations, such as the email settings page, 
!               or the preferences page. There you want to set or get email 
preference data but you do NOT 
!               require a login, or when there may be no preference data set 
yet, such as the first time a user 
!               sets the preferences, so a login is not even possible. The 
preference data will be handled by the 
!               mail_msg class as usual. Setting do_login to False for these 
occasions is OK no matter if 
!               session_cache_extreme is True or False. 
!               @access public
!               */
!               function set_do_login($do_login='##NOTHING##', 
$called_by='not_provided')
!               {
!                       if ($debug_level > 0) { echo 'ENTERING: msg_bootstrap: 
set_do_login: (called_by: '.$called_by.') param $do_login: 
['.serialize($do_login).']'.'<br>'; } 
!                       // backward compat, when this was only true or false
!                       if (is_bool($do_login))
!                       {
!                               if ($do_login == True)
!                               {
!                                       $this->do_login = True;
!                                       $this->do_login_ex = 
BS_LOGIN_ONLY_IF_NEEDED;
!                               }
!                               else
!                               {
!                                       $this->do_login = False;
!                                       $this->do_login_ex = BS_LOGIN_NEVER;
!                               }
!                               // LEAVING HERE
!                               if ($debug_level > 0) { echo 'LEAVING: 
msg_bootstrap: set_do_login: (bool input) (called_by: '.$called_by.') 
$this->do_login: ['.$this->do_login.'] $this->do_login_ex: 
['.$this->do_login_ex.'] '.'<br>'; }
!                               return $this->do_login;
!                       }
!                       elseif (is_int($do_login))
!                       {
!                               // new way has 3 possibilities
!                               switch($do_login)
!                               {
!                                       case BS_LOGIN_NEVER:
!                                               {
!                                                       $this->do_login = False;
!                                                       $this->do_login_ex = 
BS_LOGIN_NEVER;
!                                                       break;
!                                               }
!                                       case BS_LOGIN_ONLY_IF_NEEDED:
!                                               {
!                                                       $this->do_login = True;
!                                                       $this->do_login_ex = 
BS_LOGIN_ONLY_IF_NEEDED;
!                                                       break;
!                                               }
!                                       case BS_LOGIN_YES:
!                                               {
!                                                       $this->do_login = True;
!                                                       $this->do_login_ex = 
BS_LOGIN_YES;
!                                                       break;
!                                               }
!                                       default:
!                                               {
!                                                       $this->do_login = True;
!                                                       $this->do_login_ex = 
BS_LOGIN_ONLY_IF_NEEDED;
!                                               }
!                               }
!                       }
!                       else
!                       {
!                               $this->do_login = True;
!                               $this->do_login_ex = BS_LOGIN_ONLY_IF_NEEDED;
!                       }
!                       if ($debug_level > 0) { echo 'LEAVING: msg_bootstrap: 
set_do_login: (not bool input) (called_by: '.$called_by.') $this->do_login: 
['.$this->do_login.'] $this->do_login_ex: ['.$this->do_login_ex.'] '.'<br>'; }
!                       return $this->do_login_ex;
!               }
!               
!               /*!
!               @function get_do_login
!               @abstract get the value of var $this->do_login
!               @result (boolean) the value var $this->do_login 
!               @author Angles
!               @discussion ?
!               @access public
!               */
!               function get_do_login()
!               {
!                       return $this->do_login;
!               }
!               
!               /*!
!               @function get_do_login_ex
!               @abstract ?
!               @result (defined integer) the value var $this->do_login 
!               @author Angles
!               @discussion ?
!               @access public
!               */
!               function get_do_login_ex()
!               {
!                       return $this->do_login_ex;
!               }
!               
!               /*!
!               @function login
!               @abstract If you do not care to do complicated things with 
email, create this object and call this login function.
!               @author Angles
!               @discussion Alias to "ensure_mail_msg_exists", if you want 
debugging output capability then use that 
!               function. If you just want to get email working quickly, use 
this function.
!               @example 
!                       ## email quickstart:
!                       $GLOBALS["phpgw"]->msg_bootstrap = 
CreateObject("email.msg_bootstrap");
!                       $GLOBALS['phpgw']->msg_bootstrap->login();
!               */
!               function login()
!               {
!                       return $this->ensure_mail_msg_exists('whatever called 
msg_bootstrap->login', 0);
!               }
!               
!               /*!
!               @function ensure_mail_msg_exists
!               @abstract standard function to make sure a mail_msg object 
exists and is logged into the mailserver
!               @param $called_by (string) used for debug output
!               @param $debug_level (int) value 0 to 3, the prevailing debug 
level for the calling function. 
!               @author Angles
!               @discussion This process os the same for any email related code 
that needs the mail_msg object and 
!               an open stream. This function calls msg->begin_request and thus 
all the complicated logic 
!               associated with multiple accounts is handled there.
!               */
!               function ensure_mail_msg_exists($called_by='not_provided', 
$debug_level=0)
!               {
!                       if ($debug_level > 0) { echo 'ENTERING: msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.')'.'<br>'; }
!                       
!                       // make sure do_login has been set
!                       if ($this->get_do_login_ex() == BS_LOGIN_NOT_SPECIFIED)
!                       {
!                               // this gives us a good general default value
!                               $tmp_prev_value = $this->get_do_login();
!                               $this->set_do_login($tmp_prev_value);
!                       }
!                       
!                       // make sure utility classes (like html widgets) exist 
for global access
!                       //$this->ensure_utility_classes($debug_level);
!                       
!                       if (is_object($GLOBALS['phpgw']->msg))
!                       {
!                               if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): is_object test: 
$GLOBALS[phpgw]->msg is already set, do not create again<br>'; }
!                       }
!                       else
!                       {
!                               if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): $GLOBALS[phpgw]->msg is 
NOT set, creating mail_msg object<br>'; }
!                               $GLOBALS['phpgw']->msg = 
CreateObject("email.mail_msg");
!                       }
!                       
!                       if 
($GLOBALS['phpgw']->msg->get_isset_arg('already_grab_class_args_gpc'))
!                       {
!                               // mail_msg had already run thru 
"begin_request", do not call it again
!                               if ($debug_level > 0) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): LEAVING , msg object 
already initialized<br>'; }
!                               return True;
!                       }
!                       
!                       $args_array = Array();
!                       // should we log in or not
!                       if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): $this->do_login: 
['.serialize($this->do_login).']<br>'; }
!                       $args_array['do_login'] = $this->do_login;
!                       if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): $this->do_login_ex: 
['.serialize($this->do_login_ex).']<br>'; }
!                       $args_array['do_login_ex'] = $this->do_login_ex;
!                       
!                       // "start your engines"
!                       if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): call msg->begin_request 
with args array:<pre>'; print_r($args_array); echo '</pre>'; }
!                       $some_stream = 
$GLOBALS['phpgw']->msg->begin_request($args_array);
!                       // error if login failed
!                       if (($args_array['do_login'] == True)
!                       && (!$some_stream))
!                       {
!                               
$GLOBALS['phpgw']->msg->login_error($GLOBALS['PHP_SELF'].', msg_bootstrap: 
ensure_mail_msg_exists(), called_by: '.$called_by);
!                       }
!                       // login error will halt this script execution
!                       // else all is good to go and script continues... 
!                       if ($debug_level > 0) { echo 'EXIT: msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.')'.'<br>'; }
!               }
!               
!               /*!
!               @function ensure_utility_classes
!               @abstract utility function for bootstraping, makes sure 
ancillary global objects are in existance.
!               @param $debug_level (int) the bootstrap code adopts the debug 
level of the calling object, it is passed as a param.
!               @author Angles
!               @discussion This is a utility function called by this-> 
ensure_mail_msg_exists. Email uses 
!               utility c lasses from both email and api utility objects, such 
as html_widgets, 
!               this function makes sure the most commonly used of these are 
available for global access throughout 
!               the email code. Right now this is private, used only by this 
class itself.
!               @access private 
!               */
!               function ensure_utility_classes($debug_level=0)
!               {
!                       // DEBUG - override debug_level param
!                       //$debug_level = 3;
!                       
!                       if ($debug_level > 0) { echo 'ENTERING: msg_bootstrap: 
ensure_utility_classes: <br>'; }
!                       
!                       if (is_object($GLOBALS['phpgw']->widgets))
!                       {
!                               if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_utility_classes: is_object test: $GLOBALS[phpgw]->widgets is already 
set, do not create again<br>'; }
!                       }
!                       else
!                       {
!                               if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_utility_classes: $GLOBALS[phpgw]->widgets is NOT set, creating 
html_widgets object<br>'; }
!                               $my_widgets = 
CreateObject("email.html_widgets");
!                               $GLOBALS['phpgw']->widgets = $my_widgets;
!                       }
!                       
!                       
!                       if ($debug_level > 0) { echo 'EXIT: msg_bootstrap: 
ensure_utility_classes: <br>'; }
!               }
! 
!       }
!       
! ?>
--- 1,322 ----
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Module for phpGroupWare                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * http://www.phpgroupware.org                                           
                        * 
!       */
!       
/**************************************************************************\
!       * AngleMail - Bootstrap the mail_msg object                             
                *
!       * This file written by "Angles" Angelo Puglisi <address@hidden> *
!       * Bootstrap the mail_   msg object                                      
                                *
!       * Copyright (C) 2002 Angelo Tony Puglisi (Angles)                       
                *
!       * 
-------------------------------------------------------------------------       
      *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
                                *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of    *
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       
!       /*!
!       @class msg_bootstrap
!       @abstract Utility class shared throught out the email app which ensures 
the GLOBALS->msg exists and is logged in
!       @param $do_login (boolean) defaults to True, most often you do not need 
to change this.
!       @author Angles
!       @discussion  only has one function which bootstraps the GLOBALS->msg  
(if necessary). It should be safe to call 
!       CreateObject on this class at any time for object 
$GLOBALS[phpgw]->msg_bootstrap because api is smart 
!       enough to not re-create it and theres nothing in the constructor, so 
this bootstrap capability should be available 
!       at any time to any code file. If there is a problem logging in, 
function GLOBALS["phpgw"]->msg->login_error() is called, 
!       giving an error message, and the script exits.
!       @example 
!       $GLOBALS["phpgw"]->msg_bootstrap = CreateObject("email.msg_bootstrap");
!       $GLOBALS['phpgw']->msg_bootstrap->login();
!       ## OR, if you care about debug info, an alternative is to use this, 
does the same thing but gives debug info.
!       $GLOBALS['phpgw']->msg_bootstrap->ensure_mail_msg_exists('name of my 
function');
!       @access public
!       */
!       class msg_bootstrap
!       {
!               var $do_login = True;
!               //var $do_login = False;
!               var $do_login_ex = 0;
!               
!               function msg_bootstrap()
!               {
!                       if (defined(BS_LOGIN_NEVER) == False)
!                       {
!                               define('BS_LOGIN_NOT_SPECIFIED',0);
!                               // never log in no matter what
!                               define('BS_LOGIN_NEVER',1);
!                               // do not login unless required (caching in 
effect)
!                               define('BS_LOGIN_ONLY_IF_NEEDED',2);
!                               // login definately do it (if not caching)
!                               define('BS_LOGIN_YES',3);
!                               //define('BS_LOGIN_DEMAND_ONLY',3);
!                               //define('BS_LOGIN_NEEDED',4);
!                       }
!                       //return;
!               }
!               
!               
!               /* * * * 
!               @function set_do_login
!               @abstract whether to try to login to the mail server or not 
during a call to "ensure_mail_msg_exists". 
!               OPTIONAL, default is True. Behavior depends on caching method.
!               @param $do_login (boolean) 
!               @author Angles
!               @result (boolean) whatever the value var $this->do_login has on 
exiting the function.
!               @discussion OPTONAL, default of True works for most situations. 
This do_login value is 
!               used in this objects function "ensure_mail_msg_exists" where it 
is passed to the mail_msg class. 
!               Again, this is OPTONAL, default of True works for most 
situations, such as 
!               (1a) If session_cache_extreme is True, and do_login=True, this 
will _allow_ a server login, 
!               if needed, only if the app needs to get data that is not 
already cached.
!               (1b) If session_cache_extreme is False, and do_login=True, this 
will _always_ try to establish 
!               a mail server stream at the beginning of every script run. 
!               (2a and 2b) Setting do_login to False is useful in certain 
limited situations, such as the email settings page, 
!               or the preferences page. There you want to set or get email 
preference data but you do NOT 
!               require a login, or when there may be no preference data set 
yet, such as the first time a user 
!               sets the preferences, so a login is not even possible. The 
preference data will be handled by the 
!               mail_msg class as usual. Setting do_login to False for these 
occasions is OK no matter if 
!               session_cache_extreme is True or False. 
!               @access public
!               *
!               function set_do_login($do_login='##NOTHING##')
!               {
!                       if (is_bool($do_login))
!                       {
!                               $this->do_login = $do_login;
!                       }
!                       return $this->do_login;
!               }
!               */
!               
!               /*!
!               @function set_do_login REIMPLEMENTATION
!               @abstract whether to try to login to the mail server or not 
during a call to "ensure_mail_msg_exists". 
!               OPTIONAL, default is True. Behavior depends on caching method.
!               @param $do_login (boolean) 
!               @author Angles
!               @result (boolean) whatever the value var $this->do_login has on 
exiting the function.
!               @discussion OPTONAL, default of True works for most situations. 
This do_login value is 
!               used in this objects function "ensure_mail_msg_exists" where it 
is passed to the mail_msg class. 
!               Again, this is OPTONAL, default of True works for most 
situations, such as 
!               (1a) If session_cache_extreme is True, and do_login=True, this 
will _allow_ a server login, 
!               if needed, only if the app needs to get data that is not 
already cached.
!               (1b) If session_cache_extreme is False, and do_login=True, this 
will _always_ try to establish 
!               a mail server stream at the beginning of every script run. 
!               (2a and 2b) Setting do_login to False is useful in certain 
limited situations, such as the email settings page, 
!               or the preferences page. There you want to set or get email 
preference data but you do NOT 
!               require a login, or when there may be no preference data set 
yet, such as the first time a user 
!               sets the preferences, so a login is not even possible. The 
preference data will be handled by the 
!               mail_msg class as usual. Setting do_login to False for these 
occasions is OK no matter if 
!               session_cache_extreme is True or False. 
!               @access public
!               */
!               function set_do_login($do_login='##NOTHING##', 
$called_by='not_provided')
!               {
!                       if ($debug_level > 0) { echo 'ENTERING: msg_bootstrap: 
set_do_login: (called_by: '.$called_by.') param $do_login: 
['.serialize($do_login).']'.'<br>'; } 
!                       // backward compat, when this was only true or false
!                       if (is_bool($do_login))
!                       {
!                               if ($do_login == True)
!                               {
!                                       $this->do_login = True;
!                                       $this->do_login_ex = 
BS_LOGIN_ONLY_IF_NEEDED;
!                               }
!                               else
!                               {
!                                       $this->do_login = False;
!                                       $this->do_login_ex = BS_LOGIN_NEVER;
!                               }
!                               // LEAVING HERE
!                               if ($debug_level > 0) { echo 'LEAVING: 
msg_bootstrap: set_do_login: (bool input) (called_by: '.$called_by.') 
$this->do_login: ['.$this->do_login.'] $this->do_login_ex: 
['.$this->do_login_ex.'] '.'<br>'; }
!                               return $this->do_login;
!                       }
!                       elseif (is_int($do_login))
!                       {
!                               // new way has 3 possibilities
!                               switch($do_login)
!                               {
!                                       case BS_LOGIN_NEVER:
!                                               {
!                                                       $this->do_login = False;
!                                                       $this->do_login_ex = 
BS_LOGIN_NEVER;
!                                                       break;
!                                               }
!                                       case BS_LOGIN_ONLY_IF_NEEDED:
!                                               {
!                                                       $this->do_login = True;
!                                                       $this->do_login_ex = 
BS_LOGIN_ONLY_IF_NEEDED;
!                                                       break;
!                                               }
!                                       case BS_LOGIN_YES:
!                                               {
!                                                       $this->do_login = True;
!                                                       $this->do_login_ex = 
BS_LOGIN_YES;
!                                                       break;
!                                               }
!                                       default:
!                                               {
!                                                       $this->do_login = True;
!                                                       $this->do_login_ex = 
BS_LOGIN_ONLY_IF_NEEDED;
!                                               }
!                               }
!                       }
!                       else
!                       {
!                               $this->do_login = True;
!                               $this->do_login_ex = BS_LOGIN_ONLY_IF_NEEDED;
!                       }
!                       if ($debug_level > 0) { echo 'LEAVING: msg_bootstrap: 
set_do_login: (not bool input) (called_by: '.$called_by.') $this->do_login: 
['.$this->do_login.'] $this->do_login_ex: ['.$this->do_login_ex.'] '.'<br>'; }
!                       return $this->do_login_ex;
!               }
!               
!               /*!
!               @function get_do_login
!               @abstract get the value of var $this->do_login
!               @result (boolean) the value var $this->do_login 
!               @author Angles
!               @discussion ?
!               @access public
!               */
!               function get_do_login()
!               {
!                       return $this->do_login;
!               }
!               
!               /*!
!               @function get_do_login_ex
!               @abstract ?
!               @result (defined integer) the value var $this->do_login 
!               @author Angles
!               @discussion ?
!               @access public
!               */
!               function get_do_login_ex()
!               {
!                       return $this->do_login_ex;
!               }
!               
!               /*!
!               @function login
!               @abstract If you do not care to do complicated things with 
email, create this object and call this login function.
!               @author Angles
!               @discussion Alias to "ensure_mail_msg_exists", if you want 
debugging output capability then use that 
!               function. If you just want to get email working quickly, use 
this function.
!               @example 
!                       ## email quickstart:
!                       $GLOBALS["phpgw"]->msg_bootstrap = 
CreateObject("email.msg_bootstrap");
!                       $GLOBALS['phpgw']->msg_bootstrap->login();
!               */
!               function login()
!               {
!                       return $this->ensure_mail_msg_exists('whatever called 
msg_bootstrap->login', 0);
!               }
!               
!               /*!
!               @function ensure_mail_msg_exists
!               @abstract standard function to make sure a mail_msg object 
exists and is logged into the mailserver
!               @param $called_by (string) used for debug output
!               @param $debug_level (int) value 0 to 3, the prevailing debug 
level for the calling function. 
!               @author Angles
!               @discussion This process os the same for any email related code 
that needs the mail_msg object and 
!               an open stream. This function calls msg->begin_request and thus 
all the complicated logic 
!               associated with multiple accounts is handled there.
!               */
!               function ensure_mail_msg_exists($called_by='not_provided', 
$debug_level=0)
!               {
!                       if ($debug_level > 0) { echo 'ENTERING: msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.')'.'<br>'; }
!                       
!                       // make sure do_login has been set
!                       if ($this->get_do_login_ex() == BS_LOGIN_NOT_SPECIFIED)
!                       {
!                               // this gives us a good general default value
!                               $tmp_prev_value = $this->get_do_login();
!                               $this->set_do_login($tmp_prev_value);
!                       }
!                       
!                       // make sure utility classes (like html widgets) exist 
for global access
!                       //$this->ensure_utility_classes($debug_level);
!                       
!                       if (is_object($GLOBALS['phpgw']->msg))
!                       {
!                               if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): is_object test: 
$GLOBALS[phpgw]->msg is already set, do not create again<br>'; }
!                       }
!                       else
!                       {
!                               if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): $GLOBALS[phpgw]->msg is 
NOT set, creating mail_msg object<br>'; }
!                               $GLOBALS['phpgw']->msg = 
CreateObject("email.mail_msg");
!                       }
!                       
!                       if 
($GLOBALS['phpgw']->msg->get_isset_arg('already_grab_class_args_gpc'))
!                       {
!                               // mail_msg had already run thru 
"begin_request", do not call it again
!                               if ($debug_level > 0) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): LEAVING , msg object 
already initialized<br>'; }
!                               return True;
!                       }
!                       
!                       $args_array = Array();
!                       // should we log in or not
!                       if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): $this->do_login: 
['.serialize($this->do_login).']<br>'; }
!                       $args_array['do_login'] = $this->do_login;
!                       if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): $this->do_login_ex: 
['.serialize($this->do_login_ex).']<br>'; }
!                       $args_array['do_login_ex'] = $this->do_login_ex;
!                       
!                       // "start your engines"
!                       if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.'): call msg->begin_request 
with args array:<pre>'; print_r($args_array); echo '</pre>'; }
!                       $some_stream = 
$GLOBALS['phpgw']->msg->begin_request($args_array);
!                       // error if login failed
!                       if (($args_array['do_login'] == True)
!                       && (!$some_stream))
!                       {
!                               
$GLOBALS['phpgw']->msg->login_error($GLOBALS['PHP_SELF'].', msg_bootstrap: 
ensure_mail_msg_exists(), called_by: '.$called_by);
!                       }
!                       // login error will halt this script execution
!                       // else all is good to go and script continues... 
!                       if ($debug_level > 0) { echo 'EXIT: msg_bootstrap: 
ensure_mail_msg_exists: (called_by: '.$called_by.')'.'<br>'; }
!               }
!               
!               /*!
!               @function ensure_utility_classes
!               @abstract utility function for bootstraping, makes sure 
ancillary global objects are in existance.
!               @param $debug_level (int) the bootstrap code adopts the debug 
level of the calling object, it is passed as a param.
!               @author Angles
!               @discussion This is a utility function called by this-> 
ensure_mail_msg_exists. Email uses 
!               utility c lasses from both email and api utility objects, such 
as html_widgets, 
!               this function makes sure the most commonly used of these are 
available for global access throughout 
!               the email code. Right now this is private, used only by this 
class itself.
!               @access private 
!               */
!               function ensure_utility_classes($debug_level=0)
!               {
!                       // DEBUG - override debug_level param
!                       //$debug_level = 3;
!                       
!                       if ($debug_level > 0) { echo 'ENTERING: msg_bootstrap: 
ensure_utility_classes: <br>'; }
!                       
!                       if (is_object($GLOBALS['phpgw']->widgets))
!                       {
!                               if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_utility_classes: is_object test: $GLOBALS[phpgw]->widgets is already 
set, do not create again<br>'; }
!                       }
!                       else
!                       {
!                               if ($debug_level > 1) { echo 'msg_bootstrap: 
ensure_utility_classes: $GLOBALS[phpgw]->widgets is NOT set, creating 
html_widgets object<br>'; }
!                               $my_widgets = 
CreateObject("email.html_widgets");
!                               $GLOBALS['phpgw']->widgets = $my_widgets;
!                       }
!                       
!                       
!                       if ($debug_level > 0) { echo 'EXIT: msg_bootstrap: 
ensure_utility_classes: <br>'; }
!               }
! 
!       }
!       
! ?>

Index: class.spell.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.spell.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.spell.inc.php 25 Oct 2002 12:56:57 -0000      1.1
--- class.spell.inc.php 14 Mar 2003 04:01:08 -0000      1.2
***************
*** 1,1123 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Module for phpGroupWare                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * http://www.phpgroupware.org                                           
                        * 
!       */
!       
/**************************************************************************\
!       * AngleMail - E-Mail SpellChecking Functions                            
                *
!       * This file written by "Angles" Angelo Puglisi <address@hidden> *
!       * Handles Spell Checking Email                                          
                        *
[...2221 lines suppressed...]
!                               // simply fill $this->body_with_suggest with 
$this->body_orig, then the rest of the code is the same
!                               $this->body_with_suggest = $this->body_orig;
!                       }
!                       
!                       //$this->body_with_suggest = 
ereg_replace("\r\n","<br>",$this->body_with_suggest);
!                       if ($this->debug_spell_finished > 1) { echo 
'email.spell.spell_finished: FINAL PROCESSED BODY: 
$this->body_with_suggest:<pre>'.$this->body_with_suggest.'</pre>'; }
!                       
!                       // TELL BOCOMPOSE TO DO ITS THING WITH THIS SPELL FIXED 
BODY
!                       $GLOBALS['phpgw']->msg->set_arg_value('body', 
$this->body_with_suggest);
!                       $GLOBALS['phpgw']->uicompose = 
CreateObject("email.uicompose");
!                       
$GLOBALS['phpgw']->uicompose->compose('mail_spell_special_handling');
!                       
!                       
!                       
!                       if ($this->debug_spell_finished > 0) { echo 'EXIT: 
email.spell.spell_finished'.'<br>'; }
!               }
! 
! 
!       }
! ?>

Index: class.spell_struct.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.spell_struct.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.spell_struct.inc.php  25 Oct 2002 12:56:57 -0000      1.1
--- class.spell_struct.inc.php  14 Mar 2003 04:01:08 -0000      1.2
***************
*** 1,81 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Module for phpGroupWare                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * http://www.phpgroupware.org                                           
                        * 
!       */
!       
/**************************************************************************\
!       * AngleMail - E-Mail SpellChecking Header Include file                  
        *
!       * This file written by "Angles" Angelo Puglisi <address@hidden> *
!       * Class Structures shared between Spell Checking and HTML widgets       
        *
!       * Copyright (C) 2002 Angelo Tony Puglisi (Angles)                       
                *
!       * 
-------------------------------------------------------------------------       
      *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
                                *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of    *
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       /*!
!       @class spell_struct
!       @abstract A simple C-Style Include .h file, holds public data structure 
classes for class email spell
!       @discussion  Class Email Spell can be used with other classess such as 
the html widget class, 
!       however the html widget class, in this example, must be made aware of 
any data structures 
!       that the spell class may pass to it. Use this file like an include file 
for such purposes. I 
!       suggest require_once.
!       */
!       
!       
/**************************************************************************\
!       *       CONSTANTS - custom for our use here
!       
\**************************************************************************/
!       
!       /*!
!       @constant SP_FEED_
!       @abstract does dpell checker want single words or lines of text, 
SP_FEED_UNKNOWN or SP_FEED_WORDS or SP_FEED_LINES
!       @author Angles
!       @discussion there should be different ways to spell check depending on 
what your system has installed. 
!       The php builtin pspell extension appears to take one word at a time, 
the command line version of aspell 
!       takes a string, a line of text, at one time. class.spell constructor 
should determine this and fill $this->sp_feed_type.
!       */
!       define('SP_FEED_UNKNOWN',1);
!       define('SP_FEED_WORDS',2);
!       define('SP_FEED_LINES',4);
!       
!       /*!
!       @class correction_info
!       @abstract   coherently combine spelling suggextions with the original 
text
!       @param $orig_word string
!       $line_num int
!       $word_num int
!       $suggestions array of strings
!       @discussion  holds information about a misspelled word including where 
!       it appears in the original text and up to MAX_SUGGEST suggestions
!       */
!       class correction_info
!       {
!               // coherently combine spelling suggextions with the original 
text
!               var $orig_word;
!               var $orig_word_clean;
!               var $line_num;
!               var $word_num;
!               var $suggestions;
!               
!               function correction_info()
!               {
!                       $this->orig_word='';
!                       $this->orig_word_clean = '';
!                       $this->line_num=0;
!                       $this->word_num=0;
!                       $this->suggestions=array();
!               }
!       }
!       
! ?>
--- 1,81 ----
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Module for phpGroupWare                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * http://www.phpgroupware.org                                           
                        * 
!       */
!       
/**************************************************************************\
!       * AngleMail - E-Mail SpellChecking Header Include file                  
        *
!       * This file written by "Angles" Angelo Puglisi <address@hidden> *
!       * Class Structures shared between Spell Checking and HTML widgets       
        *
!       * Copyright (C) 2002 Angelo Tony Puglisi (Angles)                       
                *
!       * 
-------------------------------------------------------------------------       
      *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
                                *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of    *
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       /*!
!       @class spell_struct
!       @abstract A simple C-Style Include .h file, holds public data structure 
classes for class email spell
!       @discussion  Class Email Spell can be used with other classess such as 
the html widget class, 
!       however the html widget class, in this example, must be made aware of 
any data structures 
!       that the spell class may pass to it. Use this file like an include file 
for such purposes. I 
!       suggest require_once.
!       */
!       
!       
/**************************************************************************\
!       *       CONSTANTS - custom for our use here
!       
\**************************************************************************/
!       
!       /*!
!       @constant SP_FEED_
!       @abstract does dpell checker want single words or lines of text, 
SP_FEED_UNKNOWN or SP_FEED_WORDS or SP_FEED_LINES
!       @author Angles
!       @discussion there should be different ways to spell check depending on 
what your system has installed. 
!       The php builtin pspell extension appears to take one word at a time, 
the command line version of aspell 
!       takes a string, a line of text, at one time. class.spell constructor 
should determine this and fill $this->sp_feed_type.
!       */
!       define('SP_FEED_UNKNOWN',1);
!       define('SP_FEED_WORDS',2);
!       define('SP_FEED_LINES',4);
!       
!       /*!
!       @class correction_info
!       @abstract   coherently combine spelling suggextions with the original 
text
!       @param $orig_word string
!       $line_num int
!       $word_num int
!       $suggestions array of strings
!       @discussion  holds information about a misspelled word including where 
!       it appears in the original text and up to MAX_SUGGEST suggestions
!       */
!       class correction_info
!       {
!               // coherently combine spelling suggextions with the original 
text
!               var $orig_word;
!               var $orig_word_clean;
!               var $line_num;
!               var $word_num;
!               var $suggestions;
!               
!               function correction_info()
!               {
!                       $this->orig_word='';
!                       $this->orig_word_clean = '';
!                       $this->line_num=0;
!                       $this->word_num=0;
!                       $this->suggestions=array();
!               }
!       }
!       
! ?>

Index: class.spell_svc_none.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.spell_svc_none.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.spell_svc_none.inc.php        25 Oct 2002 12:56:57 -0000      1.1
--- class.spell_svc_none.inc.php        14 Mar 2003 04:01:08 -0000      1.2
***************
*** 1,134 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Module for phpGroupWare                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * http://www.phpgroupware.org                                           
                        * 
!       */
!       
/**************************************************************************\
!       * AngleMail - Email SpellChecking Backend Service Class                 
        *
!       * This file written by "Angles" Angelo Puglisi <address@hidden> *
!       * Email SpellChecking Backend Service Class - Dummy Class               
        *
!       * Copyright (C) 2002 Angelo Tony Puglisi (Angles)                       
                *
!       * 
-------------------------------------------------------------------------       
      *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
                                *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of    *
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       
!       /*!
!       @class spell_svc_none
!       @abstract  dummy placeholder for spell-less installations
!       @param can_spell (boolean) PRIVATE - flag if this is a working module 
or a dummy one
!       Only the calling spell class should access this, from there it is made 
public. 
!       @param $sp_feed_type (defined int) PRIVATE , if tis services takes 
single words or strings, 
!       values are defined in spell class, which gets the value from here and 
makes it public.
!       @author Angles
!       @discussion  If PHP psspell support is not compiled in,  this  dummy 
module 
!       spell_ svc_none is loaded so there are no errors related to undefined 
pspell functions.
!       @access public
!       */
!       class spell_svc_none
!       {
!               
/**************************************************************************\
!               *       VARS
!               
\**************************************************************************/
!               var $can_spell = False;
!               var $sp_feed_type;
!               
!               
/**************************************************************************\
!               *       CONSTRUCTOR
!               
\**************************************************************************/
!               function spell_svc_none()
!               {
!                       // this is a dummy module for installations with no 
spell capability
!                       $this->can_spell = False;
!                       // SP_FEED_UNKNOWN is defined in the spell class.
!                       $this->sp_feed_type = SP_FEED_UNKNOWN;
!                       return;
!               }
!               
!               
/**************************************************************************\
!               *       OO ACCESS METHODS
!               
\**************************************************************************/
!               /*!
!               @function get_can_spell
!               @abstract Read Only, report if this spell service is capable of 
spell check or not. 
!               @author Angles
!               @discussion The calling spell class will ask if this spell 
service is capable of spell check or not. 
!               This function is exposed to the calling spell class for this 
purpose. The calling spell class then 
!               maked that information public. This is a dummy placeholder 
module so it returns False.
!               @access private
!               */
!               function get_can_spell()
!               {
!                       return $this->can_spell;
!               }
!               
!               /*!
!               @function get_sp_feed_type
!               @abstract Read Only, report if this spell service takes single 
words or strings. 
!               @author Angles
!               @discussion The calling spell class will ask if this spell 
service takes single words or strings. 
!               This function is exposed to the calling spell class for this 
purpose. The calling spell class then 
!               maked that information public.
!               @access private
!               */
!               function get_sp_feed_type()
!               {
!                       return $this->sp_feed_type;
!               }
!               
!               
/**************************************************************************\
!               *       CODE
!               
\**************************************************************************/
!               /*!
!               @function pgw_pspell_new
!               @abstract  dummy placeholder for spell-less installations
!               @param string language, string [spelling], string [jargon], 
string [encoding], int [mode]
!               @discussion returns False so ignorant calling code will sense 
something is wrong with 
!               spelling code.
!               @access public
!               */
!               function pgw_pspell_new($language, $spelling, $jargon, 
$encoding, $mode)
!               {
!                       return False;
!               }
!               
!               /*!
!               @function pgw_pspell_check
!               @abstract  dummy placeholder for spell-less installations
!               @param int dictionary_link, string word
!               @discussion Returns True to imitate a word is spelled 
correctly, then ignorant 
!               calling code will not ask for suggestions, hopefully.
!               @access public
!               */
!               function pgw_pspell_check($dictionary_link, $word)
!               {
!                       return True;
!               }
!               
!               /*!
!               @function pgw_pspell_suggest
!               @abstract  dummy placeholder for spell-less installations
!               @param int dictionary_link, string word
!               @discussion Returns empty array to imitate pspell hafving no 
suggestions, 
!               since this is a dummy module there are indeed no suggestions, 
and ignorant calling 
!               code will not act on any suggestions if it gets an empty array 
back.
!               @access public
!               */
!               function pgw_pspell_suggest($dictionary_link, $word)
!               {
!                       return array();
!               }
!       }
! ?>
--- 1,134 ----
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Module for phpGroupWare                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * http://www.phpgroupware.org                                           
                        * 
!       */
!       
/**************************************************************************\
!       * AngleMail - Email SpellChecking Backend Service Class                 
        *
!       * This file written by "Angles" Angelo Puglisi <address@hidden> *
!       * Email SpellChecking Backend Service Class - Dummy Class               
        *
!       * Copyright (C) 2002 Angelo Tony Puglisi (Angles)                       
                *
!       * 
-------------------------------------------------------------------------       
      *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
                                *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of    *
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       
!       /*!
!       @class spell_svc_none
!       @abstract  dummy placeholder for spell-less installations
!       @param can_spell (boolean) PRIVATE - flag if this is a working module 
or a dummy one
!       Only the calling spell class should access this, from there it is made 
public. 
!       @param $sp_feed_type (defined int) PRIVATE , if tis services takes 
single words or strings, 
!       values are defined in spell class, which gets the value from here and 
makes it public.
!       @author Angles
!       @discussion  If PHP psspell support is not compiled in,  this  dummy 
module 
!       spell_ svc_none is loaded so there are no errors related to undefined 
pspell functions.
!       @access public
!       */
!       class spell_svc_none
!       {
!               
/**************************************************************************\
!               *       VARS
!               
\**************************************************************************/
!               var $can_spell = False;
!               var $sp_feed_type;
!               
!               
/**************************************************************************\
!               *       CONSTRUCTOR
!               
\**************************************************************************/
!               function spell_svc_none()
!               {
!                       // this is a dummy module for installations with no 
spell capability
!                       $this->can_spell = False;
!                       // SP_FEED_UNKNOWN is defined in the spell class.
!                       $this->sp_feed_type = SP_FEED_UNKNOWN;
!                       return;
!               }
!               
!               
/**************************************************************************\
!               *       OO ACCESS METHODS
!               
\**************************************************************************/
!               /*!
!               @function get_can_spell
!               @abstract Read Only, report if this spell service is capable of 
spell check or not. 
!               @author Angles
!               @discussion The calling spell class will ask if this spell 
service is capable of spell check or not. 
!               This function is exposed to the calling spell class for this 
purpose. The calling spell class then 
!               maked that information public. This is a dummy placeholder 
module so it returns False.
!               @access private
!               */
!               function get_can_spell()
!               {
!                       return $this->can_spell;
!               }
!               
!               /*!
!               @function get_sp_feed_type
!               @abstract Read Only, report if this spell service takes single 
words or strings. 
!               @author Angles
!               @discussion The calling spell class will ask if this spell 
service takes single words or strings. 
!               This function is exposed to the calling spell class for this 
purpose. The calling spell class then 
!               maked that information public.
!               @access private
!               */
!               function get_sp_feed_type()
!               {
!                       return $this->sp_feed_type;
!               }
!               
!               
/**************************************************************************\
!               *       CODE
!               
\**************************************************************************/
!               /*!
!               @function pgw_pspell_new
!               @abstract  dummy placeholder for spell-less installations
!               @param string language, string [spelling], string [jargon], 
string [encoding], int [mode]
!               @discussion returns False so ignorant calling code will sense 
something is wrong with 
!               spelling code.
!               @access public
!               */
!               function pgw_pspell_new($language, $spelling, $jargon, 
$encoding, $mode)
!               {
!                       return False;
!               }
!               
!               /*!
!               @function pgw_pspell_check
!               @abstract  dummy placeholder for spell-less installations
!               @param int dictionary_link, string word
!               @discussion Returns True to imitate a word is spelled 
correctly, then ignorant 
!               calling code will not ask for suggestions, hopefully.
!               @access public
!               */
!               function pgw_pspell_check($dictionary_link, $word)
!               {
!                       return True;
!               }
!               
!               /*!
!               @function pgw_pspell_suggest
!               @abstract  dummy placeholder for spell-less installations
!               @param int dictionary_link, string word
!               @discussion Returns empty array to imitate pspell hafving no 
suggestions, 
!               since this is a dummy module there are indeed no suggestions, 
and ignorant calling 
!               code will not act on any suggestions if it gets an empty array 
back.
!               @access public
!               */
!               function pgw_pspell_suggest($dictionary_link, $word)
!               {
!                       return array();
!               }
!       }
! ?>

Index: class.spell_svc_php.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.spell_svc_php.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.spell_svc_php.inc.php 25 Oct 2002 12:56:57 -0000      1.1
--- class.spell_svc_php.inc.php 14 Mar 2003 04:01:10 -0000      1.2
***************
*** 1,136 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Module for phpGroupWare                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * http://www.phpgroupware.org                                           
                        * 
!       */
!       
/**************************************************************************\
!       * AngleMail - Email SpellChecking Backend Service Class                 
        *
!       * This file written by "Angles" Angelo Puglisi <address@hidden> *
!       * Email SpellChecking Backend Service Class - for PHP pspell Extension  
*
!       * Copyright (C) 2002 Angelo Tony Puglisi (Angles)                       
                *
!       * 
-------------------------------------------------------------------------       
      *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
                                *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of    *
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       
!       /*!
!       @class spell_svc_php
!       @abstract Wraps calls to the spell checking backend psspell buildin tp 
PHP
!       @param can_spell (boolean) PRIVATE - flag if this is a working module 
or a dummy one
!       Only the calling spell class should access this, from there it is made 
public.
!       @param $sp_feed_type (defined int) PRIVATE , if tis services takes 
single words or strings, 
!       values are defined in spell class, which gets the value from here and 
makes it public.
!       @author  Angles
!       @discussion  This is loaded if PHP has psspell support compiled in. If 
it is not 
!       compiled in, a dummy module spell_ svc_none is loaded so there are no 
errors 
!       related to undefined pspell functions.
!       */
!       class spell_svc_php
!       {
!               
/**************************************************************************\
!               *       VARS
!               
\**************************************************************************/
!               var $can_spell = True;
!               var $sp_feed_type;
!               
!               
/**************************************************************************\
!               *       CONSTRUCTOR
!               
\**************************************************************************/
!               function spell_svc_php()
!               {
!                       $this->can_spell = True;
!                       // SP_FEED_WORDS is defined in the spell class.
!                       $this->sp_feed_type = SP_FEED_WORDS;
!                       return;
!               }
!               
!               
/**************************************************************************\
!               *       OO ACCESS METHODS
!               
\**************************************************************************/
!               /*!
!               @function get_can_spell
!               @abstract Read Only, report if this spell service is capable of 
spell check or not. 
!               @author Angles
!               @discussion The calling spell class will ask if this spell 
service is capable of spell check or not. 
!               This function is exposed to the calling spell class for this 
purpose. The calling spell class then 
!               maked that information public.
!               @access private
!               */
!               function get_can_spell()
!               {
!                       return $this->can_spell;
!               }
!               
!               /*!
!               @function get_sp_feed_type
!               @abstract Read Only, report if this spell service takes single 
words or strings. 
!               @author Angles
!               @discussion The calling spell class will ask if this spell 
service takes single words or strings. 
!               This function is exposed to the calling spell class for this 
purpose. The calling spell class then 
!               maked that information public.
!               @access private
!               */
!               function get_sp_feed_type()
!               {
!                       return $this->sp_feed_type;
!               }
!               
!               
/**************************************************************************\
!               *       CODE
!               
\**************************************************************************/
!               /*!
!               @function pgw_pspell_new
!               @abstract wraps calls to "pspell_new"
!               @param string language, string [spelling], string [jargon], 
string [encoding], int [mode]
!               @discussion Php manual shows params to be: 
!               pspell_new  (string language, string [spelling], string 
[jargon], string [encoding], int [mode])
!               @access public
!               */
!               function pgw_pspell_new($language, $spelling, $jargon, 
$encoding, $mode)
!               {
!                       // open connection to dictionary backend
!                       // see: 
http://rock.earthlink.net/manual/mod/mod_php4/function.pspell-new.html
!                       return pspell_new($language, $spelling, $jargon, 
$encoding, $mode);
!               }
!               
!               
!               /*!
!               @function pgw_pspell_check
!               @abstract wraps calls to "pspell_check"
!               @param int dictionary_link, string word
!               @discussion Php manual shows params to be: 
!               pspell_check  (int dictionary_link, string word)
!               @access public
!               */
!               function pgw_pspell_check($dictionary_link, $word)
!               {
!                       return pspell_check($dictionary_link, $word);
!               }
! 
!               /*!
!               @function pgw_pspell_suggest
!               @abstract wraps calls to "pspell_suggest"
!               @param int dictionary_link, string word
!               @discussion Php manual shows params to be:  
!               pspell_suggest (int dictionary_link, string word)
!               @access public
!               */
!               function pgw_pspell_suggest($dictionary_link, $word)
!               {
!                       // 
http://rock.earthlink.net/manual/mod/mod_php4/function.pspell-suggest.html
!                       return pspell_suggest($dictionary_link, $word);
!               }
!       }
! ?>
--- 1,136 ----
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Module for phpGroupWare                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * http://www.phpgroupware.org                                           
                        * 
!       */
!       
/**************************************************************************\
!       * AngleMail - Email SpellChecking Backend Service Class                 
        *
!       * This file written by "Angles" Angelo Puglisi <address@hidden> *
!       * Email SpellChecking Backend Service Class - for PHP pspell Extension  
*
!       * Copyright (C) 2002 Angelo Tony Puglisi (Angles)                       
                *
!       * 
-------------------------------------------------------------------------       
      *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
                                *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of    *
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       
!       /*!
!       @class spell_svc_php
!       @abstract Wraps calls to the spell checking backend psspell buildin tp 
PHP
!       @param can_spell (boolean) PRIVATE - flag if this is a working module 
or a dummy one
!       Only the calling spell class should access this, from there it is made 
public.
!       @param $sp_feed_type (defined int) PRIVATE , if tis services takes 
single words or strings, 
!       values are defined in spell class, which gets the value from here and 
makes it public.
!       @author  Angles
!       @discussion  This is loaded if PHP has psspell support compiled in. If 
it is not 
!       compiled in, a dummy module spell_ svc_none is loaded so there are no 
errors 
!       related to undefined pspell functions.
!       */
!       class spell_svc_php
!       {
!               
/**************************************************************************\
!               *       VARS
!               
\**************************************************************************/
!               var $can_spell = True;
!               var $sp_feed_type;
!               
!               
/**************************************************************************\
!               *       CONSTRUCTOR
!               
\**************************************************************************/
!               function spell_svc_php()
!               {
!                       $this->can_spell = True;
!                       // SP_FEED_WORDS is defined in the spell class.
!                       $this->sp_feed_type = SP_FEED_WORDS;
!                       return;
!               }
!               
!               
/**************************************************************************\
!               *       OO ACCESS METHODS
!               
\**************************************************************************/
!               /*!
!               @function get_can_spell
!               @abstract Read Only, report if this spell service is capable of 
spell check or not. 
!               @author Angles
!               @discussion The calling spell class will ask if this spell 
service is capable of spell check or not. 
!               This function is exposed to the calling spell class for this 
purpose. The calling spell class then 
!               maked that information public.
!               @access private
!               */
!               function get_can_spell()
!               {
!                       return $this->can_spell;
!               }
!               
!               /*!
!               @function get_sp_feed_type
!               @abstract Read Only, report if this spell service takes single 
words or strings. 
!               @author Angles
!               @discussion The calling spell class will ask if this spell 
service takes single words or strings. 
!               This function is exposed to the calling spell class for this 
purpose. The calling spell class then 
!               maked that information public.
!               @access private
!               */
!               function get_sp_feed_type()
!               {
!                       return $this->sp_feed_type;
!               }
!               
!               
/**************************************************************************\
!               *       CODE
!               
\**************************************************************************/
!               /*!
!               @function pgw_pspell_new
!               @abstract wraps calls to "pspell_new"
!               @param string language, string [spelling], string [jargon], 
string [encoding], int [mode]
!               @discussion Php manual shows params to be: 
!               pspell_new  (string language, string [spelling], string 
[jargon], string [encoding], int [mode])
!               @access public
!               */
!               function pgw_pspell_new($language, $spelling, $jargon, 
$encoding, $mode)
!               {
!                       // open connection to dictionary backend
!                       // see: 
http://rock.earthlink.net/manual/mod/mod_php4/function.pspell-new.html
!                       return pspell_new($language, $spelling, $jargon, 
$encoding, $mode);
!               }
!               
!               
!               /*!
!               @function pgw_pspell_check
!               @abstract wraps calls to "pspell_check"
!               @param int dictionary_link, string word
!               @discussion Php manual shows params to be: 
!               pspell_check  (int dictionary_link, string word)
!               @access public
!               */
!               function pgw_pspell_check($dictionary_link, $word)
!               {
!                       return pspell_check($dictionary_link, $word);
!               }
! 
!               /*!
!               @function pgw_pspell_suggest
!               @abstract wraps calls to "pspell_suggest"
!               @param int dictionary_link, string word
!               @discussion Php manual shows params to be:  
!               pspell_suggest (int dictionary_link, string word)
!               @access public
!               */
!               function pgw_pspell_suggest($dictionary_link, $word)
!               {
!                       // 
http://rock.earthlink.net/manual/mod/mod_php4/function.pspell-suggest.html
!                       return pspell_suggest($dictionary_link, $word);
!               }
!       }
! ?>

Index: class.svc_nextmatches.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.svc_nextmatches.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.svc_nextmatches.inc.php       25 Oct 2002 12:56:57 -0000      1.1
--- class.svc_nextmatches.inc.php       14 Mar 2003 04:01:12 -0000      1.2
***************
*** 1,307 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare API - nextmatchs                                         
                *
!       * This file written by Joseph Engo <address@hidden>                     
*
!       * with email only additions by Angles <address@hidden>          *
!       * Handles limiting number of rows displayed                             
                *
!       * Small Email Only changes adapted from phpGroupWare API                
        *
!       * file by Joseph Engo <address@hidden>                                  
*
!       * Copyright (C) 2000, 2001 Joseph Engo                                  
                *
!       * Email only additions Copyright (C) 2002 Angelo "Angles" Puglisi       
                *
!       * 
-------------------------------------------------------------------------       
      *
!       * This library is part of the phpGroupWare API                          
                *
!       * http://www.phpgroupware.org/api                                       
                        * 
!       * 
------------------------------------------------------------------------        
      *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
                                *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of    *
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
! 
!       /* $Id$ */
!       /* $Source$ */
! 
!       /*!
!       @class svc_nextmatches
!       @abstract service class for email, implements nextmatches that ONLY 
EMAIL needs
!       */
!       class svc_nextmatches
!       {
!               var $maxmatches;
!               var $action;
!               var $template;
!               var $extra_filters = array();
!               
!               // fallback value, prefs will fill this later
!               //var $icon_size='16';
!               var $icon_size='24';
!               
!               // fallback value, prefs will fill this later
!               //var $icon_theme='evo';
!               var $icon_theme='moz';
!               
!               function svc_nextmatches($website=False)
!               {
!                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) 
&&
!                               
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) > 
0)
!                       {
!                               $this->maxmatches = 
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']);
!                       }
!                       else
!                       {
!                               $this->maxmatches = 15;
!                       }
! 
!                       if(isset($GLOBALS['phpgw']->msg->ref_GET['menuaction']))
!                       {
!                               $this->action = 
$GLOBALS['phpgw']->msg->ref_GET['menuaction'];
!                       }
!               }
!               
!               
!               function extras_to_string($extra)
!               {
!                       if(is_array($extra))
!                       {
!                               @reset($extra);
!                               while(list($var,$value) = each($extra))
!                               {
!                                       $t_extras[] = $var . '=' . $value;
!                               }
!                               $extra_s = '&' . implode('&',$t_extras);
!                       }
!                       return $extra_s;
!               }
! 
!               /*!
!               @function page
!               @abstract ?
!               */
!               function page($extravars='')
!               {
!                       if($extravars && is_string($extravars) && 
substr($extravars,0,1)!='&')
!                       {
!                               $extras = '&'.$extravars;
!                       }
!                       elseif($extravars && is_array($extravars))
!                       {
!                               @reset($extravars);
!                               while(list($var,$value) = each($extravars))
!                               {
!                                       if($var != 'menuaction')
!                                       {
!                                               $t_extras[] = $var.'='.$value;
!                                       }
!                               }
!                               $extras = implode($t_extras,'&');
!                       }
! 
!                       return 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->action.$extras);
!               }
! 
! 
!               
!               
!               /*!
!               @function show_sort_order_mail
!               @abstract ?
!               @param $old_sort : the current sort value
!               @param $new_sort : the sort value you want if you click on this
!               @param $default_order : users preference for ordering list 
items (force this when a new [different] sorting is requested)
!               @param $order : the current order (will be flipped if old_sort 
= new_sort)
!               @param $program : script file name
!               @param $text : Text the link will show
!               @param $extra : any extra stuff you want to pass, url style
!               */
!               function 
show_sort_order_mail($old_sort,$new_sort,$default_order,$order,$program,$text,$extra='')
!               {
!                       if(is_array($extra))
!                       {
!                               $extra = $this->extras_to_string($extra);
!                       }
!                       if($old_sort == $new_sort)
!                       {
!                               // alternate order, like on outkrook, click on 
present sorting reverses order
!                               if((int)$order == 1)
!                               {
!                                       $our_order = 0;
!                               }
!                               elseif((int)$order == 0)
!                               {
!                                       $our_order = 1;
!                               }
!                               else
!                               {
!                                       // we should never get here
!                                       $our_order = 1;
!                               }
!                       }
!                       else
!                       {
!                               //user has selected a new sort scheme, reset 
the order to users default
!                               $our_order = $default_order;
!                       }
!                       
!                       /*
!                       //$prog = explode('?',$program);
!                       //$extravar = 
$prog[1].'&order='.$our_order.'&sort='.$new_sort.$extra;
!                       //// this was b0rking menuaction when NOT using 
redirect, instead using direct object calls to goto the next page
!                       //// in thise cases the menuaction that appears in the 
url remains from the PREVIOUS action, not the object call produced next page
!                       ////$link = 
($this->action?$this->page($extravar):$GLOBALS['phpgw']->link($program,$extravar));
!                       ////$link = 
$GLOBALS['phpgw']->link($program,'email.index.uiindex'.$extravar);
!                       //$link = $GLOBALS['phpgw']->link($prog[0],$extravar);
!                       //return '<a href="' .$link .'">' .$text .'</a>';
!                       
!                       // get rid of setup specified "your server name" 
because the link below will 
!                       // add it back
!                       */
!                       
!                       //echo 'show_sort_order_mail: $program 
['.serialize($program).'] <br>';
!                       //echo 'show_sort_order_mail: $extra 
['.serialize($extra).'] <br>';
!                       $prog = explode('?',$program);
!                       //echo 'show_sort_order_mail: $prog 
['.serialize($prog).'] <br>';
!                       $extravar = 
$prog[1].'&order='.$our_order.'&sort='.$new_sort.$extra;
!                       //echo 'show_sort_order_mail: $extravar 
['.serialize($extravar).'] <br>';
!                       
!                       // this was b0rking menuaction when NOT using redirect, 
instead using direct object calls to goto the next page
!                       // in thise cases the menuaction that appears in the 
url remains from the PREVIOUS action, not the object call produced next page
!                       //$link = 
($this->action?$this->page($extravar):$GLOBALS['phpgw']->link($program,$extravar));
!                       //$link = 
$GLOBALS['phpgw']->link($program,'email.index.uiindex'.$extravar);
!                       $link = $GLOBALS['phpgw']->link($prog[0],$extravar);
!                       //echo 'show_sort_order_mail: $link 
['.serialize($link).'] <br>';
!                       return '<a href="' .$link .'">' .$text .'</a>';
! 
!               }
! 
!               /*!
!               @function nav_left_right_mail
!               @abstract same code as left and right (as of Dec 07, 2001) 
except all combined into one function
!               @param feed_vars : array with these elements: <br>
!                       start 
!                       total 
!                       cmd_prefix 
!                       cmd_suffix
!               @return array, combination of functions left and right above, 
with these elements:
!                       first_page
!                       prev_page
!                       next_page
!                       last_page
!               @author: jengo, some changes by Angles
!               */
!               function nav_left_right_mail($feed_vars)
!               {
!                       if 
((@$GLOBALS['phpgw']->msg->get_isset_pref('icon_theme'))
!                       && 
(@$GLOBALS['phpgw']->msg->get_isset_pref('icon_size')))
!                       {
!                               $this->icon_theme = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_theme');
!                               $this->icon_size = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_size');
!                       }
!                       //echo "icon size is ".$this->icon_size."<br>\r\n";
!                       
!                       $return_array = Array(
!                               'first_page' => '',
!                               'prev_page'  => '',
!                               'next_page'  => '',
!                               'last_page'  => ''
!                       );
!                       $out_vars = array();
!                       // things that might change
!                       $out_vars['start'] = $feed_vars['start'];
!                       // things that stay the same
!                       $out_vars['common_uri'] = $feed_vars['common_uri'];
!                       $out_vars['total'] = $feed_vars['total'];
! 
!                       // first page
!                       if(($feed_vars['start'] != 0) &&
!                               ($feed_vars['start'] > $this->maxmatches))
!                       {
!                               $out_vars['start'] = 0;
!                               $return_array['first_page'] = 
$this->set_link_mail('left',$this->icon_theme.'-arrow-2left-'.$this->icon_size.'.gif',lang('First
 page'),$out_vars);
!                       }
!                       else
!                       {
!                               $return_array['first_page'] = 
$this->set_icon_mail('left',$this->icon_theme.'-arrow-2left-no-'.$this->icon_size.'.gif',lang('First
 page'));
!                       }
!                       // previous page
!                       if($feed_vars['start'] != 0)
!                       {
!                               // Changing the sorting order screaws up the 
starting number
!                               if(($feed_vars['start'] - $this->maxmatches) < 
0)
!                               {
!                                       $out_vars['start'] = 0;
!                               }
!                               else
!                               {
!                                       $out_vars['start'] = 
($feed_vars['start'] - $this->maxmatches);
!                               }
!                               $return_array['prev_page'] = 
$this->set_link_mail('left',$this->icon_theme.'-arrow-left-'.$this->icon_size.'.gif',lang('Previous
 page'),$out_vars);
!                       }
!                       else
!                       {
!                               $return_array['prev_page'] = 
$this->set_icon_mail('left',$this->icon_theme.'-arrow-left-no-'.$this->icon_size.'.gif',lang('Previous
 page'));
!                       }
! 
!                       // re-initialize the out_vars
!                       // things that might change
!                       $out_vars['start'] = $feed_vars['start'];
!                       // next page
!                       if(($feed_vars['total'] > $this->maxmatches) &&
!                               ($feed_vars['total'] > $feed_vars['start'] + 
$this->maxmatches))
!                       {
!                               $out_vars['start'] = ($feed_vars['start'] + 
$this->maxmatches);
!                               $return_array['next_page'] = 
$this->set_link_mail('right',$this->icon_theme.'-arrow-right-'.$this->icon_size.'.gif',lang('Next
 page'),$out_vars);
!                       }
!                       else
!                       {
!                               $return_array['next_page'] = 
$this->set_icon_mail('right',$this->icon_theme.'-arrow-right-no-'.$this->icon_size.'.gif',lang('Next
 page'));
!                       }
!                       // last page
!                       if(($feed_vars['start'] != $feed_vars['total'] - 
$this->maxmatches) &&
!                               (($feed_vars['total'] - $this->maxmatches) > 
($feed_vars['start'] + $this->maxmatches)))
!                       {
!                               $out_vars['start'] = ($feed_vars['total'] - 
$this->maxmatches);
!                               $return_array['last_page'] = 
$this->set_link_mail('right',$this->icon_theme.'-arrow-2right-'.$this->icon_size.'.gif',lang('Last
 page'),$out_vars);
!                       }
!                       else
!                       {
!                               $return_array['last_page'] = 
$this->set_icon_mail('right',$this->icon_theme.'-arrow-2right-no-'.$this->icon_size.'.gif',lang('Last
 page'));
!                       }
!                       return $return_array;
!               }
!               
!               /*!
!               @function set_link_mail
!               @abstract ?
!               @param $img_src ?
!               @param $label ?
!               @param $link ?
!               @param $extravars ?
!               */
!               function set_link_mail($align,$img,$alt_text,$out_vars)
!               {
!                       $img_full = 
$GLOBALS['phpgw']->common->image('email',$img);
!                       $image_part = '<img src="'.$img_full.'" border="0" 
alt="'.$alt_text.'">';
!                       return '<a 
href="'.$out_vars['common_uri'].'&start='.$out_vars['start'].'">'.$image_part.'</a>';
!               }
! 
!               /*!
!               @function set_icon_mail
!               @abstract ?
!               @param $align ?
!               @param $img ?
!               @param $alt_text ?
!               */
!               function set_icon_mail($align,$img,$alt_text)
!               {
!                       $img_full = 
$GLOBALS['phpgw']->common->image('email',$img);
!                       return '<img src="'.$img_full.'" border="0" 
alt="'.$alt_text.'">'."\r\n";
!               }
!       }
! ?>
--- 1,369 ----
! <?php
!       
/**************************************************************************\
!       * phpGroupWare API - nextmatchs                                         
                *
!       * This file written by Joseph Engo <address@hidden>                     
*
!       * with email only additions by Angles <address@hidden>          *
!       * Handles limiting number of rows displayed                             
                *
!       * Small Email Only changes adapted from phpGroupWare API                
        *
!       * file by Joseph Engo <address@hidden>                                  
*
!       * Copyright (C) 2000, 2001 Joseph Engo                                  
                *
!       * Email only additions Copyright (C) 2002 Angelo "Angles" Puglisi       
                *
!       * 
-------------------------------------------------------------------------       
      *
!       * This library is part of the phpGroupWare API                          
                *
!       * http://www.phpgroupware.org/api                                       
                        * 
!       * 
------------------------------------------------------------------------        
      *
!       * This library is free software; you can redistribute it and/or modify 
it               *
!       * under the terms of the GNU Lesser General Public License as published 
by      *
!       * the Free Software Foundation; either version 2.1 of the License,      
                *
!       * or any later version.                                                 
                                *
!       * This library is distributed in the hope that it will be useful, but   
                *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of    *
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  *
!       * See the GNU Lesser General Public License for more details.           
        *
!       * You should have received a copy of the GNU Lesser General Public 
License      *
!       * along with this library; if not, write to the Free Software 
Foundation,               *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
        *
!       
\**************************************************************************/
! 
!       /* $Id$ */
!       /* $Source$ */
! 
!       /*!
!       @class svc_nextmatches
!       @abstract service class for email, implements nextmatches that ONLY 
EMAIL needs
!       */
!       class svc_nextmatches
!       {
!               var $maxmatches;
!               var $action;
!               var $template;
!               var $extra_filters = array();
!               
!               // fallback value, prefs will fill this later
!               //var $icon_size='16';
!               var $icon_size='24';
!               
!               // fallback value, prefs will fill this later
!               //var $icon_theme='evo';
!               var $icon_theme='moz';
!               
!               /*!
!               @function svc_nextmatches
!               @abstract constructor
!               */
!               function svc_nextmatches($website=False)
!               {
!                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) 
&&
!                               
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) > 
0)
!                       {
!                               $this->maxmatches = 
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']);
!                       }
!                       else
!                       {
!                               $this->maxmatches = 15;
!                       }
! 
!                       if(isset($GLOBALS['phpgw']->msg->ref_GET['menuaction']))
!                       {
!                               $this->action = 
$GLOBALS['phpgw']->msg->ref_GET['menuaction'];
!                       }
!               }
!               
!               
!               /*!
!               @function extras_to_string
!               @abstract ?
!               */
!               function extras_to_string($extra)
!               {
!                       if(is_array($extra))
!                       {
!                               @reset($extra);
!                               while(list($var,$value) = each($extra))
!                               {
!                                       $t_extras[] = $var . '=' . $value;
!                               }
!                               $extra_s = '&' . implode('&',$t_extras);
!                       }
!                       return $extra_s;
!               }
! 
!               /*!
!               @function page
!               @abstract ?
!               */
!               function page($extravars='')
!               {
!                       if($extravars && is_string($extravars) && 
substr($extravars,0,1)!='&')
!                       {
!                               $extras = '&'.$extravars;
!                       }
!                       elseif($extravars && is_array($extravars))
!                       {
!                               @reset($extravars);
!                               while(list($var,$value) = each($extravars))
!                               {
!                                       if($var != 'menuaction')
!                                       {
!                                               $t_extras[] = $var.'='.$value;
!                                       }
!                               }
!                               $extras = implode($t_extras,'&');
!                       }
!                       
!                       return 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->action.$extras);
!               }
!               
!               
!               /*!
!               @function show_sort_order_mail
!               @abstract email adapted nextmatches stuff 
!               @param $old_sort (int) the current sort value
!               @param $new_sort (int) the sort value you want if you click on 
this
!               @param $default_order (int) users preference for ordering list 
items (force this when a new [different] sorting is requested)
!               @param $order (int) the current order (will be flipped if 
old_sort = new_sort)
!               @param $program (string) script file name
!               @param $text (string) Text the link will show
!               @param $extra (string OR array) any extra stuff you want to 
pass, string uri style, if array it will be converted to uri style string. 
!               @return (string) a URL produced by the GLOBALS[phpgw]->link() 
command which was given params produced by this class. 
!               @discussion email app requires different nextmatches then the 
phpgwapi nextmatches, which was designed for SQL usage. 
!               The email app uses the mailserver, not a database, so requires 
different things here. ALSO this code is capable of 
!               handling the "new style" redirects fron the boaction class 
which is not a redirect but a direct object call 
!               to display the next page. 
!               @author phpgw team, Angles
!               */
!               function 
show_sort_order_mail($old_sort,$new_sort,$default_order,$order,$program,$text,$extra='')
!               {
!                       if(is_array($extra))
!                       {
!                               $extra = $this->extras_to_string($extra);
!                       }
!                       if($old_sort == $new_sort)
!                       {
!                               // alternate order, like on outkrook, click on 
present sorting reverses order
!                               if((int)$order == 1)
!                               {
!                                       $our_order = 0;
!                               }
!                               elseif((int)$order == 0)
!                               {
!                                       $our_order = 1;
!                               }
!                               else
!                               {
!                                       // we should never get here
!                                       $our_order = 1;
!                               }
!                       }
!                       else
!                       {
!                               //user has selected a new sort scheme, reset 
the order to users default
!                               $our_order = $default_order;
!                       }
!                       
!                       /*
!                       //$prog = explode('?',$program);
!                       //$extravar = 
$prog[1].'&order='.$our_order.'&sort='.$new_sort.$extra;
!                       //// this was b0rking menuaction when NOT using 
redirect, instead using direct object calls to goto the next page
!                       //// in thise cases the menuaction that appears in the 
url remains from the PREVIOUS action, not the object call produced next page
!                       ////$link = 
($this->action?$this->page($extravar):$GLOBALS['phpgw']->link($program,$extravar));
!                       ////$link = 
$GLOBALS['phpgw']->link($program,'email.index.uiindex'.$extravar);
!                       //$link = $GLOBALS['phpgw']->link($prog[0],$extravar);
!                       //return '<a href="' .$link .'">' .$text .'</a>';
!                       
!                       // get rid of setup specified "your server name" 
because the link below will 
!                       // add it back
!                       */
!                       
!                       //echo 'show_sort_order_mail: $program 
['.serialize($program).'] <br>';
!                       //echo 'show_sort_order_mail: $extra 
['.serialize($extra).'] <br>';
!                       $prog = explode('?',$program);
!                       //echo 'show_sort_order_mail: $prog 
['.serialize($prog).'] <br>';
!                       $extravar = 
$prog[1].'&order='.$our_order.'&sort='.$new_sort.$extra;
!                       //echo 'show_sort_order_mail: $extravar 
['.serialize($extravar).'] <br>';
!                       
!                       // this was b0rking menuaction when NOT using redirect, 
instead using direct object calls to goto the next page
!                       // in thise cases the menuaction that appears in the 
url remains from the PREVIOUS action, not the object call produced next page
!                       //$link = 
($this->action?$this->page($extravar):$GLOBALS['phpgw']->link($program,$extravar));
!                       //$link = 
$GLOBALS['phpgw']->link($program,'email.index.uiindex'.$extravar);
!                       $link = $GLOBALS['phpgw']->link($prog[0],$extravar);
!                       //echo 'show_sort_order_mail: $link 
['.serialize($link).'] <br>';
!                       return '<a href="' .$link .'">' .$text .'</a>';
! 
!               }
! 
!               /*!
!               @function nav_left_right_mail
!               @abstract same code as left and right (as of Dec 07, 2001) 
except all combined into one function
!               @param $feed_vars associative array, with these elements - 
!                       $feed_vars[start] (int) message idx to start the 
display with. 
!                       $feed_vars[total] (int) total number of messages to 
display. 
!                       $feed_vars[common_uri] (string) the part of the URI 
that is common to all result links. 
!               @return (array) complete links strings, including images as per 
email prefs, for navagation 
!               between message list pages, return array has these elements, 
all strings, element names are 
!               self describing as to their usage. 
!                       $return_array[first_page] 
!                       $return_array[prev_page] 
!                       $return_array[next_page] 
!                       $return_array[last_page] 
!               @author: jengo, some changes by Angles
!               */
!               function nav_left_right_mail($feed_vars)
!               {
!                       if 
((@$GLOBALS['phpgw']->msg->get_isset_pref('icon_theme'))
!                       && 
(@$GLOBALS['phpgw']->msg->get_isset_pref('icon_size')))
!                       {
!                               $this->icon_theme = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_theme');
!                               $this->icon_size = 
$GLOBALS['phpgw']->msg->get_pref_value('icon_size');
!                       }
!                       //echo "icon size is ".$this->icon_size."<br>\r\n";
!                       
!                       $return_array = Array(
!                               'first_page' => '',
!                               'prev_page'  => '',
!                               'next_page'  => '',
!                               'last_page'  => ''
!                       );
!                       $out_vars = array();
!                       // things that might change
!                       $out_vars['start'] = $feed_vars['start'];
!                       // things that stay the same
!                       $out_vars['common_uri'] = $feed_vars['common_uri'];
!                       $out_vars['total'] = $feed_vars['total'];
!                       
!                       // spice up the alt text with some < and << and > and 
>> entities
!                       $alt_text_first_page = '&lt; &lt; '.lang('First page');
!                       $alt_text_prev_page = '&lt; '.lang('Previous page');
!                       $alt_text_next_page = lang('Next page').' &gt;';
!                       $alt_text_last_page = lang('Last page').' &gt; &gt;';
!                       // first page
!                       if(($feed_vars['start'] != 0) &&
!                               ($feed_vars['start'] > $this->maxmatches))
!                       {
!                               $out_vars['start'] = 0;
!                               //$return_array['first_page'] = 
$this->set_link_mail('left',$this->icon_theme.'-arrow-2left-'.$this->icon_size.'.gif',lang('First
 page'),$out_vars);
!                               //$return_array['first_page'] = 
$this->set_link_mail('left',$this->icon_theme.'-arrow-2left-'.$this->icon_size.'.gif',$alt_text_first_page,$out_vars);
!                               $return_array['first_page'] = 
$this->set_link_mail('left',$this->icon_theme.'/arrow-2left-'.$this->icon_size,$alt_text_first_page,$out_vars);
!                       }
!                       else
!                       {
!                               //$return_array['first_page'] = 
$this->set_icon_mail('left',$this->icon_theme.'-arrow-2left-no-'.$this->icon_size.'.gif',lang('First
 page'));
!                               //$return_array['first_page'] = 
$this->set_icon_mail('left',$this->icon_theme.'-arrow-2left-no-'.$this->icon_size.'.gif',$alt_text_first_page);
!                               $return_array['first_page'] = 
$this->set_icon_mail('left',$this->icon_theme.'/arrow-2left-no-'.$this->icon_size,$alt_text_first_page);
!                       }
!                       // previous page
!                       if($feed_vars['start'] != 0)
!                       {
!                               // Changing the sorting order screaws up the 
starting number
!                               if(($feed_vars['start'] - $this->maxmatches) < 
0)
!                               {
!                                       $out_vars['start'] = 0;
!                               }
!                               else
!                               {
!                                       $out_vars['start'] = 
($feed_vars['start'] - $this->maxmatches);
!                               }
!                               //$return_array['prev_page'] = 
$this->set_link_mail('left',$this->icon_theme.'-arrow-left-'.$this->icon_size.'.gif',lang('Previous
 page'),$out_vars);
!                               //$return_array['prev_page'] = 
$this->set_link_mail('left',$this->icon_theme.'-arrow-left-'.$this->icon_size.'.gif',$alt_text_prev_page,$out_vars);
!                               $return_array['prev_page'] = 
$this->set_link_mail('left',$this->icon_theme.'/arrow-left-'.$this->icon_size,$alt_text_prev_page,$out_vars);
!                       }
!                       else
!                       {
!                               //$return_array['prev_page'] = 
$this->set_icon_mail('left',$this->icon_theme.'-arrow-left-no-'.$this->icon_size.'.gif',lang('Previous
 page'));
!                               //$return_array['prev_page'] = 
$this->set_icon_mail('left',$this->icon_theme.'-arrow-left-no-'.$this->icon_size.'.gif',$alt_text_prev_page);
!                               $return_array['prev_page'] = 
$this->set_icon_mail('left',$this->icon_theme.'/arrow-left-no-'.$this->icon_size,$alt_text_prev_page);
!                       }
! 
!                       // re-initialize the out_vars
!                       // things that might change
!                       $out_vars['start'] = $feed_vars['start'];
!                       // next page
!                       if(($feed_vars['total'] > $this->maxmatches) &&
!                               ($feed_vars['total'] > $feed_vars['start'] + 
$this->maxmatches))
!                       {
!                               $out_vars['start'] = ($feed_vars['start'] + 
$this->maxmatches);
!                               //$return_array['next_page'] = 
$this->set_link_mail('right',$this->icon_theme.'-arrow-right-'.$this->icon_size.'.gif',$alt_text_next_page,$out_vars);
!                               $return_array['next_page'] = 
$this->set_link_mail('right',$this->icon_theme.'/arrow-right-'.$this->icon_size,$alt_text_next_page,$out_vars);
!                       }
!                       else
!                       {
!                               //$return_array['next_page'] = 
$this->set_icon_mail('right',$this->icon_theme.'-arrow-right-no-'.$this->icon_size.'.gif',$alt_text_next_page);
!                               $return_array['next_page'] = 
$this->set_icon_mail('right',$this->icon_theme.'/arrow-right-no-'.$this->icon_size,$alt_text_next_page);
!                       }
!                       // last page
!                       if(($feed_vars['start'] != $feed_vars['total'] - 
$this->maxmatches) &&
!                               (($feed_vars['total'] - $this->maxmatches) > 
($feed_vars['start'] + $this->maxmatches)))
!                       {
!                               $out_vars['start'] = ($feed_vars['total'] - 
$this->maxmatches);
!                               //$return_array['last_page'] = 
$this->set_link_mail('right',$this->icon_theme.'-arrow-2right-'.$this->icon_size.'.gif',$alt_text_last_page,$out_vars);
!                               $return_array['last_page'] = 
$this->set_link_mail('right',$this->icon_theme.'/arrow-2right-'.$this->icon_size,$alt_text_last_page,$out_vars);
!                       }
!                       else
!                       {
!                               //$return_array['last_page'] = 
$this->set_icon_mail('right',$this->icon_theme.'-arrow-2right-no-'.$this->icon_size.'.gif',$alt_text_last_page);
!                               $return_array['last_page'] = 
$this->set_icon_mail('right',$this->icon_theme.'/arrow-2right-no-'.$this->icon_size,$alt_text_last_page);
!                       }
!                       return $return_array;
!               }
!               
!               /*!
!               @function set_link_mail
!               @abstract used by "nav_left_right_mail" to make the individual 
HREF links, including image. 
!               @param $align DEPRECIATED  
!               @param $img (string) name of the image, WITHOUT PATH, phpgwapi 
is used in the function to get the path.  
!               @param $alt_text (string) the ALT TEXT to display of no image 
is used. 
!               @param $out_vars associative array that is the $feed_vars param 
to "nav_left_right_mail" that may have been 
!               altered during that function, which that function uses when it 
calls this function, it has these elements 
!               $out_vars[start] , $out_vars[common_uri] , $out_vars[total] , 
see "nav_left_right_mail" for more info. 
!               @result (string) individual HREF links, including image, used 
in "nav_left_right_mail"
!               @author phpgwapi team, Angles 
!               */
!               function set_link_mail($align,$img,$alt_text,$out_vars)
!               {
!                       $button_type = 
$GLOBALS['phpgw']->msg->get_pref_value('button_type');
!                       // in reality we never show BOTH text and image for the 
page nav links
!                       // so here we respect only just text, or else the 
default is just image
!                       if ($button_type == 'text')
!                       {
!                               $display_text = '['.$alt_text.']';
!                               return '<a 
href="'.$out_vars['common_uri'].'&start='.$out_vars['start'].'">'.$display_text.'</a>';
!                       }
!                       else
!                       {
!                               //$img_full = 
$GLOBALS['phpgw']->common->image('email',$img);
!                               $img_full = 
$GLOBALS['phpgw']->msg->_image_on('email',$img,'_on');
!                               $image_part = '<img src="'.$img_full.'" 
border="0" alt="'.$alt_text.'">';
!                               return '<a 
href="'.$out_vars['common_uri'].'&start='.$out_vars['start'].'">'.$image_part.'</a>';
!                       }
!               }
! 
!               /*!
!               @function set_icon_mail
!               @abstract used by "nav_left_right_mail" to get the desired IMG 
url 
!               @param $align DEPRECIATED  
!               @param $img (string) name of the image, WITHOUT PATH, phpgwapi 
is used in the function to get the path.  
!               @param $alt_text (string) the ALT TEXT to display of no image 
is used. 
!               @result (string) IMG part of the link, used by 
"nav_left_right_mail" 
!               @discussion Primarily used when no actual link is returned, 
because there is no page to navigate to, 
!               this usually is used to make the IMG of the image that 
indicates no navagation is possible in that direction. 
!               @author phpgwapi team, Angles
!               */
!               function set_icon_mail($align,$img,$alt_text)
!               {
!                       $button_type = 
$GLOBALS['phpgw']->msg->get_pref_value('button_type');
!                       // in reality we never show BOTH text and image for the 
page nav links
!                       // so here we respect only just text, or else the 
default is just image
!                       if ($button_type == 'text')
!                       {
!                               $display_text = '<i><small>['.$alt_text.' 
]</small></i>';
!                               return $display_text;
!                       }
!                       else
!                       {
!                               //$img_full = 
$GLOBALS['phpgw']->common->image('email',$img);
!                               $img_full = 
$GLOBALS['phpgw']->msg->_image_on('email',$img,'_on');
!                               return '<img src="'.$img_full.'" border="0" 
alt="'.$alt_text.'">'."\r\n"; 
!                       }
!               }
!       }
! ?>

Index: class.ui_mail_debug.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.ui_mail_debug.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.ui_mail_debug.inc.php 25 Oct 2002 12:56:57 -0000      1.1
--- class.ui_mail_debug.inc.php 14 Mar 2003 04:01:12 -0000      1.2
***************
*** 1,432 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - E-Mail Module for phpGroupWare                            
        *
!       * http://www.anglemail.org                                              
                        *
!       * http://www.phpgroupware.org                                           
                        * 
!       */
!       
/**************************************************************************\
!       * AngleMail - E-Mail Debug Page                                         
                *
!       * This file written by "Angles" Angelo Puglisi <address@hidden> *
!       * Debug Utility Functions and Information and Document Access           
        *
[...1008 lines suppressed...]
!                       }
!               }
!               
!               function so_delete_data($data_key)
!               {
!                       $account_id = 
get_account_id($accountid,$GLOBALS['phpgw']->session->account_id);
!                       $data_key = 
$GLOBALS['phpgw']->db->db_addslashes($data_key);
!                       $GLOBALS['phpgw']->db->query("DELETE FROM 
phpgw_anglemail "
!                               . " WHERE account_id='" . $account_id . "' AND 
data_key='" . $data_key . "'",__LINE__,__FILE__);
!               }
!               
!               function so_clear_all_data_this_user()
!               {
!                       $account_id = 
get_account_id($accountid,$GLOBALS['phpgw']->session->account_id);
!                       $GLOBALS['phpgw']->db->query("DELETE FROM 
phpgw_anglemail "
!                               . " WHERE account_id='" . $account_id . 
"'",__LINE__,__FILE__);
!               }
!               
!       }
! ?>

Index: class.uiattach_file.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uiattach_file.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.uiattach_file.inc.php 25 Oct 2002 12:56:57 -0000      1.1
--- class.uiattach_file.inc.php 14 Mar 2003 04:01:13 -0000      1.2
***************
*** 1,93 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - email UI Class for Attaching Files                        
                        *
!       * http://www.anglemail.org                                              
                        *
!       * File adapted directly from phpGroupWare file email/attach_file.php    
        *
!       * http://www.phpgroupware.org                                           
                        *
!       * This file deals only with the UI display of the bo class file         
        *
!       * Copyright 2002 Angles Puglisi                                         
        *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       class uiattach_file
!       {
!               var $public_functions = array(
!                       'attach'        => True
!                       //'show_ui'     => True
!               );
!               var $bo;
!               
!               var $debug = 0;
!               //var $debug = 3;
!               //var $debug = 4;
!               
!               function uiattach_file()
!               {
!                       return;
!               }
!               
!               function attach()
!               {
!                       if ($this->debug > 0) { echo 'ENTERING 
emai.uiattach_file.attach'.'<br>'; }
!                       if ($this->debug > 2) { echo 
'emai.uiattach_file.attach: initial $GLOBALS[phpgw_info][flags] DUMP<pre>'; 
print_r($GLOBALS['phpgw_info']['flags']);  echo '</pre>'; }
!                       //return;
!                       
!                       
!                       $phpgw_flags = Array(
!                               'currentapp' => 'email',
!                               'enable_network_class' => True,
!                               'noheader'   => True,
!                               'nonavbar'   => True
!                       );
!                       
!                       $GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
!                       
!                       $GLOBALS['phpgw']->template->set_file(
!                               Array(
!                                       'T_attach_file' => 'attach_file.tpl',
!                                       'T_attach_file_blocks' => 
'attach_file_blocks.tpl'
!                               )
!                       );
!                       
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_alert_msg','V_alert_msg');
!                       
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_attached_list','V_attached_list');
!                       
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_attached_none','V_attached_none');
!                       
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_delete_btn','V_delete_btn');
!                       
!                       // create boattach_file object
!                       $this->bo = CreateObject('email.boattach_file');
!                       // tell it we want it to fill the global template we 
establisted above
!                       // DO NOT USE AMPERSAND because we declare the param as 
a reference when we made the function 
!                       
$this->bo->set_ref_var_holder($GLOBALS['phpgw']->template);
!                       // now run the code
!                       $this->bo->attach();
!                       
!                       // ... the boattach_file class all the work ...
!                       
!                       // output the HTML
!                       $GLOBALS['phpgw']->template->pfp('out','T_attach_file');
!                       
!                       //$GLOBALS['phpgw']->common->phpgw_exit();
!                       if (is_object($GLOBALS['phpgw']->msg))
!                       {
!                               // close down ALL mailserver streams
!                               $GLOBALS['phpgw']->msg->end_request();
!                               // destroy the object
!                               $GLOBALS['phpgw']->msg = '';
!                               unset($GLOBALS['phpgw']->msg);
!                       }
!                       
!                       // shut down this transaction
!                       $GLOBALS['phpgw']->common->phpgw_exit(False);
!                       
!                       if ($this->debug > 0) { echo 'LEAVING 
emai.uiattach_file.attach'.'<br>'; }
!               }
!       
!       
!       }
! ?>
--- 1,93 ----
! <?php
!       
/**************************************************************************\
!       * AngleMail - email UI Class for Attaching Files                        
                        *
!       * http://www.anglemail.org                                              
                        *
!       * File adapted directly from phpGroupWare file email/attach_file.php    
        *
!       * http://www.phpgroupware.org                                           
                        *
!       * This file deals only with the UI display of the bo class file         
        *
!       * Copyright 2002 Angles Puglisi                                         
        *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       class uiattach_file
!       {
!               var $public_functions = array(
!                       'attach'        => True
!                       //'show_ui'     => True
!               );
!               var $tpl;
!               var $bo;
!               
!               var $debug = 0;
!               //var $debug = 3;
!               //var $debug = 4;
!               
!               function uiattach_file()
!               {
!                       //return;
!               }
!               
!               function attach()
!               {
!                       if ($this->debug > 0) { echo 'ENTERING 
emai.uiattach_file.attach'.'<br>'; }
!                       if ($this->debug > 2) { echo 
'emai.uiattach_file.attach: initial $GLOBALS[phpgw_info][flags] DUMP<pre>'; 
print_r($GLOBALS['phpgw_info']['flags']);  echo '</pre>'; }
!                       //return;
!                       
!                       
!                       $phpgw_flags = Array(
!                               'currentapp' => 'email',
!                               'enable_network_class' => True,
!                               'noheader'   => True,
!                               'nonavbar'   => True
!                       );
!                       
!                       $GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
!                       
!                       $GLOBALS['phpgw']->template->set_file(
!                               Array(
!                                       'T_attach_file' => 'attach_file.tpl',
!                                       'T_attach_file_blocks' => 
'attach_file_blocks.tpl'
!                               )
!                       );
!                       
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_alert_msg','V_alert_msg');
!                       
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_attached_list','V_attached_list');
!                       
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_attached_none','V_attached_none');
!                       
$GLOBALS['phpgw']->template->set_block('T_attach_file_blocks','B_delete_btn','V_delete_btn');
!                       
!                       // create boattach_file object
!                       $this->bo = CreateObject('email.boattach_file');
!                       // tell it we want it to fill the global template we 
establisted above
!                       // DO NOT USE AMPERSAND because we declare the param as 
a reference when we made the function 
!                       
$this->bo->set_ref_var_holder($GLOBALS['phpgw']->template);
!                       // now run the code
!                       $this->bo->attach();
!                       
!                       // ... the boattach_file class all the work ...
!                       
!                       // output the HTML
!                       $GLOBALS['phpgw']->template->pfp('out','T_attach_file');
!                       
!                       //$GLOBALS['phpgw']->common->phpgw_exit();
!                       if (is_object($GLOBALS['phpgw']->msg))
!                       {
!                               // close down ALL mailserver streams
!                               $GLOBALS['phpgw']->msg->end_request();
!                               // destroy the object
!                               $GLOBALS['phpgw']->msg = '';
!                               unset($GLOBALS['phpgw']->msg);
!                       }
!                       
!                       // shut down this transaction
!                       if ($this->debug > 0) { echo 'LEAVING 
emai.uiattach_file.attach with call to phpgw_exit'.'<br>'; }
!                       $GLOBALS['phpgw']->common->phpgw_exit(False);
!               }
!       
!       
!       }
! ?>

Index: class.uicompose.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uicompose.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.uicompose.inc.php     25 Oct 2002 12:45:53 -0000      1.3
--- class.uicompose.inc.php     14 Mar 2003 04:01:20 -0000      1.4
***************
*** 1,131 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - email UI Class for Message Lists                       
        *
!       * http://www.phpgroupware.org                                           
        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       
!       class uicompose
!       {
!               var $bo;                
!               var $debug = 0;
!               var $widgets;
! 
!               var $public_functions = array(
!                       'compose' => True
!               );
! 
!               function uicompose()
!               {
!                       return;
!               }
!               
!               /*!
!               @function compose
!               @abstract calls bocompose and makes the compose page
!               @author Angles
!               @description ?
!               @access public
!               */
!               function compose($reuse_feed_args='')
!               {
!                       if ((is_string($reuse_feed_args))
!                       && ($reuse_feed_args == ''))
!                       {
!                               // we were passed an empty string, make it an 
empty array just to be consistant
!                               $reuse_feed_args = array();
!                               
!                       }
!                       // ok, class.spell will pass $special_instructions as 
$reuse_feed_args string data, 
!                       // this must be passed onto bocompose->compose()
!                       
!                       $this->bo = CreateObject("email.bocompose");
!                       // concept of $reuse_feed_args is depreciated HOWEVER 
the spell code will 
!                       // pass "special_instructions" back to bocompose, so 
leave this here
!                       $this->bo->compose($reuse_feed_args);
!                       
!                       // we are the BO and the UI, we take care of outputting 
the HTML to the client browser
!                       unset($GLOBALS['phpgw_info']['flags']['noheader']);
!                       unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
!                       $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
!                       $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
!                       $GLOBALS['phpgw']->common->phpgw_header();
!                       
!                       $GLOBALS['phpgw']->template->set_file(
!                               Array(
!                                       'T_compose_out' => 'compose.tpl'
!                               )
!                       );
!                       
$GLOBALS['phpgw']->template->set_block('T_compose_out','B_checkbox_sig','V_checkbox_sig');
!                       
!                       if ($this->debug > 2) { echo 'GLOBALS[phpgw_info] 
dump:<pre>'; print_r($GLOBALS['phpgw_info']) ; echo '</pre>'; }
!                       
!                       //= = = = TESTING NEW TOOLBAR WIDGET = = = 
!                       $this->widgets = CreateObject('email.html_widgets');
!                       
$GLOBALS['phpgw']->template->set_var('widget_toolbar',$this->widgets->get_toolbar());
!                       
!                       // fill template vars
!                       $tpl_vars = Array(
!                               'to_box_value'          => 
$this->bo->xi['to_box_value'],
!                               'cc_box_value'          => 
$this->bo->xi['cc_box_value'],
!                               'bcc_box_value'         => 
$this->bo->xi['bcc_box_value'],
!                               'subj_box_value'        => 
$this->bo->xi['subject'],
!                               'body_box_value'        => 
$this->bo->xi['body'],
!                               'form1_action'          => 
$this->bo->xi['send_btn_action'],
!                               //The addybook's window width
!                               'jsaddybook_width'      => 
$this->bo->xi['jsaddybook_width'],
!                               //The addybook's window height
!                               'jsaddybook_height'     => 
$this->bo->xi['jsaddybook_height'],
!                               'form1_name'            => 
$this->bo->xi['form1_name'],
!                               'form1_method'          => 
$this->bo->xi['form1_method'],
!                               'js_addylink'           => 
$this->bo->xi['js_addylink'],
!                               'buttons_bgcolor'       => 
$this->bo->xi['buttons_bgcolor'],
!                               'to_boxs_bgcolor'       => 
$this->bo->xi['to_boxs_bgcolor'],
!                               'to_boxs_font'          => 
$this->bo->xi['to_boxs_font'],
!                               'to_box_desc'           => 
$this->bo->xi['to_box_desc'],
!                               'to_box_name'           => 
$this->bo->xi['to_box_name'],
!                               'cc_box_desc'           => 
$this->bo->xi['cc_box_desc'],
!                               'cc_box_name'           => 
$this->bo->xi['cc_box_name'],
!                               'bcc_box_desc'          => 
$this->bo->xi['bcc_box_desc'],
!                               'bcc_box_name'          => 
$this->bo->xi['bcc_box_name'],
!                               'subj_box_desc'         => 
$this->bo->xi['subj_box_desc'],
!                               'subj_box_name'         => 
$this->bo->xi['subj_box_name'],
!                               'checkbox_sig_desc'     => 
$this->bo->xi['checkbox_sig_desc'],
!                               'checkbox_sig_name'     => 
$this->bo->xi['checkbox_sig_name'],
!                               'checkbox_sig_value'    => 
$this->bo->xi['checkbox_sig_value'],
!                               //Step One addition for req read notifications
!                               'checkbox_req_notify_desc'      => 
$this->bo->xi['checkbox_req_notify_desc'],
!                               'checkbox_req_notify_name'      => 
$this->bo->xi['checkbox_req_notify_name'],
!                               'checkbox_req_notify_value'     => 
$this->bo->xi['checkbox_req_notify_value'],
!                               'app_images'            => 
$this->bo->xi['image_dir'],
!                               'toolbar_font'                  => 
$this->bo->xi['toolbar_font'],
!                               'addressbook_button'    => 
$this->bo->xi['addressbook_button'],
!                               'send_button'                   => 
$this->bo->xi['send_button'],
!                               'spellcheck_button'             => 
$this->bo->xi['spellcheck_button'],
!                               'attachfile_js_button'          => 
$this->bo->xi['attachfile_js_button'], 
!                               'body_box_name'         => 
$this->bo->xi['body_box_name']
!                       );
!                       $GLOBALS['phpgw']->template->set_var($tpl_vars);
!                       if ($this->bo->xi['do_checkbox_sig'])
!                       {
!                               
$GLOBALS['phpgw']->template->parse('V_checkbox_sig','B_checkbox_sig');
!                       }
!                       else
!                       {
!                               
$GLOBALS['phpgw']->template->set_var('V_checkbox_sig','');
!                       }
!                       
!                       $GLOBALS['phpgw']->msg->end_request();
!                       
!                       // we are the BO and the UI, we take care of outputting 
the HTML to the client browser
!                       $GLOBALS['phpgw']->template->pfp('out','T_compose_out');
!               }
!       }
! ?>
--- 1,192 ----
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - email UI Class for Message Lists                       
        *
!       * http://www.phpgroupware.org                                           
        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
!       
!       /* $Id$ */
!       
!       class uicompose
!       {
!               var $bo;                
!               var $debug = 0;
!               var $tpl;
!               var $widgets;
! 
!               var $public_functions = array(
!                       'compose' => True
!               );
! 
!               function uicompose()
!               {
!                       //return;
!               }
!               
!               /*!
!               @function compose
!               @abstract calls bocompose and makes the compose page
!               @author Angles
!               @description ?
!               @access public
!               */
!               function compose($reuse_feed_args='')
!               {                       
!                       if ((is_string($reuse_feed_args))
!                       && ($reuse_feed_args == ''))
!                       {
!                               // we were passed an empty string, make it an 
empty array just to be consistant
!                               $reuse_feed_args = array();
!                               
!                       }
!                       // ok, class.spell will pass $special_instructions as 
$reuse_feed_args string data, 
!                       // this must be passed onto bocompose->compose()
!                       
!                       $this->bo = CreateObject("email.bocompose");
!                       // concept of $reuse_feed_args is depreciated HOWEVER 
the spell code will 
!                       // pass "special_instructions" back to bocompose, so 
leave this here
!                       $this->bo->compose($reuse_feed_args);
!                       
!                       if ($GLOBALS['phpgw']->msg->phpgw_0914_orless)
!                       {
!                               // we point to the global template for this 
version of phpgw templatings
!                               $this->tpl =& $GLOBALS['phpgw']->template;
!                               //$this->tpl = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
!                       }
!                       else
!                       {
!                               // we use a PRIVATE template object for 0.9.14 
conpat and during xslt porting
!                               $this->tpl = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
!                       }
!                       
!                       if ($GLOBALS['phpgw']->msg->phpgw_0914_orless)
!                       {
!                               // we are the BO and the UI, we take care of 
outputting the HTML to the client browser
!                               
unset($GLOBALS['phpgw_info']['flags']['noheader']);
!                               
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
!                               $GLOBALS['phpgw_info']['flags']['noappheader'] 
= True;
!                               $GLOBALS['phpgw_info']['flags']['noappfooter'] 
= True;
!                               $GLOBALS['phpgw']->common->phpgw_header();
!                       }
!                       else
!                       {
!                               
$GLOBALS['phpgw']->xslttpl->add_file(array('app_data',
!                                                                               
        $GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header')
!                                                                               
        );
!                       }
!                       
!                       $this->tpl->set_file(
!                               Array(
!                                       'T_compose_out' => 'compose.tpl'
!                               )
!                       );
!                       
$this->tpl->set_block('T_compose_out','B_checkbox_sig','V_checkbox_sig');
!                       
!                       if ($this->debug > 2) { echo 'GLOBALS[phpgw_info] 
dump:<pre>'; print_r($GLOBALS['phpgw_info']) ; echo '</pre>'; }
!                       
!                       //= = = = TOOLBAR WIDGET = = = 
!                       $this->widgets = CreateObject('email.html_widgets');
!                       
$this->tpl->set_var('widget_toolbar',$this->widgets->get_toolbar());
!                       
!                       // fill template vars
!                       $tpl_vars = Array(
!                               'to_box_value'          => 
$this->bo->xi['to_box_value'],
!                               'cc_box_value'          => 
$this->bo->xi['cc_box_value'],
!                               'bcc_box_value'         => 
$this->bo->xi['bcc_box_value'],
!                               'subj_box_value'        => 
$this->bo->xi['subject'],
!                               'body_box_value'        => 
$this->bo->xi['body'],
!                               'form1_action'          => 
$this->bo->xi['send_btn_action'],
!                               //The addybook's window width
!                               'jsaddybook_width'      => 
$this->bo->xi['jsaddybook_width'],
!                               //The addybook's window height
!                               'jsaddybook_height'     => 
$this->bo->xi['jsaddybook_height'],
!                               'form1_name'            => 
$this->bo->xi['form1_name'],
!                               'form1_method'          => 
$this->bo->xi['form1_method'],
!                               'js_addylink'           => 
$this->bo->xi['js_addylink'],
!                               'buttons_bgcolor'       => 
$this->bo->xi['buttons_bgcolor'],
!                               'buttons_bgcolor_class' => 
$this->bo->xi['buttons_bgcolor_class'],
!                               'to_boxs_bgcolor'       => 
$this->bo->xi['to_boxs_bgcolor'],
!                               'to_boxs_bgcolor_class' => 
$this->bo->xi['to_boxs_bgcolor_class'],
!                               'to_boxs_font'          => 
$this->bo->xi['to_boxs_font'],
!                               'to_box_desc'           => 
$this->bo->xi['to_box_desc'],
!                               'to_box_name'           => 
$this->bo->xi['to_box_name'],
!                               'cc_box_desc'           => 
$this->bo->xi['cc_box_desc'],
!                               'cc_box_name'           => 
$this->bo->xi['cc_box_name'],
!                               'bcc_box_desc'          => 
$this->bo->xi['bcc_box_desc'],
!                               'bcc_box_name'          => 
$this->bo->xi['bcc_box_name'],
!                               'subj_box_desc'         => 
$this->bo->xi['subj_box_desc'],
!                               'subj_box_name'         => 
$this->bo->xi['subj_box_name'],
!                               'checkbox_sig_desc'     => 
$this->bo->xi['checkbox_sig_desc'],
!                               'checkbox_sig_name'     => 
$this->bo->xi['checkbox_sig_name'],
!                               'checkbox_sig_value'    => 
$this->bo->xi['checkbox_sig_value'],
!                               //Step One addition for req read notifications
!                               'checkbox_req_notify_desc'      => 
$this->bo->xi['checkbox_req_notify_desc'],
!                               'checkbox_req_notify_name'      => 
$this->bo->xi['checkbox_req_notify_name'],
!                               'checkbox_req_notify_value'     => 
$this->bo->xi['checkbox_req_notify_value'],
!                               'app_images'            => 
$this->bo->xi['image_dir'],
!                               'toolbar_font'                  => 
$this->bo->xi['toolbar_font'],
!                               'addressbook_button'    => 
$this->bo->xi['addressbook_button'],
!                               'send_button'                   => 
$this->bo->xi['send_button'],
!                               'spellcheck_button'             => 
$this->bo->xi['spellcheck_button'],
!                               'attachfile_js_button'          => 
$this->bo->xi['attachfile_js_button'], 
!                               'attachfile_js_onclick'          => 
$this->bo->xi['attachfile_js_onclick'],
!                               'body_box_name'         => 
$this->bo->xi['body_box_name']
!                       );
!                       $this->tpl->set_var($tpl_vars);
!                       if ($this->bo->xi['ischecked_checkbox_sig'])
!                       {
!                               
$this->tpl->set_var('ischecked_checkbox_sig','checked');
!                       }
!                       else
!                       {
!                               
$this->tpl->set_var('ischecked_checkbox_sig','');
!                       }
!                       // remember, we show the checkbox for the sig only if 
the user has some sig test in the prefs
!                       if ($this->bo->xi['do_checkbox_sig'])
!                       {
!                               
$this->tpl->parse('V_checkbox_sig','B_checkbox_sig');
!                       }
!                       else
!                       {
!                               $this->tpl->set_var('V_checkbox_sig','');
!                       }
!                       if ($this->bo->xi['ischecked_checkbox_req_notify'])
!                       {
!                               
$this->tpl->set_var('ischecked_checkbox_req_notify','checked');
!                       }
!                       else
!                       {
!                               
$this->tpl->set_var('ischecked_checkbox_req_notify','');
!                       }
!                       
!                       if ($GLOBALS['phpgw']->msg->phpgw_0914_orless)
!                       {
!                               // we are the BO and the UI, we take care of 
outputting the HTML to the client browser
!                               $this->tpl->pfp('out','T_compose_out');
!                       }
!                       else
!                       {
!                               $this->tpl->set_unknowns('comment');
!                               //$this->tpl->set_unknowns('remove');
!                               $data = array();
!                               $data['appname'] = lang('E-Mail');
!                               $data['function_msg'] = lang('compose message');
!                               $data['email_page'] = 
$this->tpl->parse('out','T_compose_out');
!                               // new way to handle debug data, if this array 
has anything, put it in the template source data vars
!                               if ($GLOBALS['phpgw']->msg->debugdata)
!                               {
!                                       $data['debugdata'] = 
$GLOBALS['phpgw']->msg->dbug->get_debugdata_stack();
!                               }
!                               
//$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('uimessage' => $data));
!                               
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('generic_out' => $data));
!                       }
!                       
!                       $GLOBALS['phpgw']->msg->end_request();
!               }
!       }
! ?>

Index: class.uifilters.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uifilters.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** class.uifilters.inc.php     25 Oct 2002 12:45:53 -0000      1.11
--- class.uifilters.inc.php     14 Mar 2003 04:01:20 -0000      1.12
***************
*** 1,660 ****
! <?php
!       
/**************************************************************************\
!       * AngleMail - Sieve Email Filters and Search Mode                       
                *
!       * http://www.anglemail.org                                              
                        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * Copyright (C) 2001, 2002 Angelo Puglisi (Angles)                      
                *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
[...1468 lines suppressed...]
!                       }
!                       else
!                       {
!                               $this->tpl->set_unknowns('comment');
!                               //$this->tpl->set_unknowns('remove');
!                               $data = array();
!                               $data['appname'] = lang('E-Mail');
!                               $data['function_msg'] = lang('Filters List');
!                               $data['email_page'] = 
$this->tpl->parse('out','T_filters_list');
!                               
//$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('uimessage' => $data));
!                               
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('generic_out' => $data));
!                       }
!                               
!                       // tell the msg object we are done with it
!                       $GLOBALS['phpgw']->msg->end_request();
!               }
!               
!               
!       }
! ?>

Index: class.uifolder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uifolder.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.uifolder.inc.php      25 Oct 2002 12:45:53 -0000      1.3
--- class.uifolder.inc.php      14 Mar 2003 04:01:20 -0000      1.4
***************
*** 1,122 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - email UI Class for Message Lists                       
        *
!       * http://www.phpgroupware.org                                           
        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       class uifolder
!       {
!               var $bo;
!               var $widgets;
!               var $debug = False;
! 
!               var $public_functions = array(
!                       'folder' => True
!               );
! 
!               function uifolder()
!               {
!                       return;
!               }
!               
!               function folder()
!               {
!                       $this->bo = CreateObject('email.bofolder');
!                       $this->bo->folder();
!                       
!                       unset($GLOBALS['phpgw_info']['flags']['noheader']);
!                       unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
!                       $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
!                       $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
!                       $GLOBALS['phpgw']->common->phpgw_header();
!                       // HOWEVER still this class must NOT invoke 
$GLOBALS['phpgw']->common->phpgw_header()
!                       // even though we had to output the header (go 
figure... :)
!                       $GLOBALS['phpgw']->template->set_file(
!                               Array(
!                                       'T_folder_out' => 'folder.tpl'
!                               )
!                       );
!                       
$GLOBALS['phpgw']->template->set_block('T_folder_out','B_folder_list','V_folder_list');
                 
!                       
!                       //= = = = TESTING NEW TOOLBAR WIDGET = = = 
!                       $this->widgets = CreateObject('email.html_widgets');
!                       // this will have a msg to the user if folder was 
renamed, created, or deleted
!                       
$this->widgets->set_toolbar_msg($this->bo->xi['action_report']);
!                       
$GLOBALS['phpgw']->template->set_var('widget_toolbar',$this->widgets->get_toolbar());
!                       
!                       
!                       for ($i=0; 
$i<count($this->bo->xi['folder_list_display']);$i++)
!                       {
!                               
$GLOBALS['phpgw']->template->set_var('list_backcolor',$this->bo->xi['folder_list_display'][$i]['list_backcolor']);
!                               
$GLOBALS['phpgw']->template->set_var('folder_link',$this->bo->xi['folder_list_display'][$i]['folder_link']);
!                               
$GLOBALS['phpgw']->template->set_var('folder_name',$this->bo->xi['folder_list_display'][$i]['folder_name']);
!                               
$GLOBALS['phpgw']->template->set_var('msgs_unseen',$this->bo->xi['folder_list_display'][$i]['msgs_unseen']);
!                               
$GLOBALS['phpgw']->template->set_var('msgs_total',$this->bo->xi['folder_list_display'][$i]['msgs_total']);
!                               
$GLOBALS['phpgw']->template->parse('V_folder_list','B_folder_list',True);
!                       }
! 
! 
! 
!                       
$GLOBALS['phpgw']->template->set_var('all_folders_listbox',$this->bo->xi['all_folders_listbox']);
!                       
!                       // ----  Set Up Form Variables  ---
!                       
$GLOBALS['phpgw']->template->set_var('form_action',$this->bo->xi['form_action']);
!                       
//$GLOBALS['phpgw']->template->set_var('all_folders_listbox',$GLOBALS['phpgw']->msg->all_folders_listbox('','','',False));
!                       
//$GLOBALS['phpgw']->template->set_var('select_name_rename','source_folder');
!                       
!                       
$GLOBALS['phpgw']->template->set_var('form_create_txt',$this->bo->xi['form_create_txt']);
!                       
$GLOBALS['phpgw']->template->set_var('form_delete_txt',$this->bo->xi['form_delete_txt']);
!                       
$GLOBALS['phpgw']->template->set_var('form_rename_txt',$this->bo->xi['form_rename_txt']);
!                       
$GLOBALS['phpgw']->template->set_var('form_create_expert_txt',$this->bo->xi['form_create_expert_txt']);
!                       
$GLOBALS['phpgw']->template->set_var('form_delete_expert_txt',$this->bo->xi['form_delete_expert_txt']);
!                       
$GLOBALS['phpgw']->template->set_var('form_rename_expert_txt',$this->bo->xi['form_rename_expert_txt']);
!                       
$GLOBALS['phpgw']->template->set_var('form_submit_txt',$this->bo->xi['form_submit_txt']);
!                       
!                       
$GLOBALS['phpgw']->template->set_var('hiddenvar_target_acctnum_name',$this->bo->xi['hiddenvar_target_acctnum_name']);
!                       
$GLOBALS['phpgw']->template->set_var('hiddenvar_target_acctnum_value',$this->bo->xi['hiddenvar_target_acctnum_value']);
!                       
$GLOBALS['phpgw']->template->set_var('target_fldball_boxname',$this->bo->xi['target_fldball_boxname']);
!                       
!                       // ----  Set Up Other Variables  ---    
!                       
$GLOBALS['phpgw']->template->set_var('title_backcolor',$this->bo->xi['title_backcolor']);
!                       
$GLOBALS['phpgw']->template->set_var('title_textcolor',$this->bo->xi['title_textcolor']);
!                       
$GLOBALS['phpgw']->template->set_var('title_text',$this->bo->xi['title_text']);
!                       
$GLOBALS['phpgw']->template->set_var('label_name_text',$this->bo->xi['label_name_text']);
!                       
//$GLOBALS['phpgw']->template->set_var('label_messages_text',$this->bo->xi['label_messages_text']);
!                       
$GLOBALS['phpgw']->template->set_var('label_new_text',$this->bo->xi['label_new_text']);
!                       
$GLOBALS['phpgw']->template->set_var('label_total_text',$this->bo->xi['label_total_text']);
!                       
!                       
$GLOBALS['phpgw']->template->set_var('view_txt',$this->bo->xi['view_txt']);
!                       
$GLOBALS['phpgw']->template->set_var('view_lnk',$this->bo->xi['view_lnk']);
!                       
!                       
//$GLOBALS['phpgw']->template->set_var('view_long_txt',$this->bo->xi['view_long_txt']);
!                       
//$GLOBALS['phpgw']->template->set_var('view_long_lnk',$this->bo->xi['view_long_lnk']);
!                       
//$GLOBALS['phpgw']->template->set_var('view_short_txt',$this->bo->xi['view_short_txt']);
!                       
//$GLOBALS['phpgw']->template->set_var('view_short_lnk',$this->bo->xi['view_short_lnk']);
!                       
!                       
$GLOBALS['phpgw']->template->set_var('the_font',$this->bo->xi['the_font']);
!                       
$GLOBALS['phpgw']->template->set_var('th_backcolor',$this->bo->xi['th_backcolor']);
!                       
!                       // COMMENT NEXT LINE OUT for producvtion use, (unknowns 
should be "remove"d in production use)
!                       $GLOBALS['phpgw']->template->set_unknowns("comment");
!                       // production use, use this:    
$GLOBALS['phpgw']->template->set_unknowns("remove");
!                       // Template->pfp will (1) parse and substitute, (2) 
"finish" - handle unknowns, (3) echo the output
!                       $GLOBALS['phpgw']->template->pfp('out','T_folder_out');
!                       // note, for some reason, eventhough it seems we 
*should* call common->phpgw_footer(),
!                       // if we do that, the client browser will get TWO page 
footers, so we do not call it here
!                       
!                       // close down ALL mailserver streams
!                       $GLOBALS['phpgw']->msg->end_request();
!                       // destroy the object
!                       $GLOBALS['phpgw']->msg = '';
!                       unset($GLOBALS['phpgw']->msg);
!               }
!       }
! ?>
--- 1,165 ----
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - email UI Class for Message Lists                       
        *
!       * http://www.phpgroupware.org                                           
        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       class uifolder
!       {
!               var $bo;
!               var $tpl;
!               var $widgets;
!               var $debug = False;
! 
!               var $public_functions = array(
!                       'folder' => True
!               );
! 
!               function uifolder()
!               {
!                       //return;
!               }
!               
!               function folder()
!               {
!                       $this->bo = CreateObject('email.bofolder');
!                       $this->bo->folder();
!                       
!                       if ($GLOBALS['phpgw']->msg->phpgw_0914_orless)
!                       {
!                               // we point to the global template for this 
version of phpgw templatings
!                               $this->tpl =& $GLOBALS['phpgw']->template;
!                               //$this->tpl = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
!                       }
!                       else
!                       {
!                               // we use a PRIVATE template object for 0.9.14 
conpat and during xslt porting
!                               $this->tpl = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
!                       }
!                       
!                       if ($GLOBALS['phpgw']->msg->phpgw_0914_orless)
!                       {
!                               
unset($GLOBALS['phpgw_info']['flags']['noheader']);
!                               
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
!                               $GLOBALS['phpgw_info']['flags']['noappheader'] 
= True;
!                               $GLOBALS['phpgw_info']['flags']['noappfooter'] 
= True;
!                               $GLOBALS['phpgw']->common->phpgw_header();
!                               // HOWEVER still this class must NOT invoke 
$GLOBALS['phpgw']->common->phpgw_header()
!                               // even though we had to output the header (go 
figure... :)
!                       }
!                       else
!                       {
!                               
$GLOBALS['phpgw']->xslttpl->add_file(array('app_data',
!                                                                               
        $GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header')
!                                                                               
        );
!                       }
!                       
!                       $this->tpl->set_file(
!                               Array(
!                                       'T_folder_out' => 'folder.tpl'
!                               )
!                       );
!                       
$this->tpl->set_block('T_folder_out','B_folder_list','V_folder_list');          
        
!                       
!                       //= = = = TESTING NEW TOOLBAR WIDGET = = = 
!                       $this->widgets = CreateObject('email.html_widgets');
!                       // this will have a msg to the user if folder was 
renamed, created, or deleted
!                       
$this->widgets->set_toolbar_msg($this->bo->xi['action_report']);
!                       
$this->tpl->set_var('widget_toolbar',$this->widgets->get_toolbar());
!                       
!                       
!                       for ($i=0; 
$i<count($this->bo->xi['folder_list_display']);$i++)
!                       {
!                               
$this->tpl->set_var('list_backcolor',$this->bo->xi['folder_list_display'][$i]['list_backcolor']);
!                               
$this->tpl->set_var('list_backcolor_class',$this->bo->xi['folder_list_display'][$i]['list_backcolor_class']);
!                               
$this->tpl->set_var('folder_link',$this->bo->xi['folder_list_display'][$i]['folder_link']);
!                               
$this->tpl->set_var('folder_name',$this->bo->xi['folder_list_display'][$i]['folder_name']);
!                               
$this->tpl->set_var('msgs_unseen',$this->bo->xi['folder_list_display'][$i]['msgs_unseen']);
!                               
$this->tpl->set_var('msgs_total',$this->bo->xi['folder_list_display'][$i]['msgs_total']);
!                               
$this->tpl->parse('V_folder_list','B_folder_list',True);
!                       }
! 
! 
! 
!                       
$this->tpl->set_var('all_folders_listbox',$this->bo->xi['all_folders_listbox']);
!                       
!                       // ----  Set Up Form Variables  ---
!                       
$this->tpl->set_var('form_action',$this->bo->xi['form_action']);
!                       
//$this->tpl->set_var('all_folders_listbox',$GLOBALS['phpgw']->msg->all_folders_listbox('','','',False));
!                       
//$this->tpl->set_var('select_name_rename','source_folder');
!                       
!                       
$this->tpl->set_var('form_create_txt',$this->bo->xi['form_create_txt']);
!                       
$this->tpl->set_var('form_delete_txt',$this->bo->xi['form_delete_txt']);
!                       
$this->tpl->set_var('form_rename_txt',$this->bo->xi['form_rename_txt']);
!                       
$this->tpl->set_var('form_create_expert_txt',$this->bo->xi['form_create_expert_txt']);
!                       
$this->tpl->set_var('form_delete_expert_txt',$this->bo->xi['form_delete_expert_txt']);
!                       
$this->tpl->set_var('form_rename_expert_txt',$this->bo->xi['form_rename_expert_txt']);
!                       
$this->tpl->set_var('form_submit_txt',$this->bo->xi['form_submit_txt']);
!                       
!                       
$this->tpl->set_var('hiddenvar_target_acctnum_name',$this->bo->xi['hiddenvar_target_acctnum_name']);
!                       
$this->tpl->set_var('hiddenvar_target_acctnum_value',$this->bo->xi['hiddenvar_target_acctnum_value']);
!                       
$this->tpl->set_var('target_fldball_boxname',$this->bo->xi['target_fldball_boxname']);
!                       
!                       // ----  Set Up Other Variables  ---    
!                       
$this->tpl->set_var('title_backcolor',$this->bo->xi['title_backcolor']);
!                       
$this->tpl->set_var('title_textcolor',$this->bo->xi['title_textcolor']);
!                       
$this->tpl->set_var('title_text',$this->bo->xi['title_text']);
!                       
$this->tpl->set_var('label_name_text',$this->bo->xi['label_name_text']);
!                       
//$this->tpl->set_var('label_messages_text',$this->bo->xi['label_messages_text']);
!                       
$this->tpl->set_var('label_new_text',$this->bo->xi['label_new_text']);
!                       
$this->tpl->set_var('label_total_text',$this->bo->xi['label_total_text']);
!                       
!                       
$this->tpl->set_var('view_txt',$this->bo->xi['view_txt']);
!                       
$this->tpl->set_var('view_lnk',$this->bo->xi['view_lnk']);
!                       
!                       
//$this->tpl->set_var('view_long_txt',$this->bo->xi['view_long_txt']);
!                       
//$this->tpl->set_var('view_long_lnk',$this->bo->xi['view_long_lnk']);
!                       
//$this->tpl->set_var('view_short_txt',$this->bo->xi['view_short_txt']);
!                       
//$this->tpl->set_var('view_short_lnk',$this->bo->xi['view_short_lnk']);
!                       
!                       
$this->tpl->set_var('the_font',$this->bo->xi['the_font']);
!                       
$this->tpl->set_var('th_backcolor',$this->bo->xi['th_backcolor']);
!                       
!                       // new way to handle debug data, if there is debug 
data, this will put it in the template source data vars
!                       $this->tpl->set_var('debugdata', 
$GLOBALS['phpgw']->msg->dbug->notice_pagedone());
!                       if ($GLOBALS['phpgw']->msg->phpgw_0914_orless)
!                       {
!                               //$this->tpl->set_var('debugdata', 
$GLOBALS['phpgw']->msg->dbug->notice_pagedone());
!                               // COMMENT NEXT LINE OUT for producvtion use, 
(unknowns should be "remove"d in production use)
!                               $this->tpl->set_unknowns('comment');
!                               // production use, use this:    
$this->tpl->set_unknowns("remove");
!                               // Template->pfp will (1) parse and substitute, 
(2) "finish" - handle unknowns, (3) echo the output
!                               $this->tpl->pfp('out','T_folder_out');
!                               // note, for some reason, eventhough it seems 
we *should* call common->phpgw_footer(),
!                               // if we do that, the client browser will get 
TWO page footers, so we do not call it here
!                       }
!                       else
!                       {
!                               $this->tpl->set_unknowns('comment');
!                               //$this->tpl->set_unknowns('remove');
!                               $data = array();
!                               $data['appname'] = lang('E-Mail');
!                               $data['function_msg'] = lang('Folders');
!                               $data['email_page'] = 
$this->tpl->parse('out','T_folder_out');
!                               // new way to handle debug data, if there is 
debug data, this will put it in the template source data vars
!                               //$data['debugdata'] = 
$GLOBALS['phpgw']->msg->dbug->notice_pagedone();
!                               
//$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('uimessage' => $data));
!                               
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('generic_out' => $data));
!                       }
!                       
!                       // close down ALL mailserver streams
!                       $GLOBALS['phpgw']->msg->end_request();
!                       // destroy the object
!                       $GLOBALS['phpgw']->msg = '';
!                       unset($GLOBALS['phpgw']->msg);
!               }
!       }
! ?>

Index: class.uiindex.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uiindex.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** class.uiindex.inc.php       16 Nov 2002 23:13:50 -0000      1.20
--- class.uiindex.inc.php       14 Mar 2003 04:01:44 -0000      1.21
***************
*** 1,651 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - email UI Class for Message Lists                       
        *
!       * http://www.phpgroupware.org                                           
        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
[...1448 lines suppressed...]
!                       
!                       $GLOBALS['phpgw']->msg->end_request();
!                       
!                       // we are the BO and the UI, we take care of outputting 
the HTML to the client browser
!                       // Template->pparse means "print parse" which parses 
the template and uses php print command
!                       // to output the HTML, note "unknowns" are never 
handled ("finished") in that method.
!                       
//$GLOBALS['phpgw']->template->pparse('out','T_index_main');
!                       
!                       // COMMENT NEXT LINE OUT for producvtion use, (unknowns 
should be "remove"d in production use)
!                       //$GLOBALS['phpgw']->template->set_unknowns("comment");
!                       // production use, use this:    
$GLOBALS['phpgw']->template->set_unknowns("remove");
!                       // Template->pfp will (1) parse and substitute, (2) 
"finish" - handle unknowns, (3) echo the output
!                       $GLOBALS['phpgw']->template->pfp('out','T_mlist_main');
!                       // note, for some reason, eventhough it seems we 
*should* call common->phpgw_footer(),
!                       // if we do that, the client browser will get TWO page 
footers, so we do not call it here
!               }
!               
!               
!       }
! ?>

Index: class.uijsaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uijsaddressbook.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.uijsaddressbook.inc.php       15 Nov 2002 10:09:39 -0000      1.2
--- class.uijsaddressbook.inc.php       14 Mar 2003 04:01:45 -0000      1.3
***************
*** 1,967 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare -  Addressbook Chooser                                   
             *
!       * http://www.phpgroupware.org                                           
   *
!         * Written by Alex Borges <address@hidden>                          *
!       * Inherited some code from the addressbook.php file
!       * Low Level Design also by    Dave Hall address@hidden                  
        *
!       * UI Design and market research by Gerardo Ramirez address@hidden
!       *-----------------------------------------------                        
  *
!       *  This program is free software; you can redistribute it and/or modify 
it *
[...1911 lines suppressed...]
!               //As you can see, its prepared to accept some js in its
!               //innerstring parameter to be inserted in the middle of script 
tags
!               //Also, it accepts a string that is supposed to be the 
javascript call to the frameset function
!               //that tells the js framework we have outputed the data it 
queried for.
!               function final_js($innerstring,$functioncall)
!               {
!                       $retstr="<html>
!                               <head>
!                               <script language=\"javascript\">";
!                                       
!                       $close="</script>
!                               </head>
!                               <body onLoad=\"$functioncall\">
!                               </body>
!                               </html>";
!                       return $retstr.''.$innerstring.''.$close;
!                                       
!               }
!       }
! ?>

Index: class.uimessage.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uimessage.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.uimessage.inc.php     24 Nov 2002 01:57:46 -0000      1.8
--- class.uimessage.inc.php     14 Mar 2003 04:01:47 -0000      1.9
***************
*** 20,38 ****
        {
                var $bo;
                var $widgets;
                var $debug = 0;
  
                var $public_functions = array(
!                       'message' => True
                );
  
                function uimessage()
                {
!                       return;
                }
  
                /*!
                @function message
!               @abstract ?
                */
                function message()
--- 20,40 ----
        {
                var $bo;
+               var $tpl;
                var $widgets;
                var $debug = 0;
  
                var $public_functions = array(
!                       'message' => True,
!                       'printable' => True
                );
  
                function uimessage()
                {
!                       //return;
                }
  
                /*!
                @function message
!               @abstract display the message indicated by the msgball data. 
                */
                function message()
***************
*** 41,81 ****
                        $this->bo->message_data();
                        
!                       // NOW we can out the header, because "index_data()" 
filled this global
!                       //      
$GLOBALS['phpgw_info']['flags']['email_refresh_uri']
!                       // which is needed to preserve folder and sort settings 
during the auto-refresh-ing
!                       // currently (Dec 6, 2001) that logic is in 
phpgwapi/inc/templates/idsociety/head.inc.php
!                       unset($GLOBALS['phpgw_info']['flags']['noheader']);
!                       unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
!                       $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
!                       $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
!                       $GLOBALS['phpgw']->common->phpgw_header();
!                       // HOWEVER still this class must NOT invoke 
$GLOBALS['phpgw']->common->phpgw_header()
!                       // even though we had to output the header (go 
figure... :)
                        
                        // ---- BEGIN UIMESSAGE
!                       $GLOBALS['phpgw']->template->set_file(array(
                                'T_message_main' => 'message_main.tpl',
                                'T_message_echo_dump' => 'message_echo_dump.tpl'
                        ));
!                       
$GLOBALS['phpgw']->template->set_block('T_message_main','B_x-phpgw-type','V_x-phpgw-type');
!                       
$GLOBALS['phpgw']->template->set_block('T_message_main','B_cc_data','V_cc_data');
!                       
$GLOBALS['phpgw']->template->set_block('T_message_main','B_attach_list','V_attach_list');
!                       
$GLOBALS['phpgw']->template->set_block('T_message_main','B_debug_parts','V_debug_parts');
!                       
$GLOBALS['phpgw']->template->set_block('T_message_main','B_display_part','V_display_part');
!                       
$GLOBALS['phpgw']->template->set_block('T_message_echo_dump','B_setup_echo_dump','V_setup_echo_dump');
!                       
$GLOBALS['phpgw']->template->set_block('T_message_echo_dump','B_done_echo_dump','V_done_echo_dump');
                        
                        //= = = = TOOLBAR WIDGET = = = 
                        $this->widgets = CreateObject('email.html_widgets');
!                       
$GLOBALS['phpgw']->template->set_var('widget_toolbar',$this->widgets->get_toolbar());
                        
                        if (!empty($this->xi['msgtype']))
                        {
!                               
$GLOBALS['phpgw']->template->set_var('application',$this->bo->xi['application']);
!                               
$GLOBALS['phpgw']->template->parse('V_x-phpgw-type','B_x-phpgw-type');
                        }
                        else
                        {
!                               
$GLOBALS['phpgw']->template->set_var('V_x-phpgw-type','');
                        }
                        
--- 43,104 ----
                        $this->bo->message_data();
                        
!                       if ($GLOBALS['phpgw']->msg->phpgw_0914_orless)
!                       {
!                               // we point to the global template for this 
version of phpgw templatings
!                               $this->tpl =& $GLOBALS['phpgw']->template;
!                               //$this->tpl = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
!                       }
!                       else
!                       {
!                               // we use a PRIVATE template object for 0.9.14 
conpat and during xslt porting
!                               $this->tpl = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
!                       }
!                       
!                       if ($GLOBALS['phpgw']->msg->phpgw_0914_orless)
!                       {
!                               // NOW we can out the header, because 
"index_data()" filled this global
!                               //      
$GLOBALS['phpgw_info']['flags']['email_refresh_uri']
!                               // which is needed to preserve folder and sort 
settings during the auto-refresh-ing
!                               // currently (Dec 6, 2001) that logic is in 
phpgwapi/inc/templates/idsociety/head.inc.php
!                               
unset($GLOBALS['phpgw_info']['flags']['noheader']);
!                               
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
!                               $GLOBALS['phpgw_info']['flags']['noappheader'] 
= True;
!                               $GLOBALS['phpgw_info']['flags']['noappfooter'] 
= True;
!                               $GLOBALS['phpgw']->common->phpgw_header();
!                               // HOWEVER still this class must NOT invoke 
$GLOBALS['phpgw']->common->phpgw_header()
!                               // even though we had to output the header (go 
figure... :)
!                       }
!                       else
!                       {
!                               
$GLOBALS['phpgw']->xslttpl->add_file(array('app_data',
!                                                                               
        $GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header')
!                                                                               
        );
!                       }
                        
                        // ---- BEGIN UIMESSAGE
!                       $this->tpl->set_file(array(
                                'T_message_main' => 'message_main.tpl',
                                'T_message_echo_dump' => 'message_echo_dump.tpl'
                        ));
!                       
$this->tpl->set_block('T_message_main','B_x-phpgw-type','V_x-phpgw-type');
!                       
$this->tpl->set_block('T_message_main','B_cc_data','V_cc_data');
!                       
$this->tpl->set_block('T_message_main','B_attach_list','V_attach_list');
!                       
$this->tpl->set_block('T_message_main','B_debug_parts','V_debug_parts');
!                       
$this->tpl->set_block('T_message_main','B_display_part','V_display_part');
!                       
$this->tpl->set_block('T_message_echo_dump','B_setup_echo_dump','V_setup_echo_dump');
!                       
$this->tpl->set_block('T_message_echo_dump','B_done_echo_dump','V_done_echo_dump');
                        
                        //= = = = TOOLBAR WIDGET = = = 
                        $this->widgets = CreateObject('email.html_widgets');
!                       
$this->tpl->set_var('widget_toolbar',$this->widgets->get_toolbar());
                        
                        if (!empty($this->xi['msgtype']))
                        {
!                               
$this->tpl->set_var('application',$this->bo->xi['application']);
!                               
$this->tpl->parse('V_x-phpgw-type','B_x-phpgw-type');
                        }
                        else
                        {
!                               $this->tpl->set_var('V_x-phpgw-type','');
                        }
                        
***************
*** 114,119 ****
--- 137,145 ----
                                // ----  Labels and Colors for From, To, CC, 
Files, and Subject  -----
                                'tofrom_labels_bkcolor' => 
$this->bo->xi['tofrom_labels_bkcolor'],
+                               'tofrom_labels_class'   => 
$this->bo->xi['tofrom_labels_class'],
                                'tofrom_data_bkcolor'   => 
$this->bo->xi['tofrom_data_bkcolor'],
+                               'tofrom_data_class'     => 
$this->bo->xi['tofrom_data_class'],
                                
+                               'lang_inbox_folder'     => 
$this->bo->xi['lang_inbox'],
                                'lang_from'             => 
$this->bo->xi['lang_from'],
                                'lang_to'               => 
$this->bo->xi['lang_to'],
***************
*** 128,132 ****
                                'to_data_final'                 => 
$this->bo->xi['to_data_final']
                        );
!                       $GLOBALS['phpgw']->template->set_var($tpl_vars);
                        
                        // ----  Cc:  Message Data  -----
--- 154,158 ----
                                'to_data_final'                 => 
$this->bo->xi['to_data_final']
                        );
!                       $this->tpl->set_var($tpl_vars);
                        
                        // ----  Cc:  Message Data  -----
***************
*** 136,161 ****
                        && ($this->bo->xi['cc_data_final'] != '') )
                        {
!                               
$GLOBALS['phpgw']->template->set_var('cc_data_final',$this->bo->xi['cc_data_final']);
!                               
$GLOBALS['phpgw']->template->parse('V_cc_data','B_cc_data');
                        }
                        else
                        {
!                               
$GLOBALS['phpgw']->template->set_var('V_cc_data','');
                        }
                        
                        // ---- Message Date  (set above)  -----
!                       
$GLOBALS['phpgw']->template->set_var('message_date',$this->bo->xi['message_date']);
                        // ---- Message Subject  (set above)  -----
!                       
$GLOBALS['phpgw']->template->set_var('message_subject',$this->bo->xi['message_subject']);
                        
                        // ---- Attachments List  -----
                        if ($this->bo->xi['list_of_files'] != '')
                        {
!                               
$GLOBALS['phpgw']->template->set_var('list_of_files',$this->bo->xi['list_of_files']);
!                               
$GLOBALS['phpgw']->template->parse('V_attach_list','B_attach_list');
                        }
                        else
                        {
!                               
$GLOBALS['phpgw']->template->set_var('V_attach_list','');
                        }
                        
--- 162,187 ----
                        && ($this->bo->xi['cc_data_final'] != '') )
                        {
!                               
$this->tpl->set_var('cc_data_final',$this->bo->xi['cc_data_final']);
!                               $this->tpl->parse('V_cc_data','B_cc_data');
                        }
                        else
                        {
!                               $this->tpl->set_var('V_cc_data','');
                        }
                        
                        // ---- Message Date  (set above)  -----
!                       
$this->tpl->set_var('message_date',$this->bo->xi['message_date']);
                        // ---- Message Subject  (set above)  -----
!                       
$this->tpl->set_var('message_subject',$this->bo->xi['message_subject']);
                        
                        // ---- Attachments List  -----
                        if ($this->bo->xi['list_of_files'] != '')
                        {
!                               
$this->tpl->set_var('list_of_files',$this->bo->xi['list_of_files']);
!                               
$this->tpl->parse('V_attach_list','B_attach_list');
                        }
                        else
                        {
!                               $this->tpl->set_var('V_attach_list','');
                        }
                        
***************
*** 169,172 ****
--- 195,199 ----
                                'reply_btns_text'       => 
$this->bo->xi['reply_btns_text'],
                                
+                               'go_back_to'            => 
$this->bo->xi['lang_go_back_to'],
                                'lnk_goback_folder'     => 
$this->bo->xi['lnk_goback_folder'],
                                'ilnk_reply'            => 
$this->bo->xi['ilnk_reply'],
***************
*** 175,179 ****
                                'ilnk_delete'           => 
$this->bo->xi['ilnk_delete']
                        );
!                       $GLOBALS['phpgw']->template->set_var($tpl_vars);
                        
                        
--- 202,206 ----
                                'ilnk_delete'           => 
$this->bo->xi['ilnk_delete']
                        );
!                       $this->tpl->set_var($tpl_vars);
                        
                        
***************
*** 182,202 ****
                        if ($this->bo->debug > 0)
                        {
!                               
$GLOBALS['phpgw']->template->set_var('msg_body_info',$this->bo->xi['msg_body_info']);
!                               
$GLOBALS['phpgw']->template->parse('V_debug_parts','B_debug_parts');
                        }
                        else
                        {
!                               
$GLOBALS['phpgw']->template->set_var('V_debug_parts','');
                        }
                        
                        // -----  Message_Display Template Handles it from here 
 -------
!                       
$GLOBALS['phpgw']->template->set_var('theme_font',$this->bo->xi['theme_font']);
!                       
$GLOBALS['phpgw']->template->set_var('theme_th_bg',$this->bo->xi['theme_th_bg']);
!                       
$GLOBALS['phpgw']->template->set_var('theme_row_on',$this->bo->xi['theme_row_on']);
!                               
                        // ----  so called "TOOLBAR" between the msg header 
data and the message siaplay
!                       
$GLOBALS['phpgw']->template->set_var('view_option',$this->bo->xi['view_option']);
!                       
$GLOBALS['phpgw']->template->set_var('view_headers_href',$this->bo->xi['view_headers_href']);
!                       
$GLOBALS['phpgw']->template->set_var('view_raw_message_href',$this->bo->xi['view_raw_message_href']);
                        
                        // -----  SHOW MESSAGE  -------
--- 209,261 ----
                        if ($this->bo->debug > 0)
                        {
!                               
$this->tpl->set_var('msg_body_info',$this->bo->xi['msg_body_info']);
!                               
$this->tpl->parse('V_debug_parts','B_debug_parts');
                        }
                        else
                        {
!                               $this->tpl->set_var('V_debug_parts','');
                        }
                        
                        // -----  Message_Display Template Handles it from here 
 -------
!                       
$this->tpl->set_var('theme_font',$this->bo->xi['theme_font']);
!                       
$this->tpl->set_var('theme_th_bg',$this->bo->xi['theme_th_bg']);
!                       
$this->tpl->set_var('theme_row_on',$this->bo->xi['theme_row_on']);
!                       
                        // ----  so called "TOOLBAR" between the msg header 
data and the message siaplay
!                       switch 
($GLOBALS['phpgw']->msg->get_pref_value('button_type'))
!                       {
!                               case 'text':
!                                       
$this->tpl->set_var('view_option',$this->bo->xi['view_option']);
!                                       
$this->tpl->set_var('view_option_ilnk','');
!                                       
$this->tpl->set_var('view_headers_href',$this->bo->xi['view_headers_href']);
!                                       
$this->tpl->set_var('view_headers_ilnk','');
!                                       
$this->tpl->set_var('view_raw_message_href',$this->bo->xi['view_raw_message_href']);
!                                       
$this->tpl->set_var('view_raw_message_ilnk','');
!                                       
$this->tpl->set_var('view_printable_href',$this->bo->xi['view_printable_href']);
!                                       
$this->tpl->set_var('view_printable_ilnk','');
!                                       break;
!                               case 'image':
!                                       $this->tpl->set_var('view_option','');
!                                       
$this->tpl->set_var('view_option_ilnk',$this->bo->xi['view_option_ilnk']);
!                                       
$this->tpl->set_var('view_headers_href','');
!                                       
$this->tpl->set_var('view_headers_ilnk',$this->bo->xi['view_headers_ilnk']);
!                                       
$this->tpl->set_var('view_raw_message_href','');
!                                       
$this->tpl->set_var('view_raw_message_ilnk',$this->bo->xi['view_raw_message_ilnk']);
!                                       
$this->tpl->set_var('view_printable_href','');
!                                       
$this->tpl->set_var('view_printable_ilnk',$this->bo->xi['view_printable_ilnk']);
!                                       break;
!                               //case 'both':
!                               default:
!                                       
$this->tpl->set_var('view_option',$this->bo->xi['view_option']);
!                                       
$this->tpl->set_var('view_option_ilnk',$this->bo->xi['view_option_ilnk']);
!                                       
$this->tpl->set_var('view_headers_href',$this->bo->xi['view_headers_href']);
!                                       
$this->tpl->set_var('view_headers_ilnk',$this->bo->xi['view_headers_ilnk']);
!                                       
$this->tpl->set_var('view_raw_message_href',$this->bo->xi['view_raw_message_href']);
!                                       
$this->tpl->set_var('view_raw_message_ilnk',$this->bo->xi['view_raw_message_ilnk']);
!                                       
$this->tpl->set_var('view_printable_href',$this->bo->xi['view_printable_href']);
!                                       
$this->tpl->set_var('view_printable_ilnk',$this->bo->xi['view_printable_ilnk']);
!                                       break;
!                       }
!                       
                        
                        // -----  SHOW MESSAGE  -------
***************
*** 207,228 ****
                                if ($this->bo->part_nice[$i]['d_instructions'] 
== 'show')
                                {
!                                       
$GLOBALS['phpgw']->template->set_var('title_text',$this->bo->part_nice[$i]['title_text']);
!                                       
$GLOBALS['phpgw']->template->set_var('display_str',$this->bo->part_nice[$i]['display_str']);
!                                       
$GLOBALS['phpgw']->template->set_var('message_body',$this->bo->part_nice[$i]['message_body']);
!                                       
$GLOBALS['phpgw']->template->parse('V_display_part','B_display_part', True);
                                }
                                elseif 
($this->bo->part_nice[$i]['d_instructions'] == 'echo_out')
                                {
                                        // output a blank message body, we'll 
use an alternate method below
!                                       
$GLOBALS['phpgw']->template->set_var('V_display_part','');
                                        // -----  Finished With Message_Mail 
Template, Output It
!                                       
$GLOBALS['phpgw']->template->pfp('out','T_message_main');
                                        
                                        // -----  Prepare a Table for this Echo 
Dump
!                                       
$GLOBALS['phpgw']->template->set_var('title_text',$this->bo->part_nice[$i]['title_text']);
!                                       
$GLOBALS['phpgw']->template->set_var('display_str',$this->bo->part_nice[$i]['display_str']);
!                                       
$GLOBALS['phpgw']->template->parse('V_setup_echo_dump','B_setup_echo_dump');
!                                       
$GLOBALS['phpgw']->template->set_var('V_done_echo_dump','');
!                                       
$GLOBALS['phpgw']->template->pfp('out','T_message_echo_dump');
                                        
                                        // -----  Prepare $msgball data for 
phpgw_fetchbody()
--- 266,287 ----
                                if ($this->bo->part_nice[$i]['d_instructions'] 
== 'show')
                                {
!                                       
$this->tpl->set_var('title_text',$this->bo->part_nice[$i]['title_text']);
!                                       
$this->tpl->set_var('display_str',$this->bo->part_nice[$i]['display_str']);
!                                       
$this->tpl->set_var('message_body',$this->bo->part_nice[$i]['message_body']);
!                                       
$this->tpl->parse('V_display_part','B_display_part', True);
                                }
                                elseif 
($this->bo->part_nice[$i]['d_instructions'] == 'echo_out')
                                {
                                        // output a blank message body, we'll 
use an alternate method below
!                                       
$this->tpl->set_var('V_display_part','');
                                        // -----  Finished With Message_Mail 
Template, Output It
!                                       $this->tpl->pfp('out','T_message_main');
                                        
                                        // -----  Prepare a Table for this Echo 
Dump
!                                       
$this->tpl->set_var('title_text',$this->bo->part_nice[$i]['title_text']);
!                                       
$this->tpl->set_var('display_str',$this->bo->part_nice[$i]['display_str']);
!                                       
$this->tpl->parse('V_setup_echo_dump','B_setup_echo_dump');
!                                       
$this->tpl->set_var('V_done_echo_dump','');
!                                       
$this->tpl->pfp('out','T_message_echo_dump');
                                        
                                        // -----  Prepare $msgball data for 
phpgw_fetchbody()
***************
*** 236,242 ****
                                        echo '</pre>';
                                        // -----  Close Table
!                                       
$GLOBALS['phpgw']->template->set_var('V_setup_echo_dump','');
!                                       
$GLOBALS['phpgw']->template->parse('V_done_echo_dump','B_done_echo_dump');
!                                       
$GLOBALS['phpgw']->template->pfp('out','T_message_echo_dump');
                                        
                                        //  = = = =  = =======  CLEANUP AND 
EXIT PAGE ======= = = = = = =
--- 295,301 ----
                                        echo '</pre>';
                                        // -----  Close Table
!                                       
$this->tpl->set_var('V_setup_echo_dump','');
!                                       
$this->tpl->parse('V_done_echo_dump','B_done_echo_dump');
!                                       
$this->tpl->pfp('out','T_message_echo_dump');
                                        
                                        //  = = = =  = =======  CLEANUP AND 
EXIT PAGE ======= = = = = = =
***************
*** 247,250 ****
--- 306,312 ----
                        //@set_time_limit(0);
                        
+                       // new way to handle debug data, if there is debug 
data, this will put it in the template source data vars
+                       $this->tpl->set_var('debugdata', 
$GLOBALS['phpgw']->msg->dbug->notice_pagedone());
+                       
                        if ((isset($did_echo_dump))
                        && ($did_echo_dump == True))
***************
*** 253,261 ****
                                // echo dump already outputted the template
                        }
!                       else
                        {
!                               
$GLOBALS['phpgw']->template->pfp('out','T_message_main');
                                //$GLOBALS['phpgw']->common->phpgw_footer();
                        }
                        if (isset($this->bo->xi['application']))
                        {
--- 315,341 ----
                                // echo dump already outputted the template
                        }
!                       elseif ($GLOBALS['phpgw']->msg->phpgw_0914_orless)
                        {
!                               $this->tpl->pfp('out','T_message_main');
                                //$GLOBALS['phpgw']->common->phpgw_footer();
                        }
+                       else
+                       {
+                               $this->tpl->set_unknowns('comment');
+                               //$this->tpl->set_unknowns('remove');
+                               $data = array();
+                               $data['appname'] = lang('E-Mail');
+                               $data['function_msg'] = lang('show message');
+                               $data['email_page'] = 
$this->tpl->parse('out','T_message_main');
+                               // new way to handle debug data, if this array 
has anything, put it in the template source data vars
+                               //if ($GLOBALS['phpgw']->msg->dbug->debugdata)
+                               //{
+                               //      $data['debugdata'] = 
$GLOBALS['phpgw']->msg->dbug->get_debugdata_stack();
+                               //}
+                               
//$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('uimessage' => $data));
+                               
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('generic_out' => $data));
+                       }
+                       
+                       // ralfbecker patch dated 021124
                        if (isset($this->bo->xi['application']))
                        {
***************
*** 263,268 ****
                                $calendar_id = $this->bo->xi['calendar_id'];
                                
$GLOBALS['phpgw']->hooks->single('email',$this->bo->xi['application']);
! 
!                       }
                        // tell apache to release emeory back to the system on 
script end
                        //apache_child_terminate();
--- 343,347 ----
                                $calendar_id = $this->bo->xi['calendar_id'];
                                
$GLOBALS['phpgw']->hooks->single('email',$this->bo->xi['application']);
!                       }
                        // tell apache to release emeory back to the system on 
script end
                        //apache_child_terminate();
***************
*** 274,277 ****
--- 353,522 ----
                        unset($GLOBALS['phpgw']->msg);
                }
+               
+               /*!
+               @function printable
+               @abstract display the message indicated by the msgball data in 
Printer Friendly style. 
+               @author Angles 
+               */
+               function printable()
+               {
+                       // get the data we need to fill the template
+                       $this->bo = CreateObject("email.bomessage");
+                       $this->bo->message_data();
+                       
+                       if ($GLOBALS['phpgw']->msg->phpgw_0914_orless)
+                       {
+                               // we point to the global template for this 
version of phpgw templatings
+                               $this->tpl =& $GLOBALS['phpgw']->template;
+                               //$this->tpl = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+                       }
+                       else
+                       {
+                               // we use a PRIVATE template object for 0.9.14 
conpat and during xslt porting
+                               $this->tpl = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+                       }
+                       
+                       $GLOBALS['phpgw_info']['flags']['noheader'] = True;
+                       $GLOBALS['phpgw_info']['flags']['nonavbar'] = True;
+                       $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
+                       $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
+                       
+                       $this->tpl->set_file(array(
+                               'T_message_printable' => 
'message_printable.tpl',
+                               'T_message_echo_dump' => 'message_echo_dump.tpl'
+                       ));
+                       
$this->tpl->set_block('T_message_printable','B_cc_data','V_cc_data');
+                       
$this->tpl->set_block('T_message_printable','B_attach_list','V_attach_list');
+                       
$this->tpl->set_block('T_message_printable','B_display_part','V_display_part');
+                       
$this->tpl->set_block('T_message_echo_dump','B_setup_echo_dump','V_setup_echo_dump');
+                       
$this->tpl->set_block('T_message_echo_dump','B_done_echo_dump','V_done_echo_dump');
+                       
+                       $tpl_vars = Array(
+                               'user_fullname' => 
$GLOBALS['phpgw_info']['user']['fullname'],
+                               'font_family'   => $this->bo->xi['theme_font'],
+                               'theme_font'    => $this->bo->xi['theme_font'],
+                               // in the echo out template, this is a TD 
background color
+                               'theme_row_on'  => '#ffffff',
+                               
+                               'lang_from'             => 
$this->bo->xi['lang_from'],
+                               'lang_to'               => 
$this->bo->xi['lang_to'],
+                               'lang_cc'               => 
$this->bo->xi['lang_cc'],
+                               'lang_date'             => 
$this->bo->xi['lang_date'],
+                               'lang_files'    => $this->bo->xi['lang_files'],
+                               'lang_subject'  => 
$this->bo->xi['lang_subject'],
+                               // ----  From:  Message Data  -----
+                               'from_data_final'               => 
$this->bo->xi['from_data_final'],
+                               // ----  To:  Message Data  -----
+                               'to_data_final'                 => 
$this->bo->xi['to_data_final'],
+                               // ----  Cc:  Message Data  -----
+                               // can NOT do this here because we do not know 
if we have any CC to display
+                               // ---- Message Date  -----
+                               'message_date'  => 
$this->bo->xi['message_date'],
+                               // ---- Message Subject  -----
+                               'message_subject'       => 
$this->bo->xi['message_subject'],
+                               'page_title'    => 
$this->bo->xi['message_subject'],
+                       );
+                       $this->tpl->set_var($tpl_vars);
+                       
+                       // ----  Cc:  Message Data  -----
+                       //if (isset($msg_headers->cc) && 
count($msg_headers->cc) > 0)
+                       //      $this->bo->xi['
+                       if ( (isset($this->bo->xi['cc_data_final']))
+                       && ($this->bo->xi['cc_data_final'] != '') )
+                       {
+                               
$this->tpl->set_var('cc_data_final',$this->bo->xi['cc_data_final']);
+                               $this->tpl->parse('V_cc_data','B_cc_data');
+                       }
+                       else
+                       {
+                               $this->tpl->set_var('V_cc_data','');
+                       }
+                       
+                       // ---- Attachments List  -----
+                       if ($this->bo->xi['list_of_files'] != '')
+                       {
+                               
$this->tpl->set_var('list_of_files',$this->bo->xi['list_of_files']);
+                               
$this->tpl->parse('V_attach_list','B_attach_list');
+                       }
+                       else
+                       {
+                               $this->tpl->set_var('V_attach_list','');
+                       }
+                       
+                       // -----  SHOW MESSAGE  -------
+                       //@set_time_limit(120);
+                       $count_part_nice = count($this->bo->part_nice);
+                       for ($i = 0; $i < $count_part_nice; $i++)
+                       {
+                               if ($this->bo->part_nice[$i]['d_instructions'] 
== 'show')
+                               {
+                                       
$this->tpl->set_var('title_text',$this->bo->part_nice[$i]['title_text']);
+                                       
$this->tpl->set_var('display_str',$this->bo->part_nice[$i]['display_str']);
+                                       
$this->tpl->set_var('message_body',$this->bo->part_nice[$i]['message_body']);
+                                       
$this->tpl->parse('V_display_part','B_display_part', True);
+                               }
+                               elseif 
($this->bo->part_nice[$i]['d_instructions'] == 'echo_out')
+                               {
+                                       // output a blank message body, we'll 
use an alternate method below
+                                       
$this->tpl->set_var('V_display_part','');
+                                       // -----  Finished With Message_Mail 
Template, Output It
+                                       
$this->tpl->pfp('out','T_message_printable');
+                                       
+                                       // -----  Prepare a Table for this Echo 
Dump
+                                       
$this->tpl->set_var('title_text',$this->bo->part_nice[$i]['title_text']);
+                                       
$this->tpl->set_var('display_str',$this->bo->part_nice[$i]['display_str']);
+                                       
$this->tpl->parse('V_setup_echo_dump','B_setup_echo_dump');
+                                       
$this->tpl->set_var('V_done_echo_dump','');
+                                       
$this->tpl->pfp('out','T_message_echo_dump');
+                                       
+                                       // -----  Prepare $msgball data for 
phpgw_fetchbody()
+                                       $msgball = 
$GLOBALS['phpgw']->msg->get_arg_value('msgball');
+                                       $msgball['part_no'] = 
$this->bo->part_nice[$i]['m_part_num_mime'];
+                                       
+                                       // -----  Echo This Data Directly to 
the Client
+                                       // since the php version of this of 
b0rked for large msgs, perhaps use sockets code?
+                                       echo '<pre>';
+                                       echo 
$GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball);
+                                       echo '</pre>';
+                                       // -----  Close Table
+                                       
$this->tpl->set_var('V_setup_echo_dump','');
+                                       
$this->tpl->parse('V_done_echo_dump','B_done_echo_dump');
+                                       
$this->tpl->pfp('out','T_message_echo_dump');
+                                       
+                                       //  = = = =  = =======  CLEANUP AND 
EXIT PAGE ======= = = = = = =
+                                       $did_echo_dump = True;
+                                       break;
+                               }
+                       }
+                       //@set_time_limit(0);
+                       
+                       if ((isset($did_echo_dump))
+                       && ($did_echo_dump == True))
+                       {
+                               // DO NOTHING!
+                               // echo dump already outputted the template
+                       }
+                       else
+                       {
+                               $this->tpl->pfp('out','T_message_printable');
+                               //$GLOBALS['phpgw']->common->phpgw_footer();
+                       }
+                       
+                       // ----  Finish The HTML Tags  ----
+                       echo "</body> \r\n";
+                       echo "</html> \r\n";
+                       
+                       if (is_object($GLOBALS['phpgw']->msg))
+                       {
+                               // close down ALL mailserver streams
+                               $GLOBALS['phpgw']->msg->end_request();
+                               // destroy the object
+                               $GLOBALS['phpgw']->msg = '';
+                               unset($GLOBALS['phpgw']->msg);
+                       }
+                       // shut down this transaction
+                       $GLOBALS['phpgw']->common->phpgw_exit(False);
+               }
+               
        }
  ?>

Index: class.uipreferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uipreferences.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** class.uipreferences.inc.php 25 Oct 2002 12:45:53 -0000      1.15
--- class.uipreferences.inc.php 14 Mar 2003 04:01:48 -0000      1.16
***************
*** 1,690 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - E-Mail                                                 
        *
!       * http://www.phpgroupware.org                                           
        *
!       * Based on Aeromail by Mark Cushman <address@hidden>                    
*
!       *          http://the.cushman.net/                                      
                *
!       * --------------------------------------------                          
                        *
!       *  This program is free software; you can redistribute it and/or modify 
it              *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
[...1500 lines suppressed...]
!                       }
!                       else
!                       {
!                               $this->tpl->set_unknowns('comment');
!                               //$this->tpl->set_unknowns('remove');
!                               $data = array();
!                               $data['appname'] = lang('E-Mail');
!                               $data['function_msg'] = lang('E-Mail Extra 
Accounts List');
!                               $data['email_page'] = 
$this->tpl->parse('out','T_prefs_ex_accounts');
!                               // new way to handle debug data, if this array 
has anything, put it in the template source data vars
!                               //if ($GLOBALS['phpgw']->msg->dbug->debugdata)
!                               //{
!                               //      $data['debugdata'] = 
$GLOBALS['phpgw']->msg->dbug->get_debugdata_stack();
!                               //}
!                               
//$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('uimessage' => $data));
!                               
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('generic_out' => $data));
!                       }
!               }
!       }
! ?>

Index: functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/functions.inc.php,v
retrieving revision 1.115
retrieving revision 1.116
diff -C2 -r1.115 -r1.116
*** functions.inc.php   25 Oct 2002 12:45:53 -0000      1.115
--- functions.inc.php   14 Mar 2003 04:01:49 -0000      1.116
***************
*** 1,35 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - E-Mail                                                 
        *
!       * http://www.phpgroupware.org                                           
        *
!       * Based on Aeromail by Mark Cushman <address@hidden>                    
*
!       *          http://the.cushman.net/                                      
                *
!       * --------------------------------------------                          
                *
!       *  This program is free software; you can redistribute it and/or modify 
it      *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       $d1 = strtolower(substr(APP_INC,0,3));
!       if($d1 == 'htt' || $d1 == 'ftp' )
!       {
!               echo "Failed attempt to break in via an old Security 
Hole!<br>\n";
!               $GLOBALS['phpgw']->common->phpgw_exit();
!       }
!       unset($d1);
!       
!       // ----  Turn Off Magic Quotes Runtime    -----
!       /*!
!       @concept Turn Off Magic Quotes Runtime
!       @discussion magic_quotes_runtime essentially handles slashes when 
communicating with databases.
!       PHP MANUAL says:
!               If magic_quotes_runtime is enabled, most functions that return 
data from any sort of 
!               external source including databases and text files will have 
quotes escaped with a backslash.
!       this is undesirable - turn it off.
!       */
!       set_magic_quotes_runtime(0);
! 
! ?>
--- 1,35 ----
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - E-Mail                                                 
        *
!       * http://www.phpgroupware.org                                           
        *
!       * Based on Aeromail by Mark Cushman <address@hidden>                    
*
!       *          http://the.cushman.net/                                      
                *
!       * --------------------------------------------                          
                *
!       *  This program is free software; you can redistribute it and/or modify 
it      *
!       *  under the terms of the GNU General Public License as published by 
the        *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your               *
!       *  option) any later version.                                           
                *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       $d1 = strtolower(substr(APP_INC,0,3));
!       if($d1 == 'htt' || $d1 == 'ftp' )
!       {
!               echo "Failed attempt to break in via an old Security 
Hole!<br>\n";
!               $GLOBALS['phpgw']->common->phpgw_exit();
!       }
!       unset($d1);
!       
!       // ----  Turn Off Magic Quotes Runtime    -----
!       /*!
!       @concept Turn Off Magic Quotes Runtime
!       @discussion magic_quotes_runtime essentially handles slashes when 
communicating with databases.
!       PHP MANUAL says:
!               If magic_quotes_runtime is enabled, most functions that return 
data from any sort of 
!               external source including databases and text files will have 
quotes escaped with a backslash.
!       this is undesirable - turn it off.
!       */
!       set_magic_quotes_runtime(0);
! 
! ?>

Index: hook_admin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/hook_admin.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** hook_admin.inc.php  25 Oct 2002 12:45:53 -0000      1.5
--- hook_admin.inc.php  14 Mar 2003 04:01:53 -0000      1.6
***************
*** 1,23 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare                                                             *
!   * http://www.phpgroupware.org                                              *
!   * Written by Joseph Engo <address@hidden>                          *
!   * --------------------------------------------                             *
!   *  This program is free software; you can redistribute it and/or modify it *
!   *  under the terms of the GNU General Public License as published by the   *
!   *  Free Software Foundation; either version 2 of the License, or (at your  *
!   *  option) any later version.                                              *
!   \**************************************************************************/
! 
!   /* $Id$ */
! {
! // Only Modify the $file and $title variables.....
!       $title = $appname;
!       $file = Array(
!               'Site Configuration'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' 
. $appname)
!       );
! //Do not modify below this line
!       display_section($appname,$title,$file);
! }
! ?>
--- 1,23 ----
! <?php
!   /**************************************************************************\
!   * phpGroupWare                                                             *
!   * http://www.phpgroupware.org                                              *
!   * Written by Joseph Engo <address@hidden>                          *
!   * --------------------------------------------                             *
!   *  This program is free software; you can redistribute it and/or modify it *
!   *  under the terms of the GNU General Public License as published by the   *
!   *  Free Software Foundation; either version 2 of the License, or (at your  *
!   *  option) any later version.                                              *
!   \**************************************************************************/
! 
!   /* $Id$ */
! {
! // Only Modify the $file and $title variables.....
!       $title = $appname;
!       $file = Array(
!               'Site Configuration'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' 
. $appname)
!       );
! //Do not modify below this line
!       display_section($appname,$title,$file);
! }
! ?>

Index: hook_home.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/hook_home.inc.php,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -r1.55 -r1.56
*** hook_home.inc.php   25 Oct 2002 12:45:53 -0000      1.55
--- hook_home.inc.php   14 Mar 2003 04:01:54 -0000      1.56
***************
*** 20,44 ****
        unset($d1);
        
!       
!       // does this array item actually exist before we create the mail_msg, 
where is it created?
!       //if 
($GLOBALS['phpgw_info']['user']['preferences']['email']['mainscreen_showmail'] 
== True)
!       
!       // create a msg object just to have access to the prefs
!       $my_msg_bootstrap = '';
!       $my_msg_bootstrap = CreateObject("email.msg_bootstrap");
!       $my_msg_bootstrap->set_do_login(False);
!       $my_msg_bootstrap->ensure_mail_msg_exists('email.hook_home', 0);
!       
!       // does account 0 (default, main account) have this pref set
!       // this pref is either set for "ON", of not set which represents a "no"
!       // other accounts can be shown by (1) giving the extra accounts access 
to this pref item, and 
!       // (2) by doing a loop testing for accounts other then just account 0
!       if ($GLOBALS['phpgw']->msg->get_isset_pref('mainscreen_showmail', 0))
!       {
!               // NO LONGER needed, from here on, msg objects opens streams on 
demand if requied
!               //$my_msg_bootstrap = '';
!               //$my_msg_bootstrap = CreateObject("email.msg_bootstrap");
!               //$my_msg_bootstrap->ensure_mail_msg_exists('email.hook_home', 
0);
!               
                $data = Array();
                
--- 20,52 ----
        unset($d1);
        
!       
!       // does this array item actually exist before we create the mail_msg, 
where is it created?
!       //if 
($GLOBALS['phpgw_info']['user']['preferences']['email']['mainscreen_showmail'] 
== True)
!       
!       $debug_hook_home = 0;
!       //$debug_hook_home = 3;
!       
!       $prev_currentapp = $GLOBALS['phpgw_info']['flags']['currentapp'];
!       $GLOBALS['phpgw_info']['flags']['currentapp'] = 'email';
!       
!       // create a msg object just to have access to the prefs
!       $my_msg_bootstrap = '';
!       $my_msg_bootstrap = CreateObject('email.msg_bootstrap');
!       // NO LOGIN if we are only checking preferences
!       //$my_msg_bootstrap->set_do_login(False);
!       //$my_msg_bootstrap->set_do_login(BS_LOGIN_ONLY_IF_NEEDED);
!       $my_msg_bootstrap->set_do_login(BS_LOGIN_NEVER);
!       // never *should* still allow a later login after we determine we need 
to show messages here
!       $my_msg_bootstrap->ensure_mail_msg_exists('email.hook_home', 
$debug_hook_home);
!       // DO NOT FORGET TO END_REQUEST since we created the msg object, it 
needs that even if we did not login, 
!       // because the backwards compat code for sessions_db does its bulk save 
to the DB in the "end_request" function.
!       
!       // does account 0 (default, main account) have this pref set
!       // this pref is either set for "ON", of not set which represents a "no"
!       // other accounts can be shown by (1) giving the extra accounts access 
to this pref item, and 
!       // (2) by doing a loop testing for accounts other then just account 0
!       if ($GLOBALS['phpgw']->msg->get_isset_pref('mainscreen_showmail', 0))
!       {
!               // from here on, msg objects opens streams on demand if requied
                $data = Array();
                
***************
*** 53,56 ****
--- 61,65 ----
                $inbox_data = Array();
                $inbox_data = $GLOBALS['phpgw']->msg->new_message_check();
+               //if ($debug_hook_home > 2) { echo 'hook_home('.__LINE__.'): 
$inbox_data dump:<pre>'; print_r($inbox_data); echo '</pre>'; } 
  
                $title = '<font color="#FFFFFF">'.lang('EMail').' 
'.$inbox_data['alert_string'].'</font>';
***************
*** 64,68 ****
                        $check_msgs = $inbox_data['number_all'];
                }
- 
                if ($inbox_data['number_all'] > 0)
                {
--- 73,76 ----
***************
*** 70,76 ****
                        $msgball_list = 
$GLOBALS['phpgw']->msg->get_msgball_list();
                }
                for($i=0; $i<$check_msgs; $i++)
!               {
!                       $msg_headers = 
$GLOBALS['phpgw']->msg->phpgw_header($msgball_list[$i]);
                        $subject = 
$GLOBALS['phpgw']->msg->get_subject($msg_headers,'');
                        if(strlen($subject) > 65)
--- 78,87 ----
                        $msgball_list = 
$GLOBALS['phpgw']->msg->get_msgball_list();
                }
+               //if ($debug_hook_home > 2) { echo 'hook_home('.__LINE__.'): 
call to "get_msgball_list" returns $msgball_list dump:<pre>'; 
print_r($msgball_list); echo '</pre>'; } 
                for($i=0; $i<$check_msgs; $i++)
!               {
!                       $this_loop_msgball = 
$GLOBALS['phpgw']->msg->ball_data_parse_str($msgball_list[$i]);
!                       //if ($debug_hook_home > 1) { echo ' * 
hook_home('.__LINE__.'): $msgball_list['.$i.'] ['.$msgball_list[$i].']; 
$this_loop_msgball: ['.serialize($this_loop_msgball).']<br>'; } 
!                       $msg_headers = 
$GLOBALS['phpgw']->msg->phpgw_header($this_loop_msgball);
                        $subject = 
$GLOBALS['phpgw']->msg->get_subject($msg_headers,'');
                        if(strlen($subject) > 65)
***************
*** 83,87 ****
                                                '/index.php',
                                                
'menuaction=email.uimessage.message'
!                                               .'&'.$msgball_list[$i]['uri']
                                )
                        );
--- 94,98 ----
                                                '/index.php',
                                                
'menuaction=email.uimessage.message'
!                                               .'&'.$this_loop_msgball['uri']
                                )
                        );
***************
*** 110,113 ****
--- 121,125 ----
                        // build the $feed_args array for the 
all_folders_listbox function
                        // anything not specified will be replace with a 
default value if the function has one for that param
+                       /*
                        $feed_args = Array(
                                'mailsvr_stream'    => '',
***************
*** 134,141 ****
                                .'&nbsp; &nbsp;'.$compose_href."\r\n"
                                .'</td>'."\r\n"
!                               .'</form>'."\r\n";
                }
-               $GLOBALS['phpgw']->msg->end_request();
                
                $portalbox = CreateObject('phpgwapi.listbox',
                        Array(
--- 146,178 ----
                                .'&nbsp; &nbsp;'.$compose_href."\r\n"
                                .'</td>'."\r\n"
!                               .'</form>'."\r\n";
!                       */
!                       // REPLACE all the above with some high levels calls to 
the widget class
!                       // WHY does not lang inbox work here? It is called in 
the base class and works fine except from "home" page.
!                       $my_widgets = CreateObject('email.html_widgets');
!                       $my_widgets->new_form();
!                       $my_widgets->set_form_name('switchbox');
!                       
$my_widgets->set_form_action($GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.index'));
!                       $my_widgets->set_form_method('post');
!                       $form_folder_switch_opentag = $my_widgets->get_form();
!                       $folder_switch_combobox = 
$my_widgets->all_folders_combobox('switchbox');
!                       $form_folder_switch_closetag = 
$my_widgets->form_closetag();
!                       $extra_data = 
!                               $form_folder_switch_opentag
!                               .'<td align="left">'."\r\n"
!                               .'&nbsp;<strong>'.lang('E-Mail 
Folders').':</strong>&nbsp;'
!                               .$folder_switch_combobox
!                               .'&nbsp; &nbsp;'.$compose_href
!                               .'</td>'."\r\n"
!                               .$form_folder_switch_closetag;
                }
                
+               if ((isset($prev_currentapp))
+               && ($prev_currentapp)
+               && ($GLOBALS['phpgw_info']['flags']['currentapp'] != 
$prev_currentapp))
+               {
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
$prev_currentapp;
+               }
+               
                $portalbox = CreateObject('phpgwapi.listbox',
                        Array(
***************
*** 168,171 ****
                // output the portalbox and below it (1) the folders listbox 
(if applicable) and (2) Compose New mail link
                echo "\n".'<!-- BEGIN Mailbox info 
-->'."\n".$portalbox->draw($extra_data).'<!-- END Mailbox info -->'."\n";
!       }
  ?>
--- 205,212 ----
                // output the portalbox and below it (1) the folders listbox 
(if applicable) and (2) Compose New mail link
                echo "\n".'<!-- BEGIN Mailbox info 
-->'."\n".$portalbox->draw($extra_data).'<!-- END Mailbox info -->'."\n";
!       }
!       // we create the msg object initially so we can have access to the 
multi-account preferences, 
!       // so even if we did not output any data here, we still must call this 
"end_request" function, it is kind of like a destructor
!       $GLOBALS['phpgw']->msg->end_request();
! 
  ?>

Index: hook_manual.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/hook_manual.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8

Index: hook_notifywindow.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/hook_notifywindow.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** hook_notifywindow.inc.php   25 Oct 2002 12:45:53 -0000      1.10
--- hook_notifywindow.inc.php   14 Mar 2003 04:01:54 -0000      1.11
***************
*** 1,114 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - E-Mail                                                 
   *
!       * http://www.phpgroupware.org                                           
   *
!       * --------------------------------------------                          
   *
!       *       This program is free software; you can redistribute it and/or 
modify it*
!       *       under the terms of the GNU General Public License as published 
by the  *
!       *       Free Software Foundation; either version 2 of the License, or 
(at your *
!       *       option) any later version.                                      
       *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       $d1 = strtolower(substr(APP_INC,0,3));
!       if($d1 == 'htt' || $d1 == 'ftp' )
!       {
!               echo "Failed attempt to break in via an old Security 
Hole!<br>\n";
!               $GLOBALS['phpgw']->common->phpgw_exit();
!       }
!       unset($d1);
! 
!       // NOTE: notify for email not available if the welcome screen show mail 
option if off
!       // just wondering, where and when is this pref array data created prior 
to mail_msg object creation?
!       if 
(($GLOBALS['phpgw_info']['user']['preferences']['email']['mainscreen_showmail'])
!       && (isset($GLOBALS['phpgw_info']['user']['apps']['email'])
!       && $GLOBALS['phpgw_info']['user']['apps']['email']))
!       {
!               $my_msg_bootstrap = '';
!               $my_msg_bootstrap = CreateObject("email.msg_bootstrap");
!               
$my_msg_bootstrap->ensure_mail_msg_exists('email.hook_notifywindow', 0);
!       
!               /*  // 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();
!               // end the mailserver request (i.e. logout of the mail server)
!               $GLOBALS['phpgw']->msg->end_request();
! 
!               $current_uid=$inbox_data['uidnext'];
!               $old_uid=$GLOBALS['phpgw']->common->appsession();
!               if(!empty($old_uid))
!               {
!                       $new_msgs=$current_id-$old_id;
!               }
!               else
!               {
!                       $new_msgs=$inbox_data['number_new'];
!               }
!               
!               if ($inbox_data['alert_string'] != '')
!               {
!                       echo '<script language="JavaScript">'."\n";
!                       echo '  <!-- Activate Cloaking Device'."\n";
!                       echo '  function CheckEmail()'."\n";
!                       echo '  {'."\n";
!                       echo '          
window.opener.document.location.href="'.$GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.index').'";'."\n";
!                       echo '  }'."\n";
!                       echo '  //-->'."\n";
!                       echo '  </script>'."\n";
!                       echo "\r\n" . '<tr><td align="left"><!-- Mailbox info 
X10 -->' . "\r\n";
!                       echo '<table width="100%" 
style="border-color:#000000;border-style:solid;border-width:1px;"><tr>'."\r\n";
!                       echo '<td width="20%" valign="middle" 
align="center">'."\r\n";
!                       echo '<a href="JavaScript:CheckEmail();"><img 
src="email/templates/default/images/navbar.png" alt="email icon" 
border=0></a>'."\r\n";
!                       echo "<td>\r\n";
!                       
!                       if($new_msgs>0)
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><b>New:</b> '.$new_msgs.'</a><br>';
!                               $urgent=true;
!                       }
!                       else
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><b>New:</b> None</a><br>'."\r\n";
!                       }
!                       
!                       if($inbox_data['number_new']>0)
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><b>Unread:</b> 
'.$inbox_data['number_new'].'</a><br>'."\r\n";
!                       }
!                       else
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><b>Unread:</b> None</a><br>'."\r\n";
!                       }
!                       
!                       if($inbox_data['number_all']<100)
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><b>INBOX:</b> 
'.$inbox_data['number_all'].'</a>'."\r\n";
!                       }
!                       else
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><nobr><b>INBOX: TOO MANY</b></a></nobr>'."\r\n";
!                       }
! 
!               if($urgent)
!               {
!                       echo '<script type="text/javascript" 
language="Javascript 1.3">'."\r\n";
!                       echo '<!--'."\r\n";
!                       echo 'window.focus();'."\r\n";
!                       echo 'document.bgcolor="#ff6666";'."\r\n";
!                       echo '// -->'."\r\n";
!                       echo '</script>'."\r\n";
!               }
! 
!                       echo "</td></tr></table>\r\n";
!                       echo "\r\n".'<!-- Mailox info --></td></tr>'."\r\n";
!               }
!               $GLOBALS['phpgw']->common->appsession($current_uid);
!       }
! ?>
--- 1,114 ----
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - E-Mail                                                 
   *
!       * http://www.phpgroupware.org                                           
   *
!       * --------------------------------------------                          
   *
!       *       This program is free software; you can redistribute it and/or 
modify it*
!       *       under the terms of the GNU General Public License as published 
by the  *
!       *       Free Software Foundation; either version 2 of the License, or 
(at your *
!       *       option) any later version.                                      
       *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       $d1 = strtolower(substr(APP_INC,0,3));
!       if($d1 == 'htt' || $d1 == 'ftp' )
!       {
!               echo "Failed attempt to break in via an old Security 
Hole!<br>\n";
!               $GLOBALS['phpgw']->common->phpgw_exit();
!       }
!       unset($d1);
! 
!       // NOTE: notify for email not available if the welcome screen show mail 
option if off
!       // just wondering, where and when is this pref array data created prior 
to mail_msg object creation?
!       if 
(($GLOBALS['phpgw_info']['user']['preferences']['email']['mainscreen_showmail'])
!       && (isset($GLOBALS['phpgw_info']['user']['apps']['email'])
!       && $GLOBALS['phpgw_info']['user']['apps']['email']))
!       {
!               $my_msg_bootstrap = '';
!               $my_msg_bootstrap = CreateObject("email.msg_bootstrap");
!               
$my_msg_bootstrap->ensure_mail_msg_exists('email.hook_notifywindow', 0);
!       
!               /*  // 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();
!               // end the mailserver request (i.e. logout of the mail server)
!               $GLOBALS['phpgw']->msg->end_request();
! 
!               $current_uid=$inbox_data['uidnext'];
!               $old_uid=$GLOBALS['phpgw']->common->appsession();
!               if(!empty($old_uid))
!               {
!                       $new_msgs=$current_id-$old_id;
!               }
!               else
!               {
!                       $new_msgs=$inbox_data['number_new'];
!               }
!               
!               if ($inbox_data['alert_string'] != '')
!               {
!                       echo '<script language="JavaScript">'."\n";
!                       echo '  <!-- Activate Cloaking Device'."\n";
!                       echo '  function CheckEmail()'."\n";
!                       echo '  {'."\n";
!                       echo '          
window.opener.document.location.href="'.$GLOBALS['phpgw']->link('/index.php','menuaction=email.uiindex.index').'";'."\n";
!                       echo '  }'."\n";
!                       echo '  //-->'."\n";
!                       echo '  </script>'."\n";
!                       echo "\r\n" . '<tr><td align="left"><!-- Mailbox info 
X10 -->' . "\r\n";
!                       echo '<table width="100%" 
style="border-color:#000000;border-style:solid;border-width:1px;"><tr>'."\r\n";
!                       echo '<td width="20%" valign="middle" 
align="center">'."\r\n";
!                       echo '<a href="JavaScript:CheckEmail();"><img 
src="email/templates/default/images/navbar.png" alt="email icon" 
border=0></a>'."\r\n";
!                       echo "<td>\r\n";
!                       
!                       if($new_msgs>0)
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><b>New:</b> '.$new_msgs.'</a><br>';
!                               $urgent=true;
!                       }
!                       else
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><b>New:</b> None</a><br>'."\r\n";
!                       }
!                       
!                       if($inbox_data['number_new']>0)
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><b>Unread:</b> 
'.$inbox_data['number_new'].'</a><br>'."\r\n";
!                       }
!                       else
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><b>Unread:</b> None</a><br>'."\r\n";
!                       }
!                       
!                       if($inbox_data['number_all']<100)
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><b>INBOX:</b> 
'.$inbox_data['number_all'].'</a>'."\r\n";
!                       }
!                       else
!                       {
!                               echo '<a 
href="JavaScript:CheckEmail();"><nobr><b>INBOX: TOO MANY</b></a></nobr>'."\r\n";
!                       }
! 
!               if($urgent)
!               {
!                       echo '<script type="text/javascript" 
language="Javascript 1.3">'."\r\n";
!                       echo '<!--'."\r\n";
!                       echo 'window.focus();'."\r\n";
!                       echo 'document.bgcolor="#ff6666";'."\r\n";
!                       echo '// -->'."\r\n";
!                       echo '</script>'."\r\n";
!               }
! 
!                       echo "</td></tr></table>\r\n";
!                       echo "\r\n".'<!-- Mailox info --></td></tr>'."\r\n";
!               }
!               $GLOBALS['phpgw']->common->appsession($current_uid);
!       }
! ?>

Index: hook_notifywindow_simple.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/hook_notifywindow_simple.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** hook_notifywindow_simple.inc.php    25 Oct 2002 12:45:53 -0000      1.8
--- hook_notifywindow_simple.inc.php    14 Mar 2003 04:01:54 -0000      1.9
***************
*** 1,55 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare - E-Mail                                                     
                                        *
!   * http://www.phpgroupware.org                                               
                                          *
!   * --------------------------------------------                              
                                  *
!   *  This program is free software; you can redistribute it and/or modify it  
*
!   *  under the terms of the GNU General Public License as published by the    
  *
!   *  Free Software Foundation; either version 2 of the License, or (at your   
*
!   *  option) any later version.                                               
                                                *
!   \**************************************************************************/
! 
!   /* $Id$ */
! 
!       $d1 = strtolower(substr(APP_INC,0,3));
!       if($d1 == 'htt' || $d1 == 'ftp' )
!       {
!               echo "Failed attempt to break in via an old Security 
Hole!<br>\n";
!               $GLOBALS['phpgw']->common->phpgw_exit();
!       }
!       unset($d1);
! 
!       if 
(($GLOBALS['phpgw_info']["user"]["preferences"]["email"]["mainscreen_showmail"])
!       && (isset($GLOBALS['phpgw_info']["user"]["apps"]["email"]))
!       && ($GLOBALS['phpgw_info']["user"]["apps"]["email"]))
!       {
!               $my_msg_bootstrap = '';
!               $my_msg_bootstrap = CreateObject("email.msg_bootstrap");
!               
$my_msg_bootstrap->ensure_mail_msg_exists('email.hook_notifywindow_simple', 0);
!               /*  // 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['is_imap'])
!               {
!                       if ($inbox_data['number_new'] > 0) 
!                       {
!                               echo 
'action:newmail:'.$inbox_data["number_all"].chr(13);
!                       }
!               }
!               else
!               {
!                       if ($inbox_data['number_all'] > 0) 
!                       {
!                               echo 
'action:newmail'.$inbox_data["number_all"].chr(13);
!                       }
!               }
!               // end the mailserver request
!               $GLOBALS['phpgw']->msg->end_request();
!       }
! ?>
--- 1,55 ----
! <?php
!   /**************************************************************************\
!   * phpGroupWare - E-Mail                                                     
                                        *
!   * http://www.phpgroupware.org                                               
                                          *
!   * --------------------------------------------                              
                                  *
!   *  This program is free software; you can redistribute it and/or modify it  
*
!   *  under the terms of the GNU General Public License as published by the    
  *
!   *  Free Software Foundation; either version 2 of the License, or (at your   
*
!   *  option) any later version.                                               
                                                *
!   \**************************************************************************/
! 
!   /* $Id$ */
! 
!       $d1 = strtolower(substr(APP_INC,0,3));
!       if($d1 == 'htt' || $d1 == 'ftp' )
!       {
!               echo "Failed attempt to break in via an old Security 
Hole!<br>\n";
!               $GLOBALS['phpgw']->common->phpgw_exit();
!       }
!       unset($d1);
! 
!       if 
(($GLOBALS['phpgw_info']["user"]["preferences"]["email"]["mainscreen_showmail"])
!       && (isset($GLOBALS['phpgw_info']["user"]["apps"]["email"]))
!       && ($GLOBALS['phpgw_info']["user"]["apps"]["email"]))
!       {
!               $my_msg_bootstrap = '';
!               $my_msg_bootstrap = CreateObject("email.msg_bootstrap");
!               
$my_msg_bootstrap->ensure_mail_msg_exists('email.hook_notifywindow_simple', 0);
!               /*  // 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['is_imap'])
!               {
!                       if ($inbox_data['number_new'] > 0) 
!                       {
!                               echo 
'action:newmail:'.$inbox_data["number_all"].chr(13);
!                       }
!               }
!               else
!               {
!                       if ($inbox_data['number_all'] > 0) 
!                       {
!                               echo 
'action:newmail'.$inbox_data["number_all"].chr(13);
!                       }
!               }
!               // end the mailserver request
!               $GLOBALS['phpgw']->msg->end_request();
!       }
! ?>

Index: hook_preferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/hook_preferences.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** hook_preferences.inc.php    25 Oct 2002 12:45:53 -0000      1.13
--- hook_preferences.inc.php    14 Mar 2003 04:01:54 -0000      1.14
***************
*** 1,23 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare                                                             *
!   * http://www.phpgroupware.org                                              *
!   * Written by Joseph Engo <address@hidden>                          *
!   * --------------------------------------------                             *
!   *  This program is free software; you can redistribute it and/or modify it *
!   *  under the terms of the GNU General Public License as published by the   *
!   *  Free Software Foundation; either version 2 of the License, or (at your  *
!   *  option) any later version.                                              *
!   \**************************************************************************/
! 
!   /* $Id$ */
! {
!       $title = $appname;
!       $file = Array(
!               'E-Mail Preferences'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uipreferences.preferences'),
!               'Extra E-Mail Accounts' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uipreferences.ex_accounts_list'),
!               'E-Mail Filters'        => 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uifilters.filters_list')
!       );
!       display_section($appname,$title,$file);
! }
! ?>
--- 1,50 ----
! <?php
!   /**************************************************************************\
!   * phpGroupWare                                                             *
!   * http://www.phpgroupware.org                                              *
!   * Written by Joseph Engo <address@hidden>                          *
!   * --------------------------------------------                             *
!   *  This program is free software; you can redistribute it and/or modify it *
!   *  under the terms of the GNU General Public License as published by the   *
!   *  Free Software Foundation; either version 2 of the License, or (at your  *
!   *  option) any later version.                                              *
!   \**************************************************************************/
! 
!   /* $Id$ */
! {
!       $title = $appname;
!       $file = Array(
!               'E-Mail Preferences'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uipreferences.preferences'),
!               'Extra E-Mail Accounts' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uipreferences.ex_accounts_list'),
!               'E-Mail Filters'        => 
$GLOBALS['phpgw']->link('/index.php','menuaction=email.uifilters.filters_list')
!       );
!       $this_ver = $GLOBALS['phpgw_info']['server']['versions']['phpgwapi'];
!       $pre_xslt_ver = '0.9.14.0.1.1';
!       if (function_exists(amorethanb))
!       {
!               if (($this_ver)
!               && (amorethanb($this_ver, $pre_xslt_ver)))
!               {
!                       // this is the xslt template era
!                       display_section($appname,$file);
!               }
!               else
!               {
!                       display_section($appname,$title,$file);
!               }
!       }
!       else
!       {
!               if (($this_ver)
!               && ($GLOBALS['phpgw']->common->cmp_version_long($this_ver, 
$pre_xslt_ver)))
!               {
!                       // this is the xslt template era
!                       display_section($appname,$file);
!               }
!               else
!               {
!                       display_section($appname,$title,$file);
!               }
!       }
! }
! ?>

Index: selectboxes.js
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/selectboxes.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** selectboxes.js      25 Oct 2002 12:56:57 -0000      1.1
--- selectboxes.js      14 Mar 2003 04:01:54 -0000      1.2
***************
*** 1,1024 ****
! /**************************************************************************\
!  * phpGroupWare - Todo list                                                 *
!  * http://www.phpgroupware.org                                              *
!  * Written by Alex Borges <address@hidden>                          *
!  * Low Level Design also by    Dave Hall address@hidden                       
   *
!  * UI Design and market research by Gerardo Ramirez address@hidden
!  * Code ripped off deveral public domain and gpl sites. Credits in each 
function
!  * for those
!  *-----------------------------------------------                          *
!  *  This program is free software; you can redistribute it and/or modify it *
[...2019 lines suppressed...]
! //@discussion Returns the selected index as normal js selectedIndex call
! //We only use this because we use funny names for our selectboxes
! function getSelectedIdx(selbox)
! {
!       var len;
!       var sbox;
!       var j;
!       sbox=document.forms[this.formname][selbox];
!       return sbox.selectedIndex;
! }
! //@function optionvalue 
! //@param selectbox The name of the selectbox
! //@param selectedidx The index of the selected option
! //@discussion Returns the value of the option pointed to by selectedidx
! function optionvalue(selectbox,selectedidx)
! {
!       var sbox;
!       sbox=document.forms[this.formname][selectbox];
!       return sbox.options[selectedidx].value;
! }

--- hook_add_def_pref.inc.php DELETED ---

--- hook_help.inc.php DELETED ---





reply via email to

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