gaim/www
Clone
Summary
Browse
Changes
Graph
Initial import into CVS
chipx86
start
2002-09-26, Christian Hammond
2b210e25fed4
Initial import into CVS
<?php
require
"html.inc.php"
;
start_html
(
"News"
);
if
(
!
isset
(
$start
))
{
$start
=
0
;
}
if
(
!
isset
(
$limit
))
{
$limit
=
5
;
}
/* Parse the news. */
$filename
=
"news.txt"
;
$fp
=
fopen
(
$filename
,
"r"
);
$fcontents
=
file
(
$filename
);
$index
=
0
;
$pos
=
0
;
print
"<br />
\n
"
;
while
(
list
(
$linenum
,
$line
)
=
each
(
$fcontents
))
{
if
(
$pos
<
$start
)
{
if
(
chop
(
$line
)
==
"#"
)
{
$pos
++
;
}
continue
;
}
elseif
(
$pos
<
(
$start
+
$limit
))
{
if
(
chop
(
$line
)
==
"#"
)
{
end_section
();
print
"<br />
\n
"
;
$index
=
0
;
$pos
++
;
continue
;
}
elseif
(
$index
==
0
)
{
$cur_title
=
$line
;
}
elseif
(
$index
==
1
)
{
start_section
(
$cur_title
,
$line
);
$cur_title
=
""
;
}
else
{
print
"<p>"
.
$line
.
"</p>
\n
"
;
}
}
else
{
break
;
}
$index
++
;
}
if
(
$index
>
0
)
{
end_section
();
print
"<br />
\n
"
;
}
if
(
$index
==
0
||
$start
>
0
)
{
print
"<table border=
\"
0
\"
width=
\"
100%
\"
>
\n
"
;
print
" <tr>
\n
"
;
print
" <td nowrap=
\"
nowrap
\"
>"
;
if
(
$start
>
0
)
{
print
"<font face=
\"
Verdana, Tahoma, Arial, Helvetica
\"
"
;
print
" size=
\"
-1
\"
>"
;
print
"<a href=
\"
$PHP_SELF
?start="
;
print
((
$start
-
$limit
>
0
)
?
(
$start
-
$limit
)
:
0
);
print
"&limit=
$limit
\"
><- Previous</a>"
;
print
"</font>"
;
}
else
{
print
" "
;
}
print
"</td>
\n
"
;
print
" <td align=
\"
right
\"
nowrap=
\"
nowrap
\"
>"
;
if
(
$index
==
0
)
{
print
"<font face=
\"
Verdana, Tahoma, Arial, Helvetica
\"
"
;
print
" size=
\"
-1
\"
>"
;
print
"<a href=
\"
$PHP_SELF
?start=
$pos
&limit=
$limit
\"
>"
;
print
"Next -></a>"
;
print
"</font>"
;
}
else
{
print
" "
;
}
print
"</td>
\n
"
;
print
" </tr>
\n
"
;
print
"</table>
\n
"
;
}
end_html
();
?>