Пример #1
0
 /**
  * Send Email upon error.
  *
  * @param  string $message holds the error to send
  */
 public static function sendEmail($message)
 {
     if (self::$emailError == true) {
         $mail = new Mail();
         $mail->setFrom(SITEEMAIL);
         $mail->addAddress(SITEEMAIL);
         $mail->subject('New error on ' . SITETITLE);
         $mail->body($message);
         $mail->send();
     }
 }
Пример #2
0
 public function forgotpassword()
 {
     $this->data['title'] = 'Forgot Password';
     if (isset($_POST) && !empty($_POST)) {
         $user = new User();
         $hash = new \Models\Hash();
         $user_details = $user->get_row(array('email' => $_POST['email']));
         if ($user_details->email != '') {
             //SEND ACCOUNT DETAILS TO USER
             $fullname = $user_details->firstname . ' ' . $user_details->lastname;
             $subject = 'Reset Password';
             $uniqid = uniqid();
             $insert_hash = $hash->create(array('user_id' => $user_details->id, 'hash' => $uniqid, 'status' => 'active'));
             $hash = DIR . 'account/resetpassword/' . $uniqid;
             $mail = new Mail();
             $mail->template('forgotpassword');
             $mail->password($user_details->email, $subject, $fullname, $hash);
             $this->data['success'] = "A reset link has been sent to your email!" . "<br> Click on link to reset.";
         } else {
             $this->data['error'] = 'This email does not exist in our records!';
         }
     }
     View::rendertemplate('header', $this->data);
     View::render('account/forgotpassword', $this->data);
     View::rendertemplate('footer', $this->data);
 }
Пример #3
0
 public static function sendEmail($message)
 {
     if (self::$emailError == true) {
         $mail = new Mail();
         $mail->setFrom('*****@*****.**');
         $mail->CharSet = 'UTF-8';
         $mail->addAddress('*****@*****.**');
         $mail->subject('Новая ошибка на ' . SITETITLE);
         $mail->body($message);
         $mail->send();
     }
 }
Пример #4
0
 /**
  * Entrem un Array de Localitats i generem les entrades... 
  **/
 public static function generaEntradaFromLocalitats($LlistatLocalitats, ComandaTableObject $CTO)
 {
     $mail = new Mail();
     $html = "";
     $htmlMail = "";
     $PrimeraEntrada = true;
     //Per cada sessió,, agafem tots els seients i generem el QR amb el corresponent email
     foreach ($LlistatLocalitats as $idSessio => $D) {
         foreach ($D['Localitats'] as $id => $LTO) {
             $id = $LTO->getLocalitatIdString();
             $QR = $LTO->getCodiQR();
             $nomArxiu = $id;
             //Genero el QR
             \PHPQRCode\QRcode::png($QR, self::$URL_ENTRADES . $nomArxiu . '.png', \PHPQRCode\Constants::QR_ECLEVEL_L, 8, 1);
             //Afegim el QR del seient al correu que enviarem
             $mail->AddEmbeddedImage(self::$URL_ENTRADES . $nomArxiu . '.png', $id);
             //Genero l'entrada en HTML per aquest seient
             $html .= self::generaEntrada($D['SessioData'], $CTO, $nomArxiu, $QR, $LTO, $PrimeraEntrada);
             $htmlMail .= self::generaEntradaMail($QR, $id, $D['SessioData'], $LTO, $CTO);
             $PrimeraEntrada = false;
         }
     }
     //Si tenim alguna sessió, faig la impressió
     if (sizeof($LlistatLocalitats) > 0) {
         $html .= '</body></html>';
         //Carrego l'html de la comanda per mail
         $htmlMailFinal = file_get_contents(BASEURL . '/app/templates/default/json/emailTemplate.html');
         $htmlMailFinal = str_replace("%%ENTRADA%%", $htmlMail, $htmlMailFinal);
         //Genero el PDF de la comanda
         $dompdf = new \DOMPDF();
         //Carrego l'HTML de les entrades
         $dompdf->load_html($html);
         //Ho guardo al disc en format PDF
         $dompdf->set_paper('a4', 'portrait');
         $dompdf->render();
         $output = $dompdf->output();
         $FILE_URL = self::$URL_ENTRADES . $CTO->comanda['co_Codi'] . '.pdf';
         $FILE_WEB = self::$URL_WEB . $CTO->comanda['co_Codi'] . '.pdf';
         file_put_contents($FILE_URL, $output);
         //Carrego un mail per si el vull enviar
         $mail->addAddress($CTO->comanda['co_EmailCompra']);
         $mail->subject("La Gorga | Les seves entrades ");
         $mail->body($htmlMailFinal);
         $mail->AddAttachment($FILE_URL);
         return array('Mail' => $mail, "Html" => $html, "FILE_URL" => $FILE_URL, "FILE_WEB_URL" => $FILE_WEB);
     }
 }
Пример #5
0
 public static function sendEmail($message)
 {
     $mail = new \Helpers\PhpMailer\Mail(array('type' => 'php'));
     $subject = 'Novo erro no ' . SITETITLE;
     $from = array('mail' => SITEEMAIL, 'name' => SITETITLE);
     $destination = array(SITEEMAIL . "," . SITETITLE);
     $mail->quick($subject, $message, $from, $destination);
 }
Пример #6
0
 public function signup($slug = null)
 {
     $this->data['title'] = 'Join Us';
     $statusModel = new Status();
     $roleModel = new Role();
     $userModel = new User();
     if (isset($_POST['email']) && !empty($_POST['email'])) {
         $firstname = $_POST['firstname'];
         $email = $_POST['email'];
         if ($_POST['password'] == $_POST['password2']) {
             $encrypted = md5($_POST['password']);
             $row_count = $userModel->getColRow('user_email', $email);
             if (!is_bool($row_count)) {
                 Session::set('error', 'Email exists in our records, please use a different email');
             } else {
                 $userArray = array('user_firstname' => $firstname, 'user_email' => $email, 'user_password' => $encrypted, 'user_role_id' => Role::id('user'), 'user_status_id' => Status::id('active'));
                 $userArray = Gump::xss_clean($userArray);
                 $userArray = Gump::sanitize($userArray);
                 $is_valid = Gump::is_valid($userArray, array('user_firstname' => 'required|max_len,200|min_len,1', 'user_email' => 'required|max_len,200|min_len,1', 'user_password' => 'required|max_len,200|min_len,1'));
                 if ($is_valid === true) {
                     $user_id = $userModel->create($userArray);
                     if ($user_id > 0) {
                         $slug = Url::generateSafeSlug($firstname . $user_id);
                         //send email
                         $subject = 'Welcome to GbeduMobile';
                         $content .= "You just opened a new account with us, Get login details below<br><br>";
                         $content .= "Username: "******"<br>";
                         $content .= "Password: "******"<br>";
                         if (ENVIRONMENT == 'production') {
                             $mail = new Mail();
                             $mail->general($email, $subject, $firstname, $content);
                         }
                         Session::set('success', 'Login details has been sent to your email, Congrats!');
                         Url::redirect('home');
                     } else {
                         Session::set('error', 'Operation Fails, Please contact admin');
                     }
                 } else {
                     Session::set('error', $is_valid);
                 }
             }
         } else {
             Session::set('error', 'Password does not match!');
         }
     }
     View::rendertemplate('header', $this->data);
     View::render('account/signup', $this->data);
     View::rendertemplate('footer', $this->data);
 }