Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/12/2008, 09:19
Avatar de rogertm
rogertm
Mod->Cuba
 
Fecha de Ingreso: julio-2005
Ubicación: /home/Cuba/Habana/rogertm/
Mensajes: 2.922
Antigüedad: 18 años, 9 meses
Puntos: 638
Pregunta Bad arguments en function implode... Clase PliggMailer

Hola por aquí, necesito me ayuden con algo, pues no entiendo mucho de PHPOO

Tengo un sitio montado en Pligg y trae la opción de enviar los artículos a un amigo, pero no funciona, mandaba este error:

Warning: implode() [function.implode]: Bad arguments. in /home/public_html/libs/mailer.php on line 31


Este es el código original:

Código php:
Ver original
  1. <?php
  2. class PliggMailer{
  3.  
  4.     var $subject = '';
  5.     var $body = '';
  6.     var $from = '';
  7.     var $to = '';
  8.  
  9.     function PliggMailer($subj = '', $body = '', $from = '', $to = '', $cc = '', $bcc = ''){
  10.  
  11.         if($subj != ''){$this->subject = $subj;}
  12.         if($body != ''){$this->body = $body;}
  13.         if($from != ''){$this->from = $from;}
  14.         if(!is_array($to)){$to[] = $to;}
  15.         if(count($to) == 0){$this->to = $to;}
  16.         if(!is_array($to)){$to[] = $to;}
  17.         if(count($to) == 0){$this->to = $to;}
  18.         if(!is_array($to)){$to[] = $to;}
  19.         if(count($to) == 0){$this->to = $to;}
  20.  
  21.     }
  22.  
  23.     function send(){
  24.  
  25.         if($this->from != ''){
  26.             $headers = 'From: ' . $this->from;
  27.         } else {
  28.             $headers = '';
  29.         }
  30.  
  31.         $send_to = implode(',', $this->to);
  32.  
  33.         if(mail($send_to, $this->subject, $this->body, $headers)){
  34.             return true;
  35.         } else {
  36.             return false;
  37.         }
  38.  
  39.     }
  40. }
  41. ?>
y lo que hice fue cambiar este línea var $to = ''; por var $to = array(''); (la linea 7). Ya no me da el error, pero tampoco envía el mensaje

Que pasa???

Gracias mil de antemano
__________________
Friki y Blogger por Cuenta Propia:213
Twenty'em: Theming is Prose