diff --git a/components/com_content/content.php b/components/com_content/content.php index cfa7acd73005f..0e78d1dac359c 100644 --- a/components/com_content/content.php +++ b/components/com_content/content.php @@ -12,28 +12,6 @@ JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php'); JLoader::register('ContentHelperQuery', JPATH_SITE . '/components/com_content/helpers/query.php'); -$input = JFactory::getApplication()->input; -$user = JFactory::getUser(); - -if ($input->get('view') === 'article' && $input->get('layout') === 'pagebreak') -{ - if (!$user->authorise('core.edit', 'com_content')) - { - JFactory::getApplication()->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning'); - - return; - } -} -elseif ($input->get('view') === 'articles' && $input->get('layout') === 'modal') -{ - if (!$user->authorise('core.edit', 'com_content')) - { - JFactory::getApplication()->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning'); - - return; - } -} - $controller = JControllerLegacy::getInstance('Content'); -$controller->execute($input->get('task')); +$controller->execute(JFactory::getApplication()->input->get('task')); $controller->redirect(); diff --git a/plugins/editors-xtd/article/article.php b/plugins/editors-xtd/article/article.php index 3c86d2b025528..3ac870b11e80f 100644 --- a/plugins/editors-xtd/article/article.php +++ b/plugins/editors-xtd/article/article.php @@ -39,36 +39,43 @@ public function onDisplay($name) * jSelectArticle creates the link tag, sends it to the editor, * and closes the select frame. */ - $js = " - function jSelectArticle(id, title, catid, object, link, lang) + $user = JFactory::getUser(); + + if ($user->authorise('core.create', 'com_content') + || $user->authorise('core.edit', 'com_content') + || $user->authorise('core.edit.own', 'com_content')) { - var hreflang = ''; - if (lang !== '') + $js = " + function jSelectArticle(id, title, catid, object, link, lang) { - var hreflang = ' hreflang = \"' + lang + '\"'; - } - var tag = '' + title + ''; - jInsertEditorText(tag, '" . $name . "'); - jModalClose(); - }"; + var hreflang = ''; + if (lang !== '') + { + var hreflang = ' hreflang = \"' + lang + '\"'; + } + var tag = '' + title + ''; + jInsertEditorText(tag, '" . $name . "'); + jModalClose(); + }"; - $doc = JFactory::getDocument(); - $doc->addScriptDeclaration($js); + $doc = JFactory::getDocument(); + $doc->addScriptDeclaration($js); - /* - * Use the built-in element view to select the article. - * Currently uses blank class. - */ - $link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1'; + /* + * Use the built-in element view to select the article. + * Currently uses blank class. + */ + $link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1'; - $button = new JObject; - $button->modal = true; - $button->class = 'btn'; - $button->link = $link; - $button->text = JText::_('PLG_ARTICLE_BUTTON_ARTICLE'); - $button->name = 'file-add'; - $button->options = "{handler: 'iframe', size: {x: 800, y: 500}}"; + $button = new JObject; + $button->modal = true; + $button->class = 'btn'; + $button->link = $link; + $button->text = JText::_('PLG_ARTICLE_BUTTON_ARTICLE'); + $button->name = 'file-add'; + $button->options = "{handler: 'iframe', size: {x: 800, y: 500}}"; - return $button; + return $button; + } } } diff --git a/plugins/editors-xtd/module/module.php b/plugins/editors-xtd/module/module.php index 861b7a8eb5f7b..59bcf9d8cf22f 100644 --- a/plugins/editors-xtd/module/module.php +++ b/plugins/editors-xtd/module/module.php @@ -38,17 +38,24 @@ public function onDisplay($name) * Use the built-in element view to select the module. * Currently uses blank class. */ - $link = 'index.php?option=com_modules&view=modules&layout=modal&tmpl=component&editor=' - . $name . '&' . JSession::getFormToken() . '=1'; + $user = JFactory::getUser(); - $button = new JObject; - $button->modal = true; - $button->class = 'btn'; - $button->link = $link; - $button->text = JText::_('PLG_MODULE_BUTTON_MODULE'); - $button->name = 'file-add'; - $button->options = "{handler: 'iframe', size: {x: 800, y: 500}}"; + if ($user->authorise('core.create', 'com_content') + || $user->authorise('core.edit', 'com_content') + || $user->authorise('core.edit.own', 'com_content')) + { + $link = 'index.php?option=com_modules&view=modules&layout=modal&tmpl=component&editor=' + . $name . '&' . JSession::getFormToken() . '=1'; - return $button; + $button = new JObject; + $button->modal = true; + $button->class = 'btn'; + $button->link = $link; + $button->text = JText::_('PLG_MODULE_BUTTON_MODULE'); + $button->name = 'file-add'; + $button->options = "{handler: 'iframe', size: {x: 800, y: 500}}"; + + return $button; + } } } diff --git a/plugins/editors-xtd/pagebreak/pagebreak.php b/plugins/editors-xtd/pagebreak/pagebreak.php index a97f111ff2521..4f87e754a4af9 100644 --- a/plugins/editors-xtd/pagebreak/pagebreak.php +++ b/plugins/editors-xtd/pagebreak/pagebreak.php @@ -33,16 +33,23 @@ class PlgButtonPagebreak extends JPlugin */ public function onDisplay($name) { - $link = 'index.php?option=com_content&view=article&layout=pagebreak&tmpl=component&e_name=' . $name; + $user = JFactory::getUser(); - $button = new JObject; - $button->modal = true; - $button->class = 'btn'; - $button->link = $link; - $button->text = JText::_('PLG_EDITORSXTD_PAGEBREAK_BUTTON_PAGEBREAK'); - $button->name = 'copy'; - $button->options = "{handler: 'iframe', size: {x: 500, y: 300}}"; + if ($user->authorise('core.create', 'com_content') + || $user->authorise('core.edit', 'com_content') + || $user->authorise('core.edit.own', 'com_content')) + { + $link = 'index.php?option=com_content&view=article&layout=pagebreak&tmpl=component&e_name=' . $name; - return $button; + $button = new JObject; + $button->modal = true; + $button->class = 'btn'; + $button->link = $link; + $button->text = JText::_('PLG_EDITORSXTD_PAGEBREAK_BUTTON_PAGEBREAK'); + $button->name = 'copy'; + $button->options = "{handler: 'iframe', size: {x: 500, y: 300}}"; + + return $button; + } } }