コード例 #1
0
 public function callback_action($msgnum, $bounce_type, $email, $subject, $xheader, $remove, $rule_no = false, $rule_cat = false, $totalFetched = 0)
 {
     /* @var $wpdb wpdb */
     global $wpdb;
     // Callback action
     $this->log->log_this(sprintf('Callback action on message for %s', $email));
     $this->log->log_this(sprintf('Email : %s | bounce_cat : %s | bounce_type : %s | bounce_no : %s', $email, $rule_cat, $bounce_type, $rule_no));
     // The query for update bea_s_receivers table
     $receiver_result = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->bea_s_receivers} WHERE email = %s", $email));
     // Update the receiver if possible
     if ($receiver_result) {
         $this->log->log_this(sprintf('%s found on database', $email));
         $wpdb->update($wpdb->bea_s_receivers, array('current_status' => 'invalid', 'bounce_cat' => $rule_cat, 'bounce_type' => $bounce_type, 'bounce_no' => $rule_no), array('email' => $email), array('%s', '%s', '%s', '%s'), array('%s'));
     }
     // The query for update bea_s_re_ca table
     $receiver_id = Bea_Sender_Receiver::getReceiver($email);
     $re_ca__result = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->bea_s_re_ca} WHERE id_campaign = %s AND id_receiver = %s", $xheader, $receiver_id));
     if ($re_ca__result) {
         $this->log->log_this(sprintf('%s found on the _re_ca table', $email));
         $wpdb->update($wpdb->bea_s_re_ca, array('current_status' => 'bounced'), array('id_campaign' => $xheader, 'id_receiver' => $receiver_id), array('%s'), array('%d', '%d'));
     }
     return true;
 }
コード例 #2
0
 /**
  * Getthe campaign receivers
  *
  * @param (array)$where : the where query to add
  * @param (array)$orderby : the where query to add
  * @return Bea_Sender_Receiver objects
  *
  */
 public function get_receivers($where = '', $orderby = '', $limit = '')
 {
     /* @var $wpdb wpdb */
     global $wpdb;
     $receivers = $wpdb->get_results($wpdb->prepare("SELECT \r\n\t\t\t\tr.id,\r\n\t\t\t\tr.current_status,\r\n\t\t\t\tr.email,\r\n\t\t\t\tr.bounce_cat,\r\n\t\t\t\tr.bounce_type,\r\n\t\t\t\tr.bounce_no,\r\n\t\t\t\treca.current_status\r\n\t\t\tFROM {$wpdb->bea_s_re_ca} AS reca\r\n\t\t\t\tJOIN {$wpdb->bea_s_receivers} AS r \r\n\t\t\t\tON r.id = reca.id_receiver\r\n\t\t\tWHERE\r\n\t\t\t\t1=1\r\n\t\t\t\tAND reca.id_campaign = %d\r\n\t\t\t\t{$where}\r\n\t\t\t\t{$orderby}\r\n\t\t\t\t{$limit}\r\n\t\t\t", $this->id));
     foreach ($receivers as $receiver) {
         $re = new Bea_Sender_Receiver($receiver->email);
         if ($re->set_receiver($this->id) === false) {
             continue;
         }
         $this->receivers[] = $re;
     }
     return $this->receivers;
 }