decodeEmail() public static method

Decode the domain in an e-mail address
public static decodeEmail ( string $strEmail ) : string
$strEmail string The e-mail address
return string The decoded e-mail address
 /**
  * Create a new user and redirect
  *
  * @param MemberModel $objMember
  */
 protected function sendPasswordLink($objMember)
 {
     $confirmationId = md5(uniqid(mt_rand(), true));
     // Store the confirmation ID
     $objMember = \MemberModel::findByPk($objMember->id);
     $objMember->activation = $confirmationId;
     $objMember->save();
     // Prepare the simple token data
     $arrData = $objMember->row();
     $arrData['domain'] = \Idna::decode(\Environment::get('host'));
     $arrData['link'] = \Idna::decode(\Environment::get('base')) . \Environment::get('request') . (strpos(\Environment::get('request'), '?') !== false ? '&' : '?') . 'token=' . $confirmationId;
     // Send e-mail
     $objEmail = new \Email();
     $objEmail->from = $GLOBALS['TL_ADMIN_EMAIL'];
     $objEmail->fromName = $GLOBALS['TL_ADMIN_NAME'];
     $objEmail->subject = sprintf($GLOBALS['TL_LANG']['MSC']['passwordSubject'], \Idna::decode(\Environment::get('host')));
     $objEmail->text = \StringUtil::parseSimpleTokens($this->reg_password, $arrData);
     $objEmail->sendTo($objMember->email);
     $this->log('A new password has been requested for user ID ' . $objMember->id . ' (' . \Idna::decodeEmail($objMember->email) . ')', __METHOD__, TL_ACCESS);
     // Check whether there is a jumpTo page
     if (($objJumpTo = $this->objModel->getRelated('jumpTo')) instanceof PageModel) {
         $this->jumpToOrReload($objJumpTo->row());
     }
     $this->reload();
 }
 /**
  * Generate the module
  */
 protected function compile()
 {
     $this->import('FrontendUser', 'User');
     // Initialize the password widget
     $arrField = array('name' => 'password', 'inputType' => 'text', 'label' => $GLOBALS['TL_LANG']['MSC']['password'][0], 'eval' => array('hideInput' => true, 'mandatory' => true, 'required' => true));
     $objWidget = new \FormTextField(\FormTextField::getAttributesFromDca($arrField, $arrField['name']));
     $objWidget->rowClass = 'row_0 row_first even';
     $strFormId = 'tl_close_account_' . $this->id;
     // Validate widget
     if (\Input::post('FORM_SUBMIT') == $strFormId) {
         $objWidget->validate();
         // Validate the password
         if (!$objWidget->hasErrors()) {
             // The password has been generated with crypt()
             if (\Encryption::test($this->User->password)) {
                 $blnAuthenticated = \Encryption::verify($objWidget->value, $this->User->password);
             } else {
                 list($strPassword, $strSalt) = explode(':', $this->User->password);
                 $blnAuthenticated = $strSalt == '' ? $strPassword === sha1($objWidget->value) : $strPassword === sha1($strSalt . $objWidget->value);
             }
             if (!$blnAuthenticated) {
                 $objWidget->value = '';
                 $objWidget->addError($GLOBALS['TL_LANG']['ERR']['invalidPass']);
             }
         }
         // Close account
         if (!$objWidget->hasErrors()) {
             // HOOK: send account ID
             if (isset($GLOBALS['TL_HOOKS']['closeAccount']) && is_array($GLOBALS['TL_HOOKS']['closeAccount'])) {
                 foreach ($GLOBALS['TL_HOOKS']['closeAccount'] as $callback) {
                     $this->import($callback[0]);
                     $this->{$callback[0]}->{$callback[1]}($this->User->id, $this->reg_close, $this);
                 }
             }
             $objMember = \MemberModel::findByPk($this->User->id);
             // Remove the account
             if ($this->reg_close == 'close_delete') {
                 $objMember->delete();
                 $this->log('User account ID ' . $this->User->id . ' (' . \Idna::decodeEmail($this->User->email) . ') has been deleted', __METHOD__, TL_ACCESS);
             } else {
                 $objMember->disable = 1;
                 $objMember->tstamp = time();
                 $objMember->save();
                 $this->log('User account ID ' . $this->User->id . ' (' . \Idna::decodeEmail($this->User->email) . ') has been deactivated', __METHOD__, TL_ACCESS);
             }
             $this->User->logout();
             // Check whether there is a jumpTo page
             if (($objJumpTo = $this->objModel->getRelated('jumpTo')) instanceof PageModel) {
                 $this->jumpToOrReload($objJumpTo->row());
             }
             $this->reload();
         }
     }
     $this->Template->fields = $objWidget->parse();
     $this->Template->formId = $strFormId;
     $this->Template->action = \Environment::get('indexFreeRequest');
     $this->Template->slabel = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['closeAccount']);
     $this->Template->rowLast = 'row_1 row_last odd';
 }
Esempio n. 3
0
    /**
     * Return all non-excluded fields of a record as HTML table
     *
     * @return string
     */
    public function show()
    {
        if (!strlen($this->intId)) {
            return '';
        }
        $objRow = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE id=?")->limit(1)->execute($this->intId);
        if ($objRow->numRows < 1) {
            return '';
        }
        $count = 1;
        $return = '';
        $row = $objRow->row();
        // Get the order fields
        $objDcaExtractor = \DcaExtractor::getInstance($this->strTable);
        $arrOrder = $objDcaExtractor->getOrderFields();
        // Get all fields
        $fields = array_keys($row);
        $allowedFields = array('id', 'pid', 'sorting', 'tstamp');
        if (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'])) {
            $allowedFields = array_unique(array_merge($allowedFields, array_keys($GLOBALS['TL_DCA'][$this->strTable]['fields'])));
        }
        // Use the field order of the DCA file
        $fields = array_intersect($allowedFields, $fields);
        // Show all allowed fields
        foreach ($fields as $i) {
            if (!in_array($i, $allowedFields) || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'password' || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['doNotShow'] || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['hideInput']) {
                continue;
            }
            // Special treatment for table tl_undo
            if ($this->strTable == 'tl_undo' && $i == 'data') {
                continue;
            }
            $value = \StringUtil::deserialize($row[$i]);
            // Decrypt the value
            if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['encrypt']) {
                $value = \Encryption::decrypt($value);
            }
            $class = $count++ % 2 == 0 ? ' class="tl_bg"' : '';
            // Get the field value
            if (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['foreignKey'])) {
                $temp = array();
                $chunks = explode('.', $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['foreignKey'], 2);
                foreach ((array) $value as $v) {
                    $objKey = $this->Database->prepare("SELECT " . $chunks[1] . " AS value FROM " . $chunks[0] . " WHERE id=?")->limit(1)->execute($v);
                    if ($objKey->numRows) {
                        $temp[] = $objKey->value;
                    }
                }
                $row[$i] = implode(', ', $temp);
            } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'fileTree' || in_array($i, $arrOrder)) {
                if (is_array($value)) {
                    foreach ($value as $kk => $vv) {
                        $value[$kk] = $vv ? \StringUtil::binToUuid($vv) : '';
                    }
                    $row[$i] = implode(', ', $value);
                } else {
                    $row[$i] = $value ? \StringUtil::binToUuid($value) : '';
                }
            } elseif (is_array($value)) {
                foreach ($value as $kk => $vv) {
                    if (is_array($vv)) {
                        $vals = array_values($vv);
                        $value[$kk] = $vals[0] . ' (' . $vals[1] . ')';
                    }
                }
                $row[$i] = implode(', ', $value);
            } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'date') {
                $row[$i] = $value ? \Date::parse(\Config::get('dateFormat'), $value) : '-';
            } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'time') {
                $row[$i] = $value ? \Date::parse(\Config::get('timeFormat'), $value) : '-';
            } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'datim' || in_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['flag'], array(5, 6, 7, 8, 9, 10)) || $i == 'tstamp') {
                $row[$i] = $value ? \Date::parse(\Config::get('datimFormat'), $value) : '-';
            } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'checkbox' && !$GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['multiple']) {
                $row[$i] = $value != '' ? $GLOBALS['TL_LANG']['MSC']['yes'] : $GLOBALS['TL_LANG']['MSC']['no'];
            } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['rgxp'] == 'email') {
                $row[$i] = \Idna::decodeEmail($value);
            } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['inputType'] == 'textarea' && ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['allowHtml'] || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['preserveTags'])) {
                $row[$i] = \StringUtil::specialchars($value);
            } elseif (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'])) {
                $row[$i] = isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]]) ? is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]]) ? $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]][0] : $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['reference'][$row[$i]] : $row[$i];
            } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['eval']['isAssociative'] || array_is_assoc($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['options'])) {
                $row[$i] = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['options'][$row[$i]];
            } else {
                $row[$i] = $value;
            }
            // Label
            if (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label'])) {
                $label = is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label']) ? $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label'][0] : $GLOBALS['TL_DCA'][$this->strTable]['fields'][$i]['label'];
            } else {
                $label = is_array($GLOBALS['TL_LANG']['MSC'][$i]) ? $GLOBALS['TL_LANG']['MSC'][$i][0] : $GLOBALS['TL_LANG']['MSC'][$i];
            }
            if ($label == '') {
                $label = $i;
            }
            $return .= '
  <tr>
    <td' . $class . '><span class="tl_label">' . $label . ': </span></td>
    <td' . $class . '>' . $row[$i] . '</td>
  </tr>';
        }
        // Special treatment for tl_undo
        if ($this->strTable == 'tl_undo') {
            $arrData = \StringUtil::deserialize($objRow->data);
            foreach ($arrData as $strTable => $arrTableData) {
                \System::loadLanguageFile($strTable);
                $this->loadDataContainer($strTable);
                foreach ($arrTableData as $arrRow) {
                    $count = 0;
                    $return .= '
  <tr>
    <td colspan="2" style="padding:0"><div style="margin-bottom:26px;line-height:24px;border-bottom:1px dotted #ccc">&nbsp;</div></td>
  </tr>';
                    foreach ($arrRow as $i => $v) {
                        if (is_array(\StringUtil::deserialize($v))) {
                            continue;
                        }
                        $class = $count++ % 2 == 0 ? ' class="tl_bg"' : '';
                        // Get the field label
                        if (isset($GLOBALS['TL_DCA'][$strTable]['fields'][$i]['label'])) {
                            $label = is_array($GLOBALS['TL_DCA'][$strTable]['fields'][$i]['label']) ? $GLOBALS['TL_DCA'][$strTable]['fields'][$i]['label'][0] : $GLOBALS['TL_DCA'][$strTable]['fields'][$i]['label'];
                        } else {
                            $label = is_array($GLOBALS['TL_LANG']['MSC'][$i]) ? $GLOBALS['TL_LANG']['MSC'][$i][0] : $GLOBALS['TL_LANG']['MSC'][$i];
                        }
                        if (!strlen($label)) {
                            $label = $i;
                        }
                        // Always encode special characters (thanks to Oliver Klee)
                        $return .= '
  <tr>
    <td' . $class . '><span class="tl_label">' . $label . ': </span></td>
    <td' . $class . '>' . \StringUtil::specialchars($v) . '</td>
  </tr>';
                    }
                }
            }
        }
        // Return table
        return '
<table class="tl_show">' . $return . '
</table>';
    }
Esempio n. 4
0
 /**
  * Activate an account
  */
 protected function activateAcount()
 {
     $this->strTemplate = 'mod_message';
     /** @var FrontendTemplate|object $objTemplate */
     $objTemplate = new \FrontendTemplate($this->strTemplate);
     $this->Template = $objTemplate;
     $objMember = \MemberModel::findOneByActivation(\Input::get('token'));
     if ($objMember === null) {
         $this->Template->type = 'error';
         $this->Template->message = $GLOBALS['TL_LANG']['MSC']['accountError'];
         return;
     }
     // Update the account
     $objMember->disable = '';
     $objMember->activation = '';
     $objMember->save();
     // HOOK: post activation callback
     if (isset($GLOBALS['TL_HOOKS']['activateAccount']) && is_array($GLOBALS['TL_HOOKS']['activateAccount'])) {
         foreach ($GLOBALS['TL_HOOKS']['activateAccount'] as $callback) {
             $this->import($callback[0]);
             $this->{$callback[0]}->{$callback[1]}($objMember, $this);
         }
     }
     // Log activity
     $this->log('User account ID ' . $objMember->id . ' (' . \Idna::decodeEmail($objMember->email) . ') has been activated', __METHOD__, TL_ACCESS);
     // Redirect to the jumpTo page
     if (($objTarget = $this->objModel->getRelated('reg_jumpTo')) instanceof PageModel) {
         /** @var PageModel $objTarget */
         $this->redirect($objTarget->getFrontendUrl());
     }
     // Confirm activation
     $this->Template->type = 'confirm';
     $this->Template->message = $GLOBALS['TL_LANG']['MSC']['accountActivated'];
 }
Esempio n. 5
0
    /**
     * Return a form to choose an existing style sheet and import it
     *
     * @param DataContainer $dc
     *
     * @return string
     */
    public function send(DataContainer $dc)
    {
        $objNewsletter = $this->Database->prepare("SELECT n.*, c.template AS channelTemplate, c.sender AS channelSender, c.senderName as channelSenderName FROM tl_newsletter n LEFT JOIN tl_newsletter_channel c ON n.pid=c.id WHERE n.id=?")->limit(1)->execute($dc->id);
        // Return if there is no newsletter
        if ($objNewsletter->numRows < 1) {
            return '';
        }
        // Set the template
        if ($objNewsletter->template == '') {
            $objNewsletter->template = $objNewsletter->channelTemplate;
        }
        // Set the sender address
        if ($objNewsletter->sender == '') {
            $objNewsletter->sender = $objNewsletter->channelSender;
        }
        // Set the sender name
        if ($objNewsletter->senderName == '') {
            $objNewsletter->senderName = $objNewsletter->channelSenderName;
        }
        // No sender address given
        if ($objNewsletter->sender == '') {
            throw new InternalServerErrorException('No sender address given. Please check the newsletter channel settings.');
        }
        $arrAttachments = array();
        // Add attachments
        if ($objNewsletter->addFile) {
            $files = \StringUtil::deserialize($objNewsletter->files);
            if (!empty($files) && is_array($files)) {
                $objFiles = \FilesModel::findMultipleByUuids($files);
                if ($objFiles !== null) {
                    while ($objFiles->next()) {
                        if (is_file(TL_ROOT . '/' . $objFiles->path)) {
                            $arrAttachments[] = $objFiles->path;
                        }
                    }
                }
            }
        }
        // Replace insert tags
        $html = $this->replaceInsertTags($objNewsletter->content, false);
        $text = $this->replaceInsertTags($objNewsletter->text, false);
        // Convert relative URLs
        if ($objNewsletter->externalImages) {
            $html = $this->convertRelativeUrls($html);
        }
        /** @var SessionInterface $objSession */
        $objSession = \System::getContainer()->get('session');
        // Send newsletter
        if (\Input::get('token') != '' && \Input::get('token') == $objSession->get('tl_newsletter_send')) {
            $referer = preg_replace('/&(amp;)?(start|mpc|token|recipient|preview)=[^&]*/', '', \Environment::get('request'));
            // Preview
            if (isset($_GET['preview'])) {
                // Check the e-mail address
                if (!\Validator::isEmail(\Input::get('recipient', true))) {
                    $_SESSION['TL_PREVIEW_MAIL_ERROR'] = true;
                    $this->redirect($referer);
                }
                $arrRecipient['email'] = urldecode(\Input::get('recipient', true));
                // Send
                $objEmail = $this->generateEmailObject($objNewsletter, $arrAttachments);
                $this->sendNewsletter($objEmail, $objNewsletter, $arrRecipient, $text, $html);
                // Redirect
                \Message::addConfirmation(sprintf($GLOBALS['TL_LANG']['tl_newsletter']['confirm'], 1));
                $this->redirect($referer);
            }
            // Get the total number of recipients
            $objTotal = $this->Database->prepare("SELECT COUNT(DISTINCT email) AS count FROM tl_newsletter_recipients WHERE pid=? AND active=1")->execute($objNewsletter->pid);
            // Return if there are no recipients
            if ($objTotal->count < 1) {
                $objSession->set('tl_newsletter_send', null);
                \Message::addError($GLOBALS['TL_LANG']['tl_newsletter']['error']);
                $this->redirect($referer);
            }
            $intTotal = $objTotal->count;
            // Get page and timeout
            $intTimeout = \Input::get('timeout') > 0 ? \Input::get('timeout') : 1;
            $intStart = \Input::get('start') ? \Input::get('start') : 0;
            $intPages = \Input::get('mpc') ? \Input::get('mpc') : 10;
            // Get recipients
            $objRecipients = $this->Database->prepare("SELECT *, r.email FROM tl_newsletter_recipients r LEFT JOIN tl_member m ON(r.email=m.email) WHERE r.pid=? AND r.active=1 GROUP BY r.email ORDER BY r.email")->limit($intPages, $intStart)->execute($objNewsletter->pid);
            echo '<div style="font-family:Verdana,sans-serif;font-size:11px;line-height:16px;margin-bottom:12px">';
            // Send newsletter
            if ($objRecipients->numRows > 0) {
                // Update status
                if ($intStart == 0) {
                    $this->Database->prepare("UPDATE tl_newsletter SET sent=1, date=? WHERE id=?")->execute(time(), $objNewsletter->id);
                    $_SESSION['REJECTED_RECIPIENTS'] = array();
                }
                while ($objRecipients->next()) {
                    $objEmail = $this->generateEmailObject($objNewsletter, $arrAttachments);
                    $this->sendNewsletter($objEmail, $objNewsletter, $objRecipients->row(), $text, $html);
                    echo 'Sending newsletter to <strong>' . \Idna::decodeEmail($objRecipients->email) . '</strong><br>';
                }
            }
            echo '<div style="margin-top:12px">';
            // Redirect back home
            if ($objRecipients->numRows < 1 || $intStart + $intPages >= $intTotal) {
                $objSession->set('tl_newsletter_send', null);
                // Deactivate rejected addresses
                if (!empty($_SESSION['REJECTED_RECIPIENTS'])) {
                    $intRejected = count($_SESSION['REJECTED_RECIPIENTS']);
                    \Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_newsletter']['rejected'], $intRejected));
                    $intTotal -= $intRejected;
                    foreach ($_SESSION['REJECTED_RECIPIENTS'] as $strRecipient) {
                        $this->Database->prepare("UPDATE tl_newsletter_recipients SET active='' WHERE email=?")->execute($strRecipient);
                        $this->log('Recipient address "' . \Idna::decodeEmail($strRecipient) . '" was rejected and has been deactivated', __METHOD__, TL_ERROR);
                    }
                }
                \Message::addConfirmation(sprintf($GLOBALS['TL_LANG']['tl_newsletter']['confirm'], $intTotal));
                echo '<script>setTimeout(\'window.location="' . \Environment::get('base') . $referer . '"\',1000)</script>';
                echo '<a href="' . \Environment::get('base') . $referer . '">Please click here to proceed if you are not using JavaScript</a>';
            } else {
                $url = preg_replace('/&(amp;)?(start|mpc|recipient)=[^&]*/', '', \Environment::get('request')) . '&start=' . ($intStart + $intPages) . '&mpc=' . $intPages;
                echo '<script>setTimeout(\'window.location="' . \Environment::get('base') . $url . '"\',' . $intTimeout * 1000 . ')</script>';
                echo '<a href="' . \Environment::get('base') . $url . '">Please click here to proceed if you are not using JavaScript</a>';
            }
            echo '</div></div>';
            exit;
        }
        $strToken = md5(uniqid(mt_rand(), true));
        $objSession->set('tl_newsletter_send', $strToken);
        $sprintf = $objNewsletter->senderName != '' ? $objNewsletter->senderName . ' &lt;%s&gt;' : '%s';
        $this->import('BackendUser', 'User');
        // Preview newsletter
        $return = '
<div id="tl_buttons">
<a href="' . $this->getReferer(true) . '" class="header_back" title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>
' . \Message::generate() . '
<form action="' . TL_SCRIPT . '" id="tl_newsletter_send" class="tl_form" method="get">
<div class="tl_formbody_edit tl_newsletter_send">
<input type="hidden" name="do" value="' . \Input::get('do') . '">
<input type="hidden" name="table" value="' . \Input::get('table') . '">
<input type="hidden" name="key" value="' . \Input::get('key') . '">
<input type="hidden" name="id" value="' . \Input::get('id') . '">
<input type="hidden" name="token" value="' . $strToken . '">
<table class="prev_header">
  <tr class="row_0">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['from'] . '</td>
    <td class="col_1">' . sprintf($sprintf, \Idna::decodeEmail($objNewsletter->sender)) . '</td>
  </tr>
  <tr class="row_1">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['subject'][0] . '</td>
    <td class="col_1">' . $objNewsletter->subject . '</td>
  </tr>
  <tr class="row_2">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['template'][0] . '</td>
    <td class="col_1">' . $objNewsletter->template . '</td>
  </tr>' . (!empty($arrAttachments) && is_array($arrAttachments) ? '
  <tr class="row_3">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['attachments'] . '</td>
    <td class="col_1">' . implode(', ', $arrAttachments) . '</td>
  </tr>' : '') . '
</table>' . (!$objNewsletter->sendText ? '
<div class="preview_html">
' . $html . '
</div>' : '') . '
<div class="preview_text">
<pre style="white-space:pre-wrap">' . $text . '</pre>
</div>

<fieldset class="tl_tbox nolegend">
<div class="w50 widget">
  <h3><label for="ctrl_mpc">' . $GLOBALS['TL_LANG']['tl_newsletter']['mailsPerCycle'][0] . '</label></h3>
  <input type="text" name="mpc" id="ctrl_mpc" value="10" class="tl_text" onfocus="Backend.getScrollOffset()">' . ($GLOBALS['TL_LANG']['tl_newsletter']['mailsPerCycle'][1] && \Config::get('showHelp') ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['mailsPerCycle'][1] . '</p>' : '') . '
</div>
<div class="w50 widget">
  <h3><label for="ctrl_timeout">' . $GLOBALS['TL_LANG']['tl_newsletter']['timeout'][0] . '</label></h3>
  <input type="text" name="timeout" id="ctrl_timeout" value="1" class="tl_text" onfocus="Backend.getScrollOffset()">' . ($GLOBALS['TL_LANG']['tl_newsletter']['timeout'][1] && \Config::get('showHelp') ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['timeout'][1] . '</p>' : '') . '
</div>
<div class="w50 widget">
  <h3><label for="ctrl_start">' . $GLOBALS['TL_LANG']['tl_newsletter']['start'][0] . '</label></h3>
  <input type="text" name="start" id="ctrl_start" value="0" class="tl_text" onfocus="Backend.getScrollOffset()">' . ($GLOBALS['TL_LANG']['tl_newsletter']['start'][1] && \Config::get('showHelp') ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['start'][1] . '</p>' : '') . '
</div>
<div class="w50 widget">
  <h3><label for="ctrl_recipient">' . $GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][0] . '</label></h3>
  <input type="text" name="recipient" id="ctrl_recipient" value="' . \Idna::decodeEmail($this->User->email) . '" class="tl_text" onfocus="Backend.getScrollOffset()">' . (isset($_SESSION['TL_PREVIEW_MAIL_ERROR']) ? '
  <div class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['email'] . '</div>' : ($GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][1] && \Config::get('showHelp') ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][1] . '</p>' : '')) . '
</div>
</fieldset>
</div>';
        $return .= '

<div class="tl_formbody_submit">
<div class="tl_submit_container">
<button type="submit" name="preview" class="tl_submit" accesskey="p">' . $GLOBALS['TL_LANG']['tl_newsletter']['preview'] . '</button>
<button type="submit" id="send" class="tl_submit" accesskey="s" onclick="return confirm(\'' . str_replace("'", "\\'", $GLOBALS['TL_LANG']['tl_newsletter']['sendConfirm']) . '\')">' . $GLOBALS['TL_LANG']['tl_newsletter']['send'][0] . '</button>
</div>
</div>

</form>';
        unset($_SESSION['TL_PREVIEW_MAIL_ERROR']);
        return $return;
    }