Fix a multibyte issue with names in groups list, and also in search.

This commit is contained in:
Retro_Guy 2024-08-10 09:49:51 -07:00
parent 636bcedb2e
commit 42528d6f26
2 changed files with 20 additions and 9 deletions

View File

@ -784,18 +784,30 @@ function groups_show($gruppen)
$groupdisplay .= '</td><td class="' . $lineclass . '"><div class="np_last_posted_date">';
if ($found == 1) {
$poster = address_decode($lastarticleinfo['name'], "nowhere");
$lastarticleinfo['from'] = $poster[0]['mailbox'] . "@" . $poster[0]['host'];
if (isset($poster[0]['personal'])) {
$lastarticleinfo['name'] = $poster[0]['personal'];
$fromline = address_decode(headerDecode($lastarticleinfo['name']), "nowhere");
if (! isset($fromline[0]["host"]))
$fromline[0]["host"] = "";
$name_from = $fromline[0]["mailbox"] . "@" . $fromline[0]["host"];
if (! isset($fromline[0]["personal"])) {
$poster_name = $fromline[0]["mailbox"];
} else {
$lastarticleinfo['name'] = $poster[0]['mailbox'];
$poster_name = $fromline[0]["personal"];
}
$fromoutput[0] = $poster[0]['mailbox'] . "@" . $poster[0]['host'];
if (trim($poster_name) == '') {
$fromoutput = explode("<", html_entity_decode($c->name));
if (strlen($fromoutput[0]) < 1) {
$poster_name = $fromoutput[1];
} else {
$poster_name = $fromoutput[0];
}
}
$lastarticleinfo['name'] = $poster_name;
$groupdisplay .= get_date_interval(date("D, j M Y H:i T", $lastarticleinfo['date']));
$groupdisplay .= '<table><tr><td>';
$groupdisplay .= '<font class="np_last_posted_date">by: ';
$groupdisplay .= create_name_link(mb_decode_mimeheader(html_entity_decode($lastarticleinfo['name'])), $lastarticleinfo['from']);
$groupdisplay .= create_name_link($lastarticleinfo['name'], $name_from);
$groupdisplay .= '</td></tr></table>';
} else {
unset($lastarticleinfo);

View File

@ -116,7 +116,6 @@ if ((! isset($_POST['key']) || ! password_verify($CONFIG['thissitekey'], $_POST[
}
}
// END Block poster
exit(0);
} else {
// Determine default view style
@ -462,7 +461,7 @@ function get_header_search($group, $terms)
}
$article_dbh = article_db_open($article_database);
$article_stmt = $article_dbh->prepare("SELECT * FROM articles WHERE number=:number");
if (is_multibyte($_POST['terms'])) {
if (!isset($_POST['data']) && is_multibyte($_POST['terms'])) {
$stmt = $dbh->prepare("SELECT * FROM $table WHERE newsgroup=:group");
$stmt->bindParam(':group', $group);
$stmt->execute();