From 67e204a044077c2ad96685386aabaf6803a61d21 Mon Sep 17 00:00:00 2001 From: "Niklas (Krymonota)" Date: Thu, 6 Feb 2020 23:23:14 +0100 Subject: [PATCH] Remove \wcf\form\MailForm Resolves #3032 Closes #3151 [Tim: Squashed the initial pull request and rewrote the commit message] --- com.woltlab.wcf/page.xml | 16 +- com.woltlab.wcf/templates/mail.tpl | 84 ------- com.woltlab.wcf/templates/user.tpl | 2 - .../templates/userInformationButtons.tpl | 2 - com.woltlab.wcf/userGroupOption.xml | 8 +- com.woltlab.wcf/userOption.xml | 13 +- .../install/files/lib/form/MailForm.class.php | 215 ------------------ wcfsetup/install/lang/de.xml | 9 - wcfsetup/install/lang/en.xml | 9 - 9 files changed, 9 insertions(+), 349 deletions(-) delete mode 100644 com.woltlab.wcf/templates/mail.tpl delete mode 100644 wcfsetup/install/files/lib/form/MailForm.class.php diff --git a/com.woltlab.wcf/page.xml b/com.woltlab.wcf/page.xml index e9668807d6..ade42ac8e1 100644 --- a/com.woltlab.wcf/page.xml +++ b/com.woltlab.wcf/page.xml @@ -161,19 +161,6 @@ Kennwort vergessen - - system - wcf\form\MailForm - E-Mail-Formular - Mail Form - 1 - - Mail Form - - - E-Mail-Formular - - system wcf\form\NewPasswordForm @@ -822,4 +809,7 @@ E-Mail: [E-Mail-Adresse der verantwortlichen Stelle]


Verantwort + + + diff --git a/com.woltlab.wcf/templates/mail.tpl b/com.woltlab.wcf/templates/mail.tpl deleted file mode 100644 index 6c64a29bc4..0000000000 --- a/com.woltlab.wcf/templates/mail.tpl +++ /dev/null @@ -1,84 +0,0 @@ -{include file='header'} - -{include file='formError'} - -

-
-

{lang}wcf.user.mail.information{/lang}

- - -
-
- - {if $errorField == 'subject'} - - {if $errorType == 'empty'} - {lang}wcf.global.form.error.empty{/lang} - {else} - {lang}wcf.user.mail.subject.error.{@$errorType}{/lang} - {/if} - - {/if} -
- - - {if $__wcf->user->userID} -
-
-
-
- {else} - -
-
- - {if $errorField == 'email'} - - {if $errorType == 'empty'} - {lang}wcf.global.form.error.empty{/lang} - {elseif $errorType == 'invalid'} - {lang}wcf.user.email.error.invalid{/lang} - {else} - {lang}wcf.user.mail.senderEmail.error.{@$errorType}{/lang} - {/if} - - {/if} -
- - {/if} - - {event name='informationFields'} -
- -
-

{lang}wcf.user.mail.message{/lang}

- -
-
- - {if $errorField == 'message'} - - {if $errorType == 'empty'} - {lang}wcf.global.form.error.empty{/lang} - {else} - {lang}wcf.user.mail.message.error.{@$errorType}{/lang} - {/if} - - {/if} -
-
- - {event name='messageFields'} -
- - {event name='sections'} - - {include file='captcha' supportsAsyncCaptcha=true} - -
- - {@SECURITY_TOKEN_INPUT_TAG} -
-
- -{include file='footer'} diff --git a/com.woltlab.wcf/templates/user.tpl b/com.woltlab.wcf/templates/user.tpl index b69b4fad72..ccf92ba955 100644 --- a/com.woltlab.wcf/templates/user.tpl +++ b/com.woltlab.wcf/templates/user.tpl @@ -273,8 +273,6 @@ {if $user->userID != $__wcf->user->userID} {if $user->isAccessible('canViewEmailAddress') || $__wcf->session->getPermission('admin.user.canEditMailAddress')}
  • {lang}wcf.user.button.mail{/lang}
  • - {elseif $user->isAccessible('canMail') && $__wcf->session->getPermission('user.profile.canMail')} -
  • {lang}wcf.user.button.mail{/lang}
  • {/if} {/if} diff --git a/com.woltlab.wcf/templates/userInformationButtons.tpl b/com.woltlab.wcf/templates/userInformationButtons.tpl index baa38d23fb..7c0eb233dd 100644 --- a/com.woltlab.wcf/templates/userInformationButtons.tpl +++ b/com.woltlab.wcf/templates/userInformationButtons.tpl @@ -9,8 +9,6 @@ {if $user->userID != $__wcf->user->userID} {if $user->isAccessible('canViewEmailAddress')}
  • - {elseif $user->isAccessible('canMail') && $__wcf->session->getPermission('user.profile.canMail')} -
  • {/if} {/if} diff --git a/com.woltlab.wcf/userGroupOption.xml b/com.woltlab.wcf/userGroupOption.xml index 65b8422b99..b90c6b7aa2 100644 --- a/com.woltlab.wcf/userGroupOption.xml +++ b/com.woltlab.wcf/userGroupOption.xml @@ -663,11 +663,6 @@ pdf - + + diff --git a/com.woltlab.wcf/userOption.xml b/com.woltlab.wcf/userOption.xml index d327dff9a7..769aade42c 100644 --- a/com.woltlab.wcf/userOption.xml +++ b/com.woltlab.wcf/userOption.xml @@ -214,16 +214,6 @@ 0:wcf.user.access.everyone 1:wcf.user.access.registered 2:wcf.user.access.following -3:wcf.user.access.nobody - 3 - - @@ -247,4 +237,7 @@ + + diff --git a/wcfsetup/install/files/lib/form/MailForm.class.php b/wcfsetup/install/files/lib/form/MailForm.class.php deleted file mode 100644 index b78f626d0a..0000000000 --- a/wcfsetup/install/files/lib/form/MailForm.class.php +++ /dev/null @@ -1,215 +0,0 @@ - - * @package WoltLabSuite\Core\Form - */ -class MailForm extends AbstractCaptchaForm { - /** - * @inheritDoc - */ - public $useCaptcha = PROFILE_MAIL_USE_CAPTCHA; - - /** - * @inheritDoc - */ - public $forceCaptcha = true; - - /** - * recipient's user id - * @var integer - */ - public $userID = 0; - - /** - * recipient's user object - * @var UserProfile - */ - public $user = null; - - /** - * true to add the reply-to header - * @var boolean - */ - public $showAddress = true; - - /** - * email subject - * @var string - */ - public $subject = ''; - - /** - * email message - * @var string - */ - public $message = ''; - - /** - * sender's email address - * @var string - */ - public $email = ''; - - /** - * @inheritDoc - */ - public $neededPermissions = ['user.profile.canMail']; - - /** - * @inheritDoc - */ - public function readParameters() { - parent::readParameters(); - - if (isset($_REQUEST['id'])) $this->userID = intval($_REQUEST['id']); - $this->user = UserProfileRuntimeCache::getInstance()->getObject($this->userID); - if ($this->user === null) { - throw new IllegalLinkException(); - } - // validate ignore status - if (WCF::getUser()->userID && $this->user->isIgnoredUser(WCF::getUser()->userID)) { - throw new PermissionDeniedException(); - } - - $this->canonicalURL = LinkHandler::getInstance()->getLink('Mail', ['object' => $this->user->getDecoratedObject()]); - } - - /** - * @inheritDoc - */ - public function readFormParameters() { - parent::readFormParameters(); - - $this->showAddress = 0; - if (isset($_POST['message'])) $this->message = StringUtil::trim($_POST['message']); - if (isset($_POST['subject'])) $this->subject = StringUtil::trim($_POST['subject']); - if (isset($_POST['email'])) $this->email = StringUtil::trim($_POST['email']); - if (isset($_POST['showAddress'])) $this->showAddress = intval($_POST['showAddress']); - } - - /** - * @inheritDoc - */ - public function validate() { - if (!WCF::getUser()->userID) { - if (empty($this->email)) { - throw new UserInputException('email'); - } - - if (!UserUtil::isValidEmail($this->email)) { - throw new UserInputException('email', 'invalid'); - } - } - - if (empty($this->subject)) { - throw new UserInputException('subject'); - } - - if (empty($this->message)) { - throw new UserInputException('message'); - } - - parent::validate(); - } - - /** - * @inheritDoc - */ - public function save() { - parent::save(); - - // build message data - $messageData = [ - 'message' => $this->message, - 'username' => WCF::getUser()->userID ? WCF::getUser()->username : $this->email - ]; - - // build mail - $email = new Email(); - $email->addRecipient(new UserMailbox($this->user->getDecoratedObject())); - $email->setSubject($this->user->getLanguage()->getDynamicVariable('wcf.user.mail.mail.subject', [ - 'username' => WCF::getUser()->userID ? WCF::getUser()->username : $this->email, - 'subject' => $this->subject - ])); - $email->setBody(new MimePartFacade([ - new RecipientAwareTextMimePart('text/html', 'email_mail', 'wcf', $messageData), - new RecipientAwareTextMimePart('text/plain', 'email_mail', 'wcf', $messageData) - ])); - - // add reply-to tag - if (WCF::getUser()->userID) { - if ($this->showAddress) { - $email->setReplyTo(new UserMailbox(WCF::getUser())); - } - } - else { - $email->setReplyTo(new Mailbox($this->email)); - } - - // send mail - $email->send(); - $this->saved(); - - // forward to profile page - HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink('User', ['object' => $this->user]), WCF::getLanguage()->getDynamicVariable('wcf.user.mail.sent', ['user' => $this->user])); - exit; - } - - /** - * @inheritDoc - */ - public function readData() { - parent::readData(); - - PageLocationManager::getInstance()->addParentLocation('com.woltlab.wcf.User', $this->user->userID, $this->user); - if (MODULE_MEMBERS_LIST) PageLocationManager::getInstance()->addParentLocation('com.woltlab.wcf.MembersList'); - } - - /** - * @inheritDoc - */ - public function assignVariables() { - parent::assignVariables(); - - WCF::getTPL()->assign([ - 'user' => $this->user, - 'showAddress' => $this->showAddress, - 'message' => $this->message, - 'subject' => $this->subject, - 'email' => $this->email - ]); - } - - /** - * @inheritDoc - */ - public function show() { - if (!$this->user->isAccessible('canMail')) { - throw new PermissionDeniedException(); - } - - parent::show(); - } -} diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 04d7b158e0..c696031d5d 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -757,7 +757,6 @@ ACHTUNG: Die oben genannten Meldungen sind stark gekürzt. Sie können Details z - @@ -5192,7 +5191,6 @@ Benachrichtigungen auf {PAGE_TITLE|lang - @@ -5227,8 +5225,6 @@ Benachrichtigungen auf {PAGE_TITLE|lang getTitle()}“:]]> - - getUser()->username}, „{@$username}“ hat {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if} über die Website {@PAGE_TITLE|language} [URL:{link isEmail=true}{/link}] folgende Nachricht gesandt: @@ -5239,11 +5235,6 @@ Benachrichtigungen auf {PAGE_TITLE|lang

    „{$username}“ hat {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if} über die Website {PAGE_TITLE|language} folgende Nachricht gesandt:

    {@$message|newlineToBreak}

    ]]> - - - username} wurde erfolgreich versandt.]]> - - diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 7e9baf3f16..fec9ca4544 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -733,7 +733,6 @@ ATTENTION: The messages listed above are greatly shortened. You can view details - @@ -5190,7 +5189,6 @@ your notifications on {PAGE_TITLE|langu - @@ -5225,8 +5223,6 @@ your notifications on {PAGE_TITLE|langu getTitle()}”:]]> - - getUser()->username}, “{@$username}” sent you a message on {@PAGE_TITLE|language} [URL:{link isEmail=true}{/link}]: @@ -5237,11 +5233,6 @@ your notifications on {PAGE_TITLE|langu

    „{$username}“ sent you a message on {PAGE_TITLE|language}:

    {@$message|newlineToBreak}

    ]]> - - - username}.]]> - - -- 2.20.1