예제 #1
0
        echo $data['svalue'];
    }
} elseif ($dopost == 'sitemap_index') {
    header("Content-Type: text/xml; charset=utf-8");
    if (empty($_GET['pwd']) || $_GET['pwd'] != ($bdpwd = baidu_get_setting('bdpwd'))) {
        baidu_header_status(404);
        return 1;
    }
    $pagesize = empty($pagesize) ? 0 : intval($pagesize);
    $sitemap_type = 0;
    if ($type == 'indexall') {
        $sitemap_type = 1;
    } elseif ($type == 'indexinc') {
        $sitemap_type = 2;
    }
    $bdarcs = new BaiduArticleXml();
    $start = $pagesize * $bdarcs->Row;
    $bdarcs->setSitemapType($sitemap_type);
    $bdarcs->Start = $start;
    echo $bdarcs->toXml();
} elseif ($dopost == 'sitemap_urls') {
    header("Content-Type: text/xml; charset=utf-8");
    if (empty($_GET['pwd']) || $_GET['pwd'] != ($bdpwd = baidu_get_setting('bdpwd'))) {
        baidu_header_status(404);
        return 1;
    }
    $type = empty($_GET['type']) ? 1 : intval($_GET['type']);
    $query = "SELECT distinct(url),create_time from `#@__plus_baidusitemap_list` WHERE `type`={$type} group by url";
    $dsql->SetQuery($query);
    $dsql->Execute('dd');
    $xmlstr = '<?xml version="1.0" encoding="UTF-8"?>
function baidu_savesitemap($action, $site, $type, $bdpwd, $sign)
{
    global $dsql, $cfg_plus_dir, $cfg_basehost;
    //$siteurl = $cfg_basehost;
    $siteurl = $site;
    $zzaction = '';
    $bdpwd = addslashes($bdpwd);
    if (0 == strncasecmp('save', $action, 3)) {
        $zzaction = 'savesitemap';
    } else {
        return false;
    }
    $script = '';
    $stype = '';
    $pagesize = 0;
    if (1 == $type) {
        $script = 'indexall';
        $stype = 'all';
    } else {
        if (2 == $type) {
            $script = 'indexinc';
            $stype = 'inc';
        } else {
            return false;
        }
    }
    $resource_name = 'RDF_Other_Webpage';
    $bdarcs = new BaiduArticleXml();
    $bdarcs->setSitemapType($type);
    $arctotal = $bdarcs->getTotal();
    if ($arctotal == 0) {
        return false;
    }
    $pagesize = ceil($arctotal / $bdarcs->Row);
    if ($pagesize > 0) {
        for ($i = 0; $i < $pagesize; $i++) {
            $cfg_plus_dir = str_replace("/", '', $cfg_plus_dir);
            $indexurl = $siteurl . "{$cfg_plus_dir}/baidusitemap.php?dopost=sitemap_index&type={$script}&pwd={$bdpwd}&pagesize={$i}";
            $time = time();
            $inQuery = "INSERT INTO `#@__plus_baidusitemap_list` (`url`, `type`, `create_time`, `pagesize`) VALUES ('{$indexurl}', {$type}, {$time}, {$i});";
            $rs = $dsql->ExecuteNoneQuery($inQuery);
            $submiturl = "http://zz.baidu.com/api/opensitemap/{$zzaction}?siteurl=" . urlencode($siteurl) . "&indexurl=" . urlencode($indexurl) . "&tokensign=" . urlencode($sign) . "&type=" . $stype . "&resource_name=" . $resource_name;
            $ret = baidu_http_send($submiturl);
        }
    }
    $bdarcs->setSetupMaxAid();
    return array('json' => $ret, 'url' => $submiturl);
}
예제 #3
0
    $lastuptime_inc = date('Y-m-d', baidu_get_setting('lastuptime_inc'));
    $site_id = baidu_get_setting('site_id');
    if (empty($site_id)) {
        header('location:?dopost=bind');
        exit;
    }
    $site_id_msg = $submitall_msg = '';
    if (empty($site_id)) {
        $site_id_msg = '<font color="red">尚未绑定站点ID,请点击</font><a href="?dopost=bind_site_id" style="color:blue">[绑定站点ID]</a><font color="red">完成绑定</font>';
    }
    if (!empty($site_id) and empty($lastuptime_all)) {
        //header('location:?dopost=auth&action=resubmit');
        //exit;
        $submitall_msg = '<font color="red">尚未提交全量索引,点击</font><a href="?dopost=auth&action=resubmit" style="color:blue">[提交全量索引]</a><font color="red">进行提交,提交5个小时后才有搜索结果</font>';
    }
    $bdarcs = new BaiduArticleXml();
    $bdarcs->setSitemapType(1);
    $maxaid = $bdarcs->getMaxAid();
    $ver = PLUS_BAIDUSITEMAP_VER;
    $siteurl2 = urlencode($siteurl);
    $msg = <<<EOT
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#DADADA">
\t<tbody>
\t\t<tr bgcolor="#FFFFFF">
\t\t\t<td colspan="2" height="100">
\t\t\t\t<table width="98%" border="0" cellspacing="1" cellpadding="1">
\t\t\t\t\t<tbody>
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td width="16%" height="30">模块版本:</td>
\t\t\t\t\t\t\t<td width="84%" style="text-align:left;"><span style='color:black'><iframe name='stafrm' src='http://baidu.api.dedecms.com/index.php?c=welcome&m=new_ver&ver={$ver}&siteurl={$siteurl2}&setupmaxaid={$setupmaxaid}' frameborder='0' id='stafrm' width='98%' height='22'></iframe></span>
\t\t\t\t\t\t\t</td>
예제 #4
0
function baidu_savesitemap($action, $site, $type, $bdpwd, $sign)
{
    global $dsql, $cfg_plus_dir, $cfg_basehost;
    $siteurl = baidu_get_setting('siteurl');
    $token = baidu_get_setting('pingtoken');
    $sign = md5($siteurl . $token);
    $zzaction = '';
    $bdpwd = addslashes($bdpwd);
    if (0 == strncasecmp('save', $action, 3)) {
        $zzaction = 'savesitemap';
    } else {
        return false;
    }
    $script = '';
    $stype = '';
    $pagesize = 0;
    if (1 == $type) {
        $script = 'indexall';
        $stype = 'all';
    } else {
        if (2 == $type) {
            $script = 'indexinc';
            $stype = 'inc';
        } else {
            return false;
        }
    }
    $resource_name = 'CustomSearch_Normal';
    $bdarcs = new BaiduArticleXml();
    $bdarcs->setSitemapType($type);
    $arctotal = $bdarcs->getTotal();
    if ($arctotal == 0) {
        return false;
    }
    $pagesize = ceil($arctotal / $bdarcs->Row);
    if ($pagesize > 0) {
        for ($i = 0; $i < $pagesize; $i++) {
            //$cfg_plus_dir = str_replace("/", '', $cfg_plus_dir );
            $indexurl = $siteurl . "{$cfg_plus_dir}/baidusitemap.php?dopost=sitemap_index&type={$script}&pwd={$bdpwd}&pagesize={$i}";
            $time = time();
            $inQuery = "INSERT INTO `#@__plus_baidusitemap_list` (`url`, `type`, `create_time`, `pagesize`) VALUES ('{$indexurl}', {$type}, {$time}, {$i});";
            $rs = $dsql->ExecuteNoneQuery($inQuery);
        }
    }
    if (1 == $type) {
        $bdarcs->setSetupMaxAid();
    }
    return array('json' => $ret, 'url' => $submiturl);
}