Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/com_languages.zip
Назад
PK ��!]�:L� � helpers/multilangstatus.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2011 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\Registry\Registry; /** * Multilang status helper. * * @since 1.7.1 */ abstract class MultilangstatusHelper { /** * Method to get the number of published home pages. * * @return integer */ public static function getHomes() { // Check for multiple Home pages. $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('COUNT(*)') ->from($db->quoteName('#__menu')) ->where('home = 1') ->where('published = 1') ->where('client_id = 0'); $db->setQuery($query); return $db->loadResult(); } /** * Method to get the number of published language switcher modules. * * @return integer */ public static function getLangswitchers() { // Check if switcher is published. $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('COUNT(*)') ->from($db->quoteName('#__modules')) ->where('module = ' . $db->quote('mod_languages')) ->where('published = 1') ->where('client_id = 0'); $db->setQuery($query); return $db->loadResult(); } /** * Method to return a list of published content languages. * * @return array of language objects. */ public static function getContentlangs() { // Check for published Content Languages. $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.lang_code AS lang_code') ->select('a.published AS published') ->from('#__languages AS a'); $db->setQuery($query); return $db->loadObjectList(); } /** * Method to return a list of published site languages. * * @return array of language extension objects. * * @deprecated 4.0 Use JLanguageHelper::getInstalledLanguages(0) instead. */ public static function getSitelangs() { try { JLog::add( sprintf('%s() is deprecated, use JLanguageHelper::getInstalledLanguages(0) instead.', __METHOD__), JLog::WARNING, 'deprecated' ); } catch (RuntimeException $exception) { // Informational log only } return JLanguageHelper::getInstalledLanguages(0); } /** * Method to return a list of language home page menu items. * * @return array of menu objects. * * @deprecated 4.0 Use JLanguageMultilang::getSiteHomePages() instead. */ public static function getHomepages() { try { JLog::add( sprintf('%s() is deprecated, use JLanguageHelper::getSiteHomePages() instead.', __METHOD__), JLog::WARNING, 'deprecated' ); } catch (RuntimeException $exception) { // Informational log only } return JLanguageMultilang::getSiteHomePages(); } /** * Method to return combined language status. * * @return array of language objects. */ public static function getStatus() { // Check for combined status. $db = JFactory::getDbo(); $query = $db->getQuery(true); // Select all fields from the languages table. $query->select('a.*', 'l.home') ->select('a.published AS published') ->select('a.lang_code AS lang_code') ->from('#__languages AS a'); // Select the language home pages. $query->select('l.home AS home') ->select('l.language AS home_language') ->join('LEFT', '#__menu AS l ON l.language = a.lang_code AND l.home=1 AND l.published=1 AND l.language <> \'*\'') ->select('e.enabled AS enabled') ->select('e.element AS element') ->join('LEFT', '#__extensions AS e ON e.element = a.lang_code') ->where('e.client_id = 0') ->where('e.enabled = 1') ->where('e.state = 0'); $db->setQuery($query); return $db->loadObjectList(); } /** * Method to return a list of contact objects. * * @return array of contact objects. */ public static function getContacts() { $db = JFactory::getDbo(); $languages = count(JLanguageHelper::getLanguages()); // Get the number of contact with all as language $alang = $db->getQuery(true) ->select('count(*)') ->from('#__contact_details AS cd') ->where('cd.user_id=u.id') ->where('cd.published=1') ->where('cd.language=' . $db->quote('*')); // Get the number of languages for the contact $slang = $db->getQuery(true) ->select('count(distinct(l.lang_code))') ->from('#__languages as l') ->join('LEFT', '#__contact_details AS cd ON cd.language=l.lang_code') ->where('cd.user_id=u.id') ->where('cd.published=1') ->where('l.published=1'); // Get the number of multiple contact/language $mlang = $db->getQuery(true) ->select('count(*)') ->from('#__languages as l') ->join('LEFT', '#__contact_details AS cd ON cd.language=l.lang_code') ->where('cd.user_id=u.id') ->where('cd.published=1') ->where('l.published=1') ->group('l.lang_code') ->having('count(*) > 1'); // Get the contacts $query = $db->getQuery(true) ->select('u.name, (' . $alang . ') as alang, (' . $slang . ') as slang, (' . $mlang . ') as mlang') ->from('#__users AS u') ->join('LEFT', '#__contact_details AS cd ON cd.user_id=u.id') ->where('EXISTS (SELECT 1 from #__content as c where c.created_by=u.id)') ->group('u.id'); $db->setQuery($query); $warnings = $db->loadObjectList(); foreach ($warnings as $index => $warn) { if ($warn->alang == 1 && $warn->slang == 0) { unset($warnings[$index]); } if ($warn->alang == 0 && $warn->slang == 0 && empty($warn->mlang)) { unset($warnings[$index]); } if ($warn->alang == 0 && $warn->slang == $languages && empty($warn->mlang)) { unset($warnings[$index]); } } return $warnings; } /** * Method to get the status of the module displaying the menutype of the default Home page set to All languages. * * @return boolean True if the module is published, false otherwise. * * @since 3.7.0 */ public static function getDefaultHomeModule() { // Find Default Home menutype. $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->qn('menutype')) ->from($db->qn('#__menu')) ->where($db->qn('home') . ' = ' . $db->q('1')) ->where($db->qn('published') . ' = ' . $db->q('1')) ->where($db->qn('client_id') . ' = ' . $db->q('0')) ->where($db->qn('language') . ' = ' . $db->q('*')); $db->setQuery($query); $menutype = $db->loadResult(); // Get published site menu modules titles. $query->clear() ->select($db->qn('title')) ->from($db->qn('#__modules')) ->where($db->qn('module') . ' = ' . $db->q('mod_menu')) ->where($db->qn('published') . ' = ' . $db->q('1')) ->where($db->qn('client_id') . ' = ' . $db->q('0')); $db->setQuery($query); $menutitles = $db->loadColumn(); // Do we have a published menu module displaying the default Home menu item set to all languages? foreach ($menutitles as $menutitle) { $module = self::getModule('mod_menu', $menutitle); $moduleParams = new JRegistry($module->params); $param = $moduleParams->get('menutype', ''); if ($param && $param != $menutype) { continue; } return true; } } /** * Get module by name * * @param string $moduleName The name of the module * @param string $instanceTitle The title of the module, optional * * @return stdClass The Module object * * @since 3.7.0 */ public static function getModule($moduleName, $instanceTitle = null) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('id, title, module, position, content, showtitle, params') ->from($db->qn('#__modules')) ->where($db->qn('module') . ' = ' . $db->q($moduleName)) ->where($db->qn('published') . ' = ' . $db->q('1')) ->where($db->qn('client_id') . ' = ' . $db->q('0')); if ($instanceTitle) { $query->where($db->qn('title') . ' = ' . $db->q($instanceTitle)); } $db->setQuery($query); try { $modules = $db->loadObject(); } catch (RuntimeException $e) { JLog::add(JText::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $e->getMessage()), JLog::WARNING, 'jerror'); } return $modules; } } PK ��!]Nbf� helpers/html/languages.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Utility class working with languages * * @since 1.6 */ abstract class JHtmlLanguages { /** * Method to generate an information about the default language. * * @param boolean $published True if the language is the default. * * @return string HTML code. */ public static function published($published) { if (!$published) { return ' '; } return JHtml::_('image', 'menu/icon-16-default.png', JText::_('COM_LANGUAGES_HEADING_DEFAULT'), null, true); } /** * Method to generate an input radio button. * * @param integer $rowNum The row number. * @param string $language Language tag. * * @return string HTML code. */ public static function id($rowNum, $language) { return '<input' . ' type="radio"' . ' id="cb' . $rowNum . '"' . ' name="cid"' . ' value="' . htmlspecialchars($language, ENT_COMPAT, 'UTF-8') . '"' . ' onclick="Joomla.isChecked(this.checked);"' . ' title="' . ($rowNum + 1) . '"' . '/>'; } /** * Method to generate an array of clients. * * @return array of client objects. */ public static function clients() { return array( JHtml::_('select.option', 0, JText::_('JSITE')), JHtml::_('select.option', 1, JText::_('JADMINISTRATOR')) ); } /** * Returns an array of published state filter options. * * @return string The HTML code for the select tag. * * @since 1.6 */ public static function publishedOptions() { // Build the active state filter options. $options = array(); $options[] = JHtml::_('select.option', '1', 'JPUBLISHED'); $options[] = JHtml::_('select.option', '0', 'JUNPUBLISHED'); $options[] = JHtml::_('select.option', '-2', 'JTRASHED'); $options[] = JHtml::_('select.option', '*', 'JALL'); return $options; } } PK ��!]RQ-�� � helpers/jsonresponse.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * JSON Response class. * * @since 2.5 * @deprecated 4.0 */ class JJsonResponse { /** * Determines whether the request was successful. * * @var boolean * @since 2.5 */ public $success = true; /** * Determines whether the request wasn't successful. * This is always the negation of $this->success, * so you can use both flags equivalently. * * @var boolean * @since 2.5 */ public $error = false; /** * The main response message. * * @var string * @since 2.5 */ public $message = null; /** * Array of messages gathered in the JApplication object. * * @var array * @since 2.5 */ public $messages = null; /** * The response data. * * @var mixed * @since 2.5 */ public $data = null; /** * Constructor * * @param mixed $response The Response data. * @param string $message The main response message. * @param boolean $error True, if the success flag shall be set to false, defaults to false. * * @since 2.5 * @deprecated 4.0 Use JResponseJson instead. */ public function __construct($response = null, $message = null, $error = false) { try { JLog::add(sprintf('%s is deprecated, use JResponseJson instead.', __CLASS__), JLog::WARNING, 'deprecated'); } catch (RuntimeException $exception) { // Informational log only } $this->message = $message; // Get the message queue. $messages = JFactory::getApplication()->getMessageQueue(); // Build the sorted messages list. if (is_array($messages) && count($messages)) { foreach ($messages as $message) { if (isset($message['type']) && isset($message['message'])) { $lists[$message['type']][] = $message['message']; } } } // If messages exist add them to the output. if (isset($lists) && is_array($lists)) { $this->messages = $lists; } // Check if we are dealing with an error. if ($response instanceof Exception) { // Prepare the error response. $this->success = false; $this->error = true; $this->message = $response->getMessage(); } else { // Prepare the response data. $this->success = !$error; $this->error = $error; $this->data = $response; } } /** * Magic toString method for sending the response in JSON format. * * @return string The response in JSON format. * * @since 2.5 */ public function __toString() { return json_encode($this); } } PK ��!]��1� � helpers/languages.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages component helper. * * @since 1.6 */ class LanguagesHelper { /** * Configure the Linkbar. * * @param string $vName The name of the active view. * @param int $client The client id of the active view. Maybe be 0 or 1. * * @return void * * @deprecated 4.0 $client parameter is not needed anymore. */ public static function addSubmenu($vName, $client = 0) { JHtmlSidebar::addEntry( JText::_('COM_LANGUAGES_SUBMENU_INSTALLED'), 'index.php?option=com_languages&view=installed', $vName == 'installed' ); JHtmlSidebar::addEntry( JText::_('COM_LANGUAGES_SUBMENU_CONTENT'), 'index.php?option=com_languages&view=languages', $vName == 'languages' ); JHtmlSidebar::addEntry( JText::_('COM_LANGUAGES_SUBMENU_OVERRIDES'), 'index.php?option=com_languages&view=overrides', $vName == 'overrides' ); } /** * Gets a list of the actions that can be performed. * * @return JObject * * @deprecated 3.2 Use JHelperContent::getActions() instead. */ public static function getActions() { // Log usage of deprecated function. try { JLog::add( sprintf('%s() is deprecated. Use JHelperContent::getActions() with new arguments order instead.', __METHOD__), JLog::WARNING, 'deprecated' ); } catch (RuntimeException $exception) { // Informational log only } // Get list of actions. return JHelperContent::getActions('com_languages'); } /** * Method for parsing ini files. * * @param string $fileName Path and name of the ini file to parse. * * @return array Array of strings found in the file, the array indices will be the keys. On failure an empty array will be returned. * * @since 2.5 * @deprecated 3.9.0 Use JLanguageHelper::parseIniFile() instead. */ public static function parseFile($fileName) { return JLanguageHelper::parseIniFile($fileName); } /** * Filter method for language keys. * This method will be called by JForm while filtering the form data. * * @param string $value The language key to filter. * * @return string The filtered language key. * * @since 2.5 */ public static function filterKey($value) { $filter = JFilterInput::getInstance(null, null, 1, 1); return strtoupper($filter->clean($value, 'cmd')); } /** * Filter method for language strings. * This method will be called by JForm while filtering the form data. * * @param string $value The language string to filter. * * @return string The filtered language string. * * @since 2.5 */ public static function filterText($value) { $filter = JFilterInput::getInstance(null, null, 1, 1); return $filter->clean($value); } } PK ��!]s[ө languages.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?> <extension type="component" version="3.1" method="upgrade"> <name>com_languages</name> <author>Joomla! Project</author> <creationDate>April 2006</creationDate> <copyright>(C) 2006 Open Source Matters, Inc.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>3.0.0</version> <description>COM_LANGUAGES_XML_DESCRIPTION</description> <administration> <files folder="admin"> <filename>config.xml</filename> <filename>controller.php</filename> <filename>languages.php</filename> <folder>controllers</folder> <folder>helpers</folder> <folder>models</folder> <folder>tables</folder> <folder>views</folder> </files> <languages folder="admin"> <language tag="en-GB">language/en-GB.com_languages.ini</language> <language tag="en-GB">language/en-GB.com_languages.sys.ini</language> </languages> </administration> </extension> PK ��!]��m\ \ languages.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.tabstate'); if (!JFactory::getUser()->authorise('core.manage', 'com_languages')) { throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); } $controller = JControllerLegacy::getInstance('Languages'); $controller->execute(JFactory::getApplication()->input->get('task')); $controller->redirect(); PK ��!]N�D� � models/overrides.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages Overrides Model * * @since 2.5 */ class LanguagesModelOverrides extends JModelList { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @since 2.5 */ public function __construct($config = array()) { parent::__construct($config); $this->filter_fields = array('key', 'text'); } /** * Retrieves the overrides data * * @param boolean $all True if all overrides shall be returned without considering pagination, defaults to false * * @return array Array of objects containing the overrides of the override.ini file * * @since 2.5 */ public function getOverrides($all = false) { // Get a storage key. $store = $this->getStoreId(); // Try to load the data from internal storage. if (!empty($this->cache[$store])) { return $this->cache[$store]; } $client = strtoupper($this->getState('filter.client')); // Parse the override.ini file in order to get the keys and strings. $fileName = constant('JPATH_' . $client) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini'; $strings = JLanguageHelper::parseIniFile($fileName); // Delete the override.ini file if empty. if (file_exists($fileName) && $strings === array()) { JFile::delete($fileName); } // Filter the loaded strings according to the search box. $search = $this->getState('filter.search'); if ($search != '') { $search = preg_quote($search, '~'); $matchvals = preg_grep('~' . $search . '~i', $strings); $matchkeys = array_intersect_key($strings, array_flip(preg_grep('~' . $search . '~i', array_keys($strings)))); $strings = array_merge($matchvals, $matchkeys); } // Consider the ordering if ($this->getState('list.ordering') == 'text') { if (strtoupper($this->getState('list.direction')) == 'DESC') { arsort($strings); } else { asort($strings); } } else { if (strtoupper($this->getState('list.direction')) == 'DESC') { krsort($strings); } else { ksort($strings); } } // Consider the pagination. if (!$all && $this->getState('list.limit') && $this->getTotal() > $this->getState('list.limit')) { $strings = array_slice($strings, $this->getStart(), $this->getState('list.limit'), true); } // Add the items to the internal cache. $this->cache[$store] = $strings; return $this->cache[$store]; } /** * Method to get the total number of overrides. * * @return integer The total number of overrides. * * @since 2.5 */ public function getTotal() { // Get a storage key. $store = $this->getStoreId('getTotal'); // Try to load the data from internal storage if (!empty($this->cache[$store])) { return $this->cache[$store]; } // Add the total to the internal cache. $this->cache[$store] = count($this->getOverrides(true)); return $this->cache[$store]; } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 2.5 */ protected function populateState($ordering = 'key', $direction = 'asc') { // We call populate state first so that we can then set the filter.client and filter.language properties in afterwards parent::populateState($ordering, $direction); $app = JFactory::getApplication(); $language_client = $this->getUserStateFromRequest('com_languages.overrides.language_client', 'language_client', '', 'cmd'); $client = substr($language_client, -1); $language = substr($language_client, 0, -1); // Sets the search filter. $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $this->setState('language_client', $language . $client); $this->setState('filter.client', $client ? 'administrator' : 'site'); $this->setState('filter.language', $language); // Add the 'language_client' value to the session to display a message if none selected $app->setUserState('com_languages.overrides.language_client', $language . $client); // Add filters to the session because they won't be stored there by 'getUserStateFromRequest' if they aren't in the current request. $app->setUserState('com_languages.overrides.filter.client', $client); $app->setUserState('com_languages.overrides.filter.language', $language); } /** * Method to delete one or more overrides. * * @param array $cids Array of keys to delete. * * @return integer Number of successfully deleted overrides, boolean false if an error occurred. * * @since 2.5 */ public function delete($cids) { // Check permissions first. if (!JFactory::getUser()->authorise('core.delete', 'com_languages')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED')); return false; } jimport('joomla.filesystem.file'); $filterclient = JFactory::getApplication()->getUserState('com_languages.overrides.filter.client'); $client = $filterclient == 0 ? 'SITE' : 'ADMINISTRATOR'; // Parse the override.ini file in oder to get the keys and strings. $fileName = constant('JPATH_' . $client) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini'; $strings = JLanguageHelper::parseIniFile($fileName); // Unset strings that shall be deleted foreach ($cids as $key) { if (isset($strings[$key])) { unset($strings[$key]); } } // Write override.ini file with the strings. if (JLanguageHelper::saveToIniFile($fileName, $strings) === false) { return false; } $this->cleanCache(); return count($cids); } /** * Removes all of the cached strings from the table. * * @return boolean result of operation * * @since 3.4.2 */ public function purge() { $db = JFactory::getDbo(); // Note: TRUNCATE is a DDL operation // This may or may not mean depending on your database try { $db->truncateTable('#__overrider'); } catch (RuntimeException $e) { return $e; } JFactory::getApplication()->enqueueMessage(JText::_('COM_LANGUAGES_VIEW_OVERRIDES_PURGE_SUCCESS')); } } PK ��!]i�< models/strings.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages Strings Model * * @since 2.5 */ class LanguagesModelStrings extends JModelLegacy { /** * Method for refreshing the cache in the database with the known language strings. * * @return boolean True on success, Exception object otherwise. * * @since 2.5 */ public function refresh() { JLoader::register('LanguagesHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/languages.php'); $app = JFactory::getApplication(); $app->setUserState('com_languages.overrides.cachedtime', null); // Empty the database cache first. try { $this->_db->setQuery('TRUNCATE TABLE ' . $this->_db->quoteName('#__overrider')); $this->_db->execute(); } catch (RuntimeException $e) { return $e; } // Create the insert query. $query = $this->_db->getQuery(true) ->insert($this->_db->quoteName('#__overrider')) ->columns('constant, string, file'); // Initialize some variables. $client = $app->getUserState('com_languages.overrides.filter.client', 'site') ? 'administrator' : 'site'; $language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB'); $base = constant('JPATH_' . strtoupper($client)); $path = $base . '/language/' . $language; $files = array(); // Parse common language directory. jimport('joomla.filesystem.folder'); if (is_dir($path)) { $files = JFolder::files($path, '.*ini$', false, true); } // Parse language directories of components. $files = array_merge($files, JFolder::files($base . '/components', '.*ini$', 3, true)); // Parse language directories of modules. $files = array_merge($files, JFolder::files($base . '/modules', '.*ini$', 3, true)); // Parse language directories of templates. $files = array_merge($files, JFolder::files($base . '/templates', '.*ini$', 3, true)); // Parse language directories of plugins. $files = array_merge($files, JFolder::files(JPATH_PLUGINS, '.*ini$', 4, true)); // Parse all found ini files and add the strings to the database cache. foreach ($files as $file) { $strings = LanguagesHelper::parseFile($file); if ($strings && count($strings)) { $query->clear('values'); foreach ($strings as $key => $string) { $query->values($this->_db->quote($key) . ',' . $this->_db->quote($string) . ',' . $this->_db->quote(JPath::clean($file))); } try { $this->_db->setQuery($query); $this->_db->execute(); } catch (RuntimeException $e) { return $e; } } } // Update the cached time. $app->setUserState('com_languages.overrides.cachedtime.' . $client . '.' . $language, time()); return true; } /** * Method for searching language strings. * * @return array Array of results on success, Exception object otherwise. * * @since 2.5 */ public function search() { $results = array(); $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); $searchTerm = $input->getString('searchstring'); $limitstart = $input->getInt('more'); try { $searchstring = $this->_db->quote('%' . $filter->clean($searchTerm, 'TRIM') . '%'); // Create the search query. $query = $this->_db->getQuery(true) ->select('constant, string, file') ->from($this->_db->quoteName('#__overrider')); if ($input->get('searchtype') == 'constant') { $query->where('constant LIKE ' . $searchstring); } else { $query->where('string LIKE ' . $searchstring); } // Consider the limitstart according to the 'more' parameter and load the results. $this->_db->setQuery($query, $limitstart, 10); $results['results'] = $this->_db->loadObjectList(); // Check whether there are more results than already loaded. $query->clear('select')->clear('limit') ->select('COUNT(id)'); $this->_db->setQuery($query); if ($this->_db->loadResult() > $limitstart + 10) { // If this is set a 'More Results' link will be displayed in the view. $results['more'] = $limitstart + 10; } } catch (RuntimeException $e) { return $e; } return $results; } } PK ��!]���� models/language.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2009 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\Utilities\ArrayHelper; /** * Languages Component Language Model * * @since 1.5 */ class LanguagesModelLanguage extends JModelAdmin { /** * Constructor. * * @param array $config An optional associative array of configuration settings. */ public function __construct($config = array()) { $config = array_merge( array( 'event_after_save' => 'onExtensionAfterSave', 'event_before_save' => 'onExtensionBeforeSave', 'events_map' => array( 'save' => 'extension' ) ), $config ); parent::__construct($config); } /** * Override to get the table. * * @param string $name Name of the table. * @param string $prefix Table name prefix. * @param array $options Array of options. * * @return JTable * * @since 1.6 */ public function getTable($name = '', $prefix = '', $options = array()) { return JTable::getInstance('Language'); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 1.6 */ protected function populateState() { $app = JFactory::getApplication('administrator'); $params = JComponentHelper::getParams('com_languages'); // Load the User state. $langId = $app->input->getInt('lang_id'); $this->setState('language.id', $langId); // Load the parameters. $this->setState('params', $params); } /** * Method to get a member item. * * @param integer $langId The id of the member to get. * * @return mixed User data object on success, false on failure. * * @since 1.0 */ public function getItem($langId = null) { $langId = (!empty($langId)) ? $langId : (int) $this->getState('language.id'); // Get a member row instance. $table = $this->getTable(); // Attempt to load the row. $return = $table->load($langId); // Check for a table object error. if ($return === false && $table->getError()) { $this->setError($table->getError()); return false; } // Set a valid accesslevel in case '0' is stored due to a bug in the installation SQL (was fixed with PR 2714). if ($table->access == '0') { $table->access = (int) JFactory::getConfig()->get('access'); } $properties = $table->getProperties(1); $value = ArrayHelper::toObject($properties, 'JObject'); return $value; } /** * Method to get the group form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return mixed A JForm object on success, false on failure. * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_languages.language', 'language', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } return $form; } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 1.6 */ protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState('com_languages.edit.language.data', array()); if (empty($data)) { $data = $this->getItem(); } $this->preprocessData('com_languages.language', $data); return $data; } /** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $langId = (!empty($data['lang_id'])) ? $data['lang_id'] : (int) $this->getState('language.id'); $isNew = true; $dispatcher = JEventDispatcher::getInstance(); JPluginHelper::importPlugin($this->events_map['save']); $table = $this->getTable(); $context = $this->option . '.' . $this->name; // Load the row if saving an existing item. if ($langId > 0) { $table->load($langId); $isNew = false; } // Prevent white spaces, including East Asian double bytes. $spaces = array('/\xE3\x80\x80/', ' '); $data['lang_code'] = str_replace($spaces, '', $data['lang_code']); // Prevent saving an incorrect language tag if (!preg_match('#\b([a-z]{2,3})[-]([A-Z]{2})\b#', $data['lang_code'])) { $this->setError(JText::_('COM_LANGUAGES_ERROR_LANG_TAG')); return false; } $data['sef'] = str_replace($spaces, '', $data['sef']); $data['sef'] = JApplicationHelper::stringURLSafe($data['sef']); // Prevent saving an empty url language code if ($data['sef'] === '') { $this->setError(JText::_('COM_LANGUAGES_ERROR_SEF')); return false; } // Bind the data. if (!$table->bind($data)) { $this->setError($table->getError()); return false; } // Check the data. if (!$table->check()) { $this->setError($table->getError()); return false; } // Trigger the before save event. $result = $dispatcher->trigger($this->event_before_save, array($context, &$table, $isNew)); // Check the event responses. if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; } // Store the data. if (!$table->store()) { $this->setError($table->getError()); return false; } // Trigger the after save event. $dispatcher->trigger($this->event_after_save, array($context, &$table, $isNew)); $this->setState('language.id', $table->lang_id); // Clean the cache. $this->cleanCache(); return true; } /** * Custom clean cache method. * * @param string $group Optional cache group name. * @param integer $clientId Application client id. * * @return void * * @since 1.6 */ protected function cleanCache($group = null, $clientId = 0) { parent::cleanCache('_system'); parent::cleanCache('com_languages'); } } PK ��!]�D�g& & models/override.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages Override Model * * @since 2.5 */ class LanguagesModelOverride extends JModelAdmin { /** * Method to get the record form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return mixed A JForm object on success, false on failure. * * @since 2.5 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_languages.override', 'override', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } $client = $this->getState('filter.client', 'site'); $language = $this->getState('filter.language', 'en-GB'); $langName = JLanguage::getInstance($language)->getName(); if (!$langName) { // If a language only exists in frontend, its metadata cannot be // loaded in backend at the moment, so fall back to the language tag. $langName = $language; } $form->setValue('client', null, JText::_('COM_LANGUAGES_VIEW_OVERRIDE_CLIENT_' . strtoupper($client))); $form->setValue('language', null, JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDE_LANGUAGE', $langName, $language)); $form->setValue('file', null, JPath::clean(constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini')); return $form; } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 2.5 */ protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState('com_languages.edit.override.data', array()); if (empty($data)) { $data = $this->getItem(); } $this->preprocessData('com_languages.override', $data); return $data; } /** * Method to get a single record. * * @param string $pk The key name. * * @return mixed Object on success, false otherwise. * * @since 2.5 */ public function getItem($pk = null) { $input = JFactory::getApplication()->input; $pk = !empty($pk) ? $pk : $input->get('id'); $fileName = constant('JPATH_' . strtoupper($this->getState('filter.client'))) . '/language/overrides/' . $this->getState('filter.language', 'en-GB') . '.override.ini'; $strings = JLanguageHelper::parseIniFile($fileName); $result = new stdClass; $result->key = ''; $result->override = ''; if (isset($strings[$pk])) { $result->key = $pk; $result->override = $strings[$pk]; } $oppositeFileName = constant('JPATH_' . strtoupper($this->getState('filter.client') == 'site' ? 'administrator' : 'site')) . '/language/overrides/' . $this->getState('filter.language', 'en-GB') . '.override.ini'; $oppositeStrings = JLanguageHelper::parseIniFile($oppositeFileName); $result->both = isset($oppositeStrings[$pk]) && ($oppositeStrings[$pk] == $strings[$pk]); return $result; } /** * Method to save the form data. * * @param array $data The form data. * @param boolean $oppositeClient Indicates whether the override should not be created for the current client. * * @return boolean True on success, false otherwise. * * @since 2.5 */ public function save($data, $oppositeClient = false) { jimport('joomla.filesystem.file'); $app = JFactory::getApplication(); $client = $app->getUserState('com_languages.overrides.filter.client', 0); $language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB'); // If the override should be created for both. if ($oppositeClient) { $client = 1 - $client; } // Return false if the constant is a reserved word, i.e. YES, NO, NULL, FALSE, ON, OFF, NONE, TRUE $blacklist = array('YES', 'NO', 'NULL', 'FALSE', 'ON', 'OFF', 'NONE', 'TRUE'); if (in_array($data['key'], $blacklist)) { $this->setError(JText::_('COM_LANGUAGES_OVERRIDE_ERROR_RESERVED_WORDS')); return false; } $client = $client ? 'administrator' : 'site'; // Parse the override.ini file in oder to get the keys and strings. $fileName = constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini'; $strings = JLanguageHelper::parseIniFile($fileName); if (isset($strings[$data['id']])) { // If an existent string was edited check whether // the name of the constant is still the same. if ($data['key'] == $data['id']) { // If yes, simply override it. $strings[$data['key']] = $data['override']; } else { // If no, delete the old string and prepend the new one. unset($strings[$data['id']]); $strings = array($data['key'] => $data['override']) + $strings; } } else { // If it is a new override simply prepend it. $strings = array($data['key'] => $data['override']) + $strings; } // Write override.ini file with the strings. if (JLanguageHelper::saveToIniFile($fileName, $strings) === false) { return false; } // If the override should be stored for both clients save // it also for the other one and prevent endless recursion. if (isset($data['both']) && $data['both'] && !$oppositeClient) { return $this->save($data, true); } return true; } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 2.5 */ protected function populateState() { $app = JFactory::getApplication(); $client = $app->getUserStateFromRequest('com_languages.overrides.filter.client', 'filter_client', 0, 'int') ? 'administrator' : 'site'; $this->setState('filter.client', $client); $language = $app->getUserStateFromRequest('com_languages.overrides.filter.language', 'filter_language', 'en-GB', 'cmd'); $this->setState('filter.language', $language); } } PK ��!]Ϫ��3 3 models/forms/language.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?> <form> <fieldset> <field name="lang_id" type="text" label="JGLOBAL_FIELD_ID_LABEL" description="JGLOBAL_FIELD_ID_DESC" class="readonly" default="0" readonly="true" /> <field name="lang_code" type="text" label="COM_LANGUAGES_FIELD_LANG_TAG_LABEL" description="COM_LANGUAGES_FIELD_LANG_TAG_DESC" maxlength="7" required="true" size="10" /> <field name="title" type="text" label="JGLOBAL_TITLE" description="COM_LANGUAGES_FIELD_TITLE_DESC" maxlength="50" required="true" size="40" /> <field name="title_native" type="text" label="COM_LANGUAGES_FIELD_TITLE_NATIVE_LABEL" description="COM_LANGUAGES_FIELD_TITLE_NATIVE_DESC" maxlength="50" required="true" size="40" /> <field name="sef" type="text" label="COM_LANGUAGES_FIELD_LANG_CODE_LABEL" description="COM_LANGUAGES_FIELD_LANG_CODE_DESC" maxlength="50" required="true" size="10" /> <field name="image" type="filelist" label="COM_LANGUAGES_FIELD_IMAGE_LABEL" description="COM_LANGUAGES_FIELD_IMAGE_DESC" stripext="1" directory="media/mod_languages/images/" hide_none="1" hide_default="1" filter="\.gif$" size="10" > <option value="">JNONE</option> </field> <field name="description" type="textarea" label="JGLOBAL_DESCRIPTION" description="COM_LANGUAGES_FIELD_DESCRIPTION_DESC" cols="80" rows="5" /> <field name="published" type="list" label="JSTATUS" description="COM_LANGUAGES_FIELD_PUBLISHED_DESC" default="1" size="1" > <option value="1">JPUBLISHED</option> <option value="0">JUNPUBLISHED</option> <option value="-2">JTRASHED</option> </field> <field name="access" type="accesslevel" label="JFIELD_ACCESS_LABEL" description="JFIELD_ACCESS_DESC" size="1" /> </fieldset> <fieldset name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS"> <field name="metakey" type="textarea" label="JFIELD_META_KEYWORDS_LABEL" description="JFIELD_META_KEYWORDS_DESC" rows="3" cols="30" /> <field name="metadesc" type="textarea" label="JFIELD_META_DESCRIPTION_LABEL" description="JFIELD_META_DESCRIPTION_DESC" rows="3" cols="30" /> </fieldset> <fieldset name="site_name" label="COM_LANGUAGES_FIELDSET_SITE_NAME_LABEL"> <field name="sitename" type="text" label="COM_LANGUAGES_FIELD_SITE_NAME_LABEL" description="COM_LANGUAGES_FIELD_SITE_NAME_DESC" filter="string" size="50" /> </fieldset> </form> PK ��!]�#,� � ! models/forms/filter_overrides.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?> <form> <field name="language_client" type="languageclient" onchange="this.form.submit();" > <option value="">COM_LANGUAGES_OVERRIDE_SELECT_LANGUAGE</option> </field> <fields name="filter"> <field name="search" type="text" inputmode="search" label="JSEARCH_FILTER" description="COM_LANGUAGES_VIEW_OVERRIDES_FILTER_SEARCH_DESC" hint="JSEARCH_FILTER" /> </fields> <fields name="list"> <field name="limit" type="limitbox" label="JGLOBAL_LIMIT" description="JGLOBAL_LIMIT" class="input-mini" default="25" onchange="this.form.submit();" /> </fields> </form> PK ��!]^���� � models/forms/override.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?> <form> <fieldset> <field name="key" type="text" label="COM_LANGUAGES_OVERRIDE_FIELD_KEY_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_KEY_DESC" size="60" required="true" filter="LanguagesHelper::filterKey" /> <field name="override" type="textarea" label="COM_LANGUAGES_OVERRIDE_FIELD_OVERRIDE_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_OVERRIDE_DESC" cols="50" rows="5" filter="LanguagesHelper::filterText" /> <field name="both" type="checkbox" label="COM_LANGUAGES_OVERRIDE_FIELD_BOTH_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_BOTH_DESC" value="true" filter="boolean" /> <field name="searchstring" type="text" label="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHSTRING_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHSTRING_DESC" size="50" /> <field name="searchtype" type="list" label="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_DESC" default="value" > <option value="constant">COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_CONSTANT</option> <option value="value">COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_TEXT</option> </field> <field name="language" type="text" label="COM_LANGUAGES_OVERRIDE_FIELD_LANGUAGE_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_LANGUAGE_DESC" filter="unset" readonly="true" class="readonly" size="50" /> <field name="client" type="text" label="COM_LANGUAGES_OVERRIDE_FIELD_CLIENT_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_CLIENT_DESC" filter="unset" readonly="true" class="readonly" size="50" /> <field name="file" type="text" label="COM_LANGUAGES_OVERRIDE_FIELD_FILE_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_FILE_DESC" filter="unset" readonly="true" class="readonly" size="80" /> <field name="id" type="hidden" /> </fieldset> </form> PK ��!]��"� � ! models/forms/filter_installed.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?> <form> <field name="client_id" type="list" onchange="jQuery('#filter_search, select[id^=filter_], #list_fullordering').val('');this.form.submit();" filtermode="selector" > <option value="0">JSITE</option> <option value="1">JADMINISTRATOR</option> </field> <fields name="filter"> <field name="search" type="text" inputmode="search" label="COM_LANGUAGES_INSTALLED_FILTER_SEARCH_LABEL" description="COM_LANGUAGES_INSTALLED_FILTER_SEARCH_DESC" hint="JSEARCH_FILTER" noresults="JGLOBAL_NO_MATCHING_RESULTS" /> </fields> <fields name="list"> <field name="fullordering" type="list" label="JGLOBAL_SORT_BY" description="JGLOBAL_SORT_BY" onchange="this.form.submit();" default="name ASC" validate="options" > <option value="">JGLOBAL_SORT_BY</option> <option value="name ASC">COM_LANGUAGES_HEADING_LANGUAGE_ASC</option> <option value="name DESC">COM_LANGUAGES_HEADING_LANGUAGE_DESC</option> <option value="nativeName ASC">COM_LANGUAGES_HEADING_TITLE_NATIVE_ASC</option> <option value="nativeName DESC">COM_LANGUAGES_HEADING_TITLE_NATIVE_DESC</option> <option value="language ASC">COM_LANGUAGES_HEADING_LANG_TAG_ASC</option> <option value="language DESC">COM_LANGUAGES_HEADING_LANG_TAG_DESC</option> <option value="published ASC">COM_LANGUAGES_HEADING_DEFAULT_ASC</option> <option value="published DESC">COM_LANGUAGES_HEADING_DEFAULT_DESC</option> <option value="version ASC">COM_LANGUAGES_HEADING_VERSION_ASC</option> <option value="version DESC">COM_LANGUAGES_HEADING_VERSION_DESC</option> <option value="creationDate ASC">COM_LANGUAGES_HEADING_DATE_ASC</option> <option value="creationDate DESC">COM_LANGUAGES_HEADING_DATE_DESC</option> <option value="author ASC">COM_LANGUAGES_HEADING_AUTHOR_ASC</option> <option value="author DESC">COM_LANGUAGES_HEADING_AUTHOR_DESC</option> <option value="authorEmail ASC">COM_LANGUAGES_HEADING_AUTHOR_EMAIL_ASC</option> <option value="authorEmail DESC">COM_LANGUAGES_HEADING_AUTHOR_EMAIL_DESC</option> <option value="extension_id ASC">JGRID_HEADING_ID_ASC</option> <option value="extension_id DESC">JGRID_HEADING_ID_DESC</option> </field> <field name="limit" type="limitbox" label="JGLOBAL_LIMIT" description="JGLOBAL_LIMIT" class="input-mini" default="25" onchange="this.form.submit();" /> </fields> </form> PK ��!]�M�`� � ! models/forms/filter_languages.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?> <form> <fields name="filter"> <field name="search" type="text" inputmode="search" label="JSEARCH_FILTER" description="COM_LANGUAGES_SEARCH_IN_TITLE" hint="JSEARCH_FILTER" /> <field name="published" type="status" filter="1,0,-2,*" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_PUBLISHED</option> </field> <field name="access" type="accesslevel" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_ACCESS</option> </field> </fields> <fields name="list"> <field name="fullordering" type="list" label="JGLOBAL_SORT_BY" description="JGLOBAL_SORT_BY" onchange="this.form.submit();" default="a.ordering ASC" validate="options" > <option value="">JGLOBAL_SORT_BY</option> <option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option> <option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option> <option value="a.published ASC">JSTATUS_ASC</option> <option value="a.published DESC">JSTATUS_DESC</option> <option value="a.title ASC">JGLOBAL_TITLE_ASC</option> <option value="a.title DESC">JGLOBAL_TITLE_DESC</option> <option value="a.title_native ASC">COM_LANGUAGES_HEADING_TITLE_NATIVE_ASC</option> <option value="a.title_native DESC">COM_LANGUAGES_HEADING_TITLE_NATIVE_DESC</option> <option value="a.lang_code ASC">COM_LANGUAGES_HEADING_LANG_TAG_ASC</option> <option value="a.lang_code DESC">COM_LANGUAGES_HEADING_LANG_TAG_DESC</option> <option value="a.sef ASC">COM_LANGUAGES_HEADING_LANG_CODE_ASC</option> <option value="a.sef DESC">COM_LANGUAGES_HEADING_LANG_CODE_DESC</option> <option value="a.image ASC">COM_LANGUAGES_HEADING_LANG_IMAGE_ASC</option> <option value="a.image DESC">COM_LANGUAGES_HEADING_LANG_IMAGE_DESC</option> <option value="a.access ASC">JGRID_HEADING_ACCESS_ASC</option> <option value="a.access DESC">JGRID_HEADING_ACCESS_DESC</option> <option value="l.home ASC">COM_LANGUAGES_HEADING_HOMEPAGE_ASC</option> <option value="l.home DESC">COM_LANGUAGES_HEADING_HOMEPAGE_DESC</option> <option value="a.lang_id ASC">JGRID_HEADING_ID_ASC</option> <option value="a.lang_id DESC">JGRID_HEADING_ID_DESC</option> </field> <field name="limit" type="limitbox" label="JGLOBAL_LIMIT" description="JGLOBAL_LIMIT" class="input-mini" default="25" onchange="this.form.submit();" /> </fields> </form> PK ��!]b� �� � models/fields/languageclient.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_newsfeeds * * @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; JFormHelper::loadFieldClass('list'); /** * Client Language List field. * * @since 3.9.0 */ class JFormFieldLanguageclient extends JFormFieldList { /** * The form field type. * * @var string * @since 3.9.0 */ protected $type = 'Languageclient'; /** * Cached form field options. * * @var array * @since 3.9.0 */ protected $cache = array(); /** * Method to get the field options. * * @return array The field option objects. * * @since 3.9.0 */ protected function getOptions() { // Try to load the data from our mini-cache. if (!empty($this->cache)) { return $this->cache; } // Get all languages of frontend and backend. $languages = array(); $site_languages = JLanguageHelper::getKnownLanguages(JPATH_SITE); $admin_languages = JLanguageHelper::getKnownLanguages(JPATH_ADMINISTRATOR); // Create a single array of them. foreach ($site_languages as $tag => $language) { $languages[$tag . '0'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JSITE')); } foreach ($admin_languages as $tag => $language) { $languages[$tag . '1'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JADMINISTRATOR')); } // Sort it by language tag and by client after that. ksort($languages); // Add the languages to the internal cache. $this->cache = array_merge(parent::getOptions(), $languages); return $this->cache; } } PK ��!]���{) {) models/installed.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2009 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\Utilities\ArrayHelper; /** * Languages Component Languages Model * * @since 1.6 */ class LanguagesModelInstalled extends JModelList { /** * @var object client object * @deprecated 4.0 */ protected $client = null; /** * @var object user object */ protected $user = null; /** * @var boolean|JExeption True, if FTP settings should be shown, or an exception */ protected $ftp = null; /** * @var string option name */ protected $option = null; /** * @var array languages description */ protected $data = null; /** * @var int total number of languages */ protected $total = null; /** * @var int total number of languages installed * @deprecated 4.0 */ protected $langlist = null; /** * @var string language path */ protected $path = null; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JController * @since 3.5 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'name', 'nativeName', 'language', 'author', 'published', 'version', 'creationDate', 'author', 'authorEmail', 'extension_id', 'client_id', ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = 'name', $direction = 'asc') { // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); // Special case for client id. $clientId = (int) $this->getUserStateFromRequest($this->context . '.client_id', 'client_id', 0, 'int'); $clientId = (!in_array($clientId, array (0, 1))) ? 0 : $clientId; $this->setState('client_id', $clientId); // Load the parameters. $params = JComponentHelper::getParams('com_languages'); $this->setState('params', $params); // List state information. parent::populateState($ordering, $direction); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. * * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('client_id'); $id .= ':' . $this->getState('filter.search'); return parent::getStoreId($id); } /** * Method to get the client object. * * @return object * * @since 1.6 */ public function getClient() { return JApplicationHelper::getClientInfo($this->getState('client_id', 0)); } /** * Method to get the ftp credentials. * * @return object * * @since 1.6 */ public function getFtp() { if (is_null($this->ftp)) { $this->ftp = JClientHelper::setCredentialsFromRequest('ftp'); } return $this->ftp; } /** * Method to get the option. * * @return object * * @since 1.6 */ public function getOption() { $option = $this->getState('option'); return $option; } /** * Method to get Languages item data. * * @return array * * @since 1.6 */ public function getData() { // Fetch language data if not fetched yet. if (is_null($this->data)) { $this->data = array(); $isCurrentLanguageRtl = JFactory::getLanguage()->isRtl(); $params = JComponentHelper::getParams('com_languages'); $installedLanguages = JLanguageHelper::getInstalledLanguages(null, true, true, null, null, null); // Compute all the languages. foreach ($installedLanguages as $clientId => $languages) { $defaultLanguage = $params->get(JApplicationHelper::getClientInfo($clientId)->name, 'en-GB'); foreach ($languages as $lang) { $row = new stdClass; $row->language = $lang->element; $row->name = $lang->metadata['name']; $row->nativeName = isset($lang->metadata['nativeName']) ? $lang->metadata['nativeName'] : '-'; $row->client_id = (int) $lang->client_id; $row->extension_id = (int) $lang->extension_id; $row->author = $lang->manifest['author']; $row->creationDate = $lang->manifest['creationDate']; $row->authorEmail = $lang->manifest['authorEmail']; $row->version = $lang->manifest['version']; $row->published = $defaultLanguage === $row->language ? 1 : 0; $row->checked_out = 0; // Fix wrongly set parentheses in RTL languages if ($isCurrentLanguageRtl) { $row->name = html_entity_decode($row->name . '‎', ENT_QUOTES, 'UTF-8'); $row->nativeName = html_entity_decode($row->nativeName . '‎', ENT_QUOTES, 'UTF-8'); } $this->data[] = $row; } } } $installedLanguages = array_merge($this->data); // Process filters. $clientId = (int) $this->getState('client_id'); $search = $this->getState('filter.search'); foreach ($installedLanguages as $key => $installedLanguage) { // Filter by client id. if (in_array($clientId, array(0, 1))) { if ($installedLanguage->client_id !== $clientId) { unset($installedLanguages[$key]); continue; } } // Filter by search term. if (!empty($search)) { if (stripos($installedLanguage->name, $search) === false && stripos($installedLanguage->nativeName, $search) === false && stripos($installedLanguage->language, $search) === false) { unset($installedLanguages[$key]); continue; } } } // Process ordering. $listOrder = $this->getState('list.ordering', 'name'); $listDirn = $this->getState('list.direction', 'ASC'); $installedLanguages = ArrayHelper::sortObjects($installedLanguages, $listOrder, strtolower($listDirn) === 'desc' ? -1 : 1, true, true); // Process pagination. $limit = (int) $this->getState('list.limit', 25); // Sets the total for pagination. $this->total = count($installedLanguages); if ($limit !== 0) { $start = (int) $this->getState('list.start', 0); return array_slice($installedLanguages, $start, $limit); } return $installedLanguages; } /** * Method to get installed languages data. * * @return string An SQL query. * * @since 1.6 * * @deprecated 4.0 */ protected function getLanguageList() { // Create a new db object. $db = $this->getDbo(); $query = $db->getQuery(true); $client = $this->getState('client_id'); $type = 'language'; // Select field element from the extensions table. $query->select($this->getState('list.select', 'a.element')) ->from('#__extensions AS a'); $type = $db->quote($type); $query->where('(a.type = ' . $type . ')') ->where('state = 0') ->where('enabled = 1') ->where('client_id=' . (int) $client); // For client_id = 1 do we need to check language table also? $db->setQuery($query); $this->langlist = $db->loadColumn(); return $this->langlist; } /** * Method to get the total number of Languages items. * * @return integer * * @since 1.6 */ public function getTotal() { if (is_null($this->total)) { $this->getData(); } return $this->total; } /** * Method to set the default language. * * @param integer $cid Id of the language to publish. * * @return boolean * * @since 1.6 */ public function publish($cid) { if ($cid) { $client = $this->getClient(); $params = JComponentHelper::getParams('com_languages'); $params->set($client->name, $cid); $table = JTable::getInstance('extension'); $id = $table->find(array('element' => 'com_languages')); // Load. if (!$table->load($id)) { $this->setError($table->getError()); return false; } $table->params = (string) $params; // Pre-save checks. if (!$table->check()) { $this->setError($table->getError()); return false; } // Save the changes. if (!$table->store()) { $this->setError($table->getError()); return false; } } else { $this->setError(JText::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED')); return false; } // Clean the cache of com_languages and component cache. $this->cleanCache(); $this->cleanCache('_system', 0); $this->cleanCache('_system', 1); return true; } /** * Method to get the folders. * * @return array Languages folders. * * @since 1.6 */ protected function getFolders() { if (is_null($this->folders)) { $path = $this->getPath(); jimport('joomla.filesystem.folder'); $this->folders = JFolder::folders($path, '.', false, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'pdf_fonts', 'overrides')); } return $this->folders; } /** * Method to get the path. * * @return string The path to the languages folders. * * @since 1.6 */ protected function getPath() { if (is_null($this->path)) { $client = $this->getClient(); $this->path = JLanguageHelper::getLanguagePath($client->path); } return $this->path; } /** * Method to compare two languages in order to sort them. * * @param object $lang1 The first language. * @param object $lang2 The second language. * * @return integer * * @since 1.6 * * @deprecated 4.0 */ protected function compareLanguages($lang1, $lang2) { return strcmp($lang1->name, $lang2->name); } /** * Method to switch the administrator language. * * @param string $cid The language tag. * * @return boolean * * @since 3.5 */ public function switchAdminLanguage($cid) { if ($cid) { $client = $this->getClient(); if ($client->name == 'administrator') { JFactory::getApplication()->setUserState('application.lang', $cid); } } else { JError::raiseWarning(500, JText::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED')); return false; } return true; } } PK ��!]G�C�� � models/languages.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages Model Class * * @since 1.6 */ class LanguagesModelLanguages extends JModelList { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JController * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'lang_id', 'a.lang_id', 'lang_code', 'a.lang_code', 'title', 'a.title', 'title_native', 'a.title_native', 'sef', 'a.sef', 'image', 'a.image', 'published', 'a.published', 'ordering', 'a.ordering', 'access', 'a.access', 'access_level', 'home', 'l.home', ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = 'a.ordering', $direction = 'asc') { // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.access', $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '', 'cmd')); $this->setState('filter.published', $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '', 'string')); // Load the parameters. $params = JComponentHelper::getParams('com_languages'); $this->setState('params', $params); // List state information. parent::populateState($ordering, $direction); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. * * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.published'); return parent::getStoreId($id); } /** * Method to build an SQL query to load the list data. * * @return string An SQL query * * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select all fields from the languages table. $query->select($this->getState('list.select', 'a.*', 'l.home')) ->from($db->quoteName('#__languages') . ' AS a'); // Join over the asset groups. $query->select('ag.title AS access_level') ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Select the language home pages. $query->select('l.home AS home') ->join('LEFT', $db->quoteName('#__menu') . ' AS l ON l.language = a.lang_code AND l.home=1 AND l.language <> ' . $db->quote('*')); // Filter on the published state. $published = $this->getState('filter.published'); if (is_numeric($published)) { $query->where('a.published = ' . (int) $published); } elseif ($published === '') { $query->where('(a.published IN (0, 1))'); } // Filter by search in title. $search = $this->getState('filter.search'); if (!empty($search)) { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $query->where('(a.title LIKE ' . $search . ')'); } // Filter by access level. if ($access = $this->getState('filter.access')) { $query->where('a.access = ' . (int) $access); } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); return $query; } /** * Set the published language(s). * * @param array $cid An array of language IDs. * @param integer $value The value of the published state. * * @return boolean True on success, false otherwise. * * @since 1.6 */ public function setPublished($cid, $value = 0) { return JTable::getInstance('Language')->publish($cid, $value); } /** * Method to delete records. * * @param array $pks An array of item primary keys. * * @return boolean Returns true on success, false on failure. * * @since 1.6 */ public function delete($pks) { // Sanitize the array. $pks = (array) $pks; // Get a row instance. $table = JTable::getInstance('Language'); // Iterate the items to delete each one. foreach ($pks as $itemId) { if (!$table->delete((int) $itemId)) { $this->setError($table->getError()); return false; } } // Clean the cache. $this->cleanCache(); return true; } /** * Custom clean cache method, 2 places for 2 clients. * * @param string $group Optional cache group name. * @param integer $clientId Application client id. * * @return void * * @since 1.6 */ protected function cleanCache($group = null, $clientId = 0) { parent::cleanCache('_system'); parent::cleanCache('com_languages'); } } PK ��!]���� � controllers/overrides.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages Overrides Controller. * * @since 2.5 */ class LanguagesControllerOverrides extends JControllerAdmin { /** * The prefix to use with controller messages. * * @var string * @since 2.5 */ protected $text_prefix = 'COM_LANGUAGES_VIEW_OVERRIDES'; /** * Method for deleting one or more overrides. * * @return void * * @since 2.5 */ public function delete() { // Check for request forgeries. $this->checkToken(); // Get items to delete from the request. $cid = (array) $this->input->get('cid', array(), 'string'); // Remove zero values resulting from input filter $cid = array_filter($cid); if (empty($cid)) { $this->setMessage(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), 'warning'); } else { // Get the model. $model = $this->getModel('overrides'); // Remove the items. if ($model->delete($cid)) { $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid))); } else { $this->setMessage($model->getError()); } } $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); } /** * Method to purge the overrider table. * * @return void * * @since 3.4.2 */ public function purge() { // Check for request forgeries. $this->checkToken(); $model = $this->getModel('overrides'); $model->purge(); $this->setRedirect(JRoute::_('index.php?option=com_languages&view=overrides', false)); } } PK ��!]5���3 3 controllers/strings.json.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages Strings JSON Controller * * @since 2.5 */ class LanguagesControllerStrings extends JControllerAdmin { /** * Method for refreshing the cache in the database with the known language strings * * @return void * * @since 2.5 */ public function refresh() { echo new JResponseJson($this->getModel('strings')->refresh()); } /** * Method for searching language strings * * @return void * * @since 2.5 */ public function search() { echo new JResponseJson($this->getModel('strings')->search()); } } PK ��!]d� � � controllers/override.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages Override Controller * * @since 2.5 */ class LanguagesControllerOverride extends JControllerForm { /** * Method to edit an existing override. * * @param string $key The name of the primary key of the URL variable (not used here). * @param string $urlVar The name of the URL variable if different from the primary key (not used here). * * @return void * * @since 2.5 */ public function edit($key = null, $urlVar = null) { // Do not cache the response to this, its a redirect JFactory::getApplication()->allowCache(false); $app = JFactory::getApplication(); $cid = (array) $this->input->post->get('cid', array(), 'string'); $context = "$this->option.edit.$this->context"; // Get the constant name. $recordId = (count($cid) ? $cid[0] : $this->input->get('id')); // Access check. if (!$this->allowEdit()) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED')); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); return; } $app->setUserState($context . '.data', null); $this->setRedirect('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, 'id')); } /** * Method to save an override. * * @param string $key The name of the primary key of the URL variable (not used here). * @param string $urlVar The name of the URL variable if different from the primary key (not used here). * * @return void * * @since 2.5 */ public function save($key = null, $urlVar = null) { // Check for request forgeries. $this->checkToken(); $app = JFactory::getApplication(); $model = $this->getModel(); $data = $this->input->post->get('jform', array(), 'array'); $context = "$this->option.edit.$this->context"; $task = $this->getTask(); $recordId = $this->input->get('id'); $data['id'] = $recordId; // Access check. if (!$this->allowSave($data, 'id')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED')); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); return; } // Validate the posted data. $form = $model->getForm($data, false); if (!$form) { $app->enqueueMessage($model->getError(), 'error'); return; } // Require helper for filter functions called by JForm. JLoader::register('LanguagesHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/languages.php'); // Test whether the data is valid. $validData = $model->validate($form, $data); // Check for validation errors. if ($validData === false) { // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof Exception) { $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); } else { $app->enqueueMessage($errors[$i], 'warning'); } } // Save the data in the session. $app->setUserState($context . '.data', $data); // Redirect back to the edit screen. $this->setRedirect( JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, 'id'), false) ); return; } // Attempt to save the data. if (!$model->save($validData)) { // Save the data in the session. $app->setUserState($context . '.data', $validData); // Redirect back to the edit screen. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError())); $this->setMessage($this->getError(), 'error'); $this->setRedirect( JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, 'id'), false) ); return; } // Add message of success. $this->setMessage(JText::_('COM_LANGUAGES_VIEW_OVERRIDE_SAVE_SUCCESS')); // Redirect the user and adjust session state based on the chosen task. switch ($task) { case 'apply': // Set the record data in the session. $app->setUserState($context . '.data', null); // Redirect back to the edit screen $this->setRedirect( JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($validData['key'], 'id'), false) ); break; case 'save2new': // Clear the record id and data from the session. $app->setUserState($context . '.data', null); // Redirect back to the edit screen $this->setRedirect( JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend(null, 'id'), false) ); break; default: // Clear the record id and data from the session. $app->setUserState($context . '.data', null); // Redirect to the list screen. $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); break; } } /** * Method to cancel an edit. * * @param string $key The name of the primary key of the URL variable (not used here). * * @return void * * @since 2.5 */ public function cancel($key = null) { $this->checkToken(); $app = JFactory::getApplication(); $context = "$this->option.edit.$this->context"; $app->setUserState($context . '.data', null); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); } } PK ��!]�Q<�D D controllers/language.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages list actions controller. * * @since 1.6 */ class LanguagesControllerLanguage extends JControllerForm { /** * Gets the URL arguments to append to an item redirect. * * @param int $recordId The primary key id for the item. * @param string $key The name of the primary key variable. * * @return string The arguments to append to the redirect URL. * * @since 1.6 */ protected function getRedirectToItemAppend($recordId = null, $key = 'lang_id') { return parent::getRedirectToItemAppend($recordId, $key); } } PK ��!]u� | | controllers/languages.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages controller Class. * * @since 1.6 */ class LanguagesControllerLanguages extends JControllerAdmin { /** * Method to get a model object, loading it if required. * * @param string $name The model name. Optional. * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * * @return object The model. * * @since 1.6 */ public function getModel($name = 'Language', $prefix = 'LanguagesModel', $config = array('ignore_request' => true)) { return parent::getModel($name, $prefix, $config); } /** * Method to save the submitted ordering values for records via AJAX. * * @return void * * @since 3.1 */ public function saveOrderAjax() { // Check for request forgeries. $this->checkToken(); $pks = (array) $this->input->post->get('cid', array(), 'int'); $order = (array) $this->input->post->get('order', array(), 'int'); // Remove zero PK's and corresponding order values resulting from input filter for PK foreach ($pks as $i => $pk) { if ($pk === 0) { unset($pks[$i]); unset($order[$i]); } } // Get the model. $model = $this->getModel(); // Save the ordering. $return = $model->saveorder($pks, $order); if ($return) { echo '1'; } // Close the application. JFactory::getApplication()->close(); } } PK ��!]���% % controllers/installed.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages Controller. * * @since 1.5 */ class LanguagesControllerInstalled extends JControllerLegacy { /** * Task to set the default language. * * @return void */ public function setDefault() { // Check for request forgeries. $this->checkToken(); $cid = (string) $this->input->get('cid', '', 'string'); $model = $this->getModel('installed'); if ($model->publish($cid)) { // Switching to the new administrator language for the message if ($model->getState('client_id') == 1) { $language = JFactory::getLanguage(); $newLang = JLanguage::getInstance($cid); JFactory::$language = $newLang; JFactory::getApplication()->loadLanguage($language = $newLang); $newLang->load('com_languages', JPATH_ADMINISTRATOR); } $msg = JText::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED'); $type = 'message'; } else { $msg = $this->getError(); $type = 'error'; } $clientId = $model->getState('client_id'); $this->setredirect('index.php?option=com_languages&view=installed&client=' . $clientId, $msg, $type); } /** * Task to switch the administrator language. * * @return void */ public function switchAdminLanguage() { // Check for request forgeries. $this->checkToken(); $cid = (string) $this->input->get('cid', '', 'string'); $model = $this->getModel('installed'); // Fetching the language name from the xx-XX.xml or langmetadata.xml respectively. $file = JPATH_ADMINISTRATOR . '/language/' . $cid . '/' . $cid . '.xml'; if (!is_file($file)) { $file = JPATH_ADMINISTRATOR . '/language/' . $cid . '/langmetadata.xml'; } $info = JInstaller::parseXMLInstallFile($file); if ($model->switchAdminLanguage($cid)) { // Switching to the new language for the message $languageName = $info['name']; $language = JFactory::getLanguage(); $newLang = JLanguage::getInstance($cid); JFactory::$language = $newLang; JFactory::getApplication()->loadLanguage($language = $newLang); $newLang->load('com_languages', JPATH_ADMINISTRATOR); $msg = JText::sprintf('COM_LANGUAGES_MSG_SWITCH_ADMIN_LANGUAGE_SUCCESS', $languageName); $type = 'message'; } else { $msg = $this->getError(); $type = 'error'; } $this->setredirect('index.php?option=com_languages&view=installed', $msg, $type); } } PK ��!]W�5� views/override/tmpl/edit.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('behavior.formvalidator'); JHtml::_('behavior.keepalive'); JHtml::_('formbehavior.chosen', 'select'); $expired = ($this->state->get('cache_expired') == 1 ) ? '1' : ''; JHtml::_('stylesheet', 'overrider/overrider.css', array('version' => 'auto', 'relative' => true)); JHtml::_('behavior.core'); JHtml::_('jquery.framework'); JHtml::_('script', 'overrider/overrider.min.js', array('version' => 'auto', 'relative' => true)); JFactory::getDocument()->addScriptDeclaration(' jQuery(document).ready(function($) { $("#jform_searchstring").on("focus", function() { if (!Joomla.overrider.states.refreshed) { var expired = "' . $expired . '"; if (expired) { Joomla.overrider.refreshCache(); Joomla.overrider.states.refreshed = true; } } $(this).removeClass("invalid"); }); }); Joomla.submitbutton = function(task) { if (task == "override.cancel" || document.formvalidator.isValid(document.getElementById("override-form"))) { Joomla.submitform(task, document.getElementById("override-form")); } }; '); ?> <form action="<?php echo JRoute::_('index.php?option=com_languages&id=' . $this->item->key); ?>" method="post" name="adminForm" id="override-form" class="form-validate form-horizontal"> <div class="row-fluid"> <div class="span6"> <fieldset> <legend><?php echo empty($this->item->key) ? JText::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_NEW_OVERRIDE_LEGEND') : JText::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_EDIT_OVERRIDE_LEGEND'); ?></legend> <div class="control-group"> <div class="control-label"> <?php echo $this->form->getLabel('language'); ?> </div> <div class="controls"> <?php echo $this->form->getInput('language'); ?> </div> </div> <div class="control-group"> <div class="control-label"> <?php echo $this->form->getLabel('client'); ?> </div> <div class="controls"> <?php echo $this->form->getInput('client'); ?> </div> </div> <div class="control-group"> <div class="control-label"> <?php echo $this->form->getLabel('key'); ?> </div> <div class="controls"> <?php echo $this->form->getInput('key'); ?> </div> </div> <div class="control-group"> <div class="control-label"> <?php echo $this->form->getLabel('override'); ?> </div> <div class="controls"> <?php echo $this->form->getInput('override'); ?> </div> </div> <?php if ($this->state->get('filter.client') == 'administrator') : ?> <div class="control-group"> <div class="control-label"> <?php echo $this->form->getLabel('both'); ?> </div> <div class="controls"> <?php echo $this->form->getInput('both'); ?> </div> </div> <?php endif; ?> <div class="control-group"> <div class="control-label"> <?php echo $this->form->getLabel('file'); ?> </div> <div class="controls"> <?php echo $this->form->getInput('file'); ?> </div> </div> </fieldset> </div> <div class="span6"> <fieldset> <legend><?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_SEARCH_LEGEND'); ?></legend> <div class="alert alert-info"><p><?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_SEARCH_TIP'); ?></p></div> <div class="control-group"> <?php echo $this->form->getInput('searchstring'); ?> <button type="submit" class="btn btn-primary" onclick="Joomla.overrider.searchStrings();return false;" formnovalidate> <?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_SEARCH_BUTTON'); ?> </button> <span id="refresh-status" class="overrider-spinner help-block"> <?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_REFRESHING'); ?> </span> </div> <div class="control-group"> <div class="control-label"> <?php echo $this->form->getLabel('searchtype'); ?> </div> <div class="controls"> <?php echo $this->form->getInput('searchtype'); ?> </div> </div> </fieldset> <fieldset id="results-container" class="adminform"> <legend><?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_RESULTS_LEGEND'); ?></legend> <span id="more-results"> <a href="javascript:Joomla.overrider.searchStrings(Joomla.overrider.states.more);"> <?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_MORE_RESULTS'); ?></a> </span> </fieldset> <input type="hidden" name="task" value="" /> <input type="hidden" name="id" value="<?php echo $this->item->key; ?>" /> <?php echo JHtml::_('form.token'); ?> </div> </div> </form> PK ��!]#���a a views/override/view.html.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * View to edit a language override * * @since 2.5 */ class LanguagesViewOverride extends JViewLegacy { /** * The form to use for the view. * * @var object * @since 2.5 */ protected $form; /** * The item to edit. * * @var object * @since 2.5 */ protected $item; /** * The model state. * * @var object * @since 2.5 */ protected $state; /** * Displays the view. * * @param string $tpl The name of the template file to parse * * @return void * * @since 2.5 */ public function display($tpl = null) { $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $app = JFactory::getApplication(); $languageClient = $app->getUserStateFromRequest('com_languages.overrides.language_client', 'language_client'); if ($languageClient == null) { $app->enqueueMessage(JText::_('COM_LANGUAGES_OVERRIDE_FIRST_SELECT_MESSAGE'), 'warning'); $app->redirect('index.php?option=com_languages&view=overrides'); } // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); } // Check whether the cache has to be refreshed. $cached_time = JFactory::getApplication()->getUserState( 'com_languages.overrides.cachedtime.' . $this->state->get('filter.client') . '.' . $this->state->get('filter.language'), 0 ); if (time() - $cached_time > 60 * 5) { $this->state->set('cache_expired', true); } // Add strings for translations in Javascript. JText::script('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS'); JText::script('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR'); $this->addToolbar(); parent::display($tpl); } /** * Adds the page title and toolbar. * * @return void * * @since 2.5 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $canDo = JHelperContent::getActions('com_languages'); JToolbarHelper::title(JText::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_TITLE'), 'comments-2 langmanager'); if ($canDo->get('core.edit')) { JToolbarHelper::apply('override.apply'); JToolbarHelper::save('override.save'); } // This component does not support Save as Copy. if ($canDo->get('core.edit') && $canDo->get('core.create')) { JToolbarHelper::save2new('override.save2new'); } if (empty($this->item->key)) { JToolbarHelper::cancel('override.cancel'); } else { JToolbarHelper::cancel('override.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_OVERRIDES_EDIT'); } } PK ��!]U��� # views/multilangstatus/view.html.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Displays the multilang status. * * @since 1.7.1 */ class LanguagesViewMultilangstatus extends JViewLegacy { /** * Display the view. * * @param string $tpl The name of the template file to parse. * * @return void */ public function display($tpl = null) { JLoader::register('MultilangstatusHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/multilangstatus.php'); $this->homes = MultilangstatusHelper::getHomes(); $this->language_filter = JLanguageMultilang::isEnabled(); $this->switchers = MultilangstatusHelper::getLangswitchers(); $this->listUsersError = MultilangstatusHelper::getContacts(); $this->contentlangs = MultilangstatusHelper::getContentlangs(); $this->site_langs = JLanguageHelper::getInstalledLanguages(0); $this->statuses = MultilangstatusHelper::getStatus(); $this->homepages = JLanguageMultilang::getSiteHomePages(); $this->defaultHome = MultilangstatusHelper::getDefaultHomeModule(); parent::display($tpl); } } PK ��!]���p'