From: <tr...@us...> - 2012-12-16 00:34:54
|
Revision: 10399 http://sourceforge.net/p/xoops/svn/10399 Author: trabis Date: 2012-12-16 00:34:51 +0000 (Sun, 16 Dec 2012) Log Message: ----------- First implementation of search module. I'll need to implement a plugin mechanism now. Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/form/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/form/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/form/search.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/search.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/icons/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/icons/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/icons/logo_large.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/icons/logo_small.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/images/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/images/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/images/logo.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/index.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/main.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/modinfo.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/preloads/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/preloads/core.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/preloads/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/templates/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/templates/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/templates/search.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/xoops_version.php Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/form/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/form/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/form/index.html 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/form/search.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/form/search.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/form/search.php 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1,76 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author trabis <lus...@gm...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +class SearchSearchForm extends XoopsThemeForm +{ + /** + * We are not using this for objects but we need to override the constructor + * @param null $obj + */ + public function __construct($obj = null) + { + } + + public function getSearchFrom($andor, $queries,$mids, $mid) + { + $xoops = Xoops::getInstance(); + $search = Search::getInstance(); + // create form + parent::__construct(_MD_SEARCH, 'search', 'index.php', 'get'); + + // create form elements + $this->addElement(new XoopsFormText(_MD_SEARCH_KEYWORDS, 'query', 30, 255, htmlspecialchars(stripslashes(implode(' ', $queries)), ENT_QUOTES)), true); + $type_select = new XoopsFormSelect(_MD_SEARCH_TYPE, 'andor', $andor); + $type_select->addOptionArray(array( + 'AND' => _MD_SEARCH_ALL, 'OR' => _MD_SEARCH_ANY, 'exact' => _MD_SEARCH_EXACT + )); + $this->addElement($type_select); + if (!empty($mids)) { + $mods_checkbox = new XoopsFormCheckBox(_MD_SEARCH_SEARCHIN, 'mids[]', $mids); + } else { + $mods_checkbox = new XoopsFormCheckBox(_MD_SEARCH_SEARCHIN, 'mids[]', $mid); + } + if (empty($modules)) { + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('hassearch', 1)); + $criteria->add(new Criteria('isactive', 1)); + if (isset($available_modules) && !empty($available_modules)) { + $criteria->add(new Criteria('mid', '(' . implode(',', $available_modules) . ')', 'IN')); + } + $module_handler = $xoops->getHandlerModule(); + $mods_checkbox->addOptionArray($module_handler->getNameList($criteria)); + } else { + /* @var $module XoopsModule */ + $module_array = array(); + foreach ($modules as $mid => $module) { + $module_array[$mid] = $module->getVar('name'); + } + $mods_checkbox->addOptionArray($module_array); + } + $this->addElement($mods_checkbox); + if ($search->getConfig('keyword_min') > 0) { + $this->addElement(new XoopsFormLabel(_MD_SEARCH_SEARCHRULE, sprintf(_MD_SEARCH_KEYIGNORE, $search->getConfig('keyword_min')))); + } + $this->addElement(new XoopsFormHidden('action', 'results')); + $this->addElement(new XoopsFormHiddenToken('id')); + $this->addElement(new XoopsFormButton('', 'submit', _MD_SEARCH, 'submit')); + return $this; + } +} \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/form/search.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/index.html 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/search.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/search.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/search.php 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1,32 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author trabis <lus...@gm...> + * @version $Id$ + */ + +defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); + +class Search extends Xoops_Module_Abstract +{ + /** + * Init the module + * + * @return null|void + */ + public function init() + { + $this->setDirname('search'); + } +} Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/class/search.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/icons/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/icons/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/icons/index.html 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/icons/logo_large.png =================================================================== (Binary files differ) Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/icons/logo_large.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/icons/logo_small.png =================================================================== (Binary files differ) Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/icons/logo_small.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/images/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/images/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/images/index.html 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/images/logo.png =================================================================== (Binary files differ) Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/images/logo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/index.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/index.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/index.php 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1,298 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * XOOPS global search + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU General Public License (GPL) + * @package core + * @since 2.0.0 + * @author Kazumi Ono (AKA onokazu) + * @author Taiwen Jiang <ph...@us...> + * @version $Id$ + * @todo Modularize; Both search algorithms and interface will be redesigned + */ + +include dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'mainfile.php'; + +$xoops = Xoops::getInstance(); +$search = Search::getInstance(); + +if (!$search->getConfig('enable_search')) { + header('Location: ' . XOOPS_URL . '/index.php'); + exit(); +} +$action = "search"; +if (!empty($_GET['action'])) { + $action = trim(strip_tags($_GET['action'])); +} else { + if (!empty($_POST['action'])) { + $action = trim(strip_tags($_POST['action'])); + } +} +$query = ""; +if (!empty($_GET['query'])) { + $query = trim(strip_tags($_GET['query'])); +} else { + if (!empty($_POST['query'])) { + $query = trim(strip_tags($_POST['query'])); + } +} +$andor = "AND"; +if (!empty($_GET['andor'])) { + $andor = trim(strip_tags($_GET['andor'])); +} else { + if (!empty($_POST['andor'])) { + $andor = trim(strip_tags($_POST['andor'])); + } +} +$mid = $uid = $start = 0; +if (!empty($_GET['mid'])) { + $mid = intval($_GET['mid']); +} else { + if (!empty($_POST['mid'])) { + $mid = intval($_POST['mid']); + } +} +if (!empty($_GET['uid'])) { + $uid = intval($_GET['uid']); +} else { + if (!empty($_POST['uid'])) { + $uid = intval($_POST['uid']); + } +} +if (!empty($_GET['start'])) { + $start = intval($_GET['start']); +} else { + if (!empty($_POST['start'])) { + $start = intval($_POST['start']); + } +} + +$queries = array(); +$mids = array(); + +if ($action == "results") { + if ($query == "") { + $xoops->redirect("index.php", 1, _MD_SEARCH_PLZENTER); + } +} else { + if ($action == "showall") { + if ($query == "" || empty($mid)) { + $xoops->redirect("index.php", 1, _MD_SEARCH_PLZENTER); + } + } else { + if ($action == "showallbyuser") { + if (empty($mid) || empty($uid)) { + $xoops->redirect("index.php", 1, _MD_SEARCH_PLZENTER); + } + } + } +} + +$gperm_handler = $xoops->getHandlerGroupperm(); +$available_modules = $gperm_handler->getItemIds('module_read', $search->getUserGroups()); +if ($action == 'search') { + $xoops->header(); + + /* @var $formHandler SearchForm */ + $formHandler = $search->getForm(null, 'search'); + $form = $formHandler->getSearchFrom($andor, $queries,$mids, $mid); + $form->display(); + + $xoops->footer(); +} +if ($andor != "OR" && $andor != "exact" && $andor != "AND") { + $andor = "AND"; +} +$ignored_queries = array(); // holds kewords that are shorter than allowed minmum length +$myts = MyTextSanitizer::getInstance(); +if ($action != 'showallbyuser') { + if ($andor != "exact") { + $temp_queries = preg_split('/[\s,]+/', $query); + foreach ($temp_queries as $q) { + $q = trim($q); + if (strlen($q) >= $search->getConfig('keyword_min')) { + $queries[] = $myts->addSlashes($q); + $queries_pattern[] = '~(' . $q . ')~sUi'; + } else { + $ignored_queries[] = $myts->addSlashes($q); + } + } + if (count($queries) == 0) { + $xoops->redirect('index.php', 2, sprintf(_MD_SEARCH_KEYTOOSHORT, $search->getConfig('keyword_min'))); + } + } else { + $query = trim($query); + if (strlen($query) < $search->getConfig('keyword_min')) { + $xoops->redirect('index.php', 2, sprintf(_MD_SEARCH_KEYTOOSHORT, $search->getConfig('keyword_min'))); + } + $queries = array($myts->addSlashes($query)); + $queries_pattern[] = '~(' . $myts->addSlashes($query) . ')~sUi'; + } +} + +switch ($action) { + case "results": + $module_handler = $xoops->getHandlerModule(); + $criteria = new CriteriaCompo(new Criteria('hassearch', 1)); + $criteria->add(new Criteria('isactive', 1)); + $criteria->add(new Criteria('mid', "(" . implode(',', $available_modules) . ")", 'IN')); + $modules = $module_handler->getObjectsArray($criteria, true); + $mids = isset($_REQUEST['mids']) ? $_REQUEST['mids'] : array(); + if (empty($mids) || !is_array($mids)) { + unset($mids); + $mids = array_keys($modules); + } + $xoops->header('module:search|search.html'); + $nomatch = true; + $xoops->tpl()->assign('search', true); + $xoops->tpl()->assign('queries', $queries); + $xoops->tpl()->assign('ignored_words', sprintf(_MD_SEARCH_IGNOREDWORDS, $search->getConfig('keyword_min'))); + $xoops->tpl()->assign('ignored_queries', $ignored_queries); + + $modules_result = array(); + foreach ($mids as $mid) { + $mid = intval($mid); + if (in_array($mid, $available_modules)) { + /* @var $module XoopsModule */ + $module = $modules[$mid]; + $results = $module->search($queries, $andor, 5, 0); + $count = count($results); + $mid = $module->getVar('mid'); + + $res = array(); + if (is_array($results) && $count > 0) { + $nomatch = false; + $modules_result[$mid]['name'] = $module->getVar('name'); + $modules_result[$mid]['image'] = 'modules/' . $module->getVar('dirname') . '/icons/logo_large.png'; + + $res = array(); + for ($i = 0; $i < $count; $i++) { + if (isset($results[$i]['image']) && $results[$i]['image'] != "") { + $res[$i]['image'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['image']; + } else { + $res[$i]['image'] = 'images/icons/posticon2.gif'; + } + if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) { + $res[$i]['link'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']; + } + $res[$i]['title'] = $myts->htmlspecialchars($results[$i]['title']); + $res[$i]['title_highligh'] = preg_replace( $queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlspecialchars($results[$i]['title'])); + if ( !empty($results[$i]['uid']) ) { + $res[$i]['uid'] = intval($results[$i]['uid']); + $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid'], true); + } + $res[$i]['time'] = !empty($results[$i]['time']) ? XoopsLocal::formatTimestamp(intval($results[$i]['time'])) : ""; + $res[$i]['content'] = empty($results[$i]['content']) ? "" : preg_replace( $queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']); + } + if ($count >= 5) { + $search_url = $search->url('index.php?query=' . urlencode(stripslashes(implode(' ', $queries)))); + $search_url .= "&mid={$mid}&action=showall&andor={$andor}"; + $modules_result[$mid]['search_url'] = htmlspecialchars($search_url); + } + } + if ( count($res) > 0 ) { + $modules_result[$mid]['result'] = $res; + } + } + unset($results); + unset($module); + } + $xoops->tpl()->assign('modules', $modules_result); + + /* @var $formHandler SearchForm */ + $formHandler = $search->getForm(null, 'search'); + $form = $formHandler->getSearchFrom($andor, $queries,$mids, $mid); + $form->display(); + break; + + case "showall": + case 'showallbyuser': + $xoops->header('module:search|search.html'); + $xoops->tpl()->assign('search', true); + $xoops->tpl()->assign('queries', $queries); + $xoops->tpl()->assign('ignored_words', sprintf(_MD_SEARCH_IGNOREDWORDS, $search->getConfig('keyword_min'))); + $xoops->tpl()->assign('ignored_queries', $ignored_queries); + + $module_handler = $xoops->getHandlerModule(); + $module = $module_handler->getById($mid); + $results = $module->search($queries, $andor, 20, $start, $uid); + + $modules_result[$mid]['name'] = $module->getVar('name'); + $modules_result[$mid]['image'] = 'modules/' . $module->getVar('dirname') . '/icons/logo_large.png'; + + $count = count($results); + if (is_array($results) && $count > 0) { + $next_results = $module->search($queries, $andor, 1, $start + 20, $uid); + $next_count = count($next_results); + $has_next = false; + if (is_array($next_results) && $next_count == 1) { + $has_next = true; + } + $xoops->tpl()->assign('sr_showing', sprintf(_MD_SEARCH_SHOWING, $start + 1, $start + $count)); + $res = array(); + for ($i = 0; $i < $count; $i++) { + if (isset($results[$i]['image']) && $results[$i]['image'] != "") { + $res[$i]['image'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['image']; + } else { + $res[$i]['image'] = 'images/icons/posticon2.gif'; + } + if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) { + $res[$i]['link'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']; + } + if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) { + $res[$i]['link'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']; + } + $res[$i]['title'] = $myts->htmlspecialchars($results[$i]['title']); + if (isset($queries_pattern)) { + $res[$i]['title_highligh'] = preg_replace( $queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlspecialchars($results[$i]['title'])); + } else { + $res[$i]['title_highligh'] = $myts->htmlspecialchars($results[$i]['title']); + } + if ( !empty($results[$i]['uid']) ) { + $res[$i]['uid'] = @intval($results[$i]['uid']); + $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid'], true); + } + $res[$i]['time'] = !empty($results[$i]['time']) ? " (" . XoopsLocal::formatTimestamp(intval($results[$i]['time'])) . ")" : ""; + $res[$i]['content'] = empty($results[$i]['content']) ? "" : preg_replace( $queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']); + } + if (count($res) > 0) { + $modules_result[$mid]['result'] = $res; + } + + $search_url = $search->url('index.php?query=' . urlencode(stripslashes(implode(' ', $queries)))); + $search_url .= "&mid={$mid}&action={$action}&andor={$andor}"; + if ($action == 'showallbyuser') { + $search_url .= "&uid={$uid}"; + } + if ($start > 0) { + $prev = $start - 20; + $search_url_prev = $search_url . "&start={$prev}"; + $modules_result[$mid]['prev'] = htmlspecialchars($search_url_prev); + + } + if (false != $has_next) { + $next = $start + 20; + $search_url_next = $search_url . "&start={$next}"; + $modules_result[$mid]['next'] = htmlspecialchars($search_url_next); + } + $xoops->tpl()->assign('modules', $modules_result); + } + + /* @var $formHandler SearchForm */ + $formHandler = $search->getForm(null, 'search'); + $form = $formHandler->getSearchFrom($andor, $queries,$mids, $mid); + $form->display(); + break; +} +$xoops->footer(); \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/index.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/index.html 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/main.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/main.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/main.php 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1,39 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author trabis <lus...@gm...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +define('_MD_SEARCH', 'Search'); +define('_MD_SEARCH_PLZENTER', 'Please enter all required data!'); +define('_MD_SEARCH_SEARCHRESULTS', 'Search Results'); +define('_MD_SEARCH_NOMATCH', 'No Match Found for your Query'); +define('_MD_SEARCH_FOUND', 'Found <strong>%s</strong> match(es)'); +define('_MD_SEARCH_SHOWING', '(Showing %d - %d)'); +define('_MD_SEARCH_ANY', 'Any (OR)'); +define('_MD_SEARCH_ALL', 'All (AND)'); +define('_MD_SEARCH_EXACT', 'Exact Match'); +define('_MD_SEARCH_SHOWALLR', 'Show all results'); +define('_MD_SEARCH_NEXT', 'Next >>'); +define('_MD_SEARCH_PREVIOUS', '<< Previous'); +define('_MD_SEARCH_KEYWORDS', 'Keyword(s)'); +define('_MD_SEARCH_TYPE', 'Type'); +define('_MD_SEARCH_SEARCHIN', 'Search in'); +define('_MD_SEARCH_KEYTOOSHORT', 'Keywords must be at least <strong>%s</strong> characters long'); +define('_MD_SEARCH_KEYIGNORE', 'Keywords shorter than <strong>%s</strong> characters will be ignored'); +define('_MD_SEARCH_SEARCHRULE', 'Search Rule'); +define('_MD_SEARCH_IGNOREDWORDS', 'The following words are shorter than allowed minmum length (%u chars) and were not included in your search:'); Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/main.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/modinfo.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/modinfo.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/modinfo.php 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1,28 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author trabis <lus...@gm...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +define('_MI_SEARCH_NAME', 'Search'); +define('_MI_SEARCH_DSC', 'Provides search ability for modules'); + +define("_MI_SEARCH_DOSEARCH", "Enable global searches?"); +define("_MI_SEARCH_DOSEARCHDSC", "Allow searching for posts/items within your site."); +define("_MI_SEARCH_MINSEARCH", "Minimum keyword length"); +define("_MI_SEARCH_MINSEARCHDSC", "Enter the minimum keyword length that users are required to enter to perform search"); + Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/english/modinfo.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/language/index.html 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/preloads/core.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/preloads/core.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/preloads/core.php 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1,38 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package publisher + * @author trabis <lus...@gm...> + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * Search core preloads + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author trabis <lus...@gm...> + */ +class SearchCorePreload extends XoopsPreloadItem +{ + static function eventCoreIncludeCommonEnd($args) + { + $path = dirname(dirname(__FILE__)); + XoopsLoad::addMap(array( + 'search' => $path . '/class/search.php', + )); + } +} \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/preloads/core.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/preloads/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/preloads/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/preloads/index.html 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/templates/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/templates/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/templates/index.html 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/templates/search.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/templates/search.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/templates/search.html 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1,81 @@ +<fieldset> + <{if $search}> + <legend><{$smarty.const._MD_SEARCH_SEARCHRESULTS}></legend> + <div> + <{$smarty.const._MD_SEARCH_KEYWORDS}> : + <span class="bold"> + <{foreachq from=$queries item=query name=foo}> + <{$query}><{if !$smarty.foreach.foo.last}>,<{/if}> + <{/foreach}> + </span> + <{if $sr_showing}> + <br /> + <{$sr_showing}> + <{/if}> + </div> + <{if count($ignored_queries) != 0}> + <div> + <{$ignored_words}> : + <span class="bold"> + <{foreachq from=$ignored_queries item=query name=foo}> + <{$query}><{if !$smarty.foreach.foo.last}>,<{/if}> + <{/foreach}> + </span> + </div> + <{/if}> + <{/if}> + + <{if count($modules) > 0}> + <{foreachq from=$modules item=module name=foo}> + <div class="searchModule"> + <div class="searchIcon floatleft"> + <img src="<{$module.image}>" alt="<{$module.name}>"> + </div> + <div class="searchTitle floatleft"> + <{$module.name}> + </div> + <{if $module.search_url}> + <div class="floatright"> + <a href="<{$module.search_url}>" title="<{$smarty.const._MD_SEARCH_SHOWALLR}>"><{$smarty.const._MD_SEARCH_SHOWALLR}></a> + </div> + <{/if}> + <div class="clear"></div> + + <{foreach from=$module.result item=result}> + <div class="searchItem"> + <div class="bold"><a href="<{$result.link}>" title="<{$result.title}>"><{$result.title_highligh}></a></div> + <div><{$result.content}></div> + <span class='x-small'> + <{if $result.uid}> + <a href="<{$xoops_url}>/userinfo.php?uid=<{$result.uid}>" title="<{$result.uname}>"><{$result.uname}></a> + <{/if}> + <{if $result.time}> + (<{$result.time}>) + <{/if}> + </span> + </div> + <{/foreach}> + </div> + + <!-- prev / next --> + <{if $module.prev || $module.next}> + <div> + <{if $module.prev}> + <div class="floatleft"> + <a href="<{$module.prev}>" title="<{$smarty.const._MD_SEARCH_PREVIOUS}>"><{$smarty.const._MD_SEARCH_PREVIOUS}></a> + </div> + <{/if}> + <{if $module.next}> + <div class="floatright"> + <a href="<{$module.next}>" title="<{$smarty.const._MD_SEARCH_NEXT}>"><{$smarty.const._MD_SEARCH_NEXT}></a> + </div> + <{/if}> + </div> + <{/if}> + <{/foreach}> + <{else}> + <div class="searchModule bold"> + <{$smarty.const._MD_SEARCH_NOMATCH}> + </div> + <{/if}> +</fieldset> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/xoops_version.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/xoops_version.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/xoops_version.php 2012-12-16 00:34:51 UTC (rev 10399) @@ -0,0 +1,88 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package logger + * @author trabis <lus...@gm...> + * @version $Id$ + */ + +$modversion = array(); +$modversion['name'] = _MI_SEARCH_NAME; +$modversion['description'] = _MI_SEARCH_DSC; +$modversion['version'] = 0.1; +$modversion['author'] = 'Trabis'; +$modversion['nickname'] = 'trabis'; +$modversion['credits'] = 'The XOOPS Project'; +$modversion['license'] = 'GNU GPL 2.0'; +$modversion['license_url'] = 'www.gnu.org/licenses/gpl-2.0.html/'; +$modversion['official'] = 1; +//$modversion['help'] = 'page=help'; +$modversion['image'] = 'images/logo.png'; +$modversion['dirname'] = 'search'; + +//about +$modversion['release_date'] = '2012/11/25'; +$modversion['module_website_url'] = 'http://www.xoops.org/'; +$modversion['module_website_name'] = 'XOOPS'; +$modversion['module_status'] = 'ALPHA 1'; +$modversion['min_php'] = '5.2'; +$modversion['min_xoops'] = '2.6.0'; +$modversion['min_db'] = array('mysql' => '5.0.7', 'mysqli' => '5.0.7'); + +// paypal +$modversion['paypal'] = array(); +$modversion['paypal']['business'] = 'lus...@gm...'; +$modversion['paypal']['item_name'] = ''; +$modversion['paypal']['amount'] = 0; +$modversion['paypal']['currency_code'] = 'EUR'; + +// Admin menu +// Set to 1 if you want to display menu generated by system module +$modversion['system_menu'] = 1; + +/* + Manage extension + */ +$modversion['extension'] = 0; + +// Admin things +$modversion['hasAdmin'] = 0; + +// Menu +$modversion['hasMain'] = 1; + +// Search +$modversion['hasSearch'] = 0; + +/* + Blocks +*/ +$modversion['blocks'] = array(); + +// Preferences +$i = 0; +$modversion['config'][$i]['name'] = 'enable_search'; +$modversion['config'][$i]['title'] = '_MI_SEARCH_DOSEARCH'; +$modversion['config'][$i]['description'] = '_MI_SEARCH_DOSEARCHDSC'; +$modversion['config'][$i]['formtype'] = 'yesno'; +$modversion['config'][$i]['valuetype'] = 'int'; +$modversion['config'][$i]['default'] = 1; + +$i++; +$modversion['config'][$i]['name'] = 'keyword_min'; +$modversion['config'][$i]['title'] = '_MI_SEARCH_MINSEARCH'; +$modversion['config'][$i]['description'] = '_MI_SEARCH_MINSEARCHDSC'; +$modversion['config'][$i]['formtype'] = 'textbox'; +$modversion['config'][$i]['valuetype'] = 'int'; +$modversion['config'][$i]['default'] = 5; \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/search/xoops_version.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native |