link; mysql_select_db($txpdb,$txplink); include txpath.'/lib/classTextile.php'; $textile = new Textile; if (!empty($articles)) { foreach($articles as $a){ if (is_callable('utf8_encode')) { // Also fixing break-tags for users with b2s Auto-BR $a['Body'] = utf8_encode(str_replace("
\n","\n",stripslashes($a['Body']))); $a['Title'] = utf8_encode(stripslashes($a['Title'])); $a['Title'] = $textile->TextileThis($a['Title'],'',1); } // b2 uses the magic word "" to generate excerpts if (strpos($a['Body'],'')) { //Everything that is before "more" can be treated as the excerpt. $pos = strpos($a['Body'],''); $a['Excerpt'] = substr($a['Body'],0,$pos); $a['Excerpt_html'] = $textile->textileThis($a['Excerpt']); $a['Body'] = str_replace('','',$a['Body']); } else { $a['Excerpt'] = ''; $a['Excerpt_html'] = ''; } $a['url_title'] = stripSpace($a['Title'],1); $a['Body_html'] = $textile->textileThis($a['Body']); extract(array_slash($a)); $q = mysql_query(" insert into `".PFX."textpattern` set ID = '$ID', Posted = '$Posted', Title = '$Title', url_title = '$url_title', Body = '$Body', Body_html = '$Body_html', Excerpt = '$Excerpt', Excerpt_html = '$Excerpt_html', Category1 = '$Category1', AuthorID = '$AuthorID', Section = '$insert_into_section', AnnotateInvite = '$default_comment_invite', uid='".md5(uniqid(rand(),true))."', feed_time='".substr($Posted,0,10)."', Status = '$insert_with_status' ",$txplink) or $results[]= mysql_error(); if (mysql_insert_id() ) { $results[]= 'inserted b2 entry '.$Title. ' into Textpattern as article '.$ID.''; } } } if (!empty($comments)) { foreach ($comments as $comment) { extract(array_slash($comment)); if (is_callable('utf8_encode')) $message = utf8_encode($message); $message = nl2br($message); $q = mysql_query("insert into `".PFX."txp_discuss` values ($discussid,$parentid,'$name','$email','$web','$ip','$posted','$message',1)", $txplink) or $results[]= mysql_error($q); if(mysql_insert_id()) { $results[]= 'inserted b2 comment '.$parentid .' into txp_discuss'; } } } return join('
', $results); } ?>