<?php
function b_BopComments_pukiwiki($maxtopic, $module_mid)	{
	$xoopsDB =& Database::getInstance();
	
	$comment = array();

	include_once (XOOPS_ROOT_PATH."/modules/pukiwiki/cache/config.php");
	
	$SQL = "SELECT p.id, p.lastediter, p.name as pname, p.title, p.editedtime , c.count FROM ".
			$xoopsDB->prefix("pukiwikimod_pginfo")." p LEFT JOIN ".
			$xoopsDB->prefix("pukiwikimod_count")." c ON p.name=c.name ".
			"WHERE p.vaids=\"&all\" AND p.name NOT LIKE \":%\" ".
			"ORDER BY p.editedtime DESC";
	if ( !$query = $xoopsDB->query($SQL,$maxtopic,0) ) echo "Error! $SQL (pukiwiki)";
	while ( $result = $xoopsDB->fetchArray($query) )	{
		$key = BopComments_KeyCheck($comment, $result['editedtime']);
		$page = ($use_static_url)? $result['id'].".html" : "?".rawurlencode($result['pname']);
		$comment[$key]['moduleimg'] = XOOPS_URL."/modules/BopComments/plugin/image/wiki.png";
		$comment[$key]['modulelink'] = XOOPS_URL."/modules/pukiwiki/index.php";
		$comment[$key]['placelink'] = XOOPS_URL."/modules/pukiwiki/".$page;
		$comment[$key]['place'] = $result['pname'];
		$comment[$key]['topiclink'] = XOOPS_URL."/modules/pukiwiki/".$page;
		$comment[$key]['topic'] = $result['title'];
		$comment[$key]['user'] = $result['lastediter'];
		$comment[$key]['read'] = $result['count'];
		$comment[$key]['reply'] = "-";
		$comment[$key]['date'] = $key;
	}
	return $comment;
}
?>