', $results); } //Some \n chars on empty fields should be removed from body_extended and excerpt //What about the new title_html field? //Fields that are on MT format, but have not sense for blogger are commented function import_blogger_item($item, $section, $status, $invite) { # Untested import code follows if (empty($item)) return; include_once txpath.'/lib/classTextile.php'; $textile = new Textile(); $title = $textile->TextileThis($item['TITLE'], 1); $url_title = stripSpace($title,1); $body = $item['BODY'][0]['content']; $body_html = $textile->textileThis($body, 1); $date = strtotime($item['DATE']); $date = date('Y-m-d H:i:s', $date); if (isset($item['STATUS'])) $post_status = ($item['STATUS'] == 'Draft' ? 1 : 4); else $post_status = $status; //Bogger can use special chars on author names. Strip them and check for realname $authorid = safe_field('user_id', 'txp_users', "RealName = '".doSlash($item['AUTHOR'])."'"); if (!$authorid) // $authorid = safe_field('user_id', 'txp_users', 'order by user_id asc limit 1'); //Add new authors safe_insert('txp_users', "name='".doSlash(stripSpace($textile->TextileThis($item['AUTHOR'],1)))."', RealName='".doSlash($item['AUTHOR'])."'"); if (!safe_field("ID", "textpattern", "Title = '".doSlash($title)."' AND Posted = '".doSlash($date)."'")) { safe_insert('textpattern', "Posted='".doSlash($date)."',". "LastMod='".doSlash($date)."',". "AuthorID='".doSlash($item['AUTHOR'])."',". "LastModID='".doSlash($item['AUTHOR'])."',". "Title='".doSlash($title)."',". "Body='".doSlash($body)."',". "Body_html='".doSlash($body_html)."',". "AnnotateInvite='".doSlash($invite)."',". "Status='".doSlash($post_status)."',". "Section='".doSlash($section)."',". "uid='".md5(uniqid(rand(),true))."',". "feed_time='".substr($date,0,10)."',". "url_title='".doSlash($url_title)."'"); $parentid = mysql_insert_id(); if (!empty($item['COMMENT'])) { foreach ($item['COMMENT'] as $comment) { $comment_date = date('Y-m-d H:i:s', strtotime(@$comment['DATE'])); $comment_content = $textile->TextileThis(nl2br(@$comment['content']),1); //Check for Comments authors if (preg_match('/(.*)<\/a>/', @$comment['AUTHOR'], $match)) { @$comment['URL'] = $match[1]; @$comment['AUTHOR'] = $match[2]; } if (!safe_field("discussid","txp_discuss","posted = '".doSlash($comment_date)."' AND message = '".doSlash($comment_content)."'")) { safe_insert('txp_discuss', "parentid='".doSlash($parentid)."',". //blogger places the link to user profile page as comment author "name='".doSlash(strip_tags(@$comment['AUTHOR']))."',". // "email='".doSlash(@$item['EMAIL'])."',". "web='".doSlash(@$comment['URL'])."',". // "ip='".doSlash(@$item['IP'])."',". "posted='".doSlash($comment_date)."',". "message='".doSlash($comment_content)."',". "visible='1'"); } } } return $title; } return $title.' already imported'; } ?>