29 if (!
$search->getConfig(
'enable_search')) {
30 header(
'Location: ' . XOOPS_URL .
'/index.php');
36 $action = Request::getCmd(
'action',
'search');
37 $query = Request::getString(
'query',
'');
38 $andor = Request::getWord(
'andor',
'AND');
39 $mid = Request::getInt(
'mid', 0);
40 $uid = Request::getInt(
'uid', 0);
41 $start = Request::getInt(
'start', 0);
42 $mids = Request::getArray(
'mids', array());
56 if (
$action ==
"showallbyuser") {
72 $formHandler =
$search->getForm(null,
'search');
85 if (
$action !=
'showallbyuser') {
88 $temp_queries = str_getcsv(
$query,
' ',
'"');
89 foreach ($temp_queries as $q) {
91 if (mb_strlen($q) >=
$search->getConfig(
'keyword_min')) {
121 $xoops->header(
'module:search/search.tpl');
123 $xoops->tpl()->assign(
'search',
true);
128 $modules_result = array();
134 $plugin = \Xoops\Module\Plugin::getPlugin(
$module->getVar(
'dirname'),
'search');
140 if (is_array($results) &&
$count > 0) {
142 $modules_result[
$mid][
'name'] =
$module->getVar(
'name');
146 $modules_result[
$mid][
'image'] =
$xoops->url(
'images/icons/posticon2.gif');
150 if (!preg_match(
"/^http[s]*:\/\//i", $results[
$i][
'link'])) {
151 $res[
$i][
'link'] =
$xoops->url(
'modules/' .
$module->getVar(
'dirname') .
'/' . $results[
$i][
'link']);
153 $res[
$i][
'link'] = $results[
$i][
'link'];
155 $res[
$i][
'title'] =
$myts->htmlspecialchars($results[$i][
'title']);
156 $res[
$i][
'title_highligh'] = preg_replace(
$queries_pattern,
"<span class='searchHighlight'>$1</span>",
$myts->htmlspecialchars($results[$i][
'title']));
157 if (!empty($results[$i][
'uid'])) {
158 $res[
$i][
'uid'] = intval($results[$i][
'uid']);
162 $res[
$i][
'content'] = empty($results[$i][
'content']) ?
"" : preg_replace(
$queries_pattern,
"<span class='searchHighlight'>$1</span>", $results[$i][
'content']);
165 $search_url =
$search->url(
'index.php?query=' . urlencode(stripslashes(implode(
' ',
$queries))));
166 $search_url .=
"&mid={$mid}&action=showall&andor={$andor}";
167 $modules_result[
$mid][
'search_url'] = htmlspecialchars($search_url);
170 if (count(
$res) > 0) {
171 $modules_result[
$mid][
'result'] =
$res;
177 $xoops->tpl()->assign(
'modules', $modules_result);
180 $formHandler =
$search->getForm(null,
'search');
186 case 'showallbyuser':
187 $xoops->header(
'module:search/search.tpl');
188 $xoops->tpl()->assign(
'search',
true);
196 $plugin = \Xoops\Module\Plugin::getPlugin(
$module->getVar(
'dirname'),
'search');
199 $modules_result[
$mid][
'name'] =
$module->getVar(
'name');
200 $modules_result[
$mid][
'image'] =
$xoops->url(
'modules/' .
$module->getVar(
'dirname') .
'/icons/logo_large.png');
202 $count = count($results);
203 if (is_array($results) && $count > 0) {
205 $next_count = count($next_results);
207 if (is_array($next_results) && $next_count == 1) {
213 if (isset($results[$i][
'image']) && $results[$i][
'image'] !=
"") {
214 $res[
$i][
'image'] =
$xoops->url(
'modules/' .
$module->getVar(
'dirname') .
'/' . $results[
$i][
'image']);
216 $res[
$i][
'image'] =
$xoops->url(
'images/icons/posticon2.gif');
218 if (!preg_match(
"/^http[s]*:\/\//i", $results[$i][
'link'])) {
219 $res[
$i][
'link'] =
$xoops->url(
'modules/' .
$module->getVar(
'dirname') .
'/' . $results[
$i][
'link']);
221 $res[
$i][
'link'] = $results[
$i][
'link'];
223 $res[
$i][
'title'] =
$myts->htmlspecialchars($results[$i][
'title']);
225 $res[
$i][
'title_highligh'] = preg_replace(
$queries_pattern,
"<span class='searchHighlight'>$1</span>",
$myts->htmlspecialchars($results[$i][
'title']));
227 $res[
$i][
'title_highligh'] =
$myts->htmlspecialchars($results[$i][
'title']);
229 if (!empty($results[$i][
'uid'])) {
230 $res[
$i][
'uid'] = @intval($results[$i][
'uid']);
234 $res[
$i][
'content'] = empty($results[$i][
'content']) ?
"" : preg_replace(
$queries_pattern,
"<span class='searchHighlight'>$1</span>", $results[$i][
'content']);
236 if (count(
$res) > 0) {
237 $modules_result[
$mid][
'result'] =
$res;
240 $search_url =
$search->url(
'index.php?query=' . urlencode(stripslashes(implode(
' ',
$queries))));
241 $search_url .=
"&mid={$mid}&action={$action}&andor={$andor}";
242 if (
$action ==
'showallbyuser') {
243 $search_url .=
"&uid={$uid}";
247 $search_url_prev = $search_url .
"&start={$prev}";
248 $modules_result[
$mid][
'prev'] = htmlspecialchars($search_url_prev);
250 if (
false != $has_next) {
252 $search_url_next = $search_url .
"&start={$next}";
253 $modules_result[
$mid][
'next'] = htmlspecialchars($search_url_next);
255 $xoops->tpl()->assign(
'modules', $modules_result);
259 $formHandler =
$search->getForm(null,
'search');
if(empty($image_id)) $image
static formatTimestamp($time, $format= 'l', $timeoffset=null)
if(!$dbm->isConnectable()) $res
const _MD_SEARCH_IGNOREDWORDS
const _MD_SEARCH_PLZENTER
defined('DS') or define('DS' DIRECTORY_SEPARATOR
static getUnameFromId($userid, $usereal=0)
if(!$xoops->isUser()) $uid
if($action== 'search') if($andor!="OR"&&$andor!="exact"&&$andor!="AND") $ignored_queries
const _MD_SEARCH_KEYTOOSHORT
if(file_exists($mainfile)) elseif(file_exists(__DIR__. '/install/index.php')) $xoops