Beispiel #1
0
if ('indexinc' === $_GET['m']) {
    $today = strtotime(date('Y-m-d'));
    $removeTime = $today - $config['HistoryDayCount'] * 24 * 3600;
    //几天前时间
    BaidusubmitSitemap::deleteIncreaseHistory($removeTime);
    //删除过期数据
    $lastTime = BaidusubmitSitemap::getSitemapMaxEnd(BaidusubmitSitemap::TYPE_INC);
    //sitemap表中最后时间
    if (empty($lastTime)) {
        $lastTime = $today;
    }
    if ($today >= $lastTime) {
        $url = 'm=sitemapinc&start=' . $today;
        BaidusubmitSitemap::addSitemap($url, BaidusubmitSitemap::TYPE_INC, $today, $today + 86399);
    }
    BaidusubmitSitemap::printIndexHeader();
    $sitemaps = BaidusubmitSitemap::getSitemapList(BaidusubmitSitemap::TYPE_INC);
    if (count($sitemaps) > 0) {
        //返回增量sitemap的索引文件
        $site = BaidusubmitOptions::getOption('siteurl');
        BaidusubmitSitemap::printSitemapList($sitemaps, $site, $urlsuffix);
    }
    BaidusubmitSitemap::printIndexFooter();
}
//全量sitemap
if ('sitemapall' === $_GET['m']) {
    $start_tid = intval($_GET['start']);
    $sitemap = BaidusubmitSitemap::getSitemap(BaidusubmitSitemap::TYPE_ALL, $start_tid);
    if (empty($sitemap)) {
        BaidusubmitSitemap::headerStatus(404);
        return 1;