Exemple #1
0
                         $description .= '<span style="margin:0;background: none repeat scroll 0 0 #FFFAE1;border: 1px dotted #ECA46A;padding: 5px 10px 5px 28px;">附件设置隐藏,需要 <a style="color: #014C90;" href="' . $link . '" target="_blank">访问</a> 社区回复后才能看到</span>';
                         $description .= '</div>';
                     } elseif ($hasUnsetAttach || $attachmentLeft) {
                         $description .= '<div style="margin-top: 10px;">';
                         $description .= '<span style="background: none repeat scroll 0 0 #F3F9FB;border: 1px solid #A6CBE7;padding: 3px 10px;">本帖包含的部分附件只能  <a style="color: #014C90;" href="' . $link . '" target="_blank">访问</a> 社区查看</span>';
                         $description .= '</div>';
                     }
                 }
                 if ($rt['ifsign'] < 2) {
                     $description = str_replace("\n", "<br />", $description);
                 }
                 $description = stripPostHideAndSell($description);
                 $description = convert($description, $allow);
                 $description = xmlEscape($description);
                 $item = array('title' => $postTitle, 'description' => $description, 'link' => $link, 'author' => $db_ceoemail . ' (' . $rt['author'] . ')', 'category' => $forum[$rt['fid']]['name'], 'pubDate' => date('r', $rt['postdate']));
                 $Rss->item($item);
             }
         }
         unset($threaddbs);
     }
     $channel['pubDate'] = date('r', $forumLastPostTime);
     $Rss->channel($channel);
     $Rss->generate($cache_path);
 }
 header("Content-type: application/xml");
 if (file_exists($cache_path)) {
     $etag = '"' . md5_file($cache_path) . '"';
     if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $etag == $_SERVER['HTTP_IF_NONE_MATCH']) {
         $statusCode = 304;
     } else {
         header('Etag:' . $etag);
    Notify::success(__('comments.created'));
    // dont notify if we have marked as spam
    if (!$spam and Config::meta('comment_notifications')) {
        $comment->notify();
    }
    return Response::redirect($posts_page->slug . '/' . $slug . '#comment');
});
/**
 * Rss feed
 */
Route::get(array('rss', 'feeds/rss'), function () {
    $uri = 'http://' . $_SERVER['HTTP_HOST'];
    $rss = new Rss(Config::meta('sitename'), Config::meta('description'), $uri, Config::app('language'));
    $query = Post::where('status', '=', 'published')->sort(Base::table('posts.created'), 'desc');
    foreach ($query->get() as $article) {
        $rss->item($article->title, Uri::full(Registry::get('posts_page')->slug . '/' . $article->slug), $article->description, $article->created);
    }
    $xml = $rss->output();
    return Response::create($xml, 200, array('content-type' => 'application/xml'));
});
/**
 * Json feed
 */
Route::get('feeds/json', function () {
    $json = Json::encode(array('meta' => Config::get('meta'), 'posts' => Post::where('status', '=', 'published')->sort(Base::table('posts.created'), 'desc')->get()));
    return Response::create($json, 200, array('content-type' => 'application/json'));
});
/**
 * Search
 */
Route::get(array('search', 'search/(:any)', 'search/(:any)/(:num)'), function ($slug = '', $offset = 1) {