From a083daf8418d1dc6e0cbc5b41924c9d364815f9e Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Thu, 15 Apr 2004 14:07:08 +0000 Subject: Truncate UTF-8 patch. Introduced a new function truncate_utf8() for chopping off strings at unsure locations, without risking incomplete UTF-8 data. --- modules/comment/comment.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/comment') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 03f6144bd..24e2a232b 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -277,7 +277,7 @@ function comment_post($edit) { $edit["subject"] = strip_tags($edit["subject"]); if ($edit["subject"] == "") { - $edit["subject"] = substr(strip_tags($edit["comment"]), 0, 29); + $edit["subject"] = truncate_utf8(strip_tags($edit["comment"]), 29); } /* @@ -978,7 +978,7 @@ function comment_admin_overview($status = 0) { $result = pager_query($sql, 50); while ($comment = db_fetch_object($result)) { - $rows[] = array(l($comment->subject, "node/view/$comment->nid/$comment->cid", array("title" => htmlspecialchars(substr($comment->comment, 0, 128))), NULL, "comment-$comment->cid") ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme("mark") : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."". format_date($comment->timestamp, "small") ."". l(t("edit comment"), "admin/comment/edit/$comment->cid"), l(t("delete comment"), "admin/comment/delete/$comment->cid")); + $rows[] = array(l($comment->subject, "node/view/$comment->nid/$comment->cid", array("title" => htmlspecialchars(truncate_utf8($comment->comment, 128))), NULL, "comment-$comment->cid") ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme("mark") : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."". format_date($comment->timestamp, "small") ."". l(t("edit comment"), "admin/comment/edit/$comment->cid"), l(t("delete comment"), "admin/comment/delete/$comment->cid")); } if ($pager = theme("pager", NULL, 50, 0, tablesort_pager())) { -- cgit v1.2.3