Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/com_search.zip
Назад
PK �!]�Y�� � search/default.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_search * * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('formbehavior.chosen', 'select'); ?> <div class="search<?php echo $this->pageclass_sfx; ?>"> <?php if ($this->params->get('show_page_heading')) : ?> <h1 class="page-title"> <?php if ($this->escape($this->params->get('page_heading'))) :?> <?php echo $this->escape($this->params->get('page_heading')); ?> <?php else : ?> <?php echo $this->escape($this->params->get('page_title')); ?> <?php endif; ?> </h1> <?php endif; ?> <?php echo $this->loadTemplate('form'); ?> <?php if ($this->error == null && count($this->results) > 0) : echo $this->loadTemplate('results'); else : echo $this->loadTemplate('error'); endif; ?> </div> PK �!]�őO O search/default_results.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_search * * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; ?> <dl class="search-results<?php echo $this->pageclass_sfx; ?>"> <?php foreach ($this->results as $result) : ?> <dt class="result-title"> <?php echo $this->pagination->limitstart + $result->count . '. '; ?> <?php if ($result->href) : ?> <a href="<?php echo JRoute::_($result->href); ?>"<?php if ($result->browsernav == 1) : ?> target="_blank"<?php endif; ?>> <?php echo $result->title; ?> </a> <?php else : ?> <?php echo $result->title; ?> <?php endif; ?> </dt> <?php if ($result->section) : ?> <dd class="result-category"> <span class="small<?php echo $this->pageclass_sfx; ?>"> (<?php echo $this->escape($result->section); ?>) </span> </dd> <?php endif; ?> <dd class="result-text"> <?php echo $result->text; ?> </dd> <?php if ($this->params->get('show_date')) : ?> <dd class="result-created<?php echo $this->pageclass_sfx; ?>"> <?php echo JText::sprintf('JGLOBAL_CREATED_DATE_ON', $result->created); ?> </dd> <?php endif; ?> <?php endforeach; ?> </dl> <div class="pagination"> <?php echo $this->pagination->getPagesLinks(); ?> </div> PK �!]ڶ8D search/default_form.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_search * * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; if(version_compare(JVERSION, '3.0', 'ge')){ JHtml::_('bootstrap.tooltip'); } $lang = JFactory::getLanguage(); $upper_limit = $lang->getUpperLimitSearchWord(); ?> <form id="searchForm" action="<?php echo JRoute::_('index.php?option=com_search');?>" method="post"> <div class="btn-toolbar"> <div class="btn-group pull-left"> <input type="text" name="searchword" placeholder="<?php echo JText::_('COM_SEARCH_SEARCH_KEYWORD'); ?>" id="search-searchword" size="30" maxlength="<?php echo $upper_limit; ?>" value="<?php echo $this->escape($this->origkeyword); ?>" class="input" /> </div> <div class="btn-group pull-left"> <button name="Search" onclick="this.form.submit()" class="btn hasTooltip" title="<?php echo JText::_('COM_SEARCH_SEARCH');?>"><span class="icon-search"></span></button> </div> <input type="hidden" name="task" value="search" /> <div class="clearfix"></div> </div> <div class="searchintro<?php echo $this->params->get('pageclass_sfx'); ?>"> <?php if (!empty($this->searchword)):?> <p><?php echo JText::plural('COM_SEARCH_SEARCH_KEYWORD_N_RESULTS', '<span class="badge badge-info">'. $this->total. '</span>');?></p> <?php endif;?> </div> <fieldset class="phrases"> <legend><?php echo JText::_('COM_SEARCH_FOR');?></legend> <div class="phrases-box"> <?php echo $this->lists['searchphrase']; ?> </div> <div class="ordering-box"> <label for="ordering" class="ordering"> <?php echo JText::_('COM_SEARCH_ORDERING');?> </label> <?php echo $this->lists['ordering'];?> </div> </fieldset> <?php if ($this->params->get('search_areas', 1)) : ?> <fieldset class="only"> <legend><?php echo JText::_('COM_SEARCH_SEARCH_ONLY');?></legend> <?php foreach ($this->searchareas['search'] as $val => $txt) : $checked = is_array($this->searchareas['active']) && in_array($val, $this->searchareas['active']) ? 'checked="checked"' : ''; ?> <label for="area-<?php echo $val;?>" class="checkbox"> <input type="checkbox" name="areas[]" value="<?php echo $val;?>" id="area-<?php echo $val;?>" <?php echo $checked;?> > <?php echo JText::_($txt); ?> </label> <?php endforeach; ?> </fieldset> <?php endif; ?> <?php if ($this->total > 0) : ?> <div class="form-limit"> <label for="limit"> <?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?> </label> <?php echo $this->pagination->getLimitBox(); ?> </div> <?php if($this->pagination->getPagesCounter() > 0) : ?> <p class="counter"><?php echo $this->pagination->getPagesCounter(); ?></p> <?php endif; ?> <?php endif; ?> </form> PK $"]L�8� � searches/default.phpnu &1i� <?php /** * @package Joomla.Administrator * @subpackage Template.hathor * * @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::_('behavior.multiselect'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> <form action="<?php echo JRoute::_('index.php?option=com_search&view=searches'); ?>" method="post" name="adminForm" id="adminForm"> <fieldset id="filter-bar"> <legend class="element-invisible"><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?></legend> <div class="filter-search"> <label class="filter-search-lbl" for="filter_search"><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?></label> <input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo JText::_('COM_SEARCH_SEARCH_IN_PHRASE'); ?>" /> <button type="submit"><?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?></button> <button type="button" onclick="document.getElementById('filter_search').value='';this.form.submit();"><?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?></button> </div> </fieldset> <div class="clr"> </div> <table class="adminlist"> <thead> <tr> <th class="title"> <?php echo JHtml::_('grid.sort', 'COM_SEARCH_HEADING_PHRASE', 'a.search_term', $listDirn, $listOrder); ?> </th> <th class="hits-col"> <?php echo JHtml::_('grid.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?> </th> <th class="width-15"> <?php echo JText::_('COM_SEARCH_HEADING_RESULTS'); ?> </th> </tr> </thead> <tbody> <?php foreach ($this->items as $i => $item) : ?> <tr class="row<?php echo $i % 2; ?>"> <td> <?php echo $this->escape($item->search_term); ?> </td> <td class="center"> <?php echo (int) $item->hits; ?> </td> <td class="center"> <?php if ($this->state->get('show_results')) : ?> <?php echo (int) $item->returns; ?> <?php else: ?> <?php echo JText::_('COM_SEARCH_NO_RESULTS'); ?> <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php echo $this->pagination->getListFooter(); ?> <input type="hidden" name="task" value="" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" /> <input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" /> <?php echo JHtml::_('form.token'); ?> </form> PK �0"]P٣�� � controller.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_search * * @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Search Component Controller * * @since 1.5 */ class SearchController extends JControllerLegacy { /** * Method to display a view. * * @param bool $cachable If true, the view output will be cached * @param bool $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JControllerLegacy This object to support chaining. * * @since 1.5 */ public function display($cachable = false, $urlparams = false) { // Force it to be the search view $this->input->set('view', 'search'); return parent::display($cachable, $urlparams); } /** * Search * * @return void * * @throws Exception */ public function search() { // Slashes cause errors, <> get stripped anyway later on. # causes problems. $badchars = array('#', '>', '<', '\\'); $searchword = trim(str_replace($badchars, '', $this->input->post->getString('searchword'))); // If searchword enclosed in double quotes, strip quotes and do exact match if (substr($searchword, 0, 1) === '"' && substr($searchword, -1) === '"') { $post['searchword'] = substr($searchword, 1, -1); $this->input->set('searchphrase', 'exact'); } else { $post['searchword'] = $searchword; } $post['ordering'] = $this->input->post->getWord('ordering'); $post['searchphrase'] = $this->input->post->getWord('searchphrase', 'all'); $post['limit'] = $this->input->post->getUInt('limit'); if ($post['limit'] === null) { unset($post['limit']); } $areas = $this->input->post->get('areas', null, 'array'); if ($areas) { foreach ($areas as $area) { $post['areas'][] = JFilterInput::getInstance()->clean($area, 'cmd'); } } // The Itemid from the request, we will use this if it's a search page or if there is no search page available $post['Itemid'] = $this->input->getInt('Itemid'); // Set Itemid id for links from menu $app = JFactory::getApplication(); $menu = $app->getMenu(); $item = $menu->getItem($post['Itemid']); // The requested Item is not a search page so we need to find one if ($item && ($item->component !== 'com_search' || $item->query['view'] !== 'search')) { // Get item based on component, not link. link is not reliable. $item = $menu->getItems('component', 'com_search', true); // If we found a search page, use that. if (!empty($item)) { $post['Itemid'] = $item->id; } } unset($post['task'], $post['submit']); $uri = JUri::getInstance(); $uri->setQuery($post); $uri->setVar('option', 'com_search'); $this->setRedirect(JRoute::_('index.php' . $uri->toString(array('query', 'fragment')), false)); } } PK �0"] �6 6 models/search.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_search * * @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Search Component Search Model * * @since 1.5 */ class SearchModelSearch extends JModelLegacy { /** * Search data array * * @var array */ protected $_data = null; /** * Search total * * @var integer */ protected $_total = null; /** * Search areas * * @var integer */ protected $_areas = null; /** * Pagination object * * @var object */ protected $_pagination = null; /** * Constructor * * @since 1.5 */ public function __construct() { parent::__construct(); // Get configuration $app = JFactory::getApplication(); $config = JFactory::getConfig(); // Get the pagination request variables $this->setState('limit', $app->getUserStateFromRequest('com_search.limit', 'limit', $config->get('list_limit'), 'uint')); $this->setState('limitstart', $app->input->get('limitstart', 0, 'uint')); // Get parameters. $params = $app->getParams(); if ($params->get('searchphrase') == 1) { $searchphrase = 'any'; } elseif ($params->get('searchphrase') == 2) { $searchphrase = 'exact'; } else { $searchphrase = 'all'; } // Set the search parameters $keyword = urldecode($app->input->getString('searchword')); $match = $app->input->get('searchphrase', $searchphrase, 'word'); $ordering = $app->input->get('ordering', $params->get('ordering', 'newest'), 'word'); $this->setSearch($keyword, $match, $ordering); // Set the search areas $areas = $app->input->get('areas', null, 'array'); $this->setAreas($areas); } /** * Method to set the search parameters * * @param string $keyword string search string * @param string $match matching option, exact|any|all * @param string $ordering option, newest|oldest|popular|alpha|category * * @access public * * @return void */ public function setSearch($keyword, $match = 'all', $ordering = 'newest') { if (isset($keyword)) { $this->setState('origkeyword', $keyword); if ($match !== 'exact') { $keyword = preg_replace('#\xE3\x80\x80#', ' ', $keyword); } $this->setState('keyword', $keyword); } if (isset($match)) { $this->setState('match', $match); } if (isset($ordering)) { $this->setState('ordering', $ordering); } } /** * Method to get weblink item data for the category * * @access public * @return array */ public function getData() { // Lets load the content if it doesn't already exist if (empty($this->_data)) { $areas = $this->getAreas(); JPluginHelper::importPlugin('search'); $dispatcher = JEventDispatcher::getInstance(); $results = $dispatcher->trigger('onContentSearch', array( $this->getState('keyword'), $this->getState('match'), $this->getState('ordering'), $areas['active']) ); $rows = array(); foreach ($results as $result) { $rows = array_merge((array) $rows, (array) $result); } $this->_total = count($rows); if ($this->getState('limit') > 0) { $this->_data = array_splice($rows, $this->getState('limitstart'), $this->getState('limit')); } else { $this->_data = $rows; } } return $this->_data; } /** * Method to get the total number of weblink items for the category * * @access public * * @return integer */ public function getTotal() { return $this->_total; } /** * Method to set the search areas * * @param array $active areas * @param array $search areas * * @return void * * @access public */ public function setAreas($active = array(), $search = array()) { $this->_areas['active'] = $active; $this->_areas['search'] = $search; } /** * Method to get a pagination object of the weblink items for the category * * @access public * @return integer */ public function getPagination() { // Lets load the content if it doesn't already exist if (empty($this->_pagination)) { $this->_pagination = new JPagination($this->getTotal(), $this->getState('limitstart'), $this->getState('limit')); } return $this->_pagination; } /** * Method to get the search areas * * @return integer * * @since 1.5 */ public function getAreas() { // Load the Category data if (empty($this->_areas['search'])) { $areas = array(); JPluginHelper::importPlugin('search'); $dispatcher = JEventDispatcher::getInstance(); $searchareas = $dispatcher->trigger('onContentSearchAreas'); foreach ($searchareas as $area) { if (is_array($area)) { $areas = array_merge($areas, $area); } } $this->_areas['search'] = $areas; } return $this->_areas; } } PK �0"]��8m�% �% views/search/view.html.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_search * * @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\String\StringHelper; /** * HTML View class for the search component * * @since 1.0 */ class SearchViewSearch extends JViewLegacy { /** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. * * @since 1.0 */ public function display($tpl = null) { JLoader::register('SearchHelper', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/search.php'); $app = JFactory::getApplication(); $uri = JUri::getInstance(); $error = null; $results = null; $total = 0; // Get some data from the model $areas = $this->get('areas'); $state = $this->get('state'); $searchWord = $state->get('keyword'); $params = $app->getParams(); if (!$app->getMenu()->getActive()) { $params->set('page_title', JText::_('COM_SEARCH_SEARCH')); } $title = $params->get('page_title'); if ($app->get('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); } elseif ($app->get('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); } $this->document->setTitle($title); if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } // Built select lists $orders = array(); $orders[] = JHtml::_('select.option', 'newest', JText::_('COM_SEARCH_NEWEST_FIRST')); $orders[] = JHtml::_('select.option', 'oldest', JText::_('COM_SEARCH_OLDEST_FIRST')); $orders[] = JHtml::_('select.option', 'popular', JText::_('COM_SEARCH_MOST_POPULAR')); $orders[] = JHtml::_('select.option', 'alpha', JText::_('COM_SEARCH_ALPHABETICAL')); $orders[] = JHtml::_('select.option', 'category', JText::_('JCATEGORY')); $lists = array(); $lists['ordering'] = JHtml::_('select.genericlist', $orders, 'ordering', 'class="inputbox"', 'value', 'text', $state->get('ordering')); $searchphrases = array(); $searchphrases[] = JHtml::_('select.option', 'all', JText::_('COM_SEARCH_ALL_WORDS')); $searchphrases[] = JHtml::_('select.option', 'any', JText::_('COM_SEARCH_ANY_WORDS')); $searchphrases[] = JHtml::_('select.option', 'exact', JText::_('COM_SEARCH_EXACT_PHRASE')); $lists['searchphrase'] = JHtml::_('select.radiolist', $searchphrases, 'searchphrase', '', 'value', 'text', $state->get('match')); // Log the search \Joomla\CMS\Helper\SearchHelper::logSearch($searchWord, 'com_search'); // Limit search-word $lang = JFactory::getLanguage(); $upper_limit = $lang->getUpperLimitSearchWord(); $lower_limit = $lang->getLowerLimitSearchWord(); if (SearchHelper::limitSearchWord($searchWord)) { $error = JText::sprintf('COM_SEARCH_ERROR_SEARCH_MESSAGE', $lower_limit, $upper_limit); } // Sanitise search-word if (SearchHelper::santiseSearchWord($searchWord, $state->get('match'))) { $error = JText::_('COM_SEARCH_ERROR_IGNOREKEYWORD'); } if (!$searchWord && !empty($this->input) && count($this->input->post)) { // $error = JText::_('COM_SEARCH_ERROR_ENTERKEYWORD'); } // Put the filtered results back into the model // for next release, the checks should be done in the model perhaps... $state->set('keyword', $searchWord); if ($error === null) { $results = $this->get('data'); $total = $this->get('total'); $pagination = $this->get('pagination'); // Flag indicates to not add limitstart=0 to URL $pagination->hideEmptyLimitstart = true; if ($state->get('match') === 'exact') { $searchWords = array($searchWord); $needle = $searchWord; } else { $searchWordA = preg_replace('#\xE3\x80\x80#', ' ', $searchWord); $searchWords = preg_split("/\s+/u", $searchWordA); $needle = $searchWords[0]; } JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php'); // Make sure there are no slashes in the needle $needle = str_replace('/', '\/', $needle); for ($i = 0, $count = count($results); $i < $count; ++$i) { $rowTitle = &$results[$i]->title; $rowTitleHighLighted = $this->highLight($rowTitle, $needle, $searchWords); $rowText = &$results[$i]->text; $rowTextHighLighted = $this->highLight($rowText, $needle, $searchWords); $result = &$results[$i]; $created = ''; if ($result->created) { $created = JHtml::_('date', $result->created, JText::_('DATE_FORMAT_LC3')); } $result->title = $rowTitleHighLighted; $result->text = JHtml::_('content.prepare', $rowTextHighLighted, '', 'com_search.search'); $result->created = $created; $result->count = $i + 1; } } // Check for layout override $active = JFactory::getApplication()->getMenu()->getActive(); if (isset($active->query['layout'])) { $this->setLayout($active->query['layout']); } // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx', '')); $this->pagination = &$pagination; $this->results = &$results; $this->lists = &$lists; $this->params = &$params; $this->ordering = $state->get('ordering'); $this->searchword = $searchWord; $this->origkeyword = $state->get('origkeyword'); $this->searchphrase = $state->get('match'); $this->searchareas = $areas; $this->total = $total; $this->error = $error; $this->action = $uri; parent::display($tpl); } /** * Method to control the highlighting of keywords * * @param string $string text to be searched * @param string $needle text to search for * @param string $searchWords words to be searched * * @return mixed A string. * * @since 3.8.4 */ public function highLight($string, $needle, $searchWords) { $hl1 = '<span class="highlight">'; $hl2 = '</span>'; $mbString = extension_loaded('mbstring'); $highlighterLen = strlen($hl1 . $hl2); // Doing HTML entity decoding here, just in case we get any HTML entities here. $quoteStyle = version_compare(PHP_VERSION, '5.4', '>=') ? ENT_NOQUOTES | ENT_HTML401 : ENT_NOQUOTES; $row = html_entity_decode($string, $quoteStyle, 'UTF-8'); $row = SearchHelper::prepareSearchContent($row, $needle); $searchWords = array_values(array_unique($searchWords)); $lowerCaseRow = $mbString ? mb_strtolower($row) : StringHelper::strtolower($row); $transliteratedLowerCaseRow = SearchHelper::remove_accents($lowerCaseRow); $posCollector = array(); foreach ($searchWords as $highlightWord) { $found = false; if ($mbString) { $lowerCaseHighlightWord = mb_strtolower($highlightWord); if (($pos = mb_strpos($lowerCaseRow, $lowerCaseHighlightWord)) !== false) { $found = true; } elseif (($pos = mb_strpos($transliteratedLowerCaseRow, $lowerCaseHighlightWord)) !== false) { $found = true; } } else { $lowerCaseHighlightWord = StringHelper::strtolower($highlightWord); if (($pos = StringHelper::strpos($lowerCaseRow, $lowerCaseHighlightWord)) !== false) { $found = true; } elseif (($pos = StringHelper::strpos($transliteratedLowerCaseRow, $lowerCaseHighlightWord)) !== false) { $found = true; } } if ($found === true) { // Iconv transliterates '€' to 'EUR' // TODO: add other expanding translations? $eur_compensation = $pos > 0 ? substr_count($row, "\xE2\x82\xAC", 0, $pos) * 2 : 0; $pos -= $eur_compensation; // Collect pos and search-word $posCollector[$pos] = $highlightWord; } } if (count($posCollector)) { // Sort by pos. Easier to handle overlapping highlighter-spans ksort($posCollector); $cnt = 0; $lastHighlighterEnd = -1; foreach ($posCollector as $pos => $highlightWord) { $pos += $cnt * $highlighterLen; /* * Avoid overlapping/corrupted highlighter-spans * TODO $chkOverlap could be used to highlight remaining part * of search-word outside last highlighter-span. * At the moment no additional highlighter is set. */ $chkOverlap = $pos - $lastHighlighterEnd; if ($chkOverlap >= 0) { // Set highlighter around search-word if ($mbString) { $highlightWordLen = mb_strlen($highlightWord); $row = mb_substr($row, 0, $pos) . $hl1 . mb_substr($row, $pos, $highlightWordLen) . $hl2 . mb_substr($row, $pos + $highlightWordLen); } else { $highlightWordLen = StringHelper::strlen($highlightWord); $row = StringHelper::substr($row, 0, $pos) . $hl1 . StringHelper::substr($row, $pos, StringHelper::strlen($highlightWord)) . $hl2 . StringHelper::substr($row, $pos + StringHelper::strlen($highlightWord)); } $cnt++; $lastHighlighterEnd = $pos + $highlightWordLen + $highlighterLen; } } } return $row; } } PK �0"]HT7�4 4 "