Changeset 847 for trunk/wp-admin/import-mt.php
- Timestamp:
- 02/09/2004 08:41:08 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/import-mt.php
r757 r847 81 81 echo "<li>Importing post... "; 82 82 83 // Take the comments out first 83 // Take the pings out first 84 preg_match("|(-----\n\nPING:.*)|s", $post, $pings); 85 $post = preg_replace("|(-----\n\nPING:.*)|s", '', $post); 86 87 // Then take the comments out 84 88 preg_match("|(-----\nCOMMENT:.*)|s", $post, $comments); 85 89 $post = preg_replace("|(-----\nCOMMENT:.*)|s", '', $post); … … 131 135 $post_allow_comments = $value; 132 136 if ($post_allow_comments == 1) { 133 $ post_allow_comments = "open";137 $comment_status = 'open'; 134 138 } else { 135 $ post_allow_comments = "closed";139 $comment_status = 'closed'; 136 140 } 137 141 break; … … 142 146 $post_allow_pings = trim($meta[2][0]); 143 147 if ($post_allow_pings == 1) { 144 $post_allow_pings = "open";148 $post_allow_pings = 'open'; 145 149 } else { 146 $post_allow_pings = "closed";150 $post_allow_pings = 'closed'; 147 151 } 148 152 break; … … 223 227 $comment_date = date('Y-m-d H:i:s', strtotime($comment_date)); 224 228 $comment = preg_replace('|(\n?DATE:.*)|', '', $comment); 225 229 226 230 $comment_content = addslashes(trim($comment)); 227 231 $comment_content = str_replace('-----', '', $comment_content); 228 232 229 233 // Check if it's already there 230 234 if (!$wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) { … … 234 238 echo " Comment added."; 235 239 } 240 } 241 } 242 243 // Finally the pings 244 // fix the double newline on the first one 245 $pings[0] = str_replace("-----\n\n", "-----\n", $pings[0]); 246 $pings = explode("-----\nPING:", $pings[0]); 247 foreach ($pings as $ping) { 248 if ('' != trim($ping)) { 249 // 'Author' 250 preg_match("|BLOG NAME:(.*)|", $ping, $comment_author); 251 $comment_author = addslashes(trim($comment_author[1])); 252 $ping = preg_replace('|(\n?BLOG NAME:.*)|', '', $ping); 253 254 $comment_email = ''; 255 256 preg_match("|IP:(.*)|", $ping, $comment_ip); 257 $comment_ip = trim($comment_ip[1]); 258 $ping = preg_replace('|(\n?IP:.*)|', '', $ping); 259 260 preg_match("|URL:(.*)|", $ping, $comment_url); 261 $comment_url = addslashes(trim($comment_url[1])); 262 $ping = preg_replace('|(\n?URL:.*)|', '', $ping); 263 264 preg_match("|DATE:(.*)|", $ping, $comment_date); 265 $comment_date = trim($comment_date[1]); 266 $comment_date = date('Y-m-d H:i:s', strtotime($comment_date)); 267 $ping = preg_replace('|(\n?DATE:.*)|', '', $ping); 268 269 preg_match("|TITLE:(.*)|", $ping, $ping_title); 270 $ping_title = addslashes(trim($ping_title[1])); 271 $ping = preg_replace('|(\n?TITLE:.*)|', '', $ping); 272 273 $comment_content = addslashes(trim($ping)); 274 $comment_content = str_replace('-----', '', $comment_content); 275 276 $comment_content = "<trackback /><strong>$ping_title</strong>\n$comment_content"; 277 278 // Check if it's already there 279 if (!$wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) { 280 $wpdb->query("INSERT INTO $tablecomments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved) 281 VALUES 282 ($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1')"); 283 echo " Comment added."; 284 } 285 236 286 } 237 287 }
Note: See TracChangeset
for help on using the changeset viewer.