1111
1212\defined ('_JEXEC ' ) or die;
1313
14+ use Joomla \CMS \Language \Text ;
1415use 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}
0 commit comments