/**
 * Initialization of some internal default values in the internationalization library.
 * @return void
 * Note: This function should be called only once in the global initialization script.
 */
function api_initialize_internationalization()
{
    if (MBSTRING_INSTALLED) {
        @ini_set('mbstring.func_overload', 0);
        @ini_set('mbstring.encoding_translation', 0);
        @ini_set('mbstring.http_input', 'pass');
        @ini_set('mbstring.http_output', 'pass');
        @ini_set('mbstring.language', 'neutral');
    }
    api_set_internationalization_default_encoding('UTF-8');
}
Пример #2
0
/* Initialization of the default encodings */
// The platform's character set must be retrieved at this early moment.
$sql = "SELECT selected_value FROM settings_current WHERE variable = 'platform_charset';";
$result = Database::query($sql);
while ($row = @Database::fetch_array($result)) {
    $charset = $row[0];
}
if (empty($charset)) {
    $charset = 'UTF-8';
}
// Preserving the value of the global variable $charset.
$charset_initial_value = $charset;
// Initialization of the internationalization library.
api_initialize_internationalization();
// Initialization of the default encoding that will be used by the multibyte string routines in the internationalization library.
api_set_internationalization_default_encoding($charset);
// Initialization of the database encoding to be used.
Database::query("SET SESSION character_set_server='utf8';");
Database::query("SET SESSION collation_server='utf8_general_ci';");
if (api_is_utf8($charset)) {
    // See Bug #1802: For UTF-8 systems we prefer to use "SET NAMES 'utf8'" statement in order to avoid a bizarre problem with Chinese language.
    Database::query("SET NAMES 'utf8';");
} else {
    Database::query("SET CHARACTER SET '" . Database::to_db_encoding($charset) . "';");
}
// Start session after the internationalization library has been initialized.
Chamilo::session()->start($already_installed);
// Remove quotes added by PHP  - get_magic_quotes_gpc() is deprecated in PHP 5 see #2970
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
    array_walk_recursive_limited($_GET, 'stripslashes', true);
    array_walk_recursive_limited($_POST, 'stripslashes', true);