diff --git a/wp-admin/import-b2.php b/wp-admin/import-b2.php deleted file mode 100644 index b49095b5ff..0000000000 --- a/wp-admin/import-b2.php +++ /dev/null @@ -1,247 +0,0 @@ - - - - WordPress — b2 Conversion - - - - -

WordPress

- -

Welcome to WordPress. Since you’re upgrading from b2 everything should be relatively - familiar to you. Here are some notes on upgrading:

- -

Have you looked at the readme? If - you’re all ready, let’s go!

- -

Step 1

-

Okay first we’re going to set up the links database. This will allow you to host your own blogroll, complete with Weblogs.com updates.

- -

Installing WP-Links.

-

Checking for tables...

-links) - $got_links = true; - if ($row[0] == $wpdb->linkcategories) - $got_cats = true; - //print "Table: $row[0]
\n"; -} -if (!$got_cats) { - echo "

Can't find table '$wpdb->linkcategories', gonna create it...

\n"; - $sql = "CREATE TABLE $wpdb->linkcategories ( " . - " cat_id int(11) NOT NULL auto_increment, " . - " cat_name tinytext NOT NULL, ". - " auto_toggle enum ('Y','N') NOT NULL default 'N', ". - " PRIMARY KEY (cat_id) ". - ") "; - $result = mysql_query($sql) or print ("Can't create the table '$wpdb->linkcategories' in the database.
" . $sql . "
" . mysql_error()); - if ($result != false) { - echo "

Table '$wpdb->linkcategories' created OK

\n"; - $got_cats = true; - } -} else { - echo "

Found table '$wpdb->linkcategories', don't need to create it...

\n"; - $got_cats = true; -} -if (!$got_links) { - echo "

Can't find '$wpdb->links', gonna create it...

\n"; - $sql = "CREATE TABLE $wpdb->links ( " . - " link_id int(11) NOT NULL auto_increment, " . - " link_url varchar(255) NOT NULL default '', " . - " link_name varchar(255) NOT NULL default '', " . - " link_image varchar(255) NOT NULL default '', " . - " link_target varchar(25) NOT NULL default '', " . - " link_category int(11) NOT NULL default 0, " . - " link_description varchar(255) NOT NULL default '', " . - " link_visible enum ('Y','N') NOT NULL default 'Y', " . - " link_owner int NOT NULL DEFAULT '1', " . - " link_rating int NOT NULL DEFAULT '0', " . - " link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', " . - " link_rel varchar(255) NOT NULL default '', " . - " link_notes MEDIUMTEXT NOT NULL default '', " . - " PRIMARY KEY (link_id) " . - ") "; - $result = mysql_query($sql) or print ("Can't create the table '$wpdb->links' in the database.
" . $sql . "
" . mysql_error()); - $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');"); - $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');"); - $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://zed1.com/b2/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');"); - - if ($result != false) { - echo "

Table '$wpdb->links' created OK

\n"; - $got_links = true; - } -} else { - echo "

Found table '$wpdb->links', don't need to create it...

\n"; - echo "

... may need to update it though. Looking for column link_updated...

\n"; - $query = "SELECT link_updated FROM $wpdb->links LIMIT 1"; - $q = @mysql_query($query); - if ($q != false) { - if ($row = mysql_fetch_object($q)) { - echo "

You have column link_updated. Good!

\n"; - } - } else { - $query = "ALTER TABLE $wpdb->links ADD COLUMN link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'"; - $q = mysql_query($query) or mysql_doh("Doh, couldn't add column.", $query, mysql_error()); - echo "

Added column link_updated...

\n"; - } - echo "

Looking for column link_rel...

\n"; - $query = "SELECT link_rel FROM $wpdb->links LIMIT 1"; - $q = @mysql_query($query); - if ($q != false) { - if ($row = mysql_fetch_object($q)) { - echo "

You have column link_rel. Good!

\n"; - } - } else { - $query = "ALTER TABLE $wpdb->links ADD COLUMN link_rel varchar(255) NOT NULL DEFAULT '' "; - $q = mysql_query($query) or mysql_doh("Doh, couldn't add column.", $query, mysql_error()); - echo "

Added column link_rel...

\n"; - } - $got_links = true; -} - -if ($got_links && $got_cats) { - echo "

Looking for category 1...

\n"; - $sql = "SELECT * FROM $wpdb->linkcategories WHERE cat_id=1 "; - $result = mysql_query($sql) or print ("Can't query '$wpdb->linkcategories'.
" . $sql . "
" . mysql_error()); - if ($result != false) { - if ($row = mysql_fetch_object($result)) { - echo "

You have at least 1 category. Good!

\n"; - $got_row = true; - } else { - echo "

Gonna insert category 1...

\n"; - $sql = "INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'General')"; - $result = mysql_query($sql) or print ("Can't query insert category.
" . $sql . "
" . mysql_error()); - if ($result != false) { - echo "

Inserted category Ok

\n"; - $got_row = true; - } - } - } -} - -if ($got_row) { - echo "

All done!

\n"; -} -?> -

Did you defeat the boss monster at the end? Good, then you’re ready for - Step 2.

- -

Step 2

-

First we’re going to add excerpt, post, and password functionality...

- -posts ADD COLUMN post_excerpt text NOT NULL;"; -$q = $wpdb->query($query); -// 0.71 mods -$query = "ALTER TABLE $wpdb->posts ADD post_status ENUM('publish','draft','private') NOT NULL, -ADD comment_status ENUM('open','closed') NOT NULL, -ADD ping_status ENUM('open','closed') NOT NULL, -ADD post_password varchar(20) NOT NULL;"; -$q = $wpdb->query($query); -?> - -

That went well! Now let's clean up the b2 database structure a bit...

- -posts DROP INDEX ID"; - -$q = $wpdb->query($query); - -?> - -

One down, two to go...

- - -

So far so good.

-posts DROP post_karma"; -$q = $wpdb->query($query); -flush(); -?> - -

Almost there...

- -users DROP INDEX ID"; - -$q = $wpdb->query($query); -upgrade_all(); -?> - -

Welcome to the family. Have fun!

- - - - \ No newline at end of file diff --git a/wp-admin/import-greymatter.php b/wp-admin/import-greymatter.php deleted file mode 100644 index d46a09dd58..0000000000 --- a/wp-admin/import-greymatter.php +++ /dev/null @@ -1,315 +0,0 @@ - - - - -WordPress › Import from GreyMatter - - - -

WordPress

- -\n - $string = str_replace("|*|","
\n",$string); - return($string); - } - - if (!@chdir($archivespath)) - die("Wrong path, $archivespath\ndoesn't exist\non the server"); - - if (!@chdir($gmpath)) - die("Wrong path, $gmpath\ndoesn't exist\non the server"); -?> - -

The importer is running...

- -

 

-

Completed GM 2 WordPress import !

-

Now you can go and log in, have fun !

- - -

This is a basic GreyMatter to WordPress import script.

-

What it does:

- -

What it does not:

- - -

First step: Install WordPress

-

Install the WordPress blog as explained in the ReadMe, then immediately come back here.

- -
- -

Second step: Provide GreyMatter details

- - - - - - - - - -
Path to GM files:
Path to GM entries:
- -

This importer will search for files 00000001.cgi to 000-whatever.cgi, so you need to enter the number of the last GM post here. (If you don't know that number, just log into your FTP and look it up in the entries' folder)

- - - - - - -
Last entry's number:
- -

When you're ready, click OK to start importing:

-
- - - - \ No newline at end of file diff --git a/wp-admin/import-livejournal.php b/wp-admin/import-livejournal.php deleted file mode 100644 index ce766381f6..0000000000 --- a/wp-admin/import-livejournal.php +++ /dev/null @@ -1,124 +0,0 @@ - - - -WordPress › Import from RSS - - - -

WordPress

- -

Howdy! This importer allows you to extract posts from a LiveJournal XML export file. To get started you must edit the following line in this file (import-livejournal.php)

-

define('XMLFILE', '');

-

You want to define where the XML file we'll be working with is, for example:

-

define('XMLFILE', '2002-04.xml');

-

You have to do this manually for security reasons.

-

If you've done that and you’re all ready, let's go!

-previous page to continue."); - -// Bring in the data -set_magic_quotes_runtime(0); -$datalines = file(XMLFILE); // Read the file into an array -$importdata = implode('', $datalines); // squish it -$importdata = str_replace(array("\r\n", "\r"), "\n", $importdata); - -preg_match_all('|(.*?)|is', $importdata, $posts); -$posts = $posts[1]; - -echo '
    '; -foreach ($posts as $post) : -$title = $date = $categories = $content = $post_id = ''; -echo "
  1. Importing post... "; - -preg_match('|(.*?)|is', $post, $title); -$title = $wpdb->escape( trim($title[1]) ); -$post_name = sanitize_title($title); - -preg_match('|(.*?)|is', $post, $date); -$date = strtotime($date[1]); - -$post_date = date('Y-m-d H:i:s', $date); - - -preg_match('|(.*?)|is', $post, $content); -$content = str_replace( array(''), '', $wpdb->escape( trim($content[1]) ) ); - -// Now lets put it in the DB -if ($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'")) : - echo 'Post already imported'; -else : - - $wpdb->query("INSERT INTO $wpdb->posts - (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name) - VALUES - ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name')"); - $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'"); - if (!$post_id) die("couldn't get post ID"); - $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1"); - if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) "); - echo 'Done!
  2. '; -endif; - - -endforeach; -?> -
- -

All done. Have fun!

- - - \ No newline at end of file diff --git a/wp-admin/import-mt.php b/wp-admin/import-mt.php deleted file mode 100644 index 54c7f8a4f8..0000000000 --- a/wp-admin/import-mt.php +++ /dev/null @@ -1,418 +0,0 @@ - - - -WordPress › Import from Movable Type - - - -

WordPress

- -

Howdy! We’re about to begin the process to import all of your Movable Type entries into WordPress. Before we get started, you need to edit this file (import-mt.php) and change one line so we know where to find your MT export file. To make this easy put the import file into the wp-admin directory. Look for the line that says:

-

define('MTEXPORT', '');

-

and change it to

-

define('MTEXPORT', 'import.txt');

-

You have to do this manually for security reasons.

-

If you've done that and you’re all ready, let's go! Remember that the import process may take a minute or so if you have a large number of entries and comments. Think of all the rebuilding time you'll be saving once it's done. :)

-

The importer is smart enough not to import duplicates, so you can run this multiple times without worry if—for whatever reason—it doesn't finish. If you get an out of memory error try splitting up the import file into pieces.

-previous page to continue."); -// Bring in the data -set_magic_quotes_runtime(0); -$importdata = file(MTEXPORT); // Read the file into an array -$importdata = implode('', $importdata); // squish it -$importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata); -$importdata = preg_replace("/\n--------\n/", "--MT-ENTRY--\n", $importdata); -$authors = array(); -$temp = array(); -$posts = explode("--MT-ENTRY--", $importdata); -unset( $importdata ); // Free up memory - -function users_form($n) { - global $wpdb, $testing; - $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID"); - ?> -

admins entries.'); ?>

-

italics. For each of these names, you can either pick an author in your WordPress installation from the menu, or enter a name for the author in the textbox.'); ?>

-

- '; - echo '
'; - $j = -1; - foreach ($authors as $author) { - ++$j; - echo '
  • '.$author.'
    '.''; - users_form($j); - echo '
  • '; - } - echo ''.'
    '; - echo '
    '; - echo ''; - - flush(); - - break; - - case 2: - $newauthornames = array(); - $formnames = array(); - $selectnames = array(); - $mtnames = array(); - foreach($_POST['user'] as $key => $line) { - $newname = trim(stripslashes($line)); - if ($newname == '') $newname = 'left_blank';//passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form. - array_push($formnames,"$newname"); - }// $formnames is the array with the form entered names - foreach ($_POST['userselect'] as $user => $key) { - $selected = trim(stripslashes($key)); - array_push($selectnames,"$selected"); - } - $count = count($formnames); - for ($i = 0; $i < $count; $i++) { - if ( $selectnames[$i] != '#NONE#') {//if no name was selected from the select menu, use the name entered in the form - array_push($newauthornames,"$selectnames[$i]"); - } - else { - array_push($newauthornames,"$formnames[$i]"); - } - } - - $j = -1; - //function to check the authorname and do the mapping - function checkauthor($author) { - global $wpdb, $mtnames, $newauthornames, $j;//mtnames is an array with the names in the mt import file - $md5pass = md5(changeme); - if (!(in_array($author, $mtnames))) { //a new mt author name is found - ++$j; - $mtnames[$j] = $author; //add that new mt author name to an array - $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$newauthornames[$j]'"); //check if the new author name defined by the user is a pre-existing wp user - if (!$user_id) { //banging my head against the desk now. - if ($newauthornames[$j] == 'left_blank') { //check if the user does not want to change the authorname - $wpdb->query("INSERT INTO $wpdb->users (user_level, user_login, user_pass, user_nickname) VALUES ('1', '$author', '$md5pass', '$author')"); // if user does not want to change, insert the authorname $author - $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$author'"); - $newauthornames[$j] = $author; //now we have a name, in the place of left_blank. - } else { - $wpdb->query("INSERT INTO $wpdb->users (user_level, user_login, user_pass, user_nickname) VALUES ('1', '$newauthornames[$j]', '$md5pass', '$newauthornames[$j]')"); //if not left_blank, insert the user specified name - $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$newauthornames[$j]'"); - } - } else return $user_id; // return pre-existing wp username if it exists - } else { - $key = array_search($author, $mtnames); //find the array key for $author in the $mtnames array - $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$newauthornames[$key]'");//use that key to get the value of the author's name from $newauthornames - } - return $user_id; -}//function checkauthor ends here - - //bring in the posts now -set_magic_quotes_runtime(0); -$importdata = file(MTEXPORT); // Read the file into an array -$importdata = implode('', $importdata); // squish it -$importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata); -$importdata = preg_replace("/\n--------\n/", "--MT-ENTRY--", $importdata); -$authors = array(); -$temp = array(); -$posts = explode("--MT-ENTRY--", $importdata); -unset( $importdata ); // Free up memory - -$i = -1; -echo "
      "; -foreach ($posts as $post) { if ('' != trim($post)) { - ++$i; - unset($post_categories); - echo "
    1. Processing post... "; - - // Take the pings out first - preg_match("|(-----\n\nPING:.*)|s", $post, $pings); - $post = preg_replace("|(-----\n\nPING:.*)|s", '', $post); - - // Then take the comments out - preg_match("|(-----\nCOMMENT:.*)|s", $post, $comments); - $post = preg_replace("|(-----\nCOMMENT:.*)|s", '', $post); - - // We ignore the keywords - $post = preg_replace("|(-----\nKEYWORDS:.*)|s", '', $post); - - // We want the excerpt - preg_match("|-----\nEXCERPT:(.*)|s", $post, $excerpt); - $excerpt = $wpdb->escape(trim($excerpt[1])); - $post = preg_replace("|(-----\nEXCERPT:.*)|s", '', $post); - - // We're going to put extended body into main body with a more tag - preg_match("|-----\nEXTENDED BODY:(.*)|s", $post, $extended); - $extended = trim($extended[1]); - if ('' != $extended) $extended = "\n\n$extended"; - $post = preg_replace("|(-----\nEXTENDED BODY:.*)|s", '', $post); - - // Now for the main body - preg_match("|-----\nBODY:(.*)|s", $post, $body); - $body = trim($body[1]); - $post_content = $wpdb->escape($body . $extended); - $post = preg_replace("|(-----\nBODY:.*)|s", '', $post); - - // Grab the metadata from what's left - $metadata = explode("\n", $post); - foreach ($metadata as $line) { - preg_match("/^(.*?):(.*)/", $line, $token); - $key = trim($token[1]); - $value = trim($token[2]); - // Now we decide what it is and what to do with it - switch($key) { - case '': - break; - case 'AUTHOR': - $post_author = $value; - break; - case 'TITLE': - $post_title = $wpdb->escape($value); - echo ''.stripslashes($post_title).'... '; - $post_name = sanitize_title($post_title); - break; - case 'STATUS': - // "publish" and "draft" enumeration items match up; no change required - $post_status = $value; - if (empty($post_status)) $post_status = 'publish'; - break; - case 'ALLOW COMMENTS': - $post_allow_comments = $value; - if ($post_allow_comments == 1) { - $comment_status = 'open'; - } else { - $comment_status = 'closed'; - } - break; - case 'CONVERT BREAKS': - $post_convert_breaks = $value; - break; - case 'ALLOW PINGS': - $post_allow_pings = trim($meta[2][0]); - if ($post_allow_pings == 1) { - $post_allow_pings = 'open'; - } else { - $post_allow_pings = 'closed'; - } - break; - case 'PRIMARY CATEGORY': - $post_categories[] = $wpdb->escape($value); - break; - case 'CATEGORY': - $post_categories[] = $wpdb->escape($value); - break; - case 'DATE': - $post_date = strtotime($value); - $post_date = date('Y-m-d H:i:s', $post_date); - $post_date_gmt = get_gmt_from_date("$post_date"); - break; - default: -// echo "\n$key: $value"; - break; - } // end switch - } // End foreach - - // Let's check to see if it's in already - if ($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$post_title' AND post_date = '$post_date'")) { - echo "Post already imported."; - } else { - $post_author = checkauthor($post_author);//just so that if a post already exists, new users are not created by checkauthor - $wpdb->query("INSERT INTO $wpdb->posts ( - post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_name, post_modified, post_modified_gmt) - VALUES - ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_name','$post_date', '$post_date_gmt')"); - $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$post_title' AND post_date = '$post_date'"); - if (0 != count($post_categories)) { - foreach ($post_categories as $post_category) { - // See if the category exists yet - $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'"); - if (!$cat_id && '' != trim($post_category)) { - $cat_nicename = sanitize_title($post_category); - $wpdb->query("INSERT INTO $wpdb->categories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')"); - $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'"); - } - if ('' == trim($post_category)) $cat_id = 1; - // Double check it's not there already - $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = $cat_id"); - - if (!$exists) { - $wpdb->query(" - INSERT INTO $wpdb->post2cat - (post_id, category_id) - VALUES - ($post_id, $cat_id) - "); - } - } // end category loop - } else { - $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1"); - if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) "); - } - echo " Post imported successfully..."; - // Now for comments - $comments = explode("-----\nCOMMENT:", $comments[0]); - foreach ($comments as $comment) { - if ('' != trim($comment)) { - // Author - preg_match("|AUTHOR:(.*)|", $comment, $comment_author); - $comment_author = $wpdb->escape(trim($comment_author[1])); - $comment = preg_replace('|(\n?AUTHOR:.*)|', '', $comment); - - preg_match("|EMAIL:(.*)|", $comment, $comment_email); - $comment_email = $wpdb->escape(trim($comment_email[1])); - $comment = preg_replace('|(\n?EMAIL:.*)|', '', $comment); - - preg_match("|IP:(.*)|", $comment, $comment_ip); - $comment_ip = trim($comment_ip[1]); - $comment = preg_replace('|(\n?IP:.*)|', '', $comment); - - preg_match("|URL:(.*)|", $comment, $comment_url); - $comment_url = $wpdb->escape(trim($comment_url[1])); - $comment = preg_replace('|(\n?URL:.*)|', '', $comment); - - preg_match("|DATE:(.*)|", $comment, $comment_date); - $comment_date = trim($comment_date[1]); - $comment_date = date('Y-m-d H:i:s', strtotime($comment_date)); - $comment = preg_replace('|(\n?DATE:.*)|', '', $comment); - - $comment_content = $wpdb->escape(trim($comment)); - $comment_content = str_replace('-----', '', $comment_content); - - // Check if it's already there - if (!$wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) { - $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved) - VALUES - ($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1')"); - echo " Comment added."; - } - } - } - - // Finally the pings - // fix the double newline on the first one - $pings[0] = str_replace("-----\n\n", "-----\n", $pings[0]); - $pings = explode("-----\nPING:", $pings[0]); - foreach ($pings as $ping) { - if ('' != trim($ping)) { - // 'Author' - preg_match("|BLOG NAME:(.*)|", $ping, $comment_author); - $comment_author = $wpdb->escape(trim($comment_author[1])); - $ping = preg_replace('|(\n?BLOG NAME:.*)|', '', $ping); - - $comment_email = ''; - - preg_match("|IP:(.*)|", $ping, $comment_ip); - $comment_ip = trim($comment_ip[1]); - $ping = preg_replace('|(\n?IP:.*)|', '', $ping); - - preg_match("|URL:(.*)|", $ping, $comment_url); - $comment_url = $wpdb->escape(trim($comment_url[1])); - $ping = preg_replace('|(\n?URL:.*)|', '', $ping); - - preg_match("|DATE:(.*)|", $ping, $comment_date); - $comment_date = trim($comment_date[1]); - $comment_date = date('Y-m-d H:i:s', strtotime($comment_date)); - $ping = preg_replace('|(\n?DATE:.*)|', '', $ping); - - preg_match("|TITLE:(.*)|", $ping, $ping_title); - $ping_title = $wpdb->escape(trim($ping_title[1])); - $ping = preg_replace('|(\n?TITLE:.*)|', '', $ping); - - $comment_content = $wpdb->escape(trim($ping)); - $comment_content = str_replace('-----', '', $comment_content); - - $comment_content = "$ping_title\n\n$comment_content"; - - // Check if it's already there - if (!$wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) { - $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved, comment_type) - VALUES - ($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1', 'trackback')"); - echo " Comment added."; - } - - } - } - } - echo "
    2. "; - flush(); - -} } -upgrade_all(); -?> -
    -

    All done. Have fun!

    - - - diff --git a/wp-admin/import-rss.php b/wp-admin/import-rss.php deleted file mode 100644 index cb7b615a23..0000000000 --- a/wp-admin/import-rss.php +++ /dev/null @@ -1,191 +0,0 @@ - - - -WordPress › Import from RSS - - - -

    WordPress

    - -

    Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. To get started you must edit the following line in this file (import-rss.php)

    -

    define('RSSFILE', '');

    -

    You want to define where the RSS file we'll be working with is, for example:

    -

    define('RSSFILE', 'rss.xml');

    -

    You have to do this manually for security reasons. When you're done reload this page and we'll take you to the next step.

    - -

    Begin RSS Import »

    - -(.*?)|is', $importdata, $posts); -$posts = $posts[1]; - -echo '
      '; -foreach ($posts as $post) : -$title = $date = $categories = $content = $post_id = ''; -echo "
    1. Importing post... "; - -preg_match('|(.*?)|is', $post, $title); -$title = $wpdb->escape( trim($title[1]) ); -$post_name = sanitize_title($title); - -preg_match('|(.*?)|is', $post, $date); - -if ($date) : - $date = strtotime($date[1]); -else : // if we don't already have something from pubDate - preg_match('|(.*?)|is', $post, $date); - $date = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $date[1]); - $date = str_replace('T', ' ', $date); - $date = strtotime($date); -endif; - -$post_date = gmdate('Y-m-d H:i:s', $date); - -preg_match_all('|(.*?)|is', $post, $categories); -$categories = $categories[1]; - -if (!$categories) : - preg_match_all('|(.*?)|is', $post, $categories); - $categories = $categories[1]; -endif; - -preg_match('|(.*?)|is', $post, $guid); -if ($guid) $guid = $wpdb->escape( trim($guid[1]) ); -else $guid = ''; - -preg_match('|(.*?)|is', $post, $content); -$content = str_replace( array(''), '', $wpdb->escape( trim($content[1]) ) ); - -if (!$content) : // This is for feeds that put content in description - preg_match('|(.*?)|is', $post, $content); - $content = $wpdb->escape( unhtmlentities( trim($content[1]) ) ); -endif; - -// Clean up content -$content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $content); -$content = str_replace('
      ', '
      ', $content); -$content = str_replace('
      ', '
      ', $content); - -// This can mess up on posts with no titles, but checking content is much slower -// So we do it as a last resort -if ('' == $title) : - $dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' AND post_date = '$post_date'"); -else : - $dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'"); -endif; - -// Now lets put it in the DB -if ($dupe) : - echo 'Post already imported'; -else : - - $wpdb->query("INSERT INTO $wpdb->posts - (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name, guid) - VALUES - ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name', '$guid')"); - $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'"); - if (!$post_id) die("couldn't get post ID"); - if (0 != count($categories)) : - foreach ($categories as $post_category) : - $post_category = unhtmlentities($post_category); - // See if the category exists yet - $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'"); - if (!$cat_id && '' != trim($post_category)) { - $cat_nicename = sanitize_title($post_category); - $wpdb->query("INSERT INTO $wpdb->categories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')"); - $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'"); - } - if ('' == trim($post_category)) $cat_id = 1; - // Double check it's not there already - $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = $cat_id"); - - if (!$exists) { - $wpdb->query(" - INSERT INTO $wpdb->post2cat - (post_id, category_id) - VALUES - ($post_id, $cat_id) - "); - } - endforeach; - else: - $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1"); - if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) "); - endif; - echo 'Done!
    2. '; -endif; - - -endforeach; -?> -
    - -

    All done. Have fun!

    - - - \ No newline at end of file diff --git a/wp-admin/import-textpattern.php b/wp-admin/import-textpattern.php deleted file mode 100644 index 18d1610a7e..0000000000 --- a/wp-admin/import-textpattern.php +++ /dev/null @@ -1,138 +0,0 @@ - - - -WordPress › Textpattern Import - - - -

    WordPress

    - -

    This script imports your entries from Textpattern into WordPress. It should be relatively painless, and we hope you're happy with the result.

    -

    To run this, you first need to edit this file (import-textpattern.php) and enter your Textpattern database connection details. Let's check if the database connection information works...

    - -

    Everything seems dandy so far, let's get started!

    - -

    It looks like your database information is incorrect. Please re-edit this file and double-check all the settings.

    - -

    Step 1

    -

    First let's get posts and comments.

    -posts` ADD `post_name` VARCHAR(200) NOT NULL"; -maybe_add_column($wpdb->posts, 'post_name', $query); - -// Create post_name field -$connection = @mysql_connect($tp_database_host, $tp_database_username, $tp_database_password); -$database = @mysql_select_db($tp_database_name); - -// For now we're going to give everything the same author and same category -$author = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_level = 10 LIMIT 1"); -$category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1"); - -$posts = mysql_query('SELECT * FROM textpattern', $connection); - -while ($post = mysql_fetch_array($posts)) { - // ID, AuthorID, LastMod, LastModID, Posted, Title, Body, Body_html, Abstract, Category1, Category2, Annotate, AnnotateInvite, Status, Listing1, Listing2, Section - $posted = $post['Posted']; - // 20030216162119 - $year = substr($posted,0,4); - $month = substr($posted,4,2); - $day = substr($posted,6,2); - $hour = substr($posted,8,2); - $minute = substr($posted,10,2); - $second = substr($posted,12,2); - $timestamp = mktime($hour, $minute, $second, $month, $day, $year); - $posted = date('Y-m-d H:i:s', $timestamp); - - $content = $wpdb->escape($post['Body_html']); - $title = $wpdb->escape($post['Title']); - $post_name = sanitize_title($title); - - $wpdb->query("INSERT INTO $wpdb->posts - (post_author, post_date, post_content, post_title, post_category, post_name, post_status) - VALUES - ('$author', '$posted', '$content', '$title', '$category', '$post_name', 'publish')"); - - // Get wordpress post id - $wp_post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1"); - - // Now let's insert comments if there are any for the TP post - $tp_id = $post['ID']; - $comments = mysql_query("SELECT * FROM txp_Discuss WHERE parentid = $tp_id"); - if ($comments) { - while($comment = mysql_fetch_object($comments)) { - // discussid, parentid, name, email, web, ip, posted, message - // For some reason here "posted" is a real MySQL date, so we don't have to do anything about it - // comment_post_ID comment_author comment_author_email comment_author_url comment_author_IP comment_date comment_content comment_karma - $wpdb->query("INSERT INTO $wpdb->comments - (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content) - VALUES - ($wp_post_ID, '$comment->name', '$comment->email', '$comment->web', '$comment->ip', '$comment->posted', '$comment->message')"); - } - } -} - -upgrade_all(); -?> -

    All done. Wasn’t that fun? Have fun.

    - - - -