mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Bring PHPMailer config into the new config UI
Summary: Port PHPMailer options. Also: - Don't show values on config lists if they're masked (this is mostly for passwords, to prevent them from being idly/accidentally disclosed). - Don't show "default" icon -- just show an icon if the value has been customized. This makes it easier to pick out custom values. Test Plan: Looked at / edited mailer values. Reviewers: codeblock, btrahan Reviewed By: codeblock CC: aran Maniphest Tasks: T2255 Differential Revision: https://secure.phabricator.com/D4441
This commit is contained in:
parent
cd9d59344c
commit
c8a2bc982c
3 changed files with 50 additions and 3 deletions
|
@ -1037,6 +1037,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPHIDConstants' => 'applications/phid/PhabricatorPHIDConstants.php',
|
||||
'PhabricatorPHIDController' => 'applications/phid/controller/PhabricatorPHIDController.php',
|
||||
'PhabricatorPHIDLookupController' => 'applications/phid/controller/PhabricatorPHIDLookupController.php',
|
||||
'PhabricatorPHPMailerConfigOptions' => 'applications/config/option/PhabricatorPHPMailerConfigOptions.php',
|
||||
'PhabricatorPaste' => 'applications/paste/storage/PhabricatorPaste.php',
|
||||
'PhabricatorPasteController' => 'applications/paste/controller/PhabricatorPasteController.php',
|
||||
'PhabricatorPasteDAO' => 'applications/paste/storage/PhabricatorPasteDAO.php',
|
||||
|
@ -2381,6 +2382,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPHDConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorPHIDController' => 'PhabricatorController',
|
||||
'PhabricatorPHIDLookupController' => 'PhabricatorPHIDController',
|
||||
'PhabricatorPHPMailerConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorPaste' =>
|
||||
array(
|
||||
0 => 'PhabricatorPasteDAO',
|
||||
|
|
|
@ -72,7 +72,7 @@ final class PhabricatorConfigGroupController
|
|||
->setHref('/config/edit/'.$option->getKey().'/')
|
||||
->addAttribute(phutil_escape_html($option->getSummary()));
|
||||
|
||||
if (!$option->getHidden()) {
|
||||
if (!$option->getHidden() && !$option->getMasked()) {
|
||||
$current_value = PhabricatorEnv::getEnvConfig($option->getKey());
|
||||
$current_value = PhabricatorConfigJSON::prettyPrintJSON(
|
||||
$current_value);
|
||||
|
@ -90,12 +90,12 @@ final class PhabricatorConfigGroupController
|
|||
$db_value = idx($db_values, $option->getKey());
|
||||
if ($db_value && !$db_value->getIsDeleted()) {
|
||||
$item->addIcon('edit', pht('Customized'));
|
||||
} else {
|
||||
$item->addIcon('edit-grey', pht('Default'));
|
||||
}
|
||||
|
||||
if ($option->getHidden()) {
|
||||
$item->addIcon('unpublish', pht('Hidden'));
|
||||
} else if ($option->getMasked()) {
|
||||
$item->addIcon('unpublish-grey', pht('Masked'));
|
||||
} else if ($option->getLocked()) {
|
||||
$item->addIcon('lock', pht('Locked'));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorPHPMailerConfigOptions
|
||||
extends PhabricatorApplicationConfigOptions {
|
||||
|
||||
public function getName() {
|
||||
return pht("PHPMailer");
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
return pht("Configure PHPMailer.");
|
||||
}
|
||||
|
||||
public function getOptions() {
|
||||
return array(
|
||||
$this->newOption('phpmailer.mailer', 'string', 'smtp')
|
||||
->setSummary(pht("Configure mailer used by PHPMailer."))
|
||||
->setDescription(
|
||||
pht(
|
||||
"If you're using PHPMailer to send email, provide the mailer and ".
|
||||
"options here. PHPMailer is much more enormous than ".
|
||||
"PHPMailerLite, and provides more mailers and greater enormity. ".
|
||||
"You need it when you want to use SMTP instead of sendmail as the ".
|
||||
"mailer.")),
|
||||
$this->newOption('phpmailer.smtp-host', 'string', null)
|
||||
->setDescription(pht('Host for SMTP.')),
|
||||
$this->newOption('phpmailer.smtp-port', 'int', 25)
|
||||
->setDescription(pht('Port for SMTP.')),
|
||||
// TODO: Implement "enum"? Valid values are empty, 'tls', or 'ssl'.
|
||||
$this->newOption('phpmailer.smtp-protocol', 'string', null)
|
||||
->setSummary(pht('Configure TLS or SSL for SMTP.'))
|
||||
->setDescription(
|
||||
pht(
|
||||
"Using PHPMailer with SMTP, you can set this to one of 'tls' or ".
|
||||
"'ssl' to use TLS or SSL, respectively. Leave it blank for ".
|
||||
"vanilla SMTP. If you're sending via Gmail, set it to 'ssl'.")),
|
||||
$this->newOption('phpmailer.smtp-user', 'string', null)
|
||||
->setDescription(pht('Username for SMTP.')),
|
||||
$this->newOption('phpmailer.smtp-password', 'string', null)
|
||||
->setMasked(true)
|
||||
->setDescription(pht('Password for SMTP.')),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue