Jim A - 2006-12-03 04:07:31
Thank you very much for this class! I have been looking for just such a class for quite some time.
I did find some bugs I though you'd like to know about...
-------------------------------------
class HTTP
{
function HTTP($host, $username, $password, $port = 2082, $ssl = '', $theme = 'x')
{
$ssl = $ssl ? 'ssl://' : '';
$this->username = $username;
$this->password = $password;
$this->theme = $theme;
$this->auth = base64_encode($username . ':' . $password);
$this->port = $port;
$this->host = $ssl . $host; //| Bug - ssl not handled separately in code
$this->path = '/frontend/' . $theme . '/';
$this->ssl = "";//| Changed - added because HTTP->ssl is referenced. Need for PHP5. Note: Code bombs if set to $ssl - some paths become ssl://ssl://.
}
---------------------
class emailAccount
{
/**
* @ignore
*/
function emailAccount($host, $username, $password, $port = 2082, $ssl = false, $theme = 'x', $address)
{
$this->HTTP = new HTTP($host, $username, $password, $port, $ssl, $theme);
//| Changed because master account can be listed without a domain
$pos = strpos($address, '@');
if ($pos === false) {
list($this->email, $this->domain) = array($address,"");
} else {
list($this->email, $this->domain) = explode('@', $address);
}
}
------------------------
function getDefaultAddress()
{
//| Changed
$data = $this->HTTP->getData('mail/def.html');
$default = explode('<b>' . $this->domain . '</b>', $data);
if (isset($default[1])){
// default account has no @
$default = explode('<td>', $default[1]);
$default = explode('</td>', $default[1]);
}
return trim($default[0]);
}