| 1 |
<?php |
| 2 |
|
| 3 |
use AcyMailing\Helpers\CaptchaHelper; |
| 4 |
|
| 5 |
$listsContent = ''; |
| 6 |
if (!empty($visibleLists)) { |
| 7 |
$listsContent .= '<div class="acym_lists">'; |
| 8 |
foreach ($visibleLists as $myListId) { |
| 9 |
$check = ''; |
| 10 |
if (in_array($myListId, $checkedLists)) { |
| 11 |
$check = 'checked="checked"'; |
| 12 |
} |
| 13 |
|
| 14 |
$listsContent .= ' |
| 15 |
<div class="onelist"> |
| 16 |
<input type="checkbox" class="acym_checkbox" name="subscription[]" id="acylist_'.$myListId.'_'.$formName.'" '.$check.' value="'.$myListId.'"/> |
| 17 |
<label for="acylist_'.$myListId.'_'.$formName.'">'.(!empty($allLists[$myListId]->display_name) ? $allLists[$myListId]->display_name : $allLists[$myListId]->name).'</label> |
| 18 |
</div>'; |
| 19 |
} |
| 20 |
$listsContent .= '</div>'; |
| 21 |
} |
| 22 |
if ($listPosition == 'before') echo $listsContent; |
| 23 |
?> |
| 24 |
|
| 25 |
<div class="acym_form"> |
| 26 |
<?php |
| 27 |
foreach ($fields as $field) { |
| 28 |
$field->option = json_decode($field->option); |
| 29 |
$fieldDB = empty($field->option->fieldDB) ? '' : json_decode($field->option->fieldDB); |
| 30 |
$field->value = empty($field->value) ? '' : json_decode($field->value); |
| 31 |
$valuesArray = []; |
| 32 |
if (!empty($field->value)) { |
| 33 |
foreach ($field->value as $value) { |
| 34 |
$valueTmp = new stdClass(); |
| 35 |
$valueTmp->text = $value->title; |
| 36 |
$valueTmp->value = $value->value; |
| 37 |
if ($value->disabled == 'y') $valueTmp->disable = true; |
| 38 |
$valuesArray[$value->value] = $valueTmp; |
| 39 |
} |
| 40 |
} |
| 41 |
if (!empty($fieldDB) && !empty($fieldDB->value)) { |
| 42 |
$fromDB = $fieldClass->getValueFromDB($fieldDB); |
| 43 |
foreach ($fromDB as $value) { |
| 44 |
$valuesArray[$value->value] = $value->title; |
| 45 |
} |
| 46 |
} |
| 47 |
$size = empty($field->option->size) ? '' : 'width:'.$field->option->size.'px'; |
| 48 |
echo '<div class="onefield fieldacy'.$field->id.' acyfield_'.$field->type.'" id="field_'.$field->id.'">'; |
| 49 |
echo $fieldClass->displayField($field, $field->default_value, $size, $valuesArray, $displayOutside, true, $identifiedUser); |
| 50 |
echo '</div>'; |
| 51 |
|
| 52 |
if ($field->id == 2 && $config->get('email_confirmation')) { |
| 53 |
echo $fieldClass->setEmailConfirmationField($displayOutside, $size); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
if ($listPosition != 'before') echo $listsContent; |
| 58 |
|
| 59 |
if (empty($identifiedUser->id) && $config->get('captcha', 'none') !== 'none' && acym_level(ACYM_ESSENTIAL)) { |
| 60 |
echo '<div class="onefield fieldacycaptcha" id="field_captcha_'.$formName.'">'; |
| 61 |
$captcha = new CaptchaHelper(); |
| 62 |
echo $captcha->display($formName); |
| 63 |
echo '</div>'; |
| 64 |
} |
| 65 |
|
| 66 |
if (!empty($termslink)) { |
| 67 |
echo '<div class="onefield fieldacyterms" id="field_terms_'.$formName.'">'; |
| 68 |
echo '<label for="mailingdata_terms_'.$formName.'">'; |
| 69 |
echo '<input id="mailingdata_terms_'.$formName.'" class="checkbox" type="checkbox" name="terms" title="'.acym_translation('ACYM_TERMS_CONDITIONS').'"/> '.$termslink; |
| 70 |
echo '</label>'; |
| 71 |
echo '</div>'; |
| 72 |
} |
| 73 |
?> |
| 74 |
</div> |
| 75 |
|
| 76 |
<p class="acysubbuttons"> |
| 77 |
<noscript> |
| 78 |
<?php echo acym_translation('ACYM_NO_JAVASCRIPT'); ?> |
| 79 |
</noscript> |
| 80 |
<?php |
| 81 |
$onclickSubscribe = 'try{ return submitAcymForm("subscribe","'.$formName.'", "acymSubmitSubForm"); }catch(err){alert("The form could not be submitted "+err);return false;}'; |
| 82 |
$onclickUnsubscribe = 'try{ return submitAcymForm("unsubscribe","'.$formName.'", "acymSubmitSubForm"); }catch(err){alert("The form could not be submitted "+err);return false;}'; |
| 83 |
?> |
| 84 |
<input type="button" |
| 85 |
class="btn btn-primary button subbutton" |
| 86 |
value="<?php echo acym_translation($subscribeText, true); ?>" |
| 87 |
name="Submit" |
| 88 |
onclick="<?php echo $disableButtons ? 'return true' : acym_escape($onclickSubscribe); ?>" /> |
| 89 |
<?php if ($unsubButton === '2' || ($unsubButton === '1' && !empty($countUnsub))) { ?> |
| 90 |
<span style="display: none;"></span> |
| 91 |
<input type="button" |
| 92 |
class="btn button unsubbutton" |
| 93 |
value="<?php echo acym_translation($unsubscribeText, true); ?>" |
| 94 |
name="Submit" |
| 95 |
onclick="<?php echo $disableButtons ? 'return true' : acym_escape($onclickUnsubscribe); ?>" /> |
| 96 |
<?php } ?> |
| 97 |
</p> |
| 98 |
|