From 79b4ff2c3f413f2b5eeeafe150e97e4837ba7ab8 Mon Sep 17 00:00:00 2001 From: Septdir Date: Fri, 2 Mar 2018 22:02:45 +0300 Subject: [PATCH 1/3] Add com_ajax check in getModuleList query --- libraries/src/Helper/ModuleHelper.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libraries/src/Helper/ModuleHelper.php b/libraries/src/Helper/ModuleHelper.php index 8e398e3ca95e3..0c1bdc45fe4ea 100644 --- a/libraries/src/Helper/ModuleHelper.php +++ b/libraries/src/Helper/ModuleHelper.php @@ -404,8 +404,14 @@ public static function getModuleList() $query->where('(m.publish_up = ' . $db->quote($nullDate) . ' OR m.publish_up <= ' . $db->quote($now) . ')') ->where('(m.publish_down = ' . $db->quote($nullDate) . ' OR m.publish_down >= ' . $db->quote($now) . ')') ->where('m.access IN (' . $groups . ')') - ->where('m.client_id = ' . $clientId) - ->where('(mm.menuid = ' . $Itemid . ' OR mm.menuid <= 0)'); + ->where('m.client_id = ' . $clientId); + + // Filter by menu itemId + $option = $app->input->get('option', ''); + if ($option !== 'com_ajax') + { + $query->where('(mm.menuid = ' . $Itemid . ' OR mm.menuid <= 0)'); + } // Filter by language if ($app->isClient('site') && $app->getLanguageFilter()) From df41666cc53ccdd11342e0ab0c3a74510ef147a0 Mon Sep 17 00:00:00 2001 From: Septdir Date: Fri, 2 Mar 2018 22:34:52 +0300 Subject: [PATCH 2/3] Restore getModuleList query --- libraries/src/Helper/ModuleHelper.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libraries/src/Helper/ModuleHelper.php b/libraries/src/Helper/ModuleHelper.php index 0c1bdc45fe4ea..8e398e3ca95e3 100644 --- a/libraries/src/Helper/ModuleHelper.php +++ b/libraries/src/Helper/ModuleHelper.php @@ -404,14 +404,8 @@ public static function getModuleList() $query->where('(m.publish_up = ' . $db->quote($nullDate) . ' OR m.publish_up <= ' . $db->quote($now) . ')') ->where('(m.publish_down = ' . $db->quote($nullDate) . ' OR m.publish_down >= ' . $db->quote($now) . ')') ->where('m.access IN (' . $groups . ')') - ->where('m.client_id = ' . $clientId); - - // Filter by menu itemId - $option = $app->input->get('option', ''); - if ($option !== 'com_ajax') - { - $query->where('(mm.menuid = ' . $Itemid . ' OR mm.menuid <= 0)'); - } + ->where('m.client_id = ' . $clientId) + ->where('(mm.menuid = ' . $Itemid . ' OR mm.menuid <= 0)'); // Filter by language if ($app->isClient('site') && $app->getLanguageFilter()) From e9eee7bf6e8d1777da2ffe29f7d422b77de5b5a5 Mon Sep 17 00:00:00 2001 From: Septdir Date: Fri, 2 Mar 2018 22:45:10 +0300 Subject: [PATCH 3/3] Change module check inside com_ajax --- components/com_ajax/ajax.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/components/com_ajax/ajax.php b/components/com_ajax/ajax.php index e3841cece7fb4..97de5f9120182 100644 --- a/components/com_ajax/ajax.php +++ b/components/com_ajax/ajax.php @@ -46,14 +46,11 @@ */ elseif ($input->get('module')) { - $module = $input->get('module'); - $moduleObject = JModuleHelper::getModule('mod_' . $module, null); - - /* - * As JModuleHelper::isEnabled always returns true, we check - * for an id other than 0 to see if it is published. - */ - if ($moduleObject->id != 0) + $module = $input->get('module'); + $table = JTable::getInstance('extension'); + $moduleId = $table->find(array('type' => 'module', 'element' => 'mod_' . $module)); + + if ($moduleId && $table->load($moduleId) && $table->enabled) { $helperFile = JPATH_BASE . '/modules/mod_' . $module . '/helper.php';