phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [18540] fix email - hopefully


From: Dave Hall
Subject: [Phpgroupware-cvs] [18540] fix email - hopefully
Date: Mon, 26 May 2008 06:29:59 +0000

Revision: 18540
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18540
Author:   skwashd
Date:     2008-05-26 06:29:59 +0000 (Mon, 26 May 2008)

Log Message:
-----------
fix email - hopefully

Modified Paths:
--------------
    trunk/email/inc/class.mail_dcom.inc.php
    trunk/email/inc/class.mail_dcom_base_sock.inc.php

Modified: trunk/email/inc/class.mail_dcom.inc.php
===================================================================
--- trunk/email/inc/class.mail_dcom.inc.php     2008-05-21 16:04:36 UTC (rev 
18539)
+++ trunk/email/inc/class.mail_dcom.inc.php     2008-05-26 06:29:59 UTC (rev 
18540)
@@ -1,6 +1,6 @@
 <?php
        /**
-       * EMail - php IMAP SO access object constructor
+       * phpGroupWare - Email - Communication Object includers "magic file"
        *
        * Handles initializing the appropriate class dcom object
        * @author Angelo (Angles) Puglisi <address@hidden>
@@ -17,57 +17,27 @@
        //$debug_dcom = True;
        $debug_dcom = False;
 
-       
-       /*!
-       Implements communication with the mail server. (not related to anything 
else called "dcom")
+       $mail_server_type = 'imap';
+       if ( 
isset($GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'])
 )
+       {
+               $mail_server_type = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type']);
+       }
 
-       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!
 
-       @access private
-       */
-       
-       /* -----  any constructor params? ---- */
-       if (isset($p1)
-       && ($p1)
-       && ( (stristr($p1, 'imap') || stristr($p1, 'pop3') || stristr($p1, 
'nntp')) )
-       )
+       if ( extension_loaded('imap') && function_exists('imap_open') && 
!$debug_dcom )
        {
-               $mail_server_type = $p1;
-               if ($debug_dcom) { echo 'DCOM DEBUG: found class feed arg $p1 
['.serialize($p1).']<br />'; }
-               //{ echo 'DCOM DEBUG: found class feed arg $p1 
['.serialize($p1).']<br />'; }
+               $imap_builtin = True;
+               $sock_fname = '';
+               if ($debug_dcom) { echo 'imap builtin extension is available<br 
/>'; }
        }
-       else
+       else if ( $debug_dcom 
+               && ( strtolower($mail_server_type) == 'pop3'
+                       || strtolower($mail_server_type) == 'imap' ) )
        {
-               if ($debug_dcom) { echo 'DCOM DEBUG: did NOT find class feed 
arg $p1 ['.serialize($p1).']<br />'; }
-               //{ echo 'DCOM DEBUG: did NOT find class feed arg $p1 
['.serialize($p1).']<br />'; }
-               $mail_server_type = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['email']['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;
@@ -75,50 +45,29 @@
                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);
+       $inc_basedir = PHPGW_INCLUDE_ROOT . '/email/inc/';
        
        /**
         * Include dcom base or base_sock
         */
-       
include(PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_base'.$sock_fname.'.inc.php');
+       require_once "{$inc_basedir}class.mail_dcom_base{$sock_fname}.inc.php";
+       if ($debug_dcom) { echo "including: 
{$inc_basedir}class.mail_dcom_base{$sock_fname}.inc.php<br>\n"; }
 
-       if ($debug_dcom) { echo 'including 
:'.PHPGW_INCLUDE_ROOT.'/email/inc/class.mail_dcom_base'.$sock_fname.'.inc.php<br
 />'; }
+       switch ( $mail_server_type )
+       {
+               case 'pop3':
+               case 'pop3s':
+                       $server_type = 'pop3';
+                       break;
 
-       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
 />'; }
+               case 'nntp':
+                       $type = 'nntp';
+
+               case 'imap':
+               case 'imaps':
+               default:
+                       $server_type = 'imap';
        }
-       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 />'; }
-       }
-?>
+
+       require_once 
"{$inc_basedir}class.mail_dcom_{$server_type}{$sock_fname}.inc.php";
+       if ($debug_dcom) { echo "including: 
'{$inc_basedir}class.mail_dcom_{$server_type}{$sock_fname}.inc.php'<br>"; }

Modified: trunk/email/inc/class.mail_dcom_base_sock.inc.php
===================================================================
--- trunk/email/inc/class.mail_dcom_base_sock.inc.php   2008-05-21 16:04:36 UTC 
(rev 18539)
+++ trunk/email/inc/class.mail_dcom_base_sock.inc.php   2008-05-26 06:29:59 UTC 
(rev 18540)
@@ -12,6 +12,10 @@
        * @internal Based on AngleMail http://www.anglemail.org/
        */
 
+       /**
+        * Import the the network class which we extend
+        */
+       phpgw::import_class('phpgwapi.network');
 
        /**
         * Set status->messages to the number of messages in the mailbox






reply via email to

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