mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
Updated
This commit is contained in:
parent
8602a8705a
commit
fc28d620b0
3 changed files with 41 additions and 1 deletions
|
@ -2236,3 +2236,40 @@ function infoByIP(string $ipAddress, int $port = 0): array
|
|||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates canonical url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getCanonicalUrl(): string
|
||||
{
|
||||
$fullUrl = rtrim(FULL_URL, '/');
|
||||
$script = $_SERVER['SCRIPT_NAME'];
|
||||
|
||||
$allowedParams = [
|
||||
POST_CAT_URL,
|
||||
POST_FORUM_URL,
|
||||
POST_GROUPS_URL,
|
||||
POST_POST_URL,
|
||||
POST_TOPIC_URL,
|
||||
POST_USERS_URL,
|
||||
];
|
||||
|
||||
$params = [];
|
||||
foreach ($allowedParams as $key) {
|
||||
if (isset($_GET[$key])) {
|
||||
$params[$key] = $_GET[$key];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($params)) {
|
||||
ksort($params);
|
||||
$queryString = http_build_query($params, '', '&', PHP_QUERY_RFC3986);
|
||||
$url = $fullUrl . $script . "?$queryString";
|
||||
} else {
|
||||
$url = $fullUrl . $script;
|
||||
}
|
||||
|
||||
return htmlCHR($url);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ $template->assign_vars([
|
|||
|
||||
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
|
||||
'ALLOW_ROBOTS' => !$bb_cfg['board_disable'] && (!isset($page_cfg['allow_robots']) || $page_cfg['allow_robots'] === true),
|
||||
'META_CANONICAL' => $page_cfg['canonical_link'] ?? '',
|
||||
'META_CANONICAL' => $page_cfg['canonical_link'] ?? getCanonicalUrl(),
|
||||
'META_DESCRIPTION' => $page_cfg['meta_description'] ?? '',
|
||||
|
||||
'SITENAME' => $bb_cfg['sitename'],
|
||||
|
|
|
@ -15,6 +15,9 @@ require __DIR__ . '/common.php';
|
|||
// Start session management
|
||||
$user->session_start();
|
||||
|
||||
// Disable canonical for this page
|
||||
$page_cfg['canonical_link'] = false;
|
||||
|
||||
set_die_append_msg();
|
||||
$mode = request_var('mode', 'viewprofile');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue