Skip to content

Commit

Permalink
Merge branch '5.5' of https://github.com/WoltLab/WCF into 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntimeX committed Oct 21, 2024
2 parents 9d555b2 + 6234fb3 commit 932795b
Show file tree
Hide file tree
Showing 22 changed files with 138 additions and 16 deletions.
6 changes: 3 additions & 3 deletions com.woltlab.wcf/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<packagedescription>Free CMS and web-framework, designed for awesome websites and communities.</packagedescription>
<packagedescription language="de">Freies CMS und Web-Framework, das eindrucksvolle Websites und Communities ermöglicht.</packagedescription>
<isapplication>1</isapplication>
<version>5.5.21</version>
<date>2024-04-22</date>
<version>5.5.23</version>
<date>2024-09-13</date>
</packageinformation>

<authorinformation>
Expand Down Expand Up @@ -50,7 +50,7 @@
<instruction type="script">acp/post_install.php</instruction>
</instructions>

<instructions type="update" fromversion="5.5.20">
<instructions type="update" fromversion="5.5.22">
<instruction type="file">files_update.tar</instruction>
</instructions>
</package>
4 changes: 4 additions & 0 deletions com.woltlab.wcf/templates/articleAdd.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@
<small class="innerError">
{if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang}
{elseif $errorType == 'disallowedBBCodes'}
{lang}wcf.message.error.disallowedBBCodes{/lang}
{else}
{lang}wcf.acp.article.content.error.{@$errorType}{/lang}
{/if}
Expand Down Expand Up @@ -539,6 +541,8 @@
<small class="innerError">
{if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang}
{elseif $errorType == 'disallowedBBCodes'}
{lang}wcf.message.error.disallowedBBCodes{/lang}
{else}
{lang}wcf.acp.article.content.error.{@$errorType}{/lang}
{/if}
Expand Down
1 change: 1 addition & 0 deletions ts/WoltLabSuite/Core/Date/Picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,7 @@ const DatePicker = {
const data = _data.get(element) as DatePickerData;

element.dataset.value = date.getTime().toString();
element.dataset.empty = "false";

let format = "";
let value: string;
Expand Down
14 changes: 14 additions & 0 deletions ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ function onScroll() {
});
}

/**
* Recalculates drop-down positions on page resize.
*/
function onWindowResize() {
_dropdowns.forEach((dropdown, containerId) => {
if (!dropdown.classList.contains("dropdownOpen")) {
return;
}

UiDropdownSimple.setAlignment(dropdown, _menus.get(containerId)!);
});
}

/**
* Notifies callbacks on status change.
*/
Expand Down Expand Up @@ -379,6 +392,7 @@ const UiDropdownSimple = {
DomChangeListener.add("WoltLabSuite/Core/Ui/Dropdown/Simple", () => UiDropdownSimple.initAll());

document.addEventListener("scroll", onScroll);
window.addEventListener("resize", () => onWindowResize(), { passive: true });

// expose on window object for backward compatibility
window.bc_wcfSimpleDropdown = this;
Expand Down
14 changes: 14 additions & 0 deletions ts/WoltLabSuite/Core/Ui/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ function initSearchBar(): void {

_pageHeaderSearchMobile?.setAttribute("aria-expanded", "false");
});

window.addEventListener(
"resize",
() => {
if (_isMobile || !_pageHeader.classList.contains("searchBarOpen")) {
return;
}

UiAlignment.set(_pageHeaderSearch, _topMenu, {
horizontal: "right",
});
},
{ passive: true },
);
}

function initMobileSearch(): void {
Expand Down
12 changes: 12 additions & 0 deletions ts/WoltLabSuite/Core/Ui/User/Menu/ControlPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ export function setup(): void {

element.addEventListener("click", (event) => event.stopPropagation());

window.addEventListener(
"resize",
() => {
if (element.hidden) {
return;
}

setAlignment(element, button);
},
{ passive: true },
);

button.addEventListener("click", (event) => {
event.preventDefault();
event.stopPropagation();
Expand Down
4 changes: 4 additions & 0 deletions wcfsetup/install/files/acp/templates/articleAdd.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@
<small class="innerError">
{if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang}
{elseif $errorType == 'disallowedBBCodes'}
{lang}wcf.message.error.disallowedBBCodes{/lang}
{else}
{lang}wcf.acp.article.content.error.{@$errorType}{/lang}
{/if}
Expand Down Expand Up @@ -532,6 +534,8 @@
<small class="innerError">
{if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang}
{elseif $errorType == 'disallowedBBCodes'}
{lang}wcf.message.error.disallowedBBCodes{/lang}
{else}
{lang}wcf.acp.article.content.error.{@$errorType}{/lang}
{/if}
Expand Down
3 changes: 2 additions & 1 deletion wcfsetup/install/files/js/WCF.User.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,13 +790,14 @@ if (COMPILER_TARGET_DEFAULT) {
*/
_beginEdit: function (event) {
if (event) event.preventDefault();

$("#profileContent").wcfTabs("select", "about");

if (this._active) return;
this._active = true;

this._actionName = 'beginEdit';
this._buttons.beginEdit.parent().addClass('active');
$('#profileContent').wcfTabs('select', 'about');

// load form
this._proxy.setOption('data', {
Expand Down
4 changes: 2 additions & 2 deletions wcfsetup/install/files/js/WoltLabSuite.Core.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions wcfsetup/install/files/js/WoltLabSuite.Core.tiny.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions wcfsetup/install/files/js/WoltLabSuite/Core/Date/Picker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use wcf\data\smiley\SmileyCache;
use wcf\data\user\User;
use wcf\form\AbstractForm;
use wcf\system\bbcode\BBCodeHandler;
use wcf\system\cache\builder\ArticleCategoryLabelCacheBuilder;
use wcf\system\exception\UserInputException;
use wcf\system\html\input\HtmlInputProcessor;
Expand Down Expand Up @@ -394,6 +395,8 @@ public function validate()
}
}

$this->setDisallowedBBCodes();

if ($this->isMultilingual) {
foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
// title
Expand All @@ -411,6 +414,12 @@ public function validate()
'com.woltlab.wcf.article.content',
0
);

$disallowedBBCodes = $this->htmlInputProcessors[$language->languageID]->validate();
if (!empty($disallowedBBCodes)) {
WCF::getTPL()->assign('disallowedBBCodes', $disallowedBBCodes);
throw new UserInputException('content', 'disallowedBBCodes');
}
}
} else {
// title
Expand All @@ -424,6 +433,12 @@ public function validate()

$this->htmlInputProcessors[0] = new HtmlInputProcessor();
$this->htmlInputProcessors[0]->process($this->content[0], 'com.woltlab.wcf.article.content', 0);

$disallowedBBCodes = $this->htmlInputProcessors[0]->validate();
if (!empty($disallowedBBCodes)) {
WCF::getTPL()->assign('disallowedBBCodes', $disallowedBBCodes);
throw new UserInputException('content', 'disallowedBBCodes');
}
}

$this->validateLabelIDs();
Expand Down Expand Up @@ -569,6 +584,8 @@ public function readData()
}
}
}

$this->setDisallowedBBCodes();
}

/**
Expand Down Expand Up @@ -625,4 +642,14 @@ public function assignVariables()
'labelGroupsToCategories' => $this->labelGroupsToCategories,
]);
}

protected function setDisallowedBBCodes(): void
{
BBCodeHandler::getInstance()->setDisallowedBBCodes(
\explode(
',',
WCF::getSession()->getPermission('user.message.disallowedBBCodes')
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,24 @@ public function save()
{
AbstractForm::save();

$overrideKey = \sprintf(
"%s\0upgradeOverride_%s",
PackageUpdateServer::class,
WCF::AVAILABLE_UPGRADE_VERSION,
);

$formData = $this->form->getData();
if ($formData['data']['enable']) {
$this->isEnabled = true;
RegistryHandler::getInstance()->set('com.woltlab.wcf', PackageUpdateServer::class . "\0upgradeOverride", \TIME_NOW);
RegistryHandler::getInstance()->set('com.woltlab.wcf', $overrideKey, \TIME_NOW);
} else {
$this->isEnabled = false;
RegistryHandler::getInstance()->delete('com.woltlab.wcf', PackageUpdateServer::class . "\0upgradeOverride");
RegistryHandler::getInstance()->delete('com.woltlab.wcf', $overrideKey);
}

// Clear the legacy override.
RegistryHandler::getInstance()->delete('com.woltlab.wcf', PackageUpdateServer::class . "\0upgradeOverride");

PackageUpdateServer::resetAll();

$this->form->cleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function readData()
RegistryHandler::getInstance()->set('com.woltlab.wcf', 'exceptionMailerTimestamp', TIME_NOW);

$fileNameRegex = new Regex('(?:^|/)\d{4}-\d{2}-\d{2}\.txt$');
$this->logFiles = DirectoryUtil::getInstance(WCF_DIR . 'log/')->getFiles(\SORT_DESC, $fileNameRegex);
$this->logFiles = DirectoryUtil::getInstance(WCF_DIR . 'log/', false)->getFiles(\SORT_DESC, $fileNameRegex);

if ($this->exceptionID) {
// search the appropriate file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,19 @@ final public static function isUpgradeOverrideEnabled()
return false;
}

$override = RegistryHandler::getInstance()->get('com.woltlab.wcf', self::class . "\0upgradeOverride");
$overrideKey = \sprintf(
"%s\0upgradeOverride_%s",
self::class,
WCF::AVAILABLE_UPGRADE_VERSION,
);
$override = RegistryHandler::getInstance()->get('com.woltlab.wcf', $overrideKey);

if (!$override) {
return false;
}

if ($override < TIME_NOW - 86400) {
RegistryHandler::getInstance()->delete('com.woltlab.wcf', self::class . "\0upgradeOverride");
RegistryHandler::getInstance()->delete('com.woltlab.wcf', $overrideKey);

// Clear package list cache to actually stop the upgrade from happening.
self::resetAll();
Expand Down
2 changes: 1 addition & 1 deletion wcfsetup/install/files/lib/system/WCF.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}

// define current woltlab suite version
\define('WCF_VERSION', '5.5.21');
\define('WCF_VERSION', '5.5.23');

// define current API version
// @deprecated 5.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ public function mark(array $objectIDs, $objectTypeID)
*/
public function unmark(array $objectIDs, $objectTypeID)
{
if ($objectIDs === []) {
return;
}

$conditions = new PreparedStatementConditionBuilder();
$conditions->add("objectTypeID = ?", [$objectTypeID]);
$conditions->add("objectID IN (?)", [$objectIDs]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function parse(HtmlInputProcessor $htmlInputProcessor, array $embeddedDat
}
}

return $mediaIDs;
return \array_unique($mediaIDs);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public function parse(HtmlInputProcessor $htmlInputProcessor, array $embeddedDat
}
}

return $unfurlUrlIDs;
return \array_unique($unfurlUrlIDs);
}
}

0 comments on commit 932795b

Please sign in to comment.