コード例 #1
0
ファイル: Forgotpassword.php プロジェクト: haaseit/hcsf
 /**
  * @param $aErr
  * @return array
  */
 private function handleForgotPassword($aErr)
 {
     if (!filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
         $aErr[] = 'emailinvalid';
     } else {
         $sql = 'SELECT * FROM customer WHERE cust_email = :email';
         $sEmail = filter_var(trim(\HaaseIT\Tools::getFormfield("email")), FILTER_SANITIZE_EMAIL);
         $hResult = $this->db->prepare($sql);
         $hResult->bindValue(':email', $sEmail, \PDO::PARAM_STR);
         $hResult->execute();
         if ($hResult->rowCount() != 1) {
             $aErr[] = 'emailunknown';
         } else {
             $aResult = $hResult->fetch();
             $iTimestamp = time();
             if ($iTimestamp - HOUR < $aResult['cust_pwresettimestamp']) {
                 // 1 hour delay between requests
                 $aErr[] = 'pwresetstilllocked';
             } else {
                 $sResetCode = md5($aResult['cust_email'] . $iTimestamp);
                 $aData = ['cust_pwresetcode' => $sResetCode, 'cust_pwresettimestamp' => $iTimestamp, 'cust_id' => $aResult['cust_id']];
                 $sql = \HaaseIT\DBTools::buildPSUpdateQuery($aData, 'customer', 'cust_id');
                 $hResult = $this->db->prepare($sql);
                 foreach ($aData as $sKey => $sValue) {
                     $hResult->bindValue(':' . $sKey, $sValue);
                 }
                 $hResult->execute();
                 $sTargetAddress = $aResult['cust_email'];
                 $sSubject = $this->textcats->T("forgotpw_mail_subject");
                 $sMessage = $this->textcats->T("forgotpw_mail_text1");
                 $sMessage .= "<br><br>" . '<a href="http' . (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' ? 's' : '') . '://';
                 $sMessage .= $_SERVER["SERVER_NAME"] . '/_misc/rp.html?key=' . $sResetCode . '&amp;email=' . $sTargetAddress . '">';
                 $sMessage .= 'http' . (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' ? 's' : '') . '://';
                 $sMessage .= $_SERVER["SERVER_NAME"] . '/_misc/rp.html?key=' . $sResetCode . '&amp;email=' . $sTargetAddress . '</a>';
                 $sMessage .= '<br><br>' . $this->textcats->T("forgotpw_mail_text2");
                 \HaaseIT\HCSF\Helper::mailWrapper($sTargetAddress, $sSubject, $sMessage);
             }
         }
     }
     return $aErr;
 }
コード例 #2
0
ファイル: Helper.php プロジェクト: haaseit/hcsf
 public static function sendVerificationMail($sEmailVerificationcode, $sTargetAddress, ServiceManager $serviceManager, $bCust = false)
 {
     if ($bCust) {
         $sSubject = $serviceManager->get('textcats')->T("register_mail_emailverification_subject");
         $aP['link'] = 'http' . (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' ? 's' : '') . '://';
         $aP['link'] .= $_SERVER["SERVER_NAME"] . '/_misc/verifyemail.html?key=' . $sEmailVerificationcode;
         $sMessage = $serviceManager->get('twig')->render('customer/sendverificationmail.twig', $aP);
     } else {
         $sSubject = HardcodedText::get('newcustomerregistration_mail_subject');
         $sMessage = HardcodedText::get('newcustomerregistration_mail_text1') . ' ';
         $sMessage .= $sTargetAddress . HardcodedText::get('newcustomerregistration_mail_text2') . ' ' . date(HelperConfig::$core['locale_format_date_time']);
         $sTargetAddress = HelperConfig::$core["email_sender"];
     }
     \HaaseIT\HCSF\Helper::mailWrapper($sTargetAddress, $sSubject, $sMessage);
 }
コード例 #3
0
ファイル: Shoppingcart.php プロジェクト: haaseit/hcsf
 /**
  * @param $iInsertID
  * @param $sMailbody_us
  * @param $sMailbody_they
  * @param $aImagesToSend
  */
 private function sendCheckoutMails($iInsertID, $sMailbody_us, $sMailbody_they, $aImagesToSend)
 {
     if (isset(HelperConfig::$shop["email_orderconfirmation_attachment_cancellationform_" . HelperConfig::$lang]) && file_exists(PATH_DOCROOT . HelperConfig::$core['directory_emailattachments'] . '/' . HelperConfig::$shop["email_orderconfirmation_attachment_cancellationform_" . HelperConfig::$lang])) {
         $aFilesToSend[] = PATH_DOCROOT . HelperConfig::$core['directory_emailattachments'] . '/' . HelperConfig::$shop["email_orderconfirmation_attachment_cancellationform_" . HelperConfig::$lang];
     } else {
         $aFilesToSend = [];
     }
     Helper::mailWrapper($this->post["email"], $this->textcats->T("shoppingcart_mail_subject") . ' ' . $iInsertID, $sMailbody_they, $aImagesToSend, $aFilesToSend);
     Helper::mailWrapper(HelperConfig::$core["email_sender"], 'Bestellung im Webshop Nr: ' . $iInsertID, $sMailbody_us, $aImagesToSend);
 }