Fixed broken sitemap sending (#112)

This commit is contained in:
Roman Kelesidis 2023-04-01 14:55:42 +07:00 committed by GitHub
parent bf9431a697
commit 3a946abdc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 30 deletions

View File

@ -23,30 +23,18 @@ switch ($mode)
case 'search_update': case 'search_update':
if (!@file_exists(SITEMAP_DIR. 'sitemap.xml')) $map->create(); if (!@file_exists(SITEMAP_DIR. 'sitemap.xml')) $map->create();
$map_link = make_url(SITEMAP_DIR. 'sitemap.xml'); $map_link = make_url(hide_bb_path(SITEMAP_DIR. 'sitemap.xml'));
if (strpos($map->send_url("http://google.com/webmasters/sitemaps/ping?sitemap=", $map_link), "successfully added") !== false) { foreach ($bb_cfg['sitemap_sending'] as $source_name => $source_link)
$html .= '<br />'.$lang['SITEMAP_NOTIFY_SEARCH'].' Google: <font style="color: green;">'.$lang['SITEMAP_SENT'].'</font>'; {
} else { if ($map->send_url($source_link, $map_link))
$html .= '<br />'.$lang['SITEMAP_NOTIFY_SEARCH'].' Google: <font style="color: red;">'.$lang['SITEMAP_ERROR'].'</font> URL: <a href="http://google.com/webmasters/sitemaps/ping?sitemap='.urlencode($map_link).'" target="_blank">http://google.com/webmasters/sitemaps/ping?sitemap='.$map_link.'</a>'; {
$html .= '<br />' . $lang['SITEMAP_NOTIFY_SEARCH'] . '&nbsp;' . $source_name . ' : <span style="color: green;">' . $lang['SITEMAP_SENT'] . '</span>';
} }
else
if (strpos($map->send_url("http://ping.blogs.yandex.ru/ping?sitemap=", $map_link), "OK") !== false) { {
$html .= '<br />'.$lang['SITEMAP_NOTIFY_SEARCH'].' Yandex: <font style="color: green;">'.$lang['SITEMAP_SENT'].'</font>'; $html .= '<br />' . $lang['SITEMAP_NOTIFY_SEARCH'] . '&nbsp;' . $source_name . ' : <span style="color: red;">' . $lang['SITEMAP_ERROR'] . '</span> URL: <a href="' . $source_link . urlencode($map_link) . '" target="_blank">' . $source_link . $map_link . '</a>';
} else {
$html .= '<br />'.$lang['SITEMAP_NOTIFY_SEARCH'].' Yandex: <font style="color: red;">'.$lang['SITEMAP_ERROR'].'</font> URL: <a href="http://ping.blogs.yandex.ru/ping?sitemap='.urlencode($map_link).'" target="_blank">http://ping.blogs.yandex.ru/ping?sitemap='.$map_link.'</a>';
} }
if ($map->send_url("http://www.bing.com/ping?sitemap=", $map_link)) {
$html .= '<br />'.$lang['SITEMAP_NOTIFY_SEARCH'].' Bing: <font style="color: green;">'.$lang['SITEMAP_SENT'].'</font>';
} else {
$html .= '<br />'.$lang['SITEMAP_NOTIFY_SEARCH'].' Bing: <font style="color: red;">'.$lang['SITEMAP_ERROR'].'</font> URL: <a href="http://www.bing.com/ping?sitemap='.urlencode($map_link).'" target="_blank">http://www.bing.com/ping?sitemap='.$map_link.'</a>';
}
if (strpos($map->send_url("http://rpc.weblogs.com/pingSiteForm?name=InfraBlog&url=", $map_link), "Thanks for the ping") !== false) {
$html .= '<br />'.$lang['SITEMAP_NOTIFY_SEARCH'].' Weblogs: <font style="color: green;">'.$lang['SITEMAP_SENT'].'</font>';
} else {
$html .= '<br />'.$lang['SITEMAP_NOTIFY_SEARCH'].' Weblogs: <font style="color: red;">'.$lang['SITEMAP_ERROR'].'</font> URL: <a href="http://rpc.weblogs.com/pingSiteForm?name=InfraBlog&url='.urlencode($map_link).'" target="_blank">http://rpc.weblogs.com/pingSiteForm?name=InfraBlog&url='.$map_link.'</a>';
} }
break; break;

View File

@ -555,6 +555,11 @@ $bb_cfg['user_agreement_url'] = 'info.php?show=user_agreement';
$bb_cfg['copyright_holders_url'] = 'info.php?show=copyright_holders'; $bb_cfg['copyright_holders_url'] = 'info.php?show=copyright_holders';
$bb_cfg['advert_url'] = 'info.php?show=advert'; $bb_cfg['advert_url'] = 'info.php?show=advert';
$bb_cfg['sitemap_sending'] = array(
# 'Source name' => 'http://ping_url'
'Google' => 'http://google.com/webmasters/sitemaps/ping?sitemap=',
);
// Extensions // Extensions
$bb_cfg['file_id_ext'] = array( $bb_cfg['file_id_ext'] = array(
1 => 'gif', 1 => 'gif',

View File

@ -7,12 +7,12 @@ require(CLASS_DIR .'sitemap.php');
$map = new sitemap(); $map = new sitemap();
$map->create(); $map->create();
if (@file_exists(BB_ROOT. "/sitemap/sitemap.xml")) if (@file_exists(SITEMAP_DIR. 'sitemap.xml'))
{ {
$map_link = make_url('/sitemap/sitemap.xml'); $map_link = make_url(hide_bb_path(SITEMAP_DIR. 'sitemap.xml'));
$map->send_url("http://google.com/webmasters/sitemaps/ping?sitemap=", $map_link); foreach ($bb_cfg['sitemap_sending'] as $source_name => $source_link)
$map->send_url("http://ping.blogs.yandex.ru/ping?sitemap=", $map_link); {
$map->send_url("http://www.bing.com/ping?sitemap=", $map_link); $map->send_url($source_link, $map_link);
$map->send_url("http://rpc.weblogs.com/pingSiteForm?name=InfraBlog&url=", $map_link); }
} }