Semi pro
Inscrit: 13/04/2007 20:36
|
Bonsoir Je vous met les codes des 2 fichiers correspondants (peut-être que l'on peut intégrer le Template sur la version 2.5.6 ) Je n'ai pas réussi a faire la liaison avec le Template sur la 2.5.6 Si quelqu'un avais une piste, je suis preneur. Code du fichier search.php de la version 2.0.18
<?php
// $Id: search.php 506 2006-05-26 23:10:37Z skalpa $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <http://www.xoops.org/> ... nbsp; //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// 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. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
$xoopsOption['pagetype'] = "search";
include 'mainfile.php';
// --------------------------------------------------- Hack by DuGris
include_once XOOPS_ROOT_PATH . '/include/functions_search.php';
// --------------------------------------------------- Hack by DuGris
$config_handler =& xoops_gethandler('config');
$xoopsConfigSearch =& $config_handler->getConfigsByCat(XOOPS_CONF_SEARCH);
if ($xoopsConfigSearch['enable_search'] != 1) {
header('Location: '.XOOPS_URL.'/index.php');
exit();
}
$action = "search";
if (!empty($_GET['action'])) {
$action = $_GET['action'];
} elseif (!empty($_POST['action'])) {
$action = $_POST['action'];
}
$query = "";
if (!empty($_GET['query'])) {
$query = $_GET['query'];
} elseif (!empty($_POST['query'])) {
$query = $_POST['query'];
}
$andor = "AND";
if (!empty($_GET['andor'])) {
$andor = $_GET['andor'];
} elseif (!empty($_POST['andor'])) {
$andor = $_POST['andor'];
}
$mid = $uid = $start = 0;
if ( !empty($_GET['mid']) ) {
$mid = intval($_GET['mid']);
} elseif ( !empty($_POST['mid']) ) {
$mid = intval($_POST['mid']);
}
if (!empty($_GET['uid'])) {
$uid = intval($_GET['uid']);
} elseif (!empty($_POST['uid'])) {
$uid = intval($_POST['uid']);
}
if (!empty($_GET['start'])) {
$start = intval($_GET['start']);
} elseif (!empty($_POST['start'])) {
$start = intval($_POST['start']);
}
$queries = array();
if ($action == "results") {
if ($query == "") {
redirect_header("search.php",1,_SR_PLZENTER);
exit();
}
} elseif ($action == "showall") {
if ($query == "" || empty($mid)) {
redirect_header("search.php",1,_SR_PLZENTER);
exit();
}
} elseif ($action == "showallbyuser") {
if (empty($mid) || empty($uid)) {
redirect_header("search.php",1,_SR_PLZENTER);
exit();
}
}
$groups = is_object($xoopsUser) ? $xoopsUser -> getGroups() : XOOPS_GROUP_ANONYMOUS;
$gperm_handler = & xoops_gethandler( 'groupperm' );
$available_modules = $gperm_handler->getItemIds('module_read', $groups);
if ( $andor != "OR" && $andor != "exact" && $andor != "AND" ) {
$andor = "AND";
}
$myts =& MyTextSanitizer::getInstance();
// --------------------------------------------------- Hack by DuGris
$ignored_queries = array(); // holds kewords that are shorter than allowed minmum length
if ($action != 'showallbyuser' && $action !='search' ) {
// --------------------------------------------------- Hack by DuGris
if ( $andor != "exact" ) {
$ignored_queries = array(); // holds kewords that are shorter than allowed minmum length
$temp_queries = preg_split('/[s,]+/', $query);
foreach ($temp_queries as $q) {
$q = trim($q);
if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
$queries[] = $myts->addSlashes($q);
} else {
$ignored_queries[] = $myts->addSlashes($q);
}
}
if (count($queries) == 0) {
redirect_header('search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
exit();
}
} else {
$query = trim($query);
if (strlen($query) < $xoopsConfigSearch['keyword_min']) {
redirect_header('search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
exit();
}
$queries = array($myts->addSlashes($query));
}
}
// --------------------------------------------------- Hack by DuGris
$xoopsOption['template_main'] = 'system_search.html';
include XOOPS_ROOT_PATH."/header.php";
$xoopsTpl->assign('action', $action );
if ($action != 'showallbyuser') {
include 'include/searchform.php';
$xoopsTpl->assign('search_form', $search_form->render());
} else {
$xoopsTpl->assign('user_link', xoops_getLinkedUnameFromId($uid));
}
// --------------------------------------------------- Hack by DuGris
switch ($action) {
case "results":
$module_handler =& xoops_gethandler('module');
$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->getObjects($criteria, true);
$mids = isset($_REQUEST['mids']) ? $_REQUEST['mids'] : array();
if (empty($mids) || !is_array($mids)) {
unset($mids);
$mids = array_keys($modules);
}
// --------------------------------------------------- Hack by DuGris
SearchMakeHeader($andor, $queries, $ignored_queries);
$hasresult = false;
// --------------------------------------------------- Hack by DuGris
foreach ($mids as $mid) {
$mid = intval($mid);
if ( in_array($mid, $available_modules) ) {
$module =& $modules[$mid];
// --------------------------------------------------- Hack by DuGris
if ( SearchMakeResult($action, $module, $queries, $andor) ) {
$hasresult = true;
}
// --------------------------------------------------- Hack by DuGris
}
}
// --------------------------------------------------- Hack by DuGris
if ( !$hasresult ) {
$xoopsTpl->assign('searchmessage', _SR_NOMATCH );
}
// --------------------------------------------------- Hack by DuGris
break;
case "showall":
case 'showallbyuser':
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->get($mid);
// --------------------------------------------------- Hack by DuGris
SearchMakeHeader($andor, $queries, $ignored_queries);
SearchMakeResult($action, $module, $queries, $andor, $start, $uid);
// --------------------------------------------------- Hack by DuGris
break;
// --------------------------------------------------- Hack by DuGris
case "search":
case "default":
break;
// --------------------------------------------------- Hack by DuGris
}
include XOOPS_ROOT_PATH."/footer.php";
?>
Et code du fichier system_search.html de la version 2.0.18 qui se trouve dans modules / system / templates /
<{if $action != "search" && $action != "showallbyuser"}>
<div class="item">
<div class="itemHead">
<b><{$smarty.const._SR_SEARCHRESULTS}></b>
</div>
<{if $searchfrom == "user"}>
<{$smarty.const._SR_NICKNAME}> : <{$user_link}>
<{else}>
<div class="itemBody">
<!-- search type -->
<{$smarty.const._SR_TYPE}> :
<b>
<{if $searchmethod == 'ALL'}>
<{$smarty.const._SR_ANY}>
<{elseif $searchmethod == 'OR'}>
<{$smarty.const._SR_ANY}>
<{else}>
<{$smarty.const._SR_EXACT}>
<{/if}>
</b>
</div>
<div class="itemBody">
<!-- queries -->
<{$smarty.const._SR_KEYWORDS}> :
<{foreach item=query from=$queries}><b><{$query}> </b><{/foreach}>
</div>
<!-- ignored queries -->
<{if count($ignored_queries) != 0}>
<div class="itemBody odd">
<{$ignored_txt}>
<{foreach item=query from=$ignored_queries}><b><{$query}> </b><{/foreach}>
</div>
<{/if}>
<{/if}>
<{if $searchmessage}>
<div class="itemBody center odd">
<{$searchmessage}>
</div>
<{/if}>
</div>
<{if $pagenav}>
<{$pagenav}>
<{/if}>
<{/if}>
<{if count($search) > 0}>
<{foreach item=module from=$search}>
<div class="item">
<div class="itemHead">
<div class="itemTitle">
<a href='<{$xoops_url}>/modules/<{$module.dirname}>' title='<{$module.name}>'><img src='<{$module.image}>' alt='<{$module.name}>' /> <{$module.name}></a>
</div>
</div>
<div>
<{include file="db:system_searchitem.html"}>
</div>
<{if $module.showall}>
<div class="itemFoot">
<span class="itemPermaLink">
<{$module.count}>
|
<a href="<{$module.showall}>"><{$smarty.const._SR_SHOWALLR}></a>
</span>
</div>
<{/if}>
</div>
<{/foreach}>
<{if $pagenav}>
<{$pagenav}>
<{/if}>
<{/if}>
<!-- display search form -->
<{$search_form}>
Merci d'avance pour vos réponses
Posté le : 04/04/2015 19:33
|