|
38 | 38 | while (!$res->EOF) {
|
39 | 39 | $info = [];
|
40 | 40 | $info['date'] = Config::time($res->fields[1]);
|
41 |
| - $info['name'] = stripslashes(filter_var($res->fields[0], FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_NO_ENCODE_QUOTES)); |
| 41 | + $raw_name = stripslashes(filter_var($res->fields[0], FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_NO_ENCODE_QUOTES)); |
| 42 | + $cleaned_name = mb_convert_encoding($raw_name, 'UTF-8', 'UTF-8'); |
| 43 | + $unwanted_sequences = ["\xF3\xA0\x80\xA1"]; |
| 44 | + foreach ($unwanted_sequences as $sequence) { |
| 45 | + $cleaned_name = str_replace($sequence, '', $cleaned_name); |
| 46 | + } |
| 47 | + $cleaned_name = str_replace($unwanted_sequence, '', $cleaned_name); |
| 48 | + $info['name'] = htmlspecialchars(addslashes($cleaned_name), ENT_QUOTES, 'UTF-8'); |
42 | 49 | $info['short_name'] = trunc($info['name'], 40);
|
43 | 50 | $info['auth'] = $res->fields['authid'];
|
44 | 51 | $info['ip'] = $res->fields['ip'];
|
|
53 | 60 | $info['search_link'] = "index.php?p=banlist&advSearch=" . $info['auth'] . "&advType=steamid&Submit";
|
54 | 61 | }
|
55 | 62 | $info['link_url'] = "window.location = '" . $info['search_link'] . "';";
|
56 |
| - $info['name'] = htmlspecialchars(addslashes($info['name']), ENT_QUOTES, 'UTF-8'); |
57 |
| - $info['popup'] = "ShowBox('Blocked player: " . $info['name'] . "', '" . $info['name'] . " tried to enter<br />' + document.getElementById('" . $info['server'] . "').title + '<br />at " . $info['date'] . "<br /><div align=middle><a href=" . $info['search_link'] . ">Click here for ban details.</a></div>', 'red', '', true);"; |
| 63 | + |
| 64 | + // To print a name in the popup instead an empty string |
| 65 | + if (empty($cleaned_name)) { |
| 66 | + $cleaned_name = "<i>No nickname present</i>"; |
| 67 | + } |
| 68 | + $info['popup'] = "ShowBox('Blocked player: " . $info['name'] . "', '" . $cleaned_name . " tried to enter<br />' + document.getElementById('" . $info['server'] . "').title + '<br />at " . $info['date'] . "<br /><div align=middle><a href=" . $info['search_link'] . ">Click here for ban details.</a></div>', 'red', '', true);"; |
58 | 69 |
|
59 | 70 | $GLOBALS['server_qry'] .= "xajax_ServerHostProperty(" . $res->fields['sid'] . ", 'block_" . $res->fields['sid'] . "_$blcount', 'title', 100);";
|
60 | 71 |
|
|
85 | 96 | $info['temp'] = true;
|
86 | 97 | $info['unbanned'] = false;
|
87 | 98 | }
|
88 |
| - $info['name'] = stripslashes($res->fields[3]); |
| 99 | + $raw_name = stripslashes($res->fields[3]); |
| 100 | + $cleaned_name = mb_convert_encoding($raw_name, 'UTF-8', 'UTF-8'); |
| 101 | + $unwanted_sequences = ["\xF3\xA0\x80\xA1"]; |
| 102 | + foreach ($unwanted_sequences as $sequence) { |
| 103 | + $cleaned_name = str_replace($sequence, '', $cleaned_name); |
| 104 | + } |
| 105 | + $cleaned_name = str_replace($unwanted_sequence, '', $cleaned_name); |
| 106 | + $info['name'] = htmlspecialchars(addslashes($cleaned_name), ENT_QUOTES, 'UTF-8'); |
89 | 107 | $info['created'] = Config::time($res->fields['created']);
|
90 | 108 | $ltemp = explode(",", $res->fields[6] == 0 ? 'Permanent' : SecondsToString(intval($res->fields[6])));
|
91 | 109 | $info['length'] = $ltemp[0];
|
|
144 | 162 | $info['temp'] = true;
|
145 | 163 | $info['unbanned'] = false;
|
146 | 164 | }
|
147 |
| - $info['name'] = stripslashes($res->fields[3]); |
| 165 | + $raw_name = stripslashes($res->fields[3]); |
| 166 | + $cleaned_name = mb_convert_encoding($raw_name, 'UTF-8', 'UTF-8'); |
| 167 | + $unwanted_sequences = ["\xF3\xA0\x80\xA1"]; |
| 168 | + foreach ($unwanted_sequences as $sequence) { |
| 169 | + $cleaned_name = str_replace($sequence, '', $cleaned_name); |
| 170 | + } |
| 171 | + $cleaned_name = str_replace($unwanted_sequence, '', $cleaned_name); |
| 172 | + $info['name'] = htmlspecialchars(addslashes($cleaned_name), ENT_QUOTES, 'UTF-8'); |
148 | 173 | $info['created'] = Config::time($res->fields['created']);
|
149 | 174 | $ltemp = explode(",", $res->fields[6] == 0 ? 'Permanent' : SecondsToString(intval($res->fields[6])));
|
150 | 175 | $info['length'] = $ltemp[0];
|
|
0 commit comments