1
For some reason after adding sub pages into the XOOPS version file of Newbb, sitemap has turned these into forums as well as sub pages on the google_xml.php….Could anyone see a reason for this happening from the sitemap newbb plugin?
/* $Id: newbb.php,v 1.1 2005/04/07 09:23:42 gij Exp $
// FILE :: newbb.php
// AUTHOR :: Ryuji AMANO
// WEB :: Ryu's Planning
// NewBBversion/newbb2 plugin: D.J., https://xoops.org.cn*/
function b_sitemap_newbb(){global $sitemap_configs;
$sitemap = array();
// Get the NewBB version Info
$module_handler = &xoops_gethandler('module');
$newbb = $module_handler->getByDirname('newbb');
$newbb_version = intval($newbb->getInfo('version'));
// For NewBB 2. If the syntax is wrong, correct me plz.
if($newbb_version>=2){
// Get All Forums with access permission
$forum_handler =& xoops_getmodulehandler('forum', 'newbb');
$_forums = $forum_handler->getForums(0, 'access');
// Some transformation; Might ugly but works :=)
$forums = array();
$forums_sub = array();
foreach ($_forums as $forumid => $forum){if($forum->isSubForum()) $forums_sub[$forum->getVar('parent_forum')][$forumid] = array(
'id' => $forumid,
'url' => "viewforum.php?forum=".$forumid,
'title' => $forum->getVar('forum_name'));
else $forums[$forumid] = array(
'id' => $forumid,
'cid' => $forum->getVar('cat_id'),
'url' => "viewforum.php?forum=".$forumid,
'title' => $forum->getVar('forum_name'));}
unset($_forums);
foreach ($forums as $id => $forum){if(!empty($forums_sub[$id]))
$forums[$id]['fchild'] =& $forums_sub[$id];}
// Why not enable subcategory?
if($sitemap_configs["show_subcategoris"])
{$category_handler =& xoops_getmodulehandler('category', 'newbb');
$categories = $category_handler->getAllCats('access');
if(count($categories)>0) foreach ($categories as $key=>$category){$cat_id=$category->getVar("cat_id");
$i=$cat_id;
$sitemap['parent'][$i]['id'] = $cat_id;
$sitemap['parent'][$i]['title'] = $category->getVar("cat_title");
$sitemap['parent'][$i]['url'] = "index.php?cat=".$cat_id;}
if(count($forums)>0) foreach ($forums as $id=>$forum){$cid=$forum['cid'];
$sitemap['parent'][$cid]['child'][$id] = $forum;
$sitemap['parent'][$cid]['child'][$id]['image'] = 2;
if(!empty($forum['fchild'])) foreach($forum['fchild'] as $_id=>$_forum){$sitemap['parent'][$cid]['child'][$_id] = $_forum;
unset($_forum);
$sitemap['parent'][$cid]['child'][$_id]['image'] = 3;}
unset($forum);}
/* In case not enable subcategory, do the following; Sorry, I have not tested with this mode yet. If any bugs, feel free to fix.*/
}else{if(count($forums)>0) foreach ($forums as $id=>$forum){$sitemap['parent'][$id] = $forum;
if(!empty($forum['fchild'])) foreach($forum['fchild'] as $_id=>$_forum){$sitemap['parent'][$id]['child'][$_id] = $_forum;
$sitemap['parent'][$cid]['child'][$id]['image'] = 2;
unset($_forum);}
unset($forum);}}
return $sitemap;}
/** My part ends, D.J. :=)*/
$db =& Database::getInstance();
$myts =& MyTextSanitizer::getInstance();
if($sitemap_configs["show_subcategoris"]){$sql = 'SELECT DISTINCT c.* FROM '.$db->prefix('bb_categories').' c, '.$db->prefix("bb_forums").' f WHERE f.cat_id=c.cat_id GROUP BY c.cat_id, c.cat_title, c.cat_order ORDER BY c.cat_order';
$result = $db->query($sql);
$categories = array();
while ($cat_row = $db->fetchArray($result)){$i = $cat_row["cat_id"];
$sitemap['parent'][$i]['id'] = $cat_row["cat_id"];
$sitemap['parent'][$i]['title'] = $myts->makeTboxData4Show($cat_row["cat_title"]);
$sitemap['parent'][$i]['url'] = "index.php?cat=".$cat_row["cat_id"];
$categories[] = $cat_row["cat_id"];}}
$sql = "SELECT f.* FROM ".$db->prefix("bb_forums")." f LEFT JOIN ".$db->prefix("bb_categories")." c ON f.cat_id=c.cat_id ORDER BY f.forum_id";
$result = $db->query($sql);
$i=0;
while($forum_row = $db->fetchArray($result))
{if($sitemap_configs["show_subcategoris"]){$j = $forum_row["cat_id"];
$sitemap['parent'][$j]['child'][$i]['id'] = $forum_row["forum_id"];
$sitemap['parent'][$j]['child'][$i]['title'] = $myts->makeTboxData4Show($forum_row["forum_name"]);
$sitemap['parent'][$j]['child'][$i]['image'] = 2;
$sitemap['parent'][$j]['child'][$i]['url'] = "viewforum.php?forum=".$forum_row['forum_id'];}
else{$sitemap['parent'][$i]['id'] = $forum_row["forum_id"];
$sitemap['parent'][$i]['title'] = $myts->makeTboxData4Show($forum_row["forum_name"]);
$sitemap['parent'][$i]['url'] = "viewforum.php?forum=".$forum_row['forum_id'];}
$i++;}
//print_r($categories);
return $sitemap;}
?>
<url>
<loc>http://localhost/finalize/modules/newbb/
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/index.php?cat=1
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewforum.php?forum=1
loc>
url>
?
<url>
<loc>http://localhost/finalize/modules/newbb/
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewforum.php?forum=2
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewforum.php?forum=3
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewforum.php?forum=4
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewforum.php?forum=5
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewforum.php?forum=6
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewforum.php?forum=7
loc>
url>
?
<url>
<loc>http://localhost/finalize/modules/newbb/search.php
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewpost.php
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewpost.php?new=1
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewall.php
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewall.php?type=digest
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewall.php?type=unreplied
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/viewall.php?type=unread
loc>
url>
?
<url>
?
<loc>
http://localhost/finalize/modules/newbb/rss.php?c=0
loc>