Server IP : 195.201.23.43 / Your IP : 18.218.44.61 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/cwd/administrator/components/com_menus/controllers/ |
Upload File : |
<?php /** * @package Joomla.Administrator * @subpackage com_menus * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Language\LanguageHelper; /** * The menu controller for ajax requests * * @since 3.9.0 */ class MenusControllerAjax extends JControllerLegacy { /** * Method to fetch associations of a menu item * * The method assumes that the following http parameters are passed in an Ajax Get request: * token: the form token * assocId: the id of the menu item whose associations are to be returned * excludeLang: the association for this language is to be excluded * * @return null * * @since 3.9.0 */ public function fetchAssociations() { if (!JSession::checkToken('get')) { echo new JResponseJson(null, JText::_('JINVALID_TOKEN'), true); } else { $input = JFactory::getApplication()->input; $extension = $input->get('extension'); $assocId = $input->getInt('assocId', 0); if ($assocId == 0) { echo new JResponseJson(null, JText::sprintf('JLIB_FORM_VALIDATE_FIELD_INVALID', 'assocId'), true); return; } $excludeLang = $input->get('excludeLang', '', 'STRING'); $associations = JLanguageAssociations::getAssociations('com_menus', '#__menu', 'com_menus.item', (int) $assocId, 'id', '', ''); unset($associations[$excludeLang]); // Add the title to each of the associated records JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_menus/tables'); $menuTable = JTable::getInstance('Menu', 'JTable', array()); foreach ($associations as $lang => $association) { $menuTable->load($association->id); $associations[$lang]->title = $menuTable->title; } $countContentLanguages = count(LanguageHelper::getContentLanguages(array(0, 1))); if (count($associations) == 0) { $message = JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_NONE'); } elseif ($countContentLanguages > count($associations) + 2) { $tags = implode(', ', array_keys($associations)); $message = JText::sprintf('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_SOME', $tags); } else { $message = JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_ALL'); } echo new JResponseJson($associations, $message); } } }Private