includes/lang.php
changeset 372 5bd429428101
parent 371 dc6026376919
child 376 66732bd4532c
--- a/includes/lang.php	Wed Jan 23 12:48:22 2008 -0500
+++ b/includes/lang.php	Thu Jan 24 22:06:09 2008 -0500
@@ -89,7 +89,8 @@
     }
     
     $lang_default = ( $x = getConfig('default_language') ) ? intval($x) : '\'def\'';
-    $q = $db->sql_query("SELECT lang_id, lang_code, last_changed, ( lang_id = $lang_default ) AS is_default FROM " . table_prefix . "language WHERE $sql_col OR lang_id = $lang_default ORDER BY is_default DESC LIMIT 1;");
+    
+    $q = $db->sql_query("SELECT lang_id, lang_code, last_changed, ( lang_id = $lang_default ) AS is_default FROM " . table_prefix . "language WHERE $sql_col OR lang_id = $lang_default ORDER BY is_default ASC LIMIT 1;");
     
     if ( !$q )
       $db->_die('lang.php - main select query');
@@ -320,18 +321,7 @@
     $contents = preg_replace('/\}([^}]+)$/', '}', $contents);
     
     // Correct syntax to be nice to the json parser
-    
-    // eliminate comments
-    $contents = preg_replace(array(
-            // eliminate single line comments in '// ...' form
-            '#^\s*//(.+)$#m',
-            // eliminate multi-line comments in '/* ... */' form, at start of string
-            '#^\s*/\*(.+)\*/#Us',
-            // eliminate multi-line comments in '/* ... */' form, at end of string
-            '#/\*(.+)\*/\s*$#Us'
-          ), '', $contents);
-    
-    $contents = preg_replace('/([,\{\[])([\s]*?)([a-z0-9_]+)([\s]*?):/', '\\1\\2"\\3" :', $contents);
+    $contents = enano_clean_json($contents);
     
     try
     {