Exemplo n.º 1
0
 public function notifications()
 {
     $this->settings_route = '/admin/shop/settings/notifications';
     switch ($this->app->get('VERB')) {
         case "POST":
         case "post":
             $data = $this->app->get('REQUEST');
             $__emails = explode(",", \Dsc\ArrayHelper::get($data, '__notifications_orders_emails'));
             $__emails = array_filter(array_unique($__emails));
             $emails = array();
             foreach ($__emails as $__email) {
                 if (\Mailer\Abstracts\Sender::isEmailAddress($__email)) {
                     $emails[] = $__email;
                 }
             }
             $this->app->set('REQUEST.notifications.orders.emails', $emails);
             // do the save and redirect to $this->settings_route
             return $this->save();
             break;
     }
     $flash = \Dsc\Flash::instance();
     $this->app->set('flash', $flash);
     $settings = \Shop\Models\Settings::fetch();
     $flash->store($settings->cast());
     $this->app->set('meta.title', 'Notifications | Shop');
     echo $this->theme->render('Shop/Admin/Views::settings/notifications.php');
 }
Exemplo n.º 2
0
 /**
  * Send the email, either via the API or via SMTP
  *
  * @return boolean
  */
 public function send()
 {
     if ($this->api()) {
         return $this->sendAPI();
     }
     return parent::send();
 }
Exemplo n.º 3
0
 public function init()
 {
     $smtp_host = $this->settings()->{'smtp.smtp_host'};
     $smtp_port = $this->settings()->{'smtp.smtp_port'};
     $smtp_username = $this->settings()->{'smtp.smtp_username'};
     $smtp_password = $this->settings()->{'smtp.smtp_password'};
     if ($smtp_host && $smtp_port && $smtp_username && $smtp_password) {
         // since we extend PHPMailer, just send via SMTP
         $this->IsSMTP();
         $this->Host = $smtp_host;
         $this->Port = $smtp_port;
         $this->Username = $smtp_username;
         $this->Password = $smtp_password;
         // TODO Add config options for these
         $this->SMTPAuth = true;
         $this->SMTPSecure = 'tls';
     } else {
         throw new \Exception('Missing settings');
     }
     return parent::init();
 }
Exemplo n.º 4
0
 public function init()
 {
     $this->isSendmail();
     return parent::init();
 }