File: sample_rss_main.php

package info (click to toggle)
boinc 5.4.11-4%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 21,440 kB
  • ctags: 16,986
  • sloc: cpp: 70,682; ansic: 45,747; php: 35,513; xml: 10,487; sh: 9,324; python: 4,291; makefile: 1,958; asm: 1,258; perl: 914; sql: 395; csh: 126; pascal: 124
file content (88 lines) | stat: -rw-r--r-- 2,609 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
// rss_main.php:
// RSS 2.0 feed for BOINC default server installation.
// Channel Main show the current news on project mainpage 
// - for more informations about RSS see RSS 2.0 Specification:
//   http://blogs.law.harvard.edu/tech/rss

// Check your page with http://feedvalidator.org/                                                                                                                                     

// Create and send out http header
//

// Get unix time that last modification was made to the news source
//
$last_mod_time=filemtime("../project/project_news.inc");
$create_date  = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT'; 

// Now construct header
//
header ("Expires: " . gmdate('D, d M Y H:i:s', time()) . " GMT");
header ("Last-Modified: " . $create_date);
header ("Content-Type: application/xml");

// Get or set display options
// - from 1 to 9 News could be set by option news, default is up to 9
//
$news = "9";
if (isset($_GET["news"])) $news=$_GET["news"];

if($news < "1" or $news > "9") {
    $news = "9";
}

// include project constants and news file
//
require_once("../project/project.inc");
require_once("../project/project_news.inc");

// Create channel header and open XML content
//
$description = "BOINC project ".PROJECT.": Main page News";
$channel_image = URL_BASE . "rss_image.gif";
$language = "en-us";
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>
    <rss version=\"2.0\">
    <channel>
    <title>".PROJECT."</title>
    <link>".URL_BASE."</link>
    <description>".$description."</description>
    <copyright>".COPYRIGHT_HOLDER."</copyright>
    <lastBuildDate>".$create_date."</lastBuildDate>
    <language>".$language."</language>
    <image>
        <url>".$channel_image."</url>
        <title>".PROJECT."</title>
        <link>".URL_BASE."</link>
    </image>
";

// write news items
//
$tot = count($project_news);
$news = min( $tot, $news);
for( $item=0; $item < $news; $item++ ) {
    $j = $tot - $item;
    if( count($project_news[$item]) == 2) {
        $d = strtotime($project_news[$item][0]);
        $news_date=gmdate('D, d M Y H:i:s',$d) . ' GMT';
        $unique_url=URL_BASE."all_news.php#$j";
        echo "<item>
            <title>Project News ".strip_tags($project_news[$item][0])."</title>
            <link>$unique_url</link>
            <guid isPermaLink=\"true\">$unique_url</guid>
            <description>".strip_tags($project_news[$item][1])."</description>
            <pubDate>$news_date</pubDate>
            </item>
        ";
    }
}

// Close XML content
//
echo "
    </channel>
    </rss>
";

?>