Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/com_categories.zip
Назад
PK �|!]5f��� � controllers/categories.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_categories * * @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; /** * The Categories List Controller * * @since 1.6 */ class CategoriesControllerCategories extends JControllerAdmin { /** * Proxy for getModel * * @param string $name The model name. Optional. * @param string $prefix The class prefix. Optional. * @param array $config The array of possible config values. Optional. * * @return JModelLegacy The model. * * @since 1.6 */ public function getModel($name = 'Category', $prefix = 'CategoriesModel', $config = array('ignore_request' => true)) { return parent::getModel($name, $prefix, $config); } /** * Rebuild the nested set tree. * * @return boolean False on failure or error, true on success. * * @since 1.6 */ public function rebuild() { $this->checkToken(); $extension = $this->input->get('extension'); $this->setRedirect(JRoute::_('index.php?option=com_categories&view=categories&extension=' . $extension, false)); /** @var CategoriesModelCategory $model */ $model = $this->getModel(); if ($model->rebuild()) { // Rebuild succeeded. $this->setMessage(JText::_('COM_CATEGORIES_REBUILD_SUCCESS')); return true; } // Rebuild failed. $this->setMessage(JText::_('COM_CATEGORIES_REBUILD_FAILURE')); return false; } /** * Save the manual order inputs from the categories list page. * * @return boolean True on success * * @since 1.6 * @see JControllerAdmin::saveorder() * @deprecated 4.0 */ public function saveorder() { $this->checkToken(); try { JLog::add(sprintf('%s() is deprecated. Function will be removed in 4.0.', __METHOD__), JLog::WARNING, 'deprecated'); } catch (RuntimeException $exception) { // Informational log only } // Get the arrays from the Request $order = $this->input->post->get('order', null, 'array'); $originalOrder = explode(',', $this->input->getString('original_order_values')); // Make sure something has changed if (!($order === $originalOrder)) { parent::saveorder(); } else { // Nothing to reorder $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); return true; } } /** * Deletes and returns correctly. * * @return void * * @since 3.1.2 */ public function delete() { $this->checkToken(); // Get items to remove from the request. $cid = (array) $this->input->get('cid', array(), 'int'); $extension = $this->input->getCmd('extension', null); // Remove zero values resulting from input filter $cid = array_filter($cid); if (empty($cid)) { JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED')); } else { // Get the model. /** @var CategoriesModelCategory $model */ $model = $this->getModel(); // Remove the items. if ($model->delete($cid)) { $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid))); } else { $this->setMessage($model->getError()); } } $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&extension=' . $extension, false)); } /** * Check in of one or more records. * * Overrides JControllerAdmin::checkin to redirect to URL with extension. * * @return boolean True on success * * @since 3.6.0 */ public function checkin() { // Process parent checkin method. $result = parent::checkin(); // Override the redirect Uri. $redirectUri = 'index.php?option=' . $this->option . '&view=' . $this->view_list . '&extension=' . $this->input->get('extension', '', 'CMD'); $this->setRedirect(JRoute::_($redirectUri, false), $this->message, $this->messageType); return $result; } } PK �|!]غ�� � controllers/ajax.json.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_categories * * @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\Language\LanguageHelper; /** * The categories controller for ajax requests * * @since 3.9.0 */ class CategoriesControllerAjax extends JControllerLegacy { /** * Method to fetch associations of a category * * The method assumes that the following http parameters are passed in an Ajax Get request: * token: the form token * assocId: the id of the category whose associations are to be returned * excludeLang: the association for this language is to be excluded * * @return null * * @since 3.9.0 */ public function fetchAssociations() { if (!JSession::checkToken('get')) { echo new JResponseJson(null, JText::_('JINVALID_TOKEN'), true); } else { $input = JFactory::getApplication()->input; $extension = $input->get('extension'); $assocId = $input->getInt('assocId', 0); if ($assocId == 0) { echo new JResponseJson(null, JText::sprintf('JLIB_FORM_VALIDATE_FIELD_INVALID', 'assocId'), true); return; } $excludeLang = $input->get('excludeLang', '', 'STRING'); $associations = JLanguageAssociations::getAssociations($extension, '#__categories', 'com_categories.item', (int) $assocId, 'id', 'alias', ''); unset($associations[$excludeLang]); // Add the title to each of the associated records JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/tables'); $categoryTable = JTable::getInstance('Category', 'JTable'); foreach ($associations as $lang => $association) { $categoryTable->load($association->id); $associations[$lang]->title = $categoryTable->title; } $countContentLanguages = count(LanguageHelper::getContentLanguages(array(0, 1))); if (count($associations) == 0) { $message = JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_NONE'); } elseif ($countContentLanguages > count($associations) + 2) { $tags = implode(', ', array_keys($associations)); $message = JText::sprintf('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_SOME', $tags); } else { $message = JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_ALL'); } echo new JResponseJson($associations, $message); } } } PK �|!]e_��p p controllers/category.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_categories * * @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; /** * The Category Controller * * @since 1.6 */ class CategoriesControllerCategory extends JControllerForm { /** * The extension for which the categories apply. * * @var string * @since 1.6 */ protected $extension; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @since 1.6 * @see JControllerLegacy */ public function __construct($config = array()) { parent::__construct($config); // Guess the JText message prefix. Defaults to the option. if (empty($this->extension)) { $this->extension = $this->input->get('extension', 'com_content'); } } /** * Method 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(); return ($user->authorise('core.create', $this->extension) || count($user->getAuthorisedCategories($this->extension, 'core.create'))); } /** * Method to check if you can edit a record. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key. * * @return boolean * * @since 1.6 */ protected function allowEdit($data = array(), $key = 'parent_id') { $recordId = (int) isset($data[$key]) ? $data[$key] : 0; $user = JFactory::getUser(); // Check "edit" permission on record asset (explicit or inherited) if ($user->authorise('core.edit', $this->extension . '.category.' . $recordId)) { return true; } // Check "edit own" permission on record asset (explicit or inherited) if ($user->authorise('core.edit.own', $this->extension . '.category.' . $recordId)) { // Need to do a lookup from the model to get the owner $record = $this->getModel()->getItem($recordId); if (empty($record)) { return false; } $ownerId = $record->created_user_id; // If the owner matches 'me' then do the test. if ($ownerId == $user->id) { return true; } } return false; } /** * Override parent save method to store form data with right key as expected by edit category page * * @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 3.10.3 */ public function save($key = null, $urlVar = null) { $result = parent::save($key, $urlVar); $oldKey = $this->option . '.edit.category.data'; $newKey = $this->option . '.edit.category.' . substr($this->extension, 4) . '.data'; $app = JFactory::getApplication(); $app->setUserState($newKey, $app->getUserState($oldKey)); return $result; } /** * Override cancel method to clear form data for a failed edit action * * @param string $key The name of the primary key of the URL variable. * * @return boolean True if access level checks pass, false otherwise. * * @since 3.10.3 */ public function cancel($key = null) { $result = parent::cancel($key); $newKey = $this->option . '.edit.category.' . substr($this->extension, 4) . '.data'; JFactory::getApplication()->setUserState($newKey, null); return $result; } /** * Method to run batch operations. * * @param object $model The model. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 1.6 */ public function batch($model = null) { $this->checkToken(); // Set the model /** @var CategoriesModelCategory $model */ $model = $this->getModel('Category'); // Preset the redirect $this->setRedirect('index.php?option=com_categories&view=categories&extension=' . $this->extension); return parent::batch($model); } /** * 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 = 'id') { $append = parent::getRedirectToItemAppend($recordId); $append .= '&extension=' . $this->extension; return $append; } /** * Gets the URL arguments to append to a list redirect. * * @return string The arguments to append to the redirect URL. * * @since 1.6 */ protected function getRedirectToListAppend() { $append = parent::getRedirectToListAppend(); $append .= '&extension=' . $this->extension; return $append; } /** * Function that allows child controller access to model data after the data has been saved. * * @param JModelLegacy $model The data model object. * @param array $validData The validated data. * * @return void * * @since 3.1 */ protected function postSaveHook(JModelLegacy $model, $validData = array()) { $item = $model->getItem(); if (isset($item->params) && is_array($item->params)) { $registry = new Registry($item->params); $item->params = (string) $registry; } if (isset($item->metadata) && is_array($item->metadata)) { $registry = new Registry($item->metadata); $item->metadata = (string) $registry; } } } PK �|!]+;3�G G % views/category/tmpl/edit_metadata.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_categories * * @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; echo JLayoutHelper::render('joomla.edit.metadata', $this); PK �|!]8?R;� � views/category/tmpl/edit.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage com_categories * * @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; // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('behavior.formvalidator'); JHtml::_('behavior.keepalive'); JHtml::_('formbehavior.chosen', '#jform_tags', null, array('placeholder_text_multiple' => JText::_('JGLOBAL_TYPE_OR_SELECT_SOME_TAGS'))); JHtml::_('formbehavior.chosen', 'select'); $app = JFactory::getApplication(); $input = $app->input; $assoc = JLanguageAssociations::isEnabled(); // Are associations implemented for this extension? $extensionassoc = array_key_exists('item_associations', $this->form->getFieldsets()); JFactory::getDocument()->addScriptDeclaration(' Joomla.submitbutton = function(task) { if (task == "category.cancel" || document.formvalidator.isValid(document.getElementById("item-form"))) { jQuery("#permissions-sliders select").attr("disabled", "disabled"); ' . $this->form->getField('description')->save() . ' Joomla.submitform(task, document.getElementById("item-form")); // @deprecated 4.0 The following js is not needed since 3.7.0. if (task !== "category.apply") { window.parent.jQuery("#categoryEdit' . $this->item->id . 'Modal").modal("hide"); } } }; '); // Fieldsets to not automatically render by /layouts/joomla/edit/params.php $this->ignore_fieldsets = array('jmetadata', 'item_associations'); // In case of modal $isModal = $input->get('layout') == 'modal' ? true : false; $layout = $isModal ? 'modal' : 'edit'; $tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : ''; ?> <form action="<?php echo JRoute::_('index.php?option=com_categories&extension=' . $input->getCmd('extension', 'com_content') . '&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" class="form-validate"> <?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?> <div class="form-horizontal"> <?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'general')); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'general', JText::_('JCATEGORY')); ?> <div class="row-fluid"> <div class="span9"> <?php echo $this->form->getLabel('description'); ?> <?php echo $this->form->getInput('description'); ?> </div> <div class="span3"> <?php echo JLayoutHelper::render('joomla.edit.global', $this); ?> </div> </div> <?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JLayoutHelper::render('joomla.edit.params', $this); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'publishing', JText::_('COM_CATEGORIES_FIELDSET_PUBLISHING')); ?> <div class="row-fluid form-horizontal-desktop"> <div class="span6"> <?php echo JLayoutHelper::render('joomla.edit.publishingdata', $this); ?> </div> <div class="span6"> <?php echo JLayoutHelper::render('joomla.edit.metadata', $this); ?> </div> </div> <?php echo JHtml::_('bootstrap.endTab'); ?> <?php if ( ! $isModal && $assoc && $extensionassoc) : ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'associations', JText::_('JGLOBAL_FIELDSET_ASSOCIATIONS')); ?> <?php echo $this->loadTemplate('associations'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?> <?php elseif ($isModal && $assoc && $extensionassoc) : ?> <div class="hidden"><?php echo $this->loadTemplate('associations'); ?></div> <?php endif; ?> <?php if ($this->canDo->get('core.admin')) : ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'rules', JText::_('COM_CATEGORIES_FIELDSET_RULES')); ?> <?php echo $this->form->getInput('rules'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?> <?php endif; ?> <?php echo JHtml::_('bootstrap.endTabSet'); ?> <?php echo $this->form->getInput('extension'); ?> <input type="hidden" name="task" value="" /> <input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>" /> <?php echo JHtml::_('form.token'); ?> </div> </form> PK �|!] ���l l views/category/tmpl/edit.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?> <metadata> <layout title="COM_CATEGORIES_CATEGORY_VIEW_EDIT_TITLE"> <message> <![CDATA[COM_CATEGORIES_CATEGORY_VIEW_EDIT_DESC]]> </message> </layout> <fieldset name="request"> <fields name="request"> <field name="extension" type="componentscategory" label="COM_CATEGORIES_CHOOSE_COMPONENT_LABEL" description="COM_CATEGORIES_CHOOSE_COMPONENT_DESC" required="true" > <option value="">COM_MENUS_OPTION_SELECT_COMPONENT</option> </field> <field name="id" type="hidden" default="0" /> </fields> </fieldset> </metadata> PK �|!]Ŏ^{G G &