SS6.0 正式版的sitemap生成有如下问题: 
1.Google的sitemap时间格式错误,原Google sitemap的时间格式为: 2008-01-01 12:12:12 不符合W3C的sitemap时间格式标准,会导致Google的警告,但不妨碍sitemap的收录; 
2.Google的sitemap文件不在网站根目录下,导致在提交sitemap时,需要新增一个名称为http://www.xxx.com/data/sitemap的站点地址。 
 
现已经修正这两个问题,发布sitemap补丁(个人修改,非官方),供大家下载。 
 
修正说明: 
1.Google的sitemap时间格式现修正为:2008-01-01这样的格式; 
2.生成的sitemap文件默认保存在网站根目录下,包括Baidu sitemap和Google sitemap ,文件名不变。 
Google sitemap生成后地址为:http://www.xxx.com/Google.xml 
Baidu sitemap生成后地址为:http://www.xxx.com/Baidu.xml 
 
 
补丁使用说明: 
下载admin_sitemap.rar文件,并解压缩, 
1.登陆FTP,打开你网站目录下的 admin 目录,修改admin_sitemap.php这个文件的名称为:admin_sitemap0.php (或其它名称也可); 
2.把你下载的admin_sitemap.php文件上传到你网站的admin目录。 
3.进入你网站后台,点击生成sitemap,如果正常,即可正常使用;如果出错或打不开,请删除admin_sitemap.php文件,并把admin_sitemap0.php文件名称重新修改成admin_sitemap.php,最好把错误提示信息或者错误代码复制上来,我看后会做修正。在提交Google sitemap的时候,注意一下sitemap的名称是Google.xml 
 
 
我经过两天的测试。已经确定无bug,但因为某些服务器的配置或权限、上传过程中出现文件损坏等原因,不能确定所有人都能正常使用。 
 
 
注明:此文件已用Zend加密. 
 
 
回复26\27\28楼,附件已经更新,请重新下载. 
 
 
同时放出源码:- <?php
 
 - /*********************/
 
 - /*                   */
 
 - /*  Version : SupeSite 6.0/X-Space 4.0 Final GBK  */
 
 - /*  Author  : Calm_soul     */
 
 - /*  Comment : 2008-02-16 */
 
 - /*                   */
 
 - /*********************/
 
  
- function write( $text, $echo = 0 )
 
 - {
 
 -     global $fp;
 
 -     fwrite( $fp, $text."\r\n" );
 
 -     if ( !empty( $echo ) )
 
 -     {
 
 -         echo "{$text} <b>OK</b><br />";
 
 -     }
 
 - }
 
  
- if ( !defined( "IN_SUPESITE_ADMINCP" ) )
 
 - {
 
 -     exit( "Access Denied" );
 
 - }
 
 - $htmlurl = H_URL;
 
 - if ( !strexists( $htmlurl, "://" ) )
 
 - {
 
 -     $htmlurl = S_URL_ALL.substr( H_DIR, 1 );
 
 - }
 
 - $addclass = $viewclass = $slogidarr = "";
 
 - $listarr = array( );
 
 - $ndate=date("Y-m-d",time());
 
 - $sitemapdata = array(
 
 -     "index" => "",
 
 -     "file" => array( )
 
 - );
 
 - $baidu_style = "none";
 
 - $google_style = "";
 
 - $options = array( "always" => "always", "hourly" => "hourly", "daily" => "daily", "weekly" => "weekly", "monthly" => "monthly", "yearly" => "yearly", "never" => "never" );
 
 - $sitemap_path = S_ROOT."./";
 
 - if ( !file_exists( $sitemap_path ) )
 
 - {
 
 -     mkdir( $sitemap_path, "0666" );
 
 - }
 
 - $lastfileid = 0;
 
 - if ( submitcheck( "thevalue" ) )
 
 - {
 
 -     if ( !preg_match( "/^[0-9a-z_]+\$/i", $_POST['mapname'] ) || 50 < strlen( $_POST['mapname'] ) )
 
 -     {
 
 -         showmessage( "sitemap_name_error" );
 
 -     }
 
 -     $mapdata = addslashes( serialize( $sitemapdata ) );
 
 -     $GLOBALS['_POST']['maptype'] = saddslashes( shtmlspecialchars( $_POST['maptype'] ) );
 
 -     $GLOBALS['_POST']['mapnum'] = $_POST['maptype'] == "google" ? intval( $_POST['mapnum_google'] ) : intval( $_POST['mapnum_baidu'] );
 
 -     $GLOBALS['_POST']['createtype'] = intval( $_POST['createtype'] );
 
 -     $GLOBALS['_POST']['changefreq'] = $_POST['maptype'] == "google" ? saddslashes( shtmlspecialchars( $_POST['changefreq_google'] ) ) : saddslashes( shtmlspecialchars( $_POST['changefreq_baidu'] ) );
 
 -     if ( !empty( $_POST['slogid'] ) )
 
 -     {
 
 -         $_SGLOBAL['db']->query( "UPDATE ".tname( "sitemaplogs" )." SET mapname='{$_POST['mapname']}', maptype='{$_POST['maptype']}', mapnum='{$_POST['mapnum']}', createtype='{$_POST['createtype']}', changefreq='{$_POST['changefreq']}' WHERE slogid='{$_POST['slogid']}'" );
 
 -         showmessage( "sitemap_config_update", $theurl );
 
 -     }
 
 -     else
 
 -     {
 
 -         $query = $_SGLOBAL['db']->query( "SELECT count(*) FROM ".tname( "sitemaplogs" )." WHERE mapname='{$_POST['mapname']}'" );
 
 -         if ( $value = $_SGLOBAL['db']->result( $query, 0 ) )
 
 -         {
 
 -             showmessage( "sitemap_name_exists" );
 
 -         }
 
 -         $_SGLOBAL['db']->query( "INSERT INTO ".tname( "sitemaplogs" )."(mapname, maptype, mapnum, mapdata, createtype, changefreq) VALUES ('{$_POST['mapname']}', '{$_POST['maptype']}', '{$_POST['mapnum']}', '{$mapdata}', '{$_POST['createtype']}', '{$_POST['changefreq']}')" );
 
 -         showmessage( "sitemap_config_add", $theurl );
 
 -     }
 
 - }
 
 - else if ( submitcheck( "listsubmit" ) )
 
 - {
 
 -     if ( !empty( $_POST['slogidarr'] ) )
 
 -     {
 
 -         $slogidarr = implode( "','", $_POST['slogidarr'] );
 
 -         $_SGLOBAL['db']->query( "DELETE FROM ".tname( "sitemaplogs" )." WHERE slogid IN ('".$slogidarr."')" );
 
 -     }
 
 -     showmessage( "robotmessage_op_success", $theurl );
 
 - }
 
 - if ( empty( $_GET['op'] ) )
 
 - {
 
 -     $viewclass = " class="active"";
 
 -     $query = $_SGLOBAL['db']->query( "SELECT * FROM ".tname( "sitemaplogs" ) );
 
 -     while ( $value = $_SGLOBAL['db']->fetch_array( $query ) )
 
 -     {
 
 -         $value['dateline'] = sgmdate( $value['dateline'] );
 
 -         $listarr[] = $value;
 
 -     }
 
 - }
 
 - else if ( $_GET['op'] == "add" )
 
 - {
 
 -     $addclass = " class="active"";
 
 -     $thevalue = array( "slogid" => "", "maptype" => "google", "dateline" => "", "createtype" => "", "lastitemid" => "", "mapnum" => "" );
 
 - }
 
 - else if ( $_GET['op'] == "edit" )
 
 - {
 
 -     $GLOBALS['_GET']['slogid'] = intval( $_GET['slogid'] );
 
 -     $query = $_SGLOBAL['db']->query( "SELECT * FROM ".tname( "sitemaplogs" )." WHERE slogid='{$_GET['slogid']}'" );
 
 -     $thevalue = $_SGLOBAL['db']->fetch_array( $query );
 
 -     $thevalue['dateline'] = sgmdate( $thevalue['dateline'] );
 
 -     if ( $thevalue['maptype'] == "baidu" )
 
 -     {
 
 -         $baidu_style = "";
 
 -         $google_style = "none";
 
 -         $disabled = "disabled";
 
 -     }
 
 -     else
 
 -     {
 
 -         $baidu_style = "none";
 
 -         $google_style = "";
 
 -         $disabled = "";
 
 -     }
 
 - }
 
 - else if ( $_GET['op'] == "update" )
 
 - {
 
 -     ignore_user_abort( );
 
 -     set_time_limit( 0 );
 
 -     if ( is_dir( $sitemap_path ) && is_writable( $sitemap_path ) )
 
 -     {
 
 -         $GLOBALS['_GET']['slogid'] = intval( $_GET['slogid'] );
 
 -         $query = $_SGLOBAL['db']->query( "SELECT * FROM ".tname( "sitemaplogs" )." WHERE slogid='{$_GET['slogid']}'" );
 
 -         if ( $value = $_SGLOBAL['db']->fetch_array( $query ) )
 
 -         {
 
 -             $value['lastitemid'] = 0 < intval( $value['lastitemid'] ) ? intval( $value['lastitemid'] ) : 1;
 
 -             $sitemapdata = unserialize( $value['mapdata'] );
 
 -             $sitemapdata['index'] = $value['mapname'].".xml";
 
 -             $limit = $idvalue = $itemurl = "";
 
 -             $fp = @fopen( $sitemap_path.$sitemapdata['index'], "w" );
 
 -             if ( $value['maptype'] == "baidu" )
 
 -             {
 
 -                 $limit = "ORDER BY itemid DESC limit ".$value['mapnum'];
 
 -                 $submiturl = "http://news.baidu.com/newsop.html#ks5";
 
 -                 write( "<?xml version="1.0" encoding="".$_SCONFIG['charset'].""?>" );
 
 -                 write( "<document>" );
 
 -                 write( "<webSite>".S_URL_ALL."</webSite>" );
 
 -                 write( "<webMaster>".$adminemail."</webMaster>" );
 
 -                 write( "<updatePeri>".$value['changefreq']."</updatePeri>" );
 
 -             }
 
 -             else
 
 -             {
 
 -                 $submiturl = "https://www.google.com/webmasters/sitemaps/";
 
 -             }
 
 -             if ( $value['createtype'] == "0" )
 
 -             {
 
 -                 $value['lastitemid'] = 0;
 
 -                 $value['lastfileid'] = 0;
 
 -                 $sitemapdata['file'] = array( );
 
 -             }
 
 -             $i = $n = 0;
 
 -             $query = $_SGLOBAL['db']->query( "SELECT itemid, type, uid, dateline, subject FROM ".tname( "spaceitems" )." WHERE folder='1' AND itemid >= {$value['lastitemid']} ".$limit );
 
 -             while ( $itemvalue = $_SGLOBAL['db']->fetch_array( $query ) )
 
 -             {
 
 -                 ++$i;
 
 -                 $itemvalue['dateline'] = sgmdate( $itemvalue['dateline'], "Y-m-d" );
 
 -                 if ( $itemvalue['type'] == "news" )
 
 -                 {
 
 -                     $itemurl = geturl( "action/viewnews/itemid/{$itemvalue['itemid']}", 2 );
 
 -                     $idvalue = 9 < $itemvalue['itemid'] ? substr( $itemvalue['itemid'], 0 - 2, 2 ) : $itemvalue['itemid'];
 
 -                     $htmlpath = $idvalue."/n-".$itemvalue['itemid'].".html";
 
 -                     if ( file_exists( H_DIR."/".$htmlpath ) )
 
 -                     {
 
 -                         $itemurl = $htmlurl."/".$htmlpath;
 
 -                     }
 
 -                 }
 
 -                 else
 
 -                 {
 
 -                     $itemurl = geturl( "uid/{$itemvalue['uid']}/action/viewspace/itemid/{$itemvalue['itemid']}", 2 );
 
 -                     $idvalue = 9 < $itemvalue['uid'] ? substr( $value['uid'], 0 - 2, 2 ) : $itemvalue['uid'];
 
 -                     $htmlpath = $idvalue."/".$itemvalue['uid']."-".$itemvalue['itemid'].".html";
 
 -                     if ( file_exists( H_DIR."/".$htmlpath ) )
 
 -                     {
 
 -                         $itemurl = $htmlurl."/".$htmlpath;
 
 -                     }
 
 -                 }
 
 -                 if ( substr( $theurl, 0, 4 ) != "http" )
 
 -                 {
 
 -                     $itemurl = S_URL_ALL.$itemurl;
 
 -                 }
 
 -                 if ( $value['maptype'] == "google" )
 
 -                 {
 
 -                     $n = floor( $i / $value['mapnum'] ) + $value['lastfileid'];
 
 -                     $sitemapfile = S_URL_ALL."/".$value['mapname']."_".$n.".xml";
 
 -                     $urlarr[$n][] = $itemurl;
 
 -                     if ( !in_array( $sitemapfile, $sitemapdata['file'] ) )
 
 -                     {
 
 -                         $sitemapdata['file'][] = $sitemapfile;
 
 -                     }
 
 -                 }
 
 -                 else if ( $value['maptype'] == "baidu" )
 
 -                 {
 
 -                     write( "<item>" );
 
 -                     write( "<title>".$itemvalue['subject']."</title>" );
 
 -                     write( "<link>".$itemurl."</link>" );
 
 -                     write( "<text>".$itemvalue['subject']."</text>" );
 
 -                     write( "<image></image>" );
 
 -                     write( "<pubDate>".$itemvalue['dateline']."</pubDate>" );
 
 -                     write( "</item>" );
 
 -                 }
 
 -                 $value['lastitemid'] = $value['lastitemid'] < $itemvalue['itemid'] ? $itemvalue['itemid'] : $value['lastitemid'];
 
 -             }
 
 -             if ( $value['maptype'] == "baidu" )
 
 -             {
 
 -                 write( "</document>" );
 
 -                 fclose( $fp );
 
 -             }
 
 -             else
 
 -             {
 
 -                 if ( $fp = @fopen( $sitemap_path.$sitemapdata['index'], "w+" ) )
 
 -                 {
 
 -                     write( "<?xml version="1.0" encoding="UTF-8"?>" );
 
 -                     write( "<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">" );
 
 -                     if ( !empty( $sitemapdata['file'] ) )
 
 -                     {
 
 -                         rsort( $sitemapdata['file'] );
 
 -                         foreach ( $sitemapdata['file'] as $filevalue )
 
 -                         {
 
 -                             write( "<sitemap>" );
 
 -                             write( "<loc>".$filevalue."</loc>" );
 
 -                             write( "<lastmod>".$ndate."</lastmod>" );
 
 -                             write( "</sitemap>" );
 
 -                         }
 
 -                     }
 
 -                     write( "</sitemapindex>" );
 
 -                     fclose( $fp );
 
 -                 }
 
 -                 if ( !empty( $urlarr ) )
 
 -                 {
 
 -                     foreach ( $urlarr as $n => $itemurlarr )
 
 -                     {
 
 -                         $sitemapfile = $sitemap_path.$value['mapname']."_".$n.".xml";
 
 -                         if ( $fp = @fopen( $sitemapfile, "w+" ) )
 
 -                         {
 
 -                             write( "<?xml version="1.0" encoding="utf-8"?>" );
 
 -                             write( "<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">" );
 
 -                             foreach ( $itemurlarr as $url )
 
 -                             {
 
 -                                 write( "<url>" );
 
 -                                 write( "<loc>".$itemurl."</loc>" );
 
 -                                 write( "<changefreq>".$value['changefreq']."</changefreq>" );
 
 -                                 write( "</url>" );
 
 -                             }
 
 -                         }
 
 -                         write( "</urlset>" );
 
 -                         fclose( $fp );
 
 -                     }
 
 -                 }
 
 -             }
 
 -             $lastfileid = count( $sitemapdata['file'] );
 
 -             $mapdata = addslashes( serialize( $sitemapdata ) );
 
 -             $_SGLOBAL['db']->query( "UPDATE ".tname( "sitemaplogs" )." SET lastitemid='{$value['lastitemid']}', dateline='{$_SGLOBAL['timestamp']}', mapdata='{$mapdata}', lastfileid='{$lastfileid}' WHERE slogid='{$value['slogid']}'" );
 
 -             showmessage( S_URL_ALL."/".$sitemapdata['index']."<br />".$alang['sitemap_info']."<a href="".S_URL_ALL."/".$sitemapdata['index']."">Sitemap</a>, ".$alang['sitemap_info_0']."<a href="".$submiturl."">Sitemap</a>" );
 
 -         }
 
 -     }
 
 -     else
 
 -     {
 
 -         showmessage( "sitemap_perm_error" );
 
 -     }
 
 - }
 
 - print "\t<script>\n\tfunction changemaptype(obj) {\n\t\tif(obj.value == 'baidu') {\n\t\t\tdocument.getElementById('typehtml_baidu').style.display = '';\n\t\t\tdocument.getElementById('typehtml_google').style.display = 'none';\n\t\t\tdocument.getElementById('createtype_baidu').disabled = true;\n\t\t\tdocument.getElementById('createtype_google').disabled = true;\n\t\t} else {\n\t\t\tdocument.getElementById('typehtml_baidu').style.display = 'none';\n\t\t\tdocument.getElementById('typehtml_google').style.display = '';\n\t\t\tdocument.getElementById('createtype_baidu').disabled = false;\n\t\t\tdocument.getElementById('createtype_google').disabled = false;\n\t\t}\n\t}\n\t</script>\n\t<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">\n\t<tr>\n\t<td><h1>{$alang['sitemap_paper_maps']}</h1></td>\n\t<td class="actions">\n\t\t<table summary="" cellpadding="0" cellspacing="0" border="0" align="right">\n\t\t<tr>\n\t\t<td{$viewclass}><a href="{$theurl}" class="view">{$alang['sitemap_config_view']}</a></td>\n\t\t<td{$addclass}><a href="{$theurl}&op=add" class="add">{$alang['sitemap_config_add']}</a></td>\n\t\t</tr>\n\t\t</table>\n\t</td>\n\t</tr>\n\t</table>\n\t<table cellspacing="2" cellpadding="2" class="helptable"><tr><td>{$alang['sitemap_help']}</td></tr></table>";
 
 - if ( !empty( $listarr ) )
 
 - {
 
 -     print "\t\t<form method="post" action="{$theurl}" name="thevalueform" enctype="multipart/form-data" onSubmit="return listsubmitconfirm(this)">\n\t\t<table cellspacing="0" cellpadding="0" width="100%"  class="listtable">\n\t\t<tr>\n\t\t<th>{$alang['words_del']}</th>\n\t\t<th>{$alang['sitemap_name']}</th>\n\t\t<th>{$alang['sitemap_type']}</th>\n\t\t<th>{$alang['sitemap_num']}</th>\n\t\t<th>{$alang['sitemap_createtime']}</th>\n\t\t<th>{$alang['sitemap_createtype']}</th>\n\t\t<th>{$alang['sitemap_lastitemid']}</th>\n\t\t<th>{$alang['spacecache_op']}</th>\n\t\t</tr>";
 
 -     foreach ( $listarr as $value )
 
 -     {
 
 -         echo "<tr>";
 
 -         echo "<td><input type="checkbox"  class="checkbox" name="slogidarr[]" value="".$value['slogid'].""></td>";
 
 -         echo "<td>".$value['mapname']."</td>";
 
 -         echo "<td>".$value['maptype']."</td>";
 
 -         echo "<td>".$value['mapnum']."</td>";
 
 -         echo "<td>".$value['dateline']."</td>";
 
 -         echo "<td>".$alang["sitemap_createtype_".$value['createtype']]."</td>";
 
 -         echo "<td>".$value['lastitemid']."</td>";
 
 -         echo "<td align="center"><a href="".$theurl."&op=edit&slogid=".$value['slogid']."">".$alang['robot_robot_op_edit']."</a>|<a href="".$theurl."&op=update&slogid=".$value['slogid']."">".$alang['generation_sitemap_clicking_here']."</a></td></tr>";
 
 -     }
 
 -     echo "</table>";
 
 -     echo "<table cellspacing="0" cellpadding="0" width="100%"  class="btmtable">";
 
 -     echo "<tr><th><input type="checkbox" name="chkall" onclick="checkall(this.form, 'slogid')">".$alang['space_select_all']."</th></tr>";
 
 -     echo "</table>";
 
 -     echo "<div class="buttons">";
 
 -     echo "<input type="submit" name="listsubmit" value="".$alang['common_submit']."" class="submit"> ";
 
 -     echo "<input type="reset"  value="".$alang['common_reset']."">";
 
 -     echo "</div>";
 
 -     echo "</form>";
 
 - }
 
 - if ( !empty( $thevalue ) )
 
 - {
 
 -     echo "<form method="post" action="".$theurl."" name="thevalueform" enctype="multipart/form-data">";
 
 -     echo "<table cellspacing="0" cellpadding="0" width="100%"  class="maintable">";
 
 -     echo "<tr id="tr_subject"><th>".$alang['sitemap_name']."</th><td><input type="text" name="mapname" size="30" value="".$thevalue['mapname'].""></td></tr>";
 
 -     echo "<tr id="tr_subject"><th>".$alang['sitemap_type']."</th><td><input type="radio" name="maptype" size="30" value="baidu" ".( $thevalue['maptype'] == "baidu" ? "checked" : "" )." onclick="changemaptype(this)">Baidu <input type="radio" name="maptype" size="30" value="google" ".( $thevalue['maptype'] == "google" ? "checked" : "" )." onclick="changemaptype(this)">Google</td></tr>";
 
 -     echo "<tbody id="typehtml_baidu" style="display:".$baidu_style."">";
 
 -     echo "<tr id="tr_subject"><th>".$alang['sitemap_changefreq']."</th><td><input type="text" name="changefreq_baidu" value="".( is_numeric( $thevalue['changefreq'] ) ? $thevalue['changefreq'] : 15 )."" id="changefreq_baidu"></td></tr>";
 
 -     echo "<tr id="tr_subject"><th>".$alang['sitemap_num']."</th><td><input type="text" name="mapnum_baidu" size="30" value="".( empty( $thevalue['mapnum'] ) ? 100 : $thevalue['mapnum'] ).""></td>";
 
 -     echo "</tbody>";
 
 -     echo "<tbody id="typehtml_google" style="display:".$google_style."">";
 
 -     echo label( array(
 
 -         "type" => "select",
 
 -         "name" => "changefreq_google",
 
 -         "options" => $options,
 
 -         "value" => $thevalue['changefreq'],
 
 -         "alang" => $alang['sitemap_changefreq']
 
 -     ) );
 
 -     echo "<tr id="tr_subject"><th>".$alang['sitemap_num']."</th><td><input type="text" name="mapnum_google" size="30" value="".( empty( $thevalue['mapnum'] ) ? 5000 : $thevalue['mapnum'] ).""></td>";
 
 -     echo "</tbody>";
 
 -     echo "<tr id="tr_subject"><th>".$alang['sitemap_createtype']."</th><td><input id="createtype_baidu" type="radio" name="createtype" size="30" value="0" ".( $thevalue['createtype'] == 0 ? "checked" : "" )." ".$disabled.">".$alang['sitemap_createtype_0']." <input id="createtype_google" type="radio" name="createtype" size="30" value="1" ".( $thevalue['createtype'] == 1 ? "checked" : "" )." ".$disabled.">".$alang['sitemap_createtype_1']."</td></tr>";
 
 -     echo "</table>";
 
 -     echo "<div class="buttons">";
 
 -     if ( $_GET['op'] == "edit" )
 
 -     {
 
 -         echo "<input type="hidden" name="slogid" value="".$thevalue['slogid']."">";
 
 -     }
 
 -     echo "<input type="submit" name="thevalue" value="".$alang['common_submit']."" class="submit"> ";
 
 -     echo "<input type="reset"  value="".$alang['common_reset']."">";
 
 -     echo "</div>";
 
 -     echo "</form>";
 
 - }
 
 - ?>
 
 
  复制代码 
[ 本帖最后由 Calm_soul 于 2008-3-6 17:08 编辑 ] |   
 
评分
- 
2
查看全部评分 
 
- 
 
 
 
 
 |