| 1 |
<?php |
| 2 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals. |
| 3 |
defined('ABSPATH') || die('Restricted Access'); |
| 4 |
|
| 5 |
use AcyMailing\Helpers\SecurityHelper; |
| 6 |
|
| 7 |
$formName = acym_getModuleFormName(); |
| 8 |
?> |
| 9 |
<div id="acym_fulldiv_<?php echo esc_attr($formName); ?>" class="acym_front_page <?php echo empty($data['suffix']) ? '' : esc_attr($data['suffix']); ?>"> |
| 10 |
<?php |
| 11 |
if (!empty($data['show_page_heading'])) { |
| 12 |
echo '<h1 class="contentheading'.esc_attr($data['suffix']).'">'.esc_html($data['page_heading']).'</h1>'; |
| 13 |
} |
| 14 |
|
| 15 |
if (!empty($data['introtext'])) { |
| 16 |
echo '<span class="acym_introtext">'.wp_kses( |
| 17 |
$data['introtext'], |
| 18 |
SecurityHelper::ALLOWED_HTML_INTRO |
| 19 |
).'</span>'; |
| 20 |
} |
| 21 |
?> |
| 22 |
|
| 23 |
<form enctype="multipart/form-data" |
| 24 |
action="<?php echo esc_url(acym_frontendLink('frontusers'.(acym_isNoTemplate() ? '&'.acym_noTemplate() : ''))); ?>" |
| 25 |
method="post" |
| 26 |
name="<?php echo esc_attr($formName); ?>" |
| 27 |
id="<?php echo esc_attr($formName); ?>" |
| 28 |
onsubmit="this.querySelector('input[type=submit]').click(); return false;" novalidate> |
| 29 |
<fieldset class="adminform acy_user_info"> |
| 30 |
<legend> |
| 31 |
<span> |
| 32 |
<?php |
| 33 |
echo wp_kses( |
| 34 |
acym_translation('ACYM_USER_INFORMATION'), |
| 35 |
SecurityHelper::ALLOWED_HTML_INTRO |
| 36 |
); |
| 37 |
?> |
| 38 |
</span> |
| 39 |
</legend> |
| 40 |
<div id="acyuserinfo"> |
| 41 |
<?php |
| 42 |
foreach ($data['fields'] as $field) { |
| 43 |
$field->option = !empty($field->option) ? json_decode($field->option) : new stdClass(); |
| 44 |
$fieldDB = empty($field->option->fieldDB) ? '' : json_decode($field->option->fieldDB); |
| 45 |
$field->value = empty($field->value) ? '' : json_decode($field->value); |
| 46 |
$valuesArray = []; |
| 47 |
if (!empty($field->value)) { |
| 48 |
foreach ($field->value as $value) { |
| 49 |
$valueTmp = new stdClass(); |
| 50 |
$valueTmp->text = $value->title; |
| 51 |
$valueTmp->value = $value->value; |
| 52 |
if ($value->disabled == 'y') { |
| 53 |
$valueTmp->disable = true; |
| 54 |
} |
| 55 |
$valuesArray[$value->value] = $valueTmp; |
| 56 |
} |
| 57 |
} |
| 58 |
if (!empty($fieldDB) && !empty($fieldDB->value)) { |
| 59 |
$fromDB = $data['fieldClass']->getValueFromDB($fieldDB); |
| 60 |
foreach ($fromDB as $value) { |
| 61 |
$valuesArray[$value->value] = $value->title; |
| 62 |
} |
| 63 |
} |
| 64 |
echo '<span class="onefield fieldacy'.esc_attr($field->id).'" id="field_'.esc_attr($field->id).'">'; |
| 65 |
|
| 66 |
$data['fieldClass']->displayField($field, $field->default_value, $valuesArray, true, true, $data['user']); |
| 67 |
echo '</span>'; |
| 68 |
|
| 69 |
if ($field->id == 2 && $this->config->get('email_confirmation')) { |
| 70 |
$data['fieldClass']->setEmailConfirmationField(true, $field, 'span', false); |
| 71 |
} |
| 72 |
} |
| 73 |
?> |
| 74 |
</div> |
| 75 |
|
| 76 |
<?php |
| 77 |
if ($this->config->get('user_tracking_control', 0) && !empty($data['user']->id)) { |
| 78 |
echo '<div class="onefield fieldacytracking" id="field_tracking_'.esc_attr($formName).'">'; |
| 79 |
echo '<label for="mailingdata_tracking_'.esc_attr($formName).'">'; |
| 80 |
echo '<input type="hidden" name="user[tracking]" value="0"/>'; |
| 81 |
echo '<input id="mailingdata_tracking_'.esc_attr( |
| 82 |
$formName |
| 83 |
).'" class="checkbox" type="checkbox" name="user[tracking]" value="1" '.((int)$data['user']->tracking === 1 ? 'checked="checked"' : '').'/> '.esc_html( |
| 84 |
acym_translation('ACYM_ALLOW_TRACKING') |
| 85 |
); |
| 86 |
echo '</label>'; |
| 87 |
echo '</div>'; |
| 88 |
} |
| 89 |
|
| 90 |
$exportButton = $this->config->get('gdpr_export', 0); |
| 91 |
$deleteButton = $this->config->get('gdpr_delete', 0); |
| 92 |
if (!empty($data['user']->id) && !(empty($exportButton) && empty($deleteButton))) { |
| 93 |
?> |
| 94 |
<div id="acyuseractions"> |
| 95 |
<table role="presentation"> |
| 96 |
<tr> |
| 97 |
<?php |
| 98 |
if ($exportButton == 1) { |
| 99 |
?> |
| 100 |
<td id="acybutton_subscriber_download_data" <?php if ($deleteButton == 1) { |
| 101 |
echo 'style="padding-right: 10px;"'; |
| 102 |
} ?>> |
| 103 |
<button class="btn btn-secondary button" onclick="this.form.task.value='exportdata'; this.form.submit(); return false;"> |
| 104 |
<?php echo esc_html(acym_translation('ACYM_EXPORT_MY_DATA')); ?> |
| 105 |
</button> |
| 106 |
</td> |
| 107 |
<?php |
| 108 |
} |
| 109 |
if ($deleteButton == 1) { |
| 110 |
?> |
| 111 |
<td id="acybutton_subscriber_delete_data"> |
| 112 |
<button class="btn btn-secondary button" |
| 113 |
onclick="if(confirm(ACYM_JS_TXT.ACYM_ARE_YOU_SURE + '\n' + ACYM_JS_TXT.ACYM_DELETE_MY_DATA_CONFIRM)){ this.form.task.value = 'gdprDelete'; this.form.submit(); } return false;"> |
| 114 |
<?php echo esc_html(acym_translation('ACYM_DELETE_MY_DATA')); ?> |
| 115 |
</button> |
| 116 |
</td> |
| 117 |
<?php |
| 118 |
} |
| 119 |
?> |
| 120 |
</tr> |
| 121 |
</table> |
| 122 |
</div> |
| 123 |
<?php } ?> |
| 124 |
</fieldset> |
| 125 |
<?php |
| 126 |
if ($data['displayLists']) { |
| 127 |
?> |
| 128 |
<fieldset class="adminform acy_subscription_list margin-bottom-1"> |
| 129 |
<legend><span><?php echo esc_html(acym_translation('ACYM_SUBSCRIPTION')); ?></span></legend> |
| 130 |
|
| 131 |
<div id="acyusersubscription"> |
| 132 |
<?php |
| 133 |
if (empty($data['dropdown'])) { |
| 134 |
$values = []; |
| 135 |
$values[0] = acym_selectOption('-1', 'ACYM_NO'); |
| 136 |
$values[1] = acym_selectOption('1', 'ACYM_YES'); |
| 137 |
$values[0]->class = 'btn-danger'; |
| 138 |
$values[1]->class = 'btn-success'; |
| 139 |
|
| 140 |
$k = 0; |
| 141 |
foreach ($data['subscription'] as $row) { |
| 142 |
if (empty($row->active) || !$row->visible) { |
| 143 |
continue; |
| 144 |
} |
| 145 |
if (empty($row->status)) { |
| 146 |
$row->status = -1; |
| 147 |
} |
| 148 |
|
| 149 |
echo '<div class="acym_list"> |
| 150 |
<div class="acystatus">'; |
| 151 |
acym_radio( |
| 152 |
$values, |
| 153 |
'data[listsub]['.$row->id.'][status]', |
| 154 |
$row->status, |
| 155 |
[], |
| 156 |
['id' => 'status'.$k++], |
| 157 |
true |
| 158 |
); |
| 159 |
echo '</div> |
| 160 |
<div class="list_name">'.esc_html(!empty($row->display_name) ? $row->display_name : $row->name).'</div> |
| 161 |
</div>'; |
| 162 |
} |
| 163 |
} else { |
| 164 |
$selectedIndex = ''; |
| 165 |
$k = 0; |
| 166 |
$dropdownOpts = []; |
| 167 |
foreach ($data['subscription'] as $key => $row) { |
| 168 |
if (empty($row->active) || !$row->visible) { |
| 169 |
continue; |
| 170 |
} |
| 171 |
|
| 172 |
$value = 0; |
| 173 |
$dropdownOpts[] = acym_selectOption($row->id, (!empty($row->display_name) ? $row->display_name : $row->name)); |
| 174 |
if ($row->status == 1) { |
| 175 |
$value = 1; |
| 176 |
$selectedIndex = $k; |
| 177 |
} |
| 178 |
echo '<input type="hidden" class="listsub-dropdown" name="data[listsub]['.esc_attr($row->id).'][status]" value="'.esc_attr($value).'">'; |
| 179 |
|
| 180 |
$k++; |
| 181 |
} |
| 182 |
|
| 183 |
acym_select($dropdownOpts, 'data[listsubdropdown]', $selectedIndex, null, 'value', 'text', null, false, true); |
| 184 |
} |
| 185 |
?> |
| 186 |
</div> |
| 187 |
</fieldset> |
| 188 |
<?php |
| 189 |
} |
| 190 |
|
| 191 |
if (empty($data['user']->id) && $data['config']->get('captcha', 'none') !== 'none' && !empty($data['captchaHelper'])) { |
| 192 |
echo '<div id="trcaptcha" class="acy_onefield">'; |
| 193 |
$data['captchaHelper']->display($formName); |
| 194 |
echo '</div>'; |
| 195 |
} |
| 196 |
|
| 197 |
if (!empty($data['source'])) { |
| 198 |
echo '<input type="hidden" name="acy_source" value="'.esc_attr($data['source']).'" />'; |
| 199 |
} |
| 200 |
|
| 201 |
// CMS specific things |
| 202 |
if (!empty($data['Itemid'])) { |
| 203 |
echo '<input type="hidden" name="Itemid" value="'.esc_attr($data['Itemid']).'" />'; |
| 204 |
} |
| 205 |
|
| 206 |
if (acym_isNoTemplate()) { |
| 207 |
echo '<input type="hidden" name="tmpl" value="component"/>'; |
| 208 |
} |
| 209 |
|
| 210 |
// Form params |
| 211 |
acym_formOptions(true, 'savechanges', '', 'frontusers'); |
| 212 |
|
| 213 |
if (isset($data['disableButtons']) && $data['disableButtons']) { |
| 214 |
$actionClick = 'return false;'; |
| 215 |
} else { |
| 216 |
$actionClick = 'return submitAcymForm(\'savechanges\',\''.$formName.'\', \'acym_checkChangeForm\');'; |
| 217 |
} |
| 218 |
?> |
| 219 |
|
| 220 |
<input type="hidden" name="hiddenlists" value="<?php echo esc_attr(implode(',', $data['hiddenlists'])); ?>" /> |
| 221 |
<input type="hidden" name="user[id]" value="<?php echo esc_attr($data['user']->id); ?>" /> |
| 222 |
<input type="hidden" name="userId" value="<?php echo esc_attr($data['user']->id); ?>" /> |
| 223 |
<input type="hidden" name="userKey" value="<?php echo esc_attr($data['user']->key ?? ''); ?>" /> |
| 224 |
<input type="hidden" name="ajax" value="1" /> |
| 225 |
<input type="hidden" name="acyprofile" value="1" /> |
| 226 |
|
| 227 |
<p class="acymodifybutton"> |
| 228 |
<button class="btn btn-primary" |
| 229 |
type="submit" |
| 230 |
onclick="<?php echo esc_attr($actionClick); ?>"> |
| 231 |
<?php echo esc_html(acym_translation(empty($data['user']->id) ? 'ACYM_SUBSCRIBE' : 'ACYM_SAVE_CHANGES')); ?> |
| 232 |
</button> |
| 233 |
</p> |
| 234 |
</form> |
| 235 |
<?php if (!empty($data['posttext'])) { |
| 236 |
echo '<span class="acym_posttext">'.wp_kses( |
| 237 |
$data['posttext'], |
| 238 |
SecurityHelper::ALLOWED_HTML_INTRO |
| 239 |
).'</span>'; |
| 240 |
} ?> |
| 241 |
</div> |
| 242 |
|