Always use native mb_* functions.

This commit is contained in:
Markus Birth 2022-02-20 01:56:52 +01:00
parent 33a98547a7
commit f4bd9bc07a
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A
7 changed files with 9 additions and 9 deletions

View File

@ -310,7 +310,7 @@ if (is_array($sql)) {
$i++; $i++;
$comment = array( $comment = array(
'fullBody' => $rs['body'], 'fullBody' => $rs['body'],
'summary' => serendipity_mb('substr', $rs['body'], 0, $summaryLength), 'summary' => mb_substr($rs['body'], 0, $summaryLength),
'status' => $rs['status'], 'status' => $rs['status'],
'type' => $rs['type'], 'type' => $rs['type'],
'id' => $rs['id'], 'id' => $rs['id'],

View File

@ -285,7 +285,7 @@ switch($serendipity['GET']['adminAction']) {
} }
} elseif ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3' || $serendipity['dbType'] == 'pdo-sqlite' || $serendipity['dbType'] == 'sqlite3oo') { } elseif ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3' || $serendipity['dbType'] == 'pdo-sqlite' || $serendipity['dbType'] == 'sqlite3oo') {
$term = str_replace('*', '%', $term); $term = str_replace('*', '%', $term);
$term = serendipity_mb('strtolower', $term); $term = mb_strtolower($term);
$filter[] = "(lower(title) LIKE '%$term%' OR lower(body) LIKE '%$term%' OR lower(extended) LIKE '%$term%')"; $filter[] = "(lower(title) LIKE '%$term%' OR lower(body) LIKE '%$term%' OR lower(extended) LIKE '%$term%')";
} else { } else {
if (preg_match('@["\+\-\*~<>\(\)]+@', $term)) { if (preg_match('@["\+\-\*~<>\(\)]+@', $term)) {
@ -468,4 +468,4 @@ if (! isset($data['is_iframepreview'])) { $data['is_iframepreview'] = null; }
echo serendipity_smarty_show('admin/entries.inc.tpl', $data); echo serendipity_smarty_show('admin/entries.inc.tpl', $data);
/* vim: set sts=4 ts=4 expandtab : */ /* vim: set sts=4 ts=4 expandtab : */

View File

@ -85,7 +85,7 @@ if (is_array($comments) && count($comments) > 0) {
$comment['entrylink'] = serendipity_archiveURL($comment['entry_id'], 'comments', 'serendipityHTTPPath', true) . '#c' . $comment['id']; $comment['entrylink'] = serendipity_archiveURL($comment['entry_id'], 'comments', 'serendipityHTTPPath', true) . '#c' . $comment['id'];
$comment['fullBody'] = $comment['body']; $comment['fullBody'] = $comment['body'];
$comment['summary'] = serendipity_mb('substr', $comment['body'], 0, 100); $comment['summary'] = mb_substr($comment['body'], 0, 100);
if (strlen($comment['fullBody']) > strlen($comment['summary']) ) { if (strlen($comment['fullBody']) > strlen($comment['summary']) ) {
$comment['excerpt'] = true; $comment['excerpt'] = true;

View File

@ -34,7 +34,7 @@ include_once(S9Y_INCLUDE_PATH . 'include/functions_smarty.inc.php');
*/ */
function serendipity_truncateString($s, $len) { function serendipity_truncateString($s, $len) {
if ( strlen($s) > ($len+3) ) { if ( strlen($s) > ($len+3) ) {
$s = serendipity_mb('substr', $s, 0, $len) . '...'; $s = mb_substr($s, 0, $len) . '...';
} }
return $s; return $s;
} }

View File

@ -877,7 +877,7 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') {
$term = str_replace('*', '%', $term); $term = str_replace('*', '%', $term);
$cond['group'] = 'GROUP BY e.id'; $cond['group'] = 'GROUP BY e.id';
$cond['distinct'] = ''; $cond['distinct'] = '';
$term = serendipity_mb('strtolower', $term); $term = mb_strtolower($term);
$cond['find_part'] = "(lower(title) LIKE '%$term%' OR lower(body) LIKE '%$term%' OR lower(extended) LIKE '%$term%')"; $cond['find_part'] = "(lower(title) LIKE '%$term%' OR lower(body) LIKE '%$term%' OR lower(extended) LIKE '%$term%')";
} else { } else {
$cond['group'] = 'GROUP BY e.id'; $cond['group'] = 'GROUP BY e.id';

View File

@ -605,7 +605,7 @@ function trackback_body_strip($body){
* @return string Output text * @return string Output text
*/ */
function serendipity_trackback_excerpt($text) { function serendipity_trackback_excerpt($text) {
return serendipity_mb('substr', strip_tags($text), 0, 255); return mb_substr(strip_tags($text), 0, 255);
} }
/** /**

View File

@ -217,7 +217,7 @@ class serendipity_plugin_history extends serendipity_plugin
echo '<span class="serendipity_history_date">' . $date . ' </span>'; echo '<span class="serendipity_history_date">' . $date . ' </span>';
} }
$t = ($maxlength==0 || strlen($e[$x]['title']) <= $maxlength) ? $e[$x]['title'] $t = ($maxlength==0 || strlen($e[$x]['title']) <= $maxlength) ? $e[$x]['title']
: (trim(serendipity_mb('substr', $e[$x]['title'], 0, $maxlength-3)).' [...]'); : (trim(mb_substr($e[$x]['title'], 0, $maxlength-3)).' [...]');
echo '<a href="' . $url . '" title="' . str_replace("'", "`", serendipity_specialchars($e[$x]['title'])) . '">"' . serendipity_specialchars($t) . '"</a></div>'; echo '<a href="' . $url . '" title="' . str_replace("'", "`", serendipity_specialchars($e[$x]['title'])) . '">"' . serendipity_specialchars($t) . '"</a></div>';
if ($full) { if ($full) {
echo '<div class="serendipity_history_body">' . strip_tags($e[$x]['body']) . '</div>'; echo '<div class="serendipity_history_body">' . strip_tags($e[$x]['body']) . '</div>';
@ -229,4 +229,4 @@ class serendipity_plugin_history extends serendipity_plugin
} }
/* vim: set sts=4 ts=4 expandtab : */ /* vim: set sts=4 ts=4 expandtab : */
?> ?>