Esempio n. 1
0
 /**
  * 文章feed
  * @param string $type 文章类型
  * @internal param $null 显示数量由 feed_num决定* 显示数量由 feed_num决定
  */
 public function listPost($type = 'single')
 {
     $PostsList = new PostsLogic();
     $post_list = $PostsList->getList(get_opinion('feed_num'), $type, 'post_date desc', true);
     $RSS = new RSS(get_opinion('title'), '', get_opinion('description'), '');
     // 站点标题的链接
     foreach ($post_list as $list) {
         $RSS->addItem($list['post_title'], 'http://' . $_SERVER["SERVER_NAME"] . get_post_url($list), $list['post_content'], $list['post_date']);
     }
     $RSS->display();
 }
<?php

$rss = new RSS("Letzte Antworten - " . SiteConfig::val("page/title", "Q/A Forum"), "Die neusten Antworten aus dem Forum", get_path("/questions/rss"));
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT T1.*,T3.title,T2.username as authorname FROM answers as T1 LEFT JOIN user_list as T2 ON T1.author=T2.id LEFT JOIN questions as T3 ON T1.question=T3.id WHERE 1 ORDER BY date_created DESC LIMIT 0,30');
foreach ($rows as $row) {
    $item = new RSSItem("Antwort auf: " . $row["title"], $row["txt"] . '<br/><br/><div style="color:#8080ff;">SPAMcheck: ' . SpamText($row["isSPAM"]) . '<br/><i>' . html($row["authorname"]) . '</i></div>', Question::PermalinkByData($row["question"], $row["title"]) . "#answer-" . $row["id"]);
    $rss->addItem($item);
}
//die($rss->fetch());
$rss->display();
exit(1);
function SpamText($v)
{
    switch ($v) {
        case -2:
            return "Akismet gute Antwort";
        case -1:
            return "Ham";
        case 1:
            return "<b>Spam</b>";
        case 2:
            return "<b>Akismet SPAM</b>";
    }
}
Esempio n. 3
0
 /**
  * displayRSS
  * 
  * Display the follow-ups of this artifact as a rss feed
  *
  */
 function displayRSS()
 {
     $uh = UserHelper::instance();
     $hp = Codendi_HTMLPurifier::instance();
     $group = $this->ArtifactType->getGroup();
     $rss = new RSS(array('title' => $group->getPublicName() . ' ' . $this->ArtifactType->getName() . ' #' . $this->getId() . ' - ' . $this->getValue('summary') . ' - ' . $GLOBALS['Language']->getText('tracker_include_artifact', 'follow_ups'), 'description' => '', 'link' => '<![CDATA[' . get_server_url() . '/tracker/?atid=' . $this->ArtifactType->getID() . '&group_id=' . $group->getGroupId() . ']]>', 'language' => 'en-us', 'copyright' => $GLOBALS['Language']->getText('rss', 'copyright', array($GLOBALS['sys_long_org_name'], $GLOBALS['sys_name'], date('Y', time()))), 'pubDate' => gmdate('D, d M Y h:i:s', $this->getLastUpdateDate()) . ' GMT'));
     $result = $this->getFollowups();
     for ($i = 0; $i < db_numrows($result); $i++) {
         $comment_type = db_result($result, $i, 'comment_type');
         $comment_type_id = db_result($result, $i, 'comment_type_id');
         $comment_id = db_result($result, $i, 'artifact_history_id');
         $field_name = db_result($result, $i, 'field_name');
         $orig_subm = $this->getOriginalCommentSubmitter($comment_id);
         $orig_date = $this->getOriginalCommentDate($comment_id);
         if ($comment_type_id == 100 || $comment_type == "") {
             $comment_type = '';
         } else {
             $comment_type = '<strong>[' . $comment_type . ']</strong><br />';
         }
         $rss->addItem(array('title' => '<![CDATA[' . $GLOBALS['Language']->getText('tracker_include_artifact', 'add_flup_comment') . ' #' . $comment_id . ']]>', 'description' => '<![CDATA[' . $comment_type . util_make_links(nl2br(db_result($result, $i, 'new_value')), $group->getGroupId(), $this->ArtifactType->getID()) . ']]>', 'pubDate' => gmdate('D, d M Y h:i:s', db_result($orig_date, 0, 'date')) . ' GMT', 'dc:creator' => $hp->purify($uh->getDisplayNameFromUserId(db_result($orig_subm, 0, 'mod_by'))), 'link' => '<![CDATA[' . get_server_url() . '/tracker/?func=detail&aid=' . $this->getId() . '&atid=' . $this->ArtifactType->getID() . '&group_id=' . $group->getGroupId() . '#comment_' . $comment_id . ']]>', 'guid' => '<![CDATA[' . get_server_url() . '/tracker/?func=detail&aid=' . $this->getId() . '&atid=' . $this->ArtifactType->getID() . '&group_id=' . $group->getGroupId() . '#comment_' . $comment_id . ']]>'));
     }
     $rss->display();
     exit;
 }
 function displayRss()
 {
     $rss = new RSS(array('title' => 'Codendi - MyProjects', 'description' => 'My projects', 'link' => get_server_url(), 'language' => 'en-us', 'copyright' => 'Copyright Xerox', 'pubDate' => gmdate('D, d M Y G:i:s', time()) . ' GMT'));
     $result = db_query("SELECT groups.group_name," . "groups.group_id," . "groups.unix_group_name," . "groups.status," . "groups.access," . "user_group.admin_flags " . "FROM groups,user_group " . "WHERE groups.group_id=user_group.group_id " . "AND user_group.user_id='" . user_getid() . "' " . "AND groups.status='A' ORDER BY group_name");
     $rows = db_numrows($result);
     if (!$result || $rows < 1) {
         $rss->addItem(array('title' => 'Error', 'description' => $GLOBALS['Language']->getText('my_index', 'not_member') . db_error(), 'link' => get_server_url()));
     } else {
         for ($i = 0; $i < $rows; $i++) {
             $title = db_result($result, $i, 'group_name');
             if (db_result($result, $i, 'access') == Project::ACCESS_PRIVATE) {
                 $title .= ' (*)';
             }
             $desc = 'Project: ' . get_server_url() . '/project/admin/?group_id=' . db_result($result, $i, 'group_id') . "<br />\n";
             if (db_result($result, $i, 'admin_flags') == 'A') {
                 $desc .= 'Admin: ' . get_server_url() . '/project/admin/?group_id=' . db_result($result, $i, 'group_id');
             }
             $rss->addItem(array('title' => $title, 'description' => $desc, 'link' => get_server_url() . '/projects/' . db_result($result, $i, 'unix_group_name')));
         }
     }
     $rss->display();
 }