r617 - trunk/web/include

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Mar 4 13:13:32 EST 2006


Author: floam
Date: 2006-03-04 13:13:32 -0500 (Sat, 04 Mar 2006)
New Revision: 617

Added:
   trunk/web/include/news.php
Modified:
   trunk/web/include/errors.php
Log:
Preparing to use IcculusNews so we can announce stuff without bothering SVN.


Modified: trunk/web/include/errors.php
===================================================================
--- trunk/web/include/errors.php	2006-03-04 11:14:44 UTC (rev 616)
+++ trunk/web/include/errors.php	2006-03-04 18:13:32 UTC (rev 617)
@@ -1,7 +1,9 @@
 <?php
 if (!$code) { $code = $_GET['code']; }
+if (!$detail) { $error['detail'] = $_GET['detail']; }
 
-switch($code) {
+switch($code)
+{
 	case 403:
 		$error['name'] = "Forbidden";
 		$error['description'] = "You don't have permission to be here. Go away!";
@@ -10,8 +12,13 @@
 		$error['name'] = "Not Found";
 		$error['description'] = "The file was not found. We probably screwed up.";
 		break;
+	case 500:
+		$error['name'] = "Internal Server Error";
+		$error['description'] = "Oh, crap. Something is broke and it's almost definitely our fault!";
+		break;
 }
+
 header("HTTP/1.0 $code" . $error['name']);
 echo "<h2>$error[name]</h2>
-<p>$error[description]</p>";
+<p>$error[description] $error[detail]</p>";
 ?>

Added: trunk/web/include/news.php
===================================================================
--- trunk/web/include/news.php	2006-03-04 11:14:44 UTC (rev 616)
+++ trunk/web/include/news.php	2006-03-04 18:13:32 UTC (rev 617)
@@ -0,0 +1,42 @@
+<?php
+require("/webspace/icculus.org/news/IcculusNews.php");
+
+$id = $_GET['id'];
+$news_queue = 2;
+
+if ($err = news_login($sock, 'localhost', 263, NULL, NULL, $news_queue))
+	$err = "Failed to log in: $err";
+else
+{
+	if (isset($id))
+	{
+		$digestarray[] = array( 'id' => $id );
+	}
+
+	else if ($err = news_digest($sock, $digestarray, false, 10))
+	{
+		$err = "Failed to get news digest: $err";
+	}
+
+	if (!isset($err))
+	{
+		foreach($digestarray as $digestItem)
+		{
+			if ($err = news_get($sock, $digestItem['id'], $item))
+			{
+				$err = "Failed to grab news item: $err";
+				break;
+			}
+			echo "<h3>" . $item['title'] . "-" . $item['postdate'] . "</h3>\n<p>" . $item['text'] . "</p>"
+		}
+	}
+}
+
+news_logout($sock);
+
+if ($err) {
+	$code = 500;
+	$detail = $err;
+	require("errors.php");
+}
+?>




More information about the quake3-commits mailing list