Permalink
Browse files

Replace PHP UTF-8 library with PHP's mbstring extension

Git Commit ID: beb4c5b

For MantisBT 1.2.x, the PHP UTF-8 library at [1] was selected to provide
proper Unicode support to MantisBT. This library wraps around PHP's
mbstring extension and provides an alternative implemented-in-PHP
approach where the mbstring extension is not available on a server
running MantisBT. mbstring is a PHP extension that is not bundled with
PHP by default. Linux distributions already package the extension and it
is trivial to install. The extension is also bundled with the Windows
.zip distribution of PHP for Windows users and is also trivial to
install.

The need to support platform configurations where mbstring isn't
available and can't be installed stems from the days when shared hosting
was popular. With the popularisation of virtualisation (virtual private
servers) as a cheap replacement to shared hosting, administrators once
again have control over their own platform, allowing them to install PHP
extensions whenever they please. Popular Linux distributions have been
packaging and making the mbstring PHP extension available for a long
time. Installation on Windows platforms is also trivial (relative to the
complexity of Windows platforms due to a lack of software package
management functionality).

Removal of the PHP UTF-8 wrapper simplifies MantisBT's code base and
likely improves performance (no need to wrap function calls and compile
and load an entire UTF-8 library into memory). More importantly,
MantisBT no longer depends on a small library that hasn't seen updates
since 2007. Reliance on mbstring is a less risky option because it is
more widely used and ties in with PHP's official infrastructure and
support/documentation system.

MantisBT's documentation has been updated and expanded to reflect the
new installation requirement. Links to external documentation on php.net
have also been provided to guide new users in performing the simple
action of adding the mbstring extension.

[1] http://sourceforge.net/projects/phputf8/
  • Loading branch information...
1 parent 82d615b commit 6a165ba57e4b8d683e26f2034b4534af0870c5f2 @grangeway grangeway committed Oct 28, 2012
Showing with 1,553 additions and 4,293 deletions.
  1. +1 −1 bug_actiongroup_ext_page.php
  2. +1 −1 bug_actiongroup_page.php
  3. +1 −1 bugnote_view_inc.php
  4. +1 −1 changelog_page.php
  5. +2 −2 core/authentication_api.php
  6. +4 −4 core/cfdefs/cfdef_standard.php
  7. +1 −1 core/classes/MantisUser.class.php
  8. +8 −8 core/columns_api.php
  9. +2 −2 core/custom_field_api.php
  10. +2 −2 core/custom_function_api.php
  11. +4 −4 core/database_api.php
  12. +2 −2 core/date_api.php
  13. +4 −4 core/email_api.php
  14. +1 −1 core/file_api.php
  15. +9 −9 core/filter_api.php
  16. +2 −2 core/form_api.php
  17. +1 −1 core/install_helper_functions_api.php
  18. +1 −1 core/lang_api.php
  19. +2 −2 core/plugin_api.php
  20. +4 −4 core/print_api.php
  21. +5 −5 core/relationship_api.php
  22. +1 −1 core/session_api.php
  23. +6 −6 core/string_api.php
  24. +2 −2 core/tag_api.php
  25. +3 −3 core/user_api.php
  26. +1 −1 core/version_api.php
  27. +1 −1 core/xmlhttprequest_api.php
  28. +42 −0 js/jquery.iviewer.min.js
  29. +13 −0 js/jquery.mousewheel.min.js
  30. +467 −0 js/jquery.panzoom.js
  31. +228 −0 js/jquery.splitter.js
  32. +115 −0 js/jquery.tools.min.js
  33. +256 −0 js/jquery.treeview.js
  34. +31 −0 js/menu.js
  35. +2 −0 js/prettify/lang-apollo.js
  36. +18 −0 js/prettify/lang-clj.js
  37. +2 −0 js/prettify/lang-css.js
  38. +1 −0 js/prettify/lang-go.js
  39. +2 −0 js/prettify/lang-hs.js
  40. +3 −0 js/prettify/lang-lisp.js
  41. +2 −0 js/prettify/lang-lua.js
  42. +2 −0 js/prettify/lang-ml.js
  43. +4 −0 js/prettify/lang-n.js
  44. +1 −0 js/prettify/lang-proto.js
  45. +2 −0 js/prettify/lang-scala.js
  46. +2 −0 js/prettify/lang-sql.js
  47. +1 −0 js/prettify/lang-tex.js
  48. +2 −0 js/prettify/lang-vb.js
  49. +3 −0 js/prettify/lang-vhdl.js
  50. +2 −0 js/prettify/lang-wiki.js
  51. +3 −0 js/prettify/lang-xq.js
  52. +2 −0 js/prettify/lang-yaml.js
  53. +28 −0 js/prettify/prettify.min.js
  54. +45 −0 js/sidebar.js
  55. +185 −0 js/template.js
  56. +0 −837 library/utf8/ChangeLog
  57. +0 −504 library/utf8/LICENSE
  58. +0 −82 library/utf8/README
  59. +0 −14 library/utf8/TODO.tsk
  60. +0 −37 library/utf8/exp/regexunicode.php
  61. 0 library/utf8/index.html
  62. +0 −140 library/utf8/mbstring/core.php
  63. +0 −438 library/utf8/native/core.php
  64. +0 −92 library/utf8/ord.php
  65. +0 −15 library/utf8/readme_mantis.txt
  66. +0 −80 library/utf8/str_ireplace.php
  67. +0 −57 library/utf8/str_pad.php
  68. +0 −35 library/utf8/str_split.php
  69. +0 −26 library/utf8/strcasecmp.php
  70. +0 −41 library/utf8/strcspn.php
  71. +0 −36 library/utf8/stristr.php
  72. +0 −22 library/utf8/strrev.php
  73. +0 −36 library/utf8/strspn.php
  74. +0 −24 library/utf8/substr_replace.php
  75. +0 −68 library/utf8/trim.php
  76. +0 −34 library/utf8/ucfirst.php
  77. +0 −44 library/utf8/ucwords.php
  78. +0 −74 library/utf8/utf8.php
  79. +0 −220 library/utf8/utils/ascii.php
  80. +0 −421 library/utf8/utils/bad.php
  81. +0 −69 library/utf8/utils/patterns.php
  82. +0 −173 library/utf8/utils/position.php
  83. +0 −131 library/utf8/utils/specials.php
  84. +0 −269 library/utf8/utils/unicode.php
  85. +0 −185 library/utf8/utils/validation.php
  86. +1 −1 manage/proj_cat_update.php
  87. +3 −3 manage/proj_edit_page.php
  88. +1 −1 manage/tags_page.php
  89. +1 −1 manage/user_page.php
  90. +1 −1 news_rss.php
  91. +1 −1 plugins/MantisGraph/pages/bug_graph_bystatus.php
  92. +1 −1 print_all_bug_options_update.php
  93. +1 −1 print_all_bug_page_word.php
  94. +1 −1 print_bugnote_inc.php
  95. +3 −3 return_dynamic_filters.php
  96. +1 −1 roadmap_page.php
  97. +1 −1 search.php
  98. +1 −1 signup.php
@@ -44,7 +44,7 @@
require_api( 'string_api.php' );
require_api( 'utility_api.php' );
-$t_external_action = utf8_strtolower( utf8_substr( $f_action, utf8_strlen( $t_external_action_prefix ) ) );
+$t_external_action = mb_strtolower( mb_substr( $f_action, mb_strlen( $t_external_action_prefix ) ) );
$t_form_fields_page = 'bug_actiongroup_' . $t_external_action . '_inc.php';
$t_form_name = 'bug_actiongroup_' . $t_external_action;
View
@@ -120,7 +120,7 @@
# Check if user selected to update a custom field.
$t_custom_fields_prefix = 'custom_field_';
if ( strpos( $f_action, $t_custom_fields_prefix ) === 0 ) {
- $t_custom_field_id = (int)substr( $f_action, utf8_strlen( $t_custom_fields_prefix ) );
+ $t_custom_field_id = (int)substr( $f_action, mb_strlen( $t_custom_fields_prefix ) );
$f_action = 'CUSTOM';
}
View
@@ -237,7 +237,7 @@
switch ( $t_bugnote->note_type ) {
case REMINDER:
echo '<em>' . lang_get( 'reminder_sent_to' ) . ' ';
- $t_note_attr = utf8_substr( $t_bugnote->note_attr, 1, utf8_strlen( $t_bugnote->note_attr ) - 2 );
+ $t_note_attr = mb_substr( $t_bugnote->note_attr, 1, mb_strlen( $t_bugnote->note_attr ) - 2 );
$t_to = array();
foreach ( explode( '|', $t_note_attr ) as $t_recipient ) {
$t_to[] = prepare_user_name( $t_recipient );
View
@@ -95,7 +95,7 @@ function print_version_header( $p_version_id ) {
echo '<br />';
$t_release_title_without_hyperlinks = $t_project_name . ' - ' . $t_version_name . $t_release_date;
- echo utf8_str_pad( '', utf8_strlen( $t_release_title_without_hyperlinks ), '=' ), '<br />';
+ echo mb_str_pad( '', mb_strlen( $t_release_title_without_hyperlinks ), '=' ), '<br />';
}
/**
@@ -393,7 +393,7 @@ function auth_does_password_match( $p_user_id, $p_test_password ) {
# Check for migration to another login method and test whether the password was encrypted
# with our previously insecure implemention of the CRYPT method
- if(( $t_login_method != $t_configured_login_method ) || (( CRYPT == $t_configured_login_method ) && utf8_substr( $t_password, 0, 2 ) == utf8_substr( $p_test_password, 0, 2 ) ) ) {
+ if(( $t_login_method != $t_configured_login_method ) || (( CRYPT == $t_configured_login_method ) && mb_substr( $t_password, 0, 2 ) == mb_substr( $p_test_password, 0, 2 ) ) ) {
user_set_password( $p_user_id, $p_test_password, true );
}
@@ -443,7 +443,7 @@ function auth_process_plain_password( $p_password, $p_salt = null, $p_method = n
}
# cut this off to PASSLEN characters which the largest possible string in the database
- return utf8_substr( $t_processed_password, 0, PASSLEN );
+ return mb_substr( $t_processed_password, 0, PASSLEN );
}
/**
@@ -177,7 +177,7 @@ function cfdef_prepare_list_database_to_value($p_value) {
*/
function cfdef_prepare_list_value_for_email($p_value) {
// strip start and end markers before converting markers to commas
- return str_replace( '|', ', ', utf8_substr( str_replace( '||', '|', '|' . $p_value . '|' ), 1, -1 ) );
+ return str_replace( '|', ', ', mb_substr( str_replace( '||', '|', '|' . $p_value . '|' ), 1, -1 ) );
}
/**
@@ -213,12 +213,12 @@ function cfdef_prepare_date_default( $p_value ) {
}
$t_value = trim( $p_value );
- $t_value_length = utf8_strlen( $t_value );
+ $t_value_length = mb_strlen( $t_value );
# We are expanding {tomorrow}, {yesterday}, {+3 days}, {-7 days}, {next week}
# See strtotime() for more details about supported formats.
if ( $t_value_length >= 3 && $t_value[0] == '{' && $t_value[$t_value_length - 1] == '}' ) {
- $t_value = utf8_substr( $t_value, 1, $t_value_length - 2 );
+ $t_value = mb_substr( $t_value, 1, $t_value_length - 2 );
$t_value = @strtotime( $t_value );
# Different versions of PHP return different values in case of error.
@@ -237,7 +237,7 @@ function cfdef_prepare_date_default( $p_value ) {
*/
function cfdef_prepare_list_value($p_value) {
// strip start and end markers before converting markers to commas
- return string_display_line( str_replace( '|', ', ', utf8_substr( str_replace( '||', '|', '|' . $p_value . '|' ), 1, -1 ) ) );
+ return string_display_line( str_replace( '|', ', ', mb_substr( str_replace( '||', '|', '|' . $p_value . '|' ), 1, -1 ) ) );
}
/**
@@ -426,7 +426,7 @@ function delete() {
*/
private function validate_username($p_username) {
# The DB field is hard-coded. USERLEN should not be modified.
- if( utf8_strlen( $p_username ) > USERLEN ) {
+ if( mb_strlen( $p_username ) > USERLEN ) {
return false;
}
View
@@ -217,7 +217,7 @@ function columns_get_plugin_columns() {
foreach( $t_plugin_column_array as $t_column_class ) {
if ( class_exists( $t_column_class ) && is_subclass_of( $t_column_class, 'MantisColumn' ) ) {
$t_column_object = new $t_column_class();
- $t_column_name = utf8_strtolower( $t_plugin . '_' . $t_column_object->column );
+ $t_column_name = mb_strtolower( $t_plugin . '_' . $t_column_object->column );
$s_column_array[ $t_column_name ] = $t_column_object;
}
}
@@ -285,7 +285,7 @@ function columns_get_all( $p_project_id = null ) {
*/
function column_get_custom_field_name( $p_column ) {
if( strncmp( $p_column, 'custom_', 7 ) === 0 ) {
- return utf8_substr( $p_column, 7 );
+ return mb_substr( $p_column, 7 );
}
return null;
@@ -299,7 +299,7 @@ function column_get_custom_field_name( $p_column ) {
* @access public
*/
function columns_string_to_array( $p_string ) {
- $t_string = utf8_strtolower( $p_string );
+ $t_string = mb_strtolower( $p_string );
$t_columns = explode( ',', $t_string );
$t_count = count($t_columns);
@@ -382,19 +382,19 @@ function column_get_title( $p_column ) {
* @access public
*/
function columns_ensure_valid( $p_field_name, $p_columns_to_validate, $p_columns_all ) {
- $t_columns_all_lower = array_map( 'utf8_strtolower', $p_columns_all );
+ $t_columns_all_lower = array_map( 'mb_strtolower', $p_columns_all );
# Check for invalid fields
foreach( $p_columns_to_validate as $t_column ) {
- if( !in_array( utf8_strtolower( $t_column ), $t_columns_all_lower ) ) {
+ if( !in_array( mb_strtolower( $t_column ), $t_columns_all_lower ) ) {
throw new MantisBT\Exception\Columns_Invalid( $p_field_name, $t_column );
}
}
# Check for duplicate fields
$t_columns_no_duplicates = array();
foreach( $p_columns_to_validate as $t_column ) {
- $t_column_lower = utf8_strtolower( $t_column );
+ $t_column_lower = mb_strtolower( $t_column );
if( in_array( $t_column, $t_columns_no_duplicates ) ) {
throw new MantisBT\Exception\Columns_Duplicate( $p_field_name, $t_column );
} else {
@@ -415,11 +415,11 @@ function columns_ensure_valid( $p_field_name, $p_columns_to_validate, $p_columns
* @access public
*/
function columns_remove_invalid( $p_columns, $p_columns_all ) {
- $t_columns_all_lower = array_values( array_map( 'utf8_strtolower', $p_columns_all ) );
+ $t_columns_all_lower = array_values( array_map( 'mb_strtolower', $p_columns_all ) );
$t_columns = array();
foreach( $p_columns as $t_column ) {
- if( in_array( utf8_strtolower( $t_column ), $t_columns_all_lower ) ) {
+ if( in_array( mb_strtolower( $t_column ), $t_columns_all_lower ) ) {
$t_columns[] = $t_column;
}
}
@@ -753,7 +753,7 @@ function custom_field_get_id_from_name( $p_field_name, $p_truncated_length = nul
return $g_cache_name_to_id_map[$p_field_name];
}
- if(( null === $p_truncated_length ) || ( utf8_strlen( $p_field_name ) != $p_truncated_length ) ) {
+ if(( null === $p_truncated_length ) || ( mb_strlen( $p_field_name ) != $p_truncated_length ) ) {
$t_query = "SELECT id FROM {custom_field} WHERE name = %s";
} else {
/** @todo This is to handle the case where we only have a truncated part of the name. This happens in the case where
@@ -1080,7 +1080,7 @@ function custom_field_validate( $p_field_id, $p_value ) {
$t_default_value = $row['default_value'];
$t_valid = true;
- $t_length = utf8_strlen( $p_value );
+ $t_length = mb_strlen( $p_value );
switch ($t_type) {
case CUSTOM_FIELD_TYPE_STRING:
# Regular expression string validation
@@ -94,7 +94,7 @@ function custom_function_default_changelog_print_issue( $p_issue_id, $p_issue_le
}
$t_category = is_blank( $t_category_name ) ? '' : '<strong>[' . string_display_line( $t_category_name ) . ']</strong> ';
- echo utf8_str_pad( '', $p_issue_level * 6, '&#160;' ), '- ', string_get_bug_view_link( $p_issue_id ), ': ', $t_category, string_display_line_links( $t_bug->summary );
+ echo mb_str_pad( '', $p_issue_level * 6, '&#160;' ), '- ', string_get_bug_view_link( $p_issue_id ), ': ', $t_category, string_display_line_links( $t_bug->summary );
if( $t_bug->handler_id != 0 ) {
echo ' (', prepare_user_name( $t_bug->handler_id ), ')';
@@ -143,7 +143,7 @@ function custom_function_default_roadmap_print_issue( $p_issue_id, $p_issue_leve
$t_category = is_blank( $t_category_name ) ? '' : '<strong>[' . string_display_line( $t_category_name ) . ']</strong> ';
- echo utf8_str_pad( '', $p_issue_level * 6, '&#160;' ), '- ', $t_strike_start, string_get_bug_view_link( $p_issue_id ), ': ', $t_category, string_display_line_links( $t_bug->summary );
+ echo mb_str_pad( '', $p_issue_level * 6, '&#160;' ), '- ', $t_strike_start, string_get_bug_view_link( $p_issue_id ), ': ', $t_category, string_display_line_links( $t_bug->summary );
if( $t_bug->handler_id != 0 ) {
echo ' (', prepare_user_name( $t_bug->handler_id ), ')';
View
@@ -187,9 +187,9 @@ function db_table_exists( $p_table_name ) {
$t_tables = db_get_table_list();
# Can't use in_array() since it is case sensitive
- $t_table_name = utf8_strtolower( $p_table_name );
+ $t_table_name = mb_strtolower( $p_table_name );
foreach( $t_tables as $t_current_table ) {
- if( utf8_strtolower( $t_current_table ) == $t_table_name ) {
+ if( mb_strtolower( $t_current_table ) == $t_table_name ) {
return true;
}
}
@@ -215,9 +215,9 @@ function db_index_exists( $p_table_name, $p_index_name ) {
$t_indexes = $g_db->get_indexes( $p_table_name );
# Can't use in_array() since it is case sensitive
- $t_index_name = utf8_strtolower( $p_index_name );
+ $t_index_name = mb_strtolower( $p_index_name );
foreach( $t_indexes as $t_current_index_name => $t_current_index_obj ) {
- if( utf8_strtolower( $t_current_index_name ) == $t_index_name ) {
+ if( mb_strtolower( $t_current_index_name ) == $t_index_name ) {
return true;
}
}
View
@@ -112,9 +112,9 @@ function print_month_option_list( $p_month = 0 ) {
for( $i = 1;$i <= 12;$i++ ) {
$month_name = date( 'F', mktime( 0, 0, 0, $i, 1, 2000 ) );
if( $i == $p_month ) {
- echo "<option value=\"$i\" selected=\"selected\">" . lang_get( 'month_' . utf8_strtolower($month_name)) . "</option>";
+ echo "<option value=\"$i\" selected=\"selected\">" . lang_get( 'month_' . mb_strtolower($month_name)) . "</option>";
} else {
- echo "<option value=\"$i\">" . lang_get( 'month_' . utf8_strtolower($month_name)) . "</option>";
+ echo "<option value=\"$i\">" . lang_get( 'month_' . mb_strtolower($month_name)) . "</option>";
}
}
}
View
@@ -1156,7 +1156,7 @@ function email_format_bug_message( $p_visible_bug_data ) {
# custom fields formatting
foreach( $p_visible_bug_data['custom_fields'] as $t_custom_field_name => $t_custom_field_data ) {
- $t_message .= utf8_str_pad( lang_get_defaulted( $t_custom_field_name, null ) . ': ', $t_email_padding_length, ' ', STR_PAD_RIGHT );
+ $t_message .= mb_str_pad( lang_get_defaulted( $t_custom_field_name, null ) . ': ', $t_email_padding_length, ' ', STR_PAD_RIGHT );
$t_message .= string_custom_field_value_for_email( $t_custom_field_data['value'], $t_custom_field_data['type'] );
$t_message .= " \n";
}
@@ -1241,14 +1241,14 @@ function email_format_bug_message( $p_visible_bug_data ) {
# format history
if( array_key_exists( 'history', $p_visible_bug_data ) ) {
$t_message .= lang_get( 'bug_history' ) . " \n";
- $t_message .= utf8_str_pad( lang_get( 'date_modified' ), 17 ) . utf8_str_pad( lang_get( 'username' ), 15 ) . utf8_str_pad( lang_get( 'field' ), 25 ) . utf8_str_pad( lang_get( 'change' ), 20 ) . " \n";
+ $t_message .= mb_str_pad( lang_get( 'date_modified' ), 17 ) . mb_str_pad( lang_get( 'username' ), 15 ) . mb_str_pad( lang_get( 'field' ), 25 ) . mb_str_pad( lang_get( 'change' ), 20 ) . " \n";
$t_message .= $t_email_separator1 . " \n";
foreach( $p_visible_bug_data['history'] as $t_raw_history_item ) {
$t_localized_item = history_localize_item( $t_raw_history_item['field'], $t_raw_history_item['type'], $t_raw_history_item['old_value'], $t_raw_history_item['new_value'], false );
- $t_message .= utf8_str_pad( date( $t_normal_date_format, $t_raw_history_item['date'] ), 17 ) . utf8_str_pad( $t_raw_history_item['username'], 15 ) . utf8_str_pad( $t_localized_item['note'], 25 ) . utf8_str_pad( $t_localized_item['change'], 20 ) . "\n";
+ $t_message .= mb_str_pad( date( $t_normal_date_format, $t_raw_history_item['date'] ), 17 ) . mb_str_pad( $t_raw_history_item['username'], 15 ) . mb_str_pad( $t_localized_item['note'], 25 ) . mb_str_pad( $t_localized_item['change'], 20 ) . "\n";
}
$t_message .= $t_email_separator1 . " \n\n";
}
@@ -1266,7 +1266,7 @@ function email_format_bug_message( $p_visible_bug_data ) {
*/
function email_format_attribute( $p_visible_bug_data, $p_attribute_id ) {
if( array_key_exists( $p_attribute_id, $p_visible_bug_data ) ) {
- return utf8_str_pad( lang_get( $p_attribute_id ) . ': ', config_get( 'email_padding_length' ), ' ', STR_PAD_RIGHT ) . $p_visible_bug_data[$p_attribute_id] . "\n";
+ return mb_str_pad( lang_get( $p_attribute_id ) . ': ', config_get( 'email_padding_length' ), ' ', STR_PAD_RIGHT ) . $p_visible_bug_data[$p_attribute_id] . "\n";
}
return '';
}
View
@@ -179,7 +179,7 @@ function file_can_delete_bug_attachments( $p_bug_id, $p_uploader_user_id = null
* @return array
*/
function file_get_icon_url( $p_display_filename ) {
- $t_ext = utf8_strtolower( pathinfo( $p_display_filename, PATHINFO_EXTENSION ) );
+ $t_ext = mb_strtolower( pathinfo( $p_display_filename, PATHINFO_EXTENSION ) );
if( $t_ext == '' ) {
return array( 'url' => helper_mantis_url( 'themes/' . config_get( 'theme' ) . '/images/fileicons/generic.png' ), 'alt' => $t_ext );
View
@@ -466,8 +466,8 @@ function filter_ensure_valid_filter( $p_filter_arr ) {
if( !isset( $p_filter_arr['_version'] ) ) {
$p_filter_arr['_version'] = config_get( 'cookie_version' );
}
- $t_cookie_vers = (int) utf8_substr( $p_filter_arr['_version'], 1 );
- if( utf8_substr( config_get( 'cookie_version' ), 1 ) > $t_cookie_vers ) {
+ $t_cookie_vers = (int) mb_substr( $p_filter_arr['_version'], 1 );
+ if( mb_substr( config_get( 'cookie_version' ), 1 ) > $t_cookie_vers ) {
# if the version is old, update it
$p_filter_arr['_version'] = config_get( 'cookie_version' );
}
@@ -627,7 +627,7 @@ function filter_ensure_valid_filter( $p_filter_arr ) {
$t_drop = false;
$t_sort = $t_sort_fields[$i];
if( strpos( $t_sort, 'custom_' ) === 0 ) {
- if( false === custom_field_get_id_from_name( utf8_substr( $t_sort, utf8_strlen( 'custom_' ) ) ) ) {
+ if( false === custom_field_get_id_from_name( mb_substr( $t_sort, mb_strlen( 'custom_' ) ) ) ) {
$t_drop = true;
}
} else {
@@ -929,7 +929,7 @@ function filter_get_query_sort_data( &$p_filter, $p_show_sticky, $p_query_clause
# if sorting by a custom field
if( strpos( $c_sort, 'custom_' ) === 0 ) {
- $t_custom_field = utf8_substr( $c_sort, 7 ); // 7 = length of 'custom_'
+ $t_custom_field = mb_substr( $c_sort, 7 ); // 7 = length of 'custom_'
$t_custom_field_id = custom_field_get_id_from_name( $t_custom_field );
$c_cf_alias = str_replace( ' ', '_', $t_custom_field );
$t_cf_table_alias = $t_custom_field_string_table . '_' . $t_custom_field_id;
@@ -3261,12 +3261,12 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
}
$t_sort = $t_sort_fields[$i];
if( strpos( $t_sort, 'custom_' ) === 0 ) {
- $t_field_name = string_display( lang_get_defaulted( utf8_substr( $t_sort, 7 ) ) ); // 7 = length of 'custom_'
+ $t_field_name = string_display( lang_get_defaulted( mb_substr( $t_sort, 7 ) ) ); // 7 = length of 'custom_'
} else {
$t_field_name = string_get_field_name( $t_sort );
}
- echo $t_field_name . ' ' . lang_get( 'bugnote_order_' . utf8_strtolower( $t_dir_fields[$i] ) );
+ echo $t_field_name . ' ' . lang_get( 'bugnote_order_' . mb_strtolower( $t_dir_fields[$i] ) );
echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_FIELD_NAME, '_', $i, '" value="', $t_sort_fields[$i], '" />';
echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_DIRECTION, '_', $i, '" value="', $t_dir_fields[$i], '" />';
}
@@ -3991,7 +3991,7 @@ function print_filter_custom_field( $p_field_id ) {
if( is_array( $t_accessible_custom_fields_values[$j] ) ) {
$t_max_length = config_get( 'max_dropdown_length' );
foreach( $t_accessible_custom_fields_values[$j] as $t_item ) {
- if(( utf8_strtolower( $t_item ) !== META_FILTER_ANY ) && ( utf8_strtolower( $t_item ) !== META_FILTER_NONE ) ) {
+ if(( mb_strtolower( $t_item ) !== META_FILTER_ANY ) && ( mb_strtolower( $t_item ) !== META_FILTER_NONE ) ) {
echo '<option value="' . string_attribute( $t_item ) . '"';
if( isset( $t_filter['custom_fields'][$p_field_id] ) ) {
check_selected( $t_filter['custom_fields'][$p_field_id], $t_item );
@@ -4019,7 +4019,7 @@ function print_filter_show_sort() {
for( $i = 0;$i < $t_n_fields;$i++ ) {
if( !in_array( $t_fields[$i], array( 'selection', 'edit', 'attachment' ) ) ) {
if( strpos( $t_fields[$i], 'custom_' ) === 0 ) {
- $t_field_name = string_display( lang_get_defaulted( utf8_substr( $t_fields[$i], 7 ) ) ); // 7 = length of 'custom_'
+ $t_field_name = string_display( lang_get_defaulted( mb_substr( $t_fields[$i], 7 ) ) ); // 7 = length of 'custom_'
} else {
$t_field_name = string_get_field_name( $t_fields[$i] );
}
@@ -4577,7 +4577,7 @@ function filter_db_get_available_queries( $p_project_id = null, $p_user_id = nul
* @return bool true when under max_length (64) and false when over
*/
function filter_name_valid_length( $p_name ) {
- if( utf8_strlen( $p_name ) > 64 ) {
+ if( mb_strlen( $p_name ) > 64 ) {
return false;
} else {
return true;
View
@@ -149,7 +149,7 @@ function form_security_validate( $p_form_name ) {
}
# Get the date claimed by the token
- $t_date = utf8_substr( $t_input, 0, 8 );
+ $t_date = mb_substr( $t_input, 0, 8 );
# Check if the token exists
if ( isset( $t_tokens[$p_form_name][$t_date][$t_input] ) ) {
@@ -182,7 +182,7 @@ function form_security_purge( $p_form_name ) {
$t_input = gpc_get_string( $t_form_token, '' );
# Get the date claimed by the token
- $t_date = utf8_substr( $t_input, 0, 8 );
+ $t_date = mb_substr( $t_input, 0, 8 );
# Generate a date string of three days ago
$t_purge_date = date( 'Ymd', time() - ( 3 * 24 * 60 * 60 ) );
@@ -146,7 +146,7 @@ function install_category_migrate() {
foreach( $t_data as $t_project_id => $t_categories ) {
$t_inserted = array();
foreach( $t_categories as $t_name => $t_user_id ) {
- $t_lower_name = utf8_strtolower( trim( $t_name ) );
+ $t_lower_name = mb_strtolower( trim( $t_name ) );
if ( !isset( $t_inserted[$t_lower_name] ) ) {
$query = 'INSERT INTO {category} ( name, project_id, user_id ) VALUES ( %s, %d, %d )';
db_query( $query, array( $t_name, $t_project_id, $t_user_id ) );
View
@@ -86,7 +86,7 @@ function lang_map_auto() {
# Find encoding
foreach( $t_accept_langs as $t_accept_lang ) {
- $t_tmp = explode( ';', utf8_strtolower( $t_accept_lang ) );
+ $t_tmp = explode( ';', mb_strtolower( $t_accept_lang ) );
if( isset( $t_auto_map_exp[trim( $t_tmp[0] )] ) ) {
$t_valid_langs = config_get( 'language_choices_arr' );
Oops, something went wrong.

0 comments on commit 6a165ba

Please sign in to comment.