Changeset 5068


Ignore:
Timestamp:
09/06/11 17:30:57 (13 years ago)
Author:
airton
Message:

Ticket #2266 - Atualizar documentacao dos arquivos PHP

Location:
trunk/services
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/services/class.ldap.php

    r4828 r5068  
    11<?php 
    2  
     2/** 
     3* 
     4* Copyright (C) 2011 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     5* 
     6* This program is free software; you can redistribute it and/or modify it under 
     7* the terms of the GNU Affero General Public License version 3 as published by 
     8* the Free Software Foundation with the addition of the following permission 
     9* added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED 
     10* WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE 
     11* WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS. 
     12* 
     13* This program is distributed in the hope that it will be useful, but WITHOUT 
     14* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
     15* FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
     16* details. 
     17* 
     18* You should have received a copy of the GNU Affero General Public License 
     19* along with this program; if not, see www.gnu.org/licenses or write to 
     20* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
     21* MA 02110-1301 USA. 
     22* 
     23* This code is based on the OpenXchange Connector and on the Prognus pSync 
     24* Connector both developed by the community and licensed under the GPL 
     25* version 2 or above as published by the Free Software Foundation. 
     26* 
     27* You can contact Prognus Software Livre headquarters at Av. Tancredo Neves, 
     28* 6731, PTI, Bl. 05, Esp. 02, Sl. 10, Foz do Iguaçu - PR - Brasil or at 
     29* e-mail address prognus@prognus.com.br. 
     30* 
     31* Serviço de LDAP 
     32* 
     33* @package    Services 
     34* @license    http://www.gnu.org/copyleft/gpl.html GPL 
     35* @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     36* @version    1.0 
     37* @sponsor    Caixa Econômica Federal 
     38*/ 
     39 
     40 
     41 
     42 
     43/** 
     44* Serviço Ldap 
     45* 
     46* Classe responsável pelas operações com o LDAP 
     47* 
     48* @package    Service 
     49* @license    http://www.gnu.org/copyleft/gpl.html GPL 
     50* @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     51* @sponsor    Caixa Econômica Federal 
     52* @version    1.0 
     53*/ 
    354class LdapService 
    455{ 
     
    1465    } 
    1566 
     67         
     68        /** 
     69     * Conecta com o LDAP 
     70     * 
     71     * @license    http://www.gnu.org/copyleft/gpl.html GPL 
     72         * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     73         * @sponsor    Caixa Econômica Federal 
     74     * @param   $host 
     75     * @param   $dn 
     76     * @param   $passwd 
     77     * @param   $ldapreferral 
     78     */ 
    1679    function connect($host='', $dn='', $passwd='', $ldapreferral=false) 
    1780    { 
     
    47110    function _or( $toWrap ) 
    48111    { 
    49         if( !is_array( $toWrap ) ) 
    50             return( $toWrap ); 
    51  
    52 //      if( count( $toWrap ) <= 1 ) 
    53 //          return implode( "", $toWrap ); 
    54  
    55         return $this->wrap( $toWrap, '|' ); 
     112                if( !is_array( $toWrap ) ) 
     113                        return( $toWrap ); 
     114         
     115                //      if( count( $toWrap ) <= 1 ) 
     116                //          return implode( "", $toWrap ); 
     117         
     118                return $this->wrap( $toWrap, '|' ); 
    56119    } 
    57120 
    58121    function _and( $toWrap ) 
    59122    { 
    60         if( !is_array( $toWrap ) ) 
    61             return( $toWrap ); 
    62  
    63 //      if( count( $toWrap ) <= 1 ) 
    64 //          return implode( "", $toWrap ); 
    65  
    66         return $this->wrap( $toWrap, '&' ); 
     123                if( !is_array( $toWrap ) ) 
     124                        return( $toWrap ); 
     125         
     126                //      if( count( $toWrap ) <= 1 ) 
     127                //          return implode( "", $toWrap ); 
     128         
     129                return $this->wrap( $toWrap, '&' ); 
    67130    } 
    68131 
    69132    function _not( $toWrap ) 
    70133    { 
    71         return $this->wrap( $toWrap, '!' ); 
     134                return $this->wrap( $toWrap, '!' ); 
    72135    } 
    73136 
    74137    function wrap( $toWrap, $conditional = "" ) 
    75138    { 
    76         if( !is_array( $toWrap ) ) 
    77             $toWrap = array( $toWrap ); 
    78  
    79         $toWrap = array_unique( $toWrap ); 
    80  
    81         return "(".$conditional.implode( "", $toWrap ).")"; 
    82     } 
    83  
     139                if( !is_array( $toWrap ) ) 
     140                        $toWrap = array( $toWrap ); 
     141         
     142                $toWrap = array_unique( $toWrap ); 
     143 
     144                return "(".$conditional.implode( "", $toWrap ).")"; 
     145    } 
     146 
     147        /** 
     148     * Manipula o filtro de busca 
     149     * 
     150     * @license    http://www.gnu.org/copyleft/gpl.html GPL 
     151         * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     152         * @sponsor    Caixa Econômica Federal 
     153     * @param   $search 
     154     * @param   $targetTypes 
     155     * @param   $customFilter 
     156     * @param   $exact 
     157     */ 
    84158    function getSearchFilter( $search, $targetTypes = false, $customFilter = '', $exact = false ) 
    85159    { 
    86160        $search = utf8_encode( $search ); 
    87161 
    88         if( !$targetTypes ) 
    89             $targetTypes = $this->allTargetTypes; 
    90  
    91         if( !is_array( $targetTypes ) ) 
    92             $targetTypes = array( $targetTypes ); 
    93  
    94         $searchFilter = ''; 
    95  
    96         foreach( $targetTypes as $targetType ) 
    97         { 
    98             switch( $targetType ) 
    99             { 
    100                 case 'g': 
     162                if( !$targetTypes ) 
     163                                $targetTypes = $this->allTargetTypes; 
     164         
     165                if( !is_array( $targetTypes ) ) 
     166                        $targetTypes = array( $targetTypes ); 
     167         
     168                $searchFilter = ''; 
     169         
     170                foreach( $targetTypes as $targetType ) 
    101171                { 
    102                     //no caso de grupos, a busca so precisa ser feita em cima do CN 
    103                     $searchFilter = $this->stemFilter( $search, 'cn' ); 
     172                        switch( $targetType ) 
     173                        { 
     174                        case 'g': 
     175                        { 
     176                                //no caso de grupos, a busca so precisa ser feita em cima do CN 
     177                                $searchFilter = $this->stemFilter( $search, 'cn' ); 
     178                        } 
     179                        break; 
     180         
     181                        default : 
     182                        { 
     183                        //parametros que a busca tem que ser sintaticas 
     184                                $searchFilter = /*array( */$this->stemFilter( $search, array( 
     185                                                        // UID e employeeNumber podem ser iguais ou muito similares, dependendo da organizacao 
     186                                                        'uid', /*'employeeNumber', */'cn', 
     187                                                        // givenName e SN sao complementares (nome e sobrenome) 
     188                                                        'givenName', 'sn', 'displayName' ) //), 
     189                                                        //parametros que a busca pode ser por aproximacao fonetica 
     190                                                /*$this->approxFilter( $search, array(  
     191                                                        // O CN e displayName geralmente sao a mesma coisa 
     192                                                        'cn', 'displayName' ))*/  ); 
     193         
     194                                $searchFilter = $this->stemFilter( $search, array( 'cn', 'givenName', 'uid', 
     195                                                                                'sn', 'displayName' ) ); 
     196                        } 
     197                        break; 
     198                        } 
    104199                } 
    105                 break; 
    106  
    107                 default : 
     200 
     201                $filter = array(); 
     202         
     203                if( $customFilter ) 
     204                        $filter[] = $customFilter; 
     205                if( $search ) 
     206                        $filter[] = $searchFilter; 
     207         
     208                return $this->_and( array( 
     209                        // Somente objetos relacionados com o Expresso 
     210                        $this->accountFilter( $targetTypes ), 
     211                        // Objetos ocultados e/ou desativados pelo Administrador nao podem ser exibidos nas consultas do Expresso 
     212                        $this->securityFilter( $targetTypes ), 
     213                        //foco da busca 
     214                        ( $exact ? $this->_and( $filter ) : $this->_or( $filter ) ) 
     215                        )); 
     216         
     217                // Verificoes extras para validar o resultado 
     218                //  (& 
     219                //     // Somente objetos com e-mail no formato da RFC822 
     220                //    (mail=*@*) 
     221                //  ) 
     222        } 
     223 
     224         
     225        /** 
     226     * Manipula o filtro de segurança 
     227     * 
     228     * @license    http://www.gnu.org/copyleft/gpl.html GPL 
     229         * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     230         * @sponsor    Caixa Econômica Federal 
     231     * @param   $targetTypes 
     232     */ 
     233        function securityFilter( $targetTypes ) 
     234    { 
     235                if( !$targetTypes ) 
     236                                $targetTypes = $this->allTargetTypes; 
     237 
     238                if( !is_array( $targetTypes ) ) 
     239                        $targetTypes = array( $targetTypes ); 
     240         
     241                $typeFilter = array(); 
     242         
     243                foreach( $targetTypes as $targetType ) 
    108244                { 
    109                    //parametros que a busca tem que ser sintaticas 
    110                     $searchFilter = /*array( */$this->stemFilter( $search, array( 
    111                                                 // UID e employeeNumber podem ser iguais ou muito similares, dependendo da organizacao 
    112                                                 'uid', /*'employeeNumber', */'cn', 
    113                                                 // givenName e SN sao complementares (nome e sobrenome) 
    114                                                 'givenName', 'sn', 'displayName' ) //), 
    115                                             //parametros que a busca pode ser por aproximacao fonetica 
    116                                            /*$this->approxFilter( $search, array(  
    117                                                 // O CN e displayName geralmente sao a mesma coisa 
    118                                                 'cn', 'displayName' ))*/  ); 
    119  
    120                     $searchFilter = $this->stemFilter( $search, array( 'cn', 'givenName', 'uid', 
    121                                                                        'sn', 'displayName' ) ); 
     245                        switch( $targetType ) 
     246                        { 
     247                        case 'g': $typeFilter[] = "(objectClass=posixGroup)"; 
     248                        break; 
     249                         
     250                        default : $typeFilter[] = "(phpgwAccountStatus=A)"; 
     251                        break; 
     252                        } 
    122253                } 
    123                 break; 
    124             } 
     254 
     255                return $this->_and( array( '(!(phpgwAccountVisible=-1))', $this->_or( $typeFilter ) ) ); 
    125256        } 
    126257 
    127         $filter = array(); 
    128  
    129         if( $customFilter ) 
    130             $filter[] = $customFilter; 
    131         if( $search ) 
    132             $filter[] = $searchFilter; 
    133  
    134         return $this->_and( array( 
    135             // Somente objetos relacionados com o Expresso 
    136             $this->accountFilter( $targetTypes ), 
    137             // Objetos ocultados e/ou desativados pelo Administrador nao podem ser exibidos nas consultas do Expresso 
    138             $this->securityFilter( $targetTypes ), 
    139             //foco da busca 
    140             ( $exact ? $this->_and( $filter ) : $this->_or( $filter ) ) 
    141             )); 
    142  
    143         // Verificoes extras para validar o resultado 
    144         //  (& 
    145         //     // Somente objetos com e-mail no formato da RFC822 
    146         //    (mail=*@*) 
    147         //  ) 
    148     } 
    149  
    150     function securityFilter( $targetTypes ) 
    151     { 
    152         if( !$targetTypes ) 
    153             $targetTypes = $this->allTargetTypes; 
    154  
    155         if( !is_array( $targetTypes ) ) 
    156             $targetTypes = array( $targetTypes ); 
    157  
    158         $typeFilter = array(); 
    159  
    160         foreach( $targetTypes as $targetType ) 
    161         { 
    162             switch( $targetType ) 
    163             { 
    164                 case 'g': $typeFilter[] = "(objectClass=posixGroup)"; 
    165                 break; 
    166                  
    167                 default : $typeFilter[] = "(phpgwAccountStatus=A)"; 
    168                 break; 
    169             } 
    170         } 
    171  
    172         return $this->_and( array( '(!(phpgwAccountVisible=-1))', $this->_or( $typeFilter ) ) ); 
    173     } 
    174  
     258         
     259        /** 
     260     * Manipula o filtro da conta 
     261     * 
     262     * @license    http://www.gnu.org/copyleft/gpl.html GPL 
     263         * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     264         * @sponsor    Caixa Econômica Federal 
     265     * @param   $targetTypes 
     266     */ 
    175267    function accountFilter( $targetTypes ) 
    176268    { 
     
    189281    } 
    190282 
    191     function stemFilter( $search, $params ) 
    192     { 
    193         $search = str_replace( ' ', '*', $search ); 
    194  
    195         if( !is_array( $params ) ) 
    196             $params = array( $params ); 
    197  
    198         foreach( $params as $i => $param ) 
    199             $params[$i] = "($param=*$search*)"; 
    200          
    201         return $this->_or( $params ); 
    202     } 
    203  
    204     function phoneticFilter( $search, $params ) 
    205     { 
    206         if( eregi( "\d", $search ) ) 
    207             return( "" ); 
    208  
    209         if( !is_array( $params ) ) 
    210             $params = array( $params ); 
    211  
    212         foreach( $params as $i => $param ) 
    213             $params[$i] = "($param~=$search)"; 
    214          
    215         return $this->_or( $params ); 
    216     } 
    217  
     283     
     284         
     285        /** 
     286     * @license    http://www.gnu.org/copyleft/gpl.html GPL 
     287         * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     288         * @sponsor    Caixa Econômica Federal 
     289     * @param   $search 
     290     * @param   $params 
     291     */ 
     292        function stemFilter( $search, $params ) 
     293    { 
     294                $search = str_replace( ' ', '*', $search ); 
     295         
     296                if( !is_array( $params ) ) 
     297                        $params = array( $params ); 
     298         
     299                foreach( $params as $i => $param ) 
     300                        $params[$i] = "($param=*$search*)"; 
     301                 
     302                return $this->_or( $params ); 
     303    } 
     304 
     305     
     306        /** 
     307     * Manipula o filtro fonético 
     308     * 
     309     * @license    http://www.gnu.org/copyleft/gpl.html GPL 
     310         * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     311         * @sponsor    Caixa Econômica Federal 
     312     * @param   $search 
     313     * @param   $params 
     314     */ 
     315        function phoneticFilter( $search, $params ) 
     316    { 
     317                if( eregi( "\d", $search ) ) 
     318                        return( "" ); 
     319         
     320                if( !is_array( $params ) ) 
     321                        $params = array( $params ); 
     322         
     323                foreach( $params as $i => $param ) 
     324                        $params[$i] = "($param~=$search)"; 
     325                 
     326                return $this->_or( $params ); 
     327    } 
     328 
     329         
     330         
     331         
    218332    function approxFilter( $search, $params ) 
    219333    { 
    220         return $this->_or( array( $this->stemFilter( $search, $params ), 
     334                return $this->_or( array( $this->stemFilter( $search, $params ), 
    221335                                  $this->phoneticFilter( $search, $params ) ) ); 
    222336    } 
     
    227341//     } 
    228342 
    229     public function accountSearch($search, $justthese = "*", $context = false , $accountType = false, $sort = false) 
     343     
     344        /** 
     345     * Método que realiza a busca no LDAP 
     346     * 
     347     * @license    http://www.gnu.org/copyleft/gpl.html GPL 
     348         * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     349         * @sponsor    Caixa Econômica Federal 
     350     * @param   $search 
     351     * @param   $justthese 
     352     * @param   $context 
     353     * @param   $accountType 
     354     * @param   $sort 
     355     */ 
     356        public function accountSearch($search, $justthese = "*", $context = false , $accountType = false, $sort = false) 
    230357    { 
    231358         if( !$this->connection ) 
  • trunk/services/class.mail.php

    r4445 r5068  
    11<?php 
     2/** 
     3* 
     4* Copyright (C) 2011 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     5* 
     6* This program is free software; you can redistribute it and/or modify it under 
     7* the terms of the GNU Affero General Public License version 3 as published by 
     8* the Free Software Foundation with the addition of the following permission 
     9* added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED 
     10* WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE 
     11* WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS. 
     12* 
     13* This program is distributed in the hope that it will be useful, but WITHOUT 
     14* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
     15* FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
     16* details. 
     17* 
     18* You should have received a copy of the GNU Affero General Public License 
     19* along with this program; if not, see www.gnu.org/licenses or write to 
     20* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
     21* MA 02110-1301 USA. 
     22* 
     23* This code is based on the OpenXchange Connector and on the Prognus pSync 
     24* Connector both developed by the community and licensed under the GPL 
     25* version 2 or above as published by the Free Software Foundation. 
     26* 
     27* You can contact Prognus Software Livre headquarters at Av. Tancredo Neves, 
     28* 6731, PTI, Bl. 05, Esp. 02, Sl. 10, Foz do Iguaçu - PR - Brasil or at 
     29* e-mail address prognus@prognus.com.br. 
     30* 
     31* Serviço de email 
     32* 
     33* @package    Services 
     34* @license    http://www.gnu.org/copyleft/gpl.html GPL 
     35* @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     36* @version    1.0 
     37* @sponsor    Caixa Econômica Federal 
     38*/ 
     39 
    240 
    341if( !function_exists( 'zend_include' ) ) 
     
    1452zend_include( 'Zend/Mail.php' ); 
    1553 
     54 
     55/** 
     56* Serviço de email 
     57* 
     58* Classe responsável pelas operações de email 
     59* 
     60* @package    Service 
     61* @license    http://www.gnu.org/copyleft/gpl.html GPL 
     62* @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     63* @sponsor    Caixa Econômica Federal 
     64* @version    1.0 
     65*/ 
    1666class MailService extends Zend_Mail /*implements ConfigurationService, HookableService*/ 
    1767{ 
    1868    static $configuration = array( 'host' => '', 'port' => '', 'username' => '', 'password' => '' ); 
    1969 
    20     public function __construct( $config = null) 
    21     { 
    22         if( !$config ) 
    23         { 
    24             require_once ( ROOT.'/header.inc.php' ); 
    25  
    26             $boemailadmin = CreateObject('emailadmin.bo'); 
    27             $emailadmin = $boemailadmin->getProfileList(); 
    28             $emailadmin = $boemailadmin->getProfile($emailadmin[0]['profileID']); 
    29                  
    30             self::$configuration['host'] = $emailadmin['smtpServer']; 
    31             self::$configuration['port'] = $emailadmin['smtpPort']; 
    32  
    33 //          self::$configuration['username'] = $emailadmin['user']; 
    34 //          self::$configuration['password'] = $emailadmin['pass']; 
    35 //          self::$configuration['name'] = $emailadmin['name']; 
    36 //          self::$configuration['type'] = 'SMTP'; 
    37  
    38 //          array_merge( $configuration, array( 'auth' => 'login' ) ); 
    39  
    40             zend_include( 'Zend/Mail/Transport/Smtp.php' ); 
    41             zend_include( 'Zend/Mail/Part.php' ); 
    42             set_include_path(LIBRARY); 
    43             parent::setDefaultTransport( new Zend_Mail_Transport_Smtp( self::$configuration['host'], self::$configuration ) ); 
    44             restore_include_path(); 
    45         } 
    46  
    47         else 
    48             $this->configure( $config ); 
    49     } 
    50  
    51     public function send( $to, $from, $subject, $body, $bcc = null, $cc = null, $isHTML = true ) 
     70     
     71        /** 
     72     * Construtor da classe 
     73     * 
     74     * @license    http://www.gnu.org/copyleft/gpl.html GPL 
     75     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     76         * @sponsor   Caixa Econômica Federal 
     77     * @param string $config 
     78     */ 
     79        public function __construct( $config = null) 
     80    { 
     81                if( !$config ) 
     82                { 
     83                        require_once ( ROOT.'/header.inc.php' ); 
     84         
     85                        $boemailadmin = CreateObject('emailadmin.bo'); 
     86                        $emailadmin = $boemailadmin->getProfileList(); 
     87                        $emailadmin = $boemailadmin->getProfile($emailadmin[0]['profileID']); 
     88                         
     89                        self::$configuration['host'] = $emailadmin['smtpServer']; 
     90                        self::$configuration['port'] = $emailadmin['smtpPort']; 
     91         
     92                //          self::$configuration['username'] = $emailadmin['user']; 
     93                //          self::$configuration['password'] = $emailadmin['pass']; 
     94                //          self::$configuration['name'] = $emailadmin['name']; 
     95                //          self::$configuration['type'] = 'SMTP'; 
     96         
     97                //          array_merge( $configuration, array( 'auth' => 'login' ) ); 
     98                 
     99                        zend_include( 'Zend/Mail/Transport/Smtp.php' ); 
     100                                zend_include( 'Zend/Mail/Part.php' ); 
     101                        set_include_path(LIBRARY); 
     102                        parent::setDefaultTransport( new Zend_Mail_Transport_Smtp( self::$configuration['host'], self::$configuration ) ); 
     103                        restore_include_path(); 
     104                } 
     105         
     106                else 
     107                        $this->configure( $config ); 
     108    } 
     109 
     110     
     111        /** 
     112     * Método que envia a mensagem 
     113     * 
     114     * @license    http://www.gnu.org/copyleft/gpl.html GPL 
     115     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     116         * @sponsor    Caixa Econômica Federal 
     117     * @param string $to 
     118     * @param string $from 
     119     * @param string $subject 
     120     * @param string $body 
     121     * @param string $bcc 
     122     * @param string $cc 
     123     * @param string $isHTML 
     124     */ 
     125        public function send( $to, $from, $subject, $body, $bcc = null, $cc = null, $isHTML = true ) 
    52126    { 
    53127        set_include_path( LIBRARY ); 
    54         if( $body ) 
    55         { 
    56             if( $isHTML ) 
    57                 parent::setBodyHtml( $body ); 
    58  
    59             else 
    60                 parent::setBodyText( $body ); 
    61         } 
    62  
    63         if( $subject ) 
    64             parent::setSubject( $subject ); 
    65  
    66         if( !$from ) 
    67             $from = $GLOBALS['phpgw']->preferences->values['email']; 
    68  
    69         parent::setFrom( $from, self::getNameByMail( $from ) ); 
    70  
    71 //pra nao ter que fazer os ifs acima... 
    72         $destTypes = array( 'to', 'bcc', 'cc' ); 
    73  
    74         foreach( $destTypes as $destination ) 
    75         { 
    76             $dest = $$destination; 
    77          
    78             if( $dest ) 
    79             { 
    80                 if( !is_array( $dest ) ) 
    81                     $dest = array( $dest ); 
    82  
    83                 foreach( $dest as $d ) 
    84                 { 
    85                     $addDestination = 'add'.ucfirst($destination); 
    86  
    87                     parent::$addDestination( $d, self::getNameByMail( $d ) ); 
    88                 } 
    89             } 
    90         } 
    91          
    92         parent::send(); 
    93         restore_include_path(); 
    94     } 
    95  
    96     public function configure( $config ) 
    97     { 
    98         if( !$config ) return( false ); 
    99  
    100         foreach( $config as $key => $value ) 
    101         { 
    102             if( $value && isset( self::$configuration[$key] ) ) 
    103             { 
    104                 self::$configuration[$key] = $value; 
    105             } 
    106         } 
     128                if( $body ) 
     129                { 
     130                        if( $isHTML ) 
     131                        parent::setBodyHtml( $body ); 
     132         
     133                        else 
     134                        parent::setBodyText( $body ); 
     135                } 
     136         
     137                if( $subject ) 
     138                        parent::setSubject( $subject ); 
     139                 
     140                if( !$from ) 
     141                        $from = $GLOBALS['phpgw']->preferences->values['email']; 
     142         
     143                parent::setFrom( $from, self::getNameByMail( $from ) ); 
     144         
     145                //pra nao ter que fazer os ifs acima... 
     146                $destTypes = array( 'to', 'bcc', 'cc' ); 
     147         
     148                foreach( $destTypes as $destination ) 
     149                { 
     150                        $dest = $$destination; 
     151                 
     152                        if( $dest ) 
     153                        { 
     154                                if( !is_array( $dest ) ) 
     155                                        $dest = array( $dest ); 
     156         
     157                                foreach( $dest as $d ) 
     158                                { 
     159                                        $addDestination = 'add'.ucfirst($destination); 
     160                 
     161                                        parent::$addDestination( $d, self::getNameByMail( $d ) ); 
     162                                } 
     163                        } 
     164                } 
     165         
     166                parent::send(); 
     167                restore_include_path(); 
     168    } 
     169 
     170    
     171        /** 
     172     * Método de configuração 
     173     * 
     174     * @license    http://www.gnu.org/copyleft/gpl.html GPL 
     175     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
     176         * @sponsor    Caixa Econômica Federal 
     177     * @param string $config 
     178     */ 
     179        public function configure( $config ) 
     180    { 
     181                if( !$config ) return( false ); 
     182         
     183                foreach( $config as $key => $value ) 
     184                { 
     185                        if( $value && isset( self::$configuration[$key] ) ) 
     186                        { 
     187                        self::$configuration[$key] = $value; 
     188                        } 
     189                } 
    107190    } 
    108191 
     
    110193    public function getNameByMail( $mail ) 
    111194    { 
    112         return( null ); 
     195                return( null ); 
    113196    } 
    114197 
    115198    public function getAttachment( $attachment ) 
    116199    { 
    117         return( null ); 
     200                return( null ); 
    118201    } 
    119202 
Note: See TracChangeset for help on using the changeset viewer.