$bgy/$bgmm ";
-
- $posts = explode("",$archive);
-
- for ($i = 1; $i < (count($posts)+1); $i = $i + 1) {
-
- $postinfo=explode("|||",$posts[$i]);
- $post_date=$postinfo[0];
- $post_content=$postinfo[2];
- $post_number=$postinfo[3];
-
- $post_author=trim(addslashes($postinfo[1]));
- // we'll check the author is registered already
- $sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
- $result = mysql_query($sql);
- if (!mysql_num_rows($result)) { // seems s/he's not, so let's register
- $user_ip="127.0.0.1";
- $user_domain="localhost";
- $user_browser="server";
- $user_joindate="1979-06-06 00:41:00"; // that's my birthdate (gmt+1) - I could choose any other date. You could change the date too. Just remember the year must be >=1970 or the world would just randomly fall on your head (everything might look fine, and then blam! major headache!)
- $user_login=addslashes($post_author);
- $pass1=addslashes("password");
- $user_nickname=addslashes($post_author);
- $user_email=addslashes("user@cafelog.com");
- $user_url=addslashes("");
- $user_joindate=addslashes($user_joindate);
- $query = "INSERT INTO $tableusers (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')";
- $result = mysql_query($query);
- if ($result==false) {
- die ("ERROR: couldn't register an user... please contact the webmaster !");
- }
- echo ": registered user $user_login";
- }
-
- $sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
- $result = mysql_query($sql);
- $myrow = mysql_fetch_array($result);
- $post_author_ID=$myrow[0];
-
- $post_date = explode(" ",$post_date);
- $post_date_Ymd = explode("/", $post_date[0]);
- $postyear=$post_date_Ymd[2];
- $postmonth=zeroise($post_date_Ymd[0],2);
- $postday=zeroise($post_date_Ymd[1],2);
- $post_date_His = explode(":", $post_date[1]);
- $posthour=zeroise($post_date_His[0],2);
- $postminute=zeroise($post_date_His[1],2);
- $postsecond=zeroise($post_date_His[2],2);
-
- if (($post_date[2]=="PM") && ($posthour!="12"))
- $posthour=$posthour+12;
-
- $post_date="$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
-
- $post_content=addslashes($post_content);
- $post_content=str_replace(" "," ",$post_content); // the XHTML touch... ;)
-
- $post_title="";
-
- $query = "INSERT INTO $tableposts (ID, post_author,post_date,post_content,post_title,post_category) VALUES ('$post_number','$post_author_ID','$post_date','$post_content','$post_title','1')";
- $result = mysql_query($query) or die(mysql_error());
-
- if (!$result)
- die ("Error in posting... contact the webmaster");
-
-
- } echo "... Done
";
-
- }}
- }
-
- /* we've still got a bug that adds some empty posts with the date 0000-00-00 00:00:00
- here's the bugfix: */
- $query="DELETE FROM $tableposts WHERE post_date=\"0000-00-00 00:00:00\"";
- $result = mysql_query($query) or die(mysql_error());
-
-
- ?>
-
parses your archives to retrieve your blogger posts
-
adds an author whenever it sees a new nickname, all authors are imported at level 1, with a default profile and the password 'password'
-
-
What it does not:
-
-
it sucks at making coffee, and is not toilet-trained yet
-
-
-
-
First step: install b2
-
Install the b2 blog as explained in the ReadMe, then immediately come back here.
-
-
Second step: let's play with Blogger
-
Log into your Blogger account.
-Go to the Settings, and make Blogger publish your files in the directory where your b2 resides. Change the Date/Time format to be mm/dd/yyyy hh:mm:ss AM/PM (the first choice in the dropdown menu). In Archives: set the frequency to 'monthly' and the archive filename to 'cafelog.php' (without the quotes), set the ftp archive path to make Blogger publish the archives in your b2 directory. Click 'save changes'.
-Go to the Templates. Replace your existing template with this line (copy and paste):
-
-Go to the Archives, and click 'republish all'.
-Check in your FTP that you've got the archive files published. They should look like this example: 2001_10_01_cafelog.php. If they aren't there, redo the republish process.
You're done with the hard part. :)
-
-
-
-
-
-
\ No newline at end of file
diff --git a/blogger-2-wp.php b/blogger-2-wp.php
new file mode 100644
index 0000000000..e5e151b90d
--- /dev/null
+++ b/blogger-2-wp.php
@@ -0,0 +1,213 @@
+
+
+
+ Blogger to WordPress - Converting...
+
+
+
+
+
Blogger to
+
The importer is running...
+
+
Importing posts and users
+
$bgy/$bgmm ";
+
+ $posts = explode('', $archive);
+
+ for ($i = 1; $i < (count($posts)+1); $i = $i + 1) {
+
+ $postinfo = explode('|||', $posts[$i]);
+ $post_date = $postinfo[0];
+ $post_content = $postinfo[2];
+ $post_number = $postinfo[3];
+
+ $post_author = trim(addslashes($postinfo[1]));
+ // we'll check the author is registered already
+ $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE user_login = '$post_author'");
+ if (!$user) { // seems s/he's not, so let's register
+ $user_ip = '127.0.0.1';
+ $user_domain = 'localhost';
+ $user_browser = 'server';
+ $user_joindate = '1979-06-06 00:41:00'; // that's my birthdate (gmt+1) - I could choose any other date. You could change the date too. Just remember the year must be >=1970 or the world would just randomly fall on your head (everything might look fine, and then blam! major headache!)
+ $user_login = addslashes($post_author);
+ $pass1 = addslashes('password');
+ $user_nickname = addslashes($post_author);
+ $user_email = addslashes('user@cafelog.com');
+ $user_url = addslashes('');
+ $user_joindate = addslashes($user_joindate);
+ $result = $wpdb->query("
+ INSERT INTO $tableusers (
+ user_login,
+ user_pass,
+ user_nickname,
+ user_email,
+ user_url,
+ user_ip,
+ user_domain,
+ user_browser,
+ dateYMDhour,
+ user_level,
+ user_idmode
+ ) VALUES (
+ '$user_login',
+ '$pass1',
+ '$user_nickname',
+ '$user_email',
+ '$user_url',
+ '$user_ip',
+ '$user_domain',
+ '$user_browser',
+ '$user_joindate',
+ '1',
+ 'nickname'
+ )");
+
+ echo ": Registered user $user_login";
+ }
+
+ $post_author_ID = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$post_author'");
+
+ $post_date = explode(' ', $post_date);
+ $post_date_Ymd = explode('/', $post_date[0]);
+ $postyear = $post_date_Ymd[2];
+ $postmonth = zeroise($post_date_Ymd[0], 2);
+ $postday = zeroise($post_date_Ymd[1], 2);
+ $post_date_His = explode(':', $post_date[1]);
+ $posthour = zeroise($post_date_His[0], 2);
+ $postminute = zeroise($post_date_His[1], 2);
+ $postsecond = zeroise($post_date_His[2], 2);
+
+ if (($post_date[2] == 'PM') && ($posthour != '12'))
+ $posthour = $posthour + 12;
+
+ $post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
+
+ $post_content = addslashes($post_content);
+ $post_content = str_replace(' ', ' ', $post_content); // the XHTML touch... ;)
+
+ $post_title = '';
+
+ $result = $wpdb->query("
+ INSERT INTO $tableposts
+ (ID, post_author,post_date,post_content,post_title,post_category)
+ VALUES
+ ('$post_number','$post_author_ID','$post_date','$post_content','$post_title','1')
+ ");
+
+
+ } echo '... Done
';
+
+ }}
+ }
+
+ /* we've still got a bug that adds some empty posts with the date 0000-00-00 00:00:00
+ here's the bugfix: */
+ $result = $wpdb->query("DELETE FROM $tableposts WHERE post_date=\"0000-00-00 00:00:00\"");
+
+
+ ?>
+
This is a basic Blogger to WordPress import script.
+
What it does:
+
+
Parses your archives to retrieve your blogger posts.
+
Adds an author whenever it sees a new nickname, all authors are imported at level 1, with a default profile and the password 'password'
+
+
What it does not:
+
+
It sucks at making coffee.
+
It always forgets to call back.
+
+
+
First step: Install WordPress
+
Install the WordPress blog as explained in the read me, then immediately come back here.
+
+
Second step: let's play with Blogger
+
Log into your Blogger account.
+Go to the Settings, and make Blogger publish your files in the directory where your b2 resides. Change the Date/Time format to be mm/dd/yyyy hh:mm:ss AM/PM (the first choice in the dropdown menu). In Archives: set the frequency to 'monthly' and the archive filename to 'cafelog.php' (without the quotes), set the ftp archive path to make Blogger publish the archives in your b2 directory. Click 'save changes'.
+Go to the Templates. Replace your existing template with this line (copy and paste):
+
+Go to the Archives, and click 'republish all'.
+Check in your FTP that you've got the archive files published. They should look like this example: 2001_10_01_cafelog.php. If they aren't there, redo the republish process.
+