File manager - Edit - /home/opticamezl/www/newok/Model.zip
Back
PK -��\�s]�@; @; IndexModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Finder\Administrator\Model; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\ListModel; use Joomla\CMS\Plugin\PluginHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Index model class for Finder. * * @since 2.5 */ class IndexModel extends ListModel { /** * The event to trigger after deleting the data. * * @var string * @since 2.5 */ protected $event_after_delete = 'onContentAfterDelete'; /** * The event to trigger before deleting the data. * * @var string * @since 2.5 */ protected $event_before_delete = 'onContentBeforeDelete'; /** * The event to trigger after purging the data. * * @var string * @since 4.0.0 */ protected $event_after_purge = 'onFinderIndexAfterPurge'; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * @param ?MVCFactoryInterface $factory The factory. * * @see \Joomla\CMS\MVC\Model\BaseDatabaseModel * @since 3.7 */ public function __construct($config = [], MVCFactoryInterface $factory = null) { if (empty($config['filter_fields'])) { $config['filter_fields'] = [ 'state', 'published', 'l.published', 'title', 'l.title', 'type', 'type_id', 'l.type_id', 't.title', 't_title', 'url', 'l.url', 'language', 'l.language', 'indexdate', 'l.indexdate', 'content_map', ]; } parent::__construct($config, $factory); } /** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission for the component. * * @since 2.5 */ protected function canDelete($record) { return $this->getCurrentUser()->authorise('core.delete', $this->option); } /** * Method to test whether a record can have its state changed. * * @param object $record A record object. * * @return boolean True if allowed to change the state of the record. Defaults to the permission for the component. * * @since 2.5 */ protected function canEditState($record) { return $this->getCurrentUser()->authorise('core.edit.state', $this->option); } /** * Method to delete one or more records. * * @param array $pks An array of record primary keys. * * @return boolean True if successful, false if an error occurs. * * @since 2.5 */ public function delete(&$pks) { $pks = (array) $pks; $table = $this->getTable(); // Include the content plugins for the on delete events. PluginHelper::importPlugin('content'); // Iterate the items to delete each one. foreach ($pks as $i => $pk) { if ($table->load($pk)) { if ($this->canDelete($table)) { $context = $this->option . '.' . $this->name; // Trigger the onContentBeforeDelete event. $result = Factory::getApplication()->triggerEvent($this->event_before_delete, [$context, $table]); if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; } if (!$table->delete($pk)) { $this->setError($table->getError()); return false; } // Trigger the onContentAfterDelete event. Factory::getApplication()->triggerEvent($this->event_after_delete, [$context, $table]); } else { // Prune items that you can't change. unset($pks[$i]); $error = $this->getError(); if ($error) { $this->setError($error); } else { $this->setError(Text::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED')); } } } else { $this->setError($table->getError()); return false; } } // Clear the component's cache $this->cleanCache(); return true; } /** * Build an SQL query to load the list data. * * @return \Joomla\Database\DatabaseQuery * * @since 2.5 */ protected function getListQuery() { $db = $this->getDatabase(); $query = $db->getQuery(true) ->select('l.*') ->select($db->quoteName('t.title', 't_title')) ->from($db->quoteName('#__finder_links', 'l')) ->join('INNER', $db->quoteName('#__finder_types', 't') . ' ON ' . $db->quoteName('t.id') . ' = ' . $db->quoteName('l.type_id')); // Check the type filter. $type = $this->getState('filter.type'); // Join over the language $query->select('la.title AS language_title, la.image AS language_image') ->join('LEFT', $db->quoteName('#__languages') . ' AS la ON la.lang_code = l.language'); if (is_numeric($type)) { $query->where($db->quoteName('l.type_id') . ' = ' . (int) $type); } // Check the map filter. $contentMapId = $this->getState('filter.content_map'); if (is_numeric($contentMapId)) { $query->join('INNER', $db->quoteName('#__finder_taxonomy_map', 'm') . ' ON ' . $db->quoteName('m.link_id') . ' = ' . $db->quoteName('l.link_id')) ->where($db->quoteName('m.node_id') . ' = ' . (int) $contentMapId); } // Check for state filter. $state = $this->getState('filter.state'); if (is_numeric($state)) { $query->where($db->quoteName('l.published') . ' = ' . (int) $state); } // Filter on the language. if ($language = $this->getState('filter.language')) { $query->where($db->quoteName('l.language') . ' = ' . $db->quote($language)); } // Check the search phrase. $search = $this->getState('filter.search'); if (!empty($search)) { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $orSearchSql = $db->quoteName('l.title') . ' LIKE ' . $search . ' OR ' . $db->quoteName('l.url') . ' LIKE ' . $search; // Filter by indexdate only if $search doesn't contains non-ascii characters if (!preg_match('/[^\x00-\x7F]/', $search)) { $orSearchSql .= ' OR ' . $query->castAsChar($db->quoteName('l.indexdate')) . ' LIKE ' . $search; } $query->where('(' . $orSearchSql . ')'); } // Handle the list ordering. $listOrder = $this->getState('list.ordering', 'l.title'); $listDir = $this->getState('list.direction', 'ASC'); if ($listOrder === 't.title') { $ordering = $db->quoteName('t.title') . ' ' . $db->escape($listDir) . ', ' . $db->quoteName('l.title') . ' ' . $db->escape($listDir); } else { $ordering = $db->escape($listOrder) . ' ' . $db->escape($listDir); } $query->order($ordering); return $query; } /** * Method to get the state of the Smart Search Plugins. * * @return array Array of relevant plugins and whether they are enabled or not. * * @since 2.5 */ public function getPluginState() { $db = $this->getDatabase(); $query = $db->getQuery(true) ->select('name, enabled') ->from($db->quoteName('#__extensions')) ->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) ->where($db->quoteName('folder') . ' IN (' . $db->quote('system') . ',' . $db->quote('content') . ')') ->where($db->quoteName('element') . ' = ' . $db->quote('finder')); $db->setQuery($query); return $db->loadObjectList('name'); } /** * 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 $id A prefix for the store id. [optional] * * @return string A store id. * * @since 2.5 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.state'); $id .= ':' . $this->getState('filter.type'); $id .= ':' . $this->getState('filter.content_map'); return parent::getStoreId($id); } /** * Gets the total of indexed items. * * @return integer The total of indexed items. * * @since 3.6.0 */ public function getTotalIndexed() { $db = $this->getDatabase(); $query = $db->getQuery(true) ->select('COUNT(link_id)') ->from($db->quoteName('#__finder_links')); $db->setQuery($query); return (int) $db->loadResult(); } /** * Returns a Table object, always creating it. * * @param string $type The table type to instantiate. [optional] * @param string $prefix A prefix for the table class name. [optional] * @param array $config Configuration array for model. [optional] * * @return \Joomla\CMS\Table\Table A database object * * @since 2.5 */ public function getTable($type = 'Link', $prefix = 'Administrator', $config = []) { return parent::getTable($type, $prefix, $config); } /** * Method to purge the index, deleting all links. * * @return boolean True on success, false on failure. * * @since 2.5 * @throws \Exception on database error */ public function purge() { $db = $this->getDatabase(); // Truncate the links table. $db->truncateTable('#__finder_links'); // Truncate the links terms tables. $db->truncateTable('#__finder_links_terms'); // Truncate the terms table. $db->truncateTable('#__finder_terms'); // Truncate the taxonomy map table. $db->truncateTable('#__finder_taxonomy_map'); // Truncate the taxonomy table and insert the root node. $db->truncateTable('#__finder_taxonomy'); $root = (object) [ 'id' => 1, 'parent_id' => 0, 'lft' => 0, 'rgt' => 1, 'level' => 0, 'path' => '', 'title' => 'ROOT', 'alias' => 'root', 'state' => 1, 'access' => 1, 'language' => '*', ]; $db->insertObject('#__finder_taxonomy', $root); // Truncate the tokens tables. $db->truncateTable('#__finder_tokens'); // Truncate the tokens aggregate table. $db->truncateTable('#__finder_tokens_aggregate'); // Include the finder plugins for the on purge events. PluginHelper::importPlugin('finder'); Factory::getApplication()->triggerEvent($this->event_after_purge); return true; } /** * Method to auto-populate the model state. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. [optional] * @param string $direction An optional direction. [optional] * * @return void * * @since 2.5 */ protected function populateState($ordering = 'l.title', $direction = 'asc') { // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'cmd')); $this->setState('filter.type', $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', '', 'cmd')); $this->setState('filter.content_map', $this->getUserStateFromRequest($this->context . '.filter.content_map', 'filter_content_map', '', 'cmd')); $this->setState('filter.language', $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '')); // Load the parameters. $params = ComponentHelper::getParams('com_finder'); $this->setState('params', $params); // List state information. parent::populateState($ordering, $direction); } /** * Method to change the published state of one or more records. * * @param array $pks A list of the primary keys to change. * @param integer $value The value of the published state. [optional] * * @return boolean True on success. * * @since 2.5 */ public function publish(&$pks, $value = 1) { $user = $this->getCurrentUser(); $table = $this->getTable(); $pks = (array) $pks; // Include the content plugins for the change of state event. PluginHelper::importPlugin('content'); // Access checks. foreach ($pks as $i => $pk) { $table->reset(); if ($table->load($pk) && !$this->canEditState($table)) { // Prune items that you can't change. unset($pks[$i]); $this->setError(Text::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); return false; } } // Attempt to change the state of the records. if (!$table->publish($pks, $value, $user->get('id'))) { $this->setError($table->getError()); return false; } $context = $this->option . '.' . $this->name; // Trigger the onContentChangeState event. $result = Factory::getApplication()->triggerEvent('onContentChangeState', [$context, $pks, $value]); if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; } // Clear the component's cache $this->cleanCache(); return true; } } PK -��\ӌe� � SearchesModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Finder\Administrator\Model; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\ListModel; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Methods supporting a list of search terms. * * @since 4.0.0 */ class SearchesModel extends ListModel { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * @param ?MVCFactoryInterface $factory The factory. * * @see \Joomla\CMS\MVC\Model\BaseDatabaseModel * @since 4.0.0 */ public function __construct($config = [], MVCFactoryInterface $factory = null) { if (empty($config['filter_fields'])) { $config['filter_fields'] = [ 'searchterm', 'a.searchterm', 'hits', 'a.hits', ]; } parent::__construct($config, $factory); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 4.0.0 */ protected function populateState($ordering = 'a.hits', $direction = 'asc') { // Special state for toggle results button. $this->setState('show_results', $this->getUserStateFromRequest($this->context . '.show_results', 'show_results', 1, 'int')); // Load the parameters. $params = ComponentHelper::getParams('com_finder'); $this->setState('params', $params); // List state information. parent::populateState($ordering, $direction); } /** * 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 $id A prefix for the store id. * * @return string A store id. * * @since 4.0.0 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('show_results'); $id .= ':' . $this->getState('filter.search'); return parent::getStoreId($id); } /** * Build an SQL query to load the list data. * * @return \Joomla\Database\DatabaseQuery * * @since 4.0.0 */ protected function getListQuery() { // Create a new query object. $db = $this->getDatabase(); $query = $db->getQuery(true); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'a.*' ) ); $query->from($db->quoteName('#__finder_logging', 'a')); // Filter by search in title if ($search = $this->getState('filter.search')) { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $query->where($db->quoteName('a.searchterm') . ' LIKE ' . $search); } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.hits')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); return $query; } /** * Override the parent getItems to inject optional data. * * @return mixed An array of objects on success, false on failure. * * @since 4.0.0 */ public function getItems() { $items = parent::getItems(); foreach ($items as $item) { if (is_resource($item->query)) { $item->query = unserialize(stream_get_contents($item->query)); } else { $item->query = unserialize($item->query); } } return $items; } /** * Method to reset the search log table. * * @return boolean * * @since 4.0.0 */ public function reset() { $db = $this->getDatabase(); try { $db->truncateTable('#__finder_logging'); } catch (\RuntimeException $e) { $this->setError($e->getMessage()); return false; } return true; } } PK -��\��J!` ` FiltersModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Finder\Administrator\Model; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\ListModel; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Filters model class for Finder. * * @since 2.5 */ class FiltersModel extends ListModel { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * @param ?MVCFactoryInterface $factory The factory. * * @see \Joomla\CMS\MVC\Model\BaseDatabaseModel * @since 3.7 */ public function __construct($config = [], MVCFactoryInterface $factory = null) { if (empty($config['filter_fields'])) { $config['filter_fields'] = [ 'filter_id', 'a.filter_id', 'title', 'a.title', 'state', 'a.state', 'created_by_alias', 'a.created_by_alias', 'created', 'a.created', 'map_count', 'a.map_count', ]; } parent::__construct($config, $factory); } /** * Build an SQL query to load the list data. * * @return \Joomla\Database\DatabaseQuery * * @since 2.5 */ protected function getListQuery() { $db = $this->getDatabase(); $query = $db->getQuery(true); // Select all fields from the table. $query->select('a.*') ->from($db->quoteName('#__finder_filters', 'a')); // Join over the users for the checked out user. $query->select($db->quoteName('uc.name', 'editor')) ->join('LEFT', $db->quoteName('#__users', 'uc') . ' ON ' . $db->quoteName('uc.id') . ' = ' . $db->quoteName('a.checked_out')); // Join over the users for the author. $query->select($db->quoteName('ua.name', 'user_name')) ->join('LEFT', $db->quoteName('#__users', 'ua') . ' ON ' . $db->quoteName('ua.id') . ' = ' . $db->quoteName('a.created_by')); // Check for a search filter. if ($search = $this->getState('filter.search')) { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $query->where($db->quoteName('a.title') . ' LIKE ' . $search); } // If the model is set to check item state, add to the query. $state = $this->getState('filter.state'); if (is_numeric($state)) { $query->where($db->quoteName('a.state') . ' = ' . (int) $state); } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.title') . ' ' . $db->escape($this->getState('list.direction', 'ASC')))); return $query; } /** * 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 $id A prefix for the store id. [optional] * * @return string A store id. * * @since 2.5 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.state'); return parent::getStoreId($id); } /** * Method to auto-populate the model state. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. [optional] * @param string $direction An optional direction. [optional] * * @return void * * @since 2.5 */ protected function populateState($ordering = 'a.title', $direction = 'asc') { // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'cmd')); // Load the parameters. $params = ComponentHelper::getParams('com_finder'); $this->setState('params', $params); // List state information. parent::populateState($ordering, $direction); } } PK -��\̿��, , IndexerModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Finder\Administrator\Model; use Joomla\CMS\MVC\Model\BaseDatabaseModel; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Indexer model class for Finder. * * @since 2.5 */ class IndexerModel extends BaseDatabaseModel { } PK -��\Bр�2 �2 MapsModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Finder\Administrator\Model; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\ListModel; use Joomla\CMS\Plugin\PluginHelper; use Joomla\Database\DatabaseQuery; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Maps model for the Finder package. * * @since 2.5 */ class MapsModel extends ListModel { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * @param ?MVCFactoryInterface $factory The factory. * * @see \Joomla\CMS\MVC\Model\BaseDatabaseModel * @since 3.7 */ public function __construct($config = [], MVCFactoryInterface $factory = null) { if (empty($config['filter_fields'])) { $config['filter_fields'] = [ 'state', 'a.state', 'title', 'a.title', 'branch', 'branch_title', 'd.branch_title', 'level', 'd.level', 'language', 'a.language', ]; } parent::__construct($config, $factory); } /** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission for the component. * * @since 2.5 */ protected function canDelete($record) { return $this->getCurrentUser()->authorise('core.delete', $this->option); } /** * Method to test whether a record can have its state changed. * * @param object $record A record object. * * @return boolean True if allowed to change the state of the record. Defaults to the permission for the component. * * @since 2.5 */ protected function canEditState($record) { return $this->getCurrentUser()->authorise('core.edit.state', $this->option); } /** * Method to delete one or more records. * * @param array $pks An array of record primary keys. * * @return boolean True if successful, false if an error occurs. * * @since 2.5 */ public function delete(&$pks) { $pks = (array) $pks; $table = $this->getTable(); // Include the content plugins for the on delete events. PluginHelper::importPlugin('content'); // Iterate the items to check if all of them exist. foreach ($pks as $i => $pk) { if (!$table->load($pk)) { // Item is not in the table. $this->setError($table->getError()); return false; } } // Iterate the items to delete each one. foreach ($pks as $i => $pk) { if ($table->load($pk)) { if ($this->canDelete($table)) { $context = $this->option . '.' . $this->name; // Trigger the onContentBeforeDelete event. $result = Factory::getApplication()->triggerEvent('onContentBeforeDelete', [$context, $table]); if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; } if (!$table->delete($pk)) { $this->setError($table->getError()); return false; } // Trigger the onContentAfterDelete event. Factory::getApplication()->triggerEvent('onContentAfterDelete', [$context, $table]); } else { // Prune items that you can't change. unset($pks[$i]); $error = $this->getError(); if ($error) { $this->setError($error); } else { $this->setError(Text::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED')); } } } } // Clear the component's cache $this->cleanCache(); return true; } /** * Build an SQL query to load the list data. * * @return \Joomla\Database\DatabaseQuery * * @since 2.5 */ protected function getListQuery() { $db = $this->getDatabase(); // Select all fields from the table. $query = $db->getQuery(true) ->select('a.id, a.parent_id, a.lft, a.rgt, a.level, a.path, a.title, a.alias, a.state, a.access, a.language') ->from($db->quoteName('#__finder_taxonomy', 'a')) ->where('a.parent_id != 0'); // Join to get the branch title $query->select([$db->quoteName('b.id', 'branch_id'), $db->quoteName('b.title', 'branch_title')]) ->leftJoin($db->quoteName('#__finder_taxonomy', 'b') . ' ON b.level = 1 AND b.lft <= a.lft AND a.rgt <= b.rgt'); // Join to get the map links. $stateQuery = $db->getQuery(true) ->select('m.node_id') ->select('COUNT(NULLIF(l.published, 0)) AS count_published') ->select('COUNT(NULLIF(l.published, 1)) AS count_unpublished') ->from($db->quoteName('#__finder_taxonomy_map', 'm')) ->leftJoin($db->quoteName('#__finder_links', 'l') . ' ON l.link_id = m.link_id') ->group('m.node_id'); $query->select('COALESCE(s.count_published, 0) AS count_published'); $query->select('COALESCE(s.count_unpublished, 0) AS count_unpublished'); $query->leftJoin('(' . $stateQuery . ') AS s ON s.node_id = a.id'); // If the model is set to check item state, add to the query. $state = $this->getState('filter.state'); if (is_numeric($state)) { $query->where('a.state = ' . (int) $state); } // Filter over level. $level = $this->getState('filter.level'); if (is_numeric($level) && (int) $level === 1) { $query->where('a.parent_id = 1'); } // Filter the maps over the branch if set. $branchId = $this->getState('filter.branch'); if (is_numeric($branchId)) { $query->where('a.parent_id = ' . (int) $branchId); } // Filter the maps over the search string if set. if ($search = $this->getState('filter.search')) { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $query->where('a.title LIKE ' . $search); } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'branch_title, a.lft')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); return $query; } /** * Returns a record count for the query. * * @param \Joomla\Database\DatabaseQuery|string * * @return integer Number of rows for query. * * @since 3.0 */ protected function _getListCount($query) { $query = clone $query; $query->clear('select')->clear('join')->clear('order')->clear('limit')->clear('offset')->select('COUNT(*)'); return (int) $this->getDatabase()->setQuery($query)->loadResult(); } /** * 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 $id A prefix for the store id. [optional] * * @return string A store id. * * @since 2.5 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.state'); $id .= ':' . $this->getState('filter.branch'); $id .= ':' . $this->getState('filter.level'); return parent::getStoreId($id); } /** * Returns a Table object, always creating it. * * @param string $type The table type to instantiate. [optional] * @param string $prefix A prefix for the table class name. [optional] * @param array $config Configuration array for model. [optional] * * @return \Joomla\CMS\Table\Table A database object * * @since 2.5 */ public function getTable($type = 'Map', $prefix = 'Administrator', $config = []) { return parent::getTable($type, $prefix, $config); } /** * Method to auto-populate the model state. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. [optional] * @param string $direction An optional direction. [optional] * * @return void * * @since 2.5 */ protected function populateState($ordering = 'branch_title, a.lft', $direction = 'ASC') { // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'cmd')); $this->setState('filter.branch', $this->getUserStateFromRequest($this->context . '.filter.branch', 'filter_branch', '', 'cmd')); $this->setState('filter.level', $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', '', 'cmd')); // Load the parameters. $params = ComponentHelper::getParams('com_finder'); $this->setState('params', $params); // List state information. parent::populateState($ordering, $direction); } /** * Method to change the published state of one or more records. * * @param array $pks A list of the primary keys to change. * @param integer $value The value of the published state. [optional] * * @return boolean True on success. * * @since 2.5 */ public function publish(&$pks, $value = 1) { $user = $this->getCurrentUser(); $table = $this->getTable(); $pks = (array) $pks; // Include the content plugins for the change of state event. PluginHelper::importPlugin('content'); // Access checks. foreach ($pks as $i => $pk) { $table->reset(); if ($table->load($pk) && !$this->canEditState($table)) { // Prune items that you can't change. unset($pks[$i]); $this->setError(Text::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); return false; } } // Attempt to change the state of the records. if (!$table->publish($pks, $value, $user->get('id'))) { $this->setError($table->getError()); return false; } $context = $this->option . '.' . $this->name; // Trigger the onContentChangeState event. $result = Factory::getApplication()->triggerEvent('onContentChangeState', [$context, $pks, $value]); if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; } // Clear the component's cache $this->cleanCache(); return true; } /** * Method to purge all maps from the taxonomy. * * @return boolean Returns true on success, false on failure. * * @since 2.5 */ public function purge() { $db = $this->getDatabase(); $query = $db->getQuery(true) ->delete($db->quoteName('#__finder_taxonomy')) ->where($db->quoteName('parent_id') . ' > 1'); $db->setQuery($query); $db->execute(); $query->clear() ->delete($db->quoteName('#__finder_taxonomy_map')); $db->setQuery($query); $db->execute(); return true; } /** * Manipulate the query to be used to evaluate if this is an Empty State to provide specific conditions for this extension. * * @return DatabaseQuery * * @since 4.0.0 */ protected function getEmptyStateQuery() { $query = parent::getEmptyStateQuery(); $title = 'ROOT'; $query->where($this->getDatabase()->quoteName('title') . ' <> :title') ->bind(':title', $title); return $query; } } PK -��\I�� StatisticsModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Finder\Administrator\Model; use Joomla\CMS\Factory; use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\PluginHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Statistics model class for Finder. * * @since 2.5 */ class StatisticsModel extends BaseDatabaseModel { /** * Method to get the component statistics * * @return CMSObject The component statistics * * @since 2.5 */ public function getData() { // Initialise $db = $this->getDatabase(); $query = $db->getQuery(true); $data = new CMSObject(); $query->select('COUNT(term_id)') ->from($db->quoteName('#__finder_terms')); $db->setQuery($query); $data->term_count = $db->loadResult(); $query->clear() ->select('COUNT(link_id)') ->from($db->quoteName('#__finder_links')); $db->setQuery($query); $data->link_count = $db->loadResult(); $query->clear() ->select('COUNT(id)') ->from($db->quoteName('#__finder_taxonomy')) ->where($db->quoteName('parent_id') . ' = 1'); $db->setQuery($query); $data->taxonomy_branch_count = $db->loadResult(); $query->clear() ->select('COUNT(id)') ->from($db->quoteName('#__finder_taxonomy')) ->where($db->quoteName('parent_id') . ' > 1'); $db->setQuery($query); $data->taxonomy_node_count = $db->loadResult(); $query->clear() ->select('t.title AS type_title, COUNT(a.link_id) AS link_count') ->from($db->quoteName('#__finder_links') . ' AS a') ->join('INNER', $db->quoteName('#__finder_types') . ' AS t ON t.id = a.type_id') ->group('a.type_id, t.title') ->order($db->quoteName('type_title') . ' ASC'); $db->setQuery($query); $data->type_list = $db->loadObjectList(); $lang = Factory::getLanguage(); $plugins = PluginHelper::getPlugin('finder'); foreach ($plugins as $plugin) { $lang->load('plg_finder_' . $plugin->name . '.sys', JPATH_ADMINISTRATOR) || $lang->load('plg_finder_' . $plugin->name . '.sys', JPATH_PLUGINS . '/finder/' . $plugin->name); } return $data; } } PK -��\fG�� FilterModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Finder\Administrator\Model; use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; use Joomla\CMS\MVC\Model\AdminModel; use Joomla\Component\Finder\Administrator\Table\FilterTable; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Filter model class for Finder. * * @since 2.5 */ class FilterModel extends AdminModel { /** * The prefix to use with controller messages. * * @var string * @since 2.5 */ protected $text_prefix = 'COM_FINDER'; /** * Model context string. * * @var string * @since 2.5 */ protected $context = 'com_finder.filter'; /** * Custom clean cache method. * * @param string $group The component name. [optional] * @param integer $clientId No longer used, will be removed without replacement * @deprecated 4.3 will be removed in 6.0 * * @return void * * @since 2.5 */ protected function cleanCache($group = 'com_finder', $clientId = 0) { parent::cleanCache($group); } /** * Method to get the filter data. * * @return FilterTable|boolean The filter data or false on a failure. * * @since 2.5 */ public function getFilter() { $filter_id = (int) $this->getState('filter.id'); // Get a FinderTableFilter instance. $filter = $this->getTable(); // Attempt to load the row. $return = $filter->load($filter_id); // Check for a database error. if ($return === false && $filter->getError()) { $this->setError($filter->getError()); return false; } // Process the filter data. if (!empty($filter->data)) { $filter->data = explode(',', $filter->data); } elseif (empty($filter->data)) { $filter->data = []; } return $filter; } /** * Method to get the record form. * * @param array $data Data for the form. [optional] * @param boolean $loadData True if the form is to load its own data (default case), false if not. [optional] * * @return Form|boolean A Form object on success, false on failure * * @since 2.5 */ public function getForm($data = [], $loadData = true) { // Get the form. $form = $this->loadForm('com_finder.filter', 'filter', ['control' => 'jform', 'load_data' => $loadData]); if (empty($form)) { return false; } return $form; } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 2.5 */ protected function loadFormData() { // Check the session for previously entered form data. $data = Factory::getApplication()->getUserState('com_finder.edit.filter.data', []); if (empty($data)) { $data = $this->getItem(); } $this->preprocessData('com_finder.filter', $data); return $data; } /** * Method to get the total indexed items * * @return integer The count of indexed items * * @since 3.5 */ public function getTotal() { $db = $this->getDatabase(); $query = $db->getQuery(true) ->select('MAX(link_id)') ->from('#__finder_links'); return $db->setQuery($query)->loadResult(); } } PK -��\�s]�@; @; IndexModel.phpnu �[��� PK -��\ӌe� � ~; SearchesModel.phpnu �[��� PK -��\��J!` ` xN FiltersModel.phpnu �[��� PK -��\̿��, , a IndexerModel.phpnu �[��� PK -��\Bр�2 �2 �c MapsModel.phpnu �[��� PK -��\I�� �� StatisticsModel.phpnu �[��� PK -��\fG�� r� FilterModel.phpnu �[��� PK . ��
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings