Login   Register  
PHP Classes
elePHPant
Icontem

fix for list_mailbox()

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      IMAP  >  All threads  >  fix for list_mailbox()  >  (Un) Subscribe thread alerts  
Subject:fix for list_mailbox()
Summary:function didn't work properly with some servers.
Messages:2
Author:Anders Jenbo
Date:2010-01-06 17:26:42
Update:2012-03-30 07:57:30
 

  1. fix for list_mailbox()   Reply  
Picture of Anders Jenbo
Anders Jenbo
2010-01-06 17:26:42
This function didn't work properly as it incorectly splits the data if there are more then one " value in per line.

function list_mailbox($ref_mail_box="",$wild_card="*")
{
if($this->state == "AUTHORIZATION")
{
$this->error = "Error : User is not authorised or logged in.!<br>";
return false;
}
if(trim($ref_mail_box) == "")
$ref_mail_box = '""';
if($this->put_line($this->tag." LIST $ref_mail_box $wild_card"))
{
$response=$this->get_server_responce();
if(substr($response,strpos($response,"$this->tag ")+strlen($this->tag)+1,2)!="OK")
{
$this->error= "Error : $response !<br>";
return false;
}
}
else
{
$this->error= "Error : Could not send User request. <br>";
return false;
}

return array_slice(preg_replace('/.*"([^"]*)"/', '$1', explode("\r\n", $response)), 1, -1);
}

  2. Re: fix for list_mailbox()   Reply  
Picture of Anders Jenbo
Anders Jenbo
2012-03-30 07:57:30 - In reply to message 1 from Anders Jenbo
This is fixed in my rewrite of the class at https://github.com/AJenbo/PHP-imap