From bc7adcda6be815367889eaa8cdecf851119009e4 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 19 Jul 2016 13:17:22 +0200 Subject: [PATCH] Updated signature implementation --- .../lib/form/SignatureEditForm.class.php | 28 +++---------------- .../user/signature/SignatureCache.class.php | 18 +++++++++--- wcfsetup/setup/db/install.sql | 2 -- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/wcfsetup/install/files/lib/form/SignatureEditForm.class.php b/wcfsetup/install/files/lib/form/SignatureEditForm.class.php index 61920f643f..ece637f04f 100644 --- a/wcfsetup/install/files/lib/form/SignatureEditForm.class.php +++ b/wcfsetup/install/files/lib/form/SignatureEditForm.class.php @@ -35,28 +35,14 @@ class SignatureEditForm extends MessageForm { * parsed signature cache * @var string */ - public $signatureCache = null; + public $signatureCache; /** + * TODO: this is still missing * @inheritDoc */ public $allowedBBCodesPermission = 'user.signature.allowedBBCodes'; - /** - * @inheritDoc - */ - public $permissionCanUseSmilies = 'user.signature.canUseSmilies'; - - /** - * @inheritDoc - */ - public $permissionCanUseHtml = 'user.signature.canUseHtml'; - - /** - * @inheritDoc - */ - public $permissionCanUseBBCodes = 'user.signature.canUseBBCodes'; - /** * @inheritDoc */ @@ -93,11 +79,7 @@ class SignatureEditForm extends MessageForm { // default values if (empty($_POST)) { - $this->enableBBCodes = WCF::getUser()->signatureEnableBBCodes; - $this->enableHtml = WCF::getUser()->signatureEnableHtml; - $this->enableSmilies = WCF::getUser()->signatureEnableSmilies; $this->text = WCF::getUser()->signature; - $this->preParse = true; } $this->signatureCache = SignatureCache::getInstance()->getSignature(WCF::getUser()); @@ -132,10 +114,8 @@ class SignatureEditForm extends MessageForm { $this->objectAction = new UserAction([WCF::getUser()], 'update', [ 'data' => array_merge($this->additionalFields, [ - 'signature' => $this->text, - 'signatureEnableBBCodes' => $this->enableBBCodes, - 'signatureEnableHtml' => $this->enableHtml, - 'signatureEnableSmilies' => $this->enableSmilies + 'signature' => $this->htmlInputProcessor->getHtml(), + 'signatureEnableHtml' => 1 ]) ]); $this->objectAction->executeAction(); diff --git a/wcfsetup/install/files/lib/system/user/signature/SignatureCache.class.php b/wcfsetup/install/files/lib/system/user/signature/SignatureCache.class.php index 6ee773deec..1e1dc6e7fd 100644 --- a/wcfsetup/install/files/lib/system/user/signature/SignatureCache.class.php +++ b/wcfsetup/install/files/lib/system/user/signature/SignatureCache.class.php @@ -1,7 +1,7 @@ signatures[$user->userID])) { - $this->signatures[$user->userID] = MessageParser::getInstance()->parse($user->signature, $user->signatureEnableSmilies, $user->signatureEnableHtml, $user->signatureEnableBBCodes, false); + if ($this->htmlOutputProcessor === null) { + $this->htmlOutputProcessor = new HtmlOutputProcessor(); + } + + $this->htmlOutputProcessor->process($user->signature, 'com.woltlab.wcf.userSignature', $user->userID); + $this->signatures[$user->userID] = $this->htmlOutputProcessor->getHtml(); } return $this->signatures[$user->userID]; diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index ec3def5723..772844eb00 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -1287,9 +1287,7 @@ CREATE TABLE wcf1_user ( enableGravatar TINYINT(1) NOT NULL DEFAULT 0, gravatarFileExtension VARCHAR(3) NOT NULL DEFAULT '', signature TEXT, - signatureEnableBBCodes TINYINT(1) NOT NULL DEFAULT 1, signatureEnableHtml TINYINT(1) NOT NULL DEFAULT 0, - signatureEnableSmilies TINYINT(1) NOT NULL DEFAULT 1, disableSignature TINYINT(1) NOT NULL DEFAULT 0, disableSignatureReason TEXT, disableSignatureExpires INT(10) NOT NULL DEFAULT 0, -- 2.20.1