$user_id = 4;
$table_prepend = "migrate-";
// Getting the content of this entries body
$body_str = <<I've made this post so that I can test to see how well a redirect can be made for a post.Labels: small, test
HERE;
$body_count = strlen($body_str);
// Getting the name of this entries body
$name_str = <<.{1,}<\/p>)/',
'',
$body_str);
// Formatting the date properly
$BlogItemDateTime = '6/12/2008 09:20:00 AM';
$BlogItemDateTime_ar = explode(' ', $BlogItemDateTime);
if($BlogItemDateTime_ar[1] == 'PM') $BlogItemDateTime_ar['hour'][0] += 12;
$BlogItemDateTime_ar['day'] = explode('/', $BlogItemDateTime_ar[0]);
$BlogItemDateTime_ar['hour'] = explode(':', $BlogItemDateTime_ar[1]);
$BlogItemDateTime_ar['mysql'] = $BlogItemDateTime_ar['day'][2].'-'.$BlogItemDateTime_ar['day'][1].'-'.$BlogItemDateTime_ar['day'][0].' '.$BlogItemDateTime_ar['hour'][0].':'.$BlogItemDateTime_ar['hour'][1].':'.$BlogItemDateTime_ar['hour'][2];
$BlogItemDateTime = $BlogItemDateTime_ar['mysql'];
// Insert this entry into the migration table
$body_str = addslashes($body_str);
$DB->query("INSERT INTO `{$table_prepend}evo_items__item` ".
"SET `post_creator_user_ID` = '{$user_id}', ".
"`post_lastedit_user_ID` = '{$user_id}', ".
"`post_datestart` = '{$BlogItemDateTime}', ".
"`post_datecreated` = '{$BlogItemDateTime}', ".
"`post_datemodified` = '{$BlogItemDateTime}', ".
"`post_status` = 'deprecated', ".
"`post_ptyp_ID` = '1', ".
"`post_locale` = 'en-US', ".
"`post_title` = '{$name_str}', ".
"`post_urltitle` = '{$url_str}', ".
"`post_notifications_status` = 'noreq', ".
"`post_comment_status` = 'open', ".
"`post_renderers` = 'default', ".
"`post_priority` = '3', ".
"`post_wordcount` = '{$body_count}', ".
"`post_content` = '{$body_str}'");
// Getting the last inserts ID
$entry_id = $DB->last_insert();
// Going through each of the new categories and adding the relation ship to the database
foreach($categories[1] as $key => $val) {
// Checking to see if this one exists yet
$test_cat = $DB->query("SELECT `cat_ID` FROM `{$table_prepend}evo_categories` WHERE `cat_name` = '{$val}' LIMIT 1", true);
if(!$test_cat['cat_ID']){
// Creating the cat link
$url_str = preg_replace( '/([^\w-])/',
'',
strtolower( str_replace( ' ',
'-',
$val
)
)
);
// If not create it and get its ID
$DB->query("INSERT INTO `{$table_prepend}evo_categories` ".
"SET `cat_name` = '{$val}', ".
" `cat_urlname` = '{$url_str}', ".
" `cat_blog_ID` = '1'");
$test_cat['cat_ID'] = $DB->last_insert();
}
// Insert this entry/category entry
$DB->query("INSERT INTO `{$table_prepend}evo_postcats` ".
"SET `postcat_post_ID` = '{$entry_id}', ".
" `postcat_cat_ID` = '{$test_cat['cat_ID']}'");
// Updating the primary cat key
$DB->query("UPDATE `{$table_prepend}evo_items__item` ".
"SET `post_main_cat_ID` = '{$test_cat['cat_ID']}' ".
"WHERE `post_ID` = '{$entry_id}'");
}
// Getting the content of this comments body
$body_str = <<