From e9becfa669f9d7e64440992daeaf937388d26686 Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 9 Oct 2007 01:43:29 +0000 Subject: - PWG_CHARSET, DB_CHARSET and DB_COLLATE... utf-8 ready git-svn-id: http://piwigo.org/svn/trunk@2127 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/common.inc.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/common.inc.php') diff --git a/include/common.inc.php b/include/common.inc.php index 18053e3ae..50c0d73fa 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -144,6 +144,23 @@ or die ( "Could not connect to database server" ); mysql_select_db( $cfgBase ) or die ( "Could not connect to database" ); +defined('PWG_CHARSET') and defined('DB_CHARSET') + or die('PWG_CHARSET and/or DB_CHARSET is not defined'); +if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) +{ + if (DB_CHARSET!='') + { + pwg_query('SET NAMES "'.DB_CHARSET.'"'); + } +} +else +{ + if ( strtolower(PWG_CHARSET)!='iso-8859-1' ) + { + die('PWG supports only iso-8859-1 charset on MySql version '.mysql_get_server_info()); + } +} + // // Setup gallery wide options, if this fails then we output a CRITICAL_ERROR // since basic gallery information is not available -- cgit v1.2.3