CMS Made Simple -> WordPress

Little hacky script that will port CMS Made Simple content to WordPress

Convert News to WP Posts
[php]
## SELECT ALL NEWS ARTICLES FROM CMS SIMPLE W/E
$news_q = mysql_query(“SELECT * FROM `cms_module_news` ORDER BY `news_id` ASC”);
while($news = mysql_fetch_array($news_q)) {

$title = $news[‘news_title’];
$title = str_replace(‘,’, ”, $title);
$title = str_replace(‘.’, ”, $title);
$title = str_replace(‘”‘, ”, $title);
$title = str_replace(‘!’, ”, $title);
$title = str_replace(‘£’, ”, $title);
$title = str_replace(‘$’, ”, $title);
$title = str_replace(‘%’, ”, $title);
$title = str_replace(‘^’, ”, $title);
$title = str_replace(‘&’, ”, $title);
$title = str_replace(‘*’, ”, $title);
$title = str_replace(‘(‘, ”, $title);
$title = str_replace(‘)’, ”, $title);
$title = str_replace(‘_’, ”, $title);
$title = str_replace(‘=’, ”, $title);
$title = str_replace(‘+’, ”, $title);
$title = str_replace(‘/’, ”, $title);
$title = str_replace(‘?’, ”, $title);
$title = str_replace(‘>’, ”, $title);
$title = str_replace(‘<‘, ”, $title);
$title = str_replace(‘|’, ”, $title);
$title = str_replace(‘ ‘, ‘-‘, $title);

$insert = mysql_query(“INSERT INTO `wp_posts` (
`post_author`,
`post_date`,
`post_date_gmt`,
`post_content`,
`post_title`,
`post_excerpt`,
`post_status`,
`comment_status`,
`ping_status`,
`post_password`,
`post_name`,
`to_ping`,
`pinged`,
`post_modified`,
`post_modified_gmt`,
`post_content_filtered`,
`post_parent`,
`guid`,
`menu_order`,
`post_type`,
`post_mime_type`,
`comment_count`
) VALUES(
‘1’,
‘”.$news[‘create_date’].”‘,
‘”.$news[‘create_date’].”‘,
‘”.$news[‘news_data’].”‘,
‘”.$news[‘news_title’].”‘,
‘”.$news[‘summary’].”‘,
‘publish’,
‘open’,
‘open’,
”,
‘”.$title.”‘,
”,
”,
‘”.$news[‘create_date’].”‘,
‘”.$news[‘create_date’].”‘,
”,
‘0’,
”,
‘0’,
‘post’,
”,
‘0’)”);
echo $title.’
‘;
}
echo ‘

done inserting news posts‘;
[/php]

Convert page content into WP Pages
[php]
$pages_q = mysql_query(“SELECT * FROM `cms_content` ORDER BY `content_id` ASC”);
while($pages = mysql_fetch_array($pages_q)) {

$title = $pages[‘content_name’];
$title = str_replace(‘,’, ”, $title);
$title = str_replace(‘.’, ”, $title);
$title = str_replace(‘”‘, ”, $title);
$title = str_replace(‘!’, ”, $title);
$title = str_replace(‘£’, ”, $title);
$title = str_replace(‘$’, ”, $title);
$title = str_replace(‘%’, ”, $title);
$title = str_replace(‘^’, ”, $title);
$title = str_replace(‘&’, ”, $title);
$title = str_replace(‘*’, ”, $title);
$title = str_replace(‘(‘, ”, $title);
$title = str_replace(‘)’, ”, $title);
$title = str_replace(‘_’, ”, $title);
$title = str_replace(‘=’, ”, $title);
$title = str_replace(‘+’, ”, $title);
$title = str_replace(‘/’, ”, $title);
$title = str_replace(‘?’, ”, $title);
$title = str_replace(‘>’, ”, $title);
$title = str_replace(‘<‘, ”, $title);
$title = str_replace(‘|’, ”, $title);
$title = str_replace(‘ ‘, ‘-‘, $title);
$title = str_replace(‘`’, ”, $title);

## GET THE CONTENT FOR EACH PAGE
$content_q = mysql_query(“SELECT * FROM `cms_content_props` WHERE `content_id` = ‘”.$pages[‘content_id’].”‘”);
$content = mysql_fetch_array($content_q);

$insert_page = mysql_query(“INSERT INTO `wp_posts` (
`post_author`,
`post_date`,
`post_date_gmt`,
`post_content`,
`post_title`,
`post_excerpt`,
`post_status`,
`comment_status`,
`ping_status`,
`post_password`,
`post_name`,
`to_ping`,
`pinged`,
`post_modified`,
`post_modified_gmt`,
`post_content_filtered`,
`post_parent`,
`guid`,
`menu_order`,
`post_type`,
`post_mime_type`,
`comment_count`
) VALUES(
‘1’,
‘”.$pages[‘create_date’].”‘,
‘”.$pages[‘create_date’].”‘,
‘”.strip_tags($content[‘content’]).”‘,
‘”.$pages[‘content_name’].”‘,
”,
‘publish’,
‘open’,
‘open’,
”,
‘”.$title.”‘,
”,
”,
‘”.$pages[‘create_date’].”‘,
‘”.$pages[‘create_date’].”‘,
”,
‘0’,
”,
‘0’,
‘page’,
”,
‘0’)”);
echo ‘inserting : ‘.$title.’
‘;
echo strip_tags($content[‘content’]).’

‘;
}
echo ‘done’;
[/php]