[ Index ] |
MailPress 7.2 |
[ Index ] [ Classes ] [ Functions ] [ Variables ] [ Constants ] [ Statistics ] |
[Summary view] [Print] [Text view]
1 <?php 2 class MP_List_Unsubscribe extends MP_list_unsubscribe_ 3 { 4 public $option_name = MailPress_list_unsubscribe::option_name; 5 6 public $class = __CLASS__; 7 public $log_name = 'mp_process_list_unsubscribe'; 8 public $log_option_name = 'list_unsubscribe'; 9 public $log_title = 'List-Unsubscribe Report ( Processing mode : %1$s )'; 10 11 public $cron_name = 'MailPress_schedule_list_unsubscribe'; 12 13 const headers = array( 'From', 'Subject' ); 14 15 function is_request() 16 { 17 $this->pop3->get_headers( $this->message_id, self::headers ); 18 19 $this->do_delete = false; 20 21 $this->action = false; 22 $this->mail_id = false; 23 $this->confkey = false; 24 $this->list_id = false; 25 26 // subject 27 $subject = $this->pop3->get_header( 'Subject' ); 28 29 if ( empty( $subject ) ) 30 { 31 $bm = ' ! ** ERROR ** empty header : Subject (?) '; 32 $this->local_log[] = '!' . $bm . str_repeat( ' ', $this->bt - strlen( $bm ) ) . '!'; 33 return false; 34 } 35 36 $bm = ' Subject ! ==> ' . $subject; 37 $this->local_log[] = '!' . $bm . str_repeat( ' ', $this->bt - strlen( $bm ) ) . '!'; 38 39 /* looking for data in subject */ 40 41 $words = explode( '.', $subject ); 42 $words = array_map( 'trim', $words ); 43 44 if ( count( $words ) != 5 ) return false; 45 if ( MailPress_list_unsubscribe::key_word != $words[0] ) return false; 46 47 $this->action = $words[0] ?? false; 48 $this->mail_id = $words[1] ?? false; 49 $this->confkey = $words[2] ?? false; 50 $this->list_id = $words[3] . '.' . $words[4] ?? false; 51 52 $mp_user_id = MP_User::get_id( $this->confkey ); 53 54 if ( !$mp_user_id ) 55 { 56 $bm = ' ! ** ERROR ** no valid confkey found'; 57 $this->local_log[] = '!' . $bm . str_repeat( ' ', $this->bt - strlen( $bm ) ) . '!'; 58 return false; 59 } 60 61 $this->mp_user = MP_User::get( $mp_user_id ); 62 63 if ( !$this->mp_user ) 64 { 65 $bm = ' ! ** ERROR ** no valid mp_user found'; 66 $this->local_log[] = '!' . $bm . str_repeat( ' ', $this->bt - strlen( $bm ) ) . '!'; 67 return false; 68 } 69 70 // from 71 $this->has_email(); 72 73 if ( !$this->email_address ) return false; 74 75 if ( !$this->compare( $this->email_address, $this->mp_user->email ) ) 76 { 77 $bm = ' ! ** ERROR ** ' . $this->mp_user->email . ' <> ' . $this->email_address; 78 $this->local_log[] = '!' . $bm . str_repeat( ' ', $this->bt - strlen( $bm ) ) . '!'; 79 $this->do_delete = true; 80 return false; 81 } 82 83 return ( $this->mail_id && $this->confkey && $this->list_id ); 84 } 85 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue May 19 15:55:14 2020 | Cross-referenced by PHPXref 0.7.1 |