Removed sitemap ping because is deprecated (#1738)

* Removed sitemap ping because is deprecated

* Update CHANGELOG.md

* Update Sitemap.php

* Update main.php

* Update config.php

* Update sitemap.php

* Updated

* Update admin_sitemap.tpl

* Update admin_sitemap.tpl

* Update admin_sitemap.tpl
This commit is contained in:
Roman Kelesidis 2025-01-08 14:16:39 +07:00 committed by GitHub
commit 4cc6fa0e6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 99 additions and 179 deletions

View file

@ -10,6 +10,7 @@
- Added `TorrentPier instance hash` generation [\#1726](https://github.com/torrentpier/torrentpier/pull/1726) ([belomaxorka](https://github.com/belomaxorka))
- Added `m4a` extension support in M3U playback [\#1724](https://github.com/torrentpier/torrentpier/pull/1724) ([belomaxorka](https://github.com/belomaxorka))
- Created `VersionHelper.php` [\#1731](https://github.com/torrentpier/torrentpier/pull/1731) ([belomaxorka](https://github.com/belomaxorka))
- Removed sitemap ping because is deprecated [\#1738](https://github.com/torrentpier/torrentpier/pull/1738) ([belomaxorka](https://github.com/belomaxorka))
- Drop Ocelot announcer support 🫡 [\#1727](https://github.com/torrentpier/torrentpier/pull/1727) ([belomaxorka](https://github.com/belomaxorka))
- Use `DEFAULT_CHARSET` constant instead of hardcoded string [\#1734](https://github.com/torrentpier/torrentpier/pull/1734) ([belomaxorka](https://github.com/belomaxorka))
- Replaced some string functions to `mbstring` alternatives [\#1735](https://github.com/torrentpier/torrentpier/pull/1735) ([belomaxorka](https://github.com/belomaxorka))

View file

@ -30,22 +30,6 @@ switch ($mode) {
}
break;
case 'search_update':
if (!is_file(SITEMAP_DIR . '/sitemap.xml')) {
$map->createSitemap();
}
$map_link = make_url(hide_bb_path(SITEMAP_DIR . '/sitemap.xml'));
foreach ($bb_cfg['sitemap_sending'] as $source_name => $source_link) {
if ($map->sendSitemap($source_link, $map_link)) {
$html .= '<br />' . $lang['SITEMAP_NOTIFY_SEARCH'] . '&nbsp;' . $source_name . ' : <span style="color: green;">' . $lang['SITEMAP_SENT'] . '</span>';
} else {
$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>';
}
}
break;
default:
$this->ajax_die("Invalid mode: $mode");
}

View file

@ -602,12 +602,6 @@ $bb_cfg['user_agreement_url'] = 'info.php?show=user_agreement';
$bb_cfg['copyright_holders_url'] = 'info.php?show=copyright_holders';
$bb_cfg['advert_url'] = 'info.php?show=advert';
$bb_cfg['sitemap_sending'] = [
// A list of URLs to which to send a sitemap for indexing by a search robot.
// Syntax: 'Resource name' => 'link to endpoint'
// Sitemap sending is deprecated. See: https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping
];
// Extensions
$bb_cfg['file_id_ext'] = [
1 => 'gif',

View file

@ -13,11 +13,3 @@ if (!defined('BB_ROOT')) {
$map = new TorrentPier\Sitemap();
$map->createSitemap();
if (is_file(SITEMAP_DIR . '/sitemap.xml')) {
$map_link = make_url(hide_bb_path(SITEMAP_DIR . '/sitemap.xml'));
foreach ($bb_cfg['sitemap_sending'] as $source_name => $source_link) {
$map->sendSitemap($source_link, $map_link);
}
}

View file

@ -2997,12 +2997,8 @@ $lang['SITEMAP_ADMIN'] = 'Manage sitemap';
$lang['SITEMAP_CREATED'] = 'Sitemap created';
$lang['SITEMAP_AVAILABLE'] = 'and is available at';
$lang['SITEMAP_NOT_CREATED'] = 'Sitemap is not yet created';
$lang['SITEMAP_NOTIFY_SEARCH'] = 'Notification of the search engine';
$lang['SITEMAP_SENT'] = 'send completed';
$lang['SITEMAP_ERROR'] = 'sending error';
$lang['SITEMAP_OPTIONS'] = 'Options';
$lang['SITEMAP_CREATE'] = 'Create / update the sitemap';
$lang['SITEMAP_NOTIFY'] = 'Notify search engines about new version of sitemap';
$lang['SITEMAP_WHAT_NEXT'] = 'What to do next?';
$lang['SITEMAP_GOOGLE_1'] = 'Register your site at <a href="https://www.google.com/webmasters/" target="_blank">Google Webmaster</a> using your Google account.';
$lang['SITEMAP_GOOGLE_2'] = '<a href="https://www.google.com/webmasters/tools/sitemap-list" target="_blank">Add sitemap</a> of site you registered.';

View file

@ -178,35 +178,4 @@ class Sitemap
return true;
}
/**
* Отправка карты сайта на указанный URL
*
* @param $url
* @param $map
*
* @return string
*/
public function sendSitemap($url, $map): string
{
$file = $url . urlencode($map);
if (\function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $file);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 6);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
return file_get_contents($file);
}
}

View file

@ -1,124 +1,108 @@
<style>
.btn{
color: rgb(255, 255, 255);
text-decoration: none;
padding: 2px 7px;
font-size: 12px;
border-radius: 3px;
}
.btn-success {
background-image: -moz-linear-gradient(top, #62c462, #51a351);
background-image: -ms-linear-gradient(top, #62c462, #51a351);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));
background-image: -webkit-linear-gradient(top, #62c462, #51a351);
background-image: -o-linear-gradient(top, #62c462, #51a351);
background-image: linear-gradient(top, #62c462, #51a351);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#51a351', GradientType=0);
border-color: #51a351 #51a351 #387038;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
}
.btn-success:active,
.btn-success:disabled,
.btn-success:focus,
.btn-success:hover,
.btn-warning:active,
.btn-warning:disabled,
.btn-warning:focus,
.btn-warning:hover {
text-decoration: none;
color: rgb(255, 255, 255);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.btn-warning:active,
.btn-warning:disabled,
.btn-warning:focus,
.btn-warning:hover {
background-color: #f89406;
}
.btn-success:active,
.btn-success:disabled,
.btn-success:focus,
.btn-success:hover {
background-color: #51a351;
}
.btn-warning {
background-color: #faa732;
background-image: -moz-linear-gradient(top, #fbb450, #f89406);
background-image: -ms-linear-gradient(top, #fbb450, #f89406);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));
background-image: -webkit-linear-gradient(top, #fbb450, #f89406);
background-image: -o-linear-gradient(top, #fbb450, #f89406);
background-image: linear-gradient(top, #fbb450, #f89406);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0);
border-color: #f89406 #f89406 #ad6704;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
}
.td_pads { padding: 10px 15px !important; }
.btn {
color: rgb(255, 255, 255);
text-decoration: none;
padding: 2px 7px;
font-size: 12px;
border-radius: 3px;
}
.btn-success {
background-image: -moz-linear-gradient(top, #62c462, #51a351);
background-image: -ms-linear-gradient(top, #62c462, #51a351);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));
background-image: -webkit-linear-gradient(top, #62c462, #51a351);
background-image: -o-linear-gradient(top, #62c462, #51a351);
background-image: linear-gradient(top, #62c462, #51a351);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#51a351', GradientType=0);
border-color: #51a351 #51a351 #387038;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
}
.btn-success:active,
.btn-success:disabled,
.btn-success:focus,
.btn-success:hover {
text-decoration: none;
color: rgb(255, 255, 255);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.btn-success:active,
.btn-success:disabled,
.btn-success:focus,
.btn-success:hover {
background-color: #51a351;
}
.td_pads {
padding: 10px 15px !important;
}
</style>
<script type="text/javascript">
ajax.sitemap = function(mode) {
ajax.exec({
action : 'sitemap',
mode : mode
});
}
ajax.callback.sitemap = function(data) {
if(data.mode == 'create') $('#mess_time').html(data.html);
else $('#sitemap').html(data.html);
}
ajax.sitemap = function (mode) {
ajax.exec({
action: 'sitemap',
mode: mode
});
}
ajax.callback.sitemap = function (data) {
if (data.mode == 'create') {
$('#mess_time').html(data.html);
}
}
</script>
<h1>{L_SITEMAP_ADMIN}</h1>
<form action="admin_sitemap.php" method="post">
<table class="forumline">
<tr class="row1">
<td width="25%"><span class="gen"><b>{L_INFORMATION}:</b></span></td>
<td class="td_pads"><div id="mess_time">{MESSAGE}</div></td>
</tr>
<tr class="row1">
<td width="25%"><span class="gen"><b>{L_SITEMAP_OPTIONS}:</b></span></td>
<td class="td_pads">
<a href="#" class="btn btn-success" onclick="ajax.sitemap('create'); return false;">{L_SITEMAP_CREATE}</a>&nbsp;&nbsp;
<a href="#" class="btn btn-warning" onclick="ajax.sitemap('search_update'); return false;">{L_SITEMAP_NOTIFY}</a><br />
<div id="sitemap"></div>
</td>
</tr>
<tr>
<th colspan="2">{L_SITEMAP_WHAT_NEXT}</th>
</tr>
<tr>
<td class="row1" colspan="2">
<p>1. {L_SITEMAP_GOOGLE_1}</p>
<p>2. {L_SITEMAP_GOOGLE_2}</p>
<p>3. {L_SITEMAP_YANDEX_1}</p>
<p>4. {L_SITEMAP_YANDEX_2}</p>
<p>5. {L_SITEMAP_BING_1}</p>
<p>6. {L_SITEMAP_BING_2}</p>
</td>
</tr>
<tr>
<th colspan="2">{L_SITEMAP_ADD_TITLE}</th>
</tr>
<tr class="row1">
<td class="row1">
<span class="gen"><b>{L_SITEMAP_ADD_PAGE}:</b></span>
</td>
<td>
<textarea name="static_sitemap" rows="5" cols="70">{STATIC_SITEMAP}</textarea><br />
<br/><p>{L_SITEMAP_ADD_EXP_1} <br/><br/><b style="color: #993300;">{L_SITEMAP_ADD_EXP_2}</b></p>
</td>
</tr>
<tr>
<td class="catBottom" colspan="2">
<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" />&nbsp;&nbsp;
<input type="reset" value="{L_RESET}" class="liteoption" />
</td>
</tr>
</table>
<table class="forumline">
<tr class="row1">
<td width="25%"><span class="gen"><b>{L_INFORMATION}:</b></span></td>
<td class="td_pads">
<div id="mess_time">{MESSAGE}</div>
</td>
</tr>
<tr class="row1">
<td width="25%"><span class="gen"><b>{L_SITEMAP_OPTIONS}:</b></span></td>
<td class="td_pads">
<a href="#" class="btn btn-success" onclick="ajax.sitemap('create'); return false;">{L_SITEMAP_CREATE}</a>
</td>
</tr>
<tr>
<th colspan="2">{L_SITEMAP_WHAT_NEXT}</th>
</tr>
<tr>
<td class="row1" colspan="2">
<p>1. {L_SITEMAP_GOOGLE_1}</p>
<p>2. {L_SITEMAP_GOOGLE_2}</p>
<p>3. {L_SITEMAP_YANDEX_1}</p>
<p>4. {L_SITEMAP_YANDEX_2}</p>
<p>5. {L_SITEMAP_BING_1}</p>
<p>6. {L_SITEMAP_BING_2}</p>
</td>
</tr>
<tr>
<th colspan="2">{L_SITEMAP_ADD_TITLE}</th>
</tr>
<tr class="row1">
<td class="row1">
<span class="gen"><b>{L_SITEMAP_ADD_PAGE}:</b></span>
</td>
<td>
<textarea name="static_sitemap" rows="5" cols="70">{STATIC_SITEMAP}</textarea><br/>
<br/>
<p>{L_SITEMAP_ADD_EXP_1} <br/><br/><b style="color: #993300;">{L_SITEMAP_ADD_EXP_2}</b></p>
</td>
</tr>
<tr>
<td class="catBottom" colspan="2">
<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption"/>&nbsp;&nbsp;
<input type="reset" value="{L_RESET}" class="liteoption"/>
</td>
</tr>
</table>
</form>