コード例 #1
0
ファイル: ecard_send.php プロジェクト: bash-t/admidio
}
// pruefen ob User eingeloggt ist
if (!$gValidLogin) {
    $gMessage($gL10n->get('SYS_INVALID_PAGE_VIEW'));
}
$senderName = $gCurrentUser->getValue('FIRST_NAME') . ' ' . $gCurrentUser->getValue('LAST_NAME');
$senderEmail = $gCurrentUser->getValue('EMAIL');
if (isset($_POST['ecard_recipients']) == false || is_array($_POST['ecard_recipients'] == false)) {
    $_SESSION['ecard_request']['ecard_recipients'] = '';
    $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('SYS_TO')));
}
if (strlen($_POST['ecard_message']) == 0) {
    $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('SYS_MESSAGE')));
}
// Template wird geholt
$ecardDataToParse = $funcClass->getEcardTemplate($postTemplateName, $template);
// if template was not found then show error
if ($ecardDataToParse === '') {
    $gMessage($gL10n->get('SYS_MODULE_DISABLED'));
}
// check if user has right to send mail to selected roles and users
$arrayRoles = array();
$arrayUsers = array();
foreach ($_POST['ecard_recipients'] as $key => $value) {
    if (strpos($value, 'groupID') !== false) {
        $roleId = substr($value, 9);
        if ($gCurrentUser->hasRightSendMailToRole($roleId)) {
            $arrayRoles[] = $roleId;
        }
    } else {
        if ($gCurrentUser->hasRightViewProfile($value)) {
コード例 #2
0
$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">&times;</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>';