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,136 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_config
*
* @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('JPATH_BASE') or die;
/**
* Text Filters form field.
*
* @package Joomla.Administrator
* @subpackage com_config
* @since 1.6
*/
class JFormFieldFilters extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
public $type = 'Filters';
/**
* Method to get the field input markup.
*
* TODO: Add access check.
*
* @return string The field input markup.
*
* @since 1.6
*/
protected function getInput()
{
// Get the available user groups.
$groups = $this->getUserGroups();
// Build the form control.
$html = array();
// Open the table.
$html[] = '<table id="filter-config" class="table table-striped">';
// The table heading.
$html[] = ' <thead>';
$html[] = ' <tr>';
$html[] = ' <th>';
$html[] = ' <span class="acl-action">' . JText::_('JGLOBAL_FILTER_GROUPS_LABEL') . '</span>';
$html[] = ' </th>';
$html[] = ' <th>';
$html[] = ' <span class="acl-action">' . JText::_('JGLOBAL_FILTER_TYPE_LABEL') . '</span>';
$html[] = ' </th>';
$html[] = ' <th>';
$html[] = ' <span class="acl-action">' . JText::_('JGLOBAL_FILTER_TAGS_LABEL') . '</span>';
$html[] = ' </th>';
$html[] = ' <th>';
$html[] = ' <span class="acl-action">' . JText::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL') . '</span>';
$html[] = ' </th>';
$html[] = ' </tr>';
$html[] = ' </thead>';
// The table body.
$html[] = ' <tbody>';
foreach ($groups as $group)
{
if (!isset($this->value[$group->value]))
{
$this->value[$group->value] = array('filter_type' => 'BL', 'filter_tags' => '', 'filter_attributes' => '');
}
$group_filter = $this->value[$group->value];
$html[] = ' <tr>';
$html[] = ' <th class="acl-groups left">';
$html[] = ' ' . str_repeat('<span class="gi">|&mdash;</span>', $group->level) . $group->text;
$html[] = ' </th>';
$html[] = ' <td>';
$html[] = ' <select name="' . $this->name . '[' . $group->value . '][filter_type]" id="' . $this->id . $group->value . '_filter_type">';
$html[] = ' <option value="BL"' . ($group_filter['filter_type'] == 'BL' ? ' selected="selected"' : '') . '>' . JText::_('COM_CONFIG_FIELD_FILTERS_DEFAULT_BLACK_LIST') . '</option>';
$html[] = ' <option value="CBL"' . ($group_filter['filter_type'] == 'CBL' ? ' selected="selected"' : '') . '>' . JText::_('COM_CONFIG_FIELD_FILTERS_CUSTOM_BLACK_LIST') . '</option>';
$html[] = ' <option value="WL"' . ($group_filter['filter_type'] == 'WL' ? ' selected="selected"' : '') . '>' . JText::_('COM_CONFIG_FIELD_FILTERS_WHITE_LIST') . '</option>';
$html[] = ' <option value="NH"' . ($group_filter['filter_type'] == 'NH' ? ' selected="selected"' : '') . '>' . JText::_('COM_CONFIG_FIELD_FILTERS_NO_HTML') . '</option>';
$html[] = ' <option value="NONE"' . ($group_filter['filter_type'] == 'NONE' ? ' selected="selected"' : '') . '>' . JText::_('COM_CONFIG_FIELD_FILTERS_NO_FILTER') . '</option>';
$html[] = ' </select>';
$html[] = ' </td>';
$html[] = ' <td>';
$html[] = ' <input name="' . $this->name . '[' . $group->value . '][filter_tags]" id="' . $this->id . $group->value . '_filter_tags" value="' . $group_filter['filter_tags'] . '"/>';
$html[] = ' </td>';
$html[] = ' <td>';
$html[] = ' <input name="' . $this->name . '[' . $group->value . '][filter_attributes]" id="' . $this->id . $group->value . '_filter_attributes" value="' . $group_filter['filter_attributes'] . '"/>';
$html[] = ' </td>';
$html[] = ' </tr>';
}
$html[] = ' </tbody>';
// Close the table.
$html[] = '</table>';
// Add notes
$html[] = '<div class="alert">';
$html[] = '<p>' . JText::_('JGLOBAL_FILTER_TYPE_DESC') . '</p>';
$html[] = '<p>' . JText::_('JGLOBAL_FILTER_TAGS_DESC') . '</p>';
$html[] = '<p>' . JText::_('JGLOBAL_FILTER_ATTRIBUTES_DESC') . '</p>';
$html[] = '</div>';
return implode("\n", $html);
}
/**
* A helper to get the list of user groups.
*
* @return array
*
* @since 1.6
*/
protected function getUserGroups()
{
// Get a database object.
$db = JFactory::getDbo();
// Get the user groups from the database.
$query = $db->getQuery(true)
->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level')
->from('#__usergroups AS a')
->join('LEFT', '#__usergroups AS b on a.lft > b.lft AND a.rgt < b.rgt')
->group('a.id, a.title, a.lft')
->order('a.lft ASC');
$db->setQuery($query);
$options = $db->loadObjectList();
return $options;
}
}

View File

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