logo       

cvs: pearweb /cron generate_rss_release.php: msg#00573

Subject: cvs: pearweb /cron generate_rss_release.php
pajoye          Thu Jan 30 14:55:58 2003 EDT

  Added files:                 
    /pearweb/cron       generate_rss_release.php 
  Log:
  Generate RSS for the releases
  
  

Index: pearweb/cron/generate_rss_release.php
+++ pearweb/cron/generate_rss_release.php
#!/usr/local/bin/php -Cq
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4; */
// +---------------------------------------------------------------------+
// |  PHP version 4.0                                                    |
// +---------------------------------------------------------------------+
// |  Copyright (c) 1997-2003 The PHP Group                              |
// +---------------------------------------------------------------------+
// |  This source file is subject to version 2.0 of the PHP license,     |
// |  that is bundled with this package in the file LICENSE, and is      |
// |  available through the world-wide-web at                            |
// |  http://www.php.net/license/2_02.txt.                               |
// |  If you did not receive a copy of the PHP license and are unable to |
// |  obtain it through the world-wide-web, please send a note to        |
// |  license@xxxxxxx so we can mail you a copy immediately.             |
// +---------------------------------------------------------------------+
// |  Authors:  Pierre-Alain Joye <paj@xxxxxxx>                          |
// +---------------------------------------------------------------------+
//


require_once 'DB.php';
require_once dirname(__FILE__) . '/../include/pear-database.php';
require_once dirname(__FILE__) . '/../include/rss.php';

if (DB::isError($dbh = DB::connect(DSN))) {
    die ("Couldn't open database -> ".DSN."\n");
}

$dow =  date ("w");
$end    =  mktime (0,0,0,date("m")  ,date("d")-$dow,date("Y"));
$start  =  mktime(0,0,0,date("m",$end)  ,date("d",$end)-7,date("Y",$end));

$recent = release::getDateRange($start,$end);
$out = "";
if (@sizeof($recent) > 0) {
    $items='';
    $rdfsequences='';
    foreach ($recent as $release) {
        extract($release);

        $releasedate = substr($releasedate, 0, 10);
        $desc = substr($releasenotes, 0, 40);
        if (strlen($releasenotes) > 40) {
            $desc .= '...';
        }

        //$description = str_replace("\n",'',$description);
        $description = strip_tags($description);
        $link_about      = 
htmlentities(PEAR_SITE."/package-info.php?pacid=$id");
        $link            = $link_about.htmlentities("&release=$version");
        $title  = "$name $version ($state)";


        $rdfsequences .= str_replace('{link}',  $name, $rdfseq);
        $cur_item = str_replace('{link_about}', $link_about, $item);
        $cur_item = str_replace('{title}',      $title, $cur_item);
        $cur_item = str_replace('{link}',       $link, $cur_item);
        $cur_item = str_replace('{description}',$description, $cur_item);
        $items .= str_replace('{date}',         $releasedate, $cur_item);
        }
    $pub_date = date("Y-m-d, H:i");

    $rss    = str_replace('{encoding}',$iso_maps['en'],$head);
    $rss    = str_replace('{pub_date}',$pub_date,$rss);
    $rss    = str_replace('{rdfsequences}',$rdfsequences,$rss).$items.$footer;
    $rss_file = PEAR_RSS_PATH.'/'.'releases.rss';
    $fp = fopen($rss_file,'w');
    if($fp){
        fputs($fp,$rss);
        fclose($fp);
    }
}
?>


-- 
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe