Exemple #1
0
    public static function generateEmail($fields)
    {
        require_once BASE_DIR . LIBRARY_DIR . 'php/text/system_variables.php';
        global $parametersMod;
        $content = '';
        for ($i = 0; $i < sizeof($fields); $i++) {
            if (get_class($fields[$i]) != 'Library\\Php\\Form\\FieldHidden') {
                switch (get_class($fields[$i])) {
                    case 'Library\\Php\\Form\\FieldEmail':
                        $content .= '<b>' . htmlspecialchars($fields[$i]->caption) . ' :</b> <a href="mailto:' . nl2br(htmlspecialchars($fields[$i]->postedValue())) . '">' . nl2br(htmlspecialchars($fields[$i]->postedValue())) . '</a><br>' . "\n";
                        break;
                    default:
                        $content .= '<b>' . htmlspecialchars($fields[$i]->caption) . ' :</b> ' . nl2br(htmlspecialchars($fields[$i]->postedValue())) . '<br>' . "\n";
                        break;
                }
            }
        }
        if (isset($_POST['spec_url'])) {
            $content .= '<b>URL :</b> <a href="' . nl2br($_POST['spec_url']) . '">' . nl2br(htmlspecialchars($_POST['spec_url'])) . '</a><br>' . "\n";
        }
        $email = $parametersMod->getValue('standard', 'configuration', 'main_parameters', 'email_template');
        $email = str_replace('[[content]]', $content, $email);
        $email = \Library\Php\Text\SystemVariables::insert($email);
        $email = \Library\Php\Text\SystemVariables::clear($email);
        $email = '
<html>
	<head></head>
	<body>
		' . $email . '
	</body>
</html>
';
        return $email;
    }
Exemple #2
0
 static function subscribeConfirmation($link)
 {
     require_once BASE_DIR . LIBRARY_DIR . 'php/text/system_variables.php';
     require_once BASE_DIR . LIBRARY_DIR . 'php/text/html_transform.php';
     global $parametersMod;
     $emailHtml = str_replace('[[content]]', $parametersMod->getValue('community', 'newsletter', 'subscription_translations', 'text_email_confirmation'), $parametersMod->getValue('standard', 'configuration', 'main_parameters', 'email_template'));
     $emailHtml = str_replace('[[link]]', '<a href="' . $link . '">' . \Library\Php\Text\HtmlTransform::prepareLink($link) . '</a>', $emailHtml);
     $emailHtml = \Library\Php\Text\SystemVariables::insert($emailHtml);
     $emailHtml = \Library\Php\Text\SystemVariables::clear($emailHtml);
     return $emailHtml;
 }
Exemple #3
0
 function sendUpdateVerificationLink($email, $code, $userId)
 {
     require_once BASE_DIR . LIBRARY_DIR . 'php/text/system_variables.php';
     global $parametersMod;
     global $site;
     $emailQueue = new \Modules\administrator\email_queue\Module();
     $emailHtml = str_replace('[[content]]', $parametersMod->getValue('community', 'user', 'email_messages', 'text_verify_new_email'), $parametersMod->getValue('standard', 'configuration', 'main_parameters', 'email_template'));
     $link = $site->generateUrl(null, null, array(), array("module_group" => "community", "module_name" => "user", "action" => "new_email_verification", "id" => $userId, "code" => $code));
     $emailHtml = str_replace('[[link]]', '<a href="' . $link . '">' . $link . '</a>', $emailHtml);
     $emailHtml = \Library\Php\Text\SystemVariables::insert($emailHtml);
     $emailHtml = \Library\Php\Text\SystemVariables::clear($emailHtml);
     $emailQueue->addEmail($parametersMod->getValue('standard', 'configuration', 'main_parameters', 'email'), $parametersMod->getValue('standard', 'configuration', 'main_parameters', 'name'), $email, '', $parametersMod->getValue('community', 'user', 'email_messages', 'subject_verify_new_email'), $emailHtml, true, true, null);
     $emailQueue->send();
 }