Skip to content

Commit

Permalink
closes #140
Browse files Browse the repository at this point in the history
  • Loading branch information
ticktackk committed Aug 11, 2024
1 parent 94ca193 commit 120df01
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
## 1.5.1 (`1050170`)

- **Fix:** Template content is not displayed when editing template modification (#139)
- **Fix:** Unable to select hidden file-based email transport on XenForo 2.3 (#140)

## 1.5.0 (`1050070`)

Expand Down
30 changes: 29 additions & 1 deletion XF/Admin/Controller/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
use XF\Entity\Option as OptionEntity;
use XF\Entity\OptionGroup as OptionGroupEntity;
use XF\Mvc\Entity\ArrayCollection;
use XF\Mvc\Reply\View;
use XF\Mvc\ParameterBag;
use XF\Mvc\Reply\View as ViewReply;
use XF\Mvc\Reply\Redirect as RedirectReply;
use XF\Mvc\Reply\Exception as ExceptionReply;

/**
* Class Option
Expand Down Expand Up @@ -39,4 +42,29 @@ public function optionAddEdit(OptionEntity $option, $baseRelations = [])

return $reply;
}

/**
* @since 1.5.1
*
* @param ParameterBag $params
*
* @return RedirectReply|ViewReply
*
* @throws ExceptionReply
*/
public function actionEmailTransportSetup(ParameterBag $params)
{
$option = $this->assertEmailTransportOption($params->option_id);

$newType = $this->filter('new_type', 'str');
if ($this->isPost() && ($newType === 'file'))
{
$optionValue = ['emailTransport' => $newType];
$this->getOptionRepo()->updateOption($option->option_id, $optionValue);

return $this->redirect($this->getDynamicRedirect());
}

return parent::actionEmailTransportSetup($params);
}
}
1 change: 1 addition & 0 deletions _output/phrases/tckDeveloperTools_file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
File
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hidden file-based email transport
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "option_template_emailTransport",
"description": "Enable hidden file-based email transport option",
"description": "Enable hidden file-based email transport option (XF 2.2)",
"execution_order": 6119,
"enabled": true,
"action": "str_replace",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"template": "option_template_advancedEmailTransport",
"description": "Custom label for email transport method is using \"file\" type",
"execution_order": 6119,
"enabled": true,
"action": "preg_replace",
"find": "{(^\\s<xf:if is=\"\\$option\\.option_value\\.emailTransport.*?>.*?)(<xf:else \\/>$)}sm",
"replace": "$1<xf:elseif is=\"$option.option_value.emailTransport == 'file'\" />\n\t\t<div>{{ phrase('tckDeveloperTools_hidden_file_based_email_transport') }}</div>\n\t$2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"template": "option_email_transport_setup",
"description": "Enable hidden file-based email transport option (XF 2.3)",
"execution_order": 6119,
"enabled": true,
"action": "str_replace",
"find": "<xf:option value=\"smtp\"",
"replace": "\t<xf:option value=\"file\">{{ phrase('tckDeveloperTools_file') }}</xf:option>\n$0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"template": "option_email_transport_setup",
"description": "Enable hidden file-based email transport option (XF 2.3)",
"execution_order": 6119,
"enabled": true,
"action": "str_replace",
"find": "$option.option_value.emailTransport|to_upper",
"replace": "($option.option_value.emailTransport == 'file') ? phrase('tckDeveloperTools_hidden_file_based_email_transport') : $0"
}

0 comments on commit 120df01

Please sign in to comment.