if ($options['trackback_life'] && $timestamp - intval($carr[1]) > 3600 * 24) { showxml('已经超过本文允许Trackback的时间'); } $article = $DB->fetch_one_array("SELECT dateline,closetrackback FROM {$db_prefix}articles WHERE articleid='{$articleid}'"); if (!$article) { showxml('文章不存在'); } elseif ($article['closetrackback']) { showxml('本文此时不允许引用'); } elseif ($article['dateline'] != intval($carr[1])) { showxml('文章时间验证失败'); } $url = sax_addslashes(trim($_POST['url'])); if ($url) { $title = sax_addslashes(html_excerpt($_POST['title'])); $excerpt = sax_addslashes(trimmed_title(html_excerpt($_POST['excerpt'])), 200); $blog_name = sax_addslashes(html_excerpt($_POST['blog_name'])); } if (!$title || !$excerpt || !$url || !$blog_name) { showxml('参数不正确'); } elseif (substr($url, 0, 7) != 'http://') { showxml('参数不正确'); } // 检查Spam // 定义发送来的此条Trackback初始分数 $point = 0; $options['tb_spam_level'] = in_array($options['tb_spam_level'], array('strong', 'weak', 'never')) ? $options['tb_spam_level'] : 'weak'; if ($options['audit_trackback']) { //如果人工审核 $visible = '0'; } elseif ($options['tb_spam_level'] != 'never') { $source_content = '';
foreach ($item->category as $c) { $att = $c->attributes(); if ($att['domain'] == 'post_format') { $format = (string) $att['nicename']; $post_format = $format == 'post-format-video' ? 'video' : 'post'; } } $post_status = $status == 'draft' ? 'draft' : 'NULL'; $comment_status = $comm == 'open' ? '1' : '0'; $type_type = !empty($post_format) && $post_format == 'video' ? 'video' : 'simple'; $title = $item->title; $seo = $item->xpath('wp:post_name'); $seo = $seo['0']; $content = $item->xpath('content:encoded'); $content = $content['0']; $descr = html_excerpt($content, 120); $content = str_replace('<!--more-->', '<!-- pagebreak -->', $content); $content = nl2p($content); $content = htmlspecialchars($content); //htmlentities($content, ENT_IGNORE, "UTF-8"); $net = explode(" ", $date); $dt = $net['0']; $nedt = explode("-", $dt); $dt2 = $net['1']; $nedt2 = explode(":", $dt2); $time = mktime($nedt2['0'], $nedt2['1'], $nedt2['2'], $nedt['1'], $nedt['2'], $nedt['0']); if (empty($time)) { $time = time(); } $mdate = str_replace(array('-', ':', ' '), '.', $date); if ($type == 'post') {