Сергей Варламов
9 years ago
commit
039147153b
14 changed files with 742 additions and 0 deletions
@ -0,0 +1,14 @@
|
||||
## search |
||||
|
||||
# Модуль Поиск v2.1.0 |
||||
|
||||
|
||||
## Данный модуль позволяет организвать поиск необходимой информации на вашем сайте. |
||||
|
||||
* Поиск информации осуществляется как по заголовкам документов, так и по содержимому. Для того, чтобы вывести форму для поиска на вашем сайте, разместите системный тег <strong>[mod_search]</strong> в нужном месте вашего шаблона сайта. |
||||
|
||||
## Перед копированием модуля в папку modules, удалите файл README.md, копируйте только корневую папку sitemap со всем ее содержимым внутри! |
||||
|
||||
## Changelog: |
||||
|
||||
22.04.2014 - версия 2.1.0 |
@ -0,0 +1,94 @@
|
||||
<?php |
||||
|
||||
class Lingua_Stem_Ru { |
||||
|
||||
var $VERSION = "0.02"; |
||||
var $Stem_Caching = 1; |
||||
var $Stem_Cache = array(); |
||||
var $VOWEL = '/аеиоуыэюя/'; |
||||
var $PERFECTIVEGROUND = '/((ив|ивши|ившись|ыв|ывши|ывшись)|((?<=[ая])(в|вши|вшись)))$/'; |
||||
var $REFLEXIVE = '/(с[яь])$/'; |
||||
var $ADJECTIVE = '/(ее|ие|ые|ое|ими|ыми|ей|ий|ый|ой|ем|им|ым|ом|его|ого|ему|ому|их|ых|ую|юю|ая|яя|ою|ею)$/'; |
||||
var $PARTICIPLE = '/((ивш|ывш|ующ)|((?<=[ая])(ем|нн|вш|ющ|щ)))$/'; |
||||
var $VERB = '/((ила|ыла|ена|ейте|уйте|ите|или|ыли|ей|уй|ил|ыл|им|ым|ен|ило|ыло|ено|ят|ует|уют|ит|ыт|ены|ить|ыть|ишь|ую|ю)|((?<=[ая])(ла|на|ете|йте|ли|й|л|ем|н|ло|но|ет|ют|ны|ть|ешь|нно)))$/'; |
||||
var $NOUN = '/(а|ев|ов|ие|ье|е|иями|ями|ами|еи|ии|и|ией|ей|ой|ий|й|иям|ям|ием|ем|ам|ом|о|у|ах|иях|ях|ы|ь|ию|ью|ю|ия|ья|я)$/'; |
||||
var $RVRE = '/^(.*?[аеиоуыэюя])(.*)$/'; |
||||
var $DERIVATIONAL = '/[^аеиоуыэюя][аеиоуыэюя]+[^аеиоуыэюя]+[аеиоуыэюя].*(?<=о)сть?$/'; |
||||
|
||||
function s(&$s, $re, $to) |
||||
{ |
||||
$orig = $s; |
||||
$s = preg_replace($re, $to, $s); |
||||
return $orig !== $s; |
||||
} |
||||
|
||||
function m($s, $re) |
||||
{ |
||||
return preg_match($re, $s); |
||||
} |
||||
|
||||
function stem_word($word) |
||||
{ |
||||
$word = mb_strtolower($word); |
||||
//$word = strtr($word, 'ё', 'е'); |
||||
# Check against cache of stemmed words |
||||
if ($this->Stem_Caching && isset($this->Stem_Cache[$word])) { |
||||
return $this->Stem_Cache[$word]; |
||||
} |
||||
$stem = $word; |
||||
do { |
||||
if (!preg_match($this->RVRE, $word, $p)) break; |
||||
$start = $p[1]; |
||||
$RV = $p[2]; |
||||
if (!$RV) break; |
||||
|
||||
# Step 1 |
||||
if (!$this->s($RV, $this->PERFECTIVEGROUND, '')) { |
||||
$this->s($RV, $this->REFLEXIVE, ''); |
||||
|
||||
if ($this->s($RV, $this->ADJECTIVE, '')) { |
||||
$this->s($RV, $this->PARTICIPLE, ''); |
||||
} else { |
||||
if (!$this->s($RV, $this->VERB, '')) |
||||
$this->s($RV, $this->NOUN, ''); |
||||
} |
||||
} |
||||
|
||||
# Step 2 |
||||
$this->s($RV, '/и$/', ''); |
||||
|
||||
# Step 3 |
||||
if ($this->m($RV, $this->DERIVATIONAL)) |
||||
$this->s($RV, '/ость?$/', ''); |
||||
|
||||
# Step 4 |
||||
if (!$this->s($RV, '/ь$/', '')) { |
||||
$this->s($RV, '/ейше?/', ''); |
||||
$this->s($RV, '/нн$/', 'н'); |
||||
} |
||||
|
||||
$stem = $start.$RV; |
||||
} while(false); |
||||
if ($this->Stem_Caching) $this->Stem_Cache[$word] = $stem; |
||||
return $stem; |
||||
} |
||||
|
||||
function stem_caching($parm_ref) |
||||
{ |
||||
$caching_level = @$parm_ref['-level']; |
||||
if ($caching_level) { |
||||
if (!$this->m($caching_level, '/^[012]$/')) { |
||||
die(__CLASS__ . "::stem_caching() - Legal values are '0','1' or '2'. '$caching_level' is not a legal value"); |
||||
} |
||||
$this->Stem_Caching = $caching_level; |
||||
} |
||||
return $this->Stem_Caching; |
||||
} |
||||
|
||||
function clear_stem_cache() |
||||
{ |
||||
$this->Stem_Cache = array(); |
||||
} |
||||
} |
||||
|
||||
?> |
@ -0,0 +1,369 @@
|
||||
<?php |
||||
|
||||
/** |
||||
* AVE.cms - Модуль Поиск |
||||
* |
||||
* @package AVE.cms |
||||
* @subpackage module_Search |
||||
* @filesource |
||||
*/ |
||||
|
||||
class Search |
||||
{ |
||||
|
||||
/** |
||||
* СВОЙСТВА |
||||
*/ |
||||
|
||||
var $_limit = 15; |
||||
var $_adminlimit = 1000; |
||||
var $_highlight = 1; |
||||
var $_allowed_tags = ''; |
||||
var $_disallowed_tags = ''; |
||||
var $_search_string = ''; |
||||
var $_stem_words = array(); |
||||
var $_like_t = "(doc.document_title LIKE '%%%s%%')"; |
||||
var $_not_like_t = "(doc.document_title LIKE '%%%s%%')"; |
||||
var $_like = "(field_value LIKE '%%%s%%')"; |
||||
var $_not_like = "(field_value NOT LIKE '%%%s%%')"; |
||||
|
||||
/** |
||||
* ВНУТРЕННИЕ МЕТОДЫ |
||||
*/ |
||||
|
||||
function _searchSpecialchars($string) |
||||
{ |
||||
$string = stripslashes($string); |
||||
$string = str_replace ( '"', '"', $string ); |
||||
$string = addslashes($string); |
||||
$string = urldecode($string); |
||||
|
||||
return $string; |
||||
} |
||||
|
||||
function _create_string_like(&$word, $key, $type='') |
||||
{ |
||||
global $stemmer; |
||||
|
||||
$type_search = (isset($_REQUEST['ts']) ? $_REQUEST['ts'] : 0); |
||||
|
||||
switch ($type) |
||||
{ |
||||
case '-': |
||||
$word = $stemmer->stem_word(mb_substr($word, 1)); |
||||
if (isset($type_search) && $type_search != 0){ |
||||
$format_string = $this->_not_like_t; |
||||
} else { |
||||
$format_string = $this->_not_like; |
||||
} |
||||
break; |
||||
|
||||
case '+': |
||||
$word = $stemmer->stem_word(mb_substr($word, 1)); |
||||
if (isset($type_search) && $type_search != 0){ |
||||
$format_string = $this->_like_t; |
||||
} else { |
||||
$format_string = $this->_like; |
||||
} |
||||
$this->_stem_words[] = $word; |
||||
break; |
||||
|
||||
default: |
||||
$word = $stemmer->stem_word($word); |
||||
if (isset($type_search) && $type_search != 0){ |
||||
$format_string = $this->_like_t; |
||||
} else { |
||||
$format_string = $this->_like; |
||||
} |
||||
$this->_stem_words[] = $word; |
||||
break; |
||||
} |
||||
|
||||
$word = sprintf($format_string, $word, $this->_searchSpecialchars($word)); |
||||
} |
||||
|
||||
/** |
||||
* ВНЕШНИЕ МЕТОДЫ |
||||
*/ |
||||
|
||||
function searchResultGet($tpl_dir, $lang_file) |
||||
{ |
||||
global $AVE_DB, $AVE_Template; |
||||
|
||||
$AVE_Template->config_load($lang_file); |
||||
|
||||
define('MODULE_TITLE', $AVE_Template->get_config_vars('SEARCH_RESULTS')); |
||||
|
||||
$stem_words = array(); |
||||
|
||||
$tmp = preg_replace('/[^\x20-\xFF]|[><!?.,;=-]/', ' ', $_REQUEST['query']); |
||||
|
||||
$this->_search_string = trim(preg_replace('/ +/', ' ', stripslashes($tmp))); |
||||
|
||||
if (mb_strlen($this->_search_string) > 2) |
||||
{ |
||||
// экранирование для LIKE |
||||
$tmp = str_replace('\\', '\\\\', $this->_search_string); |
||||
$tmp = addcslashes(addslashes($tmp), '%_'); |
||||
$tmp = preg_replace('/ +/', ' ', $tmp); |
||||
$tmp = preg_split('/\s+/', $tmp); |
||||
|
||||
$where = ''; |
||||
|
||||
if (sizeof($tmp)) |
||||
{ |
||||
$_tmp = preg_grep('/^[^\+|-].{3,}/', $tmp); |
||||
array_walk($_tmp, array(&$this,'_create_string_like')); |
||||
// + |
||||
$__tmp = preg_grep('/^\+.{3,}/', $tmp); |
||||
array_walk($__tmp, array(&$this,'_create_string_like'), '+'); |
||||
// - |
||||
$___tmp = preg_grep('/^-.{3,}/', $tmp); |
||||
array_walk($___tmp, array(&$this,'_create_string_like'), '-'); |
||||
|
||||
if (!empty($_tmp)) |
||||
{ |
||||
$where = 'WHERE (' . implode((isset($_REQUEST['or']) && 1 == $_REQUEST['or']) ? ' OR ' : ' AND ', $_tmp) . ')'; |
||||
if (!empty($__tmp)) |
||||
{ |
||||
$where .= ' AND ' . implode(' AND ', array_merge($__tmp, $___tmp)); |
||||
} |
||||
} |
||||
elseif (!empty($__tmp)) |
||||
{ |
||||
$where = 'WHERE ' . implode(' AND ', array_merge($__tmp, $___tmp)); |
||||
} |
||||
} |
||||
|
||||
$num = 0; |
||||
if ($where != '') |
||||
{ |
||||
|
||||
$limit = $this->_limit; |
||||
$start = get_current_page() * $limit - $limit; |
||||
|
||||
$query_feld = $AVE_DB->Query(" |
||||
SELECT SQL_CALC_FOUND_ROWS |
||||
document_id, |
||||
field_value, |
||||
doc.document_title, |
||||
doc.document_published, |
||||
doc.document_in_search |
||||
FROM " . PREFIX . "_document_fields |
||||
LEFT JOIN " . PREFIX . "_documents AS doc |
||||
ON document_id = doc.Id |
||||
LEFT JOIN " . PREFIX . "_rubric_fields AS rub |
||||
ON rubric_field_id = rub.Id |
||||
" . $where . " |
||||
AND doc.document_in_search = '1' |
||||
AND doc.document_status = '1' |
||||
AND rub.rubric_field_search = '1' |
||||
GROUP BY doc.Id |
||||
ORDER BY doc.document_published DESC |
||||
LIMIT " . $start . "," . $limit |
||||
); |
||||
|
||||
$num = $AVE_DB->NumAllRows(); |
||||
$pages = @ceil($num / $limit); |
||||
|
||||
$sw = addslashes(mb_strtolower($this->_search_string)); |
||||
|
||||
$exist = $AVE_DB->Query(" |
||||
SELECT 1 |
||||
FROM " . PREFIX . "_module_search |
||||
WHERE search_query = '" . $sw . "' |
||||
LIMIT 1 |
||||
")->NumRows(); |
||||
|
||||
if ($exist) |
||||
{ |
||||
$AVE_DB->Query(" |
||||
UPDATE " . PREFIX . "_module_search |
||||
SET |
||||
search_found = '" . (int)$num . "', |
||||
search_count = search_count+1 |
||||
WHERE search_query = '" . $sw . "' |
||||
"); |
||||
} |
||||
else |
||||
{ |
||||
$AVE_DB->Query(" |
||||
INSERT |
||||
INTO " . PREFIX . "_module_search |
||||
SET |
||||
Id = '', |
||||
search_found = '" . (int)$num . "', |
||||
search_query = '" . $sw . "', |
||||
search_count = 1 |
||||
"); |
||||
} |
||||
if ($num > $limit) |
||||
{ |
||||
$page_nav = '<a class="page_nav" href="index.php?module=search&query=' |
||||
. urlencode($this->_search_string) |
||||
. ($type_search ? '&ts=1' : '') |
||||
. ($_REQUEST['or'] ? '&or=1' : '') |
||||
. '&page={s}">{t}</a>'; |
||||
$page_nav = get_pagination($pages, 'page', $page_nav); |
||||
} |
||||
$AVE_Template->assign('q_navi', $page_nav); |
||||
} |
||||
|
||||
if ($num > 0) |
||||
{ |
||||
$modul_search_results = array(); |
||||
|
||||
array_walk($this->_stem_words, create_function('&$val','$val=preg_quote(stripslashes(stripslashes(str_replace("\"",""",$val))),"/");')); |
||||
$regex_snapshot = '/.{0,100}[^\s]*' . implode('[^\s]*.{0,100}|.{0,100}[^\s]*', $this->_stem_words) . '[^\s]*.{0,100}/iu'; |
||||
$regex_highlight = '/[^\s]*' . implode('[^\s]*|[^\s]*', $this->_stem_words) . '[^\s]*/iu'; |
||||
|
||||
$doctime = get_settings('use_doctime') ? ("AND document_published <= " . time() . " AND (document_expire = 0 OR document_expire >= " . time() . ")") : ''; |
||||
|
||||
while ($row_feld = $query_feld->FetchRow()) |
||||
{ |
||||
$sql = $AVE_DB->Query(" |
||||
SELECT |
||||
Id, |
||||
document_title, |
||||
document_alias, |
||||
document_published, |
||||
rubric_id |
||||
FROM " . PREFIX . "_documents |
||||
WHERE Id = '" . $row_feld->document_id . "' |
||||
AND document_deleted = '0' |
||||
AND document_status = '1' |
||||
" . $doctime |
||||
); |
||||
while ($row = $sql->FetchRow()) |
||||
{ |
||||
$row->Text = $row_feld->field_value; |
||||
$row->Text = strip_tags($row->Text, $this->_allowed_tags); |
||||
|
||||
$fo = array(); |
||||
|
||||
preg_match($regex_snapshot, $row->Text, $fo); |
||||
|
||||
$row->Text = $type_search ? '' : ''; |
||||
|
||||
while (list($key, $val) = @each($fo)) |
||||
{ |
||||
$row->Text .= $val . ($type_search ? '' : ''); |
||||
} |
||||
|
||||
if (1 == $this->_highlight && !empty($this->_stem_words)) |
||||
{ |
||||
$row->Text = @preg_replace($regex_highlight, "<strong class=\"mod_search_highlight\">$0</strong>", $row->Text); |
||||
} |
||||
$row->document_alias = rewrite_link('index.php?id=' . $row->Id . '&doc=' . (empty($row->document_alias) ? prepare_url($row->document_title) : $row->document_alias)); |
||||
|
||||
$modul_search_results[$row->Id] = $row; |
||||
} |
||||
} |
||||
|
||||
$AVE_Template->assign('searchresults', $modul_search_results); |
||||
} |
||||
else |
||||
{ |
||||
$AVE_Template->assign('no_results', 1); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
$AVE_Template->assign('no_results', 1); |
||||
} |
||||
|
||||
if (!defined('MODULE_CONTENT')) |
||||
{ |
||||
$AVE_Template->assign('inc_path', BASE_DIR . '/modules/search/templates'); |
||||
define('MODULE_CONTENT', $AVE_Template->fetch($tpl_dir . 'results.tpl')); |
||||
} |
||||
} |
||||
|
||||
function searchWordsShow($tpl_dir) |
||||
{ |
||||
global $AVE_DB, $AVE_Template; |
||||
|
||||
$limit = $this->_adminlimit; |
||||
|
||||
$sort = ' ORDER BY search_query ASC'; |
||||
$sort_navi = ''; |
||||
|
||||
if (!empty($_REQUEST['sort'])) |
||||
{ |
||||
switch ($_REQUEST['sort']) |
||||
{ |
||||
case 'begriff_desc' : |
||||
$sort = ' ORDER BY search_query DESC'; |
||||
$sort_navi = '&sort=begriff_desc'; |
||||
break; |
||||
|
||||
case 'begriff_asc' : |
||||
$sort = ' ORDER BY search_query ASC'; |
||||
$sort_navi = '&sort=begriff_asc'; |
||||
break; |
||||
|
||||
case 'anzahl_desc' : |
||||
$sort = ' ORDER BY search_count DESC'; |
||||
$sort_navi = '&sort=anzahl_desc'; |
||||
break; |
||||
|
||||
case 'anzahl_asc' : |
||||
$sort = ' ORDER BY search_count ASC'; |
||||
$sort_navi = '&sort=anzahl_asc'; |
||||
break; |
||||
|
||||
case 'gefunden_desc' : |
||||
$sort = ' ORDER BY search_found DESC'; |
||||
$sort_navi = '&sort=gefunden_desc'; |
||||
break; |
||||
|
||||
case 'gefunden_asc' : |
||||
$sort = ' ORDER BY search_found ASC'; |
||||
$sort_navi = '&sort=gefunden_asc'; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
$num = $AVE_DB->Query(" |
||||
SELECT Id |
||||
FROM " . PREFIX . "_module_search |
||||
" . $sort |
||||
)->NumRows(); |
||||
|
||||
$seiten = ceil($num / $limit); |
||||
$start = get_current_page() * $limit - $limit; |
||||
|
||||
$items = array(); |
||||
$sql = $AVE_DB->Query(" |
||||
SELECT * |
||||
FROM " . PREFIX . "_module_search |
||||
" . $sort . " |
||||
LIMIT " . $start . "," . $limit |
||||
); |
||||
while ($row = $sql->FetchRow()) |
||||
{ |
||||
array_push($items,$row); |
||||
} |
||||
|
||||
if ($num > $limit) |
||||
{ |
||||
$page_nav = " <a class=\"pnav\" href=\"index.php?do=modules&action=modedit&mod=search&moduleaction=1" . $sort_navi . "&cp=" . SESSION . "&page={s}\">{t}</a> "; |
||||
$page_nav = get_pagination($seiten, 'page', $page_nav); |
||||
$AVE_Template->assign('page_nav', $page_nav); |
||||
} |
||||
|
||||
$AVE_Template->assign('items', $items); |
||||
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'words.tpl')); |
||||
} |
||||
|
||||
function searchWordsDelete() |
||||
{ |
||||
global $AVE_DB; |
||||
|
||||
$AVE_DB->Query("DELETE FROM " . PREFIX . "_module_search"); |
||||
|
||||
header('Location:index.php?do=modules&action=modedit&mod=search&moduleaction=1&cp=' . SESSION); |
||||
exit; |
||||
} |
||||
} |
||||
?> |
@ -0,0 +1,19 @@
|
||||
SEARCH_BUTTON = "Поиск" |
||||
SEARCH_IN_DESCRIPTION = "В тексте" |
||||
SEARCH_IN_TITLE = "В заголовках" |
||||
SEARCH_HELP = "<strong>Использование поиска</strong><br><br>Используйте знак "<strong>+</strong>" для строгого включения слова в поиск.<br>Используйте знак "<strong>-</strong>" для исключения слова из поиска.<br><br>Обязательно используйте пробел перед знаками "<strong>+</strong>" и "<strong>-</strong>". " |
||||
SEARCH_USE_AND = "Используя "И"" |
||||
SEARCH_USE_OR = "Используя "ИЛИ"" |
||||
SEARCH_RESULTS = "Результаты поиска" |
||||
SEARCH_NO_RESULTS = "Извините, но по вашему запросу ничего не найдено." |
||||
SEARCH_PAGES = "Страницы: " |
||||
SEARCH_VIEW = "Показать" |
||||
SEARCH_VIEW_BLANK = "Показать в новом окне" |
||||
|
||||
SEARCH_MODULE_NAME = "Поиск" |
||||
SEARCH_MODULE_DESCRIPTION = "В данном разделе приведена полная статистика всех поисковых фраз, по которым осуществлялся поиск информации на сайте." |
||||
SEARCH_WORD = "Поисковая фраза" |
||||
SEARCH_QUERIES = "Выполненных запросов" |
||||
SEARCH_FOUND_DOCS = "Найдено документов" |
||||
SEARCH_DELETE_ITEMS = "Удалить историю" |
||||
SEARCH_DELETE_CONFIRM = "Вы уверены, что хотите удалить историю?" |
@ -0,0 +1,79 @@
|
||||
<?php |
||||
|
||||
/** |
||||
* AVE.cms - Модуль Поиск |
||||
* |
||||
* @package AVE.cms |
||||
* @subpackage module_Search |
||||
* @filesource |
||||
*/ |
||||
|
||||
if (!defined('BASE_DIR')) exit; |
||||
|
||||
if (defined('ACP')) |
||||
{ |
||||
$modul['ModuleName'] = 'Поиск'; |
||||
$modul['ModuleSysName'] = 'search'; |
||||
$modul['ModuleVersion'] = '2.1.0'; |
||||
$modul['ModuleDescription'] = 'Данный модуль позволяет организвать поиск необходимой информации на вашем сайте. Поиск информации осуществляется как по заголовкам документов, так и по содержимому. Для того, чтобы вывести форму для поиска на вашем сайте, разместите системный тег <strong>[mod_search]</strong> в нужном месте вашего шаблона сайта.'; |
||||
$modul['ModuleAutor'] = 'AVE.CMS Team'; |
||||
$modul['ModuleCopyright'] = '© 2007-2014 AVE.CMS'; |
||||
$modul['ModuleIsFunction'] = 1; |
||||
$modul['ModuleTemplate'] = 1; |
||||
$modul['ModuleAdminEdit'] = 1; |
||||
$modul['ModuleFunction'] = 'mod_search'; |
||||
$modul['ModuleTag'] = '[mod_search]'; |
||||
$modul['ModuleTagLink'] = null; |
||||
$modul['ModuleAveTag'] = '#\\\[mod_search]#'; |
||||
$modul['ModulePHPTag'] = '<?php mod_search(); ?>';
|
||||
} |
||||
|
||||
function mod_search() |
||||
{ |
||||
global $AVE_Template; |
||||
|
||||
if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'search') $AVE_Template->assign('hide', 1); |
||||
$AVE_Template->display(BASE_DIR . '/modules/search/templates/form.tpl'); |
||||
} |
||||
|
||||
if (!defined('ACP') && (isset($_REQUEST['module']) && $_REQUEST['module'] == 'search')) |
||||
{ |
||||
global $stemmer; |
||||
|
||||
if (! @require_once(BASE_DIR . '/modules/search/class.search.php')) module_error(); |
||||
if (! @require_once(BASE_DIR . '/modules/search/class.porter.php')) module_error(); |
||||
|
||||
$tpl_dir = BASE_DIR . '/modules/search/templates/'; |
||||
$lang_file = BASE_DIR . '/modules/search/lang/' . $_SESSION['user_language'] . '.txt'; |
||||
|
||||
$search = new Search; |
||||
$stemmer = new Lingua_Stem_Ru(); |
||||
|
||||
$search->searchResultGet($tpl_dir, $lang_file); |
||||
} |
||||
|
||||
if (defined('ACP') && !empty($_REQUEST['moduleaction'])) |
||||
{ |
||||
if (! (is_file(BASE_DIR . '/modules/search/class.search.php') && |
||||
@require_once(BASE_DIR . '/modules/search/class.search.php'))) module_error(); |
||||
|
||||
$tpl_dir = BASE_DIR .'/modules/search/templates/'; |
||||
$lang_file = BASE_DIR .'/modules/search/lang/' . $_SESSION['admin_language'] . '.txt'; |
||||
|
||||
$search = new Search; |
||||
|
||||
$AVE_Template->config_load($lang_file); |
||||
|
||||
switch ($_REQUEST['moduleaction']) |
||||
{ |
||||
case '1': |
||||
$search->searchWordsShow($tpl_dir); |
||||
break; |
||||
|
||||
case 'delwords': |
||||
$search->searchWordsDelete(); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
?> |
@ -0,0 +1,46 @@
|
||||
<?php |
||||
|
||||
/** |
||||
* AVE.cms - Модуль Поиск |
||||
* |
||||
* @package AVE.cms |
||||
* @subpackage module_Search |
||||
* @filesource |
||||
*/ |
||||
|
||||
$module_sql_install = array(); |
||||
$module_sql_deinstall = array(); |
||||
$module_sql_update = array(); |
||||
|
||||
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_search;"; |
||||
|
||||
$module_sql_install[] = "CREATE TABLE CPPREFIX_module_search ( |
||||
`Id` int(10) unsigned NOT NULL auto_increment, |
||||
`search_query` char(255) NOT NULL, |
||||
`search_count` mediumint(5) unsigned NOT NULL default '0', |
||||
`search_found` mediumint(5) unsigned NOT NULL default '0', |
||||
PRIMARY KEY (`Id`), |
||||
UNIQUE KEY `search_query` (`search_query`) |
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;"; |
||||
|
||||
// Обновление модуля |
||||
$module_sql_update[] = " |
||||
UPDATE |
||||
`CPPREFIX_module` |
||||
SET |
||||
ModuleAveTag = '" . $modul['ModuleAveTag'] . "', |
||||
ModulePHPTag = '" . $modul['ModulePHPTag'] . "', |
||||
ModuleVersion = '" . $modul['ModuleVersion'] . "' |
||||
WHERE |
||||
ModuleSysName = '" . $modul['ModuleSysName'] . "' |
||||
LIMIT 1; |
||||
"; |
||||
|
||||
$module_sql_update[] = " |
||||
RENAME TABLE |
||||
`CPPREFIX_modul_search` |
||||
TO |
||||
`CPPREFIX_module_search` |
||||
"; |
||||
|
||||
?> |
@ -0,0 +1,5 @@
|
||||
<form class="search" method="get" action="{$ABS_PATH}"> |
||||
<input type="hidden" name="module" value="search" /> |
||||
<input type="text" id="query" class="search text" name="query" value="" /> |
||||
<input type="submit" class="search button" value="Поиск" /> |
||||
</form> |
@ -0,0 +1,17 @@
|
||||
<div class="mod_search_big"> |
||||
<form method="get" action="{$ABS_PATH}"> |
||||
<input type="hidden" name="module" value="search" /> |
||||
<input style="width:350px" class="query" name="query" type="text" value="{$smarty.request.query|stripslashes|escape}" /> |
||||
<input type="submit" class="button" style="vertical-align: middle;" value="{#SEARCH_BUTTON#}" /> |
||||
<input title="{#SEARCH_HELP#}" type="button" class="button" style="vertical-align: middle;" value="?" /> |
||||
<br /> |
||||
|
||||
<div style="margin-top:5px"> |
||||
<input style="border:0px" type="radio" name="ts" value="0"{if $smarty.request.ts==0 || !$smarty.request.ts} checked="checked"{/if} />{#SEARCH_IN_DESCRIPTION#} |
||||
<input style="border:0px" type="radio" name="ts" value="1"{if $smarty.request.ts==1} checked="checked"{/if} />{#SEARCH_IN_TITLE#} |
||||
|
||||
<input style="border:0px" type="radio" name="or" value="0"{if $smarty.request.or==0 || !$smarty.request.or} checked="checked"{/if} />{#SEARCH_USE_AND#} |
||||
<input style="border:0px" type="radio" name="or" value="1"{if $smarty.request.or==1} checked="checked"{/if} />{#SEARCH_USE_OR#} |
||||
</div> |
||||
</form> |
||||
</div> |
After Width: | Height: | Size: 322 B |
@ -0,0 +1,16 @@
|
||||
<h2 id="page-heading">{#SEARCH_RESULTS#}</h2> |
||||
|
||||
{if $no_results==1} |
||||
<p>{#SEARCH_NO_RESULTS#}</p> |
||||
{else} |
||||
{if $q_navi}<div class="page_navigation_box">{#SEARCH_PAGES#} {$q_navi}</div>{/if} |
||||
|
||||
{foreach from=$searchresults item=result} |
||||
<h4><a href="{$result->document_alias}">{$result->document_title|escape}</a> {$result->document_published|date_format:$DATE_FORMAT|pretty_date}</h4> |
||||
<blockquote>{$result->Text}<br /><a href="{$result->document_alias}">{#SEARCH_VIEW#}</a> | <a target="_blank" href="{$result->document_alias}">{#SEARCH_VIEW_BLANK#}</a> {$result->document_count_view}</blockquote><br /> |
||||
{/foreach} |
||||
|
||||
{if $q_navi}<div class="page_navigation_box">{#SEARCH_PAGES#} {$q_navi}</div>{/if} |
||||
{/if} |
||||
|
||||
{include file="$inc_path/form_big.tpl"} |
@ -0,0 +1,71 @@
|
||||
<script language="javascript"> |
||||
$(document).ready(function(){ldelim} |
||||
|
||||
$(".ConfirmClear").click(function(e){ldelim} |
||||
e.preventDefault(); |
||||
var href = $(this).attr('href'); |
||||
var title = '{#SEARCH_DELETE_ITEMS#}'; |
||||
var confirm = '{#SEARCH_DELETE_CONFIRM#}'; |
||||
jConfirm( |
||||
confirm, |
||||
title, |
||||
function(b){ldelim} |
||||
if (b){ldelim} |
||||
window.location = href; |
||||
{rdelim} |
||||
{rdelim} |
||||
); |
||||
{rdelim}); |
||||
|
||||
{rdelim}); |
||||
|
||||
</script> |
||||
|
||||
<div class="title"><h5>{#SEARCH_MODULE_NAME#}</h5></div> |
||||
|
||||
<div class="widget" style="margin-top: 0px;"> |
||||
<div class="body"> |
||||
{#SEARCH_MODULE_DESCRIPTION#} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="breadCrumbHolder module"> |
||||
<div class="breadCrumb module"> |
||||
<ul> |
||||
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li> |
||||
<li><a href="index.php?do=modules&cp={$sess}">{#MODULES_SUB_TITLE#}</a></li> |
||||
<li>{#SEARCH_MODULE_NAME#}</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="widget first"> |
||||
<div class="head"><h5 class="iFrames">{#SEARCH_MODULE_NAME#}</h5></div> |
||||
<table cellpadding="0" cellspacing="0" width="100%" class="display" id="dinamTable"> |
||||
<thead> |
||||
<tr> |
||||
<th width="60%">{#SEARCH_WORD#}</th> |
||||
<th width="20%">{#SEARCH_QUERIES#}</th> |
||||
<th width="20%">{#SEARCH_FOUND_DOCS#}</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{foreach from=$items item=item} |
||||
<tr class="gradeA"> |
||||
<td align="center"><strong>{$item->search_query|escape}</strong></td> |
||||
<td align="center">{$item->search_count}</td> |
||||
<td align="center">{$item->search_found}</td> |
||||
</tr> |
||||
{/foreach} |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
<div class="widget" style="margin-top: 0px;"> |
||||
<div class="body aligncenter"> |
||||
<form id="#form_submit" method="post" action="index.php?do=modules&action=modedit&mod=search&moduleaction=delwords&cp={$sess}"> |
||||
<input href="index.php?do=modules&action=modedit&mod=search&moduleaction=delwords&cp={$sess}" type="button" class="basicBtn ConfirmClear" value="{#SEARCH_DELETE_ITEMS#}" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
|
Loading…
Reference in new issue