Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix usage of forbidden functions in templates #5621

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion com.woltlab.wcf/templates/aclPermissionJavaScript.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{if $categoryName|isset && $categoryName|str_ends_with:'.*'}
{assign var='__categoryNameStart' value=$categoryName|substr:0:-1}
{assign var='__categoryNameStart' value=$categoryName|mb_substr:0:-1}
{/if}
<script data-relocate="true">
$(function() {
Expand Down
8 changes: 2 additions & 6 deletions com.woltlab.wcf/templates/email_dailyNotification.tpl
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{assign var='maximum' value=7}
{if $notifications|count == $maximum + 1}{assign var='maximum' value=$maximum + 1}{/if}
{assign var='remaining' value=$notifications|count}
{assign var='remaining' value=$remaining-$maximum}
{if $mimeType === 'text/plain'}
{capture assign='content'}
{lang}wcf.user.notification.mail.daily.plaintext.intro{/lang}

---------------

{implode from=$notifications|array_slice:0:$maximum item='notification' glue="\n---------------\n\n"}
{implode from=$notifications item='notification' glue="\n---------------\n\n"}
{assign var='event' value=$notification[event]}
{assign var='notificationContent' value=$notification[notificationContent]}
{assign var='notificationType' value=$notification[notificationType]}
Expand All @@ -24,7 +20,7 @@
{capture assign='content'}
{lang}wcf.user.notification.mail.daily.html.intro{/lang}

{foreach from=$notifications|array_slice:0:$maximum item='notification'}
{foreach from=$notifications item='notification'}
{assign var='event' value=$notification[event]}
{assign var='notificationContent' value=$notification[notificationContent]}
{assign var='notificationType' value=$notification[notificationType]}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{if $categoryName|isset && $categoryName|str_ends_with:'.*'}
{assign var='__categoryNameStart' value=$categoryName|substr:0:-1}
{assign var='__categoryNameStart' value=$categoryName|mb_substr:0:-1}
{/if}
<script data-relocate="true">
$(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,35 @@ public function execute(Cronjob $cronjob)
true
);

$maximumNotificationCount = 7;
$notificationCount = \count($notifications);
if ($notificationCount === $maximumNotificationCount + 1) {
$maximumNotificationCount++;
}
$remainingNotificationCount = $notificationCount - $maximumNotificationCount;
$notifications = \array_slice($notifications, 0, $maximumNotificationCount);

$html = new RecipientAwareTextMimePart(
'text/html',
'email_dailyNotification',
'wcf',
['notifications' => $notifications]
[
'notifications' => $notifications,
'remaining' => $remainingNotificationCount,
'maximum' => $maximumNotificationCount,
'notificationCount' => $notificationCount,
]
);
$plainText = new RecipientAwareTextMimePart(
'text/plain',
'email_dailyNotification',
'wcf',
['notifications' => $notifications]
[
'notifications' => $notifications,
'remaining' => $remainingNotificationCount,
'maximum' => $maximumNotificationCount,
'notificationCount' => $notificationCount,
]
);
$email->setBody(new MimePartFacade([$html, $plainText]));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function execute(Cronjob $cronjob)
$email->setBody(new PlainTextMimePart($language->getDynamicVariable('wcf.acp.exceptionLog.email.body', [
'date' => $timestamp,
'files' => $files,
'logPath' => WCF_DIR . 'log/',
])));
$email->send();
RegistryHandler::getInstance()->set('com.woltlab.wcf', 'exceptionMailerTimestamp', TIME_NOW);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,10 @@ protected function addFormFields(IFormDocument $form)
TextFormField::create('iconPath')
->objectProperty('wysiwygicon')
->label('wcf.acp.pip.bbcode.iconPath')
->description('wcf.acp.pip.bbcode.iconPath.description')
->description(
'wcf.acp.pip.bbcode.iconPath.description',
['path' => WCF_DIR . 'icon/']
)
->required()
->maximumLength(255)
->addValidator(new FormFieldValidator('fileExists', static function (TextFormField $formField) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,21 @@ function (ItemListFormField $formField) use ($smileyCodes) {
TextFormField::create('smileyPath')
->objectProperty('path')
->label('wcf.acp.pip.smiley.smileyPath')
->description('wcf.acp.pip.smiley.smileyPath.description')
->description(
'wcf.acp.pip.smiley.smileyPath.description',
['path' => WCF_DIR]
)
->required()
->maximumLength(255)
->addValidator($fileValidator),

TextFormField::create('smileyPath2x')
->objectProperty('path2x')
->label('wcf.acp.pip.smiley.smileyPath2x')
->description('wcf.acp.pip.smiley.smileyPath2x.description')
->description(
'wcf.acp.pip.smiley.smileyPath2x.description',
['path' => WCF_DIR]
)
->maximumLength(255)
->addValidator($fileValidator),
]);
Expand Down
18 changes: 9 additions & 9 deletions wcfsetup/install/lang/de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,9 @@ log/{$file}.txt{if !$data[verdict]|isset} ({#$data[count]} Fehlermeldung{if $dat
==================
{if $data[verdict]|isset}
{if $data[verdict] == 'corrupt'}
Das Fehlerprotokoll ist defekt. Bitte prüfen Sie das Protokoll händisch: {'WCF_DIR'|constant}log/{$file}.txt
Das Fehlerprotokoll ist defekt. Bitte prüfen Sie das Protokoll händisch: {$logPath}{$file}.txt
{elseif $data[verdict] == 'huge'}
Das Fehlerprotokoll ist sehr groß. Bitte prüfen Sie das Protokoll händisch: {'WCF_DIR'|constant}log/{$file}.txt
Das Fehlerprotokoll ist sehr groß. Bitte prüfen Sie das Protokoll händisch: {$logPath}{$file}.txt
{/if}
{else}
{foreach from=$data[messages] item=message}
Expand Down Expand Up @@ -2262,7 +2262,7 @@ Die Datenbestände werden sorgfältig gepflegt, aber es ist nicht ausgeschlossen
<item name="wcf.acp.pip.bbcode.htmlOpen.error.leadingBracket"><![CDATA[Das Tag darf nicht mit einer spitzen Klammer beginnen.]]></item>
<item name="wcf.acp.pip.bbcode.htmlOpen.error.trailingBracket"><![CDATA[Das Tag darf nicht mit einer spitzen Klammer enden.]]></item>
<item name="wcf.acp.pip.bbcode.iconPath"><![CDATA[Pfad zur Icon-Datei]]></item>
<item name="wcf.acp.pip.bbcode.iconPath.description"><![CDATA[Der angegebene Pfad muss relativ zu <kbd>{'WCF_DIR'|constant}icon/</kbd> sein.]]></item>
<item name="wcf.acp.pip.bbcode.iconPath.description"><![CDATA[Der angegebene Pfad muss relativ zu <kbd>{$path}</kbd> sein.]]></item>
<item name="wcf.acp.pip.bbcode.iconPath.error.fileDoesNotExist"><![CDATA[Die angegebene Datei existiert nicht.]]></item>
<item name="wcf.acp.pip.bbcode.iconType"><![CDATA[Button-Icon-Typ]]></item>
<item name="wcf.acp.pip.bbcode.iconType.filePath"><![CDATA[Bild]]></item>
Expand Down Expand Up @@ -2401,10 +2401,10 @@ Die Datenbestände werden sorgfältig gepflegt, aber es ist nicht ausgeschlossen
<item name="wcf.acp.pip.smiley.smileyCode.description"><![CDATA[Primärer Smiley-Code, der in dieses Smiley umgewandelt wird.]]></item>
<item name="wcf.acp.pip.smiley.smileyCode.error.notUnique"><![CDATA[Der angegebene Smiley-Code wird bereits von einem anderen Smiley verwendet.]]></item>
<item name="wcf.acp.pip.smiley.smileyPath"><![CDATA[Smiley-Pfad]]></item>
<item name="wcf.acp.pip.smiley.smileyPath.description"><![CDATA[Der angegebene Pfad muss relativ zu <kbd>{'WCF_DIR'|constant}</kbd> sein.]]></item>
<item name="wcf.acp.pip.smiley.smileyPath.description"><![CDATA[Der angegebene Pfad muss relativ zu <kbd>{$path}</kbd> sein.]]></item>
<item name="wcf.acp.pip.smiley.smileyPath.error.fileDoesNotExist"><![CDATA[Die angegebene Datei existiert nicht.]]></item>
<item name="wcf.acp.pip.smiley.smileyPath2x"><![CDATA[Smiley-Pfad (HD)]]></item>
<item name="wcf.acp.pip.smiley.smileyPath2x.description"><![CDATA[Der angegebene Pfad muss relativ zu <kbd>{'WCF_DIR'|constant}</kbd> sein.]]></item>
<item name="wcf.acp.pip.smiley.smileyPath2x.description"><![CDATA[Der angegebene Pfad muss relativ zu <kbd>{$path}</kbd> sein.]]></item>
<item name="wcf.acp.pip.option.optionName.error.notUnique"><![CDATA[Der angegebene Optionsname wird bereits von einer anderen Option verwendet.]]></item>
<item name="wcf.acp.pip.option.options.hidden"><![CDATA[Versteckte Option]]></item>
<item name="wcf.acp.pip.option.options.hidden.description"><![CDATA[Der Wert der Option kann vom Administrator nicht über die Administrationsoberfläche selbst geändert werden.]]></item>
Expand Down Expand Up @@ -5320,8 +5320,8 @@ Benachrichtigungen auf <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|phra
<item name="wcf.user.notification.mail.daily.subject"><![CDATA[{if $count == 1}Neue Benachrichtigung{else}{#$count} neue Benachrichtigungen{/if}]]></item>
<item name="wcf.user.notification.mail.daily.plaintext.intro"><![CDATA[Hallo {@$mailbox->getUser()->username},

{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} derzeit insgesamt {#$notifications|count} ungelesene Benachrichtigung{if $notifications|count != 1}en{/if}, die älter als 24 Stunden {if $notifications|count == 1}ist{else}sind{/if}:]]></item>
<item name="wcf.user.notification.mail.daily.plaintext.outro"><![CDATA[{if $notifications|count > $maximum}{if LANGUAGE_USE_INFORMAL_VARIANT}Besuche deine{else}Besuchen Sie Ihre{/if} Benachrichtigungs-Übersicht [URL:{link controller='NotificationList' isEmail=true}{/link}], um auch die restlichen {#$remaining} Benachrichtigungen einzusehen.
{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} derzeit insgesamt {#$notificationCount} ungelesene Benachrichtigung{if $notificationCount != 1}en{/if}, die älter als 24 Stunden {if $notificationCount == 1}ist{else}sind{/if}:]]></item>
<item name="wcf.user.notification.mail.daily.plaintext.outro"><![CDATA[{if $remaining}{if LANGUAGE_USE_INFORMAL_VARIANT}Besuche deine{else}Besuchen Sie Ihre{/if} Benachrichtigungs-Übersicht [URL:{link controller='NotificationList' isEmail=true}{/link}], um auch die restlichen {#$remaining} Benachrichtigungen einzusehen.

{/if}Diese E-Mail ist eine automatische Benachrichtigung. BITTE {if LANGUAGE_USE_INFORMAL_VARIANT}ANTWORTE{else}ANTWORTEN SIE{/if} NICHT AUF DIESE E-MAIL.

Expand All @@ -5331,8 +5331,8 @@ Benachrichtigungen auf {@PAGE_TITLE|phrase} [URL:{link isEmail=true}{/link}] nac
Wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du{else}Sie{/if} keine E-Mail-Benachrichtigungen mehr erhalten {if LANGUAGE_USE_INFORMAL_VARIANT}möchtest{else}möchten{/if}, dann {if LANGUAGE_USE_INFORMAL_VARIANT}kannst du{else}können Sie{/if} diese direkt abbestellen: {link controller='NotificationUnsubscribe' isEmail=true}userID={@$mailbox->getUser()->userID}&token={@$mailbox->getUser()->notificationMailToken}{/link}.]]></item>
<item name="wcf.user.notification.mail.daily.html.intro"><![CDATA[<h2>Hallo {@$mailbox->getUser()->username},</h2>

<p>{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} derzeit insgesamt {#$notifications|count} ungelesene Benachrichtigung{if $notifications|count != 1}en{/if}, die älter als 24 Stunden {if $notifications|count == 1}ist{else}sind{/if}:</p>]]></item>
<item name="wcf.user.notification.mail.daily.html.outro"><![CDATA[{if $notifications|count > $maximum}<p>{if LANGUAGE_USE_INFORMAL_VARIANT}Besuche{else}Besuchen Sie{/if} <a href="{link controller='NotificationList' isHtmlEmail=true}{/link}">{if LANGUAGE_USE_INFORMAL_VARIANT}deine{else}Ihre{/if} Benachrichtigungs-Übersicht</a>, um auch die restlichen {#$remaining} Benachrichtigungen einzusehen.</p>{/if}
<p>{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} derzeit insgesamt {#$notificationCount} ungelesene Benachrichtigung{if $notificationCount != 1}en{/if}, die älter als 24 Stunden {if $notificationCount == 1}ist{else}sind{/if}:</p>]]></item>
<item name="wcf.user.notification.mail.daily.html.outro"><![CDATA[{if $remaining}<p>{if LANGUAGE_USE_INFORMAL_VARIANT}Besuche{else}Besuchen Sie{/if} <a href="{link controller='NotificationList' isHtmlEmail=true}{/link}">{if LANGUAGE_USE_INFORMAL_VARIANT}deine{else}Ihre{/if} Benachrichtigungs-Übersicht</a>, um auch die restlichen {#$remaining} Benachrichtigungen einzusehen.</p>{/if}

<p>Diese E-Mail ist eine automatische Benachrichtigung. <b>Bitte {if LANGUAGE_USE_INFORMAL_VARIANT}antworte{else}antworten Sie{/if} nicht auf diese E-Mail</b>.</p>

Expand Down
18 changes: 9 additions & 9 deletions wcfsetup/install/lang/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,9 @@ log/{$file}.txt{if !$data[verdict]|isset} ({#$data[count]} error{if $data[count]
==================
{if $data[verdict]|isset}
{if $data[verdict] == 'corrupt'}
This protocol file is corrupted. Please check the protocol manually: {'WCF_DIR'|constant}log/{$file}.txt
This protocol file is corrupted. Please check the protocol manually: {$logPath}{$file}.txt
{elseif $data[verdict] == 'huge'}
This protocol file is very large. Please check the protocol manually: {'WCF_DIR'|constant}log/{$file}.txt
This protocol file is very large. Please check the protocol manually: {$logPath}{$file}.txt
{/if}
{else}
{foreach from=$data[messages] item=message}
Expand Down Expand Up @@ -2458,7 +2458,7 @@ If you have <strong>already bought the licenses for the listed apps</strong>, th
<item name="wcf.acp.pip.bbcode.iconType.filePath"><![CDATA[Image]]></item>
<item name="wcf.acp.pip.bbcode.iconType.fontAwesome"><![CDATA[FontAwesome Icon]]></item>
<item name="wcf.acp.pip.bbcode.iconPath"><![CDATA[Path to icon file]]></item>
<item name="wcf.acp.pip.bbcode.iconPath.description"><![CDATA[The entered path has to be relative to <kbd>{'WCF_DIR'|constant}icon/</kbd>.]]></item>
<item name="wcf.acp.pip.bbcode.iconPath.description"><![CDATA[The entered path has to be relative to <kbd>{$path}</kbd>.]]></item>
<item name="wcf.acp.pip.bbcode.iconPath.error.fileDoesNotExist"><![CDATA[The entered file does not exist.]]></item>
<item name="wcf.acp.pip.bbcode.wysiwygIcon"><![CDATA[Icon]]></item>
<item name="wcf.acp.pip.smiley.smileyCode"><![CDATA[Primary Smiley Code]]></item>
Expand All @@ -2469,10 +2469,10 @@ If you have <strong>already bought the licenses for the listed apps</strong>, th
<item name="wcf.acp.pip.smiley.aliases.error.notUnique"><![CDATA[The following aliases are already used by another smiley: {implode from=$notUniqueCodes item=notUniqueCode}<kbd>{$notUniqueCode}</kbd>{/implode}.]]></item>
<item name="wcf.acp.pip.smiley.showOrder.description"><![CDATA[The entered value determines in which order the smilies are shown.]]></item>
<item name="wcf.acp.pip.smiley.smileyPath"><![CDATA[Smiley Path]]></item>
<item name="wcf.acp.pip.smiley.smileyPath.description"><![CDATA[The entered path has to be relative to <kbd>{'WCF_DIR'|constant}</kbd>.]]></item>
<item name="wcf.acp.pip.smiley.smileyPath.description"><![CDATA[The entered path has to be relative to <kbd>{$path}</kbd>.]]></item>
<item name="wcf.acp.pip.smiley.smileyPath.error.fileDoesNotExist"><![CDATA[The entered file does not exist.]]></item>
<item name="wcf.acp.pip.smiley.smileyPath2x"><![CDATA[HD Smiley Path]]></item>
<item name="wcf.acp.pip.smiley.smileyPath2x.description"><![CDATA[The entered path has to be relative to <kbd>{'WCF_DIR'|constant}</kbd>.]]></item>
<item name="wcf.acp.pip.smiley.smileyPath2x.description"><![CDATA[The entered path has to be relative to <kbd>{$path}</kbd>.]]></item>
<item name="wcf.acp.pip.userGroupOption.options.usersOnly"><![CDATA[Members Only]]></item>
<item name="wcf.acp.pip.userGroupOption.options.usersOnly.description"><![CDATA[The user group option is only available for registered members-only user groups.]]></item>
<item name="wcf.acp.pip.userGroupOption.options.optionType.description"><![CDATA[The option type determines the interface with which the value of the user group option is set and which (types of) values the option may have. Additionally, the option type also determines how the final option value is determined if a user is in multiple user groups with different option values.]]></item>
Expand Down Expand Up @@ -5323,8 +5323,8 @@ your notifications on <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|phras
<item name="wcf.user.notification.mail.daily.subject"><![CDATA[{if $count == 1}New Notification{else}{#$count} New Notifications{/if}]]></item>
<item name="wcf.user.notification.mail.daily.plaintext.intro"><![CDATA[Dear {@$mailbox->getUser()->username},

You currently have {#$notifications|count} unread notification{if $notifications|count != 1}s{/if} older than 24 hours:]]></item>
<item name="wcf.user.notification.mail.daily.plaintext.outro"><![CDATA[{if $notifications|count > $maximum}Visit your notification list [URL:{link controller='NotificationList' isEmail=true}{/link}] to view the remaining {#$remaining} notifications.
You currently have {#$notificationCount} unread notification{if $notificationCount != 1}s{/if} older than 24 hours:]]></item>
<item name="wcf.user.notification.mail.daily.plaintext.outro"><![CDATA[{if $remaining}Visit your notification list [URL:{link controller='NotificationList' isEmail=true}{/link}] to view the remaining {#$remaining} notifications.

{/if}This is an automatic notification, PLEASE DO NOT REPLY TO THIS EMAIL!

Expand All @@ -5335,8 +5335,8 @@ If you wish to disable all email notifications you can do so by visiting:
{link controller='NotificationUnsubscribe' isEmail=true}userID={@$mailbox->getUser()->userID}&token={@$mailbox->getUser()->notificationMailToken}{/link}]]></item>
<item name="wcf.user.notification.mail.daily.html.intro"><![CDATA[<h2>Dear {$mailbox->getUser()->username},</h2>

<p>You currently have {#$notifications|count} unread notification{if $notifications|count != 1}s{/if} older than 24 hours:</p>]]></item>
<item name="wcf.user.notification.mail.daily.html.outro"><![CDATA[<p>{if $notifications|count > $maximum}Visit your <a href="{link controller='NotificationList' isHtmlEmail=true}{/link}">notification list</a> to view the remaining {#$remaining} notifications.</p>{/if}
<p>You currently have {#$notificationCount} unread notification{if $notificationCount != 1}s{/if} older than 24 hours:</p>]]></item>
<item name="wcf.user.notification.mail.daily.html.outro"><![CDATA[<p>{if $remaining}Visit your <a href="{link controller='NotificationList' isHtmlEmail=true}{/link}">notification list</a> to view the remaining {#$remaining} notifications.</p>{/if}

<p>This is an automatic notification, <b>please do not reply to this email</b>!</p>

Expand Down
Loading