Exemplo n.º 1
0
 public static function getByEmail($email)
 {
     $db = Database::get();
     $data = $db->GetRow("SELECT * FROM pkgNewsletterEmails WHERE email=?", $email);
     if (!empty($data)) {
         $order = new Email();
         $order->setPropertiesFromArray($data);
     }
     return $order instanceof Email ? $order : false;
 }
 public function unsubscribe()
 {
     $email = urldecode($this->get('e'));
     $hash = urldecode($this->get('h'));
     $json = $this->get('json', false);
     if ($email && $hash) {
         $nEmail = NewsletterEmail::getByEmail(urldecode($email));
         if ($nEmail->eID) {
             //
             $nEmail->unsubscribed = 1;
             $nEmail->save();
             $state = 'success';
         } else {
             $state = 'failure';
         }
         $this->set('state', 'failure');
         if ($json) {
             header('Content-Type: application/json');
             echo json_encode(array('state' => $state));
             exit;
         }
     }
 }
Exemplo n.º 3
0
 public function getResult($queryRow)
 {
     return NewsletterEmail::getByID($queryRow['eID']);
 }
 public function delete($eID)
 {
     $nEmail = NewsletterEmail::getByID($eID);
     $nEmail->delete();
     $this->redirect("dashboard/reports/newsletter_emails/");
 }