/**
  * Returns Captcha-Image String
  *
  * @param Field $field
  * @return string image URL
  */
 public function render(Field $field)
 {
     switch (TypoScriptUtility::getCaptchaExtensionFromSettings($this->settings)) {
         case 'captcha':
             $image = ExtensionManagementUtility::siteRelPath('captcha') . 'captcha/captcha.php';
             break;
         default:
             /** @var CalculatingCaptchaService $captchaService */
             $captchaService = $this->objectManager->get('In2code\\Powermail\\Domain\\Service\\CalculatingCaptchaService');
             $image = $captchaService->render($field);
     }
     return $image;
 }
 /**
  * Check if given string is correct
  *
  * @param string $value
  * @param Field $field
  * @return bool
  */
 protected function validCodePreflight($value, $field)
 {
     switch (TypoScriptUtility::getCaptchaExtensionFromSettings($this->settings)) {
         case 'captcha':
             session_start();
             $generatedCaptchaString = $_SESSION['tx_captcha_string'];
             if ($this->isClearSession()) {
                 $_SESSION['tx_captcha_string'] = '';
             }
             if (!empty($value) && $generatedCaptchaString === $value) {
                 return true;
             }
             break;
         default:
             /** @var CalculatingCaptchaService $captchaService */
             $captchaService = $this->objectManager->get('In2code\\Powermail\\Domain\\Service\\CalculatingCaptchaService');
             if ($captchaService->validCode($value, $field, $this->isClearSession())) {
                 return true;
             }
     }
     return false;
 }
 /**
  * Send the mail
  *
  * @param array $email Array with all needed mail information
  * @return bool Mail successfully sent
  */
 protected function sendTemplateEmail(array $email)
 {
     /** @var MailMessage $message */
     $message = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
     TypoScriptUtility::overwriteValueFromTypoScript($email['subject'], $this->overwriteConfiguration, 'subject');
     $message->setTo(array($email['receiverEmail'] => $email['receiverName']))->setFrom(array($email['senderEmail'] => $email['senderName']))->setSubject($email['subject'])->setCharset(FrontendUtility::getCharset());
     $message = $this->addCc($message);
     $message = $this->addBcc($message);
     $message = $this->addReturnPath($message);
     $message = $this->addReplyAddresses($message);
     $message = $this->addPriority($message);
     $message = $this->addAttachmentsFromUploads($message);
     $message = $this->addAttachmentsFromTypoScript($message);
     $message = $this->addHtmlBody($message, $email);
     $message = $this->addPlainBody($message, $email);
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'BeforeSend', array($message, $email, $this->mail, $this->settings, $this->type));
     $message->send();
     $this->updateMail($email);
     return $message->isSent();
 }
Example #4
0
 /**
  * Send Optin Confirmation Mail to user
  *
  * @param Mail $mail
  * @return void
  */
 protected function sendConfirmationMail(Mail &$mail)
 {
     $email = ['template' => 'Mail/OptinMail', 'receiverName' => $this->mailRepository->getSenderNameFromArguments($mail, [$this->conf['sender.']['default.'], 'senderName']), 'receiverEmail' => $this->mailRepository->getSenderMailFromArguments($mail), 'senderName' => $this->settings['sender']['name'], 'senderEmail' => $this->settings['sender']['email'], 'subject' => $this->contentObject->cObjGetSingle($this->conf['optin.']['subject'], $this->conf['optin.']['subject.']), 'rteBody' => '', 'format' => $this->settings['sender']['mailformat'], 'variables' => ['hash' => OptinUtility::createOptinHash($mail), 'mail' => $mail]];
     TypoScriptUtility::overwriteValueFromTypoScript($email['receiverName'], $this->conf['optin.']['overwrite.'], 'name');
     TypoScriptUtility::overwriteValueFromTypoScript($email['receiverEmail'], $this->conf['optin.']['overwrite.'], 'email');
     TypoScriptUtility::overwriteValueFromTypoScript($email['senderName'], $this->conf['optin.']['overwrite.'], 'senderName');
     TypoScriptUtility::overwriteValueFromTypoScript($email['senderEmail'], $this->conf['optin.']['overwrite.'], 'senderEmail');
     $this->sendMailService->sendEmailPreflight($email, $mail, $this->settings, 'optin');
 }
Example #5
0
 /**
  * Create an options array (Needed for fieldsettings: select, radio, check)
  *        option1 =>
  *            label => Red Shoes
  *            value => red
  *            selected => 1
  *
  * @param string $string Options from the Textarea
  * @param string $typoScriptObjectPath Path to TypoScript like lib.blabla
  * @param bool $parse
  * @return array Options Array
  */
 protected function optionArray($string, $typoScriptObjectPath, $parse = true)
 {
     if (empty($string)) {
         $string = TypoScriptUtility::parseTypoScriptFromTypoScriptPath($typoScriptObjectPath);
     }
     if (empty($string)) {
         $string = 'Error, no options to show';
     }
     return $this->buildOptions($string, $parse);
 }
 /**
  * Get email string from TypoScript overwrite
  *
  * @return array
  */
 protected function overWriteEmailsWithTypoScript()
 {
     $receiverString = '';
     TypoScriptUtility::overwriteValueFromTypoScript($receiverString, $this->configuration['receiver.']['overwrite.'], 'email');
     return $this->parseEmailsFromString($receiverString);
 }
Example #7
0
 /**
  * Create an options array (Needed for fieldsettings: select, radio, check)
  *        option1 =>
  *            label => Red Shoes
  *            value => red
  *            selected => 1
  *
  * @param string $string Options from the Textarea
  * @param string $typoScriptObjectPath Path to TypoScript like lib.blabla
  * @param bool $parse
  * @return array Options Array
  */
 protected function optionArray($string, $typoScriptObjectPath, $parse = true)
 {
     if (empty($string)) {
         $string = TypoScriptUtility::parseTypoScriptFromTypoScriptPath($typoScriptObjectPath);
     }
     if (empty($string)) {
         $string = 'Error, no options to show';
     }
     $options = array();
     $string = str_replace('[\\n]', PHP_EOL, $string);
     $settingsField = GeneralUtility::trimExplode(PHP_EOL, $string, true);
     foreach ($settingsField as $line) {
         $settings = GeneralUtility::trimExplode('|', $line, false);
         $value = isset($settings[1]) ? $settings[1] : $settings[0];
         $label = $parse ? TemplateUtility::fluidParseString($settings[0]) : $settings[0];
         $options[] = array('label' => $label, 'value' => $value, 'selected' => isset($settings[2]) ? 1 : 0);
     }
     return $options;
 }