Index: trunk/www/.htaccess
===================================================================
--- trunk/www/.htaccess	(revision 3981)
+++ trunk/www/.htaccess	(revision 3981)
@@ -0,0 +1,4 @@
+<Files ~ "\.inc$">
+    Order allow,deny
+    Deny from all
+</Files>
Index: trunk/www/admin/.htaccess
===================================================================
--- trunk/www/admin/.htaccess	(revision 3981)
+++ trunk/www/admin/.htaccess	(revision 3981)
@@ -0,0 +1,4 @@
+AuthName "DP Site Administration"
+AuthType Basic
+AuthUserFile /Users/mij/.htpasswd
+require valid-user
Index: trunk/www/admin/headlines/add.php
===================================================================
--- trunk/www/admin/headlines/add.php	(revision 3981)
+++ trunk/www/admin/headlines/add.php	(revision 3981)
@@ -0,0 +1,20 @@
+  <?php
+    $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
+    include_once("$DOCUMENT_ROOT/includes/common.inc");
+    include_once("$DOCUMENT_ROOT/includes/functions.inc");
+    print_header('DarwinPorts | Add news', 'iso-8859-1');
+  ?>
+
+    <div id="content">
+      <h2 class="hdr">Add news</h2>
+
+      <?php
+	print_add_headline();
+      ?>
+
+      </div>
+    </div>
+
+<?php
+  print_footer();
+?>
Index: trunk/www/admin/headlines/edit.php
===================================================================
--- trunk/www/admin/headlines/edit.php	(revision 3981)
+++ trunk/www/admin/headlines/edit.php	(revision 3981)
@@ -0,0 +1,20 @@
+  <?php
+    $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
+    include_once("$DOCUMENT_ROOT/includes/common.inc");
+    include_once("$DOCUMENT_ROOT/includes/functions.inc");
+    print_header('DarwinPorts | Edit news', 'iso-8859-1');
+  ?>
+
+    <div id="content">
+      <h2 class="hdr">Edit news</h2>
+
+      <?php
+	print_edit_headline($_GET['id']);
+      ?>
+
+      </div>
+    </div>
+
+<?php
+  print_footer();
+?>
Index: trunk/www/admin/headlines/index.php
===================================================================
--- trunk/www/admin/headlines/index.php	(revision 3981)
+++ trunk/www/admin/headlines/index.php	(revision 3981)
@@ -0,0 +1,4 @@
+<html>
+<body>
+</body>
+</html>
Index: trunk/www/admin/headlines/list.php
===================================================================
--- trunk/www/admin/headlines/list.php	(revision 3981)
+++ trunk/www/admin/headlines/list.php	(revision 3981)
@@ -0,0 +1,20 @@
+  <?php
+    $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
+    include_once("$DOCUMENT_ROOT/includes/common.inc");
+    include_once("$DOCUMENT_ROOT/includes/functions.inc");
+    print_header('DarwinPorts | List all news', 'iso-8859-1');
+  ?>
+
+    <div id="content">
+      <h2 class="hdr">List all news</h2>
+
+      <?php
+	print_all_headlines();
+      ?>
+
+      </div>
+    </div>
+
+<?php
+  print_footer();
+?>
Index: trunk/www/admin/headlines/rss.php
===================================================================
--- trunk/www/admin/headlines/rss.php	(revision 3981)
+++ trunk/www/admin/headlines/rss.php	(revision 3981)
@@ -0,0 +1,5 @@
+<?php
+  $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
+  include_once("$DOCUMENT_ROOT/includes/functions.inc");
+  create_rss();
+?>
Index: trunk/www/admin/index.php
===================================================================
--- trunk/www/admin/index.php	(revision 3981)
+++ trunk/www/admin/index.php	(revision 3981)
@@ -0,0 +1,27 @@
+  <?php
+    $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
+    include_once("$DOCUMENT_ROOT/includes/common.inc");
+    include_once("$DOCUMENT_ROOT/includes/functions.inc");
+    print_header('DarwinPorts Site Administration', 'iso-8859-1');
+  ?>
+
+    <div id="content">
+      <h2 class="hdr">Site Administration</h2>
+
+      <p>Use the links below to manage the headlines on the front page of
+	the site:</p>
+
+      <ul>
+	<li><a href="/admin/headlines/add.php">Add headline</a></li>
+	<li><a href="/admin/headlines/list.php">List all headlines</a></li>
+	<li><a href="/admin/headlines/rss.php">Regenerate RSS feed</a></li>
+      </ul>
+
+      <p>If you need to edit an already-posted headline, find it in the <a
+	href="/admin/headlines/list.php">list</a>, and choose edit.</p>
+    </div>
+  </div>
+
+<?php
+  print_footer();
+?>
Index: trunk/www/dp.css
===================================================================
--- trunk/www/dp.css	(revision 3981)
+++ trunk/www/dp.css	(revision 3981)
@@ -0,0 +1,215 @@
+/*
+  $Id: dp.css,v 1.1 2003/11/19 01:59:06 mij Exp $
+*/
+
+* {
+	font-family: Georgia, "New Century Schoolbook", "Times New Roman", Times, serif;
+}
+
+body {
+	background: #e3f1c7;
+	width: 720px;
+	margin: 15px auto 15px auto;
+	font-size: 12px;
+}
+
+a:link {
+	color: #669;
+	text-decoration: none;
+	font-weight: bold;
+	border-bottom: 1px dotted #c63;
+}
+
+a:visited {
+	color: #888;
+	text-decoration: none;
+	font-weight: bold;
+	border-bottom: 1px dotted #669;
+}
+
+a:hover {
+	color: #c63;
+	text-decoration: none;
+	font-weight: bold;
+	border-bottom: 1px dotted #369;
+}
+
+img, a img {
+	border: none;
+	text-decoration: none;
+}
+
+h1 {
+	font-size: 22px;
+}
+
+h2 {
+	font-size: 20px;
+}
+
+h3 {
+	font-size: 18px;
+}
+
+h4 {
+	font-size: 16px;
+}
+
+h5 {
+	font-size: 14px;
+}
+
+h6 {
+	font-size: 13px;
+}
+
+br {
+	clear: both;
+}
+
+p {
+	margin: 10px 0 1em 0;
+	line-height: 16px;
+}
+
+input, textarea {
+	font-family: Courier, "Courier New", monospace;
+}
+
+kbd {
+	color: #c63;
+	font-family: Courier, "Courier New", monospace;
+}
+
+pre {
+	color:  #369;
+	font-family: Courier, "Courier New", monospace;
+	margin-left: 20px;
+}
+
+#nav {
+	height: 76px;
+	padding: 0;
+	font-size: 10px;
+}
+
+#logo {
+	background: #fff;
+	float: left;
+	display: inline;
+	width: 400px;
+	height: 75px;
+	border-top: 1px solid #bbb;
+	border-bottom: 1px solid #bbb;
+}
+
+#logo a {
+	border: none;
+}
+
+#nav #l {
+	width: 150px;
+	height: 75px;
+	float: left;
+	border: 1px solid #bbb;
+}
+
+#nav #r {
+	width: 150px;
+	height: 75px;
+	float: left;
+	border-top: 1px solid #bbb;
+	border-bottom: 1px solid #bbb;
+}
+
+#nav ul {
+	list-style-type: none;
+	margin: 0;
+	padding: 0;
+	text-align: center;
+}
+
+#nav li a {
+	background: #fff;
+	display: block;
+	text-decoration: none;
+	line-height: 20px;
+	padding: 2px;
+	border-bottom: 1px solid #bbb;
+}
+
+#nav li a:visited {
+	color: #999;
+	text-decoration: none;
+}
+
+#nav li a:hover {
+	background: #d8e6e7;
+	color: #888;
+}
+
+#nav li.last a {
+	border: none;
+	display: block;
+	line-height: 21px;
+}
+
+#nav li.selected a {
+	background: #f3f3f3;
+	color: #c63;
+}
+
+#nav li.sellast a {
+	background: #f3f3f3;
+	color: #c63;
+	border: none;
+	display: block;
+	line-height: 21px;
+}
+
+#main {
+	background: #fff;
+	width: 702px;
+	border-right: 1px solid #bbb;
+	border-left: 1px solid #bbb;
+	padding-bottom: 100px;
+}
+
+#content {
+	width: 80%; 
+	margin: 10px 0 0 0;
+	padding: 5px 20px;
+}
+
+#news {
+	margin: 10px 0 0 0;
+	padding: 5px 0 0 0;
+}
+
+#footer {
+	width: 692px;
+	background: #fff;
+	border: 1px solid #bbb;
+	text-align: right;
+	font-size: 10px;
+	padding: 5px;
+}
+
+.hdr {
+	color: #669;
+	margin: 0;
+	padding: 10px 0 0 0;
+	border-bottom: 1px solid #bbb;
+}
+
+.subhdr {
+	color: #879880;
+	margin: 5px 0 0 0;
+	padding: 0;
+}
+
+.date {
+	color: #999;
+	margin: 0 auto;
+	padding: 0;
+}
Index: trunk/www/dp_news.xml
===================================================================
--- trunk/www/dp_news.xml	(revision 3981)
+++ trunk/www/dp_news.xml	(revision 3981)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<rss version="2.0"
+  xmlns:dc="http://purl.org/dc/elements/1.1/"
+  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+  xmlns:admin="http://webns.net/mvcb/"
+  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+  xmlns:content="http://purl.org/rss/1.0/modules/content/">
+
+  <channel>
+    <title>DarwinPorts Project News</title>
+    <link>http://darwinports.opendarwin.org/</link>
+    <description>DarwinPorts Project News</description>
+    <dc:language>en-us</dc:language>
+    <dc:creator>Jim Mock (mij@opendarwin.org)</dc:creator>
+    <dc:rights>Copyright 2002-2003</dc:rights>
+    <dc:date>2003-10-24T21:45:4:50</dc:date>
+    <admin:errorReportsTo rdf:resource"mailto:mij@opendarwin.org" />
+    <item>
+      <title>Test 2</title>
+      <link>http://darwinports.opendarwin.org/archives/2.php</link>
+      <description><![CDATA[<p>Another test.</p>...</p>]]></description>
+      <guid isPermaLink="true">http://darwinports.opendarwin.org/archives/2.php</guid>
+      <content:encoded><![CDATA[<p>Another test.</p>]]></content:encoded>
+    </item>
+    <item>
+      <title>Test</title>
+      <link>http://darwinports.opendarwin.org/archives/1.php</link>
+      <description><![CDATA[<p>This is a test.</p>...</p>]]></description>
+      <guid isPermaLink="true">http://darwinports.opendarwin.org/archives/1.php</guid>
+      <content:encoded><![CDATA[<p>This is a test.</p>]]></content:encoded>
+    </item>
+  </channel>
+</rss>
Index: trunk/www/getdp/index.php
===================================================================
--- trunk/www/getdp/index.php	(revision 3981)
+++ trunk/www/getdp/index.php	(revision 3981)
@@ -0,0 +1,49 @@
+  <?php
+    $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
+    include_once("$DOCUMENT_ROOT/includes/common.inc");
+    /* include_once("$DOCUMENT_ROOT/includes/functions.inc"); */
+    print_header('Get DarwinPorts', 'iso-8859-1');
+  ?>
+
+    <div id="content">
+      <h2 class="hdr">Get DarwinPorts</h2>
+
+      <p>If you would like to install DarwinPorts, it first needs to be 
+	&ldquo;checked out&rdquo; of the OpenDarwin CVS repository.</p>
+
+      <p>Please note that in order to install and run DarwinPorts, you must
+	have either the Mac OS X Developer Tools (for 10.2.x), or XCode (for
+	10.3.x) installed.</p>
+
+      <p>Use the following commands to check the project out of the CVS
+	repository:</p>
+
+      <pre>cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od login
+cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od co -P darwinports</pre>
+
+      <p>When the server asks you for a password, simply press
+	<kbd>return</kbd> on your keyboard&mdash;the password is empty.</p>
+
+      <p>If you'd simply like to view the CVS repository without checking it
+	out, you can do so via <a
+	href="http://www.opendarwin.org/cgi-bin/cvsweb.cgi/proj/darwinports/">CVSweb</a>.</p>
+
+      <h5 class="subhdr">Installation</h5>
+
+      <p>Once you have the project checked out of the CVS repository, there
+	are a still a few things you will need to do before you can install
+	a port.</p>
+	
+      <p>For installation instructions, please see the <tt>README</tt>
+	file in the directory where you performed the CVS checkout.  There is
+	also an <a href="http://bsdnews.org/01/darwinports.php">article</a>
+	available at <a href="http://bsdnews.org/">BSDnews</a> which
+	provides DarwinPorts installation and usage instructions.</p> 
+
+      <p><a href="/help/">Help</a> is also available should you need it.</p>
+    </div>
+  </div>
+
+<?php
+  print_footer();
+?>
Index: trunk/www/help/index.php
===================================================================
--- trunk/www/help/index.php	(revision 3981)
+++ trunk/www/help/index.php	(revision 3981)
@@ -0,0 +1,42 @@
+  <?php
+    $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
+    include_once("$DOCUMENT_ROOT/includes/common.inc");
+    /* include_once("$DOCUMENT_ROOT/includes/functions.inc"); */
+    print_header('Get Help', 'iso-8859-1');
+  ?>
+
+    <div id="content">
+      <h2 class="hdr">Get Help</h2>
+
+      <p>If you get stuck, there are a few different ways you can find
+	help.</p>
+
+      <h5 class="subhdr">Mailing Lists</h5>
+
+      <p>The <a href="http://www.opendarwin.org/mailman/listinfo/darwinports">darwinports
+	mailing list</a> is open to all and is where most architectural and
+	feature discussions are held.  It is also the place to ask questions
+	if you have any.</p>
+
+      <p>Those interested in seeing the commits to the CVS repository can
+	also subscribe to the <a href="http://www.opendarwin.org/mailman/listinfo/cvs-darwinports-all">cvs-darwinports-all</a>
+	mailing list.</p>
+
+      <h5 class="subhdr">IRC</h5>
+
+      <p>For more real-time discussion, the #opendarwin channel on the <a
+	href="http://freenode.net/">freenode IRC network</a> is generally
+	where we hang out.</p>
+	
+      <p>Though it is generally helpful, please keep in mind that no one is
+	obligated to help or even answer your question if you join the IRC
+	channel.  Do not take it personally, simply ask your question
+	on the <a href="http://www.opendarwin.org/mailman/listinfo/darwinports">darwinports
+	mailing list</a> instead.</p>
+
+    </div>
+  </div>
+
+<?php
+  print_footer();
+?>
Index: trunk/www/includes/common.inc
===================================================================
--- trunk/www/includes/common.inc	(revision 3981)
+++ trunk/www/includes/common.inc	(revision 3981)
@@ -0,0 +1,44 @@
+<?php
+
+# $Id: common.inc,v 1.1 2003/11/19 01:59:08 mij Exp $
+# Copyright (c) 2003, OpenDarwin
+
+######################################################################
+
+# print the page header
+function print_header($title, $encoding) {
+  global $DOCUMENT_ROOT;
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+  "http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <title><?php echo("$title"); ?></title>
+    <meta http-equiv="Content-type" content="text/html; charset=<?php echo("$encoding"); ?>" />
+    <meta name="author" content="Jim Mock (mij@opendarwin.org)" />
+    <meta name="copyright" content="2003, OpenDarwin" />
+    <meta name="robots" content="all" />
+    <link rel="stylesheet" type="text/css" href="/dp.css" />
+    <link rel="alternate" type="application/rss+xml" href="http://darwinports.opendarwin.org/dp.xml" />
+  </head>
+
+  <body>
+
+  <div id="main">
+
+<?php
+  include("$DOCUMENT_ROOT/includes/header.inc");
+}
+
+###################################################################### 
+
+# print the page footer
+function print_footer() {
+  global $DOCUMENT_ROOT;
+
+  include("$DOCUMENT_ROOT/includes/footer.inc");
+
+  echo "  </body>\n";
+  echo "</html>\n";
+}
+?>
Index: trunk/www/includes/db.inc
===================================================================
--- trunk/www/includes/db.inc	(revision 3981)
+++ trunk/www/includes/db.inc	(revision 3981)
@@ -0,0 +1,6 @@
+<?php
+  $host = 'localhost';
+  $user = 'dp_www';
+  $pass = 'dp_secret';
+  $db = 'dp_www';
+?>
Index: trunk/www/includes/footer.inc
===================================================================
--- trunk/www/includes/footer.inc	(revision 3981)
+++ trunk/www/includes/footer.inc	(revision 3981)
@@ -0,0 +1,3 @@
+      <div id="footer">
+      	Copyright &copy; 2002-2003, <a href="http://www.opendarwin.org/">OpenDarwin</a>.  All rights reserved.
+      </div>
Index: trunk/www/includes/functions.inc
===================================================================
--- trunk/www/includes/functions.inc	(revision 3981)
+++ trunk/www/includes/functions.inc	(revision 3981)
@@ -0,0 +1,256 @@
+<?php
+
+# $Id: functions.inc,v 1.1 2003/11/19 01:59:08 mij Exp $
+# Copyright (c) 2003, OpenDarwin
+
+######################################################################
+
+# variables and includes
+$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
+$PHP_SELF = $_SERVER['PHP_SELF'];
+include_once("$DOCUMENT_ROOT/includes/db.inc");
+$connect = mysql_pconnect($host, $user, $pass) or die("Can't connect to db!");
+mysql_select_db($db);
+
+######################################################################
+
+# create an RSS feed of the project news
+function create_rss() {
+  global $DOCUMENT_ROOT, $connect;
+
+  $query = "SELECT id, title, news FROM headlines ORDER BY timestamp DESC LIMIT 10";
+  $result = mysql_query($query) or die("Error: $query.");
+  if(!$result) {
+    die("Error: $result.");
+  }
+
+  $open = fopen("$DOCUMENT_ROOT/dp_news.xml", "w+");
+  $rssdate = substr_replace(date("Y-m-d\TH:i:s0", time()),':', -2, 0);
+
+  $rss = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
+  $rss .= "<rss version=\"2.0\"\n";
+  $rss .= "  xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n";
+  $rss .= "  xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\"\n";
+  $rss .= "  xmlns:admin=\"http://webns.net/mvcb/\"\n";
+  $rss .= "  xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
+  $rss .= "  xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">\n\n";
+
+  $rss .= "  <channel>\n";
+  $rss .= "    <title>DarwinPorts Project News</title>\n";
+  $rss .= "    <link>http://darwinports.opendarwin.org/</link>\n";
+  $rss .= "    <description>DarwinPorts Project News</description>\n";
+  $rss .= "    <dc:language>en-us</dc:language>\n";
+  $rss .= "    <dc:creator>Jim Mock (mij@opendarwin.org)</dc:creator>\n";
+  $rss .= "    <dc:rights>Copyright 2002-2003</dc:rights>\n";
+  $rss .= "    <dc:date>$rssdate</dc:date>\n";
+  $rss .= "    <admin:errorReportsTo rdf:resource\"mailto:mij@opendarwin.org\" />\n";
+
+  if(mysql_num_rows($result) > 0) {
+    while($row = mysql_fetch_object($result)) {
+      $rss .= "    <item>\n";
+      $rss .= "      <title>$row->title</title>\n";
+      $rss .= "      <link>http://darwinports.opendarwin.org/archives/$row->id.php</link>\n";
+
+      $desc_query = "SELECT SUBSTRING_INDEX(news, ' ', 26) FROM headlines WHERE id=$row->id";
+      $desc_result = mysql_query($desc_query);
+      $desc_row = mysql_fetch_row($desc_result);
+
+      $description = $desc_row[0];
+
+      $rss .= "      <description><![CDATA[$description...</p>]]></description>\n";
+      $rss .= "      <guid isPermaLink=\"true\">http://darwinports.opendarwin.org/archives/$row->id.php</guid>\n";
+      $rss .= "      <content:encoded><![CDATA[$row->news]]></content:encoded>\n";
+      $rss .= "    </item>\n";
+    }
+  }
+  $rss .= "  </channel>\n";
+  $rss .= "</rss>\n";
+
+  $write = fwrite($open, $rss);
+  $close = fclose($open);
+}
+
+######################################################################
+
+# print the project news
+function print_headlines() {
+  global $connect;
+
+  $query = "SELECT id, DATE_FORMAT(timestamp, '%e %b %Y, %l:%i %p') AS f_timestamp, title, news FROM headlines ORDER BY timestamp DESC LIMIT 5";
+  $result = mysql_query($query) or die("Error: $query.");
+  if(!$result) {
+    die("Error: $result.");
+  }
+
+  if(mysql_num_rows($result) > 0) {
+    while($row = mysql_fetch_object($result)) {
+      echo "<h5 class=\"subhdr\">$row->title</h5>\n";
+      echo "<h6 class=\"date\">$row->f_timestamp</h6>\n";
+      echo "$row->news\n\n";
+    }
+  }
+  else {
+    echo "<p>No headlines are available at this time.</p>\n";
+  }
+}
+
+######################################################################
+
+# display a single headline
+function print_headline() {
+  global $connect;
+
+  $id = $_GET['id'];
+  $query = "SELECT id, DATE_FORMAT(timestamp, '%e %b %Y, %l:%i %p') AS f_timestamp, title, news FROM headlines WHERE id='$id'";
+  $result = mysql_query($query) or die("Error: $query.");
+  if(!$result) {
+    die("Error: $result.");
+  }
+
+  $row = mysql_fetch_object($result);
+  if($row) {
+    echo "<h5 class=\"subhdr\">$row->title</h5>\n";
+    echo "<h6 class=\"date\">$row->f_timestamp</h6>\n";
+    echo "$row->news\n\n";
+  }
+  else {
+    echo "<h2 class=\"hdr\">Error!</h2>\n";
+    echo "<p>The requested headline could not be found.  It is either not in the database, or an error has occurred.</p>\n";
+  }
+}
+
+######################################################################
+
+# print the form used to add project news
+function print_add_headline() {
+  global $PHP_SELF, $connect;
+
+  if(!$_POST['submit']) {
+    echo "<p>Use the form below to add project news.</p>\n\n";
+    echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
+    echo "<p>Title:&nbsp;&nbsp;<input type=\"text\" name=\"title\" size=\"40\" /></p>\n";
+    echo "<p>News:</p>\n";
+    echo "<p><textarea name=\"news\" cols=\"70\" rows=\"20\"></textarea></p>\n";
+    echo "<p><input type=\"submit\" name=\"submit\" value=\"Submit\" /></p>\n";
+    echo "</form>\n\n";
+  }
+  else {
+    $title = $_POST['title'];
+    $news = $_POST['news'];
+    $errorList = array();
+    $count = 0;
+    if(!$title) {
+      $errorList[$count] = 'Invalid entry: Title';
+      $count++;
+    }
+    if(!$news) {
+      $errorList[$count] = 'Invalid entry: News';
+      $count++;
+    }
+    if(sizeof($errorList) == 0) {
+      $query = "INSERT INTO headlines (timestamp, title, news) VALUES (NOW(), '$title', '$news')";
+      $result = mysql_query($query) or die("Error: $query.");
+      if(!$result) {
+	die("Error: $result.");
+      }
+      echo "<p>The addition was successful.  You can either <a href=\"list.php\">list all existing headlines, <a href=\"add.php\">add another headline</a>, or <a href=\"/\">return to the DarwinPorts site</a>.</p>\n\n";
+      create_rss();
+    }
+    else {
+      echo "<p>The following errors have occurred:</p>\n\n";
+      echo "<ul>\n";
+      for($x=0; $x<sizeof($errorList); $x++) {
+	echo "<li>$errorList[$x]</li>\n";
+      }
+      echo "</ul>\n\n";
+    }
+  }
+}
+
+######################################################################
+
+# print the form used to edit project news
+function print_edit_headline($id) {
+  global $PHP_SELF, $connect;
+
+  if(!$_POST['submit']) {
+    $id = $_GET['id'];
+    $query = "SELECT title, news FROM headlines WHERE id='$id'";
+    $result = mysql_query($query) or die("Error: $query.");
+    if(!$result) {
+      die("Error: $result.");
+    }
+    if(mysql_num_rows($result) > 0) {
+      $row = mysql_fetch_object($result);
+      echo "<p>Use the form below to edit project news.</p>\n\n";
+      echo "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
+      echo "<p>Title:&nbsp;&nbsp;<input type=\"text\" name=\"title\" size=\"40\" value=\"$row->title\" /></p>\n";
+      echo "<p>News:</p>\n";
+      echo "<p><textarea name=\"news\" cols=\"70\" rows=\"20\">";
+      echo htmlentities($row->news);
+      echo "</textarea></p>\n";
+      echo "<p><input type=\"submit\" name=\"submit\" value=\"Edit\" /></p>\n";
+      echo "</form>\n\n";
+    }
+    else {
+      echo "<p>The requested news headline could not be found.  It is either not in the database, or an error has occurred.  Please try again.</p>\n\n";
+    }
+  }
+  else {
+    $title = $_POST['title'];
+    $news = $_POST['news'];
+    $errorList = array();
+    $count = 0;
+    if(!$title) {
+      $errorList[$count] = 'Invalid entry: Title';
+      $count++;
+    }
+    if(!$news) {
+      $errorList[$count] = 'Invalid entry: News';
+      $count++;
+    }
+    if(sizeof($errorList) == 0) {
+      $query = "UPDATE headlines SET title='$title', news='$news' WHERE id='$id'";
+      $result = mysql_query($query) or die("Error: $query.");
+
+      if(!$result) {
+	die("Error: $result.");
+      }
+      echo "<p>The update was successful.  You can either <a href=\"list.php\">list all existing headlines, <a href=\"add.php\">add another headline</a>, or <a href=\"/\">return to the DarwinPorts site</a>.</p>\n\n";
+      create_rss();
+    }
+    else {
+      echo "<p>The following errors have occurred:</p>\n\n";
+      echo "<ul>\n";
+      for($x=0; $x<sizeof($errorList); $x++) {
+	echo "<li>$errorList[$x]</li>\n";
+      }
+      echo "</ul>\n\n";
+    }
+  }
+}
+
+######################################################################
+
+# print a list of all existing headlines
+function print_all_headlines() {
+  global $connect;
+
+  echo "<p>Below is a list of all existing news headlines.  They can be viewed, edited, or deleted from this interface.  Alternatively, you can also <a href=\"add.php\">add news</a>.</p>\n\n";
+
+  $query = "SELECT id, title, DATE_FORMAT(timestamp, '%e %b %Y, %l:%i %p') AS f_timestamp FROM headlines ORDER BY timestamp DESC";
+  $result = mysql_query($query) or die("Error: $query.");
+  if(!$result) {
+    die("Error: $result.");
+  }
+  if(mysql_num_rows($result) > 0) {
+    while($row = mysql_fetch_object($result)) {
+      echo "<p><a href=\"/archives/$row->id.php\">$row->title</a><br />&nbsp&nbsp;$row->f_timestamp&nbsp;&nbsp;|&nbsp;&nbsp;<a href=\"edit.php?id=$row->id\">edit</a></p>\n\n";
+    }
+  }
+  else {
+    echo "<p>No headlines are available.</p>\n\n";
+  }
+}
+
+?>
Index: trunk/www/includes/header.inc
===================================================================
--- trunk/www/includes/header.inc	(revision 3981)
+++ trunk/www/includes/header.inc	(revision 3981)
@@ -0,0 +1,50 @@
+      <div id="nav">
+	<div id="logo">
+	  <a href="/" title="DarwinPorts"><img src="/img/dp.jpg"
+	    alt="DarwinPorts" /></a>
+	</div>
+	<div id="l">
+	  <ul>
+	  <?php
+	    $PHP_SELF = $_SERVER['PHP_SELF'];
+	    $home = '/index.php';
+	    $getdp = '/getdp/index.php';
+	    $ports = '/ports/index.php';
+	    $help = '/help/index.php';
+
+	    if($PHP_SELF == $home) {
+	      echo "<li class=\"selected\"><a href=\"/\" title=\"DarwinPorts Home\">DarwinPorts Home</a></li>\n";
+	    }
+	    else {
+	      echo "<li><a href=\"/\" title=\"DarwinPorts Home\">DarwinPorts Home</a></li>\n";
+	    }
+	    if($PHP_SELF == $getdp) {
+	      echo "<li class=\"selected\"><a href=\"/getdp/\" title=\"Get DarwinPorts\">Get DarwinPorts</a></li>\n";
+	    }
+	    else {
+	      echo "<li><a href=\"/getdp/\" title=\"Get DarwinPorts\">Get DarwinPorts</a></li>\n";
+	    }
+	  ?>
+	    <li class="last"><a href="http://www.opendarwin.org/bugzilla/" title="Bugzilla">Bugzilla</a></li>
+	  </ul>
+	</div>
+	<div id="r">
+	  <ul>
+	    <li><a href="/docs/" title="Documentation">Documentation</a></li>
+	    <?php
+	      if($PHP_SELF == $ports) {
+		echo "<li class=\"selected\"><a href=\"/ports/\" title=\"Available Ports\">Available Ports</a></li>\n";
+	      }
+	      else {
+		echo "<li><a href=\"/ports/\" title=\"Available Ports\">Available Ports</a></li>\n";
+	      }
+	      if($PHP_SELF == $help) {
+		echo "<li class=\"sellast\"><a href=\"/help/\" title=\"Get Help\">Get Help</a></li>\n";
+	      }
+	      else {
+		echo "<li class=\"last\"><a href=\"/help/\" title=\"Get Help\">Get Help</a></li>\n";
+	      }
+	    ?>
+	  </ul>
+	</div>
+      </div>
Index: trunk/www/includes/lang.inc
===================================================================
--- trunk/www/includes/lang.inc	(revision 3981)
+++ trunk/www/includes/lang.inc	(revision 3981)
@@ -0,0 +1,3 @@
+      <p id="lang">[ <a href="/">English</a>, <a
+	href="/ja/">Japanese</a>, <a href="/fr/">Fran&ccedil;ais</a>, <a
+	href="/es/">Espa&ntilde;ol</a> ]</p>
Index: trunk/www/index.php
===================================================================
--- trunk/www/index.php	(revision 3879)
+++ 	(revision )
@@ -1,11 +1,0 @@
-<?
-
-//
-// File     : index.php
-// Version  : $Id: index.php,v 1.14 2002/12/20 11:31:09 kevin Exp $
-// Location : /projects/darwinports/index.php
-//
-
-	require_once("$DOCUMENT_ROOT/projects/darwinports/en/index.php");
-
-?>
Index: trunk/www/ports.php
===================================================================
--- trunk/www/ports.php	(revision 3879)
+++ 	(revision )
@@ -1,213 +1,0 @@
-<?
-	require_once("$DOCUMENT_ROOT/en/includes/od_lib.inc.php");
-	require_once("$DOCUMENT_ROOT/includes/od_db.inc.php");
-
-	od_print_header("DarwinPorts Portfiles", "en", "iso-8859-1", "", 0);
-?>
-	<center>
-	<h1>DarwinPorts Portfiles</h1>
-	</center>
-
-	<p>
-	This form allows you to search the current index of DarwinPorts software. <br />
-	<i>Index last updated: </i>
-	<?
-		$sql = "SELECT UNIX_TIMESTAMP(activity_time) FROM darwinports.log ORDER BY UNIX_TIMESTAMP(activity_time) DESC";
-		$result = mysql_query($sql);
-		if($result && $row = mysql_fetch_row($result)) {
-				echo date("d-M-Y H:i:s", $row[0]);
-		}
-	?>
-	</p>
-	
-	<form action="<?= $PHP_SELF; ?>">
-	<table>
-		<tr>
-			<th>Search by:</th>
-			<td>
-				<select name="by">
-				<option value="name"<? if ($by == "name") { echo " selected=\"selected\""; } ?>>Software Title</option>
-				<option value="desc"<? if ($by == "desc") { echo " selected=\"selected\""; } ?>>Description</option>
-				<option value="cat"<? if ($by == "cateogry") { echo " selected=\"selected\""; } ?>>Category</option>
-				<option value="maintainer"<? if ($by == "maintainer") { echo " selected=\"selected\""; } ?>>Maintainer</option>
-				</select>
-			</td>
-			<td><input type="text" name="substr" size="40" /></td>
-			<td><input type="submit" name="Search" /></td>
-		</tr>
-		<tr><td colspan="4"><hr size="1" noshade="noshade" /></td></tr>
-		<tr>
-<?
-		$result = mysql_query("SELECT count(*) from darwinports.portfiles");
-		if ($result) {
-			$row = mysql_fetch_array($result);
-			$count = $row[0];
-		} else {
-			$count = 0;
-		}
-?>
-			<td colspan="4" align="left"><a href="<?= $PHP_SELF; ?>?by=all">View All Software Titles (<?= $count; ?>)</a></td>
-		</tr>
-		<?
-			if (!$by || (!$substr && $by != "all")) {
-		?>
-		<tr><td colspan="4"><hr size="1" noshade="noshade" /></td></tr>
-		<tr><th colspan="4" align="left">View By Category:</th></tr>
-		<?
-				$query = "SELECT DISTINCT category FROM darwinports.categories ORDER BY category";
-				$result = mysql_query($query);
-				if($result) {
-					while( $row = mysql_fetch_assoc($result) ) {
-		?>
-		<tr><td colspan="4"><a href="<?= $PHP_SELF; ?>?by=cat&substr=<?= $row['category']; ?>"><?= $row['category']; ?></a></td></tr>
-		<?
-					}
-				}
-			}
-		?>
-	</table>
-	</form>
-
-<?
-	if ($by && ($substr || $by == "all")) {
-		$fields = "name, path, version, description";
-		$query = "1";
-		$tables = "darwinports.portfiles p";
-		if ($by == "name") {
-			$query = $query . " AND p.name LIKE '%" . addslashes($substr) . "%'";
-		}
-		if ($by == "desc") {
-			$query = $query . " AND p.description LIKE '%" . addslashes($substr) . "%'";
-		}
-		if ($by == "cat") {
-			$tables = $tables . ", darwinports.categories c";
-			$query = $query . " AND c.portfile=p.name AND c.category='" . addslashes($substr) . "'";
-		}
-		if ($by == "variant") {
-			$tables = $tables . ", darwinports.variants v";
-			$query = $query . " AND v.portfile=p.name AND v.variant='" . addslashes($substr) . "'";
-		}
-		if ($by == "platform") {
-			$tables = $tables . ", darwinports.platforms pl";
-			$query = $query . " AND pl.portfile=p.name AND pl.platform ='" . addslashes($substr) . "'";
-		}
-		if ($by == "maintainer") {
-			$tables = $tables . ", darwinports.maintainers m";
-			$query = $query . " AND m.portfile=p.name AND m.maintainer LIKE '%" . addslashes($substr) . "%'";
-		}
-		$query = "SELECT DISTINCT $fields FROM $tables WHERE $query ORDER BY name";
-		$result = mysql_query($query);
-		if($result) {
-?>
-	<p>
-	<i><?= mysql_num_rows($result); ?> Portfile<? if (mysql_num_rows($result) != 1) { echo "s"; } ?> Selected</i>
-	</p>
-	<dl>
-<?		
-			while( $row = mysql_fetch_assoc($result) ) {
-?>
-	<dt><b><a href="http://www.opendarwin.org/projects/darwinports/darwinports/dports/<?= $row['path']; ?>/Portfile"><?= $row['name']; ?></a></b> <?= $row['version']; ?></dt>
-	<dd>
-	<?= $row['description']; ?><br />
-	<?
-// MAINTAINERS
-				$nquery = "SELECT maintainer FROM darwinports.maintainers WHERE portfile='" . $row['name'] . "' ORDER BY is_primary DESC, maintainer";
-				$nresult = mysql_query($nquery);
-				if ($nresult) {
-?>
-	<i>Maintained by:</i>
-<?
-					$primary = 1;
-					while ( $nrow = mysql_fetch_array($nresult) ) {
-						if ($primary) { echo "<b>"; }
-					?>
-						<a href="mailto:<?= $nrow[0]; ?>"><?= $nrow[0]; ?></a>
-					<?
-						if ($primary) { echo "</b>"; }
-						$primary = 0;
-					}
-				}
-
-// CATEGORIES
-				$nquery = "SELECT category FROM darwinports.categories WHERE portfile='" . $row['name'] . "' ORDER BY is_primary DESC, category";
-				$nresult = mysql_query($nquery);
-				if ($nresult) {
-?>
-	<br />
-	<i>Categories:</i>
-<?
-					$primary = 1;
-					while ( $nrow = mysql_fetch_assoc($nresult) ) {
-						if ($primary) { echo "<b>"; }
-					?>
-						<a href="<?= $PHP_SELF; ?>?by=cat&substr=<?= $nrow['category']; ?>"><?= $nrow['category']; ?></a>
-					<?
-						if ($primary) { echo "</b>"; }
-						$primary = 0;
-					}
-				}
-
-// PLATFORMS
-				$nquery = "SELECT platform FROM darwinports.platforms WHERE portfile='" . $row['name'] . "' ORDER BY platform";
-				$nresult = mysql_query($nquery);
-				if ($nresult && mysql_num_rows($nresult) > 0) {
-?>
-	<br />
-	<i>Platforms:</i>
-<?
-					while ( $nrow = mysql_fetch_array($nresult) ) {
-						$platform = $nrow[0];
-					?>
-						<a href="<?= $PHP_SELF; ?>?by=platform&substr=<?= $platform; ?>"><?= $platform; ?></a>
-					<?
-					}
-				}
-
-// DEPENDENCIES
-				$nquery = "SELECT library FROM darwinports.dependencies WHERE portfile='" . $row['name'] . "' ORDER BY library";
-				$nresult = mysql_query($nquery);
-				if ($nresult && mysql_num_rows($nresult) > 0) {
-?>
-	<br />
-	<i>Dependencies:</i>
-<?
-					while ( $nrow = mysql_fetch_array($nresult) ) {
-						// lib:libpng.3:libpng -> libpng
-						$library = eregi_replace("^[^:]*:[^:]*:", "", $nrow[0]);
-					?>
-						<a href="<?= $PHP_SELF; ?>?by=name&substr=<?= $library; ?>"><?= $library; ?></a>
-					<?
-					}
-				}
-/*
-// VARIANTS
-				$nquery = "SELECT variant FROM darwinports.variants WHERE portfile='" . $row['name'] . "' ORDER BY variant";
-				$nresult = mysql_query($nquery);
-				if ($nresult && mysql_num_rows($nresult) > 0) {
-?>
-	<br />
-	<i>Variants:</i>
-<?
-					while ( $nrow = mysql_fetch_array($nresult) ) {
-						$variant = $nrow[0];
-					?>
-						<a href="<?= $PHP_SELF; ?>?by=variant&substr=<?= $variant; ?>"><?= $variant; ?></a>
-					<?
-					}
-				}
-*/
-	?>
-	<br />
-	</dd>
-	<br />
-<?	
-			} 
-		} else {
-			echo "An Error Occurred. (501)";
-		}
-	}
-?>
-	</dl>
-<?
-	od_print_footer("en"); 
-?>
