$v) { $value[$k] = ereg_replace('"','\"',ereg_replace("\n",'\n',ereg_replace("\r",'\r',$v))); } $flattxt[] = '"'.implode('","',$value).'"'; } //Export des commentaires $query = 'SELECT comment_ID as comment_id, comment_post_ID as post_id, comment_date as comment_dt, "'.$timezone.'" as comment_tz, comment_date as comment_upddt, comment_author as comment_author, comment_author_email as comment_email, comment_author_url as comment_site, comment_content as comment_content, "" as comment_words, comment_author_IP as comment_ip, comment_approved as comment_status, "0" as comment_spam_status, "" as comment_spam_filter, "0" as comment_trackback FROM '.$wp_prefix.'comments'; $result = mysql_query($query); $flattxt[] = '[comment comment_id,post_id,comment_dt,comment_tz,comment_upddt,comment_author,comment_email,comment_site,comment_content,comment_words,comment_ip,comment_status,comment_spam_status,comment_spam_filter,comment_trackback]'; while($value = mysql_fetch_assoc($result)) { if($value['comment_status']=='spam') { $value['comment_status'] = 0; $value['comment_spam_status'] = 1; } $value['comment_content'] = apply_filters('the_content', $value['comment_content']); foreach($value as $k=>$v) { $value[$k] = ereg_replace('"','\"',ereg_replace("\n",'\n',ereg_replace("\r",'\r',$v))); } $flattxt[] = '"'.implode('","',$value).'"'; } $flattxt[] = ''; $flattxt[] = ''; $flattxt = implode("\n",$flattxt); if(is_dir($path2dotclearPublic)) { $fp = fopen($path2dotclearPublic.'/'.$blog_id.'-backup.txt','w+'); fputs($fp,$flattxt, strlen($flattxt)); fclose($fp); } header('content-type:text/plain'); echo $flattxt; ?>