Skip to content

Commit

Permalink
MFB: fixed "multibyte chop corruption" (fixes #865, thanks to Phorum …
Browse files Browse the repository at this point in the history
…user glen!)
  • Loading branch information
mysnip committed Jul 8, 2011
1 parent 08bc525 commit 6ba0bf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion read.php
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,9 @@
// here, because of modules adding images and formatting.
$PHORUM["DATA"]["HTML_TITLE"] = trim(strip_tags($PHORUM["threaded_read"] ? $PHORUM["DATA"]["MESSAGE"]["subject"] : $PHORUM["DATA"]["TOPIC"]["subject"]));

$PHORUM["DATA"]["DESCRIPTION"] = htmlspecialchars(preg_replace('!\s+!s'," ",strip_tags(substr($PHORUM["DATA"]["TOPIC"]["body"],0,300))), ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
$PHORUM["DATA"]["DESCRIPTION"] = preg_replace('!\s+!s'," ", strip_tags($PHORUM["DATA"]["TOPIC"]["body"]));
$PHORUM["DATA"]["DESCRIPTION"] = mb_substr($PHORUM["DATA"]["DESCRIPTION"], 0, 300, $PHORUM["DATA"]["HCHARSET"]);
$PHORUM["DATA"]["DESCRIPTION"] = htmlspecialchars($PHORUM["DATA"]["DESCRIPTION"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);

// add feed url
if(isset($PHORUM['use_rss']) && $PHORUM['use_rss']){
Expand Down
3 changes: 2 additions & 1 deletion search.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ function phorum_search_check_valid_vars()
// strip HTML & BB Code
if(!$raw_body) {
$body = phorum_api_format_strip($arr["rows"][$key]["body"]);
$arr["rows"][$key]["short_body"] = substr($body, 0, 400);
$arr["rows"][$key]["short_body"] = mb_substr($body, 0, 400, $PHORUM["DATA"]["HCHARSET"]);

}
$arr["rows"][$key]["raw_datestamp"] = $row["datestamp"];
$arr["rows"][$key]["datestamp"] = phorum_api_format_relative_date($row["datestamp"]);
Expand Down

0 comments on commit 6ba0bf6

Please # to comment.