Example #1
0
 /**
  * Displays the feed
  *
  * @param mixed $handler_id The ID of the handler.
  * @param array &$data The local request data.
  */
 public function _show_feed($handler_id, array &$data)
 {
     $data['feedcreator'] =& $this->_feed;
     // Add each article now.
     if ($this->_articles) {
         foreach ($this->_articles as $article) {
             $this->_datamanager->autoset_storage($article);
             $data['article'] =& $article;
             $data['datamanager'] =& $this->_datamanager;
             midcom_show_style('feeds-item');
         }
     }
     switch ($handler_id) {
         case 'feed-rss2':
         case 'feed-category-rss2':
             echo $this->_feed->createFeed('RSS2.0');
             break;
         case 'feed-rss1':
             echo $this->_feed->createFeed('RSS1.0');
             break;
         case 'feed-rss091':
             echo $this->_feed->createFeed('RSS0.91');
             break;
         case 'feed-atom':
             echo $this->_feed->createFeed('ATOM');
             break;
     }
 }
Example #2
0
 /**
  * Displays the feed
  *
  * @param mixed $handler_id The ID of the handler.
  * @param mixed &$data The local request data.
  */
 function _show_rss($handler_id, &$data)
 {
     $data['feedcreator'] =& $this->_feed;
     // Add each event now.
     if ($this->_events) {
         foreach ($this->_events as $event) {
             $this->_datamanager->autoset_storage($event);
             $data['event'] =& $event;
             $data['datamanager'] =& $this->_datamanager;
             midcom_show_style('feeds-item');
         }
     }
     echo $this->_feed->createFeed('RSS2.0');
 }
Example #3
0
 /**
  * 掲示板RSSを出力する
  *
  * @param $community_row 対象コミュニティ情報
  * @param $bbs_row_array 掲示板親記事一覧
  * @param $params パラメータ等
  */
 static function print_bbs_rss($community_row, $bbs_row_array, $params)
 {
     // 使用クラス: acs/webapp/lib/feedcreator/feedcreator.class.php
     $rss = new UniversalFeedCreator();
     // 概要等 <channel>
     $rss->useCached();
     $rss->title = $community_row['community_name'];
     // コミュニティ名
     $rss->description = $community_row['community_profile']['contents_value'];
     // プロフィール (公開範囲別)
     $rss->link = $params['base_url'] . $community_row['top_page_url'];
     // コミュニティトップページURL
     $rss->url = $params['base_url'] . $community_row['image_url'];
     // 画像URL  <image rdf:resource="...">
     $rss->syndicationURL = $rss_syndication_url;
     // 自身のURL <channel rdf:about="...">
     // ロゴ画像 <image>
     $image = new FeedImage();
     $image->title = $community_row['image_title'];
     // ファイル名
     $image->link = ACSMsg::get_mdmsg(__FILE__, 'M006');
     // 研究室ロゴ画像
     $image->url = $params['base_url'] . $community_row['image_url'];
     $rss->image = $image;
     // 1件のダイアリー: <item>
     foreach ($bbs_row_array as $index => $bbs_row) {
         // CRLF → LF
         $body = preg_replace('/\\r\\n/', "\n", $bbs_row['body']);
         $item = new FeedItem();
         $item->post_date = $bbs_row['post_date'];
         $item->title = $bbs_row['subject'];
         $item->link = $params['base_url'] . $bbs_row['bbs_res_url'];
         $item->description = $body;
         if ($bbs_row['file_url'] != '') {
             $item->image_link = $params['base_url'] . $bbs_row['file_url'];
         }
         $item->description2 = $body;
         //第2の本文  <content:encoded>
         $rss->addItem($item);
     }
     // http-header
     mb_http_output('pass');
     header('Content-type: application/xml; charset=UTF-8');
     echo mb_convert_encoding($rss->createFeed("RSS1.0"), 'UTF-8', mb_internal_encoding());
 }
Example #4
0
    function rss() {

        $database = JFactory::getDBO();
        $cfg = BidsHelperTools::getConfig();

        ob_end_clean();
        $feed = $cfg->bid_opt_RSS_feedtype;
        $cat = JRequest::getInt('cat', '');
        $user = JRequest::getInt('user', '');

        $limit = $cfg->bid_opt_RSS_description ? intval($cfg->bid_opt_RSS_nritems) : intval($cfg->bid_opt_nr_items_per_page);
        if (!$limit)
            $limit = 10;

        require_once (JPATH_COMPONENT_SITE.DS.'libraries'.DS.'feedcreator'.DS.'feedcreator.php');

        $rss = new UniversalFeedCreator();

        $rss->title = $cfg->bid_opt_RSS_title;
        $rss->description = $cfg->bid_opt_RSS_description;
        $rss->link = htmlspecialchars(JURI::root());
        $rss->syndicationURL = htmlspecialchars(JURI::root());
        $rss->cssStyleSheet = null;
        $rss->encoding = 'UTF-8';

        $where = " where a.published=1 and a.close_offer=0 and a.close_by_admin=0 ";

        if ($cat) {
            if (!$cfg->bid_opt_inner_categories) {
                $where .= " and a.cat = '" . $cat . "' ";
            } else {
                $catOb = BidsHelperTools::getCategoryModel();
                $cTree = $catOb->getCategoryTree($cat,true);

                $cat_ids = array();
                if ($cTree) {
                    foreach ($cTree as $cc) {
                        if (!empty($cc->id)) {
                            $cat_ids[] = $cc->id;
                        }
                    }
                }
                if (count($cat_ids))
                    $cat_ids = implode(",", $cat_ids);
                $where .= " and ( a.cat  IN (" . $cat_ids . ") )";
            }
        }

        if ($user) {
            $where .= " AND userid=".$database->quote($user);
        }

        $database->setQuery("select a.* from #__bid_auctions a left join #__categories c on c.id=a.cat ".$where." order by id desc", 0, $limit);
        $rows = $database->loadObjectList();

        for ($i = 0; $i < count($rows); $i++) {

            $auction = $rows[$i];

            $item_link = JHtml::_('auctiondetails.auctionDetailsURL',$auction, false);

            // removes all formating from the intro text for the description text
            $item_description = $auction->description;
            $item_description = JFilterOutput::cleanText($item_description);
            $item_description = html_entity_decode($item_description);

            // load individual item creator class
            $item = new FeedItem();
            // item info
            $item->title = $auction->title;
            $item->link = $item_link;
            $item->description = $item_description;
            $item->source = $rss->link;
            $item->date = date('r', strtotime($auction->start_date));
            $database->setQuery( "select title from #__categories where id=".$database->quote($auction->cat) );
            $item->category = $database->loadResult();

            $rss->addItem($item);
        }

        echo $rss->createFeed($feed);
    }
Example #5
0
        $item = new FeedItem();
        $item->guid = $img->gridimage_id;
        $item->title = $img->grid_reference . " : " . $img->title;
        $item->link = "http://{$_SERVER['HTTP_HOST']}/photo/{$img->gridimage_id}";
        if (!empty($img->dist_string) || !empty($img->imagetakenString)) {
            $item->description = $img->dist_string . (!empty($img->imagetakenString) ? ' Taken: ' . $img->imagetakenString : '') . "<br/>" . $img->comment;
            $item->descriptionHtmlSyndicated = true;
        } else {
            $item->description = $img->comment;
        }
        if (!empty($img->imagetaken) && strpos($img->imagetaken, '-00') === FALSE) {
            $item->imageTaken = $img->imagetaken;
        }
        $item->date = strtotime($img->submitted);
        $item->source = "http://{$_SERVER['HTTP_HOST']}/";
        $item->author = $img->realname;
        $item->lat = $img->wgs84_lat;
        $item->long = $img->wgs84_long;
        $details = $img->getThumbnail(120, 120, 2);
        $item->thumb = $details['server'] . $details['url'];
        $item->thumbTag = $details['html'];
        $item->licence = "&copy; Copyright <i class=\"attribution\">" . htmlspecialchars($img->realname) . "</i> and licensed for reuse under this <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/2.0/\">Creative Commons Licence</a>";
        $rss->addItem($item);
    }
}
customExpiresHeader(86400, true);
header("Content-type: application/vnd.google-earth.kml+xml");
header("Content-Disposition: attachment; filename=\"geograph.kml\"");
//we store in var so can be by reference
$feed =& $rss->createFeed($format);
echo $feed;
Example #6
0
  $res2 = mysql_query($query);

  if ($res2 == FALSE)
  {
    echo "Mysql error on query: $query";
    die();
    
  }
  $r2 = mysql_fetch_array($res2);
  $fid = $r2["parent_id"];
  $forum = $r2["forum_name"].(($forum == "") ? "" : " -> ").$forum;
  $it++;
  if ($it > 100)
  {
    die("Too many iterations when fetching forum category");
  }
  }while ($fid != "0");
  $title = "( ".$author." ) ".$forum." -> ".$thread;
  $link = "http://springrts.com/phpbb/viewtopic.php?t=".$row["topic_id"];
  $item->title = $title;
  $item->link = $link;
  $item->author = $author;
  $rss->addItem($item);
}
//echo "\t</channel>\n";
//echo "</rss>\n";
echo $rss->createFeed("RSS2.0");


?>
Example #7
0
function sms_board_output_rss($keyword, $line = "10")
{
    global $apps_path, $web_title;
    include_once $apps_path['plug'] . "/feature/sms_board/lib/external/feedcreator/feedcreator.class.php";
    $keyword = strtoupper($keyword);
    if (!$line) {
        $line = "10";
    }
    $format_output = "RSS0.91";
    $rss = new UniversalFeedCreator();
    $db_query1 = "SELECT * FROM " . _DB_PREF_ . "_featureBoard_log WHERE in_keyword='{$keyword}' ORDER BY in_datetime DESC LIMIT 0,{$line}";
    $db_result1 = dba_query($db_query1);
    while ($db_row1 = dba_fetch_array($db_result1)) {
        $title = $db_row1['in_masked'];
        $description = $db_row1['in_msg'];
        $datetime = $db_row1['in_datetime'];
        $items = new FeedItem();
        $items->title = $title;
        $items->description = $description;
        $items->comments = $datetime;
        $items->date = strtotime($datetime);
        $rss->addItem($items);
    }
    $feeds = $rss->createFeed($format_output);
    return $feeds;
}
                } else {
                    $description .= "<li>To Be Announced</li>";
                }
                $description .= "</ol><br /><br />";
                $description .= "Cohort: " . html_encode(groups_get_name($result["event_cohort"])) . "<br />";
                $description .= "Phase: " . strtoupper($result["event_phase"]) . "<br />";
                $description .= "Event Date/Time: " . date(DEFAULT_DATE_FORMAT, $result["event_start"]) . "<br />";
                $description .= "Event Duration: " . ($result["event_duration"] ? $result["event_duration"] . " minutes" : "Not provided") . "<br />";
                $description .= "Event Location: " . ($result["event_location"] ? $result["event_location"] : "Not provided") . "<br />";
                $description .= "<br />Podcast Description / Details:<br />";
                $description .= html_encode($result["event_message"]);
                $item = new FeedItem();
                $item->title = $result["event_title"] . ": " . $result["file_title"];
                $item->link = ENTRADA_URL . "/events?id=" . $result["event_id"];
                $item->date = date("r", $result["event_start"]);
                $item->description = $description;
                $item->descriptionHtmlSyndicated = true;
                $item->podcast = new PodcastItem();
                $item->podcast->block = "yes";
                $item->podcast->author = $primary_contact["fullname"];
                $item->podcast->duration = $result["event_duration"] * 60;
                $item->podcast->enclosure_url = ENTRADA_URL . "/podcasts/download/" . $result["efile_id"] . "/" . $result["file_name"];
                $item->podcast->enclosure_length = $result["file_size"];
                $item->podcast->enclosure_type = $result["file_type"];
                $rss->addItem($item);
            }
        }
        echo $rss->createFeed("PODCAST");
        add_statistic("podcasts", "view", "proxy_id", $USER_PROXY_ID, $USER_PROXY_ID);
        break;
}
Example #9
0
File: rss.php Project: Zartas/appDB
    $item->description = $prebold . $app->name . ' (' . $app->latest_version . ')' . $postbold . $br;
    $item->description .= $preitalic . $app->company . $postitalic . $br;
    $item->description .= $prebold . 'Category: ' . $postbold . $app->category_name . $br;
    $item->description .= $prebold . 'Price: ' . $postbold . $app->price . $br;
    if ($cracker) {
        $item->description .= $prebold . 'Cracker: ' . $postbold . stripslashes($app->latest_version_first_cracker) . $br . $br;
    } else {
        $item->description .= $br;
    }
    $item->description .= $prebold . "Application Description:" . $postbold . $br;
    $item->description .= $desc . $br . $br;
    if ($whats_new) {
        $item->description .= $prebold . "New in this Version:" . $postbold . $br;
        $item->description .= $whats_new . $br . $br;
    }
    $item->description .= $prebold . preg_replace('/\\%LINK\\%/', $item->link, $linkline) . $postbold;
    if ($sort == 'newapps') {
        $item->date = strtotime($app->date_added);
    } else {
        $item->date = strtotime($app->latest_version_added);
    }
    $item->guid = $app->id . '-' . $app->latest_version;
    $item->source = Config::getVal('general', 'site_name');
    $item->author = Config::getVal('general', 'site_name');
    $rss->addItem($item);
}
// valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
// MBOX, OPML, ATOM, ATOM0.3, HTML, JS
$rendered = $rss->createFeed("RSS0.91");
// Write it
echo $rendered;
Example #10
0
                    foreach ($watching as $w) {
                        list($rc, $events) = al_getrecentevents('watch:' . $w['eventid']);
                        if ($rc != 0) {
                            continue;
                        }
                        foreach ($events as $e) {
                            $item = new FeedItem();
                            $item->title = $e['subject'];
                            $item->link = $GLOBALS['SITE_URL'] . $e['url'];
                            $item->date = (int) $e['time'];
                            $item->description = formatText($e['body']);
                            $rss->addItem($item);
                        }
                    }
                }
                $rss->title = '[FF] ' . $user . '\'s News';
                $rss->description = $user . '\'s FOSS Factory news';
                $rss->link = $GLOBALS['SITE_URL'];
            } else {
                header('Location: index.php');
                exit;
            }
        }
    }
}
if ($file !== null) {
    $rss->saveFeed('RSS2.0', $file, false);
    @readfile($file);
} else {
    echo $rss->createFeed('RSS2.0');
}
Example #11
0
 public static function generate_feed($id = NULL)
 {
     global $current;
     global $website;
     global $DB;
     if (empty($id)) {
         $id = $current['id'];
     }
     $item = new feed();
     $item->load($id);
     $permission = nvweb_object_enabled($item);
     if (!$permission) {
         return;
     }
     $feed = new UniversalFeedCreator();
     $feed->encoding = 'UTF-8';
     $feed->title = $item->dictionary[$current['lang']]['title'];
     $feed->description = $item->dictionary[$current['lang']]['description'];
     $feed->link = $website->absolute_path();
     $feed->syndicationURL = $website->absolute_path() . $item->paths[$current['lang']];
     if (!empty($item->image)) {
         $image = new FeedImage();
         $image->url = $website->absolute_path() . '/object?type=image&amp;id=' . $item->image;
         $image->link = $website->absolute_path();
         //$image->description = $vars['dictionary_description'];
         $feed->image = $image;
     }
     if (!empty($item->categories[0])) {
         $limit = intval($item->entries);
         if ($limit <= 0) {
             $limit = 10;
         }
         $DB->query(' SELECT SQL_CALC_FOUND_ROWS i.id, i.permission, i.date_published, i.date_unpublish,
                             i.date_to_display, COALESCE(NULLIF(i.date_to_display, 0), i.date_created) as pdate, d.text as title, i.position as position,
                             i.galleries as galleries, i.template as template
                       FROM nv_items i, nv_structure s, nv_webdictionary d
                      WHERE i.category IN(' . implode(",", $item->categories) . ')
                        AND i.website = ' . $website->id . '
                        AND i.permission = 0
                        AND (i.date_published = 0 OR i.date_published < ' . core_time() . ')
                        AND (i.date_unpublish = 0 OR i.date_unpublish > ' . core_time() . ')
                        AND s.id = i.category
                        AND (s.date_published = 0 OR s.date_published < ' . core_time() . ')
                        AND (s.date_unpublish = 0 OR s.date_unpublish > ' . core_time() . ')
                        AND s.permission = 0
                        AND (s.access = 0)
                        AND (i.access = 0)
                        AND d.website = i.website
                        AND d.node_type = "item"
                        AND d.subtype = "title"
                        AND d.node_id = i.id
                        AND d.lang = ' . protect($current['lang']) . '
                      ORDER BY pdate DESC
                      LIMIT ' . $limit . '
                     OFFSET 0');
         $rs = $DB->result();
         for ($x = 0; $x < count($rs); $x++) {
             if (nvweb_object_enabled($rs[$x])) {
                 $texts = webdictionary::load_element_strings('item', $rs[$x]->id);
                 $paths = path::loadElementPaths('item', $rs[$x]->id);
                 $fitem = new FeedItem();
                 $fitem->title = $texts[$current['lang']]['title'];
                 $fitem->link = $website->absolute_path() . $paths[$current['lang']];
                 switch ($item->content) {
                     case 'title':
                         // no description
                         break;
                     case 'content':
                         $fitem->description = $texts[$current['lang']]['section-main'];
                         break;
                     case 'summary':
                     default:
                         $fitem->description = $texts[$current['lang']]['section-main'];
                         $fitem->description = str_replace(array('</p>', '<br />', '<br/>', '<br>'), array('</p>' . "\n", '<br />' . "\n", '<br/>' . "\n", '<br>' . "\n"), $fitem->description);
                         $fitem->description = core_string_cut($fitem->description, 500, '&hellip;');
                         break;
                 }
                 $fitem->date = $rs[$x]->date_to_display;
                 // find an image to attach to the item
                 // A) first enabled image in item gallery
                 // B) first image on properties
                 $image = '';
                 if (!empty($rs[$x]->galleries)) {
                     $galleries = mb_unserialize($rs[$x]->galleries);
                     $photo = @array_shift(array_keys($galleries[0]));
                     if (!empty($photo)) {
                         $image = $website->absolute_path(false) . '/object?type=image&id=' . $photo;
                     }
                 }
                 if (empty($image)) {
                     // no image found on galleries, look for image properties
                     $properties = property::load_properties("item", $rs[$x]->template, "item", $rs[$x]->id);
                     for ($p = 0; $p < count($properties); $p++) {
                         if ($properties[$p]->type == 'image') {
                             if (!empty($properties[$p]->value)) {
                                 $image = $properties[$p]->value;
                             } else {
                                 if (!empty($properties[$p]->dvalue)) {
                                     $image = $properties[$p]->dvalue;
                                 }
                             }
                             if (is_array($image)) {
                                 $image = array_values($image);
                                 $image = $image[0];
                             }
                             if (!empty($image)) {
                                 $image = $website->absolute_path(false) . '/object?type=image&id=' . $image;
                             }
                         }
                         // we only need the first image
                         if (!empty($image)) {
                             break;
                         }
                     }
                 }
                 if (!empty($image)) {
                     $fitem->image = $image;
                     // feedly will only display images of >450px --> http://blog.feedly.com/2015/07/31/10-ways-to-optimize-your-feed-for-feedly/
                     if (strpos($item->format, 'RSS') !== false) {
                         $fitem->description = '<img src="' . $image . '&width=640"><br />' . $fitem->description;
                     }
                 }
                 //$item->author = $contents->rows[$x]->author_name;
                 $feed->addItem($fitem);
             }
         }
         // valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
         // MBOX, OPML, ATOM, ATOM10, ATOM0.3, HTML, JS
         //echo $rss->saveFeed("RSS1.0", "news/feed.xml");
     }
     $xml = $feed->createFeed($item->format);
     if ($item->format == "RSS2.0") {
         // add extra tweaks to improve the feed
         $xml = str_replace('<rss ', '<rss xmlns:webfeeds="http://webfeeds.org/rss/1.0" ', $xml);
         // also available:
         // <webfeeds:cover image="http://yoursite.com/a-large-cover-image.png" />\n
         // <webfeeds:accentColor>00FF00</webfeeds:accentColor>
         $xml = str_replace('<channel>', '<channel>' . "\n\t\t" . '<webfeeds:related layout="card" target="browser" />', $xml);
         $xml = str_replace('<channel>', '<channel>' . "\n\t\t" . '<webfeeds:logo>' . file::file_url($item->image) . '</webfeeds:logo>', $xml);
         $xml = str_replace('<channel>', '<channel>' . "\n\t\t" . '<webfeeds:icon>' . file::file_url($website->favicon) . '</webfeeds:icon>', $xml);
     }
     return $xml;
 }
Example #12
0
                        $query = "\tSELECT a.`page_url`\n\t\t\t\t\t\t\t\t\t\tFROM `community_pages` AS a\n\t\t\t\t\t\t\t\t\t\tJOIN `communities_modules` AS b\n\t\t\t\t\t\t\t\t\t\tON b.`module_shortname` = a.`page_type`\n\t\t\t\t\t\t\t\t\t\tWHERE b.`module_id` = " . $db->qstr($result["record_id"]) . "\n\t\t\t\t\t\t\t\t\t\tAND a.`community_id` = " . $db->qstr($result["community_id"]) . "\n\t\t\t\t\t\t\t\t\t\tAND a.`page_active` = '1'";
                        $page_url = $db->GetOne($query);
                    }
                    if ($result["history_key"]) {
                        $history_message = $translate->_($result["history_key"]);
                        $record_title = "";
                        $parent_id = 0;
                        community_history_record_title($result["history_key"], $result["record_id"], $result["cpage_id"], $result["community_id"]);
                    } else {
                        $history_message = $result["history_message"];
                    }
                    $content_search = array("%SITE_COMMUNITY_URL%", "%SYS_PROFILE_URL%", "%PAGE_URL%", "%RECORD_ID%", "%RECORD_TITLE%", "%PARENT_ID%");
                    $content_replace = array(COMMUNITY_URL . $community_url, ENTRADA_URL . "/people", $page_url, $result["record_id"], $record_title, $parent_id);
                    $history_message = str_replace($content_search, $content_replace, $history_message);
                    $item = new FeedItem();
                    $link = substr($history_message, stripos($history_message, "href=\"") + 6);
                    $link = substr($link, 0, stripos($link, "\""));
                    $item->link = (isset($link) && $link ? $link : COMMUNITY_URL . $community_url) . (strpos($link, "?") ? "&" : "?") . "auth=true";
                    $item->title = strip_tags(html_decode($history_message));
                    $item->date = (int) date("U", $result["history_timestamp"]);
                    $item->author = $result["email"] . " (" . $result["author_name"] . ")";
                    $item->description = strip_tags($history_message);
                    $item->descriptionHtmlSyndicated = true;
                    $rss->addItem($item);
                }
            }
            header("Content-type: text/xml");
            echo $rss->createFeed($rss_version);
            break;
    }
}
Example #13
0
File: rss.php Project: nieder/web
if (!isset($_GET['format']))
	$_GET['format'] = 'ATOM';
$format = strtoupper($_GET['format']);

if (isset($results) && is_object($results) && $results->response->numFound > 0) {
	foreach ($results->response->docs as $package) {
		$description = $package->desclong;
		if (empty($package->desclong))
			$description = $package->descshort;

		$date = $package->infofilechanged;
		$date = rtrim($date, 'Z?');

		$title = $distributions[$package->dist_id]->getDescription() . ": " . $package->pkg_id;
		$title .= " (" . $package->descshort . ")";

		$item = new FeedItem();
		$item->title = $title;
		$item->link  = $url_root . "/package.php/" . $package->name . "?rel_id=" . $package->rel_id;
		$item->description = $description;
		$item->date = $date;
		$item->source = $url_root . "/rss.php?" . get_query_params();
		$item->author = $package->maintainer;
		$rss->addItem($item);
	}
}

echo $rss->createFeed($format);

?>
Example #14
0
            // In the case of RecentChanges.xml, we must unescape the url before giving it to FC
            $item->date = date('r', strtotime($page['time']));
            // RFC2822
            $item->description = sprintf(T_("By %s"), $page['user']) . ($page['note'] ? ' (' . $page['note'] . ')' : '') . "\n";
            $item->source = WIKKA_BASE_URL;
            // @@@ JW: ^ should link to *actual* page not root
            /*
            http://dublincore.org/documents/1999/07/02/dces/
            Element: Source
            
              Name:        Source
              Identifier:  Source
              Definition:  A Reference to a resource from which the present resource
            			   is derived.
              Comment:     The present resource may be derived from the Source resource
            			   in whole or in part.  Recommended best practice is to reference
            			   the resource by means of a string or number conforming to a
            			   formal identification system.
            */
            if (($f == 'ATOM1.0' || $f == 'RSS1.0') && $this->LoadUser($page['user'])) {
                $item->author = $page['user'];
                # RSS0.91 and RSS2.0 require authorEmail
            }
            $rss->addItem($item);
        }
    }
}
ob_end_clean();
//output feed
echo $rss->createFeed($f);
Example #15
0
function outputtorss($code, $line = "10")
{
    global $apps_path, $web_title;
    include_once "{$apps_path['libs']}/gpl/feedcreator.class.php";
    $code = strtoupper($code);
    if (!$line) {
        $line = "10";
    }
    $format_output = "RSS0.91";
    $rss = new UniversalFeedCreator();
    $db_query1 = "SELECT * FROM playsms_tblSMSIncoming WHERE in_code='{$code}' ORDER BY in_datetime DESC LIMIT 0,{$line}";
    $db_result1 = dba_query($db_query1);
    while ($db_row1 = dba_fetch_array($db_result1)) {
        $title = $db_row1[in_masked];
        $description = $db_row1[in_msg];
        $datetime = $db_row1[in_datetime];
        $items = new FeedItem();
        $items->title = $title;
        $items->description = $description;
        $items->comments = $datetime;
        $items->date = strtotime($datetime);
        $rss->addItem($items);
    }
    $feeds = $rss->createFeed($format_output);
    return $feeds;
}
Example #16
0
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once 'geograph/global.inc.php';
require_once 'geograph/feedcreator.class.php';
$format = "RSS0.91";
$rss = new UniversalFeedCreator();
$rss->title = 'Game Scoreboard Approvals';
$rss->link = "http://{$_SERVER['HTTP_HOST']}/games/approve.php";
$db = NewADOConnection($GLOBALS['DSN']);
$sql = "select created,username from game_score where approved = 0 group by username order by created";
$recordSet =& $db->Execute($sql);
while (!$recordSet->EOF) {
    $item = new FeedItem();
    $item->title = $recordSet->fields['username'];
    $item->date = strtotime($recordSet->fields['created']);
    $rss->addItem($item);
    $recordSet->MoveNext();
}
print $rss->createFeed($format);
Example #17
0
        $rss->useCached();
        $rss->title = $config->feed_title;
        $rss->description = $config->feed_desc;
        $rss->ttl = $ttl;
        $rss->pubDate = $pubDate;
        $rss->link = "http://" . HOSTNAME . PATH_RELATIVE;
        $rss->syndicationURL = "http://" . HOSTNAME . PATH_RELATIVE . $_SERVER['PHP_SELF'];
        if ($_REQUEST['module'] == "resourcesmodule") {
            $rss->itunes->summary = $config->feed_desc;
            $rss->itunes->author = ORGANIZATION_NAME;
            $rss->itunes->category = '';
            $rss->itunes->subcategory = '';
            $rss->itunes->image = URL_FULL . "framework/modules/filedownloads/assets/images/logo.png";
            $rss->itunes->explicit = 0;
            $rss->itunes->subtitle = 0;
            $rss->itunes->keywords = 0;
            $rss->itunes->owner_email = 0;
        }
        foreach ($rss_items as $item) {
            $rss->addItem($item);
        }
        header("Content-type: text/xml");
        if ($module == "resourcesmodule") {
            echo $rss->createFeed("PODCAST");
        } else {
            echo $rss->createFeed("RSS2.0");
        }
    } else {
        echo gt("This RSS feed has been disabled.");
    }
}
Example #18
0
 function generate_feed($feed, $uniqueid, $rss_version, $changes, $itemurl, $urlparam, $id, $title, $titleId, $desc, $descId, $dateId, $authorId)
 {
     global $tikiIndex;
     global $userslib;
     if ($rss_version == '') {
         // override version if set as request parameter
         if (isset($_REQUEST["ver"])) {
             $ver = $_REQUEST["ver"];
             $rss_version = $this->get_rss_version($ver);
         } else {
             $rss_version = 9;
             // default to RSS 0.91
         }
     } else {
         $rss_version = $this->get_rss_version($rss_version);
     }
     $now = date("U");
     $output = $this->get_from_cache($uniqueid, $rss_version);
     if ($output != "EMPTY") {
         return $output;
     }
     $urlarray = parse_url($_SERVER["REQUEST_URI"]);
     /* 
                        this gets the correct directory name aka dirname
                        when tikiwiki is on the main directory, i mean
                        when ur site is www.yoursite.com, the dirname of your site
                        is "/" and when tikiwiki is not on main directory, i mean
                        www.yoursite.com/tiki, the dirname returns "/tiki".
                        so, on URLs, we just need to add a extra slash when the
                        tikiwiki isnt on the main directory, what means,
                        dirname($urlarray["path"]) equals to "/tiki", otherwise
                        we can ommit them.
     
                        This is a quick hack to solve the infamous double-slash 
                        problem, which was introduced somewhen after 1.9.0 release 
                        http://dev.tikiwiki.org/tiki-view_tracker_item.php?trackerId=5&itemId=291
     */
     $dirname = dirname($urlarray["path"]) != "/" ? "/" : "";
     $url = htmlspecialchars($this->httpPrefix() . $_SERVER["REQUEST_URI"]);
     $home = htmlspecialchars($this->httpPrefix() . dirname($urlarray["path"]) . $dirname . $tikiIndex);
     $img = htmlspecialchars($this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "img/tiki.jpg");
     $title = htmlspecialchars($title);
     $desc = htmlspecialchars($desc);
     $read = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . $itemurl;
     // different stylesheets for atom and rss
     $cssStyleSheet = "";
     $xslStyleSheet = "";
     $encoding = "ISO-8859-1";
     $encoding = "UTF-8";
     $contenttype = "application/xml";
     // valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1, MBOX, OPML, ATOM0.3, HTML, JS
     // valid format ids        :    9   ,   1   ,    2  ,   3   ,  4  ,   6 ,    5   ,  7  ,  8
     switch ($rss_version) {
         case "1":
             // RSS 1.0
             $cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss-style.css";
             break;
         case "2":
             // RSS 2.0
             $cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss-style.css";
             $xslStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss20.xsl";
             break;
         case "3":
             // PIE 0.1
             break;
         case "4":
             // MBOX
             $contenttype = "text/plain";
             break;
         case "5":
             // ATOM0.3
             $cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/atom-style.css";
             break;
         case "6":
             // OPML
             $xslStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/opml.xsl";
             break;
         case "7":
             // HTML
             $contenttype = "text/plain";
             break;
         case "8":
             // JS
             $contenttype = "text/javascript";
             break;
         case "9":
             // RSS 0.91
             $cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss-style.css";
             break;
     }
     $rss = new UniversalFeedCreator();
     $rss->title = $title;
     $rss->description = $desc;
     //optional
     $rss->descriptionTruncSize = 500;
     $rss->descriptionHtmlSyndicated = true;
     $rss->cssStyleSheet = htmlspecialchars($cssStyleSheet);
     $rss->xslStyleSheet = htmlspecialchars($xslStyleSheet);
     $rss->encoding = $encoding;
     $rss->language = $this->get_preference("rssfeed_language", "en-us");
     $rss->editor = $this->get_preference("rssfeed_editor", "");
     $rss->webmaster = $this->get_preference("rssfeed_webmaster", "");
     $rss->link = $url;
     $rss->feedURL = $url;
     $image = new FeedImage();
     $image->title = tra("tikiwiki logo");
     $image->url = $img;
     $image->link = $home;
     $image->description = tra(sprintf("Feed provided by %s. Click to visit.", $home));
     //optional
     $image->descriptionTruncSize = 500;
     $image->descriptionHtmlSyndicated = true;
     $rss->image = $image;
     global $dbTiki;
     if (!isset($userslib)) {
         $userslib = new Userslib($dbTiki);
     }
     foreach ($changes["data"] as $data) {
         $item = new FeedItem();
         $item->title = $data["{$titleId}"];
         // 2 parameters to replace
         if ($urlparam != '') {
             $item->link = sprintf($read, urlencode($data["{$id}"]), urlencode($data["{$urlparam}"]));
         } else {
             $item->link = sprintf($read, urlencode($data["{$id}"]));
         }
         if (isset($data["{$descId}"])) {
             $item->description = $data["{$descId}"];
         } else {
             $item->description = "";
         }
         //optional
         //item->descriptionTruncSize = 500;
         $item->descriptionHtmlSyndicated = true;
         $item->date = (int) $data["{$dateId}"];
         $item->source = $url;
         $item->author = "";
         if ($authorId != "") {
             if ($userslib->user_exists($data["{$authorId}"])) {
                 $item->author = $data["{$authorId}"];
                 // only use realname <email> if existing and
                 $tmp = "";
                 if ($this->get_user_preference($data["{$authorId}"], 'user_information', 'private') == 'public') {
                     $tmp = $this->get_user_preference($data["{$authorId}"], "realName");
                 }
                 $epublic = $this->get_user_preference($data["{$authorId}"], 'email is public', 'n');
                 if ($epublic != 'n') {
                     $res = $userslib->get_user_info($data["{$authorId}"], false);
                     if ($tmp != "") {
                         $tmp .= ' ';
                     }
                     $tmp .= "<" . scrambleEmail($res['email'], $epublic) . ">";
                 }
                 if ($tmp != "") {
                     $item->author = $tmp;
                 }
             } else {
                 $item->author = $data["{$authorId}"];
             }
         }
         $rss->addItem($item);
     }
     $data = $rss->createFeed($this->get_rss_version_name($rss_version));
     $this->put_to_cache($uniqueid, (int) $data, $rss_version);
     $output = array();
     $output["data"] = $data;
     $output["content-type"] = $contenttype;
     $output["encoding"] = $encoding;
     return $output;
 }
Example #19
0
 function handleRSS($results)
 {
     $app =& Dataface_Application::getInstance();
     $record =& $app->getRecord();
     $query =& $app->getQuery();
     import('feedcreator.class.php');
     import('Dataface/FeedTool.php');
     $ft = new Dataface_FeedTool();
     $rss = new UniversalFeedCreator();
     $rss->encoding = $app->_conf['oe'];
     //$rss->useCached(); // use cached version if age<1 hour
     $del =& $record->_table->getDelegate();
     if (!$del or !method_exists($del, 'getSingleRecordSearchFeed')) {
         $del =& $app->getDelegate();
     }
     if ($del and method_exists($del, 'getSingleRecordSearchFeed')) {
         $feedInfo = $del->getSingleRecordSearchFeed($record, $query);
         if (!$feedInfo) {
             $feedInfo = array();
         }
     }
     if (isset($feedInfo['title'])) {
         $rss->title = $feedInfo['title'];
     } else {
         $rss->title = $record->getTitle() . '[ Search for "' . $query['--subsearch'] . '"]';
     }
     if (isset($feedInfo['description'])) {
         $rss->description = $feedInfo['description'];
     } else {
         $rss->description = '';
     }
     if (isset($feedInfo['link'])) {
         $rss->link = $feedInfo['link'];
     } else {
         $rss->link = htmlentities(df_absolute_url($app->url('') . '&--subsearch=' . urlencode($query['--subsearch'])));
     }
     $rss->syndicationURL = $rss->link;
     $records = array();
     foreach ($results as $result) {
         foreach ($result as $rec) {
             $records[] = $rec->toRecord();
         }
     }
     uasort($records, array($this, 'cmp_last_modified'));
     foreach ($records as $rec) {
         if ($rec->checkPermission('view') and $rec->checkPermission('view in rss')) {
             $rss->addItem($ft->createFeedItem($rec));
         }
     }
     if (!$query['--subsearch']) {
         $rss->addItem($ft->createFeedItem($record));
     }
     header("Content-Type: application/xml; charset=" . $app->_conf['oe']);
     echo $rss->createFeed('RSS2.0');
     exit;
 }
Example #20
0
$image->link = $system_config_keyword_value['SYSTEM_IMAGE']['link'];
$image->description = $system_config_keyword_value['SYSTEM_IMAGE']['description'];
$rss->image = $image;
// get news items from somewhere:
$bbs_rss_array = $request->getAttribute('bbs_rss_array');
$system_top_address = $request->getAttribute('system_top_address');
$rss_display_max_count = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D06'), 'RSS_DISPLAY_MAX_COUNT');
$rss_count = 0;
foreach ($bbs_rss_array as $index => $data) {
    // CRLF → LF
    $body = preg_replace('/\\r\\n/', "\n", $data['body']);
    $item = new FeedItem();
    $item->post_date = $data['post_date'];
    $item->title = $data['community_id_name'] . "::" . $data['subject'];
    $item->link = $system_top_address . $data['bbs_url'];
    $item->description = $body;
    $item->image_link = $data['file_url'];
    $item->description2 = $body;
    //第2の本文
    $rss->addItem($item);
    $rss_count++;
    if ($rss_count == $rss_display_max_count) {
        // 最大出力表示件数の場合、終了
        break;
    }
}
// http-header
mb_http_output('pass');
header('Content-type: application/xml; charset=UTF-8');
echo mb_convert_encoding($rss->createFeed("RSS1.0"), 'UTF-8', mb_internal_encoding());
Example #21
0
function sms_board_output_rss($keyword, $line = "10", $format = "RSS0.91")
{
    global $core_config;
    $keyword = strtoupper($keyword);
    $line = $line ? $line : '10';
    $format_output = $format ? $format : "RSS0.91";
    include_once $core_config['apps_path']['plug'] . "/feature/sms_board/lib/external/feedcreator/feedcreator.class.php";
    $rss = new UniversalFeedCreator();
    $rss->title = $core_config['main']['web_title'];
    $rss->description = _('SMS Board') . ' ' . $keyword;
    $db_query1 = "SELECT * FROM " . _DB_PREF_ . "_featureBoard_log WHERE in_keyword='{$keyword}' ORDER BY in_datetime DESC LIMIT {$line}";
    $db_result1 = dba_query($db_query1);
    while ($db_row1 = dba_fetch_array($db_result1)) {
        $title = $db_row1['in_masked'];
        $description = $db_row1['in_msg'];
        $datetime = core_display_datetime($db_row1['in_datetime']);
        $items = new FeedItem();
        $items->title = $title;
        $items->description = $description;
        $items->comments = $datetime;
        $items->date = strtotime($datetime);
        $rss->addItem($items);
    }
    $feeds = $rss->createFeed($format_output);
    return $feeds;
}
    default:
        $rss_feed_name = "Student Feed" . ((int) $TARGET ? ", Class of " . $TARGET : "");
        $notice_where_clause = "(" . ((int) $TARGET ? "a.`target`=" . $db->qstr($TARGET) . " OR " : "") . "a.`target` = 'all' OR a.`target` = 'students')";
        break;
}
if (isset($_GET["o"]) && ($sanitized = clean_input($_GET["o"], array("int")))) {
    $ORGANISATION = $sanitized;
    $notice_where_clause .= 'AND (a.`organisation_id` IS NULL OR a.`organisation_id` = ' . $ORGANISATION . ')';
}
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = "Undergrad Notices: " . $rss_feed_name;
$rss->description = "Announcements, Schedule Changes, Updates and more from the Undergraduate Medicial Education Office, Queen's University.";
$rss->link = ENTRADA_URL . "/dashboard";
$rss->syndicationURL = ENTRADA_URL . "/notices/" . $TARGET;
$query = "\n\t\tSELECT a.*\n\t\tFROM `notices` AS a\n\t\tWHERE " . ($notice_where_clause ? $notice_where_clause . " AND" : "") . "\n\t\t(a.`display_from`='0' OR a.`display_from` <= '" . time() . "')\n\t\tORDER BY a.`updated_date` DESC, a.`display_from` DESC";
$results = USE_CACHE ? $db->CacheGetAll(CACHE_TIMEOUT, $query) : $db->GetAll($query);
if ($results) {
    foreach ($results as $result) {
        $item = new FeedItem();
        $item->title = $result["notice_summary"];
        $item->link = ENTRADA_URL . "/dashboard";
        $item->description = $result["notice_summary"];
        $item->date = unixstamp_to_iso8601((int) $result["display_from"] ? $result["display_from"] : time());
        $item->source = ENTRADA_URL . "/dashboard";
        $item->author = "Undergraduate Medical Office";
        $rss->addItem($item);
    }
}
echo $rss->createFeed();
Example #23
0
 function outputtorss($code, $line = "10")
 {
     $web_title = $this->web_title;
     include_once "{$this->apps_path}[inc]/feedcreator.class.php";
     $code = strtoupper($code);
     if (!$line) {
         $line = "10";
     }
     $format_output = "RSS0.91";
     $rss = new UniversalFeedCreator();
     $db_query1 = "SELECT * FROM phpgw_sms_tblsmsincoming WHERE in_code='{$code}' ORDER BY in_datetime DESC LIMIT 0,{$line}";
     $this->db->query($db_query1, __LINE__, __FILE__);
     while ($this->db->next_record()) {
         $title = $this->db->f('in_masked');
         $description = $this->db->f('in_msg');
         $datetime = $this->db->f('in_datetime');
         $items = new FeedItem();
         $items->title = $title;
         $items->description = $description;
         $items->comments = $datetime;
         $items->date = strtotime($datetime);
         $rss->addItem($items);
     }
     $feeds = $rss->createFeed($format_output);
     return $feeds;
 }