diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/catalog.class.php | 5 | ||||
-rw-r--r-- | lib/class/dba.class.php | 19 | ||||
-rw-r--r-- | lib/class/update.class.php | 34 |
3 files changed, 47 insertions, 11 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index c6d3e1a0..72a24b5f 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -1915,11 +1915,8 @@ class Catalog { /* If not found create */ elseif (!$readonly) { - $prefix_txt = 'NULL'; - if ($prefix) { - $prefix_txt = "'$prefix'"; - } + $prefix_txt = $prefix ? "'$prefix'" : 'NULL'; $sql = "INSERT INTO `album` (`name`, `prefix`,`year`,`disk`) VALUES ('$album',$prefix_txt,'$album_year','$album_disk')"; $db_results = Dba::query($sql); diff --git a/lib/class/dba.class.php b/lib/class/dba.class.php index 6ead8b8b..62df46fe 100644 --- a/lib/class/dba.class.php +++ b/lib/class/dba.class.php @@ -262,6 +262,21 @@ class Dba { // MySQL translte real charset names into fancy smancy MySQL land names switch (strtoupper(Config::get('site_charset'))) { + case 'CP1250': + case 'WINDOWS-1250': + case 'WINDOWS-1252': + $target_charset = 'cp1250'; + $target_collation = 'cp1250_general_ci'; + break; + case 'ISO-8859': + case 'ISO-8859-2': + $target_charset = 'latin2'; + $target_collation = 'latin2_general_ci'; + break; + case 'ISO-8859-1': + $target_charset = 'latin1'; + $target_charset = 'latin1_general_ci'; + break; case 'EUC-KR': $target_charset = 'euckr'; $target_collation = 'euckr_korean_ci'; @@ -278,10 +293,6 @@ class Dba { $target_charset = 'koi8r'; $target_collation = 'koi8r_general_ci'; break; - case 'ISO-8859': - $target_charset = 'latin2'; - $target_collation = 'latin2_general_ci'; - break; default; case 'UTF-8': $target_charset = 'utf8'; diff --git a/lib/class/update.class.php b/lib/class/update.class.php index 1a96b978..23fac871 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -269,10 +269,11 @@ class Update { $version[] = array('version' => '340016','description'=>$update_string); - $update_string = '- Attempt to correct the charset of all columns in the database.<br />'; + $update_string = '- Fix Tables for new Democratic Play methodology.<br />'; $version[] = array('version' => '340017','description'=>$update_string); + return $version; } // populate_version @@ -1206,9 +1207,36 @@ class Update { $sql = "TRUNCATE `democratic`"; $db_results = Dba::query($sql); + + self::set_version('db_version','340017'); + + } // update_340017 + + /** + * update_340018 + * This attempts to correct the charset on your database, it does some checking + * to make sure that if we do this it will actually will work. We will fail this update + * if it would cause problems + */ + public static function update_340018() { // MySQL translte real charset names into fancy smancy MySQL land names switch (strtoupper(Config::get('site_charset'))) { + case 'CP1250': + case 'WINDOWS-1250': + case 'WINDOWS-1252': + $target_charset = 'cp1250'; + $target_collation = 'cp1250_general_ci'; + break; + case 'ISO-8859': + case 'ISO-8859-2': + $target_charset = 'latin2'; + $target_collation = 'latin2_general_ci'; + break; + case 'ISO-8859-1': + $target_charset = 'latin1'; + $target_charset = 'latin1_general_ci'; + break; case 'EUC-KR': $target_charset = 'euckr'; $target_collation = 'euckr_korean_ci'; @@ -1265,9 +1293,9 @@ class Update { } // end tables - self::set_version('db_version','340017'); + //self::set_version('db_version','340018'); - } // update_340017 + } // update_340018 } // end update class ?> |