Example #1
0
     if ($queryReg) {
         $numReg = mysql_num_rows($queryReg);
     }
 }
 if ($numReg) {
     /**
      * @var $queryReg
      */
     preg_match_all("/\\{\\{(.*)\\}\\}/iU", $mail_form['body'], $output_array);
     while ($rowRegistration = mysql_fetch_assoc($queryReg)) {
         $params = array();
         $mailerSearch = $output_array[0];
         $regId = $rowRegistration[$tableRegPrimary];
         set_time_limit(60);
         $_GET['guid'] = $rowRegistration['guid'];
         include Controller::getBasePath() . '/include/config.php';
         $language_part = $templateLanguage ? '_' . $templateLanguage : '';
         $variablesFilePath = $basePath . '/templates/mailer_vars/' . $template['file_name'] . $language_part . '.' . $template['file_extension'];
         if (file_exists($variablesFilePath)) {
             include $variablesFilePath;
         }
         $modelMailTemplate->clear();
         $modelMailTemplate->setAttributes($mail_form);
         $modelMailTemplate->to = $email;
         $modelMailTemplate->to_name = $lastname . ' ' . $firstname;
         $replace = array();
         foreach ($output_array[1] as $v) {
             $v = str_replace(']', '', htmlspecialchars_decode($v, ENT_QUOTES));
             $v = str_replace('"', '', $v);
             $v = str_replace("'", '', $v);
             $v_arr = explode('[', $v);
Example #2
0
<?php

if (isset($_POST['template_id']) && ($template_id = $_POST['template_id'])) {
    require_once '../../components/Controller.php';
    require_once Controller::getBasePath() . '/include/config.php';
    require_once './models/MailTemplates.php';
    $controller = new Controller();
    $template = MailTemplates::findOne($template_id);
    $result = array();
    function generate($language = '')
    {
        global $controller;
        global $template;
        $language_part = $language ? '_' . $language : '';
        $body = $controller->renderPartial('/templates/' . $template['file_name'] . $language_part . '.' . $template['file_extension'], $GLOBALS, $GLOBALS['basePath']);
        // $template['info']['embedded_images'] = array();
        ///start embedded_images
        if (isset($template['embedded_images'])) {
            $embeddedImages = explode('|', $template['embedded_images']);
            if (count($embeddedImages) > 0) {
                $path = $cid = array();
                foreach ($embeddedImages as $embeddedImage) {
                    $pathCid = explode('=', $embeddedImage);
                    if (count($pathCid) === 2) {
                        $path[] = $pathCid[0];
                        $cid[] = 'cid:' . $pathCid[1];
                    }
                }
                function getUrlByPath($path)
                {
                    global $baseUrl;