Hello gentlemen:

I have a doubt with erspecto to the performance(yield) of symfony
I am developing a reader of post office for servant imap, but after
much to read and to prove(try) write a code that as there is of
complete and simple mas, but I have several problems

I can read files of 5kb with html but I do not read post office of
text of 3Kb ¿?

 I can read some post office of 1-2 Kb of text of all the servants of
mail, but not others ¿?

If fails in the reading of someone of the post office, already I
cannot open ningun other one inclusive someone q has opened
previously, not to being  in another browser

 It is because of it q manage to think q probably could be something
of symfony q could manage to be affecting the performance(yield) of my
application

this is the code

public function executeLeer()
  {
        set_time_limit(1200);

        //$this->id=$this->getUser()->getAttribute('idUsuario');
        //$this->usuario=UsuarioPeer::retrieveByPK($this->id);

        $password=$this->getUser()->getAttribute('passwordCorreo');
        $login=$this->devolverLogin();

        $this->param = $this->getRequestParameter('mensaje');

        $imap=$this->conectarServidor($login,$password);

        $header = imap_header($imap,  $this->param);



if  (isset ($header->subject)){
            $subject=$header->subject;}
    else { $subject="Sin Asunto"; }
  $this->subject= $subject;


if  (isset ($header->from)){
        $from=$header->from;
                foreach ($from as $id => $object) {
                        if  (isset ($object->personal)){
                        $fromname = $object->personal;}
                        else { $fromname=" "; }

                        if  (isset ($object->mailbox)){
                        $fromaddress = $object->mailbox . "@" . $object->host;}
                        else { $fromaddress=" "; }
                }
        }else { $from="Sin Destinatario";
                        $fromname="Sin Nombre";
                        $fromaddress="Sin Direccion";}
  $this->fromname=$fromname;
  $this->fromaddress=$fromaddress;

if  (isset ($header->cc)){
        $cc=$header->cc;
                foreach ($cc as $id => $object) {
                        if  (isset ($object->mailbox)){
                $copiacc[] = $object->mailbox . "@" . $object->host;}
                else{$copiacc[] =" ";}
                }
        }else { $cc=" ";
                        $copiacc[] =" "; }
  $this->copiacc=$copiacc;
  $this->cc=$cc;

  /*if  (isset ($header->reply_to)){
      $reply_to=$header->reply_to;
                  foreach ($reply_to as $id => $object) {
                  if (isset($object->mailbox)){
                    $reply[] = $object->mailbox . "@" . $object->host;
                    }
                  }
      }
      else { $reply_to=" "; }
  $this->reply=$reply;
  $this->retpy_to=$reply_to;*/

  if  (isset ($header->to)){
              $to=$header->to;
      }else { $to=" "; }
  $this->to=$to;



  if  (isset ($header->Date)){
        $fecha=$header->Date;}

  else { $fecha="0000-00-00"; }

  $this->fecha= $fecha;

  foreach ($to as $id => $object) {
      $to_address[] = $object->mailbox . "@" . $object->host.", ";
    }
  $this->to_address=$to_address;




$structure = imap_fetchstructure($imap, $this->param); // structure

if  (isset ($structure->parts)){
                //print_r($structure->parts);

          $parts = $structure->parts;
          $numparts = count($parts);
                //print_r($numparts);
        }else{$numparts=0;}

        if ($numparts > 1) // yes we do
        {
            $endwhile = false;
            $stack = array();
            $content = "";
            $attachment = array();
            $i = 0;

            // for every attachment
            while (!$endwhile)
            {
                if (!$parts[$i])
                {
                    if (count($stack) > 0) // have stacks?
                    { // sure we do!
                        $parts = $stack[count($stack) - 1]["p"];
                        $i = $stack[count($stack) - 1]["i"] + 1;
                        array_pop($stack);
                    } else { // or no...
                        $endwhile = true;
                    }
                }

                if (!$endwhile) // last loop?
                {
                    $partstring = "";

                    foreach ($stack as $s)
                        $partstring .= ($s["i"] + 1) . ".";

                    $partstring .= ($i+1);
                    if  (isset ($parts[$i]->disposition)){
                        if ($parts[$i]->disposition == "attachment") // 
attachment!!
                        {
                            $attachment[] = array(
                                "filename" => $parts[$i]->parameters[0]->value, 
// filename
                                "encoding" => $parts[$i]->encoding, // encodign
                                "filedata" => imap_fetchbody($imap, 
$this->param, $partstring) //
data, duhh!
                            );
                        } elseif ($parts[$i]->subtype == "plain") { // message
                        $np = imap_fetchbody($imap, $this->param,
$partstring); // parse
                        $content .= nl2br($np); // add this part

                        }
                        $content =Util::decode_utf8($content);
                        $this->content=$content;
                    }
                }
                if  (isset ($parts[$i]->parts)){
                        if ($parts[$i]->parts)
                        {
                            $stack[] = array("p" => $parts, "i" => $i); // next 
stack
                            $parts = $parts[$i]->parts; // parts
                            $i = 0;
                        } else {
                            $i++;
                        }
                }
            }
        } else { // no attachments
            $attachment = array();
            $content = imap_body($imap, $this->param);
            $content = nl2br($content);
            $content =Util::decode_utf8($content);
            $this->content=$content;
        }

  if  (isset ($structure->parts)){
        $numparts = count($structure->parts);
        $i=0;
        if ($numparts >1)
        {
           if  (isset ($structure->parts)){
                foreach ($structure->parts as $part)
                {
                      if ($part->disposition == "attachment")
                  {
                    print_r($part->disposition);
                    $i++;
                    $this->i=$i;
                    $this->adjunto=$part->dparameters[0]->value;
                      }
                }
           }
        }
  }

}


Forgive my English evil

Regards
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to