<?php
require('e/class/connect.php');
require('e/class/db_sql.php');
require('e/data/dbcache/class.php');
$link=db_connect();
$empire=new mysqlquery();
//------- 插件参数设置开始 -----
//只显示栏目最新几条信息,0为全部显示
$shownum=4000;
//------- 插件参数设置结束 -----
header("Content-type: application/xml");
//取得网站地址
$siteurl=$public_r['newsurl'];
if(!stristr($public_r['newsurl'],'://'))
{
$siteurl=eReturnDomain().$public_r['newsurl'];
}
$sitedomain=substr($siteurl,0,-1);//网站域名
$classid=(int)$_GET['classid'];
if(empty($classid))//栏目导航
{
?>
<?='<?xml version="1.0" encoding="UTF-8"?>'?>
<sitemapindex>
<?php
$sql=$empire->query("SELECT classid FROM {$dbtbpre}enewsclass WHERE islast=1");
while($r=$empire->fetch($sql))
{
$infor=$empire->fetch1("SELECT newstime FROM {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]." WHERE classid='$r[classid]' ORDER BY newstime DESC LIMIT 1");
?>
<sitemap>
<loc><?=$siteurl?>baidumap.php?classid=<?=$r[classid]?>.xml</loc>
<lastmod><?=date('Y-m-d',$infor[newstime])?></lastmod>
</sitemap>
<?php
}
?>
</sitemapindex>
<?php
}
else//信息列表
{
if(!$class_r[$classid]['tbname'])
{
exit();
}
$limit=$shownum?' order by newstime desc limit '.$shownum:'';
?>
<?='<?xml version="1.0" encoding="UTF-8"?>'?>
<urlset>
<?php
$sql=$empire->query("SELECT id,classid,newspath,filename,groupid,titleurl,newstime FROM {$dbtbpre}ecms_".$class_r[$classid][tbname]." WHERE classid='$classid' AND checked=1".$limit);
while($r=$empire->fetch($sql))
{
if($r['titleurl'])
{
continue;
}
$titleurl=sys_ReturnBqTitleLink($r);
$titleurl=str_replace('&','&',$titleurl);
if(!stristr($titleurl,'://'))
{
if($public_r['newsurl']=='/')
{
$titleurl=$sitedomain.$titleurl;
}
else
{
$titleurl=str_replace($public_r['newsurl'],$siteurl,$titleurl);
}
}
?>
<url>
<loc><?=$titleurl?></loc>
<lastmod><?=date('Y-m-d',$r[newstime])?></lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<?php
}
?>
</urlset>
<?php
}
db_close();
$empire=null;
?>
|