16
Try this:
<?php
/**
* ****************************************************************************
* Module généré par TDMCreate de la TDM "http://www.tdmxoops.net"
* ****************************************************************************
* xsitemap - MODULE FOR XOOPS AND IMPRESS CMS
* Copyright (c) Urbanspaceman (http://www.takeaweb.it)
*
* 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.
*
* @copyright Urbanspaceman (http://www.takeaweb.it)
* @license GPL
* @package xsitemap
* @author Urbanspaceman (http://www.takeaweb.it)
*
* Version : 1.00:
* ****************************************************************************
*/
//Show xsitemap
function xsitemap_get_map($table, $id_name, $pid_name, $title_name, $url, $order = ""){
global $sitemap_configs;
$xoopsDB =& Database::getInstance();
$xsitemap = array();
$myts =& MyTextSanitizer::getInstance();
$sql = "SELECT `$id_name`, `$pid_name`, `$title_name` FROM ".$xoopsDB->prefix."_"."$table" ;
$result = $xoopsDB->query($sql);
while ($row = $xoopsDB->fetchArray($result)) {
$objsArray[] = new XoopsDummyObject($row, $id_name, $pid_name, $title_name);
}
$mytree = new XoopsObjectTree($objsArray, $id_name, $pid_name);
$i = 0;
$sql = "SELECT `$id_name`, `$title_name` FROM ".$xoopsDB->prefix."_"."$table WHERE `$pid_name`= 0" ;
if ($order != '')
{
$sql .= " ORDER BY `$order`" ;
}
$result = $xoopsDB->query($sql);
while (list($catid, $name) = $xoopsDB->fetchRow($result))
{
$xsitemap['parent'][$i]['id'] = $catid;
$xsitemap['parent'][$i]['title'] = $myts->htmlSpecialChars( $name ) ;
$xsitemap['parent'][$i]['url'] = $url.$catid;
//if($xsitemap_configs["show_subcategories"]){
$j = 0;
$child_array = $mytree->getAllChild($catid);
foreach ($child_array as $child)
{
//$count = strlen($child['prefix']) + 1;
$xsitemap['parent'][$i]['child'][$j]['id'] = $child[$id_name];
$xsitemap['parent'][$i]['child'][$j]['title'] = $myts->htmlSpecialChars( $child[$title_name] ) ;
//$xsitemap['parent'][$i]['child'][$j]['image'] = (($count > 3) ? 4 : $count);
$xsitemap['parent'][$i]['child'][$j]['url'] = $url.$child[$id_name];
$j++;
}
//}
$i++;
}
return $xsitemap;
}
?>