Spade
Mini Shell
PKgV�[�aGGbase.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Model
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Joomla Platform Base Model Class
*
* @since 3.0.0
* @deprecated 4.0 Use the default MVC library
*/
abstract class JModelBase implements JModel
{
/**
* The model state.
*
* @var Registry
* @since 3.0.0
*/
protected $state;
/**
* Instantiate the model.
*
* @param Registry $state The model state.
*
* @since 3.0.0
*/
public function __construct(Registry $state = null)
{
// Setup the model.
$this->state = isset($state) ? $state : $this->loadState();
}
/**
* Get the model state.
*
* @return Registry The state object.
*
* @since 3.0.0
*/
public function getState()
{
return $this->state;
}
/**
* Set the model state.
*
* @param Registry $state The state object.
*
* @return void
*
* @since 3.0.0
*/
public function setState(Registry $state)
{
$this->state = $state;
}
/**
* Load the model state.
*
* @return Registry The state object.
*
* @since 3.0.0
*/
protected function loadState()
{
return new Registry;
}
}
PKgV�[��L��database.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Model
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Joomla Platform Database Model Class
*
* @since 3.0.0
* @deprecated 4.0 Use the default MVC library
*/
abstract class JModelDatabase extends JModelBase
{
/**
* The database driver.
*
* @var JDatabaseDriver
* @since 3.0.0
*/
protected $db;
/**
* Instantiate the model.
*
* @param Registry $state The model state.
* @param JDatabaseDriver $db The database adpater.
*
* @since 3.0.0
*/
public function __construct(Registry $state = null, JDatabaseDriver $db =
null)
{
parent::__construct($state);
// Setup the model.
$this->db = isset($db) ? $db : $this->loadDb();
}
/**
* Get the database driver.
*
* @return JDatabaseDriver The database driver.
*
* @since 3.0.0
*/
public function getDb()
{
return $this->db;
}
/**
* Set the database driver.
*
* @param JDatabaseDriver $db The database driver.
*
* @return void
*
* @since 3.0.0
*/
public function setDb(JDatabaseDriver $db)
{
$this->db = $db;
}
/**
* Load the database driver.
*
* @return JDatabaseDriver The database driver.
*
* @since 3.0.0
*/
protected function loadDb()
{
return JFactory::getDbo();
}
}
PKgV�[o�3��� model.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Model
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Joomla Platform Model Interface
*
* @since 3.0.0
* @deprecated 4.0 Use the default MVC library
*/
interface JModel
{
/**
* Get the model state.
*
* @return Registry The state object.
*
* @since 3.0.0
*/
public function getState();
/**
* Set the model state.
*
* @param Registry $state The state object.
*
* @return void
*
* @since 3.0.0
*/
public function setState(Registry $state);
}
PK.�[-�|:00cms.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);
}
}
PK.�[?���
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;
}
}
PK.�[��E�
�
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>
PK.�[��7��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>
PK.�[$�y�((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>
PK.�[�iv~~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>
PK.�[�3[�D"D"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;
}
}
PK.�[�?mmodules.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;
}
}
PK.�[�R#iJJ
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);
}
}
PKgV�[�aGGbase.phpnu�[���PKgV�[��L��database.phpnu�[���PKgV�[o�3��� �model.phpnu�[���PK.�[-�|:00�cms.phpnu�[���PK.�[?���
2'config.phpnu�[���PK.�[��E�
�
+form/config.xmlnu�[���PK.�[��7���5form/modules.xmlnu�[���PK.�[$�y�((�Aform/modules_advanced.xmlnu�[���PK.�[�iv~~jFform/templates.xmlnu�[���PK.�[�3[�D"D"*Jform.phpnu�[���PK.�[�?m�lmodules.phpnu�[���PK.�[�R#iJJ
�templates.phpnu�[���PK�z�