[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/ezutils/classes/ -> ezmailtransport.php (source)

   1  <?php
   2  //
   3  // Definition of eZMailTransport class
   4  //
   5  // Created on: <10-Dec-2002 14:31:35 amos>
   6  //
   7  // SOFTWARE NAME: eZ publish
   8  // SOFTWARE RELEASE: 3.9.0
   9  // BUILD VERSION: 17785
  10  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  11  // SOFTWARE LICENSE: GNU General Public License v2.0
  12  // NOTICE: >
  13  //   This program is free software; you can redistribute it and/or
  14  //   modify it under the terms of version 2.0  of the GNU General
  15  //   Public License as published by the Free Software Foundation.
  16  //
  17  //   This program is distributed in the hope that it will be useful,
  18  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20  //   GNU General Public License for more details.
  21  //
  22  //   You should have received a copy of version 2.0 of the GNU General
  23  //   Public License along with this program; if not, write to the Free
  24  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25  //   MA 02110-1301, USA.
  26  //
  27  //
  28  
  29  /*! \file ezmailtransport.php
  30  */
  31  
  32  /*!
  33    \class eZMailTransport ezmailtransport.php
  34    \brief Interface for mail transport handling
  35  
  36  */
  37  
  38  class eZMailTransport
  39  {
  40      /*!
  41       Constructor
  42      */
  43      function eZMailTransport()
  44      {
  45      }
  46  
  47      /*!
  48       \virtual
  49       Tries to send the contents of the email object \a $mail and
  50       returns \c true if succesful.
  51      */
  52      function sendMail( &$mail )
  53      {
  54          if ( get_class( $mail ) != 'ezmail' )
  55          {
  56              eZDebug::writeError( 'Can only handle objects of type eZMail.', 'eZMailTransport::sendMail' );
  57              return false;
  58          }
  59          return false;
  60      }
  61  
  62      /*!
  63       \static
  64       Sends the contents of the email object \a $mail using the default transport.
  65      */
  66      function send( &$mail )
  67      {
  68          if ( get_class( $mail ) != 'ezmail' )
  69          {
  70              eZDebug::writeError( 'Can only handle objects of type eZMail.', 'eZMailTransport::send' );
  71              return false;
  72          }
  73          $ini =& eZINI::instance();
  74  
  75          $transportType = trim( $ini->variable( 'MailSettings', 'Transport' ) );
  76          $transportObject =& $GLOBALS['eZMailTransportHandler_' . strtolower( $transportType )];
  77          if ( !isset( $transportObject ) or
  78               !is_object( $transportObject ) )
  79          {
  80              $transportClassFile = 'ez' . strtolower( $transportType ) . 'transport.php';
  81              $transportClassPath = 'lib/ezutils/classes/' . $transportClassFile;
  82              $transportClass = 'eZ' . $transportType . 'Transport';
  83              if ( !file_exists( $transportClassPath ) )
  84              {
  85                  eZDebug::writeError( "Unknown mail transport type '$transportType', cannot send mail",
  86                                       'eZMailTransport::send' );
  87                  return false;
  88              }
  89              include_once( $transportClassPath );
  90              if ( !class_exists( $transportClass ) )
  91              {
  92                  eZDebug::writeError( "No class available for mail transport type '$transportType', cannot send mail",
  93                                       'eZMailTransport::send' );
  94                  return false;
  95              }
  96              $transportObject = new $transportClass();
  97          }
  98          return $transportObject->sendMail( $mail );
  99      }
 100  }
 101  
 102  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7