1
gzartman
wfchannl -- search returns links that look like wfsection
  • 2004/2/10 6:18

  • gzartman

  • Just popping in

  • Posts: 7

  • Since: 2004/2/2 1


I've installed wfchannel on a test machine an notice that a search on channel content returns links that look like wfsection paths. For example:
domain/modules/wfchannel/article.php?storyid=4

Anyone have any idea how to hack wfchannel so that it behaves correctly with the search function?

Thanks.

Greg Zartman

2
gzartman
Re: wfchannel -- search returns links that look like wfsection
  • 2004/2/10 13:04

  • gzartman

  • Just popping in

  • Posts: 7

  • Since: 2004/2/2 1


Yes, there is a bug in this module. Specifically with include/search.inc.php. Looks like it was a cut-n-paste from wf-section, but didn't get updated for wf-channel. Fix is as follows:

<?php
/**
* $Id: search.php v 1.01 20 November 2003 Catwolf Exp $
* Module: WF-Channel
* Version: v1.0.2
* Release Date: 20 November 2003
* Author: Catzwolf
* Licence: GNU
**/

function wfchannel_search($queryarray, $andor, $limit, $offset, $userid){
global $xoopsDB;

$sql = "SELECT CID, pagetitle, created FROM ".$xoopsDB->prefix("wfschannel")." WHERE ";

// because count() returns 1 even if a supplied variable
// is not an array, we must check if $querryarray is really an array
if ( is_array($queryarray) && $count = count($queryarray) ) {
$sql .= " ((pagetitle LIKE '%$queryarray[0]%' OR pageheadline LIKE '%$queryarray[0]%' OR page LIKE '%$queryarray[0]%')";
for($i=1;$i<$count;$i++){
$sql .= " $andor ";
$sql .= "(pagetitle LIKE '%$queryarray[$i]%' OR pageheadline LIKE '%$queryarray[$i]%' OR page LIKE '%$queryarray[$i]%')";
}
$sql .= ") ";
}
$sql .= "ORDER BY created DESC";
$result = $xoopsDB->query($sql,$limit,$offset);
$ret = array();
$i = 0;
while($myrow = $xoopsDB->fetchArray($result)){
//$ret[$i]['image'] = "images/forum.gif";
$ret[$i]['link'] = "index.php?pagenum=".$myrow['CID']."";
$ret[$i]['title'] = $myrow['pagetitle'];
$ret[$i]['time'] = $myrow['created'];
$i++;
}
return $ret;
}
?>

Login

Who's Online

121 user(s) are online (86 user(s) are browsing Support Forums)


Members: 0


Guests: 121


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits