AAAAPK >\V index.htmlnuW+A PK >\''modules/default.phpnuW+Astate->get('filter.client_id') ? 'administrator' : 'site'; $user = JFactory::getUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $canOrder = $user->authorise('core.edit.state', 'com_modules'); $saveOrder = $listOrder == 'ordering'; ?>
items as $i => $item) : $ordering = ($listOrder == 'ordering'); $canCreate = $user->authorise('core.create', 'com_modules'); $canEdit = $user->authorise('core.edit', 'com_modules'); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out==$user->get('id') || $item->checked_out==0; $canChange = $user->authorise('core.edit.state', 'com_modules') && $canCheckin; ?>
items, 'filesave.png', 'modules.saveorder'); ?>
id); ?> checked_out) : ?> editor, $item->checked_out_time, 'modules.', $canCheckin); ?> escape($item->title); ?> escape($item->title); ?> note)) : ?>

escape($item->note));?>

published, $i, $canChange, 'cb'); ?> position; ?> pagination->orderUpIcon($i, (@$this->items[$i-1]->position == $item->position), 'modules.orderup', 'JLIB_HTML_MOVE_UP', $ordering); ?> pagination->orderDownIcon($i, $this->pagination->total, (@$this->items[$i+1]->position == $item->position), 'modules.orderdown', 'JLIB_HTML_MOVE_DOWN', $ordering); ?> pagination->orderUpIcon($i, (@$this->items[$i-1]->position == $item->position), 'modules.orderdown', 'JLIB_HTML_MOVE_UP', $ordering); ?> pagination->orderDownIcon($i, $this->pagination->total, (@$this->items[$i+1]->position == $item->position), 'modules.orderup', 'JLIB_HTML_MOVE_DOWN', $ordering); ?> class="text-area-order" title="title; ?> order" /> ordering; ?> name;?> pages; ?> escape($item->access_level); ?> language==''):?> language=='*'):?> language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> id; ?>
authorize('core.create', 'com_modules') || $user->authorize('core.edit', 'com_modules')) : ?> loadTemplate('batch'); ?> pagination->getListFooter(); ?>
PK >\)modules/.htaccessnuW+A Order allow,deny Deny from all PK >\Vmodules/index.htmlnuW+A PK >\) .htaccessnuW+A Order allow,deny Deny from all PK >\Vpositions/index.htmlnuW+A PK >\)positions/.htaccessnuW+A Order allow,deny Deny from all PK >\i8positions/modal.phpnuW+Aescape($this->state->get('list.ordering')); $direction = $this->escape($this->state->get('list.direction')); $clientId = $this->state->get('filter.client_id'); $state = $this->state->get('filter.state'); $template = $this->state->get('filter.template'); $type = $this->state->get('filter.type'); ?>
items as $value=>$templates) : ?>
escape($value); ?>
    $label):?>
  • hasKey($label) ? JText::sprintf('COM_MODULES_MODULE_TEMPLATE_POSITION', JText::_($template), JText::_($label)) : JText::_($template);?>
pagination->getListFooter(); ?>
PK >\:eMmodule/edit_options.phpnuW+Aform->getFieldsets('params'); foreach ($fieldSets as $name => $fieldSet) : $label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_MODULES_'.$name.'_FIELDSET_LABEL'; echo JHtml::_('sliders.panel', JText::_($label), $name.'-options'); if (isset($fieldSet->description) && trim($fieldSet->description)) : echo '

'.$this->escape(JText::_($fieldSet->description)).'

'; endif; ?>
PK >\dzXAAmodule/edit.phpnuW+Aitem->module) || $this->item->module == 'custom' || $this->item->module == 'mod_custom'; $script = "Joomla.submitbutton = function(task) { if (task == 'module.cancel' || document.formvalidator.isValid(document.id('module-form'))) {"; if ($hasContent) { $script .= $this->form->getField('content')->save(); } $script .= " Joomla.submitform(task, document.getElementById('module-form')); if (self != top) { window.top.setTimeout('window.parent.SqueezeBox.close()', 1000); } } else { alert('".$this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'))."'); } }"; JFactory::getDocument()->addScriptDeclaration($script); ?>
  • form->getLabel('title'); ?> form->getInput('title'); ?>
  • form->getLabel('showtitle'); ?> form->getInput('showtitle'); ?>
  • form->getLabel('position'); ?> form->getInput('custom_position'); ?> form->getInput('position'); ?>
  • item->xml->name != 'Login Form'): ?>
  • form->getLabel('published'); ?> form->getInput('published'); ?>
  • form->getLabel('access'); ?> form->getInput('access'); ?>
  • form->getLabel('ordering'); ?> form->getInput('ordering'); ?>
  • item->xml->name != 'Login Form'): ?>
  • form->getLabel('publish_up'); ?> form->getInput('publish_up'); ?>
  • form->getLabel('publish_down'); ?> form->getInput('publish_down'); ?>
  • form->getLabel('language'); ?> form->getInput('language'); ?>
  • form->getLabel('note'); ?> form->getInput('note'); ?>
  • item->id) : ?>
  • form->getLabel('id'); ?> form->getInput('id'); ?>
  • form->getLabel('module'); ?> form->getInput('module'); ?> item->xml) echo ($text = (string) $this->item->xml->name) ? JText::_($text) : $this->item->module;else echo JText::_(COM_MODULES_ERR_XML);?>
  • form->getLabel('client_id'); ?> form->getInput('client_id'); ?>
item->xml) : ?> item->xml->description)) : ?>
loadTemplate('options'); ?>
  • form->getLabel('content'); ?>
    form->getInput('content'); ?>
item->client_id == 0) :?>
loadTemplate('assignment'); ?>
PK >\Vmodule/index.htmlnuW+A PK >\)module/.htaccessnuW+A Order allow,deny Deny from all PK>\d8Zbb config.xmlnuW+A
PK>\Q access.xmlnuW+A
PK>\@controller.phpnuW+AcheckEditId('com_modules.edit.module', $id)) { // Somehow the person just went to the form - we don't allow that. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=com_modules&view=modules', false)); return false; } parent::display(); } } PK>\  modules.xmlnuW+A com_modules Joomla! Project April 2006 (C) 2005 - 2014 Open Source Matters. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt admin@joomla.org www.joomla.org 2.5.0 COM_MODULES_XML_DESCRIPTION config.xml controller.php index.html modules.php controllers helpers models views language/en-GB.com_modules.ini PK>\)views/select/.htaccessnuW+A Order allow,deny Deny from all PK>\Vviews/select/index.htmlnuW+A PK>\)views/select/tmpl/.htaccessnuW+A Order allow,deny Deny from all PK>\Vviews/select/tmpl/index.htmlnuW+A PK>\sviews/select/tmpl/default.phpnuW+A
PK>\(''views/select/view.html.phpnuW+Aget('State'); $items = $this->get('Items'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->assignRef('state', $state); $this->assignRef('items', $items); parent::display($tpl); } } PK>\)views/positions/tmpl/.htaccessnuW+A Order allow,deny Deny from all PK>\Vviews/positions/tmpl/index.htmlnuW+A PK>\XeB''views/positions/tmpl/modal.phpnuW+Aescape($this->state->get('list.ordering')); $direction = $this->escape($this->state->get('list.direction')); $clientId = $this->state->get('filter.client_id'); $state = $this->state->get('filter.state'); $template = $this->state->get('filter.template'); $type = $this->state->get('filter.type'); ?>
items as $value=>$templates) : ?>
pagination->getListFooter(); ?>
escape($value); ?>
    $label):?>
  • hasKey($label) ? JText::sprintf('COM_MODULES_MODULE_TEMPLATE_POSITION', JText::_($template), JText::_($label)) : JText::_($template);?>
PK>\B<views/positions/view.html.phpnuW+Aitems = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } parent::display($tpl); } } PK>\)views/positions/.htaccessnuW+A Order allow,deny Deny from all PK>\Vviews/positions/index.htmlnuW+A PK>\Vviews/index.htmlnuW+A PK>\)views/.htaccessnuW+A Order allow,deny Deny from all PK>\)views/module/.htaccessnuW+A Order allow,deny Deny from all PK>\07ii%views/module/tmpl/edit_assignment.phpnuW+A
PK>\NNviews/module/tmpl/edit.phpnuW+Aitem->module) || $this->item->module == 'custom' || $this->item->module == 'mod_custom'; $script = "Joomla.submitbutton = function(task) { if (task == 'module.cancel' || document.formvalidator.isValid(document.id('module-form'))) {"; if ($hasContent) { $script .= $this->form->getField('content')->save(); } $script .= " Joomla.submitform(task, document.getElementById('module-form')); if (self != top) { window.top.setTimeout('window.parent.SqueezeBox.close()', 1000); } } else { alert('".$this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'))."'); } }"; JFactory::getDocument()->addScriptDeclaration($script); ?>
  • form->getLabel('title'); ?> form->getInput('title'); ?>
  • form->getLabel('showtitle'); ?> form->getInput('showtitle'); ?>
  • form->getLabel('position'); ?> form->getInput('position'); ?>
  • item->xml->name != 'Login Form'): ?>
  • form->getLabel('published'); ?> form->getInput('published'); ?>
  • form->getLabel('access'); ?> form->getInput('access'); ?>
  • form->getLabel('ordering'); ?> form->getInput('ordering'); ?>
  • item->xml->name != 'Login Form'): ?>
  • form->getLabel('publish_up'); ?> form->getInput('publish_up'); ?>
  • form->getLabel('publish_down'); ?> form->getInput('publish_down'); ?>
  • form->getLabel('language'); ?> form->getInput('language'); ?>
  • form->getLabel('note'); ?> form->getInput('note'); ?>
  • item->id) : ?>
  • form->getLabel('id'); ?> form->getInput('id'); ?>
  • form->getLabel('module'); ?> form->getInput('module'); ?>
  • form->getLabel('client_id'); ?> form->getInput('client_id'); ?>
item->xml) : ?> item->xml->description)) : ?>

loadTemplate('options'); ?>
  • form->getLabel('content'); ?>
    form->getInput('content'); ?>
item->client_id == 0) :?>
loadTemplate('assignment'); ?>
PK>\H>cssviews/module/tmpl/modal.phpnuW+A
setLayout('edit'); echo $this->loadTemplate(); PK>\)views/module/tmpl/.htaccessnuW+A Order allow,deny Deny from all PK>\笗"views/module/tmpl/edit_options.phpnuW+Aform->getFieldsets('params'); foreach ($fieldSets as $name => $fieldSet) : $label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_MODULES_'.$name.'_FIELDSET_LABEL'; echo JHtml::_('sliders.panel', JText::_($label), $name.'-options'); if (isset($fieldSet->description) && trim($fieldSet->description)) : echo '

'.$this->escape(JText::_($fieldSet->description)).'

'; endif; ?>
PK>\Vviews/module/tmpl/index.htmlnuW+A PK>\Vviews/module/index.htmlnuW+A PK>\HO O views/module/view.html.phpnuW+Aform = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); parent::display($tpl); } /** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JRequest::setVar('hidemainmenu', true); $user = JFactory::getUser(); $isNew = ($this->item->id == 0); $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); $canDo = ModulesHelper::getActions($this->state->get('filter.category_id'), $this->item->id); $item = $this->get('Item'); JToolBarHelper::title( JText::sprintf('COM_MODULES_MANAGER_MODULE', JText::_($this->item->module)), 'module.png'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create') )) { JToolBarHelper::apply('module.apply'); JToolBarHelper::save('module.save'); } if (!$checkedOut && $canDo->get('core.create')) { JToolBarHelper::save2new('module.save2new'); } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolBarHelper::save2copy('module.save2copy'); } if (empty($this->item->id)) { JToolBarHelper::cancel('module.cancel'); } else { JToolBarHelper::cancel('module.cancel', 'JTOOLBAR_CLOSE'); } // Get the help information for the menu item. $lang = JFactory::getLanguage(); $help = $this->get('Help'); if ($lang->hasKey($help->url)) { $debug = $lang->setDebug(false); $url = JText::_($help->url); $lang->setDebug($debug); } else { $url = null; } JToolBarHelper::help($help->key, false, $url); } } PK>\ UU$views/modules/tmpl/default_batch.phpnuW+Astate->get('filter.client_id'); $published = $this->state->get('filter.published'); ?>

= 0) : ?>
PK>\Vviews/modules/tmpl/index.htmlnuW+A PK>\;t$t$views/modules/tmpl/default.phpnuW+Astate->get('filter.client_id') ? 'administrator' : 'site'; $user = JFactory::getUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $canOrder = $user->authorise('core.edit.state', 'com_modules'); $saveOrder = $listOrder == 'ordering'; ?>
items as $i => $item) : $ordering = ($listOrder == 'ordering'); $canCreate = $user->authorise('core.create', 'com_modules'); $canEdit = $user->authorise('core.edit', 'com_modules'); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out==$user->get('id')|| $item->checked_out==0; $canChange = $user->authorise('core.edit.state', 'com_modules') && $canCheckin; ?>
items, 'filesave.png', 'modules.saveorder'); ?>
pagination->getListFooter(); ?>
id); ?> checked_out) : ?> editor, $item->checked_out_time, 'modules.', $canCheckin); ?> escape($item->title); ?> escape($item->title); ?> note)) : ?>

escape($item->note));?>

published, $i, $canChange, 'cb'); ?> position) : ?> position; ?> pagination->orderUpIcon($i, (@$this->items[$i-1]->position == $item->position), 'modules.orderup', 'JLIB_HTML_MOVE_UP', $ordering); ?> pagination->orderDownIcon($i, $this->pagination->total, (@$this->items[$i+1]->position == $item->position), 'modules.orderdown', 'JLIB_HTML_MOVE_DOWN', $ordering); ?> pagination->orderUpIcon($i, (@$this->items[$i-1]->position == $item->position), 'modules.orderdown', 'JLIB_HTML_MOVE_UP', $ordering); ?> pagination->orderDownIcon($i, $this->pagination->total, (@$this->items[$i+1]->position == $item->position), 'modules.orderup', 'JLIB_HTML_MOVE_DOWN', $ordering); ?> class="text-area-order" /> ordering; ?> name;?> pages; ?> escape($item->access_level); ?> language==''):?> language=='*'):?> language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> id; ?>
authorize('core.create', 'com_modules') && $user->authorize('core.edit', 'com_modules') && $user->authorize('core.edit.state', 'com_modules')) : ?> loadTemplate('batch'); ?>
PK>\)views/modules/tmpl/.htaccessnuW+A Order allow,deny Deny from all PK>\r<@c c views/modules/view.html.phpnuW+Aitems = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // Check if there are no matching items if(!count($this->items)){ JFactory::getApplication()->enqueueMessage( JText::_('COM_MODULES_MSG_MANAGE_NO_MODULES') , 'warning' ); } $this->addToolbar(); // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); parent::display($tpl); } /** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { $state = $this->get('State'); $canDo = ModulesHelper::getActions(); JToolBarHelper::title(JText::_('COM_MODULES_MANAGER_MODULES'), 'module.png'); if ($canDo->get('core.create')) { //JToolBarHelper::addNew('module.add'); $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Popup', 'new', 'JTOOLBAR_NEW', 'index.php?option=com_modules&view=select&tmpl=component', 850, 400); } if ($canDo->get('core.edit')) { JToolBarHelper::editList('module.edit'); } if ($canDo->get('core.create')) { JToolBarHelper::custom('modules.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true); } if ($canDo->get('core.edit.state')) { JToolBarHelper::divider(); JToolBarHelper::publish('modules.publish', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::unpublish('modules.unpublish', 'JTOOLBAR_UNPUBLISH', true); JToolBarHelper::divider(); JToolBarHelper::checkin('modules.checkin'); } if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'modules.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } elseif ($canDo->get('core.edit.state')) { JToolBarHelper::trash('modules.trash'); JToolBarHelper::divider(); } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_modules'); JToolBarHelper::divider(); } JToolBarHelper::help('JHELP_EXTENSIONS_MODULE_MANAGER'); } } PK>\)views/modules/.htaccessnuW+A Order allow,deny Deny from all PK>\Vviews/modules/index.htmlnuW+A PK>\)views/preview/.htaccessnuW+A Order allow,deny Deny from all PK>\Vviews/preview/index.htmlnuW+A PK>\Ou*TTviews/preview/view.html.phpnuW+AassignRef('editor', $editor); parent::display($tpl); } } PK>\vviews/preview/tmpl/default.phpnuW+A
PK>\Vviews/preview/tmpl/index.htmlnuW+A PK>\)views/preview/tmpl/.htaccessnuW+A Order allow,deny Deny from all PK>\!D** modules.phpnuW+Aauthorise('core.manage', 'com_modules')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $controller = JControllerLegacy::getInstance('Modules'); $controller->execute(JRequest::getCmd('task')); $controller->redirect(); PK>\?@controllers/modules.phpnuW+AgetModel(); $model->duplicate($pks); $this->setMessage(JText::plural('COM_MODULES_N_MODULES_DUPLICATED', count($pks))); } catch (Exception $e) { JError::raiseWarning(500, $e->getMessage()); } $this->setRedirect('index.php?option=com_modules&view=modules'); } /** * 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 = 'Module', $prefix = 'ModulesModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); return $model; } } PK>\)controllers/.htaccessnuW+A Order allow,deny Deny from all PK>\̪controllers/module.phpnuW+Ainput->get('eid', 0, 'int'); if (empty($extensionId)) { $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.'&layout=edit', false)); return JError::raiseWarning(500, JText::_('COM_MODULES_ERROR_INVALID_EXTENSION')); } $app->setUserState('com_modules.add.module.extension_id', $extensionId); $app->setUserState('com_modules.add.module.params', null); // Parameters could be coming in for a new item, so let's set them. $params = $app->input->get('params', array(), 'array'); $app->setUserState('com_modules.add.module.params', $params); } /** * Override parent cancel method to reset the add module state. * * @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 = null) { // Initialise variables. $app = JFactory::getApplication(); $result = parent::cancel(); $app->setUserState('com_modules.add.module.extension_id', null); $app->setUserState('com_modules.add.module.params', null); return $result; } /** * Override parent allowSave method. * * @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 allowSave($data, $key = 'id') { // use custom position if selected if (empty($data['position'])) { $data['position'] = $data['custom_position']; } unset($data['custom_position']); return parent::allowSave($data, $key); } /** * Method to run batch operations. * * @param string $model The model * * @return boolean True on success. * * @since 1.7 */ public function batch($model = null) { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); // Set the model $model = $this->getModel('Module', '', array()); // Preset the redirect $this->setRedirect(JRoute::_('index.php?option=com_modules&view=modules'.$this->getRedirectToListAppend(), false)); return parent::batch($model); } /** * Function that allows child controller access to model data after the data has been saved. * * @param JModel &$model The data model object. * @param array $validData The validated data. * * @return void * * @since 1.6 */ protected function postSaveHook(JModel &$model, $validData = array()) { // Initialise variables. $app = JFactory::getApplication(); $task = $this->getTask(); switch ($task) { case 'save2new': $app->setUserState('com_modules.add.module.extension_id', $model->getState('module.extension_id')); break; default: $app->setUserState('com_modules.add.module.extension_id', null); break; } $app->setUserState('com_modules.add.module.params', null); } } PK>\Vcontrollers/index.htmlnuW+A PK>\)models/fields/.htaccessnuW+A Order allow,deny Deny from all PK>\ models/fields/moduleposition.phpnuW+Aelement['client_id']; if (!isset($clientId)) { $clientName = $this->element['client']; if (isset($clientName)) { $client = JApplicationHelper::getClientInfo($clientName, true); $clientId = $client->id; } } if (!isset($clientId) && $this->form instanceof JForm) { $clientId = $this->form->getValue('client_id'); } $clientId = (int) $clientId; // Load the modal behavior script. JHtml::_('behavior.modal', 'a.modal'); // Build the script. $script = array(); $script[] = ' function jSelectPosition_'.$this->id.'(name) {'; $script[] = ' document.id("'.$this->id.'").value = name;'; $script[] = ' SqueezeBox.close();'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Setup variables for display. $html = array(); $link = 'index.php?option=com_modules&view=positions&layout=modal&tmpl=component&function=jSelectPosition_'.$this->id.'&client_id='.$clientId; // The current user display field. $html[] = '
'; $html[] = parent::getInput(); $html[] = '
'; // The user select button. $html[] = '
'; $html[] = '
'; $html[] = ' '.JText::_('COM_MODULES_CHANGE_POSITION_BUTTON').''; $html[] = '
'; $html[] = '
'; return implode("\n", $html); } } PK>\Vmodels/fields/index.htmlnuW+A PK>\7# models/fields/moduleorder.phpnuW+Aelement['class'] ? ' class="'.(string) $this->element['class'].'"' : ''; $attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : ''; $attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : ''; // Initialize JavaScript field attributes. $attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : ''; $html[] = ''; return implode("\n", $html); } } PK>\ilmodels/select.phpnuW+AgetUserState('com_modules.modules.filter.client_id', 0); $this->setState('filter.client_id', (int) $clientId); // Load the parameters. $params = JComponentHelper::getParams('com_modules'); $this->setState('params', $params); // Manually set limits to get all modules. $this->setState('list.limit', 0); $this->setState('list.start', 0); $this->setState('list.ordering', 'a.name'); $this->setState('list.direction', '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.client_id'); return parent::getStoreId($id); } /** * 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 AS module' ) ); $query->from($db->quoteName('#__extensions').' AS a'); // Filter by module $query->where('a.type = '.$db->Quote('module')); // Filter by client. $clientId = $this->getState('filter.client_id'); $query->where('a.client_id = '.(int) $clientId); // Filter by enabled $query->where('a.enabled = 1'); // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.ordering')).' '.$db->escape($this->getState('list.direction', 'ASC'))); //echo nl2br(str_replace('#__','jos_',$query)); return $query; } /** * Method to get a list of items. * * @return mixed An array of objects on success, false on failure. */ public function &getItems() { // Get the list of items from the database. $items = parent::getItems(); // Initialise variables. $client = JApplicationHelper::getClientInfo($this->getState('filter.client_id', 0)); $lang = JFactory::getLanguage(); // Loop through the results to add the XML metadata, // and load language support. foreach ($items as &$item) { $path = JPath::clean($client->path.'/modules/'.$item->module.'/'.$item->module.'.xml'); if (file_exists($path)) { $item->xml = simplexml_load_file($path); } else { $item->xml = null; } // 1.5 Format; Core files or language packs then // 1.6 3PD Extension Support $lang->load($item->module . '.sys', $client->path, null, false, true) || $lang->load($item->module . '.sys', $client->path . '/modules/' . $item->module, null, false, true); $item->name = JText::_($item->name); if (isset($item->xml) && $text = trim($item->xml->description)) { $item->desc = JText::_($text); } else { $item->desc = JText::_('COM_MODULES_NODESCRIPTION'); } } $items = JArrayHelper::sortObjects($items, 'name', 1, true, $lang->getLocale()); // TODO: Use the cached XML from the extensions table? return $items; } } PK>\Vmodels/index.htmlnuW+A PK>\Vmodels/forms/index.htmlnuW+A PK>\)models/forms/.htaccessnuW+A Order allow,deny Deny from all PK>\%p models/forms/module.xmlnuW+A
PK>\)models/.htaccessnuW+A Order allow,deny Deny from all PK>\Hccmodels/module.phpnuW+AgetUserState('com_modules.add.module.extension_id')) { $this->setState('extension.id', $extensionId); } } $this->setState('module.id', $pk); // Load the parameters. $params = JComponentHelper::getParams('com_modules'); $this->setState('params', $params); } /** * Method to perform batch operations on a set of modules. * * @param array $commands An array of commands to perform. * @param array $pks An array of item ids. * @param array $contexts An array of item contexts. * * @return boolean Returns true on success, false on failure. * * @since 1.7 */ public function batch($commands, $pks, $contexts) { // Sanitize user ids. $pks = array_unique($pks); JArrayHelper::toInteger($pks); // Remove any values of zero. if (array_search(0, $pks, true)) { unset($pks[array_search(0, $pks, true)]); } if (empty($pks)) { $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; if (!empty($commands['position_id'])) { $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); if (!empty($commands['position_id'])) { if ($cmd == 'c') { $result = $this->batchCopy($commands['position_id'], $pks, $contexts); if (is_array($result)) { $pks = $result; } else { return false; } } elseif ($cmd == 'm' && !$this->batchMove($commands['position_id'], $pks, $contexts)) { return false; } $done = true; } } if (!empty($commands['assetgroup_id'])) { if (!$this->batchAccess($commands['assetgroup_id'], $pks, $contexts)) { return false; } $done = true; } if (!empty($commands['language_id'])) { if (!$this->batchLanguage($commands['language_id'], $pks, $contexts)) { return false; } $done = true; } if (!$done) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } // Clear the cache $this->cleanCache(); return true; } /** * Batch copy modules to a new position or current. * * @param integer $value The new value matching a module position. * @param array $pks An array of row IDs. * @param array $contexts An array of item contexts. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 11.1 */ protected function batchCopy($value, $pks, $contexts) { // Set the variables $user = JFactory::getUser(); $table = $this->getTable(); $i = 0; foreach ($pks as $pk) { if ($user->authorise('core.create', 'com_modules')) { $table->reset(); $table->load($pk); // Set the new position if ($value == 'noposition') { $position = ''; } elseif ($value == 'nochange') { $position = $table->position; } else { $position = $value; } $table->position = $position; // Alter the title if necessary $data = $this->generateNewTitle(0, $table->title, $table->position); $table->title = $data['0']; // Reset the ID because we are making a copy $table->id = 0; // Unpublish the new module $table->published = 0; if (!$table->store()) { $this->setError($table->getError()); return false; } // Get the new item ID $newId = $table->get('id'); // Add the new ID to the array $newIds[$i] = $newId; $i++; // Now we need to handle the module assignments $db = $this->getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName('menuid')); $query->from($db->quoteName('#__modules_menu')); $query->where($db->quoteName('moduleid') . ' = ' . $pk); $db->setQuery($query); $menus = $db->loadColumn(); // Insert the new records into the table foreach ($menus as $menu) { $query->clear(); $query->insert($db->quoteName('#__modules_menu')); $query->columns(array($db->quoteName('moduleid'), $db->quoteName('menuid'))); $query->values($newId . ', ' . $menu); $db->setQuery($query); $db->query(); } } else { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE')); return false; } } // Clean the cache $this->cleanCache(); return $newIds; } /** * Batch move modules to a new position or current. * * @param integer $value The new value matching a module position. * @param array $pks An array of row IDs. * @param array $contexts An array of item contexts. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 11.1 */ protected function batchMove($value, $pks, $contexts) { // Set the variables $user = JFactory::getUser(); $table = $this->getTable(); $i = 0; foreach ($pks as $pk) { if ($user->authorise('core.edit', 'com_modules')) { $table->reset(); $table->load($pk); // Set the new position if ($value == 'noposition') { $position = ''; } elseif ($value == 'nochange') { $position = $table->position; } else { $position = $value; } $table->position = $position; // Alter the title if necessary $data = $this->generateNewTitle(0, $table->title, $table->position); $table->title = $data['0']; // Unpublish the moved module $table->published = 0; if (!$table->store()) { $this->setError($table->getError()); return false; } } else { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } } // Clean the cache $this->cleanCache(); return true; } /** * Method to delete rows. * * @param array &$pks An array of item ids. * * @return boolean Returns true on success, false on failure. * * @since 1.6 */ public function delete(&$pks) { // Initialise variables. $pks = (array) $pks; $user = JFactory::getUser(); $table = $this->getTable(); // Iterate the items to delete each one. foreach ($pks as $i => $pk) { if ($table->load($pk)) { // Access checks. if (!$user->authorise('core.delete', 'com_modules') || $table->published != -2) { JError::raiseWarning(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); // throw new Exception(JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); return; } if (!$table->delete($pk)) { throw new Exception($table->getError()); } else { // Delete the menu assignments $db = $this->getDbo(); $query = $db->getQuery(true); $query->delete(); $query->from('#__modules_menu'); $query->where('moduleid='.(int)$pk); $db->setQuery((string)$query); $db->query(); } // Clear module cache parent::cleanCache($table->module, $table->client_id); } else { throw new Exception($table->getError()); } } // Clear modules cache $this->cleanCache(); return true; } /** * Method to duplicate modules. * * @param array &$pks An array of primary key IDs. * * @return boolean True if successful. * * @since 1.6 * @throws Exception */ public function duplicate(&$pks) { // Initialise variables. $user = JFactory::getUser(); $db = $this->getDbo(); // Access checks. if (!$user->authorise('core.create', 'com_modules')) { throw new Exception(JText::_('JERROR_CORE_CREATE_NOT_PERMITTED')); } $table = $this->getTable(); foreach ($pks as $pk) { if ($table->load($pk, true)) { // Reset the id to create a new record. $table->id = 0; // Alter the title. $m = null; if (preg_match('#\((\d+)\)$#', $table->title, $m)) { $table->title = preg_replace('#\(\d+\)$#', '('.($m[1] + 1).')', $table->title); } else { $table->title .= ' (2)'; } // Unpublish duplicate module $table->published = 0; if (!$table->check() || !$table->store()) { throw new Exception($table->getError()); } // $query = 'SELECT menuid' // . ' FROM #__modules_menu' // . ' WHERE moduleid = '.(int) $pk // ; $query = $db->getQuery(true); $query->select('menuid'); $query->from('#__modules_menu'); $query->where('moduleid='.(int)$pk); $this->_db->setQuery((string)$query); $rows = $this->_db->loadColumn(); foreach ($rows as $menuid) { $tuples[] = '('.(int) $table->id.','.(int) $menuid.')'; } } else { throw new Exception($table->getError()); } } if (!empty($tuples)) { // Module-Menu Mapping: Do it in one query $query = 'INSERT INTO #__modules_menu (moduleid,menuid) VALUES '.implode(',', $tuples); $this->_db->setQuery($query); if (!$this->_db->query()) { return JError::raiseWarning(500, $this->_db->getErrorMsg()); } } // Clear modules cache $this->cleanCache(); return true; } /** * Method to change the title. * * @param integer $category_id The id of the category. Not used here. * @param string $title The title. * @param string $position The position. * * @return array Contains the modified title. * * @since 2.5 */ protected function generateNewTitle($category_id, $title, $position) { // Alter the title & alias $table = $this->getTable(); while ($table->load(array('position' => $position, 'title' => $title))) { $title = JString::increment($title); } return array($title); } /** * Method to get the client object * * @return void * * @since 1.6 */ function &getClient() { return $this->_client; } /** * 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 1.6 */ public function getForm($data = array(), $loadData = true) { // The folder and element vars are passed when saving the form. if (empty($data)) { $item = $this->getItem(); $clientId = $item->client_id; $module = $item->module; } else { $clientId = JArrayHelper::getValue($data, 'client_id'); $module = JArrayHelper::getValue($data, 'module'); } // These variables are used to add data from the plugin XML files. $this->setState('item.client_id', $clientId); $this->setState('item.module', $module); // Get the form. $form = $this->loadForm('com_modules.module', 'module', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } $form->setFieldAttribute('position', 'client', $this->getState('item.client_id') == 0 ? 'site' : 'administrator'); // Modify the form based on access controls. if (!$this->canEditState((object) $data)) { // Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('published', 'disabled', 'true'); $form->setFieldAttribute('publish_up', 'disabled', 'true'); $form->setFieldAttribute('publish_down', 'disabled', 'true'); // Disable fields while saving. // The controller has already verified this is a record you can edit. $form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('published', 'filter', 'unset'); $form->setFieldAttribute('publish_up', 'filter', 'unset'); $form->setFieldAttribute('publish_down', 'filter', 'unset'); } 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() { $app = JFactory::getApplication(); // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState('com_modules.edit.module.data', array()); if (empty($data)) { $data = $this->getItem(); // This allows us to inject parameter settings into a new module. $params = $app->getUserState('com_modules.add.module.params'); if (is_array($params)) { $data->set('params', $params); } } return $data; } /** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { // Initialise variables. $pk = (!empty($pk)) ? (int) $pk : (int) $this->getState('module.id'); $db = $this->getDbo(); if (!isset($this->_cache[$pk])) { $false = false; // Get a row instance. $table = $this->getTable(); // Attempt to load the row. $return = $table->load($pk); // Check for a table object error. if ($return === false && $error = $table->getError()) { $this->setError($error); return $false; } // Check if we are creating a new extension. if (empty($pk)) { if ($extensionId = (int) $this->getState('extension.id')) { $query = $db->getQuery(true); $query->select('element, client_id'); $query->from('#__extensions'); $query->where('extension_id = '.$extensionId); $query->where('type = '.$db->quote('module')); $db->setQuery($query); $extension = $db->loadObject(); if (empty($extension)) { if ($error = $db->getErrorMsg()) { $this->setError($error); } else { $this->setError('COM_MODULES_ERROR_CANNOT_FIND_MODULE'); } return false; } // Extension found, prime some module values. $table->module = $extension->element; $table->client_id = $extension->client_id; } else { $app = JFactory::getApplication(); $app->redirect(JRoute::_('index.php?option=com_modules&view=modules', false)); return false; } } // Convert to the JObject before adding other data. $properties = $table->getProperties(1); $this->_cache[$pk] = JArrayHelper::toObject($properties, 'JObject'); // Convert the params field to an array. $registry = new JRegistry; $registry->loadString($table->params); $this->_cache[$pk]->params = $registry->toArray(); // Determine the page assignment mode. $db->setQuery( 'SELECT menuid' . ' FROM #__modules_menu' . ' WHERE moduleid = '.$pk ); $assigned = $db->loadColumn(); if (empty($pk)) { // If this is a new module, assign to all pages. $assignment = 0; } elseif (empty($assigned)) { // For an existing module it is assigned to none. $assignment = '-'; } else { if ($assigned[0] > 0) { $assignment = +1; } elseif ($assigned[0] < 0) { $assignment = -1; } else { $assignment = 0; } } $this->_cache[$pk]->assigned = $assigned; $this->_cache[$pk]->assignment = $assignment; // Get the module XML. $client = JApplicationHelper::getClientInfo($table->client_id); $path = JPath::clean($client->path.'/modules/'.$table->module.'/'.$table->module.'.xml'); if (file_exists($path)) { $this->_cache[$pk]->xml = simplexml_load_file($path); } else { $this->_cache[$pk]->xml = null; } } return $this->_cache[$pk]; } /** * Get the necessary data to load an item help screen. * * @return object An object with key, url, and local properties for loading the item help screen. * * @since 1.6 */ public function getHelp() { return (object) array('key' => $this->helpKey, 'url' => $this->helpURL); } /** * Returns a reference to the a Table object, always creating it. * * @param string $type The table type to instantiate * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * * @return JTable A database object * * @since 1.6 */ public function getTable($type = 'Module', $prefix = 'JTable', $config = array()) { return JTable::getInstance($type, $prefix, $config); } /** * Prepare and sanitise the table prior to saving. * * @param JTable &$table The database object * * @return void * * @since 1.6 */ protected function prepareTable(&$table) { $date = JFactory::getDate(); $user = JFactory::getUser(); $table->title = htmlspecialchars_decode($table->title, ENT_QUOTES); $table->position = trim($table->position); if (empty($table->id)) { // Set the values //$table->created = $date->toSql(); } else { // Set the values //$table->modified = $date->toSql(); //$table->modified_by = $user->get('id'); } } /** * 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 1.6 * @throws Exception if there is an error loading the form. */ protected function preprocessForm(JForm $form, $data, $group = 'content') { jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); // Initialise variables. $lang = JFactory::getLanguage(); $clientId = $this->getState('item.client_id'); $module = $this->getState('item.module'); $client = JApplicationHelper::getClientInfo($clientId); $formFile = JPath::clean($client->path.'/modules/'.$module.'/'.$module.'.xml'); // Load the core and/or local language file(s). $lang->load($module, $client->path, null, false, true) || $lang->load($module, $client->path . '/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')); } // Get the help data from the XML file if present. $help = $xml->xpath('/extension/help'); if (!empty($help)) { $helpKey = trim((string) $help[0]['key']); $helpURL = trim((string) $help[0]['url']); $this->helpKey = $helpKey ? $helpKey : $this->helpKey; $this->helpURL = $helpURL ? $helpURL : $this->helpURL; } } // Trigger the default form events. parent::preprocessForm($form, $data, $group); } /** * Loads ContentHelper for filters before validating data. * * @param object $form The form to validate against. * @param array $data The data to validate. * * @return mixed Array of filtered data if valid, false otherwise. * * @since 1.1 */ function validate($form, $data, $group = null) { require_once JPATH_ADMINISTRATOR.'/components/com_content/helpers/content.php'; return parent::validate($form, $data, $group); } /** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { // Initialise variables; $dispatcher = JDispatcher::getInstance(); $table = $this->getTable(); $pk = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('module.id'); $isNew = true; // Include the content modules for the onSave events. JPluginHelper::importPlugin('extension'); // Load the row if saving an existing record. if ($pk > 0) { $table->load($pk); $isNew = false; } // Alter the title and published state for Save as Copy if (JRequest::getVar('task') == 'save2copy') { $orig_data = JRequest::getVar('jform', array(), 'post', 'array'); $orig_table = clone($this->getTable()); $orig_table->load((int) $orig_data['id']); if ($data['title'] == $orig_table->title) { $data['title'] .= ' '.JText::_('JGLOBAL_COPY'); $data['published'] = 0; } } // Bind the data. if (!$table->bind($data)) { $this->setError($table->getError()); return false; } // Prepare the row for saving $this->prepareTable($table); // Check the data. if (!$table->check()) { $this->setError($table->getError()); return false; } // Trigger the onExtensionBeforeSave event. $result = $dispatcher->trigger('onExtensionBeforeSave', array('com_modules.module', &$table, $isNew)); if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; } // Store the data. if (!$table->store()) { $this->setError($table->getError()); return false; } // // Process the menu link mappings. // $assignment = isset($data['assignment']) ? $data['assignment'] : 0; // Delete old module to menu item associations // $db->setQuery( // 'DELETE FROM #__modules_menu'. // ' WHERE moduleid = '.(int) $table->id // ); $db = $this->getDbo(); $query = $db->getQuery(true); $query->delete(); $query->from('#__modules_menu'); $query->where('moduleid = '.(int)$table->id); $db->setQuery((string)$query); $db->query(); if (!$db->query()) { $this->setError($db->getErrorMsg()); return false; } // If the assignment is numeric, then something is selected (otherwise it's none). if (is_numeric($assignment)) { // Variable is numeric, but could be a string. $assignment = (int) $assignment; // Logic check: if no module excluded then convert to display on all. if ($assignment == -1 && empty($data['assigned'])) { $assignment = 0; } // Check needed to stop a module being assigned to `All` // and other menu items resulting in a module being displayed twice. if ($assignment === 0) { // assign new module to `all` menu item associations // $this->_db->setQuery( // 'INSERT INTO #__modules_menu'. // ' SET moduleid = '.(int) $table->id.', menuid = 0' // ); $query->clear(); $query->insert('#__modules_menu'); $query->columns(array($db->quoteName('moduleid'), $db->quoteName('menuid'))); $query->values((int)$table->id . ', 0'); $db->setQuery((string)$query); if (!$db->query()) { $this->setError($db->getErrorMsg()); return false; } } elseif (!empty($data['assigned'])) { // Get the sign of the number. $sign = $assignment < 0 ? -1 : +1; // Preprocess the assigned array. $tuples = array(); foreach ($data['assigned'] as &$pk) { $tuples[] = '('.(int) $table->id.','.(int) $pk * $sign.')'; } $this->_db->setQuery( 'INSERT INTO #__modules_menu (moduleid, menuid) VALUES '. implode(',', $tuples) ); if (!$db->query()) { $this->setError($db->getErrorMsg()); return false; } } } // Trigger the onExtensionAfterSave event. $dispatcher->trigger('onExtensionAfterSave', array('com_modules.module', &$table, $isNew)); // Compute the extension id of this module in case the controller wants it. $query = $db->getQuery(true); $query->select('extension_id'); $query->from('#__extensions AS e'); $query->leftJoin('#__modules AS m ON e.element = m.module'); $query->where('m.id = '.(int) $table->id); $db->setQuery($query); $extensionId = $db->loadResult(); if ($error = $db->getErrorMsg()) { JError::raiseWarning(500, $error); return; } $this->setState('module.extension_id', $extensionId); $this->setState('module.id', $table->id); // Clear modules cache $this->cleanCache(); // Clean module cache parent::cleanCache($table->module, $table->client_id); return true; } /** * A protected method to get a set of ordering conditions. * * @param object $table A record object. * * @return array An array of conditions to add to add to ordering queries. * * @since 1.6 */ protected function getReorderConditions($table) { $condition = array(); $condition[] = 'client_id = '.(int) $table->client_id; $condition[] = 'position = '. $this->_db->Quote($table->position); return $condition; } /** * Custom clean cache method for different clients * * @return void * * @since 1.6 */ protected function cleanCache($group = null, $client_id = 0) { parent::cleanCache('com_modules', $this->getClient()); } } PK>\%G$$models/modules.phpnuW+AgetUserStateFromRequest($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); $position = $this->getUserStateFromRequest($this->context.'.filter.position', 'filter_position', '', 'string'); $this->setState('filter.position', $position); $module = $this->getUserStateFromRequest($this->context.'.filter.module', 'filter_module', '', 'string'); $this->setState('filter.module', $module); $clientId = $this->getUserStateFromRequest($this->context.'.filter.client_id', 'filter_client_id', 0, 'int', false); $previousId = $app->getUserState($this->context.'.filter.client_id_previous', null); if($previousId != $clientId || $previousId === null){ $this->getUserStateFromRequest($this->context.'.filter.client_id_previous', 'filter_client_id_previous', 0, 'int', true); $app->setUserState($this->context.'.filter.client_id_previous', $clientId); } $this->setState('filter.client_id', $clientId); $language = $this->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', ''); $this->setState('filter.language', $language); // Load the parameters. $params = JComponentHelper::getParams('com_modules'); $this->setState('params', $params); // List state information. parent::populateState('position', '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.position'); $id .= ':'.$this->getState('filter.module'); $id .= ':'.$this->getState('filter.client_id'); $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) { $ordering = $this->getState('list.ordering', 'ordering'); if (in_array($ordering, array('pages', 'name'))) { $this->_db->setQuery($query); $result = $this->_db->loadObjectList(); $this->translate($result); $lang = JFactory::getLanguage(); JArrayHelper::sortObjects($result, $ordering, $this->getState('list.direction') == 'desc' ? -1 : 1, 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.position ASC'); $ordering = 'a.ordering'; } if ($ordering == 'language_title') { $ordering = 'l.title'; } $query->order($this->_db->quoteName($ordering) . ' ' . $this->getState('list.direction')); if ($ordering == 'position') { $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(); $client = $this->getState('filter.client_id') ? 'administrator' : 'site'; foreach($items as $item) { $extension = $item->module; $source = constant('JPATH_' . strtoupper($client)) . "/modules/$extension"; $lang->load("$extension.sys", constant('JPATH_' . strtoupper($client)), null, false, true) || $lang->load("$extension.sys", $source, null, false, true); $item->name = JText::_($item->name); if (is_null($item->pages)) { $item->pages = JText::_('JNONE'); } elseif ($item->pages < 0) { $item->pages = JText::_('COM_MODULES_ASSIGNED_VARIES_EXCEPT'); } elseif ($item->pages > 0) { $item->pages = JText::_('COM_MODULES_ASSIGNED_VARIES_ONLY'); } else { $item->pages = JText::_('JALL'); } } } /** * 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.id, a.title, a.note, a.position, a.module, a.language,' . 'a.checked_out, a.checked_out_time, a.published+2*(e.enabled-1) as published, a.access, a.ordering, a.publish_up, a.publish_down' ) ); $query->from($db->quoteName('#__modules').' AS a'); // Join over the language $query->select('l.title AS language_title'); $query->join('LEFT', $db->quoteName('#__languages').' AS l ON l.lang_code = a.language'); // 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'); // Join over the module menus $query->select('MIN(mm.menuid) AS pages'); $query->join('LEFT', '#__modules_menu AS mm ON mm.moduleid = a.id'); // Join over the extensions $query->select('e.name AS name'); $query->join('LEFT', '#__extensions AS e ON e.element = a.module'); $query->group('a.id, a.title, a.note, a.position, a.module, a.language,a.checked_out,'. 'a.checked_out_time, a.published, a.access, a.ordering,l.title, uc.name, ag.title, e.name,'. 'l.lang_code, uc.id, ag.id, mm.moduleid, e.element, a.publish_up, a.publish_down,e.enabled'); // Filter by access level. if ($access = $this->getState('filter.access')) { $query->where('a.access = '.(int) $access); } // Filter by published state $state = $this->getState('filter.state'); if (is_numeric($state)) { $query->where('a.published = '.(int) $state); } elseif ($state === '') { $query->where('(a.published IN (0, 1))'); } // Filter by position $position = $this->getState('filter.position'); if ($position && $position != 'none') { $query->where('a.position = '.$db->Quote($position)); } elseif ($position == 'none') { $query->where('a.position = '.$db->Quote('')); } // Filter by module $module = $this->getState('filter.module'); if ($module) { $query->where('a.module = '.$db->Quote($module)); } // Filter by client. $clientId = $this->getState('filter.client_id'); if (is_numeric($clientId)) { $query->where('a.client_id = ' . (int) $clientId . ' AND e.client_id ='. (int) $clientId); } // Filter by search in title $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = '.(int) substr($search, 3)); } else { $search = $db->Quote('%'.$db->escape($search, true).'%'); $query->where('('.'a.title LIKE '.$search.' OR a.note LIKE '.$search.')'); } } // Filter on the language. if ($language = $this->getState('filter.language')) { $query->where('a.language = ' . $db->quote($language)); } //echo nl2br(str_replace('#__','jos_',$query)); return $query; } } PK>\]models/positions.phpnuW+AgetUserStateFromRequest($this->context.'.filter.search', 'filter_search'); $this->setState('filter.search', $search); $state = $this->getUserStateFromRequest($this->context.'.filter.state', 'filter_state', '', 'string'); $this->setState('filter.state', $state); $clientId = JRequest::getInt('client_id', 0); $this->setState('filter.client_id', $clientId); $template = $this->getUserStateFromRequest($this->context.'.filter.template', 'filter_template', '', 'string'); $this->setState('filter.template', $template); $type = $this->getUserStateFromRequest($this->context.'.filter.type', 'filter_type', '', 'string'); $this->setState('filter.type', $type); // Load the parameters. $params = JComponentHelper::getParams('com_modules'); $this->setState('params', $params); // List state information. parent::populateState('value', 'asc'); } /** * Method to get an array of data items. * * @return mixed An array of data items on success, false on failure. * @since 1.6 */ public function getItems() { if (!isset($this->items)) { $lang = JFactory::getLanguage(); $search = $this->getState('filter.search'); $state = $this->getState('filter.state'); $clientId = $this->getState('filter.client_id'); $filter_template = $this->getState('filter.template'); $type = $this->getState('filter.type'); $ordering = $this->getState('list.ordering'); $direction = $this->getState('list.direction'); $limitstart = $this->getState('list.start'); $limit = $this->getState('list.limit'); $client = JApplicationHelper::getClientInfo($clientId); if ($type!='template') { // Get the database object and a new query object. $query = $this->_db->getQuery(true); $query->select('DISTINCT(position) as value'); $query->from('#__modules'); $query->where($this->_db->quoteName('client_id').' = '.(int) $clientId); if ($search) { $query->where('position LIKE '.$this->_db->Quote('%'.$this->_db->escape($search, true).'%')); } $this->_db->setQuery($query); $positions = $this->_db->loadObjectList('value'); // Check for a database error. if ($error = $this->_db->getErrorMsg()) { $this->setError($error); return false; } foreach ($positions as $value=>$position) { $positions[$value] = array(); } } else { $positions=array(); } // Load the positions from the installed templates. foreach (ModulesHelper::getTemplates($clientId) as $template) { $path = JPath::clean($client->path.'/templates/'.$template->element.'/templateDetails.xml'); if (file_exists($path)) { $xml = simplexml_load_file($path); if (isset($xml->positions[0])) { $lang->load('tpl_'.$template->element.'.sys', $client->path, null, false, true) || $lang->load('tpl_'.$template->element.'.sys', $client->path.'/templates/'.$template->element, null, false, true); foreach ($xml->positions[0] as $position) { $value = (string)$position['value']; $label = (string)$position; if (!$value) { $value = $label; $label = preg_replace('/[^a-zA-Z0-9_\-]/', '_', 'TPL_'.$template->element.'_POSITION_'.$value); $altlabel = preg_replace('/[^a-zA-Z0-9_\-]/', '_', 'COM_MODULES_POSITION_'.$value); if (!$lang->hasKey($label) && $lang->hasKey($altlabel)) { $label = $altlabel; } } if ($type=='user' || ($state!='' && $state!=$template->enabled)) { unset($positions[$value]); } elseif (preg_match(chr(1).$search.chr(1).'i', $value) && ($filter_template=='' || $filter_template==$template->element)) { if (!isset($positions[$value])) { $positions[$value] = array(); } $positions[$value][$template->name]=$label; } } } } } $this->total = count($positions); if ($limitstart >= $this->total) { $limitstart = $limitstart < $limit ? 0 : $limitstart - $limit; $this->setState('list.start', $limitstart); } if ($ordering == 'value') { if ($direction == 'asc') { ksort($positions); } else { krsort($positions); } } else { if ($direction == 'asc') { asort($positions); } else { arsort($positions); } } $this->items = array_slice($positions, $limitstart, $limit ? $limit : null); } return $this->items; } /** * Method to get the total number of items. * * @return int The total number of items. * @since 1.6 */ public function getTotal() { if (!isset($this->total)) { $this->getItems(); } return $this->total; } } PK>\Vhelpers/index.htmlnuW+A PK>\)helpers/.htaccessnuW+A Order allow,deny Deny from all PK>\Vhelpers/html/index.htmlnuW+A PK>\)helpers/html/.htaccessnuW+A Order allow,deny Deny from all PK>\Fhelpers/html/modules.phpnuW+Aelement, $template->name); } return $options; } /** */ static public function types() { $options = array(); $options[] = JHtml::_('select.option', 'user', 'COM_MODULES_OPTION_POSITION_USER_DEFINED'); $options[] = JHtml::_('select.option', 'template', 'COM_MODULES_OPTION_POSITION_TEMPLATE_DEFINED'); return $options; } /** */ static public function templateStates() { $options = array(); $options[] = JHtml::_('select.option', '1', 'JENABLED'); $options[] = JHtml::_('select.option', '0', 'JDISABLED'); return $options; } /** * Returns a published state on a grid * * @param integer $value The state value. * @param integer $i The row index * @param boolean $enabled An optional setting for access control on the action. * @param string $checkbox An optional prefix for checkboxes. * * @return string The Html code * * @see JHtmlJGrid::state * * @since 1.7.1 */ public static function state($value, $i, $enabled = true, $checkbox = 'cb') { $states = array( 1 => array( 'unpublish', 'COM_MODULES_EXTENSION_PUBLISHED_ENABLED', 'COM_MODULES_HTML_UNPUBLISH_ENABLED', 'COM_MODULES_EXTENSION_PUBLISHED_ENABLED', true, 'publish', 'publish' ), 0 => array( 'publish', 'COM_MODULES_EXTENSION_UNPUBLISHED_ENABLED', 'COM_MODULES_HTML_PUBLISH_ENABLED', 'COM_MODULES_EXTENSION_UNPUBLISHED_ENABLED', true, 'unpublish', 'unpublish' ), -1 => array( 'unpublish', 'COM_MODULES_EXTENSION_PUBLISHED_DISABLED', 'COM_MODULES_HTML_UNPUBLISH_DISABLED', 'COM_MODULES_EXTENSION_PUBLISHED_DISABLED', true, 'warning', 'warning' ), -2 => array( 'publish', 'COM_MODULES_EXTENSION_UNPUBLISHED_DISABLED', 'COM_MODULES_HTML_PUBLISH_DISABLED', 'COM_MODULES_EXTENSION_UNPUBLISHED_DISABLED', true, 'unpublish', 'unpublish' ), ); return JHtml::_('jgrid.state', $states, $value, $i, 'modules.', $enabled, true, $checkbox); } /** * Display a batch widget for the module position selector. * * @param integer $clientId The client ID * * @return string The necessary HTML for the widget. * * @since 2.5 */ public static function positions($clientId) { // Create the copy/move options. $options = array( JHtml::_('select.option', 'c', JText::_('JLIB_HTML_BATCH_COPY')), JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE')) ); // Create the batch selector to change select the category by which to move or copy. $lines = array( '', '
', '', JHtml::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'), '
' ); return implode("\n", $lines); } /** * Method to get the field options. * * @param integer $clientId The client ID * * @return array The field option objects. * * @since 2.5 */ public static function positionList($clientId = 0) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('DISTINCT(position) as value'); $query->select('position as text'); $query->from($db->quoteName('#__modules')); $query->where($db->quoteName('client_id') . ' = ' . (int) $clientId); $query->order('position'); // Get the options. $db->setQuery($query); $options = $db->loadObjectList(); // Check for a database error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); } // Pop the first item off the array if it's blank if (strlen($options[0]->text) < 1) { array_shift($options); } return $options; } } PK>\__helpers/xml.phpnuW+A $row) { if ($row->module == '') { $rows[$i]->name = 'custom'; $rows[$i]->module = 'custom'; $rows[$i]->descrip = 'Custom created module, using Module Manager New function'; } else { $data = JInstaller::parseXMLInstallFile($row->path . '/' . $row->file); if ($data['type'] == 'module') { $rows[$i]->name = $data['name']; $rows[$i]->descrip = $data['description']; } } } } } PK>\;shelpers/modules.phpnuW+Aset($action->name, $user->authorise($action->name, 'com_modules')); } return $result; } /** * Get a list of filter options for the state of a module. * * @return array An array of JHtmlOption elements. */ public static function getStateOptions() { // Build the filter options. $options = array(); $options[] = JHtml::_('select.option', '1', JText::_('JPUBLISHED')); $options[] = JHtml::_('select.option', '0', JText::_('JUNPUBLISHED')); $options[] = JHtml::_('select.option', '-2', JText::_('JTRASHED')); return $options; } /** * Get a list of filter options for the application clients. * * @return array An array of JHtmlOption elements. */ public static function getClientOptions() { // Build the filter options. $options = array(); $options[] = JHtml::_('select.option', '0', JText::_('JSITE')); $options[] = JHtml::_('select.option', '1', JText::_('JADMINISTRATOR')); return $options; } static function getPositions($clientId) { jimport('joomla.filesystem.folder'); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('DISTINCT(position)'); $query->from('#__modules'); $query->where($db->quoteName('client_id').' = '.(int) $clientId); $query->order('position'); $db->setQuery($query); $positions = $db->loadColumn(); $positions = (is_array($positions)) ? $positions : array(); if ($error = $db->getErrorMsg()) { JError::raiseWarning(500, $error); return; } // Build the list $options = array(); foreach ($positions as $position) { if (!$position) { $options[] = JHtml::_('select.option', 'none', ':: '.JText::_('JNONE').' ::'); } else { $options[] = JHtml::_('select.option', $position, $position); } } return $options; } public static function getTemplates($clientId = 0, $state = '', $template='') { $db = JFactory::getDbo(); // Get the database object and a new query object. $query = $db->getQuery(true); // Build the query. $query->select('element, name, enabled'); $query->from('#__extensions'); $query->where('client_id = '.(int) $clientId); $query->where('type = '.$db->quote('template')); if ($state!='') { $query->where('enabled = '.$db->quote($state)); } if ($template!='') { $query->where('element = '.$db->quote($template)); } // Set the query and load the templates. $db->setQuery($query); $templates = $db->loadObjectList('element'); return $templates; } /** * Get a list of the unique modules installed in the client application. * * @param int The client id. * * @return array */ public static function getModules($clientId) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('element AS value, name AS text'); $query->from('#__extensions as e'); $query->where('e.client_id = '.(int)$clientId); $query->where('type = '.$db->quote('module')); $query->leftJoin('#__modules as m ON m.module=e.element AND m.client_id=e.client_id'); $query->where('m.module IS NOT NULL'); $query->group('element,name'); $db->setQuery($query); $modules = $db->loadObjectList(); $lang = JFactory::getLanguage(); foreach ($modules as $i=>$module) { $extension = $module->value; $path = $clientId ? JPATH_ADMINISTRATOR : JPATH_SITE; $source = $path . "/modules/$extension"; $lang->load("$extension.sys", $path, null, false, true) || $lang->load("$extension.sys", $source, null, false, true); $modules[$i]->text = JText::_($module->text); } JArrayHelper::sortObjects($modules, 'text', 1, true, $lang->getLocale()); return $modules; } /** * Get a list of the assignment options for modules to menus. * * @param int The client id. * * @return array */ public static function getAssignmentOptions($clientId) { $options = array(); $options[] = JHtml::_('select.option', '0', 'COM_MODULES_OPTION_MENU_ALL'); $options[] = JHtml::_('select.option', '-', 'COM_MODULES_OPTION_MENU_NONE'); if ($clientId == 0) { $options[] = JHtml::_('select.option', '1', 'COM_MODULES_OPTION_MENU_INCLUDE'); $options[] = JHtml::_('select.option', '-1', 'COM_MODULES_OPTION_MENU_EXCLUDE'); } return $options; } } PK >\V index.htmlnuW+APK >\''Ymodules/default.phpnuW+APK >\)M(modules/.htaccessnuW+APK >\V )modules/index.htmlnuW+APK >\) n).htaccessnuW+APK >\V&*positions/index.htmlnuW+APK >\)*positions/.htaccessnuW+APK >\i8K+positions/modal.phpnuW+APK >\:eMu=module/edit_options.phpnuW+APK >\dzXAABmodule/edit.phpnuW+APK >\VWmodule/index.htmlnuW+APK >\)Wmodule/.htaccessnuW+APK>\d8Zbb >Xconfig.xmlnuW+APK>\Q Yaccess.xmlnuW+APK>\@\controller.phpnuW+APK>\  cmodules.xmlnuW+APK>\) gviews/select/.htaccessnuW+APK>\Vgviews/select/index.htmlnuW+APK>\)Khviews/select/tmpl/.htaccessnuW+APK>\Viviews/select/tmpl/index.htmlnuW+APK>\siviews/select/tmpl/default.phpnuW+APK>\(''mviews/select/view.html.phpnuW+APK>\)4qviews/positions/tmpl/.htaccessnuW+APK>\Vrviews/positions/tmpl/index.htmlnuW+APK>\XeB''orviews/positions/tmpl/modal.phpnuW+APK>\B<views/positions/view.html.phpnuW+APK>\)7views/positions/.htaccessnuW+APK>\Vviews/positions/index.htmlnuW+APK>\Vhviews/index.htmlnuW+APK>\)LJviews/.htaccessnuW+APK>\)views/module/.htaccessnuW+APK>\07ii%Jviews/module/tmpl/edit_assignment.phpnuW+APK>\NNviews/module/tmpl/edit.phpnuW+APK>\H>cssviews/module/tmpl/modal.phpnuW+APK>\)^views/module/tmpl/.htaccessnuW+APK>\笗"(views/module/tmpl/edit_options.phpnuW+APK>\V views/module/tmpl/index.htmlnuW+APK>\Vvviews/module/index.htmlnuW+APK>\HO O ܹviews/module/view.html.phpnuW+APK>\ UU$uviews/modules/tmpl/default_batch.phpnuW+APK>\Vviews/modules/tmpl/index.htmlnuW+APK>\;t$t$views/modules/tmpl/default.phpnuW+APK>\)Lviews/modules/tmpl/.htaccessnuW+APK>\r<@c c views/modules/view.html.phpnuW+APK>\)views/modules/.htaccessnuW+APK>\Vviews/modules/index.htmlnuW+APK>\)views/preview/.htaccessnuW+APK>\Vviews/preview/index.htmlnuW+APK>\Ou*TTviews/preview/view.html.phpnuW+APK>\vviews/preview/tmpl/default.phpnuW+APK>\Vviews/preview/tmpl/index.htmlnuW+APK>\)8views/preview/tmpl/.htaccessnuW+APK>\!D** modules.phpnuW+APK>\?@hcontrollers/modules.phpnuW+APK>\)J controllers/.htaccessnuW+APK>\̪ controllers/module.phpnuW+APK>\Vjcontrollers/index.htmlnuW+APK>\)models/fields/.htaccessnuW+APK>\ models/fields/moduleposition.phpnuW+APK>\V%models/fields/index.htmlnuW+APK>\7# :&models/fields/moduleorder.phpnuW+APK>\ilh0models/select.phpnuW+APK>\V@models/index.htmlnuW+APK>\V@models/forms/index.htmlnuW+APK>\)YAmodels/forms/.htaccessnuW+APK>\%p Bmodels/forms/module.xmlnuW+APK>\)0Mmodels/.htaccessnuW+APK>\HccMmodels/module.phpnuW+APK>\%G$$models/modules.phpnuW+APK>\]#models/positions.phpnuW+APK>\Vhelpers/index.htmlnuW+APK>\)helpers/.htaccessnuW+APK>\V@helpers/html/index.htmlnuW+APK>\)helpers/html/.htaccessnuW+APK>\Fkhelpers/html/modules.phpnuW+APK>\__helpers/xml.phpnuW+APK>\;sehelpers/modules.phpnuW+APKMMS