Skip to content

Commit 7b3a711

Browse files
authored
Merge pull request #6350 from WoltLab/6.2-account-templates-unsafe
Refactor account templates
2 parents f15c791 + ed6bb7f commit 7b3a711

13 files changed

+76
-71
lines changed

com.woltlab.wcf/templates/accountManagement.tpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{if $success|isset && $success|count > 0}
1010
<woltlab-core-notice type="success">
1111
{foreach from=$success item=successMessage}
12-
<p>{lang}{@$successMessage}{/lang}</p>
12+
<p>{lang}{$successMessage}{/lang}</p>
1313
{/foreach}
1414
</woltlab-core-notice>
1515
{/if}
@@ -30,7 +30,7 @@
3030
{if $errorType == 'empty'}
3131
{lang}wcf.global.form.error.empty{/lang}
3232
{else}
33-
{lang}wcf.user.password.error.{@$errorType}{/lang}
33+
{lang}wcf.user.password.error.{$errorType}{/lang}
3434
{/if}
3535
</small>
3636
{/if}
@@ -59,7 +59,7 @@
5959
{if $errorType == 'empty'}
6060
{lang}wcf.global.form.error.empty{/lang}
6161
{else}
62-
{lang}wcf.user.username.error.{@$errorType}{/lang}
62+
{lang}wcf.user.username.error.{$errorType}{/lang}
6363
{/if}
6464
</small>
6565
{/if}
@@ -87,7 +87,7 @@
8787
{if $errorType == 'empty'}
8888
{lang}wcf.global.form.error.empty{/lang}
8989
{else}
90-
{lang}wcf.user.password.error.{@$errorType}{/lang}
90+
{lang}wcf.user.password.error.{$errorType}{/lang}
9191
{/if}
9292
</small>
9393
{/if}
@@ -129,7 +129,7 @@
129129
{if $errorType == 'empty'}
130130
{lang}wcf.global.form.error.empty{/lang}
131131
{else}
132-
{lang}wcf.user.email.error.{@$errorType}{/lang}
132+
{lang}wcf.user.email.error.{$errorType}{/lang}
133133
{/if}
134134
</small>
135135
{/if}
@@ -182,9 +182,9 @@
182182
{content}
183183
{if $__authProvider}
184184
<dl>
185-
<dt>{lang}wcf.user.3rdparty.{@$__authProvider}{/lang}</dt>
185+
<dt>{lang}wcf.user.3rdparty.{$__authProvider}{/lang}</dt>
186186
<dd>
187-
<label><input type="checkbox" name="{@$__authProvider}Disconnect" value="1"> {lang}wcf.user.3rdparty.{@$__authProvider}.disconnect{/lang}</label>
187+
<label><input type="checkbox" name="{$__authProvider}Disconnect" value="1"> {lang}wcf.user.3rdparty.{$__authProvider}.disconnect{/lang}</label>
188188
</dd>
189189
</dl>
190190
{elseif !$__wcf->getUser()->hasAdministrativeAccess()}

com.woltlab.wcf/templates/accountSecurity.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
</h3>
4040

4141
{if $enabledMultifactorMethods[$method->objectTypeID]|isset}
42-
{@$method->getProcessor()->getStatusText($enabledMultifactorMethods[$method->objectTypeID])}
42+
{unsafe:$method->getProcessor()->getStatusText($enabledMultifactorMethods[$method->objectTypeID])}
4343
{else}
4444
{lang}wcf.user.security.multifactor.{$method->objectType}.description{/lang}
4545
{/if}
@@ -88,7 +88,7 @@
8888

8989
<dl class="plain inlineDataList small">
9090
<dt>{lang}wcf.user.security.lastActivity{/lang}</dt>
91-
<dd>{if $session->isCurrentSession()}{lang}wcf.user.security.currentSession{/lang}{else}{@$session->getLastActivityTime()|time}{/if}</dd>
91+
<dd>{if $session->isCurrentSession()}{lang}wcf.user.security.currentSession{/lang}{else}{time time=$session->getLastActivityTime()}{/if}</dd>
9292

9393
<dt>{lang}wcf.user.security.ipAddress{/lang}</dt>
9494
<dd title="{$session->getIpAddress()}">{$session->getIpAddress()->toBulletMasked(16, 48)}</dd>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{include file='authFlowHeader'}
22

3-
{@$form->getHtml()}
3+
{unsafe:$form->getHtml()}
44

55
{include file='authFlowFooter'}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<div class="section">
22
<dl class="wide">
33
<dd>
4-
<label><input type="radio" name="subscribe" value="1"{if $userObjectWatch} checked{/if}> {lang}wcf.user.objectWatch.subscribe.{@$objectType->objectType}{/lang}</label>
4+
<label><input type="radio" name="subscribe" value="1"{if $userObjectWatch} checked{/if}> {lang}wcf.user.objectWatch.subscribe.{$objectType->objectType}{/lang}</label>
55

6-
<small><label><input type="checkbox" name="enableNotification" value="1"{if $userObjectWatch && $userObjectWatch->notification} checked{/if}> {lang}wcf.user.objectWatch.enableNotification.{@$objectType->objectType}{/lang}</label></small>
6+
<small><label><input type="checkbox" name="enableNotification" value="1"{if $userObjectWatch && $userObjectWatch->notification} checked{/if}> {lang}wcf.user.objectWatch.enableNotification.{$objectType->objectType}{/lang}</label></small>
77
</dd>
88
</dl>
99
<dl class="wide">
1010
<dd>
11-
<label><input type="radio" name="subscribe" value="0"{if !$userObjectWatch} checked{/if}> {lang}wcf.user.objectWatch.unsubscribe.{@$objectType->objectType}{/lang}</label>
11+
<label><input type="radio" name="subscribe" value="0"{if !$userObjectWatch} checked{/if}> {lang}wcf.user.objectWatch.unsubscribe.{$objectType->objectType}{/lang}</label>
1212
</dd>
1313
</dl>
1414

@@ -17,4 +17,4 @@
1717

1818
<div class="formSubmit">
1919
<button type="button" class="button jsButtonSave buttonPrimary">{lang}wcf.global.button.save{/lang}</button>
20-
</div>
20+
</div>

com.woltlab.wcf/templates/newPassword.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
<woltlab-core-notice type="info">{lang}wcf.user.newPassword.info{/lang}</woltlab-core-notice>
44

5-
{@$form->getHtml()}
5+
{unsafe:$form->getHtml()}
66

77
<script data-relocate="true">
88
require(['WoltLabSuite/Core/Ui/User/PasswordStrength', 'Language'], (PasswordStrength, Language) => {
99
{include file='shared_passwordStrengthLanguage'}
1010
1111
new PasswordStrength(document.getElementById('newPassword'), {
1212
staticDictionary: [
13-
'{$user->username|encodeJS}',
14-
'{$user->email|encodeJS}',
13+
'{unsafe:$user->username|encodeJS}',
14+
'{unsafe:$user->email|encodeJS}',
1515
]
1616
});
1717
})

com.woltlab.wcf/templates/notificationList.tpl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
{/capture}
66

77
{capture assign='contentInteractionPagination'}
8-
{pages print=true assign=pagesLinks controller='NotificationList' link="pageNo=%d"}
8+
{if $pages > 1}
9+
<woltlab-core-pagination page="{$pageNo}" count="{$pages}" url="{link controller='NotificationList'}{/link}"></woltlab-core-pagination>
10+
{/if}
911
{/capture}
1012

1113
{capture assign='contentInteractionButtons'}
@@ -84,11 +86,11 @@
8486
</section>
8587

8688
<footer class="contentFooter">
87-
{hascontent}
89+
{if $pages > 1}
8890
<div class="paginationBottom">
89-
{content}{unsafe:$pagesLinks}{/content}
91+
<woltlab-core-pagination page="{$pageNo}" count="{$pages}" url="{link controller='NotificationList'}{/link}"></woltlab-core-pagination>
9092
</div>
91-
{/hascontent}
93+
{/if}
9294

9395
{hascontent}
9496
<nav class="contentFooterNavigation">

com.woltlab.wcf/templates/notificationSettings.tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@
2424
{foreach from=$eventList item=event}
2525
<div class="notificationSettingsItem">
2626
<div class="notificationSettingsEvent">
27-
<label for="settings_{@$event->eventID}">{lang}wcf.user.notification.{$event->objectType}.{$event->eventName}{/lang}</label>
27+
<label for="settings_{$event->eventID}">{lang}wcf.user.notification.{$event->objectType}.{$event->eventName}{/lang}</label>
2828
</div>
2929
<div class="notificationSettingsState">
3030
<label>
31-
<input type="checkbox" id="settings_{@$event->eventID}" name="settings[{@$event->eventID}][enabled]" class="jsCheckboxNotificationSettingsState" value="1" data-object-id="{@$event->eventID}"{if !$settings[$event->eventID][enabled]|empty} checked{/if}>
31+
<input type="checkbox" id="settings_{$event->eventID}" name="settings[{$event->eventID}][enabled]" class="jsCheckboxNotificationSettingsState" value="1" data-object-id="{$event->eventID}"{if !$settings[$event->eventID][enabled]|empty} checked{/if}>
3232
{icon size=24 name='bell' type='solid'}
3333
{icon size=24 name='bell-slash'}
3434
</label>
3535
</div>
3636
<div class="notificationSettingsEmail">
3737
{if $event->supportsEmailNotification()}
38-
<input type="hidden" id="settings_{$event->eventID}_mailNotificationType" name="settings[{@$event->eventID}][mailNotificationType]" value="{$settings[$event->eventID][mailNotificationType]}">
39-
<button type="button" class="notificationSettingsEmailType jsTooltip{if $settings[$event->eventID][enabled]|empty} disabled{/if}" title="{lang}wcf.user.notification.mailNotificationType.{@$settings[$event->eventID][mailNotificationType]}{/lang}" data-object-id="{@$event->eventID}">
38+
<input type="hidden" id="settings_{$event->eventID}_mailNotificationType" name="settings[{$event->eventID}][mailNotificationType]" value="{$settings[$event->eventID][mailNotificationType]}">
39+
<button type="button" class="notificationSettingsEmailType jsTooltip{if $settings[$event->eventID][enabled]|empty} disabled{/if}" title="{lang}wcf.user.notification.mailNotificationType.{$settings[$event->eventID][mailNotificationType]}{/lang}" data-object-id="{$event->eventID}">
4040
<span class="jsIconNotificationSettingsEmailType">
4141
{if $settings[$event->eventID][mailNotificationType] === 'none'}
4242
{icon size=24 name='xmark'}

com.woltlab.wcf/templates/paidSubscriptionList.tpl

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
{capture assign='headContent'}
22
{if PAID_SUBSCRIPTION_ENABLE_TOS_CONFIRMATION}
33
<script data-relocate="true">
4-
$(function() {
5-
$('#tosConfirmed').change(function () {
6-
if ($('#tosConfirmed').is(':checked')) {
7-
$('.paidSubscriptionList button').enable();
4+
{
5+
const tosCheckbox = document.getElementById('tosConfirmed');
6+
const buttons = document.querySelectorAll('.paidSubscriptionList button');
7+
if (tosCheckbox) {
8+
function toggleButtons () {
9+
buttons.forEach(function(button) {
10+
button.disabled = !tosCheckbox.checked;
11+
});
812
}
9-
else {
10-
$('.paidSubscriptionList button').disable();
11-
}
12-
});
13-
$('#tosConfirmed').change();
14-
});
13+
14+
tosCheckbox.addEventListener('change', toggleButtons);
15+
toggleButtons();
16+
}
17+
}
1518
</script>
1619

1720
<noscript>
@@ -42,13 +45,13 @@
4245
<li>
4346
<div class="containerHeadline">
4447
<h3>{$subscription->getTitle()} <span class="badge label">{lang}wcf.paidSubscription.formattedCost{/lang}</span></h3>
45-
<div class="htmlContent">{@$subscription->getFormattedDescription()}</div>
48+
<div class="htmlContent">{unsafe:$subscription->getFormattedDescription()}</div>
4649
</div>
4750

4851
<div class="containerContent">
4952
<ul class="buttonList">
5053
{foreach from=$subscription->getPurchaseButtons() item=button}
51-
<li>{@$button}</li>
54+
<li>{unsafe:$button}</li>
5255
{/foreach}
5356
</ul>
5457
</div>
@@ -67,14 +70,14 @@
6770
<li>
6871
<div class="containerHeadline">
6972
<h3>{$userSubscription->getSubscription()->getTitle()}</h3>
70-
<div class="htmlContent">{@$userSubscription->getSubscription()->getFormattedDescription()}</div>
73+
<div class="htmlContent">{unsafe:$userSubscription->getSubscription()->getFormattedDescription()}</div>
7174
</div>
7275

7376
{if $userSubscription->endDate}
7477
<div class="containerContent">
7578
<dl class="plain inlineDataList">
7679
<dt>{lang}wcf.paidSubscription.expires{/lang}</dt>
77-
<dd>{@$userSubscription->endDate|time}</dd>
80+
<dd>{time time=$userSubscription->endDate}</dd>
7881
</dl>
7982
</div>
8083
{/if}

com.woltlab.wcf/templates/reauthentication.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
<woltlab-core-notice type="info">{lang}wcf.user.reauthentication.explanation{/lang}</woltlab-core-notice>
44

5-
{@$form->getHtml()}
5+
{unsafe:$form->getHtml()}
66

77
{include file='authFlowFooter'}

com.woltlab.wcf/templates/register.tpl

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
<div class="section">
4040
<dl{if $errorType[username]|isset} class="formError"{/if}>
4141
<dt>
42-
<label for="{@$randomFieldNames[username]}">{lang}wcf.user.username{/lang}</label> <span class="formFieldRequired">*</span>
42+
<label for="{$randomFieldNames[username]}">{lang}wcf.user.username{/lang}</label> <span class="formFieldRequired">*</span>
4343
</dt>
4444
<dd>
4545
<input
4646
type="text"
47-
id="{@$randomFieldNames[username]}"
48-
name="{@$randomFieldNames[username]}"
47+
id="{$randomFieldNames[username]}"
48+
name="{$randomFieldNames[username]}"
4949
value="{$username}"
5050
required
5151
class="long"
@@ -67,13 +67,13 @@
6767

6868
<dl{if $errorType[email]|isset} class="formError"{/if}>
6969
<dt>
70-
<label for="{@$randomFieldNames[email]}">{lang}wcf.user.email{/lang}</label> <span class="formFieldRequired">*</span>
70+
<label for="{$randomFieldNames[email]}">{lang}wcf.user.email{/lang}</label> <span class="formFieldRequired">*</span>
7171
</dt>
7272
<dd>
7373
<input
7474
type="email"
75-
id="{@$randomFieldNames[email]}"
76-
name="{@$randomFieldNames[email]}"
75+
id="{$randomFieldNames[email]}"
76+
name="{$randomFieldNames[email]}"
7777
value="{$email}"
7878
required
7979
class="long"
@@ -95,13 +95,13 @@
9595
{if !$isExternalAuthentication}
9696
<dl{if $errorType[password]|isset} class="formError"{/if}>
9797
<dt>
98-
<label for="{@$randomFieldNames[password]}">{lang}wcf.user.password{/lang}</label> <span class="formFieldRequired">*</span>
98+
<label for="{$randomFieldNames[password]}">{lang}wcf.user.password{/lang}</label> <span class="formFieldRequired">*</span>
9999
</dt>
100100
<dd>
101101
<input
102102
type="password"
103-
id="{@$randomFieldNames[password]}"
104-
name="{@$randomFieldNames[password]}"
103+
id="{$randomFieldNames[password]}"
104+
name="{$randomFieldNames[password]}"
105105
value="{$password}"
106106
required
107107
class="long"
@@ -130,14 +130,14 @@
130130
require(['WoltLabSuite/Core/Language/Chooser'], ({ init }) => {
131131
const languages = {
132132
{implode from=$availableLanguages item=language}
133-
'{@$language->languageID}': {
134-
iconPath: '{@$language->getIconPath()|encodeJS}',
135-
languageName: '{@$language|encodeJS}'
133+
'{$language->languageID}': {
134+
iconPath: '{unsafe:$language->getIconPath()|encodeJS}',
135+
languageName: '{unsafe:$language|encodeJS}'
136136
}
137137
{/implode}
138138
};
139139
140-
init('languageIDContainer', 'languageID', {@$languageID}, languages);
140+
init('languageIDContainer', 'languageID', {$languageID}, languages);
141141
});
142142
</script>
143143
<noscript>
@@ -214,22 +214,22 @@
214214
{jsphrase name='wcf.user.email.error.notUnique'}
215215
216216
setup(
217-
document.getElementById('{@$randomFieldNames[username]}'),
218-
document.getElementById('{@$randomFieldNames[email]}'),
219-
document.getElementById('{@$randomFieldNames[password]}'),
217+
document.getElementById('{unsafe:$randomFieldNames[username]|encodeJS}'),
218+
document.getElementById('{unsafe:$randomFieldNames[email]|encodeJS}'),
219+
document.getElementById('{unsafe:$randomFieldNames[password]|encodeJS}'),
220220
{
221-
minlength: {@REGISTER_USERNAME_MIN_LENGTH},
222-
maxlength: {@REGISTER_USERNAME_MAX_LENGTH}
221+
minlength: {REGISTER_USERNAME_MIN_LENGTH},
222+
maxlength: {REGISTER_USERNAME_MAX_LENGTH}
223223
}
224224
);
225225
});
226226
require(['WoltLabSuite/Core/Ui/User/PasswordStrength', 'Language'], (PasswordStrength, Language) => {
227227
{include file='shared_passwordStrengthLanguage'}
228228
229-
new PasswordStrength(document.getElementById('{@$randomFieldNames[password]}'), {
229+
new PasswordStrength(document.getElementById('{unsafe:$randomFieldNames[password]|encodeJS}'), {
230230
relatedInputs: [
231-
document.getElementById('{@$randomFieldNames[username]}'),
232-
document.getElementById('{@$randomFieldNames[email]}')
231+
document.getElementById('{unsafe:$randomFieldNames[username]|encodeJS}'),
232+
document.getElementById('{unsafe:$randomFieldNames[email]|encodeJS}')
233233
]
234234
});
235235
});

0 commit comments

Comments
 (0)