first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,79 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Utility class working with languages
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.6
*/
abstract class JHtmlLanguages
{
/**
* Method to generate an information about the default language
*
* @param boolean $published is the language the default?
*
* @return string html code
*/
public static function published($published)
{
if ($published)
{
return JHtml::_('image', 'menu/icon-16-default.png', JText::_('COM_LANGUAGES_HEADING_DEFAULT'), null, true);
}
else
{
return '&#160;';
}
}
/**
* Method to generate an input radio button
*
* @param integer $rowNum the row number
* @param string language tag
*
* @return string html code
*/
public static function id($rowNum, $language)
{
return '<input type="radio" id="cb' . $rowNum . '" name="cid" value="' . htmlspecialchars($language) . '" onclick="Joomla.isChecked(this.checked);" title="' . ($rowNum + 1) . '"/>';
}
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;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,129 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* JSON Response class
*
* @package Joomla.Administrator
* @subpackage com_languages
* @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)
{
JLog::add('Class JJsonResponse is deprecated. Use class JResponseJson instead.', JLog::WARNING, 'deprecated');
$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);
}
}

View File

@ -0,0 +1,135 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages component helper.
*
* @package Joomla.Administrator
* @subpackage com_languages
* @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
*/
public static function addSubmenu($vName, $client = 0)
{
JHtmlSidebar::addEntry(
JText::_('COM_LANGUAGES_SUBMENU_INSTALLED_SITE'),
'index.php?option=com_languages&view=installed&client=0',
$vName == 'installed' && $client === 0
);
JHtmlSidebar::addEntry(
JText::_('COM_LANGUAGES_SUBMENU_INSTALLED_ADMINISTRATOR'),
'index.php?option=com_languages&view=installed&client=1',
$vName == 'installed' && $client === 1
);
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
*/
public static function getActions()
{
$user = JFactory::getUser();
$result = new JObject;
$assetName = 'com_languages';
$actions = JAccess::getActions($assetName);
foreach ($actions as $action)
{
$result->set($action->name, $user->authorise($action->name, $assetName));
}
return $result;
}
/**
* 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
*/
public static function parseFile($filename)
{
if (!is_file($filename))
{
return array();
}
$contents = file_get_contents($filename);
$contents = str_replace('_QQ_', '"\""', $contents);
$strings = @parse_ini_string($contents);
if ($strings === false)
{
return array();
}
return $strings;
}
/**
* 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);
}
}

View File

@ -0,0 +1,133 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Multilang status helper.
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.7.1
*/
abstract class MultilangstatusHelper
{
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();
}
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();
}
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();
}
public static function getSitelangs()
{
// check for published Site Languages
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.element AS element')
->from('#__extensions AS a')
->where('a.type = ' . $db->quote('language'))
->where('a.client_id = 0')
->where('a.enabled = 1');
$db->setQuery($query);
return $db->loadObjectList('element');
}
public static function getHomepages()
{
// Check for Home pages languages
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('language')
->from($db->quoteName('#__menu'))
->where('home = 1')
->where('published = 1')
->where('client_id = 0');
$db->setQuery($query);
return $db->loadObjectList('language');
}
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();
}
public static function getContacts()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('u.name, count(cd.language) as counted, MAX(cd.language=' . $db->quote('*') . ') as all_languages')
->from('#__users AS u')
->join('LEFT', '#__contact_details AS cd ON cd.user_id=u.id')
->join('LEFT', '#__languages as l on cd.language=l.lang_code')
->where('EXISTS (SELECT * from #__content as c where c.created_by=u.id)')
->where('(l.published=1 or cd.language=' . $db->quote('*') . ')')
->where('cd.published=1')
->group('u.id')
->having('(counted !=' . count(JLanguageHelper::getLanguages()) . ' OR all_languages=1)')
->having('(counted !=1 OR all_languages=0)');
$db->setQuery($query);
return $db->loadObjectList();
}
}