]> git.mjollnir.org Git - s9y.git/commitdiff
Patch further
authorgarvinhicking <garvinhicking>
Fri, 19 Oct 2007 14:26:12 +0000 (14:26 +0000)
committergarvinhicking <garvinhicking>
Fri, 19 Oct 2007 14:26:12 +0000 (14:26 +0000)
include/admin/import.inc.php
include/admin/importers/wordpress.inc.php

index 17bd3cbcd99ebe4851d0eea22f62b52530137729..f0b4333a4d8b26bdad87adc5f6efae5c03fedf9e 100644 (file)
@@ -167,8 +167,31 @@ class Serendipity_Import {
         global $serendipity;
 
         mysql_select_db($this->data['name'], $db);
+        $dbn = false;
+
+        $target = $this->data['charset'];
+
+        switch($target) {
+            case 'native':
+                $dbn = SQL_CHARSET;
+                break;
+
+            case 'ISO-8859-1':
+                $dbn = 'latin1';
+                break;
+            
+            case 'UTF-8':
+                $dbn = 'utf8';
+                break;
+        }
+        
+        if ($dbn && $serendipity['dbNames']) {
+            mysql_query("SET NAMES " . $dbn, $db);
+        }
+       
         $return = &mysql_query($query, $db);
-        mysql_select_db($serendipity['dbName'], $serendipity['dbConn']);        $return = &mysql_query($query, $db);
+        mysql_select_db($serendipity['dbName'], $serendipity['dbConn']);
+        serendipity_db_reconnect();
         return $return;
     }
 }
index b9ba7187483cec024df2479d2f8d8b1887f65b55..3c0cba5c43c69a12d9398091020e959d840cd588 100644 (file)
@@ -214,7 +214,7 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
                                         ON taxonomy.term_id = terms.term_id
 
                                      WHERE taxonomy.taxonomy = 'category' 
-                                  ORDER BY taxonomy.parent, taxonomy.term_taxonomy", $wpdb);
+                                  ORDER BY taxonomy.parent, taxonomy.term_taxonomy_id", $wpdb);
         if (!$res && !$no_cat) {
             $no_cat = mysql_error($wpdb);
         } elseif ($res) {
@@ -332,8 +332,9 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
                                            rel.term_taxonomy_id AS category_id 
                                       FROM {$this->data['prefix']}term_relationships AS rel;", $wpdb);
         if (!$res && !$no_entrycat) {
-            printf(COULDNT_SELECT_ENTRY_INFO, mysql_error($wpdb));
+            $no_entrycat = mysql_error($wpdb);
         } elseif ($res) {
+            $no_entrycat = false;
             if ($debug) echo "Importing category associations (WP 2.3 style)...<br />\n";
             while ($a = mysql_fetch_assoc($res)) {
                 $data = array('entryid'    => $assoc['entries'][$a['post_id']],
@@ -344,7 +345,7 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
         }
 
         if ($no_entrycat) {
-            printf(COULDNT_SELECT_ENTRY_INFO, mysql_error($wpdb));
+            printf(COULDNT_SELECT_ENTRY_INFO, $no_entrycat);
         }
 
         /* Comments */
@@ -366,11 +367,10 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
                                  'subscribed'=> 'false',
                                  'body'      => $a['comment_content'],
                                  'type'      => 'NORMAL');
-    
                 serendipity_db_insert('comments', $this->strtrRecursive($comment));
                 if ($comment['status'] == 'approved') {
                     $cid = serendipity_db_insert_id('comments', 'id');
-                    serendipity_approveComment($cid, $comment['entry_id'], true);
+                    serendipity_approveComment($cid, $assoc['entries'][$a['comment_post_ID']], true);
                 }
             }
             if ($debug) echo "Imported comments.<br />\n";