TeamPass というパスワード管理ツールがあるのですが、項目一覧で説明(description)のところを30文字に切り詰める処理がマルチバイト理解しないので、変なところで切り詰められてしまいます。
とりあえず substr() を mb_substr() に変更することで回避しました。
できれば文字幅を考慮すべきですが、実害がないのでマルチバイトでも30文字のままにしています。
sources/items.queries.php- sources/items.queries.php
--- sources/items.queries.php- 2016-08-16 05:03:17.000000000 +0900
+++ sources/items.queries.php 2016-11-29 17:53:16.128242854 +0900
@@ -314,7 +314,7 @@
' <a id="fileclass'.$newID.'" class="file" onclick="AfficherDetailsItem(\''.$newID.'\', \'0\', \'\', \'\', \'\', \'\', \'\')" ondblclick="AfficherDetailsItem(\''.$newID.'\', \'0\', \'\', \'\', \'\', true, \'\')">' .
stripslashes($dataReceived['label']);
if (!empty($dataReceived['description']) && isset($_SESSION['settings']['show_description']) && $_SESSION['settings']['show_description'] == 1) {
- $html .= ' <font size=2px>['.strip_tags(stripslashes(substr(cleanString($dataReceived['description']), 0, 30))).']</font>';
+ $html .= ' <font size=2px>['.strip_tags(stripslashes(mb_substr(cleanString($dataReceived['description']), 0, 30))).']</font>';
}
$html .= '</a><span style="float:right;margin:2px 10px 0px 0px;">';
// mini icon for collab
@@ -1955,9 +1955,9 @@
if (!empty($record['description']) && isset($_SESSION['settings']['show_description']) && $_SESSION['settings']['show_description'] == 1) {
$tempo = explode("<br />", $record['description']);
if (count($tempo) == 1) {
- $html .= ' <font size="2px">['.strip_tags(stripslashes(substr(cleanString($record['description']), 0, 30))).']</font>';
+ $html .= ' <font size="2px">['.strip_tags(stripslashes(mb_substr(cleanString($record['description']), 0, 30))).']</font>';
} else {
- $html .= ' <font size="2px">['.strip_tags(stripslashes(substr(cleanString($tempo[0]), 0, 30))).']</font>';
+ $html .= ' <font size="2px">['.strip_tags(stripslashes(mb_substr(cleanString($tempo[0]), 0, 30))).']</font>';
}
}
$html .= '</a>';