28
OK, sorry for the delay
In SimplyWiki 1.1, open include/search.php and replace the search function with this
function swiki_search($queryarray, $andor, $limit, $offset, $userid)
{
global $xoopsDB;
$sql = 'SELECT * FROM '.$xoopsDB->prefix('wiki_pages').' p, '.$xoopsDB->prefix('wiki_revisions').' r WHERE p.pageid=r.pageid AND p.lastmodified=r.modified';
if (is_array($queryarray) && ($count = count($queryarray))) {
$sql .= ' AND (p.title LIKE "%'.$queryarray[0].'%" OR r.body LIKE "%'.$queryarray[0].'%")';
for($i = 1; $i < $count; $i++) {
$sql .= ' $andor (p.title LIKE "%'.$queryarray[$i].'%" OR r.body LIKE "%'.$queryarray[$i].'%")';
}
} else {
$sql .= ' AND r.userid='.$userid.'';
}
$sql .= ' ORDER BY r.modified DESC';
$items = array();
$prf = new WiwiProfile();
$result = $xoopsDB->query($sql, $limit, $offset);
while($myrow = $xoopsDB->fetchArray($result)) {
$prf->load($myrow['prid']);
if ($prf->canRead()) {
$items[] = array(
'title' => $myrow['title'],
'link' => 'index.php?page='.$myrow['keyword'],
'time' => formatTimestamp(strtotime($myrow['modified']), _SHORTDATESTRING),
'uid' => $myrow['userid'],
'image' => '../../images/quote.gif'
);
}
}
return $items;
}
Looking at 1.0 (Wiwimod 0.8.3+), I don't think it works there, either - the LIKE conditions are not properly enclosed in quotes and there are no wildcards.