Do not truncate poster name in message view. Move From to below Subject if Subject is long.

This commit is contained in:
Retro_Guy 2024-10-28 06:47:13 -07:00
parent 4f75012597
commit a013047794
2 changed files with 17 additions and 7 deletions

View File

@ -453,7 +453,7 @@ function show_header($head, $group, $local_poster = false)
echo '<i>';
}
if ($head->name != "") {
echo create_name_link($head->name, $head->from);
echo create_name_link($head->name, $head->from, false);
} else {
if (isset($CONFIG['hide_email']) && $CONFIG['hide_email'] == true) {
echo truncate_email($head->from);
@ -568,10 +568,13 @@ function show_header_short($head, $group, $local_poster = false)
global $file_attachment, $CONFIG, $config_name, $sitelink;
global $OVERRIDES;
// If Subject: is longer than this, place From: below Subject: in short short_header
$maxsubjectlength = 70;
echo '<div class="np_article_header">';
if ($head->name != "") {
$displayname = create_name_link($head->name, $head->from);
$displayname = create_name_link($head->name, $head->from, false);
} else {
if (isset($CONFIG['hide_email']) && $CONFIG['hide_email'] == true) {
$displayname = truncate_email($head->from);
@ -581,7 +584,7 @@ function show_header_short($head, $group, $local_poster = false)
}
// Where to show From in short_headers
if (isset($OVERRIDES['short_header_show_from_in_subject']) && $OVERRIDES['short_header_show_from_in_subject'] == true) {
if (isset($OVERRIDES['short_header_show_from_in_subject']) && $OVERRIDES['short_header_show_from_in_subject'] == true && strlen($head->subject) < $maxsubjectlength) {
echo '<span class="short_header_subject">';
echo htmlspecialchars($head->subject);
echo '</span><span class="short_header_from_with_subject">';

View File

@ -1741,20 +1741,27 @@ function format_log_date()
return date('M d H:i:s');
}
function create_name_link($name, $data = null)
function create_name_link($name, $data = null, $truncate = true)
{
global $CONFIG;
$name = preg_replace('/\"/', '', $name);
if ($truncate) {
$trimlength = 20;
} else {
$trimlength = null;
}
if ($data) {
$data = urlencode(base64_encode($data));
}
if ((strpos($name, '...@') !== false && (isset($CONFIG['hide_email']) && $CONFIG['hide_email'] == true)) && ! $data) {
$return = '<span class="visited">' . substr(htmlspecialchars($name), 0, 20) . '</span>';
$return = '<span class="visited">' . substr(htmlspecialchars($name), 0, $trimlength) . '</span>';
} else {
if (isset($_COOKIE['mail_name'])) {
$return = '<a href="search.php?command=search&searchpoint=Poster&terms=' . $name . '&data=' . $data . '" title="Search or Block by user"><span class="visited">' . substr(htmlspecialchars($name), 0, 20) . '</span></a>';
$return = '<a href="search.php?command=search&searchpoint=Poster&terms=' . $name . '&data=' . $data . '" title="Search or Block by user"><span class="visited">' . substr(htmlspecialchars($name), 0, $trimlength) . '</span></a>';
} else {
$return = '<a href="search.php?command=search&searchpoint=Poster&terms=' . $name . '&data=' . $data . '" title="Search by user"><span class="visited">' . substr(htmlspecialchars($name), 0, 20) . '</span></a>';
$return = '<a href="search.php?command=search&searchpoint=Poster&terms=' . $name . '&data=' . $data . '" title="Search by user"><span class="visited">' . substr(htmlspecialchars($name), 0, $trimlength) . '</span></a>';
}
}
return ($return);