| Current Path : /home/w/u/e/wuectly/www/03cbe/ |
| Current File : /home/w/u/e/wuectly/www/03cbe/cms.php.tar |
home/wuectly/www/libraries/cms.php 0000604 00000010427 15245530367 0013275 0 ustar 00 <?php
/**
* @package Joomla.Libraries
*
* @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;
// Set the platform root path as a constant if necessary.
if (!defined('JPATH_PLATFORM'))
{
define('JPATH_PLATFORM', __DIR__);
}
// Import the library loader if necessary.
if (!class_exists('JLoader'))
{
require_once JPATH_PLATFORM . '/loader.php';
}
// Make sure that the Joomla Platform has been successfully loaded.
if (!class_exists('JLoader'))
{
throw new RuntimeException('Joomla Platform not loaded.');
}
// Register the library base path for CMS libraries.
JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms', false, true);
/** @note This will be loaded through composer in Joomla 4 */
JLoader::registerNamespace('Joomla\\CMS', JPATH_PLATFORM . '/src', false, false, 'psr4');
// Create the Composer autoloader
$loader = require JPATH_LIBRARIES . '/vendor/autoload.php';
$loader->unregister();
// Decorate Composer autoloader
spl_autoload_register(array(new JClassLoader($loader), 'loadClass'), true, true);
// Register the class aliases for Framework classes that have replaced their Platform equivalents
require_once JPATH_LIBRARIES . '/classmap.php';
// Suppress phar stream wrapper for non .phar files
$behavior = new \TYPO3\PharStreamWrapper\Behavior;
\TYPO3\PharStreamWrapper\Manager::initialize(
$behavior->withAssertion(new \TYPO3\PharStreamWrapper\Interceptor\PharExtensionInterceptor)
);
if (in_array('phar', stream_get_wrappers()))
{
stream_wrapper_unregister('phar');
stream_wrapper_register('phar', 'TYPO3\\PharStreamWrapper\\PharStreamWrapper');
}
// Define the Joomla version if not already defined.
if (!defined('JVERSION'))
{
$jversion = new JVersion;
define('JVERSION', $jversion->getShortVersion());
}
// Ensure FOF autoloader included - needed for things like content versioning where we need to get an FOFTable Instance
if (!class_exists('FOFAutoloaderFof'))
{
include_once JPATH_LIBRARIES . '/fof/include.php';
}
// Register a handler for uncaught exceptions that shows a pretty error page when possible
set_exception_handler(array('Joomla\CMS\Exception\ExceptionHandler', 'handleException'));
// Set up the message queue logger for web requests
if (array_key_exists('REQUEST_METHOD', $_SERVER))
{
JLog::addLogger(array('logger' => 'messagequeue'), JLog::ALL, array('jerror'));
}
// Register JArrayHelper due to JRegistry moved to composer's vendor folder
JLoader::register('JArrayHelper', JPATH_PLATFORM . '/joomla/utilities/arrayhelper.php');
// Register the Crypto lib
JLoader::register('Crypto', JPATH_PLATFORM . '/php-encryption/Crypto.php');
// Register classes where the names have been changed to fit the autoloader rules
// @deprecated 4.0
JLoader::register('JInstallerComponent', JPATH_PLATFORM . '/cms/installer/adapter/component.php');
JLoader::register('JInstallerFile', JPATH_PLATFORM . '/cms/installer/adapter/file.php');
JLoader::register('JInstallerLanguage', JPATH_PLATFORM . '/cms/installer/adapter/language.php');
JLoader::register('JInstallerLibrary', JPATH_PLATFORM . '/cms/installer/adapter/library.php');
JLoader::register('JInstallerModule', JPATH_PLATFORM . '/cms/installer/adapter/module.php');
JLoader::register('JInstallerPackage', JPATH_PLATFORM . '/cms/installer/adapter/package.php');
JLoader::register('JInstallerPlugin', JPATH_PLATFORM . '/cms/installer/adapter/plugin.php');
JLoader::register('JInstallerTemplate', JPATH_PLATFORM . '/cms/installer/adapter/template.php');
JLoader::register('JExtension', JPATH_PLATFORM . '/cms/installer/extension.php');
JLoader::registerAlias('JAdministrator', 'JApplicationAdministrator');
JLoader::registerAlias('JSite', 'JApplicationSite');
// Can be removed when the move of all core fields to namespace is finished
\Joomla\CMS\Form\FormHelper::addFieldPath(JPATH_LIBRARIES . '/joomla/form/fields');
\Joomla\CMS\Form\FormHelper::addRulePath(JPATH_LIBRARIES . '/joomla/form/rule');
\Joomla\CMS\Form\FormHelper::addRulePath(JPATH_LIBRARIES . '/joomla/form/rules');
\Joomla\CMS\Form\FormHelper::addFormPath(JPATH_LIBRARIES . '/joomla/form/forms');
\Joomla\CMS\Form\FormHelper::addFieldPath(JPATH_LIBRARIES . '/cms/form/field');
\Joomla\CMS\Form\FormHelper::addRulePath(JPATH_LIBRARIES . '/cms/form/rule');
home/wuectly/www/components/com_config/model/cms.php 0000604 00000014060 15245551654 0016710 0 ustar 00 <?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);
}
}