packages: phorum/multibyte_description.patch - can use mb_substr() safely a...
glen
glen at pld-linux.org
Tue May 4 14:07:57 CEST 2010
Author: glen Date: Tue May 4 12:07:57 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- can use mb_substr() safely as common.php has a wrapper
- one more mb_substr in search.php
---- Files affected:
packages/phorum:
multibyte_description.patch (1.1 -> 1.2)
---- Diffs:
================================================================
Index: packages/phorum/multibyte_description.patch
diff -u packages/phorum/multibyte_description.patch:1.1 packages/phorum/multibyte_description.patch:1.2
--- packages/phorum/multibyte_description.patch:1.1 Tue May 4 11:34:03 2010
+++ packages/phorum/multibyte_description.patch Tue May 4 14:07:51 2010
@@ -1,24 +1,26 @@
http://www.phorum.org/phorum5/read.php?61,131083
--- phorum/htdocs/read.php~ 2010-05-03 18:12:21.000000000 +0300
-+++ phorum/htdocs/read.php 2010-05-04 11:38:50.829674278 +0300
-@@ -788,7 +788,18 @@
++++ phorum/htdocs/read.php 2010-05-04 15:01:42.811819248 +0300
+@@ -788,7 +788,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"]));
-+ if (strtoupper($PHORUM["DATA"]["HCHARSET"])=='UTF-8') {
-+ if (function_exists('mb_substr')) {
-+ $PHORUM["DATA"]["DESCRIPTION"] = mb_substr($PHORUM["DATA"]["DESCRIPTION"], 0, 300, $PHORUM["DATA"]["HCHARSET"]);
-+ } else {
-+ // No change to short description without PHP warning
-+ $PHORUM["DATA"]["DESCRIPTION"] = $PHORUM["DATA"]["DESCRIPTION"];
-+ }
-+ } else {
-+ $PHORUM["DATA"]["DESCRIPTION"] = substr($PHORUM["DATA"]["DESCRIPTION"], 0, 300);
-+ }
++ $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']){
+--- phorum/htdocs/search.php~ 2010-05-04 12:28:25.000000000 +0300
++++ phorum/htdocs/search.php 2010-05-04 15:00:21.735132358 +0300
+@@ -258,7 +258,7 @@
+ // strip HTML & BB Code
+ if(!$raw_body) {
+ $body = phorum_strip_body($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_relative_date($row["datestamp"]);
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/phorum/multibyte_description.patch?r1=1.1&r2=1.2&f=u
More information about the pld-cvs-commit
mailing list