} } $attachShow->parseAttachs($pid, $description, false); } else { $description = $attachShow->clearAttachTags($description); } } $description = stripPostHideAndSell($description); $description = convert($description, $allow); $description = xmlEscape($description); $item = array('title' => $postTitle ? $postTitle : 'Re:' . $title, 'description' => $description, 'link' => $link, 'author' => $db_ceoemail . ' (' . $rt['author'] . ')', 'category' => strip_tags($rs['name']), 'pubDate' => date('r', $rt['postdate'])); $Rss->item($item); } $rssItems = ob_get_contents(); ob_end_clean(); $rssItems = $Rss->getItems(); $etag = md5($rssItems); if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $etag == $_SERVER['HTTP_IF_NONE_MATCH']) { header("HTTP/1.0 304 Not Modified"); exit; } else { header('Etag:' . $etag); } header("Content-type: application/xml"); echo $Rss->getRss(); exit; } else { $cache_path = D_P . 'data/bbscache/rss_' . $fid . '_cache.xml'; if ($timestamp - pwFilemtime($cache_path) > $Rss_updatetime * 60) { L::loadClass('rss', 'utility', false); require_once D_P . 'data/bbscache/forum_cache.php';
public function updateItemsFromDom($dom) { $items = Rss::getItems($dom); $newItems = array(); foreach ($items as $item) { if (!empty($item['link'])) { $hashUrl = MyTool::smallHash($item['link']); $newItems[$hashUrl] = array(); $newItems[$hashUrl]['title'] = empty($item['title']) ? $item['link'] : $item['title']; $newItems[$hashUrl]['time'] = strtotime($item['time']) ? strtotime($item['time']) : time(); if (MyTool::isUrl($item['via']) && parse_url($item['via'], PHP_URL_HOST) != parse_url($item['link'], PHP_URL_HOST)) { $newItems[$hashUrl]['via'] = $item['via']; } else { $newItems[$hashUrl]['via'] = ''; } $newItems[$hashUrl]['link'] = $item['link']; $newItems[$hashUrl]['author'] = $item['author']; mb_internal_encoding("UTF-8"); $newItems[$hashUrl]['description'] = mb_substr(strip_tags($item['description']), 0, 500); $newItems[$hashUrl]['content'] = $item['content']; } } return $newItems; }