0byt3m1n1-V2
Path:
/
home
/
a
/
c
/
a
/
academiac
/
www
/
[
Home
]
File: plugins.php.tar
home/academiac/www/administrator/components/com_plugins/plugins.php 0000644 00000001103 15137413543 0021766 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_plugins * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Access check. if (!JFactory::getUser()->authorise('core.manage', 'com_plugins')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } // Create the controller $controller = JControllerLegacy::getInstance('Plugins'); $controller->execute(JRequest::getCmd('task')); $controller->redirect(); home/academiac/www/administrator/components/com_plugins/models/plugins.php 0000644 00000015273 15137414216 0023264 0 ustar 00 <?php /** * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access. defined('_JEXEC') or die; jimport('joomla.application.component.modellist'); /** * Methods supporting a list of plugin records. * * @package Joomla.Administrator * @subpackage com_plugins * @since 1.6 */ class PluginsModelPlugins extends JModelList { /** * Constructor. * * @param array 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( 'extension_id', 'a.extension_id', 'name', 'a.name', 'folder', 'a.folder', 'element', 'a.element', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'state', 'a.state', 'enabled', 'a.enabled', 'access', 'a.access', 'access_level', 'ordering', 'a.ordering', 'client_id', 'a.client_id', ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { // Initialise variables. $app = JFactory::getApplication('administrator'); // Load the filter state. $search = $this->getUserStateFromRequest($this->context.'.filter.search', 'filter_search'); $this->setState('filter.search', $search); $accessId = $this->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int'); $this->setState('filter.access', $accessId); $state = $this->getUserStateFromRequest($this->context.'.filter.state', 'filter_state', '', 'string'); $this->setState('filter.state', $state); $folder = $this->getUserStateFromRequest($this->context.'.filter.folder', 'filter_folder', null, 'cmd'); $this->setState('filter.folder', $folder); $language = $this->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', ''); $this->setState('filter.language', $language); // Load the parameters. $params = JComponentHelper::getParams('com_plugins'); $this->setState('params', $params); // List state information. parent::populateState('folder', 'asc'); } /** * 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 A prefix for the store id. * * @return string A store id. */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':'.$this->getState('filter.search'); $id .= ':'.$this->getState('filter.access'); $id .= ':'.$this->getState('filter.state'); $id .= ':'.$this->getState('filter.folder'); $id .= ':'.$this->getState('filter.language'); return parent::getStoreId($id); } /** * Returns an object list * * @param string The query * @param int Offset * @param int The number of records * @return array */ protected function _getList($query, $limitstart=0, $limit=0) { $search = $this->getState('filter.search'); $ordering = $this->getState('list.ordering', 'ordering'); if ($ordering == 'name' || (!empty($search) && stripos($search, 'id:') !== 0)) { $this->_db->setQuery($query); $result = $this->_db->loadObjectList(); $this->translate($result); if (!empty($search)) { foreach($result as $i=>$item) { if (!preg_match("/$search/i", $item->name)) { unset($result[$i]); } } } $lang = JFactory::getLanguage(); $direction = ($this->getState('list.direction') == 'desc') ? -1 : 1; JArrayHelper::sortObjects($result, $ordering, $direction, true, $lang->getLocale()); $total = count($result); $this->cache[$this->getStoreId('getTotal')] = $total; if ($total < $limitstart) { $limitstart = 0; $this->setState('list.start', 0); } return array_slice($result, $limitstart, $limit ? $limit : null); } else { if ($ordering == 'ordering') { $query->order('a.folder ASC'); $ordering = 'a.ordering'; } $query->order($this->_db->quoteName($ordering) . ' ' . $this->getState('list.direction')); if($ordering == 'folder') { $query->order('a.ordering ASC'); } $result = parent::_getList($query, $limitstart, $limit); $this->translate($result); return $result; } } /** * Translate a list of objects * * @param array The array of objects * @return array The array of translated objects */ protected function translate(&$items) { $lang = JFactory::getLanguage(); foreach($items as &$item) { $source = JPATH_PLUGINS . '/' . $item->folder . '/' . $item->element; $extension = 'plg_' . $item->folder . '_' . $item->element; $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, true) || $lang->load($extension . '.sys', $source, null, false, true); $item->name = JText::_($item->name); } } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery */ protected function getListQuery() { // 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.extension_id , a.name, a.element, a.folder, a.checked_out, a.checked_out_time,' . ' a.enabled, a.access, a.ordering' ) ); $query->from($db->quoteName('#__extensions').' AS a'); $query->where($db->quoteName('type').' = '.$db->quote('plugin')); // Join over the users for the checked out user. $query->select('uc.name AS editor'); $query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); // Join over the asset groups. $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. if ($access = $this->getState('filter.access')) { $query->where('a.access = '.(int) $access); } // Filter by published state $published = $this->getState('filter.state'); if (is_numeric($published)) { $query->where('a.enabled = '.(int) $published); } elseif ($published === '') { $query->where('(a.enabled IN (0, 1))'); } // Filter by state $query->where('a.state >= 0'); // Filter by folder. if ($folder = $this->getState('filter.folder')) { $query->where('a.folder = '.$db->quote($folder)); } // Filter by search in id $search = $this->getState('filter.search'); if (!empty($search) && stripos($search, 'id:') === 0) { $query->where('a.extension_id = '.(int) substr($search, 3)); } return $query; } } home/academiac/www/administrator/components/com_plugins/helpers/plugins.php 0000644 00000004544 15137414377 0023452 0 ustar 00 <?php /** * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Plugins component helper. * * @package Joomla.Administrator * @subpackage com_plugins * @since 1.6 */ class PluginsHelper { public static $extension = 'com_plugins'; /** * Configure the Linkbar. * * @param string The name of the active view. */ public static function addSubmenu($vName) { // No submenu for this component. } /** * Gets a list of the actions that can be performed. * * @return JObject */ public static function getActions() { $user = JFactory::getUser(); $result = new JObject; $assetName = 'com_plugins'; $actions = JAccess::getActions($assetName); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; } /** * Returns an array of standard published state filter options. * * @return string The HTML code for the select tag */ public static function stateOptions() { // Build the active state filter options. $options = array(); $options[] = JHtml::_('select.option', '1', 'JENABLED'); $options[] = JHtml::_('select.option', '0', 'JDISABLED'); return $options; } /** * Returns an array of standard published state filter options. * * @return string The HTML code for the select tag */ public static function folderOptions() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('DISTINCT(folder) AS value, folder AS text'); $query->from('#__extensions'); $query->where($db->quoteName('type').' = '.$db->quote('plugin')); $query->order('folder'); $db->setQuery($query); $options = $db->loadObjectList(); if ($error = $db->getErrorMsg()) { JError::raiseWarning(500, $error); } return $options; } function parseXMLTemplateFile($templateBaseDir, $templateDir) { $data = new JObject; // Check of the xml file exists $filePath = JPath::clean($templateBaseDir.'/templates/'.$templateDir.'/templateDetails.xml'); if (is_file($filePath)) { $xml = JInstaller::parseXMLInstallFile($filePath); if ($xml['type'] != 'template') { return false; } foreach ($xml as $key => $value) { $data->set($key, $value); } } return $data; } } home/academiac/www/administrator/components/com_plugins/controllers/plugins.php 0000644 00000001712 15137445521 0024343 0 ustar 00 <?php /** * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access. defined('_JEXEC') or die; jimport('joomla.application.component.controlleradmin'); /** * Plugins list controller class. * * @package Joomla.Administrator * @subpackage com_plugins * @since 1.6 */ class PluginsControllerPlugins extends JControllerAdmin { /** * 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.6 */ public function getModel($name = 'Plugin', $prefix = 'PluginsModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); return $model; } } home/academiac/www/libraries/joomla/form/fields/plugins.php 0000644 00000003741 15137514500 0020055 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage Form * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; JFormHelper::loadFieldClass('list'); /** * Form Field class for the Joomla Framework. * * @package Joomla.Platform * @subpackage Form * @since 11.4 */ class JFormFieldPlugins extends JFormFieldList { /** * The field type. * * @var string * @since 11.4 */ protected $type = 'Plugins'; /** * Method to get a list of options for a list input. * * @return array An array of JHtml options. * * @since 11.4 */ protected function getOptions() { // Initialise variables $folder = $this->element['folder']; if (!empty($folder)) { // Get list of plugins $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('element AS value, name AS text'); $query->from('#__extensions'); $query->where('folder = ' . $db->q($folder)); $query->where('enabled = 1'); $query->order('ordering, name'); $db->setQuery($query); $options = $db->loadObjectList(); $lang = JFactory::getLanguage(); foreach ($options as $i => $item) { $source = JPATH_PLUGINS . '/' . $folder . '/' . $item->value; $extension = 'plg_' . $folder . '_' . $item->value; $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, true) || $lang->load($extension . '.sys', $source, null, false, true); $options[$i]->text = JText::_($item->text); } if ($db->getErrorMsg()) { JError::raiseWarning(500, JText::_('JFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY')); return ''; } } else { JError::raiseWarning(500, JText::_('JFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY')); } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } }
©
2018.