コード例 #1
0
 /**
  * Activate Moneybookers Quick Checkout
  *
  * @return void
  */
 protected function doActionActivate()
 {
     if (\XLite\Core\Config::getInstance()->CDev->Moneybookers->email != \XLite\Core\Request::getInstance()->email || !\XLite\Core\Config::getInstance()->CDev->Moneybookers->email || \XLite\Core\Config::getInstance()->CDev->Moneybookers->id != \XLite\Core\Request::getInstance()->id || !\XLite\Core\Config::getInstance()->CDev->Moneybookers->id) {
         $this->doActionCheckEmail();
     }
     if (\XLite\Core\Config::getInstance()->CDev->Moneybookers->email && \XLite\Core\Config::getInstance()->CDev->Moneybookers->id) {
         \XLite\Core\Mailer::sendMoneybookersActivation();
         \XLite\Core\TopMessage::getInstance()->add('You have sent a request for activation on the X.', array('date' => date('m.d.Y')));
     }
 }
コード例 #2
0
ファイル: Order.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Renew egood link
  *
  * @return void
  */
 protected function doActionEgoodsRenew()
 {
     $id = \XLite\Core\Request::GetInstance()->attachment_id;
     $attachment = \XLite\Core\Database::getRepo('XLite\\Module\\CDev\\Egoods\\Model\\OrderItem\\PrivateAttachment')->find($id);
     if (!$attachment) {
         \XLite\Core\TopMessage::addError('Download link did not found');
     } elseif (!$attachment->isActive()) {
         \XLite\Core\TopMessage::addError('Download link is not active');
     } else {
         $attachment->renew();
         \XLite\Core\Database::getEM()->flush();
         \XLite\Core\Mailer::sendEgoodsLinks($attachment->getItem()->getOrder());
         \XLite\Core\TopMessage::addInfo('Download link is renew');
     }
 }
コード例 #3
0
ファイル: Auth.php プロジェクト: kingsj/core
 /**
  * Logs in admin to cart.
  *
  * @param string $login    Administrator user login
  * @param string $password Administrator user password
  *
  * @return \XLite\Model\Profile
  */
 public function loginAdministrator($login, $password)
 {
     $profile = $this->login($login, $password);
     if ($profile instanceof \XLite\Model\Profile && !$profile->isAdmin()) {
         // Logoff user from session
         $this->logoff();
         // Reset profile object
         $profile = self::RESULT_ACCESS_DENIED;
         // Send notification about failed log in attempt
         \XLite\Core\Mailer::sendFailedAdminLoginNotification(\XLite\Core\Request::getInstance()->login);
     }
     return $profile;
 }
コード例 #4
0
ファイル: Mailer.php プロジェクト: kingsj/core
 /**
  * testSendRecoverPasswordConfirmation
  * TODO: add this test
  *
  * @return void
  * @access public
  * @see    ____func_see____
  * @since  1.0.0
  */
 public function testSendRecoverPasswordConfirmation()
 {
     $profile = self::$admin_profile;
     $this->startCheckingMail();
     \XLite\Core\Mailer::sendRecoverPasswordConfirmation(self::TESTER_EMAIL, self::TESTER_PASSWORD);
     sleep(3);
     $emails = $this->finishCheckingMail();
     if (empty($emails)) {
         $this->markTestSkipped('Email notification not found in the mail box');
     }
     $email = array_shift($emails);
     $result = (bool) preg_match('/Your new password: '******'/', $email['body']);
     $this->assertTrue($result, 'Check if email contents keywords');
 }
コード例 #5
0
ファイル: ProductVariant.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Send notification to admin about product low limit
  *
  * @return void
  */
 protected function sendLowLimitNotification()
 {
     \XLite\Core\Mailer::sendLowLimitWarningAdmin($this->prepareDataForNotification());
 }
コード例 #6
0
ファイル: SafeMode.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Send email notification to administrator about access key
  *
  * @param boolean $keyChanged is access key was changed
  *
  * @return void
  */
 public static function sendNotification($keyChanged = false)
 {
     if (!\Includes\Decorator\Utils\CacheManager::isRebuildNeeded(\Includes\Decorator\Utils\CacheManager::STEP_THIRD)) {
         // Send email notification
         \XLite\Core\Mailer::sendSafeModeAccessKeyNotification(\Includes\Utils\FileManager::read(static::getAccessKeyFileName()), $keyChanged);
     }
 }
コード例 #7
0
ファイル: OrderAbstract.php プロジェクト: kewaunited/xcart
 /**
  * A "change status" handler
  *
  * @return void
  */
 protected function processCancel()
 {
     if ($this->isNotificationsAllowed()) {
         \XLite\Core\Mailer::getInstance()->sendOrderCanceled($this, $this->isIgnoreCustomerNotifications());
     }
     $this->isNotificationSent = true;
 }
コード例 #8
0
ファイル: CheckoutAbstract.php プロジェクト: kewaunited/xcart
 /**
  * Send create profile notifications
  *
  * @param string $password Password OPTIONAL
  *
  * @return void
  */
 protected function sendCreateProfileNotifications($password = null)
 {
     $profile = $this->getCart()->getOrigProfile();
     // Send notification
     \XLite\Core\Mailer::sendProfileCreated($profile, $password, true);
 }
コード例 #9
0
ファイル: Settings.php プロジェクト: kewaunited/xcart
 /**
  * Action to send test email notification
  *
  * @return void
  */
 protected function doActionTestEmail()
 {
     $request = \XLite\Core\Request::getInstance();
     $error = \XLite\Core\Mailer::sendTestEmail($request->test_from_email_address, $request->test_to_email_address, $request->test_email_body);
     if ($error) {
         \XLite\Core\Session::getInstance()->test_email_error = $error;
         \XLite\Core\TopMessage::getInstance()->addError('Error of test e-mail sending: ' . $error);
     } else {
         \XLite\Core\TopMessage::getInstance()->add('Test e-mail have been successfully sent');
     }
     $this->setReturnURL($this->buildURL('settings', '', array('page' => static::EMAIL_PAGE)));
 }
コード例 #10
0
ファイル: Profile.php プロジェクト: kingsj/core
 /**
  * Delete profile action
  *
  * @return void
  */
 protected function doActionDelete()
 {
     $result = $this->getModelForm()->performAction('delete');
     // Send notification to the user
     \XLite\Core\Mailer::sendProfileDeletedAdminNotification($this->getProfile()->getLogin());
     $this->setReturnURL($this->buildURL('profile_list'));
 }
コード例 #11
0
ファイル: RecoverPassword.php プロジェクト: kingsj/core
 /**
  * recoverPassword
  *
  * @param mixed $email     ____param_comment____
  * @param mixed $requestID ____param_comment____
  *
  * @return void
  */
 protected function doPasswordRecovery($email, $requestID)
 {
     $result = true;
     $profile = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findByLogin($email);
     if (!isset($profile) || $profile->getPassword() != $requestID) {
         $result = false;
     } else {
         $pass = generate_code();
         $profile->setPassword(md5($pass));
         $result = $profile->update();
         if ($result) {
             // Send notification to the user
             \XLite\Core\Mailer::sendRecoverPasswordConfirmation($email, $pass);
         }
     }
     return $result;
 }
コード例 #12
0
ファイル: PitneyBowes.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Send request to PB API to register new merchant
  *
  * @return void
  */
 protected function doActionRequestCredentials()
 {
     $data = array('name' => array('humanName' => 'Name', 'value' => \XLite\Core\Request::getInstance()->name), 'company' => array('humanName' => 'Company name', 'value' => \XLite\Core\Request::getInstance()->company), 'email' => array('humanName' => 'Email', 'value' => \XLite\Core\Request::getInstance()->email), 'phone' => array('humanName' => 'Phone number', 'value' => \XLite\Core\Request::getInstance()->phone), 'businessAddress' => array('humanName' => 'Business Address', 'value' => \XLite\Core\Request::getInstance()->businessAddress), 'siteUrl' => array('humanName' => 'Site URL', 'value' => \XLite\Core\Request::getInstance()->siteUrl), 'xcartVersion' => array('humanName' => 'Current X-Cart Version', 'value' => \XLite::getInstance()->getVersion()));
     $errors = array();
     $errors['customer'] = \XLite\Core\Mailer::sendCredentialsRequestNotificationToCustomer($data);
     $errors['pitneybowes'] = \XLite\Core\Mailer::sendCredentialsRequestToPB($data);
     $requestSucceed = false;
     if (false === $errors['customer'] || false === $errors['pitneybowes']) {
         \XLite\Core\TopMessage::getInstance()->addError(static::t('Something went wrong.'));
     } else {
         \XLite\Core\TopMessage::getInstance()->addInfo(static::t('Your request has been successfully submitted for PB International Shipping. The PB team will be reaching out to you shortly with your credentials. Please check you emails. Thank you and speak soon.'));
         $requestSucceed = true;
     }
     \XLite\Core\Database::getRepo('\\XLite\\Model\\Config')->createOption(array('category' => $this->getOptionsCategory(), 'name' => 'credentials_requested', 'value' => $requestSucceed));
     $this->setReturnURL(\XLite\Core\Converter::buildURL($this->getTarget()));
 }
コード例 #13
0
 /**
  * Return all variables
  *
  * @return array
  */
 protected function getVariables()
 {
     return \XLite\Core\Mailer::getInstance()->getAllVariables();
 }
コード例 #14
0
ファイル: ProductsReturn.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Status change handler: "Requires Authorization" to "Rejected"
  *
  * @return boolean
  */
 protected function handleStatusChangeReject()
 {
     $result = false;
     if ($this->canBeRejected()) {
         // Send email notifications
         \XLite\Core\Mailer::sendProductsReturnRejected($this);
         $result = true;
     }
     return $result;
 }
コード例 #15
0
ファイル: Checkout.php プロジェクト: kingsj/core
 /**
  * Send create profile notifications
  *
  * @param string $password Password
  *
  * @return void
  */
 protected function sendCreateProfileNotifications($password)
 {
     $profile = $this->getCart()->getOrigProfile();
     // Send notification to the user
     \XLite\Core\Mailer::sendProfileCreatedUserNotification($profile, $password);
     // Send notification to the users department
     \XLite\Core\Mailer::sendProfileCreatedAdminNotification($profile);
 }
コード例 #16
0
ファイル: Profile.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Register anonymous profile
  * 
  * @return void
  */
 protected function doActionRegisterAsNew()
 {
     $result = false;
     $profile = $this->getModelForm()->getModelObject();
     if ($profile && $profile->isPersistent() && $profile->getAnonymous() && !$profile->getOrder() && !\XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findUserWithSameLogin($profile)) {
         $profile->setAnonymous(false);
         $password = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->generatePassword();
         $profile->setPassword(\XLite\Core\Auth::encryptPassword($password));
         $result = $profile->update();
     }
     if ($result) {
         // Send notification to the user
         \XLite\Core\Mailer::sendRegisterAnonymousCustomer($profile, $password);
         \XLite\Core\TopMessage::addInfo('The profile has been registered. The password has been sent to the user\'s email address');
     }
 }
コード例 #17
0
ファイル: Order.php プロジェクト: kingsj/core
 /**
  * A "change status" handler
  *
  * @return void
  */
 protected function processFail()
 {
     \XLite\Core\Mailer::getInstance()->sendFailedOrder($this);
 }
コード例 #18
0
ファイル: ContactUs.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Send message
  *
  * @return void
  */
 protected function doActionSend()
 {
     $data = \XLite\Core\Request::getInstance()->getData();
     $config = \XLite\Core\Config::getInstance()->CDev->ContactUs;
     $isValid = true;
     foreach ($this->requiredFields as $key => $name) {
         if (!isset($data[$key]) || empty($data[$key])) {
             $isValid = false;
             \XLite\Core\TopMessage::addError(static::t('The X field is empty', array('name' => $name)));
         }
     }
     if ($isValid && false === filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
         $isValid = false;
         \XLite\Core\TopMessage::addError(\XLite\Core\Translation::lbl('The value of the X field has an incorrect format', array('name' => $this->requiredFields['email'])));
     }
     if ($isValid && $config->recaptcha_private_key && $config->recaptcha_public_key) {
         require_once LC_DIR_MODULES . '/CDev/ContactUs/recaptcha/recaptchalib.php';
         $resp = recaptcha_check_answer($config->recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $data['recaptcha_challenge_field'], $data['recaptcha_response_field']);
         $isValid = $resp->is_valid;
         if (!$isValid) {
             \XLite\Core\TopMessage::addError('Please enter the correct captcha');
         }
     }
     if ($isValid) {
         $errorMessage = \XLite\Core\Mailer::sendContactUsMessage($data, \XLite\Core\Config::getInstance()->CDev->ContactUs->email ?: \XLite\Core\Config::getInstance()->Company->support_department);
         if ($errorMessage) {
             \XLite\Core\TopMessage::addError($errorMessage);
         } else {
             unset($data['message']);
             unset($data['subject']);
             \XLite\Core\TopMessage::addInfo('Message has been sent');
         }
     }
     \XLite\Core\Session::getInstance()->contact_us = $data;
 }
コード例 #19
0
ファイル: Profile.php プロジェクト: kewaunited/xcart
 /**
  * doActionDelete
  *
  * @return void
  */
 protected function doActionDelete()
 {
     if (\XLite\Core\Auth::getInstance()->isAdmin()) {
         \XLite\Core\TopMessage::addWarning(static::t('Administrator account cannot be deleted via customer interface.'));
         $result = false;
     } else {
         $userLogin = $this->getModelForm()->getModelObject()->getLogin();
         $result = $this->getModelForm()->performAction('delete');
         if ($result) {
             // Send notification to the users department
             \XLite\Core\Mailer::sendProfileDeleted($userLogin);
         }
         $this->setHardRedirect();
         $this->setReturnURL($this->buildURL());
     }
 }
コード例 #20
0
ファイル: Invoice.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Display Kount result on the invoice or not
  *
  * @return bool 
  */
 protected function isDisplayKountResult()
 {
     return \XLite\Module\CDev\XPaymentsConnector\Core\Kount::getInstance()->getKountData($this->getOrder()) && \XLite\Core\Mailer::getInstance()->isMailSendToAdmin();
 }
コード例 #21
0
ファイル: Order.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Process PIN codes 
  * 
  * @return void
  */
 public function processPINCodes()
 {
     $missingCount = 0;
     foreach ($this->getItems() as $item) {
         if ($item->getProduct()->getPinCodesEnabled()) {
             if (!$item->countPinCodes()) {
                 $item->acquirePinCodes();
                 $missingCount += $item->countMissingPinCodes();
             }
             if ($item->countPinCodes()) {
                 $item->salePinCodes();
             }
         }
     }
     if ($missingCount) {
         \XLite\Core\Mailer::getInstance()->sendAcquirePinCodesFailedAdmin($this);
         \XLite\Core\TopMessage::addError('Could not assign X PIN codes to order #Y.', array('count' => $missingCount, 'orderId' => $this->getOrderNumber()));
     }
 }
コード例 #22
0
ファイル: Settings.php プロジェクト: kingsj/core
 /**
  * Action to send test email notification
  *
  * @return void
  */
 protected function doActionTestEmail()
 {
     $request = \XLite\Core\Request::getInstance();
     $error = \XLite\Core\Mailer::getInstance()->sendTestEmail($request->test_from_email_address, $request->test_to_email_address, $request->test_email_body);
     \XLite\Core\Session::getInstance()->test_email_error = $error;
     $this->setReturnURL($this->buildURL('settings', '', array('page' => 'Email')));
 }
コード例 #23
0
ファイル: Mailer.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Composes mail message.
  *
  * @param string $from          The sender email address
  * @param string $to            The email address to send mail to
  * @param string $dir           The directiry there mail parts template located
  * @param array  $customHeaders The headers you want to add/replace to. OPTIONAL
  * @param string $interface     Interface to use for mail OPTIONAL
  * @param string $languageCode  Language code OPTIONAL
  *
  * @return void
  */
 public function compose($from, $to, $dir, array $customHeaders = array(), $interface = \XLite::CUSTOMER_INTERFACE, $languageCode = '')
 {
     static::$composeRunned = true;
     if ('' === $languageCode && \XLite::ADMIN_INTERFACE === $interface && !\XLite::isAdminZone()) {
         $languageCode = \XLite\Core\Config::getInstance()->General->default_admin_language;
     }
     \XLite\Core\Translation::setTmpMailTranslationCode($languageCode);
     // initialize internal properties
     $this->set('from', $from);
     $this->set('to', $to);
     $this->set('customHeaders', $customHeaders);
     $this->set('dir', $dir);
     $subject = $this->compile($this->get('subjectTemplate'), $interface);
     $subject = \XLite\Core\Mailer::getInstance()->populateVariables($subject);
     $this->set('subject', $subject);
     $this->set('body', $this->compile($this->get('layoutTemplate'), $interface));
     $body = $this->get('body');
     $body = \XLite\Core\Mailer::getInstance()->populateVariables($body);
     // find all images and fetch them; replace with cid:...
     $fname = tempnam(LC_DIR_COMPILE, 'mail');
     file_put_contents($fname, $body);
     $this->imageParser = new \XLite\Model\MailImageParser();
     $this->imageParser->webdir = \XLite::getInstance()->getShopURL('', false);
     $this->imageParser->parse($fname);
     $this->set('body', $this->imageParser->result);
     $this->set('images', $this->imageParser->images);
     ob_start();
     // Initialize PHPMailer from configuration variables (it should be done once in a script execution)
     $this->initMailFromConfig();
     // Initialize Mail from inner set of variables.
     $this->initMailFromSet();
     $output = ob_get_contents();
     ob_end_clean();
     if ('' !== $output) {
         \XLite\Logger::getInstance()->log('Mailer echoed: "' . $output . '". Error: ' . $this->mail->ErrorInfo);
     }
     // Check if there is any error during mail composition. Log it.
     if ($this->mail->isError()) {
         \XLite\Logger::getInstance()->log('Compose mail error: ' . $this->mail->ErrorInfo);
     }
     if (file_exists($fname)) {
         unlink($fname);
     }
     \XLite\Core\Translation::setTmpMailTranslationCode('');
     static::$composeRunned = false;
 }
コード例 #24
0
ファイル: Inventory.php プロジェクト: kewaunited/xcart
 /**
  * Send notification to admin about product low limit
  *
  * @return void
  */
 protected function sendLowLimitNotification()
 {
     if (!\XLite::getInstance()->getController() instanceof \XLite\Controller\Admin\EventTask && \XLite\Core\Request::getInstance()->event !== 'import') {
         \XLite\Core\Mailer::sendLowLimitWarningAdmin($this->prepareDataForNotification());
     }
 }
コード例 #25
0
ファイル: Order.php プロジェクト: kewaunited/xcart
 /**
  * Send tracking information action
  *
  * @return void
  */
 protected function doActionSendTracking()
 {
     \XLite\Core\Mailer::sendOrderTrackingInformationCustomer($this->getOrder());
     \XLite\Core\TopMessage::addInfo('Tracking information has been sent');
 }
コード例 #26
0
ファイル: RecoverPassword.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Sent Recover password mail
  *
  * @param string $email Email
  *
  * @return boolean
  */
 protected function requestRecoverPassword($email)
 {
     $result = false;
     $profile = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findByLogin($email);
     if (isset($profile) && !$profile->isAdmin()) {
         if ('' == $profile->getPasswordResetKey() || 0 == $profile->getPasswordResetKeyDate() || \XLite\Core\Converter::time() > $profile->getPasswordResetKeyDate()) {
             // Generate new 'password reset key'
             $profile->setPasswordResetKey($this->generatePasswordResetKey());
             $profile->setPasswordResetKeyDate(\XLite\Core\Converter::time() + static::PASSWORD_RESET_KEY_EXP_TIME);
             $profile->update();
         }
         \XLite\Core\Mailer::sendRecoverPasswordRequest($profile->getLogin(), $profile->getPasswordResetKey());
         $result = true;
     }
     return $result;
 }
コード例 #27
0
ファイル: Profile.php プロジェクト: kingsj/core
 /**
  * doActionDelete
  *
  * @return void
  */
 protected function doActionDelete()
 {
     $userLogin = $this->getModelForm()->getModelObject()->getLogin();
     $result = $this->getModelForm()->performAction('delete');
     if ($result) {
         // Send notification to the users department
         \XLite\Core\Mailer::sendProfileDeletedAdminNotification($userLogin);
     }
     $this->setReturnURL($this->buildURL());
     return $result;
 }