gaim/www
Clone
Summary
Browse
Changes
Graph
Clarification about docklet plugin.. some people were looking in the plugin tracker for it.
2004-01-10, Herman Bloggs
c63d6e0ee3b9
Clarification about docklet plugin.. some people were looking in the plugin tracker for it.
<?php
function
left
(
$str
,
$num
)
{
return
substr
(
$str
,
0
,
$num
);
}
function
rss_parse_date
(
$date
)
{
$date
=
str_replace
(
"st,"
,
""
,
$date
);
$date
=
str_replace
(
"nd,"
,
""
,
$date
);
$date
=
str_replace
(
"rd,"
,
""
,
$date
);
$date
=
str_replace
(
"th,"
,
""
,
$date
);
$timestamp
=
strtotime
(
$date
);
return
date
(
"r"
,
$timestamp
);
}
function
rss_header
(
$title
,
$description
,
$url
)
{
print
"<?xml version=
\"
1.0
\"
?>
\n\n
"
;
print
"<rss version=
\"
0.91
\"
>
\n
"
;
print
" <channel>
\n
"
;
print
" <title>
$title
</title>
\n
"
;
print
" <description>
$description
</description>
\n
"
;
print
" <link>
$url
</link>
\n
"
;
}
function
rss_footer
()
{
print
" </channel>
\n
"
;
print
"</rss>
\n
"
;
}
function
rss_start_item
(
$title
,
$date
,
$link
)
{
$title
=
chop
(
$title
);
$date
=
chop
(
$date
);
$title
=
htmlentities
(
$title
);
$date
=
rss_parse_date
(
$date
);
print
" <item>
\n
"
;
print
" <title>
$title
</title>
\n
"
;
print
" <pubDate>
$date
</pubDate>
\n
"
;
print
" <link>
$link
</link>
\n
"
;
}
function
rss_end_item
()
{
print
" </item>
\n
"
;
}
function
rss_description
(
$text
)
{
$text
=
chop
(
$text
);
$text
=
htmlentities
(
$text
);
print
" <description>
\n
"
;
print
"
$text
\n
"
;
print
" </description>
\n
"
;
}
if
(
$PATH_INFO
==
"/news"
)
{
header
(
"Content-type: text/xml"
);
rss_header
(
"Gaim news"
,
"Gaim news"
,
"http://gaim.sourceforge.net/index.php"
);
if
(
!
isset
(
$start
))
{
$start
=
0
;
}
if
(
!
isset
(
$limit
))
{
$limit
=
10
;
}
$fcontents
=
file
(
"news.txt"
);
$index
=
0
;
$pos
=
0
;
while
(
list
(
$linenum
,
$line
)
=
each
(
$fcontents
))
{
if
(
$pos
<
$start
)
{
if
(
chop
(
$line
)
==
"#"
)
$pos
++
;
continue
;
}
elseif
(
$pos
<
(
$start
+
$limit
))
{
if
(
chop
(
$line
)
==
"#"
)
{
rss_end_item
();
$index
=
0
;
$pos
++
;
continue
;
}
elseif
(
$index
==
0
)
{
$cur_title
=
$line
;
}
elseif
(
$index
==
1
)
{
rss_start_item
(
$cur_title
,
$line
,
"http://gaim.sourceforge.net/index.php?start=
$pos
"
);
$cur_title
=
""
;
}
else
{
rss_description
(
$line
);
}
}
else
break
;
$index
++
;
}
if
(
$index
>
0
)
rss_end_item
();
rss_footer
();
}
else
{
print
"RSS information for
$PATH_INFO
is not provided."
;
}
?>