From 119cf935a2a084ee6ce9dda1534ad0722ff96996 Mon Sep 17 00:00:00 2001
From: Roman Kelesidis
Date: Sun, 17 Sep 2023 16:17:10 +0700
Subject: [PATCH] Minor improvements (#903)
---
admin/admin_attachments.php | 4 ++--
install/sql/mysql.sql | 6 +++---
library/attach_mod/displaying.php | 3 ++-
library/includes/functions.php | 4 ++--
styles/templates/default/viewtopic_attach.tpl | 2 +-
5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/admin/admin_attachments.php b/admin/admin_attachments.php
index 38f9527ea..8534ae715 100644
--- a/admin/admin_attachments.php
+++ b/admin/admin_attachments.php
@@ -155,13 +155,13 @@ if ($search_imagick) {
} elseif (false !== stripos(PHP_OS, "WIN")) {
$path = 'c:/imagemagick/convert.exe';
- if (!@file_exists(amod_realpath($path))) {
+ if (file_exists(amod_realpath($path))) {
$imagick = $path;
}
}
}
- if (!@file_exists(amod_realpath(trim($imagick)))) {
+ if (file_exists(amod_realpath(trim($imagick)))) {
$new_attach['img_imagick'] = trim($imagick);
} else {
$new_attach['img_imagick'] = '';
diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql
index 12592bb65..4071f6304 100644
--- a/install/sql/mysql.sql
+++ b/install/sql/mysql.sql
@@ -52,9 +52,9 @@ VALUES ('upload_dir', 'data/torrent_files'),
('img_display_inlined', '1'),
('img_max_width', '200'),
('img_max_height', '200'),
- ('img_link_width', '0'),
- ('img_link_height', '0'),
- ('img_create_thumbnail', '0'),
+ ('img_link_width', '600'),
+ ('img_link_height', '400'),
+ ('img_create_thumbnail', '1'),
('img_min_thumb_filesize', '12000'),
('img_imagick', '/usr/bin/convert'),
('use_gd2', '1'),
diff --git a/library/attach_mod/displaying.php b/library/attach_mod/displaying.php
index 40b101c45..517e0848f 100644
--- a/library/attach_mod/displaying.php
+++ b/library/attach_mod/displaying.php
@@ -278,7 +278,8 @@ function display_attachments($post_id)
'IMG_SRC' => BB_ROOT . DL_URL . $attachments['_' . $post_id][$i]['attach_id'],
'IMG_THUMB_SRC' => $thumb_source,
'FILESIZE' => $filesize,
- 'COMMENT' => $comment
+ 'COMMENT' => $comment,
+ 'DOWNLOAD_COUNT' => declension((int)$attachments['_' . $post_id][$i]['download_count'], 'times'),
]);
}
diff --git a/library/includes/functions.php b/library/includes/functions.php
index 17941a076..232d209b7 100644
--- a/library/includes/functions.php
+++ b/library/includes/functions.php
@@ -2016,9 +2016,9 @@ function bb_captcha($mode, $callback = '')
$secret = $bb_cfg['captcha']['secret_key'];
$public = $bb_cfg['captcha']['public_key'];
- $cp_theme = $bb_cfg['captcha']['theme'];
+ $cp_theme = $bb_cfg['captcha']['theme'] ?? 'light';
- if (!$public && !$secret) {
+ if (!$bb_cfg['captcha']['disabled'] && (!$public || !$secret)) {
bb_die($lang['CAPTCHA_SETTINGS']);
}
diff --git a/styles/templates/default/viewtopic_attach.tpl b/styles/templates/default/viewtopic_attach.tpl
index c4eb51fbe..8ffe255a2 100644
--- a/styles/templates/default/viewtopic_attach.tpl
+++ b/styles/templates/default/viewtopic_attach.tpl
@@ -35,7 +35,7 @@
{postrow.attach.cat_thumb_images.DOWNLOAD_NAME}
- ({postrow.attach.cat_thumb_images.FILESIZE})
+ ({postrow.attach.cat_thumb_images.FILESIZE}, {L_DOWNLOADED}: {postrow.attach.cat_thumb_images.DOWNLOAD_COUNT})