torrentpier/admin/admin_sitemap.php
Roman Kelesidis 3626143879
Replaced some file exists to is file (#1276)
* Replaced some file_exists to is_file

* Update functions_thumbs.php

* Updated

* Update CronHelper.php

* Updated

* Update IPHelper.php

* Updated

* Update update_forums_atom.php

* Update functions.php

* Update Validate.php
2023-12-27 20:08:00 +07:00

51 lines
1.7 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* TorrentPier Bull-powered BitTorrent tracker engine
*
* @copyright Copyright (c) 2005-2024 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
if (!empty($setmodules)) {
$module['MODS']['SITEMAP'] = basename(__FILE__);
return;
}
require __DIR__ . '/pagestart.php';
$sql = 'SELECT * FROM ' . BB_CONFIG;
if (!$result = DB()->sql_query($sql)) {
bb_die('Could not query config information in admin_sitemap');
} else {
$new_params = [];
while ($row = DB()->sql_fetchrow($result)) {
$config_name = $row['config_name'];
$config_value = $row['config_value'];
$default_config[$config_name] = $config_value;
$new[$config_name] = $_POST[$config_name] ?? $default_config[$config_name];
if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name]) {
$new_params[$config_name] = $new[$config_name];
}
}
if (isset($_POST['submit'])) {
if (!empty($new_params)) {
bb_update_config($new_params);
}
}
}
$s_mess = $lang['SITEMAP_CREATED'] . ': <b>' . bb_date($new['sitemap_time'], $bb_cfg['post_date_format']) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap/sitemap.xml') . '" target="_blank">' . make_url('sitemap/sitemap.xml') . '</a>';
$message = is_file(SITEMAP_DIR . '/sitemap.xml') ? $s_mess : $lang['SITEMAP_NOT_CREATED'];
$template->assign_vars([
'STATIC_SITEMAP' => $new['static_sitemap'],
'MESSAGE' => $message
]);
print_page('admin_sitemap.tpl', 'admin');