phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: email/inc class.boattach_file.inc.php,NONE,1.3.2


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: email/inc class.boattach_file.inc.php,NONE,1.3.2.1 class.bojsaddressbook.inc.php,NONE,1.1.2.1 class.html_widgets.inc.php,NONE,1.2.2.1 class.msg_bootstrap.inc.php,NONE,1.1.2.1 class.spell.inc.php,NONE,1.1.2.1 class.spell_struct.inc.php,NONE,1.1.2.1 class.spell_svc_none.inc.php,NONE,1.1.2.1 class.spell_svc_php.inc.php,NONE,1.1.2.1 class.svc_nextmatches.inc.php,NONE,1.1.2.1 class.ui_mail_debug.inc.php,NONE,1.1.2.1 class.uiattach_file.inc.php,NONE,1.1.2.1 class.uijsaddressbook.inc.php,NONE,1.2.2.1 selectboxes.js,NONE,1.1.2.1 class.boaction.inc.php,1.11.2.1,1.11.2.2 class.bocompose.inc.php,1.1.2.2,1.1.2.3 class.bofilters.inc.php,1.12.2.2,1.12.2.3 class.bofolder.inc.php,1.4.2.1,1.4.2.2 class.boindex.inc.php,1.20.2.2,1.20.2.3 class.bomessage.inc.php,1.5.2.3,1.5.2.4 class.bopreferences.inc.php,1.10.2.3,1.10.2.4 class.bosend.inc.php,1.6.2.1,1.6.2.2 class.mail_dcom.inc.php,1.8.2.1,1.8.2.2 class.mail_dcom_base.inc.php,1.6,1.6.2.1 class.mail_dcom_base_sock.inc.php,1.21,1.21.2.1 class.mail_dcom_imap.inc.php,1.18.2.2,1.18.2.3 class.mail_dcom_imap_sock.inc.php,1.12,1.12.2.1 class.mail_dcom_nntp.inc.php,1.2,1.2.2.1 class.mail_dcom_nntp_sock.inc.php,1.3,1.3.2.1 class.mail_dcom_pop3.inc.php,1.8.2.2,1.8.2.3 class.mail_dcom_pop3_sock.inc.php,1.17.2.1,1.17.2.2 class.mail_filters.inc.php,1.4,1.4.2.1 class.mail_msg.inc.php,1.2,1.2.2.1 class.mail_msg_base.inc.php,1.61.2.7,1.61.2.8 class.mail_msg_display.inc.php,1.31.2.2,1.31.2.3 class.mail_msg_wrappers.inc.php,1.23.2.3,1.23.2.4 class.mail_send.inc.php,1.8.2.1,1.8.2.2 class.uicompose.inc.php,1.1.2.1,1.1.2.2 class.uifilters.inc.php,1.10.2.2,1.10.2.3 class.uifolder.inc.php,1.2,1.2.2.1 class.uiindex.inc.php,1.17.2.1,1.17.2.2 class.uimessage.inc.php,1.2.2.2,1.2.2.3 class.uipreferences.inc.php,1.9.2.2,1.9.2.3 functions.inc.php,1.111,1.111.2.1 hook_admin.inc.php,1.3,1.3.2.1 hook_email_add_def_pref.inc.php,1.3,1.3.6.1 hook_home.inc.php,1.48.2.4,1.48.2.5 hook_manual.inc.php,1.3,1.3.4.1 hook_notifywindow.inc.php,1.7.2.2,1.7.2.3 hook_notifywindow_simple.inc.php,1.5.2.1,1.5.2.2 hook_preferences.inc.php,1.9.2.3,1.9.2.4
Date: Wed, 20 Nov 2002 18:04:01 -0500

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

Modified Files:
      Tag: Version-0_9_14-branch
        class.boaction.inc.php class.bocompose.inc.php 
        class.bofilters.inc.php class.bofolder.inc.php 
        class.boindex.inc.php class.bomessage.inc.php 
        class.bopreferences.inc.php class.bosend.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.uicompose.inc.php 
        class.uifilters.inc.php class.uifolder.inc.php 
        class.uiindex.inc.php class.uimessage.inc.php 
        class.uipreferences.inc.php functions.inc.php 
        hook_admin.inc.php hook_email_add_def_pref.inc.php 
        hook_home.inc.php hook_manual.inc.php 
        hook_notifywindow.inc.php hook_notifywindow_simple.inc.php 
        hook_preferences.inc.php 
Added Files:
      Tag: Version-0_9_14-branch
        class.boattach_file.inc.php class.bojsaddressbook.inc.php 
        class.html_widgets.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.uijsaddressbook.inc.php 
        selectboxes.js 
Log Message:
try again ... anglemail 6-05 port ... email is now fixed!!

***** Error reading new file: [Errno 2] No such file or directory: 
'class.boattach_file.inc.php'
--- NEW FILE ---
<?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;
                }
                
        }
?>

***** Error reading new file: [Errno 2] No such file or directory: 
'class.html_widgets.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.msg_bootstrap.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.spell.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.spell_struct.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.spell_svc_none.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.spell_svc_php.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.svc_nextmatches.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.ui_mail_debug.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.uiattach_file.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.uijsaddressbook.inc.php'
--- NEW FILE ---
/**************************************************************************\
 * 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 *
 *  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 box_parser 
[...985 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;
}

Index: class.boaction.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.boaction.inc.php,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -C2 -r1.11.2.1 -r1.11.2.2
*** class.boaction.inc.php      14 Feb 2002 06:42:44 -0000      1.11.2.1
--- class.boaction.inc.php      20 Nov 2002 23:03:24 -0000      1.11.2.2
***************
*** 1,486 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - email BO Class for Message Actions                     
        *
!       * 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.                                           
                *
[...1548 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.bocompose.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.bocompose.inc.php,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** class.bocompose.inc.php     15 Feb 2002 08:00:27 -0000      1.1.2.2
--- class.bocompose.inc.php     20 Nov 2002 23:03:24 -0000      1.1.2.3
***************
*** 1,511 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - email BO Class for Folder Actions and List Display     
        *
!       * 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.                                           
                *
[...1250 lines suppressed...]
!                       
!                       //$this->xi['attachfile_js_link'] = 
$GLOBALS['phpgw']->link(
!                       //      
'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/attach_file.php');
!                       $this->xi['body_box_name'] = 'body';
!                       
!                       if ($GLOBALS['phpgw']->msg->get_isset_pref('email_sig')
!                       && ($GLOBALS['phpgw']->msg->get_pref_value('email_sig') 
!= ''))
!                       {
!                               $this->xi['do_checkbox_sig'] = True;
!                       }
!                       else
!                       {
!                               $this->xi['do_checkbox_sig'] = False;
!                       }
!                       
!               }
! 
! 
!       }
! ?>

Index: class.bofilters.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.bofilters.inc.php,v
retrieving revision 1.12.2.2
retrieving revision 1.12.2.3
diff -C2 -r1.12.2.2 -r1.12.2.3
*** class.bofilters.inc.php     18 Feb 2002 17:19:23 -0000      1.12.2.2
--- class.bofilters.inc.php     20 Nov 2002 23:03:24 -0000      1.12.2.3
***************
*** 1,1677 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - E-Mail Filters                                         
        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * Copyright (C) 2001 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.                                           
                *
[...3525 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.4.2.1
retrieving revision 1.4.2.2
diff -C2 -r1.4.2.1 -r1.4.2.2
*** class.bofolder.inc.php      14 Feb 2002 06:42:44 -0000      1.4.2.1
--- class.bofolder.inc.php      20 Nov 2002 23:03:24 -0000      1.4.2.2
***************
*** 1,379 ****
! <?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(
!                       'get_langed_labels'     => True,
!                       'folder'                => True,
!                       'folder_action'         => True,
!                       'folder_data'           => True
!               );
!               var $nextmatchs;
!               var $index_base_link='';
!               //var $debug = True;
!               var $debug = False;
!               var $xi;
!               var $xml_functions = array();
!               
!               var $soap_functions = array(
!                       'get_langed_labels' => array(
!                               'in'  => array('int'),
!                               'out' => array('array')
!                       ),
!                       'folder' => array(
!                               'in'  => array('int'),
!                               'out' => array('array')
!                       )
!               );
!               
!               function bofolder()
!               {
!                       
!               }
!               
!               function get_langed_labels()
!               {
!                       // ----  Langs  ----                    
!               }
!               
!               function folder()
!               {
!                       if ($this->debug) { echo 'ENTERING: 
email.bofolder.folder'.'<br>'; }
!                       // create class objects
!                       $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
!                       
!                       if (is_object($GLOBALS['phpgw']->msg))
!                       {
!                               if ($this->debug) { echo 
'email.bofolder.folder: is_object test: $GLOBALS[phpgw]->msg is already set, do 
not create again<br>'; }
!                       }
!                       else
!                       {
!                               if ($this->debug) { echo 
'email.bofolder.folder: $GLOBALS[phpgw]->msg is NOT set, creating mail_msg 
object<br>'; }
!                               $GLOBALS['phpgw']->msg = 
CreateObject("email.mail_msg");
!                       }
!                       
!                       $args_array = Array();
!                       $args_array['do_login'] = True;
!                       if ($this->debug == True) { echo 
'email.bofolder.folder: 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'].', folder()');
!                       }
!                       
!                       
!                       // ----  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();
!               }
!               
!               
!               
!               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').' 
'.$GLOBALS['phpgw']->msg->get_arg_value('source_folder')
!                                                       .' '.lang('to').' 
'.$GLOBALS['phpgw']->msg->get_arg_value('target_folder') .' <br>'
!                                                       .lang('result').' : ';
!                                       }
!                                       else
!                                       {
!                                               $action_report = 
$GLOBALS['phpgw']->msg->get_arg_value('action').' '.lang('folder').' 
'.$GLOBALS['phpgw']->msg->get_arg_value('target_folder').' <br>'
!                                               .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();
!                       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');
!                       
!                       $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,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'];
!                       
!               }       
!       
!       }
! ?>

Index: class.boindex.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.boindex.inc.php,v
retrieving revision 1.20.2.2
retrieving revision 1.20.2.3
diff -C2 -r1.20.2.2 -r1.20.2.3
*** class.boindex.inc.php       29 Jun 2002 16:17:30 -0000      1.20.2.2
--- class.boindex.inc.php       20 Nov 2002 23:03:24 -0000      1.20.2.3
***************
*** 1,1028 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - email BO Class for Message Lists                       
        *
!       * 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               *
[...2147 lines suppressed...]
!                                       'pre_select_folder'     => '',
!                                       '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'];
!                       if ($this->debug_index_data == True) { echo 'LEAVING: 
email.boindex: mlist_data'.'<br>'; }
!               }
!       
!       
!       }
! ?>

Index: class.bomessage.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.bomessage.inc.php,v
retrieving revision 1.5.2.3
retrieving revision 1.5.2.4
diff -C2 -r1.5.2.3 -r1.5.2.4
*** class.bomessage.inc.php     26 Mar 2002 02:20:41 -0000      1.5.2.3
--- class.bomessage.inc.php     20 Nov 2002 23:03:24 -0000      1.5.2.4
***************
*** 1,1450 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - E-Mail BO for displaying email message content         
*
!       * 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               *
[...3064 lines suppressed...]
!                               {
!                                       $msg_type = explode(';',$msgtype);
!                                       $id_array = explode('=',$msg_type[2]);
!                                       $calendar_id = 
intval(substr($id_array[1],1,strlen($id_array[1])-2));
!                                       
!                                       echo '<tr><td align="center">';
! \                                     
$GLOBALS['phpgw']->hooks->single('email',$application)
!                                       echo '</td></tr>';
!                               }
!                       } */
!                       
!                       
//$GLOBALS['phpgw']->template->pparse('out','T_message_main');
!                       
!                       // DO NOT end request yet because the "echo_out" part 
(if exists) will require this connection
!                       //$GLOBALS['phpgw']->msg->end_request();
!                       if ($this->debug > 2) { echo 
'email.bomessage.message_data:  $this->part_nice (With Instructions) dump: 
<pre>'; print_r($this->part_nice); echo '</pre>'; }
!                       
!               }
!       }
! ?>

Index: class.bopreferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.bopreferences.inc.php,v
retrieving revision 1.10.2.3
retrieving revision 1.10.2.4
diff -C2 -r1.10.2.3 -r1.10.2.4
*** class.bopreferences.inc.php 23 Apr 2002 14:30:53 -0000      1.10.2.3
--- class.bopreferences.inc.php 20 Nov 2002 23:03:24 -0000      1.10.2.4
***************
*** 1,1544 ****
! <?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  *
[...3485 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.6.2.1
retrieving revision 1.6.2.2
diff -C2 -r1.6.2.1 -r1.6.2.2
*** class.bosend.inc.php        14 Feb 2002 06:42:44 -0000      1.6.2.1
--- class.bosend.inc.php        20 Nov 2002 23:03:24 -0000      1.6.2.2
***************
*** 1,1064 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - email BO Class for Folder Actions and List Display     
        *
!       * 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.                                           
                *
[...2213 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.mail_dcom.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_dcom.inc.php,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C2 -r1.8.2.1 -r1.8.2.2
*** class.mail_dcom.inc.php     15 Feb 2002 19:45:20 -0000      1.8.2.1
--- class.mail_dcom.inc.php     20 Nov 2002 23:03:24 -0000      1.8.2.2
***************
*** 1,96 ****
! <?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                                        
                *
!       * 
-------------------------------------------------------------------------       
              *
!       * 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;
! 
!       /* -----  any constructor params? ---- */
!       if (isset($p1)
!       && ($p1)
!       && ( (stristr($p1, 'imap') || stristr($p1, 'pop') || 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 (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.6
retrieving revision 1.6.2.1
diff -C2 -r1.6 -r1.6.2.1
*** class.mail_dcom_base.inc.php        19 Dec 2001 15:56:11 -0000      1.6
--- class.mail_dcom_base.inc.php        20 Nov 2002 23:03:24 -0000      1.6.2.1
***************
*** 1,177 ****
! <?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$ */
! 
!       class mail_dcom_base
!       {
!               var $msg_struct;
!               var $err = array("code","msg","desc");
!               var $msg_info = Array(Array());
! 
!               var $tempfile;
!               var $folder_list_changed = False;
!               var $enable_utf7 = False;
!               var $imap_builtin = True;
!               var $force_msg_uids = False;
!               //var $att_files_dir;
!               var $force_check;
! 
!               var $boundary,
!                  $got_structure;
! 
!               function mail_dcom_base()
!               {
!                       $this->err["code"] = " ";
!                       $this->err["msg"]  = " ";
!                       $this->err["desc"] = " ";
!                       $this->tempfile = 
$GLOBALS['phpgw_info']['server']['temp_dir'].SEP.$GLOBALS['phpgw_info']['user']['sessionid'].'.mhd';
!                       $this->force_check = false;
!                       $this->got_structure = false;
!               }
! 
!               function utf7_encode($data)
!               {
!                       // handle utf7 encoding of folder names, if necessary
!                       if (($this->enable_utf7 == False)
!                       || (function_exists('imap_utf7_encode') == False)
!                       || (!isset($data)))
!                       {
!                               return $data;
!                       }
! 
!                       // data to and from the server can be either array or 
string
!                       if (gettype($data) == 'array')
!                       {
!                               // array data
!                               $return_array = Array();
!                               for ($i=0; $i<count($data);$i++)
!                               {
!                                       $return_array[$i] = 
$this->utf7_encode_string($data[$i]);
!                               }
!                               return $return_array;
!                       }
!                       elseif (gettype($data) == 'string')
!                       {
!                               // string data
!                               return $this->utf7_encode_string($data);
!                       }
!                       else
!                       {
!                               // ERROR
!                               return $data;
!                       }
!               }
! 
!               function utf7_encode_string($data_str)
!               {
!                       $name = Array();
!                       $name['folder_before'] = '';
!                       $name['folder_after'] = '';
!                       $name['translated'] = '';
!                       
!                       // folder name at this stage is  
{SERVER_NAME:PORT}FOLDERNAME
!                       // get everything to the right of the bracket "}", 
INCLUDES the bracket itself
!                       $name['folder_before'] = strstr($data_str,'}');
!                       // get rid of that 'needle' "}"
!                       $name['folder_before'] = substr($name['folder_before'], 
1);
!                       // translate
!                       $name['folder_after'] = 
imap_utf7_encode($name['folder_before']);
!                       // replace old folder name with new folder name
!                       $name['translated'] = 
str_replace($name['folder_before'], $name['folder_after'], $data_str);
!                       return $name['translated'];
!               }
! 
!               function utf7_decode($data)
!               {
!                       // handle utf7 decoding of folder names, if necessary
!                       if (($this->enable_utf7 == False)
!                       || (function_exists('imap_utf7_decode') == False)
!                       || (!isset($data)))
!                       {
!                               return $data;
!                       }
! 
!                       // data to and from the server can be either array or 
string
!                       if (gettype($data) == 'array')
!                       {
!                               // array data
!                               $return_array = Array();
!                               for ($i=0; $i<count($data);$i++)
!                               {
!                                       $return_array[$i] = 
$this->utf7_decode_string($data[$i]);
!                               }
!                               return $return_array;
!                       }
!                       elseif (gettype($data) == 'string')
!                       {
!                               // string data
!                               return $this->utf7_decode_string($data);
!                       }
!                       else
!                       {
!                               // ERROR
!                               return $data;
!                       }
!               }
! 
!               function utf7_decode_string($data_str)
!               {
!                       $name = Array();
!                       $name['folder_before'] = '';
!                       $name['folder_after'] = '';
!                       $name['translated'] = '';
!                       
!                       // folder name at this stage is  
{SERVER_NAME:PORT}FOLDERNAME
!                       // get everything to the right of the bracket "}", 
INCLUDES the bracket itself
!                       $name['folder_before'] = strstr($data_str,'}');
!                       // get rid of that 'needle' "}"
!                       $name['folder_before'] = substr($name['folder_before'], 
1);
!                       // translate
!                       $name['folder_after'] = 
imap_utf7_decode($name['folder_before']);
!                       // "imap_utf7_decode" returns False if no translation 
occured
!                       if ($name['folder_after'] == False)
!                       {
!                               // no translation occured
!                               return $data_str;
!                       }
!                       else
!                       {
!                               // replace old folder name with new folder name
!                               $name['translated'] = 
str_replace($name['folder_before'], $name['folder_after'], $data_str);
!                               return $name['translated'];
!                       }
!               }
! 
!               function get_flag($stream,$msg_num,$flag)
!               {
!                       $header = $this->fetchheader($stream,$msg_num);
!                       $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;
!               }
! 
!       } // end of class mail_dcom
! ?>
--- 1,321 ----
! <?php
!       
/**************************************************************************\
!       * AngleMail     http://www.anglemail.org                                
                                *
!       */
!       
/**************************************************************************\
!       * AngleMail - E-Mail Data Communications Class Core Functions           
        *
!       * This file written by Angelo "Angles" Puglisi <address@hidden> *
!       * Copyright (C) 2001-2002 Angelo "Angles" Puglisi                       
                        *
!       * 
-------------------------------------------------------------------------       
                                      *
!       * Most funtions have an authors line which attempts to identify and 
credit      *
!       * any previous authors and maintainers.                                 
                        *
!       * AngleMail appreciates the hard work of previous authors and 
maintainers.      *
!       * 
-------------------------------------------------------------------------       
                      *
!       * This file designed to work as part of a drop in email 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$ */
! 
!       /*!
!       @class mail_dcom_base 
!       @abstract E-Mail Data Communications API
!       @discussion Part of a group of files which together comprise the "Data 
Communications" 
!       API for AngleMail. Certain files are loaded if IMAP is compiled into 
php, while other 
!       files are loaded if the sockets replacement functions are needed. 
!       @author Each function has an authors line. 
!       */
!       class mail_dcom_base
!       {
!               var $msg_struct;
!               var $err = array("code","msg","desc");
!               var $msg_info = Array(Array());
!               
!               var $debug_utf7=0;
!               //var $debug_utf7=3;
! 
!               var $tempfile;
!               var $folder_list_changed = False;
!               var $enable_utf7 = False;
!               var $imap_builtin = True;
!               var $force_msg_uids = False;
!               //var $att_files_dir;
!               var $force_check;
! 
!               var $boundary,
!                  $got_structure;
! 
!               /*!
!               @function mail_dcom_base
!               @abstract *constructor*
!               @author Angles
!               @access private
!               */
!               function mail_dcom_base()
!               {
!                       $this->err["code"] = " ";
!                       $this->err["msg"]  = " ";
!                       $this->err["desc"] = " ";
!                       $this->tempfile = 
$GLOBALS['phpgw_info']['server']['temp_dir'].SEP.$GLOBALS['phpgw_info']['user']['sessionid'].'.mhd';
!                       $this->force_check = false;
!                       $this->got_structure = false;
!               }
! 
!               /*!
!               @function utf7_encode
!               @abstract ?
!               @author Angles
!               @access private
!               */
!               function utf7_encode($data, $called_by='not_provided')
!               {
!                       if ($this->debug_utf7 > 0) { echo 'mail_dcom_base: 
utf7_encode ('.__LINE__.'): ENTERING, $called_by ['.$called_by.']<br>'; } 
!                       if ($this->debug_utf7 > 1) { echo 'mail_dcom_base: 
utf7_encode ('.__LINE__.'): $data ['.serialize($data).']<br>'; } 
!                       // handle utf7 encoding of folder names, if necessary
!                       if (($this->enable_utf7 == False)
!                       || (function_exists('imap_utf7_encode') == False)
!                       || (!isset($data)))
!                       {
!                               if ($this->debug_utf7 > 0) { echo 
'mail_dcom_base: utf7_encode ('.__LINE__.'): LEAVING on error, returning param 
unmodified. Check if .. then to see why we exited here, $called_by 
['.$called_by.']<br>'; } 
!                               return $data;
!                       }
! 
!                       // data to and from the server can be either array or 
string
!                       if (gettype($data) == 'array')
!                       {
!                               // array data
!                               $return_array = Array();
!                               for ($i=0; $i<count($data);$i++)
!                               {
!                                       $return_array[$i] = 
$this->utf7_encode_string($data[$i]);
!                               }
!                               if ($this->debug_utf7 > 0) { echo 
'mail_dcom_base: utf7_encode ('.__LINE__.'): LEAVING, returning $return_array 
['.serialize($return_array).'], $called_by ['.$called_by.']<br>'; } 
!                               return $return_array;
!                       }
!                       elseif (gettype($data) == 'string')
!                       {
!                               // string data
!                               $return_string = 
$this->utf7_encode_string($data);
!                               if ($this->debug_utf7 > 0) { echo 
'mail_dcom_base: utf7_encode ('.__LINE__.'): LEAVING, returning $return_string 
['.serialize($return_string).'], $called_by ['.$called_by.']<br>'; } 
!                               return $return_string;
!                       }
!                       else
!                       {
!                               // ERROR
!                               if ($this->debug_utf7 > 0) { echo 
'mail_dcom_base: utf7_encode ('.__LINE__.'): LEAVING with ERROR, returning 
param unmodified. Data was not string nor array, $called_by 
['.$called_by.']<br>'; } 
!                               return $data;
!                       }
!               }
! 
!               /*!
!               @function utf7_encode_string
!               @abstract ?
!               @author Angles
!               @access private
!               */
!               function utf7_encode_string($data_str)
!               {
!                       $name = Array();
!                       $name['folder_before'] = '';
!                       $name['folder_after'] = '';
!                       $name['translated'] = '';
!                       
!                       if (strstr($data_str,'}'))
!                       {
!                               // folder name at this stage is  
{SERVER_NAME:PORT}FOLDERNAME
!                               // get everything to the right of the bracket 
"}", INCLUDES the bracket itself
!                               $name['folder_before'] = strstr($data_str,'}');
!                               // get rid of that 'needle' "}"
!                               $name['folder_before'] = 
substr($name['folder_before'], 1);
!                               // translate
!                               $name['folder_after'] = 
imap_utf7_encode($name['folder_before']);
!                               // replace old folder name with new folder name
!                               $name['translated'] = 
str_replace($name['folder_before'], $name['folder_after'], $data_str);
!                       }
!                       else
!                       {
!                               // folder name at this stage is  FOLDERNAME
!                               // there is NO {SERVER} part in this name, this 
is OK some commands do not require it (mail_move same acct)
!                               $name['folder_before'] = $data_str;
!                               // translate
!                               $name['folder_after'] = 
imap_utf7_encode($name['folder_before']);
!                               $name['translated'] = $name['folder_after'];
!                       }
!                       if ($this->debug_utf7 > 1) { echo ' _ mail_dcom_base: 
utf7_encode_string ('.__LINE__.'): $name DUMP: 
['.htmlspecialchars(serialize($name)).']<br>'; } 
!                       return $name['translated'];
!               }
! 
!               /*!
!               @function utf7_decode
!               @abstract ?
!               @author Angles
!               @access private
!               */
!               function utf7_decode($data)
!               {
!                       if ($this->debug_utf7 > 0) { echo 'mail_dcom_base: 
utf7_decode ('.__LINE__.'): ENTERING<br>'; } 
!                       if ($this->debug_utf7 > 1) { echo 'mail_dcom_base: 
utf7_decode ('.__LINE__.'): $data ['.serialize($data).']<br>'; } 
!                       // handle utf7 decoding of folder names, if necessary
!                       if (($this->enable_utf7 == False)
!                       || (function_exists('imap_utf7_decode') == False)
!                       || (!isset($data)))
!                       {
!                               if ($this->debug_utf7 > 0) { echo 
'mail_dcom_base: utf7_decode ('.__LINE__.'): LEAVING on error, returning param 
unmodified. Check if .. then to see why we exited here<br>'; } 
!                               return $data;
!                       }
! 
!                       // data to and from the server can be either array or 
string
!                       if (gettype($data) == 'array')
!                       {
!                               // array data
!                               $return_array = Array();
!                               for ($i=0; $i<count($data);$i++)
!                               {
!                                       $return_array[$i] = 
$this->utf7_decode_string($data[$i]);
!                               }
!                               if ($this->debug_utf7 > 0) { echo 
'mail_dcom_base: utf7_decode ('.__LINE__.'): LEAVING, returning $return_array 
['.serialize($return_array).']<br>'; } 
!                               return $return_array;
!                       }
!                       elseif (gettype($data) == 'string')
!                       {
!                               // string data
!                               $return_string = 
$this->utf7_decode_string($data);
!                               if ($this->debug_utf7 > 0) { echo 
'mail_dcom_base: utf7_decode ('.__LINE__.'): LEAVING, returning $return_string 
['.serialize($return_string).']<br>'; } 
!                               return $return_string;
!                       }
!                       else
!                       {
!                               // ERROR
!                               if ($this->debug_utf7 > 0) { echo 
'mail_dcom_base: utf7_decode ('.__LINE__.'): LEAVING with ERROR, returning 
param unmodified. Data was not string nor array.<br>'; } 
!                               return $data;
!                       }
!               }
! 
!               /*!
!               @function utf7_decode_string
!               @abstract ?
!               @author Angles
!               @access private
!               */
!               /*
!               function utf7_decode_string($data_str)
!               {
!                       $name = Array();
!                       $name['folder_before'] = '';
!                       $name['folder_after'] = '';
!                       $name['translated'] = '';
!                       
!                       // folder name at this stage is  
{SERVER_NAME:PORT}FOLDERNAME
!                       // get everything to the right of the bracket "}", 
INCLUDES the bracket itself
!                       $name['folder_before'] = strstr($data_str,'}');
!                       // get rid of that 'needle' "}"
!                       $name['folder_before'] = substr($name['folder_before'], 
1);
!                       // translate
!                       $name['folder_after'] = 
imap_utf7_decode($name['folder_before']);
!                       // "imap_utf7_decode" returns False if no translation 
occured
!                       if ($name['folder_after'] == False)
!                       {
!                               // no translation occured
!                               return $data_str;
!                       }
!                       else
!                       {
!                               // replace old folder name with new folder name
!                               $name['translated'] = 
str_replace($name['folder_before'], $name['folder_after'], $data_str);
!                               return $name['translated'];
!                       }
!               }
!               */
!               function utf7_decode_string($data_str)
!               {
!                       $name = Array();
!                       $name['folder_before'] = '';
!                       $name['folder_after'] = '';
!                       $name['translated'] = '';
!                       
!                       if (strstr($data_str,'}'))
!                       {
!                               // folder name at this stage is  
{SERVER_NAME:PORT}FOLDERNAME
!                               // get everything to the right of the bracket 
"}", INCLUDES the bracket itself
!                               $name['folder_before'] = strstr($data_str,'}');
!                               // get rid of that 'needle' "}"
!                               $name['folder_before'] = 
substr($name['folder_before'], 1);
!                               // translate
!                               $name['folder_after'] = 
imap_utf7_decode($name['folder_before']);
!                               // "imap_utf7_decode" returns False if no 
translation occured (supposed to, can return identical string too)
!                               if ( ($name['folder_after'] == False)
!                               || ($name['folder_before'] == 
$name['folder_after']) )
!                               {
!                                       // no translation occured
!                                       if ($this->debug_utf7 > 0) { echo ' _ 
mail_dcom_base: utf7_decode_string ('.__LINE__.'): returning unmodified name, 
NO decoding needed, returning feed $data_str: 
['.htmlspecialchars(serialize($data_str)).']<br>'; } 
!                                       return $data_str;
!                               }
!                               else
!                               {
!                                       // replace old folder name with new 
folder name
!                                       $name['translated'] = 
str_replace($name['folder_before'], $name['folder_after'], $data_str);
!                                       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'];
!                               }
!                       }
!                       else
!                       {
!                               // folder name at this stage is  FOLDERNAME
!                               // there is NO {SERVER} part in this name, 
!                               // DOES THIS EVER HAPPEN comming *from* the 
server? I DO NOT THINK SO, but just in case
!                               // translate
!                               $name['translated'] = 
imap_utf7_decode($data_str);
!                               // "imap_utf7_decode" returns False if no 
translation occured
!                               if (($name['translated'] == False)
!                               || ($name['folder_before'] == $data_str) )
!                               {
!                                       // no translation occured
!                                       if ($this->debug_utf7 > 0) { echo ' _ 
mail_dcom_base: utf7_decode_string ('.__LINE__.'): returning unmodified name, 
NO decoding needed, returning feed $data_str: 
['.htmlspecialchars(serialize($data_str)).']<br>'; } 
!                                       return $data_str;
!                               }
!                               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'];
!                               }
!                       }
!               }
! 
!               /*!
!               @function get_flag
!               @abstract ?
!               */
!               function get_flag($stream,$msg_num,$flag)
!               {
!                       $header = $this->fetchheader($stream,$msg_num);
!                       $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;
!               }
! 
!       } // end of class mail_dcom
! ?>

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.21
retrieving revision 1.21.2.1
diff -C2 -r1.21 -r1.21.2.1
*** class.mail_dcom_base_sock.inc.php   28 Dec 2001 11:55:52 -0000      1.21
--- class.mail_dcom_base_sock.inc.php   20 Nov 2002 23:03:24 -0000      1.21.2.1
***************
*** 1,1104 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare API - MAIL                                                  *
!   * This file written by Mark Peters <address@hidden>              *
!   * Handles general functionality for mail/mail structures                   *
!   * Copyright (C) 2001 Mark Peters                                           *
!   * -------------------------------------------------------------------------*
!   * This library is part of the phpGroupWare API                             *
!   * http://www.phpgroupware.org/api                                          
* 
!   * ------------------------------------------------------------------------ *
[...2312 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.18.2.2
retrieving revision 1.18.2.3
diff -C2 -r1.18.2.2 -r1.18.2.3
*** class.mail_dcom_imap.inc.php        18 Feb 2002 17:19:23 -0000      1.18.2.2
--- class.mail_dcom_imap.inc.php        20 Nov 2002 23:03:24 -0000      1.18.2.3
***************
*** 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);
!                       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.12
retrieving revision 1.12.2.1
diff -C2 -r1.12 -r1.12.2.1
*** class.mail_dcom_imap_sock.inc.php   14 Dec 2001 21:45:37 -0000      1.12
--- class.mail_dcom_imap_sock.inc.php   20 Nov 2002 23:03:24 -0000      1.12.2.1
***************
*** 1,1216 ****
! <?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                                          
* 
!   * ------------------------------------------------------------------------ *
[...2549 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.2
retrieving revision 1.2.2.1
diff -C2 -r1.2 -r1.2.2.1
*** class.mail_dcom_nntp.inc.php        12 Nov 2001 21:42:09 -0000      1.2
--- class.mail_dcom_nntp.inc.php        20 Nov 2002 23:03:24 -0000      1.2.2.1
***************
*** 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.3
retrieving revision 1.3.2.1
diff -C2 -r1.3 -r1.3.2.1
*** class.mail_dcom_nntp_sock.inc.php   12 Nov 2001 21:42:09 -0000      1.3
--- class.mail_dcom_nntp_sock.inc.php   20 Nov 2002 23:03:24 -0000      1.3.2.1
***************
*** 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.8.2.2
retrieving revision 1.8.2.3
diff -C2 -r1.8.2.2 -r1.8.2.3
*** class.mail_dcom_pop3.inc.php        11 Apr 2002 23:40:32 -0000      1.8.2.2
--- class.mail_dcom_pop3.inc.php        20 Nov 2002 23:03:24 -0000      1.8.2.3
***************
*** 1,252 ****
! <?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);
!                       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.17.2.1
retrieving revision 1.17.2.2
diff -C2 -r1.17.2.1 -r1.17.2.2
*** class.mail_dcom_pop3_sock.inc.php   16 Feb 2002 00:15:13 -0000      1.17.2.1
--- class.mail_dcom_pop3_sock.inc.php   20 Nov 2002 23:03:24 -0000      1.17.2.2
***************
*** 1,2175 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare API - POP3                                                  *
!   * This file written by Mark Peters <address@hidden>              *
!   * Handles specific operations in dealing with POP3                       *
!   * Copyright (C) 2001 Mark Peters and Angelo "Angles" Puglisi                
       *
!   * -------------------------------------------------------------------------*
!   * This library is part of the phpGroupWare API                             *
!   * http://www.phpgroupware.org/api                                          
* 
!   * ------------------------------------------------------------------------ *
[...4433 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.4
retrieving revision 1.4.2.1
diff -C2 -r1.4 -r1.4.2.1
*** class.mail_filters.inc.php  28 Dec 2001 07:19:36 -0000      1.4
--- class.mail_filters.inc.php  20 Nov 2002 23:03:24 -0000      1.4.2.1
***************
*** 1,353 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - E-Mail Filters                                         
        *
!       * Written by Angelo (Angles) Puglisi <address@hidden>           *
!       * Copyright (C) 2001 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
!       {
!               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()
!               {
!                       $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()
!               {
!                       // 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: extract 
multidimentional filter data embedded in this 1 dimentional array
!                                               @discussion: 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:
!                                                       $filter_X 
['match_0_comparator'] => 'contains'
!                                               the "key" string 
"match_0_comparator" needs to be "decompressed" into an associative array
!                                               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"
!                                               @author Angles
!                                               */
!                                               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: extract 
multidimentional filter data embedded in this 1 dimentional array
!                                               @discussion: 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:
!                                                       $filter_X 
['action_1_judgement'] => 'fileinto'
!                                               the "key" string 
"action_1_judgement" needs to be "decompressed" into an associative array
!                                               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"
!                                               @author Angles
!                                               */
!                                               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()
!               {
!                       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()
!               {
!                       $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();
!                       }
!                       
!                       //$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()
!               {
!                       $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.2
retrieving revision 1.2.2.1
diff -C2 -r1.2 -r1.2.2.1
*** class.mail_msg.inc.php      28 Sep 2001 18:14:00 -0000      1.2
--- class.mail_msg.inc.php      20 Nov 2002 23:03:24 -0000      1.2.2.1
***************
*** 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,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');
! 
! ?>

Index: class.mail_msg_base.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.mail_msg_base.inc.php,v
retrieving revision 1.61.2.7
retrieving revision 1.61.2.8
diff -C2 -r1.61.2.7 -r1.61.2.8
*** class.mail_msg_base.inc.php 17 Sep 2002 02:47:25 -0000      1.61.2.7
--- class.mail_msg_base.inc.php 20 Nov 2002 23:03:24 -0000      1.61.2.8
***************
*** 1,3230 ****
! <?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)                       
                *
!       * 
-------------------------------------------------------------------------       
              *
[...8547 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.31.2.2
retrieving revision 1.31.2.3
diff -C2 -r1.31.2.2 -r1.31.2.3
*** class.mail_msg_display.inc.php      29 Jun 2002 16:17:30 -0000      1.31.2.2
--- class.mail_msg_display.inc.php      20 Nov 2002 23:03:25 -0000      1.31.2.3
***************
*** 1,2301 ****
! <?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)                       
                *
[...4718 lines suppressed...]
!                                               $to_person = $to_plain;
!                                       }
!                                       else
!                                       {
!                                               $to_person = 
$GLOBALS['phpgw']->msg->decode_header_string($topeople->personal);
!                                       }
!                                       $to_data_array[$z] = $to_person;
!                               }
!                               // throw a spacer comma in between addresses, 
if more than one
!                               $to_data_final = implode(', ',$to_data_array);
!                       }
!                       $msg_list_display[$x]['to_data_final'] = $to_data_final;
!                       
!               }
!               if ($debug_msg_list_display > 2) { echo 'mail_msg: 
get_msg_list_display: exiting $msg_list_display[] dump:<pre>'; 
print_r($msg_list_display); echo '</pre>'; }
!               return $msg_list_display;
!       }
! 
! } // 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.23.2.3
retrieving revision 1.23.2.4
diff -C2 -r1.23.2.3 -r1.23.2.4
*** class.mail_msg_wrappers.inc.php     14 Mar 2002 01:50:34 -0000      1.23.2.3
--- class.mail_msg_wrappers.inc.php     20 Nov 2002 23:03:25 -0000      1.23.2.4
***************
*** 1,2510 ****
! <?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)                       
                *
[...7161 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.8.2.1
retrieving revision 1.8.2.2
diff -C2 -r1.8.2.1 -r1.8.2.2
*** class.mail_send.inc.php     2 Sep 2002 00:04:30 -0000       1.8.2.1
--- class.mail_send.inc.php     20 Nov 2002 23:03:25 -0000      1.8.2.2
***************
*** 1,383 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare API - smtp mailer                                        
                *
!       * This file written by Itzchak Rehberg <address@hidden>                 
*
!       * and Joseph Engo <address@hidden>                                      
*
!       * and Angelo Tony Puglisi (angles)  <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 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
!       Itzchak Rehberg - initial implementation, SMTP communication and 
control flow, excellent work!
!       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,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;
!                                       }
!                               }
!                               // 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
!       }
! ?>
\ No newline at end of file
--- 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.uicompose.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uicompose.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** class.uicompose.inc.php     14 Feb 2002 06:42:44 -0000      1.1.2.1
--- class.uicompose.inc.php     20 Nov 2002 23:03:25 -0000      1.1.2.2
***************
*** 1,144 ****
! <?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 = False;
!               var $is_modular = False;
! 
!               var $public_functions = array(
!                       'compose' => True,
!                       'get_is_modular' => True,
!                       'set_is_modular' => True
!               );
! 
!               function uicompose()
!               {
!                       
!               }
! 
!               function get_is_modular()
!               {
!                       return $this->is_modular;
!               }
!               
!               function set_is_modular($feed_bool=False)
!               {
!                       // is_bool() is in the php3 compat library
!                       if ((isset($feed_bool))
!                       && (is_bool($feed_bool)))
!                       {
!                               // only change this if the arg is boolean
!                               $this->is_modular = $feed_bool;
!                       }
!                       return $this->is_modular;
!               }
!               
!               function compose($reuse_feed_args='')
!               {
!                       if (empty($reuse_feed_args))
!                       {
!                               $reuse_feed_args = array();
!                       }
!                       
!                       $this->bo = CreateObject("email.bocompose");
!                       $this->bo->compose($reuse_feed_args);
!                       
!                       if ($this->is_modular == True)
!                       {
!                               // we do NOT echo or print output any html, we 
are being used as a module by another app
!                               // all we do in this case is pass the parsed 
html to the calling app
!                       }
!                       else
!                       {
!                               // 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();
!                               // NOTE: as of Dec 10, 2001 a call from 
menuaction defaults to NOT modular
!                               // 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_compose_out' => 'compose.tpl'
!                               )
!                       );
!                       
$GLOBALS['phpgw']->template->set_block('T_compose_out','B_checkbox_sig','V_checkbox_sig');
!                       
!                       // 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'],
!                               
!                               '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'],
!                               'btn_addybook_type'     => 
$this->bo->xi['btn_addybook_type'],
!                               'btn_addybook_value'    => 
$this->bo->xi['btn_addybook_value'],
!                               'btn_addybook_onclick'  => 
$this->bo->xi['btn_addybook_onclick'],
!                               'btn_send_type'         => 
$this->bo->xi['btn_send_type'],
!                               'btn_send_value'        => 
$this->bo->xi['btn_send_value'],
!                               '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'],
!                               'attachfile_js_link'    => 
$this->bo->xi['attachfile_js_link'],
!                               'attachfile_js_text'    => 
$this->bo->xi['attachfile_js_text'],
!                               '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();
!                       
!                       if ($this->is_modular == True)
!                       {
!                               // we do NOT output any html, we are being used 
as a module in another app
!                               // instead, we will pass the parsed html to the 
calling app
!                               return 
$GLOBALS['phpgw']->template->fp('out','T_compose_out');
!                       }
!                       else
!                       {
!                               // 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,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');
!               }
!       }
! ?>

Index: class.uifilters.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uifilters.inc.php,v
retrieving revision 1.10.2.2
retrieving revision 1.10.2.3
diff -C2 -r1.10.2.2 -r1.10.2.3
*** class.uifilters.inc.php     18 Feb 2002 17:19:24 -0000      1.10.2.2
--- class.uifilters.inc.php     20 Nov 2002 23:03:25 -0000      1.10.2.3
***************
*** 1,633 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - Sieve Email Filters and Search Mode                    
        *
!       * http://www.phpgroupware.org                                           
        *
!       * Written by 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.                                           
                *
[...1264 lines suppressed...]
!                       
$GLOBALS['phpgw']->template->set_var('done_href',$done_href);
!                       
!                       // TEST AND APPLY LINKS
!                       $run_all_filters_url = $GLOBALS['phpgw']->link(
!                                                                       
'/index.php',
!                                                                        
'menuaction=email.bofilters.do_filter');
!                       $run_all_filters_href = '<a 
href="'.$run_all_filters_url.'">'.lang('<b>APPLY ALL</b> Filters').'</a>';
!                       
$GLOBALS['phpgw']->template->set_var('run_all_filters_href',$run_all_filters_href);
!                       
!                       $test_all_filters_url = 
$run_all_filters_url.'&filter_test=1';
!                       $test_all_filters_href = '<a 
href="'.$test_all_filters_url.'">Test All Filters</a>';
!                       
$GLOBALS['phpgw']->template->set_var('test_all_filters_href',$test_all_filters_href);
!                       
!                       // output the template
!                       
$GLOBALS['phpgw']->template->pfp('out','T_filters_list');
!               }
!               
!               
!       }
! ?>

Index: class.uifolder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uifolder.inc.php,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -r1.2 -r1.2.2.1
*** class.uifolder.inc.php      3 Jan 2002 10:03:28 -0000       1.2
--- class.uifolder.inc.php      20 Nov 2002 23:03:25 -0000      1.2.2.1
***************
*** 1,181 ****
! <?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 $debug = False;
!               var $is_modular = False;
! 
!               var $public_functions = array(
!                       'folder' => True,
!                       'get_is_modular' => True,
!                       'set_is_modular' => True
!               );
! 
!               function uifolder()
!               {
!                       
!               }
! 
!               function get_is_modular()
!               {
!                       return $this->is_modular;
!               }
!               
!               function set_is_modular($feed_bool=False)
!               {
!                       // is_bool() is in the php3 compat library
!                       if ((isset($feed_bool))
!                       && (is_bool($feed_bool)))
!                       {
!                               // only change this if the arg is boolean
!                               $this->is_modular = $feed_bool;
!                       }
!                       return $this->is_modular;
!               }
!               
!               function folder($reuse_feed_args='')
!               {
!                       if (empty($reuse_feed_args))
!                       {
!                               $reuse_feed_args = array();
!                       }
!                       
!                       $this->bo = CreateObject("email.bofolder");
!                       $this->bo->folder($reuse_feed_args);
!                       
!                       if ($this->is_modular == True)
!                       {
!                               // we do NOT echo or print output any html, we 
are being used as a module by another app
!                               // all we do in this case is pass the parsed 
html to the calling app
!                       }
!                       else
!                       {
!                               // 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();
!                               // NOTE: as of Dec 10, 2001 a call from 
menuaction defaults to NOT modular
!                               // 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');
!                       
$GLOBALS['phpgw']->template->set_block('T_folder_out','B_action_report','V_action_report');
!                       
! 
! 
! 
!                       if ($this->bo->xi['action_report'] != '')
!                       {
!                               
$GLOBALS['phpgw']->template->set_var('action_report',$this->bo->xi['action_report']);
!                               
$GLOBALS['phpgw']->template->parse('V_action_report','B_action_report');
!                       }
!                       else
!                       {
!                               
$GLOBALS['phpgw']->template->set_var('V_action_report','');
!                       }
! 
! 
!                       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_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']);
!                       
! 
!                       if ($this->is_modular == True)
!                       {
!                               // we do NOT output any html, we are being used 
as a module in another app
!                               // instead, we will pass the parsed html to the 
calling app
!                               
!                               // Template->fp  means "Finish Parse", which 
does this
!                               // 1) parses temnplate and replaces template 
tokens with vars we have set here
!                               // 2) "finish" is like clean up, takes care of 
what to do with "unknowns",
!                               //      which are things in the template that 
look like {replace_me} tokens, but
!                               //      for which a replacement value has not 
been set, finishes allows you to do this with them:
!                               // "keep" them;  "remove"  then;  or  "comment" 
them
!                               // Template->fp  defaults to "remove" unknowns, 
although you may set Template->unknowns as you wish
!                               // 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");
!                               return 
$GLOBALS['phpgw']->template->fp('out','T_folder_out');
!                       }
!                       else
!                       {
!                               // 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_folder_out');
!                               
!                               // 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
!                       }
!               }
!       }
! ?>
--- 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);
!               }
!       }
! ?>

Index: class.uiindex.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uiindex.inc.php,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -C2 -r1.17.2.1 -r1.17.2.2
*** class.uiindex.inc.php       15 Feb 2002 08:00:27 -0000      1.17.2.1
--- class.uiindex.inc.php       20 Nov 2002 23:03:25 -0000      1.17.2.2
***************
*** 1,681 ****
! <?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.                                           
                *
[...1303 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.uimessage.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uimessage.inc.php,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -C2 -r1.2.2.2 -r1.2.2.3
*** class.uimessage.inc.php     26 Mar 2002 02:20:41 -0000      1.2.2.2
--- class.uimessage.inc.php     20 Nov 2002 23:03:25 -0000      1.2.2.3
***************
*** 1,292 ****
! <?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 uimessage
!       {
!               var $bo;                
!               var $debug = 0;
!               var $is_modular = False;
! 
!               var $public_functions = array(
!                       'message' => True,
!                       'get_is_modular' => True,
!                       'set_is_modular' => True
!               );
! 
!               function uimessage()
!               {
!                       
!               }
! 
!               function get_is_modular()
!               {
!                       return $this->is_modular;
!               }
!               
!               function set_is_modular($feed_bool=False)
!               {
!                       // is_bool() is in the php3 compat library
!                       if ((isset($feed_bool))
!                       && (is_bool($feed_bool)))
!                       {
!                               // only change this if the arg is boolean
!                               $this->is_modular = $feed_bool;
!                       }
!                       return $this->is_modular;
!               }
!               
!               function message($reuse_feed_args='')
!               {
!                       if (empty($reuse_feed_args))
!                       {
!                               $reuse_feed_args = array();
!                       }
!                       
!                       $this->bo = CreateObject("email.bomessage");
!                       $this->bo->message_data($reuse_feed_args);
!                       
!                       if ($this->is_modular == True)
!                       {
!                               // we do NOT echo or print output any html, we 
are being used as a module by another app
!                               // all we do in this case is pass the parsed 
html to the calling app
!                       }
!                       else
!                       {
!                               // we are the BO and the UI, we take care of 
outputting the HTML to the client browser
!                               // 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();
!                               // NOTE: as of Dec 10, 2001 a call from 
menuaction defaults to NOT modular
!                               // 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');
!                       
!                       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','');
!                       }
!                       
!                       //  ----  TOOL BAR / MENU BAR ----
!                       
$GLOBALS['phpgw']->template->set_var('accounts_label',$this->bo->xi['accounts_label']);
!                       
$GLOBALS['phpgw']->template->set_var('ctrl_bar_font',$this->bo->xi['ctrl_bar_font']);
!                       
$GLOBALS['phpgw']->template->set_var('ctrl_bar_font_size',$this->bo->xi['ctrl_bar_font_size']);
!                       
$GLOBALS['phpgw']->template->set_var('ctrl_bar_back1',$this->bo->xi['ctrl_bar_back1']);
!                       // ---- account switchbox  ----
!                       
$GLOBALS['phpgw']->template->set_var('acctbox_listbox',$this->bo->xi['acctbox_listbox']);
!                       
$GLOBALS['phpgw']->template->set_var('acctbox_frm_name',$this->bo->xi['acctbox_frm_name']);
!                       
$GLOBALS['phpgw']->template->set_var('acctbox_action',$this->bo->xi['acctbox_action']);
!                       // ---- Move Message Box  ----
!                       
$GLOBALS['phpgw']->template->set_var('move_current_sort',$this->bo->xi['move_current_sort']);
!                       
$GLOBALS['phpgw']->template->set_var('move_current_order',$this->bo->xi['move_current_order']);
!                       
$GLOBALS['phpgw']->template->set_var('move_current_start',$this->bo->xi['move_current_start']);
!                       
$GLOBALS['phpgw']->template->set_var('mlist_checkbox_name',$this->bo->xi['mlist_checkbox_name']);
!                       
$GLOBALS['phpgw']->template->set_var('mlist_embedded_uri',$this->bo->xi['mlist_embedded_uri']);
!                       
$GLOBALS['phpgw']->template->set_var('frm_delmov_action',$this->bo->xi['frm_delmov_action']);
!                       
$GLOBALS['phpgw']->template->set_var('frm_delmov_name',$this->bo->xi['frm_delmov_name']);
!                       
$GLOBALS['phpgw']->template->set_var('delmov_listbox',$this->bo->xi['delmov_listbox']);
!                       
$GLOBALS['phpgw']->template->set_var('move_postmove_goto_name',$this->bo->xi['move_postmove_goto_name']);
!                       
$GLOBALS['phpgw']->template->set_var('move_postmove_goto_value',$this->bo->xi['move_postmove_goto_value']);
!               
!               /*
!               ok      acctbox_frm_name
!               ok      acctbox_action
!               ok      ctrl_bar_back1
!               ok      acctbox_listbox
!               ok      ctrl_bar_font
!               ok      ctrl_bar_font_size
!               ok      accounts_label
!                       
!               ok      frm_delmov_name
!               ok      frm_delmov_action
!               ok      current_sort
!               ok      current_order
!               ok      current_start
!               ok      mlist_checkbox_name
!               ok      mlist_embedded_uri
!               ok      delmov_listbox
!               */      
!                       
!                       
!                       
!                       
$GLOBALS['phpgw']->template->set_var('ilnk_prev_msg',$this->bo->xi['ilnk_prev_msg']);
!                       
$GLOBALS['phpgw']->template->set_var('ilnk_next_msg',$this->bo->xi['ilnk_next_msg']);
!                       
!                       // ----  Labels and Colors for From, To, CC, Files, and 
Subject  -----
!                       
$GLOBALS['phpgw']->template->set_var('tofrom_labels_bkcolor',$this->bo->xi['tofrom_labels_bkcolor']);
!                       
$GLOBALS['phpgw']->template->set_var('tofrom_data_bkcolor',$this->bo->xi['tofrom_data_bkcolor']);
!                       
!                       
$GLOBALS['phpgw']->template->set_var('lang_from',$this->bo->xi['lang_from']);
!                       
$GLOBALS['phpgw']->template->set_var('lang_to',$this->bo->xi['lang_to']);
!                       
$GLOBALS['phpgw']->template->set_var('lang_cc',$this->bo->xi['lang_cc']);
!                       
$GLOBALS['phpgw']->template->set_var('lang_date',$this->bo->xi['lang_date']);
!                       
$GLOBALS['phpgw']->template->set_var('lang_files',$this->bo->xi['lang_files']);
!                       
$GLOBALS['phpgw']->template->set_var('lang_subject',$this->bo->xi['lang_subject']);
!                       
!                       // ----  From:  Message Data  -----
!                       
$GLOBALS['phpgw']->template->set_var('from_data_final',$this->bo->xi['from_data_final']);
!                       
!                       // ----  To:  Message Data  -----
!                       
$GLOBALS['phpgw']->template->set_var('to_data_final',$this->bo->xi['to_data_final']);
!                       
!                       // ----  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'] != '') )
!                       {
!                               
$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','');
!                       }
!                       
!                       
!                       // ----  Images and Hrefs For Reply, ReplyAll, Forward, 
and Delete  -----
!                       
$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']);
!                       
$GLOBALS['phpgw']->template->set_var('reply_btns_bkcolor',$this->bo->xi['reply_btns_bkcolor']);
!                       
$GLOBALS['phpgw']->template->set_var('reply_btns_text',$this->bo->xi['reply_btns_text']);
!                       
$GLOBALS['phpgw']->template->set_var('lnk_goback_folder',$this->bo->xi['lnk_goback_folder']);
!                       
$GLOBALS['phpgw']->template->set_var('ilnk_reply',$this->bo->xi['ilnk_reply']);
!                       
$GLOBALS['phpgw']->template->set_var('ilnk_replyall',$this->bo->xi['ilnk_replyall']);
!                       
$GLOBALS['phpgw']->template->set_var('ilnk_forward',$this->bo->xi['ilnk_forward']);
!                       
$GLOBALS['phpgw']->template->set_var('ilnk_delete',$this->bo->xi['ilnk_delete']);
!                       
!                       
!                       // ---- DEBUG: Show Information About Each Part  -----
!                       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  -------
!                       @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')
!                               {
!                                       
$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()
!                                       $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
!                                       echo '<pre>';
!                                       echo 
$GLOBALS['phpgw']->msg->phpgw_fetchbody($msgball);
!                                       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 ======= = = = = = =
!                                       $did_echo_dump = True;
!                                       break;
!                               }
!                       }
!                       @set_time_limit(0);
!                       // by now it should be OK to close the stream
!                       $GLOBALS['phpgw']->msg->end_request();
!                       
!                       if ((isset($did_echo_dump))
!                       && ($did_echo_dump == True))
!                       {
!                               // DO NOTHING!
!                               // echo dump already outputted the template
!                       }
!                       else
!                       {
!                               
$GLOBALS['phpgw']->template->pfp('out','T_message_main');
!                               //$GLOBALS['phpgw']->common->phpgw_footer();
!                       }
!               }
!       }
! ?>
--- 1,270 ----
! <?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 uimessage
!       @abstract ?
!       */
!       class uimessage
!       {
!               var $bo;
!               var $widgets;
!               var $debug = 0;
! 
!               var $public_functions = array(
!                       'message' => True
!               );
! 
!               function uimessage()
!               {
!                       return;
!               }
! 
!               /*!
!               @function message
!               @abstract ?
!               */
!               function message()
!               {
!                       $this->bo = CreateObject("email.bomessage");
!                       $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','');
!                       }
!                       
!                       //  ----  TOOL BAR / MENU BAR ----
!                       $tpl_vars = Array(
!                               //'accounts_label'              => 
$this->bo->xi['accounts_label'],
!                               //'ctrl_bar_font'                       => 
$this->bo->xi['ctrl_bar_font'],
!                               //'ctrl_bar_font_size'  => 
$this->bo->xi['ctrl_bar_font_size'],
!                               //'ctrl_bar_back1'              => 
$this->bo->xi['ctrl_bar_back1'],
!                               
!                               'bar_back1'             => '',
!                               //'bar_back1'           => 
$GLOBALS['phpgw_info']['theme']['table_bg'],
!                               //'bar_back1'           => 
$GLOBALS['phpgw_info']['theme']['bg08'],
!                               
!                               // ---- account switchbox  ----
!                               //'acctbox_listbox'             => 
$this->bo->xi['acctbox_listbox'],
!                               //'ilnk_accounts'                       => 
$this->bo->xi['ilnk_accounts'],
!                               //'acctbox_frm_name'            => 
$this->bo->xi['acctbox_frm_name'],
!                               //'acctbox_action'              => 
$this->bo->xi['acctbox_action'],
!                               // ---- Move Message Box  ----
!                               'move_current_sort'             => 
$this->bo->xi['move_current_sort'],
!                               'move_current_order'    => 
$this->bo->xi['move_current_order'],
!                               'move_current_start'    => 
$this->bo->xi['move_current_start'],
!                               'mlist_checkbox_name'   => 
$this->bo->xi['mlist_checkbox_name'],
!                                               
!                               'mlist_embedded_uri'    => 
$this->bo->xi['mlist_embedded_uri'],
!                               'frm_delmov_action'             => 
$this->bo->xi['frm_delmov_action'],
!                               'frm_delmov_name'               => 
$this->bo->xi['frm_delmov_name'],
!                               'delmov_listbox'                => 
$this->bo->xi['delmov_listbox'],
!                               'move_postmove_goto_name'       => 
$this->bo->xi['move_postmove_goto_name'],
!                               'move_postmove_goto_value'      => 
$this->bo->xi['move_postmove_goto_value'],
!                               
!                               'ilnk_prev_msg'                 => 
$this->bo->xi['ilnk_prev_msg'],
!                               'ilnk_next_msg'                 => 
$this->bo->xi['ilnk_next_msg'],
!                               
!                               // ----  Labels and Colors for From, To, CC, 
Files, and Subject  -----
!                               'tofrom_labels_bkcolor' => 
$this->bo->xi['tofrom_labels_bkcolor'],
!                               'tofrom_data_bkcolor'   => 
$this->bo->xi['tofrom_data_bkcolor'],
!                               
!                               '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']
!                       );
!                       $GLOBALS['phpgw']->template->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'] != '') )
!                       {
!                               
$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','');
!                       }
!                       
!                       
!                       $tpl_vars = Array(
!                               // ----  Images and Hrefs For Reply, ReplyAll, 
Forward, and Delete  -----
!                               'theme_font'            => 
$this->bo->xi['theme_font'],
!                               'theme_th_bg'           => 
$this->bo->xi['theme_th_bg'],
!                               'theme_row_on'          => 
$this->bo->xi['theme_row_on'],
!                               'reply_btns_bkcolor' => 
$this->bo->xi['reply_btns_bkcolor'],
!                               'reply_btns_text'       => 
$this->bo->xi['reply_btns_text'],
!                               
!                               'lnk_goback_folder'     => 
$this->bo->xi['lnk_goback_folder'],
!                               'ilnk_reply'            => 
$this->bo->xi['ilnk_reply'],
!                               'ilnk_replyall'         => 
$this->bo->xi['ilnk_replyall'],
!                               'ilnk_forward'          => 
$this->bo->xi['ilnk_forward'],
!                               'ilnk_delete'           => 
$this->bo->xi['ilnk_delete']
!                       );
!                       $GLOBALS['phpgw']->template->set_var($tpl_vars);
!                       
!                       
!                       // ---- DEBUG: Show Information About Each Part  -----
!                       //  the debug output needs updating
!                       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  -------
!                       //@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')
!                               {
!                                       
$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()
!                                       $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
!                                       
$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 ======= = = = = = =
!                                       $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
!                       {
!                               
$GLOBALS['phpgw']->template->pfp('out','T_message_main');
!                               //$GLOBALS['phpgw']->common->phpgw_footer();
!                       }
!                       // tell apache to release emeory back to the system on 
script end
!                       //apache_child_terminate();
! 
!                       // close down ALL mailserver streams
!                       $GLOBALS['phpgw']->msg->end_request();
!                       // destroy the object
!                       $GLOBALS['phpgw']->msg = '';
!                       unset($GLOBALS['phpgw']->msg);
!               }
!       }
! ?>

Index: class.uipreferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/class.uipreferences.inc.php,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -C2 -r1.9.2.2 -r1.9.2.3
*** class.uipreferences.inc.php 14 Feb 2002 06:42:44 -0000      1.9.2.2
--- class.uipreferences.inc.php 20 Nov 2002 23:03:25 -0000      1.9.2.3
***************
*** 1,607 ****
! <?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               *
[...1268 lines suppressed...]
!                                       
$GLOBALS['phpgw']->template->parse('V_accts_list','B_accts_list', True);
!                               }
!                       }
!                       $add_new_acct_url = $GLOBALS['phpgw']->link(
!                                                                       
'/index.php',
!                                                                        
'menuaction=email.uipreferences.ex_accounts_edit'
!                                                                       
.'&ex_acctnum='.$this->bo->add_new_account_token);
!                       $add_new_acct_href = '<a 
href="'.$add_new_acct_url.'">'.lang('New Account').'</a>';
!                       
$GLOBALS['phpgw']->template->set_var('add_new_acct_href',$add_new_acct_href);
!                       
!                       $done_url = $GLOBALS['phpgw']->link(
!                                                                       
'/preferences/index.php');
!                       $done_href = '<a 
href="'.$done_url.'">'.lang('Done').'</a>';
!                       
$GLOBALS['phpgw']->template->set_var('done_href',$done_href);
!                       
!                       // output the template
!                       
$GLOBALS['phpgw']->template->pfp('out','T_prefs_ex_accounts');
!               }
!       }
! ?>

Index: functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/functions.inc.php,v
retrieving revision 1.111
retrieving revision 1.111.2.1
diff -C2 -r1.111 -r1.111.2.1
*** functions.inc.php   3 Jan 2002 10:03:28 -0000       1.111
--- functions.inc.php   20 Nov 2002 23:03:25 -0000      1.111.2.1
***************
*** 1,295 ****
! <?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    -----
!       /*
!       @Discussion     Turn Off Magic Quotes Runtime
!       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.
!       @author Angles
!       */
!       set_magic_quotes_runtime(0);
! 
! // ----  Set Some Debug Flags ==  -----
!       //$debug_logins = True;
!       $debug_logins = False;
!       
!       //$debug_args_array = True;
!       $debug_args_array = False;
!       
! // ----  == IS IT OK TO LOGIN To Mailserver ==  -----
!       /*
!       @Discussion     Is It OK to Login To The Server?
!       Preferences page, Users home page, Addressbook page,
!       none require an actual connection to a server, in fact a connection may 
not even
!       be possible if preferences are not set or are set incorrectly
!       @author Angles
!       */
!       // OK TO LOGIN pre-conditions
!       // were we called from the main screen (user's home page)
!       if (strstr($GLOBALS['phpgw_info']['server']['versions']['phpgwapi'], 
'0.9.12'))
!       {
!               // user's welcome page was called "index.php" in ver 0.9.12
!               // perhaps still needed during the upgrade procedure - so keep 
this check
!               $in_mainscreen = 
eregi("^.*\/index\.php.*$",$GLOBALS['PHP_SELF']);
!       }
!       else
!       {
!               // after version 0.9.13 users welcome page is "home.php"
!               $in_mainscreen = 
eregi("^.*\/home\.php.*$",$GLOBALS['PHP_SELF']);
!       }
!       // were we in a typical email session
!       $in_email = eregi("^.*\/email\/.*$",$GLOBALS['PHP_SELF']);
!       
!       // DO NOT LOGIN for these conditions  --------
!       $login_allowed = True; // initialize
!       
!       // these files do not require login to email server, or have been 
replaced by n-tier classes.
!       $no_login_check = Array(
!               "attach_file\.php",
!               "preferences\.php",
!               "addressbook\.php",
!               "folder\.php",
!               "message\.php",
!               //"filters\.php",
!               "index\.php",
!               "indexx\.php"
!       );
!       if ($debug_logins) { echo 'email functions.php: $no_login_check[]: 
'.serialize($no_login_check).'<br>'; }
!       
!       for ($i=0; $i<count($no_login_check); $i++)
!       {
!               $match_this = $no_login_check[$i];
!               if (eregi("^.*\/email\/$match_this.*$",$GLOBALS['PHP_SELF']))
!               {
!                       $login_allowed = False;
!                       break;
!               }
!       }
! 
!       // MORE Login Restrictions That Need Work - Disabled for now
!       // send_message needs to access the mailserver to get parts sometimes, 
can't limit this here
!       // AND ALSO  Do Not Login - if sent message will NOT be put in the 
"Sent" folder
!       //if ( (eregi("^.*\/email\/send_message\.php.*$",$GLOBALS['PHP_SELF']))
!       //&& 
($GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'] != 
'imap')
!       //&& 
($GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'] != 
'imaps') )
!       //{
!       //      $login_allowed = False;
!       //}
! 
!       /*
!       // this this debug report looks to be somewhat dated
!       if ($debug_logins)
!       {
!               echo '<br>';
!               echo 'PHP_SELF='.$GLOBALS['PHP_SELF'].'<br>';
!               echo 
'phpgw_info[server][webserver_url]='.$GLOBALS['phpgw_info']['server']['webserver_url'].'<br>';
!               echo 'in_mainscreen='.serialize($in_mainscreen).'<br>';
!               echo 'in_email='.serialize($in_email).'<br>';
!               echo 'login_allowed='.serialize($login_allowed).'<br>';
!               echo 'folder='.$folder.'<br>';
!               echo 
'get_mailsvr_callstr='.$GLOBALS['phpgw']->msg->get_mailsvr_callstr().'<br>';
!               echo 
'get_folder_long='.$GLOBALS['phpgw']->msg->get_folder_long($folder).'<br>';
!       }
!       */
! 
!       /*!
!       @action begin mail request
!       @abstract       basic instructions for creating and initializing the 
mail_msg class
!       @param  $this->args[]   array   see below for available array elements
!       @param  $args_array     array   currently only 2 elements are available
!               $args_array['folder']  string  default: 'INBOX'
!                       name of folder name to log into (i.e. open, select)
!               $args_array['do_login']  boolean  default: True
!                       should the mail_msg class actually create a mail_dcom 
instance and then
!                       attempt to establish a connection to a server. In some 
cases, such as when
!                       setting preferences, this is not desirable (not 
possible before prefs are set, anyway)
!                       avoids delays and/or error messages of an unneeded 
server connection
!       @result none, this is an object
!       @discussion     The mail_msg class is intended to hide the complex 
details of email requests
!       from the developer, allowing almost anyone with little effort to 
include useful email functionality
!       in their application. For this reason, the initial arguments that 
mail_msg class will look for are
!       in two seperate structures. Param $args_array accepts only 2 elements, 
"folder" and "do_login"
!       and represents the minimum amount of information the calling 
application need supply to
!       the class to get something done. The other necessary data will be 
inferred of gathered from the
!       preferences class.
!       Alternatively, the $this->args[] array can hold quite a number of 
elements which can be used
!       by the mail_msg class to accomplish more specific and/or more 
complicated mail requests.
!       See below for the currently available array elements that mail_msg 
class will accept.
!       Here are some simplified instructions on initializing and using the 
mail_msg class.
!       
!       ----  INSTRUCTIONS:   -------
!       1: create an instance of the mail_msg class
!               $GLOBALS['phpgw']->msg = CreateObject("email.mail_msg");
!       2: (optional) if you want to pass some GPC type args to the class, put 
then in the
!               $GLOBALS['phpgw']->msg->args[] array
!               example: putting $GLOBALS['HTTP_POST_VARS'] and/or HTTP_GET_VARS
!               data into said msg->args[] array is accomplished with this 
class function:
!               $GLOBALS['phpgw']->msg->grab_class_args_gpc();
!               Alternatively, if you are attempting to set email preferences, 
use this call:
!               $GLOBALS['phpgw']->msg->grab_set_prefs_args_gpc();
!               FUTURE USAGE:
!                       Those two class functions will have equivalent calls 
for external data feeds, like:
!                       $GLOBALS['phpgw']->msg->grab_class_args_xmlrpc();
!                       $GLOBALS['phpgw']->msg->grab_set_prefs_args_xmlrpc();
!       3: create an array (example: $args_array[]) to be the sole argument to 
"begin_request()"
!       4: there is 1 needed and 1 optional params:
!               $args_array['do_login'] : boolean (necessary) : default: True
!               $args_array['folder'] : string (defaults to 'INBOX' if not 
supplied)
!       5: call "begin_request" with that args array as such:
!               $GLOBALS['phpgw']->msg->begin_request($args_array);
!       6: do something, like grab an email, list messages, check for new mail, 
etc...
!                       $inbox_data = Array();
!                       $inbox_data = 
$GLOBALS['phpgw']->msg->new_message_check();
!       7: when you are done, end the request with this command:
!               $GLOBALS['phpgw']->msg->end_request('');
!       
!       Simple Example:
!               $GLOBALS['phpgw']->msg = CreateObject("email.mail_msg");
!               $args_array = Array();
!               $args_array['folder'] = 'INBOX';
!               $args_array['do_login'] = True;
!               $GLOBALS['phpgw']->msg->begin_request($args_array);
!               $inbox_data = Array();
!               $inbox_data = $GLOBALS['phpgw']->msg->new_message_check();
!               echo 'mail check says: '.$inbox_data['alert_string'];
!               $GLOBALS['phpgw']->msg->end_request('');
!       */
! 
!       // ----  Create the mail_msg Class    -----
!       //$GLOBALS['phpgw']->msg = CreateObject("email.mail_msg");
!       if (is_object($GLOBALS['phpgw']->msg))
!       {
!               if ($debug_logins) { echo 'email: functions.inc.php: is_object 
test: $GLOBALS[phpgw]->msg is already set, do not create again<br>'; }
!       }
!       else
!       {
!               if ($debug_logins) { echo 'email: functions.inc.php: is_object 
test: $GLOBALS[phpgw]->msg is NOT set, creating mail_msg object<br>'; }
!               $GLOBALS['phpgw']->msg = CreateObject("email.mail_msg");
!       }
! 
!       /*
!       // DEPRECIATED - now in email.bopreferences
!       // ----  HANDLE GETTING PREFERENCE GPC HTTP_POST_VARS ARGS  -------
!       // setting prefs does not require a login, in fact you may not be able 
to login until you set
!       // some basic prefs, so it makes sence to handle that here
!       if (isset($GLOBALS['HTTP_POST_VARS']['submit_prefs']))
!       {
!               $GLOBALS['phpgw']->msg->grab_set_prefs_args_gpc();
!       }
!       */
!       
!       // UNKNOWN if $totalerrors and $errors are still used or not
!       // $args_array['totalerrors'] = $totalerrors;
!       // $args_array['errors'] = $errors;
! 
! // ----  CONNECT TO MAILSERVER - IF IT'S OK  -------
!       if ((($in_email) || ($in_mainscreen))
!       && ($login_allowed))
!       {
!               // this will expose sensitive data, beter to comment it out 
when not debugging
!               //if ($debug_logins) {  echo 'CALL TO LOGIN IN 
FUNCTIONS.INC.PHP'.'<br>'.'userid='.$GLOBALS['phpgw_info']['user']['preferences']['email']['userid'];
 }
!               
!               /*
!               // DEPRECIATED - not happens aytomatically in 
"->begin_request()"
!               // ----  GRAB CLASS VARIABLES FROM HTTP POST OR GET GLOBALS  
------
!               $GLOBALS['phpgw']->msg->grab_class_args_gpc();
!               */
!               
!               // ----  INITIALIZE SIMPLE REQUEST ARGS ARRAY HOLDER VARIABLE  
-------
!               // needed whether you intend to login or not
!               $args_array = Array();
!               // ====== ARGUMENTS THAT "BEGIN_REQUEST() ARGS_ARRAY TAKES  
=====
!               // (1) PRIMARY: $args_array["do_login"] = True/False
!               // "Primary" means this arg value *should* be passed in the 
$args_array[] item
!               // although it can be passed thru any supported means. 
"do_login" controls
!               // whether class.mail_dcom  is created and whether a server 
login is attempted.
!               // This can be undersirable if no email prefs exist or if a 
server connection is otherwise
!               // not required or not desired.
!               // (2) additionally, *any* known class arg can be passed in 
$args_array[] and theey will
!               // OVERRIDE any previous arg value, such as gotten from the GPC 
vars in "->grab_class_args_*()"
!               // Otherwise, just let the "->grab_class_args_*()" set these 
arg values.
!               // NOTE: you can supply the "folder" and "do_login" values from 
any data source, xml-rpc is planned
!               
!               // (1) ----  do_login: true/false  ----
!               // if true: class dcom is created and a login is attaemted, and 
a reopen to the "foler" var is attempted
!               // if false: used for information only, such as to fill 
preferences for squirrelmail,
!               //      or for the preferences page, where info necessary for 
logino may not yet be filled in
!               $args_array['do_login'] = True;
!                               
!               // "begin_request" will obtain the email preferences from the db
!               // currently db table "phpgw_preferences", accessed via object 
$GLOBALS['phpgw']->preferences
!               // and also containing integrated pref handling code in 
/mail/class.bopreferences.inc.php
!               // "begin_request" will also attempt to obtain values for all 
known args, ex. "->grab_class_args_*()",
!               // and will prepare those args, such as preping the folder name
!               // and login (if "do_login" == true) and, if logged in, will 
set arg value "mailsvr_stream"
!               
!               // BEGIN the mail transaction REQUEST
!               $some_stream = 
$GLOBALS['phpgw']->msg->begin_request($args_array);
! 
!               // ----  Error Msg And Exit If Mailbox Connection Not 
Established  -----
!               if (!$some_stream)
!               {
!                       
$GLOBALS['phpgw']->msg->login_error('email_(slash)_functions.inc.php');
!                       // this exits the script, calling 
$GLOBALS['phpgw']->common->phpgw_exit(True);
!               }
!       }
!       else
!       {
!               // use the msg class BUT DO NOT login
!               // ----  INITIALIZE ARGS ARRAY HOLDER VARIABLE  -------
!               // needed whether you intend to login or not
!               $args_array = Array();
!               $args_array['do_login'] = False;
!               // this will obtain the email preferences from the db 
(currently "phpgw_preferences")
!               $GLOBALS['phpgw']->msg->begin_request($args_array);
!       }
! 
! // ----  UN-INITIALIZE ARGS ARRAY HOLDER VARIABLE  -------
!       // it's no longer needed
!       $args_array = Array();
! 
! 
!       // FROM HERE DOWN IS ALL DEPRECIATED CODE
! // ----  Various Functions Used To Support Email   -----
!       // note these are probably unused, because most (all ?) useful 
functions have migrated into mail_msg class
! 
!       // this is BROKEN
!       function mime_is_packagelist($part_nice)
!       {
!               if ((stristr($part_nice['subtype'], 'MIXED')) 
!               || (stristr($part_nice['type'], 'multipart'))
!               || (stristr($part_nice['param_attribute'], 'boundry')))
!               {
!                       return True;
!               }
!               else
!               {
!                       return False;
!               }
!       }
! 
! ?>
--- 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.3
retrieving revision 1.3.2.1
diff -C2 -r1.3 -r1.3.2.1
*** hook_admin.inc.php  27 Dec 2001 17:56:03 -0000      1.3
--- hook_admin.inc.php  20 Nov 2002 23:03:26 -0000      1.3.2.1
***************
*** 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_email_add_def_pref.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/hook_email_add_def_pref.inc.php,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -C2 -r1.3 -r1.3.6.1
*** hook_email_add_def_pref.inc.php     19 Feb 2001 15:16:20 -0000      1.3
--- hook_email_add_def_pref.inc.php     20 Nov 2002 23:03:26 -0000      1.3.6.1
***************
*** 1,8 ****
! <?php
!   global $pref;
!   $pref->change("email","mainscreen_showmail","True");
!   $pref->change("email","use_trash_folder","False");
!   $pref->change("email","default_sorting","old_new");
!   $pref->change("email","show_addresses","from");
!   $pref->change("email","email_sig","");
! ?>
--- 1,8 ----
! <?php
!   global $pref;
!   $pref->change("email","mainscreen_showmail","True");
!   $pref->change("email","use_trash_folder","False");
!   $pref->change("email","default_sorting","old_new");
!   $pref->change("email","show_addresses","from");
!   $pref->change("email","email_sig","");
! ?>

Index: hook_home.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/hook_home.inc.php,v
retrieving revision 1.48.2.4
retrieving revision 1.48.2.5
diff -C2 -r1.48.2.4 -r1.48.2.5
*** hook_home.inc.php   21 Oct 2002 20:26:31 -0000      1.48.2.4
--- hook_home.inc.php   20 Nov 2002 23:03:26 -0000      1.48.2.5
***************
*** 1,174 ****
! <?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($GLOBALS['phpgw_info']['server']['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);
! 
!       // 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 the base email Msg Class    -----
!               if(!is_object(@$GLOBALS['phpgw']->msg))
!               {
!                       $GLOBALS['phpgw']->msg = CreateObject('email.mail_msg');
!               }
! 
!               $data = Array();
! 
!               $args_array = Array();
!               $args_array['folder'] = 'INBOX';
!               $args_array['do_login'] = True;
!               $some_stream = 
$GLOBALS['phpgw']->msg->begin_request($args_array);
!               if(!$some_stream)
!               {
!                       $title = '<font 
color="#FFFFFF">'.lang('EMail').'</font>';
!                       $extra_data = '<b>Mail error:</b> Can not open 
connection to mail server';
!               }
!               else
!               {
!                       /*  class mail_msg "new_message_check()"
!                         // 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();
! 
!                       $title = '<font color="#FFFFFF">'.lang('EMail').' 
'.$inbox_data['alert_string'].'</font>';
! 
!                       if($inbox_data['number_all'] >= 5)
!                       {
!                               $check_msgs = 5;
!                       }
!                       else
!                       {
!                               $check_msgs = $inbox_data['number_all'];
!                       }
! 
!                       if ($inbox_data['number_all'] > 0)
!                       {
!                               $msgball_list = array();
!                               $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)
!                               {
!                                       $subject = substr($subject,0,65).' ...';
!                               }
!                               $data[] = array(
!                                       'text' => $subject,
!                                       'link' => $GLOBALS['phpgw']->link(
!                                                       '/index.php',
!                                                       
'menuaction=email.uimessage.message'
!                                                       
.'&'.$msgball_list[$i]['uri']
!                                       )
!                               );
!                       }
! 
!                       // COMPOSE NEW email link
!                       $compose_link = $GLOBALS['phpgw']->link(
!                                               '/index.php',
!                                               
'menuaction=email.uicompose.compose'
!                                               // this data tells us where to 
return to after sending a message
!                                               // since we started from home 
page, send can not (at this time) take us back there
!                                               // so instead take user to 
INBOX for the default account (acctnum 0) after clicking the send button
!                                               .'&fldball[folder]=INBOX'
!                                               .'&fldball[acctnum]=0'
!                       );
!                       $compose_href = '<a 
href="'.$compose_link.'">'.lang('Compose New').'</a>'."\r\n";
! 
!                       // ADD FOLDER LISTBOX TO HOME PAGE (Needs to be 
TEMPLATED)
!                       // Does This Mailbox Support Folders (i.e. more than 
just INBOX)?
!                       
if($GLOBALS['phpgw']->msg->get_mailsvr_supports_folders() == False)
!                       {
!                               $extra_data = '&nbsp; &nbsp;'.$compose_href;
!                       }
!                       else
!                       {
!                               // FUTURE: this will pick up the user option to 
show num unseen msgs in dropdown list
!                               //$listbox_show_unseen = True;
!                               $listbox_show_unseen = False;
!                               // 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'      => 
$listbox_show_unseen,
!                                       'widget_name'       => 
'fldball_fake_uri',
!                                       'folder_key_name'   => 'folder',
!                                       'acctnum_key_name'  => 'acctnum',
!                                       'on_change'         => 
'document.switchbox.submit()',
!                                       'first_line_txt'    => lang('switch 
current folder to')
!                               );
!                               // get you custom built HTML listbox (a.k.a. 
selectbox) widget
!                               $switchbox_listbox = 
$GLOBALS['phpgw']->msg->all_folders_listbox($feed_args);
!                               // make it another TR we can insert into the 
home page portal object
!                               // and surround it in FORM tags so the submit 
will work
!                               $switchbox_action = $GLOBALS['phpgw']->link(
!                                                       '/index.php',
!                                                       
'menuaction=email.uiindex.index'
!                               );
!                               $extra_data = '<form name="switchbox" 
action="'.$switchbox_action.'" method="post">'."\r\n"
!                                       .'<td align="left">'."\r\n"
!                                       .'&nbsp;<strong>'.lang('E-Mail 
Folders').':</strong>&nbsp;'.$switchbox_listbox."\r\n"
!                                       .'&nbsp; &nbsp;'.$compose_href."\r\n"
!                                       .'</td>'."\r\n"
!                                       .'</form>'."\r\n";
!                       }
!                       $GLOBALS['phpgw']->msg->end_request();
!               }
! 
!               $portalbox = CreateObject('phpgwapi.listbox',
!                       Array(
!                               'title'     => $title,
!                               'primary'   => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'secondary' => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'tertiary'  => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'width'     => '100%',
!                               'outerborderwidth' => '0',
!                               'header_background_image' => 
$GLOBALS['phpgw']->common->image('phpgwapi/templates/default','bg_filler')
!                       )
!               );
!               $app_id = $GLOBALS['phpgw']->applications->name2id('email');
!               $GLOBALS['portal_order'][] = $app_id;
!               $var = Array(
!                       'up'       => Array('url' => '/set_box.php', 'app' => 
$app_id),
!                       'down'     => Array('url' => '/set_box.php', 'app' => 
$app_id),
!                       'close'    => Array('url' => '/set_box.php', 'app' => 
$app_id),
!                       'question' => Array('url' => '/set_box.php', 'app' => 
$app_id),
!                       'edit'     => Array('url' => '/set_box.php', 'app' => 
$app_id)
!               );
! 
!               while(list($key,$value) = each($var))
!               {
!                       $portalbox->set_controls($key,$value);
!               }
! 
!               $portalbox->data = $data;
! 
!               // 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";
!       }
! ?>
--- 1,171 ----
! <?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($GLOBALS['phpgw_info']['server']['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);
!       
!       
!       // 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();
!               
!               /*  class mail_msg "new_message_check()"
!                 // 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();
! 
!               $title = '<font color="#FFFFFF">'.lang('EMail').' 
'.$inbox_data['alert_string'].'</font>';
! 
!               if($inbox_data['number_all'] >= 5)
!               {
!                       $check_msgs = 5;
!               }
!               else
!               {
!                       $check_msgs = $inbox_data['number_all'];
!               }
! 
!               if ($inbox_data['number_all'] > 0)
!               {
!                       $msgball_list = array();
!                       $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)
!                       {
!                               $subject = substr($subject,0,65).' ...';
!                       }
!                       $data[] = array(
!                               'text' => $subject,
!                               'link' => $GLOBALS['phpgw']->link(
!                                               '/index.php',
!                                               
'menuaction=email.uimessage.message'
!                                               .'&'.$msgball_list[$i]['uri']
!                               )
!                       );
!               }
! 
!               // COMPOSE NEW email link
!               $compose_link = $GLOBALS['phpgw']->link(
!                                       '/index.php',
!                                       'menuaction=email.uicompose.compose'
!                                       // this data tells us where to return 
to after sending a message
!                                       // since we started from home page, 
send can not (at this time) take us back there
!                                       // so instead take user to INBOX for 
the default account (acctnum 0) after clicking the send button
!                                       .'&fldball[folder]=INBOX'
!                                       .'&fldball[acctnum]=0'
!               );
!               $compose_href = '<a href="'.$compose_link.'">'.lang('Compose 
New').'</a>'."\r\n";
! 
!               // ADD FOLDER LISTBOX TO HOME PAGE (Needs to be TEMPLATED)
!               // Does This Mailbox Support Folders (i.e. more than just 
INBOX)?
!               if($GLOBALS['phpgw']->msg->get_mailsvr_supports_folders() == 
False)
!               {
!                       $extra_data = '&nbsp; &nbsp;'.$compose_href;
!               }
!               else
!               {
!                       // 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'      => 
$GLOBALS['phpgw_info']['user']['preferences']['email']['newmsg_combobox'],
!                               'widget_name'       => 'fldball_fake_uri',
!                               'folder_key_name'   => 'folder',
!                               'acctnum_key_name'  => 'acctnum',
!                               'on_change'         => 
'document.switchbox.submit()',
!                               'first_line_txt'    => lang('switch current 
folder to')
!                       );
!                       // get you custom built HTML listbox (a.k.a. selectbox) 
widget
!                       $switchbox_listbox = 
$GLOBALS['phpgw']->msg->all_folders_listbox($feed_args);
!                       // make it another TR we can insert into the home page 
portal object
!                       // and surround it in FORM tags so the submit will work
!                       $switchbox_action = $GLOBALS['phpgw']->link(
!                                               '/index.php',
!                                               'menuaction=email.uiindex.index'
!                       );
!                       $extra_data = '<form name="switchbox" 
action="'.$switchbox_action.'" method="post">'."\r\n"
!                               .'<td align="left">'."\r\n"
!                               .'&nbsp;<strong>'.lang('E-Mail 
Folders').':</strong>&nbsp;'.$switchbox_listbox."\r\n"
!                               .'&nbsp; &nbsp;'.$compose_href."\r\n"
!                               .'</td>'."\r\n"
!                               .'</form>'."\r\n";
!               }
!               $GLOBALS['phpgw']->msg->end_request();
!               
!               $portalbox = CreateObject('phpgwapi.listbox',
!                       Array(
!                               'title'     => $title,
!                               'primary'   => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'secondary' => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'tertiary'  => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'width'     => '100%',
!                               'outerborderwidth' => '0',
!                               'header_background_image' => 
$GLOBALS['phpgw']->common->image('phpgwapi/templates/phpgw_website','bg_filler')
!                       )
!               );
!               $app_id = $GLOBALS['phpgw']->applications->name2id('email');
!               $GLOBALS['portal_order'][] = $app_id;
!               $var = Array(
!                       'up'       => Array('url' => '/set_box.php', 'app' => 
$app_id),
!                       'down'     => Array('url' => '/set_box.php', 'app' => 
$app_id),
!                       'close'    => Array('url' => '/set_box.php', 'app' => 
$app_id),
!                       'question' => Array('url' => '/set_box.php', 'app' => 
$app_id),
!                       'edit'     => Array('url' => '/set_box.php', 'app' => 
$app_id)
!               );
! 
!               while(list($key,$value) = each($var))
!               {
!                       $portalbox->set_controls($key,$value);
!               }
! 
!               $portalbox->data = $data;
! 
!               // 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";
!       }
! ?>

Index: hook_manual.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/hook_manual.inc.php,v
retrieving revision 1.3
retrieving revision 1.3.4.1
diff -C2 -r1.3 -r1.3.4.1
*** hook_manual.inc.php 14 May 2001 00:18:12 -0000      1.3
--- hook_manual.inc.php 20 Nov 2002 23:03:26 -0000      1.3.4.1
***************
*** 1,23 ****
! <?php
!   /**************************************************************************\
!   * phpGroupWare - Calendar Holidays                                         *
!   * http://www.phpgroupware.org                                              *
!   * Written by Mark Peters <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$ */
! 
!       $file = Array(
!               'Viewing'       => 'viewing.php',
!               'Replying'      => 'replying.php',
!               'Composing/Saving/Deleting'     => 'other.php',
!               'Notes'         => 'notes.php'
!       );
! //Do not modify below this line
!       display_manual_section($appname,$file);
! ?>
--- 1,23 ----
! <?php
!   /**************************************************************************\
!   * phpGroupWare - Calendar Holidays                                         *
!   * http://www.phpgroupware.org                                              *
!   * Written by Mark Peters <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$ */
! 
!       $file = Array(
!               'Viewing'       => 'viewing.php',
!               'Replying'      => 'replying.php',
!               'Composing/Saving/Deleting'     => 'other.php',
!               'Notes'         => 'notes.php'
!       );
! //Do not modify below this line
!       display_manual_section($appname,$file);
! ?>

Index: hook_notifywindow.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/inc/hook_notifywindow.inc.php,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -C2 -r1.7.2.2 -r1.7.2.3
*** hook_notifywindow.inc.php   14 Feb 2002 06:42:44 -0000      1.7.2.2
--- hook_notifywindow.inc.php   20 Nov 2002 23:03:26 -0000      1.7.2.3
***************
*** 1,79 ****
! <?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']))
!       {
!               // ----  Create the base email Msg Class    -----
!               //$GLOBALS['phpgw']->msg = CreateObject("email.mail_msg");
!               if (is_object($GLOBALS['phpgw']->msg))
!               {
!                       //echo 'email hook_notifywindow: is_object test: 
$GLOBALS[phpgw]->msg is already set, do not create again<br>'; }
!               }
!               else
!               {
!                       //echo 'email hook_notifywindow: is_object test: 
$GLOBALS[phpgw]->msg is NOT set, creating mail_msg object<br>'; }
!                       $GLOBALS['phpgw']->msg = CreateObject("email.mail_msg");
!               }
!               $args_array = Array();
!               $args_array['folder'] = 'INBOX';
!               $args_array['do_login'] = True;
!               $GLOBALS['phpgw']->msg->begin_request($args_array);
!               if 
((string)$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_stream') != '')
!               {
!                       /*  // 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();
!               }
!               else
!               {
!                       $inbox_data['alert_string'] = lang('<b>Mail error:</b> 
Can not open connection to mail server');
!               }
!               // end the mailserver request (i.e. logout of the mail server)
!               $GLOBALS['phpgw']->msg->end_request();
! 
!               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 lang("EMail").' - <a 
href="JavaScript:CheckEmail();">'.$inbox_data['alert_string'].'</a>';
!                       //echo '</font>';
!                       echo "\r\n".'<!-- Mailox info --></td></tr>'."\r\n";
!               }
! 
!       }
! ?>
--- 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.5.2.1
retrieving revision 1.5.2.2
diff -C2 -r1.5.2.1 -r1.5.2.2
*** hook_notifywindow_simple.inc.php    14 Feb 2002 06:57:22 -0000      1.5.2.1
--- hook_notifywindow_simple.inc.php    20 Nov 2002 23:03:26 -0000      1.5.2.2
***************
*** 1,74 ****
! <?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"]))
!       {
!               // ----  Create the base email Msg Class    -----
!               //$GLOBALS['phpgw']->msg = CreateObject("email.mail_msg");
!               if (is_object($GLOBALS['phpgw']->msg))
!               {
!                       //echo 'email hook_notifywindow_simple: is_object test: 
$GLOBALS[phpgw]->msg is already set, do not create again<br>'; }
!               }
!               else
!               {
!                       //echo 'email hook_notifywindow_simple: is_object test: 
$GLOBALS[phpgw]->msg is NOT set, creating mail_msg object<br>'; }
!                       $GLOBALS['phpgw']->msg = CreateObject("email.mail_msg");
!               }
!               $args_array = Array();
!               $args_array['folder'] = 'INBOX';
!               $args_array['do_login'] = True;
!               $GLOBALS['phpgw']->msg->begin_request($args_array);
!               if 
((string)$GLOBALS['phpgw']->msg->get_arg_value('mailsvr_stream') != '')
!               {
!                       /*  // 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);
!                               }
!                       }
!               }
!               else
!               {
!                       echo lang('<b>Mail error:</b> Can not open connection 
to mail server');
!               }
!               // 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.9.2.3
retrieving revision 1.9.2.4
diff -C2 -r1.9.2.3 -r1.9.2.4
*** hook_preferences.inc.php    18 Feb 2002 17:05:20 -0000      1.9.2.3
--- hook_preferences.inc.php    20 Nov 2002 23:03:26 -0000      1.9.2.4
***************
*** 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,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);
! }
! ?>





reply via email to

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