BackendEmail = new $BACKEND_EMAIL(); if (isset($BACKEND_CONTACTS)) $this->BackendContacts = new $BACKEND_CONTACTS(); if (isset($BACKEND_CALENDAR)) $this->BackendCalendar = new $BACKEND_CALENDAR(); } function Logon($username, $domain, $password) { global $BACKEND_EMAIL, $BACKEND_CONTACTS, $BACKEND_CALENDAR; if (isset($BACKEND_EMAIL) and (! $this->BackendEmail->Logon($username, $domain, $password))) return false; if (isset($BACKEND_CONTACTS) and (! $this->BackendContacts->Logon($username, $domain, $password))) return false; if (isset($BACKEND_CALENDAR) and (! $this->BackendCalendar->Logon($username, $domain, $password))) return false; return true; } function Logoff() { global $BACKEND_EMAIL; if (isset($BACKEND_EMAIL)) return $this->BackendEmail->Logoff(); else return true; } function Setup($user, $devid, $protocolversion) { debugLog('BackendProxy::Setup('.$user.','.$devid.','.$protocolversion.')'); global $BACKEND_EMAIL, $BACKEND_CONTACTS, $BACKEND_CALENDAR; if (isset($BACKEND_EMAIL)) $this->BackendEmail->Setup($user, $devid, $protocolversion); if (isset($BACKEND_CONTACTS)) $this->BackendContacts->Setup($user, $devid, $protocolversion); if (isset($BACKEND_CALENDAR)) $this->BackendCalendar->Setup($user, $devid, $protocolversion); return true; } function GetExporter($folderid = false) { $this->folderid = $folderid; return parent::GetExporter($folderid); } function SendMail($rfc822, $forward = false, $reply = false, $parent = false) { global $BACKEND_EMAIL; if (isset($BACKEND_EMAIL)) return $this->BackendEmail->SendMail($rfc822, $forward, $reply, $parent); else return false; } function GetWasteBasket() { if (isset($BACKEND_EMAIL)) return $this->BackendEmail->GetWasteBasket(); else return false; } function GetMessageList($folderid, $cutoffdate) { if ($folderid == 'root') { return $this->BackendContacts->GetMessageList($folderid, $cutoffdate); } else if ($folderid == 'calendar') { return $this->BackendCalendar->GetMessageList($folderid, $cutoffdate); } else return $this->BackendEmail->GetMessageList($folderid, $cutoffdate); } function GetFolderList() { global $BACKEND_EMAIL, $BACKEND_CONTACTS, $BACKEND_CALENDAR; $folders = Array(); if (isset($BACKEND_EMAIL)) $folders += $this->BackendEmail->GetFolderList(); if (isset($BACKEND_CALENDAR)) array_push($folders, $this->BackendCalendar->GetFolderList()); if (isset($BACKEND_CONTACTS)) array_push($folders, $this->BackendContacts->GetFolderList()); return $folders; } function GetFolder($id) { if ($id == 'root') { return $this->BackendContacts->GetFolder($id); } else if ($id == 'calendar') { return $this->BackendCalendar->GetFolder($id); } else return $this->BackendEmail->GetFolder($id); } function StatFolder($id) { if ($id == 'root') { return $this->BackendContacts->StatFolder($id); } else if ($id == 'calendar') { return $this->BackendCalendar->StatFolder($id); } else return $this->BackendEmail->StatFolder($id); } function GetAttachmentData($attname) { list($folderid, $id, $part) = explode(":", $attname); if ($folderid == 'root') { return $this->BackendContacts->GetAttachmentData($attname); } else if ($folderid == 'calendar') { return $this->BackendCalendar->GetAttachmentData($attname); } else return $this->BackendEmail->GetAttachmentData($attname); } function StatMessage($folderid, $id) { if ($folderid == 'root') { return $this->BackendContacts->StatMessage($folderid, $id); } else if ($folderid == 'calendar') { return $this->BackendCalendar->StatMessage($folderid, $id); } else return $this->BackendEmail->StatMessage($folderid, $id); } function GetMessage($folderid, $id, $truncsize, $mimesupport = 0) { if ($folderid == 'root') { return $this->BackendContacts->GetMessage($folderid, $id, $truncsize, $mimesupport = 0); } else if ($folderid == 'calendar') { return $this->BackendCalendar->GetMessage($folderid, $id, $truncsize, $mimesupport = 0); } else return $this->BackendEmail->GetMessage($folderid, $id, $truncsize, $mimesupport = 0); } function DeleteMessage($folderid, $id) { if ($folderid == 'root') { return $this->BackendContacts->DeleteMessage($folderid, $id); } else if ($folderid == 'calendar') { return $this->BackendCalendar->DeleteMessage($folderid, $id); } else return $this->BackendEmail->DeleteMessage($folderid, $id); } function SetReadFlag($folderid, $id, $flags) { if ($folderid == 'root') { return $this->BackendContacts->SetReadFlag($folderid, $id, $flags); } else if ($folderid == 'calendar') { return $this->BackendCalendar->SetReadFlag($folderid, $id, $flags); } else return $this->BackendEmail->SetReadFlag($folderid, $id, $flags); } function ChangeMessage($folderid, $id, $message) { if ($folderid == 'root') { return $this->BackendContacts->ChangeMessage($folderid, $id, $message); } else if ($folderid == 'calendar') { return $this->BackendCalendar->ChangeMessage($folderid, $id, $message); } else return $this->BackendEmail->ChangeMessage($folderid, $id, $message); } function MoveMessage($folderid, $id, $newfolderid) { if ($folderid == 'root') { return $this->BackendContacts->MoveMessage($folderid, $id, $newfolderid); } else if ($folderid == 'calendar') { return $this->BackendCalendar->MoveMessage($folderid, $id, $newfolderid); } else return $this->BackendEmail->MoveMessage($folderid, $id, $newfolderid); } function AlterPing() { if ($this->folderid == 'root') { return false; } else if ($this->folderid == 'calendar') { return false; } else return true; } function AlterPingChanges($folderid, &$syncstate) { if ($folderid == 'root') { return $this->BackendContacts->AlterPingChanges($folderid, &$syncstate); } else if ($folderid == 'calendar') { return $this->BackendCalendar->AlterPingChanges($folderid, &$syncstate); } else return $this->BackendEmail->AlterPingChanges($folderid, &$syncstate); } }; ?>