Skip to content

Instantly share code, notes, and snippets.

@komeda-shinji
Created November 29, 2016 09:01
Show Gist options
  • Save komeda-shinji/dbdf2c16861133925d68edc5aa67bc92 to your computer and use it in GitHub Desktop.
Save komeda-shinji/dbdf2c16861133925d68edc5aa67bc92 to your computer and use it in GitHub Desktop.
TeamPassのitem一覧でdescriptionのトリミングがマルチバイトを理解しない問題の対策 ref: http://qiita.com/komeda-shinji/items/896ef0306b59ad3622da
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 @@
'&nbsp;<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 .= '&nbsp;<font size=2px>['.strip_tags(stripslashes(substr(cleanString($dataReceived['description']), 0, 30))).']</font>';
+ $html .= '&nbsp;<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 .= '&nbsp;<font size="2px">['.strip_tags(stripslashes(substr(cleanString($record['description']), 0, 30))).']</font>';
+ $html .= '&nbsp;<font size="2px">['.strip_tags(stripslashes(mb_substr(cleanString($record['description']), 0, 30))).']</font>';
} else {
- $html .= '&nbsp;<font size="2px">['.strip_tags(stripslashes(substr(cleanString($tempo[0]), 0, 30))).']</font>';
+ $html .= '&nbsp;<font size="2px">['.strip_tags(stripslashes(mb_substr(cleanString($tempo[0]), 0, 30))).']</font>';
}
}
$html .= '</a>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment