Little fixes (#1272)

This commit is contained in:
Cønstantine Kovalensky 2023-12-26 21:54:09 +04:00 committed by GitHub
commit cf8fd449f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View file

@ -168,7 +168,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
if (!empty($_POST['username'])) {
$this_userdata = get_userdata($_POST['username'], true);
$user_id = $this_userdata['user_id'];
$user_id = $this_userdata ? $this_userdata['user_id'] : false;
} else {
$this_userdata = get_userdata($user_id);
}

5
dl.php
View file

@ -41,6 +41,9 @@ function send_file_to_browser($attachment, $upload_dir)
if (!str_contains($attachment['mimetype'], 'image')) {
$attachment['mimetype'] = 'application/octet-stream';
}
else {
header('Cache-Control: public, max-age=3600');
}
//bt
if (!(isset($_GET['original']) && !IS_USER)) {
@ -150,7 +153,7 @@ if (!$authorised) {
$datastore->rm('cat_forums');
// Check tor status
if (!IS_AM) {
if (!IS_AM && str_contains($attachment['mimetype'], 'bittorrent')) {
$sql = 'SELECT tor_status, poster_id FROM ' . BB_BT_TORRENTS . ' WHERE attach_id = ' . (int)$attachment['attach_id'];
if (!($result = DB()->sql_query($sql))) {

View file

@ -93,6 +93,8 @@ echo <<<EOF
<meta name="viewport" content="width=device-width, initial-scale=0.1, maximum-scale=1.0" />
<meta name="robots" content="index" />
<meta name="description" content="File listing for topic - $topic_id | {$data['name']} ({$data['size']})" />
<meta property="og:description" content="File listing for topic - $topic_id | {$data['name']} ({$data['size']})" />
<meta property="og:site_name" content="{$bb_cfg['sitename']}" />
<meta name="generator" content="TorrentPier" />
<meta name="version" content="{$bb_cfg['tp_version']}" />
<link rel="shortcut icon" href="favicon.png" type="image/x-icon" />