'."\n"; echo ''."\n"; $content = ''; if (empty($_GET['id'])) { $content = '1'."\n". 'No ID.'; } else { $id = $_GET['id']; $con = new Connection(DB_USER,DB_PASS,DB_HOST,DB_DBASE); if($con->error()) { $content = '1'."\n". 'MySQL connection error : '.$con->error().''; } else { $blog = new blog($con,DB_PREFIX,1,dc_encoding); $blog->setURL('post',dc_blog_url.dc_format_post_url); $post = $blog->getPostByID($id); if ($post->isEmpty()) { $content = '1'."\n". 'No post for this ID.'; } elseif (!dc_allow_trackbacks || !$post->f('post_open_tb') || (dc_comments_ttl!=0 && time()-(dc_comments_ttl*86400) > $post->getTS())) { $content = '1'."\n". 'Trackbacks are not allowed for this post or weblog.'; } elseif (isset($_REQUEST['__info'])) { $content = '0'."\n". 'DotClear'."\n". ''.DC_VERSION.''."\n". ''.dc_encoding.''."\n"; } elseif (!empty($_REQUEST['__mode']) && $_REQUEST['__mode'] == 'rss') { $tb_url = 'http://'.$_SERVER['HTTP_HOST'].dc_trackback_uri.'&id='.$id; if ($post->f('post_chapo') != '') { $post_excerpt = $post->f('post_chapo'); } else { $post_excerpt = $post->f('post_content'); } $post_excerpt = util::cutString(strip_tags($post_excerpt),255); $content = '0'."\n". ''."\n". ''.dc_blog_name.' - Trackback'."\n". ''.$tb_url.''."\n". 'TrackBack item for this blog'."\n". 'fr'."\n". ''."\n". ''.$blog->toXML($post->f('post_titre'),0).''."\n". 'http://'.$_SERVER['HTTP_HOST'].$post->getPermURL().''."\n". ''.$post_excerpt.''."\n". ''."\n". ''."\n". ''; } elseif (empty($_REQUEST['url'])) { $content = '1'."\n". 'URL parameter is requiered.'; } else { $url = $_REQUEST['url']; $title = (!empty($_REQUEST['title'])) ? $_REQUEST['title'] : $url; $excerpt = (!empty($_REQUEST['excerpt'])) ? $_REQUEST['excerpt'] : ''; $blog_name = (!empty($_REQUEST['blog_name'])) ? $_REQUEST['blog_name'] : ''; $title = strip_tags(trim($title)); $excerpt = strip_tags($excerpt); $blog_name = strip_tags($blog_name); if ($title == '') { $title = $url; } if (strlen($excerpt) > 255) { $excerpt = util::cutString($excerpt,252).'...'; } $is_utf8 = util::isUTF8($title) || util::isUTF8($excerpt) || util::isUTF8($blog_name); if (dc_encoding != 'UTF-8' && $is_utf8) { $title = utf8_decode($title); $excerpt = utf8_decode($excerpt); $blog_name = utf8_decode($blog_name); } elseif (dc_encoding == 'UTF-8' && !$is_utf8) { $title = utf8_encode($title); $excerpt = utf8_encode($excerpt); $blog_name = utf8_encode($blog_name); } $comment = ''."\n". '

'.$title.'

'."\n". '

'.$excerpt.'

'; require_once dirname(__FILE__).'/'.DC_ECRIRE.'/tools/spamplemousse/inc/tb.php'; if ($blog->addComment($id,$blog_name,'',$url,$comment,true) !== false) { $content = '0'; if (dc_comment_notification && $post->f('user_email') != '') { $n_titre = $blog->removeEntities($post->f('post_titre')); $n_mail = $post->f('user_email'); $n_subject = util::mimeEncode('['.dc_blog_name.'] '.$n_titre,dc_encoding); $n_content = sprintf(__('Trackback for entry %s'),$n_titre)."\n\n". sprintf(__('By: %s'),$blog_name)."\n". sprintf(__('Website: %s'),$url)."\n". "\n".$title."\n\n".$excerpt."\n". "--\n". 'http://'.$_SERVER['HTTP_HOST'].$post->getPermURL(); $n_headers = 'From: '.$n_mail."\r\n". 'Content-Type: text/plain; charset='.dc_encoding.";\r\n". "X-Mailer: DotClear\r\n". 'X-Blog: http://'.$_SERVER['HTTP_HOST'].dc_blog_url; @mail($n_mail,$n_subject,$n_content,$n_headers); } } else { $err = $blog->error(0); $content = '1'."\n". ''.$err[0][1].''; } } $con->close(); } } echo $content."\n"; echo '
'; ?>