AND first_name.usd_usf_id = ' . $gProfileFields->getProperty('FIRST_NAME', 'usf_id') . ' WHERE rol_id IN (' . implode(',', $arrayRoles) . ') AND rol_cat_id = cat_id AND cat_org_id = ' . $gCurrentOrganization->getValue('org_id') . ' AND mem_rol_id = rol_id AND mem_begin <= \'' . DATE_NOW . '\' AND mem_end > \'' . DATE_NOW . '\' AND mem_usr_id = usr_id AND usr_valid = 1 AND email.usd_usr_id = email.usd_usr_id ORDER BY last_name, first_name'; $resultUsers = $gDb->query($sql); while ($row = $gDb->fetch_array($resultUsers)) { if ($ecardSendResult == true) { // create and send ecard $ecardHtmlData = $funcClass->parseEcardTemplate($imageUrl, $_POST['ecard_message'], $ecardDataToParse, $row['first_name'] . ' ' . $row['last_name'], $row['email']); $ecardSendResult = $funcClass->sendEcard($senderName, $senderEmail, $ecardHtmlData, $row['first_name'] . ' ' . $row['last_name'], $row['email'], $imageServerPath); } } } if (count($arrayUsers) > 0) { foreach ($arrayUsers as $userId) { if ($ecardSendResult == true) { $user = new User($gDb, $gProfileFields, $userId); // create and send ecard $ecardHtmlData = $funcClass->parseEcardTemplate($imageUrl, $_POST['ecard_message'], $ecardDataToParse, $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME'), $user->getValue('EMAIL')); $ecardSendResult = $funcClass->sendEcard($senderName, $senderEmail, $ecardHtmlData, $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME'), $user->getValue('EMAIL'), $imageServerPath); } } } // show result
$gMessage->showThemeBody(false); $gMessage->showInModaleWindow(); if (strlen($_POST['ecard_template']) === 0) { $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('ECA_TEMPLATE'))); } // Initialize and check the parameters $ecardMessage = ''; $postTemplateName = admFuncVariableIsValid($_POST, 'ecard_template', 'file', array('requireValue' => true)); $postPhotoId = admFuncVariableIsValid($_POST, 'photo_id', 'int', array('requireValue' => true)); $postPhotoNr = admFuncVariableIsValid($_POST, 'photo_nr', 'int', array('requireValue' => true)); $nameRecipient = admFuncVariableIsValid($_POST, 'name_recipient', 'string'); $emailRecipient = admFuncVariableIsValid($_POST, 'email_recipient', 'string'); if (isset($_POST['ecard_message'])) { $ecardMessage = $_POST['ecard_message']; } $imageUrl = $g_root_path . '/adm_program/modules/photos/photo_show.php?pho_id=' . $postPhotoId . '&photo_nr=' . $postPhotoNr . '&max_width=' . $gPreferences['ecard_thumbs_scale'] . '&max_height=' . $gPreferences['ecard_thumbs_scale']; $funcClass = new FunctionClass($gL10n); // read content of template file $ecardDataToParse = $funcClass->getEcardTemplate($postTemplateName, THEME_SERVER_PATH . '/ecard_templates/'); if ($ecardDataToParse === '') { $gMessage->show($gL10n->get('SYS_ERROR_PAGE_NOT_FOUND')); } echo ' <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title">' . $gL10n->get('SYS_NOTE') . '</h4> </div> <div class="modal-body" id="preview_content">'; // show output of parsed template echo $funcClass->parseEcardTemplate($imageUrl, $ecardMessage, $ecardDataToParse, $nameRecipient, $emailRecipient); echo '</div>';