Remove \wcf\form\MailForm
authorNiklas (Krymonota) <Krymonota@users.noreply.github.com>
Thu, 6 Feb 2020 22:23:14 +0000 (23:23 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Sat, 23 May 2020 14:17:31 +0000 (16:17 +0200)
Resolves #3032
Closes #3151

[Tim: Squashed the initial pull request and rewrote the commit message]

com.woltlab.wcf/page.xml
com.woltlab.wcf/templates/mail.tpl [deleted file]
com.woltlab.wcf/templates/user.tpl
com.woltlab.wcf/templates/userInformationButtons.tpl
com.woltlab.wcf/userGroupOption.xml
com.woltlab.wcf/userOption.xml
wcfsetup/install/files/lib/form/MailForm.class.php [deleted file]
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index e9668807d60bcbd75943b9670c6a4c5babb45f57..ade42ac8e1a992338be5e944a49dd87353750306 100644 (file)
                                <title>Kennwort vergessen</title>
                        </content>
                </page>
-               <page identifier="com.woltlab.wcf.Mail">
-                       <pageType>system</pageType>
-                       <controller>wcf\form\MailForm</controller>
-                       <name language="de">E-Mail-Formular</name>
-                       <name language="en">Mail Form</name>
-                       <requireObjectID>1</requireObjectID>
-                       <content language="en">
-                               <title>Mail Form</title>
-                       </content>
-                       <content language="de">
-                               <title>E-Mail-Formular</title>
-                       </content>
-               </page>
                <page identifier="com.woltlab.wcf.NewPassword">
                        <pageType>system</pageType>
                        <controller>wcf\form\NewPasswordForm</controller>
@@ -822,4 +809,7 @@ E-Mail: [E-Mail-Adresse der verantwortlichen Stelle]</p><p><br></p><p>Verantwort
                        </content>
                </page>
        </import>
+       <delete>
+               <page identifier="com.woltlab.wcf.Mail" />
+       </delete>
 </data>
diff --git a/com.woltlab.wcf/templates/mail.tpl b/com.woltlab.wcf/templates/mail.tpl
deleted file mode 100644 (file)
index 6c64a29..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-{include file='header'}
-
-{include file='formError'}
-
-<form method="post" action="{link controller='Mail' object=$user}{/link}">
-       <section class="section">
-               <h2 class="sectionTitle">{lang}wcf.user.mail.information{/lang}</h2>
-               
-               <dl{if $errorField == 'subject'} class="formError"{/if}>
-                       <dt><label for="subject">{lang}wcf.user.mail.subject{/lang}</label></dt>
-                       <dd>
-                               <input type="text" id="subject" name="subject" value="{$subject}" required class="long">
-                               {if $errorField == 'subject'}
-                                       <small class="innerError">
-                                               {if $errorType == 'empty'}
-                                                       {lang}wcf.global.form.error.empty{/lang}
-                                               {else}
-                                                       {lang}wcf.user.mail.subject.error.{@$errorType}{/lang}
-                                               {/if}
-                                       </small>
-                               {/if}
-                       </dd>
-               </dl>
-               
-               {if $__wcf->user->userID}
-                       <dl>
-                               <dt></dt>
-                               <dd><label><input type="checkbox" name="showAddress" value="1"{if $showAddress == 1} checked{/if}> {lang}wcf.user.mail.showAddress{/lang}</label></dd>
-                       </dl>
-               {else}
-                       <dl{if $errorField == 'email'} class="formError"{/if}>
-                               <dt><label for="email">{lang}wcf.user.mail.senderEmail{/lang}</label></dt>
-                               <dd>
-                                       <input type="email" id="email" name="email" value="{$email}" required class="medium">
-                                       {if $errorField == 'email'}
-                                               <small class="innerError">
-                                                       {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}
-                                               </small>
-                                       {/if}
-                               </dd>
-                       </dl>
-               {/if}
-               
-               {event name='informationFields'}
-       </section>
-       
-       <section class="section">
-               <h2 class="sectionTitle">{lang}wcf.user.mail.message{/lang}</h2>
-               
-               <dl class="wide{if $errorField == 'message'} formError{/if}">
-                       <dd>
-                               <textarea rows="15" cols="40" name="message" id="message" required>{$message}</textarea>
-                               {if $errorField == 'message'}
-                                       <small class="innerError">
-                                               {if $errorType == 'empty'}
-                                                       {lang}wcf.global.form.error.empty{/lang}
-                                               {else}
-                                                       {lang}wcf.user.mail.message.error.{@$errorType}{/lang}
-                                               {/if}
-                                       </small>
-                               {/if}
-                       </dd>
-               </dl>
-               
-               {event name='messageFields'}
-       </section>
-       
-       {event name='sections'}
-       
-       {include file='captcha' supportsAsyncCaptcha=true}
-       
-       <div class="formSubmit">
-               <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
-               {@SECURITY_TOKEN_INPUT_TAG}
-       </div>
-</form>
-
-{include file='footer'}
index b69b4fad726dc10572cdd76b402b3405c8e82f08..ccf92ba95538ade89c1fd59e46c100a857aeb7c9 100644 (file)
                                                                {if $user->userID != $__wcf->user->userID}
                                                                        {if $user->isAccessible('canViewEmailAddress') || $__wcf->session->getPermission('admin.user.canEditMailAddress')}
                                                                                <li><a href="mailto:{@$user->getEncodedEmail()}">{lang}wcf.user.button.mail{/lang}</a></li>
-                                                                       {elseif $user->isAccessible('canMail') && $__wcf->session->getPermission('user.profile.canMail')}
-                                                                               <li><a href="{link controller='Mail' object=$user}{/link}">{lang}wcf.user.button.mail{/lang}</a></li>
                                                                        {/if}
                                                                {/if}
                                                                
index baa38d23fb69a2c6c15080fce826c8b33d644ce6..7c0eb233dd8e371ef0a663e13f324acc92ef6e57 100644 (file)
@@ -9,8 +9,6 @@
                                {if $user->userID != $__wcf->user->userID}
                                        {if $user->isAccessible('canViewEmailAddress')}
                                                <li><a class="jsTooltip" href="mailto:{@$user->getEncodedEmail()}" title="{lang}wcf.user.button.mail{/lang}"><span class="icon icon16 fa-envelope-o"></span> <span class="invisible">{lang}wcf.user.button.mail{/lang}</span></a></li>
-                                       {elseif $user->isAccessible('canMail') && $__wcf->session->getPermission('user.profile.canMail')}
-                                               <li><a class="jsTooltip" href="{link controller='Mail' object=$user}{/link}" title="{lang}wcf.user.button.mail{/lang}"><span class="icon icon16 fa-envelope-o"></span> <span class="invisible">{lang}wcf.user.button.mail{/lang}</span></a></li>
                                        {/if}
                                {/if}
                                
index 65b8422b994d2a7fcfd8e7ee18dd49efd5b0f131..b90c6b7aa2c3f54f04d6e731469fae371ca2c4de 100644 (file)
@@ -663,11 +663,6 @@ pdf</defaultvalue>
                        </option>
                        <!-- /user.signature -->
                        <!-- user.profile -->
-                       <option name="user.profile.canMail">
-                               <categoryname>user.profile</categoryname>
-                               <optiontype>boolean</optiontype>
-                               <defaultvalue>0</defaultvalue>
-                       </option>
                        <option name="user.profile.canChangeEmail">
                                <categoryname>user.profile</categoryname>
                                <optiontype>boolean</optiontype>
@@ -1010,4 +1005,7 @@ png</defaultvalue>
                        </option>
                </options>
        </import>
+       <delete>
+               <option name="user.profile.canMail" />
+       </delete>
 </data>
index d327dff9a7f36c6254d7fcada573f6cd5d0dbf18..769aade42c8018b5e6ee95a3622ba71a49dcc62e 100644 (file)
                                <selectoptions>0:wcf.user.access.everyone
 1:wcf.user.access.registered
 2:wcf.user.access.following
-3:wcf.user.access.nobody</selectoptions>
-                               <editable>3</editable>
-                       </option>
-                       <option name="canMail">
-                               <categoryname>settings.privacy.messaging</categoryname>
-                               <optiontype>select</optiontype>
-                               <defaultvalue>1</defaultvalue>
-                               <selectoptions>0:wcf.user.access.everyone
-1:wcf.user.access.registered
-2:wcf.user.access.following
 3:wcf.user.access.nobody</selectoptions>
                                <editable>3</editable>
                        </option>
                        </option>
                </options>
        </import>
+       <delete>
+               <option name="canMail" />
+       </delete>
 </data>
diff --git a/wcfsetup/install/files/lib/form/MailForm.class.php b/wcfsetup/install/files/lib/form/MailForm.class.php
deleted file mode 100644 (file)
index b78f626..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-<?php
-namespace wcf\form;
-use wcf\data\user\UserProfile;
-use wcf\system\cache\runtime\UserProfileRuntimeCache;
-use wcf\system\email\mime\MimePartFacade;
-use wcf\system\email\mime\RecipientAwareTextMimePart;
-use wcf\system\email\Email;
-use wcf\system\email\Mailbox;
-use wcf\system\email\UserMailbox;
-use wcf\system\exception\IllegalLinkException;
-use wcf\system\exception\PermissionDeniedException;
-use wcf\system\exception\UserInputException;
-use wcf\system\page\PageLocationManager;
-use wcf\system\request\LinkHandler;
-use wcf\system\WCF;
-use wcf\util\HeaderUtil;
-use wcf\util\StringUtil;
-use wcf\util\UserUtil;
-
-/**
- * Shows the user mail form.
- * 
- * @author     Marcel Werk
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @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();
-       }
-}
index 04d7b158e054477b65d257fe27d82438d4afc594..c696031d5d4590bb831761362aae01319bdad813 100644 (file)
@@ -757,7 +757,6 @@ ACHTUNG: Die oben genannten Meldungen sind stark gekürzt. Sie können Details z
                <item name="wcf.acp.group.option.user.profile.avatar.maxSize"><![CDATA[Maximale Dateigröße]]></item>
                <item name="wcf.acp.group.option.user.profile.canChangeEmail"><![CDATA[Kann E-Mail-Adresse ändern]]></item>
                <item name="wcf.acp.group.option.user.profile.canEditUserTitle"><![CDATA[Kann eigenen Benutzertitel bearbeiten]]></item>
-               <item name="wcf.acp.group.option.user.profile.canMail"><![CDATA[Kann E-Mails an andere Benutzer senden]]></item>
                <item name="wcf.acp.group.option.user.profile.canQuit"><![CDATA[Kann Benutzerkonto löschen]]></item>
                <item name="wcf.acp.group.option.user.profile.canRename"><![CDATA[Kann Benutzernamen ändern]]></item>
                <item name="wcf.acp.group.option.user.profile.canViewMembersList"><![CDATA[Kann Mitglieder-Liste sehen]]></item>
@@ -5192,7 +5191,6 @@ Benachrichtigungen auf <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|lang
                <item name="wcf.user.option.birthday"><![CDATA[Geburtstag]]></item>
                <item name="wcf.user.option.birthdayShowYear"><![CDATA[Geburtsjahr im Profil anzeigen]]></item>
                <item name="wcf.user.option.birthdayShowYear.description"><![CDATA[Mitglieder können dadurch {if LANGUAGE_USE_INFORMAL_VARIANT}dein{else}Ihr{/if} Alter sehen.]]></item>
-               <item name="wcf.user.option.canMail"><![CDATA[Kann E-Mails senden]]></item>
                <item name="wcf.user.option.canViewEmailAddress"><![CDATA[Kann E-Mail-Adresse sehen]]></item>
                <item name="wcf.user.option.canViewOnlineStatus"><![CDATA[Kann Online-Status sehen]]></item>
                <item name="wcf.user.option.canViewProfile"><![CDATA[Kann Benutzerprofil sehen]]></item>
@@ -5227,8 +5225,6 @@ Benachrichtigungen auf <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|lang
                <item name="wcf.user.option.searchBooleanOption"><![CDATA[Auswahl des Benutzers bei „{$option->getTitle()}“:]]></item>
        </category>
        <category name="wcf.user.mail">
-               <item name="wcf.user.mail.information"><![CDATA[Informationen]]></item>
-               <item name="wcf.user.mail.mail.subject"><![CDATA[Nachricht von {@$username}: {@$subject}]]></item>
                <item name="wcf.user.mail.mail.plaintext"><![CDATA[Hallo {@$mailbox->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 <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|lang
 <p>„{$username}“ hat {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if} über die Website <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|language}</a> folgende Nachricht gesandt:</p>
 
 <p>{@$message|newlineToBreak}</p>]]></item>
-               <item name="wcf.user.mail.message"><![CDATA[Nachricht]]></item>
-               <item name="wcf.user.mail.senderEmail"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Deine{else}Ihre{/if} E-Mail-Adresse]]></item>
-               <item name="wcf.user.mail.sent"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Deine{else}Ihre{/if} Nachricht an {$user->username} wurde erfolgreich versandt.]]></item>
-               <item name="wcf.user.mail.showAddress"><![CDATA[Meine E-Mail-Adresse als Absender-Adresse benutzen. Der Empfänger kann direkt auf die Nachricht antworten.]]></item>
-               <item name="wcf.user.mail.subject"><![CDATA[Betreff]]></item>
        </category>
        <category name="wcf.user.rank">
                <item name="wcf.user.rank.administrator"><![CDATA[Administrator]]></item>
index 7e9baf3f16fa293365f1067a8ca6b47258e23059..fec9ca45448b0e6f984fcdda344c69e37f39ed61 100644 (file)
@@ -733,7 +733,6 @@ ATTENTION: The messages listed above are greatly shortened. You can view details
                <item name="wcf.acp.group.option.user.profile.avatar.maxSize"><![CDATA[Maximum Image File Size]]></item>
                <item name="wcf.acp.group.option.user.profile.canChangeEmail"><![CDATA[Can change their email address]]></item>
                <item name="wcf.acp.group.option.user.profile.canEditUserTitle"><![CDATA[Can edit their user title]]></item>
-               <item name="wcf.acp.group.option.user.profile.canMail"><![CDATA[Can send emails to users]]></item>
                <item name="wcf.acp.group.option.user.profile.canQuit"><![CDATA[Can delete their user account]]></item>
                <item name="wcf.acp.group.option.user.profile.canRename"><![CDATA[Can change their username]]></item>
                <item name="wcf.acp.group.option.user.profile.canViewMembersList"><![CDATA[Can view members list]]></item>
@@ -5190,7 +5189,6 @@ your notifications on <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|langu
                <item name="wcf.user.option.birthday"><![CDATA[Birthday]]></item>
                <item name="wcf.user.option.birthdayShowYear"><![CDATA[Display year of birth]]></item>
                <item name="wcf.user.option.birthdayShowYear.description"><![CDATA[Allows users to view your age.]]></item>
-               <item name="wcf.user.option.canMail"><![CDATA[Can Send Me Emails]]></item>
                <item name="wcf.user.option.canViewEmailAddress"><![CDATA[Can View My Email Address]]></item>
                <item name="wcf.user.option.canViewOnlineStatus"><![CDATA[Can View My Online Status]]></item>
                <item name="wcf.user.option.canViewProfile"><![CDATA[Can View My Profile]]></item>
@@ -5225,8 +5223,6 @@ your notifications on <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|langu
                <item name="wcf.user.option.searchBooleanOption"><![CDATA[User’s selection for “{$option->getTitle()}”:]]></item>
        </category>
        <category name="wcf.user.mail">
-               <item name="wcf.user.mail.information"><![CDATA[Details]]></item>
-               <item name="wcf.user.mail.mail.subject"><![CDATA[Message From {@$username}: {@$subject}]]></item>
                <item name="wcf.user.mail.mail.plaintext"><![CDATA[Dear {@$mailbox->getUser()->username},
 
 “{@$username}” sent you a message on {@PAGE_TITLE|language} [URL:{link isEmail=true}{/link}]:
@@ -5237,11 +5233,6 @@ your notifications on <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|langu
 <p>„{$username}“ sent you a message on <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|language}</a>:</p>
 
 <p>{@$message|newlineToBreak}</p>]]></item>
-               <item name="wcf.user.mail.message"><![CDATA[Message]]></item>
-               <item name="wcf.user.mail.senderEmail"><![CDATA[Your email address]]></item>
-               <item name="wcf.user.mail.sent"><![CDATA[The message has been sent to {$user->username}.]]></item>
-               <item name="wcf.user.mail.showAddress"><![CDATA[Use my email address as sender address, the recipient can directly reply to me.]]></item>
-               <item name="wcf.user.mail.subject"><![CDATA[Subject]]></item>
        </category>
        <category name="wcf.user.rank">
                <item name="wcf.user.rank.administrator"><![CDATA[Administrator]]></item>