f355b4b511c3b1d83fad44130f819c000a2ab367
[cacert-devel.git] / www / news.php
1 <? /*
2 LibreSSL - CAcert web application
3 Copyright (C) 2004-2008 CAcert Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */ ?>
18 <?
19 loadem("index");
20
21 $id = intval($id);
22
23 showheader(_("Welcome to CAcert.org"));
24
25 if($id > 0)
26 {
27 $query = "select * from `news` where `id`='$id'";
28 $row = mysql_fetch_assoc(mysql_query($query));
29
30 echo "<h3>".$row['short']."</h3>\n";
31 echo "<p>Posted by ".$row['who']." at ".$row['when']."</p>\n";
32
33 echo "<p>".str_replace("\n", "<br>\n", $row['story'])."</p>\n";
34 } else {
35 $query = "select *, UNIX_TIMESTAMP(`when`) as `TS` from news order by `when` desc";
36 $res = mysql_query($query);
37 while($row = mysql_fetch_assoc($res))
38 {
39 echo "<p><b>".date("Y-m-d", $row['TS'])."</b> - ".$row['short']."</p>\n";
40 if($row['story'] != "")
41 echo "<p>[ <a href='news.php?id=".$row['id']."'>"._("Full Story")."</a> ]</p>\n";
42 }
43 }
44
45 echo "<p>[ <a href='javascript:history.go(-1)'>"._("Go Back")."</a> ]</p>\n";
46
47 showfooter();
48 ?>