- <?php
- class MailFolder extends BaseObject {
- var $count;
- var $recent;
- var $new;
- var $folder;
- var $pop3;
- var $imap;
- var $pop3_obj;
- var $imap_obj;
- Function MailFolder( $folder = 'INBOX' ) {
- $this->folder = $folder;
- $this->pop3 = 0;
- $this->imap = 0;
- $this->pop3_obj = new MailPop3();
- $this->imap_obj = new MailImap();
- $this->count = 0;
- $this->recent = 0;
- $this->new = 0;
- }
- Function CopySettings( $src_obj ) {
- $this->folder = $src_obj->folder;
- $this->pop3 = $src_obj->pop3;
- $this->imap = $src_obj->imap;
- $this->pop3_obj = $src_obj->pop3_obj;
- $this->imap_obj = $src_obj->imap_obj;
- if ( $this->imap == 1 ) {
- $this->imap_obj->CopySettings( $src_obj );
- }
- if ( $this->pop3 == 1 ) {
- }
- }
- Function GetStats() {
- if ( $this->pop3 ) {
- }
- if ( $this->imap ) {
- $this->imap_obj->folder = $this->folder;
- $ret_vals = $this->imap_obj->Folder_GetStats();
- if ( $ret_vals[ 0 ] == 0 ) {
- /* Bubble up the error */
- return $ret_vals;
- } else {
- $this->count = $ret_vals[ 1 ];
- $this->recent = $ret_vals[ 2 ];
- $this->new = $ret_vals[ 3 ];
- return Array( true );
- }
- }
- }
- Function GetMessageHeader( $message_num ) {
- if ( $this->imap ) {
- $this->imap_obj->folder = $this->folder;
- return $this->imap_obj->Message_GetHeader( $message_num );
- }
- }
- Function GetMessageBody( $message_num ) {
- if ( $this->imap ) {
- $this->imap_obj->folder = $this->folder;
- return $this->imap_obj->Message_GetBody( $message_num );
- }
- }
- Function GetMessageBodySection( $message_num, $section_num ) {
- if ( $this->imap ) {
- $this->imap_obj->folder = $this->folder;
- return $this->imap_obj->Message_GetBodySection(
- $message_num, $section_num
- );
- }
- }
- Function GetMessageStructure( $message_num ) {
- if ( $this->imap ) {
- $this->imap_obj->folder = $this->folder;
- return $this->imap_obj->Message_Structure( $message_num );
- }
- }
- Function DeleteMessage( $message_num ) {
- if ( $this->imap ) {
- $this->imap_obj->folder = $this->folder;
- return $this->imap_obj->Message_Delete( $message_num );
- }
- }
- Function UnDeleteMessage( $message_num ) {
- if ( $this->imap ) {
- $this->imap_obj->folder = $this->folder;
- return $this->imap_obj->Message_UnDelete( $message_num );
- }
- }
- Function ExpungeDeletedMessages() {
- if ( $this->imap ) {
- $this->imap_obj->folder = $this->folder;
- return $this->imap_obj->Message_ExpungeDeleted();
- }
- }
- /*
- SORTARRIVAL
- SORTFROM
- SORTSIZE
- SORTSUBJECT
- */
- Function Sort( $sort_order = SORTARRIVAL, $reverse_order = 0 ) {
- if ( $this->imap ) {
- $this->imap_obj->folder = $this->folder;
- return $this->imap_obj->Folder_Sort( $sort_order, $reverse_order );
- }
- }
- Function MoveMessage( $to_folder, $message_id ) {
- $this->imap_obj->CopySettings( $this );
- $this->pop3_obj->CopySettings( $this );
- if ( $this->imap == 1 ) {
- return $this->imap_obj->MoveMessage( $to_folder, $message_id );
- } else {
- /* POP3 Does not do folder support */
- return 0;
- }
- return 0;
- }
- }
- ?>