Skip to content

Commit 81a5fcd

Browse files
authored
[4.0] Fix mail template not found error (#31699)
1 parent 7cf7bc5 commit 81a5fcd

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

administrator/components/com_mails/src/Controller/DisplayController.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
\defined('_JEXEC') or die;
1313

14+
use Joomla\CMS\Language\Text;
1415
use Joomla\CMS\MVC\Controller\BaseController;
16+
use Joomla\CMS\Router\Route;
1517

1618
/**
1719
* Mail templates Controller
@@ -27,4 +29,33 @@ class DisplayController extends BaseController
2729
* @since 1.6
2830
*/
2931
protected $default_view = 'templates';
32+
33+
/**
34+
* Method to display a view.
35+
*
36+
* @param boolean $cachable If true, the view output will be cached
37+
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
38+
*
39+
* @return BaseController|boolean This object to support chaining.
40+
*
41+
* @since 1.5
42+
*/
43+
public function display($cachable = false, $urlparams = array())
44+
{
45+
$view = $this->input->get('view', 'templates');
46+
$layout = $this->input->get('layout', '');
47+
$id = $this->input->getString('template_id');
48+
49+
// Check for edit form.
50+
if ($view == 'template' && $layout == 'edit' && !$this->checkEditId('com_mails.edit.template', $id))
51+
{
52+
// Somehow the person just went to the form - we don't allow that.
53+
$this->setMessage(Text::sprintf('COM_MAILS_ERROR_UNHELD_ID', $id), 'error');
54+
$this->setRedirect(Route::_('index.php?option=com_mails&view=templates', false));
55+
56+
return false;
57+
}
58+
59+
return parent::display();
60+
}
3061
}

administrator/language/en-GB/com_mails.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ COM_MAILS_CONFIG_FIELD_ATTACHMENT_FOLDER_LABEL="Attachments Folder"
1010
COM_MAILS_CONFIG_FIELD_COPY_MAILS_LABEL="Send Copy"
1111
COM_MAILS_CONFIG_MAIL_OPTIONS="Mails"
1212
COM_MAILS_CONFIGURATION="Mail Templates: Options"
13+
COM_MAILS_ERROR_UNHELD_ID="You are not permitted to use that link to directly access that page (Template: %s)."
1314
COM_MAILS_FIELD_ALTERNATIVE_MAILCONFIG_LABEL="Mail Settings"
1415
COM_MAILS_FIELD_ATTACHMENTS_LABEL="Attachments"
1516
COM_MAILS_FIELD_BODY_LABEL="Body"

0 commit comments

Comments
 (0)