Skip to content

Commit

Permalink
[4.0] Fix mail template not found error (#31699)
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonge authored Dec 27, 2020
1 parent 7cf7bc5 commit 81a5fcd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

\defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Router\Route;

/**
* Mail templates Controller
Expand All @@ -27,4 +29,33 @@ class DisplayController extends BaseController
* @since 1.6
*/
protected $default_view = 'templates';

/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return BaseController|boolean This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = array())
{
$view = $this->input->get('view', 'templates');
$layout = $this->input->get('layout', '');
$id = $this->input->getString('template_id');

// Check for edit form.
if ($view == 'template' && $layout == 'edit' && !$this->checkEditId('com_mails.edit.template', $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setMessage(Text::sprintf('COM_MAILS_ERROR_UNHELD_ID', $id), 'error');
$this->setRedirect(Route::_('index.php?option=com_mails&view=templates', false));

return false;
}

return parent::display();
}
}
1 change: 1 addition & 0 deletions administrator/language/en-GB/com_mails.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ COM_MAILS_CONFIG_FIELD_ATTACHMENT_FOLDER_LABEL="Attachments Folder"
COM_MAILS_CONFIG_FIELD_COPY_MAILS_LABEL="Send Copy"
COM_MAILS_CONFIG_MAIL_OPTIONS="Mails"
COM_MAILS_CONFIGURATION="Mail Templates: Options"
COM_MAILS_ERROR_UNHELD_ID="You are not permitted to use that link to directly access that page (Template: %s)."
COM_MAILS_FIELD_ALTERNATIVE_MAILCONFIG_LABEL="Mail Settings"
COM_MAILS_FIELD_ATTACHMENTS_LABEL="Attachments"
COM_MAILS_FIELD_BODY_LABEL="Body"
Expand Down

0 comments on commit 81a5fcd

Please sign in to comment.