Ejemplo n.º 1
0
 /**
  * Validate the form
  */
 protected function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $fields = $this->frm->getFields();
         if ($fields['email']->isEmail(FL::err('EmailIsInvalid'))) {
         }
         if (FrontendMailengineModel::isSubscribed($fields['email']->getValue())) {
             $fields['email']->addError(FL::err('AlreadySubscribed'));
         }
         if ($this->frm->isCorrect()) {
             //--Subscribe
             $id = FrontendMailengineModel::subscribe($fields['email']->getValue());
             //--Get the default group
             $defaultGroup = FrontendModel::getModuleSetting($this->module, 'default_group');
             if ($defaultGroup > 0) {
                 $data = array();
                 $data['user_id'] = $id;
                 $data['group_id'] = $defaultGroup;
                 //--Add user to group
                 FrontendMailengineModel::insertUserToGroup($data);
             }
             // redirect
             $this->redirect(FrontendNavigation::getURLForBlock('Mailengine', 'MailengineSubscribe') . '?sent=true#subscribe');
         }
     }
     $this->frm->parse($this->tpl);
 }
Ejemplo n.º 2
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     //--Get the id
     $id = $this->URL->getParameter(1);
     //--check if the id is not empty
     if (empty($id)) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     //--Explode the id
     $ids = explode("-", $id);
     //--check if the id contains 2 elements
     if (count($ids) != 2) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     //--Get the ids and decrypt
     $send_id = (int) FrontendMailengineModel::decryptId($ids[0]);
     $user_id = (int) FrontendMailengineModel::decryptId($ids[1]);
     //--check if the ids are integers
     if ($send_id <= 0) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     if ($user_id > 0) {
         $data = array();
         $data["send_id"] = $send_id;
         $data["user_id"] = $user_id;
         //--Add open-mail to the database
         FrontendMailengineModel::insertMailOpen($data);
     }
     //--Create an empty image
     $this->createImage();
     //--Stop the script
     die;
 }
Ejemplo n.º 3
0
 /**
  * Load the data
  */
 protected function loadData()
 {
     //--Get the send mailing
     $this->record = FrontendMailengineModel::getSend($this->id);
     //--Create iframe
     $iframe = FrontendNavigation::getURLForBlock('Mailengine', 'MailenginePreview') . "?id=" . $this->id;
     $this->tpl->assign('iframe', $iframe);
 }
Ejemplo n.º 4
0
 protected function redirectLink($link_id)
 {
     //--Get the link
     $link = FrontendMailengineModel::getLink($link_id);
     //--Check if the link is empty -> redirect 404
     if (empty($link)) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     //--Redirect
     $this->redirect($link["url"]);
 }
Ejemplo n.º 5
0
 /**
  * Validate the form
  */
 protected function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $fields = $this->frm->getFields();
         if ($fields['email']->isEmail(FL::err('EmailIsInvalid'))) {
         }
         if (!FrontendMailengineModel::isSubscribed($fields['email']->getValue())) {
             $fields['email']->addError(FL::err('NotSubscribed'));
         }
         if ($this->frm->isCorrect()) {
             //--Subscribe
             FrontendMailengineModel::unsubscribe($fields['email']->getValue());
             // redirect
             $this->redirect(FrontendNavigation::getURLForBlock('Mailengine', 'MailengineUnsubscribe') . '?sent=true#unsubscribe');
         }
     }
     $this->frm->parse($this->tpl);
 }
Ejemplo n.º 6
0
 /**
  * Load the data
  */
 protected function loadData()
 {
     $this->record = FrontendMailengineModel::getSendMailingsForWebiste();
 }
Ejemplo n.º 7
0
 /**
  * Load the data
  */
 protected function loadData()
 {
     //--Get the send mailing
     $this->record = FrontendMailengineModel::getSend($this->id);
 }