Spade
Mini Shell
PK8F�[j�)eecom_ajax/ajax.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_ajax
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/*
* References
* Support plugins in your component
* -
https://docs.joomla.org/Special:MyLanguage/Supporting_plugins_in_your_component
*
* Best way for JSON output
* -
https://groups.google.com/d/msg/joomla-dev-cms/WsC0nA9Fixo/Ur-gPqpqh-EJ
*/
/** @var \Joomla\CMS\Application\CMSApplication $app */
$app = JFactory::getApplication();
$app->allowCache(false);
// Prevent the api url from being indexed
$app->setHeader('X-Robots-Tag', 'noindex,
nofollow');
// JInput object
$input = $app->input;
// Requested format passed via URL
$format = strtolower($input->getWord('format'));
// Initialize default response and module name
$results = null;
$parts = null;
// Check for valid format
if (!$format)
{
$results = new
InvalidArgumentException(JText::_('COM_AJAX_SPECIFY_FORMAT'),
404);
}
/*
* Module support.
*
* modFooHelper::getAjax() is called where 'foo' is the value
* of the 'module' variable passed via the URL
* (i.e. index.php?option=com_ajax&module=foo).
*
*/
elseif ($input->get('module'))
{
$module = $input->get('module');
$table = JTable::getInstance('extension');
$moduleId = $table->find(array('type' =>
'module', 'element' => 'mod_' . $module));
if ($moduleId && $table->load($moduleId) &&
$table->enabled)
{
$helperFile = JPATH_BASE . '/modules/mod_' . $module .
'/helper.php';
if (strpos($module, '_'))
{
$parts = explode('_', $module);
}
elseif (strpos($module, '-'))
{
$parts = explode('-', $module);
}
if ($parts)
{
$class = 'Mod';
foreach ($parts as $part)
{
$class .= ucfirst($part);
}
$class .= 'Helper';
}
else
{
$class = 'Mod' . ucfirst($module) . 'Helper';
}
$method = $input->get('method') ?: 'get';
if (is_file($helperFile))
{
JLoader::register($class, $helperFile);
if (method_exists($class, $method . 'Ajax'))
{
// Load language file for module
$basePath = JPATH_BASE;
$lang = JFactory::getLanguage();
$lang->load('mod_' . $module, $basePath, null, false,
true)
|| $lang->load('mod_' . $module, $basePath .
'/modules/mod_' . $module, null, false, true);
try
{
$results = call_user_func($class . '::' . $method .
'Ajax');
}
catch (Exception $e)
{
$results = $e;
}
}
// Method does not exist
else
{
$results = new
LogicException(JText::sprintf('COM_AJAX_METHOD_NOT_EXISTS',
$method . 'Ajax'), 404);
}
}
// The helper file does not exist
else
{
$results = new
RuntimeException(JText::sprintf('COM_AJAX_FILE_NOT_EXISTS',
'mod_' . $module . '/helper.php'), 404);
}
}
// Module is not published, you do not have access to it, or it is not
assigned to the current menu item
else
{
$results = new
LogicException(JText::sprintf('COM_AJAX_MODULE_NOT_ACCESSIBLE',
'mod_' . $module), 404);
}
}
/*
* Plugin support by default is based on the "Ajax" plugin group.
* An optional 'group' variable can be passed via the URL.
*
* The plugin event triggered is onAjaxFoo, where 'foo' is
* the value of the 'plugin' variable passed via the URL
* (i.e. index.php?option=com_ajax&plugin=foo)
*
*/
elseif ($input->get('plugin'))
{
$group = $input->get('group', 'ajax');
JPluginHelper::importPlugin($group);
$plugin = ucfirst($input->get('plugin'));
$dispatcher = JEventDispatcher::getInstance();
try
{
$results = $dispatcher->trigger('onAjax' . $plugin);
}
catch (Exception $e)
{
$results = $e;
}
}
/*
* Template support.
*
* tplFooHelper::getAjax() is called where 'foo' is the value
* of the 'template' variable passed via the URL
* (i.e. index.php?option=com_ajax&template=foo).
*
*/
elseif ($input->get('template'))
{
$template = $input->get('template');
$table = JTable::getInstance('extension');
$templateId = $table->find(array('type' =>
'template', 'element' => $template));
if ($templateId && $table->load($templateId) &&
$table->enabled)
{
$basePath = ($table->client_id) ? JPATH_ADMINISTRATOR : JPATH_SITE;
$helperFile = $basePath . '/templates/' . $template .
'/helper.php';
if (strpos($template, '_'))
{
$parts = explode('_', $template);
}
elseif (strpos($template, '-'))
{
$parts = explode('-', $template);
}
if ($parts)
{
$class = 'Tpl';
foreach ($parts as $part)
{
$class .= ucfirst($part);
}
$class .= 'Helper';
}
else
{
$class = 'Tpl' . ucfirst($template) . 'Helper';
}
$method = $input->get('method') ?: 'get';
if (is_file($helperFile))
{
JLoader::register($class, $helperFile);
if (method_exists($class, $method . 'Ajax'))
{
// Load language file for template
$lang = JFactory::getLanguage();
$lang->load('tpl_' . $template, $basePath, null, false,
true)
|| $lang->load('tpl_' . $template, $basePath .
'/templates/' . $template, null, false, true);
try
{
$results = call_user_func($class . '::' . $method .
'Ajax');
}
catch (Exception $e)
{
$results = $e;
}
}
// Method does not exist
else
{
$results = new
LogicException(JText::sprintf('COM_AJAX_METHOD_NOT_EXISTS',
$method . 'Ajax'), 404);
}
}
// The helper file does not exist
else
{
$results = new
RuntimeException(JText::sprintf('COM_AJAX_FILE_NOT_EXISTS',
'tpl_' . $template . '/helper.php'), 404);
}
}
// Template is not assigned to the current menu item
else
{
$results = new
LogicException(JText::sprintf('COM_AJAX_TEMPLATE_NOT_ACCESSIBLE',
'tpl_' . $template), 404);
}
}
// Return the results in the desired format
switch ($format)
{
// JSONinzed
case 'json' :
echo new JResponseJson($results, null, false,
$input->get('ignoreMessages', true, 'bool'));
break;
// Handle as raw format
default :
// Output exception
if ($results instanceof Exception)
{
// Log an error
JLog::add($results->getMessage(), JLog::ERROR);
// Set status header code
$app->setHeader('status', $results->getCode(), true);
// Echo exception type and message
$out = get_class($results) . ': ' . $results->getMessage();
}
// Output string/ null
elseif (is_scalar($results))
{
$out = (string) $results;
}
// Output array/ object
else
{
$out = implode((array) $results);
}
echo $out;
break;
}
PK8F�[�XW��com_banners/banners.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_banners
*
* @copyright (C) 2005 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
$controller = JControllerLegacy::getInstance('Banners');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
PK8F�[,�1���com_banners/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_banners
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Banners Controller
*
* @since 1.5
*/
class BannersController extends JControllerLegacy
{
/**
* Method when a banner is clicked on.
*
* @return void
*
* @since 1.5
*/
public function click()
{
$id = $this->input->getInt('id', 0);
if ($id)
{
$model = $this->getModel('Banner',
'BannersModel', array('ignore_request' => true));
$model->setState('banner.id', $id);
$model->click();
$this->setRedirect($model->getUrl());
}
}
}
PK;F�[Aؽb��com_banners/helpers/banner.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_banners
*
* @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;
/**
* Banner Helper Class
*
* @since 1.6
*/
abstract class BannerHelper
{
/**
* Checks if a URL is an image
*
* @param string $url The URL path to the potential image
*
* @return boolean True if an image of type bmp, gif, jp(e)g or png,
false otherwise
*
* @since 1.6
*/
public static function isImage($url)
{
return preg_match('#\.(?:bmp|gif|jpe?g|png)$#i', $url);
}
/**
* Checks if a URL is a Flash file
*
* @param string $url The URL path to the potential flash file
*
* @return boolean True if an image of type bmp, gif, jp(e)g or png,
false otherwise
*
* @since 1.6
*/
public static function isFlash($url)
{
return preg_match('#\.swf$#i', $url);
}
}
PK;F�[�r�yy
com_banners/helpers/category.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_banners
*
* @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;
/**
* Banners Component Category Tree
*
* @since 1.6
*/
class BannersCategories extends JCategories
{
/**
* Constructor
*
* @param array $options Array of options
*
* @since 1.6
*/
public function __construct($options = array())
{
$options['table'] = '#__banners';
$options['extension'] = 'com_banners';
parent::__construct($options);
}
}
PK;F�[hbh��com_banners/models/banner.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_banners
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR .
'/tables');
/**
* Banner model for the Joomla Banners component.
*
* @since 1.5
*/
class BannersModelBanner extends JModelLegacy
{
/**
* Cached item object
*
* @var object
* @since 1.6
*/
protected $_item;
/**
* Clicks the URL, incrementing the counter
*
* @return void
*
* @since 1.5
*/
public function click()
{
$item = $this->getItem();
if (empty($item))
{
throw new Exception(JText::_('JERROR_PAGE_NOT_FOUND'), 404);
}
$id = $this->getState('banner.id');
// Update click count
$db = $this->getDbo();
$query = $db->getQuery(true)
->update('#__banners')
->set('clicks = (clicks + 1)')
->where('id = ' . (int) $id);
$db->setQuery($query);
try
{
$db->execute();
}
catch (RuntimeException $e)
{
JError::raiseError(500, $e->getMessage());
}
// Track clicks
$trackClicks = $item->track_clicks;
if ($trackClicks < 0 && $item->cid)
{
$trackClicks = $item->client_track_clicks;
}
if ($trackClicks < 0)
{
$config = JComponentHelper::getParams('com_banners');
$trackClicks = $config->get('track_clicks');
}
if ($trackClicks > 0)
{
$trackDate = JFactory::getDate()->format('Y-m-d H:00:00');
$trackDate = JFactory::getDate($trackDate)->toSql();
$query->clear()
->select($db->quoteName('count'))
->from('#__banner_tracks')
->where('track_type=2')
->where('banner_id=' . (int) $id)
->where('track_date=' . $db->quote($trackDate));
$db->setQuery($query);
try
{
$db->execute();
}
catch (RuntimeException $e)
{
JError::raiseError(500, $e->getMessage());
}
$count = $db->loadResult();
$query->clear();
if ($count)
{
// Update count
$query->update('#__banner_tracks')
->set($db->quoteName('count') . ' = (' .
$db->quoteName('count') . ' + 1)')
->where('track_type=2')
->where('banner_id=' . (int) $id)
->where('track_date=' . $db->quote($trackDate));
}
else
{
// Insert new count
$query->insert('#__banner_tracks')
->columns(
array(
$db->quoteName('count'),
$db->quoteName('track_type'),
$db->quoteName('banner_id'),
$db->quoteName('track_date')
)
)
->values('1, 2,' . (int) $id . ',' .
$db->quote($trackDate));
}
$db->setQuery($query);
try
{
$db->execute();
}
catch (RuntimeException $e)
{
JError::raiseError(500, $e->getMessage());
}
}
}
/**
* Get the data for a banner.
*
* @return object
*
* @since 1.6
*/
public function &getItem()
{
if (!isset($this->_item))
{
/** @var JCacheControllerCallback $cache */
$cache = JFactory::getCache('com_banners',
'callback');
$id = $this->getState('banner.id');
// For PHP 5.3 compat we can't use $this in the lambda function
below, so grab the database driver now to use it
$db = $this->getDbo();
$loader = function ($id) use ($db)
{
$query = $db->getQuery(true)
->select(
array(
$db->quoteName('a.clickurl', 'clickurl'),
$db->quoteName('a.cid', 'cid'),
$db->quoteName('a.track_clicks',
'track_clicks'),
$db->quoteName('cl.track_clicks',
'client_track_clicks'),
)
)
->from($db->quoteName('#__banners', 'a'))
->join('LEFT', '#__banner_clients AS cl ON cl.id =
a.cid')
->where('a.id = ' . (int) $id);
$db->setQuery($query);
return $db->loadObject();
};
try
{
$this->_item = $cache->get($loader, array($id), md5(__METHOD__ .
$id));
}
catch (JCacheException $e)
{
$this->_item = $loader($id);
}
}
return $this->_item;
}
/**
* Get the URL for a banner
*
* @return string
*
* @since 1.5
*/
public function getUrl()
{
$item = $this->getItem();
$url = $item->clickurl;
// Check for links
if (!preg_match('#http[s]?://|index[2]?\.php#', $url))
{
$url = "http://$url";
}
return $url;
}
}
PK=F�[q1��X"X"com_banners/models/banners.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_banners
*
* @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\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR .
'/tables');
/**
* Banners model for the Joomla Banners component.
*
* @since 1.6
*/
class BannersModelBanners extends JModelList
{
/**
* 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.tag_search');
$id .= ':' . $this->getState('filter.client_id');
$id .= ':' .
serialize($this->getState('filter.category_id'));
$id .= ':' .
serialize($this->getState('filter.keywords'));
return parent::getStoreId($id);
}
/**
* Method to get a JDatabaseQuery object for retrieving the data set from
a database.
*
* @return JDatabaseQuery A JDatabaseQuery object to retrieve the data
set.
*
* @since 1.6
*/
protected function getListQuery()
{
$db = $this->getDbo();
$query = $db->getQuery(true);
$ordering = $this->getState('filter.ordering');
$tagSearch = $this->getState('filter.tag_search');
$cid = $this->getState('filter.client_id');
$categoryId = $this->getState('filter.category_id');
$keywords = $this->getState('filter.keywords');
$randomise = ($ordering === 'random');
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
$query->select(
'a.id as id,'
. 'a.type as type,'
. 'a.name as name,'
. 'a.clickurl as clickurl,'
. 'a.cid as cid,'
. 'a.description as description,'
. 'a.params as params,'
. 'a.custombannercode as custombannercode,'
. 'a.track_impressions as track_impressions,'
. 'cl.track_impressions as client_track_impressions'
)
->from('#__banners as a')
->join('LEFT', '#__banner_clients AS cl ON cl.id =
a.cid')
->where('a.state=1')
->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')')
->where('(a.imptotal = 0 OR a.impmade < a.imptotal)');
if ($cid)
{
$query->where('a.cid = ' . (int) $cid)
->where('cl.state = 1');
}
// Filter by a single or group of categories
if (is_numeric($categoryId))
{
$type = $this->getState('filter.category_id.include', true)
? '= ' : '<> ';
// Add subcategory check
$includeSubcategories =
$this->getState('filter.subcategories', false);
$categoryEquals = 'a.catid ' . $type . (int) $categoryId;
if ($includeSubcategories)
{
$levels = (int)
$this->getState('filter.max_category_levels', '1');
// Create a subquery for the subcategory list
$subQuery = $db->getQuery(true);
$subQuery->select('sub.id')
->from('#__categories as sub')
->join('INNER', '#__categories as this ON sub.lft
> this.lft AND sub.rgt < this.rgt')
->where('this.id = ' . (int) $categoryId)
->where('sub.level <= this.level + ' . $levels);
// Add the subquery to the main query
$query->where('(' . $categoryEquals . ' OR a.catid IN
(' . (string) $subQuery . '))');
}
else
{
$query->where($categoryEquals);
}
}
elseif (is_array($categoryId) && (count($categoryId) > 0))
{
$categoryId = ArrayHelper::toInteger($categoryId);
$categoryId = implode(',', $categoryId);
if ($categoryId != '0')
{
$type = $this->getState('filter.category_id.include',
true) ? 'IN' : 'NOT IN';
$query->where('a.catid ' . $type . ' (' .
$categoryId . ')');
}
}
if ($tagSearch)
{
if (!$keywords)
{
$query->where('0 != 0');
}
else
{
$temp = array();
$config = JComponentHelper::getParams('com_banners');
$prefix = $config->get('metakey_prefix');
if ($categoryId)
{
$query->join('LEFT', '#__categories as cat ON
a.catid = cat.id');
}
foreach ($keywords as $keyword)
{
$condition1 = 'a.own_prefix=1 '
. ' AND a.metakey_prefix=SUBSTRING(' .
$db->quote($keyword) . ',1,LENGTH( a.metakey_prefix)) '
. ' OR a.own_prefix=0 '
. ' AND cl.own_prefix=1 '
. ' AND cl.metakey_prefix=SUBSTRING(' .
$db->quote($keyword) . ',1,LENGTH(cl.metakey_prefix)) '
. ' OR a.own_prefix=0 '
. ' AND cl.own_prefix=0 '
. ' AND ' . ($prefix == substr($keyword, 0,
strlen($prefix)) ? '0 = 0' : '0 != 0');
$regexp = $db->quote("[[:<:]]" .
$db->escape($keyword) . "[[:>:]]");
$condition2 = "a.metakey " . $query->regexp($regexp) .
" ";
if ($cid)
{
$condition2 .= " OR cl.metakey " .
$query->regexp($regexp) . " ";
}
if ($categoryId)
{
$condition2 .= " OR cat.metakey " .
$query->regexp($regexp) . " ";
}
$temp[] = "($condition1) AND ($condition2)";
}
$query->where('(' . implode(' OR ', $temp) .
')');
}
}
// Filter by language
if ($this->getState('filter.language'))
{
$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
}
$query->order('a.sticky DESC,' . ($randomise ?
$query->Rand() : 'a.ordering'));
return $query;
}
/**
* Get a list of banners.
*
* @return array
*
* @since 1.6
*/
public function getItems()
{
if ($this->getState('filter.tag_search'))
{
// Filter out empty keywords.
$keywords = array_values(array_filter(array_map('trim',
$this->getState('filter.keywords')), 'strlen'));
// Re-set state before running the query.
$this->setState('filter.keywords', $keywords);
// If no keywords are provided, avoid running the query.
if (!$keywords)
{
$this->cache['items'] = array();
return $this->cache['items'];
}
}
if (!isset($this->cache['items']))
{
$this->cache['items'] = parent::getItems();
foreach ($this->cache['items'] as &$item)
{
$item->params = new Registry($item->params);
}
}
return $this->cache['items'];
}
/**
* Makes impressions on a list of banners
*
* @return void
*
* @since 1.6
*/
public function impress()
{
$trackDate = JFactory::getDate()->format('Y-m-d H:00:00');
$trackDate = JFactory::getDate($trackDate)->toSql();
$items = $this->getItems();
$db = $this->getDbo();
$query = $db->getQuery(true);
if (!count($items))
{
return;
}
foreach ($items as $item)
{
$bid[] = (int) $item->id;
}
// Increment impression made
$query->clear()
->update('#__banners')
->set('impmade = (impmade + 1)')
->where('id IN (' . implode(',', $bid) .
')');
$db->setQuery($query);
try
{
$db->execute();
}
catch (JDatabaseExceptionExecuting $e)
{
JError::raiseError(500, $e->getMessage());
}
foreach ($items as $item)
{
// Track impressions
$trackImpressions = $item->track_impressions;
if ($trackImpressions < 0 && $item->cid)
{
$trackImpressions = $item->client_track_impressions;
}
if ($trackImpressions < 0)
{
$config =
JComponentHelper::getParams('com_banners');
$trackImpressions = $config->get('track_impressions');
}
if ($trackImpressions > 0)
{
// Is track already created?
// Update count
$query->clear();
$query->update('#__banner_tracks')
->set($db->quoteName('count') . ' = (' .
$db->quoteName('count') . ' + 1)')
->where('track_type=1')
->where('banner_id=' . (int) $item->id)
->where('track_date=' . $db->quote($trackDate));
$db->setQuery($query);
try
{
$db->execute();
}
catch (JDatabaseExceptionExecuting $e)
{
JError::raiseError(500, $e->getMessage());
}
if ($db->getAffectedRows() === 0)
{
// Insert new count
$query->clear();
$query->insert('#__banner_tracks')
->columns(
array(
$db->quoteName('count'),
$db->quoteName('track_type'),
$db->quoteName('banner_id'),
$db->quoteName('track_date')
)
)
->values('1, 1, ' . (int) $item->id . ', '
. $db->quote($trackDate));
$db->setQuery($query);
try
{
$db->execute();
}
catch (JDatabaseExceptionExecuting $e)
{
JError::raiseError(500, $e->getMessage());
}
}
}
}
}
}
PK=F�[�1���
�
com_banners/router.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_banners
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Routing class from com_banners
*
* @since 3.3
*/
class BannersRouter extends JComponentRouterBase
{
/**
* Build the route for the com_banners component
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent
URL.
*
* @since 3.3
*/
public function build(&$query)
{
$segments = array();
if (isset($query['task']))
{
$segments[] = $query['task'];
unset($query['task']);
}
if (isset($query['id']))
{
$segments[] = $query['id'];
unset($query['id']);
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-',
$segments[$i]);
}
return $segments;
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
$total = count($segments);
$vars = array();
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = preg_replace('/-/', ':',
$segments[$i], 1);
}
// View is always the first element of the array
$count = count($segments);
if ($count)
{
$count--;
$segment = array_shift($segments);
if (is_numeric($segment))
{
$vars['id'] = $segment;
}
else
{
$vars['task'] = $segment;
}
}
if ($count)
{
$segment = array_shift($segments);
if (is_numeric($segment))
{
$vars['id'] = $segment;
}
}
return $vars;
}
}
/**
* Build the route for the com_banners component
*
* This function is a proxy for the new router interface
* for old SEF extensions.
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent URL.
*
* @since 3.3
* @deprecated 4.0 Use Class based routers instead
*/
function bannersBuildRoute(&$query)
{
$router = new BannersRouter;
return $router->build($query);
}
/**
* Parse the segments of a URL.
*
* This function is a proxy for the new router interface
* for old SEF extensions.
*
* @param array $segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
* @deprecated 4.0 Use Class based routers instead
*/
function bannersParseRoute($segments)
{
$router = new BannersRouter;
return $router->parse($segments);
}
PK=F�[��com_config/config.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Load classes
JLoader::registerPrefix('Config', JPATH_COMPONENT);
// Application
$app = JFactory::getApplication();
// Tell the browser not to cache this page.
$app->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00
GMT', true);
$controllerHelper = new ConfigControllerHelper;
$controller = $controllerHelper->parseController($app);
$controller->prefix = 'Config';
// Perform the Request task
$controller->execute();
PK@F�[[�����
com_config/controller/cancel.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Cancel Controller
*
* @since 3.2
*/
class ConfigControllerCancel extends JControllerBase
{
/**
* Application object - Redeclared for proper typehinting
*
* @var JApplicationCms
* @since 3.2
*/
protected $app;
/**
* Method to handle cancel
*
* @return boolean True on success.
*
* @since 3.2
*/
public function execute()
{
// Redirect back to home(base) page
$this->app->redirect(JUri::base());
}
}
PK@F�[�yt���%com_config/controller/canceladmin.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Cancel Controller for Admin
*
* @since 3.2
*/
class ConfigControllerCanceladmin extends ConfigControllerCancel
{
/**
* The context for storing internal data, e.g. record.
*
* @var string
* @since 3.2
*/
protected $context;
/**
* The URL option for the component.
*
* @var string
* @since 3.2
*/
protected $option;
/**
* URL for redirection.
*
* @var string
* @since 3.2
* @note Replaces _redirect.
*/
protected $redirect;
/**
* Method to handle admin cancel
*
* @return boolean True on success.
*
* @since 3.2
*/
public function execute()
{
// Check for request forgeries.
if (!JSession::checkToken())
{
$this->app->enqueueMessage(JText::_('JINVALID_TOKEN_NOTICE'));
$this->app->redirect('index.php');
}
if (empty($this->context))
{
$this->context = $this->option . '.edit' .
$this->context;
}
// Redirect.
$this->app->setUserState($this->context . '.data',
null);
if (!empty($this->redirect))
{
// Don't redirect to an external URL.
if (!JUri::isInternal($this->redirect))
{
$this->redirect = JUri::base();
}
$this->app->redirect($this->redirect);
}
else
{
parent::execute();
}
}
}
PK@F�[�:9�;;!com_config/controller/cmsbase.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Base Display Controller
*
* @since 3.2
*/
class ConfigControllerCmsbase extends JControllerBase
{
/**
* Prefix for the view and model classes
*
* @var string
* @since 3.2
*/
public $prefix;
/**
* Execute the controller.
*
* @return mixed A rendered view or true
*
* @since 3.2
*/
public function execute()
{
// Check for request forgeries
if (!JSession::checkToken())
{
$this->app->enqueueMessage(JText::_('JINVALID_TOKEN_NOTICE'));
$this->app->redirect('index.php');
}
// Get the application
$this->app = $this->getApplication();
$this->app->redirect('index.php?option=' .
$this->input->get('option'));
$this->componentFolder =
$this->input->getWord('option', 'com_content');
$this->viewName =
$this->input->getWord('view');
return $this;
}
}
PKAF�[B�
(com_config/controller/config/display.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Display Controller for global configuration
*
* @since 3.2
*/
class ConfigControllerConfigDisplay extends ConfigControllerDisplay
{
/**
* Method to display global configuration.
*
* @return boolean True on success, false on failure.
*
* @since 3.2
*/
public function execute()
{
// Get the application
$app = $this->getApplication();
// Get the document object.
$document = JFactory::getDocument();
$viewName = $this->input->getWord('view',
'config');
$viewFormat = $document->getType();
$layoutName = $this->input->getWord('layout',
'default');
// Access backend com_config
JLoader::registerPrefix(ucfirst($viewName), JPATH_ADMINISTRATOR .
'/components/com_config');
$displayClass = new ConfigControllerApplicationDisplay;
// Set backend required params
$document->setType('json');
$app->input->set('view', 'application');
// Execute backend controller
$serviceData = json_decode($displayClass->execute(), true);
// Reset params back after requesting from service
$document->setType('html');
$app->input->set('view', $viewName);
// Register the layout paths for the view
$paths = new SplPriorityQueue;
$paths->insert(JPATH_COMPONENT . '/view/' . $viewName .
'/tmpl', 'normal');
$viewClass = 'ConfigView' . ucfirst($viewName) .
ucfirst($viewFormat);
$modelClass = 'ConfigModel' . ucfirst($viewName);
if (class_exists($viewClass))
{
if ($viewName !== 'close')
{
$model = new $modelClass;
// Access check.
if (!JFactory::getUser()->authorise('core.admin',
$model->getState('component.option')))
{
return;
}
}
$view = new $viewClass($model, $paths);
$view->setLayout($layoutName);
// Push document object into the view.
$view->document = $document;
// Load form and bind data
$form = $model->getForm();
if ($form)
{
$form->bind($serviceData);
}
// Set form and data to the view
$view->form = &$form;
$view->data = &$serviceData;
// Render view.
echo $view->render();
}
return true;
}
}
PKAF�[����%com_config/controller/config/save.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Save Controller for global configuration
*
* @since 3.2
*/
class ConfigControllerConfigSave extends JControllerBase
{
/**
* Application object - Redeclared for proper typehinting
*
* @var JApplicationCms
* @since 3.2
*/
protected $app;
/**
* Method to save global configuration.
*
* @return boolean True on success.
*
* @since 3.2
*/
public function execute()
{
// Check for request forgeries.
if (!JSession::checkToken())
{
$this->app->enqueueMessage(JText::_('JINVALID_TOKEN_NOTICE'));
$this->app->redirect('index.php');
}
// Check if the user is authorized to do this.
if (!JFactory::getUser()->authorise('core.admin'))
{
$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
$this->app->redirect('index.php');
}
// Set FTP credentials, if given.
JClientHelper::setCredentialsFromRequest('ftp');
$model = new ConfigModelConfig;
$form = $model->getForm();
$data = $this->input->post->get('jform', array(),
'array');
// Validate the posted data.
$return = $model->validate($form, $data);
// Check for validation errors.
if ($return === false)
{
/*
* The validate method enqueued all messages for us, so we just need to
redirect back.
*/
// Save the data in the session.
$this->app->setUserState('com_config.config.global.data',
$data);
// Redirect back to the edit screen.
$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config',
false));
}
// Attempt to save the configuration.
$data = $return;
// Access backend com_config
JLoader::registerPrefix('Config', JPATH_ADMINISTRATOR .
'/components/com_config');
$saveClass = new ConfigControllerApplicationSave;
// Get a document object
$document = JFactory::getDocument();
// Set backend required params
$document->setType('json');
// Execute backend controller
$return = $saveClass->execute();
// Reset params back after requesting from service
$document->setType('html');
// Check the return value.
if ($return === false)
{
/*
* The save method enqueued all messages for us, so we just need to
redirect back.
*/
// Save the data in the session.
$this->app->setUserState('com_config.config.global.data',
$data);
// Save failed, go back to the screen and display a notice.
$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config',
false));
}
// Redirect back to com_config display
$this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config',
false));
return true;
}
}
PKBF�[��z��
�
!com_config/controller/display.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Base Display Controller
*
* @since 3.2
*/
class ConfigControllerDisplay extends JControllerBase
{
/**
* Application object - Redeclared for proper typehinting
*
* @var JApplicationCms
* @since 3.2
*/
protected $app;
/**
* Prefix for the view and model classes
*
* @var string
* @since 3.2
*/
public $prefix = 'Config';
/**
* Execute the controller.
*
* @return mixed A rendered view or true
*
* @since 3.2
*/
public function execute()
{
// Get the document object.
$document = JFactory::getDocument();
$componentFolder = $this->input->getWord('option',
'com_config');
if ($this->app->isClient('administrator'))
{
$viewName = $this->input->getWord('view',
'application');
}
else
{
$viewName = $this->input->getWord('view',
'config');
}
$viewFormat = $document->getType();
$layoutName = $this->input->getWord('layout',
'default');
// Register the layout paths for the view
$paths = new SplPriorityQueue;
if ($this->app->isClient('administrator'))
{
$paths->insert(JPATH_ADMINISTRATOR . '/components/' .
$componentFolder . '/view/' . $viewName . '/tmpl', 1);
}
else
{
$paths->insert(JPATH_BASE . '/components/' .
$componentFolder . '/view/' . $viewName . '/tmpl', 1);
}
$viewClass = $this->prefix . 'View' . ucfirst($viewName) .
ucfirst($viewFormat);
$modelClass = $this->prefix . 'Model' . ucfirst($viewName);
if (class_exists($viewClass))
{
$model = new $modelClass;
$component =
$model->getState()->get('component.option');
// Make sure com_joomlaupdate and com_privacy can only be accessed by
SuperUser
if (in_array(strtolower($component), array('com_joomlaupdate',
'com_privacy'))
&& !JFactory::getUser()->authorise('core.admin'))
{
$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
return;
}
// Access check.
if (!JFactory::getUser()->authorise('core.admin',
$component)
&& !JFactory::getUser()->authorise('core.options',
$component))
{
$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
return;
}
$view = new $viewClass($model, $paths);
$view->setLayout($layoutName);
// Push document object into the view.
$view->document = $document;
// Reply for service requests
if ($viewFormat === 'json')
{
$this->app->allowCache(false);
return $view->render();
}
// Render view.
echo $view->render();
}
return true;
}
}
PKBF�[l.��9
9
com_config/controller/helper.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper class for controllers
*
* @since 3.2
*/
class ConfigControllerHelper
{
/**
* Method to parse a controller from a url
* Defaults to the base controllers and passes an array of options.
* $options[0] is the location of the controller which defaults to the
core libraries (referenced as 'j'
* and then the named folder within the component entry point file.
* $options[1] is the name of the controller file,
* $options[2] is the name of the folder found in the component controller
folder for controllers
* not prefixed with Config.
* Additional options maybe added to parameterize the controller.
*
* @param JApplicationBase $app An application object
*
* @return JController A JController object
*
* @since 3.2
*/
public function parseController($app)
{
$tasks = array();
if ($task = $app->input->get('task'))
{
// Toolbar expects old style but we are using new style
// Remove when toolbar can handle either directly
if (strpos($task, '/') !== false)
{
$tasks = explode('/', $task);
}
else
{
$tasks = explode('.', $task);
}
}
elseif ($controllerTask = $app->input->get('controller'))
{
// Temporary solution
if (strpos($controllerTask, '/') !== false)
{
$tasks = explode('/', $controllerTask);
}
else
{
$tasks = explode('.', $controllerTask);
}
}
if (empty($tasks[0]) || $tasks[0] === 'Config')
{
$location = 'Config';
}
else
{
$location = ucfirst(strtolower($tasks[0]));
}
if (empty($tasks[1]))
{
$activity = 'Display';
}
else
{
$activity = ucfirst(strtolower($tasks[1]));
}
$view = '';
if (!empty($tasks[2]))
{
$view = ucfirst(strtolower($tasks[2]));
}
// Some special handling for com_config administrator
$option = $app->input->get('option');
if ($option === 'com_config' &&
$app->isClient('administrator'))
{
$component = $app->input->get('component');
if (!empty($component))
{
$view = 'Component';
}
elseif ($option === 'com_config')
{
$view = 'Application';
}
}
$controllerName = $location . 'Controller' . $view . $activity;
if (!class_exists($controllerName))
{
return false;
}
$controller = new $controllerName;
$controller->options = array();
$controller->options = $tasks;
return $controller;
}
}
PKBF�[W��(com_config/controller/modules/cancel.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2014 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Cancel Controller for module editing
*
* @package Joomla.Site
* @subpackage com_config
* @since 3.2
*/
class ConfigControllerModulesCancel extends ConfigControllerCanceladmin
{
/**
* Method to cancel module editing.
*
* @return boolean True on success.
*
* @since 3.2
*/
public function execute()
{
// Check if the user is authorized to do this.
$user = JFactory::getUser();
if (!$user->authorise('module.edit.frontend',
'com_modules.module.' . $this->input->get('id')))
{
$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
$this->app->redirect('index.php');
}
$this->context = 'com_config.config.global';
// Get returnUri
$returnUri = $this->input->post->get('return', null,
'base64');
if (!empty($returnUri))
{
$this->redirect = base64_decode(urldecode($returnUri));
}
else
{
$this->redirect = JUri::base();
}
$id = $this->input->getInt('id');
// Access backend com_module
JLoader::register('ModulesControllerModule',
JPATH_ADMINISTRATOR .
'/components/com_modules/controllers/module.php');
JLoader::register('ModulesViewModule', JPATH_ADMINISTRATOR .
'/components/com_modules/views/module/view.json.php');
JLoader::register('ModulesModelModule', JPATH_ADMINISTRATOR .
'/components/com_modules/models/module.php');
$cancelClass = new ModulesControllerModule;
$cancelClass->cancel($id);
parent::execute();
}
}
PKBF�[j��__)com_config/controller/modules/display.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2014 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Display Controller for module editing
*
* @package Joomla.Site
* @subpackage com_config
* @since 3.2
*/
class ConfigControllerModulesDisplay extends ConfigControllerDisplay
{
/**
* Method to display module editing.
*
* @return boolean True on success, false on failure.
*
* @since 3.2
*/
public function execute()
{
// Get the application
$app = $this->getApplication();
// Get the document object.
$document = JFactory::getDocument();
$viewName = $this->input->getWord('view',
'modules');
$viewFormat = $document->getType();
$layoutName = $this->input->getWord('layout',
'default');
$returnUri = $this->input->get->get('return', null,
'base64');
// Construct redirect URI
if (!empty($returnUri))
{
$redirect = base64_decode(urldecode($returnUri));
// Don't redirect to an external URL.
if (!JUri::isInternal($redirect))
{
$redirect = JUri::base();
}
}
else
{
$redirect = JUri::base();
}
// Access backend com_module
JLoader::register('ModulesController', JPATH_ADMINISTRATOR .
'/components/com_modules/controller.php');
JLoader::register('ModulesViewModule', JPATH_ADMINISTRATOR .
'/components/com_modules/views/module/view.json.php');
JLoader::register('ModulesModelModule', JPATH_ADMINISTRATOR .
'/components/com_modules/models/module.php');
$displayClass = new ModulesController;
// Get the parameters of the module with Id
$document->setType('json');
// Execute backend controller
if (!($serviceData = json_decode($displayClass->display(), true)))
{
$app->redirect($redirect);
}
// Reset params back after requesting from service
$document->setType('html');
$app->input->set('view', $viewName);
// Register the layout paths for the view
$paths = new SplPriorityQueue;
$paths->insert(JPATH_COMPONENT . '/view/' . $viewName .
'/tmpl', 'normal');
$viewClass = 'ConfigView' . ucfirst($viewName) .
ucfirst($viewFormat);
$modelClass = 'ConfigModel' . ucfirst($viewName);
if (class_exists($viewClass))
{
$model = new $modelClass;
// Access check.
$user = JFactory::getUser();
if (!$user->authorise('module.edit.frontend',
'com_modules.module.' . $serviceData['id']))
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
$app->redirect($redirect);
}
// Need to add module name to the state of model
$model->getState()->set('module.name',
$serviceData['module']);
$view = new $viewClass($model, $paths);
$view->setLayout($layoutName);
// Push document object into the view.
$view->document = $document;
// Load form and bind data
$form = $model->getForm();
if ($form)
{
$form->bind($serviceData);
}
// Set form and data to the view
$view->form = &$form;
$view->item = &$serviceData;
// Render view.
echo $view->render();
}
return true;
}
}
PKBF�[����&com_config/controller/modules/save.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2014 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Save Controller for module editing
*
* @package Joomla.Site
* @subpackage com_config
* @since 3.2
*/
class ConfigControllerModulesSave extends JControllerBase
{
/**
* Method to save module editing.
*
* @return boolean True on success.
*
* @since 3.2
*/
public function execute()
{
// Check for request forgeries.
if (!JSession::checkToken())
{
$this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
$this->app->redirect('index.php');
}
// Check if the user is authorized to do this.
$user = JFactory::getUser();
if (!$user->authorise('module.edit.frontend',
'com_modules.module.' . $this->input->get('id')))
{
$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
$this->app->redirect('index.php');
}
// Set FTP credentials, if given.
JClientHelper::setCredentialsFromRequest('ftp');
// Get submitted module id
$moduleId = '&id=' .
$this->input->get('id');
// Get returnUri
$returnUri = $this->input->post->get('return', null,
'base64');
$redirect = '';
if (!empty($returnUri))
{
$redirect = '&return=' . $returnUri;
}
// Access backend com_modules to be done
JLoader::register('ModulesControllerModule',
JPATH_ADMINISTRATOR .
'/components/com_modules/controllers/module.php');
JLoader::register('ModulesModelModule', JPATH_ADMINISTRATOR .
'/components/com_modules/models/module.php');
$controllerClass = new ModulesControllerModule;
// Get a document object
$document = JFactory::getDocument();
// Set backend required params
$document->setType('json');
// Execute backend controller
$return = $controllerClass->save();
// Reset params back after requesting from service
$document->setType('html');
// Check the return value.
if ($return === false)
{
// Save the data in the session.
$data = $this->input->post->get('jform', array(),
'array');
$this->app->setUserState('com_config.modules.global.data',
$data);
// Save failed, go back to the screen and display a notice.
$this->app->enqueueMessage(JText::_('JERROR_SAVE_FAILED'));
$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.modules'
. $moduleId . $redirect, false));
}
// Redirect back to com_config display
$this->app->enqueueMessage(JText::_('COM_CONFIG_MODULES_SAVE_SUCCESS'));
// Set the redirect based on the task.
switch ($this->options[3])
{
case 'apply':
$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.modules'
. $moduleId . $redirect, false));
break;
case 'save':
default:
if (!empty($returnUri))
{
$redirect = base64_decode(urldecode($returnUri));
// Don't redirect to an external URL.
if (!JUri::isInternal($redirect))
{
$redirect = JUri::base();
}
}
else
{
$redirect = JUri::base();
}
$this->app->redirect($redirect);
break;
}
}
}
PKBF�[�'��B
B
+com_config/controller/templates/display.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Display Controller for global configuration
*
* @since 3.2
*/
class ConfigControllerTemplatesDisplay extends ConfigControllerDisplay
{
/**
* Method to display global configuration.
*
* @return boolean True on success, false on failure.
*
* @since 3.2
*/
public function execute()
{
// Get the application
$app = $this->getApplication();
// Get the document object.
$document = JFactory::getDocument();
$viewName = $this->input->getWord('view',
'templates');
$viewFormat = $document->getType();
$layoutName = $this->input->getWord('layout',
'default');
// Access backend com_config
JLoader::register('TemplatesController', JPATH_ADMINISTRATOR .
'/components/com_templates/controller.php');
JLoader::register('TemplatesViewStyle', JPATH_ADMINISTRATOR .
'/components/com_templates/views/style/view.json.php');
JLoader::register('TemplatesModelStyle', JPATH_ADMINISTRATOR .
'/components/com_templates/models/style.php');
$displayClass = new TemplatesController;
// Set backend required params
$document->setType('json');
$this->input->set('id',
$app->getTemplate(true)->id);
// Execute backend controller
$serviceData = json_decode($displayClass->display(), true);
// Reset params back after requesting from service
$document->setType('html');
$this->input->set('view', $viewName);
// Register the layout paths for the view
$paths = new SplPriorityQueue;
$paths->insert(JPATH_COMPONENT . '/view/' . $viewName .
'/tmpl', 'normal');
$viewClass = 'ConfigView' . ucfirst($viewName) .
ucfirst($viewFormat);
$modelClass = 'ConfigModel' . ucfirst($viewName);
if (class_exists($viewClass))
{
if ($viewName !== 'close')
{
$model = new $modelClass;
// Access check.
if (!JFactory::getUser()->authorise('core.admin',
$model->getState('component.option')))
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
return;
}
}
$view = new $viewClass($model, $paths);
$view->setLayout($layoutName);
// Push document object into the view.
$view->document = $document;
// Load form and bind data
$form = $model->getForm();
if ($form)
{
$form->bind($serviceData);
}
// Set form and data to the view
$view->form = &$form;
// Render view.
echo $view->render();
}
return true;
}
}
PKBF�[�<��� � (com_config/controller/templates/save.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Save Controller for global configuration
*
* @since 3.2
*/
class ConfigControllerTemplatesSave extends JControllerBase
{
/**
* Method to save global configuration.
*
* @return boolean True on success.
*
* @since 3.2
*/
public function execute()
{
// Check for request forgeries.
if (!JSession::checkToken())
{
JFactory::getApplication()->redirect('index.php',
JText::_('JINVALID_TOKEN'));
}
// Check if the user is authorized to do this.
if (!JFactory::getUser()->authorise('core.admin'))
{
JFactory::getApplication()->redirect('index.php',
JText::_('JERROR_ALERTNOAUTHOR'));
return;
}
// Set FTP credentials, if given.
JClientHelper::setCredentialsFromRequest('ftp');
$app = JFactory::getApplication();
// Access backend com_templates
JLoader::register('TemplatesControllerStyle',
JPATH_ADMINISTRATOR .
'/components/com_templates/controllers/style.php');
JLoader::register('TemplatesModelStyle', JPATH_ADMINISTRATOR .
'/components/com_templates/models/style.php');
JLoader::register('TemplatesTableStyle', JPATH_ADMINISTRATOR .
'/components/com_templates/tables/style.php');
$controllerClass = new TemplatesControllerStyle;
// Get a document object
$document = JFactory::getDocument();
// Set backend required params
$document->setType('json');
$this->input->set('id',
$app->getTemplate(true)->id);
// Execute backend controller
$return = $controllerClass->save();
// Reset params back after requesting from service
$document->setType('html');
// Check the return value.
if ($return === false)
{
// Save the data in the session.
$app->setUserState('com_config.config.global.data', $data);
// Save failed, go back to the screen and display a notice.
$message = JText::sprintf('JERROR_SAVE_FAILED');
$app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.templates',
false), $message, 'error');
return false;
}
// Set the success message.
$message = JText::_('COM_CONFIG_SAVE_SUCCESS');
// Redirect back to com_config display
$app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.templates',
false), $message);
return true;
}
}
PKBF�[-�|:00com_config/model/cms.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 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;
/**
* Prototype admin model.
*
* @since 3.2
*/
abstract class ConfigModelCms extends JModelDatabase
{
/**
* The model (base) name
*
* @var string
* @since 3.2
*/
protected $name;
/**
* The URL option for the component.
*
* @var string
* @since 3.2
*/
protected $option = null;
/**
* The prefix to use with controller messages.
*
* @var string
* @since 3.2
*/
protected $text_prefix = null;
/**
* Indicates if the internal state has been set
*
* @var boolean
* @since 3.2
*/
protected $__state_set = null;
/**
* Constructor
*
* @param array $config An array of configuration options (name,
state, dbo, table_path, ignore_request).
*
* @since 3.2
* @throws Exception
*/
public function __construct($config = array())
{
// Guess the option from the class name (Option)Model(View).
if (empty($this->option))
{
$r = null;
if (!preg_match('/(.*)Model/i', get_class($this), $r))
{
throw new
Exception(JText::_('JLIB_APPLICATION_ERROR_MODEL_GET_NAME'),
500);
}
$this->option = 'com_' . strtolower($r[1]);
}
// Set the view name
if (empty($this->name))
{
if (array_key_exists('name', $config))
{
$this->name = $config['name'];
}
else
{
$this->name = $this->getName();
}
}
// Set the model state
if (array_key_exists('state', $config))
{
$this->state = $config['state'];
}
else
{
$this->state = new Registry;
}
// Set the model dbo
if (array_key_exists('dbo', $config))
{
$this->db = $config['dbo'];
}
// Register the paths for the form
$paths = $this->registerTablePaths($config);
// Set the internal state marker - used to ignore setting state from the
request
if (!empty($config['ignore_request']))
{
$this->__state_set = true;
}
// Set the clean cache event
if (isset($config['event_clean_cache']))
{
$this->event_clean_cache = $config['event_clean_cache'];
}
elseif (empty($this->event_clean_cache))
{
$this->event_clean_cache = 'onContentCleanCache';
}
$state = new Registry($config);
parent::__construct($state);
}
/**
* Method to get the model name
*
* The model name. By default parsed using the classname or it can be set
* by passing a $config['name'] in the class constructor
*
* @return string The name of the model
*
* @since 3.2
* @throws Exception
*/
public function getName()
{
if (empty($this->name))
{
$r = null;
if (!preg_match('/Model(.*)/i', get_class($this), $r))
{
throw new
Exception(JText::_('JLIB_APPLICATION_ERROR_MODEL_GET_NAME'),
500);
}
$this->name = strtolower($r[1]);
}
return $this->name;
}
/**
* Method to get model state variables
*
* @return object The property where specified, the state object where
omitted
*
* @since 3.2
*/
public function getState()
{
if (!$this->__state_set)
{
// Protected method to auto-populate the model state.
$this->populateState();
// Set the model state set flag to true.
$this->__state_set = true;
}
return $this->state;
}
/**
* Method to register paths for tables
*
* @param array $config Configuration array
*
* @return object The property where specified, the state object where
omitted
*
* @since 3.2
*/
public function registerTablePaths($config = array())
{
// Set the default view search path
if (array_key_exists('table_path', $config))
{
$this->addTablePath($config['table_path']);
}
elseif (defined('JPATH_COMPONENT_ADMINISTRATOR'))
{
// Register the paths for the form
$paths = new SplPriorityQueue;
$paths->insert(JPATH_COMPONENT_ADMINISTRATOR . '/table',
'normal');
// For legacy purposes. Remove for 4.0
$paths->insert(JPATH_COMPONENT_ADMINISTRATOR . '/tables',
'normal');
}
}
/**
* Clean the cache
*
* @param string $group The cache group
* @param integer $clientId The ID of the client
*
* @return void
*
* @since 3.2
*/
protected function cleanCache($group = null, $clientId = 0)
{
$conf = JFactory::getConfig();
$dispatcher = JEventDispatcher::getInstance();
$options = array(
'defaultgroup' => $group ?: (isset($this->option) ?
$this->option :
JFactory::getApplication()->input->get('option')),
'cachebase' => $clientId ? JPATH_ADMINISTRATOR .
'/cache' : $conf->get('cache_path', JPATH_SITE .
'/cache'));
$cache = JCache::getInstance('callback', $options);
$cache->clean();
// Trigger the onContentCleanCache event.
$dispatcher->trigger($this->event_clean_cache, $options);
}
/**
* Method to auto-populate the model state.
*
* This method should only be called once per instantiation and is
designed
* to be called on the first call to the getState() method unless the
model
* configuration flag to ignore the request is set.
*
* @return void
*
* @note Calling getState in this method will result in recursion.
* @since 3.2
*/
protected function populateState()
{
$this->loadState();
}
/**
* Method to test whether a record can be deleted.
*
* @param object $record A record object.
*
* @return boolean True if allowed to delete the record. Defaults to the
permission set in the component.
*
* @since 3.2
*/
protected function canDelete($record)
{
if (empty($record->id) || $record->published != -2)
{
return false;
}
return JFactory::getUser()->authorise('core.delete',
$this->option);
}
/**
* Method to test whether a record can have its state changed.
*
* @param object $record A record object.
*
* @return boolean True if allowed to change the state of the record.
Defaults to the permission set in the component.
*
* @since 3.2
*/
protected function canEditState($record)
{
return JFactory::getUser()->authorise('core.edit.state',
$this->option);
}
}
PKBF�[?���com_config/model/config.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Model for the global configuration
*
* @since 3.2
*/
class ConfigModelConfig extends ConfigModelForm
{
/**
* Method to get a form object.
*
* @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 3.2
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_config.config',
'config', array('control' => 'jform',
'load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
}
PKBF�[��E�
�
com_config/model/form/config.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset
name="metadata"
label="COM_CONFIG_METADATA_SETTINGS">
<field
name="MetaDesc"
type="textarea"
label="COM_CONFIG_FIELD_METADESC_LABEL"
description="COM_CONFIG_FIELD_METADESC_DESC"
filter="string"
cols="60"
rows="3"
/>
<field
name="MetaKeys"
type="textarea"
label="COM_CONFIG_FIELD_METAKEYS_LABEL"
description="COM_CONFIG_FIELD_METAKEYS_DESC"
filter="string"
cols="60"
rows="3"
/>
<field
name="MetaRights"
type="textarea"
label="JFIELD_META_RIGHTS_LABEL"
description="JFIELD_META_RIGHTS_DESC"
filter="string"
cols="60"
rows="2"
/>
</fieldset>
<fieldset
name="seo"
label="CONFIG_SEO_SETTINGS_LABEL">
<field
name="sef"
type="radio"
label="COM_CONFIG_FIELD_SEF_URL_LABEL"
description="COM_CONFIG_FIELD_SEF_URL_DESC"
default="1"
class="btn-group"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="sitename_pagetitles"
type="list"
label="COM_CONFIG_FIELD_SITENAME_PAGETITLES_LABEL"
description="COM_CONFIG_FIELD_SITENAME_PAGETITLES_DESC"
default="0"
filter="integer"
>
<option
value="2">COM_CONFIG_FIELD_VALUE_AFTER</option>
<option
value="1">COM_CONFIG_FIELD_VALUE_BEFORE</option>
<option value="0">JNO</option>
</field>
</fieldset>
<fieldset
name="site"
label="CONFIG_SITE_SETTINGS_LABEL">
<field
name="sitename"
type="text"
label="COM_CONFIG_FIELD_SITE_NAME_LABEL"
description="COM_CONFIG_FIELD_SITE_NAME_DESC"
required="true"
filter="string"
size="50"
/>
<field
name="offline"
type="radio"
label="COM_CONFIG_FIELD_SITE_OFFLINE_LABEL"
description="COM_CONFIG_FIELD_SITE_OFFLINE_DESC"
default="0"
class="btn-group"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="access"
type="accesslevel"
label="COM_CONFIG_FIELD_DEFAULT_ACCESS_LEVEL_LABEL"
description="COM_CONFIG_FIELD_DEFAULT_ACCESS_LEVEL_DESC"
default="1"
filter="integer"
/>
<field
name="list_limit"
type="list"
label="COM_CONFIG_FIELD_DEFAULT_LIST_LIMIT_LABEL"
description="COM_CONFIG_FIELD_DEFAULT_LIST_LIMIT_DESC"
default="20"
filter="integer"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="100">J100</option>
</field>
</fieldset>
<fieldset>
<field
name="asset_id"
type="hidden"
/>
</fieldset>
</form>
PKBF�[��7��!com_config/model/form/modules.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field
name="id"
type="number"
label="JGLOBAL_FIELD_ID_LABEL"
description="JGLOBAL_FIELD_ID_DESC"
default="0"
readonly="true"
/>
<field
name="title"
type="text"
label="JGLOBAL_TITLE"
description="COM_MODULES_FIELD_TITLE_DESC"
maxlength="100"
required="true"
size="35"
/>
<field
name="note"
type="text"
label="COM_MODULES_FIELD_NOTE_LABEL"
description="COM_MODULES_FIELD_NOTE_DESC"
maxlength="255"
size="35"
/>
<field
name="module"
type="hidden"
label="COM_MODULES_FIELD_MODULE_LABEL"
description="COM_MODULES_FIELD_MODULE_DESC"
readonly="readonly"
size="20"
/>
<field
name="showtitle"
type="radio"
label="COM_MODULES_FIELD_SHOWTITLE_LABEL"
description="COM_MODULES_FIELD_SHOWTITLE_DESC"
class="btn-group btn-group-yesno"
default="1"
size="1"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="published"
type="radio"
label="JSTATUS"
description="COM_MODULES_FIELD_PUBLISHED_DESC"
class="btn-group"
default="1"
size="1"
>
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
<option value="-2">JTRASHED</option>
</field>
<field
name="publish_up"
type="calendar"
label="COM_MODULES_FIELD_PUBLISH_UP_LABEL"
description="COM_MODULES_FIELD_PUBLISH_UP_DESC"
filter="user_utc"
class="input-medium"
translateformat="true"
showtime="true"
size="22"
/>
<field
name="publish_down"
type="calendar"
label="COM_MODULES_FIELD_PUBLISH_DOWN_LABEL"
description="COM_MODULES_FIELD_PUBLISH_DOWN_DESC"
filter="user_utc"
class="input-medium"
translateformat="true"
showtime="true"
size="22"
/>
<field
name="client_id"
type="hidden"
label="COM_MODULES_FIELD_CLIENT_ID_LABEL"
description="COM_MODULES_FIELD_CLIENT_ID_DESC"
readonly="true"
size="1"
/>
<field
name="position"
type="moduleposition"
label="COM_MODULES_FIELD_POSITION_LABEL"
description="COM_MODULES_FIELD_POSITION_DESC"
default=""
maxlength="50"
/>
<field
name="access"
type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
size="1"
/>
<field
name="ordering"
type="moduleorder"
label="JFIELD_ORDERING_LABEL"
description="JFIELD_ORDERING_DESC"
/>
<field
name="content"
type="editor"
label="COM_MODULES_FIELD_CONTENT_LABEL"
description="COM_MODULES_FIELD_CONTENT_DESC"
buttons="true"
class="inputbox"
filter="JComponentHelper::filterText"
hide="readmore,pagebreak"
/>
<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="JFIELD_MODULE_LANGUAGE_DESC"
>
<option value="*">JALL</option>
</field>
<field name="assignment" type="hidden" />
<field name="assigned" type="hidden" />
</fieldset>
</form>
PKBF�[$�y�((*com_config/model/form/modules_advanced.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fields name="params">
<fieldset
name="advanced">
<field
name="module_tag"
type="moduletag"
label="COM_MODULES_FIELD_MODULE_TAG_LABEL"
description="COM_MODULES_FIELD_MODULE_TAG_DESC"
default="div"
validate="options"
/>
<field
name="bootstrap_size"
type="integer"
label="COM_MODULES_FIELD_BOOTSTRAP_SIZE_LABEL"
description="COM_MODULES_FIELD_BOOTSTRAP_SIZE_DESC"
first="0"
last="12"
step="1"
/>
<field
name="header_tag"
type="headertag"
label="COM_MODULES_FIELD_HEADER_TAG_LABEL"
description="COM_MODULES_FIELD_HEADER_TAG_DESC"
default="h3"
validate="options"
/>
<field
name="header_class"
type="text"
label="COM_MODULES_FIELD_HEADER_CLASS_LABEL"
description="COM_MODULES_FIELD_HEADER_CLASS_DESC"
/>
<field
name="style"
type="chromestyle"
label="COM_MODULES_FIELD_MODULE_STYLE_LABEL"
description="COM_MODULES_FIELD_MODULE_STYLE_DESC"
/>
</fieldset>
</fields>
</form>
PKBF�[�iv~~#com_config/model/form/templates.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field
name="id"
type="number"
label="JGLOBAL_FIELD_ID_LABEL"
description="JGLOBAL_FIELD_ID_DESC"
id="id"
default="0"
readonly="true"
class="readonly"
/>
<field
name="template"
type="text"
label="COM_TEMPLATES_FIELD_TEMPLATE_LABEL"
description="COM_TEMPLATES_FIELD_TEMPLATE_DESC"
class="readonly"
size="30"
readonly="true"
/>
<field
name="client_id"
type="hidden"
label="COM_TEMPLATES_FIELD_CLIENT_LABEL"
description="COM_TEMPLATES_FIELD_CLIENT_DESC"
class="readonly"
default="0"
readonly="true"
/>
<field
name="title"
type="text"
label="COM_TEMPLATES_FIELD_TITLE_LABEL"
description="COM_TEMPLATES_FIELD_TITLE_DESC"
class="inputbox"
size="50"
required="true"
/>
<field name="assigned" type="hidden" />
</fieldset>
</form>
PKBF�[�3[�D"D"com_config/model/form.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 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;
/**
* Prototype form model.
*
* @see JForm
* @see JFormField
* @see JFormRule
* @since 3.2
*/
abstract class ConfigModelForm extends ConfigModelCms
{
/**
* Array of form objects.
*
* @var array
* @since 3.2
*/
protected $forms = array();
/**
* Method to checkin a row.
*
* @param integer $pk The numeric id of the primary key.
*
* @return boolean False on failure or error, true otherwise.
*
* @since 3.2
* @throws RuntimeException
*/
public function checkin($pk = null)
{
// Only attempt to check the row in if it exists.
if ($pk)
{
$user = JFactory::getUser();
// Get an instance of the row to checkin.
$table = $this->getTable();
if (!$table->load($pk))
{
throw new RuntimeException($table->getError());
}
// Check if this is the user has previously checked out the row.
if ($table->checked_out > 0 && $table->checked_out !=
$user->get('id') &&
!$user->authorise('core.admin', 'com_checkin'))
{
throw new RuntimeException($table->getError());
}
// Attempt to check the row in.
if (!$table->checkin($pk))
{
throw new RuntimeException($table->getError());
}
}
return true;
}
/**
* Method to check-out a row for editing.
*
* @param integer $pk The numeric id of the primary key.
*
* @return boolean False on failure or error, true otherwise.
*
* @since 3.2
*/
public function checkout($pk = null)
{
// Only attempt to check the row in if it exists.
if ($pk)
{
$user = JFactory::getUser();
// Get an instance of the row to checkout.
$table = $this->getTable();
if (!$table->load($pk))
{
throw new RuntimeException($table->getError());
}
// Check if this is the user having previously checked out the row.
if ($table->checked_out > 0 && $table->checked_out !=
$user->get('id'))
{
throw new
RuntimeException(JText::_('JLIB_APPLICATION_ERROR_CHECKOUT_USER_MISMATCH'));
}
// Attempt to check the row out.
if (!$table->checkout($user->get('id'), $pk))
{
throw new RuntimeException($table->getError());
}
}
return true;
}
/**
* Abstract method for getting the form from the model.
*
* @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 3.2
*/
abstract public function getForm($data = array(), $loadData = true);
/**
* Method to get a form object.
*
* @param string $name The name of the form.
* @param string $source The form source. Can be XML string if file
flag is set to false.
* @param array $options Optional array of options for the form
creation.
* @param boolean $clear Optional argument to force load a new form.
* @param string $xpath An optional xpath to search for the fields.
*
* @return mixed JForm object on success, False on error.
*
* @see JForm
* @since 3.2
*/
protected function loadForm($name, $source = null, $options = array(),
$clear = false, $xpath = false)
{
// Handle the optional arguments.
$options['control'] = ArrayHelper::getValue($options,
'control', false);
// Create a signature hash.
$hash = sha1($source . serialize($options));
// Check if we can use a previously loaded form.
if (isset($this->_forms[$hash]) && !$clear)
{
return $this->_forms[$hash];
}
// Get the form.
// Register the paths for the form -- failing here
$paths = new SplPriorityQueue;
$paths->insert(JPATH_COMPONENT_ADMINISTRATOR .
'/model/form', 'normal');
$paths->insert(JPATH_COMPONENT_ADMINISTRATOR .
'/model/field', 'normal');
$paths->insert(JPATH_COMPONENT . '/model/form',
'normal');
$paths->insert(JPATH_COMPONENT . '/model/field',
'normal');
$paths->insert(JPATH_COMPONENT . '/model/rule',
'normal');
// Legacy support to be removed in 4.0. -- failing here
$paths->insert(JPATH_COMPONENT . '/models/forms',
'normal');
$paths->insert(JPATH_COMPONENT . '/models/fields',
'normal');
$paths->insert(JPATH_COMPONENT . '/models/rules',
'normal');
// Solution until JForm supports splqueue
JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
JForm::addFormPath(JPATH_COMPONENT_ADMINISTRATOR .
'/model/form');
JForm::addFieldPath(JPATH_COMPONENT_ADMINISTRATOR .
'/model/field');
JForm::addFormPath(JPATH_COMPONENT . '/model/form');
JForm::addFieldPath(JPATH_COMPONENT . '/model/field');
try
{
$form = JForm::getInstance($name, $source, $options, false, $xpath);
if (isset($options['load_data']) &&
$options['load_data'])
{
// Get the data for the form.
$data = $this->loadFormData();
}
else
{
$data = array();
}
// Allow for additional modification of the form, and events to be
triggered.
// We pass the data because plugins may require it.
$this->preprocessForm($form, $data);
// Load the data into the form after the plugins have operated.
$form->bind($data);
}
catch (Exception $e)
{
JFactory::getApplication()->enqueueMessage($e->getMessage());
return false;
}
// Store the form for later.
$this->_forms[$hash] = $form;
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return array The default data is an empty array.
*
* @since 3.2
*/
protected function loadFormData()
{
return array();
}
/**
* Method to allow derived classes to preprocess the data.
*
* @param string $context The context identifier.
* @param mixed &$data The data to be processed. It gets
altered directly.
*
* @return void
*
* @since 3.2
*/
protected function preprocessData($context, &$data)
{
// Get the dispatcher and load the users plugins.
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('content');
// Trigger the data preparation event.
$results = $dispatcher->trigger('onContentPrepareData',
array($context, $data));
// Check for errors encountered while preparing the data.
if (count($results) > 0 && in_array(false, $results, true))
{
JFactory::getApplication()->enqueueMessage($dispatcher->getError(),
'error');
}
}
/**
* Method to allow derived classes to preprocess the form.
*
* @param JForm $form A JForm object.
* @param mixed $data The data expected for the form.
* @param string $group The name of the plugin group to import
(defaults to "content").
*
* @return void
*
* @see JFormField
* @since 3.2
* @throws Exception if there is an error in the form event.
*/
protected function preprocessForm(JForm $form, $data, $group =
'content')
{
// Import the appropriate plugin group.
JPluginHelper::importPlugin($group);
// Get the dispatcher.
$dispatcher = JEventDispatcher::getInstance();
// Trigger the form preparation event.
$results = $dispatcher->trigger('onContentPrepareForm',
array($form, $data));
// Check for errors encountered while preparing the form.
if (count($results) && in_array(false, $results, true))
{
// Get the last error.
$error = $dispatcher->getError();
if (!($error instanceof Exception))
{
throw new Exception($error);
}
}
}
/**
* Method to validate the form data.
*
* @param JForm $form The form to validate against.
* @param array $data The data to validate.
* @param string $group The name of the field group to validate.
*
* @return mixed Array of filtered data if valid, false otherwise.
*
* @see JFormRule
* @see JFilterInput
* @since 3.2
*/
public function validate($form, $data, $group = null)
{
// Filter and validate the form data.
$data = $form->filter($data);
$return = $form->validate($data, $group);
// Check for an error.
if ($return instanceof Exception)
{
JFactory::getApplication()->enqueueMessage($return->getMessage(),
'error');
return false;
}
// Check the validation results.
if ($return === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $message)
{
if ($message instanceof Exception)
{
$message = $message->getMessage();
}
JFactory::getApplication()->enqueueMessage($message,
'error');
}
return false;
}
return $data;
}
}
PKCF�[�?mcom_config/model/modules.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2014 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Config Module model.
*
* @since 3.2
*/
class ConfigModelModules extends ConfigModelForm
{
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
*
* @since 3.2
*/
protected function populateState()
{
$app = JFactory::getApplication('administrator');
// Load the User state.
$pk = $app->input->getInt('id');
$state = $this->loadState();
$state->set('module.id', $pk);
$this->setState($state);
}
/**
* 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 JForm A JForm object on success, false on failure
*
* @since 3.2
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_config.modules',
'modules', array('control' => 'jform',
'load_data' => $loadData));
if (empty($form))
{
return false;
}
$form->setFieldAttribute('position', 'client',
'site');
return $form;
}
/**
* Method to preprocess the form
*
* @param JForm $form A form object.
* @param mixed $data The data expected for the form.
* @param string $group The name of the plugin group to import
(defaults to "content").
*
* @return void
*
* @since 3.2
* @throws Exception if there is an error loading the form.
*/
protected function preprocessForm(JForm $form, $data, $group =
'content')
{
jimport('joomla.filesystem.path');
$lang = JFactory::getLanguage();
$module = $this->getState()->get('module.name');
$basePath = JPATH_BASE;
$formFile = JPath::clean($basePath . '/modules/' . $module .
'/' . $module . '.xml');
// Load the core and/or local language file(s).
$lang->load($module, $basePath, null, false, true)
|| $lang->load($module, $basePath . '/modules/' . $module,
null, false, true);
if (file_exists($formFile))
{
// Get the module form.
if (!$form->loadFile($formFile, false, '//config'))
{
throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
}
// Attempt to load the xml file.
if (!$xml = simplexml_load_file($formFile))
{
throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
}
}
// Load the default advanced params
JForm::addFormPath(JPATH_BASE .
'/components/com_config/model/form');
$form->loadFile('modules_advanced', false);
// Trigger the default form events.
parent::preprocessForm($form, $data, $group);
}
/**
* Method to get list of module positions in current template
*
* @return array
*
* @since 3.2
*/
public function getPositions()
{
$lang = JFactory::getLanguage();
$templateName = JFactory::getApplication()->getTemplate();
// Load templateDetails.xml file
$path = JPath::clean(JPATH_BASE . '/templates/' . $templateName
. '/templateDetails.xml');
$currentTemplatePositions = array();
if (file_exists($path))
{
$xml = simplexml_load_file($path);
if (isset($xml->positions[0]))
{
// Load language files
$lang->load('tpl_' . $templateName . '.sys',
JPATH_BASE, null, false, true)
|| $lang->load('tpl_' . $templateName . '.sys',
JPATH_BASE . '/templates/' . $templateName, null, false, true);
foreach ($xml->positions[0] as $position)
{
$value = (string) $position;
$text = preg_replace('/[^a-zA-Z0-9_\-]/', '_',
'TPL_' . strtoupper($templateName) . '_POSITION_' .
strtoupper($value));
// Construct list of positions
$currentTemplatePositions[] = self::createOption($value,
JText::_($text) . ' [' . $value . ']');
}
}
}
$templateGroups = array();
// Add an empty value to be able to deselect a module position
$option = self::createOption();
$templateGroups[''] = self::createOptionGroup('',
array($option));
$templateGroups[$templateName] = self::createOptionGroup($templateName,
$currentTemplatePositions);
// Add custom position to options
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
$editPositions = true;
$customPositions = self::getActivePositions(0, $editPositions);
$templateGroups[$customGroupText] =
self::createOptionGroup($customGroupText, $customPositions);
return $templateGroups;
}
/**
* Get a list of modules positions
*
* @param integer $clientId Client ID
* @param boolean $editPositions Allow to edit the positions
*
* @return array A list of positions
*
* @since 3.6.3
*/
public static function getActivePositions($clientId, $editPositions =
false)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT position')
->from($db->quoteName('#__modules'))
->where($db->quoteName('client_id') . ' = ' .
(int) $clientId)
->order($db->quoteName('position'));
$db->setQuery($query);
try
{
$positions = $db->loadColumn();
$positions = is_array($positions) ? $positions : array();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
return;
}
// Build the list
$options = array();
foreach ($positions as $position)
{
if (!$position && !$editPositions)
{
$options[] = JHtml::_('select.option', 'none',
':: ' . JText::_('JNONE') . ' ::');
}
else
{
$options[] = JHtml::_('select.option', $position, $position);
}
}
return $options;
}
/**
* Create and return a new Option
*
* @param string $value The option value [optional]
* @param string $text The option text [optional]
*
* @return object The option as an object (stdClass instance)
*
* @since 3.6.3
*/
private static function createOption($value = '', $text =
'')
{
if (empty($text))
{
$text = $value;
}
$option = new stdClass;
$option->value = $value;
$option->text = $text;
return $option;
}
/**
* Create and return a new Option Group
*
* @param string $label Value and label for group [optional]
* @param array $options Array of options to insert into group
[optional]
*
* @return array Return the new group as an array
*
* @since 3.6.3
*/
private static function createOptionGroup($label = '', $options
= array())
{
$group = array();
$group['value'] = $label;
$group['text'] = $label;
$group['items'] = $options;
return $group;
}
}
PKCF�[�R#iJJcom_config/model/templates.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Template style model.
*
* @since 3.2
*/
class ConfigModelTemplates extends ConfigModelForm
{
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return null
*
* @since 3.2
*/
protected function populateState()
{
$state = $this->loadState();
// Load the parameters.
$params = JComponentHelper::getParams('com_templates');
$state->set('params', $params);
$this->setState($state);
}
/**
* Method to get the record form.
*
* @param array $data An optional array of data for the form to
interrogate.
* @param boolean $loadData True if the form is to load its own data
(default case), false if not.
*
* @return JForm A JForm object on success, false on failure
*
* @since 3.2
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_config.templates',
'templates', array('control' => 'jform',
'load_data' => $loadData));
try
{
$form = new JForm('com_config.templates');
$data = array();
$this->preprocessForm($form, $data);
// Load the data into the form
$form->bind($data);
}
catch (Exception $e)
{
JFactory::getApplication()->enqueueMessage($e->getMessage());
return false;
}
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to preprocess the form
*
* @param JForm $form A form object.
* @param mixed $data The data expected for the form.
* @param string $group Plugin group to load
*
* @return void
*
* @since 3.2
* @throws Exception if there is an error in the form event.
*/
protected function preprocessForm(JForm $form, $data, $group =
'content')
{
$lang = JFactory::getLanguage();
$template = JFactory::getApplication()->getTemplate();
jimport('joomla.filesystem.path');
// Load the core and/or local language file(s).
$lang->load('tpl_' . $template, JPATH_BASE, null, false,
true)
|| $lang->load('tpl_' . $template, JPATH_BASE .
'/templates/' . $template, null, false, true);
// Look for com_config.xml, which contains fields to display
$formFile = JPath::clean(JPATH_BASE . '/templates/' . $template
. '/com_config.xml');
if (!file_exists($formFile))
{
// If com_config.xml not found, fall back to templateDetails.xml
$formFile = JPath::clean(JPATH_BASE . '/templates/' .
$template . '/templateDetails.xml');
}
// Get the template form.
if (file_exists($formFile) && !$form->loadFile($formFile,
false, '//config'))
{
throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
}
// Attempt to load the xml file.
if (!$xml = simplexml_load_file($formFile))
{
throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
}
// Trigger the default form events.
parent::preprocessForm($form, $data, $group);
}
}
PKCF�[��2com_config/view/cms/html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Prototype admin view.
*
* @since 3.2
*/
abstract class ConfigViewCmsHtml extends JViewHtml
{
/**
* The output of the template script.
*
* @var string
* @since 3.2
*/
protected $_output = null;
/**
* The name of the default template source file.
*
* @var string
* @since 3.2
*/
protected $_template = null;
/**
* The set of search directories for resources (templates)
*
* @var array
* @since 3.2
*/
protected $_path = array('template' => array(),
'helper' => array());
/**
* Layout extension
*
* @var string
* @since 3.2
*/
protected $_layoutExt = 'php';
/**
* Method to instantiate the view.
*
* @param JModel $model The model object.
* @param SplPriorityQueue $paths The paths queue.
*
* @since 3.2
*/
public function __construct(JModel $model, SplPriorityQueue $paths = null)
{
$app = JFactory::getApplication();
$component = JApplicationHelper::getComponentName();
$component = preg_replace('/[^A-Z0-9_\.-]/i', '',
$component);
if (isset($paths))
{
$paths->insert(JPATH_THEMES . '/' . $app->getTemplate()
. '/html/' . $component . '/' . $this->getName(),
2);
}
parent::__construct($model, $paths);
}
/**
* Load a template file -- first look in the templates folder for an
override
*
* @param string $tpl The name of the template source file;
automatically searches the template paths and compiles as needed.
*
* @return string The output of the the template script.
*
* @since 3.2
* @throws Exception
*/
public function loadTemplate($tpl = null)
{
// Clear prior output
$this->_output = null;
$template = JFactory::getApplication()->getTemplate();
$layout = $this->getLayout();
// Create the template file name based on the layout
$file = isset($tpl) ? $layout . '_' . $tpl : $layout;
// Clean the file name
$file = preg_replace('/[^A-Z0-9_\.-]/i', '', $file);
$tpl = isset($tpl) ? preg_replace('/[^A-Z0-9_\.-]/i',
'', $tpl) : $tpl;
// Load the language file for the template
$lang = JFactory::getLanguage();
$lang->load('tpl_' . $template, JPATH_BASE, null, false,
true)
|| $lang->load('tpl_' . $template, JPATH_THEMES .
"/$template", null, false, true);
// Prevents adding path twise
if (empty($this->_path['template']))
{
// Adding template paths
$this->paths->top();
$defaultPath = $this->paths->current();
$this->paths->next();
$templatePath = $this->paths->current();
$this->_path['template'] = array($defaultPath,
$templatePath);
}
// Load the template script
jimport('joomla.filesystem.path');
$filetofind = $this->_createFileName('template',
array('name' => $file));
$this->_template = JPath::find($this->_path['template'],
$filetofind);
// If alternate layout can't be found, fall back to default layout
if ($this->_template == false)
{
$filetofind = $this->_createFileName('',
array('name' => 'default' . (isset($tpl) ?
'_' . $tpl : $tpl)));
$this->_template = JPath::find($this->_path['template'],
$filetofind);
}
if ($this->_template != false)
{
// Unset so as not to introduce into template scope
unset($tpl, $file);
// Never allow a 'this' property
if (isset($this->this))
{
unset($this->this);
}
// Start capturing output into a buffer
ob_start();
// Include the requested template filename in the local scope
// (this will execute the view logic).
include $this->_template;
// Done with the requested template; get the buffer and
// clear it.
$this->_output = ob_get_contents();
ob_end_clean();
return $this->_output;
}
else
{
throw new
Exception(JText::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND',
$file), 500);
}
}
/**
* Create the filename for a resource
*
* @param string $type The resource type to create the filename for
* @param array $parts An associative array of filename information
*
* @return string The filename
*
* @since 3.2
*/
protected function _createFileName($type, $parts = array())
{
switch ($type)
{
case 'template':
$filename = strtolower($parts['name']) . '.' .
$this->_layoutExt;
break;
default:
$filename = strtolower($parts['name']) . '.php';
break;
}
return $filename;
}
/**
* Method to get the view name
*
* The model name by default parsed using the classname, or it can be set
* by passing a $config['name'] in the class constructor
*
* @return string The name of the model
*
* @since 3.2
* @throws Exception
*/
public function getName()
{
if (empty($this->_name))
{
$classname = get_class($this);
$viewpos = strpos($classname, 'View');
if ($viewpos === false)
{
throw new
Exception(JText::_('JLIB_APPLICATION_ERROR_VIEW_GET_NAME'), 500);
}
$lastPart = substr($classname, $viewpos + 4);
$pathParts = explode(' ',
JStringNormalise::fromCamelCase($lastPart));
if (!empty($pathParts[1]))
{
$this->_name = strtolower($pathParts[0]);
}
else
{
$this->_name = strtolower($lastPart);
}
}
return $this->_name;
}
}
PKCF�[�946iicom_config/view/cms/json.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Prototype admin view.
*
* @since 3.2
*/
abstract class ConfigViewCmsJson extends ConfigViewCmsHtml
{
public $state;
public $data;
/**
* Method to render the view.
*
* @return string The rendered view.
*
* @since 3.2
*/
public function render()
{
$this->data = $this->model->getData();
return json_encode($this->data);
}
}
PKCF�[=�
��com_config/view/config/html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 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 for the global configuration
*
* @since 3.2
*/
class ConfigViewConfigHtml extends ConfigViewCmsHtml
{
public $form;
public $data;
/**
* Method to render the view.
*
* @return string The rendered view.
*
* @since 3.2
*/
public function render()
{
$user = JFactory::getUser();
$this->userIsSuperAdmin = $user->authorise('core.admin');
return parent::render();
}
}
PKDF�[�'com_config/view/config/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Load tooltips behavior
JHtml::_('behavior.formvalidator');
JHtml::_('bootstrap.tooltip');
JHtml::_('formbehavior.chosen', 'select');
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
if (task == 'config.cancel' ||
document.formvalidator.isValid(document.getElementById('application-form')))
{
Joomla.submitform(task,
document.getElementById('application-form'));
}
}
");
?>
<form action="<?php echo
JRoute::_('index.php?option=com_config'); ?>"
id="application-form" method="post"
name="adminForm" class="form-validate">
<div class="row-fluid">
<!-- Begin Content -->
<div class="btn-toolbar" role="toolbar"
aria-label="<?php echo JText::_('JTOOLBAR');
?>">
<div class="btn-group">
<button type="button" class="btn btn-primary"
onclick="Joomla.submitbutton('config.save.config.apply')">
<span class="icon-ok"></span> <?php echo
JText::_('JSAVE') ?>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn"
onclick="Joomla.submitbutton('config.cancel')">
<span class="icon-cancel"></span> <?php echo
JText::_('JCANCEL') ?>
</button>
</div>
</div>
<hr class="hr-condensed" />
<div id="page-site" class="tab-pane active">
<div class="row-fluid">
<?php echo $this->loadTemplate('site'); ?>
<?php echo $this->loadTemplate('metadata'); ?>
<?php echo $this->loadTemplate('seo'); ?>
</div>
</div>
<input type="hidden" name="task"
value="" />
<?php echo JHtml::_('form.token'); ?>
<!-- End Content -->
</div>
</form>
PKDF�[ImO��'com_config/view/config/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONFIG_CONFIG_VIEW_DEFAULT_TITLE"
option="COM_CONFIG_CONFIG_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_DISPLAY_SITE_CONFIGURATION"
/>
<message>
<![CDATA[COM_CONFIG_CONFIG_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<fields name="request">
<fieldset name="request">
<field
name="controller"
type="hidden"
default="config.display.config"
/>
</fieldset>
</fields>
</metadata>PKEF�[�!3
}}0com_config/view/config/tmpl/default_metadata.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<fieldset class="form-horizontal">
<legend><?php echo
JText::_('COM_CONFIG_METADATA_SETTINGS'); ?></legend>
<?php
foreach ($this->form->getFieldset('metadata') as $field) :
?>
<div class="control-group">
<div class="control-label"><?php echo
$field->label; ?></div>
<div class="controls"><?php echo $field->input;
?></div>
</div>
<?php
endforeach;
?>
</fieldset>
PKEF�[ƩjYss+com_config/view/config/tmpl/default_seo.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<fieldset class="form-horizontal">
<legend><?php echo JText::_('COM_CONFIG_SEO_SETTINGS');
?></legend>
<?php
foreach ($this->form->getFieldset('seo') as $field) :
?>
<div class="control-group">
<div class="control-label"><?php echo
$field->label; ?></div>
<div class="controls"><?php echo $field->input;
?></div>
</div>
<?php
endforeach;
?>
</fieldset>
PKEF�[��Ouu,com_config/view/config/tmpl/default_site.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<fieldset class="form-horizontal">
<legend><?php echo
JText::_('COM_CONFIG_SITE_SETTINGS'); ?></legend>
<?php
foreach ($this->form->getFieldset('site') as $field) :
?>
<div class="control-group">
<div class="control-label"><?php echo
$field->label; ?></div>
<div class="controls"><?php echo $field->input;
?></div>
</div>
<?php
endforeach;
?>
</fieldset>
PKEF�[Ecٍ
com_config/view/modules/html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2014 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 module.
*
* @package Joomla.Site
* @subpackage com_config
* @since 3.2
*/
class ConfigViewModulesHtml extends ConfigViewCmsHtml
{
public $item;
public $form;
/**
* Display the view
*
* @return string The rendered view.
*
* @since 3.2
*/
public function render()
{
$lang = JFactory::getApplication()->getLanguage();
$lang->load('', JPATH_ADMINISTRATOR, $lang->getTag());
$lang->load('com_modules', JPATH_ADMINISTRATOR,
$lang->getTag());
return parent::render();
}
}
PKEF�[����$$(com_config/view/modules/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2014 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::_('bootstrap.tooltip');
JHtml::_('behavior.formvalidator');
JHtml::_('behavior.keepalive');
JHtml::_('behavior.combobox');
JHtml::_('formbehavior.chosen', 'select');
jimport('joomla.filesystem.file');
$editorText = false;
$moduleXml = JPATH_SITE . '/modules/' .
$this->item['module'] . '/' .
$this->item['module'] . '.xml';
if (JFile::exists($moduleXml))
{
$xml = simplexml_load_file($moduleXml);
if (isset($xml->customContent))
{
$editorText = true;
}
}
// If multi-language site, make language read-only
if (JLanguageMultilang::isEnabled())
{
$this->form->setFieldAttribute('language',
'readonly', 'true');
}
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
if (task == 'config.cancel.modules' ||
document.formvalidator.isValid(document.getElementById('modules-form')))
{
Joomla.submitform(task,
document.getElementById('modules-form'));
}
}
");
?>
<form
action="<?php echo
JRoute::_('index.php?option=com_config'); ?>"
method="post" name="adminForm"
id="modules-form"
class="form-validate">
<div class="row-fluid">
<!-- Begin Content -->
<div class="span12">
<div class="btn-toolbar" role="toolbar"
aria-label="<?php echo JText::_('JTOOLBAR');
?>">
<div class="btn-group">
<button type="button" class="btn btn-primary"
onclick="Joomla.submitbutton('config.save.modules.apply')">
<span class="icon-apply"
aria-hidden="true"></span>
<?php echo JText::_('JAPPLY'); ?>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn"
onclick="Joomla.submitbutton('config.save.modules.save')">
<span class="icon-save"
aria-hidden="true"></span>
<?php echo JText::_('JSAVE'); ?>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn"
onclick="Joomla.submitbutton('config.cancel.modules')">
<span class="icon-cancel"
aria-hidden="true"></span>
<?php echo JText::_('JCANCEL'); ?>
</button>
</div>
</div>
<hr class="hr-condensed" />
<legend><?php echo
JText::_('COM_CONFIG_MODULES_SETTINGS_TITLE');
?></legend>
<div>
<?php echo JText::_('COM_CONFIG_MODULES_MODULE_NAME');
?>
<span class="label label-default"><?php echo
$this->item['title']; ?></span>
<?php echo JText::_('COM_CONFIG_MODULES_MODULE_TYPE');
?>
<span class="label label-default"><?php echo
$this->item['module']; ?></span>
</div>
<hr />
<div class="row-fluid">
<div class="span12">
<fieldset class="form-horizontal">
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('title'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('title'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('showtitle');
?>
</div>
<div class="controls">
<?php echo $this->form->getInput('showtitle');
?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('position');
?>
</div>
<div class="controls">
<?php echo $this->loadTemplate('positions'); ?>
</div>
</div>
<hr />
<?php if
(JFactory::getUser()->authorise('core.edit.state',
'com_modules.module.' . $this->item['id'])) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('published');
?>
</div>
<div class="controls">
<?php echo $this->form->getInput('published');
?>
</div>
</div>
<?php endif ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('publish_up');
?>
</div>
<div class="controls">
<?php echo $this->form->getInput('publish_up');
?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo
$this->form->getLabel('publish_down'); ?>
</div>
<div class="controls">
<?php echo
$this->form->getInput('publish_down'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('access');
?>
</div>
<div class="controls">
<?php echo $this->form->getInput('access');
?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('ordering');
?>
</div>
<div class="controls">
<?php echo $this->form->getInput('ordering');
?>
</div>
</div>
<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('note'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('note'); ?>
</div>
</div>
<hr />
<div id="options">
<?php echo $this->loadTemplate('options'); ?>
</div>
<?php if ($editorText) : ?>
<div class="tab-pane" id="custom">
<?php echo $this->form->getInput('content');
?>
</div>
<?php endif; ?>
</fieldset>
</div>
<input type="hidden" name="id"
value="<?php echo $this->item['id']; ?>" />
<input type="hidden" name="return"
value="<?php echo
JFactory::getApplication()->input->get('return', null,
'base64'); ?>" />
<input type="hidden" name="task"
value="" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
<!-- End Content -->
</div>
</form>
PKEF�[EDC��0com_config/view/modules/tmpl/default_options.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2014 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
$fieldSets = $this->form->getFieldsets('params');
echo JHtml::_('bootstrap.startAccordion',
'collapseTypes');
$i = 0;
foreach ($fieldSets as $name => $fieldSet) :
$label = !empty($fieldSet->label) ? $fieldSet->label :
'COM_MODULES_' . $name . '_FIELDSET_LABEL';
$class = isset($fieldSet->class) && !empty($fieldSet->class)
? $fieldSet->class : '';
if (isset($fieldSet->description) &&
trim($fieldSet->description)) :
echo '<p class="tip">' .
$this->escape(JText::_($fieldSet->description)) .
'</p>';
endif;
?>
<?php echo JHtml::_('bootstrap.addSlide',
'collapseTypes', JText::_($label), 'collapse' .
($i++)); ?>
<ul class="nav nav-tabs nav-stacked">
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
<li>
<?php // If multi-language site, make menu-type selection read-only
?>
<?php if (JLanguageMultilang::isEnabled() &&
$this->item['module'] === 'mod_menu' &&
$field->getAttribute('name') === 'menutype') : ?>
<?php $field->readonly = true; ?>
<?php endif; ?>
<?php echo $field->renderField(); ?>
</li>
<?php endforeach; ?>
</ul>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php endforeach; ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
PKFF�[�*�QQ2com_config/view/modules/tmpl/default_positions.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2014 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
$positions = $this->model->getPositions();
// Add custom position to options
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
// Build field
$attr = array(
'id' => 'jform_position',
'list.select' => $this->item['position'],
'list.attr' => 'class="chzn-custom-value"
'
. 'data-custom_group_text="' . $customGroupText .
'" '
. 'data-no_results_text="' .
JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" '
. 'data-placeholder="' .
JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '"
'
);
echo JHtml::_('select.groupedlist', $positions,
'jform[position]', $attr);
PKFF�[+V'Ƙ�"com_config/view/templates/html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 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 template style.
*
* @since 3.2
*/
class ConfigViewTemplatesHtml extends ConfigViewCmsHtml
{
public $item;
public $form;
/**
* Method to render the view.
*
* @return string The rendered view.
*
* @since 3.2
*/
public function render()
{
$user = JFactory::getUser();
$this->userIsSuperAdmin = $user->authorise('core.admin');
return parent::render();
}
}
PKFF�[H��F��*com_config/view/templates/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 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.formvalidator');
JHtml::_('behavior.keepalive');
$user = JFactory::getUser();
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
if (task == 'config.cancel' ||
document.formvalidator.isValid(document.getElementById('templates-form')))
{
Joomla.submitform(task,
document.getElementById('templates-form'));
}
}
");
?>
<form action="<?php echo
JRoute::_('index.php?option=com_config'); ?>"
method="post" name="adminForm"
id="templates-form" class="form-validate">
<div class="row-fluid">
<!-- Begin Content -->
<div class="btn-toolbar" role="toolbar"
aria-label="<?php echo JText::_('JTOOLBAR');
?>">
<div class="btn-group">
<button type="button" class="btn btn-primary"
onclick="Joomla.submitbutton('config.save.templates.apply')">
<span class="icon-ok"></span> <?php echo
JText::_('JSAVE') ?>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn"
onclick="Joomla.submitbutton('config.cancel')">
<span class="icon-cancel"></span> <?php echo
JText::_('JCANCEL') ?>
</button>
</div>
</div>
<hr class="hr-condensed" />
<div id="page-site" class="tab-pane active">
<div class="row-fluid">
<?php // Get the menu parameters that are automatically set but may
be modified.
echo $this->loadTemplate('options'); ?>
</div>
</div>
<input type="hidden" name="task"
value="" />
<?php echo JHtml::_('form.token'); ?>
<!-- End Content -->
</div>
</form>
PKFF�[C?���*com_config/view/templates/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONFIG_TEMPLATES_VIEW_DEFAULT_TITLE"
option="COM_CONFIG_TEMPLATES_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_DISPLAY_TEMPLATE_OPTIONS"
/>
<message>
<![CDATA[COM_CONFIG_TEMPLATES_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<fields name="request">
<fieldset name="request" >
<field
name="controller"
type="hidden"
default="config.display.templates"
/>
</fieldset>
</fields>
</metadata>PKHF�[S3Tzz2com_config/view/templates/tmpl/default_options.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Load chosen.css
JHtml::_('formbehavior.chosen', 'select');
?>
<?php
$fieldSets = $this->form->getFieldsets('params');
?>
<legend><?php echo
JText::_('COM_CONFIG_TEMPLATE_SETTINGS'); ?></legend>
<?php
// Search for com_config field set
if (!empty($fieldSets['com_config'])) : ?>
<fieldset class="form-horizontal">
<?php echo $this->form->renderFieldset('com_config');
?>
</fieldset>
<?php else :
// Fall-back to display all in params
foreach ($fieldSets as $name => $fieldSet) :
$label = !empty($fieldSet->label) ? $fieldSet->label :
'COM_CONFIG_' . $name . '_FIELDSET_LABEL';
if (isset($fieldSet->description) &&
trim($fieldSet->description)) :
echo '<p class="tip">' .
$this->escape(JText::_($fieldSet->description)) .
'</p>';
endif;
?>
<fieldset class="form-horizontal">
<?php echo $this->form->renderFieldset($name); ?>
</fieldset>
<?php endforeach;
endif;
PKHF�[���v^^com_contact/contact.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2005 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('ContactHelperRoute', JPATH_COMPONENT .
'/helpers/route.php');
$input = JFactory::getApplication()->input;
if ($input->get('view') === 'contacts' &&
$input->get('layout') === 'modal')
{
if (!JFactory::getUser()->authorise('core.create',
'com_contact'))
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'warning');
return;
}
JFactory::getLanguage()->load('com_contact',
JPATH_ADMINISTRATOR);
}
$controller = JControllerLegacy::getInstance('Contact');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
PKHF�[N�Yy��com_contact/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Contact Component Controller
*
* @since 1.5
*/
class ContactController extends JControllerLegacy
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
* Recognized key values include
'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant
to be comprehensive).
*
* @since 3.7.0
*/
public function __construct($config = array())
{
$this->input = JFactory::getApplication()->input;
// Contact frontpage Editor contacts proxying:
if ($this->input->get('view') === 'contacts'
&& $this->input->get('layout') ===
'modal')
{
JHtml::_('stylesheet', 'system/adminlist.css',
array(), true);
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}
parent::__construct($config);
}
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their
variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JControllerLegacy This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = array())
{
if
(JFactory::getApplication()->getUserState('com_contact.contact.data')
=== null)
{
$cachable = true;
}
// Set the default view name and format from the Request.
$vName = $this->input->get('view',
'categories');
$this->input->set('view', $vName);
$safeurlparams = array('catid' => 'INT',
'id' => 'INT', 'cid' =>
'ARRAY', 'year' => 'INT',
'month' => 'INT',
'limit' => 'UINT', 'limitstart' =>
'UINT', 'showall' => 'INT',
'return' => 'BASE64', 'filter' =>
'STRING',
'filter_order' => 'CMD',
'filter_order_Dir' => 'CMD',
'filter-search' => 'STRING', 'print' =>
'BOOLEAN',
'lang' => 'CMD');
parent::display($cachable, $safeurlparams);
return $this;
}
}
PKIF�[e�ydqq#com_contact/controllers/contact.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2010 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Controller for single contact view
*
* @since 1.5.19
*/
class ContactControllerContact extends JControllerForm
{
/**
* 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 JModelLegacy The model.
*
* @since 1.6.4
*/
public function getModel($name = '', $prefix = '',
$config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, array('ignore_request'
=> false));
}
/**
* Method to submit the contact form and send an email.
*
* @return boolean True on success sending the email. False on failure.
*
* @since 1.5.19
*/
public function submit()
{
// Check for request forgeries.
$this->checkToken();
$app = JFactory::getApplication();
$model = $this->getModel('contact');
$stub = $this->input->getString('id');
$id = (int) $stub;
// Get the data from POST
$data = $this->input->post->get('jform', array(),
'array');
// Get item
$model->setState('filter.published', 1);
$contact = $model->getItem($id);
// Get item params, take menu parameters into account if necessary
$active = $app->getMenu()->getActive();
$stateParams = clone $model->getState()->get('params');
// If the current view is the active item and a contact view for this
contact, then the menu item params take priority
if ($active && strpos($active->link, 'view=contact')
&& strpos($active->link, '&id=' . (int)
$contact->id))
{
// $item->params are the contact params, $temp are the menu item
params
// Merge so that the menu item params take priority
$contact->params->merge($stateParams);
}
else
{
// Current view is not a single contact, so the contact params take
priority here
$stateParams->merge($contact->params);
$contact->params = $stateParams;
}
// Check if the contact form is enabled
if (!$contact->params->get('show_email_form'))
{
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='
. $stub . '&catid=' . $contact->catid, false));
return false;
}
// Check for a valid session cookie
if ($contact->params->get('validate_session', 0))
{
if (JFactory::getSession()->getState() !== 'active')
{
JError::raiseWarning(403,
JText::_('JLIB_ENVIRONMENT_SESSION_INVALID'));
// Save the data in the session.
$app->setUserState('com_contact.contact.data', $data);
// Redirect back to the contact form.
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='
. $stub . '&catid=' . $contact->catid, false));
return false;
}
}
// Contact plugins
JPluginHelper::importPlugin('contact');
$dispatcher = JEventDispatcher::getInstance();
// Validate the posted data.
$form = $model->getForm();
if (!$form)
{
JError::raiseError(500, $model->getError());
return false;
}
if (!$model->validate($form, $data))
{
$errors = $model->getErrors();
foreach ($errors as $error)
{
$errorMessage = $error;
if ($error instanceof Exception)
{
$errorMessage = $error->getMessage();
}
$app->enqueueMessage($errorMessage, 'error');
}
$app->setUserState('com_contact.contact.data', $data);
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='
. $stub . '&catid=' . $contact->catid, false));
return false;
}
// Validation succeeded, continue with custom handlers
$results = $dispatcher->trigger('onValidateContact',
array(&$contact, &$data));
foreach ($results as $result)
{
if ($result instanceof Exception)
{
return false;
}
}
// Passed Validation: Process the contact plugins to integrate with other
applications
$dispatcher->trigger('onSubmitContact', array(&$contact,
&$data));
// Send the email
$sent = false;
if (!$contact->params->get('custom_reply'))
{
$sent = $this->_sendEmail($data, $contact,
$contact->params->get('show_email_copy', 0));
}
// Set the success message if it was a success
if (!($sent instanceof Exception))
{
$msg = JText::_('COM_CONTACT_EMAIL_THANKS');
}
else
{
$msg = '';
}
// Flush the data from the session
$app->setUserState('com_contact.contact.data', null);
// Redirect if it is set in the parameters, otherwise redirect back to
where we came from
if ($contact->params->get('redirect'))
{
$this->setRedirect($contact->params->get('redirect'),
$msg);
}
else
{
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='
. $stub . '&catid=' . $contact->catid, false), $msg);
}
return true;
}
/**
* Method to get a model object, loading it if required.
*
* @param array $data The data to send in the email.
* @param stdClass $contact The user information to send the
email to
* @param boolean $emailCopyToSender True to send a copy of the email
to the user.
*
* @return boolean True on success sending the email, false on failure.
*
* @since 1.6.4
*/
private function _sendEmail($data, $contact, $emailCopyToSender)
{
$app = JFactory::getApplication();
if ($contact->email_to == '' && $contact->user_id
!= 0)
{
$contact_user = JUser::getInstance($contact->user_id);
$contact->email_to = $contact_user->get('email');
}
$mailfrom = $app->get('mailfrom');
$fromname = $app->get('fromname');
$sitename = $app->get('sitename');
$name = $data['contact_name'];
$email =
JStringPunycode::emailToPunycode($data['contact_email']);
$subject = $data['contact_subject'];
$body = $data['contact_message'];
// Prepare email body
$prefix = JText::sprintf('COM_CONTACT_ENQUIRY_TEXT',
JUri::base());
$body = $prefix . "\n" . $name . ' <' . $email .
'>' . "\r\n\r\n" . stripslashes($body);
// Load the custom fields
if (!empty($data['com_fields']) && $fields =
FieldsHelper::getFields('com_contact.mail', $contact, true,
$data['com_fields']))
{
$output = FieldsHelper::render(
'com_contact.mail',
'fields.render',
array(
'context' => 'com_contact.mail',
'item' => $contact,
'fields' => $fields,
)
);
if ($output)
{
$body .= "\r\n\r\n" . $output;
}
}
$mail = JFactory::getMailer();
$mail->addRecipient($contact->email_to);
$mail->addReplyTo($email, $name);
$mail->setSender(array($mailfrom, $fromname));
$mail->setSubject($sitename . ': ' . $subject);
$mail->setBody($body);
$sent = $mail->Send();
// If we are supposed to copy the sender, do so.
// Check whether email copy function activated
if ($emailCopyToSender == true &&
!empty($data['contact_email_copy']))
{
$copytext = JText::sprintf('COM_CONTACT_COPYTEXT_OF',
$contact->name, $sitename);
$copytext .= "\r\n\r\n" . $body;
$copysubject = JText::sprintf('COM_CONTACT_COPYSUBJECT_OF',
$subject);
$mail = JFactory::getMailer();
$mail->addRecipient($email);
$mail->addReplyTo($email, $name);
$mail->setSender(array($mailfrom, $fromname));
$mail->setSubject($copysubject);
$mail->setBody($copytext);
$sent = $mail->Send();
}
return $sent;
}
}
PKIF�[-T��#com_contact/helpers/association.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('ContactHelper', JPATH_ADMINISTRATOR .
'/components/com_contact/helpers/contact.php');
JLoader::register('ContactHelperRoute', JPATH_SITE .
'/components/com_contact/helpers/route.php');
JLoader::register('CategoryHelperAssociation',
JPATH_ADMINISTRATOR .
'/components/com_categories/helpers/association.php');
/**
* Contact Component Association Helper
*
* @since 3.0
*/
abstract class ContactHelperAssociation extends CategoryHelperAssociation
{
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null)
{
$jinput = JFactory::getApplication()->input;
$view = $view === null ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view === 'contact')
{
if ($id)
{
$associations =
JLanguageAssociations::getAssociations('com_contact',
'#__contact_details', 'com_contact.item', $id);
$return = array();
foreach ($associations as $tag => $item)
{
$return[$tag] = ContactHelperRoute::getContactRoute($item->id,
(int) $item->catid, $item->language);
}
return $return;
}
}
if ($view === 'category' || $view === 'categories')
{
return self::getCategoryAssociations($id, 'com_contact');
}
return array();
}
}
PKIF�[��?���
com_contact/helpers/category.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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;
/**
* Contact Component Category Tree
*
* @since 1.6
*/
class ContactCategories extends JCategories
{
/**
* Class constructor
*
* @param array $options Array of options
*
* @since 1.6
*/
public function __construct($options = array())
{
$options['table'] = '#__contact_details';
$options['extension'] = 'com_contact';
$options['statefield'] = 'published';
parent::__construct($options);
}
}
PKIF�[Y��$22$com_contact/helpers/legacyrouter.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Legacy routing rules class from com_contact
*
* @since 3.6
* @deprecated 4.0
*/
class ContactRouterRulesLegacy implements JComponentRouterRulesInterface
{
/**
* Constructor for this legacy router
*
* @param JComponentRouterAdvanced $router The router this rule
belongs to
*
* @since 3.6
* @deprecated 4.0
*/
public function __construct($router)
{
$this->router = $router;
}
/**
* Preprocess the route for the com_contact component
*
* @param array &$query An array of URL arguments
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function preprocess(&$query)
{
}
/**
* Build the route for the com_contact component
*
* @param array &$query An array of URL arguments
* @param array &$segments The URL arguments to use to assemble
the subsequent URL.
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function build(&$query, &$segments)
{
// Get a menu item based on Itemid or currently active
$params = JComponentHelper::getParams('com_contact');
$advanced = $params->get('sef_advanced_link', 0);
if (empty($query['Itemid']))
{
$menuItem = $this->router->menu->getActive();
}
else
{
$menuItem =
$this->router->menu->getItem($query['Itemid']);
}
$mView = empty($menuItem->query['view']) ? null :
$menuItem->query['view'];
$mId = empty($menuItem->query['id']) ? null :
$menuItem->query['id'];
if (isset($query['view']))
{
$view = $query['view'];
if (empty($query['Itemid']) || empty($menuItem) ||
$menuItem->component != 'com_contact')
{
$segments[] = $query['view'];
}
unset($query['view']);
}
// Are we dealing with a contact that is attached to a menu item?
if (isset($view) && ($mView == $view) &&
isset($query['id']) && ($mId == (int)
$query['id']))
{
unset($query['view'], $query['catid'],
$query['id']);
return;
}
if (isset($view) && ($view == 'category' || $view ==
'contact'))
{
if ($mId != (int) $query['id'] || $mView != $view)
{
if ($view == 'contact' &&
isset($query['catid']))
{
$catid = $query['catid'];
}
elseif (isset($query['id']))
{
$catid = $query['id'];
}
$menuCatid = $mId;
$categories = JCategories::getInstance('Contact');
$category = $categories->get($catid);
if ($category)
{
// TODO Throw error that the category either not exists or is
unpublished
$path = array_reverse($category->getPath());
$array = array();
foreach ($path as $id)
{
if ((int) $id == (int) $menuCatid)
{
break;
}
if ($advanced)
{
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
}
$segments = array_merge($segments, array_reverse($array));
}
if ($view == 'contact')
{
if ($advanced)
{
list($tmp, $id) = explode(':', $query['id'], 2);
}
else
{
$id = $query['id'];
}
$segments[] = $id;
}
}
unset($query['id'], $query['catid']);
}
if (isset($query['layout']))
{
if (!empty($query['Itemid']) &&
isset($menuItem->query['layout']))
{
if ($query['layout'] ==
$menuItem->query['layout'])
{
unset($query['layout']);
}
}
else
{
if ($query['layout'] == 'default')
{
unset($query['layout']);
}
}
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-',
$segments[$i]);
}
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
* @param array &$vars The URL attributes to be used by the
application.
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function parse(&$segments, &$vars)
{
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = preg_replace('/-/', ':',
$segments[$i], 1);
}
// Get the active menu item.
$item = $this->router->menu->getActive();
$params = JComponentHelper::getParams('com_contact');
$advanced = $params->get('sef_advanced_link', 0);
// Count route segments
$count = count($segments);
// Standard routing for newsfeeds.
if (!isset($item))
{
$vars['view'] = $segments[0];
$vars['id'] = $segments[$count - 1];
return;
}
// From the categories view, we can only jump to a category.
$id = (isset($item->query['id']) &&
$item->query['id'] > 1) ? $item->query['id'] :
'root';
$contactCategory =
JCategories::getInstance('Contact')->get($id);
$categories = $contactCategory ? $contactCategory->getChildren() :
array();
$vars['catid'] = $id;
$vars['id'] = $id;
$found = 0;
foreach ($segments as $segment)
{
$segment = $advanced ? str_replace(':', '-',
$segment) : $segment;
foreach ($categories as $category)
{
if ($category->slug == $segment || $category->alias == $segment)
{
$vars['id'] = $category->id;
$vars['catid'] = $category->id;
$vars['view'] = 'category';
$categories = $category->getChildren();
$found = 1;
break;
}
}
if ($found == 0)
{
if ($advanced)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from('#__contact_details')
->where($db->quoteName('catid') . ' = ' .
(int) $vars['catid'])
->where($db->quoteName('alias') . ' = ' .
$db->quote($segment));
$db->setQuery($query);
$nid = $db->loadResult();
}
else
{
$nid = $segment;
}
$vars['id'] = $nid;
$vars['view'] = 'contact';
}
$found = 0;
}
}
}
PKJF�[f^�com_contact/helpers/route.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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;
/**
* Contact Component Route Helper
*
* @static
* @package Joomla.Site
* @subpackage com_contact
* @since 1.5
*/
abstract class ContactHelperRoute
{
/**
* Get the URL route for a contact from a contact ID, contact category ID
and language
*
* @param integer $id The id of the contact
* @param integer $catid The id of the contact's category
* @param mixed $language The id of the language being used.
*
* @return string The link to the contact
*
* @since 1.5
*/
public static function getContactRoute($id, $catid, $language = 0)
{
// Create the link
$link = 'index.php?option=com_contact&view=contact&id='
. $id;
if ($catid > 1)
{
$link .= '&catid=' . $catid;
}
if ($language && $language !== '*' &&
JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
return $link;
}
/**
* Get the URL route for a contact category from a contact category ID and
language
*
* @param mixed $catid The id of the contact's category either
an integer id or an instance of JCategoryNode
* @param mixed $language The id of the language being used.
*
* @return string The link to the contact
*
* @since 1.5
*/
public static function getCategoryRoute($catid, $language = 0)
{
if ($catid instanceof JCategoryNode)
{
$id = $catid->id;
}
else
{
$id = (int) $catid;
}
if ($id < 1)
{
$link = '';
}
else
{
// Create the link
$link =
'index.php?option=com_contact&view=category&id=' . $id;
if ($language && $language !== '*' &&
JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
}
return $link;
}
}
PKJF�[�%�B��$com_contact/layouts/field/render.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
if (!key_exists('field', $displayData))
{
return;
}
$field = $displayData['field'];
$label = JText::_($field->label);
$value = $field->value;
$class = $field->params->get('render_class');
$showLabel = $field->params->get('showlabel');
$labelClass = $field->params->get('label_render_class');
if ($field->context == 'com_contact.mail')
{
// Prepare the value for the contact form mail
$value = html_entity_decode($value);
echo ($showLabel ? $label . ': ' : '') . $value .
"\r\n";
return;
}
if (!strlen($value))
{
return;
}
?>
<dt class="contact-field-entry <?php echo $class;
?>">
<?php if ($showLabel == 1) : ?>
<span class="field-label <?php echo $labelClass;
?>"><?php echo htmlentities($label, ENT_QUOTES | ENT_IGNORE,
'UTF-8'); ?>: </span>
<?php endif; ?>
</dt>
<dd class="contact-field-entry <?php echo $class;
?>">
<span class="field-value"><?php echo $value;
?></span>
</dd>
PKJF�[�{$��%com_contact/layouts/fields/render.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Check if we have all the data
if (!key_exists('item', $displayData) ||
!key_exists('context', $displayData))
{
return;
}
// Setting up for display
$item = $displayData['item'];
if (!$item)
{
return;
}
$context = $displayData['context'];
if (!$context)
{
return;
}
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR .
'/components/com_fields/helpers/fields.php');
$parts = explode('.', $context);
$component = $parts[0];
$fields = null;
if (key_exists('fields', $displayData))
{
$fields = $displayData['fields'];
}
else
{
$fields = $item->jcfields ?: FieldsHelper::getFields($context, $item,
true);
}
if (!$fields)
{
return;
}
// Check if we have mail context in first element
$isMail = (reset($fields)->context == 'com_contact.mail');
if (!$isMail)
{
// Print the container tag
echo '<dl class="fields-container contact-fields
dl-horizontal">';
}
// Loop through the fields and print them
foreach ($fields as $field)
{
// If the value is empty do nothing
if (!strlen($field->value) && !$isMail)
{
continue;
}
$layout = $field->params->get('layout',
'render');
echo FieldsHelper::render($context, 'field.' . $layout,
array('field' => $field));
}
if (!$isMail)
{
// Close the container
echo '</dl>';
}
PKJF�[u�QQ/com_contact/layouts/joomla/form/renderfield.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2015 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
extract($displayData);
/**
* Layout variables
* ---------------------
* $options : (array) Optional parameters
* $label : (string) The html code for the label (not required
if $options['hiddenLabel'] is true)
* $input : (string) The input field html code
*/
if (!empty($options['showonEnabled']))
{
JHtml::_('jquery.framework');
JHtml::_('script', 'jui/cms.js',
array('version' => 'auto', 'relative'
=> true));
}
$class = empty($options['class']) ? '' : ' '
. $options['class'];
$rel = empty($options['rel']) ? '' : ' ' .
$options['rel'];
/**
* @TODO:
*
* As mentioned in #8473 (https://github.com/joomla/joomla-cms/pull/8473),
...
* as long as we cannot access the field properties properly, this seems to
* be the way to go for now.
*
* On a side note: Parsing html is seldom a good idea.
*
https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454
*/
preg_match('/class=\"([^\"]+)\"/i', $input,
$match);
$required = (strpos($input,
'aria-required="true"') !== false || (!empty($match[1])
&& strpos($match[1], 'required') !== false));
$typeOfSpacer = (strpos($label, 'spacer-lbl') !== false);
?>
<div class="control-group<?php echo $class; ?>"<?php
echo $rel; ?>>
<?php if (empty($options['hiddenLabel'])) : ?>
<div class="control-label">
<?php echo $label; ?>
<?php if (!$required && !$typeOfSpacer) : ?>
<span class="optional"><?php echo
JText::_('COM_CONTACT_OPTIONAL'); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="controls"><?php echo $input;
?></div>
</div>
PKLF�[`���!com_contact/models/categories.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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;
use Joomla\Registry\Registry;
/**
* This models supports retrieving lists of contact categories.
*
* @since 1.6
*/
class ContactModelCategories extends JModelList
{
/**
* Model context string.
*
* @var string
*/
public $_context = 'com_contact.categories';
/**
* The category context (allows other extensions to derived from this
model).
*
* @var string
*/
protected $_extension = 'com_contact';
private $_parent = null;
private $_items = null;
/**
* 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 = null, $direction = null)
{
$app = JFactory::getApplication();
$this->setState('filter.extension', $this->_extension);
// Get the parent id if defined.
$parentId = $app->input->getInt('id');
$this->setState('filter.parentId', $parentId);
$params = $app->getParams();
$this->setState('params', $params);
$this->setState('filter.published', 1);
$this->setState('filter.access', true);
}
/**
* 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.
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.extension');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.parentId');
return parent::getStoreId($id);
}
/**
* Redefine the function an add some properties to make the styling more
easy
*
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
{
if ($this->_items === null)
{
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$params = new Registry;
if ($active)
{
$params->loadString($active->params);
}
$options = array();
$options['countItems'] =
$params->get('show_cat_items_cat', 1) ||
!$params->get('show_empty_categories_cat', 0);
$categories = JCategories::getInstance('Contact', $options);
$this->_parent =
$categories->get($this->getState('filter.parentId',
'root'));
if (is_object($this->_parent))
{
$this->_items = $this->_parent->getChildren();
}
else
{
$this->_items = false;
}
}
return $this->_items;
}
/**
* Gets the id of the parent category for the selected list of categories
*
* @return integer The id of the parent category
*
* @since 1.6.0
*/
public function getParent()
{
if (!is_object($this->_parent))
{
$this->getItems();
}
return $this->_parent;
}
}
PKLF�[���++++com_contact/models/category.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 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;
/**
* Single item model for a contact
*
* @package Joomla.Site
* @subpackage com_contact
* @since 1.5
*/
class ContactModelCategory extends JModelList
{
/**
* Category items data
*
* @var array
*/
protected $_item = null;
protected $_articles = null;
protected $_siblings = null;
protected $_children = null;
protected $_parent = null;
/**
* The category that applies.
*
* @access protected
* @var object
*/
protected $_category = null;
/**
* The list of other contact categories.
*
* @access protected
* @var array
*/
protected $_categories = null;
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'id', 'a.id',
'name', 'a.name',
'con_position', 'a.con_position',
'suburb', 'a.suburb',
'state', 'a.state',
'country', 'a.country',
'ordering', 'a.ordering',
'sortname',
'sortname1', 'a.sortname1',
'sortname2', 'a.sortname2',
'sortname3', 'a.sortname3'
);
}
parent::__construct($config);
}
/**
* Method to get a list of items.
*
* @return mixed An array of objects on success, false on failure.
*/
public function getItems()
{
// Invoke the parent getItems method to get the main list
$items = parent::getItems();
// Convert the params field into an object, saving original in _params
for ($i = 0, $n = count($items); $i < $n; $i++)
{
$item = &$items[$i];
if (!isset($this->_params))
{
$item->params = new Registry($item->params);
}
// Some contexts may not use tags data at all, so we allow callers to
disable loading tag data
if ($this->getState('load_tags', true))
{
$this->tags = new JHelperTags;
$this->tags->getItemTags('com_contact.contact',
$item->id);
}
}
return $items;
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*
* @since 1.6
*/
protected function getListQuery()
{
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select required fields from the categories.
// Changes for sqlsrv
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=',
'0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'),
':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('c.alias', '!=',
'0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'),
':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select($this->getState('list.select',
'a.*') . ',' . $case_when . ',' .
$case_when1)
/**
* TODO: we actually should be doing it but it's wrong this way
* . ' CASE WHEN CHAR_LENGTH(a.alias) THEN
CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
* . ' CASE WHEN CHAR_LENGTH(c.alias) THEN
CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END AS catslug ');
*/
->from($db->quoteName('#__contact_details') . ' AS
a')
->join('LEFT', '#__categories AS c ON c.id =
a.catid')
->where('a.access IN (' . $groups . ')');
// Filter by category.
if ($categoryId = $this->getState('category.id'))
{
$query->where('a.catid = ' . (int) $categoryId)
->where('c.access IN (' . $groups . ')');
}
// Join over the users for the author and modified_by names.
$query->select("CASE WHEN a.created_by_alias > ' '
THEN a.created_by_alias ELSE ua.name END AS author")
->select('ua.email AS author_email')
->join('LEFT', '#__users AS ua ON ua.id =
a.created_by')
->join('LEFT', '#__users AS uam ON uam.id =
a.modified_by');
// Filter by state
$state = $this->getState('filter.published');
if (is_numeric($state))
{
$query->where('a.published = ' . (int) $state);
}
else
{
$query->where('(a.published IN (0,1,2))');
}
// Filter by start and end dates.
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
if ($this->getState('filter.publish_date'))
{
$query->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')');
}
// Filter by search in title
$search = $this->getState('list.filter');
if (!empty($search))
{
$search = $db->quote('%' . $db->escape($search, true) .
'%');
$query->where('(a.name LIKE ' . $search . ')');
}
// Filter by language
if ($this->getState('filter.language'))
{
$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
}
// Set sortname ordering if selected
if ($this->getState('list.ordering') ===
'sortname')
{
$query->order($db->escape('a.sortname1') . ' '
. $db->escape($this->getState('list.direction',
'ASC')))
->order($db->escape('a.sortname2') . ' ' .
$db->escape($this->getState('list.direction',
'ASC')))
->order($db->escape('a.sortname3') . ' ' .
$db->escape($this->getState('list.direction',
'ASC')));
}
else
{
$query->order($db->escape($this->getState('list.ordering',
'a.ordering')) . ' ' .
$db->escape($this->getState('list.direction',
'ASC')));
}
return $query;
}
/**
* 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 = null, $direction = null)
{
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_contact');
// List state information
$format = $app->input->getWord('format');
if ($format === 'feed')
{
$limit = $app->get('feed_limit');
}
else
{
$limit = $app->getUserStateFromRequest('global.list.limit',
'limit', $app->get('list_limit'), 'uint');
}
$this->setState('list.limit', $limit);
$limitstart = $app->input->get('limitstart', 0,
'uint');
$this->setState('list.start', $limitstart);
// Optional filter text
$itemid = $app->input->get('Itemid', 0, 'int');
$search =
$app->getUserStateFromRequest('com_contact.category.list.' .
$itemid . '.filter-search', 'filter-search',
'', 'string');
$this->setState('list.filter', $search);
// Get list ordering default from the parameters
$menuParams = new Registry;
if ($menu = $app->getMenu()->getActive())
{
$menuParams->loadString($menu->params);
}
$mergedParams = clone $params;
$mergedParams->merge($menuParams);
$orderCol = $app->input->get('filter_order',
$mergedParams->get('initial_sort', 'ordering'));
if (!in_array($orderCol, $this->filter_fields))
{
$orderCol = 'ordering';
}
$this->setState('list.ordering', $orderCol);
$listOrder = $app->input->get('filter_order_Dir',
'ASC');
if (!in_array(strtoupper($listOrder), array('ASC',
'DESC', '')))
{
$listOrder = 'ASC';
}
$this->setState('list.direction', $listOrder);
$id = $app->input->get('id', 0, 'int');
$this->setState('category.id', $id);
$user = JFactory::getUser();
if ((!$user->authorise('core.edit.state',
'com_contact')) &&
(!$user->authorise('core.edit', 'com_contact')))
{
// Limit to published for people who can't edit or edit.state.
$this->setState('filter.published', 1);
// Filter by start and end dates.
$this->setState('filter.publish_date', true);
}
$this->setState('filter.language',
JLanguageMultilang::isEnabled());
// Load the parameters.
$this->setState('params', $params);
}
/**
* Method to get category data for the current category
*
* @return object The category object
*
* @since 1.5
*/
public function getCategory()
{
if (!is_object($this->_item))
{
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$params = new Registry;
if ($active)
{
$params->loadString($active->params);
}
$options = array();
$options['countItems'] =
$params->get('show_cat_items', 1) ||
$params->get('show_empty_categories', 0);
$categories = JCategories::getInstance('Contact', $options);
$this->_item =
$categories->get($this->getState('category.id',
'root'));
if (is_object($this->_item))
{
$this->_children = $this->_item->getChildren();
$this->_parent = false;
if ($this->_item->getParent())
{
$this->_parent = $this->_item->getParent();
}
$this->_rightsibling = $this->_item->getSibling();
$this->_leftsibling = $this->_item->getSibling(false);
}
else
{
$this->_children = false;
$this->_parent = false;
}
}
return $this->_item;
}
/**
* Get the parent category.
*
* @return mixed An array of categories or false if an error occurs.
*/
public function getParent()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
return $this->_parent;
}
/**
* Get the sibling (adjacent) categories.
*
* @return mixed An array of categories or false if an error occurs.
*/
public function &getLeftSibling()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
return $this->_leftsibling;
}
/**
* Get the sibling (adjacent) categories.
*
* @return mixed An array of categories or false if an error occurs.
*/
public function &getRightSibling()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
return $this->_rightsibling;
}
/**
* Get the child categories.
*
* @return mixed An array of categories or false if an error occurs.
*/
public function &getChildren()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
return $this->_children;
}
/**
* Increment the hit counter for the category.
*
* @param integer $pk Optional primary key of the category to
increment.
*
* @return boolean True if successful; false otherwise and internal
error set.
*
* @since 3.2
*/
public function hit($pk = 0)
{
$input = JFactory::getApplication()->input;
$hitcount = $input->getInt('hitcount', 1);
if ($hitcount)
{
$pk = (!empty($pk)) ? $pk : (int)
$this->getState('category.id');
$table = JTable::getInstance('Category', 'JTable');
$table->hit($pk);
}
return true;
}
}
PKLF�[� 3/J/Jcom_contact/models/contact.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 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;
/**
* Single item model for a contact
*
* @package Joomla.Site
* @subpackage com_contact
* @since 1.5
*/
class ContactModelContact extends JModelForm
{
/**
* The name of the view for a single item
*
* @since 1.6
*/
protected $view_item = 'contact';
/**
* A loaded item
*
* @since 1.6
*/
protected $_item = null;
/**
* Model context string.
*
* @var string
*/
protected $_context = 'com_contact.contact';
/**
* 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();
$this->setState('contact.id',
$app->input->getInt('id'));
$this->setState('params', $app->getParams());
$user = JFactory::getUser();
if ((!$user->authorise('core.edit.state',
'com_contact')) &&
(!$user->authorise('core.edit', 'com_contact')))
{
$this->setState('filter.published', 1);
$this->setState('filter.archived', 2);
}
}
/**
* Method to get the contact form.
* The base form is loaded from XML and then an event is fired
*
* @param array $data An optional array of data for the form to
interrogate.
* @param boolean $loadData True if the form is to load its own data
(default case), false if not.
*
* @return JForm A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
$form = $this->loadForm('com_contact.contact',
'contact', array('control' => 'jform',
'load_data' => true));
if (empty($form))
{
return false;
}
$temp = clone $this->getState('params');
$contact = $this->_item[$this->getState('contact.id')];
$active = JFactory::getApplication()->getMenu()->getActive();
if ($active)
{
// If the current view is the active item and a contact view for this
contact, then the menu item params take priority
if (strpos($active->link, 'view=contact') &&
strpos($active->link, '&id=' . (int) $contact->id))
{
// $contact->params are the contact params, $temp are the menu item
params
// Merge so that the menu item params take priority
$contact->params->merge($temp);
}
else
{
// Current view is not a single contact, so the contact params take
priority here
// Merge the menu item params with the contact params so that the
contact params take priority
$temp->merge($contact->params);
$contact->params = $temp;
}
}
else
{
// Merge so that contact params take priority
$temp->merge($contact->params);
$contact->params = $temp;
}
if (!$contact->params->get('show_email_copy', 0))
{
$form->removeField('contact_email_copy');
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return array The default data is an empty array.
*
* @since 1.6.2
*/
protected function loadFormData()
{
$data = (array)
JFactory::getApplication()->getUserState('com_contact.contact.data',
array());
if (empty($data['language']) &&
JLanguageMultilang::isEnabled())
{
$data['language'] = JFactory::getLanguage()->getTag();
}
// Add contact id to contact form data, so fields plugin can work
properly
if (empty($data['catid']))
{
$data['catid'] = $this->getItem()->catid;
}
$this->preprocessData('com_contact.contact', $data);
return $data;
}
/**
* Gets a contact
*
* @param integer $pk Id for the contact
*
* @return mixed Object or null
*
* @since 1.6.0
*/
public function &getItem($pk = null)
{
$pk = (!empty($pk)) ? $pk : (int)
$this->getState('contact.id');
if ($this->_item === null)
{
$this->_item = array();
}
if (!isset($this->_item[$pk]))
{
try
{
$db = $this->getDbo();
$query = $db->getQuery(true);
// Changes for sqlsrv
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias',
'!=', '0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'),
':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('c.alias',
'!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when1 .= $query->concatenate(array($c_id,
'c.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select($this->getState('item.select',
'a.*') . ',' . $case_when . ',' .
$case_when1)
->from('#__contact_details AS a')
// Join on category table.
->select('c.title AS category_title, c.alias AS
category_alias, c.access AS category_access')
->join('LEFT', '#__categories AS c on c.id =
a.catid')
// Join over the categories to get parent category titles
->select('parent.title as parent_title, parent.id as
parent_id, parent.path as parent_route, parent.alias as parent_alias')
->join('LEFT', '#__categories as parent ON parent.id
= c.parent_id')
->where('a.id = ' . (int) $pk);
// Filter by start and end dates.
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
// Filter by published state.
$published = $this->getState('filter.published');
$archived = $this->getState('filter.archived');
if (is_numeric($published))
{
$query->where('(a.published = ' . (int) $published .
' OR a.published =' . (int) $archived . ')')
->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')');
}
$db->setQuery($query);
$data = $db->loadObject();
if (empty($data))
{
JError::raiseError(404,
JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND'));
}
// Check for published state if filter set.
if ((is_numeric($published) || is_numeric($archived)) &&
(($data->published != $published) && ($data->published !=
$archived)))
{
JError::raiseError(404,
JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND'));
}
/**
* In case some entity params have been set to "use global",
those are
* represented as an empty string and must be "overridden" by
merging
* the component and / or menu params here.
*/
$registry = new Registry($data->params);
$data->params = clone $this->getState('params');
$data->params->merge($registry);
$registry = new Registry($data->metadata);
$data->metadata = $registry;
// Some contexts may not use tags data at all, so we allow callers to
disable loading tag data
if ($this->getState('load_tags', true))
{
$data->tags = new JHelperTags;
$data->tags->getItemTags('com_contact.contact',
$data->id);
}
// Compute access permissions.
if (($access = $this->getState('filter.access')))
{
// If the access filter has been set, we already know this user can
view.
$data->params->set('access-view', true);
}
else
{
// If no access filter is set, the layout takes some responsibility
for display of limited information.
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
if ($data->catid == 0 || $data->category_access === null)
{
$data->params->set('access-view',
in_array($data->access, $groups));
}
else
{
$data->params->set('access-view',
in_array($data->access, $groups) &&
in_array($data->category_access, $groups));
}
}
$this->_item[$pk] = $data;
}
catch (Exception $e)
{
$this->setError($e);
$this->_item[$pk] = false;
}
}
if ($this->_item[$pk])
{
$this->buildContactExtendedData($this->_item[$pk]);
}
return $this->_item[$pk];
}
/**
* Load extended data (profile, articles) for a contact
*
* @param object $contact The contact object
*
* @return void
*/
protected function buildContactExtendedData($contact)
{
$db = $this->getDbo();
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$published = $this->getState('filter.published');
// If we are showing a contact list, then the contact parameters take
priority
// So merge the contact parameters with the merged parameters
if
($this->getState('params')->get('show_contact_list'))
{
$this->getState('params')->merge($contact->params);
}
// Get the com_content articles by the linked user
if ((int) $contact->user_id &&
$this->getState('params')->get('show_articles'))
{
$query = $db->getQuery(true)
->select('a.id')
->select('a.title')
->select('a.state')
->select('a.access')
->select('a.catid')
->select('a.created')
->select('a.language')
->select('a.publish_up');
// SQL Server changes
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=',
'0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'),
':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('c.alias',
'!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'),
':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select($case_when1 . ',' . $case_when)
->from('#__content as a')
->join('LEFT', '#__categories as c on
a.catid=c.id')
->where('a.created_by = ' . (int) $contact->user_id)
->where('a.access IN (' . $groups . ')')
->order('a.publish_up DESC');
// Filter per language if plugin published
if (JLanguageMultilang::isEnabled())
{
$query->where('a.language IN (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
}
if (is_numeric($published))
{
$query->where('a.state IN (1,2)')
->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')');
}
// Number of articles to display from config/menu params
$articles_display_num =
$this->getState('params')->get('articles_display_num',
10);
// Use contact setting?
if ($articles_display_num === 'use_contact')
{
$articles_display_num =
$contact->params->get('articles_display_num', 10);
// Use global?
if ((string) $articles_display_num === '')
{
$articles_display_num =
JComponentHelper::getParams('com_contact')->get('articles_display_num',
10);
}
}
$db->setQuery($query, 0, (int) $articles_display_num);
$articles = $db->loadObjectList();
$contact->articles = $articles;
}
else
{
$contact->articles = null;
}
// Get the profile information for the linked user
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR .
'/components/com_users/models', 'UsersModel');
$userModel = JModelLegacy::getInstance('User',
'UsersModel', array('ignore_request' => true));
$data = $userModel->getItem((int) $contact->user_id);
JPluginHelper::importPlugin('user');
// Get the form.
JForm::addFormPath(JPATH_SITE .
'/components/com_users/models/forms');
JForm::addFieldPath(JPATH_SITE .
'/components/com_users/models/fields');
JForm::addFormPath(JPATH_SITE .
'/components/com_users/model/form');
JForm::addFieldPath(JPATH_SITE .
'/components/com_users/model/field');
$form = JForm::getInstance('com_users.profile',
'profile');
// Get the dispatcher.
$dispatcher = JEventDispatcher::getInstance();
// Trigger the form preparation event.
$dispatcher->trigger('onContentPrepareForm', array($form,
$data));
// Trigger the data preparation event.
$dispatcher->trigger('onContentPrepareData',
array('com_users.profile', $data));
// Load the data into the form after the plugins have operated.
$form->bind($data);
$contact->profile = $form;
}
/**
* Gets the query to load a contact item
*
* @param integer $pk The item to be loaded
*
* @return mixed The contact object on success, false on failure
*
* @throws Exception On database failure
* @deprecated 4.0 Use ContactModelContact::getItem() instead
*/
protected function getContactQuery($pk = null)
{
// @todo Cache on the fingerprint of the arguments
$db = $this->getDbo();
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
$user = JFactory::getUser();
$pk = (!empty($pk)) ? $pk : (int)
$this->getState('contact.id');
$query = $db->getQuery(true);
if ($pk)
{
// Sqlsrv changes
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=',
'0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'),
':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('cc.alias',
'!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('cc.id');
$case_when1 .= $query->concatenate(array($c_id,
'cc.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select(
'a.*, cc.access as category_access, cc.title as category_name,
'
. $case_when . ',' . $case_when1
)
->from('#__contact_details AS a')
->join('INNER', '#__categories AS cc on cc.id =
a.catid')
->where('a.id = ' . (int) $pk);
$published = $this->getState('filter.published');
if (is_numeric($published))
{
$query->where('a.published IN (1,2)')
->where('cc.published IN (1,2)');
}
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
try
{
$db->setQuery($query);
$result = $db->loadObject();
if (empty($result))
{
return false;
}
}
catch (Exception $e)
{
$this->setError($e->getMessage());
return false;
}
if ($result)
{
$contactParams = new Registry($result->params);
// If we are showing a contact list, then the contact parameters take
priority
// So merge the contact parameters with the merged parameters
if
($this->getState('params')->get('show_contact_list'))
{
$this->getState('params')->merge($contactParams);
}
// Get the com_content articles by the linked user
if ((int) $result->user_id &&
$this->getState('params')->get('show_articles'))
{
$query = $db->getQuery(true)
->select('a.id')
->select('a.title')
->select('a.state')
->select('a.access')
->select('a.catid')
->select('a.created')
->select('a.language')
->select('a.publish_up');
// SQL Server changes
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias',
'!=', '0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id,
'a.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('c.alias',
'!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when1 .= $query->concatenate(array($c_id,
'c.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select($case_when1 . ',' . $case_when)
->from('#__content as a')
->join('LEFT', '#__categories as c on
a.catid=c.id')
->where('a.created_by = ' . (int) $result->user_id)
->where('a.access IN (' . $groups . ')')
->order('a.publish_up DESC');
// Filter per language if plugin published
if (JLanguageMultilang::isEnabled())
{
$query->where('a.language IN (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
}
if (is_numeric($published))
{
$query->where('a.state IN (1,2)')
->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')');
}
// Number of articles to display from config/menu params
$articles_display_num =
$this->getState('params')->get('articles_display_num',
10);
// Use contact setting?
if ($articles_display_num === 'use_contact')
{
$articles_display_num =
$contactParams->get('articles_display_num', 10);
// Use global?
if ((string) $articles_display_num === '')
{
$articles_display_num =
JComponentHelper::getParams('com_contact')->get('articles_display_num',
10);
}
}
$db->setQuery($query, 0, (int) $articles_display_num);
$articles = $db->loadObjectList();
$result->articles = $articles;
}
else
{
$result->articles = null;
}
// Get the profile information for the linked user
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR .
'/components/com_users/models', 'UsersModel');
$userModel = JModelLegacy::getInstance('User',
'UsersModel', array('ignore_request' => true));
$data = $userModel->getItem((int) $result->user_id);
JPluginHelper::importPlugin('user');
$form = new JForm('com_users.profile');
// Get the dispatcher.
$dispatcher = JEventDispatcher::getInstance();
// Trigger the form preparation event.
$dispatcher->trigger('onContentPrepareForm', array($form,
$data));
// Trigger the data preparation event.
$dispatcher->trigger('onContentPrepareData',
array('com_users.profile', $data));
// Load the data into the form after the plugins have operated.
$form->bind($data);
$result->profile = $form;
$this->contact = $result;
return $result;
}
}
return false;
}
/**
* Increment the hit counter for the contact.
*
* @param integer $pk Optional primary key of the contact to
increment.
*
* @return boolean True if successful; false otherwise and internal
error set.
*
* @since 3.0
*/
public function hit($pk = 0)
{
$input = JFactory::getApplication()->input;
$hitcount = $input->getInt('hitcount', 1);
if ($hitcount)
{
$pk = (!empty($pk)) ? $pk : (int)
$this->getState('contact.id');
$table = JTable::getInstance('Contact',
'ContactTable');
$table->hit($pk);
}
return true;
}
}
PKMF�[
�kkcom_contact/models/featured.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2010 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;
/**
* Featured contact model class.
*
* @since 1.6.0
*/
class ContactModelFeatured extends JModelList
{
/**
* Category items data
*
* @var array
* @since 1.6.0-beta1
* @deprecated 4.0 Variable not used since 1.6.0-beta8
*/
protected $_item = null;
/**
* Who knows what this was for? It has never been used
*
* @var array
* @since 1.6.0-beta1
* @deprecated 4.0 Variable not used ever
*/
protected $_articles = null;
/**
* Get the siblings of the category
*
* @var array
* @since 1.6.0-beta1
* @deprecated 4.0 Variable not used since 1.6.0-beta8
*/
protected $_siblings = null;
/**
* Get the children of the category
*
* @var array
* @since 1.6.0-beta1
* @deprecated 4.0 Variable not used since 1.6.0-beta8
*/
protected $_children = null;
/**
* Get the parent of the category
*
* @var array
* @since 1.6.0-beta1
* @deprecated 4.0 Variable not used since 1.6.0-beta8
*/
protected $_parent = null;
/**
* The category that applies.
*
* @access protected
* @var object
* @deprecated 4.0 Variable not used ever
*/
protected $_category = null;
/**
* The list of other contact categories.
*
* @access protected
* @var array
* @deprecated 4.0 Variable not used ever
*/
protected $_categories = null;
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'id', 'a.id',
'name', 'a.name',
'con_position', 'a.con_position',
'suburb', 'a.suburb',
'state', 'a.state',
'country', 'a.country',
'ordering', 'a.ordering',
);
}
parent::__construct($config);
}
/**
* Method to get a list of items.
*
* @return mixed An array of objects on success, false on failure.
*/
public function getItems()
{
// Invoke the parent getItems method to get the main list
$items = parent::getItems();
// Convert the params field into an object, saving original in _params
for ($i = 0, $n = count($items); $i < $n; $i++)
{
$item = &$items[$i];
if (!isset($this->_params))
{
$item->params = new Registry($item->params);
}
}
return $items;
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*
* @since 1.6
*/
protected function getListQuery()
{
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select required fields from the categories.
$query->select($this->getState('list.select',
'a.*'))
->from($db->quoteName('#__contact_details') . ' AS
a')
->where('a.access IN (' . $groups . ')')
->where('a.featured=1')
->join('INNER', '#__categories AS c ON c.id =
a.catid')
->where('c.access IN (' . $groups . ')');
// Filter by category.
if ($categoryId = $this->getState('category.id'))
{
$query->where('a.catid = ' . (int) $categoryId);
}
// Change for sqlsrv... aliased c.published to cat_published
$query->select('c.published as cat_published, c.published AS
parents_published')
->where('c.published = 1');
// Filter by state
$state = $this->getState('filter.published');
if (is_numeric($state))
{
$query->where('a.published = ' . (int) $state);
// Filter by start and end dates.
$nullDate = $db->quote($db->getNullDate());
$date = JFactory::getDate();
$nowDate = $db->quote($date->toSql());
$query->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')');
}
// Filter by language
if ($this->getState('filter.language'))
{
$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
}
// Add the list ordering clause.
$query->order($db->escape($this->getState('list.ordering',
'a.ordering')) . ' ' .
$db->escape($this->getState('list.direction',
'ASC')));
return $query;
}
/**
* 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 = null, $direction = null)
{
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_contact');
// List state information
$limit = $app->getUserStateFromRequest('global.list.limit',
'limit', $app->get('list_limit'), 'uint');
$this->setState('list.limit', $limit);
$limitstart = $app->input->get('limitstart', 0,
'uint');
$this->setState('list.start', $limitstart);
$orderCol = $app->input->get('filter_order',
'ordering');
if (!in_array($orderCol, $this->filter_fields))
{
$orderCol = 'ordering';
}
$this->setState('list.ordering', $orderCol);
$listOrder = $app->input->get('filter_order_Dir',
'ASC');
if (!in_array(strtoupper($listOrder), array('ASC',
'DESC', '')))
{
$listOrder = 'ASC';
}
$this->setState('list.direction', $listOrder);
$user = JFactory::getUser();
if ((!$user->authorise('core.edit.state',
'com_contact')) &&
(!$user->authorise('core.edit', 'com_contact')))
{
// Limit to published for people who can't edit or edit.state.
$this->setState('filter.published', 1);
// Filter by start and end dates.
$this->setState('filter.publish_date', true);
}
$this->setState('filter.language',
JLanguageMultilang::isEnabled());
// Load the parameters.
$this->setState('params', $params);
}
}
PKMF�[����$com_contact/models/forms/contact.xmlnu�[���<?xml
version="1.0" encoding="UTF-8"?>
<form>
<fieldset name="contact"
addrulepath="components/com_contact/models/rules"
label="COM_CONTACT_CONTACT_DEFAULT_LABEL">
<field
name="spacer"
type="spacer"
label="COM_CONTACT_CONTACT_REQUIRED"
class="text"
/>
<field
name="contact_name"
type="text"
label="COM_CONTACT_CONTACT_EMAIL_NAME_LABEL"
description="COM_CONTACT_CONTACT_EMAIL_NAME_DESC"
id="contact-name"
size="30"
filter="string"
required="true"
/>
<field
name="contact_email"
type="email"
label="COM_CONTACT_EMAIL_LABEL"
description="COM_CONTACT_EMAIL_DESC"
id="contact-email"
size="30"
filter="string"
validate="contactemail"
autocomplete="email"
required="true"
/>
<field
name="contact_subject"
type="text"
label="COM_CONTACT_CONTACT_MESSAGE_SUBJECT_LABEL"
description="COM_CONTACT_CONTACT_MESSAGE_SUBJECT_DESC"
id="contact-emailmsg"
size="60"
filter="string"
validate="contactemailsubject"
required="true"
/>
<field
name="contact_message"
type="textarea"
label="COM_CONTACT_CONTACT_ENTER_MESSAGE_LABEL"
description="COM_CONTACT_CONTACT_ENTER_MESSAGE_DESC"
cols="50"
rows="10"
id="contact-message"
filter="safehtml"
validate="contactemailmessage"
required="true"
/>
<field
name="contact_email_copy"
type="checkbox"
label="COM_CONTACT_CONTACT_EMAIL_A_COPY_LABEL"
description="COM_CONTACT_CONTACT_EMAIL_A_COPY_DESC"
id="contact-email-copy"
default="0"
/>
</fieldset>
<fieldset name="captcha">
<field
name="captcha"
type="captcha"
label="COM_CONTACT_CAPTCHA_LABEL"
description="COM_CONTACT_CAPTCHA_DESC"
validate="captcha"
namespace="contact"
/>
</fieldset>
</form>
PKMF�[����,com_contact/models/forms/filter_contacts.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_CONTACT_FILTER_SEARCH_LABEL"
description="COM_CONTACT_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="published"
type="status"
label="JOPTION_SELECT_PUBLISHED"
description="JOPTION_SELECT_PUBLISHED_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
name="category_id"
type="category"
label="JOPTION_FILTER_CATEGORY"
description="JOPTION_FILTER_CATEGORY_DESC"
extension="com_contact"
published="0,1,2"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_CATEGORY</option>
</field>
<field
name="access"
type="accesslevel"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_ACCESS</option>
</field>
<field
name="language"
type="contentlanguage"
label="JOPTION_FILTER_LANGUAGE"
description="JOPTION_FILTER_LANGUAGE_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
<field
name="tag"
type="tag"
label="JOPTION_FILTER_TAG"
description="JOPTION_FILTER_TAG_DESC"
mode="nested"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_TAG</option>
</field>
<field
name="level"
type="integer"
label="JOPTION_FILTER_LEVEL"
description="JOPTION_FILTER_LEVEL_DESC"
first="1"
last="10"
step="1"
languages="*"
onchange="this.form.submit();"
>
<option
value="">JOPTION_SELECT_MAX_LEVELS</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTACT_LIST_FULL_ORDERING"
description="COM_CONTACT_LIST_FULL_ORDERING_DESC"
default="a.name ASC"
onchange="this.form.submit();"
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.featured
ASC">JFEATURED_ASC</option>
<option value="a.featured
DESC">JFEATURED_DESC</option>
<option value="a.name
ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.name
DESC">JGLOBAL_TITLE_DESC</option>
<option value="category_title
ASC">JCATEGORY_ASC</option>
<option value="category_title
DESC">JCATEGORY_DESC</option>
<option value="ul.name
ASC">COM_CONTACT_FIELD_LINKED_USER_LABEL_ASC</option>
<option value="ul.name
DESC">COM_CONTACT_FIELD_LINKED_USER_LABEL_DESC</option>
<option value="access_level
ASC">JGRID_HEADING_ACCESS_ASC</option>
<option value="access_level
DESC">JGRID_HEADING_ACCESS_DESC</option>
<option
value="association ASC"
requires="associations"
>
JASSOCIATIONS_ASC
</option>
<option
value="association DESC"
requires="associations"
>
JASSOCIATIONS_DESC
</option>
<option value="language_title
ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="language_title
DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="a.id
ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id
DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_CONTACT_LIST_LIMIT"
description="COM_CONTACT_LIST_LIMIT_DESC"
default="25"
class="input-mini"
onchange="this.form.submit();"
/>
</fields>
</form>
PKMF�[���\>\>!com_contact/models/forms/form.xmlnu�[���<?xml
version="1.0" encoding="UTF-8"?>
<!-- @deprecated 4.0 Not used since 1.6 No replacement. -->
<form>
<fieldset>
<field
name="id"
type="hidden"
label="COM_CONTACT_ID_LABEL"
default="0"
readonly="true"
required="true"
size="10"
/>
<field
name="name"
type="text"
label="CONTACT_NAME_LABEL"
description="CONTACT_NAME_DESC"
required="true"
size="30"
/>
<field
name="alias"
type="text"
label="JFIELD_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC"
hint="JFIELD_ALIAS_PLACEHOLDER"
size="30"
/>
<field
name="user_id"
type="user"
label="CONTACT_LINKED_USER_LABEL"
description="CONTACT_LINKED_USER_DESC"
/>
<field
name="published"
type="list"
label="JFIELD_PUBLISHED_LABEL"
description="JFIELD_PUBLISHED_DESC"
default="1"
size="1"
>
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
<option value="-1">JARCHIVED</option>
<option value="-2">JTRASHED</option>
</field>
<field
name="catid"
type="category"
label="JCATEGORY"
description="JFIELD_CATEGORY_DESC"
extension="com_contact"
required="true"
/>
<field
name="access"
type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
size="1"
/>
<field
name="sortname1"
type="text"
label="CONTACT_SORTNAME1_LABEL"
description="CONTACT_SORTNAME1_DESC"
size="30"
/>
<field
name="sortname2"
type="text"
label="CONTACT_SORTNAME2_LABEL"
description="CONTACT_SORTNAME3_DESC"
size="30"
/>
<field
name="sortname3"
type="text"
label="CONTACT_SORTNAME3_LABEL"
description="CONTACT_SORTNAME3_DESC"
size="30"
/>
<field
name="language"
type="text"
label="CONTACT_LANGUAGE_LABEL"
description="CONTACT_LANGUAGE_DESC"
size="30"
/>
<field
name="con_position"
type="text"
label="CONTACT_INFORMATION_POSITION_LABEL"
description="CONTACT_INFORMATION_POSITION_DESC"
size="30"
/>
<field
name="email_to"
type="email"
label="CONTACT_INFORMATION_EMAIL_LABEL"
description="CONTACT_INFORMATION_EMAIL_DESC"
size="30"
validate="email"
filter="string"
autocomplete="email"
/>
<field
name="address"
type="textarea"
label="CONTACT_INFORMATION_ADDRESS_LABEL"
description="CONTACT_INFORMATION_ADDRESS_DESC"
cols="30"
rows="3"
/>
<field
name="suburb"
type="text"
label="CONTACT_INFORMATION_SUBURB_LABEL"
description="CONTACT_INFORMATION_SUBURB_DESC"
size="30"
/>
<field
name="state"
type="text"
label="CONTACT_INFORMATION_STATE_LABEL"
description="CONTACT_INFORMATION_STATE_DESC"
size="30"
/>
<field
name="postcode"
type="text"
label="CONTACT_INFORMATION_POSTCODE_LABEL"
description="CONTACT_INFORMATION_POSTCODE_DESC"
size="30"
/>
<field
name="country"
type="text"
label="CONTACT_INFORMATION_COUNTRY_LABEL"
description="CONTACT_INFORMATION_COUNTRY_DESC"
size="30"
/>
<field
name="telephone"
type="text"
label="CONTACT_INFORMATION_TELEPHONE_LABEL"
description="CONTACT_INFORMATION_TELEPHONE_DESC"
size="30"
/>
<field
name="mobile"
type="text"
label="CONTACT_INFORMATION_MOBILE_LABEL"
description="CONTACT_INFORMATION_MOBILE_DESC"
size="30"
/>
<field
name="webpage"
type="text"
label="CONTACT_INFORMATION_WEBPAGE_LABEL"
description="CONTACT_INFORMATION_WEBPAGE_DESC"
size="30"
/>
<field
name="misc"
type="editor"
label="CONTACT_INFORMATION_MISC_LABEL"
description="CONTACT_INFORMATION_MISC_DESC"
buttons="true"
hide="pagebreak,readmore"
filter="safehtml"
size="30"
/>
<field
name="checked_out"
type="hidden"
filter="unset"
/>
<field
name="checked_out_time"
type="hidden"
filter="unset"
/>
<field
name="ordering"
type="ordering"
label="JFIELD_ORDERING_LABEL"
description="JFIELD_ORDERING_DESC"
content_type="com_contact.contact"
/>
<field
name="metakey"
type="textarea"
label="JFIELD_META_KEYWORDS_LABEL"
description="JFIELD_META_KEYWORDS_DESC"
cols="30"
rows="3"
/>
<field
name="metadesc"
type="textarea"
label="JFIELD_META_DESCRIPTION_LABEL"
description="JFIELD_META_DESCRIPTION_DESC"
cols="30"
rows="3"
/>
<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="JFIELD_CONTACT_LANGUAGE_DESC"
>
<option value="">JALL</option>
</field>
<field
name="contact_icons"
type="list"
label="Icons/text"
description="PARAMCONTACTICONS"
default="0"
>
<option
value="0">CONTACT_ICONS_OPTIONS_NONE</option>
<option
value="1">CONTACT_ICONS_OPTIONS_TEXT</option>
<option
value="2">CONTACT_ICONS_OPTIONS_TEXT</option>
</field>
<field
name="icon_address"
type="imagelist"
label="CONTACT_ICONS_ADDRESS_LABEL"
description="CONTACT_ICONS_ADDRESS_DESC"
directory="/images"
hide_none="1"
/>
<field
name="icon_email"
type="imagelist"
label="CONTACT_ICONS_EMAIL_LABEL"
description="CONTACT_ICONS_EMAIL_DESC"
directory="/images"
hide_none="1"
/>
<field
name="icon_telephone"
type="imagelist"
label="CONTACT_ICONS_TELEPHONE_LABEL"
description="CONTACT_ICONS_TELEPHONE_DESC"
directory="/images"
hide_none="1"
/>
<field
name="icon_mobile"
type="imagelist"
label="CONTACT_ICONS_MOBILE_LABEL"
description="CONTACT_ICONS_MOBILE_DESC"
directory="/images"
hide_none="1"
/>
<field
name="icon_fax"
type="imagelist"
label="CONTACT_ICONS_FAX_LABEL"
description="CONTACT_ICONS_FAX_DESC"
directory="/images"
hide_none="1"
/>
<field
name="icon_misc"
type="imagelist"
label="CONTACT_ICONS_MISC_LABEL"
description="CONTACT_ICONS_MISC_DESC"
directory="/images"
hide_none="1"
/>
</fieldset>
<fields name="metadata">
<fieldset name="metadata"
label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
<field
name="robots"
type="list"
label="JFIELD_METADATA_ROBOTS_LABEL"
description="JFIELD_METADATA_ROBOTS_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="index, follow"></option>
<option value="noindex, follow"></option>
<option value="index, nofollow"></option>
<option value="noindex, nofollow"></option>
</field>
<field
name="rights"
type="text"
label="JFIELD_METADATA_RIGHTS_LABEL"
description="JFIELD_METADATA_RIGHTS_DESC"
size="20"
/>
</fieldset>
</fields>
<fields name="params">
<fieldset name="options"
label="CONTACT_PARAMETERS">
<field
name="show_tags"
type="list"
label="COM_CONTACT_FIELD_SHOW_TAGS_LABEL"
description="COM_CONTACT_FIELD_SHOW_TAGS_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_info"
type="list"
label="COM_CONTACT_FIELD_SHOW_INFO_LABEL"
description="COM_CONTACT_FIELD_SHOW_INFO_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_name"
type="list"
label="CONTACT_PARAMS_NAME_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_position"
type="list"
label="CONTACT_PARAMS_CONTACT_POSITION_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email"
type="list"
label="CONTACT_PARAMS_CONTACT_POSITION_E_MAIL_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_street_address"
type="list"
label="CONTACT_PARAMS_STREET_ADDRESS_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_suburb"
type="list"
label="CONTACT_PARAMS_TOWN_SUBURB_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_state"
type="list"
label="CONTACT_PARAMS_STATE_COUNTY_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_postcode"
type="list"
label="CONTACT_PARAMS_POST_ZIP_CODE_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_country"
type="list"
label="CONTACT_PARAMS_COUNTRY_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_telephone"
type="list"
label="CONTACT_PARAMS_TELEPHONE_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_mobile"
type="list"
label="CONTACT_PARAMS_MOBILE_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_fax"
type="list"
label="CONTACT_PARAMS_FAX_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_webpage"
type="list"
label="CONTACT_PARAMS_WEBPAGE_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_image"
type="list"
label="CONTACT_PARAMS_IMAGE_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="allow_vcard"
type="list"
label="CONTACT_PARAMS_VCARD_LABEL"
description="CONTACT_PARAMS_VCARD_LABEL"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_misc"
type="list"
label="CONTACT_PARAMS_MISC_INFO_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_articles"
type="list"
label="CONTACT_SHOW_ARTICLES_LABEL"
description="CONTACT_SHOW_ARTICLES_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="articles_display_num"
type="list"
label="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_LABEL"
description="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_DESC"
default=""
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="75">J75</option>
<option value="100">J100</option>
<option value="150">J150</option>
<option value="200">J200</option>
<option value="250">J250</option>
<option value="300">J300</option>
<option value="0">JALL</option>
</field>
<field
name="show_profile"
type="list"
label="CONTACT_PROFILE_SHOW_LABEL"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_user_custom_fields"
type="fieldgroups"
label="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_LABEL"
description="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_DESC"
multiple="true"
context="com_users.user"
>
<option value="-1">JALL</option>
</field>
<field
name="show_links"
type="list"
label="CONTACT_SHOW_LINKS_LABEL"
description="CONTACT_SHOW_LINKS_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="linka_name"
type="text"
label="CONTACT_LINKA_NAME_LABEL"
description="CONTACT_LINKA_NAME_DESC"
size="30"
/>
<field
name="linka"
type="text"
label="CONTACT_LINKA_LABEL"
description="CONTACT_LINKA_DESC"
size="30"
/>
<field
name="linkb_name"
type="text"
label="CONTACT_LINKB_NAME_LABEL"
description="CONTACT_LINKB_NAME_DESC"
size="30"
/>
<field
name="linkb"
type="text"
label="CONTACT_LINKB_LABEL"
description="CONTACT_LINKB_DESC"
size="30"
/>
<field
name="linkc_name"
type="text"
label="CONTACT_LINKC_NAME_LABEL"
description="CONTACT_LINKC_NAME_DESC"
size="30"
/>
<field
name="linkc"
type="text"
label="CONTACT_LINKC_LABEL"
description="CONTACT_LINKC_DESC"
size="30"
/>
<field
name="linkd_name"
type="text"
label="CONTACT_LINKD_NAME_LABEL"
description="CONTACT_LINKD_NAME_DESC"
size="30"
/>
<field
name="linkd"
type="text"
label="CONTACT_LINKD_LABEL"
description="CONTACT_LINKD_DESC"
size="30"
/>
<field
name="linke_name"
type="text"
label="CONTACT_LINKE_NAME_LABEL"
description="CONTACT_LINKE_NAME_DESC"
size="30"
/>
<field
name="linke"
type="text"
label="CONTACT_LINKE_LABEL"
description="CONTACT_LINKE_DESC"
size="30"
/>
</fieldset>
</fields>
<fields name="email_form">
<fieldset name="email_form"
label="CONTACT_EMAIL_FORM_LABEL">
<field
name="show_email_form"
type="list"
label="CONTACT_EMAIL_SHOW_FORM_LABEL"
description="CONTACT_EMAIL_SHOW_FORM_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="email_description"
type="text"
label="CONTACT_EMAIL_DESCRIPTION_TEXT_LABEL"
description="CONTACT_EMAIL_DESCRIPTION_TEXT_DESC"
size="30"
/>
<field
name="show_email_copy"
type="list"
label="CONTACT_EMAIL_EMAIL_COPY_LABEL"
description="CONTACT_EMAIL_EMAIL_COPY_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="validate_session"
type="list"
label="CONTACT_CONFIG_SESSION_CHECK_LABEL"
description="CONTACT_CONFIG_SESSION_CHECK_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="custom_reply"
type="list"
label="CONTACT_CONFIG_CUSTOM_REPLY"
description="CONTACT_CONFIG_CUSTOM_REPLY_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="redirect"
type="text"
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
size="30"
/>
</fieldset>
</fields>
</form>
PKMF�[��tzz)com_contact/models/rules/contactemail.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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;
use Joomla\String\StringHelper;
JFormHelper::loadRuleClass('email');
/**
* JFormRule for com_contact to make sure the email address is not blocked.
*
* @since 1.6
*/
class JFormRuleContactEmail extends JFormRuleEmail
{
/**
* Method to test for banned email addresses
*
* @param SimpleXMLElement $element The SimpleXMLElement object
representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control
value. This acts as an array container for the field.
* For example if the field has
name="foo" and the group value is set to "bar" then the
* full field name would end up being
"bar[foo]".
* @param Registry $input An optional Registry object with
the entire data set to validate against the entire form.
* @param JForm $form The form object for which the
field is being tested.
*
* @return boolean True if the value is valid, false otherwise.
*/
public function test(SimpleXMLElement $element, $value, $group = null,
Registry $input = null, JForm $form = null)
{
if (!parent::test($element, $value, $group, $input, $form))
{
return false;
}
$params = JComponentHelper::getParams('com_contact');
$banned = $params->get('banned_email');
if ($banned)
{
foreach (explode(';', $banned) as $item)
{
if ($item != '' && StringHelper::stristr($value,
$item) !== false)
{
return false;
}
}
}
return true;
}
}
PKMF�[�#40com_contact/models/rules/contactemailmessage.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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;
use Joomla\String\StringHelper;
/**
* JFormRule for com_contact to make sure the message body contains no
banned word.
*
* @since 1.6
*/
class JFormRuleContactEmailMessage extends JFormRule
{
/**
* Method to test a message for banned words
*
* @param SimpleXMLElement $element The SimpleXMLElement object
representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control
value. This acts as an array container for the field.
* For example if the field has
name="foo" and the group value is set to "bar" then the
* full field name would end up being
"bar[foo]".
* @param Registry $input An optional Registry object with
the entire data set to validate against the entire form.
* @param JForm $form The form object for which the
field is being tested.
*
* @return boolean True if the value is valid, false otherwise.
*/
public function test(SimpleXMLElement $element, $value, $group = null,
Registry $input = null, JForm $form = null)
{
$params = JComponentHelper::getParams('com_contact');
$banned = $params->get('banned_text');
if ($banned)
{
foreach (explode(';', $banned) as $item)
{
if ($item != '' && StringHelper::stristr($value,
$item) !== false)
{
return false;
}
}
}
return true;
}
}
PKMF�[ĩk���0com_contact/models/rules/contactemailsubject.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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;
use Joomla\String\StringHelper;
/**
* JFormRule for com_contact to make sure the subject contains no banned
word.
*
* @since 1.6
*/
class JFormRuleContactEmailSubject extends JFormRule
{
/**
* Method to test for a banned subject
*
* @param SimpleXMLElement $element The SimpleXMLElement object
representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control
value. This acts as an array container for the field.
* For example if the field has
name="foo" and the group value is set to "bar" then the
* full field name would end up being
"bar[foo]".
* @param Registry $input An optional Registry object with
the entire data set to validate against the entire form.
* @param JForm $form The form object for which the
field is being tested.
*
* @return boolean True if the value is valid, false otherwise
*/
public function test(SimpleXMLElement $element, $value, $group = null,
Registry $input = null, JForm $form = null)
{
$params = JComponentHelper::getParams('com_contact');
$banned = $params->get('banned_subject');
if ($banned)
{
foreach (explode(';', $banned) as $item)
{
if ($item != '' && StringHelper::stristr($value,
$item) !== false)
{
return false;
}
}
}
return true;
}
}
PKOF�[y S�||com_contact/router.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2007 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Routing class from com_contact
*
* @since 3.3
*/
class ContactRouter extends JComponentRouterView
{
protected $noIDs = false;
/**
* Search Component router constructor
*
* @param JApplicationCms $app The application object
* @param JMenu $menu The menu object to work with
*/
public function __construct($app = null, $menu = null)
{
$params = JComponentHelper::getParams('com_contact');
$this->noIDs = (bool) $params->get('sef_ids');
$categories = new
JComponentRouterViewconfiguration('categories');
$categories->setKey('id');
$this->registerView($categories);
$category = new JComponentRouterViewconfiguration('category');
$category->setKey('id')->setParent($categories,
'catid')->setNestable();
$this->registerView($category);
$contact = new JComponentRouterViewconfiguration('contact');
$contact->setKey('id')->setParent($category,
'catid');
$this->registerView($contact);
$this->registerView(new
JComponentRouterViewconfiguration('featured'));
parent::__construct($app, $menu);
$this->attachRule(new JComponentRouterRulesMenu($this));
if ($params->get('sef_advanced', 0))
{
$this->attachRule(new JComponentRouterRulesStandard($this));
$this->attachRule(new JComponentRouterRulesNomenu($this));
}
else
{
JLoader::register('ContactRouterRulesLegacy', __DIR__ .
'/helpers/legacyrouter.php');
$this->attachRule(new ContactRouterRulesLegacy($this));
}
}
/**
* Method to get the segment(s) for a category
*
* @param string $id ID of the category to retrieve the segments
for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getCategorySegment($id, $query)
{
$category = JCategories::getInstance($this->getName())->get($id);
if ($category)
{
$path = array_reverse($category->getPath(), true);
$path[0] = '1:root';
if ($this->noIDs)
{
foreach ($path as &$segment)
{
list($id, $segment) = explode(':', $segment, 2);
}
}
return $path;
}
return array();
}
/**
* Method to get the segment(s) for a category
*
* @param string $id ID of the category to retrieve the segments
for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getCategoriesSegment($id, $query)
{
return $this->getCategorySegment($id, $query);
}
/**
* Method to get the segment(s) for a contact
*
* @param string $id ID of the contact to retrieve the segments for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getContactSegment($id, $query)
{
if (!strpos($id, ':'))
{
$db = JFactory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($dbquery->qn('alias'))
->from($dbquery->qn('#__contact_details'))
->where('id = ' . $dbquery->q((int) $id));
$db->setQuery($dbquery);
$id .= ':' . $db->loadResult();
}
if ($this->noIDs)
{
list($void, $segment) = explode(':', $id, 2);
return array($void => $segment);
}
return array((int) $id => $id);
}
/**
* Method to get the id for a category
*
* @param string $segment Segment to retrieve the ID for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getCategoryId($segment, $query)
{
if (isset($query['id']))
{
$category = JCategories::getInstance($this->getName(),
array('access' => false))->get($query['id']);
if ($category)
{
foreach ($category->getChildren() as $child)
{
if ($this->noIDs)
{
if ($child->alias == $segment)
{
return $child->id;
}
}
else
{
if ($child->id == (int) $segment)
{
return $child->id;
}
}
}
}
}
return false;
}
/**
* Method to get the segment(s) for a category
*
* @param string $segment Segment to retrieve the ID for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getCategoriesId($segment, $query)
{
return $this->getCategoryId($segment, $query);
}
/**
* Method to get the segment(s) for a contact
*
* @param string $segment Segment of the contact to retrieve the ID
for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getContactId($segment, $query)
{
if ($this->noIDs)
{
$db = JFactory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($dbquery->qn('id'))
->from($dbquery->qn('#__contact_details'))
->where('alias = ' . $dbquery->q($segment))
->where('catid = ' .
$dbquery->q($query['id']));
$db->setQuery($dbquery);
return (int) $db->loadResult();
}
return (int) $segment;
}
}
/**
* Contact router functions
*
* These functions are proxys for the new router interface
* for old SEF extensions.
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent URL.
*
* @deprecated 4.0 Use Class based routers instead
*/
function ContactBuildRoute(&$query)
{
$app = JFactory::getApplication();
$router = new ContactRouter($app, $app->getMenu());
return $router->build($query);
}
/**
* Contact router functions
*
* These functions are proxys for the new router interface
* for old SEF extensions.
*
* @param array $segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @deprecated 4.0 Use Class based routers instead
*/
function ContactParseRoute($segments)
{
$app = JFactory::getApplication();
$router = new ContactRouter($app, $app->getMenu());
return $router->parse($segments);
}
PKOF�[<��B��-com_contact/views/categories/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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::addIncludePath(JPATH_COMPONENT . '/helpers');
JHtml::_('behavior.caption');
JHtml::_('behavior.core');
// Add strings for translations in Javascript.
JText::script('JGLOBAL_EXPAND_CATEGORIES');
JText::script('JGLOBAL_COLLAPSE_CATEGORIES');
JFactory::getDocument()->addScriptDeclaration("
jQuery(function($) {
$('.categories-list').find('[id^=category-btn-]').each(function(index,
btn) {
var btn = $(btn);
btn.on('click', function() {
btn.find('span').toggleClass('icon-plus');
btn.find('span').toggleClass('icon-minus');
if (btn.attr('aria-label') ===
Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES'))
{
btn.attr('aria-label',
Joomla.JText._('JGLOBAL_COLLAPSE_CATEGORIES'));
} else {
btn.attr('aria-label',
Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES'));
}
});
});
});");
?>
<div class="categories-list<?php echo $this->pageclass_sfx;
?>">
<?php
echo JLayoutHelper::render('joomla.content.categories_default',
$this);
echo $this->loadTemplate('items');
?>
</div>
PKPF�[qy$5M5M-com_contact/views/categories/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTACT_CATEGORIES_VIEW_DEFAULT_TITLE"
option="COM_CONTACT_CATEGORIES_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_CONTACT_CATEGORIES"
/>
<message>
<![CDATA[COM_CONTACT_CATEGORIES_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
>
<field
name="id"
type="category"
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
description="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC"
extension="com_contact"
show_root="true"
required="true"
/>
</fieldset>
</fields>
<fields name="params">
<fieldset name="basic"
label="JGLOBAL_CATEGORIES_OPTIONS">
<field
name="show_base_description"
type="list"
label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="categories_description"
type="textarea"
label="JGLOBAL_FIELD_CATEGORIES_DESC_LABEL"
description="JGLOBAL_FIELD_CATEGORIES_DESC_DESC"
cols="25"
rows="5"
/>
<field
name="maxLevelcat"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
useglobal="true"
>
<option value="-1">JALL</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="show_empty_categories_cat"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_CONTACT_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc_cat"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_items_cat"
type="list"
label="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_LABEL"
description="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="category"
label="JGLOBAL_CATEGORY_OPTIONS">
<field
name="spacer1"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description"
type="list"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description_image"
type="list"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="maxLevel"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
useglobal="true"
>
<option value="-1">JALL</option>
<option value="0">JNONE</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="show_empty_categories"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_CONTACT_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_items"
type="list"
label="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_LABEL"
description="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="advanced"
label="JGLOBAL_LIST_LAYOUT_OPTIONS">
<field
name="spacer2"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
description="JGLOBAL_SHOW_HEADINGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_position_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_POSITION_LABEL"
description="COM_CONTACT_FIELD_CONFIG_POSITION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_headings"
type="list"
label="JGLOBAL_EMAIL"
description="COM_CONTACT_FIELD_CONFIG_EMAIL_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_telephone_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_PHONE_LABEL"
description="COM_CONTACT_FIELD_CONFIG_PHONE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_mobile_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_MOBILE_LABEL"
description="COM_CONTACT_FIELD_CONFIG_MOBILE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_fax_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_FAX_LABEL"
description="COM_CONTACT_FIELD_CONFIG_FAX_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_suburb_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_SUBURB_LABEL"
description="COM_CONTACT_FIELD_CONFIG_SUBURB_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_state_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_STATE_LABEL"
description="COM_CONTACT_FIELD_CONFIG_STATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_country_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_COUNTRY_LABEL"
description="COM_CONTACT_FIELD_CONFIG_COUNTRY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="contact"
label="COM_CONTACT_BASIC_OPTIONS_FIELDSET_LABEL">
<field
name="presentation_style"
type="list"
label="COM_CONTACT_FIELD_PRESENTATION_LABEL"
description="COM_CONTACT_FIELD_PRESENTATION_DESC"
useglobal="true"
>
<option
value="sliders">COM_CONTACT_FIELD_VALUE_SLIDERS</option>
<option
value="tabs">COM_CONTACT_FIELD_VALUE_TABS</option>
<option
value="plain">COM_CONTACT_FIELD_VALUE_PLAIN</option>
</field>
<field
name="show_contact_category"
type="list"
label="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_LABEL"
description="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="hide">JHIDE</option>
<option
value="show_no_link">COM_CONTACT_FIELD_VALUE_NO_LINK</option>
<option
value="show_with_link">COM_CONTACT_FIELD_VALUE_WITH_LINK</option>
</field>
<field
name="show_contact_list"
type="list"
label="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_LABEL"
description="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_name"
type="list"
label="COM_CONTACT_FIELD_PARAMS_NAME_LABEL"
description="COM_CONTACT_FIELD_PARAMS_NAME_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_tags"
type="list"
label="COM_CONTACT_FIELD_SHOW_TAGS_LABEL"
description="COM_CONTACT_FIELD_SHOW_TAGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_info"
type="list"
label="COM_CONTACT_FIELD_SHOW_INFO_LABEL"
description="COM_CONTACT_FIELD_SHOW_INFO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_position"
type="list"
label="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_LABEL"
description="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email"
type="list"
label="JGLOBAL_EMAIL"
description="COM_CONTACT_FIELD_PARAMS_CONTACT_E_MAIL_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_street_address"
type="list"
label="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_LABEL"
description="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_suburb"
type="list"
description="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_DESC"
label="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_LABEL"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_state"
type="list"
label="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_LABEL"
description="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_postcode"
type="list"
label="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_country"
type="list"
label="COM_CONTACT_FIELD_PARAMS_COUNTRY_LABEL"
description="COM_CONTACT_FIELD_PARAMS_COUNTRY_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_telephone"
type="list"
label="COM_CONTACT_FIELD_PARAMS_TELEPHONE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_TELEPHONE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_mobile"
type="list"
label="COM_CONTACT_FIELD_PARAMS_MOBILE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_MOBILE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_fax"
type="list"
label="COM_CONTACT_FIELD_PARAMS_FAX_LABEL"
description="COM_CONTACT_FIELD_PARAMS_FAX_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_webpage"
type="list"
label="COM_CONTACT_FIELD_PARAMS_WEBPAGE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_WEBPAGE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_image"
type="list"
label="COM_CONTACT_FIELD_PARAMS_IMAGE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_IMAGE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="allow_vcard"
type="list"
label="COM_CONTACT_FIELD_PARAMS_VCARD_LABEL"
description="COM_CONTACT_FIELD_PARAMS_VCARD_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_misc"
type="list"
label="COM_CONTACT_FIELD_PARAMS_MISC_INFO_LABEL"
description="COM_CONTACT_FIELD_PARAMS_MISC_INFO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_articles"
type="list"
label="COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL"
description="COM_CONTACT_FIELD_ARTICLES_SHOW_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="articles_display_num"
type="list"
label="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_LABEL"
description="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_DESC"
default=""
useglobal="true"
>
<option
value="use_contact">COM_CONTACT_FIELD_VALUE_USE_CONTACT_SETTINGS</option>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="75">J75</option>
<option value="100">J100</option>
<option value="150">J150</option>
<option value="200">J200</option>
<option value="250">J250</option>
<option value="300">J300</option>
<option value="0">JALL</option>
</field>
<field
name="show_links"
type="list"
label="COM_CONTACT_FIELD_SHOW_LINKS_LABEL"
description="COM_CONTACT_FIELD_SHOW_LINKS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="linka_name"
type="text"
label="COM_CONTACT_FIELD_LINKA_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkb_name"
type="text"
label="COM_CONTACT_FIELD_LINKB_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkc_name"
type="text"
label="COM_CONTACT_FIELD_LINKC_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkd_name"
type="text"
label="COM_CONTACT_FIELD_LINKD_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linke_name"
type="text"
label="COM_CONTACT_FIELD_LINKE_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
</fieldset>
<!-- Form options. -->
<fieldset name="Contact_Form"
label="COM_CONTACT_MAIL_FIELDSET_LABEL">
<field
name="show_email_form"
type="list"
label="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL"
description="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_copy"
type="list"
label="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL"
description="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="validate_session"
type="list"
label="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_LABEL"
description="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="custom_reply"
type="list"
label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL"
description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="redirect"
type="text"
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
size="30"
useglobal="true"
/>
</fieldset>
<fieldset name="integration">
<field
name="show_feed_link"
type="list"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>
PKPF�[�ozV� � 3com_contact/views/categories/tmpl/default_items.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2010 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::_('bootstrap.tooltip');
$class = ' class="first"';
if ($this->maxLevelcat != 0 &&
count($this->items[$this->parent->id]) > 0) :
?>
<?php foreach ($this->items[$this->parent->id] as $id =>
$item) : ?>
<?php
if ($this->params->get('show_empty_categories_cat') ||
$item->numitems || count($item->getChildren())) :
if (!isset($this->items[$this->parent->id][$id + 1]))
{
$class = ' class="last"';
}
?>
<div <?php echo $class; ?> >
<?php $class = ''; ?>
<h3 class="page-header item-title">
<a href="<?php echo
JRoute::_(ContactHelperRoute::getCategoryRoute($item->id,
$item->language)); ?>">
<?php echo $this->escape($item->title); ?></a>
<?php if ($this->params->get('show_cat_items_cat')
== 1) :?>
<span class="badge badge-info tip hasTooltip"
title="<?php echo JHtml::_('tooltipText',
'COM_CONTACT_NUM_ITEMS'); ?>">
<?php echo JText::_('COM_CONTACT_NUM_ITEMS');
?>
<?php echo $item->numitems; ?>
</span>
<?php endif; ?>
<?php if ($this->maxLevelcat > 1 &&
count($item->getChildren()) > 0) : ?>
<a id="category-btn-<?php echo $item->id; ?>"
href="#category-<?php echo $item->id; ?>"
data-toggle="collapse" data-toggle="button"
class="btn btn-mini pull-right" aria-label="<?php echo
JText::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"><span
class="icon-plus"
aria-hidden="true"></span></a>
<?php endif; ?>
</h3>
<?php if ($this->params->get('show_subcat_desc_cat')
== 1) : ?>
<?php if ($item->description) : ?>
<div class="category-desc">
<?php echo JHtml::_('content.prepare',
$item->description, '', 'com_contact.categories');
?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->maxLevelcat > 1 &&
count($item->getChildren()) > 0) : ?>
<div class="collapse fade" id="category-<?php
echo $item->id; ?>">
<?php
$this->items[$item->id] = $item->getChildren();
$this->parent = $item;
$this->maxLevelcat--;
echo $this->loadTemplate('items');
$this->parent = $item->getParent();
$this->maxLevelcat++;
?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?><?php endif; ?>
PKPF�[NX
��*com_contact/views/categories/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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;
/**
* Content categories view.
*
* @since 1.6
*/
class ContactViewCategories extends JViewCategories
{
/**
* Language key for default page heading
*
* @var string
* @since 3.2
*/
protected $pageHeading = 'COM_CONTACT_DEFAULT_PAGE_TITLE';
/**
* @var string The name of the extension for the category
* @since 3.2
*/
protected $extension = 'com_contact';
}
PKPF�[Ml#hh+com_contact/views/category/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
$this->subtemplatename = 'items';
echo JLayoutHelper::render('joomla.content.category_default',
$this);
PKPF�[)k��K�K+com_contact/views/category/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTACT_CATEGORY_VIEW_DEFAULT_TITLE"
option="COM_CONTACT_CATEGORY_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_CONTACT_CATEGORY"
/>
<message>
<![CDATA[COM_CONTACT_CATEGORY_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request"
addfieldpath="/administrator/components/com_categories/models/fields"
>
<fieldset name="request"
addfieldpath="/administrator/components/com_contact/models/fields"
>
<field
name="id"
type="modal_category"
label="COM_CONTACT_FIELD_CATEGORY_LABEL"
description="COM_CONTACT_FIELD_CATEGORY_DESC"
extension="com_contact"
required="true"
select="true"
new="true"
edit="true"
clear="true"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic"
label="JGLOBAL_CATEGORY_OPTIONS">
<field
name="spacer1"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description"
type="list"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description_image"
type="list"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="maxLevel"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
useglobal="true"
>
<option value="-1">JALL</option>
<option value="0">JNONE</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="show_empty_categories"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_CONTACT_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_items"
type="list"
label="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_LABEL"
description="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="advanced"
label="JGLOBAL_LIST_LAYOUT_OPTIONS">
<field
name="spacer2"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
description="JGLOBAL_SHOW_HEADINGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_image_heading"
type="list"
label="COM_CONTACT_FIELD_CONFIG_SHOW_IMAGE_LABEL"
description="COM_CONTACT_FIELD_CONFIG_SHOW_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_position_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_POSITION_LABEL"
description="COM_CONTACT_FIELD_CONFIG_POSITION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_headings"
type="list"
label="JGLOBAL_EMAIL"
description="COM_CONTACT_FIELD_CONFIG_EMAIL_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_telephone_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_PHONE_LABEL"
description="COM_CONTACT_FIELD_CONFIG_PHONE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_mobile_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_MOBILE_LABEL"
description="COM_CONTACT_FIELD_CONFIG_MOBILE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_fax_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_FAX_LABEL"
description="COM_CONTACT_FIELD_CONFIG_FAX_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_suburb_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_SUBURB_LABEL"
description="COM_CONTACT_FIELD_CONFIG_SUBURB_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_state_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_STATE_LABEL"
description="COM_CONTACT_FIELD_CONFIG_STATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_country_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_COUNTRY_LABEL"
description="COM_CONTACT_FIELD_CONFIG_COUNTRY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="initial_sort"
type="list"
label="COM_CONTACT_FIELD_INITIAL_SORT_LABEL"
description="COM_CONTACT_FIELD_INITIAL_SORT_DESC"
useglobal="true"
>
<option
value="name">COM_CONTACT_FIELD_VALUE_NAME</option>
<option
value="sortname">COM_CONTACT_FIELD_VALUE_SORT_NAME</option>
<option
value="ordering">COM_CONTACT_FIELD_VALUE_ORDERING</option>
</field>
</fieldset>
<fieldset name="contact"
label="COM_CONTACT_BASIC_OPTIONS_FIELDSET_LABEL"
addfieldpath="/administrator/components/com_fields/models/fields">
<field
name="contact_layout"
type="componentlayout"
label="JGLOBAL_FIELD_LAYOUT_LABEL"
description="JGLOBAL_FIELD_LAYOUT_DESC"
menuitems="true"
extension="com_contact"
view="contact"
/>
<field
name="presentation_style"
type="list"
label="COM_CONTACT_FIELD_PRESENTATION_LABEL"
description="COM_CONTACT_FIELD_PRESENTATION_DESC"
useglobal="true"
>
<option
value="sliders">COM_CONTACT_FIELD_VALUE_SLIDERS</option>
<option
value="tabs">COM_CONTACT_FIELD_VALUE_TABS</option>
<option
value="plain">COM_CONTACT_FIELD_VALUE_PLAIN</option>
</field>
<field
name="show_contact_category"
type="list"
label="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_LABEL"
description="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="hide">JHIDE</option>
<option
value="show_no_link">COM_CONTACT_FIELD_VALUE_NO_LINK</option>
<option
value="show_with_link">COM_CONTACT_FIELD_VALUE_WITH_LINK</option>
</field>
<field
name="show_contact_list"
type="list"
label="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_LABEL"
description="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_name"
type="list"
label="COM_CONTACT_FIELD_PARAMS_NAME_LABEL"
description="COM_CONTACT_FIELD_PARAMS_NAME_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_tags"
type="list"
label="COM_CONTACT_FIELD_SHOW_TAGS_LABEL"
description="COM_CONTACT_FIELD_SHOW_TAGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_info"
type="list"
label="COM_CONTACT_FIELD_SHOW_INFO_LABEL"
description="COM_CONTACT_FIELD_SHOW_INFO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_position"
type="list"
label="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_LABEL"
description="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email"
type="list"
label="JGLOBAL_EMAIL"
description="COM_CONTACT_FIELD_PARAMS_CONTACT_E_MAIL_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_street_address"
type="list"
label="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_LABEL"
description="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_suburb"
type="list"
label="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_LABEL"
description="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_state"
type="list"
label="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_LABEL"
description="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_postcode"
type="list"
label="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_country"
type="list"
label="COM_CONTACT_FIELD_PARAMS_COUNTRY_LABEL"
description="COM_CONTACT_FIELD_PARAMS_COUNTRY_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_telephone"
type="list"
label="COM_CONTACT_FIELD_PARAMS_TELEPHONE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_TELEPHONE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_mobile"
type="list"
label="COM_CONTACT_FIELD_PARAMS_MOBILE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_MOBILE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_fax"
type="list"
label="COM_CONTACT_FIELD_PARAMS_FAX_LABEL"
description="COM_CONTACT_FIELD_PARAMS_FAX_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_webpage"
type="list"
label="COM_CONTACT_FIELD_PARAMS_WEBPAGE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_WEBPAGE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_image"
type="list"
label="COM_CONTACT_FIELD_PARAMS_IMAGE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_IMAGE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="allow_vcard"
type="list"
label="COM_CONTACT_FIELD_PARAMS_VCARD_LABEL"
description="COM_CONTACT_FIELD_PARAMS_VCARD_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_misc"
type="list"
label="COM_CONTACT_FIELD_PARAMS_MISC_INFO_LABEL"
description="COM_CONTACT_FIELD_PARAMS_MISC_INFO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_articles"
type="list"
label="COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL"
description="COM_CONTACT_FIELD_ARTICLES_SHOW_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="articles_display_num"
type="list"
label="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_LABEL"
description="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_DESC"
default=""
useglobal="true"
>
<option
value="use_contact">COM_CONTACT_FIELD_VALUE_USE_CONTACT_SETTINGS</option>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="75">J75</option>
<option value="100">J100</option>
<option value="150">J150</option>
<option value="200">J200</option>
<option value="250">J250</option>
<option value="300">J300</option>
<option value="0">JALL</option>
</field>
<field
name="show_links"
type="list"
label="COM_CONTACT_FIELD_SHOW_LINKS_LABEL"
description="COM_CONTACT_FIELD_SHOW_LINKS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_user_custom_fields"
type="fieldgroups"
label="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_LABEL"
description="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_DESC"
multiple="true"
context="com_users.user"
>
<option value="-1">JALL</option>
</field>
<field
name="linka_name"
type="text"
label="COM_CONTACT_FIELD_LINKA_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkb_name"
type="text"
label="COM_CONTACT_FIELD_LINKB_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkc_name"
type="text"
label="COM_CONTACT_FIELD_LINKC_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkd_name"
type="text"
label="COM_CONTACT_FIELD_LINKD_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linke_name"
type="text"
label="COM_CONTACT_FIELD_LINKE_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
</fieldset>
<!-- Form options. -->
<fieldset name="Contact_Form"
label="COM_CONTACT_MAIL_FIELDSET_LABEL">
<field
name="show_email_form"
type="list"
label="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL"
description="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_copy"
type="list"
label="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL"
description="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="validate_session"
type="list"
label="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_LABEL"
description="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="custom_reply"
type="list"
label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL"
description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="redirect"
type="text"
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
size="30"
useglobal="true"
/>
</fieldset>
<fieldset name="integration">
<field
name="show_feed_link"
type="list"
label="JGLOBAL_Show_Feed_Link_Label"
description="JGLOBAL_Show_Feed_Link_Desc"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>
PKRF�[p@I���4com_contact/views/category/tmpl/default_children.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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;
$class = ' class="first"';
if ($this->maxLevel != 0 &&
count($this->children[$this->category->id]) > 0) :
?>
<ul class="list-striped list-condensed">
<?php foreach ($this->children[$this->category->id] as $id
=> $child) : ?>
<?php
if ($this->params->get('show_empty_categories') ||
$child->numitems || count($child->getChildren())) :
if (!isset($this->children[$this->category->id][$id + 1]))
{
$class = ' class="last"';
}
?>
<li<?php echo $class; ?>>
<?php $class = ''; ?>
<h4 class="item-title">
<a href="<?php echo
JRoute::_(ContactHelperRoute::getCategoryRoute($child->id));
?>">
<?php echo $this->escape($child->title); ?>
</a>
<?php if ($this->params->get('show_cat_items') == 1)
: ?>
<span class="badge badge-info pull-right"
title="<?php echo JText::_('COM_CONTACT_CAT_NUM');
?>"><?php echo $child->numitems; ?></span>
<?php endif; ?>
</h4>
<?php if ($this->params->get('show_subcat_desc') ==
1) : ?>
<?php if ($child->description) : ?>
<div class="category-desc">
<?php echo JHtml::_('content.prepare',
$child->description, '', 'com_contact.category');
?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if (count($child->getChildren()) > 0 ) :
$this->children[$child->id] = $child->getChildren();
$this->category = $child;
$this->maxLevel--;
echo $this->loadTemplate('children');
$this->category = $child->getParent();
$this->maxLevel++;
endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
PKRF�[�I�Ϻ�1com_contact/views/category/tmpl/default_items.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 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.core');
?>
<form action="<?php echo
htmlspecialchars(JUri::getInstance()->toString()); ?>"
method="post" name="adminForm"
id="adminForm">
<?php if ($this->params->get('filter_field') ||
$this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters btn-toolbar">
<?php if ($this->params->get('filter_field')) : ?>
<div class="btn-group">
<label class="filter-search-lbl element-invisible"
for="filter-search">
<span class="label label-warning">
<?php echo JText::_('JUNPUBLISHED'); ?>
</span>
<?php echo JText::_('COM_CONTACT_FILTER_LABEL') .
' '; ?>
</label>
<input
type="text"
name="filter-search"
id="filter-search"
value="<?php echo
$this->escape($this->state->get('list.filter'));
?>"
class="inputbox"
onchange="document.adminForm.submit();"
title="<?php echo
JText::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>"
placeholder="<?php echo
JText::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>"
/>
</div>
<?php endif; ?>
<?php if
($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group pull-right">
<label for="limit"
class="element-invisible">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
</fieldset>
<?php endif; ?>
<?php if (empty($this->items)) : ?>
<p>
<?php echo JText::_('COM_CONTACT_NO_CONTACTS'); ?>
</p>
<?php else : ?>
<ul class="category row-striped">
<?php foreach ($this->items as $i => $item) : ?>
<?php if (in_array($item->access,
$this->user->getAuthorisedViewLevels())) : ?>
<?php if ($this->items[$i]->published == 0) : ?>
<li class="row-fluid system-unpublished cat-list-row<?php
echo $i % 2; ?>">
<?php else : ?>
<li class="row-fluid cat-list-row<?php echo $i % 2;
?>" >
<?php endif; ?>
<?php if ($this->params->get('show_image_heading'))
: ?>
<?php $contactWidth = 7; ?>
<div class="span2 col-md-2">
<?php if ($this->items[$i]->image) : ?>
<a href="<?php echo
JRoute::_(ContactHelperRoute::getContactRoute($item->slug,
$item->catid)); ?>">
<?php echo JHtml::_(
'image',
$this->items[$i]->image,
JText::_('COM_CONTACT_IMAGE_DETAILS'),
array('class' => 'contact-thumbnail
img-thumbnail')
); ?>
</a>
<?php endif; ?>
</div>
<?php else : ?>
<?php $contactWidth = 9; ?>
<?php endif; ?>
<div class="list-title span<?php echo $contactWidth; ?>
col-md-<?php echo $contactWidth; ?>">
<a href="<?php echo
JRoute::_(ContactHelperRoute::getContactRoute($item->slug,
$item->catid)); ?>">
<?php echo $item->name; ?>
</a>
<?php if ($this->items[$i]->published == 0) : ?>
<span class="label label-warning">
<?php echo JText::_('JUNPUBLISHED'); ?>
</span>
<?php endif; ?>
<?php echo $item->event->afterDisplayTitle; ?>
<?php echo $item->event->beforeDisplayContent; ?>
<?php if
($this->params->get('show_position_headings')) : ?>
<?php echo $item->con_position; ?><br />
<?php endif; ?>
<?php if
($this->params->get('show_email_headings')) : ?>
<?php echo $item->email_to; ?><br />
<?php endif; ?>
<?php $location = array(); ?>
<?php if
($this->params->get('show_suburb_headings') &&
!empty($item->suburb)) : ?>
<?php $location[] = $item->suburb; ?>
<?php endif; ?>
<?php if
($this->params->get('show_state_headings') &&
!empty($item->state)) : ?>
<?php $location[] = $item->state; ?>
<?php endif; ?>
<?php if
($this->params->get('show_country_headings') &&
!empty($item->country)) : ?>
<?php $location[] = $item->country; ?>
<?php endif; ?>
<?php echo implode(', ', $location); ?>
</div>
<div class="span3 col-md-3">
<?php if
($this->params->get('show_telephone_headings') &&
!empty($item->telephone)) : ?>
<?php echo
JText::sprintf('COM_CONTACT_TELEPHONE_NUMBER',
$item->telephone); ?><br />
<?php endif; ?>
<?php if
($this->params->get('show_mobile_headings') &&
!empty ($item->mobile)) : ?>
<?php echo JText::sprintf('COM_CONTACT_MOBILE_NUMBER',
$item->mobile); ?><br />
<?php endif; ?>
<?php if ($this->params->get('show_fax_headings')
&& !empty($item->fax)) : ?>
<?php echo JText::sprintf('COM_CONTACT_FAX_NUMBER',
$item->fax); ?><br />
<?php endif; ?>
</div>
<?php echo $item->event->afterDisplayContent; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if ($this->params->get('show_pagination', 2)) :
?>
<div class="pagination">
<?php if
($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<div>
<input type="hidden" name="filter_order"
value="<?php echo
$this->escape($this->state->get('list.ordering'));
?>" />
<input type="hidden" name="filter_order_Dir"
value="<?php echo
$this->escape($this->state->get('list.direction'));
?>" />
</div>
</form>
PKRF�[*�&���(com_contact/views/category/view.feed.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Contact component
*
* @since 1.5
*/
class ContactViewCategory extends JViewCategoryfeed
{
/**
* @var string The name of the view to link individual items to
* @since 3.2
*/
protected $viewName = 'contact';
/**
* Method to reconcile non standard names from components to usage in this
class.
* Typically overridden in the component feed view class.
*
* @param object $item The item for a feed, an element of the $items
array.
*
* @return void
*
* @since 3.2
*/
protected function reconcileNames($item)
{
parent::reconcileNames($item);
$item->description = $item->address;
}
}
PKSF�[�O��(com_contact/views/category/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Contacts component
*
* @since 1.5
*/
class ContactViewCategory extends JViewCategory
{
/**
* @var string The name of the extension for the category
* @since 3.2
*/
protected $extension = 'com_contact';
/**
* @var string Default title to use for page title
* @since 3.2
*/
protected $defaultPageTitle = 'COM_CONTACT_DEFAULT_PAGE_TITLE';
/**
* @var string The name of the view to link individual items to
* @since 3.2
*/
protected $viewName = 'contact';
/**
* Run the standard Joomla plugins
*
* @var bool
* @since 3.5
*/
protected $runPlugins = true;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
parent::commonCategoryDisplay();
// Flag indicates to not add limitstart=0 to URL
$this->pagination->hideEmptyLimitstart = true;
// Prepare the data.
// Compute the contact slug.
foreach ($this->items as $item)
{
$item->slug = $item->alias ? ($item->id . ':' .
$item->alias) : $item->id;
$temp = $item->params;
$item->params = clone $this->params;
$item->params->merge($temp);
if ($item->params->get('show_email_headings', 0) == 1)
{
$item->email_to = trim($item->email_to);
if (!empty($item->email_to) &&
JMailHelper::isEmailAddress($item->email_to))
{
$item->email_to = JHtml::_('email.cloak',
$item->email_to);
}
else
{
$item->email_to = '';
}
}
}
return parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*/
protected function prepareDocument()
{
parent::prepareDocument();
$menu = $this->menu;
$id = (int) @$menu->query['id'];
if ($menu && (!isset($menu->query['option']) ||
$menu->query['option'] != $this->extension ||
$menu->query['view'] == $this->viewName
|| $id != $this->category->id))
{
$path = array(array('title' =>
$this->category->title, 'link' => ''));
$category = $this->category->getParent();
while ($category !== null && $category->id !== 'root
' &&
(!isset($menu->query['option']) ||
$menu->query['option'] !== 'com_contact' ||
$menu->query['view'] === 'contact' || $id !=
$category->id))
{
$path[] = array('title' => $category->title,
'link' =>
ContactHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();
}
$path = array_reverse($path);
foreach ($path as $item)
{
$this->pathway->addItem($item['title'],
$item['link']);
}
}
parent::addFeed();
}
}
PKSF�[�;={){)*com_contact/views/contact/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
$tparams = $this->item->params;
?>
<div class="contact<?php echo $this->pageclass_sfx;
?>" itemscope itemtype="https://schema.org/Person">
<?php if ($tparams->get('show_page_heading')) : ?>
<h1>
<?php echo
$this->escape($tparams->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->contact->name &&
$tparams->get('show_name')) : ?>
<div class="page-header">
<h2>
<?php if ($this->item->published == 0) : ?>
<span class="label label-warning"><?php echo
JText::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<span class="contact-name"
itemprop="name"><?php echo $this->contact->name;
?></span>
</h2>
</div>
<?php endif; ?>
<?php $show_contact_category =
$tparams->get('show_contact_category'); ?>
<?php if ($show_contact_category === 'show_no_link') : ?>
<h3>
<span class="contact-category"><?php echo
$this->contact->category_title; ?></span>
</h3>
<?php elseif ($show_contact_category === 'show_with_link') :
?>
<?php $contactLink =
ContactHelperRoute::getCategoryRoute($this->contact->catid); ?>
<h3>
<span class="contact-category"><a href="<?php
echo $contactLink; ?>">
<?php echo $this->escape($this->contact->category_title);
?></a>
</span>
</h3>
<?php endif; ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php if ($tparams->get('show_contact_list') &&
count($this->contacts) > 1) : ?>
<form action="#" method="get"
name="selectForm" id="selectForm">
<label for="select_contact"><?php echo
JText::_('COM_CONTACT_SELECT_CONTACT'); ?></label>
<?php echo JHtml::_('select.genericlist',
$this->contacts, 'select_contact',
'class="inputbox" onchange="document.location.href =
this.value"', 'link', 'name',
$this->contact->link); ?>
</form>
<?php endif; ?>
<?php if ($tparams->get('show_tags', 1) &&
!empty($this->item->tags->itemTags)) : ?>
<?php $this->item->tagLayout = new
JLayoutFile('joomla.content.tags'); ?>
<?php echo
$this->item->tagLayout->render($this->item->tags->itemTags);
?>
<?php endif; ?>
<?php echo $this->item->event->beforeDisplayContent; ?>
<?php $presentation_style =
$tparams->get('presentation_style'); ?>
<?php $accordionStarted = false; ?>
<?php $tabSetStarted = false; ?>
<?php if ($this->params->get('show_info', 1)) : ?>
<?php if ($presentation_style === 'sliders') : ?>
<?php echo JHtml::_('bootstrap.startAccordion',
'slide-contact', array('active' =>
'basic-details')); ?>
<?php $accordionStarted = true; ?>
<?php echo JHtml::_('bootstrap.addSlide',
'slide-contact', JText::_('COM_CONTACT_DETAILS'),
'basic-details'); ?>
<?php elseif ($presentation_style === 'tabs') : ?>
<?php echo JHtml::_('bootstrap.startTabSet',
'myTab', array('active' =>
'basic-details')); ?>
<?php $tabSetStarted = true; ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'basic-details', JText::_('COM_CONTACT_DETAILS'));
?>
<?php elseif ($presentation_style === 'plain') : ?>
<?php echo '<h3>' .
JText::_('COM_CONTACT_DETAILS') . '</h3>'; ?>
<?php endif; ?>
<?php if ($this->contact->image &&
$tparams->get('show_image')) : ?>
<div class="thumbnail pull-right">
<?php echo JHtml::_('image', $this->contact->image,
htmlspecialchars($this->contact->name, ENT_QUOTES,
'UTF-8'), array('itemprop' => 'image'));
?>
</div>
<?php endif; ?>
<?php if ($this->contact->con_position &&
$tparams->get('show_position')) : ?>
<dl class="contact-position dl-horizontal">
<dt><?php echo JText::_('COM_CONTACT_POSITION');
?>:</dt>
<dd itemprop="jobTitle">
<?php echo $this->contact->con_position; ?>
</dd>
</dl>
<?php endif; ?>
<?php echo $this->loadTemplate('address'); ?>
<?php if ($tparams->get('allow_vcard')) : ?>
<?php echo JText::_('COM_CONTACT_DOWNLOAD_INFORMATION_AS');
?>
<a href="<?php echo
JRoute::_('index.php?option=com_contact&view=contact&id='
. $this->contact->id . '&format=vcf');
?>">
<?php echo JText::_('COM_CONTACT_VCARD'); ?></a>
<?php endif; ?>
<?php if ($presentation_style === 'sliders') : ?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php elseif ($presentation_style === 'tabs') : ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($tparams->get('show_email_form') &&
($this->contact->email_to || $this->contact->user_id)) : ?>
<?php if ($presentation_style === 'sliders') : ?>
<?php if (!$accordionStarted)
{
echo JHtml::_('bootstrap.startAccordion',
'slide-contact', array('active' =>
'display-form'));
$accordionStarted = true;
}
?>
<?php echo JHtml::_('bootstrap.addSlide',
'slide-contact', JText::_('COM_CONTACT_EMAIL_FORM'),
'display-form'); ?>
<?php elseif ($presentation_style === 'tabs') : ?>
<?php if (!$tabSetStarted)
{
echo JHtml::_('bootstrap.startTabSet', 'myTab',
array('active' => 'display-form'));
$tabSetStarted = true;
}
?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'display-form', JText::_('COM_CONTACT_EMAIL_FORM'));
?>
<?php elseif ($presentation_style === 'plain') : ?>
<?php echo '<h3>' .
JText::_('COM_CONTACT_EMAIL_FORM') . '</h3>';
?>
<?php endif; ?>
<?php echo $this->loadTemplate('form'); ?>
<?php if ($presentation_style === 'sliders') : ?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php elseif ($presentation_style === 'tabs') : ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($tparams->get('show_links')) : ?>
<?php if ($presentation_style === 'sliders') : ?>
<?php if (!$accordionStarted) : ?>
<?php echo JHtml::_('bootstrap.startAccordion',
'slide-contact', array('active' =>
'display-links')); ?>
<?php $accordionStarted = true; ?>
<?php endif; ?>
<?php elseif ($presentation_style === 'tabs') : ?>
<?php if (!$tabSetStarted) : ?>
<?php echo JHtml::_('bootstrap.startTabSet',
'myTab', array('active' =>
'display-links')); ?>
<?php $tabSetStarted = true; ?>
<?php endif; ?>
<?php endif; ?>
<?php echo $this->loadTemplate('links'); ?>
<?php endif; ?>
<?php if ($tparams->get('show_articles') &&
$this->contact->user_id && $this->contact->articles) :
?>
<?php if ($presentation_style === 'sliders') : ?>
<?php if (!$accordionStarted)
{
echo JHtml::_('bootstrap.startAccordion',
'slide-contact', array('active' =>
'display-articles'));
$accordionStarted = true;
}
?>
<?php echo JHtml::_('bootstrap.addSlide',
'slide-contact', JText::_('JGLOBAL_ARTICLES'),
'display-articles'); ?>
<?php elseif ($presentation_style === 'tabs') : ?>
<?php if (!$tabSetStarted)
{
echo JHtml::_('bootstrap.startTabSet', 'myTab',
array('active' => 'display-articles'));
$tabSetStarted = true;
}
?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'display-articles', JText::_('JGLOBAL_ARTICLES'));
?>
<?php elseif ($presentation_style === 'plain') : ?>
<?php echo '<h3>' .
JText::_('JGLOBAL_ARTICLES') . '</h3>'; ?>
<?php endif; ?>
<?php echo $this->loadTemplate('articles'); ?>
<?php if ($presentation_style === 'sliders') : ?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php elseif ($presentation_style === 'tabs') : ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($tparams->get('show_profile') &&
$this->contact->user_id &&
JPluginHelper::isEnabled('user', 'profile')) : ?>
<?php if ($presentation_style === 'sliders') : ?>
<?php if (!$accordionStarted)
{
echo JHtml::_('bootstrap.startAccordion',
'slide-contact', array('active' =>
'display-profile'));
$accordionStarted = true;
}
?>
<?php echo JHtml::_('bootstrap.addSlide',
'slide-contact', JText::_('COM_CONTACT_PROFILE'),
'display-profile'); ?>
<?php elseif ($presentation_style === 'tabs') : ?>
<?php if (!$tabSetStarted)
{
echo JHtml::_('bootstrap.startTabSet', 'myTab',
array('active' => 'display-profile'));
$tabSetStarted = true;
}
?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'display-profile', JText::_('COM_CONTACT_PROFILE'));
?>
<?php elseif ($presentation_style === 'plain') : ?>
<?php echo '<h3>' .
JText::_('COM_CONTACT_PROFILE') . '</h3>'; ?>
<?php endif; ?>
<?php echo $this->loadTemplate('profile'); ?>
<?php if ($presentation_style === 'sliders') : ?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php elseif ($presentation_style === 'tabs') : ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($tparams->get('show_user_custom_fields')
&& $this->contactUser) : ?>
<?php echo $this->loadTemplate('user_custom_fields');
?>
<?php endif; ?>
<?php if ($this->contact->misc &&
$tparams->get('show_misc')) : ?>
<?php if ($presentation_style === 'sliders') : ?>
<?php if (!$accordionStarted)
{
echo JHtml::_('bootstrap.startAccordion',
'slide-contact', array('active' =>
'display-misc'));
$accordionStarted = true;
}
?>
<?php echo JHtml::_('bootstrap.addSlide',
'slide-contact',
JText::_('COM_CONTACT_OTHER_INFORMATION'),
'display-misc'); ?>
<?php elseif ($presentation_style === 'tabs') : ?>
<?php if (!$tabSetStarted)
{
echo JHtml::_('bootstrap.startTabSet', 'myTab',
array('active' => 'display-misc'));
$tabSetStarted = true;
}
?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'display-misc',
JText::_('COM_CONTACT_OTHER_INFORMATION')); ?>
<?php elseif ($presentation_style === 'plain') : ?>
<?php echo '<h3>' .
JText::_('COM_CONTACT_OTHER_INFORMATION') .
'</h3>'; ?>
<?php endif; ?>
<div class="contact-miscinfo">
<dl class="dl-horizontal">
<dt>
<span class="<?php echo
$tparams->get('marker_class'); ?>">
<?php echo $tparams->get('marker_misc'); ?>
</span>
</dt>
<dd>
<span class="contact-misc">
<?php echo $this->contact->misc; ?>
</span>
</dd>
</dl>
</div>
<?php if ($presentation_style === 'sliders') : ?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php elseif ($presentation_style === 'tabs') : ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($accordionStarted) : ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
<?php elseif ($tabSetStarted) : ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<?php endif; ?>
<?php echo $this->item->event->afterDisplayContent; ?>
</div>
PKSF�[-!Y�00*com_contact/views/contact/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTACT_CONTACT_VIEW_DEFAULT_TITLE"
option="COM_CONTACT_CONTACT_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_CONTACT_SINGLE_CONTACT"
/>
<message>
<![CDATA[COM_CONTACT_CONTACT_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_contact/models/fields"
>
<field
name="id"
type="modal_contact"
label="COM_CONTACT_SELECT_CONTACT_LABEL"
description="COM_CONTACT_SELECT_CONTACT_DESC"
required="true"
select="true"
new="true"
edit="true"
clear="true"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<!-- Basic options. -->
<fieldset name="params"
label="COM_CONTACT_BASIC_OPTIONS_FIELDSET_LABEL"
addfieldpath="/administrator/components/com_fields/models/fields"
>
<field
name="presentation_style"
type="list"
label="COM_CONTACT_FIELD_PRESENTATION_LABEL"
description="COM_CONTACT_FIELD_PRESENTATION_DESC"
useglobal="true"
>
<option
value="sliders">COM_CONTACT_FIELD_VALUE_SLIDERS</option>
<option
value="tabs">COM_CONTACT_FIELD_VALUE_TABS</option>
<option
value="plain">COM_CONTACT_FIELD_VALUE_PLAIN</option>
</field>
<field
name="show_contact_category"
type="list"
label="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_LABEL"
description="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="hide">JHIDE</option>
<option
value="show_no_link">COM_CONTACT_FIELD_VALUE_NO_LINK</option>
<option
value="show_with_link">COM_CONTACT_FIELD_VALUE_WITH_LINK</option>
</field>
<field
name="show_contact_list"
type="list"
label="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_LABEL"
description="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_name"
type="list"
label="COM_CONTACT_FIELD_PARAMS_NAME_LABEL"
description="COM_CONTACT_FIELD_PARAMS_NAME_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_tags"
type="list"
label="COM_CONTACT_FIELD_SHOW_TAGS_LABEL"
description="COM_CONTACT_FIELD_SHOW_TAGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_info"
type="list"
label="COM_CONTACT_FIELD_SHOW_INFO_LABEL"
description="COM_CONTACT_FIELD_SHOW_INFO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_position"
type="list"
label="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_LABEL"
description="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email"
type="list"
label="JGLOBAL_EMAIL"
description="COM_CONTACT_FIELD_PARAMS_CONTACT_E_MAIL_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="add_mailto_link"
type="list"
label="COM_CONTACT_FIELD_PARAMS_ADD_MAILTO_LINK_LABEL"
description="COM_CONTACT_FIELD_PARAMS_ADD_MAILTO_LINK_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="show_street_address"
type="list"
label="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_LABEL"
description="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_suburb"
type="list"
label="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_LABEL"
description="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_state"
type="list"
label="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_LABEL"
description="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_postcode"
type="list"
label="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_country"
type="list"
label="COM_CONTACT_FIELD_PARAMS_COUNTRY_LABEL"
description="COM_CONTACT_FIELD_PARAMS_COUNTRY_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_telephone"
type="list"
label="COM_CONTACT_FIELD_PARAMS_TELEPHONE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_TELEPHONE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_mobile"
type="list"
label="COM_CONTACT_FIELD_PARAMS_MOBILE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_MOBILE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_fax"
type="list"
label="COM_CONTACT_FIELD_PARAMS_FAX_LABEL"
description="COM_CONTACT_FIELD_PARAMS_FAX_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_webpage"
type="list"
label="COM_CONTACT_FIELD_PARAMS_WEBPAGE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_WEBPAGE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_image"
type="list"
label="COM_CONTACT_FIELD_PARAMS_IMAGE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_IMAGE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="allow_vcard"
type="list"
label="COM_CONTACT_FIELD_PARAMS_VCARD_LABEL"
description="COM_CONTACT_FIELD_PARAMS_VCARD_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_misc"
type="list"
label="COM_CONTACT_FIELD_PARAMS_MISC_INFO_LABEL"
description="COM_CONTACT_FIELD_PARAMS_MISC_INFO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_articles"
type="list"
label="COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL"
description="COM_CONTACT_FIELD_ARTICLES_SHOW_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="articles_display_num"
type="list"
label="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_LABEL"
description="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_DESC"
default=""
useglobal="true"
>
<option
value="use_contact">COM_CONTACT_FIELD_VALUE_USE_CONTACT_SETTINGS</option>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="75">J75</option>
<option value="100">J100</option>
<option value="150">J150</option>
<option value="200">J200</option>
<option value="250">J250</option>
<option value="300">J300</option>
<option value="0">JALL</option>
</field>
<field
name="show_profile"
type="list"
label="COM_CONTACT_FIELD_PROFILE_SHOW_LABEL"
description="COM_CONTACT_FIELD_PROFILE_SHOW_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_user_custom_fields"
type="fieldgroups"
label="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_LABEL"
description="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_DESC"
multiple="true"
context="com_users.user"
>
<option value="-1">JALL</option>
</field>
<field
name="show_links"
type="list"
label="COM_CONTACT_FIELD_SHOW_LINKS_LABEL"
description="COM_CONTACT_FIELD_SHOW_LINKS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="linka_name"
type="text"
label="COM_CONTACT_FIELD_LINKA_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkb_name"
type="text"
label="COM_CONTACT_FIELD_LINKB_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkc_name"
type="text"
label="COM_CONTACT_FIELD_LINKC_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkd_name"
type="text"
label="COM_CONTACT_FIELD_LINKD_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linke_name"
type="text"
label="COM_CONTACT_FIELD_LINKE_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
</fieldset>
<!-- Form options. -->
<fieldset name="Contact_Form"
label="COM_CONTACT_MAIL_FIELDSET_LABEL"
>
<field
name="show_email_form"
type="list"
label="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL"
description="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_copy"
type="list"
label="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL"
description="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="validate_session"
type="list"
label="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_LABEL"
description="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="custom_reply"
type="list"
label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL"
description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="redirect"
type="text"
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
size="30"
useglobal="true"
/>
</fieldset>
</fields>
</metadata>
PKSF�[}6����2com_contact/views/contact/tmpl/default_address.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Marker_class: Class based on the selection of text, none, or icons
* jicon-text, jicon-none, jicon-icon
*/
?>
<dl class="contact-address dl-horizontal"
itemprop="address" itemscope
itemtype="https://schema.org/PostalAddress">
<?php if (($this->params->get('address_check') > 0)
&&
($this->contact->address || $this->contact->suburb ||
$this->contact->state || $this->contact->country ||
$this->contact->postcode)) : ?>
<dt>
<span class="<?php echo
$this->params->get('marker_class'); ?>">
<?php echo $this->params->get('marker_address');
?>
</span>
</dt>
<?php if ($this->contact->address &&
$this->params->get('show_street_address')) : ?>
<dd>
<span class="contact-street"
itemprop="streetAddress">
<?php echo nl2br($this->contact->address); ?>
<br />
</span>
</dd>
<?php endif; ?>
<?php if ($this->contact->suburb &&
$this->params->get('show_suburb')) : ?>
<dd>
<span class="contact-suburb"
itemprop="addressLocality">
<?php echo $this->contact->suburb; ?>
<br />
</span>
</dd>
<?php endif; ?>
<?php if ($this->contact->state &&
$this->params->get('show_state')) : ?>
<dd>
<span class="contact-state"
itemprop="addressRegion">
<?php echo $this->contact->state; ?>
<br />
</span>
</dd>
<?php endif; ?>
<?php if ($this->contact->postcode &&
$this->params->get('show_postcode')) : ?>
<dd>
<span class="contact-postcode"
itemprop="postalCode">
<?php echo $this->contact->postcode; ?>
<br />
</span>
</dd>
<?php endif; ?>
<?php if ($this->contact->country &&
$this->params->get('show_country')) : ?>
<dd>
<span class="contact-country"
itemprop="addressCountry">
<?php echo $this->contact->country; ?>
<br />
</span>
</dd>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->contact->email_to &&
$this->params->get('show_email')) : ?>
<dt>
<span class="<?php echo
$this->params->get('marker_class'); ?>"
itemprop="email">
<?php echo nl2br($this->params->get('marker_email'));
?>
</span>
</dt>
<dd>
<span class="contact-emailto">
<?php echo $this->contact->email_to; ?>
</span>
</dd>
<?php endif; ?>
<?php if ($this->contact->telephone &&
$this->params->get('show_telephone')) : ?>
<dt>
<span class="<?php echo
$this->params->get('marker_class'); ?>">
<?php echo $this->params->get('marker_telephone');
?>
</span>
</dt>
<dd>
<span class="contact-telephone"
itemprop="telephone">
<?php echo $this->contact->telephone; ?>
</span>
</dd>
<?php endif; ?>
<?php if ($this->contact->fax &&
$this->params->get('show_fax')) : ?>
<dt>
<span class="<?php echo
$this->params->get('marker_class'); ?>">
<?php echo $this->params->get('marker_fax'); ?>
</span>
</dt>
<dd>
<span class="contact-fax" itemprop="faxNumber">
<?php echo $this->contact->fax; ?>
</span>
</dd>
<?php endif; ?>
<?php if ($this->contact->mobile &&
$this->params->get('show_mobile')) : ?>
<dt>
<span class="<?php echo
$this->params->get('marker_class'); ?>">
<?php echo $this->params->get('marker_mobile'); ?>
</span>
</dt>
<dd>
<span class="contact-mobile"
itemprop="telephone">
<?php echo $this->contact->mobile; ?>
</span>
</dd>
<?php endif; ?>
<?php if ($this->contact->webpage &&
$this->params->get('show_webpage')) : ?>
<dt>
<span class="<?php echo
$this->params->get('marker_class'); ?>">
<?php echo $this->params->get('marker_webpage');
?>
</span>
</dt>
<dd>
<span class="contact-webpage">
<a href="<?php echo $this->contact->webpage;
?>" target="_blank" rel="noopener noreferrer"
itemprop="url">
<?php echo JStringPunycode::urlToUTF8($this->contact->webpage);
?></a>
</span>
</dd>
<?php endif; ?>
</dl>
PKTF�[�.�b!!3com_contact/views/contact/tmpl/default_articles.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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;
JLoader::register('ContentHelperRoute', JPATH_SITE .
'/components/com_content/helpers/route.php');
?>
<?php if ($this->params->get('show_articles')) : ?>
<div class="contact-articles">
<ul class="nav nav-tabs nav-stacked">
<?php foreach ($this->item->articles as $article) : ?>
<li>
<?php echo JHtml::_('link',
JRoute::_(ContentHelperRoute::getArticleRoute($article->slug,
$article->catid, $article->language)),
htmlspecialchars($article->title, ENT_COMPAT, 'UTF-8')); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
PKTF�[�s�z~~/com_contact/views/contact/tmpl/default_form.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 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.keepalive');
JHtml::_('behavior.formvalidator');
?>
<div class="contact-form">
<form id="contact-form" action="<?php echo
JRoute::_('index.php'); ?>" method="post"
class="form-validate form-horizontal well">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<?php if ($fieldset->name === 'captcha' &&
!$this->captchaEnabled) : ?>
<?php continue; ?>
<?php endif; ?>
<?php $fields = $this->form->getFieldset($fieldset->name);
?>
<?php if (count($fields)) : ?>
<fieldset>
<?php if (isset($fieldset->label) && ($legend =
trim(JText::_($fieldset->label))) !== '') : ?>
<legend><?php echo $legend; ?></legend>
<?php endif; ?>
<?php foreach ($fields as $field) : ?>
<?php echo $field->renderField(); ?>
<?php endforeach; ?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary validate"
type="submit"><?php echo
JText::_('COM_CONTACT_CONTACT_SEND'); ?></button>
<input type="hidden" name="option"
value="com_contact" />
<input type="hidden" name="task"
value="contact.submit" />
<input type="hidden" name="return"
value="<?php echo $this->return_page; ?>" />
<input type="hidden" name="id"
value="<?php echo $this->contact->slug; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>
</div>
PKTF�[Ϡo
��0com_contact/views/contact/tmpl/default_links.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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;
?>
<?php if ($this->params->get('presentation_style') ===
'sliders') : ?>
<?php echo JHtml::_('bootstrap.addSlide',
'slide-contact', JText::_('COM_CONTACT_LINKS'),
'display-links'); ?>
<?php endif; ?>
<?php if ($this->params->get('presentation_style') ===
'tabs') : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'display-links', JText::_('COM_CONTACT_LINKS')); ?>
<?php endif; ?>
<?php if ($this->params->get('presentation_style') ===
'plain') : ?>
<?php echo '<h3>' .
JText::_('COM_CONTACT_LINKS') . '</h3>'; ?>
<?php endif; ?>
<div class="contact-links">
<ul class="nav nav-tabs nav-stacked">
<?php
// Letters 'a' to 'e'
foreach (range('a', 'e') as $char) :
$link = $this->contact->params->get('link' . $char);
$label = $this->contact->params->get('link' . $char .
'_name');
if (!$link) :
continue;
endif;
// Add 'http://' if not present
$link = (0 === strpos($link, 'http')) ? $link :
'http://' . $link;
// If no label is present, take the link
$label = $label ?: $link;
?>
<li>
<a href="<?php echo $link; ?>"
itemprop="url">
<?php echo $label; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php if ($this->params->get('presentation_style') ===
'sliders') : ?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php endif; ?>
<?php if ($this->params->get('presentation_style') ===
'tabs') : ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
PKTF�[�1�UU2com_contact/views/contact/tmpl/default_profile.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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;
?>
<?php if (JPluginHelper::isEnabled('user',
'profile')) :
$fields = $this->item->profile->getFieldset('profile');
?>
<div class="contact-profile"
id="users-profile-custom">
<dl class="dl-horizontal">
<?php foreach ($fields as $profile) :
if ($profile->value) :
echo '<dt>' . $profile->label .
'</dt>';
$profile->text = htmlspecialchars($profile->value, ENT_COMPAT,
'UTF-8');
switch ($profile->id) :
case 'profile_website':
$v_http = substr($profile->value, 0, 4);
if ($v_http === 'http') :
echo '<dd><a href="' . $profile->text .
'">' . JStringPunycode::urlToUTF8($profile->text) .
'</a></dd>';
else :
echo '<dd><a href="http://' .
$profile->text . '">' .
JStringPunycode::urlToUTF8($profile->text) .
'</a></dd>';
endif;
break;
case 'profile_dob':
echo '<dd>' . JHtml::_('date',
$profile->text, JText::_('DATE_FORMAT_LC4'), false) .
'</dd>';
break;
default:
echo '<dd>' . $profile->text .
'</dd>';
break;
endswitch;
endif;
endforeach; ?>
</dl>
</div>
<?php endif; ?>
PKTF�[�f�C
=com_contact/views/contact/tmpl/default_user_custom_fields.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
$params = $this->item->params;
$presentation_style = $params->get('presentation_style');
$displayGroups = $params->get('show_user_custom_fields');
$userFieldGroups = array();
?>
<?php if (!$displayGroups || !$this->contactUser) : ?>
<?php return; ?>
<?php endif; ?>
<?php foreach ($this->contactUser->jcfields as $field) : ?>
<?php if (!in_array('-1', $displayGroups) &&
(!$field->group_id || !in_array($field->group_id, $displayGroups))) :
?>
<?php continue; ?>
<?php endif; ?>
<?php if (!key_exists($field->group_title, $userFieldGroups)) :
?>
<?php $userFieldGroups[$field->group_title] = array(); ?>
<?php endif; ?>
<?php $userFieldGroups[$field->group_title][] = $field; ?>
<?php endforeach; ?>
<?php foreach ($userFieldGroups as $groupTitle => $fields) : ?>
<?php $id = JApplicationHelper::stringURLSafe($groupTitle); ?>
<?php if ($presentation_style == 'sliders') : ?>
<?php echo JHtml::_('bootstrap.addSlide',
'slide-contact', $groupTitle ?:
JText::_('COM_CONTACT_USER_FIELDS'), 'display-' . $id);
?>
<?php elseif ($presentation_style == 'tabs') : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'display-' . $id, $groupTitle ?:
JText::_('COM_CONTACT_USER_FIELDS')); ?>
<?php elseif ($presentation_style == 'plain') : ?>
<?php echo '<h3>' . ($groupTitle ?:
JText::_('COM_CONTACT_USER_FIELDS')) . '</h3>';
?>
<?php endif; ?>
<div class="contact-profile"
id="user-custom-fields-<?php echo $id; ?>">
<dl class="dl-horizontal">
<?php foreach ($fields as $field) : ?>
<?php if (!$field->value) : ?>
<?php continue; ?>
<?php endif; ?>
<?php if ($field->params->get('showlabel')) : ?>
<?php echo '<dt>' . JText::_($field->label) .
'</dt>'; ?>
<?php endif; ?>
<?php echo '<dd>' . $field->value .
'</dd>'; ?>
<?php endforeach; ?>
</dl>
</div>
<?php if ($presentation_style == 'sliders') : ?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php elseif ($presentation_style == 'tabs') : ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php endforeach; ?>
PKTF�[�f��J9J9'com_contact/views/contact/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML Contact View class for the Contact component
*
* @since 1.5
*/
class ContactViewContact extends JViewLegacy
{
/**
* The item model state
*
* @var \Joomla\Registry\Registry
* @since 1.6
*/
protected $state;
/**
* The form object for the contact item
*
* @var JForm
* @since 1.6
*/
protected $form;
/**
* The item object details
*
* @var JObject
* @since 1.6
*/
protected $item;
/**
* The page to return to on submission
*
* @var string
* @since 1.6
* @deprecated 4.0 Variable not used
*/
protected $return_page;
/**
* Should we show a captcha form for the submission of the contact
request?
*
* @var bool
* @since 3.6.3
*/
protected $captchaEnabled = false;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
$item = $this->get('Item');
$state = $this->get('State');
$contacts = array();
// Get submitted values
$data = $app->getUserState('com_contact.contact.data',
array());
// Add catid for selecting custom fields
$data['catid'] = $item->catid;
$app->setUserState('com_contact.contact.data', $data);
$this->form = $this->get('Form');
$params = $state->get('params');
$temp = clone $params;
$active = $app->getMenu()->getActive();
if ($active)
{
// If the current view is the active item and a contact view for this
contact, then the menu item params take priority
if (strpos($active->link, 'view=contact') &&
strpos($active->link, '&id=' . (int) $item->id))
{
// $item->params are the contact params, $temp are the menu item
params
// Merge so that the menu item params take priority
$item->params->merge($temp);
}
else
{
// Current view is not a single contact, so the contact params take
priority here
// Merge the menu item params with the contact params so that the
contact params take priority
$temp->merge($item->params);
$item->params = $temp;
}
}
else
{
// Merge so that contact params take priority
$temp->merge($item->params);
$item->params = $temp;
}
// Collect extra contact information when this information is required
if ($item &&
$item->params->get('show_contact_list'))
{
// Get Category Model data
$categoryModel = JModelLegacy::getInstance('Category',
'ContactModel', array('ignore_request' => true));
$categoryModel->setState('category.id', $item->catid);
$categoryModel->setState('list.ordering',
'a.name');
$categoryModel->setState('list.direction',
'asc');
$categoryModel->setState('filter.published', 1);
$contacts = $categoryModel->getItems();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
// Check if access is not public
$groups = $user->getAuthorisedViewLevels();
$return = '';
if ((!in_array($item->access, $groups)) ||
(!in_array($item->category_access, $groups)))
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
$app->setHeader('status', 403, true);
return false;
}
$options['category_id'] = $item->catid;
$options['order by'] = 'a.default_con DESC, a.ordering
ASC';
/**
* Handle email cloaking
*
* Keep a copy of the raw email address so it can
* still be accessed in the layout if needed.
*/
$item->email_raw = $item->email_to;
if ($item->email_to &&
$item->params->get('show_email'))
{
$item->email_to = JHtml::_('email.cloak',
$item->email_to, (bool)
$item->params->get('add_mailto_link', true));
}
if ($item->params->get('show_street_address') ||
$item->params->get('show_suburb') ||
$item->params->get('show_state')
|| $item->params->get('show_postcode') ||
$item->params->get('show_country'))
{
if (!empty($item->address) || !empty($item->suburb) ||
!empty($item->state) || !empty($item->country) ||
!empty($item->postcode))
{
$item->params->set('address_check', 1);
}
}
else
{
$item->params->set('address_check', 0);
}
// Manage the display mode for contact detail groups
switch ($item->params->get('contact_icons'))
{
case 1 :
// Text
$item->params->set('marker_address',
JText::_('COM_CONTACT_ADDRESS') . ': ');
$item->params->set('marker_email',
JText::_('JGLOBAL_EMAIL') . ': ');
$item->params->set('marker_telephone',
JText::_('COM_CONTACT_TELEPHONE') . ': ');
$item->params->set('marker_fax',
JText::_('COM_CONTACT_FAX') . ': ');
$item->params->set('marker_mobile',
JText::_('COM_CONTACT_MOBILE') . ': ');
$item->params->set('marker_webpage',
JText::_('COM_CONTACT_WEBPAGE') . ': ');
$item->params->set('marker_misc',
JText::_('COM_CONTACT_OTHER_INFORMATION') . ': ');
$item->params->set('marker_class',
'jicons-text');
break;
case 2 :
// None
$item->params->set('marker_address', '');
$item->params->set('marker_email', '');
$item->params->set('marker_telephone', '');
$item->params->set('marker_mobile', '');
$item->params->set('marker_webpage', '');
$item->params->set('marker_fax', '');
$item->params->set('marker_misc', '');
$item->params->set('marker_class',
'jicons-none');
break;
default :
if ($item->params->get('icon_address'))
{
$image1 = JHtml::_('image',
$item->params->get('icon_address',
'con_address.png'), JText::_('COM_CONTACT_ADDRESS') .
': ', null, false);
}
else
{
$image1 = JHtml::_(
'image', 'contacts/' .
$item->params->get('icon_address',
'con_address.png'), JText::_('COM_CONTACT_ADDRESS') .
': ', null, true
);
}
if ($item->params->get('icon_email'))
{
$image2 = JHtml::_('image',
$item->params->get('icon_email',
'emailButton.png'), JText::_('JGLOBAL_EMAIL') . ':
', null, false);
}
else
{
$image2 = JHtml::_('image', 'contacts/' .
$item->params->get('icon_email',
'emailButton.png'), JText::_('JGLOBAL_EMAIL') . ':
', null, true);
}
if ($item->params->get('icon_telephone'))
{
$image3 = JHtml::_('image',
$item->params->get('icon_telephone',
'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE') .
': ', null, false);
}
else
{
$image3 = JHtml::_(
'image', 'contacts/' .
$item->params->get('icon_telephone',
'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE') .
': ', null, true
);
}
if ($item->params->get('icon_fax'))
{
$image4 = JHtml::_('image',
$item->params->get('icon_fax', 'con_fax.png'),
JText::_('COM_CONTACT_FAX') . ': ', null, false);
}
else
{
$image4 = JHtml::_('image', 'contacts/' .
$item->params->get('icon_fax', 'con_fax.png'),
JText::_('COM_CONTACT_FAX') . ': ', null, true);
}
if ($item->params->get('icon_misc'))
{
$image5 = JHtml::_('image',
$item->params->get('icon_misc', 'con_info.png'),
JText::_('COM_CONTACT_OTHER_INFORMATION') . ': ', null,
false);
}
else
{
$image5 = JHtml::_(
'image',
'contacts/' .
$item->params->get('icon_misc', 'con_info.png'),
JText::_('COM_CONTACT_OTHER_INFORMATION') . ': ',
null, true
);
}
if ($item->params->get('icon_mobile'))
{
$image6 = JHtml::_('image',
$item->params->get('icon_mobile',
'con_mobile.png'), JText::_('COM_CONTACT_MOBILE') .
': ', null, false);
}
else
{
$image6 = JHtml::_(
'image', 'contacts/' .
$item->params->get('icon_mobile',
'con_mobile.png'), JText::_('COM_CONTACT_MOBILE') .
': ', null, true
);
}
$item->params->set('marker_address', $image1);
$item->params->set('marker_email', $image2);
$item->params->set('marker_telephone', $image3);
$item->params->set('marker_fax', $image4);
$item->params->set('marker_misc', $image5);
$item->params->set('marker_mobile', $image6);
$item->params->set('marker_webpage', ' ');
$item->params->set('marker_class',
'jicons-icons');
break;
}
// Add links to contacts
if ($item->params->get('show_contact_list') &&
count($contacts) > 1)
{
foreach ($contacts as &$contact)
{
$contact->link =
JRoute::_(ContactHelperRoute::getContactRoute($contact->slug,
$contact->catid), false);
}
$item->link =
JRoute::_(ContactHelperRoute::getContactRoute($item->slug,
$item->catid), false);
}
// Process the content plugins
JPluginHelper::importPlugin('content');
$dispatcher = JEventDispatcher::getInstance();
$offset = $state->get('list.offset');
// Fix for where some plugins require a text attribute
$item->text = null;
if (!empty($item->misc))
{
$item->text = $item->misc;
}
$dispatcher->trigger('onContentPrepare',
array('com_contact.contact', &$item, &$item->params,
$offset));
// Store the events for later
$item->event = new stdClass;
$results = $dispatcher->trigger('onContentAfterTitle',
array('com_contact.contact', &$item, &$item->params,
$offset));
$item->event->afterDisplayTitle = trim(implode("\n",
$results));
$results = $dispatcher->trigger('onContentBeforeDisplay',
array('com_contact.contact', &$item, &$item->params,
$offset));
$item->event->beforeDisplayContent = trim(implode("\n",
$results));
$results = $dispatcher->trigger('onContentAfterDisplay',
array('com_contact.contact', &$item, &$item->params,
$offset));
$item->event->afterDisplayContent = trim(implode("\n",
$results));
if (!empty($item->text))
{
$item->misc = $item->text;
}
$contactUser = null;
if ($item->params->get('show_user_custom_fields')
&& $item->user_id && $contactUser =
JFactory::getUser($item->user_id))
{
$contactUser->text = '';
JEventDispatcher::getInstance()->trigger('onContentPrepare',
array ('com_users.user', &$contactUser,
&$item->params, 0));
if (!isset($contactUser->jcfields))
{
$contactUser->jcfields = array();
}
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($item->params->get('pageclass_sfx',
''));
$this->contact = &$item;
$this->params = &$item->params;
$this->return = &$return;
$this->state = &$state;
$this->item = &$item;
$this->user = &$user;
$this->contacts = &$contacts;
$this->contactUser = $contactUser;
// Override the layout only if this is not the active menu item
// If it is the active menu item, then the view and item id will match
if ((!$active) || ((strpos($active->link, 'view=contact')
=== false) || (strpos($active->link, '&id=' . (string)
$this->item->id) === false)))
{
if (($layout = $item->params->get('contact_layout')))
{
$this->setLayout($layout);
}
}
elseif (isset($active->query['layout']))
{
// We need to set the layout in case this is an alternative menu item
(with an alternative layout)
$this->setLayout($active->query['layout']);
}
$model = $this->getModel();
$model->hit();
$captchaSet = $item->params->get('captcha',
JFactory::getApplication()->get('captcha', '0'));
foreach (JPluginHelper::getPlugin('captcha') as $plugin)
{
if ($captchaSet === $plugin->name)
{
$this->captchaEnabled = true;
break;
}
}
$this->_prepareDocument();
return parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*
* @since 1.6
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$pathway = $app->getPathway();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_CONTACT_DEFAULT_PAGE_TITLE'));
}
$title = $this->params->get('page_title', '');
$id = (int) @$menu->query['id'];
// If the menu item does not concern this contact
if ($menu && (!isset($menu->query['option']) ||
$menu->query['option'] !== 'com_contact' ||
$menu->query['view'] !== 'contact'
|| $id != $this->item->id))
{
// If this is not a single contact menu item, set the page title to the
contact title
if ($this->item->name)
{
$title = $this->item->name;
}
$path = array(array('title' => $this->contact->name,
'link' => ''));
$category =
JCategories::getInstance('Contact')->get($this->contact->catid);
while ($category && (!isset($menu->query['option'])
|| $menu->query['option'] !== 'com_contact' ||
$menu->query['view'] === 'contact'
|| $id != $category->id) && $category->id > 1)
{
$path[] = array('title' => $category->title,
'link' =>
ContactHelperRoute::getCategoryRoute($this->contact->catid));
$category = $category->getParent();
}
$path = array_reverse($path);
foreach ($path as $item)
{
$pathway->addItem($item['title'],
$item['link']);
}
}
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
if (empty($title))
{
$title = $this->item->name;
}
$this->document->setTitle($title);
if ($this->item->metadesc)
{
$this->document->setDescription($this->item->metadesc);
}
elseif ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->item->metakey)
{
$this->document->setMetadata('keywords',
$this->item->metakey);
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
$mdata = $this->item->metadata->toArray();
foreach ($mdata as $k => $v)
{
if ($v)
{
$this->document->setMetadata($k, $v);
}
}
}
}
PKUF�[%)�5��&com_contact/views/contact/view.vcf.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2010 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 create a VCF for a contact item
*
* @since 1.6
*/
class ContactViewContact extends JViewLegacy
{
/**
* The item model state
*
* @var \Joomla\Registry\Registry
* @deprecated 4.0 Variable not used
*/
protected $state;
/**
* The contact item
*
* @var JObject
*/
protected $item;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
// Get model data.
$item = $this->get('Item');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
JFactory::getDocument()->setMimeEncoding('text/directory',
true);
// Compute lastname, firstname and middlename
$item->name = trim($item->name);
// "Lastname, Firstname Midlename" format support
// e.g. "de Gaulle, Charles"
$namearray = explode(',', $item->name);
if (count($namearray) > 1)
{
$lastname = $namearray[0];
$card_name = $lastname;
$name_and_midname = trim($namearray[1]);
$firstname = '';
if (!empty($name_and_midname))
{
$namearray = explode(' ', $name_and_midname);
$firstname = $namearray[0];
$middlename = (count($namearray) > 1) ? $namearray[1] :
'';
$card_name = $firstname . ' ' . ($middlename ? $middlename .
' ' : '') . $card_name;
}
}
// "Firstname Middlename Lastname" format support
else
{
$namearray = explode(' ', $item->name);
$middlename = (count($namearray) > 2) ? $namearray[1] : '';
$firstname = array_shift($namearray);
$lastname = count($namearray) ? end($namearray) : '';
$card_name = $firstname . ($middlename ? ' ' . $middlename :
'') . ($lastname ? ' ' . $lastname : '');
}
$rev = date('c', strtotime($item->modified));
JFactory::getApplication()->setHeader('Content-disposition',
'attachment; filename="' . $card_name .
'.vcf"', true);
$vcard = array();
$vcard[] .= 'BEGIN:VCARD';
$vcard[] .= 'VERSION:3.0';
$vcard[] = 'N:' . $lastname . ';' . $firstname .
';' . $middlename;
$vcard[] = 'FN:' . $item->name;
$vcard[] = 'TITLE:' . $item->con_position;
$vcard[] = 'TEL;TYPE=WORK,VOICE:' . $item->telephone;
$vcard[] = 'TEL;TYPE=WORK,FAX:' . $item->fax;
$vcard[] = 'TEL;TYPE=WORK,MOBILE:' . $item->mobile;
$vcard[] = 'ADR;TYPE=WORK:;;' . $item->address .
';' . $item->suburb . ';' . $item->state .
';' . $item->postcode . ';' . $item->country;
$vcard[] = 'LABEL;TYPE=WORK:' . $item->address .
"\n" . $item->suburb . "\n" . $item->state .
"\n" . $item->postcode . "\n" . $item->country;
$vcard[] = 'EMAIL;TYPE=PREF,INTERNET:' . $item->email_to;
$vcard[] = 'URL:' . $item->webpage;
$vcard[] = 'REV:' . $rev . 'Z';
$vcard[] = 'END:VCARD';
echo implode("\n", $vcard);
}
}
PKUF�[��:�mm+com_contact/views/featured/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2010 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');
// If the page class is defined, add to class as suffix.
// It will be a separate class if the user starts it with a space
?>
<div class="blog-featured<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading') != 0 )
: ?>
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php echo $this->loadTemplate('items'); ?>
<?php if ($this->params->def('show_pagination', 2) == 1
|| ($this->params->get('show_pagination') == 2 &&
$this->pagination->pagesTotal > 1)) : ?>
<div class="pagination">
<?php if
($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
</div>
PKUF�[hw�П4�4+com_contact/views/featured/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTACT_FEATURED_VIEW_DEFAULT_TITLE"
option="COM_CONTACT_FEATURED_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_CONTACT_FEATURED"
/>
<message>
<![CDATA[COM_CONTACT_FEATURED_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="advanced"
label="JGLOBAL_LIST_LAYOUT_OPTIONS">
<field
name="spacer"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
description="JGLOBAL_SHOW_HEADINGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_position_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_POSITION_LABEL"
description="COM_CONTACT_FIELD_CONFIG_POSITION_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_headings"
type="list"
label="JGLOBAL_EMAIL"
description="COM_CONTACT_FIELD_CONFIG_EMAIL_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_telephone_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_PHONE_LABEL"
description="COM_CONTACT_FIELD_CONFIG_PHONE_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_mobile_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_MOBILE_LABEL"
description="COM_CONTACT_FIELD_CONFIG_MOBILE_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_fax_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_FAX_LABEL"
description="COM_CONTACT_FIELD_CONFIG_FAX_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_suburb_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_SUBURB_LABEL"
description="COM_CONTACT_FIELD_CONFIG_SUBURB_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_state_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_STATE_LABEL"
description="COM_CONTACT_FIELD_CONFIG_STATE_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_country_headings"
type="list"
label="COM_CONTACT_FIELD_CONFIG_COUNTRY_LABEL"
description="COM_CONTACT_FIELD_CONFIG_COUNTRY_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="contact"
label="COM_CONTACT_FIELDSET_CONTACT_LABEL">
<field
name="presentation_style"
type="list"
label="COM_CONTACT_FIELD_PRESENTATION_LABEL"
description="COM_CONTACT_FIELD_PRESENTATION_DESC"
useglobal="true"
>
<option
value="sliders">COM_CONTACT_FIELD_VALUE_SLIDERS</option>
<option
value="tabs">COM_CONTACT_FIELD_VALUE_TABS</option>
<option
value="plain">COM_CONTACT_FIELD_VALUE_PLAIN</option>
</field>
<field
name="show_tags"
type="list"
label="COM_CONTACT_FIELD_SHOW_TAGS_LABEL"
description="COM_CONTACT_FIELD_SHOW_TAGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_info"
type="list"
label="COM_CONTACT_FIELD_SHOW_INFO_LABEL"
description="COM_CONTACT_FIELD_SHOW_INFO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_name"
type="list"
label="COM_CONTACT_FIELD_PARAMS_NAME_LABEL"
description="COM_CONTACT_FIELD_PARAMS_NAME_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_position"
type="list"
label="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_LABEL"
description="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email"
type="list"
label="JGLOBAL_EMAIL"
description="COM_CONTACT_FIELD_PARAMS_CONTACT_E_MAIL_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_street_address"
type="list"
label="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_LABEL"
description="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_suburb"
type="list"
label="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_LABEL"
description="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_state"
type="list"
label="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_LABEL"
description="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_postcode"
type="list"
label="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_country"
type="list"
label="COM_CONTACT_FIELD_PARAMS_COUNTRY_LABEL"
description="COM_CONTACT_FIELD_PARAMS_COUNTRY_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_telephone"
type="list"
label="COM_CONTACT_FIELD_PARAMS_TELEPHONE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_TELEPHONE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_mobile"
type="list"
label="COM_CONTACT_FIELD_PARAMS_MOBILE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_MOBILE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_fax"
type="list"
label="COM_CONTACT_FIELD_PARAMS_FAX_LABEL"
description="COM_CONTACT_FIELD_PARAMS_FAX_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_webpage"
type="list"
label="COM_CONTACT_FIELD_PARAMS_WEBPAGE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_WEBPAGE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_image"
type="list"
label="COM_CONTACT_FIELD_PARAMS_IMAGE_LABEL"
description="COM_CONTACT_FIELD_PARAMS_IMAGE_DESC"
useglobal="true"
showon="show_info:1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="allow_vcard"
type="list"
label="COM_CONTACT_FIELD_PARAMS_VCARD_LABEL"
description="COM_CONTACT_FIELD_PARAMS_VCARD_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_misc"
type="list"
label="COM_CONTACT_FIELD_PARAMS_MISC_INFO_LABEL"
description="COM_CONTACT_FIELD_PARAMS_MISC_INFO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_articles"
type="list"
label="COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL"
description="COM_CONTACT_FIELD_ARTICLES_SHOW_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="articles_display_num"
type="list"
label="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_LABEL"
description="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_DESC"
default=""
useglobal="true"
>
<option
value="use_contact">COM_CONTACT_FIELD_VALUE_USE_CONTACT_SETTINGS</option>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="75">J75</option>
<option value="100">J100</option>
<option value="150">J150</option>
<option value="200">J200</option>
<option value="250">J250</option>
<option value="300">J300</option>
<option value="0">JALL</option>
</field>
<field
name="show_links"
type="list"
label="COM_CONTACT_FIELD_SHOW_LINKS_LABEL"
description="COM_CONTACT_FIELD_SHOW_LINKS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="linka_name"
type="text"
label="COM_CONTACT_FIELD_LINKA_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkb_name"
type="text"
label="COM_CONTACT_FIELD_LINKB_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkc_name"
type="text"
label="COM_CONTACT_FIELD_LINKC_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linkd_name"
type="text"
label="COM_CONTACT_FIELD_LINKD_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
<field
name="linke_name"
type="text"
label="COM_CONTACT_FIELD_LINKE_NAME_LABEL"
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
size="30"
useglobal="true"
/>
</fieldset>
<fieldset name="Contact_Form"
label="COM_CONTACT_FIELDSET_CONTACTFORM_LABEL">
<field
name="show_email_form"
type="list"
label="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL"
description="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_copy"
type="list"
label="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL"
description="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="validate_session"
type="list"
label="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_LABEL"
description="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="custom_reply"
type="list"
label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL"
description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="redirect"
type="text"
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
size="30"
useglobal="true"
/>
</fieldset>
</fields>
</metadata>
PKUF�[���a��1com_contact/views/featured/tmpl/default_items.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2010 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.core');
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn =
$this->escape($this->state->get('list.direction'));
?>
<?php if (empty($this->items)) : ?>
<p> <?php echo JText::_('COM_CONTACT_NO_CONTACTS');
?> </p>
<?php else : ?>
<form action="<?php echo
htmlspecialchars(JUri::getInstance()->toString()); ?>"
method="post" name="adminForm"
id="adminForm">
<fieldset class="filters">
<legend class="hidelabeltxt"><?php echo
JText::_('JGLOBAL_FILTER_LABEL'); ?></legend>
<?php if ($this->params->get('show_pagination_limit'))
: ?>
<div class="display-limit">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?> 
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
<input type="hidden" name="filter_order"
value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir"
value="<?php echo $listDirn; ?>" />
</fieldset>
<table class="category">
<?php if ($this->params->get('show_headings')) : ?>
<thead><tr>
<th class="item-num">
<?php echo JText::_('JGLOBAL_NUM'); ?>
</th>
<th class="item-title">
<?php echo JHtml::_('grid.sort',
'COM_CONTACT_CONTACT_EMAIL_NAME_LABEL', 'a.name',
$listDirn, $listOrder); ?>
</th>
<?php if
($this->params->get('show_position_headings')) : ?>
<th class="item-position">
<?php echo JHtml::_('grid.sort',
'COM_CONTACT_POSITION', 'a.con_position', $listDirn,
$listOrder); ?>
</th>
<?php endif; ?>
<?php if ($this->params->get('show_email_headings'))
: ?>
<th class="item-email">
<?php echo JText::_('JGLOBAL_EMAIL'); ?>
</th>
<?php endif; ?>
<?php if
($this->params->get('show_telephone_headings')) : ?>
<th class="item-phone">
<?php echo JText::_('COM_CONTACT_TELEPHONE'); ?>
</th>
<?php endif; ?>
<?php if ($this->params->get('show_mobile_headings'))
: ?>
<th class="item-phone">
<?php echo JText::_('COM_CONTACT_MOBILE'); ?>
</th>
<?php endif; ?>
<?php if ($this->params->get('show_fax_headings')) :
?>
<th class="item-phone">
<?php echo JText::_('COM_CONTACT_FAX'); ?>
</th>
<?php endif; ?>
<?php if ($this->params->get('show_suburb_headings'))
: ?>
<th class="item-suburb">
<?php echo JHtml::_('grid.sort',
'COM_CONTACT_SUBURB', 'a.suburb', $listDirn,
$listOrder); ?>
</th>
<?php endif; ?>
<?php if ($this->params->get('show_state_headings'))
: ?>
<th class="item-state">
<?php echo JHtml::_('grid.sort',
'COM_CONTACT_STATE', 'a.state', $listDirn, $listOrder);
?>
</th>
<?php endif; ?>
<?php if
($this->params->get('show_country_headings')) : ?>
<th class="item-state">
<?php echo JHtml::_('grid.sort',
'COM_CONTACT_COUNTRY', 'a.country', $listDirn,
$listOrder); ?>
</th>
<?php endif; ?>
</tr>
</thead>
<?php endif; ?>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<tr class="<?php echo ($i % 2) ? 'odd' :
'even'; ?>" itemscope
itemtype="https://schema.org/Person">
<td class="item-num">
<?php echo $i; ?>
</td>
<td class="item-title">
<?php if ($this->items[$i]->published == 0) : ?>
<span class="label label-warning"><?php echo
JText::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<a href="<?php echo
JRoute::_(ContactHelperRoute::getContactRoute($item->slug,
$item->catid)); ?>" itemprop="url">
<span itemprop="name"><?php echo $item->name;
?></span>
</a>
</td>
<?php if
($this->params->get('show_position_headings')) : ?>
<td class="item-position"
itemprop="jobTitle">
<?php echo $item->con_position; ?>
</td>
<?php endif; ?>
<?php if
($this->params->get('show_email_headings')) : ?>
<td class="item-email" itemprop="email">
<?php echo $item->email_to; ?>
</td>
<?php endif; ?>
<?php if
($this->params->get('show_telephone_headings')) : ?>
<td class="item-phone"
itemprop="telephone">
<?php echo $item->telephone; ?>
</td>
<?php endif; ?>
<?php if
($this->params->get('show_mobile_headings')) : ?>
<td class="item-phone"
itemprop="telephone">
<?php echo $item->mobile; ?>
</td>
<?php endif; ?>
<?php if ($this->params->get('show_fax_headings'))
: ?>
<td class="item-phone"
itemprop="faxNumber">
<?php echo $item->fax; ?>
</td>
<?php endif; ?>
<?php if
($this->params->get('show_suburb_headings')) : ?>
<td class="item-suburb" itemprop="address"
itemscope itemtype="https://schema.org/PostalAddress">
<span itemprop="addressLocality"><?php echo
$item->suburb; ?></span>
</td>
<?php endif; ?>
<?php if
($this->params->get('show_state_headings')) : ?>
<td class="item-state" itemprop="address"
itemscope itemtype="https://schema.org/PostalAddress">
<span itemprop="addressRegion"><?php echo
$item->state; ?></span>
</td>
<?php endif; ?>
<?php if
($this->params->get('show_country_headings')) : ?>
<td class="item-state" itemprop="address"
itemscope itemtype="https://schema.org/PostalAddress">
<span itemprop="addressCountry"><?php echo
$item->country; ?></span>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</form>
<?php endif; ?>
PKUF�[ܫFH��(com_contact/views/featured/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2010 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;
/**
* Featured View class
*
* @since 1.6
*/
class ContactViewFeatured extends JViewLegacy
{
/**
* The item model state
*
* @var \Joomla\Registry\Registry
* @since 1.6.0
*/
protected $state;
/**
* The item details
*
* @var JObject
* @since 1.6.0
*/
protected $items;
/**
* Who knows what this variable was intended for - but it's never
been used
*
* @var array
* @since 1.6.0
* @deprecated 4.0 This variable has been null since 1.6.0-beta8
*/
protected $category;
/**
* Who knows what this variable was intended for - but it's never
been used
*
* @var JObject Maybe.
* @since 1.6.0
* @deprecated 4.0 This variable has never been used ever
*/
protected $categories;
/**
* The pagination object
*
* @var JPagination
* @since 1.6.0
*/
protected $pagination;
/**
* Method to display the view.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed Exception on failure, void on success.
*
* @since 1.6
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$params = $app->getParams();
// Get some data from the models
$state = $this->get('State');
$items = $this->get('Items');
$category = $this->get('Category');
$children = $this->get('Children');
$parent = $this->get('Parent');
$pagination = $this->get('Pagination');
// Flag indicates to not add limitstart=0 to URL
$pagination->hideEmptyLimitstart = true;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
// Prepare the data.
// Compute the contact slug.
for ($i = 0, $n = count($items); $i < $n; $i++)
{
$item = &$items[$i];
$item->slug = $item->alias ? ($item->id . ':' .
$item->alias) : $item->id;
$temp = $item->params;
$item->params = clone $params;
$item->params->merge($temp);
if ($item->params->get('show_email', 0) == 1)
{
$item->email_to = trim($item->email_to);
if (!empty($item->email_to) &&
JMailHelper::isEmailAddress($item->email_to))
{
$item->email_to = JHtml::_('email.cloak',
$item->email_to);
}
else
{
$item->email_to = '';
}
}
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($params->get('pageclass_sfx', ''),
ENT_COMPAT, 'UTF-8');
$maxLevel = $params->get('maxLevel', -1);
$this->maxLevel = &$maxLevel;
$this->state = &$state;
$this->items = &$items;
$this->category = &$category;
$this->children = &$children;
$this->params = &$params;
$this->parent = &$parent;
$this->pagination = &$pagination;
$this->_prepareDocument();
return parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*
* @since 1.6
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_CONTACT_DEFAULT_PAGE_TITLE'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
}
PKWF�[�C�r``com_content/content.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2005 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('ContentHelperRoute', JPATH_SITE .
'/components/com_content/helpers/route.php');
JLoader::register('ContentHelperQuery', JPATH_SITE .
'/components/com_content/helpers/query.php');
JLoader::register('ContentHelperAssociation', JPATH_SITE .
'/components/com_content/helpers/association.php');
$input = JFactory::getApplication()->input;
$user = JFactory::getUser();
$checkCreateEdit = ($input->get('view') ===
'articles' && $input->get('layout') ===
'modal')
|| ($input->get('view') === 'article' &&
$input->get('layout') === 'pagebreak');
if ($checkCreateEdit)
{
// Can create in any category (component permission) or at least in one
category
$canCreateRecords = $user->authorise('core.create',
'com_content')
|| count($user->getAuthorisedCategories('com_content',
'core.create')) > 0;
// Instead of checking edit on all records, we can use **same** check as
the form editing view
$values = (array)
JFactory::getApplication()->getUserState('com_content.edit.article.id');
$isEditingRecords = count($values);
$hasAccess = $canCreateRecords || $isEditingRecords;
if (!$hasAccess)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'warning');
return;
}
}
$controller = JControllerLegacy::getInstance('Content');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
PKWF�[:tӁ
com_content/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Component\ComponentHelper;
/**
* Content Component Controller
*
* @since 1.5
*/
class ContentController extends JControllerLegacy
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
* Recognized key values include 'name',
'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
*
* @since 3.0.1
*/
public function __construct($config = array())
{
$this->input = JFactory::getApplication()->input;
// Article frontpage Editor pagebreak proxying:
if ($this->input->get('view') === 'article'
&& $this->input->get('layout') ===
'pagebreak')
{
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}
// Article frontpage Editor article proxying:
elseif ($this->input->get('view') ===
'articles' && $this->input->get('layout')
=== 'modal')
{
JHtml::_('stylesheet', 'system/adminlist.css',
array('version' => 'auto', 'relative'
=> true));
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}
parent::__construct($config);
}
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached.
* @param boolean $urlparams An array of safe URL parameters and their
variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
$cachable = true;
/**
* Set the default view name and format from the Request.
* Note we are using a_id to avoid collisions with the router and the
return page.
* Frontend is a bit messier than the backend.
*/
$id = $this->input->getInt('a_id');
$vName = $this->input->getCmd('view',
'categories');
$this->input->set('view', $vName);
$user = JFactory::getUser();
if ($user->get('id')
|| ($this->input->getMethod() === 'POST'
&& (($vName === 'category' &&
$this->input->get('layout') !== 'blog') || $vName
=== 'archive' )))
{
$cachable = false;
}
$safeurlparams = array(
'catid' => 'INT',
'id' => 'INT',
'cid' => 'ARRAY',
'year' => 'INT',
'month' => 'INT',
'limit' => 'UINT',
'limitstart' => 'UINT',
'showall' => 'INT',
'return' => 'BASE64',
'filter' => 'STRING',
'filter_order' => 'CMD',
'filter_order_Dir' => 'CMD',
'filter-search' => 'STRING',
'print' => 'BOOLEAN',
'lang' => 'CMD',
'Itemid' => 'INT');
// Check for edit form.
if ($vName === 'form' &&
!$this->checkEditId('com_content.edit.article', $id))
{
// Somehow the person just went to the form - we don't allow that.
return JError::raiseError(403,
JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
}
if ($vName === 'article')
{
// Get/Create the model
if ($model = $this->getModel($vName))
{
if
(ComponentHelper::getParams('com_content')->get('record_hits',
1) == 1)
{
$model->hit();
}
}
}
parent::display($cachable, $safeurlparams);
return $this;
}
}
PKWF�[��2�M'M'#com_content/controllers/article.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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;
/**
* Content article class.
*
* @since 1.6.0
*/
class ContentControllerArticle extends JControllerForm
{
/**
* The URL view item variable.
*
* @var string
* @since 1.6
*/
protected $view_item = 'form';
/**
* The URL view list variable.
*
* @var string
* @since 1.6
*/
protected $view_list = 'categories';
/**
* The URL edit variable.
*
* @var string
* @since 3.2
*/
protected $urlVar = 'a.id';
/**
* Method to add a new record.
*
* @return mixed True if the record can be added, an error object if
not.
*
* @since 1.6
*/
public function add()
{
if (!parent::add())
{
// Redirect to the return page.
$this->setRedirect($this->getReturnPage());
return;
}
// Redirect to the edit screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option .
'&view=' . $this->view_item . '&a_id=0'
. $this->getRedirectToItemAppend(), false
)
);
return true;
}
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 1.6
*/
protected function allowAdd($data = array())
{
$user = JFactory::getUser();
$categoryId = ArrayHelper::getValue($data, 'catid',
$this->input->getInt('catid'), 'int');
$allow = null;
if ($categoryId)
{
// If the category has been passed in the data or URL check it.
$allow = $user->authorise('core.create',
'com_content.category.' . $categoryId);
}
if ($allow === null)
{
// In the absence of better information, revert to the component
permissions.
return parent::allowAdd();
}
else
{
return $allow;
}
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key;
default is id.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = array(), $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$user = JFactory::getUser();
// Zero record (id:0), return component edit permission by calling parent
controller method
if (!$recordId)
{
return parent::allowEdit($data, $key);
}
// Check edit on the record asset (explicit or inherited)
if ($user->authorise('core.edit',
'com_content.article.' . $recordId))
{
return true;
}
// Check edit own on the record asset (explicit or inherited)
if ($user->authorise('core.edit.own',
'com_content.article.' . $recordId))
{
// Existing record already has an owner, get it
$record = $this->getModel()->getItem($recordId);
if (empty($record))
{
return false;
}
// Grant if current user is owner of the record
return $user->get('id') == $record->created_by;
}
return false;
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 1.6
*/
public function cancel($key = 'a_id')
{
parent::cancel($key);
$app = JFactory::getApplication();
// Load the parameters.
$params = $app->getParams();
$customCancelRedir = (bool)
$params->get('custom_cancel_redirect');
if ($customCancelRedir)
{
$cancelMenuitemId = (int)
$params->get('cancel_redirect_menuitem');
if ($cancelMenuitemId > 0)
{
$item = $app->getMenu()->getItem($cancelMenuitemId);
$lang = '';
if (JLanguageMultilang::isEnabled())
{
$lang = !is_null($item) && $item->language != '*'
? '&lang=' . $item->language : '';
}
// Redirect to the user specified return page.
$redirlink = $item->link . $lang . '&Itemid=' .
$cancelMenuitemId;
}
else
{
// Redirect to the same article submission form (clean form).
$redirlink = $app->getMenu()->getActive()->link .
'&Itemid=' . $app->getMenu()->getActive()->id;
}
}
else
{
$menuitemId = (int) $params->get('redirect_menuitem');
$lang = '';
if ($menuitemId > 0)
{
$lang = '';
$item = $app->getMenu()->getItem($menuitemId);
if (JLanguageMultilang::isEnabled())
{
$lang = !is_null($item) && $item->language != '*'
? '&lang=' . $item->language : '';
}
// Redirect to the general (redirect_menuitem) user specified return
page.
$redirlink = $item->link . $lang . '&Itemid=' .
$menuitemId;
}
else
{
// Redirect to the return page.
$redirlink = $this->getReturnPage();
}
}
$this->setRedirect(JRoute::_($redirlink, false));
}
/**
* Method to edit an existing record.
*
* @param string $key The name of the primary key of the URL
variable.
* @param string $urlVar The name of the URL variable if different
from the primary key
* (sometimes required to avoid router collisions).
*
* @return boolean True if access level check and checkout passes, false
otherwise.
*
* @since 1.6
*/
public function edit($key = null, $urlVar = 'a_id')
{
$result = parent::edit($key, $urlVar);
if (!$result)
{
$this->setRedirect(JRoute::_($this->getReturnPage(), false));
}
return $result;
}
/**
* 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.5
*/
public function getModel($name = 'form', $prefix = '',
$config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since 1.6
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar =
'a_id')
{
// Need to override the parent method completely.
$tmpl = $this->input->get('tmpl');
$append = '';
// Setup redirect info.
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
// TODO This is a bandaid, not a long term solution.
/**
* if ($layout)
* {
* $append .= '&layout=' . $layout;
* }
*/
$append .= '&layout=edit';
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
}
$itemId = $this->input->getInt('Itemid');
$return = $this->getReturnPage();
$catId = $this->input->getInt('catid');
if ($itemId)
{
$append .= '&Itemid=' . $itemId;
}
if ($catId)
{
$append .= '&catid=' . $catId;
}
if ($return)
{
$append .= '&return=' . base64_encode($return);
}
return $append;
}
/**
* Get the return URL.
*
* If a "return" variable has been passed in the request
*
* @return string The return URL.
*
* @since 1.6
*/
protected function getReturnPage()
{
$return = $this->input->get('return', null,
'base64');
if (empty($return) || !JUri::isInternal(base64_decode($return)))
{
return JUri::base();
}
else
{
return base64_decode($return);
}
}
/**
* Method to save a record.
*
* @param string $key The name of the primary key of the URL
variable.
* @param string $urlVar The name of the URL variable if different
from the primary key (sometimes required to avoid router collisions).
*
* @return boolean True if successful, false otherwise.
*
* @since 1.6
*/
public function save($key = null, $urlVar = 'a_id')
{
$result = parent::save($key, $urlVar);
$app = JFactory::getApplication();
$articleId = $app->input->getInt('a_id');
// Load the parameters.
$params = $app->getParams();
$menuitem = (int) $params->get('redirect_menuitem');
// Check for redirection after submission when creating a new article
only
if ($menuitem > 0 && $articleId == 0)
{
$lang = '';
if (JLanguageMultilang::isEnabled())
{
$item = $app->getMenu()->getItem($menuitem);
$lang = !is_null($item) && $item->language != '*'
? '&lang=' . $item->language : '';
}
// If ok, redirect to the return page.
if ($result)
{
$this->setRedirect(JRoute::_('index.php?Itemid=' .
$menuitem . $lang, false));
}
}
else
{
// If ok, redirect to the return page.
if ($result)
{
$this->setRedirect(JRoute::_($this->getReturnPage(), false));
}
}
return $result;
}
/**
* Method to reload a record.
*
* @param string $key The name of the primary key of the URL
variable.
* @param string $urlVar The name of the URL variable if different
from the primary key (sometimes required to avoid router collisions).
*
* @return void
*
* @since 3.8.0
*/
public function reload($key = null, $urlVar = 'a_id')
{
return parent::reload($key, $urlVar);
}
/**
* Method to save a vote.
*
* @return void
*
* @since 1.6
*/
public function vote()
{
// Check for request forgeries.
$this->checkToken();
$user_rating = $this->input->getInt('user_rating', -1);
if ($user_rating > -1)
{
$url = $this->input->getString('url', '');
$id = $this->input->getInt('id', 0);
$viewName = $this->input->getString('view',
$this->default_view);
$model = $this->getModel($viewName);
// Don't redirect to an external URL.
if (!JUri::isInternal($url))
{
$url = JRoute::_('index.php');
}
if ($model->storeVote($id, $user_rating))
{
$this->setRedirect($url,
JText::_('COM_CONTENT_ARTICLE_VOTE_SUCCESS'));
}
else
{
$this->setRedirect($url,
JText::_('COM_CONTENT_ARTICLE_VOTE_FAILURE'));
}
}
}
}
PKYF�[�����#com_content/helpers/association.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2012 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('ContentHelper', JPATH_ADMINISTRATOR .
'/components/com_content/helpers/content.php');
JLoader::register('ContentHelperRoute', JPATH_SITE .
'/components/com_content/helpers/route.php');
JLoader::register('CategoryHelperAssociation',
JPATH_ADMINISTRATOR .
'/components/com_categories/helpers/association.php');
/**
* Content Component Association Helper
*
* @since 3.0
*/
abstract class ContentHelperAssociation extends CategoryHelperAssociation
{
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
* @param string $layout View layout
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null, $layout =
null)
{
$jinput = JFactory::getApplication()->input;
$view = $view === null ? $jinput->get('view') : $view;
$component = $jinput->getCmd('option');
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($layout === null && $jinput->get('view') ==
$view && $component == 'com_content')
{
$layout = $jinput->get('layout', '',
'string');
}
if ($view === 'article')
{
if ($id)
{
$user = JFactory::getUser();
$groups = implode(',',
$user->getAuthorisedViewLevels());
$db = JFactory::getDbo();
$advClause = array();
// Filter by user groups
$advClause[] = 'c2.access IN (' . $groups . ')';
// Filter by current language
$advClause[] = 'c2.language != ' .
$db->quote(JFactory::getLanguage()->getTag());
if (!$user->authorise('core.edit.state',
'com_content') &&
!$user->authorise('core.edit', 'com_content'))
{
// Filter by start and end dates.
$nullDate = $db->quote($db->getNullDate());
$date = JFactory::getDate();
$nowDate = $db->quote($date->toSql());
$advClause[] = '(c2.publish_up = ' . $nullDate . ' OR
c2.publish_up <= ' . $nowDate . ')';
$advClause[] = '(c2.publish_down = ' . $nullDate . ' OR
c2.publish_down >= ' . $nowDate . ')';
// Filter by published
$advClause[] = 'c2.state = 1';
}
$associations =
JLanguageAssociations::getAssociations('com_content',
'#__content', 'com_content.item', $id, 'id',
'alias', 'catid', $advClause);
$return = array();
foreach ($associations as $tag => $item)
{
$return[$tag] = ContentHelperRoute::getArticleRoute($item->id,
(int) $item->catid, $item->language, $layout);
}
return $return;
}
}
if ($view === 'category' || $view === 'categories')
{
return self::getCategoryAssociations($id, 'com_content',
$layout);
}
return array();
}
/**
* Method to display in frontend the associations for a given article
*
* @param integer $id Id of the article
*
* @return array An array containing the association URL and the related
language object
*
* @since 3.7.0
*/
public static function displayAssociations($id)
{
$return = array();
if ($associations = self::getAssociations($id, 'article'))
{
$levels = JFactory::getUser()->getAuthorisedViewLevels();
$languages = JLanguageHelper::getLanguages();
foreach ($languages as $language)
{
// Do not display language when no association
if (empty($associations[$language->lang_code]))
{
continue;
}
// Do not display language without frontend UI
if (!array_key_exists($language->lang_code,
JLanguageHelper::getInstalledLanguages(0)))
{
continue;
}
// Do not display language without specific home menu
if (!array_key_exists($language->lang_code,
JLanguageMultilang::getSiteHomePages()))
{
continue;
}
// Do not display language without authorized access level
if (isset($language->access) && $language->access
&& !in_array($language->access, $levels))
{
continue;
}
$return[$language->lang_code] = array('item' =>
$associations[$language->lang_code], 'language' =>
$language);
}
}
return $return;
}
}
PKYF�[*��M}}
com_content/helpers/category.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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;
/**
* Content Component Category Tree
*
* @since 1.6
*/
class ContentCategories extends JCategories
{
/**
* Class constructor
*
* @param array $options Array of options
*
* @since 1.7.0
*/
public function __construct($options = array())
{
$options['table'] = '#__content';
$options['extension'] = 'com_content';
parent::__construct($options);
}
}
PKYF�[�o��com_content/helpers/icon.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2007 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;
/**
* Content Component HTML Helper
*
* @since 1.5
*/
abstract class JHtmlIcon
{
/**
* Method to generate a link to the create item page for the given
category
*
* @param object $category The category information
* @param Registry $params The item parameters
* @param array $attribs Optional attributes for the link
* @param boolean $legacy True to use legacy images, false to use
icomoon based graphic
*
* @return string The HTML markup for the create item link
*/
public static function create($category, $params, $attribs = array(),
$legacy = false)
{
$uri = JUri::getInstance();
$url =
'index.php?option=com_content&task=article.add&return=' .
base64_encode($uri) . '&a_id=0&catid=' .
$category->id;
$text = JLayoutHelper::render('joomla.content.icons.create',
array('params' => $params, 'legacy' => $legacy));
// Add the button classes to the attribs array
if (isset($attribs['class']))
{
$attribs['class'] .= ' btn btn-primary';
}
else
{
$attribs['class'] = 'btn btn-primary';
}
$button = JHtml::_('link', JRoute::_($url), $text, $attribs);
$output = '<span class="hasTooltip" title="'
. JHtml::_('tooltipText', 'COM_CONTENT_CREATE_ARTICLE')
. '">' . $button . '</span>';
return $output;
}
/**
* Method to generate a link to the email item page for the given article
*
* @param object $article The article information
* @param Registry $params The item parameters
* @param array $attribs Optional attributes for the link
* @param boolean $legacy True to use legacy images, false to use
icomoon based graphic
*
* @return string The HTML markup for the email item link
*
* @deprecated 4.0 The functionality to email an article is removed in
Joomla 4
*/
public static function email($article, $params, $attribs = array(),
$legacy = false)
{
JLoader::register('MailtoHelper', JPATH_SITE .
'/components/com_mailto/helpers/mailto.php');
$uri = JUri::getInstance();
$base = $uri->toString(array('scheme', 'host',
'port'));
$template = JFactory::getApplication()->getTemplate();
$link = $base .
JRoute::_(ContentHelperRoute::getArticleRoute($article->slug,
$article->catid, $article->language), false);
$url =
'index.php?option=com_mailto&tmpl=component&template=' .
$template . '&link=' . MailtoHelper::addLink($link);
$height = JFactory::getApplication()->get('captcha',
'0') === '0' ? 450 : 550;
$status = 'width=400,height=' . $height .
',menubar=yes,resizable=yes';
$text = JLayoutHelper::render('joomla.content.icons.email',
array('params' => $params, 'legacy' => $legacy));
$attribs['title'] =
JText::_('JGLOBAL_EMAIL_TITLE');
$attribs['onclick'] =
"window.open(this.href,'win2','" . $status .
"'); return false;";
$attribs['rel'] = 'nofollow';
return JHtml::_('link', JRoute::_($url), $text, $attribs);
}
/**
* Display an edit icon for the article.
*
* This icon will not display in a popup window, nor if the article is
trashed.
* Edit access checks must be performed in the calling code.
*
* @param object $article The article information
* @param Registry $params The item parameters
* @param array $attribs Optional attributes for the link
* @param boolean $legacy True to use legacy images, false to use
icomoon based graphic
*
* @return string The HTML for the article edit icon.
*
* @since 1.6
*/
public static function edit($article, $params, $attribs = array(), $legacy
= false)
{
$user = JFactory::getUser();
$uri = JUri::getInstance();
// Ignore if in a popup window.
if ($params && $params->get('popup'))
{
return;
}
// Ignore if the state is negative (trashed).
if ($article->state < 0)
{
return;
}
// Show checked_out icon if the article is checked out by a different
user
if (property_exists($article, 'checked_out')
&& property_exists($article, 'checked_out_time')
&& $article->checked_out > 0
&& $article->checked_out != $user->get('id'))
{
$checkoutUser = JFactory::getUser($article->checked_out);
$date = JHtml::_('date',
$article->checked_out_time);
$tooltip = JText::_('JLIB_HTML_CHECKED_OUT') . ' ::
' . JText::sprintf('COM_CONTENT_CHECKED_OUT_BY',
$checkoutUser->name)
. ' <br /> ' . $date;
$text =
JLayoutHelper::render('joomla.content.icons.edit_lock',
array('tooltip' => $tooltip, 'legacy' =>
$legacy));
$output = JHtml::_('link', '#', $text, $attribs);
return $output;
}
$contentUrl = ContentHelperRoute::getArticleRoute($article->slug,
$article->catid, $article->language);
$url = $contentUrl . '&task=article.edit&a_id='
. $article->id . '&return=' . base64_encode($uri);
if ($article->state == 0)
{
$overlib = JText::_('JUNPUBLISHED');
}
else
{
$overlib = JText::_('JPUBLISHED');
}
$date = JHtml::_('date', $article->created);
$author = $article->created_by_alias ?: $article->author;
$overlib .= '<br />';
$overlib .= $date;
$overlib .= '<br />';
$overlib .= JText::sprintf('COM_CONTENT_WRITTEN_BY',
htmlspecialchars($author, ENT_COMPAT, 'UTF-8'));
$text = JLayoutHelper::render('joomla.content.icons.edit',
array('article' => $article, 'overlib' =>
$overlib, 'legacy' => $legacy));
$attribs['title'] = JText::_('JGLOBAL_EDIT_TITLE');
$output = JHtml::_('link', JRoute::_($url), $text, $attribs);
return $output;
}
/**
* Method to generate a popup link to print an article
*
* @param object $article The article information
* @param Registry $params The item parameters
* @param array $attribs Optional attributes for the link
* @param boolean $legacy True to use legacy images, false to use
icomoon based graphic
*
* @return string The HTML markup for the popup link
*/
public static function print_popup($article, $params, $attribs = array(),
$legacy = false)
{
$url = ContentHelperRoute::getArticleRoute($article->slug,
$article->catid, $article->language);
$url .= '&tmpl=component&print=1&layout=default';
$status =
'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
$text =
JLayoutHelper::render('joomla.content.icons.print_popup',
array('params' => $params, 'legacy' => $legacy));
$attribs['title'] =
JText::sprintf('JGLOBAL_PRINT_TITLE',
htmlspecialchars($article->title, ENT_QUOTES, 'UTF-8'));
$attribs['onclick'] =
"window.open(this.href,'win2','" . $status .
"'); return false;";
$attribs['rel'] = 'nofollow';
return JHtml::_('link', JRoute::_($url), $text, $attribs);
}
/**
* Method to generate a link to print an article
*
* @param object $article Not used, @deprecated for 4.0
* @param Registry $params The item parameters
* @param array $attribs Not used, @deprecated for 4.0
* @param boolean $legacy True to use legacy images, false to use
icomoon based graphic
*
* @return string The HTML markup for the popup link
*/
public static function print_screen($article, $params, $attribs = array(),
$legacy = false)
{
$text =
JLayoutHelper::render('joomla.content.icons.print_screen',
array('params' => $params, 'legacy' => $legacy));
return '<a href="#" onclick="window.print();return
false;">' . $text . '</a>';
}
}
PKYF�[coJ�o'o'$com_content/helpers/legacyrouter.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Legacy routing rules class from com_content
*
* @since 3.6
* @deprecated 4.0
*/
class ContentRouterRulesLegacy implements JComponentRouterRulesInterface
{
/**
* Constructor for this legacy router
*
* @param JComponentRouterView $router The router this rule belongs to
*
* @since 3.6
* @deprecated 4.0
*/
public function __construct($router)
{
$this->router = $router;
}
/**
* Preprocess the route for the com_content component
*
* @param array &$query An array of URL arguments
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function preprocess(&$query)
{
}
/**
* Build the route for the com_content component
*
* @param array &$query An array of URL arguments
* @param array &$segments The URL arguments to use to assemble
the subsequent URL.
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function build(&$query, &$segments)
{
// Get a menu item based on Itemid or currently active
$params = JComponentHelper::getParams('com_content');
$advanced = $params->get('sef_advanced_link', 0);
// We need a menu item. Either the one specified in the query, or the
current active one if none specified
if (empty($query['Itemid']))
{
$menuItem = $this->router->menu->getActive();
$menuItemGiven = false;
}
else
{
$menuItem =
$this->router->menu->getItem($query['Itemid']);
$menuItemGiven = true;
}
// Check again
if ($menuItemGiven && isset($menuItem) &&
$menuItem->component != 'com_content')
{
$menuItemGiven = false;
unset($query['Itemid']);
}
if (isset($query['view']))
{
$view = $query['view'];
}
else
{
// We need to have a view in the query or it is an invalid URL
return;
}
// Are we dealing with an article or category that is attached to a menu
item?
if ($menuItem !== null
&& isset($menuItem->query['view'],
$query['view'], $menuItem->query['id'],
$query['id'])
&& $menuItem->query['view'] ==
$query['view']
&& $menuItem->query['id'] == (int)
$query['id'])
{
unset($query['view']);
if (isset($query['catid']))
{
unset($query['catid']);
}
if (isset($query['layout']))
{
unset($query['layout']);
}
unset($query['id']);
return;
}
if ($view == 'category' || $view == 'article')
{
if (!$menuItemGiven)
{
$segments[] = $view;
}
unset($query['view']);
if ($view == 'article')
{
if (isset($query['id']) &&
isset($query['catid']) && $query['catid'])
{
$catid = $query['catid'];
// Make sure we have the id and the alias
if (strpos($query['id'], ':') === false)
{
$db = JFactory::getDbo();
$dbQuery = $db->getQuery(true)
->select('alias')
->from('#__content')
->where('id=' . (int) $query['id']);
$db->setQuery($dbQuery);
$alias = $db->loadResult();
$query['id'] = $query['id'] . ':' .
$alias;
}
}
else
{
// We should have these two set for this view. If we don't, it
is an error
return;
}
}
else
{
if (isset($query['id']))
{
$catid = $query['id'];
}
else
{
// We should have id set for this view. If we don't, it is an
error
return;
}
}
if ($menuItemGiven &&
isset($menuItem->query['id']))
{
$mCatid = $menuItem->query['id'];
}
else
{
$mCatid = 0;
}
$categories = JCategories::getInstance('Content');
$category = $categories->get($catid);
if (!$category)
{
// We couldn't find the category we were given. Bail.
return;
}
$path = array_reverse($category->getPath());
$array = array();
foreach ($path as $id)
{
if ((int) $id == (int) $mCatid)
{
break;
}
list($tmp, $id) = explode(':', $id, 2);
$array[] = $id;
}
$array = array_reverse($array);
if (!$advanced && count($array))
{
$array[0] = (int) $catid . ':' . $array[0];
}
$segments = array_merge($segments, $array);
if ($view == 'article')
{
if ($advanced)
{
list($tmp, $id) = explode(':', $query['id'], 2);
}
else
{
$id = $query['id'];
}
$segments[] = $id;
}
unset($query['id'], $query['catid']);
}
if ($view == 'archive')
{
if (!$menuItemGiven)
{
$segments[] = $view;
unset($query['view']);
}
if (isset($query['year']))
{
if ($menuItemGiven)
{
$segments[] = $query['year'];
unset($query['year']);
}
}
if (isset($query['year']) &&
isset($query['month']))
{
if ($menuItemGiven)
{
$segments[] = $query['month'];
unset($query['month']);
}
}
}
if ($view == 'featured')
{
if (!$menuItemGiven)
{
$segments[] = $view;
}
unset($query['view']);
}
/*
* If the layout is specified and it is the same as the layout in the
menu item, we
* unset it so it doesn't go into the query string.
*/
if (isset($query['layout']))
{
if ($menuItemGiven &&
isset($menuItem->query['layout']))
{
if ($query['layout'] ==
$menuItem->query['layout'])
{
unset($query['layout']);
}
}
else
{
if ($query['layout'] == 'default')
{
unset($query['layout']);
}
}
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-',
$segments[$i]);
}
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
* @param array &$vars The URL attributes to be used by the
application.
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function parse(&$segments, &$vars)
{
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = preg_replace('/-/', ':',
$segments[$i], 1);
}
// Get the active menu item.
$item = $this->router->menu->getActive();
$params = JComponentHelper::getParams('com_content');
$advanced = $params->get('sef_advanced_link', 0);
$db = JFactory::getDbo();
// Count route segments
$count = count($segments);
/*
* Standard routing for articles. If we don't pick up an Itemid
then we get the view from the segments
* the first segment is the view and the last segment is the id of the
article or category.
*/
if (!isset($item))
{
$vars['view'] = $segments[0];
$vars['id'] = $segments[$count - 1];
return;
}
/*
* If there is only one segment, then it points to either an article or a
category.
* We test it first to see if it is a category. If the id and alias
match a category,
* then we assume it is a category. If they don't we assume it is
an article
*/
if ($count == 1)
{
// We check to see if an alias is given. If not, we assume it is an
article
if (strpos($segments[0], ':') === false)
{
$vars['view'] = 'article';
$vars['id'] = (int) $segments[0];
return;
}
list($id, $alias) = explode(':', $segments[0], 2);
// First we check if it is a category
$category = JCategories::getInstance('Content')->get($id);
if ($category && $category->alias == $alias)
{
$vars['view'] = 'category';
$vars['id'] = $id;
return;
}
else
{
$query = $db->getQuery(true)
->select($db->quoteName(array('alias',
'catid')))
->from($db->quoteName('#__content'))
->where($db->quoteName('id') . ' = ' . (int)
$id);
$db->setQuery($query);
$article = $db->loadObject();
if ($article)
{
if ($article->alias == $alias)
{
$vars['view'] = 'article';
$vars['catid'] = (int) $article->catid;
$vars['id'] = (int) $id;
return;
}
}
}
}
/*
* If there was more than one segment, then we can determine where the
URL points to
* because the first segment will have the target category id prepended
to it. If the
* last segment has a number prepended, it is an article, otherwise, it
is a category.
*/
if (!$advanced)
{
$cat_id = (int) $segments[0];
$article_id = (int) $segments[$count - 1];
if ($article_id > 0)
{
$vars['view'] = 'article';
$vars['catid'] = $cat_id;
$vars['id'] = $article_id;
}
else
{
$vars['view'] = 'category';
$vars['id'] = $cat_id;
}
return;
}
// We get the category id from the menu item and search from there
$id = $item->query['id'];
$category = JCategories::getInstance('Content')->get($id);
if (!$category)
{
JError::raiseError(404,
JText::_('COM_CONTENT_ERROR_PARENT_CATEGORY_NOT_FOUND'));
return;
}
$categories = $category->getChildren();
$vars['catid'] = $id;
$vars['id'] = $id;
$found = 0;
foreach ($segments as $segment)
{
$segment = str_replace(':', '-', $segment);
foreach ($categories as $category)
{
if ($category->alias == $segment)
{
$vars['id'] = $category->id;
$vars['catid'] = $category->id;
$vars['view'] = 'category';
$categories = $category->getChildren();
$found = 1;
break;
}
}
if ($found == 0)
{
if ($advanced)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from('#__content')
->where($db->quoteName('catid') . ' = ' .
(int) $vars['catid'])
->where($db->quoteName('alias') . ' = ' .
$db->quote($segment));
$db->setQuery($query);
$cid = $db->loadResult();
}
else
{
$cid = $segment;
}
$vars['id'] = $cid;
if ($item->query['view'] == 'archive' &&
$count != 1)
{
$vars['year'] = $count >= 2 ? $segments[$count - 2] :
null;
$vars['month'] = $segments[$count - 1];
$vars['view'] = 'archive';
}
else
{
$vars['view'] = 'article';
}
}
$found = 0;
}
}
}
PKYF�[�oh com_content/helpers/query.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2007 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Content Component Query Helper
*
* @since 1.5
*/
class ContentHelperQuery
{
/**
* Translate an order code to a field for primary category ordering.
*
* @param string $orderby The ordering code.
*
* @return string The SQL field(s) to order by.
*
* @since 1.5
*/
public static function orderbyPrimary($orderby)
{
switch ($orderby)
{
case 'alpha' :
$orderby = 'c.path, ';
break;
case 'ralpha' :
$orderby = 'c.path DESC, ';
break;
case 'order' :
$orderby = 'c.lft, ';
break;
default :
$orderby = '';
break;
}
return $orderby;
}
/**
* Translate an order code to a field for secondary category ordering.
*
* @param string $orderby The ordering code.
* @param string $orderDate The ordering code for the date.
*
* @return string The SQL field(s) to order by.
*
* @since 1.5
*/
public static function orderbySecondary($orderby, $orderDate =
'created')
{
$queryDate = self::getQueryDate($orderDate);
switch ($orderby)
{
case 'date' :
$orderby = $queryDate;
break;
case 'rdate' :
$orderby = $queryDate . ' DESC ';
break;
case 'alpha' :
$orderby = 'a.title';
break;
case 'ralpha' :
$orderby = 'a.title DESC';
break;
case 'hits' :
$orderby = 'a.hits DESC';
break;
case 'rhits' :
$orderby = 'a.hits';
break;
case 'order' :
$orderby = 'a.ordering';
break;
case 'rorder' :
$orderby = 'a.ordering DESC';
break;
case 'author' :
$orderby = 'author';
break;
case 'rauthor' :
$orderby = 'author DESC';
break;
case 'front' :
$orderby = 'a.featured DESC, fp.ordering, ' . $queryDate .
' DESC ';
break;
case 'random' :
$orderby = JFactory::getDbo()->getQuery(true)->Rand();
break;
case 'vote' :
$orderby = 'a.id DESC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating_count DESC ';
}
break;
case 'rvote' :
$orderby = 'a.id ASC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating_count ASC ';
}
break;
case 'rank' :
$orderby = 'a.id DESC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating DESC ';
}
break;
case 'rrank' :
$orderby = 'a.id ASC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating ASC ';
}
break;
default :
$orderby = 'a.ordering';
break;
}
return $orderby;
}
/**
* Translate an order code to a field for primary category ordering.
*
* @param string $orderDate The ordering code.
*
* @return string The SQL field(s) to order by.
*
* @since 1.6
*/
public static function getQueryDate($orderDate)
{
$db = JFactory::getDbo();
switch ($orderDate)
{
case 'modified' :
$queryDate = ' CASE WHEN a.modified = ' .
$db->quote($db->getNullDate()) . ' THEN a.created ELSE
a.modified END';
break;
// Use created if publish_up is not set
case 'published' :
$queryDate = ' CASE WHEN a.publish_up = ' .
$db->quote($db->getNullDate()) . ' THEN a.created ELSE
a.publish_up END ';
break;
case 'unpublished' :
$queryDate = ' CASE WHEN a.publish_down = ' .
$db->quote($db->getNullDate()) . ' THEN a.created ELSE
a.publish_down END ';
break;
case 'created' :
default :
$queryDate = ' a.created ';
break;
}
return $queryDate;
}
/**
* Get join information for the voting query.
*
* @param \Joomla\Registry\Registry $params An options object for the
article.
*
* @return array A named array with "select" and
"join" keys.
*
* @since 1.5
*/
public static function buildVotingQuery($params = null)
{
if (!$params)
{
$params = JComponentHelper::getParams('com_content');
}
$voting = $params->get('show_vote');
if ($voting)
{
// Calculate voting count
$select = ' , ROUND(v.rating_sum / v.rating_count) AS rating,
v.rating_count';
$join = ' LEFT JOIN #__content_rating AS v ON a.id =
v.content_id';
}
else
{
$select = '';
$join = '';
}
return array('select' => $select, 'join' =>
$join);
}
/**
* Method to order the intro articles array for ordering
* down the columns instead of across.
* The layout always lays the introtext articles out across columns.
* Array is reordered so that, when articles are displayed in index order
* across columns in the layout, the result is that the
* desired article ordering is achieved down the columns.
*
* @param array &$articles Array of intro text articles
* @param integer $numColumns Number of columns in the layout
*
* @return array Reordered array to achieve desired ordering down
columns
*
* @since 1.6
* @deprecated 4.0
*/
public static function orderDownColumns(&$articles, $numColumns = 1)
{
$count = count($articles);
// Just return the same array if there is nothing to change
if ($numColumns == 1 || !is_array($articles) || $count <= $numColumns)
{
$return = $articles;
}
// We need to re-order the intro articles array
else
{
// We need to preserve the original array keys
$keys = array_keys($articles);
$maxRows = ceil($count / $numColumns);
$numCells = $maxRows * $numColumns;
$numEmpty = $numCells - $count;
$index = array();
// Calculate number of empty cells in the array
// Fill in all cells of the array
// Put -1 in empty cells so we can skip later
for ($row = 1, $i = 1; $row <= $maxRows; $row++)
{
for ($col = 1; $col <= $numColumns; $col++)
{
if ($numEmpty > ($numCells - $i))
{
// Put -1 in empty cells
$index[$row][$col] = -1;
}
else
{
// Put in zero as placeholder
$index[$row][$col] = 0;
}
$i++;
}
}
// Layout the articles in column order, skipping empty cells
$i = 0;
for ($col = 1; ($col <= $numColumns) && ($i < $count);
$col++)
{
for ($row = 1; ($row <= $maxRows) && ($i < $count);
$row++)
{
if ($index[$row][$col] != - 1)
{
$index[$row][$col] = $keys[$i];
$i++;
}
}
}
// Now read the $index back row by row to get articles in right row/col
// so that they will actually be ordered down the columns (when read by
row in the layout)
$return = array();
$i = 0;
for ($row = 1; ($row <= $maxRows) && ($i < $count);
$row++)
{
for ($col = 1; ($col <= $numColumns) && ($i < $count);
$col++)
{
$return[$keys[$i]] = $articles[$index[$row][$col]];
$i++;
}
}
}
return $return;
}
}
PKYF�[��M�TTcom_content/helpers/route.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2007 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Content Component Route Helper.
*
* @since 1.5
*/
abstract class ContentHelperRoute
{
/**
* Get the article route.
*
* @param integer $id The route of the content item.
* @param integer $catid The category ID.
* @param integer $language The language code.
* @param string $layout The layout value.
*
* @return string The article route.
*
* @since 1.5
*/
public static function getArticleRoute($id, $catid = 0, $language = 0,
$layout = null)
{
// Create the link
$link = 'index.php?option=com_content&view=article&id='
. $id;
if ((int) $catid > 1)
{
$link .= '&catid=' . $catid;
}
if ($language && $language !== '*' &&
JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
if ($layout)
{
$link .= '&layout=' . $layout;
}
return $link;
}
/**
* Get the category route.
*
* @param integer $catid The category ID.
* @param integer $language The language code.
* @param string $layout The layout value.
*
* @return string The article route.
*
* @since 1.5
*/
public static function getCategoryRoute($catid, $language = 0, $layout =
null)
{
if ($catid instanceof JCategoryNode)
{
$id = $catid->id;
}
else
{
$id = (int) $catid;
}
if ($id < 1)
{
return '';
}
$link =
'index.php?option=com_content&view=category&id=' . $id;
if ($language && $language !== '*' &&
JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
if ($layout)
{
$link .= '&layout=' . $layout;
}
return $link;
}
/**
* Get the form route.
*
* @param integer $id The form ID.
*
* @return string The article route.
*
* @since 1.5
*/
public static function getFormRoute($id)
{
return
'index.php?option=com_content&task=article.edit&a_id=' .
(int) $id;
}
}
PKYF�[2 $$com_content/models/archive.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 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;
JLoader::register('ContentModelArticles', __DIR__ .
'/articles.php');
/**
* Content Component Archive Model
*
* @since 1.5
*/
class ContentModelArchive extends ContentModelArticles
{
/**
* Model context string.
*
* @var string
*/
public $_context = 'com_content.archive';
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering The field to order on.
* @param string $direction The direction to order on.
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
parent::populateState();
$app = JFactory::getApplication();
// Add archive properties
$params = $this->state->params;
// Filter on archived articles
$this->setState('filter.published', 2);
// Filter on month, year
$this->setState('filter.month',
$app->input->getInt('month'));
$this->setState('filter.year',
$app->input->getInt('year'));
// Optional filter text
$this->setState('list.filter',
$app->input->getString('filter-search'));
// Get list limit
$itemid = $app->input->get('Itemid', 0, 'int');
$limit =
$app->getUserStateFromRequest('com_content.archive.list' .
$itemid . '.limit', 'limit',
$params->get('display_num'), 'uint');
$this->setState('list.limit', $limit);
// Set the archive ordering
$articleOrderby = $params->get('orderby_sec',
'rdate');
$articleOrderDate = $params->get('order_date');
// No category ordering
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby,
$articleOrderDate);
$this->setState('list.ordering', $secondary . ',
a.created DESC');
$this->setState('list.direction', '');
}
/**
* Get the master query for retrieving a list of articles subject to the
model state.
*
* @return JDatabaseQuery
*
* @since 1.6
*/
protected function getListQuery()
{
$params = $this->state->params;
$app = JFactory::getApplication('site');
$catids =
ArrayHelper::toInteger($app->input->get('catid', array(),
'array'));
$catids = array_values(array_diff($catids, array(0)));
$articleOrderDate = $params->get('order_date');
// Create a new query object.
$query = parent::getListQuery();
// Add routing for archive
// Sqlsrv changes
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=',
'0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'),
':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$query->select($case_when);
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('c.alias', '!=',
'0');
$case_when .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when .= $query->concatenate(array($c_id, 'c.alias'),
':');
$case_when .= ' ELSE ';
$case_when .= $c_id . ' END as catslug';
$query->select($case_when);
// Filter on month, year
// First, get the date field
$queryDate = ContentHelperQuery::getQueryDate($articleOrderDate);
if ($month = $this->getState('filter.month'))
{
$query->where($query->month($queryDate) . ' = ' .
$month);
}
if ($year = $this->getState('filter.year'))
{
$query->where($query->year($queryDate) . ' = ' . $year);
}
if (count($catids) > 0)
{
$query->where('c.id IN (' . implode(', ',
$catids) . ')');
}
return $query;
}
/**
* Method to get the archived article list
*
* @access public
* @return array
*/
public function getData()
{
$app = JFactory::getApplication();
// Lets load the content if it doesn't already exist
if (empty($this->_data))
{
// Get the page/component configuration
$params = $app->getParams();
// Get the pagination request variables
$limit = $app->input->get('limit',
$params->get('display_num', 20), 'uint');
$limitstart = $app->input->get('limitstart', 0,
'uint');
$query = $this->_buildQuery();
$this->_data = $this->_getList($query, $limitstart, $limit);
}
return $this->_data;
}
/**
* JModelLegacy override to add alternating value for $odd
*
* @param string $query The query.
* @param integer $limitstart Offset.
* @param integer $limit The number of records.
*
* @return array An array of results.
*
* @since 3.0.1
* @throws RuntimeException
*/
protected function _getList($query, $limitstart=0, $limit=0)
{
$result = parent::_getList($query, $limitstart, $limit);
$odd = 1;
foreach ($result as $k => $row)
{
$result[$k]->odd = $odd;
$odd = 1 - $odd;
}
return $result;
}
/**
* Gets the archived articles years
*
* @return array
*
* @since 3.6.0
*/
public function getYears()
{
$db = $this->getDbo();
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
$query = $db->getQuery(true);
$years = $query->year($db->qn('created'));
$query->select('DISTINCT (' . $years . ')')
->from($db->qn('#__content'))
->where($db->qn('state') . '= 2')
->where('(publish_up = ' . $nullDate . ' OR publish_up
<= ' . $nowDate . ')')
->where('(publish_down = ' . $nullDate . ' OR
publish_down >= ' . $nowDate . ')')
->order('1 ASC');
$db->setQuery($query);
return $db->loadColumn();
}
}
PKZF�[��L�)�)com_content/models/article.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 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;
use Joomla\Utilities\IpHelper;
/**
* Content Component Article Model
*
* @since 1.5
*/
class ContentModelArticle extends JModelItem
{
/**
* Model context string.
*
* @var string
*/
protected $_context = 'com_content.article';
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*
* @return void
*/
protected function populateState()
{
$app = JFactory::getApplication('site');
// Load state from the request.
$pk = $app->input->getInt('id');
$this->setState('article.id', $pk);
$offset = $app->input->getUInt('limitstart');
$this->setState('list.offset', $offset);
// Load the parameters.
$params = $app->getParams();
$this->setState('params', $params);
$user = JFactory::getUser();
// If $pk is set then authorise on complete asset, else on component only
$asset = empty($pk) ? 'com_content' :
'com_content.article.' . $pk;
if ((!$user->authorise('core.edit.state', $asset))
&& (!$user->authorise('core.edit', $asset)))
{
$this->setState('filter.published', 1);
$this->setState('filter.archived', 2);
}
$this->setState('filter.language',
JLanguageMultilang::isEnabled());
}
/**
* Method to get article data.
*
* @param integer $pk The id of the article.
*
* @return object|boolean|JException Menu item data object on success,
boolean false or JException instance on error
*/
public function getItem($pk = null)
{
$user = JFactory::getUser();
$pk = (!empty($pk)) ? $pk : (int)
$this->getState('article.id');
if ($this->_item === null)
{
$this->_item = array();
}
if (!isset($this->_item[$pk]))
{
try
{
$db = $this->getDbo();
$query = $db->getQuery(true)
->select(
$this->getState(
'item.select', 'a.id, a.asset_id, a.title, a.alias,
a.introtext, a.fulltext, ' .
'a.state, a.catid, a.created, a.created_by, a.created_by_alias,
' .
// Use created if modified is 0
'CASE WHEN a.modified = ' .
$db->quote($db->getNullDate()) . ' THEN a.created ELSE
a.modified END as modified, ' .
'a.modified_by, a.checked_out, a.checked_out_time,
a.publish_up, a.publish_down, ' .
'a.images, a.urls, a.attribs, a.version, a.ordering, ' .
'a.metakey, a.metadesc, a.access, a.hits, a.metadata,
a.featured, a.language, a.xreference'
)
);
$query->from('#__content AS a')
->where('a.id = ' . (int) $pk);
// Join on category table.
$query->select('c.title AS category_title, c.alias AS
category_alias, c.access AS category_access')
->innerJoin('#__categories AS c on c.id = a.catid')
->where('c.published > 0');
// Join on user table.
$query->select('u.name AS author')
->join('LEFT', '#__users AS u on u.id =
a.created_by');
// Filter by language
if ($this->getState('filter.language'))
{
$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
}
// Join over the categories to get parent category titles
$query->select('parent.title as parent_title, parent.id as
parent_id, parent.path as parent_route, parent.alias as parent_alias')
->join('LEFT', '#__categories as parent ON parent.id
= c.parent_id');
// Join on voting table
$query->select('ROUND(v.rating_sum / v.rating_count, 0) AS
rating, v.rating_count as rating_count')
->join('LEFT', '#__content_rating AS v ON a.id =
v.content_id');
if ((!$user->authorise('core.edit.state',
'com_content.article.' . $pk)) &&
(!$user->authorise('core.edit',
'com_content.article.' . $pk)))
{
// Filter by start and end dates.
$nullDate = $db->quote($db->getNullDate());
$date = JFactory::getDate();
$nowDate = $db->quote($date->toSql());
$query->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')');
}
// Filter by published state.
$published = $this->getState('filter.published');
$archived = $this->getState('filter.archived');
if (is_numeric($published))
{
$query->where('(a.state = ' . (int) $published . '
OR a.state =' . (int) $archived . ')');
}
$db->setQuery($query);
$data = $db->loadObject();
if (empty($data))
{
return JError::raiseError(404,
JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND'));
}
// Check for published state if filter set.
if ((is_numeric($published) || is_numeric($archived)) &&
(($data->state != $published) && ($data->state !=
$archived)))
{
return JError::raiseError(404,
JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND'));
}
// Convert parameter fields to objects.
$registry = new Registry($data->attribs);
$data->params = clone $this->getState('params');
$data->params->merge($registry);
$data->metadata = new Registry($data->metadata);
// Technically guest could edit an article, but lets not check that to
improve performance a little.
if (!$user->get('guest'))
{
$userId = $user->get('id');
$asset = 'com_content.article.' . $data->id;
// Check general edit permission first.
if ($user->authorise('core.edit', $asset))
{
$data->params->set('access-edit', true);
}
// Now check if edit.own is available.
elseif (!empty($userId) &&
$user->authorise('core.edit.own', $asset))
{
// Check for a valid user and that they are the owner.
if ($userId == $data->created_by)
{
$data->params->set('access-edit', true);
}
}
}
// Compute view access permissions.
if ($access = $this->getState('filter.access'))
{
// If the access filter has been set, we already know this user can
view.
$data->params->set('access-view', true);
}
else
{
// If no access filter is set, the layout takes some responsibility
for display of limited information.
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
if ($data->catid == 0 || $data->category_access === null)
{
$data->params->set('access-view',
in_array($data->access, $groups));
}
else
{
$data->params->set('access-view',
in_array($data->access, $groups) &&
in_array($data->category_access, $groups));
}
}
$this->_item[$pk] = $data;
}
catch (Exception $e)
{
if ($e->getCode() == 404)
{
// Need to go thru the error handler to allow Redirect to work.
JError::raiseError(404, $e->getMessage());
}
else
{
$this->setError($e);
$this->_item[$pk] = false;
}
}
}
return $this->_item[$pk];
}
/**
* Increment the hit counter for the article.
*
* @param integer $pk Optional primary key of the article to
increment.
*
* @return boolean True if successful; false otherwise and internal
error set.
*/
public function hit($pk = 0)
{
$input = JFactory::getApplication()->input;
$hitcount = $input->getInt('hitcount', 1);
if ($hitcount)
{
$pk = (!empty($pk)) ? $pk : (int)
$this->getState('article.id');
$table = JTable::getInstance('Content', 'JTable');
$table->hit($pk);
}
return true;
}
/**
* Save user vote on article
*
* @param integer $pk Joomla Article Id
* @param integer $rate Voting rate
*
* @return boolean Return true on success
*/
public function storeVote($pk = 0, $rate = 0)
{
if ($rate >= 1 && $rate <= 5 && $pk > 0)
{
$userIP = IpHelper::getIp();
// Initialize variables.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Create the base select statement.
$query->select('*')
->from($db->quoteName('#__content_rating'))
->where($db->quoteName('content_id') . ' = '
. (int) $pk);
// Set the query and load the result.
$db->setQuery($query);
// Check for a database error.
try
{
$rating = $db->loadObject();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
return false;
}
// There are no ratings yet, so lets insert our rating
if (!$rating)
{
$query = $db->getQuery(true);
// Create the base insert statement.
$query->insert($db->quoteName('#__content_rating'))
->columns(array($db->quoteName('content_id'),
$db->quoteName('lastip'),
$db->quoteName('rating_sum'),
$db->quoteName('rating_count')))
->values((int) $pk . ', ' . $db->quote($userIP) .
',' . (int) $rate . ', 1');
// Set the query and execute the insert.
$db->setQuery($query);
try
{
$db->execute();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
return false;
}
}
else
{
if ($userIP != $rating->lastip)
{
$query = $db->getQuery(true);
// Create the base update statement.
$query->update($db->quoteName('#__content_rating'))
->set($db->quoteName('rating_count') . ' =
rating_count + 1')
->set($db->quoteName('rating_sum') . ' =
rating_sum + ' . (int) $rate)
->set($db->quoteName('lastip') . ' = ' .
$db->quote($userIP))
->where($db->quoteName('content_id') . ' =
' . (int) $pk);
// Set the query and execute the update.
$db->setQuery($query);
try
{
$db->execute();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
return false;
}
}
else
{
return false;
}
}
$this->cleanCache();
return true;
}
JError::raiseWarning(500,
JText::sprintf('COM_CONTENT_INVALID_RATING', $rate),
"JModelArticle::storeVote($rate)");
return false;
}
/**
* Cleans the cache of com_content and content modules
*
* @param string $group The cache group
* @param integer $clientId The ID of the client
*
* @return void
*
* @since 3.9.9
*/
protected function cleanCache($group = null, $clientId = 0)
{
parent::cleanCache('com_content');
parent::cleanCache('mod_articles_archive');
parent::cleanCache('mod_articles_categories');
parent::cleanCache('mod_articles_category');
parent::cleanCache('mod_articles_latest');
parent::cleanCache('mod_articles_news');
parent::cleanCache('mod_articles_popular');
}
}
PKZF�[���߃Y�Ycom_content/models/articles.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
JLoader::register('ContentHelperAssociation', JPATH_SITE .
'/components/com_content/helpers/association.php');
/**
* This models supports retrieving lists of articles.
*
* @since 1.6
*/
class ContentModelArticles 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(
'id', 'a.id',
'title', 'a.title',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'catid', 'a.catid', 'category_title',
'state', 'a.state',
'access', 'a.access', 'access_level',
'created', 'a.created',
'created_by', 'a.created_by',
'ordering', 'a.ordering',
'featured', 'a.featured',
'language', 'a.language',
'hits', 'a.hits',
'publish_up', 'a.publish_up',
'publish_down', 'a.publish_down',
'images', 'a.images',
'urls', 'a.urls',
'filter_tag',
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* This method should only be called once per instantiation and is
designed
* to be called on the first call to the getState() method unless the
model
* configuration flag to ignore the request is set.
*
* 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 3.0.1
*/
protected function populateState($ordering = 'ordering',
$direction = 'ASC')
{
$app = JFactory::getApplication();
// List state information
$value = $app->input->get('limit',
$app->get('list_limit', 0), 'uint');
$this->setState('list.limit', $value);
$value = $app->input->get('limitstart', 0,
'uint');
$this->setState('list.start', $value);
$value = $app->input->get('filter_tag', 0,
'uint');
$this->setState('filter.tag', $value);
$orderCol = $app->input->get('filter_order',
'a.ordering');
if (!in_array($orderCol, $this->filter_fields))
{
$orderCol = 'a.ordering';
}
$this->setState('list.ordering', $orderCol);
$listOrder = $app->input->get('filter_order_Dir',
'ASC');
if (!in_array(strtoupper($listOrder), array('ASC',
'DESC', '')))
{
$listOrder = 'ASC';
}
$this->setState('list.direction', $listOrder);
$params = $app->getParams();
$this->setState('params', $params);
$user = JFactory::getUser();
if ((!$user->authorise('core.edit.state',
'com_content')) &&
(!$user->authorise('core.edit', 'com_content')))
{
// Filter on published for those who do not have edit or edit.state
rights.
$this->setState('filter.published', 1);
}
$this->setState('filter.language',
JLanguageMultilang::isEnabled());
// Process show_noauth parameter
if ((!$params->get('show_noauth')) ||
(!JComponentHelper::getParams('com_content')->get('show_noauth')))
{
$this->setState('filter.access', true);
}
else
{
$this->setState('filter.access', false);
}
$this->setState('layout',
$app->input->getString('layout'));
}
/**
* 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 .= ':' .
serialize($this->getState('filter.published'));
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.featured');
$id .= ':' .
serialize($this->getState('filter.article_id'));
$id .= ':' .
$this->getState('filter.article_id.include');
$id .= ':' .
serialize($this->getState('filter.category_id'));
$id .= ':' .
$this->getState('filter.category_id.include');
$id .= ':' .
serialize($this->getState('filter.author_id'));
$id .= ':' .
$this->getState('filter.author_id.include');
$id .= ':' .
serialize($this->getState('filter.author_alias'));
$id .= ':' .
$this->getState('filter.author_alias.include');
$id .= ':' .
$this->getState('filter.date_filtering');
$id .= ':' . $this->getState('filter.date_field');
$id .= ':' .
$this->getState('filter.start_date_range');
$id .= ':' .
$this->getState('filter.end_date_range');
$id .= ':' .
$this->getState('filter.relative_date');
$id .= ':' .
serialize($this->getState('filter.tag'));
return parent::getStoreId($id);
}
/**
* Get the master query for retrieving a list of articles subject to the
model state.
*
* @return JDatabaseQuery
*
* @since 1.6
*/
protected function getListQuery()
{
// Get the current user for authorisation checks
$user = JFactory::getUser();
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.id, a.title, a.alias, a.introtext, a.fulltext, ' .
'a.checked_out, a.checked_out_time, ' .
'a.catid, a.created, a.created_by, a.created_by_alias, ' .
// Published/archived article in archive category is treats as archive
article
// If category is not published then force 0
'CASE WHEN c.published = 2 AND a.state > 0 THEN 2 WHEN
c.published != 1 THEN 0 ELSE a.state END as state,' .
// Use created if modified is 0
'CASE WHEN a.modified = ' .
$db->quote($db->getNullDate()) . ' THEN a.created ELSE
a.modified END as modified, ' .
'a.modified_by, uam.name as modified_by_name,' .
// Use created if publish_up is 0
'CASE WHEN a.publish_up = ' .
$db->quote($db->getNullDate()) . ' THEN a.created ELSE
a.publish_up END as publish_up,' .
'a.publish_down, a.images, a.urls, a.attribs, a.metadata,
a.metakey, a.metadesc, a.access, ' .
'a.hits, a.xreference, a.featured, a.language, ' . '
' . $query->length('a.fulltext') . ' AS readmore,
a.ordering'
)
);
$query->from('#__content AS a');
$params = $this->getState('params');
$orderby_sec = $params->get('orderby_sec');
// Join over the frontpage articles if required.
if ($this->getState('filter.frontpage'))
{
if ($orderby_sec === 'front')
{
$query->select('fp.ordering');
$query->join('INNER', '#__content_frontpage AS fp ON
fp.content_id = a.id');
}
else
{
$query->where('a.featured = 1');
}
}
elseif ($orderby_sec === 'front' ||
$this->getState('list.ordering') === 'fp.ordering')
{
$query->select('fp.ordering');
$query->join('LEFT', '#__content_frontpage AS fp ON
fp.content_id = a.id');
}
// Join over the categories.
$query->select('c.title AS category_title, c.path AS
category_route, c.access AS category_access, c.alias AS
category_alias')
->select('c.published, c.published AS parents_published,
c.lft')
->join('LEFT', '#__categories AS c ON c.id =
a.catid');
// Join over the users for the author and modified_by names.
$query->select("CASE WHEN a.created_by_alias > ' '
THEN a.created_by_alias ELSE ua.name END AS author")
->select('ua.email AS author_email')
->join('LEFT', '#__users AS ua ON ua.id =
a.created_by')
->join('LEFT', '#__users AS uam ON uam.id =
a.modified_by');
// Join over the categories to get parent category titles
$query->select('parent.title as parent_title, parent.id as
parent_id, parent.path as parent_route, parent.alias as parent_alias')
->join('LEFT', '#__categories as parent ON parent.id =
c.parent_id');
if (JPluginHelper::isEnabled('content', 'vote'))
{
// Join on voting table
$query->select('COALESCE(NULLIF(ROUND(v.rating_sum /
v.rating_count, 0), 0), 0) AS rating,
COALESCE(NULLIF(v.rating_count, 0), 0) as rating_count')
->join('LEFT', '#__content_rating AS v ON a.id =
v.content_id');
}
// Filter by access level.
if ($this->getState('filter.access', true))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')')
->where('c.access IN (' . $groups . ')');
}
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published) && $published == 2)
{
/**
* If category is archived then article has to be published or archived.
* Or category is published then article has to be archived.
*/
$query->where('((c.published = 2 AND a.state > 0) OR
(c.published = 1 AND a.state = 2))');
}
elseif (is_numeric($published))
{
// Category has to be published
$query->where('c.published = 1 AND a.state = ' . (int)
$published);
}
elseif (is_array($published))
{
$published = ArrayHelper::toInteger($published);
$published = implode(',', $published);
// Category has to be published
$query->where('c.published = 1 AND a.state IN (' .
$published . ')');
}
// Filter by featured state
$featured = $this->getState('filter.featured');
switch ($featured)
{
case 'hide':
$query->where('a.featured = 0');
break;
case 'only':
$query->where('a.featured = 1');
break;
case 'show':
default:
// Normally we do not discriminate between featured/unfeatured items.
break;
}
// Filter by a single or group of articles.
$articleId = $this->getState('filter.article_id');
if (is_numeric($articleId))
{
$type = $this->getState('filter.article_id.include', true)
? '= ' : '<> ';
$query->where('a.id ' . $type . (int) $articleId);
}
elseif (is_array($articleId))
{
$articleId = ArrayHelper::toInteger($articleId);
$articleId = implode(',', $articleId);
$type = $this->getState('filter.article_id.include',
true) ? 'IN' : 'NOT IN';
$query->where('a.id ' . $type . ' (' . $articleId
. ')');
}
// Filter by a single or group of categories
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId))
{
$type = $this->getState('filter.category_id.include', true)
? '= ' : '<> ';
// Add subcategory check
$includeSubcategories =
$this->getState('filter.subcategories', false);
$categoryEquals = 'a.catid ' . $type . (int)
$categoryId;
if ($includeSubcategories)
{
$levels = (int)
$this->getState('filter.max_category_levels', '1');
// Create a subquery for the subcategory list
$subQuery = $db->getQuery(true)
->select('sub.id')
->from('#__categories as sub')
->join('INNER', '#__categories as this ON sub.lft
> this.lft AND sub.rgt < this.rgt')
->where('this.id = ' . (int) $categoryId);
if ($levels >= 0)
{
$subQuery->where('sub.level <= this.level + ' .
$levels);
}
// Add the subquery to the main query
$query->where('(' . $categoryEquals . ' OR a.catid IN
(' . (string) $subQuery . '))');
}
else
{
$query->where($categoryEquals);
}
}
elseif (is_array($categoryId) && (count($categoryId) > 0))
{
$categoryId = ArrayHelper::toInteger($categoryId);
$categoryId = implode(',', $categoryId);
if (!empty($categoryId))
{
$type = $this->getState('filter.category_id.include',
true) ? 'IN' : 'NOT IN';
$query->where('a.catid ' . $type . ' (' .
$categoryId . ')');
}
}
// Filter by author
$authorId = $this->getState('filter.author_id');
$authorWhere = '';
if (is_numeric($authorId))
{
$type = $this->getState('filter.author_id.include',
true) ? '= ' : '<> ';
$authorWhere = 'a.created_by ' . $type . (int) $authorId;
}
elseif (is_array($authorId))
{
$authorId = array_filter($authorId, 'is_numeric');
if ($authorId)
{
$authorId = implode(',', $authorId);
$type = $this->getState('filter.author_id.include',
true) ? 'IN' : 'NOT IN';
$authorWhere = 'a.created_by ' . $type . ' (' .
$authorId . ')';
}
}
// Filter by author alias
$authorAlias = $this->getState('filter.author_alias');
$authorAliasWhere = '';
if (is_string($authorAlias))
{
$type =
$this->getState('filter.author_alias.include', true) ? '=
' : '<> ';
$authorAliasWhere = 'a.created_by_alias ' . $type .
$db->quote($authorAlias);
}
elseif (is_array($authorAlias))
{
$first = current($authorAlias);
if (!empty($first))
{
foreach ($authorAlias as $key => $alias)
{
$authorAlias[$key] = $db->quote($alias);
}
$authorAlias = implode(',', $authorAlias);
if ($authorAlias)
{
$type =
$this->getState('filter.author_alias.include', true) ?
'IN' : 'NOT IN';
$authorAliasWhere = 'a.created_by_alias ' . $type . '
(' . $authorAlias .
')';
}
}
}
if (!empty($authorWhere) && !empty($authorAliasWhere))
{
$query->where('(' . $authorWhere . ' OR ' .
$authorAliasWhere . ')');
}
elseif (empty($authorWhere) && empty($authorAliasWhere))
{
// If both are empty we don't want to add to the query
}
else
{
// One of these is empty, the other is not so we just add both
$query->where($authorWhere . $authorAliasWhere);
}
// Define null and now dates
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
// Filter by start and end dates.
if ((!$user->authorise('core.edit.state',
'com_content')) &&
(!$user->authorise('core.edit', 'com_content')))
{
$query->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')');
}
// Filter by Date Range or Relative Date
$dateFiltering = $this->getState('filter.date_filtering',
'off');
$dateField = $this->getState('filter.date_field',
'a.created');
switch ($dateFiltering)
{
case 'range':
$startDateRange =
$db->quote($this->getState('filter.start_date_range',
$nullDate));
$endDateRange =
$db->quote($this->getState('filter.end_date_range',
$nullDate));
$query->where(
'(' . $dateField . ' >= ' . $startDateRange .
' AND ' . $dateField .
' <= ' . $endDateRange . ')'
);
break;
case 'relative':
$relativeDate = (int)
$this->getState('filter.relative_date', 0);
$query->where(
$dateField . ' >= ' . $query->dateAdd($nowDate, -1 *
$relativeDate, 'DAY')
);
break;
case 'off':
default:
break;
}
// Process the filter for list views with user-entered filters
if (is_object($params) &&
($params->get('filter_field') !== 'hide') &&
($filter = $this->getState('list.filter')))
{
// Clean filter variable
$filter = StringHelper::strtolower($filter);
$monthFilter = $filter;
$hitsFilter = (int) $filter;
$filter = $db->quote('%' . $db->escape($filter,
true) . '%', false);
switch ($params->get('filter_field'))
{
case 'author':
$query->where(
'LOWER( CASE WHEN a.created_by_alias > ' .
$db->quote(' ') .
' THEN a.created_by_alias ELSE ua.name END ) LIKE ' .
$filter . ' '
);
break;
case 'hits':
$query->where('a.hits >= ' . $hitsFilter . '
');
break;
case 'month':
if ($monthFilter != '')
{
$query->where(
$db->quote(date("Y-m-d", strtotime($monthFilter)) .
' 00:00:00') . ' <= CASE WHEN a.publish_up = ' .
$db->quote($db->getNullDate()) . ' THEN a.created ELSE
a.publish_up END'
);
$query->where(
$db->quote(date("Y-m-t", strtotime($monthFilter)) .
' 23:59:59') . ' >= CASE WHEN a.publish_up = ' .
$db->quote($db->getNullDate()) . ' THEN a.created ELSE
a.publish_up END'
);
}
break;
case 'title':
default:
// Default to 'title' if parameter is not valid
$query->where('LOWER( a.title ) LIKE ' . $filter);
break;
}
}
// Filter by language
if ($this->getState('filter.language'))
{
$query->where('a.language IN (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
}
// Filter by a single or group of tags.
$tagId = $this->getState('filter.tag');
if (is_array($tagId) && count($tagId) === 1)
{
$tagId = current($tagId);
}
if (is_array($tagId))
{
$tagId = implode(',', ArrayHelper::toInteger($tagId));
if ($tagId)
{
$subQuery = $db->getQuery(true)
->select('DISTINCT content_item_id')
->from($db->quoteName('#__contentitem_tag_map'))
->where('tag_id IN (' . $tagId . ')')
->where('type_alias = ' .
$db->quote('com_content.article'));
$query->innerJoin('(' . (string) $subQuery . ') AS
tagmap ON tagmap.content_item_id = a.id');
}
}
elseif ($tagId)
{
$query->innerJoin(
$db->quoteName('#__contentitem_tag_map',
'tagmap')
. ' ON tagmap.tag_id = ' . (int) $tagId
. ' AND tagmap.content_item_id = a.id'
. ' AND tagmap.type_alias = ' .
$db->quote('com_content.article')
);
}
// Add the list ordering clause.
$query->order($this->getState('list.ordering',
'a.ordering') . ' ' .
$this->getState('list.direction', 'ASC'));
return $query;
}
/**
* Method to get a list of articles.
*
* Overridden to inject convert the attribs field into a JParameter
object.
*
* @return mixed An array of objects on success, false on failure.
*
* @since 1.6
*/
public function getItems()
{
$items = parent::getItems();
$user = JFactory::getUser();
$userId = $user->get('id');
$guest = $user->get('guest');
$groups = $user->getAuthorisedViewLevels();
$input = JFactory::getApplication()->input;
// Get the global params
$globalParams = JComponentHelper::getParams('com_content',
true);
// Convert the parameter fields into objects.
foreach ($items as &$item)
{
$articleParams = new Registry($item->attribs);
// Unpack readmore and layout params
$item->alternative_readmore =
$articleParams->get('alternative_readmore');
$item->layout =
$articleParams->get('layout');
$item->params = clone $this->getState('params');
/**
* For blogs, article params override menu item params only if menu
param = 'use_article'
* Otherwise, menu item params control the layout
* If menu item is 'use_article' and there is no article
param, use global
*/
if (($input->getString('layout') === 'blog') ||
($input->getString('view') === 'featured')
||
($this->getState('params')->get('layout_type')
=== 'blog'))
{
// Create an array of just the params set to 'use_article'
$menuParamsArray =
$this->getState('params')->toArray();
$articleArray = array();
foreach ($menuParamsArray as $key => $value)
{
if ($value === 'use_article')
{
// If the article has a value, use it
if ($articleParams->get($key) != '')
{
// Get the value from the article
$articleArray[$key] = $articleParams->get($key);
}
else
{
// Otherwise, use the global value
$articleArray[$key] = $globalParams->get($key);
}
}
}
// Merge the selected article params
if (count($articleArray) > 0)
{
$articleParams = new Registry($articleArray);
$item->params->merge($articleParams);
}
}
else
{
// For non-blog layouts, merge all of the article params
$item->params->merge($articleParams);
}
// Get display date
switch ($item->params->get('list_show_date'))
{
case 'modified':
$item->displayDate = $item->modified;
break;
case 'published':
$item->displayDate = ($item->publish_up == 0) ?
$item->created : $item->publish_up;
break;
default:
case 'created':
$item->displayDate = $item->created;
break;
}
/**
* Compute the asset access permissions.
* Technically guest could edit an article, but lets not check that to
improve performance a little.
*/
if (!$guest)
{
$asset = 'com_content.article.' . $item->id;
// Check general edit permission first.
if ($user->authorise('core.edit', $asset))
{
$item->params->set('access-edit', true);
}
// Now check if edit.own is available.
elseif (!empty($userId) &&
$user->authorise('core.edit.own', $asset))
{
// Check for a valid user and that they are the owner.
if ($userId == $item->created_by)
{
$item->params->set('access-edit', true);
}
}
}
$access = $this->getState('filter.access');
if ($access)
{
// If the access filter has been set, we already have only the articles
this user can view.
$item->params->set('access-view', true);
}
else
{
// If no access filter is set, the layout takes some responsibility for
display of limited information.
if ($item->catid == 0 || $item->category_access === null)
{
$item->params->set('access-view',
in_array($item->access, $groups));
}
else
{
$item->params->set('access-view',
in_array($item->access, $groups) &&
in_array($item->category_access, $groups));
}
}
// Some contexts may not use tags data at all, so we allow callers to
disable loading tag data
if ($this->getState('load_tags',
$item->params->get('show_tags', '1')))
{
$item->tags = new JHelperTags;
$item->tags->getItemTags('com_content.article',
$item->id);
}
if ($item->params->get('show_associations'))
{
$item->associations =
ContentHelperAssociation::displayAssociations($item->id);
}
}
return $items;
}
/**
* Method to get the starting number of items for the data set.
*
* @return integer The starting number of items available in the data
set.
*
* @since 3.0.1
*/
public function getStart()
{
return $this->getState('list.start');
}
/**
* Count Items by Month
*
* @return mixed An array of objects on success, false on failure.
*
* @since 3.9.0
*/
public function countItemsByMonth()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$query
->select('DATE(' .
$query->concatenate(
array(
$query->year($query->quoteName('publish_up')),
$query->quote('-'),
$query->month($query->quoteName('publish_up')),
$query->quote('-01')
)
) . ') as d'
)
->select('COUNT(*) as c')
->from('(' . $this->getListQuery() . ') as b')
->group($query->quoteName('d'))
->order($query->quoteName('d') . ' desc');
return $db->setQuery($query)->loadObjectList();
}
}
PKZF�[D2�|
|
!com_content/models/categories.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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\Registry\Registry;
/**
* This models supports retrieving lists of article categories.
*
* @since 1.6
*/
class ContentModelCategories extends JModelList
{
/**
* Model context string.
*
* @var string
*/
public $_context = 'com_content.categories';
/**
* The category context (allows other extensions to derived from this
model).
*
* @var string
*/
protected $_extension = 'com_content';
private $_parent = null;
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering The field to order on.
* @param string $direction The direction to order on.
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
$this->setState('filter.extension', $this->_extension);
// Get the parent id if defined.
$parentId = $app->input->getInt('id');
$this->setState('filter.parentId', $parentId);
$params = $app->getParams();
$this->setState('params', $params);
$this->setState('filter.published', 1);
$this->setState('filter.access', true);
}
/**
* 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.
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.extension');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.parentId');
return parent::getStoreId($id);
}
/**
* Redefine the function an add some properties to make the styling more
easy
*
* @param bool $recursive True if you want to return children
recursively.
*
* @return mixed An array of data items on success, false on failure.
*
* @since 1.6
*/
public function getItems($recursive = false)
{
$store = $this->getStoreId();
if (!isset($this->cache[$store]))
{
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$params = new Registry;
if ($active)
{
$params->loadString($active->params);
}
$options = array();
$options['countItems'] =
$params->get('show_cat_num_articles_cat', 1) ||
!$params->get('show_empty_categories_cat', 0);
$categories = JCategories::getInstance('Content', $options);
$this->_parent =
$categories->get($this->getState('filter.parentId',
'root'));
if (is_object($this->_parent))
{
$this->cache[$store] =
$this->_parent->getChildren($recursive);
}
else
{
$this->cache[$store] = false;
}
}
return $this->cache[$store];
}
/**
* Get the parent.
*
* @return object An array of data items on success, false on failure.
*
* @since 1.6
*/
public function getParent()
{
if (!is_object($this->_parent))
{
$this->getItems();
}
return $this->_parent;
}
}
PKZF�[�u��W1W1com_content/models/category.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 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;
use Joomla\Utilities\ArrayHelper;
/**
* This models supports retrieving a category, the articles associated with
the category,
* sibling, child and parent categories.
*
* @since 1.5
*/
class ContentModelCategory extends JModelList
{
/**
* Category items data
*
* @var array
*/
protected $_item = null;
protected $_articles = null;
protected $_siblings = null;
protected $_children = null;
protected $_parent = null;
/**
* Model context string.
*
* @var string
*/
protected $_context = 'com_content.category';
/**
* The category that applies.
*
* @access protected
* @var object
*/
protected $_category = null;
/**
* The list of other newfeed categories.
*
* @access protected
* @var array
*/
protected $_categories = null;
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'catid', 'a.catid', 'category_title',
'state', 'a.state',
'access', 'a.access', 'access_level',
'created', 'a.created',
'created_by', 'a.created_by',
'modified', 'a.modified',
'ordering', 'a.ordering',
'featured', 'a.featured',
'language', 'a.language',
'hits', 'a.hits',
'publish_up', 'a.publish_up',
'publish_down', 'a.publish_down',
'author', 'a.author',
'filter_tag'
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering The field to order on.
* @param string $direction The direction to order on.
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication('site');
$pk = $app->input->getInt('id');
$this->setState('category.id', $pk);
// Load the parameters. Merge Global and Menu Item params into new object
$params = $app->getParams();
$menuParams = new Registry;
if ($menu = $app->getMenu()->getActive())
{
$menuParams->loadString($menu->params);
}
$mergedParams = clone $menuParams;
$mergedParams->merge($params);
$this->setState('params', $mergedParams);
$user = JFactory::getUser();
$asset = 'com_content';
if ($pk)
{
$asset .= '.category.' . $pk;
}
if ((!$user->authorise('core.edit.state', $asset))
&& (!$user->authorise('core.edit', $asset)))
{
// Limit to published for people who can't edit or edit.state.
$this->setState('filter.published', 1);
}
else
{
$this->setState('filter.published', array(0, 1, 2));
}
// Process show_noauth parameter
if (!$params->get('show_noauth'))
{
$this->setState('filter.access', true);
}
else
{
$this->setState('filter.access', false);
}
$itemid = $app->input->get('id', 0, 'int') .
':' . $app->input->get('Itemid', 0,
'int');
$value =
$this->getUserStateFromRequest('com_content.category.filter.'
. $itemid . '.tag', 'filter_tag', 0, 'int',
false);
$this->setState('filter.tag', $value);
// Optional filter text
$search =
$app->getUserStateFromRequest('com_content.category.list.' .
$itemid . '.filter-search', 'filter-search',
'', 'string');
$this->setState('list.filter', $search);
// Filter.order
$orderCol =
$app->getUserStateFromRequest('com_content.category.list.' .
$itemid . '.filter_order', 'filter_order',
'', 'string');
if (!in_array($orderCol, $this->filter_fields))
{
$orderCol = 'a.ordering';
}
$this->setState('list.ordering', $orderCol);
$listOrder =
$app->getUserStateFromRequest('com_content.category.list.' .
$itemid . '.filter_order_Dir', 'filter_order_Dir',
'', 'cmd');
if (!in_array(strtoupper($listOrder), array('ASC',
'DESC', '')))
{
$listOrder = 'ASC';
}
$this->setState('list.direction', $listOrder);
$this->setState('list.start',
$app->input->get('limitstart', 0, 'uint'));
// Set limit for query. If list, use parameter. If blog, add blog
parameters for limit.
if (($app->input->get('layout') === 'blog') ||
$params->get('layout_type') === 'blog')
{
$limit = $params->get('num_leading_articles') +
$params->get('num_intro_articles') +
$params->get('num_links');
$this->setState('list.links',
$params->get('num_links'));
}
else
{
$limit =
$app->getUserStateFromRequest('com_content.category.list.' .
$itemid . '.limit', 'limit',
$params->get('display_num'), 'uint');
}
$this->setState('list.limit', $limit);
// Set the depth of the category query based on parameter
$showSubcategories =
$params->get('show_subcategory_content', '0');
if ($showSubcategories)
{
$this->setState('filter.max_category_levels',
$params->get('show_subcategory_content', '1'));
$this->setState('filter.subcategories', true);
}
$this->setState('filter.language',
JLanguageMultilang::isEnabled());
$this->setState('layout',
$app->input->getString('layout'));
// Set the featured articles state
$this->setState('filter.featured',
$params->get('show_featured'));
}
/**
* Get the articles in the category
*
* @return mixed An array of articles or false if an error occurs.
*
* @since 1.5
*/
public function getItems()
{
$limit = $this->getState('list.limit');
if ($this->_articles === null && $category =
$this->getCategory())
{
$model = JModelLegacy::getInstance('Articles',
'ContentModel', array('ignore_request' => true));
$model->setState('params',
JFactory::getApplication()->getParams());
$model->setState('filter.category_id', $category->id);
$model->setState('filter.published',
$this->getState('filter.published'));
$model->setState('filter.access',
$this->getState('filter.access'));
$model->setState('filter.language',
$this->getState('filter.language'));
$model->setState('filter.featured',
$this->getState('filter.featured'));
$model->setState('list.ordering',
$this->_buildContentOrderBy());
$model->setState('list.start',
$this->getState('list.start'));
$model->setState('list.limit', $limit);
$model->setState('list.direction',
$this->getState('list.direction'));
$model->setState('list.filter',
$this->getState('list.filter'));
$model->setState('filter.tag',
$this->getState('filter.tag'));
// Filter.subcategories indicates whether to include articles from
subcategories in the list or blog
$model->setState('filter.subcategories',
$this->getState('filter.subcategories'));
$model->setState('filter.max_category_levels',
$this->getState('filter.max_category_levels'));
$model->setState('list.links',
$this->getState('list.links'));
if ($limit >= 0)
{
$this->_articles = $model->getItems();
if ($this->_articles === false)
{
$this->setError($model->getError());
}
}
else
{
$this->_articles = array();
}
$this->_pagination = $model->getPagination();
}
return $this->_articles;
}
/**
* Build the orderby for the query
*
* @return string $orderby portion of query
*
* @since 1.5
*/
protected function _buildContentOrderBy()
{
$app = JFactory::getApplication('site');
$db = $this->getDbo();
$params = $this->state->params;
$itemid = $app->input->get('id', 0, 'int') .
':' . $app->input->get('Itemid', 0,
'int');
$orderCol =
$app->getUserStateFromRequest('com_content.category.list.' .
$itemid . '.filter_order', 'filter_order',
'', 'string');
$orderDirn =
$app->getUserStateFromRequest('com_content.category.list.' .
$itemid . '.filter_order_Dir', 'filter_order_Dir',
'', 'cmd');
$orderby = ' ';
if (!in_array($orderCol, $this->filter_fields))
{
$orderCol = null;
}
if (!in_array(strtoupper($orderDirn), array('ASC',
'DESC', '')))
{
$orderDirn = 'ASC';
}
if ($orderCol && $orderDirn)
{
$orderby .= $db->escape($orderCol) . ' ' .
$db->escape($orderDirn) . ', ';
}
$articleOrderby = $params->get('orderby_sec',
'rdate');
$articleOrderDate = $params->get('order_date');
$categoryOrderby = $params->def('orderby_pri',
'');
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby,
$articleOrderDate) . ', ';
$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
$orderby .= $primary . ' ' . $secondary . ' a.created
';
return $orderby;
}
/**
* Method to get a JPagination object for the data set.
*
* @return JPagination A JPagination object for the data set.
*
* @since 3.0.1
*/
public function getPagination()
{
if (empty($this->_pagination))
{
return null;
}
return $this->_pagination;
}
/**
* Method to get category data for the current category
*
* @return object
*
* @since 1.5
*/
public function getCategory()
{
if (!is_object($this->_item))
{
if (isset($this->state->params))
{
$params = $this->state->params;
$options = array();
$options['countItems'] =
$params->get('show_cat_num_articles', 1) ||
!$params->get('show_empty_categories_cat', 0);
$options['access'] =
$params->get('check_access_rights', 1);
}
else
{
$options['countItems'] = 0;
}
$categories = JCategories::getInstance('Content', $options);
$this->_item =
$categories->get($this->getState('category.id',
'root'));
// Compute selected asset permissions.
if (is_object($this->_item))
{
$user = JFactory::getUser();
$asset = 'com_content.category.' . $this->_item->id;
// Check general create permission.
if ($user->authorise('core.create', $asset))
{
$this->_item->getParams()->set('access-create',
true);
}
// TODO: Why aren't we lazy loading the children and siblings?
$this->_children = $this->_item->getChildren();
$this->_parent = false;
if ($this->_item->getParent())
{
$this->_parent = $this->_item->getParent();
}
$this->_rightsibling = $this->_item->getSibling();
$this->_leftsibling = $this->_item->getSibling(false);
}
else
{
$this->_children = false;
$this->_parent = false;
}
}
return $this->_item;
}
/**
* Get the parent category.
*
* @return mixed An array of categories or false if an error occurs.
*
* @since 1.6
*/
public function getParent()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
return $this->_parent;
}
/**
* Get the left sibling (adjacent) categories.
*
* @return mixed An array of categories or false if an error occurs.
*
* @since 1.6
*/
public function &getLeftSibling()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
return $this->_leftsibling;
}
/**
* Get the right sibling (adjacent) categories.
*
* @return mixed An array of categories or false if an error occurs.
*
* @since 1.6
*/
public function &getRightSibling()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
return $this->_rightsibling;
}
/**
* Get the child categories.
*
* @return mixed An array of categories or false if an error occurs.
*
* @since 1.6
*/
public function &getChildren()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
// Order subcategories
if ($this->_children)
{
$params = $this->getState()->get('params');
$orderByPri = $params->get('orderby_pri');
if ($orderByPri === 'alpha' || $orderByPri ===
'ralpha')
{
$this->_children = ArrayHelper::sortObjects($this->_children,
'title', ($orderByPri === 'alpha') ? 1 : (-1));
}
}
return $this->_children;
}
/**
* Increment the hit counter for the category.
*
* @param int $pk Optional primary key of the category to increment.
*
* @return boolean True if successful; false otherwise and internal error
set.
*/
public function hit($pk = 0)
{
$input = JFactory::getApplication()->input;
$hitcount = $input->getInt('hitcount', 1);
if ($hitcount)
{
$pk = (!empty($pk)) ? $pk : (int)
$this->getState('category.id');
$table = JTable::getInstance('Category', 'JTable');
$table->hit($pk);
}
return true;
}
}
PK[F�[Vnڼcccom_content/models/featured.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 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;
use Joomla\Utilities\ArrayHelper;
JLoader::register('ContentModelArticles', __DIR__ .
'/articles.php');
/**
* Frontpage Component Model
*
* @since 1.5
*/
class ContentModelFeatured extends ContentModelArticles
{
/**
* Model context string.
*
* @var string
*/
public $_context = 'com_content.frontpage';
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering The field to order on.
* @param string $direction The direction to order on.
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
parent::populateState($ordering, $direction);
$input = JFactory::getApplication()->input;
$user = JFactory::getUser();
$app = JFactory::getApplication('site');
// List state information
$limitstart = $input->getUInt('limitstart', 0);
$this->setState('list.start', $limitstart);
$params = $this->state->params;
$menuParams = new Registry;
if ($menu = $app->getMenu()->getActive())
{
$menuParams->loadString($menu->params);
}
$mergedParams = clone $menuParams;
$mergedParams->merge($params);
$this->setState('params', $mergedParams);
$limit = $params->get('num_leading_articles') +
$params->get('num_intro_articles') +
$params->get('num_links');
$this->setState('list.limit', $limit);
$this->setState('list.links',
$params->get('num_links'));
$this->setState('filter.frontpage', true);
if ((!$user->authorise('core.edit.state',
'com_content')) &&
(!$user->authorise('core.edit', 'com_content')))
{
// Filter on published for those who do not have edit or edit.state
rights.
$this->setState('filter.published', 1);
}
else
{
$this->setState('filter.published', array(0, 1, 2));
}
// Process show_noauth parameter
if (!$params->get('show_noauth'))
{
$this->setState('filter.access', true);
}
else
{
$this->setState('filter.access', false);
}
// Check for category selection
if ($params->get('featured_categories') &&
implode(',', $params->get('featured_categories')) ==
true)
{
$featuredCategories = $params->get('featured_categories');
$this->setState('filter.frontpage.categories',
$featuredCategories);
}
$articleOrderby = $params->get('orderby_sec',
'rdate');
$articleOrderDate = $params->get('order_date');
$categoryOrderby = $params->def('orderby_pri',
'');
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby,
$articleOrderDate);
$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
$this->setState('list.ordering', $primary . $secondary .
', a.created DESC');
$this->setState('list.direction', '');
}
/**
* Method to get a list of articles.
*
* @return mixed An array of objects on success, false on failure.
*/
public function getItems()
{
$params = clone $this->getState('params');
$limit = $params->get('num_leading_articles') +
$params->get('num_intro_articles') +
$params->get('num_links');
if ($limit > 0)
{
$this->setState('list.limit', $limit);
return parent::getItems();
}
return array();
}
/**
* 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.
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= $this->getState('filter.frontpage');
return parent::getStoreId($id);
}
/**
* Get the list of items.
*
* @return JDatabaseQuery
*/
protected function getListQuery()
{
// Create a new query object.
$query = parent::getListQuery();
// Filter by categories
$featuredCategories =
$this->getState('filter.frontpage.categories');
if (is_array($featuredCategories) && !in_array('',
$featuredCategories))
{
$query->where('a.catid IN (' . implode(',',
ArrayHelper::toInteger($featuredCategories)) . ')');
}
return $query;
}
}
PK[F�[��5JJcom_content/models/form.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
// Base this model on the backend version.
JLoader::register('ContentModelArticle', JPATH_ADMINISTRATOR .
'/components/com_content/models/article.php');
/**
* Content Component Article Model
*
* @since 1.5
*/
class ContentModelForm extends ContentModelArticle
{
/**
* Model typeAlias string. Used for version history.
*
* @var string
*/
public $typeAlias = 'com_content.article';
/**
* 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();
// Load the parameters.
$params = $app->getParams();
$this->setState('params', $params);
if ($params && $params->get('enable_category') == 1
&& $params->get('catid'))
{
$catId = $params->get('catid');
}
else
{
$catId = 0;
}
// Load state from the request.
$pk = $app->input->getInt('a_id');
$this->setState('article.id', $pk);
$this->setState('article.catid',
$app->input->getInt('catid', $catId));
$return = $app->input->get('return', null,
'base64');
$this->setState('return_page', base64_decode($return));
$this->setState('layout',
$app->input->getString('layout'));
}
/**
* Method to get article data.
*
* @param integer $itemId The id of the article.
*
* @return mixed Content item data object on success, false on failure.
*/
public function getItem($itemId = null)
{
$itemId = (int) (!empty($itemId)) ? $itemId :
$this->getState('article.id');
// Get a row instance.
$table = $this->getTable();
// Attempt to load the row.
$return = $table->load($itemId);
// Check for a table object error.
if ($return === false && $table->getError())
{
$this->setError($table->getError());
return false;
}
$properties = $table->getProperties(1);
$value = ArrayHelper::toObject($properties, 'JObject');
// Convert attrib field to Registry.
$value->params = new Registry($value->attribs);
// Compute selected asset permissions.
$user = JFactory::getUser();
$userId = $user->get('id');
$asset = 'com_content.article.' . $value->id;
// Check general edit permission first.
if ($user->authorise('core.edit', $asset))
{
$value->params->set('access-edit', true);
}
// Now check if edit.own is available.
elseif (!empty($userId) &&
$user->authorise('core.edit.own', $asset))
{
// Check for a valid user and that they are the owner.
if ($userId == $value->created_by)
{
$value->params->set('access-edit', true);
}
}
// Check edit state permission.
if ($itemId)
{
// Existing item
$value->params->set('access-change',
$user->authorise('core.edit.state', $asset));
}
else
{
// New item.
$catId = (int) $this->getState('article.catid');
if ($catId)
{
$value->params->set('access-change',
$user->authorise('core.edit.state',
'com_content.category.' . $catId));
$value->catid = $catId;
}
else
{
$value->params->set('access-change',
$user->authorise('core.edit.state', 'com_content'));
}
}
$value->articletext = $value->introtext;
if (!empty($value->fulltext))
{
$value->articletext .= '<hr id="system-readmore"
/>' . $value->fulltext;
}
// Convert the metadata field to an array.
$registry = new Registry($value->metadata);
$value->metadata = $registry->toArray();
if ($itemId)
{
$value->tags = new JHelperTags;
$value->tags->getTagIds($value->id,
'com_content.article');
$value->metadata['tags'] = $value->tags;
}
return $value;
}
/**
* Get the return URL.
*
* @return string The return URL.
*
* @since 1.6
*/
public function getReturnPage()
{
return base64_encode($this->getState('return_page'));
}
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return boolean True on success.
*
* @since 3.2
*/
public function save($data)
{
// Associations are not edited in frontend ATM so we have to inherit them
if (JLanguageAssociations::isEnabled() &&
!empty($data['id'])
&& $associations =
JLanguageAssociations::getAssociations('com_content',
'#__content', 'com_content.item',
$data['id']))
{
foreach ($associations as $tag => $associated)
{
$associations[$tag] = (int) $associated->id;
}
$data['associations'] = $associations;
}
return parent::save($data);
}
/**
* Allows preprocessing of the JForm object.
*
* @param JForm $form The form object
* @param array $data The data to be merged into the form object
* @param string $group The plugin group to be executed
*
* @return void
*
* @since 3.7.0
*/
protected function preprocessForm(JForm $form, $data, $group =
'content')
{
$params = $this->getState()->get('params');
if ($params && $params->get('enable_category') == 1
&& $params->get('catid'))
{
$form->setFieldAttribute('catid', 'default',
$params->get('catid'));
$form->setFieldAttribute('catid', 'readonly',
'true');
}
parent::preprocessForm($form, $data, $group);
}
}
PK[F�[���""$com_content/models/forms/article.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset
addfieldpath="/administrator/components/com_categories/models/fields">
<field
name="id"
type="hidden"
label="COM_CONTENT_ID_LABEL"
class="inputbox"
id="id"
size="10"
default="0"
readonly="true"
/>
<field
name="contenthistory"
type="contenthistory"
label="JTOOLBAR_VERSIONS"
id="contenthistory"
data-typeAlias="com_content.article"
/>
<field
name="asset_id"
type="hidden"
filter="unset"
/>
<field
name="title"
type="text"
label="JGLOBAL_TITLE"
description="JFIELD_TITLE_DESC"
id="title"
class="inputbox"
size="30"
required="true"
/>
<field
name="alias"
type="text"
label="JFIELD_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC"
id="alias"
hint="JFIELD_ALIAS_PLACEHOLDER"
class="inputbox"
size="45"
/>
<field
name="articletext"
type="editor"
label="CONTENT_TEXT_LABEL"
description="CONTENT_TEXT_DESC"
buttons="true"
class="inputbox"
filter="JComponentHelper::filterText"
asset_id="com_content"
/>
<field
name="state"
type="list"
label="JSTATUS"
description="JFIELD_PUBLISHED_DESC"
id="state"
class="inputbox"
size="1"
default="1"
>
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
<option value="2">JARCHIVED</option>
<option value="-2">JTRASHED</option>
</field>
<field
name="featured"
type="list"
label="JGLOBAL_FIELD_FEATURED_LABEL"
description="JGLOBAL_FIELD_FEATURED_DESC"
id="featured"
class="inputbox"
default="0"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="catid"
type="categoryedit"
label="JCATEGORY"
description="JFIELD_CATEGORY_DESC"
id="catid"
extension="com_content"
class="inputbox"
required="true"
/>
<field
name="created"
type="calendar"
translateformat="true"
id="created"
filter="unset"
/>
<field
name="created_by"
type="text"
id="created_by"
filter="unset"
/>
<field
name="created_by_alias"
type="text"
label="JGLOBAL_FIELD_CREATED_BY_ALIAS_LABEL"
description="JGLOBAL_FIELD_CREATED_BY_ALIAS_DESC"
id="created_by_alias"
class="inputbox"
size="20"
/>
<field
name="note"
type="text"
label="COM_CONTENT_FIELD_NOTE_LABEL"
description="COM_CONTENT_FIELD_NOTE_DESC"
class="inputbox"
size="40"
maxlength="255"
/>
<field
name="version_note"
type="text"
label="JGLOBAL_FIELD_VERSION_NOTE_LABEL"
description="JGLOBAL_FIELD_VERSION_NOTE_DESC"
class="inputbox"
maxlength="255"
size="45"
labelclass="control-label"
/>
<field
name="publish_up"
type="calendar"
label="JGLOBAL_FIELD_PUBLISH_UP_LABEL"
description="JGLOBAL_FIELD_PUBLISH_UP_DESC"
id="publish_up"
class="inputbox"
translateformat="true"
showtime="true"
size="22"
filter="user_utc"
/>
<field
name="publish_down"
type="calendar"
label="JGLOBAL_FIELD_PUBLISH_DOWN_LABEL"
description="JGLOBAL_FIELD_PUBLISH_DOWN_DESC"
id="publish_down"
class="inputbox"
translateformat="true"
showtime="true"
size="22"
filter="user_utc"
/>
<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="JFIELD_LANGUAGE_DESC"
class="inputbox"
>
<option value="*">JALL</option>
</field>
<field
name="tags"
type="tag"
label="JTAG"
description="JTAG_DESC"
class="inputbox"
multiple="true"
size="45"
/>
<field
name="metakey"
type="textarea"
label="JFIELD_META_KEYWORDS_LABEL"
description="JFIELD_META_KEYWORDS_DESC"
id="metakey"
class="inputbox"
rows="5"
cols="50"
/>
<field
name="metadesc"
type="textarea"
label="JFIELD_META_DESCRIPTION_LABEL"
description="JFIELD_META_DESCRIPTION_DESC"
id="metadesc"
class="inputbox"
rows="5"
cols="50"
/>
<field
name="access"
type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
id="access"
class="inputbox"
size="1"
/>
<field
name="captcha"
type="captcha"
label="COM_CONTENT_CAPTCHA_LABEL"
description="COM_CONTENT_CAPTCHA_DESC"
validate="captcha"
namespace="article"
/>
</fieldset>
<fields name="images">
<fieldset name="image-intro">
<field
name="image_intro"
type="media"
label="COM_CONTENT_FIELD_INTRO_LABEL"
description="COM_CONTENT_FIELD_INTRO_DESC"
/>
<field
name="image_intro_alt"
type="text"
label="COM_CONTENT_FIELD_IMAGE_ALT_LABEL"
description="COM_CONTENT_FIELD_IMAGE_ALT_DESC"
class="inputbox"
size="20"
/>
<field
name="image_intro_caption"
type="text"
label="COM_CONTENT_FIELD_IMAGE_CAPTION_LABEL"
description="COM_CONTENT_FIELD_IMAGE_CAPTION_DESC"
class="inputbox"
size="20"
/>
<field
name="float_intro"
type="list"
label="COM_CONTENT_FLOAT_INTRO_LABEL"
description="COM_CONTENT_FLOAT_DESC"
useglobal="true"
>
<option value="right">COM_CONTENT_RIGHT</option>
<option value="left">COM_CONTENT_LEFT</option>
<option value="none">COM_CONTENT_NONE</option>
</field>
</fieldset>
<fieldset name="image-full">
<field
name="image_fulltext"
type="media"
label="COM_CONTENT_FIELD_FULL_LABEL"
description="COM_CONTENT_FIELD_FULL_DESC"
/>
<field
name="image_fulltext_alt"
type="text"
label="COM_CONTENT_FIELD_IMAGE_ALT_LABEL"
description="COM_CONTENT_FIELD_IMAGE_ALT_DESC"
class="inputbox"
size="20"
/>
<field
name="image_fulltext_caption"
type="text"
label="COM_CONTENT_FIELD_IMAGE_CAPTION_LABEL"
description="COM_CONTENT_FIELD_IMAGE_CAPTION_DESC"
class="inputbox"
size="20"
/>
<field
name="float_fulltext"
type="list"
label="COM_CONTENT_FLOAT_FULLTEXT_LABEL"
description="COM_CONTENT_FLOAT_DESC"
useglobal="true"
>
<option value="right">COM_CONTENT_RIGHT</option>
<option value="left">COM_CONTENT_LEFT</option>
<option value="none">COM_CONTENT_NONE</option>
</field>
</fieldset>
</fields>
<fields name="urls">
<field
name="urla"
type="url"
label="COM_CONTENT_FIELD_URLA_LABEL"
description="COM_CONTENT_FIELD_URL_DESC"
validate="url"
filter="url"
relative="true"
/>
<field
name="urlatext"
type="text"
label="COM_CONTENT_FIELD_URLA_LINK_TEXT_LABEL"
description="COM_CONTENT_FIELD_URL_LINK_TEXT_DESC"
class="inputbox"
size="20"
/>
<field
name="targeta"
type="hidden"
/>
<field
name="urlb"
type="url"
label="COM_CONTENT_FIELD_URLB_LABEL"
description="COM_CONTENT_FIELD_URL_DESC"
validate="url"
filter="url"
relative="true"
/>
<field
name="urlbtext"
type="text"
label="COM_CONTENT_FIELD_URLB_LINK_TEXT_LABEL"
description="COM_CONTENT_FIELD_URL_LINK_TEXT_DESC"
class="inputbox"
size="20"
/>
<field
name="targetb"
type="hidden"
/>
<field
name="urlc"
type="url"
label="COM_CONTENT_FIELD_URLC_LABEL"
description="COM_CONTENT_FIELD_URL_DESC"
validate="url"
filter="url"
relative="true"
/>
<field
name="urlctext"
type="text"
label="COM_CONTENT_FIELD_URLC_LINK_TEXT_LABEL"
description="COM_CONTENT_FIELD_URL_LINK_TEXT_DESC"
class="inputbox"
size="20"
/>
<field
name="targetc"
type="hidden"
/>
</fields>
<fields name="metadata">
<fieldset
name="jmetadata"
label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
<field
name="robots"
type="hidden"
label="JFIELD_METADATA_ROBOTS_LABEL"
description="JFIELD_METADATA_ROBOTS_DESC"
filter="unset"
labelclass="control-label"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="index, follow"></option>
<option value="noindex, follow"></option>
<option value="index, nofollow"></option>
<option value="noindex, nofollow"></option>
</field>
<field
name="author"
type="hidden"
label="JAUTHOR"
description="JFIELD_METADATA_AUTHOR_DESC"
filter="unset"
size="20"
labelclass="control-label"
/>
<field
name="rights"
type="hidden"
label="JFIELD_META_RIGHTS_LABEL"
description="JFIELD_META_RIGHTS_DESC"
filter="unset"
labelclass="control-label"
/>
<field
name="xreference"
type="hidden"
label="COM_CONTENT_FIELD_XREFERENCE_LABEL"
description="COM_CONTENT_FIELD_XREFERENCE_DESC"
filter="unset"
class="inputbox"
size="20"
labelclass="control-label"
/>
</fieldset>
</fields>
</form>
PK\F�[�����,com_content/models/forms/filter_articles.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_CONTENT_MODAL_FILTER_SEARCH_LABEL"
description="COM_CONTENT_MODAL_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="published"
type="status"
label="COM_CONTENT_FILTER_PUBLISHED"
description="COM_CONTENT_FILTER_PUBLISHED_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
name="category_id"
type="category"
label="JOPTION_FILTER_CATEGORY"
description="JOPTION_FILTER_CATEGORY_DESC"
multiple="true"
class="multipleCategories"
extension="com_content"
onchange="this.form.submit();"
published="0,1,2"
/>
<field
name="access"
type="accesslevel"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"
/>
<field
name="author_id"
type="author"
label="COM_CONTENT_FILTER_AUTHOR"
description="COM_CONTENT_FILTER_AUTHOR_DESC"
multiple="true"
class="multipleAuthors"
onchange="this.form.submit();"
>
<option value="0">JNONE</option>
</field>
<field
name="level"
type="integer"
label="JOPTION_FILTER_LEVEL"
description="JOPTION_FILTER_LEVEL_DESC"
first="1"
last="10"
step="1"
languages="*"
onchange="this.form.submit();"
>
<option
value="">JOPTION_SELECT_MAX_LEVELS</option>
</field>
<field
name="language"
type="contentlanguage"
label="JOPTION_FILTER_LANGUAGE"
description="JOPTION_FILTER_LANGUAGE_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
<field
name="tag"
type="tag"
label="JOPTION_FILTER_TAG"
description="JOPTION_FILTER_TAG_DESC"
multiple="true"
class="multipleTags"
mode="nested"
onchange="this.form.submit();"
/>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="a.title 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.state ASC">JSTATUS_ASC</option>
<option value="a.state DESC">JSTATUS_DESC</option>
<option value="a.title
ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.title
DESC">JGLOBAL_TITLE_DESC</option>
<option value="category_title
ASC">JCATEGORY_ASC</option>
<option value="category_title
DESC">JCATEGORY_DESC</option>
<option value="association ASC"
requires="associations">JASSOCIATIONS_ASC</option>
<option value="association DESC"
requires="associations">JASSOCIATIONS_DESC</option>
<option value="a.access
ASC">JGRID_HEADING_ACCESS_ASC</option>
<option value="a.access
DESC">JGRID_HEADING_ACCESS_DESC</option>
<option value="a.created_by
ASC">JAUTHOR_ASC</option>
<option value="a.created_by
DESC">JAUTHOR_DESC</option>
<option value="language
ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="language
DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="a.created ASC">JDATE_ASC</option>
<option value="a.created DESC">JDATE_DESC</option>
<option value="a.id
ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id
DESC">JGRID_HEADING_ID_DESC</option>
<option value="a.featured
ASC">JFEATURED_ASC</option>
<option value="a.featured
DESC">JFEATURED_DESC</option>
<option value="a.hits
ASC">JGLOBAL_HITS_ASC</option>
<option value="a.hits
DESC">JGLOBAL_HITS_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_CONTENT_LIST_LIMIT"
description="COM_CONTENT_LIST_LIMIT_DESC"
class="inputbox input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>
PK\F�[S
3��com_content/router.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Routing class of com_content
*
* @since 3.3
*/
class ContentRouter extends JComponentRouterView
{
protected $noIDs = false;
/**
* Content Component router constructor
*
* @param JApplicationCms $app The application object
* @param JMenu $menu The menu object to work with
*/
public function __construct($app = null, $menu = null)
{
$params = JComponentHelper::getParams('com_content');
$this->noIDs = (bool) $params->get('sef_ids');
$categories = new
JComponentRouterViewconfiguration('categories');
$categories->setKey('id');
$this->registerView($categories);
$category = new JComponentRouterViewconfiguration('category');
$category->setKey('id')->setParent($categories,
'catid')->setNestable()->addLayout('blog');
$this->registerView($category);
$article = new JComponentRouterViewconfiguration('article');
$article->setKey('id')->setParent($category,
'catid');
$this->registerView($article);
$this->registerView(new
JComponentRouterViewconfiguration('archive'));
$this->registerView(new
JComponentRouterViewconfiguration('featured'));
$form = new JComponentRouterViewconfiguration('form');
$form->setKey('a_id');
$this->registerView($form);
parent::__construct($app, $menu);
$this->attachRule(new JComponentRouterRulesMenu($this));
if ($params->get('sef_advanced', 0))
{
$this->attachRule(new JComponentRouterRulesStandard($this));
$this->attachRule(new JComponentRouterRulesNomenu($this));
}
else
{
JLoader::register('ContentRouterRulesLegacy', __DIR__ .
'/helpers/legacyrouter.php');
$this->attachRule(new ContentRouterRulesLegacy($this));
}
}
/**
* Method to get the segment(s) for a category
*
* @param string $id ID of the category to retrieve the segments
for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getCategorySegment($id, $query)
{
$category = JCategories::getInstance($this->getName())->get($id);
if ($category)
{
$path = array_reverse($category->getPath(), true);
$path[0] = '1:root';
if ($this->noIDs)
{
foreach ($path as &$segment)
{
list($id, $segment) = explode(':', $segment, 2);
}
}
return $path;
}
return array();
}
/**
* Method to get the segment(s) for a category
*
* @param string $id ID of the category to retrieve the segments
for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getCategoriesSegment($id, $query)
{
return $this->getCategorySegment($id, $query);
}
/**
* Method to get the segment(s) for an article
*
* @param string $id ID of the article to retrieve the segments for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getArticleSegment($id, $query)
{
if (!strpos($id, ':'))
{
$db = JFactory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($dbquery->qn('alias'))
->from($dbquery->qn('#__content'))
->where('id = ' . $dbquery->q($id));
$db->setQuery($dbquery);
$id .= ':' . $db->loadResult();
}
if ($this->noIDs)
{
list($void, $segment) = explode(':', $id, 2);
return array($void => $segment);
}
return array((int) $id => $id);
}
/**
* Method to get the segment(s) for a form
*
* @param string $id ID of the article form to retrieve the
segments for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*
* @since 3.7.3
*/
public function getFormSegment($id, $query)
{
return $this->getArticleSegment($id, $query);
}
/**
* Method to get the id for a category
*
* @param string $segment Segment to retrieve the ID for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getCategoryId($segment, $query)
{
if (isset($query['id']))
{
$category = JCategories::getInstance($this->getName(),
array('access' => false))->get($query['id']);
if ($category)
{
foreach ($category->getChildren() as $child)
{
if ($this->noIDs)
{
if ($child->alias == $segment)
{
return $child->id;
}
}
else
{
if ($child->id == (int) $segment)
{
return $child->id;
}
}
}
}
}
return false;
}
/**
* Method to get the segment(s) for a category
*
* @param string $segment Segment to retrieve the ID for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getCategoriesId($segment, $query)
{
return $this->getCategoryId($segment, $query);
}
/**
* Method to get the segment(s) for an article
*
* @param string $segment Segment of the article to retrieve the ID
for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getArticleId($segment, $query)
{
if ($this->noIDs)
{
$db = JFactory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($dbquery->qn('id'))
->from($dbquery->qn('#__content'))
->where('alias = ' . $dbquery->q($segment))
->where('catid = ' .
$dbquery->q($query['id']));
$db->setQuery($dbquery);
return (int) $db->loadResult();
}
return (int) $segment;
}
}
/**
* Content router functions
*
* These functions are proxys for the new router interface
* for old SEF extensions.
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent URL.
*
* @deprecated 4.0 Use Class based routers instead
*/
function contentBuildRoute(&$query)
{
$app = JFactory::getApplication();
$router = new ContentRouter($app, $app->getMenu());
return $router->build($query);
}
/**
* Parse the segments of a URL.
*
* This function is a proxy for the new router interface
* for old SEF extensions.
*
* @param array $segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
* @deprecated 4.0 Use Class based routers instead
*/
function contentParseRoute($segments)
{
$app = JFactory::getApplication();
$router = new ContentRouter($app, $app->getMenu());
return $router->parse($segments);
}
PK]F�[�_�
*com_content/views/archive/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 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');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.caption');
?>
<div class="archive<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<form id="adminForm" action="<?php echo
JRoute::_('index.php'); ?>" method="post"
class="form-inline">
<fieldset class="filters">
<div class="filter-search">
<?php if ($this->params->get('filter_field') !==
'hide') : ?>
<label class="filter-search-lbl element-invisible"
for="filter-search"><?php echo
JText::_('COM_CONTENT_TITLE_FILTER_LABEL') .
' '; ?></label>
<input type="text" name="filter-search"
id="filter-search" value="<?php echo
$this->escape($this->filter); ?>" class="inputbox
span2"
onchange="document.getElementById('adminForm').submit();"
placeholder="<?php echo
JText::_('COM_CONTENT_TITLE_FILTER_LABEL'); ?>" />
<?php endif; ?>
<?php echo $this->form->monthField; ?>
<?php echo $this->form->yearField; ?>
<?php echo $this->form->limitField; ?>
<button type="submit" class="btn btn-primary"
style="vertical-align: top;"><?php echo
JText::_('JGLOBAL_FILTER_BUTTON'); ?></button>
<input type="hidden" name="view"
value="archive" />
<input type="hidden" name="option"
value="com_content" />
<input type="hidden" name="limitstart"
value="0" />
</div>
<br />
</fieldset>
<?php echo $this->loadTemplate('items'); ?>
</form>
</div>
PK]F�[4��zz*com_content/views/archive/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTENT_ARCHIVE_VIEW_DEFAULT_TITLE"
option="COM_CONTENT_ARCHIVE_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_ARTICLE_ARCHIVED"
/>
<message>
<![CDATA[com_content_archive_view_default_desc]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_categories/models/fields"
>
<field
name="catid"
type="category"
extension="com_content"
multiple="true"
size="5"
label="JCATEGORY"
description="JFIELD_CATEGORY_DESC"
>
<option value="">JOPTION_ALL_CATEGORIES</option>
</field>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<!-- Basic options. -->
<fieldset name="basic"
label="JGLOBAL_ARCHIVE_OPTIONS"
>
<field
name="orderby_sec"
type="list"
label="JGLOBAL_ARTICLE_ORDER_LABEL"
description="JGLOBAL_ARTICLE_ORDER_DESC"
default="alpha"
>
<option
value="date">JGLOBAL_OLDEST_FIRST</option>
<option
value="rdate">JGLOBAL_MOST_RECENT_FIRST</option>
<option
value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option
value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option
value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option>
<option
value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option>
<option value="hits">JGLOBAL_MOST_HITS</option>
<option value="rhits">JGLOBAL_LEAST_HITS</option>
<option
value="order">JGLOBAL_ARTICLE_MANAGER_ORDER</option>
<option value="vote"
requires="vote">JGLOBAL_VOTES_DESC</option>
<option value="rvote"
requires="vote">JGLOBAL_VOTES_ASC</option>
<option value="rank"
requires="vote">JGLOBAL_RATINGS_DESC</option>
<option value="rrank"
requires="vote">JGLOBAL_RATINGS_ASC</option>
</field>
<field
name="order_date"
type="list"
label="JGLOBAL_ORDERING_DATE_LABEL"
description="JGLOBAL_ORDERING_DATE_DESC"
default="created"
>
<option value="created">JGLOBAL_Created</option>
<option
value="modified">JGLOBAL_Modified</option>
<option value="published">JPUBLISHED</option>
</field>
<field
name="display_num"
type="list"
label="JGLOBAL_NUMBER_ITEMS_LIST_LABEL"
description="JGLOBAL_NUMBER_ITEMS_LIST_DESC"
default="5"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="100">J100</option>
<option value="0">JALL</option>
</field>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
default=""
useglobal="true"
>
<option value="hide">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="introtext_limit"
type="number"
label="JGLOBAL_ARCHIVE_ARTICLES_FIELD_INTROTEXTLIMIT_LABEL"
description="JGLOBAL_ARCHIVE_ARTICLES_FIELD_INTROTEXTLIMIT_DESC"
default="100"
/>
</fieldset>
<!-- Articles options. -->
<fieldset name="articles"
label="COM_CONTENT_ATTRIBS_ARTICLE_SETTINGS_LABEL"
>
<field
name="show_intro"
type="list"
label="JGLOBAL_SHOW_INTRO_LABEL"
description="JGLOBAL_SHOW_INTRO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="info_block_position"
type="list"
label="COM_CONTENT_FIELD_INFOBLOCK_POSITION_LABEL"
description="COM_CONTENT_FIELD_INFOBLOCK_POSITION_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option
value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option>
<option
value="1">COM_CONTENT_FIELD_OPTION_BELOW</option>
<option
value="2">COM_CONTENT_FIELD_OPTION_SPLIT</option>
</field>
<field
name="info_block_show_title"
type="list"
label="COM_CONTENT_FIELD_INFOBLOCK_TITLE_LABEL"
description="COM_CONTENT_FIELD_INFOBLOCK_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_category"
type="list"
label="JGLOBAL_SHOW_CATEGORY_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_category"
type="list"
label="JGLOBAL_LINK_CATEGORY_LABEL"
description="JGLOBAL_LINK_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_parent_category"
type="list"
label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_parent_category"
type="list"
label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
description="JGLOBAL_LINK_PARENT_CATEGORY_DESC"
useglobal="true"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="link_titles"
type="list"
label="JGLOBAL_LINKED_TITLES_LABEL"
description="JGLOBAL_LINKED_TITLES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_author"
type="list"
label="JGLOBAL_SHOW_AUTHOR_LABEL"
description="JGLOBAL_SHOW_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_author"
type="list"
label="JGLOBAL_LINK_AUTHOR_LABEL"
description="JGLOBAL_LINK_AUTHOR_DESC"
useglobal="true"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_create_date"
type="list"
label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
description="JGLOBAL_SHOW_CREATE_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_modify_date"
type="list"
label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
description="JGLOBAL_SHOW_MODIFY_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_publish_date"
type="list"
label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_item_navigation"
type="list"
label="JGLOBAL_SHOW_NAVIGATION_LABEL"
description="JGLOBAL_SHOW_NAVIGATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_hits"
type="list"
label="JGLOBAL_SHOW_HITS_LABEL"
description="JGLOBAL_SHOW_HITS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>
PK`F�[|6�;
%
%0com_content/views/archive/tmpl/default_items.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 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');
$params = $this->params;
?>
<div id="archive-items">
<?php foreach ($this->items as $i => $item) : ?>
<?php $info =
$item->params->get('info_block_position', 0); ?>
<div class="row<?php echo $i % 2; ?>" itemscope
itemtype="https://schema.org/Article">
<div class="page-header">
<h2 itemprop="headline">
<?php if ($params->get('link_titles')) : ?>
<a href="<?php echo
JRoute::_(ContentHelperRoute::getArticleRoute($item->slug,
$item->catid, $item->language)); ?>"
itemprop="url">
<?php echo $this->escape($item->title); ?>
</a>
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
</h2>
<?php // Content is generated by content plugin event
"onContentAfterTitle" ?>
<?php echo $item->event->afterDisplayTitle; ?>
<?php if ($params->get('show_author') &&
!empty($item->author )) : ?>
<div class="createdby" itemprop="author"
itemscope itemtype="https://schema.org/Person">
<?php $author = $item->created_by_alias ?: $item->author;
?>
<?php $author = '<span itemprop="name">'
. $author . '</span>'; ?>
<?php if (!empty($item->contact_link) &&
$params->get('link_author') == true) : ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY',
JHtml::_('link', $this->item->contact_link, $author,
array('itemprop' => 'url'))); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY',
$author); ?>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<?php $useDefList = ($params->get('show_modify_date') ||
$params->get('show_publish_date') ||
$params->get('show_create_date')
|| $params->get('show_hits') ||
$params->get('show_category') ||
$params->get('show_parent_category')); ?>
<?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
<div class="article-info muted">
<dl class="article-info">
<dt class="article-info-term">
<?php echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?>
</dt>
<?php if ($params->get('show_parent_category')
&& !empty($item->parent_slug)) : ?>
<dd>
<div class="parent-category-name">
<?php $title = $this->escape($item->parent_title); ?>
<?php if ($params->get('link_parent_category')
&& !empty($item->parent_slug)) : ?>
<?php $url = '<a href="' .
JRoute::_(ContentHelperRoute::getCategoryRoute($item->parent_slug)) .
'" itemprop="genre">' . $title .
'</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $url);
?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT',
'<span itemprop="genre">' . $title .
'</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_category')) : ?>
<dd>
<div class="category-name">
<?php $title = $this->escape($item->category_title); ?>
<?php if ($params->get('link_category') &&
$item->catslug) : ?>
<?php $url = '<a href="' .
JRoute::_(ContentHelperRoute::getCategoryRoute($item->catslug)) .
'" itemprop="genre">' . $title .
'</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY',
$url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY',
'<span itemprop="genre">' . $title .
'</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd>
<div class="published">
<span class="icon-calendar"
aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date',
$item->publish_up, 'c'); ?>"
itemprop="datePublished">
<?php echo
JText::sprintf('COM_CONTENT_PUBLISHED_DATE_ON',
JHtml::_('date', $item->publish_up,
JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($info == 0) : ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd>
<div class="modified">
<span class="icon-calendar"
aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date',
$item->modified, 'c'); ?>"
itemprop="dateModified">
<?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED',
JHtml::_('date', $item->modified,
JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_create_date')) : ?>
<dd>
<div class="create">
<span class="icon-calendar"
aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date',
$item->created, 'c'); ?>"
itemprop="dateCreated">
<?php echo
JText::sprintf('COM_CONTENT_CREATED_DATE_ON',
JHtml::_('date', $item->created,
JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<dd>
<div class="hits">
<span class="icon-eye-open"></span>
<meta itemprop="interactionCount"
content="UserPageVisits:<?php echo $item->hits; ?>"
/>
<?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS',
$item->hits); ?>
</div>
</dd>
<?php endif; ?>
<?php endif; ?>
</dl>
</div>
<?php endif; ?>
<?php // Content is generated by content plugin event
"onContentBeforeDisplay" ?>
<?php echo $item->event->beforeDisplayContent; ?>
<?php if ($params->get('show_intro')) : ?>
<div class="intro" itemprop="articleBody">
<?php echo JHtml::_('string.truncateComplex',
$item->introtext, $params->get('introtext_limit')); ?>
</div>
<?php endif; ?>
<?php if ($useDefList && ($info == 1 || $info == 2)) : ?>
<div class="article-info muted">
<dl class="article-info">
<dt class="article-info-term"><?php echo
JText::_('COM_CONTENT_ARTICLE_INFO'); ?></dt>
<?php if ($info == 1) : ?>
<?php if ($params->get('show_parent_category')
&& !empty($item->parent_slug)) : ?>
<dd>
<div class="parent-category-name">
<?php $title = $this->escape($item->parent_title); ?>
<?php if ($params->get('link_parent_category')
&& $item->parent_slug) : ?>
<?php $url = '<a href="' .
JRoute::_(ContentHelperRoute::getCategoryRoute($item->parent_slug)) .
'" itemprop="genre">' . $title .
'</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT',
$url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT',
'<span itemprop="genre">' . $title .
'</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_category')) : ?>
<dd>
<div class="category-name">
<?php $title = $this->escape($item->category_title); ?>
<?php if ($params->get('link_category') &&
$item->catslug) : ?>
<?php $url = '<a href="' .
JRoute::_(ContentHelperRoute::getCategoryRoute($item->catslug)) .
'" itemprop="genre">' . $title .
'</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY',
$url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY',
'<span itemprop="genre">' . $title .
'</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd>
<div class="published">
<span class="icon-calendar"
aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date',
$item->publish_up, 'c'); ?>"
itemprop="datePublished">
<?php echo
JText::sprintf('COM_CONTENT_PUBLISHED_DATE_ON',
JHtml::_('date', $item->publish_up,
JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php endif; ?>
<?php if ($params->get('show_create_date')) : ?>
<dd>
<div class="create">
<span class="icon-calendar"
aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date',
$item->created, 'c'); ?>"
itemprop="dateCreated">
<?php echo
JText::sprintf('COM_CONTENT_CREATED_DATE_ON',
JHtml::_('date', $item->modified,
JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd>
<div class="modified">
<span class="icon-calendar"
aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date',
$item->modified, 'c'); ?>"
itemprop="dateModified">
<?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED',
JHtml::_('date', $item->modified,
JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<dd>
<div class="hits">
<span class="icon-eye-open"></span>
<meta content="UserPageVisits:<?php echo $item->hits;
?>" itemprop="interactionCount" />
<?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS',
$item->hits); ?>
</div>
</dd>
<?php endif; ?>
</dl>
</div>
<?php endif; ?>
<?php // Content is generated by content plugin event
"onContentAfterDisplay" ?>
<?php echo $item->event->afterDisplayContent; ?>
</div>
<?php endforeach; ?>
</div>
<div class="pagination">
<p class="counter"> <?php echo
$this->pagination->getPagesCounter(); ?> </p>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
PK`F�[s���AA'com_content/views/archive/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Content component
*
* @since 1.5
*/
class ContentViewArchive extends JViewLegacy
{
protected $state = null;
protected $item = null;
protected $items = null;
protected $pagination = null;
protected $years = null;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$user = JFactory::getUser();
$state = $this->get('State');
$items = $this->get('Items');
$pagination = $this->get('Pagination');
// Flag indicates to not add limitstart=0 to URL
$pagination->hideEmptyLimitstart = true;
// Get the page/component configuration
$params = &$state->params;
JPluginHelper::importPlugin('content');
foreach ($items as $item)
{
$item->catslug = $item->category_alias ? ($item->catid .
':' . $item->category_alias) : $item->catid;
$item->parent_slug = $item->parent_alias ? ($item->parent_id .
':' . $item->parent_alias) : $item->parent_id;
// No link for ROOT category
if ($item->parent_alias === 'root')
{
$item->parent_slug = null;
}
$item->event = new stdClass;
$dispatcher = JEventDispatcher::getInstance();
// Old plugins: Ensure that text property is available
if (!isset($item->text))
{
$item->text = $item->introtext;
}
$dispatcher->trigger('onContentPrepare', array
('com_content.archive', &$item, &$item->params, 0));
// Old plugins: Use processed text as introtext
$item->introtext = $item->text;
$results = $dispatcher->trigger('onContentAfterTitle',
array('com_content.archive', &$item, &$item->params,
0));
$item->event->afterDisplayTitle = trim(implode("\n",
$results));
$results = $dispatcher->trigger('onContentBeforeDisplay',
array('com_content.archive', &$item, &$item->params,
0));
$item->event->beforeDisplayContent = trim(implode("\n",
$results));
$results = $dispatcher->trigger('onContentAfterDisplay',
array('com_content.archive', &$item, &$item->params,
0));
$item->event->afterDisplayContent = trim(implode("\n",
$results));
}
$form = new stdClass;
// Month Field
$months = array(
'' => JText::_('COM_CONTENT_MONTH'),
'1' => JText::_('JANUARY_SHORT'),
'2' => JText::_('FEBRUARY_SHORT'),
'3' => JText::_('MARCH_SHORT'),
'4' => JText::_('APRIL_SHORT'),
'5' => JText::_('MAY_SHORT'),
'6' => JText::_('JUNE_SHORT'),
'7' => JText::_('JULY_SHORT'),
'8' => JText::_('AUGUST_SHORT'),
'9' => JText::_('SEPTEMBER_SHORT'),
'10' => JText::_('OCTOBER_SHORT'),
'11' => JText::_('NOVEMBER_SHORT'),
'12' => JText::_('DECEMBER_SHORT')
);
$form->monthField = JHtml::_(
'select.genericlist',
$months,
'month',
array(
'list.attr' => 'size="1"
class="inputbox"',
'list.select' => $state->get('filter.month'),
'option.key' => null
)
);
// Year Field
$this->years = $this->getModel()->getYears();
$years = array();
$years[] = JHtml::_('select.option', null,
JText::_('JYEAR'));
for ($i = 0, $iMax = count($this->years); $i < $iMax; $i++)
{
$years[] = JHtml::_('select.option', $this->years[$i],
$this->years[$i]);
}
$form->yearField = JHtml::_(
'select.genericlist',
$years,
'year',
array('list.attr' => 'size="1"
class="inputbox"', 'list.select' =>
$state->get('filter.year'))
);
$form->limitField = $pagination->getLimitBox();
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($params->get('pageclass_sfx', ''));
$this->filter = $state->get('list.filter');
$this->form = &$form;
$this->items = &$items;
$this->params = &$params;
$this->user = &$user;
$this->pagination = &$pagination;
$this->pagination->setAdditionalUrlParam('month',
$state->get('filter.month'));
$this->pagination->setAdditionalUrlParam('year',
$state->get('filter.year'));
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('JGLOBAL_ARTICLES'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
}
PK`F�[}����*com_content/views/article/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 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');
// Create shortcuts to some parameters.
$params = $this->item->params;
$urls = json_decode($this->item->urls);
$canEdit = $params->get('access-edit');
$user = JFactory::getUser();
$info = $params->get('info_block_position', 0);
// Check if associations are implemented. If they are, define the
parameter.
$assocParam = (JLanguageAssociations::isEnabled() &&
$params->get('show_associations'));
JHtml::_('behavior.caption');
$currentDate = JFactory::getDate()->format('Y-m-d
H:i:s');
$isNotPublishedYet = $this->item->publish_up > $currentDate;
$isExpired = $this->item->publish_down < $currentDate
&& $this->item->publish_down !==
JFactory::getDbo()->getNullDate();
?>
<div class="item-page<?php echo $this->pageclass_sfx;
?>" itemscope itemtype="https://schema.org/Article">
<meta itemprop="inLanguage" content="<?php echo
($this->item->language === '*') ?
JFactory::getConfig()->get('language') :
$this->item->language; ?>" />
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1> <?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif;
if (!empty($this->item->pagination) &&
$this->item->pagination &&
!$this->item->paginationposition &&
$this->item->paginationrelative)
{
echo $this->item->pagination;
}
?>
<?php // Todo Not that elegant would be nice to group the params ?>
<?php $useDefList = ($params->get('show_modify_date') ||
$params->get('show_publish_date') ||
$params->get('show_create_date')
|| $params->get('show_hits') ||
$params->get('show_category') ||
$params->get('show_parent_category') ||
$params->get('show_author') || $assocParam); ?>
<?php if (!$useDefList && $this->print) : ?>
<div id="pop-print" class="btn hidden-print">
<?php echo JHtml::_('icon.print_screen', $this->item,
$params); ?>
</div>
<div class="clearfix"> </div>
<?php endif; ?>
<?php if ($params->get('show_title')) : ?>
<div class="page-header">
<h2 itemprop="headline">
<?php echo $this->escape($this->item->title); ?>
</h2>
<?php if ($this->item->state == 0) : ?>
<span class="label label-warning"><?php echo
JText::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php if ($isNotPublishedYet) : ?>
<span class="label label-warning"><?php echo
JText::_('JNOTPUBLISHEDYET'); ?></span>
<?php endif; ?>
<?php if ($isExpired) : ?>
<span class="label label-warning"><?php echo
JText::_('JEXPIRED'); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if (!$this->print) : ?>
<?php if ($canEdit || $params->get('show_print_icon') ||
$params->get('show_email_icon')) : ?>
<?php echo JLayoutHelper::render('joomla.content.icons',
array('params' => $params, 'item' =>
$this->item, 'print' => false)); ?>
<?php endif; ?>
<?php else : ?>
<?php if ($useDefList) : ?>
<div id="pop-print" class="btn hidden-print">
<?php echo JHtml::_('icon.print_screen', $this->item,
$params); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php // Content is generated by content plugin event
"onContentAfterTitle" ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
<?php // Todo: for Joomla4 joomla.content.info_block.block can be
changed to joomla.content.info_block ?>
<?php echo
JLayoutHelper::render('joomla.content.info_block.block',
array('item' => $this->item, 'params' =>
$params, 'position' => 'above')); ?>
<?php endif; ?>
<?php if ($info == 0 && $params->get('show_tags',
1) && !empty($this->item->tags->itemTags)) : ?>
<?php $this->item->tagLayout = new
JLayoutFile('joomla.content.tags'); ?>
<?php echo
$this->item->tagLayout->render($this->item->tags->itemTags);
?>
<?php endif; ?>
<?php // Content is generated by content plugin event
"onContentBeforeDisplay" ?>
<?php echo $this->item->event->beforeDisplayContent; ?>
<?php if (isset($urls) && ((!empty($urls->urls_position)
&& ($urls->urls_position == '0')) ||
($params->get('urls_position') == '0' &&
empty($urls->urls_position)))
|| (empty($urls->urls_position) &&
(!$params->get('urls_position')))) : ?>
<?php echo $this->loadTemplate('links'); ?>
<?php endif; ?>
<?php if ($params->get('access-view')) : ?>
<?php echo JLayoutHelper::render('joomla.content.full_image',
$this->item); ?>
<?php
if (!empty($this->item->pagination) &&
$this->item->pagination &&
!$this->item->paginationposition &&
!$this->item->paginationrelative) :
echo $this->item->pagination;
endif;
?>
<?php if (isset ($this->item->toc)) :
echo $this->item->toc;
endif; ?>
<div itemprop="articleBody">
<?php echo $this->item->text; ?>
</div>
<?php if ($info == 1 || $info == 2) : ?>
<?php if ($useDefList) : ?>
<?php // Todo: for Joomla4 joomla.content.info_block.block can be
changed to joomla.content.info_block ?>
<?php echo
JLayoutHelper::render('joomla.content.info_block.block',
array('item' => $this->item, 'params' =>
$params, 'position' => 'below')); ?>
<?php endif; ?>
<?php if ($params->get('show_tags', 1) &&
!empty($this->item->tags->itemTags)) : ?>
<?php $this->item->tagLayout = new
JLayoutFile('joomla.content.tags'); ?>
<?php echo
$this->item->tagLayout->render($this->item->tags->itemTags);
?>
<?php endif; ?>
<?php endif; ?>
<?php
if (!empty($this->item->pagination) &&
$this->item->pagination &&
$this->item->paginationposition &&
!$this->item->paginationrelative) :
echo $this->item->pagination;
?>
<?php endif; ?>
<?php if (isset($urls) && ((!empty($urls->urls_position)
&& ($urls->urls_position == '1')) ||
($params->get('urls_position') == '1'))) : ?>
<?php echo $this->loadTemplate('links'); ?>
<?php endif; ?>
<?php // Optional teaser intro text for guests ?>
<?php elseif ($params->get('show_noauth') == true
&& $user->get('guest')) : ?>
<?php echo
JLayoutHelper::render('joomla.content.intro_image',
$this->item); ?>
<?php echo JHtml::_('content.prepare',
$this->item->introtext); ?>
<?php // Optional link to let them register to see the whole article.
?>
<?php if ($params->get('show_readmore') &&
$this->item->fulltext != null) : ?>
<?php $menu = JFactory::getApplication()->getMenu(); ?>
<?php $active = $menu->getActive(); ?>
<?php $itemId = $active->id; ?>
<?php $link = new
JUri(JRoute::_('index.php?option=com_users&view=login&Itemid='
. $itemId, false)); ?>
<?php $link->setVar('return',
base64_encode(ContentHelperRoute::getArticleRoute($this->item->slug,
$this->item->catid, $this->item->language))); ?>
<?php echo JLayoutHelper::render('joomla.content.readmore',
array('item' => $this->item, 'params' =>
$params, 'link' => $link)); ?>
<?php endif; ?>
<?php endif; ?>
<?php
if (!empty($this->item->pagination) &&
$this->item->pagination &&
$this->item->paginationposition &&
$this->item->paginationrelative) :
echo $this->item->pagination;
?>
<?php endif; ?>
<?php // Content is generated by content plugin event
"onContentAfterDisplay" ?>
<?php echo $this->item->event->afterDisplayContent; ?>
</div>
PK`F�[�pLf``*com_content/views/article/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTENT_ARTICLE_VIEW_DEFAULT_TITLE"
option="COM_CONTENT_ARTICLE_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_ARTICLE_SINGLE_ARTICLE"
/>
<message>
<![CDATA[COM_CONTENT_ARTICLE_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_content/models/fields">
<field
name="id"
type="modal_article"
label="COM_CONTENT_FIELD_SELECT_ARTICLE_LABEL"
description="COM_CONTENT_FIELD_SELECT_ARTICLE_DESC"
required="true"
select="true"
new="true"
edit="true"
clear="true"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<!-- Basic options. -->
<fieldset name="basic"
label="COM_CONTENT_ATTRIBS_ARTICLE_SETTINGS_LABEL">
<field
name="show_title"
type="list"
label="JGLOBAL_SHOW_TITLE_LABEL"
description="JGLOBAL_SHOW_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="link_titles"
type="list"
label="JGLOBAL_LINKED_TITLES_LABEL"
description="JGLOBAL_LINKED_TITLES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="show_intro"
type="list"
label="JGLOBAL_SHOW_INTRO_LABEL"
description="JGLOBAL_SHOW_INTRO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="info_block_position"
type="list"
label="COM_CONTENT_FIELD_INFOBLOCK_POSITION_LABEL"
description="COM_CONTENT_FIELD_INFOBLOCK_POSITION_DESC"
useglobal="true"
>
<option
value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option>
<option
value="1">COM_CONTENT_FIELD_OPTION_BELOW</option>
<option
value="2">COM_CONTENT_FIELD_OPTION_SPLIT</option>
</field>
<field
name="info_block_show_title"
type="list"
label="COM_CONTENT_FIELD_INFOBLOCK_TITLE_LABEL"
description="COM_CONTENT_FIELD_INFOBLOCK_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_category"
type="list"
label="JGLOBAL_SHOW_CATEGORY_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="link_category"
type="list"
label="JGLOBAL_LINK_CATEGORY_LABEL"
description="JGLOBAL_LINK_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="show_parent_category"
type="list"
label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="link_parent_category"
type="list"
label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
description="JGLOBAL_LINK_PARENT_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="show_associations"
type="list"
label="JGLOBAL_SHOW_ASSOCIATIONS_LABEL"
description="JGLOBAL_SHOW_ASSOCIATIONS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_author"
type="list"
label="JGLOBAL_SHOW_AUTHOR_LABEL"
description="JGLOBAL_SHOW_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="link_author"
type="list"
label="JGLOBAL_LINK_AUTHOR_LABEL"
description="JGLOBAL_LINK_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="show_create_date"
type="list"
label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
description="JGLOBAL_SHOW_CREATE_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_modify_date"
type="list"
label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
description="JGLOBAL_SHOW_MODIFY_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_publish_date"
type="list"
label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_item_navigation"
type="list"
label="JGLOBAL_SHOW_NAVIGATION_LABEL"
description="JGLOBAL_SHOW_NAVIGATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_vote"
type="list"
label="JGLOBAL_SHOW_VOTE_LABEL"
description="JGLOBAL_SHOW_VOTE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_icons"
type="list"
label="JGLOBAL_SHOW_ICONS_LABEL"
description="JGLOBAL_SHOW_ICONS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_print_icon"
type="list"
label="JGLOBAL_SHOW_PRINT_ICON_LABEL"
description="JGLOBAL_SHOW_PRINT_ICON_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_email_icon"
type="list"
label="JGLOBAL_SHOW_EMAIL_ICON_LABEL"
description="JGLOBAL_SHOW_EMAIL_ICON_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_hits"
type="list"
label="JGLOBAL_SHOW_HITS_LABEL"
description="JGLOBAL_SHOW_HITS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_tags"
type="list"
label="JGLOBAL_SHOW_TAGS_LABEL"
description="JGLOBAL_SHOW_TAGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_noauth"
type="list"
label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL"
description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="urls_position"
type="list"
label="COM_CONTENT_FIELD_URLSPOSITION_LABEL"
description="COM_CONTENT_FIELD_URLSPOSITION_DESC"
useglobal="true"
>
<option
value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option>
<option
value="1">COM_CONTENT_FIELD_OPTION_BELOW</option>
</field>
</fieldset>
</fields>
</metadata>
PK`F�[��ղ
0com_content/views/article/tmpl/default_links.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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;
// Create shortcut
$urls = json_decode($this->item->urls);
// Create shortcuts to some parameters.
$params = $this->item->params;
if ($urls && (!empty($urls->urla) || !empty($urls->urlb) ||
!empty($urls->urlc))) :
?>
<div class="content-links">
<ul class="nav nav-tabs nav-stacked">
<?php
$urlarray = array(
array($urls->urla, $urls->urlatext, $urls->targeta,
'a'),
array($urls->urlb, $urls->urlbtext, $urls->targetb,
'b'),
array($urls->urlc, $urls->urlctext, $urls->targetc,
'c')
);
foreach ($urlarray as $url) :
$link = $url[0];
$label = $url[1];
$target = $url[2];
$id = $url[3];
if ( ! $link) :
continue;
endif;
// If no label is present, take the link
$label = $label ?: $link;
// If no target is present, use the default
$target = $target ?: $params->get('target' . $id);
?>
<li class="content-links-<?php echo $id; ?>">
<?php
// Compute the correct link
switch ($target)
{
case 1:
// Open in a new window
echo '<a href="' . htmlspecialchars($link,
ENT_COMPAT, 'UTF-8') . '" target="_blank"
rel="nofollow noopener noreferrer">' .
htmlspecialchars($label, ENT_COMPAT, 'UTF-8') .
'</a>';
break;
case 2:
// Open in a popup window
$attribs =
'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=600';
echo "<a href=\"" . htmlspecialchars($link,
ENT_COMPAT, 'UTF-8') . "\"
onclick=\"window.open(this.href, 'targetWindow',
'" . $attribs . "'); return false;\"
rel=\"noopener noreferrer\">" .
htmlspecialchars($label, ENT_COMPAT, 'UTF-8') .
'</a>';
break;
case 3:
// Open in a modal window
JHtml::_('behavior.modal', 'a.modal');
echo '<a class="modal" href="' .
htmlspecialchars($link, ENT_COMPAT, 'UTF-8') . '"
rel="{handler: \'iframe\', size: {x:600, y:600}} noopener
noreferrer">' .
htmlspecialchars($label, ENT_COMPAT, 'UTF-8') . '
</a>';
break;
default:
// Open in parent window
echo '<a href="' . htmlspecialchars($link,
ENT_COMPAT, 'UTF-8') . '"
rel="nofollow">' .
htmlspecialchars($label, ENT_COMPAT, 'UTF-8') . '
</a>';
break;
}
?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
PKaF�[=梤(�('com_content/views/article/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML Article View class for the Content component
*
* @since 1.5
*/
class ContentViewArticle extends JViewLegacy
{
protected $item;
protected $params;
protected $print;
protected $state;
protected $user;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
$dispatcher = JEventDispatcher::getInstance();
$this->item = $this->get('Item');
$this->print = $app->input->getBool('print');
$this->state = $this->get('State');
$this->user = $user;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
// Create a shortcut for $item.
$item = $this->item;
$item->tagLayout = new JLayoutFile('joomla.content.tags');
// Add router helpers.
$item->slug = $item->alias ? ($item->id . ':' .
$item->alias) : $item->id;
$item->catslug = $item->category_alias ? ($item->catid .
':' . $item->category_alias) : $item->catid;
$item->parent_slug = $item->parent_alias ? ($item->parent_id .
':' . $item->parent_alias) : $item->parent_id;
// No link for ROOT category
if ($item->parent_alias === 'root')
{
$item->parent_slug = null;
}
// TODO: Change based on shownoauth
$item->readmore_link =
JRoute::_(ContentHelperRoute::getArticleRoute($item->slug,
$item->catid, $item->language));
// Merge article params. If this is single-article view, menu params
override article params
// Otherwise, article params override menu item params
$this->params = $this->state->get('params');
$active = $app->getMenu()->getActive();
$temp = clone $this->params;
// Check to see which parameters should take priority
if ($active)
{
$currentLink = $active->link;
// If the current view is the active item and an article view for this
article, then the menu item params take priority
if (strpos($currentLink, 'view=article') &&
strpos($currentLink, '&id=' . (string) $item->id))
{
// Load layout from active query (in case it is an alternative menu
item)
if (isset($active->query['layout']))
{
$this->setLayout($active->query['layout']);
}
// Check for alternative layout of article
elseif ($layout = $item->params->get('article_layout'))
{
$this->setLayout($layout);
}
// $item->params are the article params, $temp are the menu item
params
// Merge so that the menu item params take priority
$item->params->merge($temp);
}
else
{
// Current view is not a single article, so the article params take
priority here
// Merge the menu item params with the article params so that the
article params take priority
$temp->merge($item->params);
$item->params = $temp;
// Check for alternative layouts (since we are not in a single-article
menu item)
// Single-article menu item layout takes priority over alt layout for
an article
if ($layout = $item->params->get('article_layout'))
{
$this->setLayout($layout);
}
}
}
else
{
// Merge so that article params take priority
$temp->merge($item->params);
$item->params = $temp;
// Check for alternative layouts (since we are not in a single-article
menu item)
// Single-article menu item layout takes priority over alt layout for an
article
if ($layout = $item->params->get('article_layout'))
{
$this->setLayout($layout);
}
}
$offset = $this->state->get('list.offset');
// Check the view access to the article (the model has already computed
the values).
if ($item->params->get('access-view') == false &&
($item->params->get('show_noauth', '0') ==
'0'))
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
$app->setHeader('status', 403, true);
return;
}
/**
* Check for no 'access-view' and empty fulltext,
* - Redirect guest users to login
* - Deny access to logged users with 403 code
* NOTE: we do not recheck for no access-view + show_noauth disabled ...
since it was checked above
*/
if ($item->params->get('access-view') == false &&
!strlen($item->fulltext))
{
if ($this->user->get('guest'))
{
$return = base64_encode(JUri::getInstance());
$login_url_with_return =
JRoute::_('index.php?option=com_users&view=login&return='
. $return);
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'notice');
$app->redirect($login_url_with_return, 403);
}
else
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
$app->setHeader('status', 403, true);
return;
}
}
/**
* NOTE: The following code (usually) sets the text to contain the
fulltext, but it is the
* responsibility of the layout to check 'access-view' and only
use "introtext" for guests
*/
if ($item->params->get('show_intro', '1') ==
'1')
{
$item->text = $item->introtext . ' ' .
$item->fulltext;
}
elseif ($item->fulltext)
{
$item->text = $item->fulltext;
}
else
{
$item->text = $item->introtext;
}
$item->tags = new JHelperTags;
$item->tags->getItemTags('com_content.article',
$this->item->id);
if ($item->params->get('show_associations'))
{
$item->associations =
ContentHelperAssociation::displayAssociations($item->id);
}
// Process the content plugins.
JPluginHelper::importPlugin('content');
$dispatcher->trigger('onContentPrepare', array
('com_content.article', &$item, &$item->params,
$offset));
$item->event = new stdClass;
$results = $dispatcher->trigger('onContentAfterTitle',
array('com_content.article', &$item, &$item->params,
$offset));
$item->event->afterDisplayTitle = trim(implode("\n",
$results));
$results = $dispatcher->trigger('onContentBeforeDisplay',
array('com_content.article', &$item, &$item->params,
$offset));
$item->event->beforeDisplayContent = trim(implode("\n",
$results));
$results = $dispatcher->trigger('onContentAfterDisplay',
array('com_content.article', &$item, &$item->params,
$offset));
$item->event->afterDisplayContent = trim(implode("\n",
$results));
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($this->item->params->get('pageclass_sfx',
''));
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document.
*
* @return void
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$pathway = $app->getPathway();
$title = null;
/**
* Because the application sets a default page title,
* we need to get it from the menu item itself
*/
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('JGLOBAL_ARTICLES'));
}
$title = $this->params->get('page_title', '');
$id = (int) @$menu->query['id'];
// If the menu item does not concern this article
if ($menu && (!isset($menu->query['option']) ||
$menu->query['option'] !== 'com_content' ||
$menu->query['view'] !== 'article'
|| $id != $this->item->id))
{
// If a browser page title is defined, use that, then fall back to the
article title if set, then fall back to the page_title option
$title =
$this->item->params->get('article_page_title',
$this->item->title ?: $title);
$path = array(array('title' =>
$this->item->title, 'link' => ''));
$category =
JCategories::getInstance('Content')->get($this->item->catid);
while ($category && (!isset($menu->query['option'])
|| $menu->query['option'] !== 'com_content' ||
$menu->query['view'] === 'article'
|| $id != $category->id) && $category->id !==
'root')
{
$path[] = array('title' => $category->title,
'link' =>
ContentHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();
}
$path = array_reverse($path);
foreach ($path as $item)
{
$pathway->addItem($item['title'],
$item['link']);
}
}
// Check for empty title and add site name if param is set
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
if (empty($title))
{
$title = $this->item->title;
}
$this->document->setTitle($title);
if ($this->item->metadesc)
{
$this->document->setDescription($this->item->metadesc);
}
elseif ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->item->metakey)
{
$this->document->setMetadata('keywords',
$this->item->metakey);
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
if ($app->get('MetaAuthor') == '1')
{
$author = $this->item->created_by_alias ?:
$this->item->author;
$this->document->setMetaData('author', $author);
}
$mdata = $this->item->metadata->toArray();
foreach ($mdata as $k => $v)
{
if ($v)
{
$this->document->setMetadata($k, $v);
}
}
// If there is a pagebreak heading or title, add it to the page title
if (!empty($this->item->page_title))
{
$this->item->title = $this->item->title . ' - ' .
$this->item->page_title;
$this->document->setTitle(
$this->item->page_title . ' - ' .
JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM',
$this->state->get('list.offset') + 1)
);
}
if ($this->print)
{
$this->document->setMetaData('robots', 'noindex,
nofollow');
}
}
}
PKbF�[?�$��-com_content/views/categories/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
JHtml::_('behavior.caption');
JHtml::_('behavior.core');
// Add strings for translations in Javascript.
JText::script('JGLOBAL_EXPAND_CATEGORIES');
JText::script('JGLOBAL_COLLAPSE_CATEGORIES');
JFactory::getDocument()->addScriptDeclaration("
jQuery(function($) {
$('.categories-list').find('[id^=category-btn-]').each(function(index,
btn) {
var btn = $(btn);
btn.on('click', function() {
btn.find('span').toggleClass('icon-plus');
btn.find('span').toggleClass('icon-minus');
if (btn.attr('aria-label') ===
Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES'))
{
btn.attr('aria-label',
Joomla.JText._('JGLOBAL_COLLAPSE_CATEGORIES'));
} else {
btn.attr('aria-label',
Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES'));
}
});
});
});");
?>
<div class="categories-list<?php echo $this->pageclass_sfx;
?>">
<?php
echo JLayoutHelper::render('joomla.content.categories_default',
$this);
echo $this->loadTemplate('items');
?>
</div>
PKbF�[����KK-com_content/views/categories/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTENT_CATEGORIES_VIEW_DEFAULT_TITLE"
option="COM_CONTENT_CATEGORIES_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_ARTICLE_CATEGORIES"
/>
<message>
<![CDATA[COM_CONTENT_CATEGORIES_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
>
<field
name="id"
type="category"
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
description="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC"
extension="com_content"
show_root="true"
required="true"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic"
label="JGLOBAL_CATEGORIES_OPTIONS">
<field
name="show_base_description"
type="list"
label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="categories_description"
type="textarea"
label="JGLOBAL_FIELD_CATEGORIES_DESC_LABEL"
description="JGLOBAL_FIELD_CATEGORIES_DESC_DESC"
cols="25"
rows="5"
/>
<field
name="maxLevelcat"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
useglobal="true"
>
<option value="-1">JALL</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="show_empty_categories_cat"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_CONTENT_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc_cat"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_num_articles_cat"
type="list"
label="COM_CONTENT_NUMBER_CATEGORY_ITEMS_LABEL"
description="COM_CONTENT_NUMBER_CATEGORY_ITEMS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="category"
label="JGLOBAL_CATEGORY_OPTIONS">
<field
name="spacer3"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description"
type="list"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description_image"
type="list"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="maxLevel"
type="list"
label="JGLOBAL_MAXLEVEL_LABEL"
description="JGLOBAL_MAXLEVEL_DESC"
useglobal="true"
>
<option value="-1">JALL</option>
<option value="0">JNONE</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="show_empty_categories"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_CONTENT_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_no_articles"
type="list"
label="COM_CONTENT_NO_ARTICLES_LABEL"
description="COM_CONTENT_NO_ARTICLES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_num_articles"
type="list"
label="COM_CONTENT_NUMBER_CATEGORY_ITEMS_LABEL"
description="COM_CONTENT_NUMBER_CATEGORY_ITEMS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="blog"
label="JGLOBAL_BLOG_LAYOUT_OPTIONS">
<field
name="spacer4"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="num_leading_articles"
type="number"
label="JGLOBAL_NUM_LEADING_ARTICLES_LABEL"
description="JGLOBAL_NUM_LEADING_ARTICLES_DESC"
size="3"
useglobal="true"
/>
<field
name="num_intro_articles"
type="number"
label="JGLOBAL_NUM_INTRO_ARTICLES_LABEL"
description="JGLOBAL_NUM_INTRO_ARTICLES_DESC"
size="3"
useglobal="true"
/>
<field
name="num_columns"
type="number"
label="JGLOBAL_NUM_COLUMNS_LABEL"
description="JGLOBAL_NUM_COLUMNS_DESC"
size="3"
useglobal="true"
/>
<field
name="num_links"
type="number"
label="JGLOBAL_NUM_LINKS_LABEL"
description="JGLOBAL_NUM_LINKS_DESC"
size="3"
useglobal="true"
/>
<field
name="multi_column_order"
type="list"
description="JGLOBAL_MULTI_COLUMN_ORDER_DESC"
label="JGLOBAL_MULTI_COLUMN_ORDER_LABEL"
useglobal="true"
>
<option value="0">JGLOBAL_DOWN</option>
<option value="1">JGLOBAL_ACROSS</option>
</field>
<field
name="show_subcategory_content"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORY_CONTENT_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORY_CONTENT_DESC"
useglobal="true"
>
<option value="0">JNONE</option>
<option value="-1">JALL</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="spacer5"
type="spacer"
hr="true"
/>
<field
name="orderby_pri"
type="list"
label="JGLOBAL_CATEGORY_ORDER_LABEL"
description="JGLOBAL_CATEGORY_ORDER_DESC"
useglobal="true"
>
<option value="none">JGLOBAL_NO_ORDER</option>
<option
value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option
value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option
value="order">JGLOBAL_CATEGORY_MANAGER_ORDER</option>
</field>
<field
name="orderby_sec"
type="list"
label="JGLOBAL_ARTICLE_ORDER_LABEL"
description="JGLOBAL_ARTICLE_ORDER_DESC"
useglobal="true"
>
<option
value="front">COM_CONTENT_FEATURED_ORDER</option>
<option
value="rdate">JGLOBAL_MOST_RECENT_FIRST</option>
<option
value="date">JGLOBAL_OLDEST_FIRST</option>
<option
value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option
value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option
value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option>
<option
value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option>
<option value="hits">JGLOBAL_MOST_HITS</option>
<option value="rhits">JGLOBAL_LEAST_HITS</option>
<option value="order">JGLOBAL_ORDERING</option>
<option value="rorder">JGLOBAL_REVERSE_ORDERING</option>
<option value="vote"
requires="vote">JGLOBAL_VOTES_DESC</option>
<option value="rvote"
requires="vote">JGLOBAL_VOTES_ASC</option>
<option value="rank"
requires="vote">JGLOBAL_RATINGS_DESC</option>
<option value="rrank"
requires="vote">JGLOBAL_RATINGS_ASC</option>
</field>
<field
name="order_date"
type="list"
label="JGLOBAL_ORDERING_DATE_LABEL"
description="JGLOBAL_ORDERING_DATE_DESC"
useglobal="true"
>
<option value="created">JGLOBAL_CREATED</option>
<option
value="modified">JGLOBAL_MODIFIED</option>
<option value="published">JPUBLISHED</option>
</field>
</fieldset>
<fieldset name="advanced"
label="JGLOBAL_LIST_LAYOUT_OPTIONS" >
<field
name="spacer6"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
useglobal="true"
>
<option value="hide">JHIDE</option>
<option value="title">JGLOBAL_TITLE</option>
<option value="author">JAUTHOR</option>
<option value="hits">JGLOBAL_HITS</option>
</field>
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
description="JGLOBAL_SHOW_HEADINGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="list_show_date"
type="list"
label="JGLOBAL_SHOW_DATE_LABEL"
description="JGLOBAL_SHOW_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="created">JGLOBAL_CREATED</option>
<option
value="modified">JGLOBAL_MODIFIED</option>
<option value="published">JPUBLISHED</option>
</field>
<field
name="date_format"
type="text"
label="JGLOBAL_DATE_FORMAT_LABEL"
description="JGLOBAL_DATE_FORMAT_DESC"
size="15"
useglobal="true"
/>
<field
name="list_show_hits"
type="list"
label="JGLOBAL_LIST_HITS_LABEL"
description="JGLOBAL_LIST_HITS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="list_show_author"
type="list"
label="JGLOBAL_LIST_AUTHOR_LABEL"
description="JGLOBAL_LIST_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="display_num"
type="list"
label="JGLOBAL_NUMBER_ITEMS_LIST_LABEL"
description="JGLOBAL_NUMBER_ITEMS_LIST_DESC"
default="10"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="100">J100</option>
<option value="0">JALL</option>
</field>
</fieldset>
<fieldset name="shared"
label="COM_CONTENT_SHARED_LABEL"
description="COM_CONTENT_SHARED_DESC">
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="article"
label="COM_CONTENT_ATTRIBS_FIELDSET_LABEL">
<field
name="article_layout"
type="componentlayout"
label="JGLOBAL_FIELD_LAYOUT_LABEL"
description="JGLOBAL_FIELD_LAYOUT_DESC"
menuitems="true"
extension="com_content"
view="article"
/>
<field
name="show_title"
type="list"
label="JGLOBAL_SHOW_TITLE_LABEL"
description="JGLOBAL_SHOW_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_titles"
type="list"
label="JGLOBAL_LINKED_TITLES_LABEL"
description="JGLOBAL_LINKED_TITLES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_intro"
type="list"
label="JGLOBAL_SHOW_INTRO_LABEL"
description="JGLOBAL_SHOW_INTRO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_category"
type="list"
label="JGLOBAL_SHOW_CATEGORY_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_category"
type="list"
label="JGLOBAL_LINK_CATEGORY_LABEL"
description="JGLOBAL_LINK_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_parent_category"
type="list"
label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_parent_category"
type="list"
label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
description="JGLOBAL_LINK_PARENT_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_author"
type="list"
label="JGLOBAL_SHOW_AUTHOR_LABEL"
description="JGLOBAL_SHOW_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_author"
type="list"
label="JGLOBAL_LINK_AUTHOR_LABEL"
description="JGLOBAL_LINK_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_create_date"
type="list"
label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
description="JGLOBAL_SHOW_CREATE_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_modify_date"
type="list"
label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
description="JGLOBAL_SHOW_MODIFY_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_publish_date"
type="list"
label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_item_navigation"
type="list"
label="JGLOBAL_SHOW_NAVIGATION_LABEL"
description="JGLOBAL_SHOW_NAVIGATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_vote"
type="list"
label="JGLOBAL_SHOW_VOTE_LABEL"
description="JGLOBAL_SHOW_VOTE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_readmore"
type="list"
label="JGLOBAL_SHOW_READMORE_LABEL"
description="JGLOBAL_SHOW_READMORE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_readmore_title"
type="list"
label="JGLOBAL_SHOW_READMORE_TITLE_LABEL"
description="JGLOBAL_SHOW_READMORE_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_icons"
type="list"
label="JGLOBAL_SHOW_ICONS_LABEL"
description="JGLOBAL_SHOW_ICONS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_print_icon"
type="list"
label="JGLOBAL_SHOW_PRINT_ICON_LABEL"
description="JGLOBAL_SHOW_PRINT_ICON_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_icon"
type="list"
label="JGLOBAL_SHOW_EMAIL_ICON_LABEL"
description="JGLOBAL_SHOW_EMAIL_ICON_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_hits"
type="list"
label="JGLOBAL_SHOW_HITS_LABEL"
description="JGLOBAL_SHOW_HITS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_noauth"
type="list"
label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL"
description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
<fieldset name="integration">
<field
name="show_feed_link"
type="list"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="feed_summary"
type="list"
label="JGLOBAL_FEED_SUMMARY_LABEL"
description="JGLOBAL_FEED_SUMMARY_DESC"
useglobal="true"
>
<option value="0">JGLOBAL_INTRO_TEXT</option>
<option value="1">JGLOBAL_FULL_TEXT</option>
</field>
</fieldset>
</fields>
</metadata>
PKbF�[ο|}
}
3com_content/views/categories/tmpl/default_items.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2010 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::_('bootstrap.tooltip');
$class = ' class="first"';
if ($this->maxLevelcat != 0 &&
count($this->items[$this->parent->id]) > 0) :
?>
<?php foreach ($this->items[$this->parent->id] as $id =>
$item) : ?>
<?php
if ($this->params->get('show_empty_categories_cat') ||
$item->numitems || count($item->getChildren())) :
if (!isset($this->items[$this->parent->id][$id + 1]))
{
$class = ' class="last"';
}
?>
<div <?php echo $class; ?> >
<?php $class = ''; ?>
<h3 class="page-header item-title">
<a href="<?php echo
JRoute::_(ContentHelperRoute::getCategoryRoute($item->id,
$item->language)); ?>">
<?php echo $this->escape($item->title); ?></a>
<?php if
($this->params->get('show_cat_num_articles_cat') == 1)
:?>
<span class="badge badge-info tip hasTooltip"
title="<?php echo JHtml::_('tooltipText',
'COM_CONTENT_NUM_ITEMS_TIP'); ?>">
<?php echo JText::_('COM_CONTENT_NUM_ITEMS');
?>
<?php echo $item->numitems; ?>
</span>
<?php endif; ?>
<?php if (count($item->getChildren()) > 0 &&
$this->maxLevelcat > 1) : ?>
<a id="category-btn-<?php echo $item->id; ?>"
href="#category-<?php echo $item->id; ?>"
data-toggle="collapse" class="btn btn-mini
pull-right" aria-label="<?php echo
JText::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"><span
class="icon-plus"
aria-hidden="true"></span></a>
<?php endif; ?>
</h3>
<?php if
($this->params->get('show_description_image') &&
$item->getParams()->get('image')) : ?>
<img src="<?php echo
$item->getParams()->get('image'); ?>"
alt="<?php echo
htmlspecialchars($item->getParams()->get('image_alt'),
ENT_COMPAT, 'UTF-8'); ?>" />
<?php endif; ?>
<?php if ($this->params->get('show_subcat_desc_cat')
== 1) : ?>
<?php if ($item->description) : ?>
<div class="category-desc">
<?php echo JHtml::_('content.prepare',
$item->description, '', 'com_content.categories');
?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if (count($item->getChildren()) > 0 &&
$this->maxLevelcat > 1) : ?>
<div class="collapse fade" id="category-<?php echo
$item->id; ?>">
<?php
$this->items[$item->id] = $item->getChildren();
$this->parent = $item;
$this->maxLevelcat--;
echo $this->loadTemplate('items');
$this->parent = $item->getParent();
$this->maxLevelcat++;
?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
PKcF�[�Рixx*com_content/views/categories/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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;
/**
* Content categories view.
*
* @since 1.5
*/
class ContentViewCategories extends JViewCategories
{
/**
* Language key for default page heading
*
* @var string
* @since 3.2
*/
protected $pageHeading = 'JGLOBAL_ARTICLES';
/**
* @var string The name of the extension for the category
* @since 3.2
*/
protected $extension = 'com_content';
}
PKcF�[��}���(com_content/views/category/tmpl/blog.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 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');
JHtml::_('behavior.caption');
$dispatcher = JEventDispatcher::getInstance();
$this->category->text = $this->category->description;
$dispatcher->trigger('onContentPrepare',
array($this->category->extension . '.categories',
&$this->category, &$this->params, 0));
$this->category->description = $this->category->text;
$results = $dispatcher->trigger('onContentAfterTitle',
array($this->category->extension . '.categories',
&$this->category, &$this->params, 0));
$afterDisplayTitle = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentBeforeDisplay',
array($this->category->extension . '.categories',
&$this->category, &$this->params, 0));
$beforeDisplayContent = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay',
array($this->category->extension . '.categories',
&$this->category, &$this->params, 0));
$afterDisplayContent = trim(implode("\n", $results));
?>
<div class="blog<?php echo $this->pageclass_sfx; ?>"
itemscope itemtype="https://schema.org/Blog">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1> <?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<?php if ($this->params->get('show_category_title', 1)
or $this->params->get('page_subheading')) : ?>
<h2> <?php echo
$this->escape($this->params->get('page_subheading'));
?>
<?php if ($this->params->get('show_category_title'))
: ?>
<span class="subheading-category"><?php echo
$this->category->title; ?></span>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php echo $afterDisplayTitle; ?>
<?php if ($this->params->get('show_cat_tags', 1)
&& !empty($this->category->tags->itemTags)) : ?>
<?php $this->category->tagLayout = new
JLayoutFile('joomla.content.tags'); ?>
<?php echo
$this->category->tagLayout->render($this->category->tags->itemTags);
?>
<?php endif; ?>
<?php if ($beforeDisplayContent || $afterDisplayContent ||
$this->params->get('show_description', 1) ||
$this->params->def('show_description_image', 1)) : ?>
<div class="category-desc clearfix">
<?php if
($this->params->get('show_description_image') &&
$this->category->getParams()->get('image')) : ?>
<img src="<?php echo
$this->category->getParams()->get('image'); ?>"
alt="<?php echo
htmlspecialchars($this->category->getParams()->get('image_alt'),
ENT_COMPAT, 'UTF-8'); ?>"/>
<?php endif; ?>
<?php echo $beforeDisplayContent; ?>
<?php if ($this->params->get('show_description')
&& $this->category->description) : ?>
<?php echo JHtml::_('content.prepare',
$this->category->description, '',
'com_content.category'); ?>
<?php endif; ?>
<?php echo $afterDisplayContent; ?>
</div>
<?php endif; ?>
<?php if (empty($this->lead_items) &&
empty($this->link_items) && empty($this->intro_items)) :
?>
<?php if ($this->params->get('show_no_articles', 1)) :
?>
<p><?php echo JText::_('COM_CONTENT_NO_ARTICLES');
?></p>
<?php endif; ?>
<?php endif; ?>
<?php $leadingcount = 0; ?>
<?php if (!empty($this->lead_items)) : ?>
<div class="items-leading clearfix">
<?php foreach ($this->lead_items as &$item) : ?>
<div class="leading-<?php echo $leadingcount; ?><?php
echo $item->state == 0 ? ' system-unpublished' : null;
?>"
itemprop="blogPost" itemscope
itemtype="https://schema.org/BlogPosting">
<?php
$this->item = &$item;
echo $this->loadTemplate('item');
?>
</div>
<?php $leadingcount++; ?>
<?php endforeach; ?>
</div><!-- end items-leading -->
<?php endif; ?>
<?php
$introcount = count($this->intro_items);
$counter = 0;
?>
<?php if (!empty($this->intro_items)) : ?>
<?php foreach ($this->intro_items as $key => &$item) : ?>
<?php $rowcount = ((int) $key % (int) $this->columns) + 1; ?>
<?php if ($rowcount === 1) : ?>
<?php $row = $counter / $this->columns; ?>
<div class="items-row cols-<?php echo (int)
$this->columns; ?> <?php echo 'row-' . $row; ?>
row-fluid clearfix">
<?php endif; ?>
<div class="span<?php echo round(12 / $this->columns);
?>">
<div class="item column-<?php echo $rowcount; ?><?php
echo $item->state == 0 ? ' system-unpublished' : null;
?>"
itemprop="blogPost" itemscope
itemtype="https://schema.org/BlogPosting">
<?php
$this->item = &$item;
echo $this->loadTemplate('item');
?>
</div>
<!-- end item -->
<?php $counter++; ?>
</div><!-- end span -->
<?php if (($rowcount == $this->columns) or ($counter ==
$introcount)) : ?>
</div><!-- end row -->
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php if (!empty($this->link_items)) : ?>
<div class="items-more">
<?php echo $this->loadTemplate('links'); ?>
</div>
<?php endif; ?>
<?php if ($this->maxLevel != 0 &&
!empty($this->children[$this->category->id])) : ?>
<div class="cat-children">
<?php if
($this->params->get('show_category_heading_title_text', 1)
== 1) : ?>
<h3> <?php echo JText::_('JGLOBAL_SUBCATEGORIES');
?> </h3>
<?php endif; ?>
<?php echo $this->loadTemplate('children'); ?>
</div>
<?php endif; ?>
<?php if (($this->params->def('show_pagination', 1) ==
1 || ($this->params->get('show_pagination') == 2))
&& ($this->pagination->get('pages.total') > 1))
: ?>
<div class="pagination">
<?php if
($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right"> <?php echo
$this->pagination->getPagesCounter(); ?> </p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
</div>
PKcF�[v/��K�K(com_content/views/category/tmpl/blog.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTENT_CATEGORY_VIEW_BLOG_TITLE"
option="COM_CONTENT_CATEGORY_VIEW_BLOG_OPTION">
<help key = "JHELP_MENUS_MENU_ITEM_ARTICLE_CATEGORY_BLOG"
/>
<message>
<![CDATA[COM_CONTENT_CATEGORY_VIEW_BLOG_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_categories/models/fields"
>
<field
name="id"
type="modal_category"
label="JGLOBAL_CHOOSE_CATEGORY_LABEL"
description="JGLOBAL_CHOOSE_CATEGORY_DESC"
extension="com_content"
required="true"
select="true"
new="true"
edit="true"
clear="true"
/>
<field
name="filter_tag"
type="tag"
label="JTAG"
description="JTAG_FIELD_SELECT_DESC"
multiple="true"
mode="nested"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic"
label="JGLOBAL_CATEGORY_OPTIONS">
<field
name="layout_type"
type="hidden"
default="blog"
/>
<field
name="show_category_heading_title_text"
type="list"
label="JGLOBAL_SHOW_CATEGORY_HEADING_TITLE_TEXT_LABEL"
description="JGLOBAL_SHOW_CATEGORY_HEADING_TITLE_TEXT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description"
type="list"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description_image"
type="list"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="maxLevel"
type="list"
label="JGLOBAL_MAXLEVEL_LABEL"
description="JGLOBAL_MAXLEVEL_DESC"
useglobal="true"
>
<option value="-1">JALL</option>
<option value="0">JNONE</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="show_empty_categories"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_CONTENT_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_no_articles"
type="list"
label="COM_CONTENT_NO_ARTICLES_LABEL"
description="COM_CONTENT_NO_ARTICLES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_num_articles"
type="list"
label="COM_CONTENT_NUMBER_CATEGORY_ITEMS_LABEL"
description="COM_CONTENT_NUMBER_CATEGORY_ITEMS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_tags"
type="list"
label="COM_CONTENT_FIELD_SHOW_CAT_TAGS_LABEL"
description="COM_CONTENT_FIELD_SHOW_CAT_TAGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="page_subheading"
type="text"
label="JGLOBAL_SUBHEADING_LABEL"
description="JGLOBAL_SUBHEADING_DESC"
size="20"
/>
</fieldset>
<fieldset name="advanced"
label="JGLOBAL_BLOG_LAYOUT_OPTIONS">
<field
name="bloglayout"
type="spacer"
label="JGLOBAL_SUBSLIDER_BLOG_LAYOUT_LABEL"
class="text"
/>
<field
name="num_leading_articles"
type="number"
label="JGLOBAL_NUM_LEADING_ARTICLES_LABEL"
description="JGLOBAL_NUM_LEADING_ARTICLES_DESC"
useglobal="true"
size="3"
/>
<field
name="num_intro_articles"
type="number"
label="JGLOBAL_NUM_INTRO_ARTICLES_LABEL"
description="JGLOBAL_NUM_INTRO_ARTICLES_DESC"
useglobal="true"
size="3"
/>
<field
name="num_columns"
type="number"
label="JGLOBAL_NUM_COLUMNS_LABEL"
description="JGLOBAL_NUM_COLUMNS_DESC"
useglobal="true"
size="3"
/>
<field
name="num_links"
type="number"
label="JGLOBAL_NUM_LINKS_LABEL"
description="JGLOBAL_NUM_LINKS_DESC"
useglobal="true"
size="3"
/>
<field
name="multi_column_order"
type="list"
label="JGLOBAL_MULTI_COLUMN_ORDER_LABEL"
description="JGLOBAL_MULTI_COLUMN_ORDER_DESC"
useglobal="true"
>
<option value="0">JGLOBAL_DOWN</option>
<option value="1">JGLOBAL_ACROSS</option>
</field>
<field
name="show_subcategory_content"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORY_CONTENT_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORY_CONTENT_DESC"
useglobal="true"
>
<option value="0">JNONE</option>
<option value="-1">JALL</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="spacer1"
type="spacer"
hr="true"
/>
<field
name="orderby_pri"
type="list"
label="JGLOBAL_CATEGORY_ORDER_LABEL"
description="JGLOBAL_CATEGORY_ORDER_DESC"
useglobal="true"
>
<option value="none">JGLOBAL_NO_ORDER</option>
<option
value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option
value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option
value="order">JGLOBAL_CATEGORY_MANAGER_ORDER</option>
</field>
<field
name="orderby_sec"
type="list"
label="JGLOBAL_ARTICLE_ORDER_LABEL"
description="JGLOBAL_ARTICLE_ORDER_DESC"
useglobal="true"
>
<option
value="front">COM_CONTENT_FEATURED_ORDER</option>
<option
value="rdate">JGLOBAL_MOST_RECENT_FIRST</option>
<option
value="date">JGLOBAL_OLDEST_FIRST</option>
<option
value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option
value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option
value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option>
<option
value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option>
<option value="hits">JGLOBAL_MOST_HITS</option>
<option
value="rhits">JGLOBAL_LEAST_HITS</option>
<option
value="random">JGLOBAL_RANDOM_ORDER</option>
<option value="order">JGLOBAL_ORDERING</option>
<option value="rorder">JGLOBAL_REVERSE_ORDERING</option>
<option value="vote"
requires="vote">JGLOBAL_VOTES_DESC</option>
<option value="rvote"
requires="vote">JGLOBAL_VOTES_ASC</option>
<option value="rank"
requires="vote">JGLOBAL_RATINGS_DESC</option>
<option value="rrank"
requires="vote">JGLOBAL_RATINGS_ASC</option>
</field>
<field
name="order_date"
type="list"
label="JGLOBAL_ORDERING_DATE_LABEL"
description="JGLOBAL_ORDERING_DATE_DESC"
useglobal="true"
>
<option value="created">JGLOBAL_CREATED</option>
<option
value="modified">JGLOBAL_MODIFIED</option>
<option value="published">JPUBLISHED</option>
<option
value="unpublished">JUNPUBLISHED</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_featured"
type="list"
default=""
label="JGLOBAL_SHOW_FEATURED_ARTICLES_LABEL"
description="JGLOBAL_SHOW_FEATURED_ARTICLES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="show">JSHOW</option>
<option value="hide">JHIDE</option>
<option value="only">JONLY</option>
</field>
</fieldset>
<fieldset name="article"
label="COM_CONTENT_ATTRIBS_FIELDSET_LABEL">
<field
name="article_layout" type="componentlayout"
label="JGLOBAL_FIELD_LAYOUT_LABEL"
description="JGLOBAL_FIELD_LAYOUT_DESC"
menuitems="true"
extension="com_content"
view="article"
/>
<field
name="show_title"
type="list"
label="JGLOBAL_SHOW_TITLE_LABEL"
description="JGLOBAL_SHOW_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_titles"
type="list"
label="JGLOBAL_LINKED_TITLES_LABEL"
description="JGLOBAL_LINKED_TITLES_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_intro"
type="list"
label="JGLOBAL_SHOW_INTRO_LABEL"
description="JGLOBAL_SHOW_INTRO_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="info_block_position"
type="list"
label="COM_CONTENT_FIELD_INFOBLOCK_POSITION_LABEL"
description="COM_CONTENT_FIELD_INFOBLOCK_POSITION_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option
value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option>
<option
value="1">COM_CONTENT_FIELD_OPTION_BELOW</option>
<option
value="2">COM_CONTENT_FIELD_OPTION_SPLIT</option>
</field>
<field
name="info_block_show_title"
type="list"
label="COM_CONTENT_FIELD_INFOBLOCK_TITLE_LABEL"
description="COM_CONTENT_FIELD_INFOBLOCK_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_category"
type="list"
label="JGLOBAL_SHOW_CATEGORY_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_category"
type="list"
label="JGLOBAL_LINK_CATEGORY_LABEL"
description="JGLOBAL_LINK_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_parent_category"
type="list"
label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_parent_category"
type="list"
label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
description="JGLOBAL_LINK_PARENT_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_associations"
type="list"
label="JGLOBAL_SHOW_ASSOCIATIONS_LABEL"
description="JGLOBAL_SHOW_ASSOCIATIONS_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_author"
type="list"
label="JGLOBAL_SHOW_AUTHOR_LABEL"
description="JGLOBAL_SHOW_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_author"
type="list"
label="JGLOBAL_LINK_AUTHOR_LABEL"
description="JGLOBAL_LINK_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_create_date"
type="list"
label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
description="JGLOBAL_SHOW_CREATE_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_modify_date"
type="list"
label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
description="JGLOBAL_SHOW_MODIFY_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_publish_date"
type="list"
label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_item_navigation"
type="list"
label="JGLOBAL_SHOW_NAVIGATION_LABEL"
description="JGLOBAL_SHOW_NAVIGATION_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_vote"
type="list"
label="JGLOBAL_SHOW_VOTE_LABEL"
description="JGLOBAL_SHOW_VOTE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_readmore"
type="list"
label="JGLOBAL_SHOW_READMORE_LABEL"
description="JGLOBAL_SHOW_READMORE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_readmore_title"
type="list"
label="JGLOBAL_SHOW_READMORE_TITLE_LABEL"
description="JGLOBAL_SHOW_READMORE_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_icons"
type="list"
label="JGLOBAL_SHOW_ICONS_LABEL"
description="JGLOBAL_SHOW_ICONS_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_print_icon"
type="list"
label="JGLOBAL_SHOW_PRINT_ICON_LABEL"
description="JGLOBAL_SHOW_PRINT_ICON_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_icon"
type="list"
label="JGLOBAL_Show_Email_Icon_Label"
description="JGLOBAL_Show_Email_Icon_Desc"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_hits"
type="list"
label="JGLOBAL_SHOW_HITS_LABEL"
description="JGLOBAL_SHOW_HITS_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_tags"
type="list"
label="COM_CONTENT_FIELD_SHOW_TAGS_LABEL"
description="COM_CONTENT_FIELD_SHOW_TAGS_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_noauth"
type="list"
label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL"
description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
<fieldset name="integration"
label="COM_MENUS_INTEGRATION_FIELDSET_LABEL">
<field
name="show_feed_link"
type="list"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="feed_summary"
type="list"
label="JGLOBAL_FEED_SUMMARY_LABEL"
description="JGLOBAL_FEED_SUMMARY_DESC"
useglobal="true"
>
<option value="0">JGLOBAL_INTRO_TEXT</option>
<option value="1">JGLOBAL_FULL_TEXT</option>
</field>
</fieldset>
</fields>
</metadata>
PKdF�[^�
��
�
1com_content/views/category/tmpl/blog_children.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2010 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::_('bootstrap.tooltip');
$class = ' class="first"';
$lang = JFactory::getLanguage();
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
if ($this->maxLevel != 0 &&
count($this->children[$this->category->id]) > 0) : ?>
<?php foreach ($this->children[$this->category->id] as $id
=> $child) : ?>
<?php // Check whether category access level allows access to
subcategories. ?>
<?php if (in_array($child->access, $groups)) : ?>
<?php if ($this->params->get('show_empty_categories')
|| $child->numitems || count($child->getChildren())) :
if (!isset($this->children[$this->category->id][$id + 1])) :
$class = ' class="last"';
endif;
?>
<div<?php echo $class; ?>>
<?php $class = ''; ?>
<?php if ($lang->isRtl()) : ?>
<h3 class="page-header item-title">
<?php if (
$this->params->get('show_cat_num_articles', 1)) : ?>
<span class="badge badge-info tip hasTooltip"
title="<?php echo JHtml::_('tooltipText',
'COM_CONTENT_NUM_ITEMS_TIP'); ?>">
<?php echo $child->getNumItems(true); ?>
</span>
<?php endif; ?>
<a href="<?php echo
JRoute::_(ContentHelperRoute::getCategoryRoute($child->id));
?>">
<?php echo $this->escape($child->title); ?></a>
<?php if ($this->maxLevel > 1 &&
count($child->getChildren()) > 0) : ?>
<a href="#category-<?php echo $child->id; ?>"
data-toggle="collapse" class="btn btn-mini pull-right"
aria-label="<?php echo
JText::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"><span
class="icon-plus"
aria-hidden="true"></span></a>
<?php endif; ?>
</h3>
<?php else : ?>
<h3 class="page-header item-title"><a
href="<?php echo
JRoute::_(ContentHelperRoute::getCategoryRoute($child->id));
?>">
<?php echo $this->escape($child->title); ?></a>
<?php if (
$this->params->get('show_cat_num_articles', 1)) : ?>
<span class="badge badge-info tip hasTooltip"
title="<?php echo JHtml::_('tooltipText',
'COM_CONTENT_NUM_ITEMS_TIP'); ?>">
<?php echo JText::_('COM_CONTENT_NUM_ITEMS');
?>
<?php echo $child->getNumItems(true); ?>
</span>
<?php endif; ?>
<?php if ($this->maxLevel > 1 &&
count($child->getChildren()) > 0) : ?>
<a href="#category-<?php echo $child->id; ?>"
data-toggle="collapse" class="btn btn-mini pull-right"
aria-label="<?php echo
JText::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"><span
class="icon-plus"
aria-hidden="true"></span></a>
<?php endif; ?>
</h3>
<?php endif; ?>
<?php if ($this->params->get('show_subcat_desc') ==
1) : ?>
<?php if ($child->description) : ?>
<div class="category-desc">
<?php echo JHtml::_('content.prepare',
$child->description, '', 'com_content.category');
?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->maxLevel > 1 &&
count($child->getChildren()) > 0) : ?>
<div class="collapse fade" id="category-<?php
echo $child->id; ?>">
<?php
$this->children[$child->id] = $child->getChildren();
$this->category = $child;
$this->maxLevel--;
echo $this->loadTemplate('children');
$this->category = $child->getParent();
$this->maxLevel++;
?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php endif;
PKdF�[WbV�??-com_content/views/category/tmpl/blog_item.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Create a shortcut for params.
$params = $this->item->params;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$canEdit = $this->item->params->get('access-edit');
$info = $params->get('info_block_position', 0);
// Check if associations are implemented. If they are, define the
parameter.
$assocParam = (JLanguageAssociations::isEnabled() &&
$params->get('show_associations'));
$currentDate = JFactory::getDate()->format('Y-m-d H:i:s');
$isUnpublished = ($this->item->state == 0 ||
$this->item->publish_up > $currentDate)
|| ($this->item->publish_down < $currentDate &&
$this->item->publish_down !== JFactory::getDbo()->getNullDate());
?>
<?php if ($isUnpublished) : ?>
<div class="system-unpublished">
<?php endif; ?>
<?php echo
JLayoutHelper::render('joomla.content.blog_style_default_item_title',
$this->item); ?>
<?php if ($canEdit || $params->get('show_print_icon') ||
$params->get('show_email_icon')) : ?>
<?php echo JLayoutHelper::render('joomla.content.icons',
array('params' => $params, 'item' =>
$this->item, 'print' => false)); ?>
<?php endif; ?>
<?php // Todo Not that elegant would be nice to group the params ?>
<?php $useDefList = ($params->get('show_modify_date') ||
$params->get('show_publish_date') ||
$params->get('show_create_date')
|| $params->get('show_hits') ||
$params->get('show_category') ||
$params->get('show_parent_category') ||
$params->get('show_author') || $assocParam); ?>
<?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
<?php // Todo: for Joomla4 joomla.content.info_block.block can be
changed to joomla.content.info_block ?>
<?php echo
JLayoutHelper::render('joomla.content.info_block.block',
array('item' => $this->item, 'params' =>
$params, 'position' => 'above')); ?>
<?php endif; ?>
<?php if ($info == 0 && $params->get('show_tags',
1) && !empty($this->item->tags->itemTags)) : ?>
<?php echo JLayoutHelper::render('joomla.content.tags',
$this->item->tags->itemTags); ?>
<?php endif; ?>
<?php echo JLayoutHelper::render('joomla.content.intro_image',
$this->item); ?>
<?php if (!$params->get('show_intro')) : ?>
<?php // Content is generated by content plugin event
"onContentAfterTitle" ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php endif; ?>
<?php // Content is generated by content plugin event
"onContentBeforeDisplay" ?>
<?php echo $this->item->event->beforeDisplayContent; ?>
<?php echo $this->item->introtext; ?>
<?php if ($info == 1 || $info == 2) : ?>
<?php if ($useDefList) : ?>
<?php // Todo: for Joomla4 joomla.content.info_block.block can be
changed to joomla.content.info_block ?>
<?php echo
JLayoutHelper::render('joomla.content.info_block.block',
array('item' => $this->item, 'params' =>
$params, 'position' => 'below')); ?>
<?php endif; ?>
<?php if ($params->get('show_tags', 1) &&
!empty($this->item->tags->itemTags)) : ?>
<?php echo JLayoutHelper::render('joomla.content.tags',
$this->item->tags->itemTags); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($params->get('show_readmore') &&
$this->item->readmore) :
if ($params->get('access-view')) :
$link =
JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug,
$this->item->catid, $this->item->language));
else :
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link = new
JUri(JRoute::_('index.php?option=com_users&view=login&Itemid='
. $itemId, false));
$link->setVar('return',
base64_encode(ContentHelperRoute::getArticleRoute($this->item->slug,
$this->item->catid, $this->item->language)));
endif; ?>
<?php echo JLayoutHelper::render('joomla.content.readmore',
array('item' => $this->item, 'params' =>
$params, 'link' => $link)); ?>
<?php endif; ?>
<?php if ($isUnpublished) : ?>
</div>
<?php endif; ?>
<?php // Content is generated by content plugin event
"onContentAfterDisplay" ?>
<?php echo $this->item->event->afterDisplayContent; ?>
PKeF�[�2��"".com_content/views/category/tmpl/blog_links.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<ol class="nav nav-tabs nav-stacked">
<?php foreach ($this->link_items as &$item) : ?>
<li>
<a href="<?php echo
JRoute::_(ContentHelperRoute::getArticleRoute($item->slug,
$item->catid, $item->language)); ?>">
<?php echo $item->title; ?></a>
</li>
<?php endforeach; ?>
</ol>
PKeF�[j\�+com_content/views/category/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 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');
JHtml::_('behavior.caption');
?>
<div class="category-list<?php echo $this->pageclass_sfx;
?>">
<?php
$this->subtemplatename = 'articles';
echo JLayoutHelper::render('joomla.content.category_default',
$this);
?>
</div>
PKeF�[���P3E3E+com_content/views/category/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTENT_CATEGORY_VIEW_DEFAULT_TITLE"
option="COM_CONTENT_CATEGORY_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_ARTICLE_CATEGORY_LIST"
/>
<message>
<![CDATA[COM_CONTENT_CATEGORY_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_categories/models/fields"
>
<field
name="id"
type="modal_category"
label="JGLOBAL_CHOOSE_CATEGORY_LABEL"
description="JGLOBAL_CHOOSE_CATEGORY_DESC"
extension="com_content"
required="true"
select="true"
new="true"
edit="true"
clear="true"
/>
<field
name="filter_tag"
type="tag"
label="JTAG"
description="JTAG_FIELD_SELECT_DESC"
multiple="true"
mode="nested"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic"
label="JGLOBAL_CATEGORY_OPTIONS">
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description"
type="list"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description_image"
type="list"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="maxLevel"
type="list"
label="JGLOBAL_MAXLEVEL_LABEL"
description="JGLOBAL_MAXLEVEL_DESC"
useglobal="true"
>
<option value="-1">JALL</option>
<option value="0">JNONE</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="show_empty_categories"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_CONTENT_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_no_articles"
type="list"
label="COM_CONTENT_NO_ARTICLES_LABEL"
description="COM_CONTENT_NO_ARTICLES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_category_heading_title_text"
type="list"
label="JGLOBAL_SHOW_CATEGORY_HEADING_TITLE_TEXT_LABEL"
description="JGLOBAL_SHOW_CATEGORY_HEADING_TITLE_TEXT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_num_articles"
type="list"
label="COM_CONTENT_NUMBER_CATEGORY_ITEMS_LABEL"
description="COM_CONTENT_NUMBER_CATEGORY_ITEMS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_tags"
type="list"
label="COM_CONTENT_FIELD_SHOW_CAT_TAGS_LABEL"
description="COM_CONTENT_FIELD_SHOW_CAT_TAGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="page_subheading"
type="text"
label="JGLOBAL_SUBHEADING_LABEL"
description="JGLOBAL_SUBHEADING_DESC"
size="20"
/>
</fieldset>
<fieldset name="advanced"
label="JGLOBAL_LIST_LAYOUT_OPTIONS">
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
useglobal="true"
>
<option value="hide">JHIDE</option>
<option value="title">JGLOBAL_TITLE</option>
<option value="author">JAUTHOR</option>
<option value="hits">JGLOBAL_HITS</option>
<option value="tag">JTAG</option>
<option value="month">JMONTH_PUBLISHED</option>
</field>
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
description="JGLOBAL_SHOW_HEADINGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="list_show_date"
type="list"
label="JGLOBAL_SHOW_DATE_LABEL"
description="JGLOBAL_SHOW_DATE_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="created">JGLOBAL_CREATED</option>
<option
value="modified">JGLOBAL_MODIFIED</option>
<option value="published">JPUBLISHED</option>
</field>
<field
name="date_format"
type="text"
label="JGLOBAL_DATE_FORMAT_LABEL"
description="JGLOBAL_DATE_FORMAT_DESC"
size="15"
useglobal="true"
/>
<field
name="list_show_hits"
type="list"
label="JGLOBAL_LIST_HITS_LABEL"
description="JGLOBAL_LIST_HITS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="list_show_author"
type="list"
label="JGLOBAL_LIST_AUTHOR_LABEL"
description="JGLOBAL_LIST_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="list_show_votes"
type="list"
label="JGLOBAL_LIST_VOTES_LABEL"
description="JGLOBAL_LIST_VOTES_DESC"
class="btn-group btn-group-yesno"
useglobal="true"
>
<option value="1"
requires="vote">JSHOW</option>
<option value="0"
requires="vote">JHIDE</option>
</field>
<field
name="list_show_ratings"
type="list"
label="JGLOBAL_LIST_RATINGS_LABEL"
description="JGLOBAL_LIST_RATINGS_DESC"
class="btn-group btn-group-yesno"
useglobal="true"
>
<option value="1"
requires="vote">JSHOW</option>
<option value="0"
requires="vote">JHIDE</option>
</field>
<field
name="spacer1"
type="spacer"
hr="true"
/>
<field
name="orderby_pri"
type="list"
label="JGLOBAL_CATEGORY_ORDER_LABEL"
description="JGLOBAL_CATEGORY_ORDER_DESC"
useglobal="true"
>
<option value="none">JGLOBAL_NO_ORDER</option>
<option
value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option
value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option
value="order">JGLOBAL_CATEGORY_MANAGER_ORDER</option>
</field>
<field
name="orderby_sec"
type="list"
label="JGLOBAL_ARTICLE_ORDER_LABEL"
description="JGLOBAL_ARTICLE_ORDER_DESC"
useglobal="true"
>
<option
value="front">COM_CONTENT_FEATURED_ORDER</option>
<option
value="rdate">JGLOBAL_MOST_RECENT_FIRST</option>
<option
value="date">JGLOBAL_OLDEST_FIRST</option>
<option
value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option
value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option
value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option>
<option
value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option>
<option value="hits">JGLOBAL_MOST_HITS</option>
<option value="rhits">JGLOBAL_LEAST_HITS</option>
<option
value="random">JGLOBAL_RANDOM_ORDER</option>
<option value="order">JGLOBAL_ORDERING</option>
<option value="rorder">JGLOBAL_REVERSE_ORDERING</option>
<option value="vote"
requires="vote">JGLOBAL_VOTES_DESC</option>
<option value="rvote"
requires="vote">JGLOBAL_VOTES_ASC</option>
<option value="rank" requires="vote">
JGLOBAL_RATINGS_DESC</option>
<option value="rrank"
requires="vote">JGLOBAL_RATINGS_ASC</option>
</field>
<field
name="order_date"
type="list"
label="JGLOBAL_ORDERING_DATE_LABEL"
description="JGLOBAL_ORDERING_DATE_DESC"
useglobal="true"
>
<option value="created">JGLOBAL_CREATED</option>
<option
value="modified">JGLOBAL_MODIFIED</option>
<option value="published">JPUBLISHED</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="display_num"
type="list"
label="JGLOBAL_NUMBER_ITEMS_LIST_LABEL"
description="JGLOBAL_NUMBER_ITEMS_LIST_DESC"
default="10"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="100">J100</option>
<option value="0">JALL</option>
</field>
<field
name="show_featured"
type="list"
label="JGLOBAL_SHOW_FEATURED_ARTICLES_LABEL"
description="JGLOBAL_SHOW_FEATURED_ARTICLES_DESC"
useglobal="true"
default=""
>
<option value="show">JSHOW</option>
<option value="hide">JHIDE</option>
<option value="only">JONLY</option>
</field>
</fieldset>
<fieldset name="article"
label="COM_CONTENT_ATTRIBS_FIELDSET_LABEL">
<field
name="article_layout" type="componentlayout"
label="JGLOBAL_FIELD_LAYOUT_LABEL"
description="JGLOBAL_FIELD_LAYOUT_DESC"
menuitems="true"
extension="com_content"
view="article"
/>
<field
name="show_title"
type="list"
label="JGLOBAL_SHOW_TITLE_LABEL"
description="JGLOBAL_SHOW_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_titles"
type="list"
label="JGLOBAL_LINKED_TITLES_LABEL"
description="JGLOBAL_LINKED_TITLES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_intro"
type="list"
label="JGLOBAL_SHOW_INTRO_LABEL"
description="JGLOBAL_SHOW_INTRO_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_category"
type="list"
label="JGLOBAL_SHOW_CATEGORY_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_category"
type="list"
label="JGLOBAL_LINK_CATEGORY_LABEL"
description="JGLOBAL_LINK_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_parent_category"
type="list"
label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_parent_category"
type="list"
label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
description="JGLOBAL_LINK_PARENT_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_associations"
type="list"
label="JGLOBAL_SHOW_ASSOCIATIONS_LABEL"
description="JGLOBAL_SHOW_ASSOCIATIONS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_author"
type="list"
label="JGLOBAL_SHOW_AUTHOR_LABEL"
description="JGLOBAL_SHOW_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_author"
type="list"
label="JGLOBAL_LINK_AUTHOR_LABEL"
description="JGLOBAL_LINK_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_create_date"
type="list"
label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
description="JGLOBAL_SHOW_CREATE_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_modify_date"
type="list"
label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
description="JGLOBAL_SHOW_MODIFY_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_publish_date"
type="list"
label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_item_navigation"
type="list"
label="JGLOBAL_SHOW_NAVIGATION_LABEL"
description="JGLOBAL_SHOW_NAVIGATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_vote"
type="list"
label="JGLOBAL_SHOW_VOTE_LABEL"
description="JGLOBAL_SHOW_VOTE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_readmore"
type="list"
label="JGLOBAL_SHOW_READMORE_LABEL"
description="JGLOBAL_SHOW_READMORE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_readmore_title"
type="list"
label="JGLOBAL_SHOW_READMORE_TITLE_LABEL"
description="JGLOBAL_SHOW_READMORE_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_icons"
type="list"
label="JGLOBAL_SHOW_ICONS_LABEL"
description="JGLOBAL_SHOW_ICONS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_print_icon"
type="list"
label="JGLOBAL_SHOW_PRINT_ICON_LABEL"
description="JGLOBAL_SHOW_PRINT_ICON_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_icon"
type="list"
label="JGLOBAL_SHOW_EMAIL_ICON_LABEL"
description="JGLOBAL_SHOW_EMAIL_ICON_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_hits"
type="list"
label="JGLOBAL_SHOW_HITS_LABEL"
description="JGLOBAL_SHOW_HITS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_noauth"
type="list"
label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL"
description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
<fieldset name="integration"
label="COM_MENUS_INTEGRATION_FIELDSET_LABEL">
<field
name="show_feed_link"
type="list"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="feed_summary"
type="list"
label="JGLOBAL_FEED_SUMMARY_LABEL"
description="JGLOBAL_FEED_SUMMARY_DESC"
useglobal="true"
>
<option value="0">JGLOBAL_INTRO_TEXT</option>
<option value="1">JGLOBAL_FULL_TEXT</option>
</field>
</fieldset>
</fields>
</metadata>
PKeF�[�1�5�54com_content/views/category/tmpl/default_articles.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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\CMS\Component\ComponentHelper;
use Joomla\CMS\Language\Multilanguage;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
// Create some shortcuts.
$n = count($this->items);
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn =
$this->escape($this->state->get('list.direction'));
$langFilter = false;
// Tags filtering based on language filter
if (($this->params->get('filter_field') ===
'tag') && (Multilanguage::isEnabled()))
{
$tagfilter =
ComponentHelper::getParams('com_tags')->get('tag_list_language_filter');
switch ($tagfilter)
{
case 'current_language' :
$langFilter = JFactory::getApplication()->getLanguage()->getTag();
break;
case 'all' :
$langFilter = false;
break;
default :
$langFilter = $tagfilter;
}
}
// Check for at least one editable article
$isEditable = false;
if (!empty($this->items))
{
foreach ($this->items as $article)
{
if ($article->params->get('access-edit'))
{
$isEditable = true;
break;
}
}
}
// For B/C we also add the css classes inline. This will be removed in 4.0.
JFactory::getDocument()->addStyleDeclaration('
.hide { display: none; }
.table-noheader { border-collapse: collapse; }
.table-noheader thead { display: none; }
');
$tableClass = $this->params->get('show_headings') != 1 ?
' table-noheader' : '';
$nullDate = JFactory::getDbo()->getNullDate();
$currentDate = JFactory::getDate()->format('Y-m-d H:i:s');
?>
<form action="<?php echo
htmlspecialchars(JUri::getInstance()->toString()); ?>"
method="post" name="adminForm" id="adminForm"
class="form-inline">
<?php if ($this->params->get('filter_field') !==
'hide' ||
$this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters btn-toolbar clearfix">
<legend class="hide"><?php echo
JText::_('COM_CONTENT_FORM_FILTER_LEGEND'); ?></legend>
<?php if ($this->params->get('filter_field') !==
'hide') : ?>
<div class="btn-group">
<?php if ($this->params->get('filter_field') ===
'tag') : ?>
<select name="filter_tag" id="filter_tag"
onchange="document.adminForm.submit();">
<option value=""><?php echo
JText::_('JOPTION_SELECT_TAG'); ?></option>
<?php echo JHtml::_('select.options',
JHtml::_('tag.options', array('filter.published' =>
array(1), 'filter.language' => $langFilter), true),
'value', 'text',
$this->state->get('filter.tag')); ?>
</select>
<?php elseif ($this->params->get('filter_field') ===
'month') : ?>
<select name="filter-search" id="filter-search"
onchange="document.adminForm.submit();">
<option value=""><?php echo
JText::_('JOPTION_SELECT_MONTH'); ?></option>
<?php echo JHtml::_('select.options',
JHtml::_('content.months', $this->state), 'value',
'text', $this->state->get('list.filter')); ?>
</select>
<?php else : ?>
<label class="filter-search-lbl element-invisible"
for="filter-search">
<?php echo JText::_('COM_CONTENT_' .
$this->params->get('filter_field') .
'_FILTER_LABEL') . ' '; ?>
</label>
<input type="text" name="filter-search"
id="filter-search" value="<?php echo
$this->escape($this->state->get('list.filter'));
?>" class="inputbox"
onchange="document.adminForm.submit();" title="<?php echo
JText::_('COM_CONTENT_FILTER_SEARCH_DESC'); ?>"
placeholder="<?php echo JText::_('COM_CONTENT_' .
$this->params->get('filter_field') .
'_FILTER_LABEL'); ?>" />
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($this->params->get('show_pagination_limit'))
: ?>
<div class="btn-group pull-right">
<label for="limit" class="element-invisible">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
<input type="hidden" name="filter_order"
value="" />
<input type="hidden" name="filter_order_Dir"
value="" />
<input type="hidden" name="limitstart"
value="" />
<input type="hidden" name="task"
value="" />
</fieldset>
<div class="control-group hide pull-right">
<div class="controls">
<button type="submit" name="filter_submit"
class="btn btn-primary"><?php echo
JText::_('COM_CONTENT_FORM_FILTER_SUBMIT'); ?></button>
</div>
</div>
<?php endif; ?>
<?php if (empty($this->items)) : ?>
<?php if ($this->params->get('show_no_articles', 1)) :
?>
<p><?php echo JText::_('COM_CONTENT_NO_ARTICLES');
?></p>
<?php endif; ?>
<?php else : ?>
<table class="category table table-striped table-bordered
table-hover<?php echo $tableClass; ?>">
<caption class="hide"><?php echo
JText::sprintf('COM_CONTENT_CATEGORY_LIST_TABLE_CAPTION',
$this->category->title); ?></caption>
<thead>
<tr>
<th scope="col"
id="categorylist_header_title">
<?php echo JHtml::_('grid.sort',
'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder,
null, 'asc', '', 'adminForm'); ?>
</th>
<?php if ($date =
$this->params->get('list_show_date')) : ?>
<th scope="col"
id="categorylist_header_date">
<?php if ($date === 'created') : ?>
<?php echo JHtml::_('grid.sort',
'COM_CONTENT_' . $date . '_DATE',
'a.created', $listDirn, $listOrder); ?>
<?php elseif ($date === 'modified') : ?>
<?php echo JHtml::_('grid.sort',
'COM_CONTENT_' . $date . '_DATE',
'a.modified', $listDirn, $listOrder); ?>
<?php elseif ($date === 'published') : ?>
<?php echo JHtml::_('grid.sort',
'COM_CONTENT_' . $date . '_DATE',
'a.publish_up', $listDirn, $listOrder); ?>
<?php endif; ?>
</th>
<?php endif; ?>
<?php if ($this->params->get('list_show_author')) :
?>
<th scope="col"
id="categorylist_header_author">
<?php echo JHtml::_('grid.sort', 'JAUTHOR',
'author', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<?php if ($this->params->get('list_show_hits')) :
?>
<th scope="col"
id="categorylist_header_hits">
<?php echo JHtml::_('grid.sort',
'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<?php if ($this->params->get('list_show_votes', 0)
&& $this->vote) : ?>
<th scope="col"
id="categorylist_header_votes">
<?php echo JHtml::_('grid.sort',
'COM_CONTENT_VOTES', 'rating_count', $listDirn,
$listOrder); ?>
</th>
<?php endif; ?>
<?php if ($this->params->get('list_show_ratings', 0)
&& $this->vote) : ?>
<th scope="col"
id="categorylist_header_ratings">
<?php echo JHtml::_('grid.sort',
'COM_CONTENT_RATINGS', 'rating', $listDirn,
$listOrder); ?>
</th>
<?php endif; ?>
<?php if ($isEditable) : ?>
<th scope="col"
id="categorylist_header_edit"><?php echo
JText::_('COM_CONTENT_EDIT_ITEM'); ?></th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php foreach ($this->items as $i => $article) : ?>
<?php if ($this->items[$i]->state == 0) : ?>
<tr class="system-unpublished cat-list-row<?php echo $i % 2;
?>">
<?php else : ?>
<tr class="cat-list-row<?php echo $i % 2; ?>" >
<?php endif; ?>
<td headers="categorylist_header_title"
class="list-title">
<?php if (in_array($article->access,
$this->user->getAuthorisedViewLevels())) : ?>
<a href="<?php echo
JRoute::_(ContentHelperRoute::getArticleRoute($article->slug,
$article->catid, $article->language)); ?>">
<?php echo $this->escape($article->title); ?>
</a>
<?php if (JLanguageAssociations::isEnabled() &&
$this->params->get('show_associations')) : ?>
<?php $associations =
ContentHelperAssociation::displayAssociations($article->id); ?>
<?php foreach ($associations as $association) : ?>
<?php if ($this->params->get('flags', 1)
&& $association['language']->image) : ?>
<?php $flag = JHtml::_('image',
'mod_languages/' . $association['language']->image .
'.gif', $association['language']->title_native,
array('title' =>
$association['language']->title_native), true); ?>
<a href="<?php echo
JRoute::_($association['item']); ?>"><?php echo
$flag; ?></a>
<?php else : ?>
<?php $class = 'label label-association label-' .
$association['language']->sef; ?>
<a class="<?php echo $class; ?>"
href="<?php echo JRoute::_($association['item']);
?>"><?php echo
strtoupper($association['language']->sef);
?></a>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php else : ?>
<?php
echo $this->escape($article->title) . ' : ';
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link = new
JUri(JRoute::_('index.php?option=com_users&view=login&Itemid='
. $itemId, false));
$link->setVar('return',
base64_encode(ContentHelperRoute::getArticleRoute($article->slug,
$article->catid, $article->language)));
?>
<a href="<?php echo $link; ?>"
class="register">
<?php echo
JText::_('COM_CONTENT_REGISTER_TO_READ_MORE'); ?>
</a>
<?php if (JLanguageAssociations::isEnabled() &&
$this->params->get('show_associations')) : ?>
<?php $associations =
ContentHelperAssociation::displayAssociations($article->id); ?>
<?php foreach ($associations as $association) : ?>
<?php if ($this->params->get('flags', 1)) : ?>
<?php $flag = JHtml::_('image',
'mod_languages/' . $association['language']->image .
'.gif', $association['language']->title_native,
array('title' =>
$association['language']->title_native), true); ?>
<a href="<?php echo
JRoute::_($association['item']); ?>"><?php echo
$flag; ?></a>
<?php else : ?>
<?php $class = 'label label-association label-' .
$association['language']->sef; ?>
<a class="' . <?php echo $class; ?> .
'" href="<?php echo
JRoute::_($association['item']); ?>"><?php echo
strtoupper($association['language']->sef);
?></a>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($article->state == 0) : ?>
<span class="list-published label label-warning">
<?php echo JText::_('JUNPUBLISHED'); ?>
</span>
<?php endif; ?>
<?php if ($article->publish_up > $currentDate) : ?>
<span class="list-published label label-warning">
<?php echo JText::_('JNOTPUBLISHEDYET'); ?>
</span>
<?php endif; ?>
<?php if ($article->publish_down < $currentDate &&
$article->publish_down !== $nullDate) : ?>
<span class="list-published label label-warning">
<?php echo JText::_('JEXPIRED'); ?>
</span>
<?php endif; ?>
</td>
<?php if ($this->params->get('list_show_date')) :
?>
<td headers="categorylist_header_date"
class="list-date small">
<?php
echo JHtml::_(
'date', $article->displayDate,
$this->escape($this->params->get('date_format',
JText::_('DATE_FORMAT_LC3')))
); ?>
</td>
<?php endif; ?>
<?php if ($this->params->get('list_show_author', 1))
: ?>
<td headers="categorylist_header_author"
class="list-author">
<?php if (!empty($article->author) ||
!empty($article->created_by_alias)) : ?>
<?php $author = $article->author ?>
<?php $author = $article->created_by_alias ?: $author; ?>
<?php if (!empty($article->contact_link) &&
$this->params->get('link_author') == true) : ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY',
JHtml::_('link', $article->contact_link, $author)); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY',
$author); ?>
<?php endif; ?>
<?php endif; ?>
</td>
<?php endif; ?>
<?php if ($this->params->get('list_show_hits', 1)) :
?>
<td headers="categorylist_header_hits"
class="list-hits">
<span class="badge badge-info">
<?php echo JText::sprintf('JGLOBAL_HITS_COUNT',
$article->hits); ?>
</span>
</td>
<?php endif; ?>
<?php if ($this->params->get('list_show_votes', 0)
&& $this->vote) : ?>
<td headers="categorylist_header_votes"
class="list-votes">
<span class="badge badge-success">
<?php echo JText::sprintf('COM_CONTENT_VOTES_COUNT',
$article->rating_count); ?>
</span>
</td>
<?php endif; ?>
<?php if ($this->params->get('list_show_ratings', 0)
&& $this->vote) : ?>
<td headers="categorylist_header_ratings"
class="list-ratings">
<span class="badge badge-warning">
<?php echo JText::sprintf('COM_CONTENT_RATINGS_COUNT',
$article->rating); ?>
</span>
</td>
<?php endif; ?>
<?php if ($isEditable) : ?>
<td headers="categorylist_header_edit"
class="list-edit">
<?php if ($article->params->get('access-edit')) :
?>
<?php echo JHtml::_('icon.edit', $article,
$article->params); ?>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php // Code to add a link to submit an article. ?>
<?php if
($this->category->getParams()->get('access-create')) :
?>
<?php echo JHtml::_('icon.create', $this->category,
$this->category->params); ?>
<?php endif; ?>
<?php // Add pagination links ?>
<?php if (!empty($this->items)) : ?>
<?php if (($this->params->def('show_pagination', 2) ==
1 || ($this->params->get('show_pagination') == 2))
&& ($this->pagination->pagesTotal > 1)) : ?>
<div class="pagination">
<?php if
($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</form>
PKeF�[8�Z�
�
4com_content/views/category/tmpl/default_children.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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;
JHtml::_('bootstrap.tooltip');
$class = ' class="first"';
$lang = JFactory::getLanguage();
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
?>
<?php if (count($this->children[$this->category->id]) > 0) :
?>
<?php foreach ($this->children[$this->category->id] as $id
=> $child) : ?>
<?php // Check whether category access level allows access to
subcategories. ?>
<?php if (in_array($child->access, $groups)) : ?>
<?php
if ($this->params->get('show_empty_categories') ||
$child->getNumItems(true) || count($child->getChildren())) :
if (!isset($this->children[$this->category->id][$id + 1])) :
$class = ' class="last"';
endif;
?>
<div<?php echo $class; ?>>
<?php $class = ''; ?>
<?php if ($lang->isRtl()) : ?>
<h3 class="page-header item-title">
<?php if (
$this->params->get('show_cat_num_articles', 1)) : ?>
<span class="badge badge-info tip hasTooltip"
title="<?php echo JHtml::_('tooltipText',
'COM_CONTENT_NUM_ITEMS_TIP'); ?>">
<?php echo $child->getNumItems(true); ?>
</span>
<?php endif; ?>
<a href="<?php echo
JRoute::_(ContentHelperRoute::getCategoryRoute($child->id));
?>">
<?php echo $this->escape($child->title); ?></a>
<?php if (count($child->getChildren()) > 0 &&
$this->maxLevel > 1) : ?>
<a href="#category-<?php echo $child->id; ?>"
data-toggle="collapse" class="btn btn-mini pull-right"
aria-label="<?php echo
JText::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"><span
class="icon-plus"
aria-hidden="true"></span></a>
<?php endif; ?>
</h3>
<?php else : ?>
<h3 class="page-header item-title"><a
href="<?php echo
JRoute::_(ContentHelperRoute::getCategoryRoute($child->id));
?>">
<?php echo $this->escape($child->title); ?></a>
<?php if (
$this->params->get('show_cat_num_articles', 1)) : ?>
<span class="badge badge-info tip hasTooltip"
title="<?php echo JHtml::_('tooltipText',
'COM_CONTENT_NUM_ITEMS_TIP'); ?>">
<?php echo $child->getNumItems(true); ?>
</span>
<?php endif; ?>
<?php if (count($child->getChildren()) > 0 &&
$this->maxLevel > 1) : ?>
<a href="#category-<?php echo $child->id; ?>"
data-toggle="collapse" class="btn btn-mini pull-right"
aria-label="<?php echo
JText::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"><span
class="icon-plus"
aria-hidden="true"></span></a>
<?php endif; ?>
</h3>
<?php endif; ?>
<?php if ($this->params->get('show_subcat_desc') ==
1) : ?>
<?php if ($child->description) : ?>
<div class="category-desc">
<?php echo JHtml::_('content.prepare',
$child->description, '', 'com_content.category');
?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if (count($child->getChildren()) > 0 &&
$this->maxLevel > 1) : ?>
<div class="collapse fade" id="category-<?php
echo $child->id; ?>">
<?php
$this->children[$child->id] = $child->getChildren();
$this->category = $child;
$this->maxLevel--;
echo $this->loadTemplate('children');
$this->category = $child->getParent();
$this->maxLevel++;
?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
PKfF�[�=
��(com_content/views/category/view.feed.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Content component
*
* @since 1.5
*/
class ContentViewCategory extends JViewCategoryfeed
{
/**
* @var string The name of the view to link individual items to
* @since 3.2
*/
protected $viewName = 'article';
/**
* Method to reconcile non standard names from components to usage in this
class.
* Typically overridden in the component feed view class.
*
* @param object $item The item for a feed, an element of the $items
array.
*
* @return void
*
* @since 3.2
*/
protected function reconcileNames($item)
{
// Get description, intro_image, author and date
$app = JFactory::getApplication();
$params = $app->getParams();
$item->description = '';
$obj = json_decode($item->images);
$introImage = isset($obj->{'image_intro'}) ?
$obj->{'image_intro'} : '';
if (isset($introImage) && ($introImage != ''))
{
$image = preg_match('/http/', $introImage) ? $introImage :
JURI::root() . $introImage;
$item->description = '<p><img src="' . $image
. '" /></p>';
}
$item->description .= ($params->get('feed_summary', 0) ?
$item->introtext . $item->fulltext : $item->introtext);
// Add readmore link to description if introtext is shown, show_readmore
is true and fulltext exists
if (!$item->params->get('feed_summary', 0) &&
$item->params->get('feed_show_readmore', 0) &&
$item->fulltext)
{
// Compute the article slug
$item->slug = $item->alias ? ($item->id . ':' .
$item->alias) : $item->id;
// URL link to article
$link = JRoute::_(
ContentHelperRoute::getArticleRoute($item->slug, $item->catid,
$item->language),
true,
$app->get('force_ssl') == 2 ? \JRoute::TLS_FORCE :
\JRoute::TLS_IGNORE,
true
);
$item->description .= '<p
class="feed-readmore"><a target="_blank"
href="' . $link . '">' .
JText::_('COM_CONTENT_FEED_READMORE') .
'</a></p>';
}
$item->author = $item->created_by_alias ?: $item->author;
}
}
PKfF�[�1��(com_content/views/category/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Registry\Registry;
/**
* HTML View class for the Content component
*
* @since 1.5
*/
class ContentViewCategory extends JViewCategory
{
/**
* @var array Array of leading items for blog display
* @since 3.2
*/
protected $lead_items = array();
/**
* @var array Array of intro (multicolumn display) items for blog
display
* @since 3.2
*/
protected $intro_items = array();
/**
* @var array Array of links in blog display
* @since 3.2
*/
protected $link_items = array();
/**
* @var integer Number of columns in a multi column display
* @since 3.2
* @deprecated 4.0
*/
protected $columns = 1;
/**
* @var string The name of the extension for the category
* @since 3.2
*/
protected $extension = 'com_content';
/**
* @var string Default title to use for page title
* @since 3.2
*/
protected $defaultPageTitle = 'JGLOBAL_ARTICLES';
/**
* @var string The name of the view to link individual items to
* @since 3.2
*/
protected $viewName = 'article';
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
parent::commonCategoryDisplay();
// Flag indicates to not add limitstart=0 to URL
$this->pagination->hideEmptyLimitstart = true;
// Prepare the data
// Get the metrics for the structural page layout.
$params = $this->params;
$numLeading = $params->def('num_leading_articles', 1);
$numIntro = $params->def('num_intro_articles', 4);
$numLinks = $params->def('num_links', 4);
$this->vote = PluginHelper::isEnabled('content',
'vote');
PluginHelper::importPlugin('content');
$dispatcher = JEventDispatcher::getInstance();
// Compute the article slugs and prepare introtext (runs content
plugins).
foreach ($this->items as $item)
{
$item->slug = $item->alias ? ($item->id . ':' .
$item->alias) : $item->id;
$item->parent_slug = $item->parent_alias ? ($item->parent_id .
':' . $item->parent_alias) : $item->parent_id;
// No link for ROOT category
if ($item->parent_alias === 'root')
{
$item->parent_slug = null;
}
$item->catslug = $item->category_alias ? ($item->catid .
':' . $item->category_alias) : $item->catid;
$item->event = new stdClass;
// Old plugins: Ensure that text property is available
if (!isset($item->text))
{
$item->text = $item->introtext;
}
$dispatcher->trigger('onContentPrepare', array
('com_content.category', &$item, &$item->params, 0));
// Old plugins: Use processed text as introtext
$item->introtext = $item->text;
$results = $dispatcher->trigger('onContentAfterTitle',
array('com_content.category', &$item, &$item->params,
0));
$item->event->afterDisplayTitle = trim(implode("\n",
$results));
$results = $dispatcher->trigger('onContentBeforeDisplay',
array('com_content.category', &$item, &$item->params,
0));
$item->event->beforeDisplayContent = trim(implode("\n",
$results));
$results = $dispatcher->trigger('onContentAfterDisplay',
array('com_content.category', &$item, &$item->params,
0));
$item->event->afterDisplayContent = trim(implode("\n",
$results));
}
// For blog layouts, preprocess the breakdown of leading, intro and
linked articles.
// This makes it much easier for the designer to just interrogate the
arrays.
if ($params->get('layout_type') === 'blog' ||
$this->getLayout() === 'blog')
{
foreach ($this->items as $i => $item)
{
if ($i < $numLeading)
{
$this->lead_items[] = $item;
}
elseif ($i >= $numLeading && $i < $numLeading +
$numIntro)
{
$this->intro_items[] = $item;
}
elseif ($i < $numLeading + $numIntro + $numLinks)
{
$this->link_items[] = $item;
}
else
{
continue;
}
}
$this->columns = max(1, $params->def('num_columns', 1));
$order = $params->def('multi_column_order', 1);
if ($order == 0 && $this->columns > 1)
{
// Call order down helper
$this->intro_items =
ContentHelperQuery::orderDownColumns($this->intro_items,
$this->columns);
}
}
// Because the application sets a default page title,
// we need to get it from the menu item itself
$app = Factory::getApplication();
$active = $app->getMenu()->getActive();
if ($active
&& $active->component == 'com_content'
&& isset($active->query['view'],
$active->query['id'])
&& $active->query['view'] == 'category'
&& $active->query['id'] ==
$this->category->id)
{
$this->params->def('page_heading',
$this->params->get('page_title', $active->title));
$title = $this->params->get('page_title',
$active->title);
}
else
{
$this->params->def('page_heading',
$this->category->title);
$title = $this->category->title;
$this->params->set('page_title', $title);
}
// Check for empty title and add site name if param is set
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
if (empty($title))
{
$title = $this->category->title;
}
$this->document->setTitle($title);
if ($this->category->metadesc)
{
$this->document->setDescription($this->category->metadesc);
}
elseif ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->category->metakey)
{
$this->document->setMetadata('keywords',
$this->category->metakey);
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
if (!is_object($this->category->metadata))
{
$this->category->metadata = new
Registry($this->category->metadata);
}
if (($app->get('MetaAuthor') == '1') &&
$this->category->get('author', ''))
{
$this->document->setMetaData('author',
$this->category->get('author', ''));
}
$mdata = $this->category->metadata->toArray();
foreach ($mdata as $k => $v)
{
if ($v)
{
$this->document->setMetadata($k, $v);
}
}
return parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*/
protected function prepareDocument()
{
parent::prepareDocument();
$menu = $this->menu;
$id = (int) @$menu->query['id'];
if ($menu && (!isset($menu->query['option']) ||
$menu->query['option'] !== 'com_content' ||
$menu->query['view'] === 'article'
|| $id != $this->category->id))
{
$path = array(array('title' =>
$this->category->title, 'link' => ''));
$category = $this->category->getParent();
while ($category !== null && $category->id !==
'root'
&& (!isset($menu->query['option']) ||
$menu->query['option'] !== 'com_content' ||
$menu->query['view'] === 'article' || $id !=
$category->id))
{
$path[] = array('title' => $category->title,
'link' =>
ContentHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();
}
$path = array_reverse($path);
foreach ($path as $item)
{
$this->pathway->addItem($item['title'],
$item['link']);
}
}
parent::addFeed();
}
}
PKgF�[�䴝��+com_content/views/featured/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 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');
JHtml::_('behavior.caption');
// If the page class is defined, add to class as suffix.
// It will be a separate class if the user starts it with a space
?>
<div class="blog-featured<?php echo $this->pageclass_sfx;
?>" itemscope itemtype="https://schema.org/Blog">
<?php if ($this->params->get('show_page_heading') != 0)
: ?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<?php if ($this->params->get('page_subheading')) : ?>
<h2>
<?php echo
$this->escape($this->params->get('page_subheading'));
?>
</h2>
<?php endif; ?>
<?php $leadingcount = 0; ?>
<?php if (!empty($this->lead_items)) : ?>
<div class="items-leading clearfix">
<?php foreach ($this->lead_items as &$item) : ?>
<div class="leading-<?php echo $leadingcount; ?><?php
echo $item->state == 0 ? ' system-unpublished' : null; ?>
clearfix"
itemprop="blogPost" itemscope
itemtype="https://schema.org/BlogPosting">
<?php
$this->item = &$item;
echo $this->loadTemplate('item');
?>
</div>
<?php
$leadingcount++;
?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php
$introcount = count($this->intro_items);
$counter = 0;
?>
<?php if (!empty($this->intro_items)) : ?>
<?php foreach ($this->intro_items as $key => &$item) : ?>
<?php
$key = ($key - $leadingcount) + 1;
$rowcount = (((int) $key - 1) % (int) $this->columns) + 1;
$row = $counter / $this->columns;
if ($rowcount === 1) : ?>
<div class="items-row cols-<?php echo (int) $this->columns;
?> <?php echo 'row-' . $row; ?> row-fluid">
<?php endif; ?>
<div class="item column-<?php echo $rowcount; ?><?php
echo $item->state == 0 ? ' system-unpublished' : null; ?>
span<?php echo round(12 / $this->columns); ?>"
itemprop="blogPost" itemscope
itemtype="https://schema.org/BlogPosting">
<?php
$this->item = &$item;
echo $this->loadTemplate('item');
?>
</div>
<?php $counter++; ?>
<?php if (($rowcount == $this->columns) or ($counter ==
$introcount)) : ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php if (!empty($this->link_items)) : ?>
<div class="items-more">
<?php echo $this->loadTemplate('links'); ?>
</div>
<?php endif; ?>
<?php if ($this->params->def('show_pagination', 2) == 1
|| ($this->params->get('show_pagination') == 2 &&
$this->pagination->pagesTotal > 1)) : ?>
<div class="pagination">
<?php if
($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
</div>
PKgF�[��F�D8D8+com_content/views/featured/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTENT_FEATURED_VIEW_DEFAULT_TITLE"
option="COM_CONTENT_FEATURED_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_ARTICLE_FEATURED"
/>
<message>
<![CDATA[COM_CONTENT_CATEGORY_VIEW_FEATURED_DESC]]>
</message>
</layout>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="advanced"
label="COM_MENUS_LAYOUT_FEATURED_OPTIONS">
<field
name="featured_categories"
type="category"
label="COM_CONTENT_FEATURED_CATEGORIES_LABEL"
description="COM_CONTENT_FEATURED_CATEGORIES_DESC"
extension="com_content"
multiple="true"
size="10"
default=""
>
<option value="">JOPTION_ALL_CATEGORIES</option>
</field>
<field
name="layout_type"
type="hidden"
default="blog"
/>
<field
name="bloglayout"
type="spacer"
label="JGLOBAL_SUBSLIDER_BLOG_LAYOUT_LABEL"
class="text"
/>
<field
name="num_leading_articles"
type="number"
label="JGLOBAL_NUM_LEADING_ARTICLES_LABEL"
description="JGLOBAL_NUM_LEADING_ARTICLES_DESC"
useglobal="true"
size="3"
/>
<field
name="num_intro_articles"
type="number"
label="JGLOBAL_NUM_INTRO_ARTICLES_LABEL"
description="JGLOBAL_NUM_INTRO_ARTICLES_DESC"
useglobal="true"
size="3"
/>
<field
name="num_columns"
type="number"
label="JGLOBAL_NUM_COLUMNS_LABEL"
description="JGLOBAL_NUM_COLUMNS_DESC"
useglobal="true"
size="3"
/>
<field
name="num_links"
type="number"
label="JGLOBAL_NUM_LINKS_LABEL"
description="JGLOBAL_NUM_LINKS_DESC"
useglobal="true"
size="3"
/>
<field
name="multi_column_order"
type="list"
label="JGLOBAL_MULTI_COLUMN_ORDER_LABEL"
description="JGLOBAL_MULTI_COLUMN_ORDER_DESC"
useglobal="true"
>
<option value="0">JGLOBAL_Down</option>
<option value="1">JGLOBAL_Across</option>
</field>
<field
name="orderby_pri"
type="list"
label="JGLOBAL_CATEGORY_ORDER_LABEL"
description="JGLOBAL_CATEGORY_ORDER_DESC"
useglobal="true"
>
<option value="none">JGLOBAL_No_Order</option>
<option
value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option
value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option
value="order">JGLOBAL_CATEGORY_MANAGER_ORDER</option>
</field>
<field
name="orderby_sec"
type="list"
label="JGLOBAL_ARTICLE_ORDER_LABEL"
description="JGLOBAL_ARTICLE_ORDER_DESC"
useglobal="true"
>
<option
value="front">COM_CONTENT_FEATURED_ORDER</option>
<option
value="rdate">JGLOBAL_MOST_RECENT_FIRST</option>
<option
value="date">JGLOBAL_OLDEST_FIRST</option>
<option
value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option
value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option
value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option>
<option
value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option>
<option value="hits">JGLOBAL_MOST_HITS</option>
<option value="rhits">JGLOBAL_LEAST_HITS</option>
<option
value="random">JGLOBAL_RANDOM_ORDER</option>
<option value="order">JGLOBAL_ORDERING</option>
<option value="rorder">JGLOBAL_REVERSE_ORDERING</option>
<option value="vote"
requires="vote">JGLOBAL_VOTES_DESC</option>
<option value="rvote"
requires="vote">JGLOBAL_VOTES_ASC</option>
<option value="rank"
requires="vote">JGLOBAL_RATINGS_DESC</option>
<option value="rrank"
requires="vote">JGLOBAL_RATINGS_ASC</option>
</field>
<field
name="order_date"
type="list"
label="JGLOBAL_ORDERING_DATE_LABEL"
description="JGLOBAL_ORDERING_DATE_DESC"
useglobal="true"
>
<option value="created">JGLOBAL_CREATED</option>
<option
value="modified">JGLOBAL_MODIFIED</option>
<option value="published">JPUBLISHED</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="page_subheading"
type="text"
label="JGLOBAL_SUBHEADING_LABEL"
description="JGLOBAL_SUBHEADING_DESC"
size="20"
/>
</fieldset>
<fieldset name="article"
label="COM_CONTENT_ATTRIBS_FIELDSET_LABEL">
<field
name="show_title"
type="list"
label="JGLOBAL_SHOW_TITLE_LABEL"
description="JGLOBAL_SHOW_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_titles"
type="list"
label="JGLOBAL_LINKED_TITLES_LABEL"
description="JGLOBAL_LINKED_TITLES_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_intro"
type="list"
label="JGLOBAL_SHOW_INTRO_LABEL"
description="JGLOBAL_SHOW_INTRO_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="info_block_position"
type="list"
label="COM_CONTENT_FIELD_INFOBLOCK_POSITION_LABEL"
description="COM_CONTENT_FIELD_INFOBLOCK_POSITION_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option
value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option>
<option
value="1">COM_CONTENT_FIELD_OPTION_BELOW</option>
<option
value="2">COM_CONTENT_FIELD_OPTION_SPLIT</option>
</field>
<field
name="info_block_show_title"
type="list"
label="COM_CONTENT_FIELD_INFOBLOCK_TITLE_LABEL"
description="COM_CONTENT_FIELD_INFOBLOCK_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_category"
type="list"
label="JGLOBAL_SHOW_CATEGORY_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_category"
type="list"
label="JGLOBAL_LINK_CATEGORY_LABEL"
description="JGLOBAL_LINK_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_parent_category"
type="list"
label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_parent_category"
type="list"
label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
description="JGLOBAL_LINK_PARENT_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_associations"
type="list"
label="JGLOBAL_SHOW_ASSOCIATIONS_LABEL"
description="JGLOBAL_SHOW_ASSOCIATIONS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_author"
type="list"
label="JGLOBAL_SHOW_AUTHOR_LABEL"
description="JGLOBAL_SHOW_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_author"
type="list"
label="JGLOBAL_LINK_AUTHOR_LABEL"
description="JGLOBAL_LINK_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_create_date"
type="list"
label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
description="JGLOBAL_SHOW_CREATE_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_modify_date"
type="list"
label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
description="JGLOBAL_SHOW_MODIFY_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_publish_date"
type="list"
label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_item_navigation"
type="list"
label="JGLOBAL_SHOW_NAVIGATION_LABEL"
description="JGLOBAL_SHOW_NAVIGATION_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_vote"
type="list"
label="JGLOBAL_SHOW_VOTE_LABEL"
description="JGLOBAL_SHOW_VOTE_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_readmore"
type="list"
label="JGLOBAL_SHOW_READMORE_LABEL"
description="JGLOBAL_SHOW_READMORE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_readmore_title"
type="list"
label="JGLOBAL_SHOW_READMORE_TITLE_LABEL"
description="JGLOBAL_SHOW_READMORE_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_icons"
type="list"
label="JGLOBAL_SHOW_ICONS_LABEL"
description="JGLOBAL_SHOW_ICONS_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_print_icon"
type="list"
label="JGLOBAL_SHOW_PRINT_ICON_LABEL"
description="JGLOBAL_SHOW_PRINT_ICON_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email_icon"
type="list"
label="JGLOBAL_SHOW_EMAIL_ICON_LABEL"
description="JGLOBAL_SHOW_EMAIL_ICON_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_hits"
type="list"
label="JGLOBAL_SHOW_HITS_LABEL"
description="JGLOBAL_SHOW_HITS_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_tags"
type="list"
label="COM_CONTENT_FIELD_SHOW_TAGS_LABEL"
description="COM_CONTENT_FIELD_SHOW_TAGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_noauth"
type="list"
label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL"
description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC"
useglobal="true"
class="chzn-color"
>
<option
value="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
<fieldset name="integration"
label="COM_MENUS_INTEGRATION_FIELDSET_LABEL">
<field
name="show_feed_link"
type="list"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="feed_summary"
type="list"
label="JGLOBAL_FEED_SUMMARY_LABEL"
description="JGLOBAL_FEED_SUMMARY_DESC"
useglobal="true"
>
<option value="0">JGLOBAL_INTRO_TEXT</option>
<option value="1">JGLOBAL_FULL_TEXT</option>
</field>
</fieldset>
</fields>
</metadata>
PKgF�[�ݤ000com_content/views/featured/tmpl/default_item.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Create a shortcut for params.
$params = &$this->item->params;
$canEdit = $this->item->params->get('access-edit');
$info =
$this->item->params->get('info_block_position', 0);
// Check if associations are implemented. If they are, define the
parameter.
$assocParam = (JLanguageAssociations::isEnabled() &&
$params->get('show_associations'));
$currentDate = JFactory::getDate()->format('Y-m-d
H:i:s');
$isExpired = $this->item->publish_down < $currentDate
&& $this->item->publish_down !==
JFactory::getDbo()->getNullDate();
$isNotPublishedYet = $this->item->publish_up > $currentDate;
$isUnpublished = $this->item->state == 0 || $isNotPublishedYet ||
$isExpired;
?>
<?php if ($isUnpublished) : ?>
<div class="system-unpublished">
<?php endif; ?>
<?php if ($params->get('show_title')) : ?>
<h2 class="item-title" itemprop="headline">
<?php if ($params->get('link_titles') &&
$params->get('access-view')) : ?>
<a href="<?php echo
JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug,
$this->item->catid, $this->item->language)); ?>"
itemprop="url">
<?php echo $this->escape($this->item->title); ?>
</a>
<?php else : ?>
<?php echo $this->escape($this->item->title); ?>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php if ($this->item->state == 0) : ?>
<span class="label label-warning"><?php echo
JText::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php if ($isNotPublishedYet) : ?>
<span class="label label-warning"><?php echo
JText::_('JNOTPUBLISHEDYET'); ?></span>
<?php endif; ?>
<?php if ($isExpired) : ?>
<span class="label label-warning"><?php echo
JText::_('JEXPIRED'); ?></span>
<?php endif; ?>
<?php if ($canEdit || $params->get('show_print_icon') ||
$params->get('show_email_icon')) : ?>
<?php echo JLayoutHelper::render('joomla.content.icons',
array('params' => $params, 'item' =>
$this->item, 'print' => false)); ?>
<?php endif; ?>
<?php // Content is generated by content plugin event
"onContentAfterTitle" ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php // Todo Not that elegant would be nice to group the params ?>
<?php $useDefList = ($params->get('show_modify_date') ||
$params->get('show_publish_date') ||
$params->get('show_create_date')
|| $params->get('show_hits') ||
$params->get('show_category') ||
$params->get('show_parent_category') ||
$params->get('show_author') || $assocParam); ?>
<?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
<?php // Todo: for Joomla4 joomla.content.info_block.block can be
changed to joomla.content.info_block ?>
<?php echo
JLayoutHelper::render('joomla.content.info_block.block',
array('item' => $this->item, 'params' =>
$params, 'position' => 'above')); ?>
<?php endif; ?>
<?php if ($info == 0 && $params->get('show_tags',
1) && !empty($this->item->tags->itemTags)) : ?>
<?php echo JLayoutHelper::render('joomla.content.tags',
$this->item->tags->itemTags); ?>
<?php endif; ?>
<?php echo JLayoutHelper::render('joomla.content.intro_image',
$this->item); ?>
<?php // Content is generated by content plugin event
"onContentBeforeDisplay" ?>
<?php echo $this->item->event->beforeDisplayContent; ?>
<?php echo $this->item->introtext; ?>
<?php if ($info == 1 || $info == 2) : ?>
<?php if ($useDefList) : ?>
<?php // Todo: for Joomla4 joomla.content.info_block.block can be
changed to joomla.content.info_block ?>
<?php echo
JLayoutHelper::render('joomla.content.info_block.block',
array('item' => $this->item, 'params' =>
$params, 'position' => 'below')); ?>
<?php endif; ?>
<?php if ($params->get('show_tags', 1) &&
!empty($this->item->tags->itemTags)) : ?>
<?php echo JLayoutHelper::render('joomla.content.tags',
$this->item->tags->itemTags); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($params->get('show_readmore') &&
$this->item->readmore) :
if ($params->get('access-view')) :
$link =
JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug,
$this->item->catid, $this->item->language));
else :
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link = new
JUri(JRoute::_('index.php?option=com_users&view=login&Itemid='
. $itemId, false));
$link->setVar('return',
base64_encode(ContentHelperRoute::getArticleRoute($this->item->slug,
$this->item->catid, $this->item->language)));
endif; ?>
<?php echo JLayoutHelper::render('joomla.content.readmore',
array('item' => $this->item, 'params' =>
$params, 'link' => $link)); ?>
<?php endif; ?>
<?php if ($isUnpublished) : ?>
</div>
<?php endif; ?>
<?php // Content is generated by content plugin event
"onContentAfterDisplay" ?>
<?php echo $this->item->event->afterDisplayContent; ?>
PKhF�[�W�1com_content/views/featured/tmpl/default_links.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<ol class="nav nav-tabs nav-stacked">
<?php foreach ($this->link_items as &$item) : ?>
<li>
<a href="<?php echo
JRoute::_(ContentHelperRoute::getArticleRoute($item->slug,
$item->catid, $item->language)); ?>">
<?php echo $item->title; ?></a>
</li>
<?php endforeach; ?>
</ol>
PKhF�[�;D�
�
(com_content/views/featured/view.feed.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Frontpage View class
*
* @since 1.5
*/
class ContentViewFeatured extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
// Parameters
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$params = $app->getParams();
$feedEmail = $app->get('feed_email', 'none');
$siteEmail = $app->get('mailfrom');
$doc->link =
JRoute::_('index.php?option=com_content&view=featured');
// Get some data from the model
$app->input->set('limit',
$app->get('feed_limit'));
$categories = JCategories::getInstance('Content');
$rows = $this->get('Items');
foreach ($rows as $row)
{
// Strip html from feed item title
$title = $this->escape($row->title);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
// Compute the article slug
$row->slug = $row->alias ? ($row->id . ':' .
$row->alias) : $row->id;
// URL link to article
$link = ContentHelperRoute::getArticleRoute($row->slug,
$row->catid, $row->language);
$description = '';
$obj = json_decode($row->images);
$introImage = isset($obj->{'image_intro'}) ?
$obj->{'image_intro'} : '';
if (isset($introImage) && ($introImage != ''))
{
$image = preg_match('/http/', $introImage) ? $introImage :
JURI::root() . $introImage;
$description = '<p><img src="' . $image .
'" /></p>';
}
$description .= ($params->get('feed_summary', 0) ?
$row->introtext . $row->fulltext : $row->introtext);
$author = $row->created_by_alias ?: $row->author;
// Load individual item creator class
$item = new JFeedItem;
$item->title = $title;
$item->link = \JRoute::_($link);
$item->date = $row->publish_up;
$item->category = array();
// All featured articles are categorized as "Featured"
$item->category[] = JText::_('JFEATURED');
for ($item_category = $categories->get($row->catid);
$item_category !== null; $item_category = $item_category->getParent())
{
// Only add non-root categories
if ($item_category->id > 1)
{
$item->category[] = $item_category->title;
}
}
$item->author = $author;
if ($feedEmail === 'site')
{
$item->authorEmail = $siteEmail;
}
elseif ($feedEmail === 'author')
{
$item->authorEmail = $row->author_email;
}
// Add readmore link to description if introtext is shown, show_readmore
is true and fulltext exists
if (!$params->get('feed_summary', 0) &&
$params->get('feed_show_readmore', 0) &&
$row->fulltext)
{
$link = \JRoute::_($link, true, $app->get('force_ssl') ==
2 ? \JRoute::TLS_FORCE : \JRoute::TLS_IGNORE, true);
$description .= '<p class="feed-readmore"><a
target="_blank" href="' . $link .
'">' . JText::_('COM_CONTENT_FEED_READMORE') .
'</a></p>';
}
// Load item description and add div
$item->description = '<div
class="feed-description">' . $description .
'</div>';
// Loads item info into rss array
$doc->addItem($item);
}
}
}
PKhF�[�f�M��(com_content/views/featured/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Frontpage View class
*
* @since 1.5
*/
class ContentViewFeatured extends JViewLegacy
{
protected $state = null;
protected $item = null;
protected $items = null;
protected $pagination = null;
protected $lead_items = array();
protected $intro_items = array();
protected $link_items = array();
/** @deprecated 4.0 */
protected $columns = 1;
/**
* An instance of JDatabaseDriver.
*
* @var JDatabaseDriver
* @since 3.6.3
*/
protected $db;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$user = JFactory::getUser();
$state = $this->get('State');
$items = $this->get('Items');
$pagination = $this->get('Pagination');
// Flag indicates to not add limitstart=0 to URL
$pagination->hideEmptyLimitstart = true;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
$params = &$state->params;
// PREPARE THE DATA
// Get the metrics for the structural page layout.
$numLeading = (int) $params->def('num_leading_articles', 1);
$numIntro = (int) $params->def('num_intro_articles', 4);
JPluginHelper::importPlugin('content');
// Compute the article slugs and prepare introtext (runs content
plugins).
foreach ($items as &$item)
{
$item->slug = $item->alias ? ($item->id . ':'
. $item->alias) : $item->id;
$item->catslug = $item->category_alias ? ($item->catid .
':' . $item->category_alias) : $item->catid;
$item->parent_slug = $item->parent_alias ? ($item->parent_id .
':' . $item->parent_alias) : $item->parent_id;
// No link for ROOT category
if ($item->parent_alias === 'root')
{
$item->parent_slug = null;
}
$item->event = new stdClass;
$dispatcher = JEventDispatcher::getInstance();
// Old plugins: Ensure that text property is available
if (!isset($item->text))
{
$item->text = $item->introtext;
}
$dispatcher->trigger('onContentPrepare', array
('com_content.featured', &$item, &$item->params, 0));
// Old plugins: Use processed text as introtext
$item->introtext = $item->text;
$results = $dispatcher->trigger('onContentAfterTitle',
array('com_content.featured', &$item, &$item->params,
0));
$item->event->afterDisplayTitle = trim(implode("\n",
$results));
$results = $dispatcher->trigger('onContentBeforeDisplay',
array('com_content.featured', &$item, &$item->params,
0));
$item->event->beforeDisplayContent = trim(implode("\n",
$results));
$results = $dispatcher->trigger('onContentAfterDisplay',
array('com_content.featured', &$item, &$item->params,
0));
$item->event->afterDisplayContent = trim(implode("\n",
$results));
}
// Preprocess the breakdown of leading, intro and linked articles.
// This makes it much easier for the designer to just interogate the
arrays.
$max = count($items);
// The first group is the leading articles.
$limit = $numLeading;
for ($i = 0; $i < $limit && $i < $max; $i++)
{
$this->lead_items[$i] = &$items[$i];
}
// The second group is the intro articles.
$limit = $numLeading + $numIntro;
// Order articles across, then down (or single column mode)
for ($i = $numLeading; $i < $limit && $i < $max; $i++)
{
$this->intro_items[$i] = &$items[$i];
}
$this->columns = max(1, $params->def('num_columns', 1));
$order = $params->def('multi_column_order', 1);
if ($order == 0 && $this->columns > 1)
{
// Call order down helper
$this->intro_items =
ContentHelperQuery::orderDownColumns($this->intro_items,
$this->columns);
}
// The remainder are the links.
for ($i = $numLeading + $numIntro; $i < $max; $i++)
{
$this->link_items[$i] = &$items[$i];
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($params->get('pageclass_sfx', ''));
$this->params = &$params;
$this->items = &$items;
$this->pagination = &$pagination;
$this->user = &$user;
$this->db = JFactory::getDbo();
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document.
*
* @return void
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('JGLOBAL_ARTICLES'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
// Add feed links
if ($this->params->get('show_feed_link', 1))
{
$link = '&format=feed&limitstart=';
$attribs = array('type' => 'application/rss+xml',
'title' => 'RSS 2.0');
$this->document->addHeadLink(JRoute::_($link .
'&type=rss'), 'alternate', 'rel',
$attribs);
$attribs = array('type' =>
'application/atom+xml', 'title' => 'Atom
1.0');
$this->document->addHeadLink(JRoute::_($link .
'&type=atom'), 'alternate', 'rel',
$attribs);
}
}
}
PKkF�[�F��!!$com_content/views/form/tmpl/edit.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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;
JHtml::_('behavior.tabstate');
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', '#jform_catid', null,
array('disable_search_threshold' => 0));
JHtml::_('formbehavior.chosen', '#jform_tags', null,
array('placeholder_text_multiple' =>
JText::_('JGLOBAL_TYPE_OR_SELECT_SOME_TAGS')));
JHtml::_('formbehavior.chosen', 'select');
$this->tab_name = 'com-content-form';
$this->ignore_fieldsets = array('image-intro',
'image-full', 'jmetadata',
'item_associations');
// Create shortcut to parameters.
$params = $this->state->get('params');
// This checks if the editor config options have ever been saved. If they
haven't they will fall back to the original settings.
$editoroptions = isset($params->show_publishing_options);
if (!$editoroptions)
{
$params->show_urls_images_frontend = '0';
}
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
if (task == 'article.cancel' ||
document.formvalidator.isValid(document.getElementById('adminForm')))
{
" . $this->form->getField('articletext')->save()
. "
Joomla.submitform(task);
}
}
");
?>
<div class="edit item-page<?php echo $this->pageclass_sfx;
?>">
<?php if ($params->get('show_page_heading')) : ?>
<div class="page-header">
<h1>
<?php echo
$this->escape($params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<form action="<?php echo
JRoute::_('index.php?option=com_content&a_id=' . (int)
$this->item->id); ?>" method="post"
name="adminForm" id="adminForm"
class="form-validate form-vertical">
<fieldset>
<?php echo JHtml::_('bootstrap.startTabSet',
$this->tab_name, array('active' => 'editor'));
?>
<?php echo JHtml::_('bootstrap.addTab', $this->tab_name,
'editor', JText::_('COM_CONTENT_ARTICLE_CONTENT'));
?>
<?php echo $this->form->renderField('title'); ?>
<?php if (is_null($this->item->id)) : ?>
<?php echo $this->form->renderField('alias'); ?>
<?php endif; ?>
<?php echo $this->form->getInput('articletext');
?>
<?php if ($this->captchaEnabled) : ?>
<?php echo $this->form->renderField('captcha');
?>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php if ($params->get('show_urls_images_frontend')) :
?>
<?php echo JHtml::_('bootstrap.addTab', $this->tab_name,
'images', JText::_('COM_CONTENT_IMAGES_AND_URLS'));
?>
<?php echo $this->form->renderField('image_intro',
'images'); ?>
<?php echo
$this->form->renderField('image_intro_alt',
'images'); ?>
<?php echo
$this->form->renderField('image_intro_caption',
'images'); ?>
<?php echo $this->form->renderField('float_intro',
'images'); ?>
<?php echo
$this->form->renderField('image_fulltext',
'images'); ?>
<?php echo
$this->form->renderField('image_fulltext_alt',
'images'); ?>
<?php echo
$this->form->renderField('image_fulltext_caption',
'images'); ?>
<?php echo
$this->form->renderField('float_fulltext',
'images'); ?>
<?php echo $this->form->renderField('urla',
'urls'); ?>
<?php echo $this->form->renderField('urlatext',
'urls'); ?>
<div class="control-group">
<div class="controls">
<?php echo $this->form->getInput('targeta',
'urls'); ?>
</div>
</div>
<?php echo $this->form->renderField('urlb',
'urls'); ?>
<?php echo $this->form->renderField('urlbtext',
'urls'); ?>
<div class="control-group">
<div class="controls">
<?php echo $this->form->getInput('targetb',
'urls'); ?>
</div>
</div>
<?php echo $this->form->renderField('urlc',
'urls'); ?>
<?php echo $this->form->renderField('urlctext',
'urls'); ?>
<div class="control-group">
<div class="controls">
<?php echo $this->form->getInput('targetc',
'urls'); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php echo JLayoutHelper::render('joomla.edit.params',
$this); ?>
<?php echo JHtml::_('bootstrap.addTab', $this->tab_name,
'publishing', JText::_('COM_CONTENT_PUBLISHING'));
?>
<?php echo $this->form->renderField('catid'); ?>
<?php echo $this->form->renderField('tags'); ?>
<?php echo $this->form->renderField('note'); ?>
<?php if ($params->get('save_history', 0)) : ?>
<?php echo
$this->form->renderField('version_note'); ?>
<?php endif; ?>
<?php if ($params->get('show_publishing_options', 1) ==
1) : ?>
<?php echo
$this->form->renderField('created_by_alias'); ?>
<?php endif; ?>
<?php if
($this->item->params->get('access-change')) : ?>
<?php echo $this->form->renderField('state'); ?>
<?php echo $this->form->renderField('featured');
?>
<?php if ($params->get('show_publishing_options', 1)
== 1) : ?>
<?php echo $this->form->renderField('publish_up');
?>
<?php echo
$this->form->renderField('publish_down'); ?>
<?php endif; ?>
<?php endif; ?>
<?php echo $this->form->renderField('access'); ?>
<?php if (is_null($this->item->id)) : ?>
<div class="control-group">
<div class="control-label">
</div>
<div class="controls">
<?php echo JText::_('COM_CONTENT_ORDERING'); ?>
</div>
</div>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', $this->tab_name,
'language', JText::_('JFIELD_LANGUAGE_LABEL')); ?>
<?php echo $this->form->renderField('language');
?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php if ($params->get('show_publishing_options', 1) ==
1) : ?>
<?php echo JHtml::_('bootstrap.addTab',
$this->tab_name, 'metadata',
JText::_('COM_CONTENT_METADATA')); ?>
<?php echo $this->form->renderField('metadesc');
?>
<?php echo $this->form->renderField('metakey');
?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<input type="hidden" name="task"
value="" />
<input type="hidden" name="return"
value="<?php echo $this->return_page; ?>" />
<?php echo JHtml::_('form.token'); ?>
</fieldset>
<div class="btn-toolbar">
<div class="btn-group">
<button type="button" class="btn btn-primary"
onclick="Joomla.submitbutton('article.save')">
<span class="icon-ok"></span><?php echo
JText::_('JSAVE') ?>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn"
onclick="Joomla.submitbutton('article.cancel')">
<span class="icon-cancel"></span><?php echo
JText::_('JCANCEL') ?>
</button>
</div>
<?php if ($params->get('save_history', 0) &&
$this->item->id) : ?>
<div class="btn-group">
<?php echo $this->form->getInput('contenthistory');
?>
</div>
<?php endif; ?>
</div>
</form>
</div>
PKkF�[��%�$com_content/views/form/tmpl/edit.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTENT_FORM_VIEW_DEFAULT_TITLE"
option="COM_CONTENT_FORM_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_ARTICLE_CREATE"
/>
<message>
<![CDATA[COM_CONTENT_FORM_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<fields name="params">
<fieldset name="basic"
addfieldpath="/administrator/components/com_categories/models/fields"
>
<field
name="enable_category"
type="radio"
label="COM_CONTENT_CREATE_ARTICLE_CATEGORY_LABEL"
description="COM_CONTENT_CREATE_ARTICLE_CATEGORY_DESC"
class="btn-group btn-group-yesno"
default="0"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="catid"
type="modal_category"
label="JGLOBAL_CHOOSE_CATEGORY_LABEL"
description="JGLOBAL_CHOOSE_CATEGORY_DESC"
extension="com_content"
select="true"
new="true"
edit="true"
clear="true"
showon="enable_category:1"
/>
<field
name="redirect_menuitem"
type="modal_menu"
label="COM_CONTENT_CREATE_ARTICLE_REDIRECTMENU_LABEL"
description="COM_CONTENT_CREATE_ARTICLE_REDIRECTMENU_DESC"
>
<option value="">JDEFAULT</option>
</field>
<field
name="custom_cancel_redirect"
type="radio"
label="COM_CONTENT_CREATE_ARTICLE_CUSTOM_CANCEL_REDIRECT_LABEL"
description="COM_CONTENT_CREATE_ARTICLE_CUSTOM_CANCEL_REDIRECT_DESC"
class="btn-group btn-group-yesno"
default="0"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="cancel_redirect_menuitem"
type="modal_menu"
label="COM_CONTENT_CREATE_ARTICLE_CANCEL_REDIRECT_MENU_LABEL"
description="COM_CONTENT_CREATE_ARTICLE_CANCEL_REDIRECT_MENU_DESC"
showon="custom_cancel_redirect:1"
>
<option value="">JDEFAULT</option>
</field>
</fieldset>
</fields>
</metadata>
PKkF�[��"y>>$com_content/views/form/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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;
/**
* HTML Article View class for the Content component
*
* @since 1.5
*/
class ContentViewForm extends JViewLegacy
{
protected $form;
protected $item;
protected $return_page;
protected $state;
/**
* Should we show a captcha form for the submission of the article?
*
* @var bool
* @since 3.7.0
*/
protected $captchaEnabled = false;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$user = JFactory::getUser();
$app = JFactory::getApplication();
// Get model data.
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$this->return_page = $this->get('ReturnPage');
if (empty($this->item->id))
{
$catid = $this->state->params->get('catid');
if ($this->state->params->get('enable_category') == 1
&& $catid)
{
$authorised = $user->authorise('core.create',
'com_content.category.' . $catid);
}
else
{
$authorised = $user->authorise('core.create',
'com_content') ||
count($user->getAuthorisedCategories('com_content',
'core.create'));
}
}
else
{
$authorised =
$this->item->params->get('access-edit');
}
if ($authorised !== true)
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
$app->setHeader('status', 403, true);
return false;
}
$this->item->tags = new JHelperTags;
if (!empty($this->item->id))
{
$this->item->tags->getItemTags('com_content.article',
$this->item->id);
$this->item->images = json_decode($this->item->images);
$this->item->urls = json_decode($this->item->urls);
$tmp = new stdClass;
$tmp->images = $this->item->images;
$tmp->urls = $this->item->urls;
$this->form->bind($tmp);
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
// Create a shortcut to the parameters.
$params = &$this->state->params;
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($params->get('pageclass_sfx', ''));
$this->params = $params;
// Override global params with article specific params
$this->params->merge($this->item->params);
$this->user = $user;
// Propose current language as default when creating new article
if (empty($this->item->id) &&
JLanguageMultilang::isEnabled())
{
$lang = JFactory::getLanguage()->getTag();
$this->form->setFieldAttribute('language',
'default', $lang);
}
$captchaSet = $params->get('captcha',
JFactory::getApplication()->get('captcha', '0'));
foreach (JPluginHelper::getPlugin('captcha') as $plugin)
{
if ($captchaSet === $plugin->name)
{
$this->captchaEnabled = true;
break;
}
}
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_CONTENT_FORM_EDIT_ARTICLE'));
}
$title = $this->params->def('page_title',
JText::_('COM_CONTENT_FORM_EDIT_ARTICLE'));
if ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
$pathway = $app->getPathWay();
$pathway->addItem($title, '');
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
}
PKlF�[fPHߝ�%com_contenthistory/contenthistory.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_contenthistory
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Load the com_contenthistory language files, default to the admin file
and fall back to site if one isn't found
$lang = JFactory::getLanguage();
$lang->load('com_contenthistory', JPATH_ADMINISTRATOR, null,
false, true)
|| $lang->load('com_contenthistory', JPATH_SITE, null, false,
true);
// Hand processing over to the admin base file
require_once JPATH_COMPONENT_ADMINISTRATOR .
'/contenthistory.php';
PKlF�[O���com_fields/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_fields
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Base controller class for Fields Component.
*
* @since 3.7.0
*/
class FieldsController extends JControllerLegacy
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
* Recognized key values include
'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant
to be comprehensive).
*
* @since 3.7.0
*/
public function __construct($config = array())
{
$this->input = JFactory::getApplication()->input;
// Frontpage Editor Fields Button proxying:
if ($this->input->get('view') === 'fields'
&& $this->input->get('layout') ===
'modal')
{
// Load the backend language file.
$lang = JFactory::getLanguage();
$lang->load('com_fields', JPATH_ADMINISTRATOR);
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}
parent::__construct($config);
}
}
PKmF�[xƹ���com_fields/fields.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_fields
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR .
'/components/com_fields/helpers/fields.php');
$input = JFactory::getApplication()->input;
$context =
JFactory::getApplication()->getUserStateFromRequest('com_fields.fields.context',
'context', 'com_content.article', 'CMD');
$parts = FieldsHelper::extract($context);
if ($input->get('view') === 'fields' &&
$input->get('layout') === 'modal')
{
if (!JFactory::getUser()->authorise('core.create', $parts[0])
|| !JFactory::getUser()->authorise('core.edit', $parts[0]))
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
return;
}
}
$controller = JControllerLegacy::getInstance('Fields');
$controller->execute($input->get('task'));
$controller->redirect();
PKnF�[}0�ZZ#com_fields/layouts/field/render.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_fields
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
if (!key_exists('field', $displayData))
{
return;
}
$field = $displayData['field'];
$label = JText::_($field->label);
$value = $field->value;
$showLabel = $field->params->get('showlabel');
$labelClass = $field->params->get('label_render_class');
$valueClass = $field->params->get('value_render_class');
if ($value == '')
{
return;
}
?>
<?php if ($showLabel == 1) : ?>
<span class="field-label <?php echo $labelClass;
?>"><?php echo htmlentities($label, ENT_QUOTES | ENT_IGNORE,
'UTF-8'); ?>: </span>
<?php endif; ?>
<span class="field-value <?php echo $valueClass;
?>"><?php echo $value; ?></span>
PKnF�[(�M�
$com_fields/layouts/fields/render.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_fields
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Check if we have all the data
if (!key_exists('item', $displayData) ||
!key_exists('context', $displayData))
{
return;
}
// Setting up for display
$item = $displayData['item'];
if (!$item)
{
return;
}
$context = $displayData['context'];
if (!$context)
{
return;
}
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR .
'/components/com_fields/helpers/fields.php');
$parts = explode('.', $context);
$component = $parts[0];
$fields = null;
if (key_exists('fields', $displayData))
{
$fields = $displayData['fields'];
}
else
{
$fields = $item->jcfields ?: FieldsHelper::getFields($context, $item,
true);
}
if (empty($fields))
{
return;
}
$output = array();
foreach ($fields as $field)
{
// If the value is empty do nothing
if (!isset($field->value) || trim($field->value) === '')
{
continue;
}
$class = $field->name . ' ' .
$field->params->get('render_class');
$layout = $field->params->get('layout',
'render');
$content = FieldsHelper::render($context, 'field.' . $layout,
array('field' => $field));
// If the content is empty do nothing
if (trim($content) === '')
{
continue;
}
$output[] = '<dd class="field-entry ' . $class .
'">' . $content . '</dd>';
}
if (empty($output))
{
return;
}
?>
<dl class="fields-container">
<?php echo implode("\n", $output); ?>
</dl>
PKnF�[)���)com_fields/models/forms/filter_fields.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="group"
addfieldpath="/administrator/components/com_fields/models/fields">
<field
name="context"
type="fieldcontexts"
onchange="this.form.submit();"
/>
</fieldset>
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label=""
hint="JSEARCH_FILTER"
class="js-stools-search-string"
/>
<field
name="state"
type="status"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
name="group_id"
type="fieldgroups"
state="0,1,2"
onchange="this.form.submit();"
>
<option
value="">COM_FIELDS_VIEW_FIELDS_SELECT_GROUP</option>
</field>
<field
name="assigned_cat_ids"
type="category"
onchange="this.form.submit();"
>
<option
value="">COM_FIELDS_VIEW_FIELDS_SELECT_CATEGORY</option>
</field>
<field
name="access"
type="accesslevel"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_ACCESS</option>
</field>
<field
name="language"
type="contentlanguage"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_LANGUAGE</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
description="JGLOBAL_SORT_BY"
statuses="*,0,1,2,-2"
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.state ASC">JSTATUS_ASC</option>
<option value="a.state 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.type
ASC">COM_FIELDS_VIEW_FIELDS_SORT_TYPE_ASC</option>
<option value="a.type
DESC">COM_FIELDS_VIEW_FIELDS_SORT_TYPE_DESC</option>
<option value="g.title
ASC">COM_FIELDS_VIEW_FIELDS_SORT_GROUP_ASC</option>
<option value="g.title
DESC">COM_FIELDS_VIEW_FIELDS_SORT_GROUP_DESC</option>
<option value="a.access
ASC">JGRID_HEADING_ACCESS_ASC</option>
<option value="a.access
DESC">JGRID_HEADING_ACCESS_DESC</option>
<option value="a.language
ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="a.language
DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="a.id
ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id
DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_FIELDS_LIST_LIMIT"
description="COM_FIELDS_LIST_LIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>
PKoF�[w�/]com_finder/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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;
JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR .
'/components/com_finder/helpers/language.php');
/**
* Finder Component Controller.
*
* @since 2.5
*/
class FinderController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached.
[optional]
* @param array $urlparams An array of safe URL parameters and their
variable types,
* for valid values see {@link
JFilterInput::clean()}. [optional]
*
* @return JControllerLegacy This object is to support chaining.
*
* @since 2.5
*/
public function display($cachable = false, $urlparams = array())
{
$input = JFactory::getApplication()->input;
$cachable = true;
// Load plugin language files.
FinderHelperLanguage::loadPluginLanguage();
// Set the default view name and format from the Request.
$viewName = $input->get('view', 'search',
'word');
$input->set('view', $viewName);
// Don't cache view for search queries
if ($input->get('q', null, 'string') ||
$input->get('f', null, 'int') ||
$input->get('t', null, 'array'))
{
$cachable = false;
}
$safeurlparams = array(
'f' => 'INT',
'lang' => 'CMD'
);
return parent::display($cachable, $safeurlparams);
}
}
PKoF�[��� � +com_finder/controllers/suggestions.json.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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;
/**
* Suggestions JSON controller for Finder.
*
* @since 2.5
*/
class FinderControllerSuggestions extends JControllerLegacy
{
/**
* Method to find search query suggestions. Uses jQuery and
autocompleter.js
*
* @return void
*
* @since 3.4
*/
public function suggest()
{
/** @var \Joomla\CMS\Application\CMSApplication $app */
$app = JFactory::getApplication();
$app->mimeType = 'application/json';
// Ensure caching is disabled as it depends on the query param in the
model
$app->allowCache(false);
$suggestions = $this->getSuggestions();
// Send the response.
$app->setHeader('Content-Type', $app->mimeType . ';
charset=' . $app->charSet);
$app->sendHeaders();
echo '{ "suggestions": ' . json_encode($suggestions)
. ' }';
$app->close();
}
/**
* Method to find search query suggestions. Uses Mootools and
autocompleter.js
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their
variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return void
*
* @since 2.5
* @deprecated 3.4
*/
public function display($cachable = false, $urlparams = false)
{
/** @var \Joomla\CMS\Application\CMSApplication $app */
$app = JFactory::getApplication();
$app->mimeType = 'application/json';
// Ensure caching is disabled as it depends on the query param in the
model
$app->allowCache(false);
$suggestions = $this->getSuggestions();
// Send the response.
$app->setHeader('Content-Type', $app->mimeType . ';
charset=' . $app->charSet);
$app->sendHeaders();
echo json_encode($suggestions);
$app->close();
}
/**
* Method to retrieve the data from the database
*
* @return array The suggested words
*
* @since 3.4
*/
protected function getSuggestions()
{
$return = array();
$params = JComponentHelper::getParams('com_finder');
if ($params->get('show_autosuggest', 1))
{
// Get the suggestions.
$model = $this->getModel('Suggestions',
'FinderModel');
$return = $model->getItems();
}
// Check the data.
if (empty($return))
{
$return = array();
}
return $return;
}
}
PKoF�[l�8c��com_finder/finder.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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;
JLoader::register('FinderHelperRoute', JPATH_COMPONENT .
'/helpers/route.php');
$controller = JControllerLegacy::getInstance('Finder');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
PKpF�[X�1�7�7"com_finder/helpers/html/filter.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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;
JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR .
'/components/com_finder/helpers/language.php');
/**
* Filter HTML Behaviors for Finder.
*
* @since 2.5
*/
abstract class JHtmlFilter
{
/**
* Method to generate filters using the slider widget and decorated
* with the FinderFilter JavaScript behaviors.
*
* @param array $options An array of configuration options. [optional]
*
* @return mixed A rendered HTML widget on success, null otherwise.
*
* @since 2.5
*/
public static function slider($options = array())
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$html = '';
$filter = null;
// Get the configuration options.
$filterId = array_key_exists('filter_id', $options) ?
$options['filter_id'] : null;
$activeNodes = array_key_exists('selected_nodes', $options) ?
$options['selected_nodes'] : array();
$classSuffix = array_key_exists('class_suffix', $options) ?
$options['class_suffix'] : '';
// Load the predefined filter if specified.
if (!empty($filterId))
{
$query->select('f.data, f.params')
->from($db->quoteName('#__finder_filters') . ' AS
f')
->where('f.filter_id = ' . (int) $filterId);
// Load the filter data.
$db->setQuery($query);
try
{
$filter = $db->loadObject();
}
catch (RuntimeException $e)
{
return null;
}
// Initialize the filter parameters.
if ($filter)
{
$filter->params = new Registry($filter->params);
}
}
// Build the query to get the branch data and the number of child nodes.
$query->clear()
->select('t.*, count(c.id) AS children')
->from($db->quoteName('#__finder_taxonomy') . ' AS
t')
->join('INNER',
$db->quoteName('#__finder_taxonomy') . ' AS c ON
c.parent_id = t.id')
->where('t.parent_id = 1')
->where('t.state = 1')
->where('t.access IN (' . $groups . ')')
->group('t.id, t.parent_id, t.state, t.access, t.ordering,
t.title, c.parent_id')
->order('t.ordering, t.title');
// Limit the branch children to a predefined filter.
if ($filter)
{
$query->where('c.id IN(' . $filter->data .
')');
}
// Load the branches.
$db->setQuery($query);
try
{
$branches = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
return null;
}
// Check that we have at least one branch.
if (count($branches) === 0)
{
return null;
}
$branch_keys = array_keys($branches);
$html .= JHtml::_('bootstrap.startAccordion',
'accordion', array('parent' => true,
'active' => 'accordion-' . $branch_keys[0])
);
// Load plugin language files.
FinderHelperLanguage::loadPluginLanguage();
// Iterate through the branches and build the branch groups.
foreach ($branches as $bk => $bv)
{
// If the multi-lang plugin is enabled then drop the language branch.
if ($bv->title === 'Language' &&
JLanguageMultilang::isEnabled())
{
continue;
}
// Build the query to get the child nodes for this branch.
$query->clear()
->select('t.*')
->from($db->quoteName('#__finder_taxonomy') . ' AS
t')
->where('t.parent_id = ' . (int) $bk)
->where('t.state = 1')
->where('t.access IN (' . $groups . ')')
->order('t.ordering, t.title');
// Self-join to get the parent title.
$query->select('e.title AS parent_title')
->join('LEFT',
$db->quoteName('#__finder_taxonomy', 'e') . '
ON ' . $db->quoteName('e.id') . ' = ' .
$db->quoteName('t.parent_id'));
// Load the branches.
$db->setQuery($query);
try
{
$nodes = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
return null;
}
// Translate node titles if possible.
$lang = JFactory::getLanguage();
foreach ($nodes as $nk => $nv)
{
if (trim($nv->parent_title, '**') ===
'Language')
{
$title = FinderHelperLanguage::branchLanguageTitle($nv->title);
}
else
{
$key = FinderHelperLanguage::branchPlural($nv->title);
$title = $lang->hasKey($key) ? JText::_($key) : $nv->title;
}
$nodes[$nk]->title = $title;
}
// Adding slides
$html .= JHtml::_('bootstrap.addSlide',
'accordion',
JText::sprintf('COM_FINDER_FILTER_BRANCH_LABEL',
JText::_(FinderHelperLanguage::branchSingular($bv->title)) . '
- ' . count($nodes)
),
'accordion-' . $bk
);
// Populate the toggle button.
$html .= '<button class="btn jform-rightbtn"
type="button"
onclick="jQuery(\'[id="tax-'
. $bk .
'"]\').each(function(){this.click();});"><span
class="icon-checkbox-partial"></span> '
. JText::_('JGLOBAL_SELECTION_INVERT') .
'</button><hr/>';
// Populate the group with nodes.
foreach ($nodes as $nk => $nv)
{
// Determine if the node should be checked.
$checked = in_array($nk, $activeNodes) ? '
checked="checked"' : '';
// Build a node.
$html .= '<div class="control-group">';
$html .= '<div class="controls">';
$html .= '<label class="checkbox">';
$html .= '<input type="checkbox" class="selector
filter-node' . $classSuffix . '" value="' . $nk .
'" name="t[]" id="tax-'
. $bk . '"' . $checked . ' />';
$html .= $nv->title;
$html .= '</label>';
$html .= '</div>';
$html .= '</div>';
}
$html .= JHtml::_('bootstrap.endSlide');
}
$html .= JHtml::_('bootstrap.endAccordion');
return $html;
}
/**
* Method to generate filters using select box dropdown controls.
*
* @param FinderIndexerQuery $idxQuery A FinderIndexerQuery object.
* @param array $options An array of options.
*
* @return mixed A rendered HTML widget on success, null otherwise.
*
* @since 2.5
*/
public static function select($idxQuery, $options)
{
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$filter = null;
// Get the configuration options.
$classSuffix = $options->get('class_suffix', null);
$showDates = $options->get('show_date_filters', false);
// Try to load the results from cache.
$cache = JFactory::getCache('com_finder', '');
$cacheId = 'filter_select_' .
serialize(array($idxQuery->filter, $options, $groups,
JFactory::getLanguage()->getTag()));
// Check the cached results.
if ($cache->contains($cacheId))
{
$branches = $cache->get($cacheId);
}
else
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Load the predefined filter if specified.
if (!empty($idxQuery->filter))
{
$query->select('f.data, ' .
$db->quoteName('f.params'))
->from($db->quoteName('#__finder_filters') . ' AS
f')
->where('f.filter_id = ' . (int) $idxQuery->filter);
// Load the filter data.
$db->setQuery($query);
try
{
$filter = $db->loadObject();
}
catch (RuntimeException $e)
{
return null;
}
// Initialize the filter parameters.
if ($filter)
{
$filter->params = new Registry($filter->params);
}
}
// Build the query to get the branch data and the number of child nodes.
$query->clear()
->select('t.*, count(c.id) AS children')
->from($db->quoteName('#__finder_taxonomy') . ' AS
t')
->join('INNER',
$db->quoteName('#__finder_taxonomy') . ' AS c ON
c.parent_id = t.id')
->where('t.parent_id = 1')
->where('t.state = 1')
->where('t.access IN (' . $groups . ')')
->where('c.state = 1')
->where('c.access IN (' . $groups . ')')
->group($db->quoteName('t.id'))
->order('t.ordering, t.title');
// Limit the branch children to a predefined filter.
if (!empty($filter->data))
{
$query->where('c.id IN(' . $filter->data .
')');
}
// Load the branches.
$db->setQuery($query);
try
{
$branches = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
return null;
}
// Check that we have at least one branch.
if (count($branches) === 0)
{
return null;
}
// Iterate through the branches and build the branch groups.
foreach ($branches as $bk => $bv)
{
// If the multi-lang plugin is enabled then drop the language branch.
if ($bv->title === 'Language' &&
JLanguageMultilang::isEnabled())
{
continue;
}
// Build the query to get the child nodes for this branch.
$query->clear()
->select('t.*')
->from($db->quoteName('#__finder_taxonomy') . '
AS t')
->where('t.parent_id = ' . (int) $bk)
->where('t.state = 1')
->where('t.access IN (' . $groups . ')')
->order('t.ordering, t.title');
// Self-join to get the parent title.
$query->select('e.title AS parent_title')
->join('LEFT',
$db->quoteName('#__finder_taxonomy', 'e') . '
ON ' . $db->quoteName('e.id') . ' = ' .
$db->quoteName('t.parent_id'));
// Limit the nodes to a predefined filter.
if (!empty($filter->data))
{
$query->where('t.id IN(' . $filter->data .
')');
}
// Load the branches.
$db->setQuery($query);
try
{
$branches[$bk]->nodes = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
return null;
}
// Translate branch nodes if possible.
$language = JFactory::getLanguage();
foreach ($branches[$bk]->nodes as $node_id => $node)
{
if (trim($node->parent_title, '**') ===
'Language')
{
$title = FinderHelperLanguage::branchLanguageTitle($node->title);
}
else
{
$key = FinderHelperLanguage::branchPlural($node->title);
$title = $language->hasKey($key) ? JText::_($key) :
$node->title;
}
$branches[$bk]->nodes[$node_id]->title = $title;
}
// Add the Search All option to the branch.
array_unshift($branches[$bk]->nodes, array('id' =>
null, 'title' =>
JText::_('COM_FINDER_FILTER_SELECT_ALL_LABEL')));
}
// Store the data in cache.
$cache->store($branches, $cacheId);
}
$html = '';
// Add the dates if enabled.
if ($showDates)
{
$html .= JHtml::_('filter.dates', $idxQuery, $options);
}
$html .= '<div class="filter-branch' . $classSuffix .
' control-group clearfix">';
// Iterate through all branches and build code.
foreach ($branches as $bk => $bv)
{
// If the multi-lang plugin is enabled then drop the language branch.
if ($bv->title === 'Language' &&
JLanguageMultilang::isEnabled())
{
continue;
}
$active = null;
// Check if the branch is in the filter.
if (array_key_exists($bv->title, $idxQuery->filters))
{
// Get the request filters.
$temp =
JFactory::getApplication()->input->request->get('t',
array(), 'array');
// Search for active nodes in the branch and get the active node.
$active = array_intersect($temp, $idxQuery->filters[$bv->title]);
$active = count($active) === 1 ? array_shift($active) : null;
}
// Build a node.
$html .= '<div class="controls
finder-selects">';
$html .= '<label for="tax-' .
JFilterOutput::stringURLSafe($bv->title) . '"
class="control-label">';
$html .= JText::sprintf('COM_FINDER_FILTER_BRANCH_LABEL',
JText::_(FinderHelperLanguage::branchSingular($bv->title)));
$html .= '</label>';
$html .= '<br />';
$html .= JHtml::_(
'select.genericlist',
$branches[$bk]->nodes, 't[]', 'class="inputbox
advancedSelect"', 'id', 'title', $active,
'tax-' . JFilterOutput::stringURLSafe($bv->title)
);
$html .= '</div>';
}
$html .= '</div>';
return $html;
}
/**
* Method to generate fields for filtering dates
*
* @param FinderIndexerQuery $idxQuery A FinderIndexerQuery object.
* @param array $options An array of options.
*
* @return mixed A rendered HTML widget on success, null otherwise.
*
* @since 2.5
*/
public static function dates($idxQuery, $options)
{
$html = '';
// Get the configuration options.
$classSuffix = $options->get('class_suffix', null);
$loadMedia = $options->get('load_media', true);
$showDates = $options->get('show_date_filters', false);
if (!empty($showDates))
{
// Build the date operators options.
$operators = array();
$operators[] = JHtml::_('select.option', 'before',
JText::_('COM_FINDER_FILTER_DATE_BEFORE'));
$operators[] = JHtml::_('select.option', 'exact',
JText::_('COM_FINDER_FILTER_DATE_EXACTLY'));
$operators[] = JHtml::_('select.option', 'after',
JText::_('COM_FINDER_FILTER_DATE_AFTER'));
// Load the CSS/JS resources.
if ($loadMedia)
{
JHtml::_('stylesheet', 'com_finder/dates.css',
array('version' => 'auto', 'relative'
=> true));
}
// Open the widget.
$html .= '<ul
id="finder-filter-select-dates">';
// Start date filter.
$attribs['class'] = 'input-medium';
$html .= '<li class="filter-date' . $classSuffix .
'">';
$html .= '<label for="filter_date1"
class="hasTooltip" title ="' .
JText::_('COM_FINDER_FILTER_DATE1_DESC') .
'">';
$html .= JText::_('COM_FINDER_FILTER_DATE1');
$html .= '</label>';
$html .= '<br />';
$html .= JHtml::_(
'select.genericlist',
$operators, 'w1', 'class="inputbox
filter-date-operator advancedSelect"', 'value',
'text', $idxQuery->when1, 'finder-filter-w1'
);
$html .= JHtml::_('calendar', $idxQuery->date1,
'd1', 'filter_date1', '%Y-%m-%d', $attribs);
$html .= '</li>';
// End date filter.
$html .= '<li class="filter-date' . $classSuffix .
'">';
$html .= '<label for="filter_date2"
class="hasTooltip" title ="' .
JText::_('COM_FINDER_FILTER_DATE2_DESC') .
'">';
$html .= JText::_('COM_FINDER_FILTER_DATE2');
$html .= '</label>';
$html .= '<br />';
$html .= JHtml::_(
'select.genericlist',
$operators, 'w2', 'class="inputbox
filter-date-operator advancedSelect"', 'value',
'text', $idxQuery->when2, 'finder-filter-w2'
);
$html .= JHtml::_('calendar', $idxQuery->date2,
'd2', 'filter_date2', '%Y-%m-%d', $attribs);
$html .= '</li>';
// Close the widget.
$html .= '</ul>';
}
return $html;
}
}
PKpF�[�ش���!com_finder/helpers/html/query.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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;
/**
* Query HTML behavior class for Finder.
*
* @since 2.5
*/
abstract class JHtmlQuery
{
/**
* Method to get the explained (human-readable) search query.
*
* @param FinderIndexerQuery $query A FinderIndexerQuery object to
explain.
*
* @return mixed String if there is data to explain, null otherwise.
*
* @since 2.5
*/
public static function explained(FinderIndexerQuery $query)
{
$parts = array();
// Process the required tokens.
foreach ($query->included as $token)
{
if ($token->required && (!isset($token->derived) ||
$token->derived == false))
{
$parts[] = '<span class="query-required">' .
JText::sprintf('COM_FINDER_QUERY_TOKEN_REQUIRED',
$token->term) . '</span>';
}
}
// Process the optional tokens.
foreach ($query->included as $token)
{
if (!$token->required && (!isset($token->derived) ||
$token->derived == false))
{
$parts[] = '<span class="query-optional">' .
JText::sprintf('COM_FINDER_QUERY_TOKEN_OPTIONAL',
$token->term) . '</span>';
}
}
// Process the excluded tokens.
foreach ($query->excluded as $token)
{
if (!isset($token->derived) || $token->derived === false)
{
$parts[] = '<span class="query-excluded">' .
JText::sprintf('COM_FINDER_QUERY_TOKEN_EXCLUDED',
$token->term) . '</span>';
}
}
// Process the start date.
if ($query->date1)
{
$date =
JFactory::getDate($query->date1)->format(JText::_('DATE_FORMAT_LC'));
$datecondition = JText::_('COM_FINDER_QUERY_DATE_CONDITION_' .
strtoupper($query->when1));
$parts[] = '<span class="query-start-date">' .
JText::sprintf('COM_FINDER_QUERY_START_DATE', $datecondition,
$date) . '</span>';
}
// Process the end date.
if ($query->date2)
{
$date =
JFactory::getDate($query->date2)->format(JText::_('DATE_FORMAT_LC'));
$datecondition = JText::_('COM_FINDER_QUERY_DATE_CONDITION_' .
strtoupper($query->when2));
$parts[] = '<span class="query-end-date">' .
JText::sprintf('COM_FINDER_QUERY_END_DATE', $datecondition,
$date) . '</span>';
}
// Process the taxonomy filters.
if (!empty($query->filters))
{
// Get the filters in the request.
$t =
JFactory::getApplication()->input->request->get('t',
array(), 'array');
// Process the taxonomy branches.
foreach ($query->filters as $branch => $nodes)
{
// Process the taxonomy nodes.
$lang = JFactory::getLanguage();
foreach ($nodes as $title => $id)
{
// Translate the title for Types
$key = FinderHelperLanguage::branchPlural($title);
if ($lang->hasKey($key))
{
$title = JText::_($key);
}
// Don't include the node if it is not in the request.
if (!in_array($id, $t))
{
continue;
}
// Add the node to the explanation.
$parts[] = '<span class="query-taxonomy">'
. JText::sprintf('COM_FINDER_QUERY_TAXONOMY_NODE', $title,
JText::_(FinderHelperLanguage::branchSingular($branch)))
. '</span>';
}
}
}
// Build the interpreted query.
return count($parts) ?
JText::sprintf('COM_FINDER_QUERY_TOKEN_INTERPRETED',
implode(JText::_('COM_FINDER_QUERY_TOKEN_GLUE'), $parts)) : null;
}
/**
* Method to get the suggested search query.
*
* @param FinderIndexerQuery $query A FinderIndexerQuery object.
*
* @return mixed String if there is a suggestion, false otherwise.
*
* @since 2.5
*/
public static function suggested(FinderIndexerQuery $query)
{
$suggested = false;
// Check if the query input is empty.
if (empty($query->input))
{
return $suggested;
}
// Check if there were any ignored or included keywords.
if (count($query->ignored) || count($query->included))
{
$suggested = $query->input;
// Replace the ignored keyword suggestions.
foreach (array_reverse($query->ignored) as $token)
{
if (isset($token->suggestion))
{
$suggested = str_ireplace($token->term, $token->suggestion,
$suggested);
}
}
// Replace the included keyword suggestions.
foreach (array_reverse($query->included) as $token)
{
if (isset($token->suggestion))
{
$suggested = str_ireplace($token->term, $token->suggestion,
$suggested);
}
}
// Check if we made any changes.
if ($suggested == $query->input)
{
$suggested = false;
}
}
return $suggested;
}
}
PKqF�[!f�com_finder/helpers/route.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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;
/**
* Finder route helper class.
*
* @since 2.5
*/
class FinderHelperRoute
{
/**
* Method to get the route for a search page.
*
* @param integer $f The search filter id. [optional]
* @param string $q The search query string. [optional]
*
* @return string The search route.
*
* @since 2.5
*/
public static function getSearchRoute($f = null, $q = null)
{
// Get the menu item id.
$query = array('view' => 'search', 'q'
=> $q, 'f' => $f);
$item = self::getItemid($query);
// Get the base route.
$uri = clone
JUri::getInstance('index.php?option=com_finder&view=search');
// Add the pre-defined search filter if present.
if ($f !== null)
{
$uri->setVar('f', $f);
}
// Add the search query string if present.
if ($q !== null)
{
$uri->setVar('q', $q);
}
// Add the menu item id if present.
if ($item !== null)
{
$uri->setVar('Itemid', $item);
}
return $uri->toString(array('path', 'query'));
}
/**
* Method to get the route for an advanced search page.
*
* @param integer $f The search filter id. [optional]
* @param string $q The search query string. [optional]
*
* @return string The advanced search route.
*
* @since 2.5
*/
public static function getAdvancedRoute($f = null, $q = null)
{
// Get the menu item id.
$query = array('view' => 'advanced', 'q'
=> $q, 'f' => $f);
$item = self::getItemid($query);
// Get the base route.
$uri = clone
JUri::getInstance('index.php?option=com_finder&view=advanced');
// Add the pre-defined search filter if present.
if ($q !== null)
{
$uri->setVar('f', $f);
}
// Add the search query string if present.
if ($q !== null)
{
$uri->setVar('q', $q);
}
// Add the menu item id if present.
if ($item !== null)
{
$uri->setVar('Itemid', $item);
}
return $uri->toString(array('path', 'query'));
}
/**
* Method to get the most appropriate menu item for the route based on the
* supplied query needles.
*
* @param array $query An array of URL parameters.
*
* @return mixed An integer on success, null otherwise.
*
* @since 2.5
*/
public static function getItemid($query)
{
static $items, $active;
// Get the menu items for com_finder.
if (!$items || !$active)
{
$app = JFactory::getApplication('site');
$com = JComponentHelper::getComponent('com_finder');
$menu = $app->getMenu();
$active = $menu->getActive();
$items = $menu->getItems('component_id', $com->id);
$items = is_array($items) ? $items : array();
}
// Try to match the active view and filter.
if ($active && @$active->query['view'] ==
@$query['view'] && @$active->query['f'] ==
@$query['f'])
{
return $active->id;
}
// Try to match the view, query, and filter.
foreach ($items as $item)
{
if (@$item->query['view'] == @$query['view']
&& @$item->query['q'] == @$query['q']
&& @$item->query['f'] == @$query['f'])
{
return $item->id;
}
}
// Try to match the view and filter.
foreach ($items as $item)
{
if (@$item->query['view'] == @$query['view']
&& @$item->query['f'] == @$query['f'])
{
return $item->id;
}
}
// Try to match the view.
foreach ($items as $item)
{
if (@$item->query['view'] == @$query['view'])
{
return $item->id;
}
}
return null;
}
}
PKqF�[Lf6܍���com_finder/models/search.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
// Register dependent classes.
define('FINDER_PATH_INDEXER', JPATH_ADMINISTRATOR .
'/components/com_finder/helpers/indexer');
JLoader::register('FinderIndexerHelper', FINDER_PATH_INDEXER .
'/helper.php');
JLoader::register('FinderIndexerQuery', FINDER_PATH_INDEXER .
'/query.php');
JLoader::register('FinderIndexerResult', FINDER_PATH_INDEXER .
'/result.php');
JLoader::register('FinderIndexerStemmer', FINDER_PATH_INDEXER .
'/stemmer.php');
/**
* Search model class for the Finder package.
*
* @since 2.5
*/
class FinderModelSearch extends JModelList
{
/**
* Context string for the model type
*
* @var string
* @since 2.5
*/
protected $context = 'com_finder.search';
/**
* The query object is an instance of FinderIndexerQuery which contains
and
* models the entire search query including the text input; static and
* dynamic taxonomy filters; date filters; etc.
*
* @var FinderIndexerQuery
* @since 2.5
*/
protected $query;
/**
* An array of all excluded terms ids.
*
* @var array
* @since 2.5
*/
protected $excludedTerms = array();
/**
* An array of all included terms ids.
*
* @var array
* @since 2.5
*/
protected $includedTerms = array();
/**
* An array of all required terms ids.
*
* @var array
* @since 2.5
*/
protected $requiredTerms = array();
/**
* Method to get the results of the query.
*
* @return array An array of FinderIndexerResult objects.
*
* @since 2.5
* @throws Exception on database error.
*/
public function getResults()
{
// Check if the search query is valid.
if (empty($this->query->search))
{
return null;
}
// Check if we should return results.
if (empty($this->includedTerms) &&
(empty($this->query->filters) || !$this->query->empty))
{
return null;
}
// Get the store id.
$store = $this->getStoreId('getResults');
// Use the cached data if possible.
if ($this->retrieve($store))
{
return $this->retrieve($store);
}
// Get the row data.
$items = $this->getResultsData();
// Check the data.
if (empty($items))
{
return null;
}
// Create the query to get the search results.
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('link_id') . ', ' .
$db->quoteName('object'))
->from($db->quoteName('#__finder_links'))
->where($db->quoteName('link_id') . ' IN (' .
implode(',', array_keys($items)) . ')');
// Load the results from the database.
$db->setQuery($query);
$rows = $db->loadObjectList('link_id');
// Set up our results container.
$results = $items;
// Convert the rows to result objects.
foreach ($rows as $rk => $row)
{
// Build the result object.
if (is_resource($row->object))
{
$object = pg_unescape_bytea(stream_get_contents($row->object));
$result = unserialize(str_replace("''",
"'", $object));
}
else
{
$result = unserialize($row->object);
}
$result->weight = $results[$rk];
$result->link_id = $rk;
// Add the result back to the stack.
$results[$rk] = $result;
}
// Switch to a non-associative array.
$results = array_values($results);
// Push the results into cache.
$this->store($store, $results);
// Return the results.
return $this->retrieve($store);
}
/**
* Method to get the total number of results.
*
* @return integer The total number of results.
*
* @since 2.5
* @throws Exception on database error.
*/
public function getTotal()
{
// Check if the search query is valid.
if (empty($this->query->search))
{
return null;
}
// Check if we should return results.
if (empty($this->includedTerms) &&
(empty($this->query->filters) || !$this->query->empty))
{
return null;
}
// Get the store id.
$store = $this->getStoreId('getTotal');
// Use the cached data if possible.
if ($this->retrieve($store))
{
return $this->retrieve($store);
}
// Get the results total.
$total = $this->getResultsTotal();
// Push the total into cache.
$this->store($store, $total);
// Return the total.
return $this->retrieve($store);
}
/**
* Method to get the query object.
*
* @return FinderIndexerQuery A query object.
*
* @since 2.5
*/
public function getQuery()
{
// Return the query object.
return $this->query;
}
/**
* Method to build a database query to load the list data.
*
* @return JDatabaseQuery A database query.
*
* @since 2.5
*/
protected function getListQuery()
{
// Get the store id.
$store = $this->getStoreId('getListQuery');
// Use the cached data if possible.
if ($this->retrieve($store, false))
{
return clone $this->retrieve($store, false);
}
// Set variables
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('l.link_id')
->from($db->quoteName('#__finder_links') . ' AS
l')
->where('l.access IN (' . $groups . ')')
->where('l.state = 1')
->where('l.published = 1');
// Get the null date and the current date, minus seconds.
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(substr_replace(JFactory::getDate()->toSql(),
'00', -2));
// Add the publish up and publish down filters.
$query->where('(l.publish_start_date = ' . $nullDate .
' OR l.publish_start_date <= ' . $nowDate . ')')
->where('(l.publish_end_date = ' . $nullDate . ' OR
l.publish_end_date >= ' . $nowDate . ')');
/*
* Add the taxonomy filters to the query. We have to join the taxonomy
* map table for each group so that we can use AND clauses across
* groups. Within each group there can be an array of values that will
* use OR clauses.
*/
if (!empty($this->query->filters))
{
// Convert the associative array to a numerically indexed array.
$groups = array_values($this->query->filters);
// Iterate through each taxonomy group and add the join and where.
for ($i = 0, $c = count($groups); $i < $c; $i++)
{
// We use the offset because each join needs a unique alias.
$query->join('INNER',
$db->quoteName('#__finder_taxonomy_map') . ' AS t' .
$i . ' ON t' . $i . '.link_id = l.link_id')
->where('t' . $i . '.node_id IN (' .
implode(',', $groups[$i]) . ')');
}
}
// Add the start date filter to the query.
if (!empty($this->query->date1))
{
// Escape the date.
$date1 = $db->quote($this->query->date1);
// Add the appropriate WHERE condition.
if ($this->query->when1 === 'before')
{
$query->where($db->quoteName('l.start_date') . '
<= ' . $date1);
}
elseif ($this->query->when1 === 'after')
{
$query->where($db->quoteName('l.start_date') . '
>= ' . $date1);
}
else
{
$query->where($db->quoteName('l.start_date') . ' =
' . $date1);
}
}
// Add the end date filter to the query.
if (!empty($this->query->date2))
{
// Escape the date.
$date2 = $db->quote($this->query->date2);
// Add the appropriate WHERE condition.
if ($this->query->when2 === 'before')
{
$query->where($db->quoteName('l.start_date') . '
<= ' . $date2);
}
elseif ($this->query->when2 === 'after')
{
$query->where($db->quoteName('l.start_date') . '
>= ' . $date2);
}
else
{
$query->where($db->quoteName('l.start_date') . ' =
' . $date2);
}
}
// Filter by language
if ($this->getState('filter.language'))
{
$query->where('l.language IN (' .
$db->quote(JFactory::getLanguage()->getTag()) . ', ' .
$db->quote('*') . ')');
}
// Push the data into cache.
$this->store($store, $query, false);
// Return a copy of the query object.
return clone $this->retrieve($store, false);
}
/**
* Method to get the total number of results for the search query.
*
* @return integer The results total.
*
* @since 2.5
* @throws Exception on database error.
*/
protected function getResultsTotal()
{
// Get the store id.
$store = $this->getStoreId('getResultsTotal', false);
// Use the cached data if possible.
if ($this->retrieve($store))
{
return $this->retrieve($store);
}
// Get the base query and add the ordering information.
$base = $this->getListQuery();
$base->select('0 AS ordering');
// Get the maximum number of results.
$limit = (int) $this->getState('match.limit');
/*
* If there are no optional or required search terms in the query,
* we can get the result total in one relatively simple database query.
*/
if (empty($this->includedTerms))
{
// Adjust the query to join on the appropriate mapping table.
$query = clone $base;
$query->clear('select')
->select('COUNT(DISTINCT l.link_id)');
// Get the total from the database.
$this->_db->setQuery($query);
$total = $this->_db->loadResult();
// Push the total into cache.
$this->store($store, min($total, $limit));
// Return the total.
return $this->retrieve($store);
}
/*
* If there are optional or required search terms in the query, the
* process of getting the result total is more complicated.
*/
$start = 0;
$items = array();
$sorted = array();
$maps = array();
$excluded = $this->getExcludedLinkIds();
/*
* Iterate through the included search terms and group them by mapping
* table suffix. This ensures that we never have to do more than 16
* queries to get a batch. This may seem like a lot but it is rarely
* anywhere near 16 because of the improved mapping algorithm.
*/
foreach ($this->includedTerms as $token => $ids)
{
// Get the mapping table suffix.
$suffix = StringHelper::substr(md5(StringHelper::substr($token, 0, 1)),
0, 1);
// Initialize the mapping group.
if (!array_key_exists($suffix, $maps))
{
$maps[$suffix] = array();
}
// Add the terms to the mapping group.
$maps[$suffix] = array_merge($maps[$suffix], $ids);
}
/*
* When the query contains search terms we need to find and process the
* result total iteratively using a do-while loop.
*/
do
{
// Create a container for the fetched results.
$results = array();
$more = false;
/*
* Iterate through the mapping groups and load the total from each
* mapping table.
*/
foreach ($maps as $suffix => $ids)
{
// Create a storage key for this set.
$setId = $this->getStoreId('getResultsTotal:' .
serialize(array_values($ids)) . ':' . $start . ':' .
$limit);
// Use the cached data if possible.
if ($this->retrieve($setId))
{
$temp = $this->retrieve($setId);
}
// Load the data from the database.
else
{
// Adjust the query to join on the appropriate mapping table.
$query = clone $base;
$query->join('INNER', '#__finder_links_terms' .
$suffix . ' AS m ON m.link_id = l.link_id')
->where('m.term_id IN (' . implode(',', $ids)
. ')');
// Load the results from the database.
$this->_db->setQuery($query, $start, $limit);
$temp = $this->_db->loadObjectList();
// Set the more flag to true if any of the sets equal the limit.
$more = count($temp) === $limit;
// We loaded the data unkeyed but we need it to be keyed for later.
$junk = $temp;
$temp = array();
// Convert to an associative array.
for ($i = 0, $c = count($junk); $i < $c; $i++)
{
$temp[$junk[$i]->link_id] = $junk[$i];
}
// Store this set in cache.
$this->store($setId, $temp);
}
// Merge the results.
$results = array_merge($results, $temp);
}
// Check if there are any excluded terms to deal with.
if (count($excluded))
{
// Remove any results that match excluded terms.
for ($i = 0, $c = count($results); $i < $c; $i++)
{
if (in_array($results[$i]->link_id, $excluded))
{
unset($results[$i]);
}
}
// Reset the array keys.
$results = array_values($results);
}
// Iterate through the set to extract the unique items.
for ($i = 0, $c = count($results); $i < $c; $i++)
{
if (!isset($sorted[$results[$i]->link_id]))
{
$sorted[$results[$i]->link_id] = $results[$i]->ordering;
}
}
/*
* If the query contains just optional search terms and we have
* enough items for the page, we can stop here.
*/
if (empty($this->requiredTerms))
{
// If we need more items and they're available, make another pass.
if ($more && count($sorted) < $limit)
{
// Increment the batch starting point and continue.
$start += $limit;
continue;
}
// Push the total into cache.
$this->store($store, min(count($sorted), $limit));
// Return the total.
return $this->retrieve($store);
}
/*
* The query contains required search terms so we have to iterate
* over the items and remove any items that do not match all of the
* required search terms. This is one of the most expensive steps
* because a required token could theoretically eliminate all of
* current terms which means we would have to loop through all of
* the possibilities.
*/
foreach ($this->requiredTerms as $token => $required)
{
// Create a storage key for this set.
$setId = $this->getStoreId('getResultsTotal:required:' .
serialize(array_values($required)) . ':' . $start . ':'
. $limit);
// Use the cached data if possible.
if ($this->retrieve($setId))
{
$reqTemp = $this->retrieve($setId);
}
// Check if the token was matched.
elseif (empty($required))
{
return null;
}
// Load the data from the database.
else
{
// Setup containers in case we have to make multiple passes.
$reqStart = 0;
$reqTemp = array();
do
{
// Get the map table suffix.
$suffix = StringHelper::substr(md5(StringHelper::substr($token, 0,
1)), 0, 1);
// Adjust the query to join on the appropriate mapping table.
$query = clone $base;
$query->join('INNER', '#__finder_links_terms'
. $suffix . ' AS m ON m.link_id = l.link_id')
->where('m.term_id IN (' . implode(',',
$required) . ')');
// Load the results from the database.
$this->_db->setQuery($query, $reqStart, $limit);
$temp = $this->_db->loadObjectList('link_id');
// Set the required token more flag to true if the set equal the
limit.
$reqMore = count($temp) === $limit;
// Merge the matching set for this token.
$reqTemp += $temp;
// Increment the term offset.
$reqStart += $limit;
}
while ($reqMore === true);
// Store this set in cache.
$this->store($setId, $reqTemp);
}
// Remove any items that do not match the required term.
$sorted = array_intersect_key($sorted, $reqTemp);
}
// If we need more items and they're available, make another pass.
if ($more && count($sorted) < $limit)
{
// Increment the batch starting point.
$start += $limit;
// Merge the found items.
$items += $sorted;
continue;
}
// Otherwise, end the loop.
{
// Merge the found items.
$items += $sorted;
$more = false;
}
// End do-while loop.
}
while ($more === true);
// Set the total.
$total = count($items);
$total = min($total, $limit);
// Push the total into cache.
$this->store($store, $total);
// Return the total.
return $this->retrieve($store);
}
/**
* Method to get the results for the search query.
*
* @return array An array of result data objects.
*
* @since 2.5
* @throws Exception on database error.
*/
protected function getResultsData()
{
// Get the store id.
$store = $this->getStoreId('getResultsData', false);
// Use the cached data if possible.
if ($this->retrieve($store))
{
return $this->retrieve($store);
}
// Get the result ordering and direction.
$ordering = $this->getState('list.ordering',
'l.start_date');
$direction = $this->getState('list.direction',
'DESC');
// Get the base query and add the ordering information.
$base = $this->getListQuery();
$base->select($this->_db->escape($ordering) . ' AS
ordering');
$base->order($this->_db->escape($ordering) . ' ' .
$this->_db->escape($direction));
/*
* If there are no optional or required search terms in the query, we
* can get the results in one relatively simple database query.
*/
if (empty($this->includedTerms))
{
// Get the results from the database.
$this->_db->setQuery($base, (int)
$this->getState('list.start'), (int)
$this->getState('list.limit'));
$return = $this->_db->loadObjectList('link_id');
// Get a new store id because this data is page specific.
$store = $this->getStoreId('getResultsData', true);
// Push the results into cache.
$this->store($store, $return);
// Return the results.
return $this->retrieve($store);
}
/*
* If there are optional or required search terms in the query, the
* process of getting the results is more complicated.
*/
$start = 0;
$limit = (int) $this->getState('match.limit');
$items = array();
$sorted = array();
$maps = array();
$excluded = $this->getExcludedLinkIds();
/*
* Iterate through the included search terms and group them by mapping
* table suffix. This ensures that we never have to do more than 16
* queries to get a batch. This may seem like a lot but it is rarely
* anywhere near 16 because of the improved mapping algorithm.
*/
foreach ($this->includedTerms as $token => $ids)
{
// Get the mapping table suffix.
$suffix = StringHelper::substr(md5(StringHelper::substr($token, 0, 1)),
0, 1);
// Initialize the mapping group.
if (!array_key_exists($suffix, $maps))
{
$maps[$suffix] = array();
}
// Add the terms to the mapping group.
$maps[$suffix] = array_merge($maps[$suffix], $ids);
}
/*
* When the query contains search terms we need to find and process the
* results iteratively using a do-while loop.
*/
do
{
// Create a container for the fetched results.
$results = array();
$more = false;
/*
* Iterate through the mapping groups and load the results from each
* mapping table.
*/
foreach ($maps as $suffix => $ids)
{
// Create a storage key for this set.
$setId = $this->getStoreId('getResultsData:' .
serialize(array_values($ids)) . ':' . $start . ':' .
$limit);
// Use the cached data if possible.
if ($this->retrieve($setId))
{
$temp = $this->retrieve($setId);
}
// Load the data from the database.
else
{
// Adjust the query to join on the appropriate mapping table.
$query = clone $base;
$query->join('INNER',
$this->_db->quoteName('#__finder_links_terms' . $suffix) .
' AS m ON m.link_id = l.link_id')
->where('m.term_id IN (' . implode(',', $ids)
. ')');
// Load the results from the database.
$this->_db->setQuery($query, $start, $limit);
$temp = $this->_db->loadObjectList('link_id');
// Store this set in cache.
$this->store($setId, $temp);
// The data is keyed by link_id to ease caching, we don't need it
till later.
$temp = array_values($temp);
}
// Set the more flag to true if any of the sets equal the limit.
$more = count($temp) === $limit;
// Merge the results.
$results = array_merge($results, $temp);
}
// Check if there are any excluded terms to deal with.
if (count($excluded))
{
// Remove any results that match excluded terms.
for ($i = 0, $c = count($results); $i < $c; $i++)
{
if (in_array($results[$i]->link_id, $excluded))
{
unset($results[$i]);
}
}
// Reset the array keys.
$results = array_values($results);
}
/*
* If we are ordering by relevance we have to add up the relevance
* scores that are contained in the ordering field.
*/
if ($ordering === 'm.weight')
{
// Iterate through the set to extract the unique items.
for ($i = 0, $c = count($results); $i < $c; $i++)
{
// Add the total weights for all included search terms.
if (isset($sorted[$results[$i]->link_id]))
{
$sorted[$results[$i]->link_id] += (float)
$results[$i]->ordering;
}
else
{
$sorted[$results[$i]->link_id] = (float)
$results[$i]->ordering;
}
}
}
/*
* If we are ordering by start date we have to add convert the
* dates to unix timestamps.
*/
elseif ($ordering === 'l.start_date')
{
// Iterate through the set to extract the unique items.
for ($i = 0, $c = count($results); $i < $c; $i++)
{
if (!isset($sorted[$results[$i]->link_id]))
{
$sorted[$results[$i]->link_id] =
strtotime($results[$i]->ordering);
}
}
}
/*
* If we are not ordering by relevance or date, we just have to add
* the unique items to the set.
*/
else
{
// Iterate through the set to extract the unique items.
for ($i = 0, $c = count($results); $i < $c; $i++)
{
if (!isset($sorted[$results[$i]->link_id]))
{
$sorted[$results[$i]->link_id] = $results[$i]->ordering;
}
}
}
// Sort the results.
natcasesort($items);
if ($direction === 'DESC')
{
$items = array_reverse($items, true);
}
/*
* If the query contains just optional search terms and we have
* enough items for the page, we can stop here.
*/
if (empty($this->requiredTerms))
{
// If we need more items and they're available, make another pass.
if ($more && count($sorted) <
($this->getState('list.start') +
$this->getState('list.limit')))
{
// Increment the batch starting point and continue.
$start += $limit;
continue;
}
// Push the results into cache.
$this->store($store, $sorted);
// Return the requested set.
return array_slice($this->retrieve($store), (int)
$this->getState('list.start'), (int)
$this->getState('list.limit'), true);
}
/*
* The query contains required search terms so we have to iterate
* over the items and remove any items that do not match all of the
* required search terms. This is one of the most expensive steps
* because a required token could theoretically eliminate all of
* current terms which means we would have to loop through all of
* the possibilities.
*/
foreach ($this->requiredTerms as $token => $required)
{
// Create a storage key for this set.
$setId = $this->getStoreId('getResultsData:required:' .
serialize(array_values($required)) . ':' . $start . ':'
. $limit);
// Use the cached data if possible.
if ($this->retrieve($setId))
{
$reqTemp = $this->retrieve($setId);
}
// Check if the token was matched.
elseif (empty($required))
{
return null;
}
// Load the data from the database.
else
{
// Setup containers in case we have to make multiple passes.
$reqStart = 0;
$reqTemp = array();
do
{
// Get the map table suffix.
$suffix = StringHelper::substr(md5(StringHelper::substr($token, 0,
1)), 0, 1);
// Adjust the query to join on the appropriate mapping table.
$query = clone $base;
$query->join('INNER',
$this->_db->quoteName('#__finder_links_terms' . $suffix) .
' AS m ON m.link_id = l.link_id')
->where('m.term_id IN (' . implode(',',
$required) . ')');
// Load the results from the database.
$this->_db->setQuery($query, $reqStart, $limit);
$temp = $this->_db->loadObjectList('link_id');
// Set the required token more flag to true if the set equal the
limit.
$reqMore = count($temp) === $limit;
// Merge the matching set for this token.
$reqTemp += $temp;
// Increment the term offset.
$reqStart += $limit;
}
while ($reqMore === true);
// Store this set in cache.
$this->store($setId, $reqTemp);
}
// Remove any items that do not match the required term.
$sorted = array_intersect_key($sorted, $reqTemp);
}
// If we need more items and they're available, make another pass.
if ($more && count($sorted) <
($this->getState('list.start') +
$this->getState('list.limit')))
{
// Increment the batch starting point.
$start += $limit;
// Merge the found items.
$items = array_merge($items, $sorted);
continue;
}
// Otherwise, end the loop.
else
{
// Set the found items.
$items = $sorted;
$more = false;
}
// End do-while loop.
}
while ($more === true);
// Push the results into cache.
$this->store($store, $items);
// Return the requested set.
return array_slice($this->retrieve($store), (int)
$this->getState('list.start'), (int)
$this->getState('list.limit'), true);
}
/**
* Method to get an array of link ids that match excluded terms.
*
* @return array An array of links ids.
*
* @since 2.5
* @throws Exception on database error.
*/
protected function getExcludedLinkIds()
{
// Check if the search query has excluded terms.
if (empty($this->excludedTerms))
{
return array();
}
// Get the store id.
$store = $this->getStoreId('getExcludedLinkIds', false);
// Use the cached data if possible.
if ($this->retrieve($store))
{
return $this->retrieve($store);
}
// Initialize containers.
$links = array();
$maps = array();
/*
* Iterate through the excluded search terms and group them by mapping
* table suffix. This ensures that we never have to do more than 16
* queries to get a batch. This may seem like a lot but it is rarely
* anywhere near 16 because of the improved mapping algorithm.
*/
foreach ($this->excludedTerms as $token => $id)
{
// Get the mapping table suffix.
$suffix = StringHelper::substr(md5(StringHelper::substr($token, 0, 1)),
0, 1);
// Initialize the mapping group.
if (!array_key_exists($suffix, $maps))
{
$maps[$suffix] = array();
}
// Add the terms to the mapping group.
$maps[$suffix][] = (int) $id;
}
/*
* Iterate through the mapping groups and load the excluded links ids
* from each mapping table.
*/
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
foreach ($maps as $suffix => $ids)
{
// Create the query to get the links ids.
$query->clear()
->select('link_id')
->from($db->quoteName('#__finder_links_terms' .
$suffix))
->where($db->quoteName('term_id') . ' IN (' .
implode(',', $ids) . ')')
->group($db->quoteName('link_id'));
// Load the link ids from the database.
$db->setQuery($query);
$temp = $db->loadColumn();
// Merge the link ids.
$links = array_merge($links, $temp);
}
// Sanitize the link ids.
$links = array_unique($links);
$links = ArrayHelper::toInteger($links);
// Push the link ids into cache.
$this->store($store, $links);
return $links;
}
/**
* Method to get a store id based on model the 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 An identifier string to generate the store id.
[optional]
* @param boolean $page True to store the data paged, false to store
all data. [optional]
*
* @return string A store id.
*
* @since 2.5
*/
protected function getStoreId($id = '', $page = true)
{
// Get the query object.
$query = $this->getQuery();
// Add the search query state.
$id .= ':' . $query->input;
$id .= ':' . $query->language;
$id .= ':' . $query->filter;
$id .= ':' . serialize($query->filters);
$id .= ':' . $query->date1;
$id .= ':' . $query->date2;
$id .= ':' . $query->when1;
$id .= ':' . $query->when2;
if ($page)
{
// Add the list state for page specific data.
$id .= ':' . $this->getState('list.start');
$id .= ':' . $this->getState('list.limit');
$id .= ':' . $this->getState('list.ordering');
$id .= ':' . $this->getState('list.direction');
}
return parent::getStoreId($id);
}
/**
* Method to auto-populate the model state. Calling getState in this
method will result in recursion.
*
* @param string $ordering An optional ordering field. [optional]
* @param string $direction An optional direction. [optional]
*
* @return void
*
* @since 2.5
*/
protected function populateState($ordering = null, $direction = null)
{
// Get the configuration options.
$app = JFactory::getApplication();
$input = $app->input;
$params = $app->getParams();
$user = JFactory::getUser();
$this->setState('filter.language',
JLanguageMultilang::isEnabled());
// Setup the stemmer.
if ($params->get('stem', 1) &&
$params->get('stemmer', 'porter_en'))
{
FinderIndexerHelper::$stemmer =
FinderIndexerStemmer::getInstance($params->get('stemmer',
'porter_en'));
}
$request = $input->request;
$options = array();
// Get the empty query setting.
$options['empty'] =
$params->get('allow_empty_query', 0);
// Get the static taxonomy filters.
$options['filter'] = $request->getInt('f',
$params->get('f', ''));
// Get the dynamic taxonomy filters.
$options['filters'] = $request->get('t',
$params->get('t', array()), '', 'array');
// Get the query string.
$options['input'] = $request->getString('q',
$params->get('q', ''));
// Get the query language.
$options['language'] = $request->getCmd('l',
$params->get('l', ''));
// Get the start date and start date modifier filters.
$options['date1'] = $request->getString('d1',
$params->get('d1', ''));
$options['when1'] = $request->getString('w1',
$params->get('w1', ''));
// Get the end date and end date modifier filters.
$options['date2'] = $request->getString('d2',
$params->get('d2', ''));
$options['when2'] = $request->getString('w2',
$params->get('w2', ''));
// Load the query object.
$this->query = new FinderIndexerQuery($options);
// Load the query token data.
$this->excludedTerms = $this->query->getExcludedTermIds();
$this->includedTerms = $this->query->getIncludedTermIds();
$this->requiredTerms = $this->query->getRequiredTermIds();
// Load the list state.
$this->setState('list.start',
$input->get('limitstart', 0, 'uint'));
$this->setState('list.limit',
$input->get('limit', $app->get('list_limit', 20),
'uint'));
/**
* Load the sort ordering.
* Currently this is 'hard' coded via menu item parameter but
may not satisfy a users need.
* More flexibility was way more user friendly. So we allow the user to
pass a custom value
* from the pool of fields that are indexed like the 'title'
field.
* Also, we allow this parameter to be passed in either case
(lower/upper).
*/
$order = $input->getWord('filter_order',
$params->get('sort_order', 'relevance'));
$order = StringHelper::strtolower($order);
switch ($order)
{
case 'date':
$this->setState('list.ordering',
'l.start_date');
break;
case 'price':
$this->setState('list.ordering',
'l.list_price');
break;
case ($order === 'relevance' &&
!empty($this->includedTerms)) :
$this->setState('list.ordering', 'm.weight');
break;
// Custom field that is indexed and might be required for ordering
case 'title':
$this->setState('list.ordering', 'l.title');
break;
default:
$this->setState('list.ordering', 'l.link_id');
break;
}
/**
* Load the sort direction.
* Currently this is 'hard' coded via menu item parameter but
may not satisfy a users need.
* More flexibility was way more user friendly. So we allow to be
inverted.
* Also, we allow this parameter to be passed in either case
(lower/upper).
*/
$dirn = $input->getWord('filter_order_Dir',
$params->get('sort_direction', 'desc'));
$dirn = StringHelper::strtolower($dirn);
switch ($dirn)
{
case 'asc':
$this->setState('list.direction', 'ASC');
break;
default:
case 'desc':
$this->setState('list.direction', 'DESC');
break;
}
// Set the match limit.
$this->setState('match.limit', 1000);
// Load the parameters.
$this->setState('params', $params);
// Load the user state.
$this->setState('user.id', (int)
$user->get('id'));
$this->setState('user.groups',
$user->getAuthorisedViewLevels());
}
/**
* Method to retrieve data from cache.
*
* @param string $id The cache store id.
* @param boolean $persistent Flag to enable the use of external
cache. [optional]
*
* @return mixed The cached data if found, null otherwise.
*
* @since 2.5
*/
protected function retrieve($id, $persistent = true)
{
$data = null;
// Use the internal cache if possible.
if (isset($this->cache[$id]))
{
return $this->cache[$id];
}
// Use the external cache if data is persistent.
if ($persistent)
{
$data = JFactory::getCache($this->context,
'output')->get($id);
$data = $data ? unserialize($data) : null;
}
// Store the data in internal cache.
if ($data)
{
$this->cache[$id] = $data;
}
return $data;
}
/**
* Method to store data in cache.
*
* @param string $id The cache store id.
* @param mixed $data The data to cache.
* @param boolean $persistent Flag to enable the use of external
cache. [optional]
*
* @return boolean True on success, false on failure.
*
* @since 2.5
*/
protected function store($id, $data, $persistent = true)
{
// Store the data in internal cache.
$this->cache[$id] = $data;
// Store the data in external cache if data is persistent.
if ($persistent)
{
return JFactory::getCache($this->context,
'output')->store(serialize($data), $id);
}
return true;
}
}
PKqF�[
9P���!com_finder/models/suggestions.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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\String\StringHelper;
define('FINDER_PATH_INDEXER', JPATH_ADMINISTRATOR .
'/components/com_finder/helpers/indexer');
JLoader::register('FinderIndexerHelper', FINDER_PATH_INDEXER .
'/helper.php');
/**
* Suggestions model class for the Finder package.
*
* @since 2.5
*/
class FinderModelSuggestions extends JModelList
{
/**
* Context string for the model type.
*
* @var string
* @since 2.5
*/
protected $context = 'com_finder.suggestions';
/**
* Method to get an array of data items.
*
* @return array An array of data items.
*
* @since 2.5
*/
public function getItems()
{
// Get the items.
$items = parent::getItems();
// Convert them to a simple array.
foreach ($items as $k => $v)
{
$items[$k] = $v->term;
}
return $items;
}
/**
* Method to build a database query to load the list data.
*
* @return JDatabaseQuery A database query
*
* @since 2.5
*/
protected function getListQuery()
{
$user = JFactory::getUser();
$groups =
\Joomla\Utilities\ArrayHelper::toInteger($user->getAuthorisedViewLevels());
// Create a new query object.
$db = $this->getDbo();
$termIdQuery = $db->getQuery(true);
$termQuery = $db->getQuery(true);
// Limit term count to a reasonable number of results to reduce main
query join size
$termIdQuery->select('ti.term_id')
->from($db->quoteName('#__finder_terms',
'ti'))
->where('ti.term LIKE ' .
$db->quote($db->escape(StringHelper::strtolower($this->getState('input')),
true) . '%', false))
->where('ti.common = 0')
->where('ti.language IN (' .
$db->quote($this->getState('language')) . ', ' .
$db->quote('*') . ')')
->order('ti.links DESC')
->order('ti.weight DESC');
$termIds = $db->setQuery($termIdQuery, 0, 100)->loadColumn();
// Early return on term mismatch
if (!count($termIds))
{
return $termIdQuery;
}
$termIdString = implode(',', $termIds);
// Select required fields
$termQuery->select('DISTINCT(t.term)')
->select('t.links')
->select('t.weight')
->from($db->quoteName('#__finder_terms') . ' AS
t')
->where('t.term_id IN (' . $termIdString . ')')
->order('t.links DESC')
->order('t.weight DESC');
// Determine the relevant mapping table suffix by inverting the logic
from drivers
$mappingTableSuffix =
StringHelper::substr(md5(StringHelper::substr(StringHelper::strtolower($this->getState('input')),
0, 1)), 0, 1);
// Join mapping table for term <-> link relation
$mappingTable = $db->quoteName('#__finder_links_terms' .
$mappingTableSuffix);
$termQuery->join('INNER', $mappingTable . ' AS tm ON
tm.term_id = t.term_id');
// Join links table
$termQuery->join('INNER',
$db->quoteName('#__finder_links') . ' AS l ON (tm.link_id
= l.link_id)')
->where('l.access IN (' . implode(',', $groups) .
')')
->where('l.state = 1')
->where('l.published = 1');
return $termQuery;
}
/**
* Method to get a store id based on model the 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 An identifier string to generate the store id.
[optional]
*
* @return string A store id.
*
* @since 2.5
*/
protected function getStoreId($id = '')
{
// Add the search query state.
$id .= ':' . $this->getState('input');
$id .= ':' . $this->getState('language');
// Add the list state.
$id .= ':' . $this->getState('list.start');
$id .= ':' . $this->getState('list.limit');
return parent::getStoreId($id);
}
/**
* Method to auto-populate the model state. 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 = null, $direction = null)
{
// Get the configuration options.
$app = JFactory::getApplication();
$input = $app->input;
$params = JComponentHelper::getParams('com_finder');
$user = JFactory::getUser();
// Get the query input.
$this->setState('input',
$input->request->get('q', '',
'string'));
// Set the query language
if (JLanguageMultilang::isEnabled())
{
$lang = JFactory::getLanguage()->getTag();
}
else
{
$lang = FinderIndexerHelper::getDefaultLanguage();
}
$lang = FinderIndexerHelper::getPrimaryLanguage($lang);
$this->setState('language', $lang);
// Load the list state.
$this->setState('list.start', 0);
$this->setState('list.limit', 10);
// Load the parameters.
$this->setState('params', $params);
// Load the user state.
$this->setState('user.id', (int)
$user->get('id'));
}
}
PKqF�[�&hppcom_finder/router.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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;
/**
* Routing class from com_finder
*
* @since 3.3
*/
class FinderRouter extends JComponentRouterBase
{
/**
* Build the route for the com_finder component
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent
URL.
*
* @since 3.3
*/
public function build(&$query)
{
$segments = array();
/*
* First, handle menu item routes first. When the menu system builds a
* route, it only provides the option and the menu item id. We don't
have
* to do anything to these routes.
*/
if (count($query) === 2 && isset($query['Itemid'],
$query['option']))
{
return $segments;
}
/*
* Next, handle a route with a supplied menu item id. All system
generated
* routes should fall into this group. We can assume that the menu item
id
* is the best possible match for the query but we need to go through and
* see which variables we can eliminate from the route query string
because
* they are present in the menu item route already.
*/
if (!empty($query['Itemid']))
{
// Get the menu item.
$item = $this->menu->getItem($query['Itemid']);
// Check if the view matches.
if ($item && isset($item->query['view']) &&
isset($query['view']) &&
$item->query['view'] === $query['view'])
{
unset($query['view']);
}
// Check if the search query filter matches.
if ($item && isset($item->query['f']) &&
isset($query['f']) && $item->query['f'] ===
$query['f'])
{
unset($query['f']);
}
// Check if the search query string matches.
if ($item && isset($item->query['q']) &&
isset($query['q']) && $item->query['q'] ===
$query['q'])
{
unset($query['q']);
}
return $segments;
}
/*
* Lastly, handle a route with no menu item id. Fortunately, we only need
* to deal with the view as the other route variables are supposed to
stay
* in the query string.
*/
if (isset($query['view']))
{
// Add the view to the segments.
$segments[] = $query['view'];
unset($query['view']);
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-',
$segments[$i]);
}
return $segments;
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
$total = count($segments);
$vars = array();
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = preg_replace('/-/', ':',
$segments[$i], 1);
}
// Check if the view segment is set and it equals search or advanced.
if (isset($segments[0]) && ($segments[0] === 'search'
|| $segments[0] === 'advanced'))
{
$vars['view'] = $segments[0];
}
return $vars;
}
}
/**
* Finder router functions
*
* These functions are proxys for the new router interface
* for old SEF extensions.
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent URL.
*
* @deprecated 4.0 Use Class based routers instead
*/
function FinderBuildRoute(&$query)
{
$router = new FinderRouter;
return $router->build($query);
}
/**
* Finder router functions
*
* These functions are proxys for the new router interface
* for old SEF extensions.
*
* @param array $segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @deprecated 4.0 Use Class based routers instead
*/
function FinderParseRoute($segments)
{
$router = new FinderRouter;
return $router->parse($segments);
}
PKqF�[�7��(com_finder/views/search/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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::_('behavior.core');
JHtml::_('formbehavior.chosen');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('stylesheet', 'com_finder/finder.css',
array('version' => 'auto', 'relative'
=> true));
?>
<div class="finder<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<h1>
<?php if
($this->escape($this->params->get('page_heading'))) :
?>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
<?php else : ?>
<?php echo
$this->escape($this->params->get('page_title')); ?>
<?php endif; ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('show_search_form', 1)) :
?>
<div id="search-form">
<?php echo $this->loadTemplate('form'); ?>
</div>
<?php endif; ?>
<?php // Load the search results layout if we are performing a search.
?>
<?php if ($this->query->search === true) : ?>
<div id="search-results">
<?php echo $this->loadTemplate('results'); ?>
</div>
<?php endif; ?>
</div>
PKqF�[g)4�""(com_finder/views/search/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_FINDER_MENU_SEARCH_VIEW_DEFAULT_TITLE">
<help
key = "JHELP_MENUS_MENU_ITEM_FINDER_SEARCH"
/>
<message>
<![CDATA[COM_FINDER_MENU_SEARCH_VIEW_DEFAULT_TEXT]]>
</message>
</layout>
<fields name="request"
addfieldpath="/administrator/components/com_finder/models/fields">
<fieldset name="request">
<field
name="q"
type="text"
label="COM_FINDER_SEARCH_SEARCH_QUERY_LABEL"
description="COM_FINDER_SEARCH_SEARCH_QUERY_DESC"
size="30"
/>
<field
name="f"
type="searchfilter"
label="COM_FINDER_SEARCH_FILTER_SEARCH_LABEL"
description="COM_FINDER_SEARCH_FILTER_SEARCH_DESC"
default=""
/>
</fieldset>
</fields>
<fields name="params"
addfieldpath="/administrator/components/com_finder/models/fields">
<fieldset name="basic">
<field
name="show_date_filters"
type="list"
label="COM_FINDER_CONFIG_SHOW_DATE_FILTERS_LABEL"
description="COM_FINDER_CONFIG_SHOW_DATE_FILTERS_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_advanced"
type="list"
label="COM_FINDER_CONFIG_SHOW_ADVANCED_LABEL"
description="COM_FINDER_CONFIG_SHOW_ADVANCED_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="expand_advanced"
type="list"
label="COM_FINDER_CONFIG_EXPAND_ADVANCED_LABEL"
description="COM_FINDER_CONFIG_EXPAND_ADVANCED_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field type="spacer" />
<field
name="show_description"
type="list"
label="COM_FINDER_CONFIG_SHOW_DESCRIPTION_LABEL"
description="COM_FINDER_CONFIG_SHOW_DESCRIPTION_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="description_length"
type="number"
label="COM_FINDER_CONFIG_DESCRIPTION_LENGTH_LABEL"
description="COM_FINDER_CONFIG_DESCRIPTION_LENGTH_DESC"
default=""
size="5"
useglobal="true"
/>
<field
name="show_url"
type="list"
label="COM_FINDER_CONFIG_SHOW_URL_LABEL"
description="COM_FINDER_CONFIG_SHOW_URL_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field type="spacer" />
</fieldset>
<fieldset name="advanced">
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
validate="options"
class="chzn-color"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
validate="options"
class="chzn-color"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
validate="options"
class="chzn-color"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="allow_empty_query"
type="list"
label="COM_FINDER_ALLOW_EMPTY_QUERY_LABEL"
description="COM_FINDER_ALLOW_EMPTY_QUERY_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="show_suggested_query"
type="list"
label="COM_FINDER_CONFIG_SHOW_SUGGESTED_QUERY_LABEL"
description="COM_FINDER_CONFIG_SHOW_SUGGESTED_QUERY_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="show_explained_query"
type="list"
label="COM_FINDER_CONFIG_SHOW_EXPLAINED_QUERY_LABEL"
description="COM_FINDER_CONFIG_SHOW_EXPLAINED_QUERY_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="sort_order"
type="list"
label="COM_FINDER_CONFIG_SORT_ORDER_LABEL"
description="COM_FINDER_CONFIG_SORT_ORDER_DESC"
default=""
useglobal="true"
>
<option
value="relevance">COM_FINDER_CONFIG_SORT_OPTION_RELEVANCE</option>
<option
value="date">COM_FINDER_CONFIG_SORT_OPTION_START_DATE</option>
<option
value="price">COM_FINDER_CONFIG_SORT_OPTION_LIST_PRICE</option>
</field>
<field
name="sort_direction"
type="list"
label="COM_FINDER_CONFIG_SORT_DIRECTION_LABEL"
description="COM_FINDER_CONFIG_SORT_DIRECTION_DESC"
default=""
useglobal="true"
>
<option
value="desc">COM_FINDER_CONFIG_SORT_OPTION_DESCENDING</option>
<option
value="asc">COM_FINDER_CONFIG_SORT_OPTION_ASCENDING</option>
</field>
</fieldset>
<fieldset name="integration">
<field
name="show_feed_link"
type="list"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
validate="options"
class="chzn-color"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>
PKsF�[���
�
-com_finder/views/search/tmpl/default_form.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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;
if ($this->params->get('show_advanced', 1) ||
$this->params->get('show_autosuggest', 1))
{
JHtml::_('jquery.framework');
$script = "
jQuery(function() {";
if ($this->params->get('show_advanced', 1))
{
/*
* This segment of code disables select boxes that have no value when the
* form is submitted so that the URL doesn't get blown up with null
values.
*/
$script .= "
jQuery('#finder-search').on('submit', function(e){
e.stopPropagation();
// Disable select boxes with no value selected.
jQuery('#advancedSearch').find('select').each(function(index,
el) {
var el = jQuery(el);
if(!el.val()){
el.attr('disabled', 'disabled');
}
});
});";
}
/*
* This segment of code sets up the autocompleter.
*/
if ($this->params->get('show_autosuggest', 1))
{
JHtml::_('script', 'jui/jquery.autocomplete.min.js',
array('version' => 'auto', 'relative'
=> true));
$script .= "
var suggest = jQuery('#q').autocomplete({
serviceUrl: '" .
JRoute::_('index.php?option=com_finder&task=suggestions.suggest&format=json&tmpl=component')
. "',
paramName: 'q',
minChars: 1,
maxHeight: 400,
width: 300,
zIndex: 9999,
deferRequestBy: 500
});";
}
$script .= "
});";
JFactory::getDocument()->addScriptDeclaration($script);
}
?>
<form id="finder-search" action="<?php echo
JRoute::_($this->query->toUri()); ?>" method="get"
class="form-inline">
<?php echo $this->getFields(); ?>
<?php // DISABLED UNTIL WEIRD VALUES CAN BE TRACKED DOWN. ?>
<?php if (false &&
$this->state->get('list.ordering') !==
'relevance_dsc') : ?>
<input type="hidden" name="o" value="<?php
echo $this->escape($this->state->get('list.ordering'));
?>" />
<?php endif; ?>
<fieldset class="word">
<label for="q">
<?php echo JText::_('COM_FINDER_SEARCH_TERMS'); ?>
</label>
<input type="text" name="q" id="q"
size="30" value="<?php echo
$this->escape($this->query->input); ?>"
class="inputbox" />
<?php if ($this->escape($this->query->input) != ''
|| $this->params->get('allow_empty_query')) : ?>
<button name="Search" type="submit"
class="btn btn-primary">
<span class="icon-search icon-white"></span>
<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>
</button>
<?php else : ?>
<button name="Search" type="submit"
class="btn btn-primary disabled">
<span class="icon-search icon-white"></span>
<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>
</button>
<?php endif; ?>
<?php if ($this->params->get('show_advanced', 1)) :
?>
<a href="#advancedSearch" data-toggle="collapse"
class="btn">
<span class="icon-list"
aria-hidden="true"></span>
<?php echo JText::_('COM_FINDER_ADVANCED_SEARCH_TOGGLE');
?>
</a>
<?php endif; ?>
</fieldset>
<?php if ($this->params->get('show_advanced', 1)) :
?>
<div id="advancedSearch" class="collapse<?php if
($this->params->get('expand_advanced', 0)) echo '
in'; ?>">
<hr />
<?php if ($this->params->get('show_advanced_tips',
1)) : ?>
<div id="search-query-explained">
<div class="advanced-search-tip">
<?php echo JText::_('COM_FINDER_ADVANCED_TIPS'); ?>
</div>
<hr />
</div>
<?php endif; ?>
<div id="finder-filter-window">
<?php echo JHtml::_('filter.select', $this->query,
$this->params); ?>
</div>
</div>
<?php endif; ?>
</form>
PKsF�[1�bm� � /com_finder/views/search/tmpl/default_result.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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\String\StringHelper;
// Get the mime type class.
$mime = !empty($this->result->mime) ? 'mime-' .
$this->result->mime : null;
$show_description = $this->params->get('show_description',
1);
if ($show_description)
{
// Calculate number of characters to display around the result
$term_length = StringHelper::strlen($this->query->input);
$desc_length = $this->params->get('description_length',
255);
$pad_length = $term_length < $desc_length ? (int) floor(($desc_length
- $term_length) / 2) : 0;
// Make sure we highlight term both in introtext and fulltext
if (!empty($this->result->summary) &&
!empty($this->result->body))
{
$full_description =
FinderIndexerHelper::parse($this->result->summary .
$this->result->body);
}
else
{
$full_description = $this->result->description;
}
// Find the position of the search term
$pos = $term_length ?
StringHelper::strpos(StringHelper::strtolower($full_description),
StringHelper::strtolower($this->query->input)) : false;
// Find a potential start point
$start = ($pos && $pos > $pad_length) ? $pos - $pad_length : 0;
// Find a space between $start and $pos, start right after it.
$space = StringHelper::strpos($full_description, ' ', $start
> 0 ? $start - 1 : 0);
$start = ($space && $space < $pos) ? $space + 1 : $start;
$description = JHtml::_('string.truncate',
StringHelper::substr($full_description, $start), $desc_length, true);
}
$route = $this->result->route;
// Get the route with highlighting information.
if (!empty($this->query->highlight)
&& empty($this->result->mime)
&& $this->params->get('highlight_terms', 1)
&& JPluginHelper::isEnabled('system',
'highlight'))
{
$route .= '&highlight=' .
base64_encode(json_encode($this->query->highlight));
}
?>
<li>
<h4 class="result-title <?php echo $mime; ?>">
<a href="<?php echo JRoute::_($route); ?>">
<?php echo $this->result->title; ?>
</a>
</h4>
<?php if ($show_description && $description !== '') :
?>
<p class="result-text<?php echo $this->pageclass_sfx;
?>">
<?php echo $description; ?>
</p>
<?php endif; ?>
<?php if ($this->params->get('show_url', 1)) : ?>
<div class="small result-url<?php echo
$this->pageclass_sfx; ?>">
<?php echo $this->baseUrl, JRoute::_($this->result->route);
?>
</div>
<?php endif; ?>
</li>
PKsF�[�����0com_finder/views/search/tmpl/default_results.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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;
?>
<?php // Display the suggested search if it is different from the
current search. ?>
<?php if (($this->suggested &&
$this->params->get('show_suggested_query', 1)) ||
($this->explained &&
$this->params->get('show_explained_query', 1))) : ?>
<div id="search-query-explained">
<?php // Display the suggested search query. ?>
<?php if ($this->suggested &&
$this->params->get('show_suggested_query', 1)) : ?>
<?php // Replace the base query string with the suggested query
string. ?>
<?php $uri = JUri::getInstance($this->query->toUri()); ?>
<?php $uri->setVar('q', $this->suggested); ?>
<?php // Compile the suggested query link. ?>
<?php $linkUrl = JRoute::_($uri->toString(array('path',
'query'))); ?>
<?php $link = '<a href="' . $linkUrl .
'">' . $this->escape($this->suggested) .
'</a>'; ?>
<?php echo JText::sprintf('COM_FINDER_SEARCH_SIMILAR',
$link); ?>
<?php elseif ($this->explained &&
$this->params->get('show_explained_query', 1)) : ?>
<?php // Display the explained search query. ?>
<?php echo $this->explained; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php // Display the 'no results' message and exit the
template. ?>
<?php if (($this->total === 0) || ($this->total === null)) : ?>
<div id="search-result-empty">
<h2><?php echo
JText::_('COM_FINDER_SEARCH_NO_RESULTS_HEADING');
?></h2>
<?php $multilang = JFactory::getApplication()->getLanguageFilter()
? '_MULTILANG' : ''; ?>
<p><?php echo
JText::sprintf('COM_FINDER_SEARCH_NO_RESULTS_BODY' . $multilang,
$this->escape($this->query->input)); ?></p>
</div>
<?php // Exit this template. ?>
<?php return; ?>
<?php endif; ?>
<?php // Activate the highlighter if enabled. ?>
<?php if (!empty($this->query->highlight) &&
$this->params->get('highlight_terms', 1)) : ?>
<?php JHtml::_('behavior.highlighter',
$this->query->highlight); ?>
<?php endif; ?>
<?php // Display a list of results ?>
<br id="highlighter-start" />
<ul class="search-results<?php echo $this->pageclass_sfx;
?> list-striped">
<?php $this->baseUrl =
JUri::getInstance()->toString(array('scheme',
'host', 'port')); ?>
<?php foreach ($this->results as $result) : ?>
<?php $this->result = &$result; ?>
<?php $layout = $this->getLayoutFile($this->result->layout);
?>
<?php echo $this->loadTemplate($layout); ?>
<?php endforeach; ?>
</ul>
<br id="highlighter-end" />
<?php // Display the pagination ?>
<div class="search-pagination">
<div class="pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<div class="search-pages-counter">
<?php // Prepare the pagination string. Results X - Y of Z ?>
<?php $start = (int)
$this->pagination->get('limitstart') + 1; ?>
<?php $total = (int) $this->pagination->get('total');
?>
<?php $limit = (int) $this->pagination->get('limit') *
$this->pagination->get('pages.current'); ?>
<?php $limit = (int) ($limit > $total ? $total : $limit); ?>
<?php echo JText::sprintf('COM_FINDER_SEARCH_RESULTS_OF',
$start, $limit, $total); ?>
</div>
</div>
PKsF�[Vb��w
w
%com_finder/views/search/view.feed.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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;
/**
* Search feed view class for the Finder package.
*
* @since 2.5
*/
class FinderViewSearch extends JViewLegacy
{
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed JError object on failure, void on success.
*
* @since 2.5
*/
public function display($tpl = null)
{
// Get the application
$app = JFactory::getApplication();
// Adjust the list limit to the feed limit.
$app->input->set('limit',
$app->get('feed_limit'));
// Get view data.
$state = $this->get('State');
$params = $state->get('params');
$query = $this->get('Query');
$results = $this->get('Results');
// Push out the query data.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$explained = JHtml::_('query.explained', $query);
// Set the document title.
$title = $params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
// Configure the document description.
if (!empty($explained))
{
$this->document->setDescription(html_entity_decode(strip_tags($explained),
ENT_QUOTES, 'UTF-8'));
}
// Set the document link.
$this->document->link = JRoute::_($query->toUri());
// If we don't have any results, we are done.
if (empty($results))
{
return;
}
// Convert the results to feed entries.
foreach ($results as $result)
{
// Convert the result to a feed entry.
$item = new JFeedItem;
$item->title = $result->title;
$item->link = JRoute::_($result->route);
$item->description = $result->description;
// Use Unix date to cope for non-english languages
$item->date = (int) $result->start_date ?
JHtml::_('date', $result->start_date, 'U') :
$result->indexdate;
// Get the taxonomy data.
$taxonomy = $result->getTaxonomy();
// Add the category to the feed if available.
if (isset($taxonomy['Category']))
{
$node = array_pop($taxonomy['Category']);
$item->category = $node->title;
}
// Loads item info into RSS array
$this->document->addItem($item);
}
}
}
PKsF�[���66%com_finder/views/search/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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\CMS\Helper\SearchHelper;
/**
* Search HTML view class for the Finder package.
*
* @since 2.5
*/
class FinderViewSearch extends JViewLegacy
{
/**
* The query object
*
* @var FinderIndexerQuery
*/
protected $query;
/**
* The application parameters
*
* @var Registry The parameters object
*/
protected $params;
/**
* The model state
*
* @var object
*/
protected $state;
protected $user;
/**
* An array of results
*
* @var array
*
* @since 3.8.0
*/
protected $results;
/**
* The total number of items
*
* @var integer
*
* @since 3.8.0
*/
protected $total;
/**
* The pagination object
*
* @var JPagination
*
* @since 3.8.0
*/
protected $pagination;
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed JError object on failure, void on success.
*
* @since 2.5
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$params = $app->getParams();
// Get view data.
$state = $this->get('State');
$query = $this->get('Query');
JDEBUG ?
JProfiler::getInstance('Application')->mark('afterFinderQuery')
: null;
$results = $this->get('Results');
JDEBUG ?
JProfiler::getInstance('Application')->mark('afterFinderResults')
: null;
$total = $this->get('Total');
JDEBUG ?
JProfiler::getInstance('Application')->mark('afterFinderTotal')
: null;
$pagination = $this->get('Pagination');
JDEBUG ?
JProfiler::getInstance('Application')->mark('afterFinderPagination')
: null;
// Flag indicates to not add limitstart=0 to URL
$pagination->hideEmptyLimitstart = true;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Configure the pathway.
if (!empty($query->input))
{
$app->getPathway()->addItem($this->escape($query->input));
}
// Push out the view data.
$this->state = &$state;
$this->params = &$params;
$this->query = &$query;
$this->results = &$results;
$this->total = &$total;
$this->pagination = &$pagination;
// Check for a double quote in the query string.
if (strpos($this->query->input, '"'))
{
// Get the application router.
$router = &$app::getRouter();
// Fix the q variable in the URL.
if ($router->getVar('q') !== $this->query->input)
{
$router->setVar('q', $this->query->input);
}
}
// Log the search
SearchHelper::logSearch($this->query->input,
'com_finder');
// Push out the query data.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$this->suggested = JHtml::_('query.suggested', $query);
$this->explained = JHtml::_('query.explained', $query);
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($params->get('pageclass_sfx', ''));
// Check for layout override only if this is not the active menu item
// If it is the active menu item, then the view and category id will
match
$active = $app->getMenu()->getActive();
if (isset($active->query['layout']))
{
// We need to set the layout in case this is an alternative menu item
(with an alternative layout)
$this->setLayout($active->query['layout']);
}
$this->prepareDocument($query);
JDEBUG ?
JProfiler::getInstance('Application')->mark('beforeFinderLayout')
: null;
parent::display($tpl);
JDEBUG ?
JProfiler::getInstance('Application')->mark('afterFinderLayout')
: null;
}
/**
* Method to get hidden input fields for a get form so that control
variables
* are not lost upon form submission
*
* @return string A string of hidden input form fields
*
* @since 2.5
*/
protected function getFields()
{
$fields = null;
// Get the URI.
$uri = JUri::getInstance(JRoute::_($this->query->toUri()));
$uri->delVar('q');
$uri->delVar('o');
$uri->delVar('t');
$uri->delVar('d1');
$uri->delVar('d2');
$uri->delVar('w1');
$uri->delVar('w2');
$elements = $uri->getQuery(true);
// Create hidden input elements for each part of the URI.
foreach ($elements as $n => $v)
{
if (is_scalar($v))
{
$fields .= '<input type="hidden" name="' .
$n . '" value="' . $v . '" />';
}
}
return $fields;
}
/**
* Method to get the layout file for a search result object.
*
* @param string $layout The layout file to check. [optional]
*
* @return string The layout file to use.
*
* @since 2.5
*/
protected function getLayoutFile($layout = null)
{
// Create and sanitize the file name.
$file = $this->_layout . '_' .
preg_replace('/[^A-Z0-9_\.-]/i', '', $layout);
// Check if the file exists.
jimport('joomla.filesystem.path');
$filetofind = $this->_createFileName('template',
array('name' => $file));
$exists = JPath::find($this->_path['template'],
$filetofind);
return ($exists ? $layout : 'result');
}
/**
* Prepares the document
*
* @param FinderIndexerQuery $query The search query
*
* @return void
*
* @since 2.5
*/
protected function prepareDocument($query)
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_FINDER_DEFAULT_PAGE_TITLE'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($layout = $this->params->get('article_layout'))
{
$this->setLayout($layout);
}
// Configure the document meta-description.
if (!empty($this->explained))
{
$explained =
$this->escape(html_entity_decode(strip_tags($this->explained),
ENT_QUOTES, 'UTF-8'));
$this->document->setDescription($explained);
}
elseif ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
// Configure the document meta-keywords.
if (!empty($query->highlight))
{
$this->document->setMetaData('keywords', implode(',
', $query->highlight));
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
// Add feed link to the document head.
if ($this->params->get('show_feed_link', 1) == 1)
{
// Add the RSS link.
$props = array('type' => 'application/rss+xml',
'title' => 'RSS 2.0');
$route = JRoute::_($this->query->toUri() .
'&format=feed&type=rss');
$this->document->addHeadLink($route, 'alternate',
'rel', $props);
// Add the ATOM link.
$props = array('type' => 'application/atom+xml',
'title' => 'Atom 1.0');
$route = JRoute::_($this->query->toUri() .
'&format=feed&type=atom');
$this->document->addHeadLink($route, 'alternate',
'rel', $props);
}
}
}
PKsF�[<-(MM+com_finder/views/search/view.opensearch.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @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;
/**
* OpenSearch View class for Finder
*
* @since 2.5
*/
class FinderViewSearch extends JViewLegacy
{
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed JError object on failure, void on success.
*
* @since 2.5
*/
public function display($tpl = null)
{
$doc = JFactory::getDocument();
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_finder');
$doc->setShortName($params->get('opensearch_name',
$app->get('sitename')));
$doc->setDescription($params->get('opensearch_description',
$app->get('MetaDesc')));
// Add the URL for the search
$searchUri = JUri::base() .
'index.php?option=com_finder&q={searchTerms}';
// Find the menu item for the search
$menu = $app->getMenu();
$items = $menu->getItems('link',
'index.php?option=com_finder&view=search');
if (isset($items[0]))
{
$searchUri .= '&Itemid=' . $items[0]->id;
}
$htmlSearch = new JOpenSearchUrl;
$htmlSearch->template = JRoute::_($searchUri);
$doc->addUrl($htmlSearch);
}
}
PKsF�[ �
com_mailto/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_mailto
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Mailer Component Controller.
*
* @since 1.5
*/
class MailtoController extends JControllerLegacy
{
/**
* Show the form so that the user can send the link to someone.
*
* @return void
*
* @since 1.5
*/
public function mailto()
{
$this->input->set('view', 'mailto');
$this->display();
}
/**
* Send the message and display a notice
*
* @return void
*
* @since 1.5
*/
public function send()
{
// Check for request forgeries
$this->checkToken();
$app = JFactory::getApplication();
$model = $this->getModel('mailto');
$data = $model->getData();
// Validate the posted data.
$form = $model->getForm();
if (!$form)
{
JError::raiseError(500, $model->getError());
return false;
}
if (!$model->validate($form, $data))
{
$errors = $model->getErrors();
foreach ($errors as $error)
{
$errorMessage = $error;
if ($error instanceof Exception)
{
$errorMessage = $error->getMessage();
}
$app->enqueueMessage($errorMessage, 'error');
}
return $this->mailto();
}
// An array of email headers we do not want to allow as input
$headers = array (
'Content-Type:',
'MIME-Version:',
'Content-Transfer-Encoding:',
'bcc:',
'cc:'
);
/*
* Here is the meat and potatoes of the header injection test. We
* iterate over the array of form input and check for header strings.
* If we find one, send an unauthorized header and die.
*/
foreach ($data as $key => $value)
{
foreach ($headers as $header)
{
if (is_string($value) && strpos($value, $header) !== false)
{
JError::raiseError(403, '');
}
}
}
/*
* Free up memory
*/
unset($headers, $fields);
$siteName = $app->get('sitename');
$link =
MailtoHelper::validateHash($this->input->post->get('link',
'', 'post'));
// Verify that this is a local link
if (!$link || !JUri::isInternal($link))
{
// Non-local url...
JError::raiseNotice(500,
JText::_('COM_MAILTO_EMAIL_NOT_SENT'));
return $this->mailto();
}
$subject_default = JText::sprintf('COM_MAILTO_SENT_BY',
$data['sender']);
$subject = $data['subject'] !== '' ?
$data['subject'] : $subject_default;
// Check for a valid to address
$error = false;
if (!$data['emailto'] ||
!JMailHelper::isEmailAddress($data['emailto']))
{
$error = JText::sprintf('COM_MAILTO_EMAIL_INVALID',
$data['emailto']);
JError::raiseWarning(0, $error);
}
// Check for a valid from address
if (!$data['emailfrom'] ||
!JMailHelper::isEmailAddress($data['emailfrom']))
{
$error = JText::sprintf('COM_MAILTO_EMAIL_INVALID',
$data['emailfrom']);
JError::raiseWarning(0, $error);
}
if ($error)
{
return $this->mailto();
}
// Build the message to send
$msg = JText::_('COM_MAILTO_EMAIL_MSG');
$body = sprintf($msg, $siteName, $data['sender'],
$data['emailfrom'], $link);
// Clean the email data
$subject = JMailHelper::cleanSubject($subject);
$body = JMailHelper::cleanBody($body);
// To send we need to use punycode.
$data['emailfrom'] =
JStringPunycode::emailToPunycode($data['emailfrom']);
$data['emailfrom'] =
JMailHelper::cleanAddress($data['emailfrom']);
$data['emailto'] =
JStringPunycode::emailToPunycode($data['emailto']);
// Send the email
if (JFactory::getMailer()->sendMail($data['emailfrom'],
$data['sender'], $data['emailto'], $subject, $body) !==
true)
{
JError::raiseNotice(500,
JText::_('COM_MAILTO_EMAIL_NOT_SENT'));
return $this->mailto();
}
$this->input->set('view', 'sent');
$this->display();
}
}
PKtF�[8�'��com_mailto/helpers/mailto.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_mailto
*
* @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;
/**
* Mailto route helper class.
*
* @package Joomla.Site
* @subpackage com_mailto
* @since 1.6.1
*/
abstract class MailtoHelper
{
/**
* Adds a URL to the mailto system and returns the hash
*
* @param string $url Url
*
* @return string URL hash
*/
public static function addLink($url)
{
$hash = sha1($url);
self::cleanHashes();
$session = JFactory::getSession();
$mailto_links = $session->get('com_mailto.links', array());
if (!isset($mailto_links[$hash]))
{
$mailto_links[$hash] = new stdClass;
}
$mailto_links[$hash]->link = $url;
$mailto_links[$hash]->expiry = time();
$session->set('com_mailto.links', $mailto_links);
return $hash;
}
/**
* Checks if a URL is a Flash file
*
* @param string $hash File hash
*
* @return URL
*/
public static function validateHash($hash)
{
$retval = false;
$session = JFactory::getSession();
self::cleanHashes();
$mailto_links = $session->get('com_mailto.links', array());
if (isset($mailto_links[$hash]))
{
$retval = $mailto_links[$hash]->link;
}
return $retval;
}
/**
* Cleans out old hashes
*
* @param integer $lifetime How old are the hashes we want to remove
*
* @return void
*
* @since 1.6.1
*/
public static function cleanHashes($lifetime = 1440)
{
// Flag for if we've cleaned on this cycle
static $cleaned = false;
if (!$cleaned)
{
$past = time() - $lifetime;
$session = JFactory::getSession();
$mailto_links = $session->get('com_mailto.links', array());
foreach ($mailto_links as $index => $link)
{
if ($link->expiry < $past)
{
unset($mailto_links[$index]);
}
}
$session->set('com_mailto.links', $mailto_links);
$cleaned = true;
}
}
}
PKtF�[�^��com_mailto/mailto.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_mailto
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('MailtoHelper', JPATH_COMPONENT .
'/helpers/mailto.php');
$controller = JControllerLegacy::getInstance('Mailto');
$controller->registerDefaultTask('mailto');
$controller->execute(JFactory::getApplication()->input->get('task'));
PKuF�[7/����com_mailto/mailto.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1"
method="upgrade">
<name>com_mailto</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_MAILTO_XML_DESCRIPTION</description>
<files folder="site">
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>mailto.php</filename>
<folder>views</folder>
</files>
<languages folder="site">
<language
tag="en-GB">language/en-GB.com_mailto.ini</language>
</languages>
<administration>
<files folder="admin">
<filename>index.html</filename>
</files>
<languages folder="admin">
<language
tag="en-GB">language/en-GB.com_mailto.sys.ini</language>
</languages>
</administration>
</extension>
PKuF�[�"�ZZ"com_mailto/models/forms/mailto.xmlnu�[���<?xml
version="1.0" encoding="utf-8" ?>
<form>
<fieldset name="default">
<field
name="emailto"
type="email"
label="COM_MAILTO_EMAIL_TO"
filter="string"
required="true"
size="30"
validate="email"
autocomplete="email"
/>
<field
name="sender"
type="text"
label="COM_MAILTO_SENDER"
filter="string"
required="true"
size="30"
/>
<field
name="emailfrom"
type="email"
label="COM_MAILTO_YOUR_EMAIL"
filter="string"
required="true"
size="30"
validate="email"
autocomplete="email"
/>
<field
name="subject"
type="text"
label="COM_MAILTO_SUBJECT"
filter="string"
required="true"
size="30"
/>
<field
name="captcha"
type="captcha"
label="COM_MAILTO_CAPTCHA"
validate="captcha"
/>
</fieldset>
</form>
PKuF�[��f�
�
com_mailto/models/mailto.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
/**
* Mailto model class.
*
* @since 3.8.9
*/
class MailtoModelMailto extends JModelForm
{
/**
* Method to get the mailto form.
*
* The base form is loaded from XML and then an event is fired
* for users plugins to extend the form with extra fields.
*
* @param array $data An optional array of data for the form to
interrogate.
* @param boolean $loadData True if the form is to load its own data
(default case), false if not.
*
* @return JForm A JForm object on success, false on failure
*
* @since 3.8.9
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_mailto.mailto',
'mailto', array('load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return array The default data is an empty array.
*
* @since 3.8.9
*/
protected function loadFormData()
{
$user = JFactory::getUser();
$app = JFactory::getApplication();
$data = $app->getUserState('mailto.mailto.form.data',
array());
$data['link'] =
urldecode($app->input->get('link', '',
'BASE64'));
if ($data['link'] == '')
{
JError::raiseError(403,
JText::_('COM_MAILTO_LINK_IS_MISSING'));
return false;
}
// Load with previous data, if it exists
$data['sender'] =
$app->input->post->getString('sender', '');
$data['subject'] =
$app->input->post->getString('subject', '');
$data['emailfrom'] =
JStringPunycode::emailToPunycode($app->input->post->getString('emailfrom',
''));
$data['emailto'] =
JStringPunycode::emailToPunycode($app->input->post->getString('emailto',
''));
if (!$user->guest)
{
$data['sender'] = $user->name;
$data['emailfrom'] = $user->email;
}
$app->setUserState('mailto.mailto.form.data', $data);
$this->preprocessData('com_mailto.mailto', $data);
return $data;
}
/**
* Get the request data
*
* @return array The requested data
*
* @since 3.8.9
*/
public function getData()
{
$input = JFactory::getApplication()->input;
$data['emailto'] = $input->get('emailto',
'', 'string');
$data['sender'] = $input->get('sender',
'', 'string');
$data['emailfrom'] = $input->get('emailfrom',
'', 'string');
$data['subject'] = $input->get('subject',
'', 'string');
$data['consentbox'] = $input->get('consentbox',
'', 'string');
return $data;
}
}
PKuF�[�n(3��(com_mailto/views/mailto/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_mailto
*
* @copyright (C) 2006 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.core');
JHtml::_('behavior.keepalive');
?>
<div id="mailto-window">
<h2>
<?php echo JText::_('COM_MAILTO_EMAIL_TO_A_FRIEND'); ?>
</h2>
<div class="mailto-close">
<a href="javascript: void window.close()"
title="<?php echo JText::_('COM_MAILTO_CLOSE_WINDOW');
?>">
<span>
<?php echo JText::_('COM_MAILTO_CLOSE_WINDOW'); ?>
</span>
</a>
</div>
<form action="<?php echo
JRoute::_('index.php?option=com_mailto&task=send');
?>" method="post" class="form-validate
form-horizontal well">
<fieldset>
<?php foreach ($this->form->getFieldset('') as
$field) : ?>
<?php if (!$field->hidden) : ?>
<?php echo $field->renderField(); ?>
<?php endif; ?>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary
validate">
<?php echo JText::_('COM_MAILTO_SEND'); ?>
</button>
<button type="button" class="button"
onclick="window.close();return false;">
<?php echo JText::_('COM_MAILTO_CANCEL'); ?>
</button>
</div>
</div>
</fieldset>
<input type="hidden" name="layout"
value="<?php echo htmlspecialchars($this->getLayout(),
ENT_COMPAT, 'UTF-8'); ?>" />
<input type="hidden" name="option"
value="com_mailto" />
<input type="hidden" name="task"
value="send" />
<input type="hidden" name="tmpl"
value="component" />
<input type="hidden" name="link"
value="<?php echo $this->link; ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
PKuF�[B��44%com_mailto/views/mailto/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_mailto
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Class for Mail.
*
* @since 1.5
*/
class MailtoViewMailto extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.5
*/
public function display($tpl = null)
{
$this->form = $this->get('Form');
$this->link =
urldecode(JFactory::getApplication()->input->get('link',
'', 'BASE64'));
return parent::display($tpl);
}
}
PKuF�[S�f�AA&com_mailto/views/sent/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_mailto
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<div style="padding: 10px;">
<div style="text-align:right">
<a href="javascript: void window.close()">
<?php echo JText::_('COM_MAILTO_CLOSE_WINDOW'); ?>
<?php echo JHtml::_('image', 'mailto/close-x.png',
null, null, true); ?>
</a>
</div>
<h2>
<?php echo JText::_('COM_MAILTO_EMAIL_SENT'); ?>
</h2>
</div>
PKwF�[�!dd#com_mailto/views/sent/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_mailto
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Class for email sent view.
*
* @since 1.5
*/
class MailtoViewSent extends JViewLegacy
{
}
PKwF�[��Qeppcom_media/media.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_media
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Load the com_media language files, default to the admin file and fall
back to site if one isn't found
$lang = JFactory::getLanguage();
$lang->load('com_media', JPATH_ADMINISTRATOR, null, false,
true)
|| $lang->load('com_media', JPATH_SITE, null, false, true);
// Hand processing over to the admin base file
require_once JPATH_COMPONENT_ADMINISTRATOR . '/media.php';
PKwF�[�k�TTcom_menus/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_menus
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Menus manager master display controller.
*
* @since 3.7.0
*/
class MenusController extends JControllerLegacy
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
* Recognized key values include
'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant
to be comprehensive).
*
* @since 3.7.0
*/
public function __construct($config = array())
{
$this->input = JFactory::getApplication()->input;
// Menus frontpage Editor Menu proxying:
if ($this->input->get('view') === 'items'
&& $this->input->get('layout') ===
'modal')
{
JHtml::_('stylesheet', 'system/adminlist.css',
array(), true);
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}
parent::__construct($config);
}
}
PKwF�[��--com_menus/menus.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_menus
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Load the required admin language files
$lang = JFactory::getLanguage();
$app = JFactory::getApplication();
if ($app->input->get('view') === 'items'
&& $app->input->get('layout') ===
'modal')
{
if (!JFactory::getUser()->authorise('core.create',
'com_menus'))
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'warning');
return;
}
}
$lang->load('com_menus', JPATH_ADMINISTRATOR);
// Trigger the controller
$controller = JControllerLegacy::getInstance('Menus');
$controller->execute($app->input->get('task'));
$controller->redirect();
PKyF�[9S��oo'com_menus/models/forms/filter_items.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset
addfieldpath="/administrator/components/com_menus/models/fields"
/>
<field
name="menutype"
type="menu"
label="COM_MENUS_SELECT_MENU_FILTER"
accesstype="manage"
clientid=""
showAll="false"
filtermode="selector"
onchange="this.form.submit();"
>
<option value="">COM_MENUS_SELECT_MENU</option>
</field>
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_MENUS_ITEMS_SEARCH_FILTER_LABEL"
description="COM_MENUS_ITEMS_SEARCH_FILTER"
hint="JSEARCH_FILTER"
/>
<field
name="published"
type="status"
label="COM_MENUS_FILTER_PUBLISHED"
description="COM_MENUS_FILTER_PUBLISHED_DESC"
filter="*,0,1,-2"
onchange="this.form.submit();"
>
<option
value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
name="access"
type="accesslevel"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_ACCESS</option>
</field>
<field
name="language"
type="contentlanguage"
label="JOPTION_FILTER_LANGUAGE"
description="JOPTION_FILTER_LANGUAGE_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
<field
name="level"
type="integer"
label="JOPTION_FILTER_LEVEL"
description="JOPTION_FILTER_LEVEL_DESC"
first="1"
last="10"
step="1"
languages="*"
onchange="this.form.submit();"
>
<option
value="">JOPTION_SELECT_MAX_LEVELS</option>
</field>
<field
name="parent_id"
type="MenuItemByType"
label="COM_MENUS_FILTER_PARENT_MENU_ITEM_LABEL"
onchange="this.form.submit();"
>
<option
value="">COM_MENUS_FILTER_SELECT_PARENT_MENU_ITEM</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
description="JGLOBAL_SORT_BY"
statuses="*,0,1,2,-2"
onchange="this.form.submit();"
default="a.lft ASC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.lft
ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.lft
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="menutype_title
ASC">COM_MENUS_HEADING_MENU_ASC</option>
<option value="menutype_title
DESC">COM_MENUS_HEADING_MENU_DESC</option>
<option value="a.home
ASC">COM_MENUS_HEADING_HOME_ASC</option>
<option value="a.home
DESC">COM_MENUS_HEADING_HOME_DESC</option>
<option value="a.access
ASC">JGRID_HEADING_ACCESS_ASC</option>
<option value="a.access
DESC">JGRID_HEADING_ACCESS_DESC</option>
<option value="association ASC"
requires="associations">JASSOCIATIONS_ASC</option>
<option value="association DESC"
requires="associations">JASSOCIATIONS_DESC</option>
<option value="language
ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="language
DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="a.id
ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id
DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_MENUS_LIST_LIMIT"
description="COM_MENUS_LIST_LIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>
PKyF�[�W}}com_modules/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_modules
*
* @copyright (C) 2015 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Modules manager master display controller.
*
* @since 3.5
*/
class ModulesController extends JControllerLegacy
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
* Recognized key values include
'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant
to be comprehensive).
*
* @since 3.5
*/
public function __construct($config = array())
{
$this->input = JFactory::getApplication()->input;
// Modules frontpage Editor Module proxying:
if ($this->input->get('view') === 'modules'
&& $this->input->get('layout') ===
'modal')
{
JHtml::_('stylesheet', 'system/adminlist.css',
array('version' => 'auto', 'relative'
=> true));
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}
parent::__construct($config);
}
}
PKzF�[̲���
�
+com_modules/models/forms/filter_modules.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset
addfieldpath="/administrator/components/com_modules/models/fields"
/>
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_MODULES_MODULES_FILTER_SEARCH_LABEL"
description="COM_MODULES_MODULES_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
noresults="COM_MODULES_MSG_MANAGE_NO_MODULES"
/>
<field
name="position"
type="modulesposition"
label="COM_MODULES_FIELD_POSITION_LABEL"
onchange="this.form.submit();"
>
<option
value="">COM_MODULES_OPTION_SELECT_POSITION</option>
</field>
<field
name="module"
type="ModulesModule"
label="COM_MODULES_OPTION_SELECT_MODULE"
onchange="this.form.submit();"
>
<option
value="">COM_MODULES_OPTION_SELECT_MODULE</option>
</field>
<field
name="access"
type="accesslevel"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
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"
statuses="*,0,1,-2"
onchange="this.form.submit();"
default="a.position 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.position
ASC">COM_MODULES_HEADING_POSITION_ASC</option>
<option value="a.position
DESC">COM_MODULES_HEADING_POSITION_DESC</option>
<option value="name
ASC">COM_MODULES_HEADING_MODULE_ASC</option>
<option value="name
DESC">COM_MODULES_HEADING_MODULE_DESC</option>
<option value="pages
ASC">COM_MODULES_HEADING_PAGES_ASC</option>
<option value="pages
DESC">COM_MODULES_HEADING_PAGES_DESC</option>
<option value="ag.title
ASC">JGRID_HEADING_ACCESS_ASC</option>
<option value="ag.title
DESC">JGRID_HEADING_ACCESS_DESC</option>
<option value="l.title
ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="l.title
DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="a.id
ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id
DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_MODULES_LIST_LIMIT"
description="JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>
PKzF�[my���com_modules/modules.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_modules
*
* @copyright (C) 2015 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Load the required admin language files
$lang = JFactory::getLanguage();
$app = JFactory::getApplication();
$config = array();
$lang->load('com_modules', JPATH_ADMINISTRATOR);
if ($app->input->get('view') === 'modules'
&& $app->input->get('layout') ===
'modal')
{
if (!JFactory::getUser()->authorise('core.create',
'com_modules'))
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'warning');
return;
}
}
if ($app->input->get('task') ===
'module.orderPosition')
{
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}
// Trigger the controller
$controller = JControllerLegacy::getInstance('Modules', $config);
$controller->execute($app->input->get('task'));
$controller->redirect();
PK{F�[�0*!99com_newsfeeds/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Newsfeeds Component Controller
*
* @since 1.5
*/
class NewsfeedsController extends JControllerLegacy
{
/**
* Method to show a newsfeeds view
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their
variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JControllerLegacy This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
$cachable = true;
// Set the default view name and format from the Request.
$vName = $this->input->get('view',
'categories');
$this->input->set('view', $vName);
$user = JFactory::getUser();
if ($user->get('id') || ($this->input->getMethod() ===
'POST' && $vName === 'category'))
{
$cachable = false;
}
$safeurlparams = array('id' => 'INT',
'limit' => 'UINT', 'limitstart' =>
'UINT',
'filter_order' => 'CMD',
'filter_order_Dir' => 'CMD', 'lang' =>
'CMD');
parent::display($cachable, $safeurlparams);
}
}
PK{F�[@�9��%com_newsfeeds/helpers/association.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('NewsfeedsHelper', JPATH_ADMINISTRATOR .
'/components/com_newsfeeds/helpers/newsfeeds.php');
JLoader::register('NewsfeedsHelperRoute', JPATH_SITE .
'/components/com_newsfeeds/helpers/route.php');
JLoader::register('CategoryHelperAssociation',
JPATH_ADMINISTRATOR .
'/components/com_categories/helpers/association.php');
/**
* Newsfeeds Component Association Helper
*
* @since 3.0
*/
abstract class NewsfeedsHelperAssociation extends CategoryHelperAssociation
{
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null)
{
$jinput = JFactory::getApplication()->input;
$view = $view === null ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view === 'newsfeed')
{
if ($id)
{
$associations =
JLanguageAssociations::getAssociations('com_newsfeeds',
'#__newsfeeds', 'com_newsfeeds.item', $id);
$return = array();
foreach ($associations as $tag => $item)
{
$return[$tag] = NewsfeedsHelperRoute::getNewsfeedRoute($item->id,
(int) $item->catid, $item->language);
}
return $return;
}
}
if ($view === 'category' || $view === 'categories')
{
return self::getCategoryAssociations($id, 'com_newsfeeds');
}
return array();
}
}
PK{F�[)x���"com_newsfeeds/helpers/category.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @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;
/**
* Content Component Category Tree
*
* @since 1.6
*/
class NewsfeedsCategories extends JCategories
{
/**
* Constructor
*
* @param array $options options
*/
public function __construct($options = array())
{
$options['table'] = '#__newsfeeds';
$options['extension'] = 'com_newsfeeds';
$options['statefield'] = 'published';
parent::__construct($options);
}
}
PK{F�[�xӈ��&com_newsfeeds/helpers/legacyrouter.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Legacy routing rules class from com_newsfeeds
*
* @since 3.6
* @deprecated 4.0
*/
class NewsfeedsRouterRulesLegacy implements JComponentRouterRulesInterface
{
/**
* Constructor for this legacy router
*
* @param JComponentRouterAdvanced $router The router this rule
belongs to
*
* @since 3.6
* @deprecated 4.0
*/
public function __construct($router)
{
$this->router = $router;
}
/**
* Preprocess the route for the com_newsfeeds component
*
* @param array &$query An array of URL arguments
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function preprocess(&$query)
{
}
/**
* Build the route for the com_newsfeeds component
*
* @param array &$query An array of URL arguments
* @param array &$segments The URL arguments to use to assemble
the subsequent URL.
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function build(&$query, &$segments)
{
// Get a menu item based on Itemid or currently active
$params = JComponentHelper::getParams('com_newsfeeds');
$advanced = $params->get('sef_advanced_link', 0);
if (empty($query['Itemid']))
{
$menuItem = $this->router->menu->getActive();
}
else
{
$menuItem =
$this->router->menu->getItem($query['Itemid']);
}
$mView = empty($menuItem->query['view']) ? null :
$menuItem->query['view'];
$mId = empty($menuItem->query['id']) ? null :
$menuItem->query['id'];
if (isset($query['view']))
{
$view = $query['view'];
if (empty($menuItem) || $menuItem->component !==
'com_newsfeeds' || empty($query['Itemid']))
{
$segments[] = $query['view'];
}
unset($query['view']);
}
// Are we dealing with a newsfeed that is attached to a menu item?
if (isset($query['view'], $query['id']) &&
$mView == $query['view'] && $mId == (int)
$query['id'])
{
unset($query['view'], $query['catid'],
$query['id']);
return;
}
if (isset($view) && ($view === 'category' || $view ===
'newsfeed'))
{
if ($mId != (int) $query['id'] || $mView != $view)
{
if ($view === 'newsfeed' &&
isset($query['catid']))
{
$catid = $query['catid'];
}
elseif (isset($query['id']))
{
$catid = $query['id'];
}
$menuCatid = $mId;
$categories = JCategories::getInstance('Newsfeeds');
$category = $categories->get($catid);
if ($category)
{
$path = $category->getPath();
$path = array_reverse($path);
$array = array();
foreach ($path as $id)
{
if ((int) $id === (int) $menuCatid)
{
break;
}
if ($advanced)
{
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
}
$segments = array_merge($segments, array_reverse($array));
}
if ($view === 'newsfeed')
{
if ($advanced)
{
list($tmp, $id) = explode(':', $query['id'], 2);
}
else
{
$id = $query['id'];
}
$segments[] = $id;
}
}
unset($query['id'], $query['catid']);
}
if (isset($query['layout']))
{
if (!empty($query['Itemid']) &&
isset($menuItem->query['layout']))
{
if ($query['layout'] ==
$menuItem->query['layout'])
{
unset($query['layout']);
}
}
else
{
if ($query['layout'] === 'default')
{
unset($query['layout']);
}
}
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-',
$segments[$i]);
}
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
* @param array &$vars The URL attributes to be used by the
application.
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function parse(&$segments, &$vars)
{
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = preg_replace('/-/', ':',
$segments[$i], 1);
}
// Get the active menu item.
$item = $this->router->menu->getActive();
$params = JComponentHelper::getParams('com_newsfeeds');
$advanced = $params->get('sef_advanced_link', 0);
// Count route segments
$count = count($segments);
// Standard routing for newsfeeds.
if (!isset($item))
{
$vars['view'] = $segments[0];
$vars['id'] = $segments[$count - 1];
return;
}
// From the categories view, we can only jump to a category.
$id = (isset($item->query['id']) &&
$item->query['id'] > 1) ? $item->query['id'] :
'root';
$categories =
JCategories::getInstance('Newsfeeds')->get($id)->getChildren();
$vars['catid'] = $id;
$vars['id'] = $id;
$found = 0;
foreach ($segments as $segment)
{
$segment = $advanced ? str_replace(':', '-',
$segment) : $segment;
foreach ($categories as $category)
{
if ($category->slug == $segment || $category->alias == $segment)
{
$vars['id'] = $category->id;
$vars['catid'] = $category->id;
$vars['view'] = 'category';
$categories = $category->getChildren();
$found = 1;
break;
}
}
if ($found == 0)
{
if ($advanced)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from('#__newsfeeds')
->where($db->quoteName('catid') . ' = ' .
(int) $vars['catid'])
->where($db->quoteName('alias') . ' = ' .
$db->quote($segment));
$db->setQuery($query);
$nid = $db->loadResult();
}
else
{
$nid = $segment;
}
$vars['id'] = $nid;
$vars['view'] = 'newsfeed';
}
$found = 0;
}
}
}
PK{F�[l�F���com_newsfeeds/helpers/route.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @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;
/**
* Newsfeeds Component Route Helper
*
* @since 1.5
*/
abstract class NewsfeedsHelperRoute
{
/**
* getNewsfeedRoute
*
* @param int $id menu itemid
* @param int $catid category id
* @param int $language language
*
* @return string
*/
public static function getNewsfeedRoute($id, $catid, $language = 0)
{
// Create the link
$link =
'index.php?option=com_newsfeeds&view=newsfeed&id=' . $id;
if ((int) $catid > 1)
{
$link .= '&catid=' . $catid;
}
if ($language && $language !== '*' &&
JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
return $link;
}
/**
* getCategoryRoute
*
* @param int $catid category id
* @param int $language language
*
* @return string
*/
public static function getCategoryRoute($catid, $language = 0)
{
if ($catid instanceof JCategoryNode)
{
$id = $catid->id;
}
else
{
$id = (int) $catid;
}
if ($id < 1)
{
$link = '';
}
else
{
// Create the link
$link =
'index.php?option=com_newsfeeds&view=category&id=' . $id;
if ($language && $language !== '*' &&
JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
}
return $link;
}
}
PK{F�[��ѫ�#com_newsfeeds/models/categories.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 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;
/**
* This models supports retrieving lists of newsfeed categories.
*
* @since 1.6
*/
class NewsfeedsModelCategories extends JModelList
{
/**
* Model context string.
*
* @var string
*/
public $_context = 'com_newsfeeds.categories';
/**
* The category context (allows other extensions to derived from this
model).
*
* @var string
*/
protected $_extension = 'com_newsfeeds';
private $_parent = null;
private $_items = null;
/**
* 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
*
* @throws Exception
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
$this->setState('filter.extension', $this->_extension);
// Get the parent id if defined.
$parentId = $app->input->getInt('id');
$this->setState('filter.parentId', $parentId);
$params = $app->getParams();
$this->setState('params', $params);
$this->setState('filter.published', 1);
$this->setState('filter.access', true);
}
/**
* 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.
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.extension');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.parentId');
return parent::getStoreId($id);
}
/**
* redefine the function an add some properties to make the styling more
easy
*
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
{
if ($this->_items === null)
{
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$params = new Registry;
if ($active)
{
$params->loadString($active->params);
}
$options = array();
$options['countItems'] =
$params->get('show_cat_items_cat', 1) ||
!$params->get('show_empty_categories_cat', 0);
$categories = JCategories::getInstance('Newsfeeds', $options);
$this->_parent =
$categories->get($this->getState('filter.parentId',
'root'));
if (is_object($this->_parent))
{
$this->_items = $this->_parent->getChildren();
}
else
{
$this->_items = false;
}
}
return $this->_items;
}
/**
* get the Parent
*
* @return null
*/
public function getParent()
{
if (!is_object($this->_parent))
{
$this->getItems();
}
return $this->_parent;
}
}
PK|F�[1��T�!�!!com_newsfeeds/models/category.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 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;
/**
* Newsfeeds Component Category Model
*
* @since 1.5
*/
class NewsfeedsModelCategory extends JModelList
{
/**
* Category items data
*
* @var array
*/
protected $_item = null;
protected $_articles = null;
protected $_siblings = null;
protected $_children = null;
protected $_parent = null;
/**
* The category that applies.
*
* @access protected
* @var object
*/
protected $_category = null;
/**
* The list of other newsfeed categories.
*
* @access protected
* @var array
*/
protected $_categories = null;
/**
* 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(
'id', 'a.id',
'name', 'a.name',
'numarticles', 'a.numarticles',
'link', 'a.link',
'ordering', 'a.ordering',
);
}
parent::__construct($config);
}
/**
* Method to get a list of items.
*
* @return mixed An array of objects on success, false on failure.
*/
public function getItems()
{
// Invoke the parent getItems method to get the main list
$items = parent::getItems();
// Convert the params field into an object, saving original in _params
foreach ($items as $item)
{
if (!isset($this->_params))
{
$params = new Registry;
$item->params = $params;
$params->loadString($item->params);
}
// Some contexts may not use tags data at all, so we allow callers to
disable loading tag data
if ($this->getState('load_tags', true))
{
$item->tags = new JHelperTags;
$item->tags->getItemTags('com_newsfeeds.newsfeed',
$item->id);
}
}
return $items;
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*
* @since 1.6
*/
protected function getListQuery()
{
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select required fields from the categories.
$query->select($this->getState('list.select',
'a.*'))
->from($db->quoteName('#__newsfeeds') . ' AS
a')
->where('a.access IN (' . $groups . ')');
// Filter by category.
if ($categoryId = $this->getState('category.id'))
{
$query->where('a.catid = ' . (int) $categoryId)
->join('LEFT', '#__categories AS c ON c.id =
a.catid')
->where('c.access IN (' . $groups . ')');
}
// Filter by state
$state = $this->getState('filter.published');
if (is_numeric($state))
{
$query->where('a.published = ' . (int) $state);
}
else
{
$query->where('(a.published IN (0,1,2))');
}
// Filter by start and end dates.
$nullDate = $db->quote($db->getNullDate());
$date = JFactory::getDate();
$nowDate = $db->quote($date->format($db->getDateFormat()));
if ($this->getState('filter.publish_date'))
{
$query->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')');
}
// Filter by search in title
$search = $this->getState('list.filter');
if (!empty($search))
{
$search = $db->quote('%' . $db->escape($search, true) .
'%');
$query->where('(a.name LIKE ' . $search . ')');
}
// Filter by language
if ($this->getState('filter.language'))
{
$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
}
// Add the list ordering clause.
$query->order($db->escape($this->getState('list.ordering',
'a.ordering')) . ' ' .
$db->escape($this->getState('list.direction',
'ASC')));
return $query;
}
/**
* 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
*
* @throws Exception
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_newsfeeds');
// List state information
$limit = $app->getUserStateFromRequest('global.list.limit',
'limit', $app->get('list_limit'), 'uint');
$this->setState('list.limit', $limit);
$limitstart = $app->input->get('limitstart', 0,
'uint');
$this->setState('list.start', $limitstart);
// Optional filter text
$this->setState('list.filter',
$app->input->getString('filter-search'));
$orderCol = $app->input->get('filter_order',
'ordering');
if (!in_array($orderCol, $this->filter_fields))
{
$orderCol = 'ordering';
}
$this->setState('list.ordering', $orderCol);
$listOrder = $app->input->get('filter_order_Dir',
'ASC');
if (!in_array(strtoupper($listOrder), array('ASC',
'DESC', '')))
{
$listOrder = 'ASC';
}
$this->setState('list.direction', $listOrder);
$id = $app->input->get('id', 0, 'int');
$this->setState('category.id', $id);
$user = JFactory::getUser();
if ((!$user->authorise('core.edit.state',
'com_newsfeeds')) &&
(!$user->authorise('core.edit', 'com_newsfeeds')))
{
// Limit to published for people who can't edit or edit.state.
$this->setState('filter.published', 1);
// Filter by start and end dates.
$this->setState('filter.publish_date', true);
}
$this->setState('filter.language',
JLanguageMultilang::isEnabled());
// Load the parameters.
$this->setState('params', $params);
}
/**
* Method to get category data for the current category
*
* @return object
*
* @since 1.5
*/
public function getCategory()
{
if (!is_object($this->_item))
{
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$params = new Registry;
if ($active)
{
$params->loadString($active->params);
}
$options = array();
$options['countItems'] =
$params->get('show_cat_items', 1) ||
$params->get('show_empty_categories', 0);
$categories = JCategories::getInstance('Newsfeeds', $options);
$this->_item =
$categories->get($this->getState('category.id',
'root'));
if (is_object($this->_item))
{
$this->_children = $this->_item->getChildren();
$this->_parent = false;
if ($this->_item->getParent())
{
$this->_parent = $this->_item->getParent();
}
$this->_rightsibling = $this->_item->getSibling();
$this->_leftsibling = $this->_item->getSibling(false);
}
else
{
$this->_children = false;
$this->_parent = false;
}
}
return $this->_item;
}
/**
* Get the parent category.
*
* @return mixed An array of categories or false if an error occurs.
*/
public function getParent()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
return $this->_parent;
}
/**
* Get the sibling (adjacent) categories.
*
* @return mixed An array of categories or false if an error occurs.
*/
public function &getLeftSibling()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
return $this->_leftsibling;
}
/**
* Get the sibling (adjacent) categories.
*
* @return mixed An array of categories or false if an error occurs.
*/
public function &getRightSibling()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
return $this->_rightsibling;
}
/**
* Get the child categories.
*
* @return mixed An array of categories or false if an error occurs.
*/
public function &getChildren()
{
if (!is_object($this->_item))
{
$this->getCategory();
}
return $this->_children;
}
/**
* Increment the hit counter for the category.
*
* @param int $pk Optional primary key of the category to increment.
*
* @return boolean True if successful; false otherwise and internal error
set.
*/
public function hit($pk = 0)
{
$input = JFactory::getApplication()->input;
$hitcount = $input->getInt('hitcount', 1);
if ($hitcount)
{
$pk = (!empty($pk)) ? $pk : (int)
$this->getState('category.id');
$table = JTable::getInstance('Category', 'JTable');
$table->hit($pk);
}
return true;
}
}
PK|F�[S��RR!com_newsfeeds/models/newsfeed.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 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;
/**
* Newsfeeds Component Newsfeed Model
*
* @since 1.5
*/
class NewsfeedsModelNewsfeed extends JModelItem
{
/**
* Model context string.
*
* @var string
* @since 1.6
*/
protected $_context = 'com_newsfeeds.newsfeed';
/**
* 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('site');
// Load state from the request.
$pk = $app->input->getInt('id');
$this->setState('newsfeed.id', $pk);
$offset = $app->input->get('limitstart', 0,
'uint');
$this->setState('list.offset', $offset);
// Load the parameters.
$params = $app->getParams();
$this->setState('params', $params);
$user = JFactory::getUser();
if ((!$user->authorise('core.edit.state',
'com_newsfeeds')) &&
(!$user->authorise('core.edit', 'com_newsfeeds')))
{
$this->setState('filter.published', 1);
$this->setState('filter.archived', 2);
}
}
/**
* Method to get newsfeed data.
*
* @param integer $pk The id of the newsfeed.
*
* @return mixed Menu item data object on success, false on failure.
*
* @since 1.6
*/
public function &getItem($pk = null)
{
$pk = (!empty($pk)) ? $pk : (int)
$this->getState('newsfeed.id');
if ($this->_item === null)
{
$this->_item = array();
}
if (!isset($this->_item[$pk]))
{
try
{
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($this->getState('item.select',
'a.*'))
->from('#__newsfeeds AS a');
// Join on category table.
$query->select('c.title AS category_title, c.alias AS
category_alias, c.access AS category_access')
->join('LEFT', '#__categories AS c on c.id =
a.catid');
// Join on user table.
$query->select('u.name AS author')
->join('LEFT', '#__users AS u on u.id =
a.created_by');
// Join over the categories to get parent category titles
$query->select('parent.title as parent_title, parent.id as
parent_id, parent.path as parent_route, parent.alias as parent_alias')
->join('LEFT', '#__categories as parent ON parent.id
= c.parent_id')
->where('a.id = ' . (int) $pk);
// Filter by start and end dates.
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
// Filter by published state.
$published = $this->getState('filter.published');
$archived = $this->getState('filter.archived');
if (is_numeric($published))
{
$query->where('(a.published = ' . (int) $published .
' OR a.published =' . (int) $archived . ')')
->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')')
->where('(c.published = ' . (int) $published . ' OR
c.published =' . (int) $archived . ')');
}
$db->setQuery($query);
$data = $db->loadObject();
if (empty($data))
{
JError::raiseError(404,
JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'));
}
// Check for published state if filter set.
if ((is_numeric($published) || is_numeric($archived)) &&
$data->published != $published && $data->published !=
$archived)
{
JError::raiseError(404,
JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'));
}
// Convert parameter fields to objects.
$registry = new Registry($data->params);
$data->params = clone $this->getState('params');
$data->params->merge($registry);
$data->metadata = new Registry($data->metadata);
// Compute access permissions.
if ($access = $this->getState('filter.access'))
{
// If the access filter has been set, we already know this user can
view.
$data->params->set('access-view', true);
}
else
{
// If no access filter is set, the layout takes some responsibility
for display of limited information.
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
$data->params->set('access-view',
in_array($data->access, $groups) &&
in_array($data->category_access, $groups));
}
$this->_item[$pk] = $data;
}
catch (Exception $e)
{
$this->setError($e);
$this->_item[$pk] = false;
}
}
return $this->_item[$pk];
}
/**
* Increment the hit counter for the newsfeed.
*
* @param int $pk Optional primary key of the item to increment.
*
* @return boolean True if successful; false otherwise and internal
error set.
*
* @since 3.0
*/
public function hit($pk = 0)
{
$input = JFactory::getApplication()->input;
$hitcount = $input->getInt('hitcount', 1);
if ($hitcount)
{
$pk = (!empty($pk)) ? $pk : (int)
$this->getState('newsfeed.id');
$table = JTable::getInstance('Newsfeed',
'NewsfeedsTable');
$table->hit($pk);
}
return true;
}
}
PK}F�[�]��33com_newsfeeds/newsfeeds.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2005 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('NewsfeedsHelperRoute', JPATH_COMPONENT .
'/helpers/route.php');
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR .
'/tables');
$controller = JControllerLegacy::getInstance('Newsfeeds');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
PK}F�[C�L~~com_newsfeeds/router.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Routing class from com_newsfeeds
*
* @since 3.3
*/
class NewsfeedsRouter extends JComponentRouterView
{
protected $noIDs = false;
/**
* Newsfeeds Component router constructor
*
* @param JApplicationCms $app The application object
* @param JMenu $menu The menu object to work with
*/
public function __construct($app = null, $menu = null)
{
$params = JComponentHelper::getParams('com_newsfeeds');
$this->noIDs = (bool) $params->get('sef_ids');
$categories = new
JComponentRouterViewconfiguration('categories');
$categories->setKey('id');
$this->registerView($categories);
$category = new JComponentRouterViewconfiguration('category');
$category->setKey('id')->setParent($categories,
'catid')->setNestable();
$this->registerView($category);
$newsfeed = new JComponentRouterViewconfiguration('newsfeed');
$newsfeed->setKey('id')->setParent($category,
'catid');
$this->registerView($newsfeed);
parent::__construct($app, $menu);
$this->attachRule(new JComponentRouterRulesMenu($this));
if ($params->get('sef_advanced', 0))
{
$this->attachRule(new JComponentRouterRulesStandard($this));
$this->attachRule(new JComponentRouterRulesNomenu($this));
}
else
{
JLoader::register('NewsfeedsRouterRulesLegacy', __DIR__ .
'/helpers/legacyrouter.php');
$this->attachRule(new NewsfeedsRouterRulesLegacy($this));
}
}
/**
* Method to get the segment(s) for a category
*
* @param string $id ID of the category to retrieve the segments
for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getCategorySegment($id, $query)
{
$category = JCategories::getInstance($this->getName())->get($id);
if ($category)
{
$path = array_reverse($category->getPath(), true);
$path[0] = '1:root';
if ($this->noIDs)
{
foreach ($path as &$segment)
{
list($id, $segment) = explode(':', $segment, 2);
}
}
return $path;
}
return array();
}
/**
* Method to get the segment(s) for a category
*
* @param string $id ID of the category to retrieve the segments
for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getCategoriesSegment($id, $query)
{
return $this->getCategorySegment($id, $query);
}
/**
* Method to get the segment(s) for a newsfeed
*
* @param string $id ID of the newsfeed to retrieve the segments
for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getNewsfeedSegment($id, $query)
{
if (!strpos($id, ':'))
{
$db = JFactory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($dbquery->qn('alias'))
->from($dbquery->qn('#__newsfeeds'))
->where('id = ' . $dbquery->q((int) $id));
$db->setQuery($dbquery);
$id .= ':' . $db->loadResult();
}
if ($this->noIDs)
{
list($void, $segment) = explode(':', $id, 2);
return array($void => $segment);
}
return array((int) $id => $id);
}
/**
* Method to get the id for a category
*
* @param string $segment Segment to retrieve the ID for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getCategoryId($segment, $query)
{
if (isset($query['id']))
{
$category = JCategories::getInstance($this->getName(),
array('access' => false))->get($query['id']);
if ($category)
{
foreach ($category->getChildren() as $child)
{
if ($this->noIDs)
{
if ($child->alias === $segment)
{
return $child->id;
}
}
else
{
if ($child->id == (int) $segment)
{
return $child->id;
}
}
}
}
}
return false;
}
/**
* Method to get the segment(s) for a category
*
* @param string $segment Segment to retrieve the ID for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getCategoriesId($segment, $query)
{
return $this->getCategoryId($segment, $query);
}
/**
* Method to get the segment(s) for a newsfeed
*
* @param string $segment Segment of the newsfeed to retrieve the ID
for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getNewsfeedId($segment, $query)
{
if ($this->noIDs)
{
$db = JFactory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($dbquery->qn('id'))
->from($dbquery->qn('#__newsfeeds'))
->where('alias = ' . $dbquery->q($segment))
->where('catid = ' .
$dbquery->q($query['id']));
$db->setQuery($dbquery);
return (int) $db->loadResult();
}
return (int) $segment;
}
}
/**
* newsfeedsBuildRoute
*
* These functions are proxys for the new router interface
* for old SEF extensions.
*
* @param array &$query The segments of the URL to parse.
*
* @return array
*
* @deprecated 4.0 Use Class based routers instead
*/
function newsfeedsBuildRoute(&$query)
{
$app = JFactory::getApplication();
$router = new NewsfeedsRouter($app, $app->getMenu());
return $router->build($query);
}
/**
* newsfeedsParseRoute
*
* @param array $segments The segments of the URL to parse.
*
* @return array
*
* @deprecated 4.0 Use Class based routers instead
*/
function newsfeedsParseRoute($segments)
{
$app = JFactory::getApplication();
$router = new NewsfeedsRouter($app, $app->getMenu());
return $router->parse($segments);
}
PK�F�[�7���/com_newsfeeds/views/categories/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 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');
JHtml::_('behavior.caption');
JHtml::_('behavior.core');
// Add strings for translations in Javascript.
JText::script('JGLOBAL_EXPAND_CATEGORIES');
JText::script('JGLOBAL_COLLAPSE_CATEGORIES');
JFactory::getDocument()->addScriptDeclaration("
jQuery(function($) {
$('.categories-list').find('[id^=category-btn-]').each(function(index,
btn) {
var btn = $(btn);
btn.on('click', function() {
btn.find('span').toggleClass('icon-plus');
btn.find('span').toggleClass('icon-minus');
if (btn.attr('aria-label') ===
Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES'))
{
btn.attr('aria-label',
Joomla.JText._('JGLOBAL_COLLAPSE_CATEGORIES'));
} else {
btn.attr('aria-label',
Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES'));
}
});
});
});");
?>
<div class="categories-list<?php echo $this->pageclass_sfx;
?>">
<?php echo
JLayoutHelper::render('joomla.content.categories_default',
$this); ?>
<?php echo $this->loadTemplate('items'); ?>
</div>
PK�F�[����["["/com_newsfeeds/views/categories/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_NEWSFEEDS_CATEGORIES_VIEW_DEFAULT_TITLE"
option="COM_NEWSFEEDS_CATEGORIES_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_NEWSFEED_CATEGORIES"
/>
<message>
<![CDATA[COM_NEWSFEEDS_CATEGORIES_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
>
<field
name="id"
type="category"
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
description="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC"
extension="com_newsfeeds"
show_root="true"
required="true"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic"
label="JGLOBAL_CATEGORIES_OPTIONS">
<field
name="show_base_description"
type="list"
label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="categories_description"
type="textarea"
label="JGLOBAL_FIELD_CATEGORIES_DESC_LABEL"
description="JGLOBAL_FIELD_CATEGORIES_DESC_DESC"
cols="25"
rows="5"
/>
<field
name="maxLevelcat"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
useglobal="true"
>
<option value="-1">JALL</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="show_empty_categories_cat"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc_cat"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_items_cat"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="category"
label="JGLOBAL_CATEGORY_OPTIONS">
<field
name="spacer2"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description"
type="list"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description_image"
type="list"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="maxLevel"
type="list"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
useglobal="true"
>
<option value="-1">JALL</option>
<option value="0">JNONE</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="show_empty_categories"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_items"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
id="show_cat_items"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="advanced"
label="JGLOBAL_LIST_LAYOUT_OPTIONS">
<field
name="spacer1"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="hide">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
description="JGLOBAL_SHOW_HEADINGS_DESC"
id="show_headings"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_articles"
type="list"
label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_LABEL"
description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC"
id="show_articles"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_link"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_LINKS_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC"
id="show_link"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="newsfeed"
label="COM_NEWSFEEDS_FIELDSET_MORE_OPTIONS_LABEL">
<field
name="show_feed_image"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_feed_description"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_item_description"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="feed_character_count"
type="number"
label="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL"
description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC"
size="6"
useglobal="true"
/>
</fieldset>
</fields>
</metadata>
PK�F�[�ό
5com_newsfeeds/views/categories/tmpl/default_items.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2010 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::_('bootstrap.tooltip');
?>
<?php $class = ' class="first"'; ?>
<?php if ($this->maxLevelcat != 0 &&
count($this->items[$this->parent->id]) > 0) : ?>
<?php foreach ($this->items[$this->parent->id] as $id =>
$item) : ?>
<?php if
($this->params->get('show_empty_categories_cat') ||
$item->numitems || count($item->getChildren())) : ?>
<?php if (!isset($this->items[$this->parent->id][$id + 1]))
: ?>
<?php $class = ' class="last"'; ?>
<?php endif; ?>
<div<?php echo $class; ?>>
<?php $class = ''; ?>
<h3 class="page-header item-title">
<a href="<?php echo
JRoute::_(NewsfeedsHelperRoute::getCategoryRoute($item->id,
$item->language)); ?>">
<?php echo $this->escape($item->title); ?>
</a>
<?php if ($this->params->get('show_cat_items_cat')
== 1) : ?>
<span class="badge badge-info tip hasTooltip"
title="<?php echo JHtml::_('tooltipText',
'COM_NEWSFEEDS_NUM_ITEMS'); ?>">
<?php echo JText::_('COM_NEWSFEEDS_NUM_ITEMS');
?>
<?php echo $item->numitems; ?>
</span>
<?php endif; ?>
<?php if (count($item->getChildren()) > 0 &&
$this->maxLevelcat > 1) : ?>
<a id="category-btn-<?php echo $item->id; ?>"
href="#category-<?php echo $item->id; ?>"
data-toggle="collapse" data-toggle="button"
class="btn btn-mini pull-right" aria-label="<?php echo
JText::_('JGLOBAL_EXPAND_CATEGORIES'); ?>">
<span class="icon-plus"
aria-hidden="true"></span>
</a>
<?php endif; ?>
</h3>
<?php if ($this->params->get('show_subcat_desc_cat')
== 1) : ?>
<?php if ($item->description) : ?>
<div class="category-desc">
<?php echo JHtml::_('content.prepare',
$item->description, '', 'com_newsfeeds.categories');
?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if (count($item->getChildren()) > 0 &&
$this->maxLevelcat > 1) : ?>
<div class="collapse fade" id="category-<?php
echo $item->id; ?>">
<?php $this->items[$item->id] = $item->getChildren();
?>
<?php $this->parent = $item; ?>
<?php $this->maxLevelcat--; ?>
<?php echo $this->loadTemplate('items'); ?>
<?php $this->parent = $item->getParent(); ?>
<?php $this->maxLevelcat++; ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
PK�F�[�?�%��,com_newsfeeds/views/categories/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Content categories view.
*
* @since 1.5
*/
class NewsfeedsViewCategories extends JViewCategories
{
/**
* Language key for default page heading
*
* @var string
* @since 3.2
*/
protected $pageHeading = 'COM_NEWSFEEDS_DEFAULT_PAGE_TITLE';
/**
* @var string The name of the extension for the category
* @since 3.2
*/
protected $extension = 'com_newsfeeds';
}
PK�F�[���_-com_newsfeeds/views/category/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 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');
JHtml::_('behavior.caption');
JHtml::_('formbehavior.chosen', 'select');
$pageClass = $this->params->get('pageclass_sfx',
'');
?>
<div class="newsfeed-category<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('show_category_title', 1))
: ?>
<h2>
<?php echo JHtml::_('content.prepare',
$this->category->title, '',
'com_newsfeeds.category.title'); ?>
</h2>
<?php endif; ?>
<?php if ($this->params->get('show_tags', 1) &&
!empty($this->category->tags->itemTags)) : ?>
<?php $this->category->tagLayout = new
JLayoutFile('joomla.content.tags'); ?>
<?php echo
$this->category->tagLayout->render($this->category->tags->itemTags);
?>
<?php endif; ?>
<?php if ($this->params->get('show_description', 1) ||
$this->params->def('show_description_image', 1)) : ?>
<div class="category-desc">
<?php if
($this->params->get('show_description_image') &&
$this->category->getParams()->get('image')) : ?>
<img src="<?php echo
$this->category->getParams()->get('image'); ?>"
/>
<?php endif; ?>
<?php if ($this->params->get('show_description')
&& $this->category->description) : ?>
<?php echo JHtml::_('content.prepare',
$this->category->description, '',
'com_newsfeeds.category'); ?>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php echo $this->loadTemplate('items'); ?>
<?php if ($this->maxLevel != 0 &&
!empty($this->children[$this->category->id])) : ?>
<div class="cat-children">
<h3>
<?php echo JText::_('JGLOBAL_SUBCATEGORIES'); ?>
</h3>
<?php echo $this->loadTemplate('children'); ?>
</div>
<?php endif; ?>
</div>
PK�F�[�!4��-com_newsfeeds/views/category/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_NEWSFEEDS_CATEGORY_VIEW_DEFAULT_TITLE"
option="COM_NEWSFEEDS_CATEGORY_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_NEWSFEED_CATEGORY"
/>
<message>
<![CDATA[COM_NEWSFEEDS_CATEGORY_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request"
addfieldpath="/administrator/components/com_categories/models/fields"
>
<fieldset name="request"
addfieldpath="/administrator/components/com_newsfeeds/models/fields"
>
<field
name="id"
type="modal_category"
label="JCATEGORY"
description="COM_NEWSFEEDS_FIELD_SELECT_CATEGORY_DESC"
extension="com_newsfeeds"
required="true"
select="true"
new="true"
edit="true"
clear="true"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic"
label="JGLOBAL_CATEGORY_OPTIONS">
<field
name="spacer1"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description"
type="list"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description_image"
type="list"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="maxLevel"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
useglobal="true"
>
<option value="-1">JALL</option>
<option value="0">JNONE</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="show_empty_categories"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_items"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
id="show_cat_items"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="advanced"
label="JGLOBAL_LIST_LAYOUT_OPTIONS">
<field
name="spacer2"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="hide">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
description="JGLOBAL_SHOW_HEADINGS_DESC"
id="show_headings"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_articles"
type="list"
label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_LABEL"
description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC"
id="show_articles"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_link"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_LINKS_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC"
id="show_link"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="newsfeed"
label="COM_NEWSFEEDS_FIELDSET_MORE_OPTIONS_LABEL">
<field
name="show_feed_image"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_feed_description"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_item_description"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="feed_character_count"
type="number"
description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC"
label="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL"
size="6"
useglobal="true"
/>
<field
name="feed_display_order"
type="list"
label="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_LABEL"
description="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_DESC"
useglobal="true"
>
<option
value="des">JGLOBAL_MOST_RECENT_FIRST</option>
<option value="asc">JGLOBAL_OLDEST_FIRST</option>
</field>
</fieldset>
</fields>
</metadata>
PK�F�[O��2��6com_newsfeeds/views/category/tmpl/default_children.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @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;
?>
<?php $class = ' class="first"'; ?>
<?php if ($this->maxLevel != 0 &&
count($this->children[$this->category->id]) > 0) : ?>
<ul>
<?php foreach ($this->children[$this->category->id] as $id
=> $child) : ?>
<?php if ($this->params->get('show_empty_categories')
|| $child->numitems || count($child->getChildren())) : ?>
<?php if (!isset($this->children[$this->category->id][$id +
1])) : ?>
<?php $class = ' class="last"'; ?>
<?php endif; ?>
<li<?php echo $class; ?>>
<?php $class = ''; ?>
<span class="item-title">
<a href="<?php echo
JRoute::_(NewsfeedsHelperRoute::getCategoryRoute($child->id));
?>">
<?php echo $this->escape($child->title); ?>
</a>
</span>
<?php if ($this->params->get('show_subcat_desc') ==
1) : ?>
<?php if ($child->description) : ?>
<div class="category-desc">
<?php echo JHtml::_('content.prepare',
$child->description, '', 'com_newsfeeds.category');
?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->params->get('show_cat_items') ==
1) : ?>
<dl class="newsfeed-count">
<dt>
<?php echo JText::_('COM_NEWSFEEDS_CAT_NUM'); ?>
</dt>
<dd>
<?php echo $child->numitems; ?>
</dd>
</dl>
<?php endif; ?>
<?php if (count($child->getChildren()) > 0) : ?>
<?php $this->children[$child->id] =
$child->getChildren(); ?>
<?php $this->category = $child; ?>
<?php $this->maxLevel--; ?>
<?php echo $this->loadTemplate('children'); ?>
<?php $this->category = $child->getParent(); ?>
<?php $this->maxLevel++; ?>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif;
PK�F�[�gE3com_newsfeeds/views/category/tmpl/default_items.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
$n = count($this->items);
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn =
$this->escape($this->state->get('list.direction'));
?>
<?php if (empty($this->items)) : ?>
<p><?php echo JText::_('COM_NEWSFEEDS_NO_ARTICLES');
?></p>
<?php else : ?>
<form action="<?php echo
htmlspecialchars(JUri::getInstance()->toString(), ENT_COMPAT,
'UTF-8'); ?>" method="post"
name="adminForm" id="adminForm">
<?php if ($this->params->get('filter_field') !==
'hide' ||
$this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters btn-toolbar">
<?php if ($this->params->get('filter_field') !==
'hide' &&
$this->params->get('filter_field') == '1') :
?>
<div class="btn-group">
<label class="filter-search-lbl element-invisible"
for="filter-search">
<span class="label label-warning">
<?php echo JText::_('JUNPUBLISHED'); ?>
</span>
<?php echo JText::_('COM_NEWSFEEDS_FILTER_LABEL') .
' '; ?>
</label>
<input type="text" name="filter-search"
id="filter-search" value="<?php echo
$this->escape($this->state->get('list.filter'));
?>" class="inputbox"
onchange="document.adminForm.submit();" title="<?php echo
JText::_('COM_NEWSFEEDS_FILTER_SEARCH_DESC'); ?>"
placeholder="<?php echo
JText::_('COM_NEWSFEEDS_FILTER_SEARCH_DESC'); ?>" />
</div>
<?php endif; ?>
<?php if
($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group pull-right">
<label for="limit"
class="element-invisible">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
</fieldset>
<?php endif; ?>
<ul class="category list-striped list-condensed">
<?php foreach ($this->items as $i => $item) : ?>
<?php if ($this->items[$i]->published == 0) : ?>
<li class="system-unpublished cat-list-row<?php echo $i %
2; ?>">
<?php else : ?>
<li class="cat-list-row<?php echo $i % 2; ?>">
<?php endif; ?>
<?php if ($this->params->get('show_articles')) :
?>
<span class="list-hits badge badge-info pull-right">
<?php echo
JText::sprintf('COM_NEWSFEEDS_NUM_ARTICLES_COUNT',
$item->numarticles); ?>
</span>
<?php endif; ?>
<span class="list pull-left">
<div class="list-title">
<a href="<?php echo
JRoute::_(NewsFeedsHelperRoute::getNewsfeedRoute($item->slug,
$item->catid)); ?>">
<?php echo $item->name; ?>
</a>
</div>
</span>
<?php if ($this->items[$i]->published == 0) : ?>
<span class="label label-warning">
<?php echo JText::_('JUNPUBLISHED'); ?>
</span>
<?php endif; ?>
<br />
<?php if ($this->params->get('show_link')) : ?>
<?php $link = JStringPunycode::urlToUTF8($item->link); ?>
<span class="list pull-left">
<a href="<?php echo $item->link; ?>">
<?php echo $link; ?>
</a>
</span>
<br />
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php // Add pagination links ?>
<?php if (!empty($this->items)) : ?>
<?php if (($this->params->def('show_pagination', 2)
== 1 || ($this->params->get('show_pagination') == 2))
&& ($this->pagination->pagesTotal > 1)) : ?>
<div class="pagination">
<?php if
($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</form>
<?php endif; ?>
PK�F�[+��?� � *com_newsfeeds/views/category/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 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;
/**
* HTML View class for the Newsfeeds component
*
* @since 1.0
*/
class NewsfeedsViewCategory extends JViewCategory
{
/**
* @var string Default title to use for page title
* @since 3.2
*/
protected $defaultPageTitle =
'COM_NEWSFEEDS_DEFAULT_PAGE_TITLE';
/**
* @var string The name of the extension for the category
* @since 3.2
*/
protected $extension = 'com_newsfeeds';
/**
* @var string The name of the view to link individual items to
* @since 3.2
*/
protected $viewName = 'newsfeed';
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$this->commonCategoryDisplay();
// Flag indicates to not add limitstart=0 to URL
$this->pagination->hideEmptyLimitstart = true;
// Prepare the data.
// Compute the newsfeed slug.
foreach ($this->items as $item)
{
$item->slug = $item->alias ? ($item->id . ':' .
$item->alias) : $item->id;
$temp = $item->params;
$item->params = clone $this->params;
$item->params->merge($temp);
}
return parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*/
protected function prepareDocument()
{
parent::prepareDocument();
$menu = $this->menu;
$id = (int) @$menu->query['id'];
if ($menu && (!isset($menu->query['option']) ||
$menu->query['option'] !== 'com_newsfeeds' ||
$menu->query['view'] === 'newsfeed'
|| $id != $this->category->id))
{
$path = array(array('title' =>
$this->category->title, 'link' => ''));
$category = $this->category->getParent();
while ((!isset($menu->query['option']) ||
$menu->query['option'] !== 'com_newsfeeds' ||
$menu->query['view'] === 'newsfeed'
|| $id != $category->id) && $category->id > 1)
{
$path[] = array('title' => $category->title,
'link' =>
NewsfeedsHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();
}
$path = array_reverse($path);
foreach ($path as $item)
{
$this->pathway->addItem($item['title'],
$item['link']);
}
}
}
}
PK�F�[IJzh��-com_newsfeeds/views/newsfeed/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<?php if (!empty($this->msg)) : ?>
<?php echo $this->msg; ?>
<?php else : ?>
<?php $lang = JFactory::getLanguage(); ?>
<?php $myrtl = $this->newsfeed->rtl; ?>
<?php $direction = ' '; ?>
<?php $isRtl = $lang->isRtl(); ?>
<?php if ($isRtl && $myrtl == 0) : ?>
<?php $direction = ' redirect-rtl'; ?>
<?php elseif ($isRtl && $myrtl == 1) : ?>
<?php $direction = ' redirect-ltr'; ?>
<?php elseif ($isRtl && $myrtl == 2) : ?>
<?php $direction = ' redirect-rtl'; ?>
<?php elseif ($myrtl == 0) : ?>
<?php $direction = ' redirect-ltr'; ?>
<?php elseif ($myrtl == 1) : ?>
<?php $direction = ' redirect-ltr'; ?>
<?php elseif ($myrtl == 2) : ?>
<?php $direction = ' redirect-rtl'; ?>
<?php endif; ?>
<?php $images = json_decode($this->item->images); ?>
<div class="newsfeed<?php echo $this->pageclass_sfx;
?><?php echo $direction; ?>">
<?php if ($this->params->get('display_num')) : ?>
<h1 class="<?php echo $direction; ?>">
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<h2 class="<?php echo $direction; ?>">
<?php if ($this->item->published == 0) : ?>
<span class="label label-warning"><?php echo
JText::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<a href="<?php echo $this->item->link; ?>"
target="_blank">
<?php echo str_replace(''', "'",
$this->item->name); ?>
</a>
</h2>
<?php if ($this->params->get('show_tags', 1)) : ?>
<?php $this->item->tagLayout = new
JLayoutFile('joomla.content.tags'); ?>
<?php echo
$this->item->tagLayout->render($this->item->tags->itemTags);
?>
<?php endif; ?>
<!-- Show Images from Component -->
<?php if (isset($images->image_first) &&
!empty($images->image_first)) : ?>
<?php $imgfloat = empty($images->float_first) ?
$this->params->get('float_first') :
$images->float_first; ?>
<div class="img-intro-<?php echo htmlspecialchars($imgfloat,
ENT_COMPAT, 'UTF-8'); ?>">
<img
<?php if ($images->image_first_caption) : ?>
<?php echo 'class="caption"' . '
title="' . htmlspecialchars($images->image_first_caption,
ENT_COMPAT, 'UTF-8') . '"'; ?>
<?php endif; ?>
src="<?php echo htmlspecialchars($images->image_first,
ENT_COMPAT, 'UTF-8'); ?>" alt="<?php echo
htmlspecialchars($images->image_first_alt, ENT_COMPAT,
'UTF-8'); ?>" />
</div>
<?php endif; ?>
<?php if (isset($images->image_second) &&
!empty($images->image_second)) : ?>
<?php $imgfloat = empty($images->float_second) ?
$this->params->get('float_second') :
$images->float_second; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat,
ENT_COMPAT, 'UTF-8'); ?> item-image">
<img
<?php if ($images->image_second_caption) : ?>
<?php echo 'class="caption"' . '
title="' . htmlspecialchars($images->image_second_caption) .
'"'; ?>
<?php endif; ?>
src="<?php echo htmlspecialchars($images->image_second,
ENT_COMPAT, 'UTF-8'); ?>" alt="<?php echo
htmlspecialchars($images->image_second_alt, ENT_COMPAT,
'UTF-8'); ?>" />
</div>
<?php endif; ?>
<!-- Show Description from Component -->
<?php echo $this->item->description; ?>
<!-- Show Feed's Description -->
<?php if ($this->params->get('show_feed_description'))
: ?>
<div class="feed-description">
<?php echo str_replace(''', "'",
$this->rssDoc->description); ?>
</div>
<?php endif; ?>
<!-- Show Image -->
<?php if ($this->rssDoc->image &&
$this->params->get('show_feed_image')) : ?>
<div>
<img src="<?php echo $this->rssDoc->image->uri;
?>" alt="<?php echo $this->rssDoc->image->title;
?>" />
</div>
<?php endif; ?>
<!-- Show items -->
<?php if (!empty($this->rssDoc[0])) : ?>
<ol>
<?php for ($i = 0; $i < $this->item->numarticles; $i++) :
?>
<?php if (empty($this->rssDoc[$i])) : ?>
<?php break; ?>
<?php endif; ?>
<?php $uri = $this->rssDoc[$i]->uri ||
!$this->rssDoc[$i]->isPermaLink ? trim($this->rssDoc[$i]->uri)
: trim($this->rssDoc[$i]->guid); ?>
<?php $uri = !$uri || stripos($uri, 'http') !== 0 ?
$this->item->link : $uri; ?>
<?php $text = $this->rssDoc[$i]->content !== '' ?
trim($this->rssDoc[$i]->content) : ''; ?>
<li>
<?php if (!empty($uri)) : ?>
<h3 class="feed-link">
<a href="<?php echo htmlspecialchars($uri); ?>"
target="_blank">
<?php echo trim($this->rssDoc[$i]->title); ?>
</a>
</h3>
<?php else : ?>
<h3 class="feed-link"><?php echo
trim($this->rssDoc[$i]->title); ?></h3>
<?php endif; ?>
<?php if
($this->params->get('show_item_description') &&
$text !== '') : ?>
<div class="feed-item-description">
<?php if ($this->params->get('show_feed_image',
0) == 0) : ?>
<?php $text = JFilterOutput::stripImages($text); ?>
<?php endif; ?>
<?php $text = JHtml::_('string.truncate', $text,
$this->params->get('feed_character_count')); ?>
<?php echo str_replace(''',
"'", $text); ?>
</div>
<?php endif; ?>
</li>
<?php endfor; ?>
</ol>
<?php endif; ?>
</div>
<?php endif; ?>
PK�F�[���r�
�
-com_newsfeeds/views/newsfeed/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_NEWSFEEDS_NEWSFEED_VIEW_DEFAULT_TITLE"
option="COM_NEWSFEEDS_NEWSFEED_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_NEWSFEED_SINGLE_NEWSFEED"
/>
<message>
<![CDATA[COM_NEWSFEEDS_NEWSFEED_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_newsfeeds/models/fields"
>
<field
name="id"
type="modal_newsfeed"
label="COM_NEWSFEEDS_FIELD_SELECT_FEED_LABEL"
description="COM_NEWSFEEDS_FIELD_SELECT_FEED_DESC"
required="true"
select="true"
new="true"
edit="true"
clear="true"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<!-- Basic options. -->
<fieldset name="basic"
label="COM_NEWSFEEDS_FIELDSET_MORE_OPTIONS_LABEL">
<field
name="show_feed_image"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_feed_description"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_item_description"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_tags"
type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_TAGS_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_TAGS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="feed_character_count"
type="number"
label="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL"
description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC"
size="6"
useglobal="true"
/>
<field
name="feed_display_order"
type="list"
label="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_LABEL"
description="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_DESC"
useglobal="true"
>
<option
value="des">JGLOBAL_MOST_RECENT_FIRST</option>
<option value="asc">JGLOBAL_OLDEST_FIRST</option>
</field>
</fieldset>
</fields>
</metadata>
PK�F�[g���, ,
*com_newsfeeds/views/newsfeed/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright (C) 2006 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;
/**
* HTML View class for the Newsfeeds component
*
* @since 1.0
*/
class NewsfeedsViewNewsfeed extends JViewLegacy
{
/**
* @var object
* @since 1.6
*/
protected $state;
/**
* @var object
* @since 1.6
*/
protected $item;
/**
* @var boolean
* @since 1.6
*/
protected $print;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.6
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
// Get view related request variables.
$print = $app->input->getBool('print');
// Get model data.
$state = $this->get('State');
$item = $this->get('Item');
// Check for errors.
// @TODO: Maybe this could go into
JComponentHelper::raiseErrors($this->get('Errors'))
if (count($errors = $this->get('Errors')))
{
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
// Add router helpers.
$item->slug = $item->alias ? ($item->id . ':' .
$item->alias) : $item->id;
$item->catslug = $item->category_alias ? ($item->catid .
':' . $item->category_alias) : $item->catid;
$item->parent_slug = $item->category_alias ? ($item->parent_id .
':' . $item->parent_alias) : $item->parent_id;
// Merge newsfeed params. If this is single-newsfeed view, menu params
override newsfeed params
// Otherwise, newsfeed params override menu item params
$params = $state->get('params');
$newsfeed_params = clone $item->params;
$active = $app->getMenu()->getActive();
$temp = clone $params;
// Check to see which parameters should take priority
if ($active)
{
$currentLink = $active->link;
// If the current view is the active item and a newsfeed view for this
feed, then the menu item params take priority
if (strpos($currentLink, 'view=newsfeed') &&
strpos($currentLink, '&id=' . (string) $item->id))
{
// $item->params are the newsfeed params, $temp are the menu item
params
// Merge so that the menu item params take priority
$newsfeed_params->merge($temp);
$item->params = $newsfeed_params;
// Load layout from active query (in case it is an alternative menu
item)
if (isset($active->query['layout']))
{
$this->setLayout($active->query['layout']);
}
}
else
{
// Current view is not a single newsfeed, so the newsfeed params take
priority here
// Merge the menu item params with the newsfeed params so that the
newsfeed params take priority
$temp->merge($newsfeed_params);
$item->params = $temp;
// Check for alternative layouts (since we are not in a single-newsfeed
menu item)
if ($layout = $item->params->get('newsfeed_layout'))
{
$this->setLayout($layout);
}
}
}
else
{
// Merge so that newsfeed params take priority
$temp->merge($newsfeed_params);
$item->params = $temp;
// Check for alternative layouts (since we are not in a single-newsfeed
menu item)
if ($layout = $item->params->get('newsfeed_layout'))
{
$this->setLayout($layout);
}
}
// Check the access to the newsfeed
$levels = $user->getAuthorisedViewLevels();
if (!in_array($item->access, $levels) || (in_array($item->access,
$levels) && (!in_array($item->category_access, $levels))))
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
$app->setHeader('status', 403, true);
return;
}
// Get the current menu item
$params = $app->getParams();
// Get the newsfeed
$newsfeed = $item;
$params->merge($item->params);
try
{
$feed = new JFeedFactory;
$this->rssDoc = $feed->getFeed($newsfeed->link);
}
catch (InvalidArgumentException $e)
{
$msg = JText::_('COM_NEWSFEEDS_ERRORS_FEED_NOT_RETRIEVED');
}
catch (RunTimeException $e)
{
$msg = JText::_('COM_NEWSFEEDS_ERRORS_FEED_NOT_RETRIEVED');
}
if (empty($this->rssDoc))
{
$msg = JText::_('COM_NEWSFEEDS_ERRORS_FEED_NOT_RETRIEVED');
}
$feed_display_order = $params->get('feed_display_order',
'des');
if ($feed_display_order === 'asc')
{
$this->rssDoc->reverseItems();
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($params->get('pageclass_sfx', ''));
$this->params = $params;
$this->newsfeed = $newsfeed;
$this->state = $state;
$this->item = $item;
$this->user = $user;
if (!empty($msg))
{
$this->msg = $msg;
}
$this->print = $print;
$item->tags = new JHelperTags;
$item->tags->getItemTags('com_newsfeeds.newsfeed',
$item->id);
// Increment the hit counter of the newsfeed.
$model = $this->getModel();
$model->hit();
$this->_prepareDocument();
return parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*
* @since 1.6
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$pathway = $app->getPathway();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_NEWSFEEDS_DEFAULT_PAGE_TITLE'));
}
$title = $this->params->get('page_title', '');
$id = (int) @$menu->query['id'];
// If the menu item does not concern this newsfeed
if ($menu && (!isset($menu->query['option']) ||
$menu->query['option'] !== 'com_newsfeeds' ||
$menu->query['view'] !== 'newsfeed'
|| $id != $this->item->id))
{
// If this is not a single newsfeed menu item, set the page title to the
newsfeed title
if ($this->item->name)
{
$title = $this->item->name;
}
$path = array(array('title' => $this->item->name,
'link' => ''));
$category =
JCategories::getInstance('Newsfeeds')->get($this->item->catid);
while ((!isset($menu->query['option']) ||
$menu->query['option'] !== 'com_newsfeeds' ||
$menu->query['view'] === 'newsfeed'
|| $id != $category->id) && $category->id > 1)
{
$path[] = array('title' => $category->title,
'link' =>
NewsfeedsHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();
}
$path = array_reverse($path);
foreach ($path as $item)
{
$pathway->addItem($item['title'],
$item['link']);
}
}
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
if (empty($title))
{
$title = $this->item->name;
}
$this->document->setTitle($title);
if ($this->item->metadesc)
{
$this->document->setDescription($this->item->metadesc);
}
elseif ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->item->metakey)
{
$this->document->setMetadata('keywords',
$this->item->metakey);
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
if ($app->get('MetaTitle') == '1')
{
$this->document->setMetaData('title',
$this->item->name);
}
if ($app->get('MetaAuthor') == '1')
{
$this->document->setMetaData('author',
$this->item->author);
}
$mdata = $this->item->metadata->toArray();
foreach ($mdata as $k => $v)
{
if ($v)
{
$this->document->setMetadata($k, $v);
}
}
}
}
PK�F�[�����com_privacy/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @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;
/**
* Privacy Controller
*
* @since 3.9.0
*/
class PrivacyController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their
variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return $this
*
* @since 3.9.0
*/
public function display($cachable = false, $urlparams = array())
{
$view = $this->input->get('view',
$this->default_view);
// Submitting information requests and confirmation through the frontend
is restricted to authenticated users at this time
if (in_array($view, array('confirm', 'request'))
&& JFactory::getUser()->guest)
{
$this->setRedirect(
JRoute::_('index.php?option=com_users&view=login&return='
. base64_encode('index.php?option=com_privacy&view=' .
$view), false)
);
return $this;
}
// Set a Referrer-Policy header for views which require it
if (in_array($view, array('confirm', 'remind')))
{
JFactory::getApplication()->setHeader('Referrer-Policy',
'no-referrer', true);
}
return parent::display($cachable, $urlparams);
}
}
PK�F�[�T�###com_privacy/controllers/request.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @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;
/**
* Request action controller class.
*
* @since 3.9.0
*/
class PrivacyControllerRequest extends JControllerLegacy
{
/**
* Method to confirm the information request.
*
* @return boolean
*
* @since 3.9.0
*/
public function confirm()
{
// Check the request token.
$this->checkToken('post');
/** @var PrivacyModelConfirm $model */
$model = $this->getModel('Confirm',
'PrivacyModel');
$data = $this->input->post->get('jform', array(),
'array');
$return = $model->confirmRequest($data);
// Check for a hard error.
if ($return instanceof Exception)
{
// Get the error message to display.
if (JFactory::getApplication()->get('error_reporting'))
{
$message = $return->getMessage();
}
else
{
$message = JText::_('COM_PRIVACY_ERROR_CONFIRMING_REQUEST');
}
// Go back to the confirm form.
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=confirm',
false), $message, 'error');
return false;
}
elseif ($return === false)
{
// Confirm failed.
// Go back to the confirm form.
$message =
JText::sprintf('COM_PRIVACY_ERROR_CONFIRMING_REQUEST_FAILED',
$model->getError());
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=confirm',
false), $message, 'notice');
return false;
}
else
{
// Confirm succeeded.
$this->setRedirect(JRoute::_(JUri::root()),
JText::_('COM_PRIVACY_CONFIRM_REQUEST_SUCCEEDED'),
'info');
return true;
}
}
/**
* Method to submit an information request.
*
* @return boolean
*
* @since 3.9.0
*/
public function submit()
{
// Check the request token.
$this->checkToken('post');
/** @var PrivacyModelRequest $model */
$model = $this->getModel('Request',
'PrivacyModel');
$data = $this->input->post->get('jform', array(),
'array');
$return = $model->createRequest($data);
// Check for a hard error.
if ($return instanceof Exception)
{
// Get the error message to display.
if (JFactory::getApplication()->get('error_reporting'))
{
$message = $return->getMessage();
}
else
{
$message = JText::_('COM_PRIVACY_ERROR_CREATING_REQUEST');
}
// Go back to the confirm form.
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=request',
false), $message, 'error');
return false;
}
elseif ($return === false)
{
// Confirm failed.
// Go back to the confirm form.
$message =
JText::sprintf('COM_PRIVACY_ERROR_CREATING_REQUEST_FAILED',
$model->getError());
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=request',
false), $message, 'notice');
return false;
}
else
{
// Confirm succeeded.
$this->setRedirect(JRoute::_(JUri::root()),
JText::_('COM_PRIVACY_CREATE_REQUEST_SUCCEEDED'),
'info');
return true;
}
}
/**
* Method to extend the privacy consent.
*
* @return boolean
*
* @since 3.9.0
*/
public function remind()
{
// Check the request token.
$this->checkToken('post');
/** @var PrivacyModelConfirm $model */
$model = $this->getModel('Remind',
'PrivacyModel');
$data = $this->input->post->get('jform', array(),
'array');
$return = $model->remindRequest($data);
// Check for a hard error.
if ($return instanceof Exception)
{
// Get the error message to display.
if (JFactory::getApplication()->get('error_reporting'))
{
$message = $return->getMessage();
}
else
{
$message = JText::_('COM_PRIVACY_ERROR_REMIND_REQUEST');
}
// Go back to the confirm form.
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=remind',
false), $message, 'error');
return false;
}
elseif ($return === false)
{
// Confirm failed.
// Go back to the confirm form.
$message =
JText::sprintf('COM_PRIVACY_ERROR_CONFIRMING_REMIND_FAILED',
$model->getError());
$this->setRedirect(JRoute::_('index.php?option=com_privacy&view=remind',
false), $message, 'notice');
return false;
}
else
{
// Confirm succeeded.
$this->setRedirect(JRoute::_(JUri::root()),
JText::_('COM_PRIVACY_CONFIRM_REMIND_SUCCEEDED'),
'info');
return true;
}
}
}
PK�F�[��s�iicom_privacy/models/confirm.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @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;
/**
* Request confirmation model class.
*
* @since 3.9.0
*/
class PrivacyModelConfirm extends JModelAdmin
{
/**
* Confirms the information request.
*
* @param array $data The data expected for the form.
*
* @return mixed Exception | JException | boolean
*
* @since 3.9.0
*/
public function confirmRequest($data)
{
// Get the form.
$form = $this->getForm();
// Check for an error.
if ($form instanceof Exception)
{
return $form;
}
// Filter and validate the form data.
$data = $form->filter($data);
$return = $form->validate($data);
// Check for an error.
if ($return instanceof Exception)
{
return $return;
}
// Check the validation results.
if ($return === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $formError)
{
$this->setError($formError->getMessage());
}
return false;
}
// Get the user email address
$data['email'] = JFactory::getUser()->email;
// Search for the information request
/** @var PrivacyTableRequest $table */
$table = $this->getTable();
if (!$table->load(array('email' =>
$data['email'], 'status' => 0)))
{
$this->setError(JText::_('COM_PRIVACY_ERROR_NO_PENDING_REQUESTS'));
return false;
}
// A request can only be confirmed if it is in a pending status and has a
confirmation token
if ($table->status != '0' || !$table->confirm_token)
{
$this->setError(JText::_('COM_PRIVACY_ERROR_NO_PENDING_REQUESTS'));
return false;
}
// A request can only be confirmed if the token is less than 24 hours old
$confirmTokenCreatedAt = new JDate($table->confirm_token_created_at);
$confirmTokenCreatedAt->add(new DateInterval('P1D'));
$now = new JDate('now');
if ($now > $confirmTokenCreatedAt)
{
// Invalidate the request
$table->status = -1;
$table->confirm_token = '';
try
{
$table->store();
}
catch (JDatabaseException $exception)
{
// The error will be logged in the database API, we just need to catch
it here to not let things fatal out
}
$this->setError(JText::_('COM_PRIVACY_ERROR_CONFIRM_TOKEN_EXPIRED'));
return false;
}
// Verify the token
if (!JUserHelper::verifyPassword($data['confirm_token'],
$table->confirm_token))
{
$this->setError(JText::_('COM_PRIVACY_ERROR_NO_PENDING_REQUESTS'));
return false;
}
// Everything is good to go, transition the request to confirmed
$saved = $this->save(
array(
'id' => $table->id,
'status' => 1,
'confirm_token' => '',
)
);
if (!$saved)
{
// Error was set by the save method
return false;
}
// Push a notification to the site's super users, deliberately
ignoring if this process fails so the below message goes out
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR .
'/components/com_messages/models', 'MessagesModel');
JTable::addIncludePath(JPATH_ADMINISTRATOR .
'/components/com_messages/tables');
/** @var MessagesModelMessage $messageModel */
$messageModel = JModelLegacy::getInstance('Message',
'MessagesModel');
$messageModel->notifySuperUsers(
JText::_('COM_PRIVACY_ADMIN_NOTIFICATION_USER_CONFIRMED_REQUEST_SUBJECT'),
JText::sprintf('COM_PRIVACY_ADMIN_NOTIFICATION_USER_CONFIRMED_REQUEST_MESSAGE',
$table->email)
);
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR .
'/components/com_actionlogs/models',
'ActionlogsModel');
$message = array(
'action' => 'request-confirmed',
'subjectemail' => $table->email,
'id' => $table->id,
'itemlink' =>
'index.php?option=com_privacy&view=request&id=' .
$table->id,
);
/** @var ActionlogsModelActionlog $model */
$model = JModelLegacy::getInstance('Actionlog',
'ActionlogsModel');
$model->addLog(array($message),
'COM_PRIVACY_ACTION_LOG_CONFIRMED_REQUEST',
'com_privacy.request');
return true;
}
/**
* Method for getting the form from the model.
*
* @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 JForm|boolean A JForm object on success, false on failure
*
* @since 3.9.0
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_privacy.confirm',
'confirm', array('control' => 'jform'));
if (empty($form))
{
return false;
}
$input = JFactory::getApplication()->input;
if ($input->getMethod() === 'GET')
{
$form->setValue('confirm_token', '',
$input->get->getAlnum('confirm_token'));
}
return $form;
}
/**
* Method to get a table object, load it if necessary.
*
* @param string $name The table name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $options Configuration array for model. Optional.
*
* @return JTable A JTable object
*
* @since 3.9.0
* @throws \Exception
*/
public function getTable($name = 'Request', $prefix =
'PrivacyTable', $options = array())
{
return parent::getTable($name, $prefix, $options);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
*
* @since 3.9.0
*/
protected function populateState()
{
// Get the application object.
$params =
JFactory::getApplication()->getParams('com_privacy');
// Load the parameters.
$this->setState('params', $params);
}
}
PK�F�[��f$oo$com_privacy/models/forms/confirm.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default"
label="COM_PRIVACY_CONFIRM_REQUEST_FIELDSET_LABEL">
<field
name="confirm_token"
type="text"
label="COM_PRIVACY_FIELD_CONFIRM_CONFIRM_TOKEN_LABEL"
description="COM_PRIVACY_FIELD_CONFIRM_CONFIRM_TOKEN_DESC"
filter="alnum"
required="true"
size="32"
/>
</fieldset>
</form>
PK�F�[�P�#com_privacy/models/forms/remind.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default"
label="COM_PRIVACY_REMIND_REQUEST_FIELDSET_LABEL">
<field
name="email"
type="text"
label="JGLOBAL_EMAIL"
description="COM_PRIVACY_FIELD_CONFIRM_EMAIL_DESC"
validate="email"
required="true"
size="30"
/>
<field
name="remind_token"
type="text"
label="COM_PRIVACY_FIELD_REMIND_CONFIRM_TOKEN_LABEL"
description="COM_PRIVACY_FIELD_REMIND_CONFIRM_TOKEN_DESC"
filter="alnum"
required="true"
size="32"
/>
</fieldset>
</form>
PK�F�[�����$com_privacy/models/forms/request.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default">
<field
name="request_type"
type="list"
label="COM_PRIVACY_FIELD_REQUEST_TYPE_LABEL"
description="COM_PRIVACY_FIELD_REQUEST_TYPE_DESC"
filter="string"
default="export"
validate="options"
>
<option
value="export">COM_PRIVACY_REQUEST_TYPE_EXPORT</option>
<option
value="remove">COM_PRIVACY_REQUEST_TYPE_REMOVE</option>
</field>
</fieldset>
</form>
PK�F�[��Ym--com_privacy/models/remind.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @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;
/**
* Remind confirmation model class.
*
* @since 3.9.0
*/
class PrivacyModelRemind extends JModelAdmin
{
/**
* Confirms the remind request.
*
* @param array $data The data expected for the form.
*
* @return mixed Exception | JException | boolean
*
* @since 3.9.0
*/
public function remindRequest($data)
{
// Get the form.
$form = $this->getForm();
$data['email'] =
JStringPunycode::emailToPunycode($data['email']);
// Check for an error.
if ($form instanceof Exception)
{
return $form;
}
// Filter and validate the form data.
$data = $form->filter($data);
$return = $form->validate($data);
// Check for an error.
if ($return instanceof Exception)
{
return $return;
}
// Check the validation results.
if ($return === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $formError)
{
$this->setError($formError->getMessage());
}
return false;
}
/** @var PrivacyTableConsent $table */
$table = $this->getTable();
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(array('r.id',
'r.user_id', 'r.token')));
$query->from($db->quoteName('#__privacy_consents',
'r'));
$query->join('LEFT', $db->quoteName('#__users',
'u') . ' ON u.id = r.user_id');
$query->where($db->quoteName('u.email') . ' = '
. $db->quote($data['email']));
$query->where($db->quoteName('r.remind') . ' =
1');
$db->setQuery($query);
try
{
$remind = $db->loadObject();
}
catch (RuntimeException $e)
{
$this->setError(JText::_('COM_PRIVACY_ERROR_NO_PENDING_REMIND'));
return false;
}
if (!$remind)
{
$this->setError(JText::_('COM_PRIVACY_ERROR_NO_PENDING_REMIND'));
return false;
}
// Verify the token
if (!JUserHelper::verifyPassword($data['remind_token'],
$remind->token))
{
$this->setError(JText::_('COM_PRIVACY_ERROR_NO_REMIND_REQUESTS'));
return false;
}
// Everything is good to go, transition the request to extended
$saved = $this->save(
array(
'id' => $remind->id,
'remind' => 0,
'token' => '',
'created' => JFactory::getDate()->toSql(),
)
);
if (!$saved)
{
// Error was set by the save method
return false;
}
return true;
}
/**
* Method for getting the form from the model.
*
* @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 JForm|boolean A JForm object on success, false on failure
*
* @since 3.9.0
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_privacy.remind',
'remind', array('control' => 'jform'));
if (empty($form))
{
return false;
}
$input = JFactory::getApplication()->input;
if ($input->getMethod() === 'GET')
{
$form->setValue('remind_token', '',
$input->get->getAlnum('remind_token'));
}
return $form;
}
/**
* Method to get a table object, load it if necessary.
*
* @param string $name The table name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $options Configuration array for model. Optional.
*
* @return JTable A JTable object
*
* @since 3.9.0
* @throws \Exception
*/
public function getTable($name = 'Consent', $prefix =
'PrivacyTable', $options = array())
{
return parent::getTable($name, $prefix, $options);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
*
* @since 3.9.0
*/
protected function populateState()
{
// Get the application object.
$params =
JFactory::getApplication()->getParams('com_privacy');
// Load the parameters.
$this->setState('params', $params);
}
}
PK�F�[��[[com_privacy/models/request.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @copyright (C) 2018 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Router\Route;
/**
* Request model class.
*
* @since 3.9.0
*/
class PrivacyModelRequest extends JModelAdmin
{
/**
* Creates an information request.
*
* @param array $data The data expected for the form.
*
* @return mixed Exception | JException | boolean
*
* @since 3.9.0
*/
public function createRequest($data)
{
// Creating requests requires the site's email sending be enabled
if (!JFactory::getConfig()->get('mailonline', 1))
{
$this->setError(JText::_('COM_PRIVACY_ERROR_CANNOT_CREATE_REQUEST_WHEN_SENDMAIL_DISABLED'));
return false;
}
// Get the form.
$form = $this->getForm();
// Check for an error.
if ($form instanceof Exception)
{
return $form;
}
// Filter and validate the form data.
$data = $form->filter($data);
$return = $form->validate($data);
// Check for an error.
if ($return instanceof Exception)
{
return $return;
}
// Check the validation results.
if ($return === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $formError)
{
$this->setError($formError->getMessage());
}
return false;
}
// Get the user email address
$data['email'] = JFactory::getUser()->email;
// Search for an open information request matching the email and type
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('COUNT(id)')
->from('#__privacy_requests')
->where('email = ' .
$db->quote($data['email']))
->where('request_type = ' .
$db->quote($data['request_type']))
->where('status IN (0, 1)');
try
{
$result = (int) $db->setQuery($query)->loadResult();
}
catch (JDatabaseException $exception)
{
// Can't check for existing requests, so don't create a new
one
$this->setError(JText::_('COM_PRIVACY_ERROR_CHECKING_FOR_EXISTING_REQUESTS'));
return false;
}
if ($result > 0)
{
$this->setError(JText::_('COM_PRIVACY_ERROR_PENDING_REQUEST_OPEN'));
return false;
}
// Everything is good to go, create the request
$token =
JApplicationHelper::getHash(JUserHelper::genRandomPassword());
$hashedToken = JUserHelper::hashPassword($token);
$data['confirm_token'] = $hashedToken;
$data['confirm_token_created_at'] =
JFactory::getDate()->toSql();
if (!$this->save($data))
{
// The save function will set the error message, so just return here
return false;
}
// Push a notification to the site's super users, deliberately
ignoring if this process fails so the below message goes out
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR .
'/components/com_messages/models', 'MessagesModel');
JTable::addIncludePath(JPATH_ADMINISTRATOR .
'/components/com_messages/tables');
/** @var MessagesModelMessage $messageModel */
$messageModel = JModelLegacy::getInstance('Message',
'MessagesModel');
$messageModel->notifySuperUsers(
JText::_('COM_PRIVACY_ADMIN_NOTIFICATION_USER_CREATED_REQUEST_SUBJECT'),
JText::sprintf('COM_PRIVACY_ADMIN_NOTIFICATION_USER_CREATED_REQUEST_MESSAGE',
$data['email'])
);
// The mailer can be set to either throw Exceptions or return boolean
false, account for both
try
{
$app = JFactory::getApplication();
$linkMode = $app->get('force_ssl', 0) == 2 ?
Route::TLS_FORCE : Route::TLS_IGNORE;
$substitutions = array(
'[SITENAME]' => $app->get('sitename'),
'[URL]' => JUri::root(),
'[TOKENURL]' => JRoute::link('site',
'index.php?option=com_privacy&view=confirm&confirm_token='
. $token, false, $linkMode, true),
'[FORMURL]' => JRoute::link('site',
'index.php?option=com_privacy&view=confirm', false,
$linkMode, true),
'[TOKEN]' => $token,
'\\n' => "\n",
);
switch ($data['request_type'])
{
case 'export':
$emailSubject =
JText::_('COM_PRIVACY_EMAIL_REQUEST_SUBJECT_EXPORT_REQUEST');
$emailBody =
JText::_('COM_PRIVACY_EMAIL_REQUEST_BODY_EXPORT_REQUEST');
break;
case 'remove':
$emailSubject =
JText::_('COM_PRIVACY_EMAIL_REQUEST_SUBJECT_REMOVE_REQUEST');
$emailBody =
JText::_('COM_PRIVACY_EMAIL_REQUEST_BODY_REMOVE_REQUEST');
break;
default:
$this->setError(JText::_('COM_PRIVACY_ERROR_UNKNOWN_REQUEST_TYPE'));
return false;
}
foreach ($substitutions as $k => $v)
{
$emailSubject = str_replace($k, $v, $emailSubject);
$emailBody = str_replace($k, $v, $emailBody);
}
$mailer = JFactory::getMailer();
$mailer->setSubject($emailSubject);
$mailer->setBody($emailBody);
$mailer->addRecipient($data['email']);
$mailResult = $mailer->Send();
if ($mailResult instanceof JException)
{
// JError was already called so we just need to return now
return false;
}
elseif ($mailResult === false)
{
$this->setError($mailer->ErrorInfo);
return false;
}
/** @var PrivacyTableRequest $table */
$table = $this->getTable();
if (!$table->load($this->getState($this->getName() .
'.id')))
{
$this->setError($table->getError());
return false;
}
// Log the request's creation
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR .
'/components/com_actionlogs/models',
'ActionlogsModel');
$message = array(
'action' => 'request-created',
'requesttype' => $table->request_type,
'subjectemail' => $table->email,
'id' => $table->id,
'itemlink' =>
'index.php?option=com_privacy&view=request&id=' .
$table->id,
);
/** @var ActionlogsModelActionlog $model */
$model = JModelLegacy::getInstance('Actionlog',
'ActionlogsModel');
$model->addLog(array($message),
'COM_PRIVACY_ACTION_LOG_CREATED_REQUEST',
'com_privacy.request');
// The email sent and the record is saved, everything is good to go from
here
return true;
}
catch (phpmailerException $exception)
{
$this->setError($exception->getMessage());
return false;
}
}
/**
* Method for getting the form from the model.
*
* @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 JForm|boolean A JForm object on success, false on failure
*
* @since 3.9.0
*/
public function getForm($data = array(), $loadData = true)
{
return $this->loadForm('com_privacy.request',
'request', array('control' => 'jform'));
}
/**
* Method to get a table object, load it if necessary.
*
* @param string $name The table name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $options Configuration array for model. Optional.
*
* @return JTable A JTable object
*
* @since 3.9.0
* @throws \Exception
*/
public function getTable($name = 'Request', $prefix =
'PrivacyTable', $options = array())
{
return parent::getTable($name, $prefix, $options);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
*
* @since 3.9.0
*/
protected function populateState()
{
// Get the application object.
$params =
JFactory::getApplication()->getParams('com_privacy');
// Load the parameters.
$this->setState('params', $params);
}
}
PK�F�[oxV���com_privacy/privacy.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @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;
$controller = JControllerLegacy::getInstance('Privacy');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
PK�F�[@<�?��com_privacy/router.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @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;
/**
* Routing class from com_privacy
*
* @since 3.9.0
*/
class PrivacyRouter extends JComponentRouterView
{
/**
* Privacy Component router constructor
*
* @param JApplicationCms $app The application object
* @param JMenu $menu The menu object to work with
*
* @since 3.9.0
*/
public function __construct($app = null, $menu = null)
{
$this->registerView(new
JComponentRouterViewconfiguration('confirm'));
$this->registerView(new
JComponentRouterViewconfiguration('request'));
$this->registerView(new
JComponentRouterViewconfiguration('remind'));
parent::__construct($app, $menu);
$this->attachRule(new JComponentRouterRulesMenu($this));
$this->attachRule(new JComponentRouterRulesStandard($this));
$this->attachRule(new JComponentRouterRulesNomenu($this));
}
}
/**
* Privacy router functions
*
* These functions are proxies for the new router interface
* for old SEF extensions.
*
* @param array &$query REQUEST query
*
* @return array Segments of the SEF url
*
* @since 3.9.0
* @deprecated 4.0 Use Class based routers instead
*/
function privacyBuildRoute(&$query)
{
$app = JFactory::getApplication();
$router = new PrivacyRouter($app, $app->getMenu());
return $router->build($query);
}
/**
* Convert SEF URL segments into query variables
*
* @param array $segments Segments in the current URL
*
* @return array Query variables
*
* @since 3.9.0
* @deprecated 4.0 Use Class based routers instead
*/
function privacyParseRoute($segments)
{
$app = JFactory::getApplication();
$router = new PrivacyRouter($app, $app->getMenu());
return $router->parse($segments);
}
PK�F�[zA��66*com_privacy/views/confirm/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @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;
/** @var PrivacyViewConfirm $this */
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
?>
<div class="request-confirm<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<form action="<?php echo
JRoute::_('index.php?option=com_privacy&task=request.confirm');
?>" method="post" class="form-validate
form-horizontal well">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<fieldset>
<?php if (!empty($fieldset->label)) : ?>
<legend><?php echo JText::_($fieldset->label);
?></legend>
<?php endif; ?>
<?php echo $this->form->renderFieldset($fieldset->name);
?>
</fieldset>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary
validate">
<?php echo JText::_('JSUBMIT'); ?>
</button>
</div>
</div>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
PK�F�[���EE*com_privacy/views/confirm/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_PRIVACY_CONFIRM_VIEW_DEFAULT_TITLE"
option="COM_PRIVACY_CONFIRM_VIEW_DEFAULT_OPTION">
<help
key="JHELP_MENUS_MENU_ITEM_PRIVACY_CONFIRM_REQUEST"
/>
<message>
<![CDATA[COM_PRIVACY_CONFIRM_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
PK�F�[�z�<��'com_privacy/views/confirm/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @copyright (C) 2018 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
/**
* Request confirmation view class
*
* @since 3.9.0
*/
class PrivacyViewConfirm extends JViewLegacy
{
/**
* The form object
*
* @var JForm
* @since 3.9.0
*/
protected $form;
/**
* The CSS class suffix to append to the view container
*
* @var string
* @since 3.9.0
*/
protected $pageclass_sfx;
/**
* The view parameters
*
* @var Registry
* @since 3.9.0
*/
protected $params;
/**
* The state information
*
* @var JObject
* @since 3.9.0
*/
protected $state;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @see JViewLegacy::loadTemplate()
* @since 3.9.0
* @throws Exception
*/
public function display($tpl = null)
{
// Initialise variables.
$this->form = $this->get('Form');
$this->state = $this->get('State');
$this->params = $this->state->params;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($this->params->get('pageclass_sfx',
''), ENT_COMPAT, 'UTF-8');
$this->prepareDocument();
return parent::display($tpl);
}
/**
* Prepares the document.
*
* @return void
*
* @since 3.9.0
*/
protected function prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_PRIVACY_VIEW_CONFIRM_PAGE_TITLE'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
}
PK�F�[εd44)com_privacy/views/remind/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @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;
/** @var PrivacyViewConfirm $this */
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
?>
<div class="remind-confirm<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<form action="<?php echo
JRoute::_('index.php?option=com_privacy&task=request.remind');
?>" method="post" class="form-validate
form-horizontal well">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<fieldset>
<?php if (!empty($fieldset->label)) : ?>
<legend><?php echo JText::_($fieldset->label);
?></legend>
<?php endif; ?>
<?php echo $this->form->renderFieldset($fieldset->name);
?>
</fieldset>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary
validate">
<?php echo JText::_('JSUBMIT'); ?>
</button>
</div>
</div>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
PK�F�[`A��AA)com_privacy/views/remind/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_PRIVACY_REMIND_VIEW_DEFAULT_TITLE"
option="COM_PRIVACY_REMIND_VIEW_DEFAULT_OPTION">
<help
key="JHELP_MENUS_MENU_ITEM_PRIVACY_REMIND_REQUEST"
/>
<message>
<![CDATA[COM_PRIVACY_REMIND_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
PK�F�[��i��&com_privacy/views/remind/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @copyright (C) 2018 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
/**
* Remind confirmation view class
*
* @since 3.9.0
*/
class PrivacyViewRemind extends JViewLegacy
{
/**
* The form object
*
* @var JForm
* @since 3.9.0
*/
protected $form;
/**
* The CSS class suffix to append to the view container
*
* @var string
* @since 3.9.0
*/
protected $pageclass_sfx;
/**
* The view parameters
*
* @var Registry
* @since 3.9.0
*/
protected $params;
/**
* The state information
*
* @var JObject
* @since 3.9.0
*/
protected $state;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @see JViewLegacy::loadTemplate()
* @since 3.9.0
* @throws Exception
*/
public function display($tpl = null)
{
// Initialise variables.
$this->form = $this->get('Form');
$this->state = $this->get('State');
$this->params = $this->state->params;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($this->params->get('pageclass_sfx',
''), ENT_COMPAT, 'UTF-8');
$this->prepareDocument();
return parent::display($tpl);
}
/**
* Prepares the document.
*
* @return void
*
* @since 3.9.0
*/
protected function prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_PRIVACY_VIEW_REMIND_PAGE_TITLE'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
}
PK�F�[�)x:LL*com_privacy/views/request/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @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;
/** @var PrivacyViewRequest $this */
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
?>
<div class="request-form<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<?php if ($this->sendMailEnabled) : ?>
<form action="<?php echo
JRoute::_('index.php?option=com_privacy&task=request.submit');
?>" method="post" class="form-validate
form-horizontal well">
<?php foreach ($this->form->getFieldsets() as $fieldset) :
?>
<fieldset>
<?php if (!empty($fieldset->label)) : ?>
<legend><?php echo JText::_($fieldset->label);
?></legend>
<?php endif; ?>
<?php echo $this->form->renderFieldset($fieldset->name);
?>
</fieldset>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary
validate">
<?php echo JText::_('JSUBMIT'); ?>
</button>
</div>
</div>
<?php echo JHtml::_('form.token'); ?>
</form>
<?php else : ?>
<div class="alert alert-warning">
<p><?php echo
JText::_('COM_PRIVACY_WARNING_CANNOT_CREATE_REQUEST_WHEN_SENDMAIL_DISABLED');
?></p>
</div>
<?php endif; ?>
</div>
PK�F�[
���DD*com_privacy/views/request/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_PRIVACY_REQUEST_VIEW_DEFAULT_TITLE"
option="COM_PRIVACY_REQUEST_VIEW_DEFAULT_OPTION">
<help
key="JHELP_MENUS_MENU_ITEM_PRIVACY_CREATE_REQUEST"
/>
<message>
<![CDATA[COM_PRIVACY_REQUEST_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
PK�F�[�T-Y��'com_privacy/views/request/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_privacy
*
* @copyright (C) 2018 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
/**
* Request view class
*
* @since 3.9.0
*/
class PrivacyViewRequest extends JViewLegacy
{
/**
* The form object
*
* @var JForm
* @since 3.9.0
*/
protected $form;
/**
* The CSS class suffix to append to the view container
*
* @var string
* @since 3.9.0
*/
protected $pageclass_sfx;
/**
* The view parameters
*
* @var Registry
* @since 3.9.0
*/
protected $params;
/**
* Flag indicating the site supports sending email
*
* @var boolean
* @since 3.9.0
*/
protected $sendMailEnabled;
/**
* The state information
*
* @var JObject
* @since 3.9.0
*/
protected $state;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @see JViewLegacy::loadTemplate()
* @since 3.9.0
* @throws Exception
*/
public function display($tpl = null)
{
// Initialise variables.
$this->form = $this->get('Form');
$this->state = $this->get('State');
$this->params = $this->state->params;
$this->sendMailEnabled = (bool)
JFactory::getConfig()->get('mailonline', 1);
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($this->params->get('pageclass_sfx',
''), ENT_COMPAT, 'UTF-8');
$this->prepareDocument();
return parent::display($tpl);
}
/**
* Prepares the document.
*
* @return void
*
* @since 3.9.0
*/
protected function prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_PRIVACY_VIEW_REQUEST_PAGE_TITLE'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
}
PK�F�[P٣���com_search/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_search
*
* @copyright (C) 2007 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Search Component Controller
*
* @since 1.5
*/
class SearchController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param bool $cachable If true, the view output will be cached
* @param bool $urlparams An array of safe URL parameters and their
variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JControllerLegacy This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
// Force it to be the search view
$this->input->set('view', 'search');
return parent::display($cachable, $urlparams);
}
/**
* Search
*
* @return void
*
* @throws Exception
*/
public function search()
{
// Slashes cause errors, <> get stripped anyway later on. # causes
problems.
$badchars = array('#', '>', '<',
'\\');
$searchword = trim(str_replace($badchars, '',
$this->input->post->getString('searchword')));
// If searchword enclosed in double quotes, strip quotes and do exact
match
if (substr($searchword, 0, 1) === '"' &&
substr($searchword, -1) === '"')
{
$post['searchword'] = substr($searchword, 1, -1);
$this->input->set('searchphrase', 'exact');
}
else
{
$post['searchword'] = $searchword;
}
$post['ordering'] =
$this->input->post->getWord('ordering');
$post['searchphrase'] =
$this->input->post->getWord('searchphrase',
'all');
$post['limit'] =
$this->input->post->getUInt('limit');
if ($post['limit'] === null)
{
unset($post['limit']);
}
$areas = $this->input->post->get('areas', null,
'array');
if ($areas)
{
foreach ($areas as $area)
{
$post['areas'][] =
JFilterInput::getInstance()->clean($area, 'cmd');
}
}
// The Itemid from the request, we will use this if it's a search
page or if there is no search page available
$post['Itemid'] =
$this->input->getInt('Itemid');
// Set Itemid id for links from menu
$app = JFactory::getApplication();
$menu = $app->getMenu();
$item = $menu->getItem($post['Itemid']);
// The requested Item is not a search page so we need to find one
if ($item && ($item->component !== 'com_search' ||
$item->query['view'] !== 'search'))
{
// Get item based on component, not link. link is not reliable.
$item = $menu->getItems('component',
'com_search', true);
// If we found a search page, use that.
if (!empty($item))
{
$post['Itemid'] = $item->id;
}
}
unset($post['task'], $post['submit']);
$uri = JUri::getInstance();
$uri->setQuery($post);
$uri->setVar('option', 'com_search');
$this->setRedirect(JRoute::_('index.php' .
$uri->toString(array('query', 'fragment')), false));
}
}
PK�F�[
�66com_search/models/search.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_search
*
* @copyright (C) 2007 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Search Component Search Model
*
* @since 1.5
*/
class SearchModelSearch extends JModelLegacy
{
/**
* Search data array
*
* @var array
*/
protected $_data = null;
/**
* Search total
*
* @var integer
*/
protected $_total = null;
/**
* Search areas
*
* @var integer
*/
protected $_areas = null;
/**
* Pagination object
*
* @var object
*/
protected $_pagination = null;
/**
* Constructor
*
* @since 1.5
*/
public function __construct()
{
parent::__construct();
// Get configuration
$app = JFactory::getApplication();
$config = JFactory::getConfig();
// Get the pagination request variables
$this->setState('limit',
$app->getUserStateFromRequest('com_search.limit',
'limit', $config->get('list_limit'),
'uint'));
$this->setState('limitstart',
$app->input->get('limitstart', 0, 'uint'));
// Get parameters.
$params = $app->getParams();
if ($params->get('searchphrase') == 1)
{
$searchphrase = 'any';
}
elseif ($params->get('searchphrase') == 2)
{
$searchphrase = 'exact';
}
else
{
$searchphrase = 'all';
}
// Set the search parameters
$keyword =
urldecode($app->input->getString('searchword'));
$match = $app->input->get('searchphrase',
$searchphrase, 'word');
$ordering = $app->input->get('ordering',
$params->get('ordering', 'newest'),
'word');
$this->setSearch($keyword, $match, $ordering);
// Set the search areas
$areas = $app->input->get('areas', null,
'array');
$this->setAreas($areas);
}
/**
* Method to set the search parameters
*
* @param string $keyword string search string
* @param string $match matching option, exact|any|all
* @param string $ordering option,
newest|oldest|popular|alpha|category
*
* @access public
*
* @return void
*/
public function setSearch($keyword, $match = 'all', $ordering =
'newest')
{
if (isset($keyword))
{
$this->setState('origkeyword', $keyword);
if ($match !== 'exact')
{
$keyword = preg_replace('#\xE3\x80\x80#', ' ',
$keyword);
}
$this->setState('keyword', $keyword);
}
if (isset($match))
{
$this->setState('match', $match);
}
if (isset($ordering))
{
$this->setState('ordering', $ordering);
}
}
/**
* Method to get weblink item data for the category
*
* @access public
* @return array
*/
public function getData()
{
// Lets load the content if it doesn't already exist
if (empty($this->_data))
{
$areas = $this->getAreas();
JPluginHelper::importPlugin('search');
$dispatcher = JEventDispatcher::getInstance();
$results = $dispatcher->trigger('onContentSearch', array(
$this->getState('keyword'),
$this->getState('match'),
$this->getState('ordering'),
$areas['active'])
);
$rows = array();
foreach ($results as $result)
{
$rows = array_merge((array) $rows, (array) $result);
}
$this->_total = count($rows);
if ($this->getState('limit') > 0)
{
$this->_data = array_splice($rows,
$this->getState('limitstart'),
$this->getState('limit'));
}
else
{
$this->_data = $rows;
}
}
return $this->_data;
}
/**
* Method to get the total number of weblink items for the category
*
* @access public
*
* @return integer
*/
public function getTotal()
{
return $this->_total;
}
/**
* Method to set the search areas
*
* @param array $active areas
* @param array $search areas
*
* @return void
*
* @access public
*/
public function setAreas($active = array(), $search = array())
{
$this->_areas['active'] = $active;
$this->_areas['search'] = $search;
}
/**
* Method to get a pagination object of the weblink items for the category
*
* @access public
* @return integer
*/
public function getPagination()
{
// Lets load the content if it doesn't already exist
if (empty($this->_pagination))
{
$this->_pagination = new JPagination($this->getTotal(),
$this->getState('limitstart'),
$this->getState('limit'));
}
return $this->_pagination;
}
/**
* Method to get the search areas
*
* @return integer
*
* @since 1.5
*/
public function getAreas()
{
// Load the Category data
if (empty($this->_areas['search']))
{
$areas = array();
JPluginHelper::importPlugin('search');
$dispatcher = JEventDispatcher::getInstance();
$searchareas =
$dispatcher->trigger('onContentSearchAreas');
foreach ($searchareas as $area)
{
if (is_array($area))
{
$areas = array_merge($areas, $area);
}
}
$this->_areas['search'] = $areas;
}
return $this->_areas;
}
}
PK�F�[���,!!com_search/router.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_search
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Routing class from com_search
*
* @since 3.3
*/
class SearchRouter extends JComponentRouterBase
{
/**
* Build the route for the com_search component
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent
URL.
*
* @since 3.3
*/
public function build(&$query)
{
$segments = array();
if (isset($query['view']))
{
unset($query['view']);
}
return $segments;
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
$vars = array();
// Fix up search for URL
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
// Urldecode twice because it is encoded twice
$segments[$i] = urldecode(urldecode(stripcslashes($segments[$i])));
}
$searchword = array_shift($segments);
$vars['searchword'] = $searchword;
$vars['view'] = 'search';
return $vars;
}
}
/**
* searchBuildRoute
*
* These functions are proxies for the new router interface
* for old SEF extensions.
*
* @param array &$query An array of URL arguments
*
* @return array
*
* @deprecated 4.0 Use Class based routers instead
*/
function searchBuildRoute(&$query)
{
$router = new SearchRouter;
return $router->build($query);
}
/**
* searchParseRoute
*
* These functions are proxies for the new router interface
* for old SEF extensions.
*
* @param array $segments The segments of the URL to parse.
*
* @return array
*
* @deprecated 4.0 Use Class based routers instead
*/
function searchParseRoute($segments)
{
$router = new SearchRouter;
return $router->parse($segments);
}
PK�F�[-Ll��com_search/search.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_search
*
* @copyright (C) 2005 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
$controller = JControllerLegacy::getInstance('Search');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
PK�F�[;����(com_search/views/search/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_search
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<div class="search<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<h1 class="page-title">
<?php if
($this->escape($this->params->get('page_heading'))) :
?>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
<?php else : ?>
<?php echo
$this->escape($this->params->get('page_title')); ?>
<?php endif; ?>
</h1>
<?php endif; ?>
<?php echo $this->loadTemplate('form'); ?>
<?php if ($this->error == null && count($this->results)
> 0) : ?>
<?php echo $this->loadTemplate('results'); ?>
<?php else : ?>
<?php echo $this->loadTemplate('error'); ?>
<?php endif; ?>
</div>
PK�F�[:a�yN
N
(com_search/views/search/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_SEARCH_SEARCH_VIEW_DEFAULT_TITLE"
option="COM_SEARCH_SEARCH_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_SEARCH_RESULTS"
/>
<message>
<![CDATA[COM_SEARCH_SEARCH_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
label="COM_SEARCH_FIELDSET_OPTIONAL_LABEL">
<field
name="searchword"
type="text"
label="COM_SEARCH_FIELD_LABEL"
description="COM_SEARCH_FIELD_DESC"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<!-- Basic options. -->
<fieldset name="basic"
label="COM_MENUS_BASIC_FIELDSET_LABEL">
<field
name="search_phrases"
type="list"
label="COM_SEARCH_FIELD_SEARCH_PHRASES_LABEL"
description="COM_SEARCH_FIELD_SEARCH_PHRASES_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="search_areas"
type="list"
label="COM_SEARCH_FIELD_SEARCH_AREAS_LABEL"
description="COM_SEARCH_FIELD_SEARCH_AREAS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_date"
type="list"
label="COM_SEARCH_CONFIG_FIELD_CREATED_DATE_LABEL"
description="COM_SEARCH_CONFIG_FIELD_CREATED_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="spacer1"
type="spacer"
label="COM_SEARCH_SAVED_SEARCH_OPTIONS"
class="text"
/>
<!-- Add fields to define saved search. -->
<field
name="searchphrase"
type="list"
label="COM_SEARCH_FOR_LABEL"
description="COM_SEARCH_FOR_DESC"
default="0"
>
<option value="0">COM_SEARCH_ALL_WORDS</option>
<option value="1">COM_SEARCH_ANY_WORDS</option>
<option
value="2">COM_SEARCH_EXACT_PHRASE</option>
</field>
<field
name="ordering"
type="list"
label="COM_SEARCH_ORDERING_LABEL"
description="COM_SEARCH_ORDERING_DESC"
default="newest"
>
<option
value="newest">COM_SEARCH_NEWEST_FIRST</option>
<option
value="oldest">COM_SEARCH_OLDEST_FIRST</option>
<option
value="popular">COM_SEARCH_MOST_POPULAR</option>
<option
value="alpha">COM_SEARCH_ALPHABETICAL</option>
<option value="category">JCATEGORY</option>
</field>
</fieldset>
</fields>
</metadata>
PK�F�[(�Myy.com_search/views/search/tmpl/default_error.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_search
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<?php if ($this->error) : ?>
<div class="error">
<?php echo $this->escape($this->error); ?>
</div>
<?php endif; ?>
PK�F�[HT7�44-com_search/views/search/tmpl/default_form.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_search
*
* @copyright (C) 2006 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::_('bootstrap.tooltip');
$lang = JFactory::getLanguage();
$upper_limit = $lang->getUpperLimitSearchWord();
?>
<form id="searchForm" action="<?php echo
JRoute::_('index.php?option=com_search'); ?>"
method="post">
<div class="btn-toolbar">
<div class="btn-group pull-left">
<label for="search-searchword"
class="element-invisible">
<?php echo JText::_('COM_SEARCH_SEARCH_KEYWORD'); ?>
</label>
<input type="text" name="searchword"
title="<?php echo JText::_('COM_SEARCH_SEARCH_KEYWORD');
?>" placeholder="<?php echo
JText::_('COM_SEARCH_SEARCH_KEYWORD'); ?>"
id="search-searchword" size="30"
maxlength="<?php echo $upper_limit; ?>"
value="<?php echo $this->escape($this->origkeyword);
?>" class="inputbox" />
</div>
<div class="btn-group pull-left">
<button name="Search"
onclick="this.form.submit()" class="btn hasTooltip"
title="<?php echo JHtml::_('tooltipText',
'COM_SEARCH_SEARCH');?>">
<span class="icon-search"></span>
<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>
</button>
</div>
<input type="hidden" name="task"
value="search" />
<div class="clearfix"></div>
</div>
<div class="searchintro<?php echo
$this->params->get('pageclass_sfx', '');
?>">
<?php if (!empty($this->searchword)) : ?>
<p>
<?php echo
JText::plural('COM_SEARCH_SEARCH_KEYWORD_N_RESULTS',
'<span class="badge badge-info">' .
$this->total . '</span>'); ?>
</p>
<?php endif; ?>
</div>
<?php if ($this->params->get('search_phrases', 1)) :
?>
<fieldset class="phrases">
<legend>
<?php echo JText::_('COM_SEARCH_FOR'); ?>
</legend>
<div class="phrases-box">
<?php echo $this->lists['searchphrase']; ?>
</div>
<div class="ordering-box">
<label for="ordering" class="ordering">
<?php echo JText::_('COM_SEARCH_ORDERING'); ?>
</label>
<?php echo $this->lists['ordering']; ?>
</div>
</fieldset>
<?php endif; ?>
<?php if ($this->params->get('search_areas', 1)) :
?>
<fieldset class="only">
<legend>
<?php echo JText::_('COM_SEARCH_SEARCH_ONLY'); ?>
</legend>
<?php foreach ($this->searchareas['search'] as $val
=> $txt) : ?>
<?php $checked = is_array($this->searchareas['active'])
&& in_array($val, $this->searchareas['active']) ?
'checked="checked"' : ''; ?>
<label for="area-<?php echo $val; ?>"
class="checkbox">
<input type="checkbox" name="areas[]"
value="<?php echo $val; ?>" id="area-<?php echo
$val; ?>" <?php echo $checked; ?> />
<?php echo JText::_($txt); ?>
</label>
<?php endforeach; ?>
</fieldset>
<?php endif; ?>
<?php if ($this->total > 0) : ?>
<div class="form-limit">
<label for="limit">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<p class="counter">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
</form>
PK�F�[ /1�::0com_search/views/search/tmpl/default_results.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_search
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<dl class="search-results<?php echo $this->pageclass_sfx;
?>">
<?php foreach ($this->results as $result) : ?>
<dt class="result-title">
<?php echo $this->pagination->limitstart + $result->count .
'. '; ?>
<?php if ($result->href) : ?>
<a href="<?php echo JRoute::_($result->href);
?>"<?php if ($result->browsernav == 1) : ?>
target="_blank"<?php endif; ?>>
<?php // $result->title should not be escaped in this case, as it
may ?>
<?php // contain span HTML tags wrapping the searched terms, if
present ?>
<?php // in the title. ?>
<?php echo $result->title; ?>
</a>
<?php else : ?>
<?php // see above comment: do not escape $result->title ?>
<?php echo $result->title; ?>
<?php endif; ?>
</dt>
<?php if ($result->section) : ?>
<dd class="result-category">
<span class="small<?php echo $this->pageclass_sfx;
?>">
(<?php echo $this->escape($result->section); ?>)
</span>
</dd>
<?php endif; ?>
<dd class="result-text">
<?php echo $result->text; ?>
</dd>
<?php if ($this->params->get('show_date')) : ?>
<dd class="result-created<?php echo $this->pageclass_sfx;
?>">
<?php echo JText::sprintf('JGLOBAL_CREATED_DATE_ON',
$result->created); ?>
</dd>
<?php endif; ?>
<?php endforeach; ?>
</dl>
<div class="pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
PK�F�[��8m�%�%%com_search/views/search/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_search
*
* @copyright (C) 2007 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\String\StringHelper;
/**
* HTML View class for the search component
*
* @since 1.0
*/
class SearchViewSearch extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.0
*/
public function display($tpl = null)
{
JLoader::register('SearchHelper', JPATH_COMPONENT_ADMINISTRATOR
. '/helpers/search.php');
$app = JFactory::getApplication();
$uri = JUri::getInstance();
$error = null;
$results = null;
$total = 0;
// Get some data from the model
$areas = $this->get('areas');
$state = $this->get('state');
$searchWord = $state->get('keyword');
$params = $app->getParams();
if (!$app->getMenu()->getActive())
{
$params->set('page_title',
JText::_('COM_SEARCH_SEARCH'));
}
$title = $params->get('page_title');
if ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($params->get('menu-meta_description'))
{
$this->document->setDescription($params->get('menu-meta_description'));
}
if ($params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$params->get('menu-meta_keywords'));
}
if ($params->get('robots'))
{
$this->document->setMetadata('robots',
$params->get('robots'));
}
// Built select lists
$orders = array();
$orders[] = JHtml::_('select.option', 'newest',
JText::_('COM_SEARCH_NEWEST_FIRST'));
$orders[] = JHtml::_('select.option', 'oldest',
JText::_('COM_SEARCH_OLDEST_FIRST'));
$orders[] = JHtml::_('select.option', 'popular',
JText::_('COM_SEARCH_MOST_POPULAR'));
$orders[] = JHtml::_('select.option', 'alpha',
JText::_('COM_SEARCH_ALPHABETICAL'));
$orders[] = JHtml::_('select.option', 'category',
JText::_('JCATEGORY'));
$lists = array();
$lists['ordering'] = JHtml::_('select.genericlist',
$orders, 'ordering', 'class="inputbox"',
'value', 'text', $state->get('ordering'));
$searchphrases = array();
$searchphrases[] = JHtml::_('select.option',
'all', JText::_('COM_SEARCH_ALL_WORDS'));
$searchphrases[] = JHtml::_('select.option',
'any', JText::_('COM_SEARCH_ANY_WORDS'));
$searchphrases[] = JHtml::_('select.option',
'exact', JText::_('COM_SEARCH_EXACT_PHRASE'));
$lists['searchphrase'] = JHtml::_('select.radiolist',
$searchphrases, 'searchphrase', '', 'value',
'text', $state->get('match'));
// Log the search
\Joomla\CMS\Helper\SearchHelper::logSearch($searchWord,
'com_search');
// Limit search-word
$lang = JFactory::getLanguage();
$upper_limit = $lang->getUpperLimitSearchWord();
$lower_limit = $lang->getLowerLimitSearchWord();
if (SearchHelper::limitSearchWord($searchWord))
{
$error = JText::sprintf('COM_SEARCH_ERROR_SEARCH_MESSAGE',
$lower_limit, $upper_limit);
}
// Sanitise search-word
if (SearchHelper::santiseSearchWord($searchWord,
$state->get('match')))
{
$error = JText::_('COM_SEARCH_ERROR_IGNOREKEYWORD');
}
if (!$searchWord && !empty($this->input) &&
count($this->input->post))
{
// $error = JText::_('COM_SEARCH_ERROR_ENTERKEYWORD');
}
// Put the filtered results back into the model
// for next release, the checks should be done in the model perhaps...
$state->set('keyword', $searchWord);
if ($error === null)
{
$results = $this->get('data');
$total = $this->get('total');
$pagination = $this->get('pagination');
// Flag indicates to not add limitstart=0 to URL
$pagination->hideEmptyLimitstart = true;
if ($state->get('match') === 'exact')
{
$searchWords = array($searchWord);
$needle = $searchWord;
}
else
{
$searchWordA = preg_replace('#\xE3\x80\x80#', ' ',
$searchWord);
$searchWords = preg_split("/\s+/u", $searchWordA);
$needle = $searchWords[0];
}
JLoader::register('ContentHelperRoute', JPATH_SITE .
'/components/com_content/helpers/route.php');
// Make sure there are no slashes in the needle
$needle = str_replace('/', '\/', $needle);
for ($i = 0, $count = count($results); $i < $count; ++$i)
{
$rowTitle = &$results[$i]->title;
$rowTitleHighLighted = $this->highLight($rowTitle, $needle,
$searchWords);
$rowText = &$results[$i]->text;
$rowTextHighLighted = $this->highLight($rowText, $needle,
$searchWords);
$result = &$results[$i];
$created = '';
if ($result->created)
{
$created = JHtml::_('date', $result->created,
JText::_('DATE_FORMAT_LC3'));
}
$result->title = $rowTitleHighLighted;
$result->text = JHtml::_('content.prepare',
$rowTextHighLighted, '', 'com_search.search');
$result->created = $created;
$result->count = $i + 1;
}
}
// Check for layout override
$active = JFactory::getApplication()->getMenu()->getActive();
if (isset($active->query['layout']))
{
$this->setLayout($active->query['layout']);
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($params->get('pageclass_sfx', ''));
$this->pagination = &$pagination;
$this->results = &$results;
$this->lists = &$lists;
$this->params = &$params;
$this->ordering = $state->get('ordering');
$this->searchword = $searchWord;
$this->origkeyword = $state->get('origkeyword');
$this->searchphrase = $state->get('match');
$this->searchareas = $areas;
$this->total = $total;
$this->error = $error;
$this->action = $uri;
parent::display($tpl);
}
/**
* Method to control the highlighting of keywords
*
* @param string $string text to be searched
* @param string $needle text to search for
* @param string $searchWords words to be searched
*
* @return mixed A string.
*
* @since 3.8.4
*/
public function highLight($string, $needle, $searchWords)
{
$hl1 = '<span class="highlight">';
$hl2 = '</span>';
$mbString = extension_loaded('mbstring');
$highlighterLen = strlen($hl1 . $hl2);
// Doing HTML entity decoding here, just in case we get any HTML entities
here.
$quoteStyle = version_compare(PHP_VERSION, '5.4',
'>=') ? ENT_NOQUOTES | ENT_HTML401 : ENT_NOQUOTES;
$row = html_entity_decode($string, $quoteStyle,
'UTF-8');
$row = SearchHelper::prepareSearchContent($row, $needle);
$searchWords = array_values(array_unique($searchWords));
$lowerCaseRow = $mbString ? mb_strtolower($row) :
StringHelper::strtolower($row);
$transliteratedLowerCaseRow =
SearchHelper::remove_accents($lowerCaseRow);
$posCollector = array();
foreach ($searchWords as $highlightWord)
{
$found = false;
if ($mbString)
{
$lowerCaseHighlightWord = mb_strtolower($highlightWord);
if (($pos = mb_strpos($lowerCaseRow, $lowerCaseHighlightWord)) !==
false)
{
$found = true;
}
elseif (($pos = mb_strpos($transliteratedLowerCaseRow,
$lowerCaseHighlightWord)) !== false)
{
$found = true;
}
}
else
{
$lowerCaseHighlightWord = StringHelper::strtolower($highlightWord);
if (($pos = StringHelper::strpos($lowerCaseRow,
$lowerCaseHighlightWord)) !== false)
{
$found = true;
}
elseif (($pos = StringHelper::strpos($transliteratedLowerCaseRow,
$lowerCaseHighlightWord)) !== false)
{
$found = true;
}
}
if ($found === true)
{
// Iconv transliterates '€' to 'EUR'
// TODO: add other expanding translations?
$eur_compensation = $pos > 0 ? substr_count($row,
"\xE2\x82\xAC", 0, $pos) * 2 : 0;
$pos -= $eur_compensation;
// Collect pos and search-word
$posCollector[$pos] = $highlightWord;
}
}
if (count($posCollector))
{
// Sort by pos. Easier to handle overlapping highlighter-spans
ksort($posCollector);
$cnt = 0;
$lastHighlighterEnd = -1;
foreach ($posCollector as $pos => $highlightWord)
{
$pos += $cnt * $highlighterLen;
/*
* Avoid overlapping/corrupted highlighter-spans
* TODO $chkOverlap could be used to highlight remaining part
* of search-word outside last highlighter-span.
* At the moment no additional highlighter is set.
*/
$chkOverlap = $pos - $lastHighlighterEnd;
if ($chkOverlap >= 0)
{
// Set highlighter around search-word
if ($mbString)
{
$highlightWordLen = mb_strlen($highlightWord);
$row = mb_substr($row, 0, $pos) . $hl1 . mb_substr($row,
$pos, $highlightWordLen)
. $hl2 . mb_substr($row, $pos + $highlightWordLen);
}
else
{
$highlightWordLen = StringHelper::strlen($highlightWord);
$row = StringHelper::substr($row, 0, $pos)
. $hl1 . StringHelper::substr($row, $pos,
StringHelper::strlen($highlightWord))
. $hl2 . StringHelper::substr($row, $pos +
StringHelper::strlen($highlightWord));
}
$cnt++;
$lastHighlighterEnd = $pos + $highlightWordLen + $highlighterLen;
}
}
}
return $row;
}
}
PK�F�[|�zii+com_search/views/search/view.opensearch.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_search
*
* @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;
/**
* OpenSearch View class for the Search component
*
* @since 1.7
*/
class SearchViewSearch extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl name of the template
*
* @throws Exception
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$doc = JFactory::getDocument();
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_search');
$doc->setShortName($params->get('opensearch_name',
$app->get('sitename')));
$doc->setDescription($params->get('opensearch_description',
$app->get('MetaDesc')));
// Add the URL for the search
$searchUri = JUri::base() .
'index.php?option=com_search&searchword={searchTerms}';
// Find the menu item for the search
$menu = $app->getMenu();
$items = $menu->getItems('link',
'index.php?option=com_search&view=search');
if (isset($items[0]))
{
$searchUri .= '&Itemid=' . $items[0]->id;
}
$htmlSearch = new JOpenSearchUrl;
$htmlSearch->template = JRoute::_($searchUri);
$doc->addUrl($htmlSearch);
}
}
PK�F�[��1�yycom_tags/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Tags Component Controller
*
* @since 3.1
*/
class TagsController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be
cached
* @param mixed|boolean $urlparams An array of safe URL parameters and
their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JControllerLegacy This object to support chaining.
*
* @since 3.1
*/
public function display($cachable = false, $urlparams = false)
{
$user = JFactory::getUser();
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'tags');
$this->input->set('view', $vName);
if ($user->get('id') || ($this->input->getMethod() ===
'POST' && $vName === 'tags'))
{
$cachable = false;
}
$safeurlparams = array(
'id' => 'ARRAY',
'type' => 'ARRAY',
'limit' => 'UINT',
'limitstart' => 'UINT',
'filter_order' => 'CMD',
'filter_order_Dir' => 'CMD',
'lang' => 'CMD'
);
return parent::display($cachable, $safeurlparams);
}
}
PK�F�[�tx�DDcom_tags/controllers/tags.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* The Tags List Controller
*
* @since 3.1
*/
class TagsControllerTags extends JControllerLegacy
{
/**
* Method to search tags with AJAX
*
* @return void
*/
public function searchAjax()
{
// Required objects
$app = JFactory::getApplication();
$user = JFactory::getUser();
// Receive request data
$filters = array(
'like' =>
trim($app->input->get('like', null, 'string')),
'title' =>
trim($app->input->get('title', null, 'string')),
'flanguage' =>
$app->input->get('flanguage', null, 'word'),
'published' =>
$app->input->get('published', 1, 'int'),
'parent_id' =>
$app->input->get('parent_id', 0, 'int'),
'access' => $user->getAuthorisedViewLevels(),
);
if ((!$user->authorise('core.edit.state',
'com_tags')) &&
(!$user->authorise('core.edit', 'com_tags')))
{
// Filter on published for those who do not have edit or edit.state
rights.
$filters['published'] = 1;
}
$results = JHelperTags::searchTags($filters);
if ($results)
{
// Output a JSON object
echo json_encode($results);
}
$app->close();
}
}
PK�F�[҆b(��com_tags/helpers/route.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Tags Component Route Helper.
*
* @since 3.1
*/
class TagsHelperRoute extends JHelperRoute
{
protected static $lookup;
/**
* Tries to load the router for the component and calls it. Otherwise uses
getTagRoute.
*
* @param integer $contentItemId Component item id
* @param string $contentItemAlias Component item alias
* @param integer $contentCatId Component item category id
* @param string $language Component item language
* @param string $typeAlias Component type alias
* @param string $routerName Component router
*
* @return string URL link to pass to JRoute
*
* @since 3.1
*/
public static function getItemRoute($contentItemId, $contentItemAlias,
$contentCatId, $language, $typeAlias, $routerName)
{
$link = '';
$explodedAlias = explode('.', $typeAlias);
$explodedRouter = explode('::', $routerName);
if (file_exists($routerFile = JPATH_BASE . '/components/' .
$explodedAlias[0] . '/helpers/route.php'))
{
JLoader::register($explodedRouter[0], $routerFile);
$routerClass = $explodedRouter[0];
$routerMethod = $explodedRouter[1];
if (class_exists($routerClass) && method_exists($routerClass,
$routerMethod))
{
if ($routerMethod === 'getCategoryRoute')
{
$link = $routerClass::$routerMethod($contentItemId, $language);
}
else
{
$link = $routerClass::$routerMethod($contentItemId . ':' .
$contentItemAlias, $contentCatId, $language);
}
}
}
if ($link === '')
{
// Create a fallback link in case we can't find the component
router
$router = new JHelperRoute;
$link = $router->getRoute($contentItemId, $typeAlias, $link,
$language, $contentCatId);
}
return $link;
}
/**
* Tries to load the router for the component and calls it. Otherwise
calls getRoute.
*
* @param integer $id The ID of the tag
*
* @return string URL link to pass to JRoute
*
* @since 3.1
*/
public static function getTagRoute($id)
{
$needles = array(
'tag' => array((int) $id)
);
if ($id < 1)
{
$link = '';
}
else
{
$link = 'index.php?option=com_tags&view=tag&id=' .
$id;
if ($item = self::_findItem($needles))
{
$link .= '&Itemid=' . $item;
}
else
{
$needles = array('tags' => array(1, 0));
if ($item = self::_findItem($needles))
{
$link .= '&Itemid=' . $item;
}
}
}
return $link;
}
/**
* Tries to load the router for the tags view.
*
* @return string URL link to pass to JRoute
*
* @since 3.7
*/
public static function getTagsRoute()
{
$needles = array(
'tags' => array(0)
);
$link = 'index.php?option=com_tags&view=tags';
if ($item = self::_findItem($needles))
{
$link .= '&Itemid=' . $item;
}
return $link;
}
/**
* Find Item static function
*
* @param array $needles Array used to get the language value
*
* @return null
*
* @throws Exception
*/
protected static function _findItem($needles = null)
{
$app = JFactory::getApplication();
$menus = $app->getMenu('site');
$language = isset($needles['language']) ?
$needles['language'] : '*';
// Prepare the reverse lookup array.
if (self::$lookup === null)
{
self::$lookup = array();
$component = JComponentHelper::getComponent('com_tags');
$items = $menus->getItems('component_id',
$component->id);
if ($items)
{
foreach ($items as $item)
{
if (isset($item->query, $item->query['view']))
{
$lang = ($item->language != '' ? $item->language :
'*');
if (!isset(self::$lookup[$lang]))
{
self::$lookup[$lang] = array();
}
$view = $item->query['view'];
if (!isset(self::$lookup[$lang][$view]))
{
self::$lookup[$lang][$view] = array();
}
// Only match menu items that list one tag
if (isset($item->query['id']) &&
is_array($item->query['id']))
{
foreach ($item->query['id'] as $position => $tagId)
{
if
(!isset(self::$lookup[$lang][$view][$item->query['id'][$position]])
|| count($item->query['id']) == 1)
{
self::$lookup[$lang][$view][$item->query['id'][$position]]
= $item->id;
}
}
}
elseif ($view == 'tags')
{
self::$lookup[$lang]['tags'][] = $item->id;
}
}
}
}
}
if ($needles)
{
foreach ($needles as $view => $ids)
{
if (isset(self::$lookup[$language][$view]))
{
foreach ($ids as $id)
{
if (isset(self::$lookup[$language][$view][(int) $id]))
{
return self::$lookup[$language][$view][(int) $id];
}
}
}
}
}
else
{
$active = $menus->getActive();
if ($active)
{
return $active->id;
}
}
return null;
}
}
PK�F�[�Ϙ##com_tags/models/tag.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 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;
/**
* Tags Component Tag Model
*
* @since 3.1
*/
class TagsModelTag extends JModelList
{
/**
* The tags that apply.
*
* @var object
* @since 3.1
*/
protected $tag = null;
/**
* The list of items associated with the tags.
*
* @var array
* @since 3.1
*/
protected $items = null;
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @see JController
* @since 3.1
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'core_content_id', 'c.core_content_id',
'core_title', 'c.core_title',
'core_type_alias', 'c.core_type_alias',
'core_checked_out_user_id',
'c.core_checked_out_user_id',
'core_checked_out_time', 'c.core_checked_out_time',
'core_catid', 'c.core_catid',
'core_state', 'c.core_state',
'core_access', 'c.core_access',
'core_created_user_id', 'c.core_created_user_id',
'core_created_time', 'c.core_created_time',
'core_modified_time', 'c.core_modified_time',
'core_ordering', 'c.core_ordering',
'core_featured', 'c.core_featured',
'core_language', 'c.core_language',
'core_hits', 'c.core_hits',
'core_publish_up', 'c.core_publish_up',
'core_publish_down', 'c.core_publish_down',
'core_images', 'c.core_images',
'core_urls', 'c.core_urls',
'match_count',
);
}
parent::__construct($config);
}
/**
* Method to get a list of items for a list of tags.
*
* @return mixed An array of objects on success, false on failure.
*
* @since 3.1
*/
public function getItems()
{
// Invoke the parent getItems method to get the main list
$items = parent::getItems();
if (!empty($items))
{
foreach ($items as $item)
{
$item->link = TagsHelperRoute::getItemRoute(
$item->content_item_id,
$item->core_alias,
$item->core_catid,
$item->core_language,
$item->type_alias,
$item->router
);
// Get display date
switch
($this->state->params->get('tag_list_show_date'))
{
case 'modified':
$item->displayDate = $item->core_modified_time;
break;
case 'created':
$item->displayDate = $item->core_created_time;
break;
default:
case 'published':
$item->displayDate = ($item->core_publish_up == 0) ?
$item->core_created_time : $item->core_publish_up;
break;
}
}
}
return $items;
}
/**
* Method to build an SQL query to load the list data of all items with a
given tag.
*
* @return string An SQL query
*
* @since 3.1
*/
protected function getListQuery()
{
$tagId = $this->getState('tag.id') ? : '';
$typesr = $this->getState('tag.typesr');
$orderByOption = $this->getState('list.ordering',
'c.core_title');
$includeChildren =
$this->state->params->get('include_children', 0);
$orderDir = $this->getState('list.direction',
'ASC');
$matchAll =
$this->getState('params')->get('return_any_or_all',
1);
$language = $this->getState('tag.language');
$stateFilter = $this->getState('tag.state');
// Optionally filter on language
if (empty($language))
{
$language =
JComponentHelper::getParams('com_tags')->get('tag_list_language_filter',
'all');
}
$tagsHelper = new JHelperTags;
$query = $tagsHelper->getTagItemsQuery($tagId, $typesr,
$includeChildren, $orderByOption, $orderDir, $matchAll, $language,
$stateFilter);
if ($this->state->get('list.filter'))
{
$query->where($this->_db->quoteName('c.core_title') .
' LIKE ' . $this->_db->quote('%' .
$this->state->get('list.filter') . '%'));
}
return $query;
}
/**
* 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 3.1
*/
protected function populateState($ordering = 'c.core_title',
$direction = 'ASC')
{
$app = JFactory::getApplication();
// Load the parameters.
$params = $app->isClient('administrator') ?
JComponentHelper::getParams('com_tags') : $app->getParams();
$this->setState('params', $params);
// Load state from the request.
$ids = (array) $app->input->get('id', array(),
'string');
if (count($ids) == 1)
{
$ids = explode(',', $ids[0]);
}
$ids = ArrayHelper::toInteger($ids);
// Remove zero values resulting from bad input
$ids = array_filter($ids);
$pkString = implode(',', $ids);
$this->setState('tag.id', $pkString);
// Get the selected list of types from the request. If none are specified
all are used.
$typesr = $app->input->get('types', array(),
'array');
if ($typesr)
{
// Implode is needed because the array can contain a string with a coma
separated list of ids
$typesr = implode(',', $typesr);
// Sanitise
$typesr = explode(',', $typesr);
$typesr = ArrayHelper::toInteger($typesr);
$this->setState('tag.typesr', $typesr);
}
$language =
$app->input->getString('tag_list_language_filter');
$this->setState('tag.language', $language);
// List state information
$format = $app->input->getWord('format');
if ($format === 'feed')
{
$limit = $app->get('feed_limit');
}
else
{
$limit = $params->get('display_num',
$app->get('list_limit', 20));
$limit = $app->getUserStateFromRequest('global.list.limit',
'limit', $limit, 'uint');
}
$this->setState('list.limit', $limit);
$offset = $app->input->get('limitstart', 0,
'uint');
$this->setState('list.start', $offset);
$itemid = $pkString . ':' .
$app->input->get('Itemid', 0, 'int');
$orderCol =
$app->getUserStateFromRequest('com_tags.tag.list.' . $itemid .
'.filter_order', 'filter_order', '',
'string');
$orderCol = !$orderCol ?
$this->state->params->get('tag_list_orderby',
'c.core_title') : $orderCol;
if (!in_array($orderCol, $this->filter_fields))
{
$orderCol = 'c.core_title';
}
$this->setState('list.ordering', $orderCol);
$listOrder =
$app->getUserStateFromRequest('com_tags.tag.list.' . $itemid .
'.filter_order_direction', 'filter_order_Dir',
'', 'string');
$listOrder = !$listOrder ?
$this->state->params->get('tag_list_orderby_direction',
'ASC') : $listOrder;
if (!in_array(strtoupper($listOrder), array('ASC',
'DESC', '')))
{
$listOrder = 'ASC';
}
$this->setState('list.direction', $listOrder);
$this->setState('tag.state', 1);
// Optional filter text
$filterSearch =
$app->getUserStateFromRequest('com_tags.tag.list.' . $itemid .
'.filter_search', 'filter-search', '',
'string');
$this->setState('list.filter', $filterSearch);
}
/**
* Method to get tag data for the current tag or tags
*
* @param integer $pk An optional ID
*
* @return object
*
* @since 3.1
*/
public function getItem($pk = null)
{
if (!isset($this->item))
{
$this->item = false;
if (empty($pk))
{
$pk = $this->getState('tag.id');
}
// Get a level row instance.
$table = JTable::getInstance('Tag', 'TagsTable');
$idsArray = explode(',', $pk);
// Attempt to load the rows into an array.
foreach ($idsArray as $id)
{
try
{
$table->load($id);
// Check published state.
if ($published = $this->getState('tag.state'))
{
if ($table->published != $published)
{
continue;
}
}
if (!in_array($table->access,
JFactory::getUser()->getAuthorisedViewLevels()))
{
continue;
}
// Convert the JTable to a clean JObject.
$properties = $table->getProperties(1);
$this->item[] = ArrayHelper::toObject($properties,
'JObject');
}
catch (RuntimeException $e)
{
$this->setError($e->getMessage());
return false;
}
}
}
if (!$this->item)
{
return JError::raiseError(404,
JText::_('COM_TAGS_TAG_NOT_FOUND'));
}
return $this->item;
}
/**
* Increment the hit counter.
*
* @param integer $pk Optional primary key of the article to
increment.
*
* @return boolean True if successful; false otherwise and internal
error set.
*
* @since 3.2
*/
public function hit($pk = 0)
{
$input = JFactory::getApplication()->input;
$hitcount = $input->getInt('hitcount', 1);
if ($hitcount)
{
$pk = (!empty($pk)) ? $pk : (int)
$this->getState('tag.id');
$table = JTable::getInstance('Tag', 'TagsTable');
$table->hit($pk);
// Load the table data for later
$table->load($pk);
if (!$table->hasPrimaryKey())
{
JError::raiseError(404, JText::_('COM_TAGS_TAG_NOT_FOUND'));
}
}
return true;
}
}
PK�F�[A�p���com_tags/models/tags.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 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;
/**
* This models supports retrieving a list of tags.
*
* @since 3.1
*/
class TagsModelTags extends JModelList
{
/**
* Model context string.
*
* @var string
* @since 3.1
*/
public $_context = 'com_tags.tags';
/**
* Method to auto-populate the model state.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @note Calling getState in this method will result in recursion.
*
* @since 3.1
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication('site');
// Load state from the request.
$pid = $app->input->getInt('parent_id');
$this->setState('tag.parent_id', $pid);
$language =
$app->input->getString('tag_list_language_filter');
$this->setState('tag.language', $language);
$offset = $app->input->get('limitstart', 0,
'uint');
$this->setState('list.offset', $offset);
$app = JFactory::getApplication();
$params = $app->getParams();
$this->setState('params', $params);
$this->setState('list.limit',
$params->get('maximum', 200));
$this->setState('filter.published', 1);
$this->setState('filter.access', true);
$user = JFactory::getUser();
if ((!$user->authorise('core.edit.state',
'com_tags')) &&
(!$user->authorise('core.edit', 'com_tags')))
{
$this->setState('filter.published', 1);
}
// Optional filter text
$itemid = $pid . ':' .
$app->input->getInt('Itemid', 0);
$filterSearch =
$app->getUserStateFromRequest('com_tags.tags.list.' . $itemid
. '.filter_search', 'filter-search', '',
'string');
$this->setState('list.filter', $filterSearch);
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*
* @since 1.6
*/
protected function getListQuery()
{
$app = JFactory::getApplication('site');
$user = JFactory::getUser();
$groups = implode(',',
$user->getAuthorisedViewLevels());
$pid = $this->getState('tag.parent_id');
$orderby =
$this->state->params->get('all_tags_orderby',
'title');
$published =
$this->state->params->get('published', 1);
$orderDirection =
$this->state->params->get('all_tags_orderby_direction',
'ASC');
$language = $this->getState('tag.language');
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select required fields from the tags.
$query->select('a.*, u.name as created_by_user_name,
u.email')
->from($db->quoteName('#__tags') . ' AS a')
->join('LEFT', '#__users AS u ON a.created_user_id =
u.id')
->where($db->quoteName('a.access') . ' IN (' .
$groups . ')');
if (!empty($pid))
{
$query->where($db->quoteName('a.parent_id') . ' =
' . $pid);
}
// Exclude the root.
$query->where($db->quoteName('a.parent_id') . '
<> 0');
// Optionally filter on language
if (empty($language))
{
$language =
JComponentHelper::getParams('com_tags')->get('tag_list_language_filter',
'all');
}
if ($language !== 'all')
{
if ($language === 'current_language')
{
$language = JHelperContent::getCurrentLanguage();
}
$query->where($db->quoteName('language') . ' IN
(' . $db->quote($language) . ', ' .
$db->quote('*') . ')');
}
// List state information
$format = $app->input->getWord('format');
if ($format === 'feed')
{
$limit = $app->get('feed_limit');
}
else
{
if
($this->state->params->get('show_pagination_limit'))
{
$limit =
$app->getUserStateFromRequest('global.list.limit',
'limit', $app->get('list_limit'), 'uint');
}
else
{
$limit = $this->state->params->get('maximum', 20);
}
}
$this->setState('list.limit', $limit);
$offset = $app->input->get('limitstart', 0,
'uint');
$this->setState('list.start', $offset);
// Optionally filter on entered value
if ($this->state->get('list.filter'))
{
$query->where($db->quoteName('a.title') . ' LIKE
' . $db->quote('%' .
$this->state->get('list.filter') . '%'));
}
$query->where($db->quoteName('a.published') . ' =
' . $published);
$query->order($db->quoteName($orderby) . ' ' .
$orderDirection . ', a.title ASC');
return $query;
}
}
PK�F�[T<���com_tags/router.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 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;
/**
* Routing class from com_tags
*
* @since 3.3
*/
class TagsRouter extends JComponentRouterBase
{
/**
* Build the route for the com_tags component
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent
URL.
*
* @since 3.3
*/
public function build(&$query)
{
$segments = array();
// Get a menu item based on Itemid or currently active
$params = JComponentHelper::getParams('com_tags');
// We need a menu item. Either the one specified in the query, or the
current active one if none specified
if (empty($query['Itemid']))
{
$menuItem = $this->menu->getActive();
}
else
{
$menuItem = $this->menu->getItem($query['Itemid']);
}
$mView = empty($menuItem->query['view']) ? null :
$menuItem->query['view'];
$mId = empty($menuItem->query['id']) ? null :
$menuItem->query['id'];
if (is_array($mId))
{
$mId = ArrayHelper::toInteger($mId);
}
$view = '';
if (isset($query['view']))
{
$view = $query['view'];
if (empty($query['Itemid']))
{
$segments[] = $view;
}
unset($query['view']);
}
// Are we dealing with a tag that is attached to a menu item?
if ($mView == $view && isset($query['id']) &&
$mId == $query['id'])
{
unset($query['id']);
return $segments;
}
if ($view === 'tag')
{
$notActiveTag = is_array($mId) ? (count($mId) > 1 || $mId[0] != (int)
$query['id']) : ($mId != (int) $query['id']);
if ($notActiveTag || $mView != $view)
{
// ID in com_tags can be either an integer, a string or an array of IDs
$id = is_array($query['id']) ? implode(',',
$query['id']) : $query['id'];
$segments[] = $id;
}
unset($query['id']);
}
if (isset($query['layout']))
{
if ((!empty($query['Itemid']) &&
isset($menuItem->query['layout'])
&& $query['layout'] ==
$menuItem->query['layout'])
|| $query['layout'] === 'default')
{
unset($query['layout']);
}
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-',
$segments[$i]);
$position = strpos($segments[$i], '-');
if ($position)
{
// Remove id from segment
$segments[$i] = substr($segments[$i], $position + 1);
}
}
return $segments;
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
$total = count($segments);
$vars = array();
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = preg_replace('/-/', ':',
$segments[$i], 1);
}
// Get the active menu item.
$item = $this->menu->getActive();
// Count route segments
$count = count($segments);
// Standard routing for tags.
if (!isset($item))
{
$vars['view'] = $segments[0];
$vars['id'] = $this->fixSegment($segments[$count - 1]);
return $vars;
}
$vars['id'] = $this->fixSegment($segments[0]);
$vars['view'] = 'tag';
return $vars;
}
/**
* Try to add missing id to segment
*
* @param string $segment One piece of segment of the URL to parse
*
* @return string The segment with founded id
*
* @since 3.7
*/
protected function fixSegment($segment)
{
$db = JFactory::getDbo();
// Try to find tag id
$alias = str_replace(':', '-', $segment);
$query = $db->getQuery(true)
->select('id')
->from($db->quoteName('#__tags'))
->where($db->quoteName('alias') . " = " .
$db->quote($alias));
$id = $db->setQuery($query)->loadResult();
if ($id)
{
$segment = "$id:$alias";
}
return $segment;
}
}
/**
* Tags router functions. These functions are proxys for the new router
interface or old SEF extensions.
*
* @param array &$query An array of URL arguments.
*
* @return array
*
* @deprecated 4.0 Use Class based routers instead
*/
function tagsBuildRoute(&$query)
{
$router = new TagsRouter;
return $router->build($query);
}
/**
* Parse the segments of a URL. These functions are proxys for the new
router interface or old SEF extensions.
*
* @param array $segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @deprecated 4.0 Use Class based routers instead
*/
function tagsParseRoute($segments)
{
$router = new TagsRouter;
return $router->parse($segments);
}
PK�F�[=�ӻ��com_tags/tags.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('TagsHelperRoute', JPATH_COMPONENT .
'/helpers/route.php');
$controller = JControllerLegacy::getInstance('Tags');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
PK�F�[�?�__#com_tags/views/tag/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Note that there are certain parts of this layout used only when there is
exactly one tag.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$isSingleTag = count($this->item) === 1;
?>
<div class="tag-category<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('show_tag_title', 1)) :
?>
<h2>
<?php echo JHtml::_('content.prepare',
$this->tags_title, '', 'com_tag.tag'); ?>
</h2>
<?php endif; ?>
<?php // We only show a tag description if there is a single tag. ?>
<?php if (count($this->item) === 1 &&
($this->params->get('tag_list_show_tag_image', 1) ||
$this->params->get('tag_list_show_tag_description', 1))) :
?>
<div class="category-desc">
<?php $images = json_decode($this->item[0]->images); ?>
<?php if
($this->params->get('tag_list_show_tag_image', 1) == 1
&& !empty($images->image_fulltext)) : ?>
<img src="<?php echo
htmlspecialchars($images->image_fulltext, ENT_QUOTES,
'UTF-8'); ?>" alt="<?php echo
htmlspecialchars($images->image_fulltext_alt, ENT_QUOTES,
'UTF-8'); ?>" />
<?php endif; ?>
<?php if
($this->params->get('tag_list_show_tag_description') == 1
&& $this->item[0]->description) : ?>
<?php echo JHtml::_('content.prepare',
$this->item[0]->description, '', 'com_tags.tag');
?>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php // If there are multiple tags and a description or image has been
supplied use that. ?>
<?php if
($this->params->get('tag_list_show_tag_description', 1) ||
$this->params->get('show_description_image', 1)) : ?>
<?php if ($this->params->get('show_description_image',
1) == 1 && $this->params->get('tag_list_image')) :
?>
<img src="<?php echo
htmlspecialchars($this->params->get('tag_list_image'),
ENT_QUOTES, 'UTF-8'); ?>" />
<?php endif; ?>
<?php if ($this->params->get('tag_list_description',
'') > '') : ?>
<?php echo JHtml::_('content.prepare',
$this->params->get('tag_list_description'), '',
'com_tags.tag'); ?>
<?php endif; ?>
<?php endif; ?>
<?php echo $this->loadTemplate('items'); ?>
<?php if (($this->params->def('show_pagination', 1) ==
1 || ($this->params->get('show_pagination') == 2))
&& ($this->pagination->get('pages.total') > 1))
: ?>
<div class="pagination">
<?php if
($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
</div>
PK�F�[I��s #com_tags/views/tag/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_TAGS_TAG_VIEW_DEFAULT_TITLE"
option="COM_TAGS_TAG_VIEW_DEFAULT_OPTION">
<help
key="JHELP_MENUS_MENU_ITEM_TAGS_ITEMS_LIST"
/>
<message>
<![CDATA[COM_TAGS_TAG_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request">
<field
name="id"
type="tag"
label="COM_TAGS_FIELD_TAG_LABEL"
description="COM_TAGS_FIELD_SELECT_TAG_DESC"
mode="nested"
required="true"
multiple="true"
/>
<field
name="types"
type="contenttype"
label="COM_TAGS_FIELD_TYPE_LABEL"
description="COM_TAGS_FIELD_TYPE_DESC"
multiple="true"
/>
<field
name="tag_list_language_filter"
type="contentlanguage"
label="COM_TAGS_FIELD_LANGUAGE_FILTER_LABEL"
description="COM_TAGS_FIELD_LANGUAGE_FILTER_DESC"
default=""
useglobal="true"
>
<option value="all">JALL</option>
<option
value="current_language">JCURRENT</option>
</field>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic" label="COM_TAGS_OPTIONS">
<field
name="show_tag_title"
type="list"
label="COM_TAGS_SHOW_TAG_TITLE_LABEL"
description="COM_TAGS_SHOW_TAG_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="tag_list_show_tag_image"
type="list"
label="COM_TAGS_SHOW_TAG_IMAGE_LABEL"
description="COM_TAGS_SHOW_TAG_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="tag_list_show_tag_description"
type="list"
label="COM_TAGS_SHOW_TAG_DESCRIPTION_LABEL"
description="COM_TAGS_SHOW_TAG_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="tag_list_image"
type="media"
label="COM_TAGS_TAG_LIST_MEDIA_LABEL"
description="COM_TAGS_TAG_LIST_MEDIA_DESC"
/>
<field
name="tag_list_description"
type="textarea"
class="inputbox"
label="COM_TAGS_SHOW_TAG_LIST_DESCRIPTION_LABEL"
description="COM_TAGS_TAG_LIST_DESCRIPTION_DESC"
rows="3"
cols="30"
filter="safehtml"
/>
<field
name="tag_list_orderby"
type="list"
label="JGLOBAL_FIELD_FIELD_ORDERING_LABEL"
description="JGLOBAL_FIELD_FIELD_ORDERING_DESC"
default=""
useglobal="true"
>
<option
value="c.core_title">JGLOBAL_TITLE</option>
<option
value="match_count">COM_TAGS_MATCH_COUNT</option>
<option
value="c.core_created_time">JGLOBAL_CREATED_DATE</option>
<option
value="c.core_modified_time">JGLOBAL_MODIFIED_DATE</option>
<option
value="c.core_publish_up">JGLOBAL_PUBLISHED_DATE</option>
</field>
<field
name="tag_list_orderby_direction"
type="list"
label="JGLOBAL_ORDER_DIRECTION_LABEL"
description="JGLOBAL_ORDER_DIRECTION_DESC"
useglobal="true"
>
<option
value="ASC">JGLOBAL_ORDER_ASCENDING</option>
<option
value="DESC">JGLOBAL_ORDER_DESCENDING</option>
</field>
</fieldset>
<fieldset name="advanced"
label="COM_TAGS_ITEM_OPTIONS">
<field
name="spacer2"
type="spacer"
label="COM_TAGS_SUBSLIDER_DRILL_TAG_LIST_LABEL"
class="text"
/>
<field
name="tag_list_show_item_image"
type="list"
label="COM_TAGS_TAG_LIST_SHOW_ITEM_IMAGE_LABEL"
description="COM_TAGS_TAG_LIST_SHOW_ITEM_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="tag_list_show_item_description"
type="list"
label="COM_TAGS_TAG_LIST_SHOW_ITEM_DESCRIPTION_LABEL"
description="COM_TAGS_TAG_LIST_SHOW_ITEM_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="tag_list_item_maximum_characters"
type="number"
label="COM_TAGS_LIST_MAX_CHARACTERS_LABEL"
description="COM_TAGS_LIST_MAX_CHARACTERS_DESC"
filter="integer"
useglobal="true"
/>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="pagination"
label="COM_TAGS_PAGINATION_OPTIONS">
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="selection"
label="COM_TAGS_LIST_SELECTION_OPTIONS">
<field
name="return_any_or_all"
type="list"
label="COM_TAGS_SEARCH_TYPE_LABEL"
description="COM_TAGS_SEARCH_TYPE_DESC"
useglobal="true"
>
<option value="0">COM_TAGS_ALL</option>
<option value="1">COM_TAGS_ANY</option>
</field>
<field
name="include_children"
type="list"
label="COM_TAGS_INCLUDE_CHILDREN_LABEL"
description="COM_TAGS_INCLUDE_CHILDREN_DESC"
default=""
useglobal="true"
>
<option value="0">COM_TAGS_EXCLUDE</option>
<option value="1">COM_TAGS_INCLUDE</option>
</field>
</fieldset>
<fieldset name="integration">
<field
name="show_feed_link"
type="list"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>
PK�F�[��6�qq)com_tags/views/tag/tmpl/default_items.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 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.core');
JHtml::_('formbehavior.chosen', 'select');
// Get the user object.
$user = JFactory::getUser();
// Check if user is allowed to add/edit based on tags permissions.
// Do we really have to make it so people can see unpublished tags???
$canEdit = $user->authorise('core.edit',
'com_tags');
$canCreate = $user->authorise('core.create',
'com_tags');
$canEditState = $user->authorise('core.edit.state',
'com_tags');
JFactory::getDocument()->addScriptDeclaration("
var resetFilter = function() {
document.getElementById('filter-search').value = '';
}
");
?>
<form action="<?php echo
htmlspecialchars(JUri::getInstance()->toString()); ?>"
method="post" name="adminForm" id="adminForm"
class="form-inline">
<?php if ($this->params->get('show_headings') ||
$this->params->get('filter_field') ||
$this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters btn-toolbar">
<?php if ($this->params->get('filter_field')) : ?>
<div class="btn-group">
<label class="filter-search-lbl element-invisible"
for="filter-search">
<?php echo JText::_('COM_TAGS_TITLE_FILTER_LABEL') .
' '; ?>
</label>
<input type="text" name="filter-search"
id="filter-search" value="<?php echo
$this->escape($this->state->get('list.filter'));
?>" class="inputbox"
onchange="document.adminForm.submit();" title="<?php echo
JText::_('COM_TAGS_FILTER_SEARCH_DESC'); ?>"
placeholder="<?php echo
JText::_('COM_TAGS_TITLE_FILTER_LABEL'); ?>" />
<button type="button"
name="filter-search-button" title="<?php echo
JText::_('JSEARCH_FILTER_SUBMIT'); ?>"
onclick="document.adminForm.submit();" class="btn">
<span class="icon-search"></span>
</button>
<button type="reset" name="filter-clear-button"
title="<?php echo JText::_('JSEARCH_FILTER_CLEAR');
?>" class="btn" onclick="resetFilter();
document.adminForm.submit();">
<span class="icon-remove"></span>
</button>
</div>
<?php endif; ?>
<?php if
($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group pull-right">
<label for="limit"
class="element-invisible">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
<input type="hidden" name="filter_order"
value="" />
<input type="hidden" name="filter_order_Dir"
value="" />
<input type="hidden" name="limitstart"
value="" />
<input type="hidden" name="task"
value="" />
<div class="clearfix"></div>
</fieldset>
<?php endif; ?>
<?php if (empty($this->items)) : ?>
<p><?php echo JText::_('COM_TAGS_NO_ITEMS');
?></p>
<?php else : ?>
<ul class="category list-striped">
<?php foreach ($this->items as $i => $item) : ?>
<?php if ($item->core_state == 0) : ?>
<li class="system-unpublished cat-list-row<?php echo $i %
2; ?>">
<?php else : ?>
<li class="cat-list-row<?php echo $i % 2; ?>
clearfix">
<?php endif; ?>
<?php if (($item->type_alias === 'com_users.category')
|| ($item->type_alias === 'com_banners.category')) : ?>
<h3>
<?php echo $this->escape($item->core_title); ?>
</h3>
<?php else : ?>
<h3>
<a href="<?php echo JRoute::_($item->link);
?>">
<?php echo $this->escape($item->core_title); ?>
</a>
</h3>
<?php endif; ?>
<?php // Content is generated by content plugin event
"onContentAfterTitle" ?>
<?php echo $item->event->afterDisplayTitle; ?>
<?php $images = json_decode($item->core_images); ?>
<?php if
($this->params->get('tag_list_show_item_image', 1) == 1
&& !empty($images->image_intro)) : ?>
<a href="<?php echo JRoute::_($item->link);
?>">
<img src="<?php echo
htmlspecialchars($images->image_intro); ?>" alt="<?php
echo htmlspecialchars($images->image_intro_alt); ?>">
</a>
<?php endif; ?>
<?php if
($this->params->get('tag_list_show_item_description', 1)) :
?>
<?php // Content is generated by content plugin event
"onContentBeforeDisplay" ?>
<?php echo $item->event->beforeDisplayContent; ?>
<span class="tag-body">
<?php echo JHtml::_('string.truncate',
$item->core_body,
$this->params->get('tag_list_item_maximum_characters'));
?>
</span>
<?php // Content is generated by content plugin event
"onContentAfterDisplay" ?>
<?php echo $item->event->afterDisplayContent; ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</form>
PK�F�[\�5�/ /
com_tags/views/tag/tmpl/list.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Note that there are certain parts of this layout used only when there is
exactly one tag.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$n = count($this->items);
?>
<div class="tag-category<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('show_tag_title', 1)) :
?>
<h2>
<?php echo JHtml::_('content.prepare',
$this->tags_title, '', 'com_tag.tag'); ?>
</h2>
<?php endif; ?>
<?php // We only show a tag description if there is a single tag. ?>
<?php if (count($this->item) === 1 &&
($this->params->get('tag_list_show_tag_image', 1) ||
$this->params->get('tag_list_show_tag_description', 1))) :
?>
<div class="category-desc">
<?php $images = json_decode($this->item[0]->images); ?>
<?php if
($this->params->get('tag_list_show_tag_image', 1) == 1
&& !empty($images->image_fulltext)) : ?>
<img src="<?php echo
htmlspecialchars($images->image_fulltext, ENT_QUOTES,
'UTF-8'); ?>">
<?php endif; ?>
<?php if
($this->params->get('tag_list_show_tag_description') == 1
&& $this->item[0]->description) : ?>
<?php echo JHtml::_('content.prepare',
$this->item[0]->description, '', 'com_tags.tag');
?>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php // If there are multiple tags and a description or image has been
supplied use that. ?>
<?php if
($this->params->get('tag_list_show_tag_description', 1) ||
$this->params->get('show_description_image', 1)) : ?>
<?php if ($this->params->get('show_description_image',
1) == 1 && $this->params->get('tag_list_image')) :
?>
<img src="<?php echo
htmlspecialchars($this->params->get('tag_list_image'),
ENT_QUOTES, 'UTF-8'); ?>">
<?php endif; ?>
<?php if ($this->params->get('tag_list_description',
'') > '') : ?>
<?php echo JHtml::_('content.prepare',
$this->params->get('tag_list_description'), '',
'com_tags.tag'); ?>
<?php endif; ?>
<?php endif; ?>
<?php echo $this->loadTemplate('items'); ?>
</div>
PK�F�[�&&
com_tags/views/tag/tmpl/list.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_TAGS_TAG_VIEW_LIST_COMPACT_TITLE"
option="COM_TAGS_TAG_VIEW_LIST_COMPACT_OPTION">
<help
key="JHELP_MENUS_MENU_ITEM_TAGS_ITEMS_COMPACT_LIST"
/>
<message>
<![CDATA[COM_TAGS_TAG_VIEW_LIST_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request">
<field
name="id"
type="tag"
label="COM_TAGS_FIELD_TAG_LABEL"
description="COM_TAGS_FIELD_SELECT_TAG_DESC"
mode="nested"
required="true"
multiple="true"
/>
<field
name="types"
type="contenttype"
label="COM_TAGS_FIELD_TYPE_LABEL"
description="COM_TAGS_FIELD_TYPE_DESC"
multiple="true"
/>
<field
name="tag_list_language_filter"
type="contentlanguage"
label="COM_TAGS_FIELD_LANGUAGE_FILTER_LABEL"
description="COM_TAGS_FIELD_LANGUAGE_FILTER_DESC"
default=""
useglobal="true"
>
<option value="all">JALL</option>
<option
value="current_language">JCURRENT</option>
</field>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic"
label="COM_TAGS_OPTIONS">
<field
name="show_tag_title"
type="list"
label="COM_TAGS_SHOW_TAG_TITLE_LABEL"
description="COM_TAGS_SHOW_TAG_TITLE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="tag_list_show_tag_image"
type="list"
label="COM_TAGS_SHOW_TAG_IMAGE_LABEL"
description="COM_TAGS_SHOW_TAG_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="tag_list_show_tag_description"
type="list"
label="COM_TAGS_SHOW_TAG_DESCRIPTION_LABEL"
description="COM_TAGS_SHOW_TAG_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="tag_list_image"
type="media"
label="COM_TAGS_TAG_LIST_MEDIA_LABEL"
description="COM_TAGS_TAG_LIST_MEDIA_DESC"
/>
<field
name="tag_list_description"
type="textarea"
label="COM_TAGS_SHOW_TAG_LIST_DESCRIPTION_LABEL"
description="COM_TAGS_TAG_LIST_DESCRIPTION_DESC"
class="inputbox"
rows="3"
cols="30"
filter="safehtml"
/>
<field
name="tag_list_orderby"
type="list"
label="JGLOBAL_FIELD_FIELD_ORDERING_LABEL"
description="JGLOBAL_FIELD_FIELD_ORDERING_DESC"
default=""
useglobal="true"
>
<option
value="c.core_title">JGLOBAL_TITLE</option>
<option
value="match_count">COM_TAGS_MATCH_COUNT</option>
<option
value="c.core_created_time">JGLOBAL_CREATED_DATE</option>
<option
value="c.core_modified_time">JGLOBAL_MODIFIED_DATE</option>
<option
value="c.core_publish_up">JGLOBAL_PUBLISHED_DATE</option>
</field>
<field
name="tag_list_orderby_direction"
type="list"
label="JGLOBAL_ORDER_DIRECTION_LABEL"
description="JGLOBAL_ORDER_DIRECTION_DESC"
useglobal="true"
>
<option
value="ASC">JGLOBAL_ORDER_ASCENDING</option>
<option
value="DESC">JGLOBAL_ORDER_DESCENDING</option>
</field>
</fieldset>
<fieldset name="advanced"
label="JGLOBAL_LIST_LAYOUT_OPTIONS">
<field
name="spacer2"
type="spacer"
label="COM_TAGS_SUBSLIDER_DRILL_TAG_LIST_LABEL"
class="text"
/>
<field
name="tag_list_show_item_image"
type="list"
label="COM_TAGS_TAG_LIST_SHOW_ITEM_IMAGE_LABEL"
description="COM_TAGS_TAG_LIST_SHOW_ITEM_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="tag_list_show_item_description"
type="list"
label="COM_TAGS_TAG_LIST_SHOW_ITEM_DESCRIPTION_LABEL"
description="COM_TAGS_TAG_LIST_SHOW_ITEM_DESCRIPTION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="tag_list_item_maximum_characters"
type="number"
label="COM_TAGS_LIST_MAX_CHARACTERS_LABEL"
description="COM_TAGS_LIST_MAX_CHARACTERS_DESC"
filter="integer"
useglobal="true"
/>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="display_num"
type="list"
label="COM_TAGS_FIELD_NUMBER_ITEMS_LIST_LABEL"
description="COM_TAGS_FIELD_NUMBER_ITEMS_LIST_DESC"
class="chzn-color"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="100">J100</option>
<option value="0">JALL</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="tag_list_show_date"
type="list"
label="JGLOBAL_SHOW_DATE_LABEL"
description="JGLOBAL_SHOW_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="created">JGLOBAL_CREATED</option>
<option
value="modified">JGLOBAL_MODIFIED</option>
<option value="published">JPUBLISHED</option>
</field>
<field
name="date_format"
type="text"
label="JGLOBAL_DATE_FORMAT_LABEL"
description="JGLOBAL_DATE_FORMAT_DESC"
size="15"
/>
</fieldset>
<fieldset name="selection"
label="COM_TAGS_LIST_SELECTION_OPTIONS">
<field
name="return_any_or_all"
type="list"
label="COM_TAGS_SEARCH_TYPE_LABEL"
description="COM_TAGS_SEARCH_TYPE_DESC"
useglobal="true"
>
<option value="0">COM_TAGS_ALL</option>
<option value="1">COM_TAGS_ANY</option>
</field>
<field
name="include_children"
type="list"
label="COM_TAGS_INCLUDE_CHILDREN_LABEL"
description="COM_TAGS_INCLUDE_CHILDREN_DESC"
default=""
useglobal="true"
>
<option value="0">COM_TAGS_EXCLUDE</option>
<option value="1">COM_TAGS_INCLUDE</option>
</field>
</fieldset>
<fieldset name="integration">
<field
name="show_feed_link"
type="list"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>
PK�F�[/���&com_tags/views/tag/tmpl/list_items.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 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.core');
JHtml::_('formbehavior.chosen', 'select');
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn =
$this->escape($this->state->get('list.direction'));
JFactory::getDocument()->addScriptDeclaration("
var resetFilter = function() {
document.getElementById('filter-search').value = '';
}
");
?>
<form action="<?php echo
htmlspecialchars(JUri::getInstance()->toString()); ?>"
method="post" name="adminForm"
id="adminForm">
<?php if ($this->params->get('filter_field') ||
$this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters btn-toolbar">
<?php if ($this->params->get('filter_field')) : ?>
<div class="btn-group">
<label class="filter-search-lbl element-invisible"
for="filter-search">
<?php echo JText::_('COM_TAGS_TITLE_FILTER_LABEL') .
' '; ?>
</label>
<input type="text" name="filter-search"
id="filter-search" value="<?php echo
$this->escape($this->state->get('list.filter'));
?>" class="inputbox"
onchange="document.adminForm.submit();" title="<?php echo
JText::_('COM_TAGS_FILTER_SEARCH_DESC'); ?>"
placeholder="<?php echo
JText::_('COM_TAGS_TITLE_FILTER_LABEL'); ?>" />
<button type="button"
name="filter-search-button" title="<?php echo
JText::_('JSEARCH_FILTER_SUBMIT'); ?>"
onclick="document.adminForm.submit();" class="btn">
<span class="icon-search"></span>
</button>
<button type="reset" name="filter-clear-button"
title="<?php echo JText::_('JSEARCH_FILTER_CLEAR');
?>" class="btn" onclick="resetFilter();
document.adminForm.submit();">
<span class="icon-remove"></span>
</button>
</div>
<?php endif; ?>
<?php if
($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group pull-right">
<label for="limit"
class="element-invisible">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
<input type="hidden" name="filter_order"
value="" />
<input type="hidden" name="filter_order_Dir"
value="" />
<input type="hidden" name="limitstart"
value="" />
<input type="hidden" name="task"
value="" />
<div class="clearfix"></div>
</fieldset>
<?php endif; ?>
<?php if (empty($this->items)) : ?>
<p><?php echo JText::_('COM_TAGS_NO_ITEMS');
?></p>
<?php else : ?>
<table class="category table table-striped table-bordered
table-hover">
<?php if ($this->params->get('show_headings')) :
?>
<thead>
<tr>
<th id="categorylist_header_title">
<?php echo JHtml::_('grid.sort',
'JGLOBAL_TITLE', 'c.core_title', $listDirn,
$listOrder); ?>
</th>
<?php if ($date =
$this->params->get('tag_list_show_date')) : ?>
<th id="categorylist_header_date">
<?php if ($date === 'created') : ?>
<?php echo JHtml::_('grid.sort',
'COM_TAGS_' . $date . '_DATE',
'c.core_created_time', $listDirn, $listOrder); ?>
<?php elseif ($date === 'modified') : ?>
<?php echo JHtml::_('grid.sort',
'COM_TAGS_' . $date . '_DATE',
'c.core_modified_time', $listDirn, $listOrder); ?>
<?php elseif ($date === 'published') : ?>
<?php echo JHtml::_('grid.sort',
'COM_TAGS_' . $date . '_DATE',
'c.core_publish_up', $listDirn, $listOrder); ?>
<?php endif; ?>
</th>
<?php endif; ?>
</tr>
</thead>
<?php endif; ?>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<?php if ($item->core_state == 0) : ?>
<tr class="system-unpublished cat-list-row<?php echo $i %
2; ?>">
<?php else : ?>
<tr class="cat-list-row<?php echo $i % 2; ?>">
<?php endif; ?>
<td <?php if
($this->params->get('show_headings')) echo
"headers=\"categorylist_header_title\""; ?>
class="list-title">
<a href="<?php echo JRoute::_($item->link);
?>">
<?php echo $this->escape($item->core_title); ?>
</a>
<?php if ($item->core_state == 0) : ?>
<span class="list-published label label-warning">
<?php echo JText::_('JUNPUBLISHED'); ?>
</span>
<?php endif; ?>
</td>
<?php if
($this->params->get('tag_list_show_date')) : ?>
<td headers="categorylist_header_date"
class="list-date small">
<?php
echo JHtml::_(
'date', $item->displayDate,
$this->escape($this->params->get('date_format',
JText::_('DATE_FORMAT_LC3')))
); ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php // Add pagination links ?>
<?php if (($this->params->def('show_pagination', 2) ==
1 || ($this->params->get('show_pagination') == 2))
&& ($this->pagination->pagesTotal > 1)) : ?>
<div class="pagination">
<?php if
($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</form>
PK�F�[�b�%
com_tags/views/tag/view.feed.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Tags component
*
* @since 3.1
*/
class TagsViewTag extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$ids = (array) $app->input->get('id', array(),
'int');
$i = 0;
$tagIds = '';
// Remove zero values resulting from input filter
$ids = array_filter($ids);
foreach ($ids as $id)
{
if ($i !== 0)
{
$tagIds .= '&';
}
$tagIds .= 'id[' . $i . ']=' . $id;
$i++;
}
$document->link =
JRoute::_('index.php?option=com_tags&view=tag&' .
$tagIds);
$app->input->set('limit',
$app->get('feed_limit'));
$siteEmail = $app->get('mailfrom');
$fromName = $app->get('fromname');
$feedEmail = $app->get('feed_email',
'none');
$document->editor = $fromName;
if ($feedEmail !== 'none')
{
$document->editorEmail = $siteEmail;
}
// Get some data from the model
$items = $this->get('Items');
if ($items !== false)
{
foreach ($items as $item)
{
// Strip HTML from feed item title
$title = $this->escape($item->core_title);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
// Strip HTML from feed item description text
$description = $item->core_body;
$author = $item->core_created_by_alias ?: $item->author;
$date = ($item->displayDate ? date('r',
strtotime($item->displayDate)) : '');
// Load individual item creator class
$feeditem = new JFeedItem;
$feeditem->title = $title;
$feeditem->link = JRoute::_($item->link);
$feeditem->description = $description;
$feeditem->date = $date;
$feeditem->category = $title;
$feeditem->author = $author;
if ($feedEmail === 'site')
{
$item->authorEmail = $siteEmail;
}
elseif ($feedEmail === 'author')
{
$item->authorEmail = $item->author_email;
}
// Loads item info into RSS array
$document->addItem($feeditem);
}
}
}
}
PK�F�[W-}�+&+&
com_tags/views/tag/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 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;
/**
* HTML View class for the Tags component
*
* @since 3.1
*/
class TagsViewTag extends JViewLegacy
{
/**
* The model state
*
* @var \Joomla\Registry\Registry
* @since 3.1
*/
protected $state;
/**
* An array of items.
*
* @var array
* @since 3.1
*/
protected $items;
/**
* The active JObject (on success, false on failure)
*
* @var JObject|boolean
* @since 3.1
*/
protected $item;
/**
* Array of Children objects
*
* @var array
* @since 3.1
*/
protected $children;
/**
* The pagination object.
*
* @var JPagination
* @since 3.1
*/
protected $pagination;
/**
* The application parameters
*
* @var \Joomla\Registry\Registry The parameters object
* @since 3.1
*/
protected $params;
/**
* Array of tags title
*
* @var array
* @since 3.1
*/
protected $tags_title;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 3.1
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$params = $app->getParams();
// Get some data from the models
$state = $this->get('State');
$items = $this->get('Items');
$item = $this->get('Item');
$children = $this->get('Children');
$parent = $this->get('Parent');
$pagination = $this->get('Pagination');
// Flag indicates to not add limitstart=0 to URL
$pagination->hideEmptyLimitstart = true;
// Check whether access level allows access.
// @TODO: Should already be computed in
$item->params->get('access-view')
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
foreach ($item as $itemElement)
{
if (!in_array($itemElement->access, $groups))
{
unset($itemElement);
}
// Prepare the data.
if (!empty($itemElement))
{
$temp = new Registry($itemElement->params);
$itemElement->params = clone $params;
$itemElement->params->merge($temp);
$itemElement->params = (array)
json_decode($itemElement->params);
$itemElement->metadata = new Registry($itemElement->metadata);
}
}
if ($items !== false)
{
JPluginHelper::importPlugin('content');
foreach ($items as $itemElement)
{
$itemElement->event = new stdClass;
// For some plugins.
!empty($itemElement->core_body) ? $itemElement->text =
$itemElement->core_body : $itemElement->text = null;
$itemElement->core_params = new
Registry($itemElement->core_params);
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onContentPrepare', array
('com_tags.tag', &$itemElement,
&$itemElement->core_params, 0));
$results = $dispatcher->trigger('onContentAfterTitle',
array('com_tags.tag', &$itemElement,
&$itemElement->core_params, 0));
$itemElement->event->afterDisplayTitle =
trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentBeforeDisplay',
array('com_tags.tag', &$itemElement,
&$itemElement->core_params, 0));
$itemElement->event->beforeDisplayContent =
trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay',
array('com_tags.tag', &$itemElement,
&$itemElement->core_params, 0));
$itemElement->event->afterDisplayContent =
trim(implode("\n", $results));
// Write the results back into the body
if (!empty($itemElement->core_body))
{
$itemElement->core_body = $itemElement->text;
}
// Categories store the images differently so lets re-map it so the
display is correct
if ($itemElement->type_alias === 'com_content.category')
{
$itemElement->core_images = json_encode(
array(
'image_intro' =>
$itemElement->core_params->get('image', ''),
'image_intro_alt' =>
$itemElement->core_params->get('image_alt', '')
)
);
}
}
}
$this->state = $state;
$this->items = $items;
$this->children = $children;
$this->parent = $parent;
$this->pagination = $pagination;
$this->user = $user;
$this->item = $item;
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($params->get('pageclass_sfx', ''));
// Merge tag params. If this is single-tag view, menu params override tag
params
// Otherwise, article params override menu item params
$this->params = $this->state->get('params');
$active = $app->getMenu()->getActive();
$temp = clone $this->params;
// Convert item params to a Registry object
$item[0]->params = new Registry($item[0]->params);
// Check to see which parameters should take priority
if ($active)
{
$currentLink = $active->link;
// If the current view is the active item and a tag view for one tag,
then the menu item params take priority
if (strpos($currentLink, 'view=tag') &&
strpos($currentLink, '&id[0]=' . (string) $item[0]->id))
{
// $item[0]->params are the tag params, $temp are the menu item
params
// Merge so that the menu item params take priority
$item[0]->params->merge($temp);
// Load layout from active query (in case it is an alternative menu
item)
if (isset($active->query['layout']))
{
$this->setLayout($active->query['layout']);
}
}
else
{
// Current menuitem is not a single tag view, so the tag params take
priority.
// Merge the menu item params with the tag params so that the tag
params take priority
$temp->merge($item[0]->params);
$item[0]->params = $temp;
// Check for alternative layouts (since we are not in a single-article
menu item)
// Single-article menu item layout takes priority over alt layout for
an article
if ($layout = $item[0]->params->get('tag_layout'))
{
$this->setLayout($layout);
}
}
}
else
{
// Merge so that item params take priority
$temp->merge($item[0]->params);
$item[0]->params = $temp;
// Check for alternative layouts (since we are not in a single-tag menu
item)
// Single-tag menu item layout takes priority over alt layout for an
article
if ($layout = $item[0]->params->get('tag_layout'))
{
$this->setLayout($layout);
}
}
// Increment the hit counter
$model = $this->getModel();
$model->hit();
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document.
*
* @return void
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive();
$this->tags_title = $this->getTagsTitle();
$pathway = $app->getPathway();
$title = '';
// Highest priority for "Browser Page Title".
if ($menu)
{
$title = $menu->params->get('page_title', '');
}
if ($this->tags_title)
{
$this->params->def('page_heading',
$this->tags_title);
$title = $title ?: $this->tags_title;
}
elseif ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
$title = $title ?: $this->params->get('page_title',
$menu->title);
if (!isset($menu->query['option']) ||
$menu->query['option'] !== 'com_tags')
{
$this->params->set('page_subheading', $menu->title);
}
}
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
$pathway->addItem($title);
foreach ($this->item as $itemElement)
{
if ($itemElement->metadesc)
{
$this->document->setDescription($itemElement->metadesc);
}
elseif ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($itemElement->metakey)
{
$this->document->setMetadata('keywords',
$itemElement->metakey);
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
if (count($this->item) === 1)
{
foreach ($this->item[0]->metadata->toArray() as $k => $v)
{
if ($v)
{
$this->document->setMetadata($k, $v);
}
}
}
if ($this->params->get('show_feed_link', 1) == 1)
{
$link = '&format=feed&limitstart=';
$attribs = array('type' => 'application/rss+xml',
'title' => 'RSS 2.0');
$this->document->addHeadLink(JRoute::_($link .
'&type=rss'), 'alternate', 'rel',
$attribs);
$attribs = array('type' =>
'application/atom+xml', 'title' => 'Atom
1.0');
$this->document->addHeadLink(JRoute::_($link .
'&type=atom'), 'alternate', 'rel',
$attribs);
}
}
/**
* Creates the tags title for the output
*
* @return boolean
*/
protected function getTagsTitle()
{
$tags_title = array();
if (!empty($this->item))
{
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
foreach ($this->item as $item)
{
if (in_array($item->access, $groups))
{
$tags_title[] = $item->title;
}
}
}
return implode(' ', $tags_title);
}
}
PK�F�[�oo$com_tags/views/tags/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Note that there are certain parts of this layout used only when there is
exactly one tag.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$description =
$this->params->get('all_tags_description');
$descriptionImage =
$this->params->get('all_tags_description_image');
?>
<div class="tag-category<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if
($this->params->get('all_tags_show_description_image')
&& !empty($descriptionImage)) : ?>
<div>
<img src="<?php echo htmlspecialchars($descriptionImage,
ENT_QUOTES, 'UTF-8'); ?>" />
</div>
<?php endif; ?>
<?php if (!empty($description)) : ?>
<div>
<?php echo $description; ?>
</div>
<?php endif; ?>
<?php echo $this->loadTemplate('items'); ?>
</div>
PK�F�[�΄aa$com_tags/views/tags/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_TAGS_TAGS_VIEW_DEFAULT_TITLE"
option="COM_TAGS_TAG_VIEW_DEFAULT_OPTION">
<help
key="JHELP_MENUS_MENU_ITEM_TAGS_ITEMS_LIST_ALL"
/>
<message>
<![CDATA[COM_TAGS_TAGS_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request">
<field
name="parent_id"
type="tag"
label="COM_TAGS_FIELD_PARENT_TAG_LABEL"
description="COM_TAGS_FIELD_PARENT_TAG_DESC"
mode="nested"
>
<option value="">JNONE</option>
<option value="1">JGLOBAL_ROOT</option>
</field>
<field
name="tag_list_language_filter"
type="contentlanguage"
label="COM_TAGS_FIELD_LANGUAGE_FILTER_LABEL"
description="COM_TAGS_FIELD_LANGUAGE_FILTER_DESC"
default=""
useglobal="true"
>
<option value="all">JALL</option>
<option
value="current_language">JCURRENT</option>
</field>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic">
<field
name="tag_columns"
type="number"
label="COM_TAGS_COMPACT_COLUMNS_LABEL"
description="COM_TAGS_NUMBER_COLUMNS_DESC"
default="4"
filter="integer"
/>
<field
name="all_tags_description"
type="textarea"
label="COM_TAGS_SHOW_ALL_TAGS_DESCRIPTION_LABEL"
description="COM_TAGS_ALL_TAGS_DESCRIPTION_DESC"
class="inputbox"
rows="3"
cols="30"
filter="safehtml"
/>
<field
name="all_tags_show_description_image"
type="list"
label="COM_TAGS_SHOW_ALL_TAGS_IMAGE_LABEL"
description="COM_TAGS_SHOW_ALL_TAGS_IMAGE_DESC"
class="chzn-color"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="all_tags_description_image"
type="media"
label="COM_TAGS_ALL_TAGS_MEDIA_LABEL"
description="COM_TAGS_ALL_TAGS_MEDIA_DESC"
/>
<field
name="all_tags_orderby"
type="list"
label="JGLOBAL_FIELD_FIELD_ORDERING_LABEL"
description="JGLOBAL_FIELD_FIELD_ORDERING_DESC"
useglobal="true"
>
<option value="title">JGLOBAL_TITLE</option>
<option value="hits">JGLOBAL_HITS</option>
<option
value="created_time">JGLOBAL_CREATED_DATE</option>
<option
value="modified_time">JGLOBAL_MODIFIED_DATE</option>
<option
value="publish_up">JGLOBAL_PUBLISHED_DATE</option>
</field>
<field
name="all_tags_orderby_direction"
type="list"
label="JGLOBAL_ORDER_DIRECTION_LABEL"
description="JGLOBAL_ORDER_DIRECTION_DESC"
useglobal="true"
>
<option
value="ASC">JGLOBAL_ORDER_ASCENDING</option>
<option
value="DESC">JGLOBAL_ORDER_DESCENDING</option>
</field>
<field
name="all_tags_show_tag_image"
type="list"
label="COM_TAGS_SHOW_ITEM_IMAGE_LABEL"
description="COM_TAGS_SHOW_ITEM_IMAGE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="all_tags_show_tag_description"
type="list"
label="COM_TAGS_SHOW_ITEM_DESCRIPTION_LABEL"
description="COM_TAGS_SHOW_ITEM_DESCRIPTION_DESC"
class="chzn-color"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="all_tags_tag_maximum_characters"
type="number"
label="COM_TAGS_LIST_MAX_CHARACTERS_LABEL"
description="COM_TAGS_LIST_MAX_CHARACTERS_DESC"
filter="integer"
/>
<field
name="all_tags_show_tag_hits"
type="list"
label="JGLOBAL_HITS"
description="COM_TAGS_FIELD_CONFIG_HITS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset
name="selection"
label="COM_TAGS_LIST_ALL_SELECTION_OPTIONS">
<field
name="maximum"
type="number"
label="COM_TAGS_LIST_MAX_LABEL"
description="COM_TAGS_LIST_MAX_DESC"
default="200"
filter="integer"
/>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="integration">
<field
name="show_feed_link"
type="list"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>
PK�F�[�J?��*com_tags/views/tags/tmpl/default_items.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 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');
JHtml::_('behavior.caption');
JHtml::_('behavior.core');
// Get the user object.
$user = JFactory::getUser();
// Check if user is allowed to add/edit based on tags permissions.
$canEdit = $user->authorise('core.edit',
'com_tags');
$canCreate = $user->authorise('core.create',
'com_tags');
$canEditState = $user->authorise('core.edit.state',
'com_tags');
$columns = $this->params->get('tag_columns', 1);
// Avoid division by 0 and negative columns.
if ($columns < 1)
{
$columns = 1;
}
$bsspans = floor(12 / $columns);
if ($bsspans < 1)
{
$bsspans = 1;
}
$bscolumns = min($columns, floor(12 / $bsspans));
$n = count($this->items);
JFactory::getDocument()->addScriptDeclaration("
var resetFilter = function() {
document.getElementById('filter-search').value = '';
}
");
?>
<form action="<?php echo
htmlspecialchars(JUri::getInstance()->toString()); ?>"
method="post" name="adminForm"
id="adminForm">
<?php if ($this->params->get('filter_field') ||
$this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters btn-toolbar">
<?php if ($this->params->get('filter_field')) : ?>
<div class="btn-group">
<label class="filter-search-lbl element-invisible"
for="filter-search">
<?php echo JText::_('COM_TAGS_TITLE_FILTER_LABEL') .
' '; ?>
</label>
<input type="text" name="filter-search"
id="filter-search" value="<?php echo
$this->escape($this->state->get('list.filter'));
?>" class="inputbox"
onchange="document.adminForm.submit();" title="<?php echo
JText::_('COM_TAGS_FILTER_SEARCH_DESC'); ?>"
placeholder="<?php echo
JText::_('COM_TAGS_TITLE_FILTER_LABEL'); ?>" />
<button type="button"
name="filter-search-button" title="<?php echo
JText::_('JSEARCH_FILTER_SUBMIT'); ?>"
onclick="document.adminForm.submit();" class="btn">
<span class="icon-search"></span>
</button>
<button type="reset" name="filter-clear-button"
title="<?php echo JText::_('JSEARCH_FILTER_CLEAR');
?>" class="btn" onclick="resetFilter();
document.adminForm.submit();">
<span class="icon-remove"></span>
</button>
</div>
<?php endif; ?>
<?php if
($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group pull-right">
<label for="limit"
class="element-invisible">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
<input type="hidden" name="filter_order"
value="" />
<input type="hidden" name="filter_order_Dir"
value="" />
<input type="hidden" name="limitstart"
value="" />
<input type="hidden" name="task"
value="" />
<div class="clearfix"></div>
</fieldset>
<?php endif; ?>
<?php if ($this->items == false || $n === 0) : ?>
<p><?php echo JText::_('COM_TAGS_NO_TAGS');
?></p>
<?php else : ?>
<?php foreach ($this->items as $i => $item) : ?>
<?php if ($n === 1 || $i === 0 || $bscolumns === 1 || $i % $bscolumns
=== 0) : ?>
<ul class="thumbnails">
<?php endif; ?>
<?php if ((!empty($item->access)) &&
in_array($item->access, $this->user->getAuthorisedViewLevels())) :
?>
<li class="cat-list-row<?php echo $i % 2; ?>">
<h3>
<a href="<?php echo
JRoute::_(TagsHelperRoute::getTagRoute($item->id . ':' .
$item->alias)); ?>">
<?php echo $this->escape($item->title); ?>
</a>
</h3>
<?php endif; ?>
<?php if
($this->params->get('all_tags_show_tag_image') &&
!empty($item->images)) : ?>
<?php $images = json_decode($item->images); ?>
<span class="tag-body">
<?php if (!empty($images->image_intro)) : ?>
<?php $imgfloat = empty($images->float_intro) ?
$this->params->get('float_intro') :
$images->float_intro; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat,
ENT_QUOTES, 'UTF-8'); ?> item-image">
<img
<?php if ($images->image_intro_caption) : ?>
<?php echo 'class="caption"' . '
title="' . htmlspecialchars($images->image_intro_caption,
ENT_QUOTES, 'UTF-8') . '"'; ?>
<?php endif; ?>
src="<?php echo htmlspecialchars($images->image_intro,
ENT_QUOTES, 'UTF-8'); ?>"
alt="<?php echo
htmlspecialchars($images->image_intro_alt, ENT_QUOTES,
'UTF-8'); ?>" />
</div>
<?php endif; ?>
</span>
<?php endif; ?>
<?php if
(($this->params->get('all_tags_show_tag_description', 1)
&& !empty($item->description)) ||
$this->params->get('all_tags_show_tag_hits')) : ?>
<div class="caption">
<?php if
($this->params->get('all_tags_show_tag_description', 1)
&& !empty($item->description)) : ?>
<span class="tag-body">
<?php echo JHtml::_('string.truncate',
$item->description,
$this->params->get('all_tags_tag_maximum_characters'));
?>
</span>
<?php endif; ?>
<?php if
($this->params->get('all_tags_show_tag_hits')) : ?>
<span class="list-hits badge badge-info">
<?php echo JText::sprintf('JGLOBAL_HITS_COUNT',
$item->hits); ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
</li>
<?php if (($i === 0 && $n === 1) || $i === $n - 1 ||
$bscolumns === 1 || (($i + 1) % $bscolumns === 0)) : ?>
</ul>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php // Add pagination links ?>
<?php if (!empty($this->items)) : ?>
<?php if (($this->params->def('show_pagination', 2) ==
1 || ($this->params->get('show_pagination') == 2))
&& ($this->pagination->pagesTotal > 1)) : ?>
<div class="pagination">
<?php if
($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</form>
PK�F�[��=���!com_tags/views/tags/view.feed.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Tags component all tags view
*
* @since 3.1
*/
class TagsViewTags extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$document->link =
JRoute::_('index.php?option=com_tags&view=tags');
$app->input->set('limit',
$app->get('feed_limit'));
$siteEmail = $app->get('mailfrom');
$fromName = $app->get('fromname');
$feedEmail = $app->get('feed_email',
'none');
$document->editor = $fromName;
if ($feedEmail !== 'none')
{
$document->editorEmail = $siteEmail;
}
// Get some data from the model
$items = $this->get('Items');
foreach ($items as $item)
{
// Strip HTML from feed item title
$title = $this->escape($item->title);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
// Strip HTML from feed item description text
$description = $item->description;
$author = $item->created_by_alias ?:
$item->created_by_user_name;
$date = $item->created_time ? date('r',
strtotime($item->created_time)) : '';
// Load individual item creator class
$feeditem = new JFeedItem;
$feeditem->title = $title;
$feeditem->link =
'/index.php?option=com_tags&view=tag&id=' . (int)
$item->id;
$feeditem->description = $description;
$feeditem->date = $date;
$feeditem->category = 'All Tags';
$feeditem->author = $author;
if ($feedEmail === 'site')
{
$feeditem->authorEmail = $siteEmail;
}
if ($feedEmail === 'author')
{
$feeditem->authorEmail = $item->email;
}
// Loads item info into RSS array
$document->addItem($feeditem);
}
}
}
PK�F�[���}��!com_tags/views/tags/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright (C) 2013 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;
/**
* HTML View class for the Tags component
*
* @since 3.1
*/
class TagsViewTags extends JViewLegacy
{
protected $state;
protected $items;
protected $item;
protected $pagination;
protected $params;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
// Get some data from the models
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->params = $this->state->get('params');
$this->user = JFactory::getUser();
// Flag indicates to not add limitstart=0 to URL
$this->pagination->hideEmptyLimitstart = true;
/*
* // Change to catch
* if (count($errors = $this->get('Errors'))) {
* JError::raiseError(500, implode("\n", $errors));
* return false;
*/
// Check whether access level allows access.
// @todo: Should already be computed in
$item->params->get('access-view')
$groups = $this->user->getAuthorisedViewLevels();
if (!empty($this->items))
{
foreach ($this->items as $itemElement)
{
if (!in_array($itemElement->access, $groups))
{
unset($itemElement);
}
// Prepare the data.
$temp = new Registry($itemElement->params);
$itemElement->params = clone $this->params;
$itemElement->params->merge($temp);
$itemElement->params = (array) json_decode($itemElement->params);
}
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($this->params->get('pageclass_sfx',
''));
$active = JFactory::getApplication()->getMenu()->getActive();
// Load layout from active query (in case it is an alternative menu item)
if ($active && isset($active->query['option'])
&& $active->query['option'] === 'com_tags'
&& $active->query['view'] === 'tags')
{
if (isset($active->query['layout']))
{
$this->setLayout($active->query['layout']);
}
}
else
{
// Load default All Tags layout from component
if ($layout = $this->params->get('tags_layout'))
{
$this->setLayout($layout);
}
}
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_TAGS_DEFAULT_PAGE_TITLE'));
}
if ($menu && (!isset($menu->query['option']) ||
$menu->query['option'] !== 'com_tags'))
{
$this->params->set('page_subheading', $menu->title);
}
// Set metadata for all tags menu item
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
// If this is not a single tag menu item, set the page title to the tag
titles
$title = '';
if (!empty($this->item))
{
foreach ($this->item as $i => $itemElement)
{
if ($itemElement->title)
{
if ($i != 0)
{
$title .= ', ';
}
$title .= $itemElement->title;
}
}
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
foreach ($this->item as $itemElement)
{
if ($itemElement->metadesc)
{
$this->document->setDescription($this->item->metadesc);
}
elseif ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($itemElement->metakey)
{
$this->document->setMetadata('keywords',
$this->tag->metakey);
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
if ($app->get('MetaAuthor') == '1')
{
$this->document->setMetaData('author',
$itemElement->created_user_id);
}
$mdata = $this->item->metadata->toArray();
foreach ($mdata as $k => $v)
{
if ($v)
{
$this->document->setMetadata($k, $v);
}
}
}
}
// Respect configuration Sitename Before/After for TITLE in views All
Tags.
if (!$title && ($pos =
$app->get('sitename_pagetitles', 0)))
{
$title = $this->document->getTitle();
if ($pos == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
else
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
}
// Add alternative feed link
if ($this->params->get('show_feed_link', 1) == 1)
{
$link = '&format=feed&limitstart=';
$attribs = array('type' => 'application/rss+xml',
'title' => 'RSS 2.0');
$this->document->addHeadLink(JRoute::_($link .
'&type=rss'), 'alternate', 'rel',
$attribs);
$attribs = array('type' =>
'application/atom+xml', 'title' => 'Atom
1.0');
$this->document->addHeadLink(JRoute::_($link .
'&type=atom'), 'alternate', 'rel',
$attribs);
}
}
}
PK�F�[��\}77com_users/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
/**
* Base controller class for Users.
*
* @since 1.5
*/
class UsersController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their
variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = $this->input->getCmd('view',
'login');
$vFormat = $document->getType();
$lName = $this->input->getCmd('layout',
'default');
if ($view = $this->getView($vName, $vFormat))
{
// Do any specific processing by view.
switch ($vName)
{
case 'registration':
// If the user is already logged in, redirect to the profile page.
$user = JFactory::getUser();
if ($user->get('guest') != 1)
{
// Redirect to profile page.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile',
false));
return;
}
// Check if user registration is enabled
if
(JComponentHelper::getParams('com_users')->get('allowUserRegistration')
== 0)
{
// Registration is disabled - Redirect to login page.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login',
false));
return;
}
// The user is a guest, load the registration model and show the
registration page.
$model = $this->getModel('Registration');
break;
// Handle view specific models.
case 'profile':
// If the user is a guest, redirect to the login page.
$user = JFactory::getUser();
if ($user->get('guest') == 1)
{
// Redirect to login page.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login',
false));
return;
}
$model = $this->getModel($vName);
break;
// Handle the default views.
case 'login':
$model = $this->getModel($vName);
break;
case 'reset':
// If the user is already logged in, redirect to the profile page.
$user = JFactory::getUser();
if ($user->get('guest') != 1)
{
// Redirect to profile page.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile',
false));
return;
}
$model = $this->getModel($vName);
break;
case 'remind':
// If the user is already logged in, redirect to the profile page.
$user = JFactory::getUser();
if ($user->get('guest') != 1)
{
// Redirect to profile page.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile',
false));
return;
}
$model = $this->getModel($vName);
break;
default:
$model = $this->getModel('Login');
break;
}
// Make sure we don't send a referer
if (in_array($vName, array('remind', 'reset')))
{
JFactory::getApplication()->setHeader('Referrer-Policy',
'no-referrer', true);
}
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->document = $document;
$view->display();
}
}
}
PK�F�[��c'��!com_users/controllers/profile.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JLoader::register('UsersController', JPATH_COMPONENT .
'/controller.php');
/**
* Profile controller class for Users.
*
* @since 1.6
*/
class UsersControllerProfile extends UsersController
{
/**
* Method to check out a user for editing and redirect to the edit form.
*
* @return boolean
*
* @since 1.6
*/
public function edit()
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
$loginUserId = (int) $user->get('id');
// Get the previous user id (if any) and the current user id.
$previousId = (int)
$app->getUserState('com_users.edit.profile.id');
$userId = $this->input->getInt('user_id');
// Check if the user is trying to edit another users profile.
if ($userId != $loginUserId)
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
$app->setHeader('status', 403, true);
return false;
}
$cookieLogin = $user->get('cookieLogin');
// Check if the user logged in with a cookie
if (!empty($cookieLogin))
{
// If so, the user must login to edit the password and other data.
$app->enqueueMessage(JText::_('JGLOBAL_REMEMBER_MUST_LOGIN'),
'message');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login',
false));
return false;
}
// Set the user id for the user to edit in the session.
$app->setUserState('com_users.edit.profile.id', $userId);
// Get the model.
$model = $this->getModel('Profile', 'UsersModel');
// Check out the user.
if ($userId)
{
$model->checkout($userId);
}
// Check in the previous user.
if ($previousId)
{
$model->checkin($previousId);
}
// Redirect to the edit screen.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit',
false));
return true;
}
/**
* Method to save a user's profile data.
*
* @return void
*
* @since 1.6
*/
public function save()
{
// Check for request forgeries.
$this->checkToken();
$app = JFactory::getApplication();
$model = $this->getModel('Profile',
'UsersModel');
$user = JFactory::getUser();
$userId = (int) $user->get('id');
// Get the user data.
$requestData = $app->input->post->get('jform',
array(), 'array');
// Force the ID to this user.
$requestData['id'] = $userId;
// Validate the posted data.
$form = $model->getForm();
if (!$form)
{
JError::raiseError(500, $model->getError());
return false;
}
// Send an object which can be modified through the plugin event
$objData = (object) $requestData;
$app->triggerEvent(
'onContentNormaliseRequestData',
array('com_users.user', $objData, $form)
);
$requestData = (array) $objData;
// Validate the posted data.
$data = $model->validate($form, $requestData);
// Check for errors.
if ($data === 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');
}
}
// Unset the passwords.
unset($requestData['password1'],
$requestData['password2']);
// Save the data in the session.
$app->setUserState('com_users.edit.profile.data',
$requestData);
// Redirect back to the edit screen.
$userId = (int)
$app->getUserState('com_users.edit.profile.id');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&user_id='
. $userId, false));
return false;
}
// Attempt to save the data.
$return = $model->save($data);
// Check for errors.
if ($return === false)
{
// Save the data in the session.
$app->setUserState('com_users.edit.profile.data', $data);
// Redirect back to the edit screen.
$userId = (int)
$app->getUserState('com_users.edit.profile.id');
$this->setMessage(JText::sprintf('COM_USERS_PROFILE_SAVE_FAILED',
$model->getError()), 'warning');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&user_id='
. $userId, false));
return false;
}
// Redirect the user and adjust session state based on the chosen task.
switch ($this->getTask())
{
case 'apply':
// Check out the profile.
$app->setUserState('com_users.edit.profile.id', $return);
$model->checkout($return);
// Redirect back to the edit screen.
$this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS'));
$redirect =
$app->getUserState('com_users.edit.profile.redirect');
// Don't redirect to an external URL.
if (!JUri::isInternal($redirect))
{
$redirect = null;
}
if (!$redirect)
{
$redirect =
'index.php?option=com_users&view=profile&layout=edit&hidemainmenu=1';
}
$this->setRedirect(JRoute::_($redirect, false));
break;
default:
// Check in the profile.
$userId = (int)
$app->getUserState('com_users.edit.profile.id');
if ($userId)
{
$model->checkin($userId);
}
// Clear the profile id from the session.
$app->setUserState('com_users.edit.profile.id', null);
$redirect =
$app->getUserState('com_users.edit.profile.redirect');
// Don't redirect to an external URL.
if (!JUri::isInternal($redirect))
{
$redirect = null;
}
if (!$redirect)
{
$redirect =
'index.php?option=com_users&view=profile&user_id=' .
$return;
}
// Redirect to the list screen.
$this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS'));
$this->setRedirect(JRoute::_($redirect, false));
break;
}
// Flush the data from the session.
$app->setUserState('com_users.edit.profile.data', null);
}
}
PK�F�[��&com_users/controllers/registration.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JLoader::register('UsersController', JPATH_COMPONENT .
'/controller.php');
/**
* Registration controller class for Users.
*
* @since 1.6
*/
class UsersControllerRegistration extends UsersController
{
/**
* Method to activate a user.
*
* @return boolean True on success, false on failure.
*
* @since 1.6
*/
public function activate()
{
$user = JFactory::getUser();
$input = JFactory::getApplication()->input;
$uParams = JComponentHelper::getParams('com_users');
// Check for admin activation. Don't allow non-super-admin to delete
a super admin
if ($uParams->get('useractivation') != 2 &&
$user->get('id'))
{
$this->setRedirect('index.php');
return true;
}
// If user registration or account activation is disabled, throw a 403.
if ($uParams->get('useractivation') == 0 ||
$uParams->get('allowUserRegistration') == 0)
{
JError::raiseError(403,
JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
return false;
}
$model = $this->getModel('Registration',
'UsersModel');
$token = $input->getAlnum('token');
// Check that the token is in a valid format.
if ($token === null || strlen($token) !== 32)
{
JError::raiseError(403, JText::_('JINVALID_TOKEN'));
return false;
}
// Get the User ID
$userIdToActivate = $model->getUserIdFromToken($token);
if (!$userIdToActivate)
{
$this->setMessage(JText::_('COM_USERS_ACTIVATION_TOKEN_NOT_FOUND'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login',
false));
return false;
}
// Get the user we want to activate
$userToActivate = JFactory::getUser($userIdToActivate);
// Admin activation is on and admin is activating the account
if (($uParams->get('useractivation') == 2) &&
$userToActivate->getParam('activate', 0))
{
// If a user admin is not logged in, redirect them to the login page
with an error message
if (!$user->authorise('core.create', 'com_users')
|| !$user->authorise('core.manage', 'com_users'))
{
$activationUrl =
'index.php?option=com_users&task=registration.activate&token='
. $token;
$loginUrl =
'index.php?option=com_users&view=login&return=' .
base64_encode($activationUrl);
// In case we still run into this in the second step the user does not
have the right permissions
$message =
JText::_('COM_USERS_REGISTRATION_ACL_ADMIN_ACTIVATION_PERMISSIONS');
// When we are not logged in we should login
if ($user->guest)
{
$message =
JText::_('COM_USERS_REGISTRATION_ACL_ADMIN_ACTIVATION');
}
$this->setMessage($message);
$this->setRedirect(JRoute::_($loginUrl, false));
return false;
}
}
// Attempt to activate the user.
$return = $model->activate($token);
// Check for errors.
if ($return === false)
{
// Redirect back to the home page.
$this->setMessage(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED',
$model->getError()), 'error');
$this->setRedirect('index.php');
return false;
}
$useractivation = $uParams->get('useractivation');
// Redirect to the login screen.
if ($useractivation == 0)
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login',
false));
}
elseif ($useractivation == 1)
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_ACTIVATE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login',
false));
}
elseif ($return->getParam('activate'))
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_VERIFY_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete',
false));
}
else
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_ADMINACTIVATE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete',
false));
}
return true;
}
/**
* Method to register a user.
*
* @return boolean True on success, false on failure.
*
* @since 1.6
*/
public function register()
{
// Check for request forgeries.
$this->checkToken();
// If registration is disabled - Redirect to login page.
if
(JComponentHelper::getParams('com_users')->get('allowUserRegistration')
== 0)
{
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login',
false));
return false;
}
$app = JFactory::getApplication();
$model = $this->getModel('Registration',
'UsersModel');
// Get the user data.
$requestData = $this->input->post->get('jform',
array(), 'array');
// Validate the posted data.
$form = $model->getForm();
if (!$form)
{
JError::raiseError(500, $model->getError());
return false;
}
$data = $model->validate($form, $requestData);
// Check for validation errors.
if ($data === 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(),
'error');
}
else
{
$app->enqueueMessage($errors[$i], 'error');
}
}
// Save the data in the session.
$app->setUserState('com_users.registration.data',
$requestData);
// Redirect back to the registration screen.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration',
false));
return false;
}
// Attempt to save the data.
$return = $model->register($data);
// Check for errors.
if ($return === false)
{
// Save the data in the session.
$app->setUserState('com_users.registration.data', $data);
// Redirect back to the edit screen.
$this->setMessage($model->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration',
false));
return false;
}
// Flush the data from the session.
$app->setUserState('com_users.registration.data', null);
// Redirect to the profile screen.
if ($return === 'adminactivate')
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_VERIFY'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete',
false));
}
elseif ($return === 'useractivate')
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete',
false));
}
else
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login',
false));
}
return true;
}
}
PK�F�[�~�L��
com_users/controllers/remind.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright (C) 2010 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('UsersController', JPATH_COMPONENT .
'/controller.php');
/**
* Reset controller class for Users.
*
* @since 1.6
*/
class UsersControllerRemind extends UsersController
{
/**
* Method to request a username reminder.
*
* @return boolean
*
* @since 1.6
*/
public function remind()
{
// Check the request token.
$this->checkToken('post');
$model = $this->getModel('Remind', 'UsersModel');
$data = $this->input->post->get('jform', array(),
'array');
// Submit the password reset request.
$return = $model->processRemindRequest($data);
// Check for a hard error.
if ($return == false && JDEBUG)
{
// The request failed.
// Go back to the request form.
$message = JText::sprintf('COM_USERS_REMIND_REQUEST_FAILED',
$model->getError());
$this->setRedirect(JRoute::_('index.php?option=com_users&view=remind',
false), $message, 'notice');
return false;
}
// To not expose if the user exists or not we send a generic message.
$message = JText::_('COM_USERS_REMIND_REQUEST');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login',
false), $message, 'notice');
return true;
}
}
PK�F�[����com_users/controllers/reset.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JLoader::register('UsersController', JPATH_COMPONENT .
'/controller.php');
/**
* Reset controller class for Users.
*
* @since 1.6
*/
class UsersControllerReset extends UsersController
{
/**
* Method to request a password reset.
*
* @return boolean
*
* @since 1.6
*/
public function request()
{
// Check the request token.
$this->checkToken('post');
$app = JFactory::getApplication();
$model = $this->getModel('Reset', 'UsersModel');
$data = $this->input->post->get('jform', array(),
'array');
// Submit the password reset request.
$return = $model->processResetRequest($data);
// Check for a hard error.
if ($return instanceof Exception && JDEBUG)
{
// Get the error message to display.
if ($app->get('error_reporting'))
{
$message = $return->getMessage();
}
else
{
$message = JText::_('COM_USERS_RESET_REQUEST_ERROR');
}
// Go back to the request form.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=reset',
false), $message, 'error');
return false;
}
elseif ($return === false && JDEBUG)
{
// The request failed.
// Go back to the request form.
$message = JText::sprintf('COM_USERS_RESET_REQUEST_FAILED',
$model->getError());
$this->setRedirect(JRoute::_('index.php?option=com_users&view=reset',
false), $message, 'notice');
return false;
}
// To not expose if the user exists or not we send a generic message.
$message = JText::_('COM_USERS_RESET_REQUEST');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=confirm',
false), $message, 'notice');
return true;
}
/**
* Method to confirm the password request.
*
* @return boolean
*
* @access public
* @since 1.6
*/
public function confirm()
{
// Check the request token.
$this->checkToken('request');
$app = JFactory::getApplication();
$model = $this->getModel('Reset', 'UsersModel');
$data = $this->input->get('jform', array(),
'array');
// Confirm the password reset request.
$return = $model->processResetConfirm($data);
// Check for a hard error.
if ($return instanceof Exception)
{
// Get the error message to display.
if ($app->get('error_reporting'))
{
$message = $return->getMessage();
}
else
{
$message = JText::_('COM_USERS_RESET_CONFIRM_ERROR');
}
// Go back to the confirm form.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=confirm',
false), $message, 'error');
return false;
}
elseif ($return === false)
{
// Confirm failed.
// Go back to the confirm form.
$message = JText::sprintf('COM_USERS_RESET_CONFIRM_FAILED',
$model->getError());
$this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=confirm',
false), $message, 'notice');
return false;
}
else
{
// Confirm succeeded.
// Proceed to step three.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=complete',
false));
return true;
}
}
/**
* Method to complete the password reset process.
*
* @return boolean
*
* @since 1.6
*/
public function complete()
{
// Check for request forgeries
$this->checkToken('post');
$app = JFactory::getApplication();
$model = $this->getModel('Reset', 'UsersModel');
$data = $this->input->post->get('jform', array(),
'array');
// Complete the password reset request.
$return = $model->processResetComplete($data);
// Check for a hard error.
if ($return instanceof Exception)
{
// Get the error message to display.
if ($app->get('error_reporting'))
{
$message = $return->getMessage();
}
else
{
$message = JText::_('COM_USERS_RESET_COMPLETE_ERROR');
}
// Go back to the complete form.
$this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=complete',
false), $message, 'error');
return false;
}
elseif ($return === false)
{
// Complete failed.
// Go back to the complete form.
$message = JText::sprintf('COM_USERS_RESET_COMPLETE_FAILED',
$model->getError());
$this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=complete',
false), $message, 'notice');
return false;
}
else
{
// Complete succeeded.
// Proceed to the login form.
$message = JText::_('COM_USERS_RESET_COMPLETE_SUCCESS');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login',
false), $message);
return true;
}
}
}
PK�F�[k�ĕ�!�!com_users/controllers/user.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JLoader::register('UsersController', JPATH_COMPONENT .
'/controller.php');
/**
* Registration controller class for Users.
*
* @since 1.6
*/
class UsersControllerUser extends UsersController
{
/**
* Method to log in a user.
*
* @return void
*
* @since 1.6
*/
public function login()
{
$this->checkToken('post');
$app = JFactory::getApplication();
$input = $app->input->getInputForRequestMethod();
// Populate the data array:
$data = array();
$data['return'] =
base64_decode($input->get('return', '',
'BASE64'));
$data['username'] = $input->get('username',
'', 'USERNAME');
$data['password'] = $input->get('password',
'', 'RAW');
$data['secretkey'] = $input->get('secretkey',
'', 'RAW');
// Check for a simple menu item id
if (is_numeric($data['return']))
{
if (JLanguageMultilang::isEnabled())
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('language')
->from($db->quoteName('#__menu'))
->where('client_id = 0')
->where('id =' . $data['return']);
$db->setQuery($query);
try
{
$language = $db->loadResult();
}
catch (RuntimeException $e)
{
return;
}
if ($language !== '*')
{
$lang = '&lang=' . $language;
}
else
{
$lang = '';
}
}
else
{
$lang = '';
}
$data['return'] = 'index.php?Itemid=' .
$data['return'] . $lang;
}
else
{
// Don't redirect to an external URL.
if (!JUri::isInternal($data['return']))
{
$data['return'] = '';
}
}
// Set the return URL if empty.
if (empty($data['return']))
{
$data['return'] =
'index.php?option=com_users&view=profile';
}
// Set the return URL in the user state to allow modification by plugins
$app->setUserState('users.login.form.return',
$data['return']);
// Get the log in options.
$options = array();
$options['remember'] =
$this->input->getBool('remember', false);
$options['return'] = $data['return'];
// Get the log in credentials.
$credentials = array();
$credentials['username'] = $data['username'];
$credentials['password'] = $data['password'];
$credentials['secretkey'] = $data['secretkey'];
// Perform the log in.
if (true !== $app->login($credentials, $options))
{
// Login failed !
// Clear user name, password and secret key before sending the login
form back to the user.
$data['remember'] = (int) $options['remember'];
$data['username'] = '';
$data['password'] = '';
$data['secretkey'] = '';
$app->setUserState('users.login.form.data', $data);
$app->redirect(JRoute::_('index.php?option=com_users&view=login',
false));
}
// Success
if ($options['remember'] == true)
{
$app->setUserState('rememberLogin', true);
}
$app->setUserState('users.login.form.data', array());
$app->redirect(JRoute::_($app->getUserState('users.login.form.return'),
false));
}
/**
* Method to log out a user.
*
* @return void
*
* @since 1.6
*/
public function logout()
{
$this->checkToken('request');
$app = JFactory::getApplication();
// Prepare the logout options.
$options = array(
'clientid' => $app->get('shared_session',
'0') ? null : 0,
);
// Perform the log out.
$error = $app->logout(null, $options);
$input = $app->input->getInputForRequestMethod();
// Check if the log out succeeded.
if ($error instanceof Exception)
{
$app->redirect(JRoute::_('index.php?option=com_users&view=login',
false));
}
// Get the return URL from the request and validate that it is internal.
$return = $input->get('return', '',
'BASE64');
$return = base64_decode($return);
// Check for a simple menu item id
if (is_numeric($return))
{
if (JLanguageMultilang::isEnabled())
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('language')
->from($db->quoteName('#__menu'))
->where('client_id = 0')
->where('id =' . $return);
$db->setQuery($query);
try
{
$language = $db->loadResult();
}
catch (RuntimeException $e)
{
return;
}
if ($language !== '*')
{
$lang = '&lang=' . $language;
}
else
{
$lang = '';
}
}
else
{
$lang = '';
}
$return = 'index.php?Itemid=' . $return . $lang;
}
else
{
// Don't redirect to an external URL.
if (!JUri::isInternal($return))
{
$return = '';
}
}
// In case redirect url is not set, redirect user to homepage
if (empty($return))
{
$return = JUri::root();
}
// Redirect the user.
$app->redirect(JRoute::_($return, false));
}
/**
* Method to logout directly and redirect to page.
*
* @return void
*
* @since 3.5
*/
public function menulogout()
{
// Get the ItemID of the page to redirect after logout
$app = JFactory::getApplication();
$active = $app->getMenu()->getActive();
$itemid = $active ? $active->getParams()->get('logout') :
0;
// Get the language of the page when multilang is on
if (JLanguageMultilang::isEnabled())
{
if ($itemid)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('language')
->from($db->quoteName('#__menu'))
->where('client_id = 0')
->where('id =' . $itemid);
$db->setQuery($query);
try
{
$language = $db->loadResult();
}
catch (RuntimeException $e)
{
return;
}
if ($language !== '*')
{
$lang = '&lang=' . $language;
}
else
{
$lang = '';
}
// URL to redirect after logout
$url = 'index.php?Itemid=' . $itemid . $lang;
}
else
{
// Logout is set to default. Get the home page ItemID
$lang_code =
$app->input->cookie->getString(JApplicationHelper::getHash('language'));
$item = $app->getMenu()->getDefault($lang_code);
$itemid = $item->id;
// Redirect to Home page after logout
$url = 'index.php?Itemid=' . $itemid;
}
}
else
{
// URL to redirect after logout, default page if no ItemID is set
$url = $itemid ? 'index.php?Itemid=' . $itemid : JUri::root();
}
// Logout and redirect
$this->setRedirect('index.php?option=com_users&task=user.logout&'
. JSession::getFormToken() . '=1&return=' .
base64_encode($url));
}
/**
* Method to request a username reminder.
*
* @return boolean
*
* @since 1.6
*/
public function remind()
{
// Check the request token.
$this->checkToken('post');
$app = JFactory::getApplication();
$model = $this->getModel('User', 'UsersModel');
$data = $this->input->post->get('jform', array(),
'array');
// Submit the username remind request.
$return = $model->processRemindRequest($data);
// Check for a hard error.
if ($return instanceof Exception)
{
// Get the error message to display.
$message = $app->get('error_reporting')
? $return->getMessage()
: JText::_('COM_USERS_REMIND_REQUEST_ERROR');
// Get the route to the next page.
$itemid = UsersHelperRoute::getRemindRoute();
$itemid = $itemid !== null ? '&Itemid=' . $itemid :
'';
$route = 'index.php?option=com_users&view=remind' .
$itemid;
// Go back to the complete form.
$this->setRedirect(JRoute::_($route, false), $message,
'error');
return false;
}
if ($return === false)
{
// Complete failed.
// Get the route to the next page.
$itemid = UsersHelperRoute::getRemindRoute();
$itemid = $itemid !== null ? '&Itemid=' . $itemid :
'';
$route = 'index.php?option=com_users&view=remind' .
$itemid;
// Go back to the complete form.
$message = JText::sprintf('COM_USERS_REMIND_REQUEST_FAILED',
$model->getError());
$this->setRedirect(JRoute::_($route, false), $message,
'notice');
return false;
}
// Complete succeeded.
// Get the route to the next page.
$itemid = UsersHelperRoute::getLoginRoute();
$itemid = $itemid !== null ? '&Itemid=' . $itemid :
'';
$route = 'index.php?option=com_users&view=login' . $itemid;
// Proceed to the login form.
$message = JText::_('COM_USERS_REMIND_REQUEST_SUCCESS');
$this->setRedirect(JRoute::_($route, false), $message);
return true;
}
/**
* Method to resend a user.
*
* @return void
*
* @since 1.6
*/
public function resend()
{
// Check for request forgeries
// $this->checkToken('post');
}
}
PK�F�[E��;��
com_users/helpers/html/users.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
/**
* Users Html Helper
*
* @since 1.6
*/
abstract class JHtmlUsers
{
/**
* Get the sanitized value
*
* @param mixed $value Value of the field
*
* @return mixed String/void
*
* @since 1.6
*/
public static function value($value)
{
if (is_string($value))
{
$value = trim($value);
}
if (empty($value))
{
return JText::_('COM_USERS_PROFILE_VALUE_NOT_FOUND');
}
elseif (!is_array($value))
{
return htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
}
}
/**
* Get the space symbol
*
* @param mixed $value Value of the field
*
* @return string
*
* @since 1.6
*/
public static function spacer($value)
{
return '';
}
/**
* Get the sanitized helpsite link
*
* @param mixed $value Value of the field
*
* @return mixed String/void
*
* @since 1.6
*/
public static function helpsite($value)
{
if (empty($value))
{
return static::value($value);
}
$text = $value;
if ($xml = simplexml_load_file(JPATH_ADMINISTRATOR .
'/help/helpsites.xml'))
{
foreach ($xml->sites->site as $site)
{
if ((string) $site->attributes()->url == $value)
{
$text = (string) $site;
break;
}
}
}
$value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
if (strpos($value, 'http') === 0)
{
return '<a href="' . $value . '">' .
$text . '</a>';
}
return '<a href="http://' . $value .
'">' . $text . '</a>';
}
/**
* Get the sanitized template style
*
* @param mixed $value Value of the field
*
* @return mixed String/void
*
* @since 1.6
*/
public static function templatestyle($value)
{
if (empty($value))
{
return static::value($value);
}
else
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('title')
->from('#__template_styles')
->where('id = ' . $db->quote($value));
$db->setQuery($query);
$title = $db->loadResult();
if ($title)
{
return htmlspecialchars($title, ENT_COMPAT, 'UTF-8');
}
else
{
return static::value('');
}
}
}
/**
* Get the sanitized language
*
* @param mixed $value Value of the field
*
* @return mixed String/void
*
* @since 1.6
*/
public static function admin_language($value)
{
if (empty($value))
{
return static::value($value);
}
else
{
$file = JLanguageHelper::getLanguagePath(JPATH_ADMINISTRATOR, $value) .
'/' . $value . '.xml';
$result = null;
if (is_file($file))
{
$result = JLanguageHelper::parseXMLLanguageFile($file);
}
if ($result)
{
return htmlspecialchars($result['name'], ENT_COMPAT,
'UTF-8');
}
else
{
return static::value('');
}
}
}
/**
* Get the sanitized language
*
* @param mixed $value Value of the field
*
* @return mixed String/void
*
* @since 1.6
*/
public static function language($value)
{
if (empty($value))
{
return static::value($value);
}
else
{
$file = JLanguageHelper::getLanguagePath(JPATH_SITE, $value) .
'/' . $value . '.xml';
$result = null;
if (is_file($file))
{
$result = JLanguageHelper::parseXMLLanguageFile($file);
}
if ($result)
{
return htmlspecialchars($result['name'], ENT_COMPAT,
'UTF-8');
}
else
{
return static::value('');
}
}
}
/**
* Get the sanitized editor name
*
* @param mixed $value Value of the field
*
* @return mixed String/void
*
* @since 1.6
*/
public static function editor($value)
{
if (empty($value))
{
return static::value($value);
}
else
{
$db = JFactory::getDbo();
$lang = JFactory::getLanguage();
$query = $db->getQuery(true)
->select('name')
->from('#__extensions')
->where('element = ' . $db->quote($value))
->where('folder = ' . $db->quote('editors'));
$db->setQuery($query);
$title = $db->loadResult();
if ($title)
{
$lang->load("plg_editors_$value.sys", JPATH_ADMINISTRATOR,
null, false, true)
|| $lang->load("plg_editors_$value.sys", JPATH_PLUGINS .
'/editors/' . $value, null, false, true);
$lang->load($title . '.sys');
return JText::_($title);
}
else
{
return static::value('');
}
}
}
}
PK�F�[���4��"com_users/helpers/legacyrouter.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Legacy routing rules class from com_users
*
* @since 3.6
* @deprecated 4.0
*/
class UsersRouterRulesLegacy implements JComponentRouterRulesInterface
{
/**
* Constructor for this legacy router
*
* @param JComponentRouterAdvanced $router The router this rule
belongs to
*
* @since 3.6
* @deprecated 4.0
*/
public function __construct($router)
{
$this->router = $router;
}
/**
* Preprocess the route for the com_users component
*
* @param array &$query An array of URL arguments
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function preprocess(&$query)
{
}
/**
* Build the route for the com_users component
*
* @param array &$query An array of URL arguments
* @param array &$segments The URL arguments to use to assemble
the subsequent URL.
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function build(&$query, &$segments)
{
// Declare static variables.
static $items;
static $default;
static $registration;
static $profile;
static $login;
static $remind;
static $resend;
static $reset;
// Get the relevant menu items if not loaded.
if (empty($items))
{
// Get all relevant menu items.
$items = $this->router->menu->getItems('component',
'com_users');
// Build an array of serialized query strings to menu item id mappings.
foreach ($items as $item)
{
if (empty($item->query['view']))
{
continue;
}
// Check to see if we have found the resend menu item.
if (empty($resend) && $item->query['view'] ===
'resend')
{
$resend = $item->id;
continue;
}
// Check to see if we have found the reset menu item.
if (empty($reset) && $item->query['view'] ===
'reset')
{
$reset = $item->id;
continue;
}
// Check to see if we have found the remind menu item.
if (empty($remind) && $item->query['view'] ===
'remind')
{
$remind = $item->id;
continue;
}
// Check to see if we have found the login menu item.
if (empty($login) && $item->query['view'] ===
'login' && (empty($item->query['layout']) ||
$item->query['layout'] === 'default'))
{
$login = $item->id;
continue;
}
// Check to see if we have found the registration menu item.
if (empty($registration) && $item->query['view']
=== 'registration')
{
$registration = $item->id;
continue;
}
// Check to see if we have found the profile menu item.
if (empty($profile) && $item->query['view'] ===
'profile')
{
$profile = $item->id;
}
}
// Set the default menu item to use for com_users if possible.
if ($profile)
{
$default = $profile;
}
elseif ($registration)
{
$default = $registration;
}
elseif ($login)
{
$default = $login;
}
}
if (!empty($query['view']))
{
switch ($query['view'])
{
case 'reset':
if ($query['Itemid'] = $reset)
{
unset($query['view']);
}
else
{
$query['Itemid'] = $default;
}
break;
case 'resend':
if ($query['Itemid'] = $resend)
{
unset($query['view']);
}
else
{
$query['Itemid'] = $default;
}
break;
case 'remind':
if ($query['Itemid'] = $remind)
{
unset($query['view']);
}
else
{
$query['Itemid'] = $default;
}
break;
case 'login':
if ($query['Itemid'] = $login)
{
unset($query['view']);
}
else
{
$query['Itemid'] = $default;
}
break;
case 'registration':
if ($query['Itemid'] = $registration)
{
unset($query['view']);
}
else
{
$query['Itemid'] = $default;
}
break;
default:
case 'profile':
if (!empty($query['view']))
{
$segments[] = $query['view'];
}
unset($query['view']);
if ($query['Itemid'] = $profile)
{
unset($query['view']);
}
else
{
$query['Itemid'] = $default;
}
// Only append the user id if not "me".
$user = JFactory::getUser();
if (!empty($query['user_id']) &&
($query['user_id'] != $user->id))
{
$segments[] = $query['user_id'];
}
unset($query['user_id']);
break;
}
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-',
$segments[$i]);
}
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
* @param array &$vars The URL attributes to be used by the
application.
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function parse(&$segments, &$vars)
{
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = preg_replace('/-/', ':',
$segments[$i], 1);
}
// Only run routine if there are segments to parse.
if (count($segments) < 1)
{
return;
}
// Get the package from the route segments.
$userId = array_pop($segments);
if (!is_numeric($userId))
{
$vars['view'] = 'profile';
return;
}
if (is_numeric($userId))
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__users'))
->where($db->quoteName('id') . ' = ' . (int)
$userId);
$db->setQuery($query);
$userId = $db->loadResult();
}
// Set the package id if present.
if ($userId)
{
// Set the package id.
$vars['user_id'] = (int) $userId;
// Set the view to package if not already set.
if (empty($vars['view']))
{
$vars['view'] = 'profile';
}
}
else
{
JError::raiseError(404,
JText::_('JGLOBAL_RESOURCE_NOT_FOUND'));
}
}
}
PK�F�[�,.GYYcom_users/helpers/route.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
/**
* Users Route Helper
*
* @since 1.6
* @deprecated 4.0
*/
class UsersHelperRoute
{
/**
* Method to get the menu items for the component.
*
* @return array An array of menu items.
*
* @since 1.6
* @deprecated 4.0
*/
public static function &getItems()
{
static $items;
// Get the menu items for this component.
if (!isset($items))
{
$component = JComponentHelper::getComponent('com_users');
$items =
JFactory::getApplication()->getMenu()->getItems('component_id',
$component->id);
// If no items found, set to empty array.
if (!$items)
{
$items = array();
}
}
return $items;
}
/**
* Method to get a route configuration for the login view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
* @deprecated 4.0
*/
public static function getLoginRoute()
{
// Get the items.
$items = self::getItems();
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) &&
$item->query['view'] === 'login' &&
(empty($item->query['layout']) ||
$item->query['layout'] === 'default'))
{
return $item->id;
}
}
return null;
}
/**
* Method to get a route configuration for the profile view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
* @deprecated 4.0
*/
public static function getProfileRoute()
{
// Get the items.
$items = self::getItems();
// Search for a suitable menu id.
// Menu link can only go to users own profile.
foreach ($items as $item)
{
if (isset($item->query['view']) &&
$item->query['view'] === 'profile')
{
return $item->id;
}
}
return null;
}
/**
* Method to get a route configuration for the registration view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
* @deprecated 4.0
*/
public static function getRegistrationRoute()
{
// Get the items.
$items = self::getItems();
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) &&
$item->query['view'] === 'registration')
{
return $item->id;
}
}
return null;
}
/**
* Method to get a route configuration for the remind view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
* @deprecated 4.0
*/
public static function getRemindRoute()
{
// Get the items.
$items = self::getItems();
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) &&
$item->query['view'] === 'remind')
{
return $item->id;
}
}
return null;
}
/**
* Method to get a route configuration for the resend view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
* @deprecated 4.0
*/
public static function getResendRoute()
{
// Get the items.
$items = self::getItems();
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) &&
$item->query['view'] === 'resend')
{
return $item->id;
}
}
return null;
}
/**
* Method to get a route configuration for the reset view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
* @deprecated 4.0
*/
public static function getResetRoute()
{
// Get the items.
$items = self::getItems();
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) &&
$item->query['view'] === 'reset')
{
return $item->id;
}
}
return null;
}
}
PK�F�[��H[XX-com_users/layouts/joomla/form/renderfield.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @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;
extract($displayData);
/**
* Layout variables
* ---------------------
* $options : (array) Optional parameters
* $label : (string) The html code for the label (not required
if $options['hiddenLabel'] is true)
* $input : (string) The input field html code
*/
if (!empty($options['showonEnabled']))
{
JHtml::_('jquery.framework');
JHtml::_('script', 'jui/cms.js',
array('version' => 'auto', 'relative'
=> true));
}
$class = empty($options['class']) ? '' : ' '
. $options['class'];
$rel = empty($options['rel']) ? '' : ' ' .
$options['rel'];
/**
* @TODO:
*
* As mentioned in #8473 (https://github.com/joomla/joomla-cms/pull/8473),
...
* as long as we cannot access the field properties properly, this seems to
* be the way to go for now.
*
* On a side note: Parsing html is seldom a good idea.
*
https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454
*/
preg_match('/class=\"([^\"]+)\"/i', $input,
$match);
$required = (strpos($input, 'aria-required="true"')
!== false || (!empty($match[1]) && strpos($match[1],
'required') !== false));
$typeOfSpacer = (strpos($label, 'spacer-lbl') !== false);
?>
<div class="control-group<?php echo $class; ?>"<?php
echo $rel; ?>>
<?php if (empty($options['hiddenLabel'])): ?>
<div class="control-label">
<?php echo $label; ?>
<?php if (!$required && !$typeOfSpacer) : ?>
<span class="optional"><?php echo
JText::_('COM_USERS_OPTIONAL'); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="controls">
<?php echo $input; ?>
</div>
</div>
PK�F�[����#com_users/models/forms/frontend.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fields name="params">
<!-- Basic user account settings. -->
<fieldset name="params"
label="COM_USERS_SETTINGS_FIELDSET_LABEL">
<field
name="editor"
type="plugins"
label="COM_USERS_USER_FIELD_EDITOR_LABEL"
description="COM_USERS_USER_FIELD_EDITOR_DESC"
folder="editors"
useaccess="true"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field
name="timezone"
type="timezone"
label="COM_USERS_USER_FIELD_TIMEZONE_LABEL"
description="COM_USERS_USER_FIELD_TIMEZONE_DESC"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field
name="language"
type="language"
label="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_LABEL"
description="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_DESC"
client="site"
filter="cmd"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
</fieldset>
</fields>
</form>
PK�F�[�qn)com_users/models/forms/frontend_admin.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fields name="params">
<!-- Backend user account settings. -->
<fieldset name="params"
label="COM_USERS_SETTINGS_FIELDSET_LABEL">
<field
name="admin_style"
type="templatestyle"
label="COM_USERS_USER_FIELD_BACKEND_TEMPLATE_LABEL"
description="COM_USERS_USER_FIELD_BACKEND_TEMPLATE_DESC"
client="administrator"
filter="uint"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field
name="admin_language"
type="language"
label="COM_USERS_USER_FIELD_BACKEND_LANGUAGE_LABEL"
description="COM_USERS_USER_FIELD_BACKEND_LANGUAGE_DESC"
client="administrator"
filter="cmd"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
</fieldset>
</fields>
</form>
PK�F�[[�����
com_users/models/forms/login.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="credentials"
label="COM_USERS_LOGIN_DEFAULT_LABEL">
<field
name="username"
type="text"
label="COM_USERS_LOGIN_USERNAME_LABEL"
class="validate-username"
filter="username"
size="25"
required="true"
validate="username"
autofocus="true"
/>
<field
name="password"
type="password"
label="JGLOBAL_PASSWORD"
class="validate-password"
required="true"
filter="raw"
size="25"
/>
</fieldset>
<field
name="secretkey"
type="text"
label="JGLOBAL_SECRETKEY"
autocomplete="one-time-code"
class=""
filter="int"
size="25"
/>
<fieldset>
<field
name="return"
type="hidden"
/>
</fieldset>
</form>
PK�F�[3��cqq"com_users/models/forms/profile.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="core"
label="COM_USERS_PROFILE_DEFAULT_LABEL">
<field
name="id"
type="hidden"
filter="integer"
/>
<field
name="name"
type="text"
label="COM_USERS_PROFILE_NAME_LABEL"
description="COM_USERS_PROFILE_NAME_DESC"
filter="string"
required="true"
size="30"
/>
<field
name="username"
type="text"
label="COM_USERS_PROFILE_USERNAME_LABEL"
description="COM_USERS_DESIRED_USERNAME"
class="validate-username"
filter="username"
message="COM_USERS_PROFILE_USERNAME_MESSAGE"
required="true"
size="30"
validate="username"
/>
<field
name="password1"
type="password"
label="COM_USERS_PROFILE_PASSWORD1_LABEL"
description="COM_USERS_DESIRED_PASSWORD"
autocomplete="off"
class="validate-password"
filter="raw"
size="30"
validate="password"
/>
<field
name="password2"
type="password"
label="COM_USERS_PROFILE_PASSWORD2_LABEL"
description="COM_USERS_PROFILE_PASSWORD2_DESC"
autocomplete="off"
class="validate-password"
field="password1"
filter="raw"
message="COM_USERS_PROFILE_PASSWORD1_MESSAGE"
size="30"
validate="equals"
/>
<field
name="email1"
type="email"
label="COM_USERS_PROFILE_EMAIL1_LABEL"
description="COM_USERS_PROFILE_EMAIL1_DESC"
filter="string"
required="true"
size="30"
unique="true"
validate="email"
validDomains="com_users.domains"
autocomplete="email"
/>
<field
name="email2"
type="email"
label="COM_USERS_PROFILE_EMAIL2_LABEL"
description="COM_USERS_PROFILE_EMAIL2_DESC"
field="email1"
filter="string"
message="COM_USERS_PROFILE_EMAIL2_MESSAGE"
required="true"
size="30"
validate="equals"
/>
</fieldset>
<!-- Used to get the two factor authentication configuration -->
<field
name="twofactor"
type="hidden"
/>
</form>
PK�F�[H�'com_users/models/forms/registration.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default"
label="COM_USERS_REGISTRATION_DEFAULT_LABEL">
<field
name="spacer"
type="spacer"
label="COM_USERS_REGISTER_REQUIRED"
class="text"
/>
<field
name="name"
type="text"
label="COM_USERS_REGISTER_NAME_LABEL"
description="COM_USERS_REGISTER_NAME_DESC"
filter="string"
required="true"
size="30"
/>
<field
name="username"
type="text"
label="COM_USERS_REGISTER_USERNAME_LABEL"
description="COM_USERS_DESIRED_USERNAME"
class="validate-username"
filter="username"
message="COM_USERS_REGISTER_USERNAME_MESSAGE"
required="true"
size="30"
validate="username"
/>
<field
name="password1"
type="password"
label="COM_USERS_PROFILE_PASSWORD1_LABEL"
description="COM_USERS_DESIRED_PASSWORD"
autocomplete="off"
class="validate-password"
field="password1"
filter="raw"
size="30"
validate="password"
required="true"
/>
<field
name="password2"
type="password"
label="COM_USERS_PROFILE_PASSWORD2_LABEL"
description="COM_USERS_PROFILE_PASSWORD2_DESC"
autocomplete="off"
class="validate-password"
field="password1"
filter="raw"
message="COM_USERS_PROFILE_PASSWORD1_MESSAGE"
size="30"
validate="equals"
required="true"
/>
<field
name="email1"
type="email"
label="COM_USERS_REGISTER_EMAIL1_LABEL"
description="COM_USERS_REGISTER_EMAIL1_DESC"
field="id"
filter="string"
required="true"
size="30"
unique="true"
validate="email"
validDomains="com_users.domains"
autocomplete="email"
/>
<field
name="email2"
type="email"
label="COM_USERS_REGISTER_EMAIL2_LABEL"
description="COM_USERS_REGISTER_EMAIL2_DESC"
field="email1"
filter="string"
message="COM_USERS_REGISTER_EMAIL2_MESSAGE"
required="true"
size="30"
validate="equals"
/>
<field
name="captcha"
type="captcha"
label="COM_USERS_CAPTCHA_LABEL"
description="COM_USERS_CAPTCHA_DESC"
validate="captcha"
/>
</fieldset>
</form>
PK�F�[j�%��!com_users/models/forms/remind.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default"
label="COM_USERS_REMIND_DEFAULT_LABEL">
<field
name="email"
type="email"
label="COM_USERS_FIELD_REMIND_EMAIL_LABEL"
description="COM_USERS_FIELD_REMIND_EMAIL_DESC"
required="true"
size="30"
validate="email"
autocomplete="email"
/>
<field
name="captcha"
type="captcha"
label="COM_USERS_CAPTCHA_LABEL"
description="COM_USERS_CAPTCHA_DESC"
validate="captcha"
/>
</fieldset>
</form>PK�F�[.8��)com_users/models/forms/reset_complete.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default"
label="COM_USERS_RESET_COMPLETE_LABEL">
<field
name="password1"
type="password"
label="COM_USERS_FIELD_RESET_PASSWORD1_LABEL"
description="COM_USERS_FIELD_RESET_PASSWORD1_DESC"
autocomplete="off"
class="validate-password"
field="password2"
filter="raw"
message="COM_USERS_FIELD_RESET_PASSWORD1_MESSAGE"
required="true"
size="30"
validate="equals"
/>
<field
name="password2"
type="password"
label="COM_USERS_FIELD_RESET_PASSWORD2_LABEL"
description="COM_USERS_FIELD_RESET_PASSWORD2_DESC"
autocomplete="off"
class="validate-password"
filter="raw"
required="true"
size="30"
validate="password"
/>
</fieldset>
</form>PK�F�[���H--(com_users/models/forms/reset_confirm.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default"
label="COM_USERS_RESET_CONFIRM_LABEL">
<field
name="username"
type="text"
label="COM_USERS_FIELD_RESET_CONFIRM_USERNAME_LABEL"
description="COM_USERS_FIELD_RESET_CONFIRM_USERNAME_DESC"
filter="username"
required="true"
size="30"
/>
<field
name="token"
type="text"
label="COM_USERS_FIELD_RESET_CONFIRM_TOKEN_LABEL"
description="COM_USERS_FIELD_RESET_CONFIRM_TOKEN_DESC"
filter="alnum"
required="true"
size="32"
/>
</fieldset>
</form>
PK�F�[���(com_users/models/forms/reset_request.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default"
label="COM_USERS_RESET_REQUEST_LABEL">
<field
name="email"
type="text"
label="COM_USERS_FIELD_PASSWORD_RESET_LABEL"
description="COM_USERS_FIELD_PASSWORD_RESET_DESC"
class="validate-username"
filter="email"
required="true"
size="30"
/>
<field
name="captcha"
type="captcha"
label="COM_USERS_CAPTCHA_LABEL"
description="COM_USERS_CAPTCHA_DESC"
validate="captcha"
/>
</fieldset>
</form>PK�F�[`����#com_users/models/forms/sitelang.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
<fields name="params">
<fieldset name="params"
label="COM_USERS_SETTINGS_FIELDSET_LABEL">
<field
name="language"
type="language"
label="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_LABEL"
description="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_DESC"
client="site"
filter="cmd"
default="active"
/>
</fieldset>
</fields>
</form>PK�F�[�S&p�
�
com_users/models/login.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright (C) 2010 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Rest model class for Users.
*
* @since 1.6
*/
class UsersModelLogin extends JModelForm
{
/**
* Method to get the login form.
*
* The base form is loaded from XML and then an event is fired
* for users plugins to extend the form with extra fields.
*
* @param array $data An optional array of data for the form to
interrogate.
* @param boolean $loadData True if the form is to load its own data
(default case), false if not.
*
* @return JForm 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_users.login',
'login', array('load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return array The default data is an empty array.
*
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered login form data.
$app = JFactory::getApplication();
$data = $app->getUserState('users.login.form.data',
array());
$input = $app->input->getInputForRequestMethod();
// Check for return URL from the request first
if ($return = $input->get('return', '',
'BASE64'))
{
$data['return'] = base64_decode($return);
if (!JUri::isInternal($data['return']))
{
$data['return'] = '';
}
}
$app->setUserState('users.login.form.data', $data);
$this->preprocessData('com_users.login', $data);
return $data;
}
/**
* Method to auto-populate the model state.
*
* Calling getState in this method will result in recursion.
*
* @return void
*
* @since 1.6
*/
protected function populateState()
{
// Get the application object.
$params =
JFactory::getApplication()->getParams('com_users');
// Load the parameters.
$this->setState('params', $params);
}
/**
* Override JModelAdmin::preprocessForm to ensure the correct plugin group
is loaded.
*
* @param JForm $form A JForm object.
* @param mixed $data The data expected for the form.
* @param string $group The name of the plugin group to import
(defaults to "content").
*
* @return void
*
* @since 1.6
* @throws Exception if there is an error in the form event.
*/
protected function preprocessForm(JForm $form, $data, $group =
'user')
{
parent::preprocessForm($form, $data, $group);
}
}
PK�F�[��9k,k,com_users/models/profile.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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\CMS\User\UserHelper;
use Joomla\Registry\Registry;
/**
* Profile model class for Users.
*
* @since 1.6
*/
class UsersModelProfile extends JModelForm
{
/**
* @var object The user profile data.
* @since 1.6
*/
protected $data;
/**
* Constructor
*
* @param array $config An array of configuration options (name,
state, dbo, table_path, ignore_request).
*
* @since 3.2
*
* @throws Exception
*/
public function __construct($config = array())
{
$config = array_merge(
array(
'events_map' => array('validate' =>
'user')
), $config
);
parent::__construct($config);
// Load the helper and model used for two factor authentication
JLoader::register('UsersModelUser', JPATH_ADMINISTRATOR .
'/components/com_users/models/user.php');
JLoader::register('UsersHelper', JPATH_ADMINISTRATOR .
'/components/com_users/helpers/users.php');
}
/**
* Method to check in a user.
*
* @param integer $userId The id of the row to check out.
*
* @return boolean True on success, false on failure.
*
* @since 1.6
*/
public function checkin($userId = null)
{
// Get the user id.
$userId = (!empty($userId)) ? $userId : (int)
$this->getState('user.id');
if ($userId)
{
// Initialise the table with JUser.
$table = JTable::getInstance('User');
// Attempt to check the row in.
if (!$table->checkin($userId))
{
$this->setError($table->getError());
return false;
}
}
return true;
}
/**
* Method to check out a user for editing.
*
* @param integer $userId The id of the row to check out.
*
* @return boolean True on success, false on failure.
*
* @since 1.6
*/
public function checkout($userId = null)
{
// Get the user id.
$userId = (!empty($userId)) ? $userId : (int)
$this->getState('user.id');
if ($userId)
{
// Initialise the table with JUser.
$table = JTable::getInstance('User');
// Get the current user object.
$user = JFactory::getUser();
// Attempt to check the row out.
if (!$table->checkout($user->get('id'), $userId))
{
$this->setError($table->getError());
return false;
}
}
return true;
}
/**
* Method to get the profile form data.
*
* The base form data is loaded and then an event is fired
* for users plugins to extend the data.
*
* @return mixed Data object on success, false on failure.
*
* @since 1.6
*/
public function getData()
{
if ($this->data === null)
{
$userId = $this->getState('user.id');
// Initialise the table with JUser.
$this->data = new JUser($userId);
// Set the base user data.
$this->data->email1 = $this->data->get('email');
$this->data->email2 = $this->data->get('email');
// Override the base user data with any data in the session.
$temp = (array)
JFactory::getApplication()->getUserState('com_users.edit.profile.data',
array());
foreach ($temp as $k => $v)
{
$this->data->$k = $v;
}
// Unset the passwords.
unset($this->data->password1, $this->data->password2);
$registry = new Registry($this->data->params);
$this->data->params = $registry->toArray();
}
return $this->data;
}
/**
* Method to get the profile form.
*
* The base form is loaded from XML and then an event is fired
* for users plugins to extend the form with extra fields.
*
* @param array $data An optional array of data for the form to
interrogate.
* @param boolean $loadData True if the form is to load its own data
(default case), false if not.
*
* @return JForm 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_users.profile',
'profile', array('control' => 'jform',
'load_data' => $loadData));
if (empty($form))
{
return false;
}
// Check for username compliance and parameter set
$isUsernameCompliant = true;
$username = $loadData ? $form->getValue('username') :
$this->loadFormData()->username;
if ($username)
{
$isUsernameCompliant =
!(preg_match('#[<>"\'%;()&\\\\]|\\.\\./#',
$username) || strlen(utf8_decode($username)) < 2
|| trim($username) !== $username);
}
$this->setState('user.username.compliant',
$isUsernameCompliant);
if ($isUsernameCompliant &&
!JComponentHelper::getParams('com_users')->get('change_login_name'))
{
$form->setFieldAttribute('username', 'class',
'');
$form->setFieldAttribute('username', 'filter',
'');
$form->setFieldAttribute('username',
'description',
'COM_USERS_PROFILE_NOCHANGE_USERNAME_DESC');
$form->setFieldAttribute('username', 'validate',
'');
$form->setFieldAttribute('username', 'message',
'');
$form->setFieldAttribute('username', 'readonly',
'true');
$form->setFieldAttribute('username', 'required',
'false');
}
// When multilanguage is set, a user's default site language should
also be a Content Language
if (JLanguageMultilang::isEnabled())
{
$form->setFieldAttribute('language', 'type',
'frontend_language', 'params');
}
// If the user needs to change their password, mark the password fields
as required
if (JFactory::getUser()->requireReset)
{
$form->setFieldAttribute('password1', 'required',
'true');
$form->setFieldAttribute('password2', 'required',
'true');
}
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()
{
$data = $this->getData();
$this->preprocessData('com_users.profile', $data,
'user');
return $data;
}
/**
* Override preprocessForm to load the user plugin group instead of
content.
*
* @param JForm $form A JForm object.
* @param mixed $data The data expected for the form.
* @param string $group The name of the plugin group to import
(defaults to "content").
*
* @return void
*
* @throws Exception if there is an error in the form event.
*
* @since 1.6
*/
protected function preprocessForm(JForm $form, $data, $group =
'user')
{
if
(JComponentHelper::getParams('com_users')->get('frontend_userparams'))
{
$form->loadFile('frontend', false);
if (JFactory::getUser()->authorise('core.login.admin'))
{
$form->loadFile('frontend_admin', false);
}
}
parent::preprocessForm($form, $data, $group);
}
/**
* 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()
{
// Get the application object.
$params =
JFactory::getApplication()->getParams('com_users');
// Get the user id.
$userId =
JFactory::getApplication()->getUserState('com_users.edit.profile.id');
$userId = !empty($userId) ? $userId : (int)
JFactory::getUser()->get('id');
// Set the user id.
$this->setState('user.id', $userId);
// Load the parameters.
$this->setState('params', $params);
}
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return mixed The user id on success, false on failure.
*
* @since 1.6
*/
public function save($data)
{
$userId = (!empty($data['id'])) ? $data['id'] : (int)
$this->getState('user.id');
$user = new JUser($userId);
// Prepare the data for the user object.
$data['email'] =
JStringPunycode::emailToPunycode($data['email1']);
$data['password'] = $data['password1'];
// Unset the username if it should not be overwritten
$isUsernameCompliant =
$this->getState('user.username.compliant');
if ($isUsernameCompliant &&
!JComponentHelper::getParams('com_users')->get('change_login_name'))
{
unset($data['username']);
}
// Unset block and sendEmail so they do not get overwritten
unset($data['block'], $data['sendEmail']);
// Handle the two factor authentication setup
if (array_key_exists('twofactor', $data))
{
$model = new UsersModelUser;
$twoFactorMethod = $data['twofactor']['method'];
// Get the current One Time Password (two factor auth) configuration
$otpConfig = $model->getOtpConfig($userId);
if ($twoFactorMethod !== 'none')
{
// Run the plugins
FOFPlatform::getInstance()->importPlugin('twofactorauth');
$otpConfigReplies =
FOFPlatform::getInstance()->runPlugins('onUserTwofactorApplyConfiguration',
array($twoFactorMethod));
// Look for a valid reply
foreach ($otpConfigReplies as $reply)
{
if (!is_object($reply) || empty($reply->method) ||
($reply->method != $twoFactorMethod))
{
continue;
}
$otpConfig->method = $reply->method;
$otpConfig->config = $reply->config;
break;
}
// Save OTP configuration.
$model->setOtpConfig($userId, $otpConfig);
// Generate one time emergency passwords if required (depleted or not
set)
if (empty($otpConfig->otep))
{
$model->generateOteps($userId);
}
}
else
{
$otpConfig->method = 'none';
$otpConfig->config = array();
$model->setOtpConfig($userId, $otpConfig);
}
// Unset the raw data
unset($data['twofactor']);
// Reload the user record with the updated OTP configuration
$user->load($userId);
}
// Bind the data.
if (!$user->bind($data))
{
$this->setError(JText::sprintf('COM_USERS_PROFILE_BIND_FAILED',
$user->getError()));
return false;
}
// Load the users plugin group.
JPluginHelper::importPlugin('user');
// Retrieve the user groups so they don't get overwritten
unset($user->groups);
$user->groups = JAccess::getGroupsByUser($user->id, false);
// Store the data.
if (!$user->save())
{
$this->setError($user->getError());
return false;
}
// Destroy all active sessions for the user after changing the password
if ($data['password'])
{
UserHelper::destroyUserSessions($user->id, true);
}
return $user->id;
}
/**
* Gets the configuration forms for all two-factor authentication methods
* in an array.
*
* @param integer $userId The user ID to load the forms for (optional)
*
* @return array
*
* @since 3.2
*/
public function getTwofactorform($userId = null)
{
$userId = (!empty($userId)) ? $userId : (int)
$this->getState('user.id');
$model = new UsersModelUser;
$otpConfig = $model->getOtpConfig($userId);
FOFPlatform::getInstance()->importPlugin('twofactorauth');
return
FOFPlatform::getInstance()->runPlugins('onUserTwofactorShowConfiguration',
array($otpConfig, $userId));
}
/**
* Returns the one time password (OTP) – a.k.a. two factor
authentication –
* configuration for a particular user.
*
* @param integer $userId The numeric ID of the user
*
* @return stdClass An object holding the OTP configuration for this
user
*
* @since 3.2
*/
public function getOtpConfig($userId = null)
{
$userId = (!empty($userId)) ? $userId : (int)
$this->getState('user.id');
$model = new UsersModelUser;
return $model->getOtpConfig($userId);
}
}
PK�F�[|1
HH!com_users/models/registration.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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\CMS\Router\Route;
/**
* Registration model class for Users.
*
* @since 1.6
*/
class UsersModelRegistration extends JModelForm
{
/**
* @var object The user registration data.
* @since 1.6
*/
protected $data;
/**
* Constructor
*
* @param array $config An array of configuration options (name,
state, dbo, table_path, ignore_request).
*
* @since 3.6
*
* @throws Exception
*/
public function __construct($config = array())
{
$config = array_merge(
array(
'events_map' => array('validate' =>
'user')
), $config
);
parent::__construct($config);
}
/**
* Method to get the user ID from the given token
*
* @param string $token The activation token.
*
* @return mixed False on failure, id of the user on success
*
* @since 3.8.13
*/
public function getUserIdFromToken($token)
{
$db = $this->getDbo();
// Get the user id based on the token.
$query = $db->getQuery(true);
$query->select($db->quoteName('id'))
->from($db->quoteName('#__users'))
->where($db->quoteName('activation') . ' = ' .
$db->quote($token))
->where($db->quoteName('block') . ' = ' . 1)
->where($db->quoteName('lastvisitDate') . ' =
' . $db->quote($db->getNullDate()));
$db->setQuery($query);
try
{
return (int) $db->loadResult();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR',
$e->getMessage()), 500);
return false;
}
}
/**
* Method to activate a user account.
*
* @param string $token The activation token.
*
* @return mixed False on failure, user object on success.
*
* @since 1.6
*/
public function activate($token)
{
$config = JFactory::getConfig();
$userParams = JComponentHelper::getParams('com_users');
$userId = $this->getUserIdFromToken($token);
// Check for a valid user id.
if (!$userId)
{
$this->setError(JText::_('COM_USERS_ACTIVATION_TOKEN_NOT_FOUND'));
return false;
}
// Load the users plugin group.
JPluginHelper::importPlugin('user');
// Activate the user.
$user = JFactory::getUser($userId);
// Admin activation is on and user is verifying their email
if (($userParams->get('useractivation') == 2) &&
!$user->getParam('activate', 0))
{
$linkMode = $config->get('force_ssl', 0) == 2 ?
Route::TLS_FORCE : Route::TLS_IGNORE;
// Compile the admin notification mail values.
$data = $user->getProperties();
$data['activation'] =
JApplicationHelper::getHash(JUserHelper::genRandomPassword());
$user->set('activation', $data['activation']);
$data['siteurl'] = JUri::base();
$data['activate'] = JRoute::link(
'site',
'index.php?option=com_users&task=registration.activate&token='
. $data['activation'],
false,
$linkMode,
true
);
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$user->setParam('activate', 1);
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_SUBJECT',
$data['name'],
$data['sitename']
);
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY',
$data['sitename'],
$data['name'],
$data['email'],
$data['username'],
$data['activate']
);
// Get all admin users
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(array('name',
'email', 'sendEmail', 'id')))
->from($db->quoteName('#__users'))
->where($db->quoteName('sendEmail') . ' = 1')
->where($db->quoteName('block') . ' = 0');
$db->setQuery($query);
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR',
$e->getMessage()), 500);
return false;
}
// Send mail to all users with users creating permissions and receiving
system emails
foreach ($rows as $row)
{
$usercreator = JFactory::getUser($row->id);
if ($usercreator->authorise('core.create',
'com_users') &&
$usercreator->authorise('core.manage', 'com_users'))
{
$return =
JFactory::getMailer()->sendMail($data['mailfrom'],
$data['fromname'], $row->email, $emailSubject, $emailBody);
// Check for an error.
if ($return !== true)
{
$this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED'));
return false;
}
}
}
}
// Admin activation is on and admin is activating the account
elseif (($userParams->get('useractivation') == 2) &&
$user->getParam('activate', 0))
{
$user->set('activation', '');
$user->set('block', '0');
// Compile the user activated notification mail values.
$data = $user->getProperties();
$user->setParam('activate', 0);
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['siteurl'] = JUri::base();
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_SUBJECT',
$data['name'],
$data['sitename']
);
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_BODY',
$data['name'],
$data['siteurl'],
$data['username']
);
$return =
JFactory::getMailer()->sendMail($data['mailfrom'],
$data['fromname'], $data['email'], $emailSubject,
$emailBody);
// Check for an error.
if ($return !== true)
{
$this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED'));
return false;
}
}
else
{
$user->set('activation', '');
$user->set('block', '0');
}
// Store the user object.
if (!$user->save())
{
$this->setError(JText::sprintf('COM_USERS_REGISTRATION_ACTIVATION_SAVE_FAILED',
$user->getError()));
return false;
}
return $user;
}
/**
* Method to get the registration form data.
*
* The base form data is loaded and then an event is fired
* for users plugins to extend the data.
*
* @return mixed Data object on success, false on failure.
*
* @since 1.6
*/
public function getData()
{
if ($this->data === null)
{
$this->data = new stdClass;
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_users');
// Override the base user data with any data in the session.
$temp = (array)
$app->getUserState('com_users.registration.data', array());
// Don't load the data in this getForm call, or we'll call
ourself
$form = $this->getForm(array(), false);
foreach ($temp as $k => $v)
{
// Here we could have a grouped field, let's check it
if (is_array($v))
{
$this->data->$k = new stdClass;
foreach ($v as $key => $val)
{
if ($form->getField($key, $k) !== false)
{
$this->data->$k->$key = $val;
}
}
}
// Only merge the field if it exists in the form.
elseif ($form->getField($k) !== false)
{
$this->data->$k = $v;
}
}
// Get the groups the user should be added to after registration.
$this->data->groups = array();
// Get the default new user group, guest or public group if not
specified.
$system = $params->get('new_usertype',
$params->get('guest_usergroup', 1));
$this->data->groups[] = $system;
// Unset the passwords.
unset($this->data->password1, $this->data->password2);
// Get the dispatcher and load the users plugins.
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('user');
// Trigger the data preparation event.
$results = $dispatcher->trigger('onContentPrepareData',
array('com_users.registration', $this->data));
// Check for errors encountered while preparing the data.
if (count($results) && in_array(false, $results, true))
{
$this->setError($dispatcher->getError());
$this->data = false;
}
}
return $this->data;
}
/**
* Method to get the registration form.
*
* The base form is loaded from XML and then an event is fired
* for users plugins to extend the form with extra fields.
*
* @param array $data An optional array of data for the form to
interrogate.
* @param boolean $loadData True if the form is to load its own data
(default case), false if not.
*
* @return JForm 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_users.registration',
'registration', array('control' =>
'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
// When multilanguage is set, a user's default site language should
also be a Content Language
if (JLanguageMultilang::isEnabled())
{
$form->setFieldAttribute('language', 'type',
'frontend_language', 'params');
}
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()
{
$data = $this->getData();
if (JLanguageMultilang::isEnabled() && empty($data->language))
{
$data->language = JFactory::getLanguage()->getTag();
}
$this->preprocessData('com_users.registration', $data);
return $data;
}
/**
* Override preprocessForm to load the user plugin group instead of
content.
*
* @param JForm $form A JForm object.
* @param mixed $data The data expected for the form.
* @param string $group The name of the plugin group to import
(defaults to "content").
*
* @return void
*
* @since 1.6
* @throws Exception if there is an error in the form event.
*/
protected function preprocessForm(JForm $form, $data, $group =
'user')
{
$userParams = JComponentHelper::getParams('com_users');
// Add the choice for site language at registration time
if ($userParams->get('site_language') == 1 &&
$userParams->get('frontend_userparams') == 1)
{
$form->loadFile('sitelang', false);
}
parent::preprocessForm($form, $data, $group);
}
/**
* 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()
{
// Get the application object.
$app = JFactory::getApplication();
$params = $app->getParams('com_users');
// Load the parameters.
$this->setState('params', $params);
}
/**
* Method to save the form data.
*
* @param array $temp The form data.
*
* @return mixed The user id on success, false on failure.
*
* @since 1.6
*/
public function register($temp)
{
$params = JComponentHelper::getParams('com_users');
// Initialise the table with JUser.
$user = new JUser;
$data = (array) $this->getData();
// Merge in the registration data.
foreach ($temp as $k => $v)
{
$data[$k] = $v;
}
// Prepare the data for the user object.
$data['email'] =
JStringPunycode::emailToPunycode($data['email1']);
$data['password'] = $data['password1'];
$useractivation = $params->get('useractivation');
$sendpassword = $params->get('sendpassword', 1);
// Check if the user needs to activate their account.
if (($useractivation == 1) || ($useractivation == 2))
{
$data['activation'] =
JApplicationHelper::getHash(JUserHelper::genRandomPassword());
$data['block'] = 1;
}
// Bind the data.
if (!$user->bind($data))
{
$this->setError(JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED',
$user->getError()));
return false;
}
// Load the users plugin group.
JPluginHelper::importPlugin('user');
// Store the data.
if (!$user->save())
{
$this->setError(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED',
$user->getError()));
return false;
}
$config = JFactory::getConfig();
$db = $this->getDbo();
$query = $db->getQuery(true);
// Compile the notification mail values.
$data = $user->getProperties();
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['siteurl'] = JUri::root();
// Handle account activation/confirmation emails.
if ($useractivation == 2)
{
// Set the link to confirm the user email.
$linkMode = $config->get('force_ssl', 0) == 2 ?
Route::TLS_FORCE : Route::TLS_IGNORE;
$data['activate'] = JRoute::link(
'site',
'index.php?option=com_users&task=registration.activate&token='
. $data['activation'],
false,
$linkMode,
true
);
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS',
$data['name'],
$data['sitename']
);
if ($sendpassword)
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY',
$data['name'],
$data['sitename'],
$data['activate'],
$data['siteurl'],
$data['username'],
$data['password_clear']
);
}
else
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY_NOPW',
$data['name'],
$data['sitename'],
$data['activate'],
$data['siteurl'],
$data['username']
);
}
}
elseif ($useractivation == 1)
{
// Set the link to activate the user account.
$linkMode = $config->get('force_ssl', 0) == 2 ?
Route::TLS_FORCE : Route::TLS_IGNORE;
$data['activate'] = JRoute::link(
'site',
'index.php?option=com_users&task=registration.activate&token='
. $data['activation'],
false,
$linkMode,
true
);
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS',
$data['name'],
$data['sitename']
);
if ($sendpassword)
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY',
$data['name'],
$data['sitename'],
$data['activate'],
$data['siteurl'],
$data['username'],
$data['password_clear']
);
}
else
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY_NOPW',
$data['name'],
$data['sitename'],
$data['activate'],
$data['siteurl'],
$data['username']
);
}
}
else
{
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS',
$data['name'],
$data['sitename']
);
if ($sendpassword)
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_BODY',
$data['name'],
$data['sitename'],
$data['siteurl'],
$data['username'],
$data['password_clear']
);
}
else
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_BODY_NOPW',
$data['name'],
$data['sitename'],
$data['siteurl']
);
}
}
// Send the registration email.
$return = JFactory::getMailer()->sendMail($data['mailfrom'],
$data['fromname'], $data['email'], $emailSubject,
$emailBody);
// Send Notification mail to administrators
if (($params->get('useractivation') < 2) &&
($params->get('mail_to_admin') == 1))
{
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS',
$data['name'],
$data['sitename']
);
$emailBodyAdmin = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY',
$data['name'],
$data['username'],
$data['siteurl']
);
// Get all admin users
$query->clear()
->select($db->quoteName(array('name',
'email', 'sendEmail', 'id')))
->from($db->quoteName('#__users'))
->where($db->quoteName('sendEmail') . ' = 1')
->where($db->quoteName('block') . ' = 0');
$db->setQuery($query);
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR',
$e->getMessage()), 500);
return false;
}
// Send mail to all users with user creating permissions and receiving
system emails
foreach ($rows as $row)
{
$usercreator = JFactory::getUser($row->id);
if ($usercreator->authorise('core.create',
'com_users') &&
$usercreator->authorise('core.manage', 'com_users'))
{
$return =
JFactory::getMailer()->sendMail($data['mailfrom'],
$data['fromname'], $row->email, $emailSubject,
$emailBodyAdmin);
// Check for an error.
if ($return !== true)
{
$this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED'));
return false;
}
}
}
}
// Check for an error.
if ($return !== true)
{
$this->setError(JText::_('COM_USERS_REGISTRATION_SEND_MAIL_FAILED'));
// Send a system message to administrators receiving system mails
$db = $this->getDbo();
$query->clear()
->select($db->quoteName('id'))
->from($db->quoteName('#__users'))
->where($db->quoteName('block') . ' = ' .
(int) 0)
->where($db->quoteName('sendEmail') . ' = ' .
(int) 1);
$db->setQuery($query);
try
{
$userids = $db->loadColumn();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR',
$e->getMessage()), 500);
return false;
}
if (count($userids) > 0)
{
$jdate = new JDate;
// Build the query to add the messages
foreach ($userids as $userid)
{
$values = array(
$db->quote($userid),
$db->quote($userid),
$db->quote($jdate->toSql()),
$db->quote(JText::_('COM_USERS_MAIL_SEND_FAILURE_SUBJECT')),
$db->quote(JText::sprintf('COM_USERS_MAIL_SEND_FAILURE_BODY',
$return, $data['username']))
);
$query->clear()
->insert($db->quoteName('#__messages'))
->columns($db->quoteName(array('user_id_from',
'user_id_to', 'date_time', 'subject',
'message')))
->values(implode(',', $values));
$db->setQuery($query);
try
{
$db->execute();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR',
$e->getMessage()), 500);
return false;
}
}
}
return false;
}
if ($useractivation == 1)
{
return 'useractivate';
}
elseif ($useractivation == 2)
{
return 'adminactivate';
}
else
{
return $user->id;
}
}
}
PK�F�[�33com_users/models/remind.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright (C) 2010 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;
/**
* Remind model class for Users.
*
* @since 1.5
*/
class UsersModelRemind extends JModelForm
{
/**
* Method to get the username remind request form.
*
* @param array $data An optional array of data for the form to
interrogate.
* @param boolean $loadData True if the form is to load its own data
(default case), false if not.
*
* @return JFor 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_users.remind',
'remind', array('control' => 'jform',
'load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Override preprocessForm to load the user plugin group instead of
content.
*
* @param JForm $form A JForm object.
* @param mixed $data The data expected for the form.
* @param string $group The name of the plugin group to import
(defaults to "content").
*
* @return void
*
* @throws Exception if there is an error in the form event.
*
* @since 1.6
*/
protected function preprocessForm(JForm $form, $data, $group =
'user')
{
parent::preprocessForm($form, $data, 'user');
}
/**
* 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()
{
// Get the application object.
$app = JFactory::getApplication();
$params = $app->getParams('com_users');
// Load the parameters.
$this->setState('params', $params);
}
/**
* Send the remind username email
*
* @param array $data Array with the data received from the form
*
* @return boolean
*
* @since 1.6
*/
public function processRemindRequest($data)
{
// Get the form.
$form = $this->getForm();
$data['email'] =
JStringPunycode::emailToPunycode($data['email']);
// Check for an error.
if (empty($form))
{
return false;
}
// Validate the data.
$data = $this->validate($form, $data);
// Check for an error.
if ($data instanceof Exception)
{
return false;
}
// Check the validation results.
if ($data === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $formError)
{
$this->setError($formError->getMessage());
}
return false;
}
// Find the user id for the given email address.
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('*')
->from($db->quoteName('#__users'))
->where('LOWER(' . $db->quoteName('email') .
') = LOWER(' . $db->quote($data['email']) .
')');
// Get the user id.
$db->setQuery($query);
try
{
$user = $db->loadObject();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR',
$e->getMessage()), 500);
return false;
}
// Check for a user.
if (empty($user))
{
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
return false;
}
// Make sure the user isn't blocked.
if ($user->block)
{
$this->setError(JText::_('COM_USERS_USER_BLOCKED'));
return false;
}
$config = JFactory::getConfig();
// Assemble the login link.
$link = 'index.php?option=com_users&view=login';
$mode = $config->get('force_ssl', 0) == 2 ? 1 : (-1);
// Put together the email template data.
$data = ArrayHelper::fromObject($user);
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['link_text'] = JRoute::_($link, false, $mode);
$data['link_html'] = JRoute::_($link, true, $mode);
$subject = JText::sprintf(
'COM_USERS_EMAIL_USERNAME_REMINDER_SUBJECT',
$data['sitename']
);
$body = JText::sprintf(
'COM_USERS_EMAIL_USERNAME_REMINDER_BODY',
$data['sitename'],
$data['username'],
$data['link_text']
);
// Send the password reset request email.
$return = JFactory::getMailer()->sendMail($data['mailfrom'],
$data['fromname'], $user->email, $subject, $body);
// Check for an error.
if ($return !== true)
{
$this->setError(JText::_('COM_USERS_MAIL_FAILED'), 500);
return false;
}
$dispatcher = \JEventDispatcher::getInstance();
$dispatcher->trigger('onUserAfterRemind', array($user));
return true;
}
}
PK�F�[���p�1�1com_users/models/reset.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright (C) 2009 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
use Joomla\CMS\User\UserHelper;
defined('_JEXEC') or die;
/**
* Rest model class for Users.
*
* @since 1.5
*/
class UsersModelReset extends JModelForm
{
/**
* Method to get the password reset request form.
*
* The base form is loaded from XML and then an event is fired
* for users plugins to extend the form with extra fields.
*
* @param array $data An optional array of data for the form to
interrogate.
* @param boolean $loadData True if the form is to load its own data
(default case), false if not.
*
* @return JForm 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_users.reset_request',
'reset_request', array('control' =>
'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the password reset complete 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 JForm A JForm object on success, false on failure
*
* @since 1.6
*/
public function getResetCompleteForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_users.reset_complete',
'reset_complete', $options = array('control' =>
'jform'));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the password reset confirm 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 JForm A JForm object on success, false on failure
*
* @since 1.6
*/
public function getResetConfirmForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_users.reset_confirm',
'reset_confirm', $options = array('control' =>
'jform'));
if (empty($form))
{
return false;
}
else
{
$form->setValue('token', '',
JFactory::getApplication()->input->get('token'));
}
return $form;
}
/**
* Override preprocessForm to load the user plugin group instead of
content.
*
* @param JForm $form A JForm object.
* @param mixed $data The data expected for the form.
* @param string $group The name of the plugin group to import
(defaults to "content").
*
* @return void
*
* @throws Exception if there is an error in the form event.
*
* @since 1.6
*/
protected function preprocessForm(JForm $form, $data, $group =
'user')
{
parent::preprocessForm($form, $data, $group);
}
/**
* 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()
{
// Get the application object.
$params =
JFactory::getApplication()->getParams('com_users');
// Load the parameters.
$this->setState('params', $params);
}
/**
* Save the new password after reset is done
*
* @param array $data The data expected for the form.
*
* @return mixed Exception | JException | boolean
*
* @since 1.6
*/
public function processResetComplete($data)
{
// Get the form.
$form = $this->getResetCompleteForm();
// Check for an error.
if ($form instanceof Exception)
{
return $form;
}
// Filter and validate the form data.
$data = $form->filter($data);
$return = $form->validate($data);
// Check for an error.
if ($return instanceof Exception)
{
return $return;
}
// Check the validation results.
if ($return === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $formError)
{
$this->setError($formError->getMessage());
}
return false;
}
// Get the token and user id from the confirmation process.
$app = JFactory::getApplication();
$token = $app->getUserState('com_users.reset.token', null);
$userId = $app->getUserState('com_users.reset.user', null);
// Check the token and user id.
if (empty($token) || empty($userId))
{
return new
JException(JText::_('COM_USERS_RESET_COMPLETE_TOKENS_MISSING'),
403);
}
// Get the user object.
$user = JUser::getInstance($userId);
// Check for a user and that the tokens match.
if (empty($user) || $user->activation !== $token)
{
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
return false;
}
// Make sure the user isn't blocked.
if ($user->block)
{
$this->setError(JText::_('COM_USERS_USER_BLOCKED'));
return false;
}
// Check if the user is reusing the current password if required to reset
their password
if ($user->requireReset == 1 &&
JUserHelper::verifyPassword($data['password1'],
$user->password))
{
$this->setError(JText::_('JLIB_USER_ERROR_CANNOT_REUSE_PASSWORD'));
return false;
}
// Prepare user data.
$data['password'] = $data['password1'];
$data['activation'] = '';
// Update the user object.
if (!$user->bind($data))
{
return new \Exception($user->getError(), 500);
}
// Save the user to the database.
if (!$user->save(true))
{
return new
JException(JText::sprintf('COM_USERS_USER_SAVE_FAILED',
$user->getError()), 500);
}
// Destroy all active sessions for the user
UserHelper::destroyUserSessions($user->id);
// Flush the user data from the session.
$app->setUserState('com_users.reset.token', null);
$app->setUserState('com_users.reset.user', null);
return true;
}
/**
* Receive the reset password request
*
* @param array $data The data expected for the form.
*
* @return mixed Exception | JException | boolean
*
* @since 1.6
*/
public function processResetConfirm($data)
{
// Get the form.
$form = $this->getResetConfirmForm();
// Check for an error.
if ($form instanceof Exception)
{
return $form;
}
// Filter and validate the form data.
$data = $form->filter($data);
$return = $form->validate($data);
// Check for an error.
if ($return instanceof Exception)
{
return $return;
}
// Check the validation results.
if ($return === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $formError)
{
$this->setError($formError->getMessage());
}
return false;
}
// Find the user id for the given token.
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('activation')
->select('id')
->select('block')
->from($db->quoteName('#__users'))
->where($db->quoteName('username') . ' = ' .
$db->quote($data['username']));
// Get the user id.
$db->setQuery($query);
try
{
$user = $db->loadObject();
}
catch (RuntimeException $e)
{
return new
JException(JText::sprintf('COM_USERS_DATABASE_ERROR',
$e->getMessage()), 500);
}
// Check for a user.
if (empty($user))
{
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
return false;
}
if (!$user->activation)
{
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
return false;
}
// Verify the token
if (!JUserHelper::verifyPassword($data['token'],
$user->activation))
{
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
return false;
}
// Make sure the user isn't blocked.
if ($user->block)
{
$this->setError(JText::_('COM_USERS_USER_BLOCKED'));
return false;
}
// Push the user data into the session.
$app = JFactory::getApplication();
$app->setUserState('com_users.reset.token',
$user->activation);
$app->setUserState('com_users.reset.user', $user->id);
return true;
}
/**
* Method to start the password reset process.
*
* @param array $data The data expected for the form.
*
* @return mixed Exception | JException | boolean
*
* @since 1.6
*/
public function processResetRequest($data)
{
$config = JFactory::getConfig();
// Get the form.
$form = $this->getForm();
$data['email'] =
JStringPunycode::emailToPunycode($data['email']);
// Check for an error.
if ($form instanceof Exception)
{
return $form;
}
// Filter and validate the form data.
$data = $form->filter($data);
$return = $form->validate($data);
// Check for an error.
if ($return instanceof Exception)
{
return $return;
}
// Check the validation results.
if ($return === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $formError)
{
$this->setError($formError->getMessage());
}
return false;
}
// Find the user id for the given email address.
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('id')
->from($db->quoteName('#__users'))
->where('LOWER(' . $db->quoteName('email') .
') = LOWER(' . $db->quote($data['email']) .
')');
// Get the user object.
$db->setQuery($query);
try
{
$userId = $db->loadResult();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR',
$e->getMessage()), 500);
return false;
}
// Check for a user.
if (empty($userId))
{
$this->setError(JText::_('COM_USERS_INVALID_EMAIL'));
return false;
}
// Get the user object.
$user = JUser::getInstance($userId);
// Make sure the user isn't blocked.
if ($user->block)
{
$this->setError(JText::_('COM_USERS_USER_BLOCKED'));
return false;
}
// Make sure the user isn't a Super Admin.
if ($user->authorise('core.admin'))
{
$this->setError(JText::_('COM_USERS_REMIND_SUPERADMIN_ERROR'));
return false;
}
// Make sure the user has not exceeded the reset limit
if (!$this->checkResetLimit($user))
{
$resetLimit = (int)
JFactory::getApplication()->getParams()->get('reset_time');
$this->setError(JText::plural('COM_USERS_REMIND_LIMIT_ERROR_N_HOURS',
$resetLimit));
return false;
}
// Set the confirmation token.
$token = JApplicationHelper::getHash(JUserHelper::genRandomPassword());
$hashedToken = JUserHelper::hashPassword($token);
$user->activation = $hashedToken;
// Save the user to the database.
if (!$user->save(true))
{
return new
JException(JText::sprintf('COM_USERS_USER_SAVE_FAILED',
$user->getError()), 500);
}
// Assemble the password reset confirmation link.
$mode = $config->get('force_ssl', 0) == 2 ? 1 : (-1);
$link =
'index.php?option=com_users&view=reset&layout=confirm&token='
. $token;
// Put together the email template data.
$data = $user->getProperties();
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['link_text'] = JRoute::_($link, false, $mode);
$data['link_html'] = JRoute::_($link, true, $mode);
$data['token'] = $token;
$subject = JText::sprintf(
'COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT',
$data['sitename']
);
$body = JText::sprintf(
'COM_USERS_EMAIL_PASSWORD_RESET_BODY',
$data['sitename'],
$data['token'],
$data['link_text']
);
// Send the password reset request email.
$return = JFactory::getMailer()->sendMail($data['mailfrom'],
$data['fromname'], $user->email, $subject, $body);
// Check for an error.
if ($return !== true)
{
return new JException(JText::_('COM_USERS_MAIL_FAILED'), 500);
}
return true;
}
/**
* Method to check if user reset limit has been exceeded within the
allowed time period.
*
* @param JUser $user User doing the password reset
*
* @return boolean true if user can do the reset, false if limit exceeded
*
* @since 2.5
*/
public function checkResetLimit($user)
{
$params = JFactory::getApplication()->getParams();
$maxCount = (int) $params->get('reset_count');
$resetHours = (int) $params->get('reset_time');
$result = true;
$lastResetTime = strtotime($user->lastResetTime) ?: 0;
$hoursSinceLastReset = (strtotime(JFactory::getDate()->toSql()) -
$lastResetTime) / 3600;
if ($hoursSinceLastReset > $resetHours)
{
// If it's been long enough, start a new reset count
$user->lastResetTime = JFactory::getDate()->toSql();
$user->resetCount = 1;
}
elseif ($user->resetCount < $maxCount)
{
// If we are under the max count, just increment the counter
++$user->resetCount;
}
else
{
// At this point, we know we have exceeded the maximum resets for the
time period
$result = false;
}
return $result;
}
}
PK�F�[���?II+com_users/models/rules/loginuniquefield.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* JFormRule for com_users to be sure only one redirect login field has a
value
*
* @since 3.6
*/
class JFormRuleLoginUniqueField extends JFormRule
{
/**
* Method to test if two fields have a value in order to use only one
field.
* To use this rule, the form
* XML needs a validate attribute of loginuniquefield and a field
attribute
* that is equal to the field to test against.
*
* @param SimpleXMLElement $element The SimpleXMLElement object
representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control
value. This acts as an array container for the field.
* For example if the field has
name="foo" and the group value is set to "bar" then the
* full field name would end up being
"bar[foo]".
* @param Registry $input An optional Registry object with
the entire data set to validate against the entire form.
* @param JForm $form The form object for which the
field is being tested.
*
* @return boolean True if the value is valid, false otherwise.
*
* @since 3.6
*/
public function test(SimpleXMLElement $element, $value, $group = null,
Registry $input = null, JForm $form = null)
{
$loginRedirectUrl =
$input['params']->login_redirect_url;
$loginRedirectMenuitem =
$input['params']->login_redirect_menuitem;
if ($form === null)
{
throw new InvalidArgumentException(sprintf('The value for $form
must not be null in %s', get_class($this)));
}
if ($input === null)
{
throw new InvalidArgumentException(sprintf('The value for $input
must not be null in %s', get_class($this)));
}
return true;
}
}
PK�F�[�xNN,com_users/models/rules/logoutuniquefield.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright (C) 2016 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* JFormRule for com_users to be sure only one redirect logout field has a
value
*
* @since 3.6
*/
class JFormRuleLogoutUniqueField extends JFormRule
{
/**
* Method to test if two fields have a value in order to use only one
field.
* To use this rule, the form
* XML needs a validate attribute of logoutuniquefield and a field
attribute
* that is equal to the field to test against.
*
* @param SimpleXMLElement $element The SimpleXMLElement object
representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control
value. This acts as an array container for the field.
* For example if the field has
name="foo" and the group value is set to "bar" then the
* full field name would end up being
"bar[foo]".
* @param Registry $input An optional Registry object with
the entire data set to validate against the entire form.
* @param JForm $form The form object for which the
field is being tested.
*
* @return boolean True if the value is valid, false otherwise.
*
* @since 3.6
*/
public function test(SimpleXMLElement $element, $value, $group = null,
Registry $input = null, JForm $form = null)
{
$logoutRedirectUrl =
$input['params']->logout_redirect_url;
$logoutRedirectMenuitem =
$input['params']->logout_redirect_menuitem;
if ($form === null)
{
throw new InvalidArgumentException(sprintf('The value for $form
must not be null in %s', get_class($this)));
}
if ($input === null)
{
throw new InvalidArgumentException(sprintf('The value for $input
must not be null in %s', get_class($this)));
}
return true;
}
}
PK�F�[�q� com_users/router.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
/**
* Routing class from com_users
*
* @since 3.2
*/
class UsersRouter extends JComponentRouterView
{
/**
* Users Component router constructor
*
* @param JApplicationCms $app The application object
* @param JMenu $menu The menu object to work with
*/
public function __construct($app = null, $menu = null)
{
$this->registerView(new
JComponentRouterViewconfiguration('login'));
$profile = new JComponentRouterViewconfiguration('profile');
$profile->addLayout('edit');
$this->registerView($profile);
$this->registerView(new
JComponentRouterViewconfiguration('registration'));
$this->registerView(new
JComponentRouterViewconfiguration('remind'));
$this->registerView(new
JComponentRouterViewconfiguration('reset'));
parent::__construct($app, $menu);
$this->attachRule(new JComponentRouterRulesMenu($this));
$params = JComponentHelper::getParams('com_users');
if ($params->get('sef_advanced', 0))
{
$this->attachRule(new JComponentRouterRulesStandard($this));
$this->attachRule(new JComponentRouterRulesNomenu($this));
}
else
{
JLoader::register('UsersRouterRulesLegacy', __DIR__ .
'/helpers/legacyrouter.php');
$this->attachRule(new UsersRouterRulesLegacy($this));
}
}
}
/**
* Users router functions
*
* These functions are proxys for the new router interface
* for old SEF extensions.
*
* @param array &$query REQUEST query
*
* @return array Segments of the SEF url
*
* @deprecated 4.0 Use Class based routers instead
*/
function usersBuildRoute(&$query)
{
$app = JFactory::getApplication();
$router = new UsersRouter($app, $app->getMenu());
return $router->build($query);
}
/**
* Convert SEF URL segments into query variables
*
* @param array $segments Segments in the current URL
*
* @return array Query variables
*
* @deprecated 4.0 Use Class based routers instead
*/
function usersParseRoute($segments)
{
$app = JFactory::getApplication();
$router = new UsersRouter($app, $app->getMenu());
return $router->parse($segments);
}
PK�F�[
�^<��com_users/users.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JLoader::register('UsersHelperRoute', JPATH_COMPONENT .
'/helpers/route.php');
$controller = JControllerLegacy::getInstance('Users');
$controller->execute(JFactory::getApplication()->input->get('task',
'display'));
$controller->redirect();
PK�F�[�q��&com_users/views/login/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
$cookieLogin = $this->user->get('cookieLogin');
if (!empty($cookieLogin) || $this->user->get('guest'))
{
// The user is not logged in or needs to provide a password.
echo $this->loadTemplate('login');
}
else
{
// The user is already logged in.
echo $this->loadTemplate('logout');
}
PK�F�[?��|GG&com_users/views/login/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_USER_LOGIN_VIEW_DEFAULT_TITLE"
option="COM_USER_LOGIN_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_USER_LOGIN"
/>
<message>
<![CDATA[COM_USER_LOGIN_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<!-- Basic options. -->
<fieldset name="basic"
addrulepath="components/com_users/models/rules"
label="COM_MENUS_BASIC_FIELDSET_LABEL">
<field
name="loginredirectchoice"
type="radio"
label="COM_USERS_FIELD_LOGIN_REDIRECT_CHOICE_LABEL"
description="COM_USERS_FIELD_LOGIN_REDIRECT_CHOICE_DESC"
class="btn-group btn-group-yesno"
default="1"
>
<option
value="1">COM_USERS_FIELD_LOGIN_MENUITEM</option>
<option
value="0">COM_USERS_FIELD_LOGIN_URL</option>
</field>
<field
name="login_redirect_url"
type="text"
label="JFIELD_LOGIN_REDIRECT_URL_LABEL"
description="JFIELD_LOGIN_REDIRECT_URL_DESC"
class="inputbox"
validate="loginuniquefield"
field="login_redirect_menuitem"
hint="COM_USERS_FIELD_LOGIN_REDIRECT_PLACEHOLDER"
message="COM_USERS_FIELD_LOGIN_REDIRECT_ERROR"
showon="loginredirectchoice:0"
/>
<field
name="login_redirect_menuitem"
type="modal_menu"
label="COM_USERS_FIELD_LOGIN_REDIRECTMENU_LABEL"
description="COM_USERS_FIELD_LOGIN_REDIRECTMENU_DESC"
disable="separator,alias,heading,url"
showon="loginredirectchoice:1"
select="true"
new="true"
edit="true"
clear="true"
>
<option value="">JDEFAULT</option>
</field>
<field
name="logindescription_show"
type="list"
label="JFIELD_BASIS_LOGIN_DESCRIPTION_SHOW_LABEL"
description="JFIELD_BASIS_LOGIN_DESCRIPTION_SHOW_DESC"
default="1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="login_description"
type="textarea"
label="JFIELD_BASIS_LOGIN_DESCRIPTION_LABEL"
description="JFIELD_BASIS_LOGIN_DESCRIPTION_DESC"
rows="3"
cols="40"
filter="safehtml"
showon="logindescription_show:1"
/>
<field
name="login_image"
type="media"
label="JFIELD_LOGIN_IMAGE_LABEL"
description="JFIELD_LOGIN_IMAGE_DESC"
/>
<field
name="spacer1"
type="spacer"
hr="true"
/>
<field
name="logoutredirectchoice"
type="radio"
label="COM_USERS_FIELD_LOGOUT_REDIRECT_CHOICE_LABEL"
description="COM_USERS_FIELD_LOGOUT_REDIRECT_CHOICE_DESC"
class="btn-group btn-group-yesno"
default="1"
>
<option
value="1">COM_USERS_FIELD_LOGIN_MENUITEM</option>
<option
value="0">COM_USERS_FIELD_LOGIN_URL</option>
</field>
<field
name="logout_redirect_url"
type="text"
label="JFIELD_LOGOUT_REDIRECT_URL_LABEL"
description="JFIELD_LOGOUT_REDIRECT_URL_DESC"
class="inputbox"
field="logout_redirect_menuitem"
validate="logoutuniquefield"
hint="COM_USERS_FIELD_LOGIN_REDIRECT_PLACEHOLDER"
message="COM_USERS_FIELD_LOGOUT_REDIRECT_ERROR"
showon="logoutredirectchoice:0"
/>
<field
name="logout_redirect_menuitem"
type="modal_menu"
label="COM_USERS_FIELD_LOGOUT_REDIRECTMENU_LABEL"
description="COM_USERS_FIELD_LOGOUT_REDIRECTMENU_DESC"
disable="separator,alias,heading,url"
showon="logoutredirectchoice:1"
select="true"
new="true"
edit="true"
clear="true"
>
<option value="">JDEFAULT</option>
</field>
<field
name="logoutdescription_show"
type="list"
label="JFIELD_BASIS_LOGOUT_DESCRIPTION_SHOW_LABEL"
description="JFIELD_BASIS_LOGOUT_DESCRIPTION_SHOW_DESC"
default="1"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="logout_description"
type="textarea"
label="JFIELD_BASIS_LOGOUT_DESCRIPTION_LABEL"
description="JFIELD_BASIS_LOGOUT_DESCRIPTION_DESC"
rows="3"
cols="40"
filter="safehtml"
showon="logoutdescription_show:1"
/>
<field
name="logout_image"
type="media"
label="JFIELD_LOGOUT_IMAGE_LABEL"
description="JFIELD_LOGOUT_IMAGE_DESC"
/>
</fieldset>
</fields>
</metadata>
PK�F�[�xva��,com_users/views/login/tmpl/default_login.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
?>
<div class="login<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<?php if (($this->params->get('logindescription_show')
== 1 && str_replace(' ', '',
$this->params->get('login_description')) != '')
|| $this->params->get('login_image') != '') :
?>
<div class="login-description">
<?php endif; ?>
<?php if ($this->params->get('logindescription_show')
== 1) : ?>
<?php echo $this->params->get('login_description');
?>
<?php endif; ?>
<?php if ($this->params->get('login_image') !=
'') : ?>
<img src="<?php echo
$this->escape($this->params->get('login_image'));
?>" class="login-image" alt="<?php echo
JText::_('COM_USERS_LOGIN_IMAGE_ALT'); ?>" />
<?php endif; ?>
<?php if (($this->params->get('logindescription_show')
== 1 && str_replace(' ', '',
$this->params->get('login_description')) != '')
|| $this->params->get('login_image') != '') :
?>
</div>
<?php endif; ?>
<form action="<?php echo
JRoute::_('index.php?option=com_users&task=user.login');
?>" method="post" class="form-validate
form-horizontal well">
<fieldset>
<?php echo
$this->form->renderFieldset('credentials'); ?>
<?php if ($this->tfa) : ?>
<?php echo $this->form->renderField('secretkey');
?>
<?php endif; ?>
<?php if (JPluginHelper::isEnabled('system',
'remember')) : ?>
<div class="control-group">
<div class="control-label">
<label for="remember">
<?php echo JText::_('COM_USERS_LOGIN_REMEMBER_ME');
?>
</label>
</div>
<div class="controls">
<input id="remember" type="checkbox"
name="remember" class="inputbox" value="yes"
/>
</div>
</div>
<?php endif; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn
btn-primary">
<?php echo JText::_('JLOGIN'); ?>
</button>
</div>
</div>
<?php $return = $this->form->getValue('return',
'', $this->params->get('login_redirect_url',
$this->params->get('login_redirect_menuitem'))); ?>
<input type="hidden" name="return"
value="<?php echo base64_encode($return); ?>" />
<?php echo JHtml::_('form.token'); ?>
</fieldset>
</form>
</div>
<div>
<ul class="nav nav-tabs nav-stacked">
<li>
<a href="<?php echo
JRoute::_('index.php?option=com_users&view=reset');
?>">
<?php echo JText::_('COM_USERS_LOGIN_RESET'); ?>
</a>
</li>
<li>
<a href="<?php echo
JRoute::_('index.php?option=com_users&view=remind');
?>">
<?php echo JText::_('COM_USERS_LOGIN_REMIND'); ?>
</a>
</li>
<?php $usersConfig =
JComponentHelper::getParams('com_users'); ?>
<?php if ($usersConfig->get('allowUserRegistration')) :
?>
<li>
<a href="<?php echo
JRoute::_('index.php?option=com_users&view=registration');
?>">
<?php echo JText::_('COM_USERS_LOGIN_REGISTER'); ?>
</a>
</li>
<?php endif; ?>
</ul>
</div>
PK�F�[ÑFҊ�-com_users/views/login/tmpl/default_logout.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
?>
<div class="logout<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<?php if (($this->params->get('logoutdescription_show')
== 1 && str_replace(' ', '',
$this->params->get('logout_description')) !=
'')|| $this->params->get('logout_image') !=
'') : ?>
<div class="logout-description">
<?php endif; ?>
<?php if ($this->params->get('logoutdescription_show')
== 1) : ?>
<?php echo $this->params->get('logout_description');
?>
<?php endif; ?>
<?php if ($this->params->get('logout_image') !=
'') : ?>
<img src="<?php echo
$this->escape($this->params->get('logout_image'));
?>" class="thumbnail pull-right logout-image"
alt="<?php echo JText::_('COM_USER_LOGOUT_IMAGE_ALT');
?>" />
<?php endif; ?>
<?php if (($this->params->get('logoutdescription_show')
== 1 && str_replace(' ', '',
$this->params->get('logout_description')) !=
'')|| $this->params->get('logout_image') !=
'') : ?>
</div>
<?php endif; ?>
<form action="<?php echo
JRoute::_('index.php?option=com_users&task=user.logout');
?>" method="post" class="form-horizontal
well">
<div class="control-group">
<div class="controls">
<button type="submit" class="btn
btn-primary">
<span class="icon-arrow-left icon-white"></span>
<?php echo JText::_('JLOGOUT'); ?>
</button>
</div>
</div>
<?php if ($this->params->get('logout_redirect_url')) :
?>
<input type="hidden" name="return"
value="<?php echo
base64_encode($this->params->get('logout_redirect_url',
$this->form->getValue('return'))); ?>" />
<?php else : ?>
<input type="hidden" name="return"
value="<?php echo
base64_encode($this->params->get('logout_redirect_menuitem',
$this->form->getValue('return'))); ?>" />
<?php endif; ?>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
PK�F�[¿�.��%com_users/views/login/tmpl/logout.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_USER_LOGOUT_VIEW_DEFAULT_TITLE"
option="COM_USER_LOGOUT_VIEW_DEFAULT_OPTION">
<help key = "JHELP_MENUS_MENU_ITEM_USER_LOGOUT"/>
<message>
<![CDATA[COM_USER_LOGOUT_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request">
<field
name="task"
type="hidden"
default="user.menulogout"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic"
label="COM_MENUS_BASIC_FIELDSET_LABEL">
<field
name="logout"
type="modal_menu"
label="JFIELD_LOGOUT_REDIRECT_PAGE_LABEL"
description="JFIELD_LOGOUT_REDIRECT_PAGE_DESC"
disable="separator,alias,heading,url"
select="true"
new="true"
edit="true"
clear="true"
>
<option value="">JDEFAULT</option>
</field>
</fieldset>
</fields>
</metadata>
PK�F�[�e+2��#com_users/views/login/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
/**
* Login view class for Users.
*
* @since 1.5
*/
class UsersViewLogin extends JViewLegacy
{
protected $form;
protected $params;
protected $state;
protected $user;
/**
* Method to display the view.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.5
*/
public function display($tpl = null)
{
// Get the view data.
$this->user = JFactory::getUser();
$this->form = $this->get('Form');
$this->state = $this->get('State');
$this->params = $this->state->get('params');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Check for layout override
$active = JFactory::getApplication()->getMenu()->getActive();
if (isset($active->query['layout']))
{
$this->setLayout($active->query['layout']);
}
$tfa = JAuthenticationHelper::getTwoFactorMethods();
$this->tfa = is_array($tfa) && count($tfa) > 1;
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($this->params->get('pageclass_sfx',
''), ENT_COMPAT, 'UTF-8');
$this->prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*
* @since 1.6
*/
protected function prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$user = JFactory::getUser();
$login = $user->get('guest') ? true : false;
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading', $login ?
JText::_('JLOGIN') : JText::_('JLOGOUT'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
}
PK�F�[�U��(com_users/views/profile/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
?>
<div class="profile<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<?php if (JFactory::getUser()->id == $this->data->id) : ?>
<ul class="btn-toolbar pull-right">
<li class="btn-group">
<a class="btn" href="<?php echo
JRoute::_('index.php?option=com_users&task=profile.edit&user_id='
. (int) $this->data->id); ?>">
<span class="icon-user"></span>
<?php echo JText::_('COM_USERS_EDIT_PROFILE'); ?>
</a>
</li>
</ul>
<?php endif; ?>
<?php echo $this->loadTemplate('core'); ?>
<?php echo $this->loadTemplate('params'); ?>
<?php echo $this->loadTemplate('custom'); ?>
</div>
PK�F�[����33(com_users/views/profile/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_USER_PROFILE_VIEW_DEFAULT_TITLE"
option="COM_USER_PROFILE_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_USER_PROFILE"
/>
<message>
<![CDATA[COM_USER_PROFILE_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
PK�F�[����-com_users/views/profile/tmpl/default_core.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
?>
<fieldset id="users-profile-core">
<legend>
<?php echo JText::_('COM_USERS_PROFILE_CORE_LEGEND'); ?>
</legend>
<dl class="dl-horizontal">
<dt>
<?php echo JText::_('COM_USERS_PROFILE_NAME_LABEL'); ?>
</dt>
<dd>
<?php echo $this->escape($this->data->name); ?>
</dd>
<dt>
<?php echo JText::_('COM_USERS_PROFILE_USERNAME_LABEL');
?>
</dt>
<dd>
<?php echo $this->escape($this->data->username); ?>
</dd>
<dt>
<?php echo
JText::_('COM_USERS_PROFILE_REGISTERED_DATE_LABEL'); ?>
</dt>
<dd>
<?php echo JHtml::_('date',
$this->data->registerDate, JText::_('DATE_FORMAT_LC1'));
?>
</dd>
<dt>
<?php echo
JText::_('COM_USERS_PROFILE_LAST_VISITED_DATE_LABEL'); ?>
</dt>
<?php if ($this->data->lastvisitDate !=
$this->db->getNullDate()) : ?>
<dd>
<?php echo JHtml::_('date',
$this->data->lastvisitDate, JText::_('DATE_FORMAT_LC1'));
?>
</dd>
<?php else : ?>
<dd>
<?php echo JText::_('COM_USERS_PROFILE_NEVER_VISITED');
?>
</dd>
<?php endif; ?>
</dl>
</fieldset>
PK�F�[m�:� � /com_users/views/profile/tmpl/default_custom.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::register('users.spacer', array('JHtmlUsers',
'spacer'));
$fieldsets = $this->form->getFieldsets();
if (isset($fieldsets['core']))
{
unset($fieldsets['core']);
}
if (isset($fieldsets['params']))
{
unset($fieldsets['params']);
}
$tmp = isset($this->data->jcfields) ?
$this->data->jcfields : array();
$customFields = array();
foreach ($tmp as $customField)
{
$customFields[$customField->name] = $customField;
}
?>
<?php foreach ($fieldsets as $group => $fieldset) : ?>
<?php $fields = $this->form->getFieldset($group); ?>
<?php if (count($fields)) : ?>
<fieldset id="users-profile-custom-<?php echo $group;
?>" class="users-profile-custom-<?php echo $group;
?>">
<?php if (isset($fieldset->label) && ($legend =
trim(JText::_($fieldset->label))) !== '') : ?>
<legend><?php echo $legend; ?></legend>
<?php endif; ?>
<?php if (isset($fieldset->description) &&
trim($fieldset->description)) : ?>
<p><?php echo
$this->escape(JText::_($fieldset->description)); ?></p>
<?php endif; ?>
<dl class="dl-horizontal">
<?php foreach ($fields as $field) : ?>
<?php if (!$field->hidden && $field->type !==
'Spacer') : ?>
<dt>
<?php echo $field->title; ?>
</dt>
<dd>
<?php if (key_exists($field->fieldname, $customFields)) :
?>
<?php echo strlen($customFields[$field->fieldname]->value)
? $customFields[$field->fieldname]->value :
JText::_('COM_USERS_PROFILE_VALUE_NOT_FOUND'); ?>
<?php elseif (JHtml::isRegistered('users.' .
$field->id)) : ?>
<?php echo JHtml::_('users.' . $field->id,
$field->value); ?>
<?php elseif (JHtml::isRegistered('users.' .
$field->fieldname)) : ?>
<?php echo JHtml::_('users.' . $field->fieldname,
$field->value); ?>
<?php elseif (JHtml::isRegistered('users.' .
$field->type)) : ?>
<?php echo JHtml::_('users.' . $field->type,
$field->value); ?>
<?php else : ?>
<?php echo JHtml::_('users.value', $field->value);
?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php endforeach; ?>
</dl>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
PK�F�[=-R�&&/com_users/views/profile/tmpl/default_params.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright (C) 2010 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');
?>
<?php $fields = $this->form->getFieldset('params');
?>
<?php if (count($fields)) : ?>
<fieldset id="users-profile-custom">
<legend><?php echo
JText::_('COM_USERS_SETTINGS_FIELDSET_LABEL');
?></legend>
<dl class="dl-horizontal">
<?php foreach ($fields as $field) : ?>
<?php if (!$field->hidden) : ?>
<dt>
<?php echo $field->title; ?>
</dt>
<dd>
<?php if (JHtml::isRegistered('users.' . $field->id))
: ?>
<?php echo JHtml::_('users.' . $field->id,
$field->value); ?>
<?php elseif (JHtml::isRegistered('users.' .
$field->fieldname)) : ?>
<?php echo JHtml::_('users.' . $field->fieldname,
$field->value); ?>
<?php elseif (JHtml::isRegistered('users.' .
$field->type)) : ?>
<?php echo JHtml::_('users.' . $field->type,
$field->value); ?>
<?php else : ?>
<?php echo JHtml::_('users.value', $field->value);
?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php endforeach; ?>
</dl>
</fieldset>
<?php endif; ?>
PK�F�[t�u�%com_users/views/profile/tmpl/edit.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('bootstrap.tooltip');
// Load user_profile plugin language
$lang = JFactory::getLanguage();
$lang->load('plg_user_profile', JPATH_ADMINISTRATOR);
?>
<div class="profile-edit<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<script type="text/javascript">
Joomla.twoFactorMethodChange = function(e)
{
var selectedPane = 'com_users_twofactor_' +
jQuery('#jform_twofactor_method').val();
jQuery.each(jQuery('#com_users_twofactor_forms_container>div'),
function(i, el)
{
if (el.id != selectedPane)
{
jQuery('#' + el.id).hide(0);
}
else
{
jQuery('#' + el.id).show(0);
}
});
}
</script>
<form id="member-profile" action="<?php echo
JRoute::_('index.php?option=com_users&task=profile.save');
?>" method="post" class="form-validate
form-horizontal well" enctype="multipart/form-data">
<?php // Iterate through the form fieldsets and display each one.
?>
<?php foreach ($this->form->getFieldsets() as $group =>
$fieldset) : ?>
<?php $fields = $this->form->getFieldset($group); ?>
<?php if (count($fields)) : ?>
<fieldset>
<?php // If the fieldset has a label set, display it as the legend.
?>
<?php if (isset($fieldset->label)) : ?>
<legend>
<?php echo JText::_($fieldset->label); ?>
</legend>
<?php endif; ?>
<?php if (isset($fieldset->description) &&
trim($fieldset->description)) : ?>
<p>
<?php echo $this->escape(JText::_($fieldset->description));
?>
</p>
<?php endif; ?>
<?php // Iterate through the fields in the set and display them.
?>
<?php foreach ($fields as $field) : ?>
<?php // If the field is hidden, just display the input. ?>
<?php if ($field->hidden) : ?>
<?php echo $field->input; ?>
<?php else : ?>
<div class="control-group">
<div class="control-label">
<?php echo $field->label; ?>
<?php if (!$field->required && $field->type !==
'Spacer') : ?>
<span class="optional">
<?php echo JText::_('COM_USERS_OPTIONAL'); ?>
</span>
<?php endif; ?>
</div>
<div class="controls">
<?php if ($field->fieldname === 'password1') :
?>
<?php // Disables autocomplete ?>
<input type="password"
style="display:none">
<?php endif; ?>
<?php echo $field->input; ?>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
<?php if (count($this->twofactormethods) > 1 &&
!empty($this->twofactorform)) : ?>
<fieldset>
<legend><?php echo
JText::_('COM_USERS_PROFILE_TWO_FACTOR_AUTH');
?></legend>
<div class="control-group">
<div class="control-label">
<label id="jform_twofactor_method-lbl"
for="jform_twofactor_method" class="hasTooltip"
title="<?php echo '<strong>' .
JText::_('COM_USERS_PROFILE_TWOFACTOR_LABEL') .
'</strong><br />' .
JText::_('COM_USERS_PROFILE_TWOFACTOR_DESC'); ?>">
<?php echo
JText::_('COM_USERS_PROFILE_TWOFACTOR_LABEL'); ?>
</label>
</div>
<div class="controls">
<?php echo JHtml::_('select.genericlist',
$this->twofactormethods, 'jform[twofactor][method]',
array('onchange' =>
'Joomla.twoFactorMethodChange()'), 'value',
'text', $this->otpConfig->method,
'jform_twofactor_method', false); ?>
</div>
</div>
<div id="com_users_twofactor_forms_container">
<?php foreach ($this->twofactorform as $form) : ?>
<?php $style = $form['method'] ==
$this->otpConfig->method ? 'display: block' :
'display: none'; ?>
<div id="com_users_twofactor_<?php echo
$form['method']; ?>" style="<?php echo $style;
?>">
<?php echo $form['form']; ?>
</div>
<?php endforeach; ?>
</div>
</fieldset>
<fieldset>
<legend>
<?php echo JText::_('COM_USERS_PROFILE_OTEPS'); ?>
</legend>
<div class="alert alert-info">
<?php echo JText::_('COM_USERS_PROFILE_OTEPS_DESC');
?>
</div>
<?php if (empty($this->otpConfig->otep)) : ?>
<div class="alert alert-warning">
<?php echo
JText::_('COM_USERS_PROFILE_OTEPS_WAIT_DESC'); ?>
</div>
<?php else : ?>
<?php foreach ($this->otpConfig->otep as $otep) : ?>
<span class="span3">
<?php echo substr($otep, 0, 4); ?>-<?php echo substr($otep,
4, 4); ?>-<?php echo substr($otep, 8, 4); ?>-<?php echo
substr($otep, 12, 4); ?>
</span>
<?php endforeach; ?>
<div class="clearfix"></div>
<?php endif; ?>
</fieldset>
<?php endif; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary
validate">
<?php echo JText::_('JSUBMIT'); ?>
</button>
<a class="btn" href="<?php echo
JRoute::_('index.php?option=com_users&view=profile');
?>" title="<?php echo JText::_('JCANCEL');
?>">
<?php echo JText::_('JCANCEL'); ?>
</a>
<input type="hidden" name="option"
value="com_users" />
<input type="hidden" name="task"
value="profile.save" />
</div>
</div>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
PK�F�[ݏ�88%com_users/views/profile/tmpl/edit.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_USER_PROFILE_EDIT_DEFAULT_TITLE"
option="COM_USER_PROFILE_EDIT_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_USER_PROFILE_EDIT"
/>
<message>
<![CDATA[COM_USER_PROFILE_EDIT_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
PK�F�[e��}}%com_users/views/profile/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
/**
* Profile view class for Users.
*
* @since 1.6
*/
class UsersViewProfile extends JViewLegacy
{
protected $data;
protected $form;
protected $params;
protected $state;
/**
* An instance of JDatabaseDriver.
*
* @var JDatabaseDriver
* @since 3.6.3
*/
protected $db;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.6
*/
public function display($tpl = null)
{
$user = JFactory::getUser();
// Get the view data.
$this->data = $this->get('Data');
$this->form = $this->getModel()->getForm(new
JObject(array('id' => $user->id)));
$this->state = $this->get('State');
$this->params = $this->state->get('params');
$this->twofactorform = $this->get('Twofactorform');
$this->twofactormethods = UsersHelper::getTwoFactorMethods();
$this->otpConfig = $this->get('OtpConfig');
$this->db = JFactory::getDbo();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// View also takes responsibility for checking if the user logged in with
remember me.
$cookieLogin = $user->get('cookieLogin');
if (!empty($cookieLogin))
{
// If so, the user must login to edit the password and other data.
// What should happen here? Should we force a logout which destroys the
cookies?
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('JGLOBAL_REMEMBER_MUST_LOGIN'),
'message');
$app->redirect(JRoute::_('index.php?option=com_users&view=login',
false));
return false;
}
// Check if a user was found.
if (!$this->data->id)
{
JError::raiseError(404,
JText::_('JERROR_USERS_PROFILE_NOT_FOUND'));
return false;
}
JPluginHelper::importPlugin('content');
$this->data->text = '';
JEventDispatcher::getInstance()->trigger('onContentPrepare',
array ('com_users.user', &$this->data,
&$this->data->params, 0));
unset($this->data->text);
// Check for layout override
$active = JFactory::getApplication()->getMenu()->getActive();
if (isset($active->query['layout']))
{
$this->setLayout($active->query['layout']);
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($this->params->get('pageclass_sfx',
''));
$this->prepareDocument();
return parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*
* @since 1.6
*/
protected function prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$user = JFactory::getUser();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $user->name));
}
else
{
$this->params->def('page_heading',
JText::_('COM_USERS_PROFILE'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
}
PK�F�[�v�B��.com_users/views/registration/tmpl/complete.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
?>
<div class="registration-complete<?php echo
$this->pageclass_sfx; ?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
</div>
PK�F�[�s�cc-com_users/views/registration/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
?>
<div class="registration<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
</div>
<?php endif; ?>
<form id="member-registration" action="<?php echo
JRoute::_('index.php?option=com_users&task=registration.register');
?>" method="post" class="form-validate
form-horizontal well" enctype="multipart/form-data">
<?php // Iterate through the form fieldsets and display each one.
?>
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<?php $fields = $this->form->getFieldset($fieldset->name);
?>
<?php if (count($fields)) : ?>
<fieldset>
<?php // If the fieldset has a label set, display it as the legend.
?>
<?php if (isset($fieldset->label)) : ?>
<legend><?php echo JText::_($fieldset->label);
?></legend>
<?php endif; ?>
<?php echo $this->form->renderFieldset($fieldset->name);
?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary
validate">
<?php echo JText::_('JREGISTER'); ?>
</button>
<a class="btn" href="<?php echo
JRoute::_(''); ?>" title="<?php echo
JText::_('JCANCEL'); ?>">
<?php echo JText::_('JCANCEL'); ?>
</a>
<input type="hidden" name="option"
value="com_users" />
<input type="hidden" name="task"
value="registration.register" />
</div>
</div>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
PK�F�[��B�EE-com_users/views/registration/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_USER_REGISTRATION_VIEW_DEFAULT_TITLE"
option="COM_USER_REGISTRATION_VIEW_DEFAULT_OPTION">
<help
key="JHELP_MENUS_MENU_ITEM_USER_REGISTRATION"
/>
<message>
<![CDATA[COM_USER_REGISTRATION_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
PK�F�[�!���
�
*com_users/views/registration/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
/**
* Registration view class for Users.
*
* @since 1.6
*/
class UsersViewRegistration extends JViewLegacy
{
protected $data;
protected $form;
protected $params;
protected $state;
public $document;
/**
* Method to display the view.
*
* @param string $tpl The template file to include
*
* @return mixed
*
* @since 1.6
*/
public function display($tpl = null)
{
// Get the view data.
$this->form = $this->get('Form');
$this->data = $this->get('Data');
$this->state = $this->get('State');
$this->params = $this->state->get('params');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Check for layout override
$active = JFactory::getApplication()->getMenu()->getActive();
if (isset($active->query['layout']))
{
$this->setLayout($active->query['layout']);
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($this->params->get('pageclass_sfx',
''), ENT_COMPAT, 'UTF-8');
$this->prepareDocument();
return parent::display($tpl);
}
/**
* Prepares the document.
*
* @return void
*
* @since 1.6
*/
protected function prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_USERS_REGISTRATION'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
}
PK�F�[^f��
'com_users/views/remind/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
?>
<div class="remind<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<form id="user-registration" action="<?php echo
JRoute::_('index.php?option=com_users&task=remind.remind');
?>" method="post" class="form-validate
form-horizontal well">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<fieldset>
<?php if (isset($fieldset->label)) : ?>
<p><?php echo JText::_($fieldset->label); ?></p>
<?php endif; ?>
<?php echo $this->form->renderFieldset($fieldset->name);
?>
</fieldset>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary
validate">
<?php echo JText::_('JSUBMIT'); ?>
</button>
</div>
</div>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
PK�F�[�q>�11'com_users/views/remind/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_USER_REMIND_VIEW_DEFAULT_TITLE"
option="COM_USER_REMIND_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_USER_REMINDER"
/>
<message>
<![CDATA[COM_USER_REMIND_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
PK�F�[�_
_
$com_users/views/remind/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
/**
* Registration view class for Users.
*
* @since 1.5
*/
class UsersViewRemind extends JViewLegacy
{
protected $form;
protected $params;
protected $state;
/**
* Method to display the view.
*
* @param string $tpl The template file to include
*
* @return mixed
*
* @since 1.5
*/
public function display($tpl = null)
{
// Get the view data.
$this->form = $this->get('Form');
$this->state = $this->get('State');
$this->params = $this->state->params;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Check for layout override
$active = JFactory::getApplication()->getMenu()->getActive();
if (isset($active->query['layout']))
{
$this->setLayout($active->query['layout']);
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($this->params->get('pageclass_sfx',
''), ENT_COMPAT, 'UTF-8');
$this->prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document.
*
* @return void
*
* @since 1.6
*/
protected function prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_USERS_REMIND'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
}
PK�F�[�9���'com_users/views/reset/tmpl/complete.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
?>
<div class="reset-complete<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<form action="<?php echo
JRoute::_('index.php?option=com_users&task=reset.complete');
?>" method="post" class="form-validate
form-horizontal well">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<fieldset>
<?php if (isset($fieldset->label)) : ?>
<p><?php echo JText::_($fieldset->label); ?></p>
<?php endif; ?>
<?php echo $this->form->renderFieldset($fieldset->name);
?>
</fieldset>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary
validate">
<?php echo JText::_('JSUBMIT'); ?>
</button>
</div>
</div>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
PK�F�[�>����&com_users/views/reset/tmpl/confirm.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
?>
<div class="reset-confirm<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<form action="<?php echo
JRoute::_('index.php?option=com_users&task=reset.confirm');
?>" method="post" class="form-validate
form-horizontal well">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<fieldset>
<?php if (isset($fieldset->label)) : ?>
<p><?php echo JText::_($fieldset->label); ?></p>
<?php endif; ?>
<?php echo $this->form->renderFieldset($fieldset->name);
?>
</fieldset>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary
validate">
<?php echo JText::_('JSUBMIT'); ?>
</button>
</div>
</div>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
PK�F�[~/ӷ&com_users/views/reset/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidator');
?>
<div class="reset<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<form id="user-registration" action="<?php echo
JRoute::_('index.php?option=com_users&task=reset.request');
?>" method="post" class="form-validate
form-horizontal well">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<fieldset>
<?php if (isset($fieldset->label)) : ?>
<p><?php echo JText::_($fieldset->label); ?></p>
<?php endif; ?>
<?php echo $this->form->renderFieldset($fieldset->name);
?>
</fieldset>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary
validate">
<?php echo JText::_('JSUBMIT'); ?>
</button>
</div>
</div>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
PK�F�[��W�22&com_users/views/reset/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_USER_RESET_VIEW_DEFAULT_TITLE"
option="COM_USER_RESET_VIEW_DEFAULT_OPTION">
<help
key="JHELP_MENUS_MENU_ITEM_USER_PASSWORD_RESET"
/>
<message>
<![CDATA[COM_USER_RESET_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
PK�F�[cO��#com_users/views/reset/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @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;
/**
* Reset view class for Users.
*
* @since 1.5
*/
class UsersViewReset extends JViewLegacy
{
protected $form;
protected $params;
protected $state;
/**
* Method to display the view.
*
* @param string $tpl The template file to include
*
* @return mixed
*
* @since 1.5
*/
public function display($tpl = null)
{
// This name will be used to get the model
$name = $this->getLayout();
// Check that the name is valid - has an associated model.
if (!in_array($name, array('confirm', 'complete')))
{
$name = 'default';
}
if ('default' === $name)
{
$formname = 'Form';
}
else
{
$formname = ucfirst($this->_name) . ucfirst($name) .
'Form';
}
// Get the view data.
$this->form = $this->get($formname);
$this->state = $this->get('State');
$this->params = $this->state->params;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($this->params->get('pageclass_sfx',
''), ENT_COMPAT, 'UTF-8');
$this->prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document.
*
* @return void
*
* @since 1.6
*/
protected function prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading',
$this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading',
JText::_('COM_USERS_RESET'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots',
$this->params->get('robots'));
}
}
}
PK�F�[���3��com_wrapper/controller.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_wrapper
*
* @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;
/**
* Content Component Controller
*
* @since 1.5
*/
class WrapperController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their
variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JControllerLegacy This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = array())
{
$cachable = true;
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'wrapper');
$this->input->set('view', $vName);
return parent::display($cachable, array('Itemid' =>
'INT'));
}
}
PK�F�[�w��77com_wrapper/router.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_wrapper
*
* @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;
/**
* Routing class from com_wrapper
*
* @since 3.3
*/
class WrapperRouter extends JComponentRouterBase
{
/**
* Build the route for the com_wrapper component
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent
URL.
*
* @since 3.3
*/
public function build(&$query)
{
if (isset($query['view']))
{
unset($query['view']);
}
return array();
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
return array('view' => 'wrapper');
}
}
/**
* Wrapper router functions
*
* These functions are proxys for the new router interface
* for old SEF extensions.
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent URL.
*
* @deprecated 4.0 Use Class based routers instead
*/
function wrapperBuildRoute(&$query)
{
$router = new WrapperRouter;
return $router->build($query);
}
/**
* Wrapper router functions
*
* These functions are proxys for the new router interface
* for old SEF extensions.
*
* @param array $segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @deprecated 4.0 Use Class based routers instead
*/
function wrapperParseRoute($segments)
{
$router = new WrapperRouter;
return $router->parse($segments);
}
PK�F�[7���NN*com_wrapper/views/wrapper/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_wrapper
*
* @copyright (C) 2006 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::_('script', 'com_wrapper/iframe-height.min.js',
array('version' => 'auto', 'relative'
=> true));
?>
<div class="contentpane<?php echo $this->pageclass_sfx;
?>">
<?php if ($this->params->get('show_page_heading')) :
?>
<div class="page-header">
<h1>
<?php if
($this->escape($this->params->get('page_heading'))) :
?>
<?php echo
$this->escape($this->params->get('page_heading')); ?>
<?php else : ?>
<?php echo
$this->escape($this->params->get('page_title')); ?>
<?php endif; ?>
</h1>
</div>
<?php endif; ?>
<iframe <?php echo $this->wrapper->load; ?>
id="blockrandom"
name="iframe"
src="<?php echo $this->escape($this->wrapper->url);
?>"
width="<?php echo
$this->escape($this->params->get('width')); ?>"
height="<?php echo
$this->escape($this->params->get('height')); ?>"
scrolling="<?php echo
$this->escape($this->params->get('scrolling'));
?>"
frameborder="<?php echo
$this->escape($this->params->get('frameborder', 1));
?>"
<?php if
($this->escape($this->params->get('page_heading'))) :
?>
title="<?php echo
$this->escape($this->params->get('page_heading'));
?>"
<?php else : ?>
title="<?php echo
$this->escape($this->params->get('page_title'));
?>"
<?php endif; ?>
class="wrapper<?php echo $this->pageclass_sfx; ?>">
<?php echo JText::_('COM_WRAPPER_NO_IFRAMES'); ?>
</iframe>
</div>
PK�F�[\��u u *com_wrapper/views/wrapper/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_WRAPPER_WRAPPER_VIEW_DEFAULT_TITLE"
option="COM_WRAPPER_WRAPPER_VIEW_DEFAULT_OPTION">
<help
key="JHELP_MENUS_MENU_ITEM_WRAPPER"
/>
<message>
<![CDATA[COM_WRAPPER_WRAPPER_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="request"
label="COM_MENUS_BASIC_FIELDSET_LABEL">
<field
name="url"
type="text"
label="COM_WRAPPER_FIELD_URL_LABEL"
description="COM_WRAPPER_FIELD_URL_DESC"
size="30"
required="true"
/>
</fieldset>
<!-- Add fields to the parameters object for the layout. -->
<!-- Scroll. -->
<fieldset name="basic"
label="COM_WRAPPER_FIELD_LABEL_SCROLLBARSPARAMS">
<field
name="scrolling"
type="list"
label="COM_WRAPPER_FIELD_SCROLLBARS_LABEL"
description="COM_WRAPPER_FIELD_SCROLLBARS_DESC"
default="auto"
>
<option value="no">JNO</option>
<option value="yes">JYES</option>
<option
value="auto">COM_WRAPPER_FIELD_VALUE_AUTO</option>
</field>
<field
name="width"
type="text"
label="JGLOBAL_WIDTH"
description="COM_WRAPPER_FIELD_WIDTH_DESC"
default="100%"
size="5"
/>
<field
name="height"
type="number"
label="COM_WRAPPER_FIELD_HEIGHT_LABEL"
description="COM_WRAPPER_FIELD_HEIGHT_DESC"
default="500"
size="5"
/>
</fieldset>
<!-- Advanced options. -->
<fieldset name="advanced">
<field
name="height_auto"
type="radio"
label="COM_WRAPPER_FIELD_HEIGHTAUTO_LABEL"
description="COM_WRAPPER_FIELD_HEIGHTAUTO_DESC"
default="0"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="add_scheme"
type="radio"
label="COM_WRAPPER_FIELD_ADD_LABEL"
description="COM_WRAPPER_FIELD_ADD_DESC"
class="btn-group btn-group-yesno"
default="1"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="frameborder"
type="radio"
label="COM_WRAPPER_FIELD_FRAME_LABEL"
description="COM_WRAPPER_FIELD_FRAME_DESC"
class="btn-group btn-group-yesno"
default="1"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
</fields>
</metadata>
PK�F�[IT��'com_wrapper/views/wrapper/view.html.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_wrapper
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Wrapper view class.
*
* @since 1.5
*/
class WrapperViewWrapper extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.5
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$params = $app->getParams();
// Because the application sets a default page title, we need to get it
// right from the menu item itself
$title = $params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE',
$app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title,
$app->get('sitename'));
}
$this->document->setTitle($title);
if ($params->get('menu-meta_description'))
{
$this->document->setDescription($params->get('menu-meta_description'));
}
if ($params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords',
$params->get('menu-meta_keywords'));
}
if ($params->get('robots'))
{
$this->document->setMetadata('robots',
$params->get('robots'));
}
$wrapper = new stdClass;
// Auto height control
if ($params->def('height_auto'))
{
$wrapper->load = 'onload="iFrameHeight(this)"';
}
else
{
$wrapper->load = '';
}
$url = $params->def('url', '');
if ($params->def('add_scheme', 1))
{
// Adds 'http://' or 'https://' if none is set
if (strpos($url, '//') === 0)
{
// URL without scheme in component. Prepend current scheme.
$wrapper->url =
JUri::getInstance()->toString(array('scheme')) . substr($url,
2);
}
elseif (strpos($url, '/') === 0)
{
// Relative URL in component. Use scheme + host + port.
$wrapper->url =
JUri::getInstance()->toString(array('scheme',
'host', 'port')) . $url;
}
elseif (strpos($url, 'http://') !== 0 && strpos($url,
'https://') !== 0)
{
// URL doesn't start with either 'http://' or
'https://'. Add current scheme.
$wrapper->url =
JUri::getInstance()->toString(array('scheme')) . $url;
}
else
{
// URL starts with either 'http://' or 'https://'.
Do not change it.
$wrapper->url = $url;
}
}
else
{
$wrapper->url = $url;
}
// Escape strings for HTML output
$this->pageclass_sfx =
htmlspecialchars($params->get('pageclass_sfx', ''));
$this->params = &$params;
$this->wrapper = &$wrapper;
parent::display($tpl);
}
}
PK�F�[�~���com_wrapper/wrapper.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage com_wrapper
*
* @copyright (C) 2005 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
$controller = JControllerLegacy::getInstance('Wrapper');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
PK�F�[�
���com_wrapper/wrapper.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1"
method="upgrade">
<name>com_wrapper</name>
<author>Joomla! Project</author>
<creationDate>April 2006</creationDate>
<copyright>(C) 2007 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_WRAPPER_XML_DESCRIPTION</description>
<files folder="site">
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>metadata.xml</filename>
<filename>router.php</filename>
<filename>wrapper.php</filename>
<folder>views</folder>
</files>
<languages folder="site">
<language
tag="en-GB">language/en-GB.com_wrapper.ini</language>
</languages>
<administration>
<files folder="admin">
<filename>index.html</filename>
</files>
<languages folder="admin">
<language
tag="en-GB">language/en-GB.com_wrapper.ini</language>
<language
tag="en-GB">language/en-GB.com_wrapper.sys.ini</language>
</languages>
</administration>
</extension>
PK�F�[�V�
index.htmlnu�[���<!DOCTYPE
html><title></title>
PK�F�[�X�""#com_componentbuilder/controller.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Router\Route;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
/**
* Componentbuilder Component Base Controller
*/
class ComponentbuilderController extends BaseController
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached.
* @param boolean $urlparams An array of safe URL parameters and their
variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
*/
function display($cachable = false, $urlparams = false)
{
// set default view if not set
$view = $this->input->getCmd('view',
'');
$this->input->set('view', $view);
$isEdit = $this->checkEditView($view);
$layout = $this->input->get('layout', null,
'WORD');
$id = $this->input->getInt('id');
// $cachable = true; (TODO) working on a fix
[gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238)
// insure that the view is not cashable if edit view or if user is logged
in
$user = Factory::getUser();
if ($user->get('id') || $isEdit)
{
$cachable = false;
}
// Check for edit form.
if($isEdit)
{
if ($layout == 'edit' &&
!$this->checkEditId('com_componentbuilder.edit.'.$view, $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID',
$id));
$this->setMessage($this->getError(), 'error');
// check if item was opend from other then its own list view
$ref = $this->input->getCmd('ref', 0);
$refid = $this->input->getInt('refid', 0);
// set redirect
if ($refid > 0 && StringHelper::check($ref))
{
// redirect to item of ref
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view='.(string)$ref.'&layout=edit&id='.(int)$refid,
false));
}
elseif (StringHelper::check($ref))
{
// redirect to ref
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view='.(string)$ref,
false));
}
else
{
// normal redirect back to the list default site view
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=',
false));
}
return false;
}
}
// we may need to make this more dynamic in the future. (TODO)
$safeurlparams = array(
'catid' => 'INT',
'id' => 'INT',
'cid' => 'ARRAY',
'year' => 'INT',
'month' => 'INT',
'limit' => 'UINT',
'limitstart' => 'UINT',
'showall' => 'INT',
'return' => 'BASE64',
'filter' => 'STRING',
'filter_order' => 'CMD',
'filter_order_Dir' => 'CMD',
'filter-search' => 'STRING',
'print' => 'BOOLEAN',
'lang' => 'CMD',
'Itemid' => 'INT');
// should these not merge?
if (UtilitiesArrayHelper::check($urlparams))
{
$safeurlparams = UtilitiesArrayHelper::merge(array($urlparams,
$safeurlparams));
}
return parent::display($cachable, $safeurlparams);
}
protected function checkEditView($view)
{
if (StringHelper::check($view))
{
$views = array(
''
);
// check if this is a edit view
if (in_array($view,$views))
{
return true;
}
}
return false;
}
}
PK�F�[�#o,,com_componentbuilder/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�F�[��IX99com_componentbuilder/router.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
/**
* Routing class from com_componentbuilder
*
* @since 3.3
*/
class ComponentbuilderRouter extends JComponentRouterBase
{
/**
* Build the route for the com_componentbuilder component
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent
URL.
*
* @since 3.3
*/
public function build(&$query)
{
$segments = [];
// Get a menu item based on Itemid or currently active
$params = ComponentHelper::getParams('com_componentbuilder');
if (empty($query['Itemid']))
{
$menuItem = $this->menu->getActive();
}
else
{
$menuItem = $this->menu->getItem($query['Itemid']);
}
$mView = (empty($menuItem->query['view'])) ? null :
$menuItem->query['view'];
$mId = (empty($menuItem->query['id'])) ? null :
$menuItem->query['id'];
if (isset($query['view']))
{
$view = $query['view'];
if (empty($query['Itemid']) && !(isset($view)
&& isset($query['id']) && ($view ===
'api')))
{
$segments[] = $query['view'];
}
unset($query['view']);
}
// Are we dealing with a item that is attached to a menu item?
if (isset($view) && ($mView == $view) and
(isset($query['id'])) and ($mId == (int) $query['id']))
{
unset($query['view']);
unset($query['catid']);
unset($query['id']);
return $segments;
}
if (isset($view) && isset($query['id']) &&
($view === 'api'))
{
if ($mId != (int) $query['id'] || $mView != $view)
{
if (($view === 'api'))
{
$segments[] = $view;
$id = explode(':', $query['id']);
if (count($id) == 2)
{
$segments[] = $id[1];
}
else
{
$segments[] = $id[0];
}
}
}
unset($query['id']);
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-',
$segments[$i]);
}
return $segments;
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
$count = count($segments);
$vars = [];
// Handle View and Identifier
switch($segments[0])
{
case 'api':
$vars['view'] = 'api';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('joomla_component',
$segments[$count-1], 'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
}
return $vars;
}
protected function getVar($table, $where = null, $whereString = null,
$what = null, $category = false, $operator = '=', $main =
'componentbuilder')
{
if(!$where || !$what || !$whereString)
{
return false;
}
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array($what)));
if ('categories' == $table || 'category' == $table ||
$category)
{
$getTable = '#__categories';
$query->from($db->quoteName($getTable));
// we need this to target the components categories (TODO will keep an
eye on this)
$query->where($db->quoteName('extension') . ' LIKE
'. $db->quote((string)'com_' . $main . '%'));
}
else
{
// we must check if the table exist (TODO not ideal)
$tables = $db->getTableList();
$app = Factory::getApplication();
$prefix = $app->get('dbprefix');
$check = $prefix.$main.'_'.$table;
if (in_array($check, $tables))
{
$getTable = '#__'.$main.'_'.$table;
$query->from($db->quoteName($getTable));
}
else
{
return false;
}
}
if (is_numeric($where))
{
return false;
}
elseif ($this->checkString($where))
{
// we must first check if this table has the column
$columns = $db->getTableColumns($getTable);
if (isset($columns[$whereString]))
{
$query->where($db->quoteName($whereString) . '
'.$operator.' '. $db->quote((string)$where));
}
else
{
return false;
}
}
else
{
return false;
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadResult();
}
return false;
}
protected function checkString($string)
{
if (isset($string) && is_string($string) &&
strlen($string) > 0)
{
return true;
}
return false;
}
}
function ComponentbuilderBuildRoute(&$query)
{
$router = new ComponentbuilderRouter;
return $router->build($query);
}
function ComponentbuilderParseRoute($segments)
{
$router = new ComponentbuilderRouter;
return $router->parse($segments);
}PK�F�[{�h��)com_componentbuilder/componentbuilder.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// The power autoloader for this project (JPATH_SITE) area.
$power_autoloader = JPATH_SITE .
'/components/com_componentbuilder/helpers/powerloader.php';
if (file_exists($power_autoloader))
{
require_once $power_autoloader;
}
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\MVC\Controller\BaseController;
// Set the component css/js
Html::_('stylesheet',
'components/com_componentbuilder/assets/css/site.css',
['version' => 'auto']);
Html::_('script',
'components/com_componentbuilder/assets/js/site.js',
['version' => 'auto']);
// Require helper files
JLoader::register('ComponentbuilderHelper', __DIR__ .
'/helpers/componentbuilder.php');
\JLoader::register('ComponentbuilderEmail',
JPATH_COMPONENT_ADMINISTRATOR .
'/helpers/componentbuilderemail.php');
JLoader::register('ComponentbuilderHelperRoute', __DIR__ .
'/helpers/route.php');
//Trigger the Global Site Event
ComponentbuilderHelper::globalEvent(Factory::getDocument());
// Get an instance of the controller prefixed by Componentbuilder
$controller = BaseController::getInstance('Componentbuilder');
// Perform the request task
$controller->execute(Factory::getApplication()->input->get('task'));
// Redirect if set by the controller
$controller->redirect();
PK�F�[{����'com_componentbuilder/assets/css/api.cssnu�[���/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
/* CSS Document */
PK�F�[�#o,,*com_componentbuilder/assets/css/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�F�[���e��(com_componentbuilder/assets/css/site.cssnu�[���/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
/* CSS Document */
.no-click {
pointer-events: none;
}
PK�F�[�#o,,-com_componentbuilder/assets/images/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�F�[�#o,,&com_componentbuilder/assets/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�F�[�#o,,)com_componentbuilder/assets/js/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�F�[�ς��&com_componentbuilder/assets/js/site.jsnu�[���/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
/* JS Document */
PK�F�[]+<�!!)com_componentbuilder/helpers/category.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Componentbuilder Component Category Tree
*/
//Insure this view category file is loaded.
$classname = 'ComponentbuilderFieldCategories';
if (!class_exists($classname))
{
$path = JPATH_SITE .
'/components/com_componentbuilder/helpers/categoryfield.php';
if (is_file($path))
{
include_once $path;
}
}
//Insure this view category file is loaded.
$classname = 'ComponentbuilderFieldtypeCategories';
if (!class_exists($classname))
{
$path = JPATH_SITE .
'/components/com_componentbuilder/helpers/categoryfieldtype.php';
if (is_file($path))
{
include_once $path;
}
}
PK�F�[F��jj.com_componentbuilder/helpers/categoryfield.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Componentbuilder Field Component Category Tree
*/
class ComponentbuilderFieldCategories extends JCategories
{
/**
* Class constructor
*
* @param array $options Array of options
*
*/
public function __construct($options = [])
{
$options['table'] = '#__componentbuilder_field';
$options['extension'] = 'com_componentbuilder.field';
parent::__construct($options);
}
}
PK�F�[F��zz2com_componentbuilder/helpers/categoryfieldtype.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Componentbuilder Fieldtype Component Category Tree
*/
class ComponentbuilderFieldtypeCategories extends JCategories
{
/**
* Class constructor
*
* @param array $options Array of options
*
*/
public function __construct($options = [])
{
$options['table'] = '#__componentbuilder_fieldtype';
$options['extension'] =
'com_componentbuilder.fieldtype';
parent::__construct($options);
}
}
PK�F�[�l3ѥ���1com_componentbuilder/helpers/componentbuilder.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// The power autoloader for this project (JPATH_SITE) area.
$power_autoloader = JPATH_SITE .
'/components/com_componentbuilder/helpers/powerloader.php';
if (file_exists($power_autoloader))
{
require_once $power_autoloader;
}
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Access\Access;
use Joomla\CMS\Access\Rules as AccessRules;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Language\Language;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Version;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\Archive\Archive;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Openai\Factory as OpenaiFactory;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\FieldHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CompilerFactory;
use VDM\Joomla\Utilities\Base64Helper;
use VDM\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Utilities\String\FieldHelper as StringFieldHelper;
use VDM\Joomla\Utilities\String\TypeHelper;
use VDM\Joomla\Utilities\String\NamespaceHelper;
use VDM\Joomla\Utilities\MathHelper;
use VDM\Joomla\Utilities\String\PluginHelper;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\Utilities\Component\Helper;
use VDM\Joomla\Utilities\FormHelper;
use Joomla\CMS\Router\Route;
/**
* Componentbuilder component helper
*/
abstract class ComponentbuilderHelper
{
/**
* Composer Switch
*
* @var array
*/
protected static $composer = [];
/**
* The Main Active Language
*
* @var string
*/
public static $langTag;
/**
* The Global Site Event Method.
**/
public static function globalEvent($document)
{
// the Session keeps track of all data related to the current session of
this user
self::loadSession();
}
/**
* Just to Add the OPEN AI api to JCB (soon)
* OpenaiFactory
**/
/**
* Locked Libraries (we can not have these change)
**/
public static $libraryNames = array(1 => 'No Library', 2
=> 'Bootstrap v4', 3 => 'Uikit v3', 4 =>
'Uikit v2', 5 => 'FooTable v2', 6 =>
'FooTable v3');
/**
* Array of php fields Allowed (16)
**/
public static $phpFieldArray = array('', 'a',
'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k',
'l', 'm', 'n', 'x',
'HEADER');
/**
* The global params
**/
protected static $params = false;
/**
* The global updater
**/
protected static $globalUpdater = array();
/**
* The local company details
**/
protected static $localCompany = array();
/**
* The excluded powers
**/
protected static $exPowers= array();
/**
* The snippet paths
**/
public static $snippetPath =
'https://raw.githubusercontent.com/vdm-io/Joomla-Component-Builder-Snippets/master/';
public static $snippetsPath =
'https://api.github.com/repos/vdm-io/Joomla-Component-Builder-Snippets/git/trees/master';
/**
* The VDM packages paths
**/
public static $vdmGithubPackageUrl =
"https://github.com/vdm-io/JCB-Packages/raw/master/";
public static $vdmGithubPackagesUrl =
"https://api.github.com/repos/vdm-io/JCB-Packages/git/trees/master";
/**
* The JCB packages paths
**/
public static $jcbGithubPackageUrl =
"https://github.com/vdm-io/JCB-Community-Packages/raw/master/";
public static $jcbGithubPackagesUrl =
"https://api.github.com/repos/vdm-io/JCB-Community-Packages/git/trees/master";
/**
* The bolerplate paths
**/
public static $bolerplatePath =
'https://raw.githubusercontent.com/vdm-io/boilerplate/jcb/';
public static $bolerplateAPI =
'https://api.github.com/repos/vdm-io/boilerplate/git/trees/jcb';
/**
* The array of constant paths
*
* JPATH_SITE is meant to represent the root path of the JSite
application,
* just as JPATH_ADMINISTRATOR is mean to represent the root path of the
JAdministrator application.
*
* JPATH_BASE is the root path for the current requested
application.... so if you are in the administrator application:
*
* JPATH_BASE == JPATH_ADMINISTRATOR
*
* If you are in the site application:
*
* JPATH_BASE == JPATH_SITE
*
* If you are in the installation application:
*
* JPATH_BASE == JPATH_INSTALLATION.
*
* JPATH_ROOT is the root path for the Joomla install and does not
depend upon any application.
*
* @var array
*/
public static $constantPaths = array(
// The path to the administrator folder.
'JPATH_ADMINISTRATOR' => JPATH_ADMINISTRATOR,
// The path to the installed Joomla! site, or JPATH_ROOT/administrator if
executed from the backend.
'JPATH_BASE' => JPATH_BASE,
// The path to the cache folder.
'JPATH_CACHE' => JPATH_CACHE,
// The path to the administration folder of the current component being
executed.
'JPATH_COMPONENT_ADMINISTRATOR' =>
JPATH_COMPONENT_ADMINISTRATOR,
// The path to the site folder of the current component being executed.
'JPATH_COMPONENT_SITE' => JPATH_COMPONENT_SITE,
// The path to the current component being executed.
'JPATH_COMPONENT' => JPATH_COMPONENT,
// The path to folder containing the configuration.php file.
'JPATH_CONFIGURATION' => JPATH_CONFIGURATION,
// The path to the installation folder.
'JPATH_INSTALLATION' => JPATH_INSTALLATION,
// The path to the libraries folder.
'JPATH_LIBRARIES' => JPATH_LIBRARIES,
// The path to the plugins folder.
'JPATH_PLUGINS' => JPATH_PLUGINS,
// The path to the installed Joomla! site.
'JPATH_ROOT' => JPATH_ROOT,
// The path to the installed Joomla! site.
'JPATH_SITE' => JPATH_SITE,
// The path to the templates folder.
'JPATH_THEMES' => JPATH_THEMES
);
/**
* get the class method or property
*
* @input int The method/property ID
* @input string The target type
*
* @returns string on success
**/
public static function getClassCode($id, $type)
{
if ('property' === $type || 'method' === $type)
{
// Get a db connection.
$db = Factory::getDbo();
// Get user object
$user = Factory::getUser();
// Create a new query object.
$query = $db->getQuery(true);
// get method
if ('method' === $type)
{
$query->select($db->quoteName(array('a.comment','a.name','a.visibility','a.arguments','a.code')));
}
// get property
elseif ('property' === $type)
{
$query->select($db->quoteName(array('a.comment','a.name','a.visibility','a.default')));
}
$query->from($db->quoteName('#__componentbuilder_class_'
. $type,'a'));
$query->where($db->quoteName('a.id') . ' = ' .
(int) $id);
// Implement View Level Access
if (!$user->authorise('core.options',
'com_componentbuilder'))
{
$columns =
$db->getTableColumns('#__componentbuilder_class_' . $type);
if(isset($columns['access']))
{
$groups = implode(',',
$user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups .
')');
}
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
// get the code
$code = $db->loadObject();
// combine method values
$combinded = array();
// add comment if set
if (UtilitiesStringHelper::check($code->comment))
{
$comment = array_map('trim', (array) explode(PHP_EOL,
base64_decode($code->comment)));
$combinded[] = "\t" . implode(PHP_EOL . "\t ",
$comment);
}
// build method
if ('method' === $type)
{
// set the method signature
if (UtilitiesStringHelper::check($code->arguments))
{
$combinded[] = "\t" . $code->visibility . '
function ' . $code->name . '(' .
base64_decode($code->arguments) . ')';
}
else
{
$combinded[] = "\t" . $code->visibility . '
function ' . $code->name . '()';
}
// set the method code
$combinded[] = "\t" . "{";
// add code if set
if (UtilitiesStringHelper::check(trim($code->code)))
{
$combinded[] = base64_decode($code->code);
}
else
{
$combinded[] = "\t\t// add your code here";
}
$combinded[] = "\t" . "}";
}
else
{
if (UtilitiesStringHelper::check($code->default))
{
$code->default = base64_decode($code->default);
if (is_int($code->default))
{
// set the class property
$combinded[] = "\t" . $code->visibility . '
$' . $code->name . ' = ' . (int) $code->default .
';';
}
elseif (is_float($code->default))
{
// set the class property
$combinded[] = "\t" . $code->visibility . '
$' . $code->name . ' = ' . (float) $code->default .
';';
}
elseif (('false' === $code->default || 'true'
=== $code->default)
|| (UtilitiesStringHelper::check($code->default) &&
(strpos($code->default, 'array(') !== false ||
strpos($code->default, '"') !== false)))
{
// set the class property
$combinded[] = "\t" . $code->visibility . '
$' . $code->name . ' = ' . $code->default .
';';
}
elseif (UtilitiesStringHelper::check($code->default) &&
strpos($code->default, '"') === false)
{
// set the class property
$combinded[] = "\t" . $code->visibility . '
$' . $code->name . ' = "' . $code->default .
'";';
}
else
{
// set the class property
$combinded[] = "\t" . $code->visibility . '
$' . $code->name . ';';
}
}
else
{
// set the class property
$combinded[] = "\t" . $code->visibility . '
$' . $code->name . ';';
}
}
// return the code
return implode(PHP_EOL, $combinded);
}
}
return false;
}
/**
* extract Boilerplate Class Extends
*
* @input string The class as a string
* @input string The type of class/extension
*
* @returns string on success
**/
public static function extractBoilerplateClassExtends(&$class, $type)
{
if (($strings = GetHelper::allBetween($class, 'class ',
'}')) !== false &&
UtilitiesArrayHelper::check($strings))
{
foreach ($strings as $string)
{
if (($extends = GetHelper::between($string, 'extends ',
'{')) !== false &&
UtilitiesStringHelper::check($extends))
{
return trim($extends);
}
}
}
return false;
}
/**
* extract Boilerplate Class Header
*
* @input string The class as a string
* @input string The class being extended
* @input string The type of class/extension
*
* @returns string on success
**/
public static function extractBoilerplateClassHeader(&$class,
$extends, $type)
{
if (($string = GetHelper::between($class,
"defined('_JEXEC')", 'extends ' . $extends))
!== false && UtilitiesStringHelper::check($string))
{
$headArray = explode(PHP_EOL, $string);
if (UtilitiesArrayHelper::check($headArray) && count($headArray)
> 3)
{
// remove first since it still has the [or die;] string in it
array_shift($headArray);
// remove the last since it has the class declaration
array_pop($headArray);
// at this point we have the class comment still in as part of the
header, lets remove that
$last = count($headArray);
while ($last > 0)
{
$last--;
if (isset($headArray[$last]) && strpos($headArray[$last],
'*') !== false)
{
unset($headArray[$last]);
}
else
{
// moment the comment stops, we break out
$last = 0;
}
}
// make sure we only return if we have values
if (UtilitiesArrayHelper::check($headArray))
{
return implode(PHP_EOL, $headArray);
}
}
}
return false;
}
/**
* extract Boilerplate Class Comment
*
* @input string The class as a string
* @input string The class being extended
* @input string The type of class/extension
*
* @returns string on success
**/
public static function extractBoilerplateClassComment(&$class,
$extends, $type)
{
if (($string = GetHelper::between($class,
"defined('_JEXEC')", 'extends ' . $extends))
!== false && UtilitiesStringHelper::check($string))
{
$headArray = explode(PHP_EOL, $string);
if (UtilitiesArrayHelper::check($headArray) && count($headArray)
> 3)
{
$comment = array();
// remove the last since it has the class declaration
array_pop($headArray);
// at this point we have the class comment still in as part of the
header, lets remove that
$last = count($headArray);
while ($last > 0)
{
$last--;
if (isset($headArray[$last]) && strpos($headArray[$last],
'*') !== false)
{
$comment[$last] = $headArray[$last];
}
else
{
// moment the comment stops, we break out
$last = 0;
}
}
// make sure we only return if we have values
if (UtilitiesArrayHelper::check($comment))
{
// set the correct order
ksort($comment);
$replace = array('Foo' => '[[[Plugin_name]]]',
'[PACKAGE_NAME]' => '[[[Plugin]]]',
'1.0.0' => '[[[plugin.version]]]', '1.0'
=> '[[[plugin.version]]]');
// now update with JCB placeholders
return str_replace(array_keys($replace), array_values($replace),
implode(PHP_EOL, $comment));
}
}
}
return false;
}
/**
* extract Boilerplate Class Properties & Methods
*
* @input string The class as a string
* @input string The class being extended
* @input string The type of class/extension
* @input int The plugin groups
*
* @returns string on success
**/
public static function
extractBoilerplateClassPropertiesMethods(&$class, $extends, $type,
$plugin_group = null)
{
$bucket = array('property' => array(), 'method'
=> array());
// get the class code, and remove the head
$codeArrayTmp = explode('extends ' . $extends, $class);
// make sure we have the correct result
if (UtilitiesArrayHelper::check($codeArrayTmp) &&
count($codeArrayTmp) == 2)
{
// the triggers
$triggers = array('public' => 1, 'protected'
=> 2, 'private' => 3);
$codeArray = explode(PHP_EOL, $codeArrayTmp[1]);
unset($codeArrayTmp);
// clean the code
self::cleanBoilerplateCode($codeArray);
// temp bucket
$name = null;
$arg = null;
$target = null;
$visibility = null;
$tmp = array();
$comment = array();
// load method
$loadCode = function (&$bucket, &$target, &$name, &$arg,
&$visibility, &$tmp, &$comment) use($type, $plugin_group){
$_tmp = array(
'name' => $name,
'visibility' => $visibility,
'extension_type' => $type
);
// build filter
$filters = array('extension_type' => $type);
// add more data based on target
if ('method' === $target &&
UtilitiesArrayHelper::check($tmp))
{
// clean the code
self::cleanBoilerplateCode($tmp);
// only load if there are values
if (UtilitiesArrayHelper::check($tmp, true))
{
$_tmp['code'] = implode(PHP_EOL, $tmp);
}
else
{
$_tmp['code'] = '';
}
// load arguments only if set
if (UtilitiesStringHelper::check($arg))
{
$_tmp['arguments'] = $arg;
}
}
elseif ('property' === $target)
{
// load default only if set
if (UtilitiesStringHelper::check($arg))
{
$_tmp['default'] = $arg;
}
}
// load comment only if set
if (UtilitiesArrayHelper::check($comment, true))
{
$_tmp['comment'] = implode(PHP_EOL, $comment);
}
// load the group target
if ($plugin_group)
{
$_tmp['joomla_plugin_group'] = $plugin_group;
$filters['joomla_plugin_group'] = $plugin_group;
}
// load the local values
if (($locals = self::getLocalBoilerplate($name, $target, $type,
$filters)) !== false)
{
foreach ($locals as $key => $value)
{
$_tmp[$key] = $value;
}
}
else
{
$_tmp['id'] = 0;
$_tmp['published'] = 1;
$_tmp['version'] = 1;
}
// store the data based on target
$bucket[$target][] = $_tmp;
};
// now we start loading
foreach($codeArray as $line)
{
if ($visibility && $target && $name &&
strpos($line, '/**') !== false)
{
$loadCode($bucket, $target, $name, $arg, $visibility, $tmp,
$comment);
// reset loop buckets
$name = null;
$arg = null;
$target = null;
$visibility = null;
$tmp = array();
$comment = array();
}
// load the comment before method/property
if (!$visibility && !$target && !$name &&
strpos($line, '*') !== false)
{
$comment[] = rtrim($line);
}
else
{
if (!$visibility && !$target && !$name)
{
// get the line values
$lineArray = array_values(array_map('trim',
preg_split('/\s+/', trim($line))));
// check if we are at the main line
if (isset($lineArray[0]) && isset($triggers[$lineArray[0]]))
{
$visibility = $lineArray[0];
if (strpos($line, 'function') !== false)
{
$target = 'method';
// get the name
$name = trim(GetHelper::between($line, 'function ',
'('));
// get the arguments
$arg = trim(GetHelper::between($line, ' ' . $name .
'(', ')'));
}
else
{
$target = 'property';
if (strpos($line, '=') !== false)
{
// get the name
$name = trim(GetHelper::between($line, '$',
'='));
// get the default
$arg = trim(GetHelper::between($line, '=',
';'));
}
else
{
// get the name
$name = trim(GetHelper::between($line, '$',
';'));
}
}
}
}
else
{
$tmp[] = rtrim($line);
}
}
}
// check if a last method is still around
if ($visibility && $target && $name)
{
$loadCode($bucket, $target, $name, $arg, $visibility, $tmp, $comment);
// reset loop buckets
$name = null;
$arg = null;
$target = null;
$visibility = null;
$tmp = array();
$comment = array();
}
return $bucket;
}
return false;
}
protected static function getLocalBoilerplate($name, $table,
$extension_type, $filters = array())
{
if ('property' === $table || 'method' === $table)
{
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// get method
$query->select($db->quoteName(array('a.id','a.published','a.version')));
$query->from($db->quoteName('#__componentbuilder_class_'
. $table,'a'));
$query->where($db->quoteName('a.name') . ' = '
. $db->quote($name));
$query->where($db->quoteName('a.extension_type') .
' = ' . $db->quote($extension_type));
// add more filters
if (UtilitiesArrayHelper::check($filters))
{
foreach($filters as $where => $value)
{
if (is_numeric($value))
{
$query->where($db->quoteName('a.' . $where) . '
= ' . $value);
}
else
{
$query->where($db->quoteName('a.' . $where) . '
= ' . $db->quote($value));
}
}
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
// get the code
return $db->loadAssoc();
}
}
return false;
}
protected static function cleanBoilerplateCode(&$code)
{
// remove the first lines until a { is found
$key = 0;
$found = false;
while (!$found)
{
if (isset($code[$key]))
{
if (strpos($code[$key], '{') !== false)
{
unset($code[$key]);
// only remove the first } found
$found = true;
}
// remove empty lines
elseif (!UtilitiesStringHelper::check(trim($code[$key])))
{
unset($code[$key]);
}
}
// check next line
$key++;
// stop loop at line 30 (really this should never happen)
if ($key > 30)
{
$found = true;
}
}
// reset all keys
$code = array_values($code);
// remove last lines until }
$last = count($code);
while ($last > 0)
{
$last--;
if (isset($code[$last]))
{
if (strpos($code[$last], '}') !== false)
{
unset($code[$last]);
// only remove the first } found
$last = 0;
}
// remove empty lines
elseif (!UtilitiesStringHelper::check(trim($code[$last])))
{
unset($code[$last]);
}
}
}
}
/*
* Get the Array of Existing Validation Rule Names
*
* @return array
*/
public static function getExistingValidationRuleNames($lowercase = false)
{
// get the items
$items = self::get('_existing_validation_rules_VDM', null);
if (!$items)
{
// load the file class
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
// set the path to the form validation rules
$path = JPATH_LIBRARIES . '/src/Form/Rule';
// check if the path exist
if (!Folder::exists($path))
{
return false;
}
// we must first store the current working directory
$joomla = getcwd();
// go to that folder
chdir($path);
// load all the files in this path
$items = Folder::files('.', '\.php', true, true);
// change back to Joomla working directory
chdir($joomla);
// make sure we have an array
if (!UtilitiesArrayHelper::check($items))
{
return false;
}
// remove the Rule.php from the name
$items = array_map( function ($name) {
return str_replace(array('./','Rule.php'),
'', $name);
}, $items);
// store the names for next run
self::set('_existing_validation_rules_VDM',
json_encode($items));
}
// make sure it is no longer json
if (JsonHelper::check($items))
{
$items = json_decode($items, true);
}
// check if the names should be all lowercase
if ($lowercase)
{
$items = array_map( function($item) {
return strtolower($item);
}, $items);
}
return $items;
}
/**
* Get the snippet contributor details
*
* @param string $filename The file name
* @param string $type The type of file
*
* @return array On success the contributor details
*
*/
public static function getContributorDetails($filename, $type =
'snippet')
{
// start loading the contributor details
$contributor = array();
// get the path & content
switch ($type)
{
case 'snippet':
$path = self::$snippetPath.$filename;
// get the file if available
$content = FileHelper::getContent($path);
if (JsonHelper::check($content))
{
$content = json_decode($content, true);
}
break;
default:
// only allow types that are being targeted
return false;
break;
}
// see if we have content and all needed details
if (isset($content) && UtilitiesArrayHelper::check($content)
&& isset($content['contributor_company'])
&& isset($content['contributor_name'])
&& isset($content['contributor_email'])
&& isset($content['contributor_website']))
{
// got the details from file
return array('contributor_company' =>
$content['contributor_company'] ,'contributor_name'
=> $content['contributor_name'], 'contributor_email'
=> $content['contributor_email'],
'contributor_website' =>
$content['contributor_website'], 'origin' =>
'file');
}
// get the global settings
if (!ObjectHelper::check(self::$params))
{
self::$params =
ComponentHelper::getParams('com_componentbuilder');
}
// get the global company details
if (!UtilitiesArrayHelper::check(self::$localCompany))
{
// Set the person sharing information (default VDM ;)
self::$localCompany['company'] =
self::$params->get('export_company', 'Vast Development
Method');
self::$localCompany['owner'] =
self::$params->get('export_owner', 'Llewellyn van der
Merwe');
self::$localCompany['email'] =
self::$params->get('export_email',
'joomla@vdm.io');
self::$localCompany['website'] =
self::$params->get('export_website',
'https://www.vdm.io/');
}
// default global
return array('contributor_company' =>
self::$localCompany['company'] ,'contributor_name'
=> self::$localCompany['owner'], 'contributor_email'
=> self::$localCompany['email'],
'contributor_website' =>
self::$localCompany['website'], 'origin' =>
'global');
}
/**
* Get the library files
*
* @param int $id The library id to target
*
* @return array On success the array of files that belong to this
library
*
*/
public static function getLibraryFiles($id)
{
// get the library files, folders, and urls
$files = array();
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('b.name','a.addurls','a.addfolders','a.addfiles')));
$query->from($db->quoteName('#__componentbuilder_library_files_folders_urls','a'));
$query->join('LEFT',
$db->quoteName('#__componentbuilder_library', 'b') .
' ON (' . $db->quoteName('a.library') . ' =
' . $db->quoteName('b.id') . ')');
$query->where($db->quoteName('a.library') . ' =
' . (int) $id);
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
// prepare the files
$result = $db->loadObject();
// first we load the URLs
if (JsonHelper::check($result->addurls))
{
// convert to array
$result->addurls = json_decode($result->addurls, true);
// set urls
if (UtilitiesArrayHelper::check($result->addurls))
{
// build media folder path
$mediaPath = '/media/' . strtolower(
preg_replace('/\s+/', '-',
UtilitiesStringHelper::safe($result->name, 'filename', '
', false)));
// load the urls
foreach($result->addurls as $url)
{
if (isset($url['url']) &&
UtilitiesStringHelper::check($url['url']))
{
// set the path if needed
if (isset($url['type']) && $url['type']
> 1)
{
$fileName = basename($url['url']);
// build sub path
if (strpos($fileName, '.js') !== false)
{
$path = '/js';
}
elseif (strpos($fileName, '.css') !== false)
{
$path = '/css';
}
else
{
$path = '';
}
// set the path to library file
$url['path'] = $mediaPath . $path . '/' .
$fileName; // we need this for later
}
// if local path is set, then use it first
if (isset($url['path']))
{
// load document script
$files[md5($url['path'])] = '(' .
Text::_('URL') . ') ' . basename($url['url'])
. ' - ' . Text::_('COM_COMPONENTBUILDER_LOCAL');
}
// check if link must be added
if (isset($url['url']) &&
((isset($url['type']) && $url['type'] == 1) ||
(isset($url['type']) && $url['type'] == 3) ||
!isset($url['type'])))
{
// load url also if not building document
$files[md5($url['url'])] = '(' .
Text::_('URL') . ') ' . basename($url['url'])
. ' - ' . Text::_('COM_COMPONENTBUILDER_LINK');
}
}
}
}
}
// load the local files
if (JsonHelper::check($result->addfiles))
{
// convert to array
$result->addfiles = json_decode($result->addfiles, true);
// set files
if (UtilitiesArrayHelper::check($result->addfiles))
{
foreach($result->addfiles as $file)
{
if (isset($file['file']) &&
isset($file['path']))
{
$path = '/'.trim($file['path'], '/');
// check if path has new file name (has extetion)
$pathInfo = pathinfo($path);
if (isset($pathInfo['extension']) &&
$pathInfo['extension'])
{
// load document script
$files[md5($path)] = '(' .
Text::_('COM_COMPONENTBUILDER_FILE') . ') ' .
$file['file'];
}
else
{
// load document script
$files[md5($path.'/'.trim($file['file'],'/'))]
= '(' . Text::_('COM_COMPONENTBUILDER_FILE') . ')
' . $file['file'];
}
}
}
}
}
// load the files in the folder
if (JsonHelper::check($result->addfolders))
{
// convert to array
$result->addfolders = json_decode($result->addfolders, true);
// set folder
if (UtilitiesArrayHelper::check($result->addfolders))
{
// get the global settings
if (!ObjectHelper::check(self::$params))
{
self::$params =
ComponentHelper::getParams('com_componentbuilder');
}
// reset bucket
$bucket = array();
// get custom folder path
$customPath =
'/'.trim(self::$params->get('custom_folder_path',
JPATH_COMPONENT_ADMINISTRATOR.'/custom'), '/');
// get all the file paths
foreach ($result->addfolders as $folder)
{
if (isset($folder['path']) &&
isset($folder['folder']))
{
$_path = '/'.trim($folder['path'],
'/');
$customFolder = '/'.trim($folder['folder'],
'/');
if (isset($folder['rename']) && 1 ==
$folder['rename'])
{
if ($_paths = FileHelper::getPaths($customPath.$customFolder))
{
$bucket[$_path] = $_paths;
}
}
else
{
$path = $_path.$customFolder;
if ($_paths = FileHelper::getPaths($customPath.$customFolder))
{
$bucket[$path] = $_paths;
}
}
}
}
// now load the script
if (UtilitiesArrayHelper::check($bucket))
{
foreach ($bucket as $root => $paths)
{
// load per path
foreach($paths as $path)
{
$files[md5($root.'/'.trim($path, '/'))] =
'(' . Text::_('COM_COMPONENTBUILDER_FOLDER') . ')
' . basename($path) . ' - ' . basename($root);
}
}
}
}
}
// return files if found
if (UtilitiesArrayHelper::check($files))
{
return $files;
}
}
return false;
}
/**
* Fix the path to work in the JCB script <-- (main issue here)
* Since we need / slash in all paths, for the JCB script even if it is
Windows
* and since MS works with both forward and back slashes
* we just convert all slashes to forward slashes
*
* THIS is just my hack (fix) if you know a better way! speak-up!
*
* @param mix $values the array of paths or the path as a string
* @param array $targets paths to target
*
* @return string
*
*/
public static function fixPath(&$values, $targets = array())
{
// if multiple to gets searched and fixed
if (UtilitiesArrayHelper::check($values) &&
UtilitiesArrayHelper::check($targets))
{
foreach ($targets as $target)
{
if (isset($values[$target]) && strpos($values[$target],
'\\') !== false)
{
$values[$target] = str_replace('\\', '/',
$values[$target]);
}
}
}
// if just a string
elseif (UtilitiesStringHelper::check($values) && strpos($values,
'\\') !== false)
{
$values = str_replace('\\', '/', $values);
}
}
/**
* get all component IDs
*/
public static function getComponentIDs()
{
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('id')));
$query->from($db->quoteName('#__componentbuilder_joomla_component'));
$query->where($db->quoteName('published') . ' >=
1'); // do not backup trash
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadColumn();
}
return false;
}
/**
* Autoloader
*/
public static function autoLoader($type = 'compiler')
{
// load the type classes
if ('smart' !== $type)
{
foreach
(glob(JPATH_ADMINISTRATOR."/components/com_componentbuilder/helpers/".$type."/*.php")
as $autoFile)
{
require_once $autoFile;
}
}
// load only if compiler
if ('compiler' === $type)
{
// import the Joomla librarys
jimport('joomla.application.component.modellist');
}
// load only if smart
if ('smart' === $type)
{
// import the Joomla libraries
jimport('joomla.application.component.modellist');
}
// load this for all
jimport('joomla.application');
}
/*
* Convert repeatable field to subform
*
* @param array $item The array to convert
* @param string $name The main field name
*
* @return array
*/
public static function convertRepeatable($item, $name)
{
// continue only if we have an array
if (UtilitiesArrayHelper::check($item))
{
$bucket = array();
foreach ($item as $key => $values)
{
foreach ($values as $nr => $value)
{
if (!isset($bucket[$name . $nr]) ||
!UtilitiesArrayHelper::check($bucket[$name . $nr]))
{
$bucket[$name . $nr] = array();
}
$bucket[$name . $nr][$key] = $value;
}
}
return $bucket;
}
return $item;
}
/*
* Convert repeatable field to subform
*
* @param object $item The item to update
* @param array $searcher The fields to check and update
* @param array $updater To update the local table
*
* @return void
*/
public static function convertRepeatableFields($object, $searcher,
$updater = array())
{
// update the repeatable fields
foreach ($searcher as $key => $sleutel)
{
if (isset($object->{$key}))
{
$isJson = false;
if (JsonHelper::check($object->{$key}))
{
$object->{$key} = json_decode($object->{$key}, true);
$isJson = true;
}
// check if this is old values for repeatable fields
if (UtilitiesArrayHelper::check($object->{$key}) &&
isset($object->{$key}[$sleutel]))
{
// load it back
$object->{$key} = self::convertRepeatable($object->{$key},
$key);
// add to global updater
if (
UtilitiesArrayHelper::check($object->{$key}) &&
UtilitiesArrayHelper::check($updater) &&
(
( isset($updater['table']) &&
isset($updater['val']) &&
isset($updater['key']) ) ||
( isset($updater['unique']) &&
isset($updater['unique'][$key]) &&
isset($updater['unique'][$key]['table']) &&
isset($updater['unique'][$key]['val']) &&
isset($updater['unique'][$key]['key']) )
)
)
{
$_key = null;
$_value = null;
$_table = null;
// check if we have unique id table for this repeatable/subform
field
if ( isset($updater['unique']) &&
isset($updater['unique'][$key]) &&
isset($updater['unique'][$key]['table']) &&
isset($updater['unique'][$key]['val']) &&
isset($updater['unique'][$key]['key']) )
{
$_key = $updater['unique'][$key]['key'];
$_value = $updater['unique'][$key]['val'];
$_table = $updater['unique'][$key]['table'];
}
elseif ( isset($updater['table']) &&
isset($updater['val']) &&
isset($updater['key']) )
{
$_key = $updater['key'];
$_value = $updater['val'];
$_table = $updater['table'];
}
// continue only if values are valid
if (UtilitiesStringHelper::check($_table) &&
UtilitiesStringHelper::check($_key) && $_value > 0)
{
// set target table & item
$target = trim($_table) . '.' . trim($_key) .
'.' . trim($_value);
if (!isset(self::$globalUpdater[$target]))
{
self::$globalUpdater[$target] = new \stdClass;
self::$globalUpdater[$target]->{$_key} = (int) $_value;
}
// load the new subform values to global updater
self::$globalUpdater[$target]->{$key} =
json_encode($object->{$key});
}
}
}
// no set back to json if came in as json
if ($isJson &&
UtilitiesArrayHelper::check($object->{$key}))
{
$object->{$key} = json_encode($object->{$key});
}
// remove if not json or array
elseif (!UtilitiesArrayHelper::check($object->{$key}) &&
!JsonHelper::check($object->{$key}))
{
unset($object->{$key});
}
}
}
return $object;
}
/**
* Run Global Updater if any are set
*
* @return void
*
*/
public static function runGlobalUpdater()
{
// check if any updates are set to run
if (UtilitiesArrayHelper::check(self::$globalUpdater))
{
// get the database object
$db = Factory::getDbo();
foreach (self::$globalUpdater as $tableKeyID => $object)
{
// get the table
$table = explode('.', $tableKeyID);
// update the item
$db->updateObject('#__componentbuilder_' . (string)
$table[0] , $object, (string) $table[1]);
}
// rest updater
self::$globalUpdater = array();
}
}
/**
* Copy Any Item (only use for direct database copying)
*
* @param int $id The item to copy
* @param string $table The table and model to copy from and with
* @param array $config The values that should change
*
* @return boolean True if success
*
*/
public static function copyItem($id, $type, $config = array())
{
// only continue if we have an id
if ((int) $id > 0)
{
// get the model
$model = self::getModel($type);
$app = Factory::getApplication();
// get item
if ($item = $model->getItem($id))
{
// update values that should change
if (UtilitiesArrayHelper::check($config))
{
foreach($config as $key => $value)
{
if (isset($item->{$key}))
{
$item->{$key} = $value;
}
}
}
// clone the object
$data = array();
foreach ($item as $key => $value)
{
$data[$key] = $value;
}
// reset some values
$data['id'] = 0;
$data['version'] = 1;
if (isset($data['tags']))
{
$data['tags'] = null;
}
if (isset($data['associations']))
{
$data['associations'] = array();
}
// remove some unneeded values
unset($data['params']);
unset($data['asset_id']);
unset($data['checked_out']);
unset($data['checked_out_time']);
// Attempt to save the data.
if ($model->save($data))
{
return true;
}
}
}
return false;
}
/**
* the basic localkey
**/
protected static $localkey = false;
/**
* get the localkey
**/
public static function getLocalKey()
{
if (!self::$localkey)
{
// get the basic key
self::$localkey = md5(self::getCryptKey('basic',
'localKey34fdWEkl'));
}
return self::$localkey;
}
/**
* indent HTML
*/
public static function indent($html)
{
// load the class
require_once
JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/indenter.php';
// set new indenter
$indenter = new Indenter();
// return indented html
return $indenter->indent($html);
}
public static function checkFileType($file, $sufix)
{
// now check if the file ends with the sufix
return $sufix === "" || ($sufix == substr(strrchr($file,
"."), -strlen($sufix)));
}
public static function imageInfo($path, $request = 'type')
{
// set image
$image = JPATH_SITE.'/'.$path;
// check if exists
if (file_exists($image) && $result = @getimagesize($image))
{
// return type request
switch ($request)
{
case 'width':
return $result[0];
break;
case 'height':
return $result[1];
break;
case 'type':
$extensions = array(
IMAGETYPE_GIF => "gif",
IMAGETYPE_JPEG => "jpg",
IMAGETYPE_PNG => "png",
IMAGETYPE_SWF => "swf",
IMAGETYPE_PSD => "psd",
IMAGETYPE_BMP => "bmp",
IMAGETYPE_TIFF_II => "tiff",
IMAGETYPE_TIFF_MM => "tiff",
IMAGETYPE_JPC => "jpc",
IMAGETYPE_JP2 => "jp2",
IMAGETYPE_JPX => "jpx",
IMAGETYPE_JB2 => "jb2",
IMAGETYPE_SWC => "swc",
IMAGETYPE_IFF => "iff",
IMAGETYPE_WBMP => "wbmp",
IMAGETYPE_XBM => "xbm",
IMAGETYPE_ICO => "ico"
);
return $extensions[$result[2]];
break;
case 'attr':
return $result[3];
break;
case 'all':
default:
return $result;
break;
}
}
return false;
}
/**
* set the session defaults if not set
**/
protected static function setSessionDefaults()
{
// noting for now
return true;
}
/**
* check if it is a new hash
**/
public static function newHash($hash, $name = 'backup', $type =
'hash', $key = '', $fileType = 'txt')
{
// make sure we have a hash
if (UtilitiesStringHelper::check($hash))
{
// first get the file path
$path_filename = FileHelper::getPath('path', $name.$type,
$fileType, $key, JPATH_COMPONENT_ADMINISTRATOR);
// set as read if not already set
if ($content = FileHelper::getContent($path_filename, false))
{
if ($hash == $content)
{
return false;
}
}
// set the hash
return FileHelper::write($path_filename, $hash);
}
return false;
}
protected static $pkOwnerSearch = array(
'company' =>
'COM_COMPONENTBUILDER_DTCOMPANYDTDDSDD',
'owner' => 'COM_COMPONENTBUILDER_DTOWNERDTDDSDD',
'email' => 'COM_COMPONENTBUILDER_DTEMAILDTDDSDD',
'website' =>
'COM_COMPONENTBUILDER_DTWEBSITEDTDDSDD',
'license' =>
'COM_COMPONENTBUILDER_DTLICENSEDTDDSDD',
'copyright' =>
'COM_COMPONENTBUILDER_DTCOPYRIGHTDTDDSDD'
);
/**
* get the JCB package owner details display
**/
public static function getPackageOwnerDetailsDisplay(&$info, $trust =
false)
{
$hasOwner = false;
$ownerDetails = '<h2 class="module-title
nav-header">' .
Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') .
'</h2>';
$ownerDetails .= '<dl
class="uk-description-list-horizontal">';
// load the list items
foreach (self::$pkOwnerSearch as $key => $dd)
{
if ($value = self::getPackageOwnerValue($key, $info))
{
$ownerDetails .= Text::sprintf($dd, $value);
// check if we have a owner/source name
if (('owner' === $key || 'company' === $key)
&& !$hasOwner)
{
$hasOwner = true;
$owner = $value;
}
}
}
$ownerDetails .= '</dl>';
// provide some details to how the user can get a key
if ($hasOwner &&
isset($info['getKeyFrom']['buy_link']) &&
UtilitiesStringHelper::check($info['getKeyFrom']['buy_link']))
{
$ownerDetails .= '<hr />';
$ownerDetails .=
Text::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_SSA',
'class="btn btn-primary"
href="'.$info['getKeyFrom']['buy_link'].'"
target="_blank" title="get a key from
'.$owner.'"', $owner);
}
// add more custom links
elseif ($hasOwner &&
isset($info['getKeyFrom']['buy_links']) &&
UtilitiesArrayHelper::check($info['getKeyFrom']['buy_links']))
{
$buttons = array();
foreach ($info['getKeyFrom']['buy_links'] as
$keyName => $link)
{
$buttons[] =
Text::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROM_SB_FOR_A_SSA',
$owner, 'class="btn btn-primary"
href="'.$link.'" target="_blank"
title="get a key from '.$owner.'"', $keyName);
}
$ownerDetails .= '<hr />';
$ownerDetails .= implode('<br />', $buttons);
}
// return the owner details
if (!$hasOwner)
{
$ownerDetails = '<h2>' .
Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND') .
'</h2>';
if (!$trust)
{
$ownerDetails .= '<p style="color:
#922924;">' .
Text::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE')
. '</p>';
}
}
return '<div>'.$ownerDetails.'</div>';
}
public static function getPackageOwnerValue($key, &$info)
{
$source = (isset($info['source']) &&
isset($info['source'][$key])) ? 'source' :
((isset($info['getKeyFrom']) &&
isset($info['getKeyFrom'][$key])) ? 'getKeyFrom' :
false);
if ($source &&
UtilitiesStringHelper::check($info[$source][$key]))
{
return $info[$source][$key];
}
return false;
}
/**
* get the JCB package component key status
**/
public static function getPackageComponentsKeyStatus(&$info)
{
// check the package key status
if (!isset($info['key']))
{
if (isset($info['getKeyFrom']) &&
isset($info['getKeyFrom']['owner']))
{
// this just confirms it for older packages
$info['key'] = true;
}
else
{
// this just confirms it for older packages
$info['key'] = false;
}
}
return $info['key'];
}
protected static $compOwnerSearch = array(
'ul' => array (
'companyname' =>
'COM_COMPONENTBUILDER_ICOMPANYI_BSB',
'author' => 'COM_COMPONENTBUILDER_IAUTHORI_BSB',
'email' => 'COM_COMPONENTBUILDER_IEMAILI_BSB',
'website' =>
'COM_COMPONENTBUILDER_IWEBSITEI_BSB',
),
'other' => array(
'license' =>
'COM_COMPONENTBUILDER_HFOUR_CLASSNAVHEADERLICENSEHFOURPSP',
'copyright' =>
'COM_COMPONENTBUILDER_HFOUR_CLASSNAVHEADERCOPYRIGHTHFOURPSP'
)
);
/**
* get the JCB package component details display
**/
public static function getPackageComponentsDetailsDisplay(&$info)
{
// check if these components need a key
$needKey = self::getPackageComponentsKeyStatus($info);
if (isset($info['name']) &&
UtilitiesArrayHelper::check($info['name']))
{
$cAmount = count((array) $info['name']);
$class2 = ($cAmount == 1) ? 'span12' : 'span6';
$counter = 1;
$display = array();
foreach ($info['name'] as $key => $value)
{
// set the name
$name= $value . ' v' .
$info['component_version'][$key];
if ($cAmount > 1 && $counter == 3)
{
$display[] = '</div>';
$counter = 1;
}
if ($cAmount > 1 && $counter == 1)
{
$display[] = '<div>';
}
$display[] = '<div class="well well-small ' . $class2
. '">';
$display[] = '<h3>';
$display[] = $name;
if ($needKey)
{
$display[] = ' - <em>' .
Text::sprintf('COM_COMPONENTBUILDER_PAIDLOCKED') .
'</em>';
}
else
{
$display[] = ' - <em>' .
Text::sprintf('COM_COMPONENTBUILDER_FREEOPEN') .
'</em>';
}
$display[] = '</h3><h4>';
$display[] = $info['short_description'][$key];
$display[] = '</h4>';
$display[] = '<ul class="uk-list
uk-list-striped">';
// load the list items
foreach (self::$compOwnerSearch['ul'] as $li => $value)
{
if (isset($info[$li]) && isset($info[$li][$key]))
{
$display[] = '<li>'.Text::sprintf($value,
$info[$li][$key]).'</li>';
}
}
$display[] = '</ul>';
// if we have a source link we add it
if (isset($info['joomla_source_link']) &&
UtilitiesArrayHelper::check($info['joomla_source_link'])
&& isset($info['joomla_source_link'][$key]) &&
UtilitiesStringHelper::check($info['joomla_source_link'][$key]))
{
$display[] = '<a class="uk-button uk-button-mini
uk-width-1-1 uk-margin-small-bottom "
href="'.$info['joomla_source_link'][$key].'"
target="_blank" title="Source Code for Joomla Component
('.$name.')">source code</a>';
}
// load other
foreach (self::$compOwnerSearch['other'] as $other =>
$value)
{
if (isset($info[$other]) && isset($info[$other][$key]))
{
$display[] = Text::sprintf($value, $info[$other][$key]);
}
}
$display[] = '</div>';
$counter++;
}
// close the div if needed
if ($cAmount > 1)
{
$display[] = '</div>';
}
return implode("\n",$display);
}
return
'<div>'.Text::_('COM_COMPONENTBUILDER_NO_COMPONENT_DETAILS_FOUND_SO_IT_IS_NOT_SAFE_TO_CONTINUE').'</div>';
}
/**
* get the database table columns
**/
public static function getDbTableColumns($tableName, $as, $type)
{
// Get a db connection.
$db = Factory::getDbo();
// get the columns
$columns = $db->getTableColumns("#__" . $tableName);
// set the type (multi or single)
$unique = '';
if (1 == $type)
{
$unique = UtilitiesStringHelper::safe($tableName) . '_';
}
if (UtilitiesArrayHelper::check($columns))
{
// build the return string
$tableColumns = array();
foreach ($columns as $column => $typeCast)
{
$tableColumns[] = $as . "." . $column . ' AS ' .
$unique . $column;
}
return implode("\n", $tableColumns);
}
return false;
}
/**
* get the view table columns
**/
public static function getViewTableColumns($admin_view, $as, $type)
{
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.addfields',
'b.name_single')));
$query->from($db->quoteName('#__componentbuilder_admin_fields',
'a'));
$query->join('LEFT',
$db->quoteName('#__componentbuilder_admin_view',
'b') . ' ON (' .
$db->quoteName('a.admin_view') . ' = ' .
$db->quoteName('b.id') . ')');
$query->where($db->quoteName('b.published') . ' =
1');
$query->where($db->quoteName('a.admin_view') . ' =
' . (int) $admin_view);
// Reset the query using our newly populated query object.
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$result = $db->loadObject();
$tableName = '';
if (1 == $type)
{
$tableName = UtilitiesStringHelper::safe($result->name_single) .
'_';
}
$addfields = json_decode($result->addfields, true);
if (UtilitiesArrayHelper::check($addfields))
{
// reset all buckets
$field = array();
$fields = array();
// get data
foreach ($addfields as $nr => $value)
{
$tmp = self::getFieldNameAndType((int) $value['field']);
if (UtilitiesArrayHelper::check($tmp))
{
$field[$nr] = $tmp;
}
// insure it is set to alias if needed
if (isset($value['alias']) &&
$value['alias'] == 1)
{
$field[$nr]['name'] = 'alias';
}
// remove a field that is not being stored in the database
if (!isset($value['list']) || $value['list'] ==
2)
{
unset($field[$nr]);
}
}
// add the basic defaults
$fields[] = $as . ".id AS " . $tableName . "id";
$fields[] = $as . ".asset_id AS " . $tableName .
"asset_id";
// load data
foreach ($field as $n => $f)
{
if (UtilitiesArrayHelper::check($f))
{
$fields[] = $as . "." . $f['name'] . " AS
" . $tableName . $f['name'];
}
}
// add the basic defaults
$fields[] = $as . ".published AS " . $tableName .
"published";
$fields[] = $as . ".created_by AS " . $tableName .
"created_by";
$fields[] = $as . ".modified_by AS " . $tableName .
"modified_by";
$fields[] = $as . ".created AS " . $tableName .
"created";
$fields[] = $as . ".modified AS " . $tableName .
"modified";
$fields[] = $as . ".version AS " . $tableName .
"version";
$fields[] = $as . ".hits AS " . $tableName .
"hits";
if (0) // TODO access is not set here but per/view in the form linking
this admin view to which these field belong to the components (boooo I know
but that is the case and so we can't ever really know at this point if
this view has access set)
{
$fields[] = $as . ".access AS " . $tableName .
"access";
}
$fields[] = $as . ".ordering AS " . $tableName .
"ordering";
// return the field of this view
return implode("\n", $fields);
}
}
return false;
}
public static function getFieldNameAndType($id, $spacers = false)
{
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Order it by the ordering field.
$query->select($db->quoteName(array('a.name',
'a.xml')));
$query->select($db->quoteName(array('c.name'),
array('type_name')));
$query->from('#__componentbuilder_field AS a');
$query->join('LEFT',
$db->quoteName('#__componentbuilder_fieldtype', 'c')
. ' ON (' . $db->quoteName('a.fieldtype') . ' =
' . $db->quoteName('c.id') . ')');
$query->where($db->quoteName('a.id') . ' = '.
$db->quote($id));
// Reset the query using our newly populated query object.
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
// Load the results as a list of stdClass objects (see later for more
options on retrieving data).
$field = $db->loadObject();
// load the values form params
$field->xml = json_decode($field->xml);
$field->type_name = self::safeTypeName($field->type_name);
$load = true;
// if category then name must be catid (only one per view)
if ($field->type_name === 'category')
{
$name = 'catid';
}
// if tag is set then enable all tag options for this view (only one per
view)
elseif ($field->type_name === 'tag')
{
$name = 'tags';
}
// don't add spacers or notes
elseif (!$spacers && ($field->type_name == 'spacer'
|| $field->type_name == 'note'))
{
// make sure the name is unique
return false;
}
else
{
$name =
self::safeFieldName(GetHelper::between($field->xml,'name="','"'));
}
// use field core name only if not found in xml
if (!UtilitiesStringHelper::check($name))
{
$name = self::safeFieldName($field->name);
}
return array('name' => $name, 'type' =>
$field->type_name);
}
return false;
}
/**
* validate that a placeholder is unique
**/
public static function validateUniquePlaceholder($id, $name, $bool =
false)
{
// make sure no padding is set
$name = preg_replace("/[^A-Za-z0-9_]/", '', $name);
// this list may grow as we find more cases that break the compiler (just
open an issue on github)
if (in_array($name, array('component', 'view',
'views')))
{
// check if we must return boolean
if (!$bool)
{
return array (
'message' =>
Text::_('COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE_IN_THE_COMPILER'),
'status' => 'danger');
}
return false;
}
// add the padding (needed)
$name = '[[[' . trim($name) . ']]]';
if (self::placeholderIsSet($id, $name))
{
// check if we must return boolean
if (!$bool)
{
return array (
'message' =>
Text::_('COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE'),
'status' => 'danger');
}
return false;
}
// check if we must return boolean
if (!$bool)
{
return array (
'name' => $name,
'message' =>
Text::_('COM_COMPONENTBUILDER_GREAT_THIS_PLACEHOLDER_WILL_WORK'),
'status' => 'success');
}
return true;
}
/**
* search for placeholder in table
**/
protected static function placeholderIsSet($id, $name)
{
// query the table for result array
if (($results = self::getPlaceholderTarget($id, $name)) !== false)
{
// check if we must continue the search
foreach ($results as $_id => $target)
{
if ($name === $target)
{
return true;
}
}
}
return false;
}
/**
* get placeholder target
**/
protected static function getPlaceholderTarget($id, $name)
{
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('id',
'target')));
$query->from($db->quoteName('#__componentbuilder_placeholder'));
$query->where($db->quoteName('target') . ' = '.
$db->quote($name));
// check if we have id
if (is_numeric($id))
{
$query->where($db->quoteName('id') . ' <>
' . (int) $id);
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadAssocList('id', 'target');
}
return false;
}
/**
* Powers to exclude
**/
public static function excludePowers($id)
{
// first check if this power set is already found
if (!isset(self::$exPowers[$id]))
{
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id')));
$query->from($db->quoteName('#__componentbuilder_power',
'a'));
$query->join('LEFT',
$db->quoteName('#__componentbuilder_power', 'b') .
' ON (' . $db->quoteName('a.name') . ' = '
. $db->quoteName('b.name') . ' AND ' .
$db->quoteName('a.namespace') . ' = ' .
$db->quoteName('b.namespace') . ')');
$query->where($db->quoteName('b.id') . ' = ' .
(int) $id);
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
self::$exPowers[$id] = $db->loadColumn();
}
// all ways add itself aswell
self::$exPowers[$id][] = $id;
}
// if found return
if (isset(self::$exPowers[$id]))
{
return self::$exPowers[$id];
}
return false;
}
/**
* The array of dynamic content
*
* @var array
*/
protected static array $dynamicContent = [
// The banners by size (width - height)
'banner' => [
'728-90' => [
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/joomla-heart-wide.gif',
'hash' => 'f857e3a38facaeac9eba3cffa912b620',
'html' => '<a
href="https://vdm.bz/joomla-volunteers" target="_blank"
title="Joomla! Volunteers Portal"><img
class="jcb-sponsor-banner"
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/banner/joomla-heart-wide.gif"
alt="Joomla! Volunteers Portal" width="728"
height="90" border="0"></a>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/JCM_2010_120x600.png',
'hash' => '5389cf3be8569cb3f6793e8bd4013d19',
'html' => '<a
href="https://vdm.bz/joomla-magazine" target="_blank"
title="Joomla! Community Magazine | Because community
matters..."><img class="jcb-sponsor-banner"
alt="Joomla! Community Magazine | Because community matters..."
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/banner/JCM_2010_728x90.png"
width="728" height="90" border="0"
/></a>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/tlwebdesign_jcb_sponsor_728_90.png',
'hash' => 'd19be1f9f5b2049ff901096aafc246be',
'html' => '<a
href="https://vdm.bz/jcb-sponsor-tlwebdesign"
target="_blank" title="tlwebdesign a JCB sponsor | Because
community matters..."><img class="jcb-sponsor-banner"
alt="tlwebdesign a JCB sponsor | Because community matters..."
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/banner/tlwebdesign_jcb_sponsor_728_90.png"
width="728" height="90" border="0"
/></a>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/vdm_jcb_sponsor_728_90.gif',
'hash' => '84478dfa0cd880395815e0ee026812a4',
'html' => '<a
href="https://vdm.bz/jcb-sponsor-vdm" target="_blank"
title="VDM a JCB sponsor | Because community
matters..."><img class="jcb-sponsor-banner"
alt="VDM a JCB sponsor | Because community matters..."
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/banner/vdm_jcb_sponsor_728_90.gif"
width="728" height="90" border="0"
/></a>'],
[
'url' =>
'https://cms-experts.org/images/banners/agerix/agerix-loves-jcb-728-90.gif',
'hash' => 'b24c0726aa809cdcc04bcffe7e1e1529',
'html' => '<a
href="https://vdm.bz/jcb-sponsor-agerix"
target="_blank" title="Agerix a JCB sponsor | Because
community matters..."><img class="jcb-sponsor-banner"
alt="Agerix a JCB sponsor | Because community matters..."
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/banner/agerix-loves-jcb-728-90.gif"
width="728" height="90" border="0"
/></a>']
],
'160-600' => [
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/joomla-heart-tall.gif',
'hash' => '9a75e4929b86c318128b53cf78251678',
'html' => '<a
href="https://vdm.bz/joomla-volunteers" target="_blank"
title="Joomla! Volunteers Portal"><img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/banner/joomla-heart-tall.gif"
alt="Joomla! Volunteers Portal" width="160"
height="600" border="0"></a>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/JCM_2010_120x600.png',
'hash' => '5389cf3be8569cb3f6793e8bd4013d19',
'html' => '<a
href="https://vdm.bz/joomla-magazine" target="_blank"
title="Joomla! Community Magazine | Because community
matters..."><img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/banner/JCM_2010_120x600.png"
alt="Joomla! Community Magazine | Because community matters..."
width="120" height="600"
border="0"/></a>']
]
],
// The build-gif by size (width - height)
'builder-gif' => [
// original gif ;)
'480-272' => [
[
'url' =>
'https://www.joomlacomponentbuilder.com/images/builder/original.gif',
'hash' => '676e37a949add8f4573381195cd1061c',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/original.gif"
/>'
]
],
// new gif artwork since 2021
'480-540' => [
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/1.gif',
'hash' => 'ce6e36456fa794ba95d981547b2f54f8',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/1.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/2.gif',
'hash' => '0a54dbc393359747e33db90cabb1e2d7',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/2.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/3.gif',
'hash' => '4e5498713ff69a64a0a79dbf620372a3',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/3.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/4.gif',
'hash' => '3554ffab2a6df95a116fd9f0db63925c',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/4.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/5.gif',
'hash' => '08f0cdf188593eca65c6dafd7af27ef9',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/5.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/6.gif',
'hash' => '103b46a7ac3fcb974e25d06f417a4e87',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/6.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/7.gif',
'hash' => 'ffa8547099b7286f89ab7ff5a140dd90',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/7.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/8.gif',
'hash' => '316df780f9e4ce81200a65d3c4303c41',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/8.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/9.gif',
'hash' => '9ab6ba78b6e63a285fdef2ff5e447c93',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/9.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/10.gif',
'hash' => 'cd9abaa1cb95f51a70916da6b70614f2',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/10.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/11.gif',
'hash' => 'cfe53095b5249618e2348223b89262b9',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/11.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/12.gif',
'hash' => '15a6690647d5160d67c80ce4dd1f5602',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/12.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/13.gif',
'hash' => '2f77562e92c8a3b7c47664c98f551fe8',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/13.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/14.gif',
'hash' => '46db15517ef5bd063be85134e1cc575d',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/14.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/15.gif',
'hash' => 'e6c96eff157ea648ceb1583f2cc22544',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/15.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/16.gif',
'hash' => '76010b7d1f99952eb9645df660467ae8',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/16.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/17.gif',
'hash' => '021219ddd72d8fcfc7f80bd4a874d651',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/17.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/18.gif',
'hash' => '383af3179d4ae27301c1292e630d7155',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/18.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/19.gif',
'hash' => '8537e6d7be93447241b521f851e8a61d',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/19.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/20.gif',
'hash' => '10d96f70e3d43086a925b00a7dc0022e',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/20.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/21.gif',
'hash' => '161de9865b171b44039353b8d50491d3',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/21.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/22.gif',
'hash' => '6a2354e43eb97d278d74bb2c12890988',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/22.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/23.gif',
'hash' => '2cb6e2f9562a8dc8eef6d5d8d1a84f5e',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/23.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>'],
[
'url' =>
'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/24.gif',
'hash' => '745b3fb5e16515689132432bf02ab1b4',
'html' => '<img
src="[[[ROOT-URL]]]administrator/components/com_componentbuilder/assets/images/builder-gif/24.gif"
/><br /><div style="text-align: right; font-size:
smaller;">Animation produced with 3D Particle Explorations by Jack
Rugile.</div>']
]
]
];
/**
* get the dynamic content array size
*
* @param string $type The type of content
* @param string $size The size of the content
*
* @return int on success number of items in array type,size
*
*/
public static function getDynamicContentSize(string $type, string $size):
int
{
if (isset(self::$dynamicContent[$type]) &&
isset(self::$dynamicContent[$type][$size])
&& ($nr =
UtilitiesArrayHelper::check(self::$dynamicContent[$type][$size])))
{
return $nr;
}
return 0;
}
/**
* get the dynamic content
*
* @param string $type The type of content
* @param string $size The size of the content
* @param mixed $default The default to return
* @param int $try Retry tracker (when bigger then array
size it stops)
* @param mixed $getter The specific getter number (not zero
based)
*
* @return string on success html string
*
*/
public static function getDynamicContent(string $type, string $size,
$default = '', int $try = 1, $getter = null)
{
if (($nr = self::getDynamicContentSize($type, $size)) !== 0)
{
// use specific getter
if ($getter)
{
$get = --$getter;
}
// get the random getter number
elseif ($nr > 1)
{
$get = (int) rand(0, --$nr);
}
else
{
$get = 0;
}
// get the current target if found
if (isset(self::$dynamicContent[$type][$size][$get]))
{
$target = self::$dynamicContent[$type][$size][$get];
// set file name
$file_name = basename($target['url']);
// set the local path (in admin area so when the component uninstall
these images get removed as well)
$path = JPATH_ROOT .
"/administrator/components/com_componentbuilder/assets/images/$type/$file_name";
// check if file exist or if it changed
if (($image_data = FileHelper::getContent($path, false)) === false ||
md5($image_data) !== $target['hash'])
{
// since the file does not exist or has changed (so we have a new
hash)
// therefore we download it to validate
if (($image_data = FileHelper::getContent($target['url'],
false)) !== false &&
md5($image_data) === $target['hash'])
{
// create the JCB type path if it does not exist
if (!Folder::exists(JPATH_ROOT .
"/administrator/components/com_componentbuilder/assets/images/$type"))
{
Folder::create(JPATH_ROOT .
"/administrator/components/com_componentbuilder/assets/images/$type");
}
// only set the image if the data match the hash
FileHelper::write($path, $image_data);
}
// we retry array size times (unless specific getter is used)
elseif ($try <= $nr && !$getter)
{
// the first time around failed so we try again (the size of the
array times)
return self::getDynamicContent($type, $size, $default, ++$try);
}
}
// return found content
return str_replace('[[[ROOT-URL]]]', Uri::root(),
$target['html']);
}
}
return $default;
}
/**
* Tab/spacer bucket (to speed-up the build)
*
* @var array
*/
protected static $tabSpacerBucket = array();
/**
* Set tab/spacer
*
* @var string
*/
protected static $tabSpacer = "\t";
/**
* Set the tab/space
*
* @param int $nr The number of tag/space
*
* @return string
*
*/
public static function _t($nr)
{
// check if we already have the string
if (!isset(self::$tabSpacerBucket[$nr]))
{
// get the string
self::$tabSpacerBucket[$nr] = str_repeat(self::$tabSpacer, (int) $nr);
}
// return stored string
return self::$tabSpacerBucket[$nr];
}
/**
* the Butler
**/
public static $session = array();
/**
* the Butler Assistant
**/
protected static $localSession = array();
/**
* start a session if not already set, and load with data
**/
public static function loadSession()
{
if (!isset(self::$session) || !ObjectHelper::check(self::$session))
{
self::$session = Factory::getSession();
}
// set the defaults
self::setSessionDefaults();
}
/**
* give Session more to keep
**/
public static function set($key, $value)
{
if (!isset(self::$session) || !ObjectHelper::check(self::$session))
{
self::$session = Factory::getSession();
}
// set to local memory to speed up program
self::$localSession[$key] = $value;
// load to session for later use
return self::$session->set($key, self::$localSession[$key]);
}
/**
* get info from Session
**/
public static function get($key, $default = null)
{
if (!isset(self::$session) || !ObjectHelper::check(self::$session))
{
self::$session = Factory::getSession();
}
// check if in local memory
if (!isset(self::$localSession[$key]))
{
// set to local memory to speed up program
self::$localSession[$key] = self::$session->get($key, $default);
}
return self::$localSession[$key];
}
/**
* get field type properties
*
* @return array on success
*
*/
public static function getFieldTypeProperties($value, $type, $settings =
[], $xml = null, $dbDefaults = false)
{
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('properties',
'short_description', 'description')));
// load database default values
if ($dbDefaults)
{
$query->select($db->quoteName(array('datadefault',
'datadefault_other', 'datalenght',
'datalenght_other', 'datatype',
'has_defaults', 'indexes', 'null_switch',
'store')));
}
$query->from($db->quoteName('#__componentbuilder_fieldtype'));
$query->where($db->quoteName('published') . ' =
1');
$query->where($db->quoteName($type) . ' = '. $value);
// Reset the query using our newly populated query object.
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$result = $db->loadObject();
$properties = json_decode($result->properties, true);
$field = array(
'subform' => array(),
'nameListOptions' => array(),
'php' => array(),
'values' => "<field ",
'values_description' => '<table
class="uk-table uk-table-hover uk-table-striped
uk-table-condensed">',
'short_description' => $result->short_description,
'description' => $result->description);
// number pointer
$nr = 0;
// php tracker (we must try to load alteast 17 rows
$phpTracker = array();
// force load all properties
$forceAll = false;
if ($xml && strpos($xml,
'..__FORCE_LOAD_ALL_PROPERTIES__..') !== false)
{
$forceAll = true;
}
// value to check since there are false and null values even 0 in the
values returned
$confirmation =
'8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB';
// set the headers
$field['values_description'] .=
'<thead><tr><th
class="uk-text-right">' .
Text::_('COM_COMPONENTBUILDER_PROPERTY') .
'</th><th>' .
Text::_('COM_COMPONENTBUILDER_EXAMPLE') .
'</th><th>' .
Text::_('COM_COMPONENTBUILDER_DESCRIPTION') .
'</th></thead><tbody>';
foreach ($properties as $property)
{
$example = (isset($property['example']) &&
UtilitiesStringHelper::check($property['example'])) ?
$property['example'] : '';
$field['values_description'] .= '<tr><td
class="uk-text-right"><code>' .
$property['name'] .
'</code></td><td>' . $example .
'</td><td>' . $property['description'] .
'</td></tr>';
// check if we should load the value
$value = FieldHelper::getValue($xml, $property['name'],
$confirmation);
// check if this is a php field
$addPHP = false;
if (strpos($property['name'], 'type_php') !==
false)
{
$addPHP = true;
// set the line number
$phpLine = (int) preg_replace('/[^0-9]/', '',
$property['name']);
// set the key
$phpKey = trim(preg_replace('/[0-9]+/', '',
$property['name']), '_');
// start array if not already set
if (!isset($field['php'][$phpKey]))
{
$field['php'][$phpKey] = array();
$field['php'][$phpKey]['value'] = array();
$field['php'][$phpKey]['desc'] =
$property['description'];
// start tracker
$phpTracker[$phpKey] = 1;
}
}
// was the settings for the property passed
if(UtilitiesArrayHelper::check($settings) &&
isset($settings[$property['name']]))
{
// add the xml values
$field['values'] .= PHP_EOL . "\t" .
$property['name'] . '="'.
$settings[$property['name']] . '" ';
// add the json values
if ($addPHP)
{
$field['php'][$phpKey]['value'][$phpLine] =
$settings[$property['name']];
$phpTracker[$phpKey]++;
}
else
{
$field['subform']['properties'.$nr] =
array('name' => $property['name'], 'value'
=> $settings[$property['name']], 'desc' =>
$property['description']);
}
}
elseif ($forceAll || !$xml || $confirmation !== $value)
{
// add the xml values
$field['values'] .= PHP_EOL."\t" .
$property['name'] . '="' . ($confirmation !==
$value) ? $value : $example .'" ';
// add the json values
if ($addPHP)
{
$field['php'][$phpKey]['value'][$phpLine] =
($confirmation !== $value) ? $value : $example;
$phpTracker[$phpKey]++;
}
else
{
$field['subform']['properties' . $nr] =
array('name' => $property['name'], 'value'
=> ($confirmation !== $value) ? $value : $example, 'desc'
=> $property['description']);
}
}
// add the name List Options
if (!$addPHP)
{
$field['nameListOptions'][$property['name']] =
$property['name'];
}
// increment the number
$nr++;
}
// check if all php is loaded using the tracker
if (UtilitiesStringHelper::check($xml) && isset($phpTracker)
&& UtilitiesArrayHelper::check($phpTracker))
{
foreach ($phpTracker as $phpKey => $start)
{
if ($start < 30)
{
// we must search for more code in the xml just incase
foreach(range(2, 30) as $t_nr)
{
$get_ = $phpKey . '_' . $t_nr;
if
(!isset($field['php'][$phpKey]['value'][$t_nr])
&& ($value = FieldHelper::getValue($xml, $get_, $confirmation)) !==
$confirmation)
{
$field['php'][$phpKey]['value'][$t_nr] =
$value;
}
}
}
}
}
$field['values'] .= PHP_EOL . "/>";
$field['values_description'] .=
'</tbody></table>';
// load the database defaults if set and wanted
if ($dbDefaults && isset($result->has_defaults) &&
$result->has_defaults == 1)
{
$field['database'] = array(
'datatype' => $result->datatype,
'datadefault' => $result->datadefault,
'datadefault_other' => $result->datadefault_other,
'datalenght' => $result->datalenght,
'datalenght_other' => $result->datalenght_other,
'indexes' => $result->indexes,
'null_switch' => $result->null_switch,
'store' => $result->store
);
}
// return found field options
return $field;
}
return false;
}
/**
* Get a field value from the XML stored string
*
* @param string $xml The xml string of the field
* @param string $get The value key to get from the
string
* @param string $confirmation The value to confirm found value
*
* @return string The field value from xml
* @deprecated 3.3 Use FieldHelper::getValue($xml, $get, $confirmation);
*/
public static function getValueFromXMLstring(&$xml, &$get,
$confirmation = '')
{
return FieldHelper::getValue($xml, $get, $confirmation);
}
/**
* get field types properties
*
* @return array on success
*
*/
public static function getFieldTypesProperties($targets = array(), $filter
= array(), $exclude = array(), $type = 'id', $operator =
'IN')
{
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('id','properties')));
$query->from($db->quoteName('#__componentbuilder_fieldtype'));
$query->where($db->quoteName('published') . ' =
1');
// make sure we have ids (or get all)
if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS'
=== $operator)
{
$query->where($db->quoteName($type) . ' ' .
str_replace('_STRINGS', '', $operator) . '
("' . implode('","',$targets) .
'")');
}
else
{
$query->where($db->quoteName($type) . ' ' . $operator .
' (' . implode(',',$targets) . ')');
}
// Reset the query using our newly populated query object.
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$_types = array();
$_properties = array();
$types = $db->loadObjectList('id');
foreach ($types as $id => $type)
{
$properties = json_decode($type->properties);
foreach ($properties as $property)
{
if (!isset($_types[$id]))
{
$_types[$id] = array();
}
// add if no objection is found
$add = true;
// check if we have exclude
if (UtilitiesArrayHelper::check($exclude) &&
in_array($property->name, $exclude))
{
continue;
}
// check if we have filter
if (UtilitiesArrayHelper::check($filter))
{
foreach($filter as $key => $val)
{
if (!isset($property->$key) || $property->$key != $val)
{
$add = false;
}
}
}
// now add the property
if ($add)
{
$_types[$id][$property->name] = array('name' =>
ucfirst($property->name), 'example' =>
$property->example, 'description' =>
$property->description);
// set mandatory
if (isset($property->mandatory) && $property->mandatory
== 1)
{
$_types[$id][$property->name]['mandatory'] = true;
}
else
{
$_types[$id][$property->name]['mandatory'] = false;
}
// set translatable
if (isset($property->translatable) &&
$property->translatable == 1)
{
$_types[$id][$property->name]['translatable'] = true;
}
else
{
$_types[$id][$property->name]['translatable'] = false;
}
$_properties[$property->name] =
$_types[$id][$property->name]['name'];
}
}
}
// return found types & properties
return array('types' => $_types, 'properties'
=> $_properties);
}
return false;
}
/**
* Remove folders with files
*
* @param string $path The path to folder to remove
* @param array|null $ignore The folders and files to ignore and not
remove
*
* @return bool True if all are removed
*/
public static function removeFolder(string $path, ?array $ignore = null):
bool
{
if (!Folder::exists($path))
{
return false;
}
$it = new \RecursiveDirectoryIterator($path,
\RecursiveDirectoryIterator::SKIP_DOTS);
$files = new \RecursiveIteratorIterator($it,
\RecursiveIteratorIterator::CHILD_FIRST);
// Prepare a base path without trailing slash for comparison
$basePath = rtrim($path, '/');
foreach ($files as $fileinfo)
{
$filePath = $fileinfo->getRealPath();
if (self::removeFolderShouldIgnore($basePath, $filePath, $ignore))
{
continue;
}
if ($fileinfo->isDir())
{
Folder::delete($filePath);
}
else
{
File::delete($filePath);
}
}
// Delete the root folder if ignore not set
if (!UtilitiesArrayHelper::check($ignore))
{
return Folder::delete($path);
}
return true;
}
/**
* Check if the current path should be ignored.
*
* @param string $basePath The base directory path
* @param string $filePath The current file or directory path
* @param array|null $ignore List of items to ignore
*
* @return boolean True if the path should be ignored
* @since 3.2.0
*/
protected static function removeFolderShouldIgnore(string $basePath,
string $filePath, ?array $ignore = null): bool
{
if (!$ignore || !UtilitiesArrayHelper::check($ignore))
{
return false;
}
foreach ($ignore as $item)
{
if (strpos($filePath, $basePath . '/' . $item) !== false)
{
return true;
}
}
return false;
}
/**
* The github access token
**/
protected static $gitHubAccessToken = "";
/**
* The github repo get data errors
**/
public static $githubRepoDataErrors = array();
/**
* get the github repo file list
*
* @return array on success
*
*/
public static function getGithubRepoFileList($type, $target)
{
// get the repo data
if (($repoData = self::getGithubRepoData($type, $target,
'tree')) !== false)
{
return $repoData->tree;
}
return false;
}
/**
* get the github repo file list
*
* @return array on success
*
*/
public static function getGithubRepoData($type, $url, $target = null,
$return_type = 'object')
{
// always reset errors per/request
self::$githubRepoDataErrors = array();
// get the current Packages (public)
if ('nomemory' === $type || !$repoData = self::get($type))
{
// add the token if not already added
$_url = self::setGithubToken($url);
// check if the url exist
if (self::urlExists($_url))
{
// get the data from github
if (($repoData = FileHelper::getContent($_url)) !== false &&
JsonHelper::check($repoData))
{
$github_returned = json_decode($repoData);
if (UtilitiesStringHelper::check($target) &&
( (ObjectHelper::check($github_returned) &&
isset($github_returned->{$target}) &&
UtilitiesArrayHelper::check($github_returned->{$target})) ||
(UtilitiesArrayHelper::check($github_returned) &&
isset($github_returned[$target]) &&
UtilitiesArrayHelper::check($github_returned[$target])) ))
{
if ('nomemory' !== $type)
{
// remember to set it
self::set($type, $repoData);
}
}
elseif (!UtilitiesStringHelper::check($target) &&
(UtilitiesArrayHelper::check($github_returned) ||
(ObjectHelper::check($github_returned) &&
!isset($github_returned->message))))
{
if ('nomemory' !== $type)
{
// remember to set it
self::set($type, $repoData);
}
}
// check if we have error message from github
elseif (($errorMessage =
self::githubErrorHandeler(array('error' => null),
$github_returned, $type)) !== false)
{
if (isset($errorMessage['error']) &&
UtilitiesStringHelper::check($errorMessage['error']))
{
// set the error in the application
Factory::getApplication()->enqueueMessage($errorMessage['error'],
'Error');
// set the error also in the class encase it is and Ajax call
self::$githubRepoDataErrors[] = $errorMessage['error'];
}
return false;
}
elseif (UtilitiesStringHelper::check($target))
{
// setup error string
$error =
Text::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_S_DATA',
$url, $target);
// set the error in the application
Factory::getApplication()->enqueueMessage($error,
'Error');
// set the error also in the class encase it is and Ajax call
self::$githubRepoDataErrors[] = $error;
// we are done here
return false;
}
elseif ('nomemory' !== $type)
{
// setup error string
$error =
Text::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_S_DATA',
$url, $type);
// set the error in the application
Factory::getApplication()->enqueueMessage($error,
'Error');
// set the error also in the class encase it is and Ajax call
self::$githubRepoDataErrors[] = $error;
// we are done here
return false;
}
else
{
// setup error string
$error =
Text::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_VALID_DATA',
$url, $type);
// set the error in the application
Factory::getApplication()->enqueueMessage($error,
'Error');
// set the error also in the class encase it is and Ajax call
self::$githubRepoDataErrors[] = $error;
// we are done here
return false;
}
}
else
{
// setup error string
$error =
Text::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_RETURN_ANY_DATA',
$url);
// set the error in the application
Factory::getApplication()->enqueueMessage($error,
'Error');
// set the error also in the class encase it is and Ajax call
self::$githubRepoDataErrors[] = $error;
// we are done here
return false;
}
}
else
{
// setup error string
$error =
Text::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST',
$url);
// set the error in the application
Factory::getApplication()->enqueueMessage($error,
'Error');
// set the error also in the class encase it is and Ajax call
self::$githubRepoDataErrors[] = $error;
// we are done here
return false;
}
}
// check if we could find packages
if (isset($repoData) && JsonHelper::check($repoData))
{
if ('object' === $return_type)
{
return json_decode($repoData);
}
elseif ('array' === $return_type)
{
return json_decode($repoData, true);
}
return $repoData;
}
return false;
}
/**
* get the github error messages
*
* @return array of errors on success
*
*/
protected static function githubErrorHandeler($message, &$github,
$type)
{
if (ObjectHelper::check($github) && isset($github->message)
&& UtilitiesStringHelper::check($github->message))
{
// set the message
$errorMessage = $github->message;
// add the documentation URL
if (isset($github->documentation_url) &&
UtilitiesStringHelper::check($github->documentation_url))
{
$errorMessage = $errorMessage . '<br />' .
$github->documentation_url;
}
// check the message
if (strpos($errorMessage, 'Authenticated') !== false)
{
if ('nomemory' === $type)
{
$type = 'data';
}
// add little more help if it is an access token issue
$errorMessage =
Text::sprintf('COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_A_BGITHUB_ACCESS_TOKENB_TO_COMPONENTBUILDER_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_TO_GITHUB_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO_TO_RETRIEVE_S',
$errorMessage, $type);
}
// set error notice
$message['error'] = $errorMessage;
// we have error message
return $message;
}
return false;
}
/**
* set the github token
*
* @return array of errors on success
*
*/
protected static function setGithubToken($url)
{
// first check if token already set
if (strpos($url, 'access_token=') !== false)
{
// make sure the token is loaded
if (!UtilitiesStringHelper::check(self::$gitHubAccessToken))
{
// get the global settings
if (!ObjectHelper::check(self::$params))
{
self::$params =
ComponentHelper::getParams('com_componentbuilder');
}
self::$gitHubAccessToken =
self::$params->get('github_access_token', null);
}
// make sure the token is loaded at this point
if (UtilitiesStringHelper::check(self::$gitHubAccessToken))
{
$url .= '&access_token=' . self::$gitHubAccessToken;
}
}
return $url;
}
/**
* get Dynamic Scripts
*
* @param string $type The target type of string
* @param string $fieldName The target field name of string
*
* @return void
*
*/
public static function getDynamicScripts($type, $fieldName = false)
{
// if field name is passed the convert to type
if ($fieldName)
{
$fieldNames = array(
'php_import_display' => 'display',
'php_import_setdata' => 'setdata',
'php_import_save' => 'save',
'html_import_view' => 'view',
'php_import' => 'import',
'php_import_ext' => 'ext',
'php_import_headers' => 'headers'
);
// first check if the field name is found
if (isset($fieldNames[$type]))
{
$type = $fieldNames[$type];
}
else
{
return '';
}
}
$script = array();
if ('display' === $type)
{
// set the display script
$script['display'][] = self::_t(1) . "protected
\$headerList;";
$script['display'][] = self::_t(1) . "protected
\$hasPackage = false;";
$script['display'][] = self::_t(1) . "protected
\$headers;";
$script['display'][] = self::_t(1) . "protected
\$hasHeader = 0;";
$script['display'][] = self::_t(1) . "protected
\$dataType;";
$script['display'][] = self::_t(1) . "public function
display(\$tpl = null)";
$script['display'][] = self::_t(1) . "{";
$script['display'][] = self::_t(2) . "if
(\$this->getLayout() !== 'modal')";
$script['display'][] = self::_t(2) . "{";
$script['display'][] = self::_t(3) . "// Include helper
submenu";
$script['display'][] = self::_t(3) .
"[[[-#-#-Component]]]Helper::addSubmenu('import');";
$script['display'][] = self::_t(2) . "}";
$script['display'][] = PHP_EOL . self::_t(2) . "\$paths =
new \stdClass;";
$script['display'][] = self::_t(2) . "\$paths->first =
'';";
$script['display'][] = self::_t(2) . "\$state =
\$this->get('state');";
$script['display'][] = PHP_EOL . self::_t(2) .
"\$this->paths = &\$paths;";
$script['display'][] = self::_t(2) . "\$this->state =
&\$state;";
$script['display'][] = self::_t(2) . "// get global
action permissions";
$script['display'][] = self::_t(2) . "\$this->canDo =
[[[-#-#-Component]]]Helper::getActions('import');";
$script['display'][] = PHP_EOL . self::_t(2) . "// We
don't need toolbar in the modal window.";
$script['display'][] = self::_t(2) . "if
(\$this->getLayout() !== 'modal')";
$script['display'][] = self::_t(2) . "{";
$script['display'][] = self::_t(3) .
"\$this->addToolbar();";
$script['display'][] = self::_t(3) . "\$this->sidebar
= JHtmlSidebar::render();";
$script['display'][] = self::_t(2) . "}";
$script['display'][] = PHP_EOL . self::_t(2) . "// get
the session object";
$script['display'][] = self::_t(2) . "\$session =
Factory::getSession();";
$script['display'][] = self::_t(2) . "// check if it has
package";
$script['display'][] = self::_t(2) .
"\$this->hasPackage" . self::_t(1) . "=
\$session->get('hasPackage', false);";
$script['display'][] = self::_t(2) .
"\$this->dataType" . self::_t(1) . "=
\$session->get('dataType', false);";
$script['display'][] = self::_t(2) .
"if(\$this->hasPackage && \$this->dataType)";
$script['display'][] = self::_t(2) . "{";
$script['display'][] = self::_t(3) .
"\$this->headerList" . self::_t(1) . "=
json_decode(\$session->get(\$this->dataType.'_VDM_IMPORTHEADERS',
false),true);";
$script['display'][] = self::_t(3) .
"\$this->headers" . self::_t(2) . "=
[[[-#-#-Component]]]Helper::getFileHeaders(\$this->dataType);";
$script['display'][] = self::_t(3) . "// clear the data
type";
$script['display'][] = self::_t(3) .
"\$session->clear('dataType');";
$script['display'][] = self::_t(2) . "}";
$script['display'][] = PHP_EOL . self::_t(2) . "// Check
for errors.";
$script['display'][] = self::_t(2) . "if (count(\$errors
= \$this->get('Errors'))){";
$script['display'][] = self::_t(3) . "throw new
Exception(implode(PHP_EOL, \$errors), 500);";
$script['display'][] = self::_t(2) . "}";
$script['display'][] = PHP_EOL . self::_t(2) . "//
Display the template";
$script['display'][] = self::_t(2) .
"parent::display(\$tpl);";
$script['display'][] = self::_t(1) . "}";
}
elseif ('setdata' === $type)
{
// set the setdata script
$script['setdata'] = array();
$script['setdata'][] = self::_t(1) . "/**";
$script['setdata'][] = self::_t(1) . "* Set the data from
the spreadsheet to the database";
$script['setdata'][] = self::_t(1) . "*";
$script['setdata'][] = self::_t(1) . "* @param string
\$package Paths to the uploaded package file";
$script['setdata'][] = self::_t(1) . "*";
$script['setdata'][] = self::_t(1) . "* @return boolean
false on failure";
$script['setdata'][] = self::_t(1) . "*";
$script['setdata'][] = self::_t(1) . "**/";
$script['setdata'][] = self::_t(1) . "protected function
setData(\$package,\$table,\$target_headers)";
$script['setdata'][] = self::_t(1) . "{";
$script['setdata'][] = self::_t(2) . "if
(Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$target_headers))";
$script['setdata'][] = self::_t(2) . "{";
$script['setdata'][] = self::_t(3) . "// make sure the
file is loaded";
$script['setdata'][] = self::_t(3) .
"[[[-#-#-Component]]]Helper::composerAutoload('phpspreadsheet');";
$script['setdata'][] = self::_t(3) . "\$jinput =
Factory::getApplication()->input;";
$script['setdata'][] = self::_t(3) .
"foreach(\$target_headers as \$header)";
$script['setdata'][] = self::_t(3) . "{";
$script['setdata'][] = self::_t(4) . "if ((\$column =
\$jinput->getString(\$header, false)) !== false ||";
$script['setdata'][] = self::_t(5) . "(\$column =
\$jinput->getString(strtolower(\$header), false)) !== false)";
$script['setdata'][] = self::_t(4) . "{";
$script['setdata'][] = self::_t(5) .
"\$data['target_headers'][\$header] = \$column;";
$script['setdata'][] = self::_t(4) . "}";
$script['setdata'][] = self::_t(4) . "else";
$script['setdata'][] = self::_t(4) . "{";
$script['setdata'][] = self::_t(5) .
"\$data['target_headers'][\$header] = null;";
$script['setdata'][] = self::_t(4) . "}";
$script['setdata'][] = self::_t(3) . "}";
$script['setdata'][] = self::_t(3) . "// set the
data";
$script['setdata'][] = self::_t(3) .
"if(isset(\$package['dir']))";
$script['setdata'][] = self::_t(3) . "{";
$script['setdata'][] = self::_t(4) . "\$inputFileType =
IOFactory::identify(\$package['dir']);";
$script['setdata'][] = self::_t(4) . "\$excelReader =
IOFactory::createReader(\$inputFileType);";
$script['setdata'][] = self::_t(4) .
"\$excelReader->setReadDataOnly(true);";
$script['setdata'][] = self::_t(4) . "\$excelObj =
\$excelReader->load(\$package['dir']);";
$script['setdata'][] = self::_t(4) .
"\$data['array'] =
\$excelObj->getActiveSheet()->toArray(null, true,true,true);";
$script['setdata'][] = self::_t(4) .
"\$excelObj->disconnectWorksheets();";
$script['setdata'][] = self::_t(4) .
"unset(\$excelObj);";
$script['setdata'][] = self::_t(4) . "return
\$this->save(\$data, \$table);";
$script['setdata'][] = self::_t(3) . "}";
$script['setdata'][] = self::_t(2) . "}";
$script['setdata'][] = self::_t(2) . "return
false;";
$script['setdata'][] = self::_t(1) . "}";
}
elseif ('headers' === $type)
{
$script['headers'] = array();
$script['headers'][] = self::_t(1) . "/**";
$script['headers'][] = self::_t(1) . "* Method to get
header.";
$script['headers'][] = self::_t(1) . "*";
$script['headers'][] = self::_t(1) . "* @return mixed An
array of data items on success, false on failure.";
$script['headers'][] = self::_t(1) . "*/";
$script['headers'][] = self::_t(1) . "public function
getExImPortHeaders()";
$script['headers'][] = self::_t(1) . "{";
$script['headers'][] = self::_t(2) . "// Get a db
connection.";
$script['headers'][] = self::_t(2) . "\$db =
Factory::getDbo();";
$script['headers'][] = self::_t(2) . "// get the
columns";
$script['headers'][] = self::_t(2) . "\$columns =
\$db->getTableColumns(\"#__[[[-#-#-component]]]_[[[-#-#-view]]]\");";
$script['headers'][] = self::_t(2) . "if
(Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$columns))";
$script['headers'][] = self::_t(2) . "{";
$script['headers'][] = self::_t(3) . "// remove the
headers you don't import/export.";
$script['headers'][] = self::_t(3) .
"unset(\$columns['asset_id']);";
$script['headers'][] = self::_t(3) .
"unset(\$columns['checked_out']);";
$script['headers'][] = self::_t(3) .
"unset(\$columns['checked_out_time']);";
$script['headers'][] = self::_t(3) . "\$headers = new
\stdClass();";
$script['headers'][] = self::_t(3) . "foreach (\$columns
as \$column => \$type)";
$script['headers'][] = self::_t(3) . "{";
$script['headers'][] = self::_t(4) .
"\$headers->{\$column} = \$column;";
$script['headers'][] = self::_t(3) . "}";
$script['headers'][] = self::_t(3) . "return
\$headers;";
$script['headers'][] = self::_t(2) . "}";
$script['headers'][] = self::_t(2) . "return
false;";
$script['headers'][] = self::_t(1) . "}";
}
elseif ('save' === $type)
{
$script['save'] = array();
$script['save'][] = self::_t(1) . "/**";
$script['save'][] = self::_t(1) . "* Save the data from
the file to the database";
$script['save'][] = self::_t(1) . "*";
$script['save'][] = self::_t(1) . "* @param string
\$package Paths to the uploaded package file";
$script['save'][] = self::_t(1) . "*";
$script['save'][] = self::_t(1) . "* @return boolean
false on failure";
$script['save'][] = self::_t(1) . "*";
$script['save'][] = self::_t(1) . "**/";
$script['save'][] = self::_t(1) . "protected function
save(\$data,\$table)";
$script['save'][] = self::_t(1) . "{";
$script['save'][] = self::_t(2) . "// import the data if
there is any";
$script['save'][] = self::_t(2) .
"if(Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$data['array']))";
$script['save'][] = self::_t(2) . "{";
$script['save'][] = self::_t(3) . "// get user
object";
$script['save'][] = self::_t(3) . "\$user" .
self::_t(2) . "= Factory::getUser();";
$script['save'][] = self::_t(3) . "// remove header if it
has headers";
$script['save'][] = self::_t(3) . "\$id_key" .
self::_t(1) . "=
\$data['target_headers']['id'];";
$script['save'][] = self::_t(3) . "\$published_key"
. self::_t(1) . "=
\$data['target_headers']['published'];";
$script['save'][] = self::_t(3) . "\$ordering_key" .
self::_t(1) . "=
\$data['target_headers']['ordering'];";
$script['save'][] = self::_t(3) . "// get the first array
set";
$script['save'][] = self::_t(3) . "\$firstSet =
reset(\$data['array']);";
$script['save'][] = "";
$script['save'][] = self::_t(3) . "// check if first
array is a header array and remove if true";
$script['save'][] = self::_t(3) .
"if(\$firstSet[\$id_key] == 'id' ||
\$firstSet[\$published_key] == 'published' ||
\$firstSet[\$ordering_key] == 'ordering')";
$script['save'][] = self::_t(3) . "{";
$script['save'][] = self::_t(4) .
"array_shift(\$data['array']);";
$script['save'][] = self::_t(3) . "}";
$script['save'][] = self::_t(3) . "";
$script['save'][] = self::_t(3) . "// make sure there is
still values in array and that it was not only headers";
$script['save'][] = self::_t(3) .
"if(Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$data['array'])
&& \$user->authorise(\$table.'.import',
'com_[[[-#-#-component]]]') &&
\$user->authorise('core.import',
'com_[[[-#-#-component]]]'))";
$script['save'][] = self::_t(3) . "{";
$script['save'][] = self::_t(4) . "// set target.";
$script['save'][] = self::_t(4) . "\$target" .
self::_t(1) . "=
array_flip(\$data['target_headers']);";
$script['save'][] = self::_t(4) . "// Get a db
connection.";
$script['save'][] = self::_t(4) . "\$db =
Factory::getDbo();";
$script['save'][] = self::_t(4) . "// set some
defaults";
$script['save'][] = self::_t(4) . "\$todayDate" .
self::_t(2) . "= Factory::getDate()->toSql();";
$script['save'][] = self::_t(4) . "// get global action
permissions";
$script['save'][] = self::_t(4) . "\$canDo" .
self::_t(3) . "=
[[[-#-#-Component]]]Helper::getActions(\$table);";
$script['save'][] = self::_t(4) . "\$canEdit" .
self::_t(2) . "= \$canDo->get('core.edit');";
$script['save'][] = self::_t(4) . "\$canState" .
self::_t(2) . "= \$canDo->get('core.edit.state');";
$script['save'][] = self::_t(4) . "\$canCreate" .
self::_t(2) . "= \$canDo->get('core.create');";
$script['save'][] = self::_t(4) . "\$hasAlias" .
self::_t(2) . "= \$this->getAliasesUsed(\$table);";
$script['save'][] = self::_t(4) . "// prosses the
data";
$script['save'][] = self::_t(4) .
"foreach(\$data['array'] as \$row)";
$script['save'][] = self::_t(4) . "{";
$script['save'][] = self::_t(5) . "\$found =
false;";
$script['save'][] = self::_t(5) . "if
(isset(\$row[\$id_key]) && is_numeric(\$row[\$id_key]) &&
\$row[\$id_key] > 0)";
$script['save'][] = self::_t(5) . "{";
$script['save'][] = self::_t(6) . "// raw items import
& update!";
$script['save'][] = self::_t(6) . "\$query =
\$db->getQuery(true);";
$script['save'][] = self::_t(6) . "\$query";
$script['save'][] = self::_t(7) .
"->select('version')";
$script['save'][] = self::_t(7) .
"->from(\$db->quoteName('#__[[[-#-#-component]]]_'.\$table))";
$script['save'][] = self::_t(7) .
"->where(\$db->quoteName('id') . ' = '.
\$db->quote(\$row[\$id_key]));";
$script['save'][] = self::_t(6) . "// Reset the query
using our newly populated query object.";
$script['save'][] = self::_t(6) .
"\$db->setQuery(\$query);";
$script['save'][] = self::_t(6) .
"\$db->execute();";
$script['save'][] = self::_t(6) . "\$found =
\$db->getNumRows();";
$script['save'][] = self::_t(5) . "}";
$script['save'][] = self::_t(5) . "";
$script['save'][] = self::_t(5) . "if(\$found &&
\$canEdit)";
$script['save'][] = self::_t(5) . "{";
$script['save'][] = self::_t(6) . "// update item";
$script['save'][] = self::_t(6) . "\$id" .
self::_t(2) . "= \$row[\$id_key];";
$script['save'][] = self::_t(6) . "\$version" .
self::_t(1) . "= \$db->loadResult();";
$script['save'][] = self::_t(6) . "// reset all
buckets";
$script['save'][] = self::_t(6) . "\$query" .
self::_t(2) . "= \$db->getQuery(true);";
$script['save'][] = self::_t(6) . "\$fields" .
self::_t(1) . "= array();";
$script['save'][] = self::_t(6) . "// Fields to
update.";
$script['save'][] = self::_t(6) . "foreach(\$row as \$key
=> \$cell)";
$script['save'][] = self::_t(6) . "{";
$script['save'][] = self::_t(7) . "// ignore
column";
$script['save'][] = self::_t(7) . "if ('IGNORE'
== \$target[\$key])";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "continue;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "// update
modified";
$script['save'][] = self::_t(7) . "if
('modified_by' == \$target[\$key])";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "continue;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "// update
modified";
$script['save'][] = self::_t(7) . "if
('modified' == \$target[\$key])";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "continue;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "// update
version";
$script['save'][] = self::_t(7) . "if
('version' == \$target[\$key])";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "\$cell = (int)
\$version + 1;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "// verify publish
authority";
$script['save'][] = self::_t(7) . "if
('published' == \$target[\$key] && !\$canState)";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "continue;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "// set to update
array";
$script['save'][] = self::_t(7) . "if(in_array(\$key,
\$data['target_headers']) && is_numeric(\$cell))";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "\$fields[] =
\$db->quoteName(\$target[\$key]) . ' = ' . \$cell;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "elseif(in_array(\$key,
\$data['target_headers']) && is_string(\$cell))";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "\$fields[] =
\$db->quoteName(\$target[\$key]) . ' = ' .
\$db->quote(\$cell);";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "elseif(in_array(\$key,
\$data['target_headers']) && is_null(\$cell))";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "// if import data is
null then set empty";
$script['save'][] = self::_t(8) . "\$fields[] =
\$db->quoteName(\$target[\$key]) . \" =
''\";";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(6) . "}";
$script['save'][] = self::_t(6) . "// load the
defaults";
$script['save'][] = self::_t(6) . "\$fields[]" .
self::_t(1) . "= \$db->quoteName('modified_by') . '
= ' . \$db->quote(\$user->id);";
$script['save'][] = self::_t(6) . "\$fields[]" .
self::_t(1) . "= \$db->quoteName('modified') . ' =
' . \$db->quote(\$todayDate);";
$script['save'][] = self::_t(6) . "// Conditions for
which records should be updated.";
$script['save'][] = self::_t(6) . "\$conditions =
array(";
$script['save'][] = self::_t(7) .
"\$db->quoteName('id') . ' = ' . \$id";
$script['save'][] = self::_t(6) . ");";
$script['save'][] = self::_t(6) . "";
$script['save'][] = self::_t(6) .
"\$query->update(\$db->quoteName('#__[[[-#-#-component]]]_'.\$table))->set(\$fields)->where(\$conditions);";
$script['save'][] = self::_t(6) .
"\$db->setQuery(\$query);";
$script['save'][] = self::_t(6) .
"\$db->execute();";
$script['save'][] = self::_t(5) . "}";
$script['save'][] = self::_t(5) . "elseif
(\$canCreate)";
$script['save'][] = self::_t(5) . "{";
$script['save'][] = self::_t(6) . "// insert item";
$script['save'][] = self::_t(6) . "\$query =
\$db->getQuery(true);";
$script['save'][] = self::_t(6) . "// reset all
buckets";
$script['save'][] = self::_t(6) . "\$columns" .
self::_t(1) . "= array();";
$script['save'][] = self::_t(6) . "\$values" .
self::_t(1) . "= array();";
$script['save'][] = self::_t(6) . "\$version" .
self::_t(1) . "= false;";
$script['save'][] = self::_t(6) . "// Insert columns.
Insert values.";
$script['save'][] = self::_t(6) . "foreach(\$row as \$key
=> \$cell)";
$script['save'][] = self::_t(6) . "{";
$script['save'][] = self::_t(7) . "// ignore
column";
$script['save'][] = self::_t(7) . "if ('IGNORE'
== \$target[\$key])";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "continue;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "// remove id";
$script['save'][] = self::_t(7) . "if ('id' ==
\$target[\$key])";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "continue;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "// update
created";
$script['save'][] = self::_t(7) . "if
('created_by' == \$target[\$key])";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "continue;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "// update
created";
$script['save'][] = self::_t(7) . "if
('created' == \$target[\$key])";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "continue;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "// Make sure the alias
is incremented";
$script['save'][] = self::_t(7) . "if ('alias'
== \$target[\$key])";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "\$cell =
\$this->getAlias(\$cell,\$table);";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "// update
version";
$script['save'][] = self::_t(7) . "if
('version' == \$target[\$key])";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "\$cell = 1;";
$script['save'][] = self::_t(8) . "\$version =
true;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "// set to insert
array";
$script['save'][] = self::_t(7) . "if(in_array(\$key,
\$data['target_headers']) && is_numeric(\$cell))";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "\$columns[]" .
self::_t(1) . "= \$target[\$key];";
$script['save'][] = self::_t(8) . "\$values[]" .
self::_t(1) . "= \$cell;";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "elseif(in_array(\$key,
\$data['target_headers']) && is_string(\$cell))";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "\$columns[]" .
self::_t(1) . "= \$target[\$key];";
$script['save'][] = self::_t(8) . "\$values[]" .
self::_t(1) . "= \$db->quote(\$cell);";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(7) . "elseif(in_array(\$key,
\$data['target_headers']) && is_null(\$cell))";
$script['save'][] = self::_t(7) . "{";
$script['save'][] = self::_t(8) . "// if import data is
null then set empty";
$script['save'][] = self::_t(8) . "\$columns[]" .
self::_t(1) . "= \$target[\$key];";
$script['save'][] = self::_t(8) . "\$values[]" .
self::_t(1) . "= \"''\";";
$script['save'][] = self::_t(7) . "}";
$script['save'][] = self::_t(6) . "}";
$script['save'][] = self::_t(6) . "// load the
defaults";
$script['save'][] = self::_t(6) . "\$columns[]" .
self::_t(1) . "= 'created_by';";
$script['save'][] = self::_t(6) . "\$values[]" .
self::_t(1) . "= \$db->quote(\$user->id);";
$script['save'][] = self::_t(6) . "\$columns[]" .
self::_t(1) . "= 'created';";
$script['save'][] = self::_t(6) . "\$values[]" .
self::_t(1) . "= \$db->quote(\$todayDate);";
$script['save'][] = self::_t(6) . "if
(!\$version)";
$script['save'][] = self::_t(6) . "{";
$script['save'][] = self::_t(7) . "\$columns[]" .
self::_t(1) . "= 'version';";
$script['save'][] = self::_t(7) . "\$values[]" .
self::_t(1) . "= 1;";
$script['save'][] = self::_t(6) . "}";
$script['save'][] = self::_t(6) . "// Prepare the insert
query.";
$script['save'][] = self::_t(6) . "\$query";
$script['save'][] = self::_t(7) .
"->insert(\$db->quoteName('#__[[[-#-#-component]]]_'.\$table))";
$script['save'][] = self::_t(7) .
"->columns(\$db->quoteName(\$columns))";
$script['save'][] = self::_t(7) .
"->values(implode(',', \$values));";
$script['save'][] = self::_t(6) . "// Set the query using
our newly populated query object and execute it.";
$script['save'][] = self::_t(6) .
"\$db->setQuery(\$query);";
$script['save'][] = self::_t(6) . "\$done =
\$db->execute();";
$script['save'][] = self::_t(6) . "if (\$done)";
$script['save'][] = self::_t(6) . "{";
$script['save'][] = self::_t(7) . "\$aId =
\$db->insertid();";
$script['save'][] = self::_t(7) . "// make sure the
access of asset is set";
$script['save'][] = self::_t(7) .
"[[[-#-#-Component]]]Helper::setAsset(\$aId,\$table);";
$script['save'][] = self::_t(6) . "}";
$script['save'][] = self::_t(5) . "}";
$script['save'][] = self::_t(5) . "else";
$script['save'][] = self::_t(5) . "{";
$script['save'][] = self::_t(6) . "return false;";
$script['save'][] = self::_t(5) . "}";
$script['save'][] = self::_t(4) . "}";
$script['save'][] = self::_t(4) . "return true;";
$script['save'][] = self::_t(3) . "}";
$script['save'][] = self::_t(2) . "}";
$script['save'][] = self::_t(2) . "return false;";
$script['save'][] = self::_t(1) . "}";
}
elseif ('view' === $type)
{
$script['view'] = array();
$script['view'][] = "<script
type=\"text/javascript\">";
$script['view'][] = "<?php if (\$this->hasPackage
&&
Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$this->headerList))
: ?>";
$script['view'][] = self::_t(1) . "Joomla.continueImport
= function()";
$script['view'][] = self::_t(1) . "{";
$script['view'][] = self::_t(2) . "var form =
document.getElementById('adminForm');";
$script['view'][] = self::_t(2) . "var error =
false;";
$script['view'][] = self::_t(2) . "var therequired =
[<?php \$i = 0; foreach(\$this->headerList as \$name => \$title) {
echo (\$i != 0)? ',
\"vdm_'.\$name.'\"':'\"vdm_'.\$name.'\"';
\$i++; } ?>];";
$script['view'][] = self::_t(2) . "for(i = 0; i <
therequired.length; i++)";
$script['view'][] = self::_t(2) . "{";
$script['view'][] = self::_t(3) .
"if(jQuery('#'+therequired[i]).val() == \"\"
)";
$script['view'][] = self::_t(3) . "{";
$script['view'][] = self::_t(4) . "error = true;";
$script['view'][] = self::_t(4) . "break;";
$script['view'][] = self::_t(3) . "}";
$script['view'][] = self::_t(2) . "}";
$script['view'][] = self::_t(2) . "// do field
validation";
$script['view'][] = self::_t(2) . "if (error)";
$script['view'][] = self::_t(2) . "{";
$script['view'][] = self::_t(3) . "alert(\"<?php
echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS',
true); ?>\");";
$script['view'][] = self::_t(2) . "}";
$script['view'][] = self::_t(2) . "else";
$script['view'][] = self::_t(2) . "{";
$script['view'][] = self::_t(3) .
"jQuery('#loading').css('display',
'block');";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(3) .
"form.gettype.value = 'continue';";
$script['view'][] = self::_t(3) . "form.submit();";
$script['view'][] = self::_t(2) . "}";
$script['view'][] = self::_t(1) . "};";
$script['view'][] = "<?php else: ?>";
$script['view'][] = self::_t(1) . "Joomla.submitbutton =
function()";
$script['view'][] = self::_t(1) . "{";
$script['view'][] = self::_t(2) . "var form =
document.getElementById('adminForm');";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(2) . "// do field
validation";
$script['view'][] = self::_t(2) . "if
(form.import_package.value == \"\")";
$script['view'][] = self::_t(2) . "{";
$script['view'][] = self::_t(3) . "alert(\"<?php
echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_MSG_PLEASE_SELECT_A_FILE',
true); ?>\");";
$script['view'][] = self::_t(2) . "}";
$script['view'][] = self::_t(2) . "else";
$script['view'][] = self::_t(2) . "{";
$script['view'][] = self::_t(3) .
"jQuery('#loading').css('display',
'block');";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(3) .
"form.gettype.value = 'upload';";
$script['view'][] = self::_t(3) . "form.submit();";
$script['view'][] = self::_t(2) . "}";
$script['view'][] = self::_t(1) . "};";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(1) .
"Joomla.submitbutton3 = function()";
$script['view'][] = self::_t(1) . "{";
$script['view'][] = self::_t(2) . "var form =
document.getElementById('adminForm');";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(2) . "// do field
validation";
$script['view'][] = self::_t(2) . "if
(form.import_directory.value == \"\"){";
$script['view'][] = self::_t(3) . "alert(\"<?php
echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY',
true); ?>\");";
$script['view'][] = self::_t(2) . "}";
$script['view'][] = self::_t(2) . "else";
$script['view'][] = self::_t(2) . "{";
$script['view'][] = self::_t(3) .
"jQuery('#loading').css('display',
'block');";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(3) .
"form.gettype.value = 'folder';";
$script['view'][] = self::_t(3) . "form.submit();";
$script['view'][] = self::_t(2) . "}";
$script['view'][] = self::_t(1) . "};";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(1) .
"Joomla.submitbutton4 = function()";
$script['view'][] = self::_t(1) . "{";
$script['view'][] = self::_t(2) . "var form =
document.getElementById('adminForm');";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(2) . "// do field
validation";
$script['view'][] = self::_t(2) . "if
(form.import_url.value == \"\" || form.import_url.value ==
\"http://\")";
$script['view'][] = self::_t(2) . "{";
$script['view'][] = self::_t(3) . "alert(\"<?php
echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_MSG_ENTER_A_URL',
true); ?>\");";
$script['view'][] = self::_t(2) . "}";
$script['view'][] = self::_t(2) . "else";
$script['view'][] = self::_t(2) . "{";
$script['view'][] = self::_t(3) .
"jQuery('#loading').css('display',
'block');";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(3) .
"form.gettype.value = 'url';";
$script['view'][] = self::_t(3) . "form.submit();";
$script['view'][] = self::_t(2) . "}";
$script['view'][] = self::_t(1) . "};";
$script['view'][] = "<?php endif; ?>";
$script['view'][] = "";
$script['view'][] = PHP_EOL . "// Add spindle-wheel for
importations:";
$script['view'][] = "jQuery(document).ready(function(\$)
{";
$script['view'][] = self::_t(1) . "var outerDiv =
\$('body');";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(1) .
"\$('<div
id=\"loading\"></div>')";
$script['view'][] = self::_t(2) .
".css(\"background\", \"rgba(255, 255, 255, .8)
url('components/com_[[[-#-#-component]]]/assets/images/import.gif')
50% 15% no-repeat\")";
$script['view'][] = self::_t(2) .
".css(\"top\", outerDiv.position().top -
\$(window).scrollTop())";
$script['view'][] = self::_t(2) .
".css(\"left\", outerDiv.position().left -
\$(window).scrollLeft())";
$script['view'][] = self::_t(2) .
".css(\"width\", outerDiv.width())";
$script['view'][] = self::_t(2) .
".css(\"height\", outerDiv.height())";
$script['view'][] = self::_t(2) .
".css(\"position\", \"fixed\")";
$script['view'][] = self::_t(2) .
".css(\"opacity\", \"0.80\")";
$script['view'][] = self::_t(2) .
".css(\"-ms-filter\",
\"progid:DXImageTransform.Microsoft.Alpha(Opacity =
80)\")";
$script['view'][] = self::_t(2) .
".css(\"filter\", \"alpha(opacity = 80)\")";
$script['view'][] = self::_t(2) .
".css(\"display\", \"none\")";
$script['view'][] = self::_t(2) .
".appendTo(outerDiv);";
$script['view'][] = "});";
$script['view'][] = "";
$script['view'][] = PHP_EOL . "</script>";
$script['view'][] = "";
$script['view'][] = PHP_EOL . "<div
id=\"installer-import\" class=\"clearfix\">";
$script['view'][] = "<form
enctype=\"multipart/form-data\" action=\"<?php echo
Route::_('index.php?option=com_[[[-#-#-component]]]&view=import_[[[-#-#-views]]]');?>\"
method=\"post\" name=\"adminForm\"
id=\"adminForm\" class=\"form-horizontal
form-validate\">";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(1) . "<?php if
(!empty( \$this->sidebar)) : ?>";
$script['view'][] = self::_t(2) . "<div
id=\"j-sidebar-container\" class=\"span2\">";
$script['view'][] = self::_t(3) . "<?php echo
\$this->sidebar; ?>";
$script['view'][] = self::_t(2) . "</div>";
$script['view'][] = self::_t(2) . "<div
id=\"j-main-container\" class=\"span10\">";
$script['view'][] = self::_t(1) . "<?php else :
?>";
$script['view'][] = self::_t(2) . "<div
id=\"j-main-container\">";
$script['view'][] = self::_t(1) . "<?php
endif;?>";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(1) . "<?php if
(\$this->hasPackage &&
Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$this->headerList)
&&
Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$this->headers))
: ?>";
$script['view'][] = self::_t(2) . "<fieldset
class=\"uploadform\">";
$script['view'][] = self::_t(3) . "<legend><?php
echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_LINK_FILE_TO_TABLE_COLUMNS');
?></legend>";
$script['view'][] = self::_t(3) . "<div
class=\"control-group\">";
$script['view'][] = self::_t(4) . "<label
class=\"control-label\" ><h4><?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_TABLE_COLUMNS');
?></h4></label>";
$script['view'][] = self::_t(4) . "<div
class=\"controls\">";
$script['view'][] = self::_t(5) . "<label
class=\"control-label\" ><h4><?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_FILE_COLUMNS');
?></h4></label>";
$script['view'][] = self::_t(4) . "</div>";
$script['view'][] = self::_t(3) . "</div>";
$script['view'][] = self::_t(3) . "<?php
foreach(\$this->headerList as \$name => \$title): ?>";
$script['view'][] = self::_t(4) . "<div
class=\"control-group\">";
$script['view'][] = self::_t(5) . "<label
for=\"<?php echo \$name; ?>\"
class=\"control-label\" ><?php echo \$title;
?></label>";
$script['view'][] = self::_t(5) . "<div
class=\"controls\">";
$script['view'][] = self::_t(6) . "<select
name=\"<?php echo \$name; ?>\" id=\"vdm_<?php echo
\$name; ?>\" required class=\"required input_box\"
>";
$script['view'][] = self::_t(7) . "<option
value=\"\"><?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_PLEASE_SELECT_COLUMN');
?></option>";
$script['view'][] = self::_t(7) . "<option
value=\"IGNORE\"><?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_IGNORE_COLUMN');
?></option>";
$script['view'][] = self::_t(7) . "<?php
foreach(\$this->headers as \$value => \$option): ?>";
$script['view'][] = self::_t(8) . "<?php \$selected =
(strtolower(\$option) == strtolower (\$title) || strtolower(\$option) ==
strtolower(\$name))?
'selected=\"selected\"':''; ?>";
$script['view'][] = self::_t(8) . "<option
value=\"<?php echo [[[-#-#-Component]]]Helper::htmlEscape(\$value);
?>\" class=\"required\" <?php echo \$selected
?>><?php echo [[[-#-#-Component]]]Helper::htmlEscape(\$option);
?></option>";
$script['view'][] = self::_t(7) . "<?php endforeach;
?>";
$script['view'][] = self::_t(6) .
"</select>";
$script['view'][] = self::_t(5) . "</div>";
$script['view'][] = self::_t(4) . "</div>";
$script['view'][] = self::_t(3) . "<?php endforeach;
?>";
$script['view'][] = self::_t(3) . "<div
class=\"form-actions\">";
$script['view'][] = self::_t(4) . "<input
class=\"btn btn-primary\" type=\"button\"
value=\"<?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_CONTINUE');
?>\" onclick=\"Joomla.continueImport()\" />";
$script['view'][] = self::_t(3) . "</div>";
$script['view'][] = self::_t(2) .
"</fieldset>";
$script['view'][] = self::_t(2) . "<input
type=\"hidden\" name=\"gettype\"
value=\"continue\" />";
$script['view'][] = self::_t(1) . "<?php else:
?>";
$script['view'][] = self::_t(2) . "<?php echo
Html::_('bootstrap.startTabSet', 'myTab',
array('active' => 'upload')); ?>";
$script['view'][] = self::_t(2) . "";
$script['view'][] = self::_t(2) . "<?php echo
Html::_('bootstrap.addTab', 'myTab',
'upload',
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_FROM_UPLOAD',
true)); ?>";
$script['view'][] = self::_t(3) . "<fieldset
class=\"uploadform\">";
$script['view'][] = self::_t(4) . "<legend><?php
echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_UPDATE_DATA');
?></legend>";
$script['view'][] = self::_t(4) . "<div
class=\"control-group\">";
$script['view'][] = self::_t(5) . "<label
for=\"import_package\"
class=\"control-label\"><?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_SELECT_FILE');
?></label>";
$script['view'][] = self::_t(5) . "<div
class=\"controls\">";
$script['view'][] = self::_t(6) . "<input
class=\"input_box\" id=\"import_package\"
name=\"import_package\" type=\"file\"
size=\"57\" />";
$script['view'][] = self::_t(5) . "</div>";
$script['view'][] = self::_t(4) . "</div>";
$script['view'][] = self::_t(4) . "<div
class=\"form-actions\">";
$script['view'][] = self::_t(5) . "<input
class=\"btn btn-primary\" type=\"button\"
value=\"<?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_UPLOAD_BOTTON');
?>\" onclick=\"Joomla.submitbutton()\"
/> <small><?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_FORMATS_ACCEPTED');
?> (.csv .xls .ods)</small>";
$script['view'][] = self::_t(4) . "</div>";
$script['view'][] = self::_t(3) .
"</fieldset>";
$script['view'][] = self::_t(2) . "<?php echo
Html::_('bootstrap.endTab'); ?>";
$script['view'][] = self::_t(2) . "";
$script['view'][] = self::_t(2) . "<?php echo
Html::_('bootstrap.addTab', 'myTab',
'directory',
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_FROM_DIRECTORY',
true)); ?>";
$script['view'][] = self::_t(3) . "<fieldset
class=\"uploadform\">";
$script['view'][] = self::_t(4) . "<legend><?php
echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_UPDATE_DATA');
?></legend>";
$script['view'][] = self::_t(4) . "<div
class=\"control-group\">";
$script['view'][] = self::_t(5) . "<label
for=\"import_directory\"
class=\"control-label\"><?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_SELECT_FILE_DIRECTORY');
?></label>";
$script['view'][] = self::_t(5) . "<div
class=\"controls\">";
$script['view'][] = self::_t(6) . "<input
type=\"text\" id=\"import_directory\"
name=\"import_directory\" class=\"span5 input_box\"
size=\"70\" value=\"<?php echo
\$this->state->get('import.directory'); ?>\"
/>";
$script['view'][] = self::_t(5) . "</div>";
$script['view'][] = self::_t(4) . "</div>";
$script['view'][] = self::_t(4) . "<div
class=\"form-actions\">";
$script['view'][] = self::_t(5) . "<input
type=\"button\" class=\"btn btn-primary\"
value=\"<?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_GET_BOTTON');
?>\" onclick=\"Joomla.submitbutton3()\"
/> <small><?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_FORMATS_ACCEPTED');
?> (.csv .xls .ods)</small>";
$script['view'][] = self::_t(4) . "</div>";
$script['view'][] = self::_t(4) .
"</fieldset>";
$script['view'][] = self::_t(2) . "<?php echo
Html::_('bootstrap.endTab'); ?>";
$script['view'][] = "";
$script['view'][] = PHP_EOL . self::_t(2) . "<?php
echo Html::_('bootstrap.addTab', 'myTab',
'url',
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_FROM_URL', true));
?>";
$script['view'][] = self::_t(3) . "<fieldset
class=\"uploadform\">";
$script['view'][] = self::_t(4) . "<legend><?php
echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_UPDATE_DATA');
?></legend>";
$script['view'][] = self::_t(4) . "<div
class=\"control-group\">";
$script['view'][] = self::_t(5) . "<label
for=\"import_url\" class=\"control-label\"><?php
echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_SELECT_FILE_URL');
?></label>";
$script['view'][] = self::_t(5) . "<div
class=\"controls\">";
$script['view'][] = self::_t(6) . "<input
type=\"text\" id=\"import_url\"
name=\"import_url\" class=\"span5 input_box\"
size=\"70\" value=\"http://\" />";
$script['view'][] = self::_t(5) . "</div>";
$script['view'][] = self::_t(4) . "</div>";
$script['view'][] = self::_t(4) . "<div
class=\"form-actions\">";
$script['view'][] = self::_t(5) . "<input
type=\"button\" class=\"btn btn-primary\"
value=\"<?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_GET_BOTTON');
?>\" onclick=\"Joomla.submitbutton4()\"
/> <small><?php echo
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_FORMATS_ACCEPTED');
?> (.csv .xls .ods)</small>";
$script['view'][] = self::_t(4) . "</div>";
$script['view'][] = self::_t(3) .
"</fieldset>";
$script['view'][] = self::_t(2) . "<?php echo
Html::_('bootstrap.endTab'); ?>";
$script['view'][] = self::_t(2) . "<?php echo
Html::_('bootstrap.endTabSet'); ?>";
$script['view'][] = self::_t(2) . "<input
type=\"hidden\" name=\"gettype\"
value=\"upload\" />";
$script['view'][] = self::_t(1) . "<?php endif;
?>";
$script['view'][] = self::_t(1) . "<input
type=\"hidden\" name=\"task\"
value=\"import_[[[-#-#-views]]].import\" />";
$script['view'][] = self::_t(1) . "<?php echo
Html::_('form.token'); ?>";
$script['view'][] = "</form>";
$script['view'][] = "</div>";
}
elseif ('import' === $type)
{
$script['import'] = array();
$script['import'][] = self::_t(1) . "/**";
$script['import'][] = self::_t(1) . " * Import an
spreadsheet from either folder, url or upload.";
$script['import'][] = self::_t(1) . " *";
$script['import'][] = self::_t(1) . " * @return boolean
result of import";
$script['import'][] = self::_t(1) . " *";
$script['import'][] = self::_t(1) . " */";
$script['import'][] = self::_t(1) . "public function
import()";
$script['import'][] = self::_t(1) . "{";
$script['import'][] = self::_t(2) .
"\$this->setState('action', 'import');";
$script['import'][] = self::_t(2) . "\$app" .
self::_t(2) . "= Factory::getApplication();";
$script['import'][] = self::_t(2) . "\$session" .
self::_t(1) . "= Factory::getSession();";
$script['import'][] = self::_t(2) . "\$package" .
self::_t(1) . "= null;";
$script['import'][] = self::_t(2) . "\$continue" .
self::_t(1) . "= false;";
$script['import'][] = self::_t(2) . "// get import
type";
$script['import'][] = self::_t(2) . "\$this->getType =
\$app->input->getString('gettype', NULL);";
$script['import'][] = self::_t(2) . "// get import
type";
$script['import'][] = self::_t(2) .
"\$this->dataType" . self::_t(1) . "=
\$session->get('dataType_VDM_IMPORTINTO', NULL);";
$script['import'][] = PHP_EOL . self::_t(2) . "if
(\$package === null)";
$script['import'][] = self::_t(2) . "{";
$script['import'][] = self::_t(3) . "switch
(\$this->getType)";
$script['import'][] = self::_t(3) . "{";
$script['import'][] = self::_t(4) . "case
'folder':";
$script['import'][] = self::_t(5) . "// Remember the
'Import from Directory' path.";
$script['import'][] = self::_t(5) .
"\$app->getUserStateFromRequest(\$this->_context .
'.import_directory', 'import_directory');";
$script['import'][] = self::_t(5) . "\$package =
\$this->_getPackageFromFolder();";
$script['import'][] = self::_t(5) . "break;";
$script['import'][] = PHP_EOL . self::_t(4) . "case
'upload':";
$script['import'][] = self::_t(5) . "\$package =
\$this->_getPackageFromUpload();";
$script['import'][] = self::_t(5) . "break;";
$script['import'][] = PHP_EOL . self::_t(4) . "case
'url':";
$script['import'][] = self::_t(5) . "\$package =
\$this->_getPackageFromUrl();";
$script['import'][] = self::_t(5) . "break;";
$script['import'][] = PHP_EOL . self::_t(4) . "case
'continue':";
$script['import'][] = self::_t(5) . "\$continue" .
self::_t(1) . "= true;";
$script['import'][] = self::_t(5) . "\$package" .
self::_t(1) . "= \$session->get('package', null);";
$script['import'][] = self::_t(5) . "\$package" .
self::_t(1) . "= json_decode(\$package, true);";
$script['import'][] = self::_t(5) . "// clear
session";
$script['import'][] = self::_t(5) .
"\$session->clear('package');";
$script['import'][] = self::_t(5) .
"\$session->clear('dataType');";
$script['import'][] = self::_t(5) .
"\$session->clear('hasPackage');";
$script['import'][] = self::_t(5) . "break;";
$script['import'][] = PHP_EOL . self::_t(4) .
"default:";
$script['import'][] = self::_t(5) .
"\$app->setUserState('com_[[[-#-#-component]]].message',
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_NO_IMPORT_TYPE_FOUND'));";
$script['import'][] = PHP_EOL . self::_t(5) . "return
false;";
$script['import'][] = self::_t(5) . "break;";
$script['import'][] = self::_t(3) . "}";
$script['import'][] = self::_t(2) . "}";
$script['import'][] = self::_t(2) . "// Was the package
valid?";
$script['import'][] = self::_t(2) . "if (!\$package ||
!\$package['type'])";
$script['import'][] = self::_t(2) . "{";
$script['import'][] = self::_t(3) . "if
(in_array(\$this->getType, array('upload',
'url')))";
$script['import'][] = self::_t(3) . "{";
$script['import'][] = self::_t(4) .
"\$this->remove(\$package['packagename']);";
$script['import'][] = self::_t(3) . "}";
$script['import'][] = PHP_EOL . self::_t(3) .
"\$app->setUserState('com_[[[-#-#-component]]].message',
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE'));";
$script['import'][] = self::_t(3) . "return
false;";
$script['import'][] = self::_t(2) . "}";
$script['import'][] = self::_t(2) . "";
$script['import'][] = self::_t(2) . "// first link data
to table headers";
$script['import'][] = self::_t(2) .
"if(!\$continue){";
$script['import'][] = self::_t(3) . "\$package" .
self::_t(1) . "= json_encode(\$package);";
$script['import'][] = self::_t(3) .
"\$session->set('package', \$package);";
$script['import'][] = self::_t(3) .
"\$session->set('dataType', \$this->dataType);";
$script['import'][] = self::_t(3) .
"\$session->set('hasPackage', true);";
$script['import'][] = self::_t(3) . "return true;";
$script['import'][] = self::_t(2) . "}";
$script['import'][] = self::_t(2) . "// set the
data";
$script['import'][] = self::_t(2) . "\$headerList =
json_decode(\$session->get(\$this->dataType.'_VDM_IMPORTHEADERS',
false), true);";
$script['import'][] = self::_t(2) . "if
(!\$this->setData(\$package,\$this->dataType,\$headerList))";
$script['import'][] = self::_t(2) . "{";
$script['import'][] = self::_t(3) . "// There was an
error importing the package";
$script['import'][] = self::_t(3) . "\$msg =
JTe-#-#-xt::_('COM_[[[-#-#-COMPONENT]]]_IMPORT_ERROR');";
$script['import'][] = self::_t(3) . "\$back =
\$session->get('backto_VDM_IMPORT', NULL);";
$script['import'][] = self::_t(3) . "if (\$back)";
$script['import'][] = self::_t(3) . "{";
$script['import'][] = self::_t(4) .
"\$app->setUserState('com_[[[-#-#-component]]].redirect_url',
'index.php?option=com_[[[-#-#-component]]]&view='.\$back);";
$script['import'][] = self::_t(4) .
"\$session->clear('backto_VDM_IMPORT');";
$script['import'][] = self::_t(3) . "}";
$script['import'][] = self::_t(3) . "\$result =
false;";
$script['import'][] = self::_t(2) . "}";
$script['import'][] = self::_t(2) . "else";
$script['import'][] = self::_t(2) . "{";
$script['import'][] = self::_t(3) . "// Package imported
sucessfully";
$script['import'][] = self::_t(3) . "\$msg =
JTe-#-#-xt::sprintf('COM_[[[-#-#-COMPONENT]]]_IMPORT_SUCCESS',
\$package['packagename']);";
$script['import'][] = self::_t(3) . "\$back =
\$session->get('backto_VDM_IMPORT', NULL);";
$script['import'][] = self::_t(3) . "if (\$back)";
$script['import'][] = self::_t(3) . "{";
$script['import'][] = self::_t(4) .
"\$app->setUserState('com_[[[-#-#-component]]].redirect_url',
'index.php?option=com_[[[-#-#-component]]]&view='.\$back);";
$script['import'][] = self::_t(4) .
"\$session->clear('backto_VDM_IMPORT');";
$script['import'][] = self::_t(3) . "}";
$script['import'][] = self::_t(3) . "\$result =
true;";
$script['import'][] = self::_t(2) . "}";
$script['import'][] = PHP_EOL . self::_t(2) . "// Set
some model state values";
$script['import'][] = self::_t(2) .
"\$app->enqueueMessage(\$msg);";
$script['import'][] = PHP_EOL . self::_t(2) . "// remove
file after import";
$script['import'][] = self::_t(2) .
"\$this->remove(\$package['packagename']);";
$script['import'][] = self::_t(2) .
"\$session->clear(\$this->getType.'_VDM_IMPORTHEADERS');";
$script['import'][] = self::_t(2) . "return
\$result;";
$script['import'][] = self::_t(1) . "}";
}
elseif ('ext' === $type)
{
$script['ext'][] = self::_t(1) . "/**";
$script['ext'][] = self::_t(1) . " * Check the
extension";
$script['ext'][] = self::_t(1) . " *";
$script['ext'][] = self::_t(1) . " * @param string
\$file Name of the uploaded file";
$script['ext'][] = self::_t(1) . " *";
$script['ext'][] = self::_t(1) . " * @return boolean
True on success";
$script['ext'][] = self::_t(1) . " *";
$script['ext'][] = self::_t(1) . " */";
$script['ext'][] = self::_t(1) . "protected function
checkExtension(\$file)";
$script['ext'][] = self::_t(1) . "{";
$script['ext'][] = self::_t(2) . "// check the
extention";
$script['ext'][] = self::_t(2) .
"switch(strtolower(pathinfo(\$file, PATHINFO_EXTENSION)))";
$script['ext'][] = self::_t(2) . "{";
$script['ext'][] = self::_t(3) . "case
'xls':";
$script['ext'][] = self::_t(3) . "case
'ods':";
$script['ext'][] = self::_t(3) . "case
'csv':";
$script['ext'][] = self::_t(3) . "return true;";
$script['ext'][] = self::_t(3) . "break;";
$script['ext'][] = self::_t(2) . "}";
$script['ext'][] = self::_t(2) . "return false;";
$script['ext'][] = self::_t(1) . "}";
}
elseif ('routerparse' === $type)
{
$script['routerparse'][] = self::_t(4) . "// default
script in switch for this view";
$script['routerparse'][] = self::_t(4) .
"\$vars['view'] = '[[[-#-#-sview]]]';";
$script['routerparse'][] = self::_t(4) . "if
(is_numeric(\$segments[\$count-1]))";
$script['routerparse'][] = self::_t(4) . "{";
$script['routerparse'][] = self::_t(5) .
"\$vars['id'] = (int) \$segments[\$count-1];";
$script['routerparse'][] = self::_t(4) . "}";
$script['routerparse'][] = self::_t(4) . "elseif
(\$segments[\$count-1])";
$script['routerparse'][] = self::_t(4) . "{";
$script['routerparse'][] = self::_t(5) . "\$id =
\$this->getVar('[[[-#-#-sview]]]', \$segments[\$count-1],
'alias', 'id');";
$script['routerparse'][] = self::_t(5) .
"if(\$id)";
$script['routerparse'][] = self::_t(5) . "{";
$script['routerparse'][] = self::_t(6) .
"\$vars['id'] = \$id;";
$script['routerparse'][] = self::_t(5) . "}";
$script['routerparse'][] = self::_t(4) . "}";
}
// return the needed script
if (isset($script[$type]))
{
return str_replace('-#-#-', '', implode(PHP_EOL,
$script[$type]));
}
return false;
}
/**
* Field Grouping https://docs.joomla.org/Form_field
* @deprecated 3.3
**/
protected static $fieldGroups = array(
'default' => array(
'accesslevel', 'cachehandler', 'calendar',
'captcha', 'category', 'checkbox',
'checkboxes', 'chromestyle',
'color', 'combo', 'componentlayout',
'contentlanguage', 'contenttype',
'databaseconnection', 'components',
'editor', 'editors', 'email',
'file', 'file', 'filelist',
'folderlist', 'groupedlist', 'headertag',
'helpsite', 'hidden', 'imagelist',
'integer', 'language', 'list',
'media', 'menu', 'modal_menu',
'menuitem', 'meter', 'modulelayout',
'moduleorder', 'moduleposition',
'moduletag', 'note', 'number',
'password', 'plugins', 'predefinedlist',
'radio', 'range', 'repeatable',
'rules',
'sessionhandler', 'spacer', 'sql',
'subform', 'tag', 'tel',
'templatestyle', 'text', 'textarea',
'timezone', 'url', 'user',
'usergroup'
),
'plain' => array(
'cachehandler', 'calendar', 'checkbox',
'chromestyle', 'color', 'componentlayout',
'contenttype', 'editor', 'editors',
'captcha',
'email', 'file', 'headertag',
'helpsite', 'hidden', 'integer',
'language', 'media', 'menu',
'modal_menu', 'menuitem', 'meter',
'modulelayout', 'templatestyle',
'moduleorder', 'moduletag', 'number',
'password', 'range', 'rules',
'tag', 'tel', 'text', 'textarea',
'timezone', 'url', 'user',
'usergroup'
),
'option' => array(
'accesslevel', 'category', 'checkboxes',
'combo', 'contentlanguage',
'databaseconnection', 'components',
'filelist', 'folderlist', 'imagelist',
'list', 'plugins', 'predefinedlist',
'radio', 'sessionhandler', 'sql',
'groupedlist'
),
'text' => array(
'calendar', 'color', 'editor',
'email', 'number', 'password',
'range', 'tel', 'text', 'textarea',
'url'
),
'list' => array(
'checkbox', 'checkboxes', 'list',
'radio', 'groupedlist', 'combo'
),
'dynamic' => array(
'category', 'file', 'filelist',
'folderlist', 'headertag', 'imagelist',
'integer', 'media', 'meter',
'rules', 'tag', 'timezone', 'user'
),
'spacer' => array(
'note', 'spacer'
),
'special' => array(
'contentlanguage', 'moduleposition',
'plugin', 'repeatable', 'subform'
),
'search' => array(
'editor', 'email', 'tel',
'text', 'textarea', 'url',
'subform'
)
);
/**
* Field Checker
*
* @param string $type The field type
* @param boolean $option The field grouping
*
* @return boolean if the field was found
* @deprecated 3.3 Use
CompilerFactory::_('Field.Groups')->check($type, $option);
*/
public static function fieldCheck($type, $option = 'default')
{
return CompilerFactory::_('Field.Groups')->check($type,
$option);
}
/**
* get the field types id -> name of a group or groups
*
* @return array ids of the spacer field types
* @deprecated 3.3 Use
CompilerFactory::_('Field.Groups')->types($groups);
*/
public static function getFieldTypesByGroup($groups = array())
{
return CompilerFactory::_('Field.Groups')->types($groups);
}
/**
* get the field types IDs of a group or groups
*
* @return array ids of the spacer field types
* @deprecated 3.3 Use
CompilerFactory::_('Field.Groups')->typesIds($groups);
*/
public static function getFieldTypesIdsByGroup($groups = array())
{
return
CompilerFactory::_('Field.Groups')->typesIds($groups);
}
/**
* get the spacer IDs
*
* @return array ids of the spacer field types
* @deprecated 3.3 Use
CompilerFactory::_('Field.Groups')->spacerIds();
*/
public static function getSpacerIds()
{
return CompilerFactory::_('Field.Groups')->spacerIds();
}
/**
* open base64 string if stored as base64
*
* @param string $data The base64 string
* @param string $key We store the string with that suffix :)
* @param string $default The default switch
*
* @return string The opened string
* @deprecated 3.3 Use Base64Helper::open($data, $key, $default);
*/
public static function openValidBase64($data, $key =
'__.o0=base64=Oo.__', $default = 'string')
{
return Base64Helper::open($data, $key, $default);
}
/**
* prepare base64 string for url
*
* @deprecate Use urlencode();
*/
public static function base64_urlencode($string, $encode = false)
{
if ($encode)
{
$string = base64_encode($string);
}
return str_replace(array('+', '/'),
array('-', '_'), $string);
}
/**
* prepare base64 string form url
*
* @deprecate
*/
public static function base64_urldecode($string, $decode = false)
{
$string = str_replace(array('-', '_'),
array('+', '/'), $string);
if ($decode)
{
$string = base64_decode($string);
}
return $string;
}
/**
* Get the file path or url
*
* @param string $type The (url/path) type to return
* @param string $target The Params Target name (if set)
* @param string $default The default path if not set in
Params (fallback path)
* @param bool $createIfNotSet The switch to create the folder if
not found
*
* @return string On success the path or url is returned based on the
type requested
*
*/
public static function getFolderPath($type = 'path', $target =
'folderpath', $default = '', $createIfNotSet = true)
{
// make sure to always have a string/path
if(!UtilitiesStringHelper::check($default))
{
$default = JPATH_SITE . '/images/';
}
// get the global settings
if (!ObjectHelper::check(self::$params))
{
self::$params =
ComponentHelper::getParams('com_componentbuilder');
}
$folderPath = self::$params->get($target, $default);
// create the folder if it does not exist
if ($createIfNotSet && !Folder::exists($folderPath))
{
Folder::create($folderPath);
}
// return the url
if ('url' === $type)
{
if (strpos($folderPath, JPATH_SITE) !== false)
{
$folderPath = trim( str_replace( JPATH_SITE, '',
$folderPath), '/');
return Uri::root() . $folderPath . '/';
}
// since the path is behind the root folder of the site, return only the
root url (may be used to build the link)
return Uri::root();
}
// sanitize the path
return '/' . trim( $folderPath, '/' ) .
'/';
}
/**
* the Crypt objects
**/
protected static $CRYPT = array();
/**
* the Cipher MODE switcher (list of ciphers)
**/
protected static $setCipherMode = array(
'AES' => true,
'Rijndael' => true,
'Twofish' => false, // can but not good idea
'Blowfish' => false, // can but not good idea
'RC4' => false, // nope
'RC2' => false, // can but not good idea
'TripleDES' => false, // can but not good idea
'DES' => true
);
/**
* get the Crypt object
*
* @return object on success with Crypt power
**/
public static function crypt($type, $mode = null)
{
// set key based on mode
if ($mode)
{
$key = $type . $mode;
}
else
{
$key = $type;
}
// check if it was already set
if (isset(self::$CRYPT[$key]) &&
ObjectHelper::check(self::$CRYPT[$key]))
{
return self::$CRYPT[$key];
}
// make sure we have the composer classes loaded
self::composerAutoload('phpseclib');
// build class name
$CLASS = '\phpseclib\Crypt\\' . $type;
// make sure we have the phpseclib classes
if (!class_exists($CLASS))
{
// class not in place so send out error
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESPHPSECLIBVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO',
$CLASS), 'Error');
return false;
}
// does this crypt class use mode
if ($mode && isset(self::$setCipherMode[$type]) &&
self::$setCipherMode[$type])
{
switch ($mode)
{
case 'CTR':
self::$CRYPT[$key] = new $CLASS('ctr');
break;
case 'ECB':
self::$CRYPT[$key] = new $CLASS('ecb');
break;
case 'CBC':
self::$CRYPT[$key] = new $CLASS('cbc');
break;
case 'CBC3':
self::$CRYPT[$key] = new $CLASS('cbc3');
break;
case 'CFB':
self::$CRYPT[$key] = new $CLASS('cfb');
break;
case 'CFB8':
self::$CRYPT[$key] = new $CLASS('cfb8');
break;
case 'OFB':
self::$CRYPT[$key] = new $CLASS('ofb');
break;
case 'GCM':
self::$CRYPT[$key] = new $CLASS('gcm');
break;
case 'STREAM':
self::$CRYPT[$key] = new $CLASS('stream');
break;
default:
// No valid mode has been specified
Factory::getApplication()->enqueueMessage(Text::_('COM_COMPONENTBUILDER_NO_VALID_MODE_HAS_BEEN_SPECIFIED'),
'Error');
return false;
break;
}
}
else
{
// set the default
self::$CRYPT[$key] = new $CLASS();
}
// return the object
return self::$CRYPT[$key];
}
/**
* Move File to Server
*
* @param string $localPath The local path to the file
* @param string $fileName The the actual file name
* @param int $serverID The server local id to use
* @param int $protocol The server protocol to use
* @param string $permission The permission validation area
*
* @return bool true on success
**/
public static function moveToServer($localPath, $fileName, $serverID,
$protocol = null, $permission = 'core.export')
{
// get the server
if ($server = self::getServer( (int) $serverID, $protocol, $permission))
{
// use the FTP protocol
if (1 == $server->jcb_protocol)
{
// now move the file
if (!$server->store($localPath, $fileName))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER',
$fileName, $server->jcb_remote_server_name[(int) $serverID]),
'Error');
return false;
}
// close the connection
$server->quit();
}
// use the SFTP protocol
elseif (2 == $server->jcb_protocol)
{
// get the remote path
$remote_path = '/' .
trim($server->jcb_remote_server_path[(int) $serverID], '/') .
'/' . $fileName;
// now move the file
if (!$server->put($remote_path, FileHelper::getContent($localPath,
null)))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER',
$fileName, $server->jcb_remote_server_path[(int) $serverID],
$server->jcb_remote_server_name[(int) $serverID]), 'Error');
return false;
}
}
return true;
}
return false;
}
/**
* the SFTP objects
**/
protected static $sftp = array();
/**
* the FTP objects
**/
protected static $ftp = array();
/**
* get the server object
*
* @param int $serverID The server local id to use
* @param int $protocol The server protocol to use
* @param string $permission The permission validation area
*
* @return object on success server object
**/
public static function getServer($serverID, $protocol = null, $permission
= 'core.export')
{
// if not protocol is given get it (sad I know)
if (!$protocol)
{
$protocol = self::getVar('server', (int) $serverID,
'id', 'protocol');
}
// return the server object
switch ($protocol)
{
case 1: // FTP
return self::getFtp($serverID, $permission);
break;
case 2: // SFTP
return self::getSftp($serverID, $permission);
break;
}
return false;
}
/**
* get the sftp object
*
* @param int $serverID The server local id to use
* @param string $permission The permission validation area
*
* @return object on success with sftp power
**/
public static function getSftp($serverID, $permission =
'core.export')
{
// check if we have a server with that id
if ($server = self::getServerDetails($serverID, 2, $permission))
{
// check if it was already set
if (!isset(self::$sftp[$server->cache]) ||
!ObjectHelper::check(self::$sftp[$server->cache]))
{
// make sure we have the composer classes loaded
self::composerAutoload('phpseclib');
// make sure we have the phpseclib classes
if (!class_exists('\phpseclib\Net\SFTP'))
{
// class not in place so send out error
Factory::getApplication()->enqueueMessage(Text::_('COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO'),
'Error');
return false;
}
// insure the port is set
$server->port = (isset($server->port) &&
is_numeric($server->port) && $server->port > 0) ? (int)
$server->port : 22;
// open the connection
self::$sftp[$server->cache] = new
phpseclib\Net\SFTP($server->host, $server->port);
// heads-up on protocol
self::$sftp[$server->cache]->jcb_protocol = 2; // SFTP <-- if
called not knowing what type of protocol is being used
// now login based on authentication type
switch($server->authentication)
{
case 1: // password
if (!self::$sftp[$server->cache]->login($server->username,
$server->password))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT',
$server->name), 'Error');
unset(self::$sftp[$server->cache]);
return false;
}
break;
case 2: // private key file
if (ObjectHelper::check(self::crypt('RSA')))
{
// check if we have a passprase
if (UtilitiesStringHelper::check($server->secret))
{
self::crypt('RSA')->setPassword($server->secret);
}
// now load the key file
if
(!self::crypt('RSA')->loadKey(FileHelper::getContent($server->private,
null)))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER',
$server->name), 'Error');
unset(self::$sftp[$server->cache]);
return false;
}
// now login
if (!self::$sftp[$server->cache]->login($server->username,
self::crypt('RSA')))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT',
$server->name), 'Error');
unset(self::$sftp[$server->cache]);
return false;
}
}
break;
case 3: // both password and private key file
if (ObjectHelper::check(self::crypt('RSA')))
{
// check if we have a passphrase
if (UtilitiesStringHelper::check($server->secret))
{
self::crypt('RSA')->setPassword($server->secret);
}
// now load the key file
if
(!self::crypt('RSA')->loadKey(FileHelper::getContent($server->private,
null)))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER',
$server->name), 'Error');
unset(self::$sftp[$server->cache]);
return false;
}
// now login
if (!self::$sftp[$server->cache]->login($server->username,
$server->password, self::crypt('RSA')))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT',
$server->name), 'Error');
unset(self::$sftp[$server->cache]);
return false;
}
}
break;
case 4: // private key field
if (ObjectHelper::check(self::crypt('RSA')))
{
// check if we have a passprase
if (UtilitiesStringHelper::check($server->secret))
{
self::crypt('RSA')->setPassword($server->secret);
}
// now load the key field
if
(!self::crypt('RSA')->loadKey($server->private_key))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER',
$server->name), 'Error');
unset(self::$sftp[$server->cache]);
return false;
}
// now login
if (!self::$sftp[$server->cache]->login($server->username,
self::crypt('RSA')))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT',
$server->name), 'Error');
unset(self::$sftp[$server->cache]);
return false;
}
}
break;
case 5: // both password and private key field
if (ObjectHelper::check(self::crypt('RSA')))
{
// check if we have a passphrase
if (UtilitiesStringHelper::check($server->secret))
{
self::crypt('RSA')->setPassword($server->secret);
}
// now load the key file
if
(!self::crypt('RSA')->loadKey($server->private_key))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER',
$server->name), 'Error');
unset(self::$sftp[$server->cache]);
return false;
}
// now login
if (!self::$sftp[$server->cache]->login($server->username,
$server->password, self::crypt('RSA')))
{
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT',
$server->name), 'Error');
unset(self::$sftp[$server->cache]);
return false;
}
}
break;
}
}
// only continue if object is set
if (isset(self::$sftp[$server->cache]) &&
ObjectHelper::check(self::$sftp[$server->cache]))
{
// set the unique buckets
if (!isset(self::$sftp[$server->cache]->jcb_remote_server_name))
{
self::$sftp[$server->cache]->jcb_remote_server_name = array();
self::$sftp[$server->cache]->jcb_remote_server_path = array();
}
// always set the name and remote server path
self::$sftp[$server->cache]->jcb_remote_server_name[$serverID] =
$server->name;
self::$sftp[$server->cache]->jcb_remote_server_path[$serverID] =
(UtilitiesStringHelper::check($server->path) && $server->path
!== '/') ? $server->path : '';
// return the sftp object
return self::$sftp[$server->cache];
}
}
return false;
}
/**
* get the JClientFtp object
*
* @param int $serverID The server local id to use
* @param string $permission The permission validation area
*
* @return object on success with ftp power
**/
public static function getFtp($serverID, $permission)
{
// check if we have a server with that id
if ($server = self::getServerDetails($serverID, 1, $permission))
{
// check if we already have the server instance
if (isset(self::$ftp[$server->cache]) &&
self::$ftp[$server->cache] instanceof JClientFtp)
{
// always set the name and remote server path
self::$ftp[$server->cache]->jcb_remote_server_name[$serverID] =
$server->name;
// if still connected we are ready to go
if (self::$ftp[$server->cache]->isConnected())
{
// return the FTP instance
return self::$ftp[$server->cache];
}
// check if we can reinitialise the server
if (self::$ftp[$server->cache]->reinit())
{
// return the FTP instance
return self::$ftp[$server->cache];
}
}
// make sure we have a string and it is not default or empty
if (UtilitiesStringHelper::check($server->signature))
{
// turn into variables
parse_str($server->signature); // because of this I am using strange
variable naming to avoid any collisions.
// set options
if (isset($options) && UtilitiesArrayHelper::check($options))
{
foreach ($options as $o__p0t1on => $vAln3)
{
if ('timeout' === $o__p0t1on)
{
$options[$o__p0t1on] = (int) $vAln3;
}
if ('type' === $o__p0t1on)
{
$options[$o__p0t1on] = (string) $vAln3;
}
}
}
else
{
$options = array();
}
// get ftp object
if (isset($host) && $host != 'HOSTNAME' &&
isset($port) && $port != 'PORT_INT' &&
isset($username) && $username != 'user@name.com'
&& isset($password) && $password != 'password')
{
// load for reuse
self::$ftp[$server->cache] = JClientFtp::getInstance($host, $port,
$options, $username, $password);
}
else
{
// load error to indicate signature was in error
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_FTP_SIGNATURE_FOR_BSB_WAS_NOT_WELL_FORMED_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS',
$server->name), 'Error');
return false;
}
// check if we are connected
if (self::$ftp[$server->cache] instanceof JClientFtp &&
self::$ftp[$server->cache]->isConnected())
{
// heads-up on protocol
self::$ftp[$server->cache]->jcb_protocol = 1; // FTP <-- if
called not knowing what type of protocol is being used
// set the unique buckets
if (!isset(self::$ftp[$server->cache]->jcb_remote_server_name))
{
self::$ftp[$server->cache]->jcb_remote_server_name = array();
}
// always set the name and remote server path
self::$ftp[$server->cache]->jcb_remote_server_name[$serverID] =
$server->name;
// return the FTP instance
return self::$ftp[$server->cache];
}
// reset since we have no connection
unset(self::$ftp[$server->cache]);
}
// load error to indicate signature was in error
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_FTP_CONNECTION_FOR_BSB_COULD_NOT_BE_MADE_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS',
$server->name), 'Error');
}
return false;
}
/**
* get the server details
*
* @param int $serverID The server local id to use
* @param int $protocol The server protocol to use
* @param string $permission The permission validation area
*
* @return object on success with server details
**/
public static function getServerDetails($serverID, $protocol = 2,
$permission = 'core.export')
{
// check if this user has permission to access items
if (!Factory::getUser()->authorise($permission,
'com_componentbuilder'))
{
// set message to inform the user that permission was denied
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THE_SERVER_DETAILS_BS_DENIEDB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO',
UtilitiesStringHelper::safe($permission, 'w')),
'Error');
return false;
}
// now insure we have correct values
if (is_int($serverID) && is_int($protocol))
{
// Get a db connection
$db = Factory::getDbo();
// start the query
$query = $db->getQuery(true);
// select based to protocol
if (2 == $protocol)
{
// SFTP
$query->select($db->quoteName(array('name','authentication','username','host','password','path','port','private','private_key','secret')));
// cache builder
$cache =
array('authentication','username','host','password','port','private','private_key','secret');
}
else
{
// FTP
$query->select($db->quoteName(array('name','signature')));
// cache builder
$cache = array('signature');
}
$query->from($db->quoteName('#__componentbuilder_server'));
$query->where($db->quoteName('id') . ' = ' .
(int) $serverID);
$query->where($db->quoteName('protocol') . ' =
' . (int) $protocol);
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$server = $db->loadObject();
// Get the basic encryption.
$basickey = self::getCryptKey('basic',
'Th1sMnsTbL0ck@d');
// Get the encryption object.
$basic = new AES($basickey, 128);
// start cache keys
$keys = array();
// unlock the needed fields
foreach($server as $name => &$value)
{
// unlock the needed fields
if ($name !== 'name' && !empty($value) &&
$basickey && !is_numeric($value) && $value ===
base64_encode(base64_decode($value, true)))
{
// basic decrypt of data
$value = rtrim($basic->decryptString($value), "\0");
}
// build cache (keys) for lower connection latency
if (in_array($name, $cache))
{
$keys[] = $value;
}
}
// check if cache keys were found
if (UtilitiesArrayHelper::check($keys))
{
// now set cache
$server->cache = md5(implode('', $keys));
}
else
{
// default is ID
$server->cache = $serverID;
}
// return the server details
return $server;
}
}
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_SERVER_DETAILS_FOR_BID_SB_COULD_NOT_BE_RETRIEVED',
$serverID), 'Error');
return false;
}
/**
* Load the Composer Vendor phpseclib
*/
protected static function composephpseclib()
{
// load the autoloader for phpseclib
require_once JPATH_SITE .
'/libraries/phpseclib/vendor/autoload.php';
// do not load again
self::$composer['phpseclib'] = true;
return true;
}
/**
* the locker
*
* @var array
* @since 3.1
*/
protected static array $locker = [];
/**
* the dynamic replacement salt
*
* @var array
* @since 3.1
*/
protected static array $globalSalt = [];
/**
* the timer
*
* @var object
* @since 3.1
*/
protected static $keytimer;
/**
* To Lock string
*
* @param string $string The string/array to lock
* @param string|null $key The custom key to use
* @param int $salt The switch to add salt and type of
salt
* @param int|null $dynamic The dynamic replacement array of salt
build string
* @param int $urlencode The switch to control url encoding
*
* @return string Encrypted String
* @since 3.1
*/
public static function lock(string $string, ?string $key = null, int $salt
= 2, ?int $dynamic = null, $urlencode = true): string
{
// get the global settings
if (!$key || !UtilitiesStringHelper::check($key))
{
// set temp timer
$timer = 2;
// if we have a timer use it
if ($salt > 0)
{
$timer = $salt;
}
// set the default key
$key = self::salt($timer, $dynamic);
// try getting the system key
if (method_exists(get_called_class(), "getCryptKey"))
{
// try getting the medium key first the fall back to basic, and then
default
$key = self::getCryptKey('medium',
self::getCryptKey('basic', $key));
}
}
// check if we have a salt timer
if ($salt > 0)
{
$key .= self::salt($salt, $dynamic);
}
// get the locker settings
if (!isset(self::$locker[$key]) ||
!ObjectHelper::check(self::$locker[$key]))
{
self::$locker[$key] = new AES($key, 128);
}
// convert array or object to string
if (UtilitiesArrayHelper::check($string) ||
ObjectHelper::check($string))
{
$string = serialize($string);
}
// prep for url
if ($urlencode && method_exists(get_called_class(),
"base64_urlencode"))
{
return
self::base64_urlencode(self::$locker[$key]->encryptString($string));
}
return self::$locker[$key]->encryptString($string);
}
/**
* To un-Lock string
*
* @param string $string The string to unlock
* @param string $key The custom key to use
* @param int $salt The switch to add salt and type of
salt
* @param int $dynamic The dynamic replacement array of salt build
string
* @param int $urlencode The switch to control url decoding
*
* @return string Decrypted String
* @since 3.1
*/
public static function unlock($string, $key = null, $salt = 2, $dynamic =
null, $urlencode = true): string
{
// get the global settings
if (!$key || !UtilitiesStringHelper::check($key))
{
// set temp timer
$timer = 2;
// if we have a timer use it
if ($salt > 0)
{
$timer = $salt;
}
// set the default key
$key = self::salt($timer, $dynamic);
// try getting the system key
if (method_exists(get_called_class(), "getCryptKey"))
{
// try getting the medium key first the fall back to basic, and then
default
$key = self::getCryptKey('medium',
self::getCryptKey('basic', $key));
}
}
// check if we have a salt timer
if ($salt > 0)
{
$key .= self::salt($salt, $dynamic);
}
// get the locker settings
if (!isset(self::$locker[$key]) ||
!ObjectHelper::check(self::$locker[$key]))
{
self::$locker[$key] = new AES($key, 128);
}
// make sure we have real base64
if ($urlencode && method_exists(get_called_class(),
"base64_urldecode"))
{
$string = self::base64_urldecode($string);
}
// basic decrypt string.
if (!empty($string) && !is_numeric($string) && $string
=== base64_encode(base64_decode($string, true)))
{
$string = rtrim(self::$locker[$key]->decryptString($string),
"\0");
// convert serial string to array
if (self::is_serial($string))
{
$string = unserialize($string);
}
}
return $string;
}
/**
* The Salt
*
* @param int $type The type of length the salt should be valid
* @param int $dynamic The dynamic replacement array of salt build
string
*
* @return string
* @since 3.1
*/
public static function salt(int $type = 1, $dynamic = null): string
{
// get dynamic replacement salt
$dynamic = self::getDynamicSalt($dynamic);
// get the key timer
if (!ObjectHelper::check(self::$keytimer))
{
// load the date time object
self::$keytimer = new DateTime;
// set the correct time stamp
$vdmLocalTime = new DateTimeZone('Africa/Windhoek');
self::$keytimer->setTimezone($vdmLocalTime);
}
// set type
if ($type == 2)
{
// hour
$format = 'Y-m-d \o\n ' .
self::periodFix(self::$keytimer->format('H'));
}
elseif ($type == 3)
{
// day
$format = 'Y-m-' .
self::periodFix(self::$keytimer->format('d'));
}
elseif ($type == 4)
{
// month
$format = 'Y-' .
self::periodFix(self::$keytimer->format('m'));
}
else
{
// minute
$format = 'Y-m-d \o\n H:' .
self::periodFix(self::$keytimer->format('i'));
}
// get key
if (UtilitiesArrayHelper::check($dynamic))
{
return md5(str_replace(array_keys($dynamic), array_values($dynamic),
self::$keytimer->format($format) . ' @ VDM.I0'));
}
return md5(self::$keytimer->format($format) . ' @ VDM.I0');
}
/**
* The function to insure the salt is valid within the given period (third
try)
*
* @param int $main The main number
* @since 3.1
*/
protected static function periodFix(int $main): int
{
return round($main / 3) * 3;
}
/**
* Check if a string is serialized
*
* @param string $string
*
* @return Boolean
* @since 3.1
*/
public static function is_serial(string $string): bool
{
return (@unserialize($string) !== false);
}
/**
* Get dynamic replacement salt
* @since 3.1
*/
public static function getDynamicSalt($dynamic = null)
{
// load global if not manually set
if (!UtilitiesArrayHelper::check($dynamic))
{
return self::getGlobalSalt();
}
// return manual values if set
else
{
return $dynamic;
}
}
/**
* The random or dynamic secret salt
* @since 3.1
*/
public static function getSecretSalt($string = null, $size = 9)
{
// set the string
if (!$string)
{
// get random string
$string = self::randomkey($size);
}
// convert string to array
$string = UtilitiesStringHelper::safe($string);
// convert string to array
$array = str_split($string);
// insure only unique values are used
$array = array_unique($array);
// set the size
$size = ($size <= count($array)) ? $size : count($array);
// down size the
return array_slice($array, 0, $size);
}
/**
* Get global replacement salt
* @since 3.1
*/
public static function getGlobalSalt()
{
// load from memory if found
if (!UtilitiesArrayHelper::check(self::$globalSalt))
{
// get the global settings
if (!ObjectHelper::check(self::$params))
{
self::$params =
ComponentHelper::getParams('com_componentbuilder');
}
// check if we have a global dynamic replacement array available (format
--> ' 1->!,3->E,4->A')
$tmp = self::$params->get('dynamic_salt', null);
if (UtilitiesStringHelper::check($tmp) && strpos($tmp,
',') !== false && strpos($tmp, '->') !==
false)
{
$salt = array_map('trim', (array) explode(',',
$tmp));
if (UtilitiesArrayHelper::check($salt ))
{
foreach($salt as $replace)
{
$dynamic = array_map('trim', (array)
explode('->', $replace));
if (isset($dynamic[0]) && isset($dynamic[1]))
{
self::$globalSalt[$dynamic[0]] = $dynamic[1];
}
}
}
}
}
// return global if found
if (UtilitiesArrayHelper::check(self::$globalSalt))
{
return self::$globalSalt;
}
// return default as fail safe
return array('1' => '!', '3' =>
'E', '4' => 'A');
}
/**
* Close public protocol
* @since 3.1
*/
public static function closePublicProtocol($id, $public)
{
// get secret salt
$secretSalt = self::getSecretSalt(self::salt(1,array('4' =>
'R','1' => 'E','2' =>
'G','7' => 'J','8' =>
'A')));
// get the key
$key = self::salt(1, $secretSalt);
// get secret salt
$secret = self::getSecretSalt();
// set the secret
$close['SECRET'] = self::lock($secret, $key, 1,
array('1' => 's', '3' => 'R',
'4' => 'D'));
// get the key
$key = self::salt(1, $secret);
// get the public key
$close['PUBLIC'] = self::lock($public, $key, 1,
array('1' => '!', '3' => 'E',
'4' => 'A'));
// get secret salt
$secretSalt = self::getSecretSalt($public);
// get the key
$key = self::salt(1, $secretSalt);
// get the ID
$close['ID'] = self::unlock($id, $key, 1, array('1'
=> 'i', '3' => 'e', '4' =>
'B'));
// return closed values
return $close;
}
/**
* Open public protocol
* @since 3.1
*/
public static function openPublicProtocol($SECRET, $ID, $PUBLIC)
{
// get secret salt
$secretSalt = self::getSecretSalt(self::salt(1,array('4' =>
'R','1' => 'E','2' =>
'G','7' => 'J','8' =>
'A')));
// get the key
$key = self::salt(1, $secretSalt);
// get the $SECRET
$SECRET = self::unlock($SECRET, $key, 1, array('1' =>
's', '3' => 'R', '4' =>
'D'));
// get the key
$key = self::salt(1, $SECRET);
// get the public key
$open['public'] = self::unlock($PUBLIC, $key, 1,
array('1' => '!', '3' => 'E',
'4' => 'A'));
// get secret salt
$secretSalt = self::getSecretSalt($open['public']);
// get the key
$key = self::salt(1, $secretSalt);
// get the ID
$open['id'] = self::unlock($ID, $key, 1, array('1'
=> 'i', '3' => 'e', '4' =>
'B'));
// return opened values
return $open;
}
/**
* Workers to load tasks
*
* @var array
* @since 3.1
*/
protected static array $worker = [];
/**
* Set a worker dynamic URLs
*
* @var array
* @since 3.1
*/
protected static array $workerURL = [];
/**
* Set a worker dynamic HEADERs
*
* @var array
* @since 3.1
*/
protected static array $workerHEADER = [];
/**
* Curl Error Notice
*
* @var bool
* @since 3.1
*/
protected static bool $curlErrorLoaded = false;
/**
* check if a worker has more work
*
* @param string $function The function to target to perform the
task
*
* @return bool
* @since 3.1
*/
public static function hasWork(string $function): bool
{
if (isset(self::$worker[$function]) &&
UtilitiesArrayHelper::check(self::$worker[$function]))
{
return count( (array) self::$worker[$function]);
}
return false;
}
/**
* Set a worker url
*
* @param string $function The function to target to perform the
task
* @param string $url The url of where the task is to be
performed
*
* @return void
* @since 3.1
*/
public static function setWorkerUrl(string $function, string $url): void
{
// set the URL if found
if (UtilitiesStringHelper::check($url))
{
// make sure task function url is up
self::$workerURL[$function] = $url;
}
}
/**
* Set a worker headers
*
* @param string $function The function to target to perform the
task
* @param array|null $headers The headers needed for these
workers/function
*
* @return void
* @since 3.1
*/
public static function setWorkerHeaders(string $function, ?array
$headers): void
{
// set the Headers if found
if (UtilitiesArrayHelper::check($headers))
{
// make sure task function headers are set
self::$workerHEADER[$function] = $headers;
}
}
/**
* Set a worker that needs to perform a task
*
* @param mixed $data The data to pass to the task
* @param string $function The function to target to perform the
task
* @param string $url The url of where the task is to be
performed
* @param array $headers The headers needed for these
workers/function
*
* @return void
* @since 3.1
*/
public static function setWorker($data, string $function, ?string $url =
null, ?array $headers = null)
{
// make sure task function is up
if (!isset(self::$worker[$function]))
{
self::$worker[$function] = [];
}
// load the task
self::$worker[$function][] = self::lock($data);
// set the Headers if found
if ($headers && !isset(self::$workerHEADER[$function]))
{
self::setWorkerHeaders($function, $headers);
}
// set the URL if found
if ($url && !isset(self::$workerURL[$function]))
{
self::setWorkerUrl($function, $url);
}
}
/**
* Run set Workers
*
* @param string $function The function to target to perform the
task
* @param string $perTask The amount of task per worker
* @param function $callback The option to do a call back when task
is completed
* @param int $threadSize The size of the thread
*
* @return bool true On success
* @since 3.1
*/
public static function runWorker(string $function, $perTask = 50,
$callback = null, $threadSize = 20): bool
{
// set task
$task = self::lock($function);
// build headers
$headers = array('VDM-TASK: ' .$task);
// build dynamic headers
if (isset(self::$workerHEADER[$function]) &&
UtilitiesArrayHelper::check(self::$workerHEADER[$function]))
{
foreach (self::$workerHEADER[$function] as $header)
{
$headers[] = $header;
}
}
// build worker options
$options = array();
// make sure worker is up
if (isset(self::$worker[$function]) &&
UtilitiesArrayHelper::check(self::$worker[$function]))
{
// this load method is for each
if (1 == $perTask)
{
// working with a string = 1
$headers[] = 'VDM-VALUE-TYPE: ' .self::lock(1);
// now load the options
foreach (self::$worker[$function] as $data)
{
$options[] = array(CURLOPT_HTTPHEADER => $headers, CURLOPT_POST
=> 1, CURLOPT_POSTFIELDS => 'VDM_DATA='. $data);
}
}
// this load method is for bundles
else
{
// working with an array = 2
$headers[] = 'VDM-VALUE-TYPE: ' .self::lock(2);
// now load the options
$work = array_chunk(self::$worker[$function], $perTask);
foreach ($work as $data)
{
$options[] = array(CURLOPT_HTTPHEADER => $headers, CURLOPT_POST
=> 1, CURLOPT_POSTFIELDS => 'VDM_DATA='.
implode('___VDM___', $data));
}
}
// relieve worker of task/function
self::$worker[$function] = array();
}
// do the execution
if (UtilitiesArrayHelper::check($options))
{
if (isset(self::$workerURL[$function]))
{
$url = self::$workerURL[$function];
}
else
{
$url = Uri::root() .
'/index.php?option=com_componentbuilder&task=api.worker';
}
return self::curlMultiExec($url, $options, $callback, $threadSize);
}
return false;
}
/**
* Do a multi curl execution of tasks
*
* @param string $url The url of where the task is to
be performed
* @param array $_options The array of curl options/headers to
set
* @param function $callback The option to do a call back when
task is completed
* @param int $threadSize The size of the thread
*
* @return bool true On success
* @since 3.1
*/
public static function curlMultiExec(&$url, &$_options, $callback
= null, $threadSize = 20)
{
// make sure we have curl available
if (!function_exists('curl_version'))
{
if (!self::$curlErrorLoaded)
{
// set the notice
Factory::getApplication()->enqueueMessage(Text::_('COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP'),
'Error');
// load the notice only once
self::$curlErrorLoaded = true;
}
return false;
}
// make sure we have an url
if (UtilitiesStringHelper::check($url))
{
// make sure the thread size isn't greater than the # of _options
$threadSize = (count($_options) < $threadSize) ? count($_options) :
$threadSize;
// set the options
$options = array();
$options[CURLOPT_URL] = $url;
$options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT
6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12';
$options[CURLOPT_RETURNTRANSFER] = TRUE;
$options[CURLOPT_SSL_VERIFYPEER] = FALSE;
// start multi threading :)
$handle = curl_multi_init();
// start the first batch of requests
for ($i = 0; $i < $threadSize; $i++)
{
if (isset($_options[$i]))
{
$ch = curl_init();
foreach ($_options[$i] as $curlopt => $string)
{
$options[$curlopt] = $string;
}
curl_setopt_array($ch, $options);
curl_multi_add_handle($handle, $ch);
}
}
// we wait for all the calls to finish (should not take long)
do {
while(($execrun = curl_multi_exec($handle, $working)) ==
CURLM_CALL_MULTI_PERFORM);
if($execrun != CURLM_OK)
break;
// a request was just completed -- find out which one
while($done = curl_multi_info_read($handle))
{
if (is_callable($callback))
{
// $info = curl_getinfo($done['handle']);
// request successful. process output using the callback function.
$output = curl_multi_getcontent($done['handle']);
$callback($output);
}
$key = $i + 1;
if(isset($_options[$key]))
{
// start a new request (it's important to do this before
removing the old one)
$ch = curl_init(); $i++;
// add options
foreach ($_options[$key] as $curlopt => $string)
{
$options[$curlopt] = $string;
}
curl_setopt_array($ch, $options);
curl_multi_add_handle($handle, $ch);
// remove options again
foreach ($_options[$key] as $curlopt => $string)
{
unset($options[$curlopt]);
}
}
// remove the curl handle that just completed
curl_multi_remove_handle($handle, $done['handle']);
}
// stop wasting CPU cycles and rest for a couple ms
usleep(10000);
} while ($working);
// close the curl multi thread
curl_multi_close($handle);
// okay done
return true;
}
return false;
}
/**
* Get an edit button
*
* @param int $item The item to edit
* @param string $view The type of item to edit
* @param string $views The list view controller name
* @param string $ref The return path
* @param string $component The component these views belong to
* @param string $headsup The message to show on click of button
*
* @return string On success the full html link
*
*/
public static function getEditButton(&$item, $view, $views, $ref =
'', $component = 'com_componentbuilder', $headsup =
'COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE')
{
// get URL
$url = self::getEditURL($item, $view, $views, $ref, $component);
// check if we found any
if (UtilitiesStringHelper::check($url))
{
// get the global settings
if (!ObjectHelper::check(self::$params))
{
self::$params =
ComponentHelper::getParams('com_componentbuilder');
}
// get UIKIT version
$uikit = self::$params->get('uikit_version', 2);
// check that we have the ID
if (ObjectHelper::check($item) && isset($item->id))
{
// check if the checked_out is available
if (isset($item->checked_out))
{
$checked_out = (int) $item->checked_out;
}
else
{
$checked_out = self::getVar($view, $item->id, 'id',
'checked_out', '=', str_replace('com_',
'', $component));
}
}
elseif (UtilitiesArrayHelper::check($item) &&
isset($item['id']))
{
// check if the checked_out is available
if (isset($item['checked_out']))
{
$checked_out = (int) $item['checked_out'];
}
else
{
$checked_out = self::getVar($view, $item['id'],
'id', 'checked_out', '=',
str_replace('com_', '', $component));
}
}
elseif (is_numeric($item) && $item > 0)
{
$checked_out = self::getVar($view, $item, 'id',
'checked_out', '=', str_replace('com_',
'', $component));
}
// set the link title
$title =
UtilitiesStringHelper::safe(Text::_('COM_COMPONENTBUILDER_EDIT')
. ' ' . $view, 'W');
// check that there is a check message
if (UtilitiesStringHelper::check($headsup))
{
if (3 == $uikit)
{
$href =
'onclick="UIkit.modal.confirm(\''.Text::_($headsup).'\').then(
function(){ window.location.href = \'' . $url . '\' }
)" href="javascript:void(0)"';
}
else
{
$href =
'onclick="UIkit2.modal.confirm(\''.Text::_($headsup).'\',
function(){ window.location.href = \'' . $url . '\'
})" href="javascript:void(0)"';
}
}
else
{
$href = 'href="' . $url . '"';
}
// return UIKIT version 3
if (3 == $uikit)
{
// check if it is checked out
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == Factory::getUser()->id)
{
return ' <a ' . $href . ' uk-icon="icon:
lock" title="' . $title . '"></a>';
}
return ' <a href="#" disabled uk-icon="icon:
lock" title="' .
Text::sprintf('COM_COMPONENTBUILDER__HAS_BEEN_CHECKED_OUT_BY_S',
UtilitiesStringHelper::safe($view, 'W'),
Factory::getUser($checked_out)->name) .
'"></a>';
}
// return normal edit link
return ' <a ' . $href . ' uk-icon="icon:
pencil" title="' . $title .
'"></a>';
}
// check if it is checked out (return UIKIT version 2)
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == Factory::getUser()->id)
{
return ' <a ' . $href . '
class="uk-icon-lock" title="' . $title .
'"></a>';
}
return ' <a href="#" disabled
class="uk-icon-lock" title="' .
Text::sprintf('COM_COMPONENTBUILDER__HAS_BEEN_CHECKED_OUT_BY_S',
UtilitiesStringHelper::safe($view, 'W'),
Factory::getUser($checked_out)->name) .
'"></a>';
}
// return normal edit link
return ' <a ' . $href . '
class="uk-icon-pencil" title="' . $title .
'"></a>';
}
return '';
}
/**
* Get an edit text button
*
* @param string $text The button text
* @param int $item The item to edit
* @param string $view The type of item to edit
* @param string $views The list view controller name
* @param string $ref The return path
* @param string $component The component these views belong to
* @param string $headsup The message to show on click of button
*
* @return string On success the full html link
*
*/
public static function getEditTextButton($text, &$item, $view, $views,
$ref = '', $component = 'com_componentbuilder', $jRoute
= true, $class = 'uk-button', $headsup =
'COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE')
{
// make sure we have text
if (!UtilitiesStringHelper::check($text))
{
return self::getEditButton($item, $view, $views, $ref, $component,
$headsup);
}
// get URL
$url = self::getEditURL($item, $view, $views, $ref, $component,
$jRoute);
// check if we found any
if (UtilitiesStringHelper::check($url))
{
// get the global settings
if (!ObjectHelper::check(self::$params))
{
self::$params =
ComponentHelper::getParams('com_componentbuilder');
}
// get UIKIT version
$uikit = self::$params->get('uikit_version', 2);
// check that we have the ID
if (ObjectHelper::check($item) && isset($item->id))
{
// check if the checked_out is available
if (isset($item->checked_out))
{
$checked_out = (int) $item->checked_out;
}
else
{
$checked_out = self::getVar($view, $item->id, 'id',
'checked_out', '=', str_replace('com_',
'', $component));
}
}
elseif (UtilitiesArrayHelper::check($item) &&
isset($item['id']))
{
// check if the checked_out is available
if (isset($item['checked_out']))
{
$checked_out = (int) $item['checked_out'];
}
else
{
$checked_out = self::getVar($view, $item['id'],
'id', 'checked_out', '=',
str_replace('com_', '', $component));
}
}
elseif (is_numeric($item) && $item > 0)
{
$checked_out = self::getVar($view, $item, 'id',
'checked_out', '=', str_replace('com_',
'', $component));
}
// set the link title
$title =
UtilitiesStringHelper::safe(Text::_('COM_COMPONENTBUILDER_EDIT')
. ' ' . $view, 'W');
// check that there is a check message
if (UtilitiesStringHelper::check($headsup))
{
if (3 == $uikit)
{
$href =
'onclick="UIkit.modal.confirm(\''.Text::_($headsup).'\').then(
function(){ window.location.href = \'' . $url . '\' }
)" href="javascript:void(0)"';
}
else
{
$href =
'onclick="UIkit2.modal.confirm(\''.Text::_($headsup).'\',
function(){ window.location.href = \'' . $url . '\'
})" href="javascript:void(0)"';
}
}
else
{
$href = 'href="' . $url . '"';
}
// return UIKIT version 3
if (3 == $uikit)
{
// check if it is checked out
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == Factory::getUser()->id)
{
return ' <a class="' . $class . '" '
. $href . ' title="' . $title . '">' .
$text . '</a>';
}
return ' <a class="' . $class . '"
href="#" disabled title="' .
Text::sprintf('COM_COMPONENTBUILDER__HAS_BEEN_CHECKED_OUT_BY_S',
UtilitiesStringHelper::safe($view, 'W'),
Factory::getUser($checked_out)->name) . '">' . $text .
'</a>';
}
// return normal edit link
return ' <a class="' . $class . '" ' .
$href . ' title="' . $title . '">' . $text
. '</a>';
}
// check if it is checked out (return UIKIT version 2)
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == Factory::getUser()->id)
{
return ' <a class="' . $class . '" '
. $href . ' title="' . $title . '">' .
$text . '</a>';
}
return ' <a class="' . $class . '"
href="#" disabled title="' .
Text::sprintf('COM_COMPONENTBUILDER__HAS_BEEN_CHECKED_OUT_BY_S',
UtilitiesStringHelper::safe($view, 'W'),
Factory::getUser($checked_out)->name) . '">' . $text .
'</a>';
}
// return normal edit link
return ' <a class="' . $class . '" ' .
$href . ' title="' . $title . '">' . $text
. '</a>';
}
return '';
}
/**
* Get the edit URL
*
* @param int $item The item to edit
* @param string $view The type of item to edit
* @param string $views The list view controller name
* @param string $ref The return path
* @param string $component The component these views belong to
* @param bool $jRoute The switch to add use JRoute or not
*
* @return string On success the edit url
*
*/
public static function getEditURL(&$item, $view, $views, $ref =
'', $component = 'com_componentbuilder', $jRoute =
true)
{
// build record
$record = new \stdClass();
// check if user can edit
if (self::canEditItem($record, $item, $view, $views, $component))
{
// set the edit link
if ($jRoute)
{
return Route::_("index.php?option=" . $component .
"&view=" . $views . "&task=" . $view .
".edit&id=" . $record->id . $ref);
}
return "index.php?option=" . $component .
"&view=" . $views . "&task=" . $view .
".edit&id=" . $record->id . $ref;
}
return false;
}
/**
* Can Edit (either any, or own)
*
* @param int $item The item to edit
* @param string $view The type of item to edit
* @param string $views The list view controller name
* @param string $component The component these views belong to
*
* @return bool if user can edit returns true els
*
*/
public static function allowEdit(&$item, $view, $views, $component =
'com_componentbuilder')
{
// build record
$record = new \stdClass();
return self::canEditItem($record, $item, $view, $views, $component);
}
/**
* Can Edit (either any, or own)
*
* @param int $item The item to edit
* @param string $view The type of item to edit
* @param string $views The list view controller name
* @param string $component The component these views belong to
*
* @return bool if user can edit returns true els
*
*/
protected static function canEditItem(&$record, &$item, $view,
$views, $component = 'com_componentbuilder')
{
// make sure the user has access to view
if (!Factory::getUser()->authorise($view. '.access',
$component))
{
return false;
}
// we start with false.
$can_edit = false;
// check that we have the ID
if (ObjectHelper::check($item) && isset($item->id))
{
$record->id = (int) $item->id;
// check if created_by is available
if (isset($item->created_by) && $item->created_by > 0)
{
$record->created_by = (int) $item->created_by;
}
}
elseif (UtilitiesArrayHelper::check($item) &&
isset($item['id']))
{
$record->id = (int) $item['id'];
// check if created_by is available
if (isset($item['created_by']) &&
$item['created_by'] > 0)
{
$record->created_by = (int) $item['created_by'];
}
}
elseif (is_numeric($item))
{
$record->id = (int) $item;
}
// check ID
if (isset($record->id) && $record->id > 0)
{
// get user action permission to edit
$action = self::getActions($view, $record, $views, 'edit',
str_replace('com_', '', $component));
// check if the view permission is set
if (($can_edit = $action->get($view . '.edit',
'none-set')) === 'none-set')
{
// fall back on the core permission then (this can be an issue)
$can_edit = ($action->get('core.edit', false) ||
$action->get('core.edit.own', false));
}
}
return $can_edit;
}
/**
* set subform type table
*
* @param array $head The header names
* @param array $rows The row values
* @param string $idName The prefix to the table id
*
* @return string
*
*/
public static function setSubformTable($head, $rows, $idName)
{
$table[] = "<div class=\"row-fluid\"
id=\"vdm_table_display_".$idName."\">";
$table[] = "\t<div class=\"subform-repeatable-wrapper
subform-table-layout
subform-table-sublayout-section-byfieldsets\">";
$table[] = "\t\t<div
class=\"subform-repeatable\">";
$table[] = "\t\t\t<table class=\"adminlist table
table-striped table-bordered\">";
$table[] = "\t\t\t\t<thead>";
$table[] = "\t\t\t\t\t<tr>";
$table[] = "\t\t\t\t\t\t<th>" .
implode("</th><th>", $head) .
"</th>";
$table[] = "\t\t\t\t\t</tr>";
$table[] = "\t\t\t\t</thead>";
$table[] = "\t\t\t\t<tbody>";
foreach ($rows as $row)
{
$table[] = "\t\t\t\t\t<tr
class=\"subform-repeatable-group\">";
$table[] = "\t\t\t\t\t\t" . $row;
$table[] = "\t\t\t\t\t</tr>";
}
$table[] = "\t\t\t\t</tbody>";
$table[] = "\t\t\t</table>";
$table[] = "\t\t</div>";
$table[] = "\t</div>";
$table[] = "</div>";
// return the table
return implode("\n", $table);
}
/**
* Change to nice fancy date
*/
public static function fancyDate($date, $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('jS \o\f F Y',$date);
}
/**
* get date based in period past
*/
public static function fancyDynamicDate($date, $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
// older then year
$lastyear = date("Y", strtotime("-1 year"));
$tragetyear = date("Y", $date);
if ($tragetyear <= $lastyear)
{
return date('m/d/y', $date);
}
// same day
$yesterday = strtotime("-1 day");
if ($date > $yesterday)
{
return date('g:i A', $date);
}
// just month day
return date('M j', $date);
}
/**
* Change to nice fancy day time and date
*/
public static function fancyDayTimeDate($time, $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($time))
{
$time = strtotime($time);
}
return date('D ga jS \o\f F Y',$time);
}
/**
* Change to nice fancy time and date
*/
public static function fancyDateTime($time, $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($time))
{
$time = strtotime($time);
}
return date('(G:i) jS \o\f F Y',$time);
}
/**
* Change to nice hour:minutes time
*/
public static function fancyTime($time, $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($time))
{
$time = strtotime($time);
}
return date('G:i',$time);
}
/**
* set the date day as Sunday through Saturday
*/
public static function setDayName($date, $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('l', $date);
}
/**
* set the date month as January through December
*/
public static function setMonthName($date, $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('F', $date);
}
/**
* set the date day as 1st
*/
public static function setDay($date, $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('jS', $date);
}
/**
* set the date month as 5
*/
public static function setMonth($date, $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('n', $date);
}
/**
* set the date year as 2004 (for charts)
*/
public static function setYear($date, $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('Y', $date);
}
/**
* set the date as 2004/05 (for charts)
*/
public static function setYearMonth($date, $spacer = '/',
$check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('Y' . $spacer . 'm', $date);
}
/**
* set the date as 2004/05/03 (for charts)
*/
public static function setYearMonthDay($date, $spacer = '/',
$check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('Y' . $spacer . 'm' . $spacer .
'd', $date);
}
/**
* set the date as 03/05/2004
*/
public static function setDayMonthYear($date, $spacer = '/',
$check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('d' . $spacer . 'm' . $spacer .
'Y', $date);
}
/**
* Check if string is a valid time stamp
*/
public static function isValidTimeStamp($timestamp)
{
return ((int) $timestamp === $timestamp)
&& ($timestamp <= PHP_INT_MAX)
&& ($timestamp >= ~PHP_INT_MAX);
}
/**
* Check if string is a valid date
* https://www.php.net/manual/en/function.checkdate.php#113205
*/
public static function isValidateDate($date, $format = 'Y-m-d
H:i:s')
{
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
}
/**
* The subform layouts
**/
protected static $subformLayouts = false;
/**
* get the subform layout
*
* @input string The view name
* @input string The string name
*
* @returns string on success
**/
public static function getSubformLayout($view, $field, $default =
'repeatablejcb')
{
// get global values
if (self::$subformLayouts === false)
{
self::$subformLayouts =
ComponentHelper::getParams('com_componentbuilder')->get('subform_layouts',
false);
}
// check what we found (else) return default
if (ObjectHelper::check(self::$subformLayouts))
{
// looking for
$target = $view . '.' . $field;
foreach (self::$subformLayouts as $subform)
{
if ($target === $subform->view_field)
{
return $subform->layout;
}
elseif ('default' === $subform->view_field)
{
$default = $subform->layout;
}
}
}
return $default;
}
/**
* Check if a row already exist
*
* @param string $table The table from which to get the
variable
* @param array $where The value where
* @param string $main The component in which the table is
found
*
* @return int the id, or false
*
*/
public static function checkExist($table, $where, $what = 'id',
$operator = '=', $main = 'componentbuilder')
{
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array($what)));
if (empty($table))
{
$query->from($db->quoteName('#__'.$main));
}
else
{
$query->from($db->quoteName('#__'.$main.'_'.$table));
}
if (UtilitiesArrayHelper::check($where))
{
foreach ($where as $key => $value)
{
if (is_numeric($value))
{
if (is_float($value + 0))
{
$query->where($db->quoteName($key) . ' ' . $operator
. ' ' . (float) $value);
}
else
{
$query->where($db->quoteName($key) . ' ' . $operator
. ' ' . (int) $value);
}
}
elseif (is_bool($value))
{
$query->where($db->quoteName($key) . ' ' . $operator .
' ' . (bool) $value);
}
// we do not allow arrays at this point
elseif (!UtilitiesArrayHelper::check($value))
{
$query->where($db->quoteName($key) . ' ' . $operator .
' ' . $db->quote( (string) $value));
}
else
{
return false;
}
}
}
else
{
return false;
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadResult();
}
return false;
}
/**
* Making class or function name safe
*
* @input string The name you would like to make safe
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use ClassfunctionHelper::safe($name);
*/
public static function safeClassFunctionName($name)
{
return ClassfunctionHelper::safe($name);
}
/**
* Making field names safe
*
* @input string The you would like to make safe
* @input boolean The switch to return an ALL UPPER CASE string
* @input string The string to use in white space
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use StringFieldHelper::safe($string, $allcap,
$spacer);
*/
public static function safeFieldName($string, $allcap = false, $spacer =
'_')
{
// set the local component option
self::setComponentOption();
return StringFieldHelper::safe($string, $allcap, $spacer);
}
/**
* Making field type name safe
*
* @input string The you would like to make safe
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use TypeHelper::safe($string);
*/
public static function safeTypeName($string)
{
// set the local component option
self::setComponentOption();
return TypeHelper::safe($string);
}
/**
* Making namespace safe
*
* @input string The you would like to make safe
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use NamespaceHelper::safe($string);
*/
public static function safeNamespace($string)
{
return NamespaceHelper::safe($string);
}
/**
* get all strings between two other strings
*
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
*
* @return array On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GetHelper::allBetween($content, $start, $end);
*/
public static function getAllBetween($content, $start, $end)
{
return GetHelper::allBetween($content, $start, $end);
}
/**
* get a string between two other strings
*
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
* @param string $default The default value if none found
*
* @return string On success / empty string on failure
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GetHelper::between($content, $start, $end,
$default);
*/
public static function getBetween($content, $start, $end, $default =
'')
{
return GetHelper::between($content, $start, $end, $default);
}
/**
* bc math wrapper (very basic not for accounting)
*
* @param string $type The type bc math
* @param int $val1 The first value
* @param int $val2 The second value
* @param int $scale The scale value
*
* @return float|int
*
* @since 3.0.9
*
* @deprecated 4.0 - Use MathHelper::bc($type, $val1, $val2, $scale);
*/
public static function bcmath($type, $val1, $val2, $scale = 0)
{
return MathHelper::bc($type, $val1, $val2, $scale);
}
/**
* Basic sum of an array with more precision
*
* @param array $array The values to sum
* @param int $scale The scale value
*
* @return float|int
*
* @since 3.0.9
*
* @deprecated 4.0 - Use MathHelper::sum($array, $scale);
*/
public static function bcsum($array, $scale = 4)
{
return MathHelper::sum($array, $scale);
}
/**
* create plugin class name
*
* @input string The group name
* @input string The name
*
* @return string
*
* @since 3.0.9
*
* @deprecated 4.0 - Use PluginHelper::safeClassName($name, $group);
*/
public static function createPluginClassName($group, $name)
{
return PluginHelper::safeClassName($name, $group);
}
/**
* Returns a GUIDv4 string
*
* Thanks to Dave Pearson (and other)
* https://www.php.net/manual/en/function.com-create-guid.php#119168
*
* Uses the best cryptographically secure method
* for all supported platforms with fallback to an older,
* less secure version.
*
* @param bool $trim
*
* @return string
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GuidHelper::get($trim);
*/
public static function GUID($trim = true)
{
return GuidHelper::get($trim);
}
/**
* Validate the Globally Unique Identifier ( and check if table already
has this identifier)
*
* @param string $guid
* @param string $table
* @param int $id
* @param string|null $component
*
* @return bool
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id,
$component);
*/
public static function validGUID($guid, $table = null, $id = 0, $component
= null)
{
// set the local component option
self::setComponentOption();
return GuidHelper::valid($guid, $table, $id, $component);
}
/**
* get the ITEM of a GUID by table
*
* @param string $guid
* @param string $table
* @param string/array $what
* @param string|null $component
*
* @return mixed
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id,
$component);
*/
public static function getGUID($guid, $table, $what = 'a.id',
$component = null)
{
// set the local component option
self::setComponentOption();
return GuidHelper::item($guid, $table, $what, $component);
}
/**
* Validate the Globally Unique Identifier
*
* Thanks to Lewie
* https://stackoverflow.com/a/1515456/1429677
*
* @param string $guid
*
* @return bool
*
* @deprecated 4.0 - Use GuidHelper::validate($guid);
*/
protected static function validateGUID($guid)
{
return GuidHelper::valid($guid);
}
/**
* The zipper method
*
* @param string $workingDIR The directory where the items must be
zipped
* @param string $filepath The path to where the zip file must
be placed
*
* @return bool true On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::zip($workingDIR, $filepath);
*/
public static function zip($workingDIR, &$filepath)
{
return FileHelper::zip($workingDIR, $filepath);
}
/**
* get the content of a file
*
* @param string $path The path to the file
* @param mixed $none The return value if no content was found
*
* @return string On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::getContent($path, $none);
*/
public static function getFileContents($path, $none = '')
{
return FileHelper::getContent($path, $none);
}
/**
* Write a file to the server
*
* @param string $path The path and file name where to safe the
data
* @param string $data The data to safe
*
* @return bool true On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::write($path, $data);
*/
public static function writeFile($path, $data)
{
return FileHelper::write($path, $data);
}
/**
* get all the file paths in folder and sub folders
*
* @param string $folder The local path to parse
* @param array $fileTypes The type of files to get
*
* @return array|null
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::getPaths($folder, $fileTypes ,
$recurse, $full);
*/
public static function getAllFilePaths($folder, $fileTypes =
array('\.php', '\.js', '\.css',
'\.less'), $recurse = true, $full = true)
{
return FileHelper::getPaths($folder, $fileTypes , $recurse, $full);
}
/**
* Get the file path or url
*
* @param string $type The (url/path) type to return
* @param string $target The Params Target name (if set)
* @param string $fileType The kind of filename to generate
(if not set no file name is generated)
* @param string $key The key to adjust the filename (if
not set ignored)
* @param string $default The default path if not set in
Params (fallback path)
* @param bool $createIfNotSet The switch to create the folder if
not found
*
* @return string On success the path or url is returned based on the
type requested
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::getPath($type, $target, $fileType,
$key, $default, $createIfNotSet);
*/
public static function getFilePath($type = 'path', $target =
'filepath', $fileType = null, $key = '', $default =
'', $createIfNotSet = true)
{
// set the local component option
self::setComponentOption();
return FileHelper::getPath($type, $target, $fileType, $key, $default,
$createIfNotSet);
}
/**
* Check if file exist
*
* @param string $path The url/path to check
*
* @return bool If exist true
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::exists($path);
*/
public static function urlExists($path)
{
return FileHelper::exists($path);
}
/**
* Set the component option
*
* @param String|null $option The option for the component.
*
* @since 3.0.11
*/
public static function setComponentOption($option = null)
{
// set the local component option
if (empty($option))
{
if (empty(Helper::$option) && property_exists(__CLASS__,
'ComponentCodeName'))
{
Helper::$option = 'com_' . self::$ComponentCodeName;
}
}
else
{
Helper::$option = $option;
}
}
/**
* Load the Composer Vendors
*/
public static function composerAutoload($target)
{
// insure we load the composer vendor only once
if (!isset(self::$composer[$target]))
{
// get the function name
$functionName = UtilitiesStringHelper::safe('compose' .
$target);
// check if method exist
if (method_exists(__CLASS__, $functionName))
{
return self::{$functionName}();
}
return false;
}
return self::$composer[$target];
}
/**
* Convert a json object to a string
*
* @input string $value The json string to convert
*
* @returns a string
* @deprecated 3.3 Use JsonHelper::string(...);
*/
public static function jsonToString($value, $sperator = ", ",
$table = null, $id = 'id', $name = 'name')
{
return JsonHelper::string(
$value,
$sperator,
$table,
$id,
$name
);
}
/**
* Load the Component xml manifest.
*/
public static function manifest()
{
$manifestUrl =
JPATH_ADMINISTRATOR."/components/com_componentbuilder/componentbuilder.xml";
return simplexml_load_file($manifestUrl);
}
/**
* Joomla version object
*/
protected static $JVersion;
/**
* set/get Joomla version
*/
public static function jVersion()
{
// check if set
if (!ObjectHelper::check(self::$JVersion))
{
self::$JVersion = new Version();
}
return self::$JVersion;
}
/**
* Load the Contributors details.
*/
public static function getContributors()
{
// get params
$params =
ComponentHelper::getParams('com_componentbuilder');
// start contributors array
$contributors = [];
// get all Contributors (max 20)
$searchArray = range('0','20');
foreach($searchArray as $nr)
{
if ((NULL !== $params->get("showContributor".$nr))
&& ($params->get("showContributor".$nr) == 2 ||
$params->get("showContributor".$nr) == 3))
{
// set link based of selected option
if($params->get("useContributor".$nr) == 1)
{
$link_front = '<a
href="mailto:'.$params->get("emailContributor".$nr).'"
target="_blank">';
$link_back = '</a>';
}
elseif($params->get("useContributor".$nr) == 2)
{
$link_front = '<a
href="'.$params->get("linkContributor".$nr).'"
target="_blank">';
$link_back = '</a>';
}
else
{
$link_front = '';
$link_back = '';
}
$contributors[$nr]['title'] =
UtilitiesStringHelper::html($params->get("titleContributor".$nr));
$contributors[$nr]['name'] =
$link_front.UtilitiesStringHelper::html($params->get("nameContributor".$nr)).$link_back;
}
}
return $contributors;
}
/**
* Load the Component Help URLs.
**/
public static function getHelpUrl($view)
{
$user = Factory::getUser();
$groups = $user->get('groups');
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url'));
$query->from('#__componentbuilder_help_document AS a');
$query->where('a.site_view = '.$db->quote($view));
$query->where('a.location = 2');
$query->where('a.published = 1');
$db->setQuery($query);
$db->execute();
if($db->getNumRows())
{
$helps = $db->loadObjectList();
if (UtilitiesArrayHelper::check($helps))
{
foreach ($helps as $nr => $help)
{
if ($help->target == 1)
{
$targetgroups = json_decode($help->groups, true);
if (!array_intersect($targetgroups, $groups))
{
// if user not in those target groups then remove the item
unset($helps[$nr]);
continue;
}
}
// set the return type
switch ($help->type)
{
// set joomla article
case 1:
return self::loadArticleLink($help->article);
break;
// set help text
case 2:
return self::loadHelpTextLink($help->id);
break;
// set Link
case 3:
return $help->url;
break;
}
}
}
}
return false;
}
/**
* Get the Article Link.
**/
protected static function loadArticleLink($id)
{
return Uri::root() .
'index.php?option=com_content&view=article&id='.$id.'&tmpl=component&layout=modal';
}
/**
* Get the Help Text Link.
**/
protected static function loadHelpTextLink($id)
{
$token = Session::getFormToken();
return
'index.php?option=com_componentbuilder&task=help.getText&id='
. (int) $id . '&' . $token . '=1';
}
/**
* Get any component's model
*/
public static function getModel($name, $path = JPATH_COMPONENT_SITE,
$Component = 'Componentbuilder', $config = [])
{
// fix the name
$name = UtilitiesStringHelper::safe($name);
// full path to models
$fullPathModels = $path . '/models';
// load the model file
BaseDatabaseModel::addIncludePath($fullPathModels, $Component .
'Model');
// make sure the table path is loaded
if (!isset($config['table_path']) ||
!UtilitiesStringHelper::check($config['table_path']))
{
// This is the JCB default path to tables in Joomla 3.x
$config['table_path'] = JPATH_ADMINISTRATOR .
'/components/com_' . strtolower($Component) .
'/tables';
}
// get instance
$model = BaseDatabaseModel::getInstance($name, $Component .
'Model', $config);
// if model not found (strange)
if ($model == false)
{
jimport('joomla.filesystem.file');
// get file path
$filePath = $path . '/' . $name . '.php';
$fullPathModel = $fullPathModels . '/' . $name .
'.php';
// check if it exists
if (File::exists($filePath))
{
// get the file
require_once $filePath;
}
elseif (File::exists($fullPathModel))
{
// get the file
require_once $fullPathModel;
}
// build class names
$modelClass = $Component . 'Model' . $name;
if (class_exists($modelClass))
{
// initialize the model
return new $modelClass($config);
}
}
return $model;
}
/**
* Add to asset Table
*/
public static function setAsset($id, $table, $inherit = true)
{
$parent = Table::getInstance('Asset');
$parent->loadByName('com_componentbuilder');
$parentId = $parent->id;
$name = 'com_componentbuilder.'.$table.'.'.$id;
$title = '';
$asset = Table::getInstance('Asset');
$asset->loadByName($name);
// Check for an error.
$error = $asset->getError();
if ($error)
{
return false;
}
else
{
// Specify how a new or moved node asset is inserted into the tree.
if ($asset->parent_id != $parentId)
{
$asset->setLocation($parentId, 'last-child');
}
// Prepare the asset to be stored.
$asset->parent_id = $parentId;
$asset->name = $name;
$asset->title = $title;
// get the default asset rules
$rules = self::getDefaultAssetRules('com_componentbuilder',
$table, $inherit);
if ($rules instanceof AccessRules)
{
$asset->rules = (string) $rules;
}
if (!$asset->check() || !$asset->store())
{
Factory::getApplication()->enqueueMessage($asset->getError(),
'warning');
return false;
}
else
{
// Create an asset_id or heal one that is corrupted.
$object = new stdClass();
// Must be a valid primary key value.
$object->id = $id;
$object->asset_id = (int) $asset->id;
// Update their asset_id to link to the asset table.
return
Factory::getDbo()->updateObject('#__componentbuilder_'.$table,
$object, 'id');
}
}
return false;
}
/**
* Gets the default asset Rules for a component/view.
*/
protected static function getDefaultAssetRules($component, $view, $inherit
= true)
{
// if new or inherited
$assetId = 0;
// Only get the actual item rules if not inheriting
if (!$inherit)
{
// Need to find the asset id by the name of the component.
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' .
$db->quote($component));
$db->setQuery($query);
$db->execute();
// check that there is a value
if ($db->getNumRows())
{
// asset already set so use saved rules
$assetId = (int) $db->loadResult();
}
}
// get asset rules
$result = Access::getAssetRules($assetId);
if ($result instanceof AccessRules)
{
$_result = (string) $result;
$_result = json_decode($_result);
foreach ($_result as $name => &$rule)
{
$v = explode('.', $name);
if ($view !== $v[0])
{
// remove since it is not part of this view
unset($_result->$name);
}
elseif ($inherit)
{
// clear the value since we inherit
$rule = [];
}
}
// check if there are any view values remaining
if (count((array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);
// Instantiate and return the AccessRules object for the asset rules.
$rules = new AccessRules($_result);
// return filtered rules
return $rules;
}
}
return $result;
}
/**
* xmlAppend
*
* @param SimpleXMLElement $xml The XML element reference in
which to inject a comment
* @param mixed $node A SimpleXMLElement node to append
to the XML element reference, or a stdClass object containing a comment
attribute to be injected before the XML node and a fieldXML attribute
containing a SimpleXMLElement
*
* @return void
* @deprecated 3.3 Use FormHelper::append($xml, $node);
*/
public static function xmlAppend(&$xml, $node)
{
FormHelper::append($xml, $node);
}
/**
* xmlComment
*
* @param SimpleXMLElement $xml The XML element reference in
which to inject a comment
* @param string $comment The comment to inject
*
* @return void
* @deprecated 3.3 Use FormHelper::comment($xml, $comment);
*/
public static function xmlComment(&$xml, $comment)
{
FormHelper::comment($xml, $comment);
}
/**
* xmlAddAttributes
*
* @param SimpleXMLElement $xml The XML element reference in
which to inject a comment
* @param array $attributes The attributes to apply to
the XML element
*
* @return null
* @deprecated 3.3 Use FormHelper::attributes($xml, $attributes);
*/
public static function xmlAddAttributes(&$xml, $attributes = [])
{
FormHelper::attributes($xml, $attributes);
}
/**
* xmlAddOptions
*
* @param SimpleXMLElement $xml The XML element reference in
which to inject a comment
* @param array $options The options to apply to the
XML element
*
* @return void
* @deprecated 3.3 Use FormHelper::options($xml, $options);
*/
public static function xmlAddOptions(&$xml, $options = [])
{
FormHelper::options($xml, $options);
}
/**
* get the field object
*
* @param array $attributes The array of attributes
* @param string $default The default of the field
* @param array $options The options to apply to the XML
element
*
* @return object
* @deprecated 3.3 Use FormHelper::field($attributes, $default, $options);
*/
public static function getFieldObject(&$attributes, $default =
'', $options = null)
{
return FormHelper::field($attributes, $default, $options);
}
/**
* get the field xml
*
* @param array $attributes The array of attributes
* @param array $options The options to apply to the XML
element
*
* @return object
* @deprecated 3.3 Use FormHelper::xml($attributes, $options);
*/
public static function getFieldXML(&$attributes, $options = null)
{
return FormHelper::xml($attributes, $options);
}
/**
* Render Bool Button
*
* @param array $args All the args for the button
* 0) name
* 1) additional (options class) // not used
at this time
* 2) default
* 3) yes (name)
* 4) no (name)
*
* @return string The input html of the button
*
*/
public static function renderBoolButton()
{
$args = func_get_args();
// check if there is additional button class
$additional = isset($args[1]) ? (string) $args[1] : ''; // not
used at this time
// button attributes
$buttonAttributes = array(
'type' => 'radio',
'name' => isset($args[0]) ?
UtilitiesStringHelper::html($args[0]) : 'bool_button',
'label' => isset($args[0]) ?
UtilitiesStringHelper::safe(UtilitiesStringHelper::html($args[0]),
'Ww') : 'Bool Button', // not seen anyway
'class' => 'btn-group',
'filter' => 'INT',
'default' => isset($args[2]) ? (int) $args[2] : 0);
// set the button options
$buttonOptions = array(
'1' => isset($args[3]) ?
UtilitiesStringHelper::html($args[3]) : 'JYES',
'0' => isset($args[4]) ?
UtilitiesStringHelper::html($args[4]) : 'JNO');
// return the input
return FormHelper::field($buttonAttributes,
$buttonAttributes['default'], $buttonOptions)->input;
}
/**
* UIKIT Component Classes
**/
public static $uk_components = array(
'data-uk-grid' => array(
'grid' ),
'uk-accordion' => array(
'accordion' ),
'uk-autocomplete' => array(
'autocomplete' ),
'data-uk-datepicker' => array(
'datepicker' ),
'uk-form-password' => array(
'form-password' ),
'uk-form-select' => array(
'form-select' ),
'data-uk-htmleditor' => array(
'htmleditor' ),
'data-uk-lightbox' => array(
'lightbox' ),
'uk-nestable' => array(
'nestable' ),
'UIkit.notify' => array(
'notify' ),
'data-uk-parallax' => array(
'parallax' ),
'uk-search' => array(
'search' ),
'uk-slider' => array(
'slider' ),
'uk-slideset' => array(
'slideset' ),
'uk-slideshow' => array(
'slideshow',
'slideshow-fx' ),
'uk-sortable' => array(
'sortable' ),
'data-uk-sticky' => array(
'sticky' ),
'data-uk-timepicker' => array(
'timepicker' ),
'data-uk-tooltip' => array(
'tooltip' ),
'uk-placeholder' => array(
'placeholder' ),
'uk-dotnav' => array(
'dotnav' ),
'uk-slidenav' => array(
'slidenav' ),
'uk-form' => array(
'form-advanced' ),
'uk-progress' => array(
'progress' ),
'upload-drop' => array(
'upload', 'form-file' )
);
/**
* Add UIKIT Components
**/
public static $uikit = false;
/**
* Get UIKIT Components
**/
public static function getUikitComp($content,$classes = array())
{
if (strpos($content,'class="uk-') !== false)
{
// reset
$temp = [];
foreach (self::$uk_components as $looking => $add)
{
if (strpos($content,$looking) !== false)
{
$temp[] = $looking;
}
}
// make sure uikit is loaded to config
if (strpos($content,'class="uk-') !== false)
{
self::$uikit = true;
}
// sorter
if (UtilitiesArrayHelper::check($temp))
{
// merger
if (UtilitiesArrayHelper::check($classes))
{
$newTemp = array_merge($temp,$classes);
$temp = array_unique($newTemp);
}
return $temp;
}
}
if (UtilitiesArrayHelper::check($classes))
{
return $classes;
}
return false;
}
/**
* Get a variable
*
* @param string $table The table from which to get the
variable
* @param string $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field
and $where/value
* @param string $main The component in which the table is
found
*
* @return mix string/int/float
* @deprecated 3.3 Use GetHelper::var(...);
*/
public static function getVar($table, $where = null, $whereString =
'user', $what = 'id', $operator = '=', $main
= 'componentbuilder')
{
return GetHelper::var(
$table,
$where,
$whereString,
$what,
$operator,
$main
);
}
/**
* Get array of variables
*
* @param string $table The table from which to get the
variables
* @param string $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field
and $where/value
* @param string $main The component in which the table is
found
* @param bool $unique The switch to return a unique array
*
* @return array
* @deprecated 3.3 Use GetHelper::vars(...);
*/
public static function getVars($table, $where = null, $whereString =
'user', $what = 'id', $operator = 'IN', $main
= 'componentbuilder', $unique = true)
{
return GetHelper::vars(
$table,
$where,
$whereString,
$what,
$operator,
$main,
$unique
);
}
public static function isPublished($id,$type)
{
if ($type == 'raw')
{
$type = 'item';
}
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select(array('a.published'));
$query->from('#__componentbuilder_'.$type.' AS
a');
$query->where('a.id = '. (int) $id);
$query->where('a.published = 1');
$db->setQuery($query);
$db->execute();
$found = $db->getNumRows();
if($found)
{
return true;
}
return false;
}
public static function getGroupName($id)
{
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select(array('a.title'));
$query->from('#__usergroups AS a');
$query->where('a.id = '. (int) $id);
$db->setQuery($query);
$db->execute();
$found = $db->getNumRows();
if($found)
{
return $db->loadResult();
}
return $id;
}
/**
* Get the action permissions
*
* @param string $view The related view name
* @param int $record The item to act upon
* @param string $views The related list view name
* @param mixed $target Only get this permission (like edit,
create, delete)
* @param string $component The target component
* @param object $user The user whose permissions we are loading
*
* @return object The CMSObject of permission/authorised actions
*
*/
public static function getActions($view, &$record = null, $views =
null, $target = null, $component = 'componentbuilder', $user =
'null')
{
// load the user if not given
if (!ObjectHelper::check($user))
{
// get the user object
$user = Factory::getUser();
}
// load the CMSObject
$result = new CMSObject;
// make view name safe (just incase)
$view = UtilitiesStringHelper::safe($view);
if (UtilitiesStringHelper::check($views))
{
$views = UtilitiesStringHelper::safe($views);
}
// get all actions from component
$actions = Access::getActionsFromFile(
JPATH_ADMINISTRATOR . '/components/com_' . $component .
'/access.xml',
"/access/section[@name='component']/"
);
// if non found then return empty CMSObject
if (empty($actions))
{
return $result;
}
// get created by if not found
if (ObjectHelper::check($record) &&
!isset($record->created_by) && isset($record->id))
{
$record->created_by = GetHelper::var($view, $record->id,
'id', 'created_by', '=', $component);
}
// set actions only set in component settings
$componentActions = array('core.admin',
'core.manage', 'core.options',
'core.export');
// check if we have a target
$checkTarget = false;
if ($target)
{
// convert to an array
if (UtilitiesStringHelper::check($target))
{
$target = array($target);
}
// check if we are good to go
if (UtilitiesArrayHelper::check($target))
{
$checkTarget = true;
}
}
// loop the actions and set the permissions
foreach ($actions as $action)
{
// check target action filter
if ($checkTarget && self::filterActions($view, $action->name,
$target))
{
continue;
}
// set to use component default
$fallback = true;
// reset permission per/action
$permission = false;
$catpermission = false;
// set area
$area = 'comp';
// check if the record has an ID and the action is item related (not a
component action)
if (ObjectHelper::check($record) && isset($record->id)
&& $record->id > 0 && !in_array($action->name,
$componentActions) &&
(strpos($action->name, 'core.') !== false ||
strpos($action->name, $view . '.') !== false))
{
// we are in item
$area = 'item';
// The record has been set. Check the record permissions.
$permission = $user->authorise($action->name, 'com_' .
$component . '.' . $view . '.' . (int) $record->id);
// if no permission found, check edit own
if (!$permission)
{
// With edit, if the created_by matches current user then dig deeper.
if (($action->name === 'core.edit' || $action->name
=== $view . '.edit') && $record->created_by > 0
&& ($record->created_by == $user->id))
{
// the correct target
$coreCheck = (array) explode('.', $action->name);
// check that we have both local and global access
if ($user->authorise($coreCheck[0] . '.edit.own',
'com_' . $component . '.' . $view . '.' .
(int) $record->id) &&
$user->authorise($coreCheck[0] . '.edit.own',
'com_' . $component))
{
// allow edit
$result->set($action->name, true);
// set not to use global default
// because we already validated it
$fallback = false;
}
else
{
// do not allow edit
$result->set($action->name, false);
$fallback = false;
}
}
}
elseif (UtilitiesStringHelper::check($views) &&
isset($record->catid) && $record->catid > 0)
{
// we are in item
$area = 'category';
// set the core check
$coreCheck = explode('.', $action->name);
$core = $coreCheck[0];
// make sure we use the core. action check for the categories
if (strpos($action->name, $view) !== false &&
strpos($action->name, 'core.') === false )
{
$coreCheck[0] = 'core';
$categoryCheck = implode('.', $coreCheck);
}
else
{
$categoryCheck = $action->name;
}
// The record has a category. Check the category permissions.
$catpermission = $user->authorise($categoryCheck, 'com_'
. $component . '.' . $views . '.category.' . (int)
$record->catid);
if (!$catpermission && !is_null($catpermission))
{
// With edit, if the created_by matches current user then dig deeper.
if (($action->name === 'core.edit' || $action->name
=== $view . '.edit') && $record->created_by > 0
&& ($record->created_by == $user->id))
{
// check that we have both local and global access
if ($user->authorise('core.edit.own', 'com_'
. $component . '.' . $views . '.category.' . (int)
$record->catid) &&
$user->authorise($core . '.edit.own', 'com_'
. $component))
{
// allow edit
$result->set($action->name, true);
// set not to use global default
// because we already validated it
$fallback = false;
}
else
{
// do not allow edit
$result->set($action->name, false);
$fallback = false;
}
}
}
}
}
// if allowed then fallback on component global settings
if ($fallback)
{
// if item/category blocks access then don't fall back on global
if ((($area === 'item') && !$permission) || (($area
=== 'category') && !$catpermission))
{
// do not allow
$result->set($action->name, false);
}
// Finally remember the global settings have the final say. (even if
item allow)
// The local item permissions can block, but it can't open and
override of global permissions.
// Since items are created by users and global permissions is set by
system admin.
else
{
$result->set($action->name,
$user->authorise($action->name, 'com_' . $component));
}
}
}
return $result;
}
/**
* Filter the action permissions
*
* @param string $action The action to check
* @param array $targets The array of target actions
*
* @return boolean true if action should be filtered out
*
*/
protected static function filterActions(&$view, &$action,
&$targets)
{
foreach ($targets as $target)
{
if (strpos($action, $view . '.' . $target) !== false ||
strpos($action, 'core.' . $target) !== false)
{
return false;
break;
}
}
return true;
}
/**
* Check if have an json string
*
* @input string The json string to check
*
* @returns bool true on success
* @deprecated 3.3 Use JsonHelper::check($string);
*/
public static function checkJson($string)
{
return JsonHelper::check($string);
}
/**
* Check if have an object with a length
*
* @input object The object to check
*
* @returns bool true on success
* @deprecated 3.3 Use ObjectHelper::check($object);
*/
public static function checkObject($object)
{
return ObjectHelper::check($object);
}
/**
* Check if have an array with a length
*
* @input array The array to check
*
* @returns bool/int number of items in array on success
* @deprecated 3.3 Use UtilitiesArrayHelper::check($array,
$removeEmptyString);
*/
public static function checkArray($array, $removeEmptyString = false)
{
return UtilitiesArrayHelper::check($array, $removeEmptyString);
}
/**
* Check if have a string with a length
*
* @input string The string to check
*
* @returns bool true on success
* @deprecated 3.3 Use UtilitiesStringHelper::check($string);
*/
public static function checkString($string)
{
return UtilitiesStringHelper::check($string);
}
/**
* Check if we are connected
* Thanks https://stackoverflow.com/a/4860432/1429677
*
* @returns bool true on success
*/
public static function isConnected()
{
// If example.com is down, then probably the whole internet is down,
since IANA maintains the domain. Right?
$connected = @fsockopen("www.example.com", 80);
// website, port (try 80 or 443)
if ($connected)
{
//action when connected
$is_conn = true;
fclose($connected);
}
else
{
//action in connection failure
$is_conn = false;
}
return $is_conn;
}
/**
* Merge an array of array's
*
* @input array The arrays you would like to merge
*
* @returns array on success
* @deprecated 3.3 Use UtilitiesArrayHelper::merge($arrays);
*/
public static function mergeArrays($arrays)
{
return UtilitiesArrayHelper::merge($arrays);
}
// typo sorry!
public static function sorten($string, $length = 40, $addTip = true)
{
return self::shorten($string, $length, $addTip);
}
/**
* Shorten a string
*
* @input string The you would like to shorten
*
* @returns string on success
* @deprecated 3.3 Use UtilitiesStringHelper::shorten(...);
*/
public static function shorten($string, $length = 40, $addTip = true)
{
return UtilitiesStringHelper::shorten($string, $length, $addTip);
}
/**
* Making strings safe (various ways)
*
* @input string The you would like to make safe
*
* @returns string on success
* @deprecated 3.3 Use UtilitiesStringHelper::safe(...);
*/
public static function safeString($string, $type = 'L', $spacer
= '_', $replaceNumbers = true, $keepOnlyCharacters = true)
{
return UtilitiesStringHelper::safe(
$string,
$type,
$spacer,
$replaceNumbers,
$keepOnlyCharacters
);
}
/**
* Convert none English strings to code usable string
*
* @input an string
*
* @returns a string
* @deprecated 3.3 Use UtilitiesStringHelper::transliterate($string);
*/
public static function transliterate($string)
{
return UtilitiesStringHelper::transliterate($string);
}
/**
* make sure a string is HTML save
*
* @input an html string
*
* @returns a string
* @deprecated 3.3 Use UtilitiesStringHelper::html(...);
*/
public static function htmlEscape($var, $charset = 'UTF-8',
$shorten = false, $length = 40)
{
return UtilitiesStringHelper::html(
$var,
$charset,
$shorten,
$length
);
}
/**
* Convert all int in a string to an English word string
*
* @input an string with numbers
*
* @returns a string
* @deprecated 3.3 Use UtilitiesStringHelper::numbers($string);
*/
public static function replaceNumbers($string)
{
return UtilitiesStringHelper::numbers($string);
}
/**
* Convert an integer into an English word string
* Thanks to Tom Nicholson
<http://php.net/manual/en/function.strval.php#41988>
*
* @input an int
* @returns a string
* @deprecated 3.3 Use UtilitiesStringHelper::number($x);
*/
public static function numberToString($x)
{
return UtilitiesStringHelper::number($x);
}
/**
* Random Key
*
* @returns a string
* @deprecated 3.3 Use UtilitiesStringHelper::random($size);
*/
public static function randomkey($size)
{
return UtilitiesStringHelper::random($size);
}
/**
* Get The Encryption Keys
*
* @param string $type The type of key
* @param string/bool $default The return value if no key was found
*
* @return string On success
*
**/
public static function getCryptKey($type, $default = false)
{
// Get the global params
$params = ComponentHelper::getParams('com_componentbuilder',
true);
// Basic Encryption Type
if ('basic' === $type)
{
$basic_key = $params->get('basic_key', $default);
if (UtilitiesStringHelper::check($basic_key))
{
return $basic_key;
}
}
return $default;
}
}
PK�F�[}7�,com_componentbuilder/helpers/headercheck.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
class componentbuilderHeaderCheck
{
protected $document = null;
protected $app = null;
function js_loaded($script_name)
{
// UIkit check point
if (strpos($script_name,'uikit') !== false)
{
if (!$this->app)
{
$this->app = Factory::getApplication();
}
$getTemplateName =
$this->app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false)
{
return true;
}
}
if (!$this->document)
{
$this->document = Factory::getDocument();
}
$head_data = $this->document->getHeadData();
foreach (array_keys($head_data['scripts']) as $script)
{
if (stristr($script, $script_name))
{
return true;
}
}
return false;
}
function css_loaded($script_name)
{
// UIkit check point
if (strpos($script_name,'uikit') !== false)
{
if (!$this->app)
{
$this->app = Factory::getApplication();
}
$getTemplateName =
$this->app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false)
{
return true;
}
}
if (!$this->document)
{
$this->document = Factory::getDocument();
}
$head_data = $this->document->getHeadData();
foreach (array_keys($head_data['styleSheets']) as $script)
{
if (stristr($script, $script_name))
{
return true;
}
}
return false;
}
}PK�F�[�#o,,'com_componentbuilder/helpers/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�F�[v�R,com_componentbuilder/helpers/powerloader.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die;
// add the autoloader for the composer classes
$composer_autoloader = JPATH_LIBRARIES .
'/phpseclib3/vendor/autoload.php';
if (file_exists($composer_autoloader))
{
require_once $composer_autoloader;
}
// register additional namespace
spl_autoload_register(function ($class) {
// project-specific base directories and namespace prefix
$search = [
'libraries/vendor_jcb/VDM.Joomla.Gitea' =>
'VDM\\Joomla\\Gitea',
'libraries/vendor_jcb/VDM.Joomla.FOF' =>
'VDM\\Joomla\\FOF',
'libraries/vendor_jcb/VDM.Joomla' =>
'VDM\\Joomla',
'libraries/vendor_jcb/VDM.Minify' =>
'VDM\\Minify',
'libraries/vendor_jcb/VDM.Psr' => 'VDM\\Psr'
];
// Start the search and load if found
$found = false;
$found_base_dir = "";
$found_len = 0;
foreach ($search as $base_dir => $prefix)
{
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) === 0)
{
// we have a match so load the values
$found = true;
$found_base_dir = $base_dir;
$found_len = $len;
// done here
break;
}
}
// check if we found a match
if (!$found)
{
// not found so move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $found_len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = JPATH_ROOT . '/' . $found_base_dir . '/src' .
str_replace('\\', '/', $relative_class) .
'.php';
// if the file exists, require it
if (file_exists($file))
{
require $file;
}
});
PK�F�[��{��&com_componentbuilder/helpers/route.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Categories\CategoryNode;
use Joomla\CMS\Categories\Categories;
use VDM\Joomla\Utilities\ArrayHelper;
/**
* Componentbuilder Route Helper
**/
abstract class ComponentbuilderHelperRoute
{
protected static $lookup;
/**
* @param int The route of the Api
*/
public static function getApiRoute($id = 0, $catid = 0)
{
if ($id > 0)
{
// Initialize the needel array.
$needles = array(
'api' => array((int) $id)
);
// Create the link
$link =
'index.php?option=com_componentbuilder&view=api&id='.
$id;
}
else
{
// Initialize the needel array.
$needles = array(
'api' => array()
);
// Create the link but don't add the id.
$link = 'index.php?option=com_componentbuilder&view=api';
}
if ($catid > 1)
{
$categories = Categories::getInstance('componentbuilder.api');
$category = $categories->get($catid);
if ($category)
{
$needles['category'] =
array_reverse($category->getPath());
$needles['categories'] = $needles['category'];
$link .= '&catid='.$catid;
}
}
if ($item = self::_findItem($needles))
{
$link .= '&Itemid='.$item;
}
return $link;
}
/**
* Get the URL route for componentbuilder category from a category ID and
language
*
* @param mixed $catid The id of the items's category either
an integer id or a instance of CategoryNode
* @param mixed $language The id of the language being used.
*
* @return string The link to the contact
*
* @since 1.5
*/
public static function getCategoryRoute_keep_for_later($catid, $language =
0)
{
if ($catid instanceof CategoryNode)
{
$id = $catid->id;
$category = $catid;
}
else
{
throw new Exception('First parameter must be CategoryNode');
}
$views = array(
"com_componentbuilder.field" => "field",
"com_componentbuilder.fieldtype" => "fieldtype");
$view = $views[$category->extension];
if ($id < 1 || !($category instanceof CategoryNode))
{
$link = '';
}
else
{
//Create the link
$link =
'index.php?option=com_componentbuilder&view='.$view.'&category='.$category->slug;
$needles = array(
$view => array($id),
'category' => array($id)
);
if ($language && $language != "*" &&
Multilanguage::isEnabled())
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('a.sef AS sef')
->select('a.lang_code AS lang_code')
->from('#__languages AS a');
$db->setQuery($query);
$langs = $db->loadObjectList();
foreach ($langs as $lang)
{
if ($language == $lang->lang_code)
{
$link .= '&lang='.$lang->sef;
$needles['language'] = $language;
}
}
}
if ($item = self::_findItem($needles,'category'))
{
$link .= '&Itemid='.$item;
}
else
{
if ($category)
{
$catids = array_reverse($category->getPath());
$needles = array(
'category' => $catids
);
if ($item = self::_findItem($needles,'category'))
{
$link .= '&Itemid='.$item;
}
elseif ($item = self::_findItem(null, 'category'))
{
$link .= '&Itemid='.$item;
}
}
}
}
return $link;
}
protected static function _findItem($needles = null,$type = null)
{
$app = Factory::getApplication();
$menus = $app->getMenu('site');
$language = isset($needles['language']) ?
$needles['language'] : '*';
// Prepare the reverse lookup array.
if (!isset(self::$lookup[$language]))
{
self::$lookup[$language] = [];
$component =
ComponentHelper::getComponent('com_componentbuilder');
$attributes = array('component_id');
$values = array($component->id);
if ($language != '*')
{
$attributes[] = 'language';
$values[] = array($needles['language'], '*');
}
$items = $menus->getItems($attributes, $values);
foreach ($items as $item)
{
if (isset($item->query) &&
isset($item->query['view']))
{
$view = $item->query['view'];
if (!isset(self::$lookup[$language][$view]))
{
self::$lookup[$language][$view] = [];
}
if (isset($item->query['id']))
{
/**
* Here it will become a bit tricky
* language != * can override existing entries
* language == * cannot override existing entries
*/
if
(!isset(self::$lookup[$language][$view][$item->query['id']])
|| $item->language != '*')
{
self::$lookup[$language][$view][$item->query['id']] =
$item->id;
}
}
else
{
self::$lookup[$language][$view][0] = $item->id;
}
}
}
}
if ($needles)
{
foreach ($needles as $view => $ids)
{
if (isset(self::$lookup[$language][$view]))
{
if (ArrayHelper::check($ids))
{
foreach ($ids as $id)
{
if (isset(self::$lookup[$language][$view][(int) $id]))
{
return self::$lookup[$language][$view][(int) $id];
}
}
}
elseif (isset(self::$lookup[$language][$view][0]))
{
return self::$lookup[$language][$view][0];
}
}
}
}
if ($type)
{
// Check if the global menu item has been set.
$params = ComponentHelper::getParams('com_componentbuilder');
if ($item = $params->get($type.'_menu', 0))
{
return $item;
}
}
// Check if the active menuitem matches the requested language
$active = $menus->getActive();
if ($active
&& $active->component == 'com_componentbuilder'
&& ($language == '*' || in_array($active->language,
array('*', $language)) || !Multilanguage::isEnabled()))
{
return $active->id;
}
// If not found, return language specific home link
$default = $menus->getDefault($language);
return !empty($default->id) ? $default->id : null;
}
}
PK�F�[Q1 �O�O(com_componentbuilder/controllers/api.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Component\ComponentHelper;
/**
* Componentbuilder Api Form Controller
*/
class ComponentbuilderControllerApi extends FormController
{
/**
* Current or most recently performed task.
*
* @var string
* @since 12.2
* @note Replaces _task.
*/
protected $task;
public function __construct($config = [])
{
$this->view_list = ''; // safeguard for setting the return
view listing to the default site view.
parent::__construct($config);
}
/**
* The methods that are allowed to be called
*
* @var array
*/
protected $allowedMethods = array('compileInstall',
'translate');
/**
* The local methods that should be triggered
*
* @var array
*/
protected $localMethodTrigger = array('compileInstall' =>
'_autoloader');
/**
* Run the Translator
*
* @return mix
*/
public function translator()
{
// get params first
if (!isset($this->params) || !ObjectHelper::check($this->params))
{
$this->params =
ComponentHelper::getParams('com_componentbuilder');
}
// get model
$model = $this->getModel('api');
// check if user has the right
$user = $this->getApiUser();
// get components that have translation tools
if ($user->authorise('core.admin',
'com_componentbuilder') && ($components =
$model->getTranslationLinkedComponents()) !== false)
{
// the message package
$message = array();
// make sure to not unlock
$unlock = false;
// get messages
$callback = function($messages) use (&$message, &$unlock) {
// unlock messages if needed
if ($unlock) {
$messages = ComponentbuilderHelper::unlock($messages);
}
// check if we have any messages
if (UtilitiesArrayHelper::check($messages)) {
$message[] = implode("<br />\n", $messages);
} else {
// var_dump($messages); // error debug message
}
};
// we have two options, doing them one at a time, or using curl to do
them somewhat asynchronously
if (count ( (array) $components) > 1 &&
function_exists('curl_version'))
{
// line up the translations
foreach ($components as $component)
{
ComponentbuilderHelper::setWorker($component, 'translate');
}
// make sure to unlock
$unlock = true;
// run workers
ComponentbuilderHelper::runWorker('translate', 1,
$callback);
}
else
{
foreach ($components as $component)
{
$model->translate($component);
}
// check if we have any messages
$callback($model->messages);
}
// return messages if found
if (UtilitiesArrayHelper::check($message))
{
echo implode("<br />\n", $message);
}
else
{
echo 1;
}
// clear session
Factory::getApplication()->getSession()->destroy();
jexit();
}
// clear session
Factory::getApplication()->getSession()->destroy();
// return bool
echo 0;
jexit();
}
/**
* Run the Expansion
*
* @return mix
*/
public function expand()
{
// get params first
if (!isset($this->params) || !ObjectHelper::check($this->params))
{
$this->params =
ComponentHelper::getParams('com_componentbuilder');
}
// check if expansion is enabled
$method = $this->params->get('development_method', 1);
// check what kind of return values show we give
$returnOptionsBuild =
$this->params->get('return_options_build', 2);
if (2 == $method)
{
// get expansion components
$expansion = $this->params->get('expansion', null);
// check if they are set
if (ObjectHelper::check($expansion))
{
// check if user has the right
$user = $this->getApiUser();
// the message package
$message = array();
if ($user->authorise('core.admin',
'com_componentbuilder'))
{
// make sure to not unlock
$unlock = false;
// get messages
$callback = function($messages) use (&$message, &$unlock) {
// unlock messages if needed
if ($unlock) {
$messages = ComponentbuilderHelper::unlock($messages);
}
// check if we have any messages
if (UtilitiesArrayHelper::check($messages)) {
$message[] = implode("<br />\n", $messages);
} else {
// var_dump($messages); // error debug message
}
};
// we have two options, doing them one at a time, or using curl to do
them somewhat asynchronously
if (count ( (array) $expansion) > 1 &&
function_exists('curl_version'))
{
// set workers
foreach ($expansion as $component)
{
ComponentbuilderHelper::setWorker($component,
'compileInstall');
}
// make sure to unlock
$unlock = true;
// run workers
ComponentbuilderHelper::runWorker('compileInstall', 1,
$callback);
}
else
{
// get model
$model = $this->getModel('api');
// load the compiler
$this->_autoloader();
// set workers
foreach ($expansion as $component)
{
// compile and install
$model->compileInstall($component);
}
// check if we have any messages
$callback($model->messages);
}
// return messages if found
if (1== $returnOptionsBuild &&
UtilitiesArrayHelper::check($message))
{
echo implode("<br />\n", $message);
}
else
{
echo 1;
}
// clear session
Factory::getApplication()->getSession()->destroy();
jexit();
}
// check if message is to be returned
if (1== $returnOptionsBuild)
{
// clear session
Factory::getApplication()->getSession()->destroy();
jexit('Access Denied!');
}
}
}
// clear session
Factory::getApplication()->getSession()->destroy();
// check if message is to be returned
if (1== $returnOptionsBuild)
{
jexit('Expansion Disabled! Expansion can be enabled by your system
administrator in the global Options of JCB under the Development Method
tab.');
}
// return bool
echo 0;
jexit();
}
/**
* Get API User
*
* @return object
*/
protected function getApiUser()
{
// return user object
return Factory::getUser($this->params->get('api', 0,
'INT'));
}
/**
* Load the needed script
*
* @return void
*/
protected function _autoloader()
{
// include component compiler
require_once
JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/compiler.php';
}
public function backup()
{
// get params first
if (!isset($this->params) || !ObjectHelper::check($this->params))
{
$this->params =
ComponentHelper::getParams('com_componentbuilder');
}
// Get the model
$model = componentbuilderHelper::getModel('joomla_components',
JPATH_ADMINISTRATOR . '/components/com_componentbuilder');
// set user
$model->user = $this->getApiUser();
// make sure to set active type (adding this script from custom code :)
$model->activeType = 'backup';
// check if export is allowed for this user. (we need this sorry)
if
($model->user->authorise('joomla_component.export_jcb_packages',
'com_componentbuilder') &&
$model->user->authorise('core.export',
'com_componentbuilder'))
{
// get all component IDs to backup
$pks = componentbuilderHelper::getComponentIDs();
// set auto loader
ComponentbuilderHelper::autoLoader('smart');
// manual backup message
$backupNotice = [];
// get the data to export
if (UtilitiesArrayHelper::check($pks) &&
$model->getSmartExport($pks))
{
$backupNotice[] =
Text::_('COM_COMPONENTBUILDER_BACKUP_WAS_DONE_SUCCESSFULLY');
$backupNoticeStatus = 'Success';
// set the key string
if (StringHelper::check($model->key) &&
strlen($model->key) == 32)
{
$textNotice = array();
$keyNotice = '<h1>' .
Text::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE',
$model->key) . '</h1>';
$keyNotice .= '<p>' .
Text::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_TWO_HUNDRED_AND_FIFTY_SIX_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY')
. '</p>';
$textNotice[] =
Text::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S',
$model->key);
// set the package owner info
if
((isset($model->info['getKeyFrom']['company'])
&&
StringHelper::check($model->info['getKeyFrom']['company']))
|| (isset($model->info['getKeyFrom']['owner'])
&&
StringHelper::check($model->info['getKeyFrom']['owner'])))
{
$ownerDetails = '<h2>' .
Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') .
'</h2>';
$textNotice[] = '# ' .
Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS');
$ownerDetails .= '<ul>';
if
(isset($model->info['getKeyFrom']['company'])
&&
StringHelper::check($model->info['getKeyFrom']['company']))
{
$ownerDetails .= '<li>' .
Text::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB',
$model->info['getKeyFrom']['company']) .
'</li>';
$textNotice[] = '- ' .
Text::sprintf('COM_COMPONENTBUILDER_COMPANY_S',
$model->info['getKeyFrom']['company']);
}
// add value only if set
if (isset($model->info['getKeyFrom']['owner'])
&&
StringHelper::check($model->info['getKeyFrom']['owner']))
{
$ownerDetails .= '<li>' .
Text::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB',
$model->info['getKeyFrom']['owner']) .
'</li>';
$textNotice[] = '- ' .
Text::sprintf('COM_COMPONENTBUILDER_OWNER_S',
$model->info['getKeyFrom']['owner']);
}
// add value only if set
if
(isset($model->info['getKeyFrom']['website'])
&&
StringHelper::check($model->info['getKeyFrom']['website']))
{
$ownerDetails .= '<li>' .
Text::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB',
$model->info['getKeyFrom']['website']) .
'</li>';
$textNotice[] = '- ' .
Text::sprintf('COM_COMPONENTBUILDER_WEBSITE_S',
$model->info['getKeyFrom']['website']);
}
// add value only if set
if (isset($model->info['getKeyFrom']['email'])
&&
StringHelper::check($model->info['getKeyFrom']['email']))
{
$ownerDetails .= '<li>' .
Text::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB',
$model->info['getKeyFrom']['email']) .
'</li>';
$textNotice[] = '- ' .
Text::sprintf('COM_COMPONENTBUILDER_EMAIL_S',
$model->info['getKeyFrom']['email']);
}
// add value only if set
if
(isset($model->info['getKeyFrom']['license'])
&&
StringHelper::check($model->info['getKeyFrom']['license']))
{
$ownerDetails .= '<li>' .
Text::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB',
$model->info['getKeyFrom']['license']) .
'</li>';
$textNotice[] = '- ' .
Text::sprintf('COM_COMPONENTBUILDER_LICENSE_S',
$model->info['getKeyFrom']['license']);
}
// add value only if set
if
(isset($model->info['getKeyFrom']['copyright'])
&&
StringHelper::check($model->info['getKeyFrom']['copyright']))
{
$ownerDetails .= '<li>' .
Text::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB',
$model->info['getKeyFrom']['copyright']) .
'</li>';
$textNotice[] = '- ' .
Text::sprintf('COM_COMPONENTBUILDER_COPYRIGHT_S',
$model->info['getKeyFrom']['copyright']);
}
$ownerDetails .= '</ul>';
$backupNotice[] =
Text::_('COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET');
}
else
{
$ownerDetails = '<h2>' .
Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') .
'</h2>';
$textNotice[] = '# ' .
Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS');
$ownerDetails .=
Text::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE')
. '<br />';
$textNotice[] =
Text::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE');
$ownerDetails .= '<h3>' .
Text::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS')
. '</h3>';
$textNotice[] = '## ' .
Text::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS');
$ownerDetails .=
Text::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB')
. '<br />';
$textNotice[] =
Text::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT');
$backupNotice[] =
Text::_('COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE');
}
}
else
{
$keyNotice = '<h1>' .
Text::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') .
'</h1>';
$textNotice[] = '# ' .
Text::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY');
$ownerDetails =
Text::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB')
. '<br />';
$textNotice[] =
Text::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY');
$backupNotice[] =
Text::_('COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY');
}
// get email
if ($email = $this->params->get('backup_email', null))
{
// plain text
$plainText = implode("\n", $textNotice);
// set hash to track changes
$hashTracker = md5($plainText);
if (ComponentbuilderHelper::newHash($hashTracker))
{
// Build final massage.
$message = $keyNotice . $ownerDetails . '<br
/><small>HASH: ' . $hashTracker .
'</small>';
// set the subject
$subject =
Text::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY');
// email the message
componentbuilderEmail::send($email, $subject,
componentbuilderEmail::setTableBody($message, $subject), $plainText, 1);
$backupNotice[] =
Text::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SENT');
}
else
{
$backupNotice[] =
Text::_('COM_COMPONENTBUILDER_KEY_HAS_NOT_CHANGED');
}
}
}
else
{
$backupNotice[] =
Text::_('COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR');
$backupNoticeStatus = 'Error';
if (StringHelper::check($model->packagePath))
{
// clear all if not successful
ComponentbuilderHelper::removeFolder($model->packagePath);
}
if (StringHelper::check($model->zipPath))
{
// clear all if not successful
File::delete($model->zipPath);
}
}
// quite only if auto backup (adding this script from custom code :)
if ('backup' === $model->activeType)
{
echo "# " . $backupNoticeStatus . "\n"
.implode("\n", $backupNotice);
// clear session
Factory::getApplication()->getSession()->destroy();
jexit();
}
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components',
false), implode("<br />", $backupNotice),
$backupNoticeStatus);
return;
}
// quite only if auto backup (adding this script from custom code :)
if ('backup' === $model->activeType)
{
echo "# Error\n" .
Text::_('COM_COMPONENTBUILDER_ACCESS_DENIED');
// clear session
Factory::getApplication()->getSession()->destroy();
jexit();
}
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components',
false), Text::_('COM_COMPONENTBUILDER_ACCESS_DENIED'),
'Error');
return;
}
/**
* Run worker request
*
* @return mix
*/
public function worker()
{
// get input values
$input = Factory::getApplication()->input;
// get DATA
$DATA = $input->post->get('VDM_DATA', null,
'STRING');
// get TASK
$TASK = $input->server->get('HTTP_VDM_TASK', null,
'STRING');
// get TYPE
$TYPE = $input->server->get('HTTP_VDM_VALUE_TYPE', null,
'STRING');
// check if correct value is given
if (StringHelper::check($DATA) && StringHelper::check($TASK)
&& StringHelper::check($TYPE))
{
// get the type of values we are working with ( 2 = array; 1 = string)
$type = ComponentbuilderHelper::unlock($TYPE);
// get data value
$dataValues = ComponentbuilderHelper::unlock($DATA);
// get the task
$task = ComponentbuilderHelper::unlock($TASK);
// check the for a string
if (1 == $type && ObjectHelper::check($dataValues) &&
StringHelper::check($task))
{
// get model
$model = $this->getModel('api');
// check if allowed and method exist and is callable
if (in_array($task, $this->allowedMethods) &&
method_exists($model, $task) && is_callable(array($model, $task)))
{
// trigger local method
if (isset($this->localMethodTrigger[$task]))
{
// run the local method
$this->{$this->localMethodTrigger[$task]}();
}
// run the model method
$result = $model->{$task}($dataValues);
// check if we have messages
if (UtilitiesArrayHelper::check($model->messages))
{
// return locked values
echo ComponentbuilderHelper::lock($model->messages);
// clear session
Factory::getApplication()->getSession()->destroy();
jexit();
}
elseif ($result)
{
echo 1;
// clear session
Factory::getApplication()->getSession()->destroy();
jexit();
}
}
}
}
// not success
echo 0;
// clear session
Factory::getApplication()->getSession()->destroy();
jexit();
}
/**
* Method to check if you can edit an existing record.
*
* Extended classes can override this if necessary.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key;
default is id.
*
* @return boolean
*
* @since 12.2
*/
protected function allowEdit($data = [], $key = 'id')
{
// to insure no other tampering
return false;
}
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 1.6
*/
protected function allowAdd($data = [])
{
// to insure no other tampering
return false;
}
/**
* Method to check if you can save a new or existing record.
*
* Extended classes can override this if necessary.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 12.2
*/
protected function allowSave($data, $key = 'id')
{
// to insure no other tampering
return false;
}
/**
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param BaseDatabaseModel &$model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 11.1
*/
protected function postSaveHook(BaseDatabaseModel $model, $validData = [])
{
}
}
PK�F�[�R�
�
)com_componentbuilder/controllers/help.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Session\Session;
use Joomla\Utilities\ArrayHelper;
/**
* Componentbuilder Help Base Controller
*/
class ComponentbuilderControllerHelp extends BaseController
{
public function __construct($config)
{
parent::__construct($config);
// load the tasks
$this->registerTask('getText', 'help');
}
public function help()
{
$user = Factory::getUser();
$jinput = Factory::getApplication()->input;
// Check Token!
$token = Session::getFormToken();
$call_token = $jinput->get('token', 0,
'ALNUM');
if($user->id != 0 && ($jinput->get($token, 0,
'ALNUM') || $token === $call_token))
{
$task = $this->getTask();
switch($task){
case 'getText':
try
{
$idValue = $jinput->get('id', 0, 'INT');
if($idValue)
{
$result = $this->getHelpDocumentText($idValue);
}
else
{
$result = '';
}
echo $result;
// stop execution gracefully
jexit();
}
catch(Exception $e)
{
// stop execution gracefully
jexit();
}
break;
}
}
else
{
// stop execution gracefully
jexit();
}
}
protected function getHelpDocumentText($id)
{
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select(array('a.title','a.content'));
$query->from('#__componentbuilder_help_document AS a');
$query->where('a.id = '.(int) $id);
$query->where('a.published = 1');
$query->where('a.location = 2');
$db->setQuery($query);
$db->execute();
if($db->getNumRows())
{
$text = [];
$document = $db->loadObject();
// fix image issue
$images['src="images'] =
'src="'.Uri::root().'images';
$images["src='images"] =
"src='".Uri::root()."images";
$images['src="/images'] =
'src="'.Uri::root().'images';
$images["src='/images"] =
"src='".Uri::root()."images";
// set document template
$text[] = "<!doctype html>";
$text[] = '<html>';
$text[] = "<head>";
$text[] = '<meta charset="utf-8">';
$text[] =
"<title>".$document->title."</title>";
$text[] = '<link type="text/css"
href="'.Uri::root().'media/com_componentbuilder/uikit/css/uikit.gradient.min.css"
rel="stylesheet"></link>';
$text[] = '<script type="text/javascript"
src="'.Uri::root().'media/com_componentbuilder/uikit/js/uikit.min.js"></script>';
$text[] = "</head>";
$text[] = '<body><br />';
$text[] = '<div class="uk-container uk-container-center
uk-grid-collapse">';
$text[] = '<div class="uk-panel uk-width-1-1 uk-panel-box
uk-panel-box-primary">';
// build the help text
$text[] = '<h1
class="uk-panel-title">'.$document->title."</h1>";
$text[] =
str_replace(array_keys($images),array_values($images),$document->content);
// end template
$text[] = '</div><br /><br />';
$text[] = '</div>';
$text[] = "</body>";
$text[] = "</html>";
return implode("\n",$text);
}
return false;
}
}
PK�F�[�#o,,+com_componentbuilder/controllers/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�F�[C����
� #com_componentbuilder/models/api.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\MVC\Model\ItemModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\GetHelper;
/**
* Componentbuilder Api Item Model
*/
class ComponentbuilderModelApi extends ItemModel
{
/**
* Model context string.
*
* @var string
*/
protected $_context = 'com_componentbuilder.api';
/**
* Model user data.
*
* @var strings
*/
protected $user;
protected $userId;
protected $guest;
protected $groups;
protected $levels;
protected $app;
protected $input;
protected $uikitComp;
/**
* @var object item
*/
protected $item;
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*
* @return void
*/
protected function populateState()
{
$this->app = Factory::getApplication();
$this->input = $this->app->input;
// Get the itme main id
$id = $this->input->getInt('id', null);
$this->setState('api.id', $id);
// Load the parameters.
$params = $this->app->getParams();
$this->setState('params', $params);
parent::populateState();
}
/**
* Method to get article data.
*
* @param integer $pk The id of the article.
*
* @return mixed Menu item data object on success, false on failure.
*/
public function getItem($pk = null)
{
$this->user = Factory::getUser();
$this->userId = $this->user->get('id');
$this->guest = $this->user->get('guest');
$this->groups = $this->user->get('groups');
$this->authorisedGroups = $this->user->getAuthorisedGroups();
$this->levels = $this->user->getAuthorisedViewLevels();
$this->initSet = true;
$pk = (!empty($pk)) ? $pk : (int) $this->getState('api.id');
if ($this->_item === null)
{
$this->_item = [];
}
if (!isset($this->_item[$pk]))
{
try
{
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Get from #__componentbuilder_joomla_component as a
$query->select($db->quoteName(
array('a.ordering'),
array('ordering')));
$query->from($db->quoteName('#__componentbuilder_joomla_component',
'a'));
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a stdClass object.
$data = $db->loadObject();
if (empty($data))
{
$app = Factory::getApplication();
// If no data is found redirect to default page and show warning.
$app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_NOT_FOUND_OR_ACCESS_DENIED'),
'warning');
$app->redirect(Uri::root());
return false;
}
// set data object to item.
$this->_item[$pk] = $data;
}
catch (Exception $e)
{
if ($e->getCode() == 404)
{
// Need to go thru the error handler to allow Redirect to work.
JError::raiseError(404, $e->getMessage());
}
else
{
$this->setError($e);
$this->_item[$pk] = false;
}
}
}
return $this->_item[$pk];
}
/**
* Get the uikit needed components
*
* @return mixed An array of objects on success.
*
*/
public function getUikitComp()
{
if (isset($this->uikitComp) &&
UtilitiesArrayHelper::check($this->uikitComp))
{
return $this->uikitComp;
}
return false;
}
public $messages = array();
public $model;
protected $compiler;
public function getTranslationLinkedComponents()
{
// Get a db connection.
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// for now we only have crowdin
$query->select($db->quoteName(array('id',
'translation_tool', 'crowdin_account_api_key',
'crowdin_project_api_key'
,'crowdin_project_identifier', 'crowdin_username')));
$query->from($db->quoteName('#__componentbuilder_joomla_component'));
$query->where($db->quoteName('translation_tool') . '
> 0');
$query->where($db->quoteName('published') . ' >=
1');
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadObjectList();
}
return false;
}
public function translate($component)
{
$this->messages[] =
Text::_('COM_COMPONENTBUILDER_TRANSLATOR_MODULE_NOT_READYBR_THIS_AREA_IS_STILL_UNDER_PRODUCTION_HOPEFULLY_WITH_NEXT_UPDATE');
return false;
}
public function compileInstall($component)
{
$values = array(
'joomla_version' => 3,
'install' => 0,
'component_id' => 0,
'backup' => 0,
'repository' => 0,
'add_placeholders' => 0,
'debug_line_nr' => 0,
'minify' => 0
);
// set the values
foreach ($values as $key => $val)
{
if (isset($component->{$key}))
{
$values[$key] = $component->{$key};
}
}
// make sure we have a component
if (isset($values['component_id']) &&
$values['component_id'] > 1)
{
// make sure the component is published
$published = GetHelper::var('joomla_component', (int)
$values['component_id'], 'id', 'published');
// make sure the component is checked in
$checked_out = GetHelper::var('joomla_component', (int)
$values['component_id'], 'id',
'checked_out');
if (1 == $published && $checked_out == 0)
{
// load the config values
CFactory::_('Config')->loadArray($values, true);
// start up Compiler
$this->compiler = new Compiler();
if($this->compiler)
{
// component was compiled
$this->messages[] =
Text::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_SUCCESSFULLY_COMPILED',
$this->compiler->componentFolderName);
// get compiler model to run the installer
$model = ComponentbuilderHelper::getModel('compiler',
JPATH_COMPONENT_ADMINISTRATOR);
// now install components
if (1 == CFactory::_('Config')->install &&
$model->install($this->compiler->componentFolderName.'.zip'))
{
// component was installed
$this->messages[] =
Text::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_SUCCESSFULLY_INSTALLED_AND_REMOVED_FROM_TEMP_FOLDER',
$this->compiler->componentFolderName);
}
elseif (1 != CFactory::_('Config')->install)
{
jimport('joomla.filesystem.file');
$config = Factory::getConfig();
$package = $config->get('tmp_path') . '/' .
$this->compiler->componentFolderName.'.zip';
// just remove from temp
if (JFile::delete($package) && !is_file($package))
{
// component was installed
$this->messages[] =
Text::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_NOT_INSTALLED_BY_YOUR_REQUEST_AND_IS_ALSO_REMOVED_FROM_TEMP_FOLDER',
$this->compiler->componentFolderName);
}
else
{
// component was not installed
$this->messages[] =
Text::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_NOT_INSTALLED_BY_YOUR_REQUEST_AND_IS_STILL_IN_THE_TEMP_FOLDER',
$this->compiler->componentFolderName);
}
}
else
{
// component was not installed
$this->messages[] =
Text::sprintf('COM_COMPONENTBUILDER_THE_S_WAS_NOT_INSTALLED_AND_IS_STILL_IN_THE_TEMP_FOLDER',
$this->compiler->componentFolderName);
}
// get all the messages from application (TODO)
return true;
}
// set that the component was not found
$this->messages[] =
Text::_('COM_COMPONENTBUILDER_COMPONENT_DID_NOT_COMPILE');
return false;
}
// set that the component was not found
$this->messages[] =
Text::_('COM_COMPONENTBUILDER_COMPONENT_IS_NOT_PUBLISHED_OR_IS_CHECKED_OUT');
return false;
}
// set that the component was not found
$this->messages[] =
Text::_('COM_COMPONENTBUILDER_COMPONENT_WAS_NOT_FOUND');
return false;
}
}
PK�F�[�#o,,&com_componentbuilder/models/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�F�[�#o,,)com_componentbuilder/views/api/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�F�[����MM.com_componentbuilder/views/api/submitbutton.jsnu�[���/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
Joomla.submitbutton = function(task)
{
if (task == ''){
return false;
} else {
var action = task.split('.');
if (action[1] == 'cancel' || action[1] == 'close' ||
document.formvalidator.isValid(document.getElementById("adminForm"))){
Joomla.submitform(task, document.getElementById("adminForm"));
return true;
} else {
alert(Joomla.JText._('api, some values are not
acceptable.','Some values are unacceptable'));
return false;
}
}
}PK�F�[e
Z*��/com_componentbuilder/views/api/tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper as Html;
?>
<div class="uk-alert uk-alert-danger" data-uk-alert>
<h2><?php echo
Text::_('COM_COMPONENTBUILDER_ERROR'); ?></h2>
</div>
PK�F�[�#o,,.com_componentbuilder/views/api/tmpl/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�F�[*8G;��,com_componentbuilder/views/api/view.html.phpnu�[���<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\StringHelper;
/**
* Componentbuilder Html View class for the Api
*/
class ComponentbuilderViewApi extends HtmlView
{
// Overwriting JView display method
function display($tpl = null)
{
// get combined params of both component and menu
$this->app = Factory::getApplication();
$this->params = $this->app->getParams();
$this->menu = $this->app->getMenu()->getActive();
// get the user object
$this->user = Factory::getUser();
// Initialise variables.
$this->item = $this->get('Item');
// do not load the display
jexit('Access Denied!');
// Set the toolbar
$this->addToolBar();
// Set the html view document stuff
$this->_prepareDocument();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
}
/**
* Prepares the document
*/
protected function _prepareDocument()
{
// Only load jQuery if needed. (default is true)
if ($this->params->get('add_jquery_framework', 1) == 1)
{
Html::_('jquery.framework');
}
// Load the header checker class.
require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php'
);
// Initialize the header checker.
$HeaderCheck = new componentbuilderHeaderCheck();
// Load uikit options.
$uikit = $this->params->get('uikit_load');
// Set script size.
$size = $this->params->get('uikit_min');
// Set css style.
$style = $this->params->get('uikit_style');
// The uikit css.
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1)
&& $uikit != 2 && $uikit != 3)
{
Html::_('stylesheet',
'media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css',
['version' => 'auto']);
}
// The uikit js.
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1)
&& $uikit != 2 && $uikit != 3)
{
Html::_('script',
'media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js',
['version' => 'auto']);
}
// add the document default css file
Html::_('stylesheet',
'components/com_componentbuilder/assets/css/api.css',
['version' => 'auto']);
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('api');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER',
false, $this->help_url);
}
// now initiate the toolbar
$this->toolbar = Toolbar::getInstance();
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
*
* @return mixed The escaped value.
*/
public function escape($var, $sorten = false, $length = 40)
{
// use the helper htmlEscape method instead.
return StringHelper::html($var, $this->_charset, $sorten, $length);
}
/**
* Get the Document (helper method toward Joomla 4 and 5)
*/
public function getDocument()
{
$this->document ??= JFactory::getDocument();
return $this->document;
}
}
PK�F�[�#o,,%com_componentbuilder/views/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�F�[�#o,,'com_componentbuilder/layouts/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK8F�[j�)eecom_ajax/ajax.phpnu�[���PK8F�[�XW���com_banners/banners.phpnu�[���PK8F�[,�1����com_banners/controller.phpnu�[���PK;F�[Aؽb���com_banners/helpers/banner.phpnu�[���PK;F�[�r�yy
�"com_banners/helpers/category.phpnu�[���PK;F�[hbh���%com_banners/models/banner.phpnu�[���PK=F�[q1��X"X"n6com_banners/models/banners.phpnu�[���PK=F�[�1���
�
Ycom_banners/router.phpnu�[���PK=F�[���ccom_config/config.phpnu�[���PK@F�[[�����
�fcom_config/controller/cancel.phpnu�[���PK@F�[�yt���%�icom_config/controller/canceladmin.phpnu�[���PK@F�[�:9�;;!pcom_config/controller/cmsbase.phpnu�[���PKAF�[B�
(�tcom_config/controller/config/display.phpnu�[���PKAF�[����%~com_config/controller/config/save.phpnu�[���PKBF�[��z��
�
!��com_config/controller/display.phpnu�[���PKBF�[l.��9
9
�com_config/controller/helper.phpnu�[���PKBF�[W��(��com_config/controller/modules/cancel.phpnu�[���PKBF�[j��__)��com_config/controller/modules/display.phpnu�[���PKBF�[����&8�com_config/controller/modules/save.phpnu�[���PKBF�[�'��B
B
+�com_config/controller/templates/display.phpnu�[���PKBF�[�<��� � (��com_config/controller/templates/save.phpnu�[���PKBF�[-�|:00��com_config/model/cms.phpnu�[���PKBF�[?���3�com_config/model/config.phpnu�[���PKBF�[��E�
�
�com_config/model/form/config.xmlnu�[���PKBF�[��7��!�com_config/model/form/modules.xmlnu�[���PKBF�[$�y�((*-com_config/model/form/modules_advanced.xmlnu�[���PKBF�[�iv~~#�com_config/model/form/templates.xmlnu�[���PKBF�[�3[�D"D"�com_config/model/form.phpnu�[���PKCF�[�?m
3com_config/model/modules.phpnu�[���PKCF�[�R#iJJkMcom_config/model/templates.phpnu�[���PKCF�[��2Zcom_config/view/cms/html.phpnu�[���PKCF�[�946iinocom_config/view/cms/json.phpnu�[���PKCF�[=�
��#rcom_config/view/config/html.phpnu�[���PKDF�[�'
ucom_config/view/config/tmpl/default.phpnu�[���PKDF�[ImO��'y|com_config/view/config/tmpl/default.xmlnu�[���PKEF�[�!3
}}0�~com_config/view/config/tmpl/default_metadata.phpnu�[���PKEF�[ƩjYss+��com_config/view/config/tmpl/default_seo.phpnu�[���PKEF�[��Ouu,j�com_config/view/config/tmpl/default_site.phpnu�[���PKEF�[Ecٍ
;�com_config/view/modules/html.phpnu�[���PKEF�[����$$(��com_config/view/modules/tmpl/default.phpnu�[���PKEF�[EDC��0�com_config/view/modules/tmpl/default_options.phpnu�[���PKFF�[�*�QQ2�com_config/view/modules/tmpl/default_positions.phpnu�[���PKFF�[+V'Ƙ�"Ϭcom_config/view/templates/html.phpnu�[���PKFF�[H��F��*��com_config/view/templates/tmpl/default.phpnu�[���PKFF�[C?���*�com_config/view/templates/tmpl/default.xmlnu�[���PKHF�[S3Tzz2H�com_config/view/templates/tmpl/default_options.phpnu�[���PKHF�[���v^^$�com_contact/contact.phpnu�[���PKHF�[N�Yy���com_contact/controller.phpnu�[���PKIF�[e�ydqq#��com_contact/controllers/contact.phpnu�[���PKIF�[-T��#z�com_contact/helpers/association.phpnu�[���PKIF�[��?���
��com_contact/helpers/category.phpnu�[���PKIF�[Y��$22$��com_contact/helpers/legacyrouter.phpnu�[���PKJF�[f^�
com_contact/helpers/route.phpnu�[���PKJF�[�%�B��$�com_contact/layouts/field/render.phpnu�[���PKJF�[�{$��%�com_contact/layouts/fields/render.phpnu�[���PKJF�[u�QQ/com_contact/layouts/joomla/form/renderfield.phpnu�[���PKLF�[`���!�$com_contact/models/categories.phpnu�[���PKLF�[���++++2com_contact/models/category.phpnu�[���PKLF�[� 3/J/J�]com_contact/models/contact.phpnu�[���PKMF�[
�kk�com_contact/models/featured.phpnu�[���PKMF�[����$�com_contact/models/forms/contact.xmlnu�[���PKMF�[����,��com_contact/models/forms/filter_contacts.xmlnu�[���PKMF�[���\>\>!��com_contact/models/forms/form.xmlnu�[���PKMF�[��tzz)�com_contact/models/rules/contactemail.phpnu�[���PKMF�[�#40Ycom_contact/models/rules/contactemailmessage.phpnu�[���PKMF�[ĩk���0�$com_contact/models/rules/contactemailsubject.phpnu�[���PKOF�[y S�||,com_contact/router.phpnu�[���PKOF�[<��B��-�Dcom_contact/views/categories/tmpl/default.phpnu�[���PKPF�[qy$5M5M-&Jcom_contact/views/categories/tmpl/default.xmlnu�[���PKPF�[�ozV� � 3��com_contact/views/categories/tmpl/default_items.phpnu�[���PKPF�[NX
��*��com_contact/views/categories/view.html.phpnu�[���PKPF�[Ml#hh+��com_contact/views/category/tmpl/default.phpnu�[���PKPF�[)k��K�K+Z�com_contact/views/category/tmpl/default.xmlnu�[���PKRF�[p@I���4��com_contact/views/category/tmpl/default_children.phpnu�[���PKRF�[�I�Ϻ�1�com_contact/views/category/tmpl/default_items.phpnu�[���PKRF�[*�&���(�com_contact/views/category/view.feed.phpnu�[���PKSF�[�O��(�com_contact/views/category/view.html.phpnu�[���PKSF�[�;={){)*�com_contact/views/contact/tmpl/default.phpnu�[���PKSF�[-!Y�00*�Icom_contact/views/contact/tmpl/default.xmlnu�[���PKSF�[}6����2zcom_contact/views/contact/tmpl/default_address.phpnu�[���PKTF�[�.�b!!3��com_contact/views/contact/tmpl/default_articles.phpnu�[���PKTF�[�s�z~~/}�com_contact/views/contact/tmpl/default_form.phpnu�[���PKTF�[Ϡo
��0Z�com_contact/views/contact/tmpl/default_links.phpnu�[���PKTF�[�1�UU2S�com_contact/views/contact/tmpl/default_profile.phpnu�[���PKTF�[�f�C
=
�com_contact/views/contact/tmpl/default_user_custom_fields.phpnu�[���PKTF�[�f��J9J9'��com_contact/views/contact/view.html.phpnu�[���PKUF�[%)�5��&%�com_contact/views/contact/view.vcf.phpnu�[���PKUF�[��:�mm+�com_contact/views/featured/tmpl/default.phpnu�[���PKUF�[hw�П4�4+�com_contact/views/featured/tmpl/default.xmlnu�[���PKUF�[���a��1�*com_contact/views/featured/tmpl/default_items.phpnu�[���PKUF�[ܫFH��(�@com_contact/views/featured/view.html.phpnu�[���PKWF�[�C�r``Scom_content/content.phpnu�[���PKWF�[:tӁ
�Ycom_content/controller.phpnu�[���PKWF�[��2�M'M'#�fcom_content/controllers/article.phpnu�[���PKYF�[�����#��com_content/helpers/association.phpnu�[���PKYF�[*��M}}
ǟcom_content/helpers/category.phpnu�[���PKYF�[�o����com_content/helpers/icon.phpnu�[���PKYF�[coJ�o'o'$�com_content/helpers/legacyrouter.phpnu�[���PKYF�[�oh ��com_content/helpers/query.phpnu�[���PKYF�[��M�TT�com_content/helpers/route.phpnu�[���PKYF�[2 $$�com_content/models/archive.phpnu�[���PKZF�[��L�)�)#com_content/models/article.phpnu�[���PKZF�[���߃Y�Y�Lcom_content/models/articles.phpnu�[���PKZF�[D2�|
|
!��com_content/models/categories.phpnu�[���PKZF�[�u��W1W1��com_content/models/category.phpnu�[���PK[F�[Vnڼcc3�com_content/models/featured.phpnu�[���PK[F�[��5JJ�com_content/models/form.phpnu�[���PK[F�[���""$z
com_content/models/forms/article.xmlnu�[���PK\F�[�����,�/com_content/models/forms/filter_articles.xmlnu�[���PK\F�[S
3��(@com_content/router.phpnu�[���PK]F�[�_�
*3[com_content/views/archive/tmpl/default.phpnu�[���PK]F�[4��zz*�bcom_content/views/archive/tmpl/default.xmlnu�[���PK`F�[|6�;
%
%0k�com_content/views/archive/tmpl/default_items.phpnu�[���PK`F�[s���AA'ئcom_content/views/archive/view.html.phpnu�[���PK`F�[}����*p�com_content/views/article/tmpl/default.phpnu�[���PK`F�[�pLf``*J�com_content/views/article/tmpl/default.xmlnu�[���PK`F�[��ղ
0�com_content/views/article/tmpl/default_links.phpnu�[���PKaF�[=梤(�('dcom_content/views/article/view.html.phpnu�[���PKbF�[?�$��-_+com_content/views/categories/tmpl/default.phpnu�[���PKbF�[����KK-�0com_content/views/categories/tmpl/default.xmlnu�[���PKbF�[ο|}
}
3!|com_content/views/categories/tmpl/default_items.phpnu�[���PKcF�[�Рixx*�com_content/views/categories/view.html.phpnu�[���PKcF�[��}���(Ӊcom_content/views/category/tmpl/blog.phpnu�[���PKcF�[v/��K�K(�com_content/views/category/tmpl/blog.xmlnu�[���PKdF�[^�
��
�
1)�com_content/views/category/tmpl/blog_children.phpnu�[���PKdF�[WbV�??-c�com_content/views/category/tmpl/blog_item.phpnu�[���PKeF�[�2��"".� com_content/views/category/tmpl/blog_links.phpnu�[���PKeF�[j\�+ com_content/views/category/tmpl/default.phpnu�[���PKeF�[���P3E3E+� com_content/views/category/tmpl/default.xmlnu�[���PKeF�[�1�5�54{V com_content/views/category/tmpl/default_articles.phpnu�[���PKeF�[8�Z�
�
4u� com_content/views/category/tmpl/default_children.phpnu�[���PKfF�[�=
��(v� com_content/views/category/view.feed.phpnu�[���PKfF�[�1��(�� com_content/views/category/view.html.phpnu�[���PKgF�[�䴝��+�� com_content/views/featured/tmpl/default.phpnu�[���PKgF�[��F�D8D8+�� com_content/views/featured/tmpl/default.xmlnu�[���PKgF�[�ݤ000x
com_content/views/featured/tmpl/default_item.phpnu�[���PKhF�[�W�1
com_content/views/featured/tmpl/default_links.phpnu�[���PKhF�[�;D�
�
(�
com_content/views/featured/view.feed.phpnu�[���PKhF�[�f�M��(l+
com_content/views/featured/view.html.phpnu�[���PKkF�[�F��!!$�D
com_content/views/form/tmpl/edit.phpnu�[���PKkF�[��%�$`
com_content/views/form/tmpl/edit.xmlnu�[���PKkF�[��"y>>$�g
com_content/views/form/view.html.phpnu�[���PKlF�[fPHߝ�%�z
com_contenthistory/contenthistory.phpnu�[���PKlF�[O����}
com_fields/controller.phpnu�[���PKmF�[xƹ���b�
com_fields/fields.phpnu�[���PKnF�[}0�ZZ#��
com_fields/layouts/field/render.phpnu�[���PKnF�[(�M�
$M�
com_fields/layouts/fields/render.phpnu�[���PKnF�[)���)��
com_fields/models/forms/filter_fields.xmlnu�[���PKoF�[w�/]�
com_finder/controller.phpnu�[���PKoF�[��� � +��
com_finder/controllers/suggestions.json.phpnu�[���PKoF�[l�8c��|�
com_finder/finder.phpnu�[���PKpF�[X�1�7�7"��
com_finder/helpers/html/filter.phpnu�[���PKpF�[�ش���!��
com_finder/helpers/html/query.phpnu�[���PKqF�[!f��
com_finder/helpers/route.phpnu�[���PKqF�[Lf6܍���Vcom_finder/models/search.phpnu�[���PKqF�[
9P���!/�com_finder/models/suggestions.phpnu�[���PKqF�[�&hpp@�com_finder/router.phpnu�[���PKqF�[�7��(��com_finder/views/search/tmpl/default.phpnu�[���PKqF�[g)4�""(/�com_finder/views/search/tmpl/default.xmlnu�[���PKsF�[���
�
-��com_finder/views/search/tmpl/default_form.phpnu�[���PKsF�[1�bm� � /��com_finder/views/search/tmpl/default_result.phpnu�[���PKsF�[�����04�com_finder/views/search/tmpl/default_results.phpnu�[���PKsF�[Vb��w
w
%G�com_finder/views/search/view.feed.phpnu�[���PKsF�[���66%�com_finder/views/search/view.html.phpnu�[���PKsF�[<-(MM+�com_finder/views/search/view.opensearch.phpnu�[���PKsF�[ �
F"com_mailto/controller.phpnu�[���PKtF�[8�'���1com_mailto/helpers/mailto.phpnu�[���PKtF�[�^���9com_mailto/mailto.phpnu�[���PKuF�[7/����/<com_mailto/mailto.xmlnu�[���PKuF�[�"�ZZ"g@com_mailto/models/forms/mailto.xmlnu�[���PKuF�[��f�
�
Dcom_mailto/models/mailto.phpnu�[���PKuF�[�n(3��(�Ncom_mailto/views/mailto/tmpl/default.phpnu�[���PKuF�[B��44%'Vcom_mailto/views/mailto/view.html.phpnu�[���PKuF�[S�f�AA&�Ycom_mailto/views/sent/tmpl/default.phpnu�[���PKwF�[�!dd#G\com_mailto/views/sent/view.html.phpnu�[���PKwF�[��Qepp�]com_media/media.phpnu�[���PKwF�[�k�TT�`com_menus/controller.phpnu�[���PKwF�[��--Mecom_menus/menus.phpnu�[���PKyF�[9S��oo'�hcom_menus/models/forms/filter_items.xmlnu�[���PKyF�[�W}}�wcom_modules/controller.phpnu�[���PKzF�[̲���
�
+J|com_modules/models/forms/filter_modules.xmlnu�[���PKzF�[my���x�com_modules/modules.phpnu�[���PK{F�[�0*!99��com_newsfeeds/controller.phpnu�[���PK{F�[@�9��%�com_newsfeeds/helpers/association.phpnu�[���PK{F�[)x���"2�com_newsfeeds/helpers/category.phpnu�[���PK{F�[�xӈ��&
�com_newsfeeds/helpers/legacyrouter.phpnu�[���PK{F�[l�F���4�com_newsfeeds/helpers/route.phpnu�[���PK{F�[��ѫ�#[�com_newsfeeds/models/categories.phpnu�[���PK|F�[1��T�!�!!Y�com_newsfeeds/models/category.phpnu�[���PK|F�[S��RR!w�com_newsfeeds/models/newsfeed.phpnu�[���PK}F�[�]��33�com_newsfeeds/newsfeeds.phpnu�[���PK}F�[C�L~~��com_newsfeeds/router.phpnu�[���PK�F�[�7���/^
com_newsfeeds/views/categories/tmpl/default.phpnu�[���PK�F�[����["["/�
com_newsfeeds/views/categories/tmpl/default.xmlnu�[���PK�F�[�ό
5o>
com_newsfeeds/views/categories/tmpl/default_items.phpnu�[���PK�F�[�?�%��,�H
com_newsfeeds/views/categories/view.html.phpnu�[���PK�F�[���_-�K
com_newsfeeds/views/category/tmpl/default.phpnu�[���PK�F�[�!4��-9T
com_newsfeeds/views/category/tmpl/default.xmlnu�[���PK�F�[O��2��6Fq
com_newsfeeds/views/category/tmpl/default_children.phpnu�[���PK�F�[�gE3ky
com_newsfeeds/views/category/tmpl/default_items.phpnu�[���PK�F�[+��?� � *و
com_newsfeeds/views/category/view.html.phpnu�[���PK�F�[IJzh��-�
com_newsfeeds/views/newsfeed/tmpl/default.phpnu�[���PK�F�[���r�
�
-9�
com_newsfeeds/views/newsfeed/tmpl/default.xmlnu�[���PK�F�[g���,
,
*��
com_newsfeeds/views/newsfeed/view.html.phpnu�[���PK�F�[������
com_privacy/controller.phpnu�[���PK�F�[�T�###�
com_privacy/controllers/request.phpnu�[���PK�F�[��s�iiw�
com_privacy/models/confirm.phpnu�[���PK�F�[��f$oo$.com_privacy/models/forms/confirm.xmlnu�[���PK�F�[�P�#�com_privacy/models/forms/remind.xmlnu�[���PK�F�[�����$`com_privacy/models/forms/request.xmlnu�[���PK�F�[��Ym--ycom_privacy/models/remind.phpnu�[���PK�F�[��[[�com_privacy/models/request.phpnu�[���PK�F�[oxV����6com_privacy/privacy.phpnu�[���PK�F�[@<�?��{8com_privacy/router.phpnu�[���PK�F�[zA��66*I@com_privacy/views/confirm/tmpl/default.phpnu�[���PK�F�[���EE*�Ecom_privacy/views/confirm/tmpl/default.xmlnu�[���PK�F�[�z�<��'xGcom_privacy/views/confirm/view.html.phpnu�[���PK�F�[εd44)�Scom_privacy/views/remind/tmpl/default.phpnu�[���PK�F�[`A��AA)QYcom_privacy/views/remind/tmpl/default.xmlnu�[���PK�F�[��i��&�Zcom_privacy/views/remind/view.html.phpnu�[���PK�F�[�)x:LL*3gcom_privacy/views/request/tmpl/default.phpnu�[���PK�F�[
���DD*�mcom_privacy/views/request/tmpl/default.xmlnu�[���PK�F�[�T-Y��'wocom_privacy/views/request/view.html.phpnu�[���PK�F�[P٣����|com_search/controller.phpnu�[���PK�F�[
�66��com_search/models/search.phpnu�[���PK�F�[���,!!�com_search/router.phpnu�[���PK�F�[-Ll��k�com_search/search.phpnu�[���PK�F�[;����(F�com_search/views/search/tmpl/default.phpnu�[���PK�F�[:a�yN
N
(-�com_search/views/search/tmpl/default.xmlnu�[���PK�F�[(�Myy.Ӵcom_search/views/search/tmpl/default_error.phpnu�[���PK�F�[HT7�44-��com_search/views/search/tmpl/default_form.phpnu�[���PK�F�[ /1�::0;�com_search/views/search/tmpl/default_results.phpnu�[���PK�F�[��8m�%�%%��com_search/views/search/view.html.phpnu�[���PK�F�[|�zii+��com_search/views/search/view.opensearch.phpnu�[���PK�F�[��1�yy��com_tags/controller.phpnu�[���PK�F�[�tx�DD`�com_tags/controllers/tags.phpnu�[���PK�F�[҆b(���com_tags/helpers/route.phpnu�[���PK�F�[�Ϙ##com_tags/models/tag.phpnu�[���PK�F�[A�p���g8com_tags/models/tags.phpnu�[���PK�F�[T<���mJcom_tags/router.phpnu�[���PK�F�[=�ӻ��J]com_tags/tags.phpnu�[���PK�F�[�?�__#l_com_tags/views/tag/tmpl/default.phpnu�[���PK�F�[I��s #kcom_tags/views/tag/tmpl/default.xmlnu�[���PK�F�[��6�qq)z�com_tags/views/tag/tmpl/default_items.phpnu�[���PK�F�[\�5�/ /
D�com_tags/views/tag/tmpl/list.phpnu�[���PK�F�[�&&
ácom_tags/views/tag/tmpl/list.xmlnu�[���PK�F�[/���&9�com_tags/views/tag/tmpl/list_items.phpnu�[���PK�F�[�b�%
:�com_tags/views/tag/view.feed.phpnu�[���PK�F�[W-}�+&+&
��com_tags/views/tag/view.html.phpnu�[���PK�F�[�oo$com_tags/views/tags/tmpl/default.phpnu�[���PK�F�[�΄aa$�
com_tags/views/tags/tmpl/default.xmlnu�[���PK�F�[�J?��*}!com_tags/views/tags/tmpl/default_items.phpnu�[���PK�F�[��=���!�9com_tags/views/tags/view.feed.phpnu�[���PK�F�[���}��!�Bcom_tags/views/tags/view.html.phpnu�[���PK�F�[��\}77�[com_users/controller.phpnu�[���PK�F�[��c'��!jcom_users/controllers/profile.phpnu�[���PK�F�[��&
�com_users/controllers/registration.phpnu�[���PK�F�[�~�L��
s�com_users/controllers/remind.phpnu�[���PK�F�[����T�com_users/controllers/reset.phpnu�[���PK�F�[k�ĕ�!�!&�com_users/controllers/user.phpnu�[���PK�F�[E��;��
�com_users/helpers/html/users.phpnu�[���PK�F�[���4��"��com_users/helpers/legacyrouter.phpnu�[���PK�F�[�,.GYY�com_users/helpers/route.phpnu�[���PK�F�[��H[XX-�com_users/layouts/joomla/form/renderfield.phpnu�[���PK�F�[����#Mcom_users/models/forms/frontend.xmlnu�[���PK�F�[�qn)`com_users/models/forms/frontend_admin.xmlnu�[���PK�F�[[�����
�
com_users/models/forms/login.xmlnu�[���PK�F�[3��cqq"�#com_users/models/forms/profile.xmlnu�[���PK�F�[H�'�+com_users/models/forms/registration.xmlnu�[���PK�F�[j�%��!,4com_users/models/forms/remind.xmlnu�[���PK�F�[.8��)r6com_users/models/forms/reset_complete.xmlnu�[���PK�F�[���H--(�9com_users/models/forms/reset_confirm.xmlnu�[���PK�F�[���(H<com_users/models/forms/reset_request.xmlnu�[���PK�F�[`����#�>com_users/models/forms/sitelang.xmlnu�[���PK�F�[�S&p�
�
~@com_users/models/login.phpnu�[���PK�F�[��9k,k,mKcom_users/models/profile.phpnu�[���PK�F�[|1
HH!$xcom_users/models/registration.phpnu�[���PK�F�[�33��com_users/models/remind.phpnu�[���PK�F�[���p�1�1�com_users/models/reset.phpnu�[���PK�F�[���?II+com_users/models/rules/loginuniquefield.phpnu�[���PK�F�[�xNN,�
com_users/models/rules/logoutuniquefield.phpnu�[���PK�F�[�q� icom_users/router.phpnu�[���PK�F�[
�^<���com_users/users.phpnu�[���PK�F�[�q��&�!com_users/views/login/tmpl/default.phpnu�[���PK�F�[?��|GG&[$com_users/views/login/tmpl/default.xmlnu�[���PK�F�[�xva��,�4com_users/views/login/tmpl/default_login.phpnu�[���PK�F�[ÑFҊ�-BBcom_users/views/login/tmpl/default_logout.phpnu�[���PK�F�[¿�.��%)Kcom_users/views/login/tmpl/logout.xmlnu�[���PK�F�[�e+2��#mOcom_users/views/login/view.html.phpnu�[���PK�F�[�U��(�[com_users/views/profile/tmpl/default.phpnu�[���PK�F�[����33(`com_users/views/profile/tmpl/default.xmlnu�[���PK�F�[����-�acom_users/views/profile/tmpl/default_core.phpnu�[���PK�F�[m�:� � /�fcom_users/views/profile/tmpl/default_custom.phpnu�[���PK�F�[=-R�&&/�pcom_users/views/profile/tmpl/default_params.phpnu�[���PK�F�[t�u�%\vcom_users/views/profile/tmpl/edit.phpnu�[���PK�F�[ݏ�88%Ōcom_users/views/profile/tmpl/edit.xmlnu�[���PK�F�[e��}}%R�com_users/views/profile/view.html.phpnu�[���PK�F�[�v�B��.$�com_users/views/registration/tmpl/complete.phpnu�[���PK�F�[�s�cc-n�com_users/views/registration/tmpl/default.phpnu�[���PK�F�[��B�EE-.�com_users/views/registration/tmpl/default.xmlnu�[���PK�F�[�!���
�
*Ъcom_users/views/registration/view.html.phpnu�[���PK�F�[^f��
'�com_users/views/remind/tmpl/default.phpnu�[���PK�F�[�q>�11'T�com_users/views/remind/tmpl/default.xmlnu�[���PK�F�[�_
_
$ܼcom_users/views/remind/view.html.phpnu�[���PK�F�[�9���'��com_users/views/reset/tmpl/complete.phpnu�[���PK�F�[�>����&��com_users/views/reset/tmpl/confirm.phpnu�[���PK�F�[~/ӷ&8�com_users/views/reset/tmpl/default.phpnu�[���PK�F�[��W�22&��com_users/views/reset/tmpl/default.xmlnu�[���PK�F�[cO��#"�com_users/views/reset/view.html.phpnu�[���PK�F�[���3��w�com_wrapper/controller.phpnu�[���PK�F�[�w��77��com_wrapper/router.phpnu�[���PK�F�[7���NN*=�com_wrapper/views/wrapper/tmpl/default.phpnu�[���PK�F�[\��u u *�com_wrapper/views/wrapper/tmpl/default.xmlnu�[���PK�F�[IT��'�com_wrapper/views/wrapper/view.html.phpnu�[���PK�F�[�~����com_wrapper/wrapper.phpnu�[���PK�F�[�
���qcom_wrapper/wrapper.xmlnu�[���PK�F�[�V�
;index.htmlnu�[���PK�F�[�X�""#�com_componentbuilder/controller.phpnu�[���PK�F�[�#o,, #com_componentbuilder/index.htmlnu�[���PK�F�[��IX99�#com_componentbuilder/router.phpnu�[���PK�F�[{�h��)8com_componentbuilder/componentbuilder.phpnu�[���PK�F�[{����'I?com_componentbuilder/assets/css/api.cssnu�[���PK�F�[�#o,,*:Acom_componentbuilder/assets/css/index.htmlnu�[���PK�F�[���e��(�Acom_componentbuilder/assets/css/site.cssnu�[���PK�F�[�#o,,-�Ccom_componentbuilder/assets/images/index.htmlnu�[���PK�F�[�#o,,&_Dcom_componentbuilder/assets/index.htmlnu�[���PK�F�[�#o,,)�Dcom_componentbuilder/assets/js/index.htmlnu�[���PK�F�[�ς��&fEcom_componentbuilder/assets/js/site.jsnu�[���PK�F�[]+<�!!)SGcom_componentbuilder/helpers/category.phpnu�[���PK�F�[F��jj.�Kcom_componentbuilder/helpers/categoryfield.phpnu�[���PK�F�[F��zz2�Ocom_componentbuilder/helpers/categoryfieldtype.phpnu�[���PK�F�[�l3ѥ���1qScom_componentbuilder/helpers/componentbuilder.phpnu�[���PK�F�[}7�,w$com_componentbuilder/helpers/headercheck.phpnu�[���PK�F�[�#o,,'�+com_componentbuilder/helpers/index.htmlnu�[���PK�F�[v�R,r,com_componentbuilder/helpers/powerloader.phpnu�[���PK�F�[��{��&�4com_componentbuilder/helpers/route.phpnu�[���PK�F�[Q1 �O�O(Ncom_componentbuilder/controllers/api.phpnu�[���PK�F�[�R�
�
)O�com_componentbuilder/controllers/help.phpnu�[���PK�F�[�#o,,+>�com_componentbuilder/controllers/index.htmlnu�[���PK�F�[C����
�
#Ŭcom_componentbuilder/models/api.phpnu�[���PK�F�[�#o,,&��com_componentbuilder/models/index.htmlnu�[���PK�F�[�#o,,)s�com_componentbuilder/views/api/index.htmlnu�[���PK�F�[����MM.��com_componentbuilder/views/api/submitbutton.jsnu�[���PK�F�[e
Z*��/��com_componentbuilder/views/api/tmpl/default.phpnu�[���PK�F�[�#o,,.��com_componentbuilder/views/api/tmpl/index.htmlnu�[���PK�F�[*8G;��,g�com_componentbuilder/views/api/view.html.phpnu�[���PK�F�[�#o,,%��com_componentbuilder/views/index.htmlnu�[���PK�F�[�#o,,'�com_componentbuilder/layouts/index.htmlnu�[���PK\\҈��