?
avatar andrepereiradasilva
andrepereiradasilva
4 Oct 2016

Steps to reproduce the issue

Expected result

We add a menu or contact link

Actual result

Error

System information (as much as possible)

Latest 3.7.x branch

Additional comments

This plugins only exist in 3.7.x

pinging @infograf768 @brianteeman @zero-24

avatar andrepereiradasilva andrepereiradasilva - open - 4 Oct 2016
avatar andrepereiradasilva andrepereiradasilva - edited - 4 Oct 2016
avatar andrepereiradasilva
andrepereiradasilva - comment - 4 Oct 2016

just as aditional info

for the contacts i think you need the frontend component proxying to admin when view = contacts

for the menus i think you may need the component itself on the frontend proxying to the backend
See com_modules as example: https://github.com/joomla/joomla-cms/tree/staging/components/com_modules

avatar zero-24 zero-24 - change - 4 Oct 2016
The description was changed
Labels Added: ?
avatar brianteeman brianteeman - change - 4 Oct 2016
Status New Confirmed
avatar brianteeman
brianteeman - comment - 4 Oct 2016

Confirmed


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12309.

avatar brianteeman brianteeman - change - 4 Oct 2016
Category Plugins
avatar infograf768
infograf768 - comment - 5 Oct 2016

release blocker


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12309.

avatar infograf768
infograf768 - comment - 5 Oct 2016

I tried to solve the issue for contacts by proxying as should.
I had to register once the admin modal though and still get this fatal error

Fatal error: Using $this when not in object context in /Applications/MAMP/htdocs/370/infograf768/administrator/components/com_contact/views/contacts/tmpl/modal.php on line 21

This is the code I used.

diff --git a/administrator/components/com_contact/views/contacts/tmpl/modal.php b/administrator/components/com_contact/views/contacts/tmpl/modal.php
index e9a8138..1e2f493 100644
--- a/administrator/components/com_contact/views/contacts/tmpl/modal.php
+++ b/administrator/components/com_contact/views/contacts/tmpl/modal.php
@@ -24,4 +24,9 @@
 $app = JFactory::getApplication();

+if ($app->isSite())
+{
+   JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
+}
+
 $function  = $app->input->getCmd('function', 'jSelectContact');
 $listOrder = $this->escape($this->state->get('list.ordering'));
diff --git a/components/com_contact/contact.php b/components/com_contact/contact.php
index a119f16..e68d2b8 100644
--- a/components/com_contact/contact.php
+++ b/components/com_contact/contact.php
@@ -12,5 +12,13 @@
 JLoader::register('ContactHelperRoute', JPATH_COMPONENT . '/helpers/route.php');

+$input = JFactory::getApplication()->input;
+
+if ($input->get('view') === 'contacts' && $input->get('layout') === 'modal')
+{
+   $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
+   require_once JPATH_COMPONENT_ADMINISTRATOR . '/views/contacts/tmpl/modal.php';
+}
+
 $controller = JControllerLegacy::getInstance('Contact');
-$controller->execute(JFactory::getApplication()->input->get('task'));
+$controller->execute($input->get('task'));
 $controller->redirect();
diff --git a/components/com_contact/controller.php b/components/com_contact/controller.php
index de91f09..ac78e1d 100644
--- a/components/com_contact/controller.php
+++ b/components/com_contact/controller.php
@@ -18,4 +18,27 @@
 {
    /**
+    * Constructor.
+    *
+    * @param   array  $config  An optional associative array of configuration settings.
+    *                          Recognized key values include 'name', 'default_task', 'model_path', and
+    *                          'view_path' (this list is not meant to be comprehensive).
+    *
+    * @since   __DEPLOY_VERSION__
+    */
+   public function __construct($config = array())
+   {
+       $this->input = JFactory::getApplication()->input;
+
+       // Article frontpage Editor contact proxying:
+       if ($this->input->get('view') === 'contacts' && $this->input->get('layout') === 'modal')
+       {
+           JHtml::_('stylesheet', 'system/adminlist.css', array(), true);
+           $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
+       }
+
+       parent::__construct($config);
+   }
+
+   /**
     * Method to display a view.
     *

contactxtdfrontendissue.diff.zip

avatar zero-24
zero-24 - comment - 5 Oct 2016

Fatal error: Using $this when not in object context in /Applications/MAMP/htdocs/370/infograf768/administrator/components/com_contact/views/contacts/tmpl/modal.php on line 21

Strange error:

As we use the same line in com_content modal.
https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/views/articles/tmpl/modal.php#L29

And $this->filterForm it is defined for com_contact here: https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_contact/views/contacts/view.html.php#L78

avatar infograf768
infograf768 - comment - 5 Oct 2016

Something must be missing in the code I posted above.
Both for xtd modules and xtd article, no need to load the modal as I did with
require_once JPATH_COMPONENT_ADMINISTRATOR . '/views/contacts/tmpl/modal.php';

Let's hope someone can solve this.

Note: Concerning xtd menu, it is even another story as we have no com_menus in frontend...

avatar infograf768
infograf768 - comment - 5 Oct 2016

Looks like I found a possible solution...

adding in the xtd (here for contacts)

/*
         * Use the built-in element view to select the contact.
         * Currently uses blank class.
         */
        $app = JFactory::getApplication();

        if ($app->isSite())
        {
            $link = 'administrator/index.php?option=com_contact&view=contacts&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1';
        }
        else
        {
            $link = 'index.php?option=com_contact&view=contacts&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1';
        }

I do get the modal OK and can select.

screen shot 2016-10-05 at 12 34 51

No need in this case to add require_once JPATH_COMPONENT_ADMINISTRATOR . '/views/contacts/tmpl/modal.php';

Can someone test and look if this does not have a wrong effect? (security or else)

avatar andrepereiradasilva
andrepereiradasilva - comment - 5 Oct 2016

using the administrator index.php means you need to be login admin right? Did you test that when logout of admin?

avatar infograf768
infograf768 - comment - 5 Oct 2016

I have a problem in 3.7.0
As super admin, when you login in admin OR site, you are logged in both...

avatar andrepereiradasilva
andrepereiradasilva - comment - 5 Oct 2016

you have shared sessions in global config set to yes right?

avatar brianteeman
brianteeman - comment - 5 Oct 2016

Sounds like #12068 in action

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar infograf768
infograf768 - comment - 5 Oct 2016

Ah, grrrr
shared sessions now off.
My trick does not work anymore when the user is not logged in admin. Forget it...

avatar infograf768
infograf768 - comment - 5 Oct 2016

Welcome a completion of the patch proposed above...

avatar dgt41
dgt41 - comment - 5 Oct 2016

@infograf768 why don't you replicate what have been done in XTD_modules? I mean the link @andrepereiradasilva posted in the first comment

avatar infograf768
infograf768 - comment - 5 Oct 2016

that is what i tried to do for contacts. obviously not enough...
concerning xtd menu we do not have anu frontend com_menus...

you did the xtd modules, you may know better


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12309.

avatar dgt41
dgt41 - comment - 5 Oct 2016

@infograf768 your code is correct you just miss this change (add $config) in com_contact/contact.php:

$controller = JControllerLegacy::getInstance('Contact', $config);

Then it should work fine!

avatar brianteeman brianteeman - change - 5 Oct 2016
Labels Added: ?
avatar infograf768
infograf768 - comment - 5 Oct 2016

ok, will try tomorrow for contacts.

any idea for xtd menu?

avatar infograf768
infograf768 - comment - 6 Oct 2016

@dgt41

Adding , $config helps. I also loaded backend language. I still get a Notice:
Notice: Undefined index: contacts in /Applications/MAMP/htdocs/370/infograf768/libraries/cms/component/router/view.php on line 86
And search tools is broken

For the xtd menus, I added in frontend an instance of com_menus with the same structure as com_modules frontend. Does not work yet.
For that one the modal displays The most recent request was denied because it contained an invalid security token. Please refresh the page and try again.

I am going to create a WIP PR to work in collaboration to solve these.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12309.

avatar infograf768
infograf768 - comment - 6 Oct 2016

Here it is
#12320

avatar zero-24
zero-24 - comment - 6 Oct 2016

Closing as we have a PR by @infograf768

avatar zero-24 zero-24 - change - 6 Oct 2016
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2016-10-06 09:35:13
Closed_By zero-24
avatar zero-24 zero-24 - close - 6 Oct 2016
avatar zero-24 zero-24 - close - 6 Oct 2016
avatar zero-24 zero-24 - change - 6 Oct 2016
Labels Removed: ?
avatar infograf768
infograf768 - comment - 6 Oct 2016

a WIP one... ;)

Add a Comment

Login with GitHub to post a comment