yay, a little more functionality.

This commit is contained in:
Jeff Teunissen 2007-03-16 00:49:05 +00:00
parent 6932a861c8
commit c1b76a3f53
18 changed files with 425 additions and 85 deletions

View File

@ -13,7 +13,7 @@
// Preamble
$pageName = "Contact Us";
$focused = "none"; // Dock icon name to gets a border
require "parts/preamble.php"; // Load most of document
?>
<!--SEARCHME-->

View File

@ -1,27 +0,0 @@
<?
need('date sql');
$conn = @mysql_pconnect (sqlHost, sqlUser, sqlPass);
if ($conn) {
$query = 'SELECT n_date, n_user, n_news FROM news_main' .
' ORDER BY n_date DESC';
$result = @mysql_db_query (sqlDB, $query, $conn);
if ($result) {
$numRows = @mysql_num_rows ($result);
if ($numRows) {
if($numRows > 5) $numRows = 5;
for ($i = 0 ; $i < $numRows ; $i++) {
list ($n_date, $n_user, $n_news) = mysql_fetch_row ($result);
newsItem (dateFromSQLDateTime ($n_date), $n_user, StripSlashes($n_news));
}
} else {
newsItem ('now', 'Web Server', '<P>No current news!');
}
} else {
newsItem ('now', 'Web Server', '<P>No news in database!');
}
mysql_close ($conn);
} else {
newsItem ('Now', 'Web Server', '<P>Error: Could not connect to SQL server to fetch news. Please notify the server administrator.');
}
?>

View File

@ -21,7 +21,7 @@
while (list (, $cdl) = each ($list)) {
if (is_file ('doc/' . $cdl . '-' . $type . '.txt')) {
echo '<LI>';
echo '<A href="' . $type . '.php?program='
echo '<A href="doc_' . $type . '.php?program='
. $cdl . '">' . $cdl . '</A>';
echo '</LI>';
}
@ -53,10 +53,10 @@
</TR>
<TR>
<TD class="inside" align="left" vAlign="top" width="50%">
<? doc_list ("Cvar Documentation", $list, "cvar"); ?>
<? doc_list ("Cvar Documentation", $list, "cvars"); ?>
</TD>
<TD class="inside" align="left" vAlign="top" width="50%">
<? doc_list ("Command Documentation", $list, "cmd"); ?>
<? doc_list ("Command Documentation", $list, "cmds"); ?>
</TD>
</TR>
<?

View File

@ -11,7 +11,7 @@
?>
<DIV class="newsTitle"><A href="old_news.php">Older News...</A></DIV>
</DIV>
<!--<? include "sponsor_incl.html"; ?>-->
<!--<? include "partners.inc"; ?>-->
<?
require "parts/postamble.php"; // Finish this sucker up
?>

View File

@ -24,19 +24,8 @@
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
*/
have ('auth');
need ('table');
if (!defined ('_SQLCONSTS_')) {
define ('_SQLCONSTS_', 1);
require siteHome . '/../etc/sql.conf';
}
global $userInfo;
global $authRealm;
global $REMOTE_USER;
/* SQL definition for member list table
/* // SQL definition for member list table
CREATE TABLE members (
u_key INT NOT NULL auto_increment PRIMARY KEY,
u_admin CHAR DEFAULT 'N' NOT NULL,
@ -53,22 +42,60 @@ CREATE TABLE members (
);
*/
have ('auth');
need ('table');
if (!defined ('_SQLCONSTS_')) {
define ('_SQLCONSTS_', 1);
require siteHome . '/../etc/sql.conf';
}
if (!defined ('authSplitChar')) {
define ('authSplitChar', '%');
}
global $userInfo;
global $authRealm;
global $REMOTE_USER;
if (!$authRealm) {
$authRealm = "Member Access";
}
/*
authProcess
Authenticate user against SQL database
Authenticate user against SQL database.
If $split is nonzero, the provided password string is
split using the value of the authSplitChar definition
and the process will fail if no right-hand side
component is present. If there IS a right-hand side
component, sqlRWPass is defined.
*/
function authProcess ($userName, $password)
function authProcess ($user, $password, $split)
{
if ($split) {
$pos = strrpos ($password, authSplitChar);
if ($pos !== FALSE) { // user gave an SQL read-write pass
$sqlRWPass = substr ($password, $pos + 1);
$password = substr ($password, 0, $pos);
/* We now have a read-write password, so set sqlRWPass */
define ('sqlRWPass', $sqlRWPass);
} else {
return FALSE;
}
}
$query = "SELECT u_password, 1 AS auth FROM members" .
" WHERE u_username='$userName'" .
" AND u_password=ENCRYPT('$password','$userName')";
" WHERE u_username='$user'" .
" AND u_password=ENCRYPT('$password','$user')";
$result = @mysql_fetch_array (@mysql_db_query (sqlDB, $query));
if ($result[auth]) {
return 1;
return TRUE;
} else {
return 0;
return FALSE;
}
}
@ -85,10 +112,6 @@ CREATE TABLE members (
}
// Initialization
if (!$authRealm) {
$authRealm = "Secure Area";
}
if (!isset ($_SERVER['PHP_AUTH_USER'])) {
authBasicChallenge ($authRealm, "Login required.");
} else {
@ -99,7 +122,7 @@ CREATE TABLE members (
$db = @mysql_connect (sqlHost, sqlUser, sqlPass);
if ($userName && $password) {
if (authProcess ($userName, $password) == 0) {
if (!authProcess ($userName, $password, TRUE)) {
authBasicChallenge ($authRealm, "Login incorrect.");
}
} else {

View File

@ -1,7 +1,5 @@
<? // Preamble
$pageName = "Mailing Lists";
$focused = "none"; // Dock icon name to get a border
$currPage = "none";
require "parts/preamble.php"; // Load most of document
if (!$list) {
@ -11,7 +9,6 @@
} else {
$list = strToLower ($list);
}
?>
<FORM method="post" action="http://lists.quakeforge.net/lists/subscribe/<? echo $list; ?>">

14
members.php Normal file
View File

@ -0,0 +1,14 @@
<? // Preamble
$pageName = "Member Central";
$need = 'auth';
$modules = 'member_stuff';
require "parts/preamble.php"; // Load most of document
?>
<H2>Welcome to Developer Central, <?=ucfirst($REMOTE_USER)?>!</H2>
<P>This is the area for developers to post news, edit your user information,
check on the server(s), and so on. Members with Admin-level access can modify
news items here as well.</P>
<?
require siteHome . "/parts/postamble.php"; // Finish this sucker up
?>

68
news_add.php Normal file
View File

@ -0,0 +1,68 @@
<? // Preamble
$pageName = "Add News";
$need = 'auth';
require "parts/preamble.php"; // Load most of document
function showPreview ($date, $user, $def)
{?>
<DIV class="newsBox">
<DIV class="newsTitle"><H2>Add News (Preview)</H2></DIV>
<DL>
<DT><FONT size="-1"><EM>(Will be) posted on</EM> <?=$date?> <EM>by</EM> <STRONG><?=$user?></STRONG></FONT></DT>
<DD>
<FORM action="news_add.php" method="post">
<TEXTAREA name="newsItem" rows="25" cols="64"><?=StripSlashes ($def)?></TEXTAREA><BR>
<INPUT align="center" type="submit" name="mode" value="Post"></INPUT>
<INPUT align="center" type="submit" name="mode" value="Preview"></INPUT>
</FORM>
</DD>
</DL>
</DIV>
<?}
$newsItem = $_REQUEST['newsItem'];
$mode = $_REQUEST['mode'];
if ($newsItem && $mode == "Post") {
need ('sql');
$user = ucfirst ($REMOTE_USER);
$newsItem = AddSlashes ($newsItem);
$conn = mysql_connect (sqlHost, sqlRWUser, sqlRWPass);
if ($conn) {
$query = 'INSERT into news_main (n_date, n_user, n_news) VALUES (' .
" NOW(), '$user', '$newsItem')";
$result = mysql_db_query (sqlDB, $query, $conn);
if ($result) {
$numRows = mysql_affected_rows ($conn);
if ($numRows) {
echo '<P>Your news item has been processed successfully.';
} else {
echo '<P>There was an error in your input. If you don\'t know what it is, I\'m not going to tell you.';
}
}
mysql_close ($conn);
} else {
echo '<P>You suck, butthead.';
}
} else {
$date = strftime ('%d %b %Y', time ());
$user = ucfirst ($REMOTE_USER);
if ($newsItem) {?>
<DIV class="newsBox">
<DIV class="newsTitle"><H2>Latest News</H2></DIV>
<DL>
<DT><FONT size="-1"><EM>Posted on</EM> <?=$date?> <EM>by</EM> <STRONG><?=$user?></STRONG></FONT></DT>
<DD>
<P><?=StripSlashes($newsItem)?></P>
</DD>
</DL>
</DIV>
<?}
showPreview ($date, $user, $newsItem);
}
require siteHome . "/parts/postamble.php"; // Finish this sucker up
?>

86
news_del.php Normal file
View File

@ -0,0 +1,86 @@
<? // Preamble
$pageName = "Delete News";
$need = 'auth';
require "parts/preamble.php"; // Load most of document
if (!$userInfo['u_admin']) // no access from non-admin
bailout ('<P>You don\'t have access to this page. Bug an admin to delete a news post.</P>');
need ('sql');
function convertToHTML ($string)
{
$table = array_flip (get_html_translation_table (HTML_ENTITIES));
return strtr ($string, $table);
}
function convertFromHTML ($string)
{
$table = get_html_translation_table (HTML_ENTITIES);
return strtr ($string, $table);
}
function newsEntry ($array)
{
need ('date');
return
'<TR>'
.' <TD><A href="news_del.php?newsID=' . $array[n_id] . '">' . $array[n_id] . '</A></TD>'
.' <TD>' . dateFromSQLDateTime ($array[n_date]) . '</TD>'
.' <TD>' . $array[n_user] . '</TD>'
.' <TD>' . substr (convertFromHTML (StripSlashes ($array[n_news])), 0, 60) . '&#8230;</TD>'
.'</TR>';
}
$newsID = $_REQUEST['newsID'];
if ($conn = mysql_pconnect (sqlHost, sqlRWUser, sqlRWPass)) {
if ($newsID) {
$query = "DELETE FROM news_main WHERE n_id='$newsID'";
if ($result = mysql_db_query (sqlDB, $query, $conn)) {
if ($numRows = mysql_affected_rows ($conn)) {
echo "<P>News entry $newsID has been deleted successfully.";
} else {
echo '<P>There was an error in your input. If you don\'t know what it is, I\'m not going to tell you.';
}
}
}
?>
<DIV class="newsBox">
<DIV class="newsTitle"><H2>Edit News</H2></DIV>
<TABLE width="100%">
<?
$query = 'SELECT n_id, n_date, n_user, n_news FROM news_main'
.' ORDER BY n_date DESC';
if ($result = mysql_db_query (sqlDB, $query, $conn)) {
if ($numRows = mysql_num_rows ($result)) {?>
<TR>
<TH align="left">ID</TH>
<TH align="left">Date</TH>
<TH align="left">User</TH>
<TH align="left">Text</TH>
</TR><?
for ($i = 0; $i < $numRows; $i++) {
$news[$i] = mysql_fetch_array ($result);
echo newsEntry ($news[$i]);
}
} else {
echo '<P>No matching news entries.</P>';
}
} else {
echo '<P>Somebody screwed up, and MySQL said "' . mysql_error() . '". Bug a project admin or somethin\' eh?</P>';
}
?>
</TABLE>
</DIV>
<?
} else {
echo '<P>Couldn\'t connect to the SQL server with the password you gave. <STRONG>(&quot;You suck, butthead.&quot;)</STRONG></P>';
}
require siteHome . "/parts/postamble.php"; // Finish this sucker up
?>

147
news_edit.php Normal file
View File

@ -0,0 +1,147 @@
<? // Preamble
$pageName = "Edit News";
$need = 'auth';
require "parts/preamble.php"; // Load most of document
if (!$userInfo['u_admin']) // no access from non-admin
bailout ('<P>You don\'t have access to this page. Bug an admin to delete a news post.</P>');
need ('sql');
function convertToHTML ($string)
{
$table = array_flip (get_html_translation_table (HTML_ENTITIES));
return strtr ($string, $table);
}
function convertFromHTML ($string)
{
$table = get_html_translation_table (HTML_ENTITIES);
return strtr ($string, $table);
}
function newsEntrySummary ($array)
{
need ("date");
return
'<TR>'
.' <TD><A href="news_edit.php?newsID=' . $array[n_id] . '">' . $array[n_id] . '</A></TD>'
.' <TD>' . dateFromSQLDateTime ($array[n_date]) . '</TD>'
.' <TD>' . $array[n_user] . '</TD>'
.' <TD>' . substr (convertFromHTML (StripSlashes ($array[n_news])), 0, 60) . '&#8230;</TD>'
.'</TR>';
}
function newsEntryEditor ($array)
{
need ("date");
$id = $array[n_id];
$usr = $array[n_user];
$txt = convertFromHTML(stripSlashes($array[n_news]));
$date = dateFromSQLDateTime($array[n_date]);
?>
<FORM action="editnews.php?newsID=<?=$id?>" method="post">
<DIV class="newsBox">
<DIV class="newsTitle"><H2>Edit News Entry #<?=$id?></H2></DIV>
<DL>
<DT>
<FONT size="-1">
<EM>Posted on</EM>
<?=$date?>
<EM>by</EM>
<STRONG>
<INPUT type="text" name="newsUser" size="20" value="<?=$usr?>">
</STRONG>
<INPUT align="center" type="submit" value="Modify User / Text"></INPUT>
</FONT>
</DT>
<DD>
<TEXTAREA name="newsItem" rows="25" cols="64"><?=$txt?></TEXTAREA><BR>
</DD>
</DL>
</DIV>
</FORM>
<?
}
need ('sql');
global $newsID;
global $newsUser;
global $newsItem;
$newsID = $_GET['newsID'];
$newsItem = $_POST['newsItem'];
$newsUser = $_POST['newsUser'];
if ($conn = mysql_pconnect (sqlHost, sqlRWUser, sqlRWPass)) {
if ($newsID) {
if ($newsUser && $newsItem) {
$newsItem = AddSlashes ($newsItem);
$query = "UPDATE news_main SET n_user='$newsUser', n_news='$newsItem' WHERE n_id='$newsID'";
if ($result = mysql_db_query (sqlDB, $query, $conn)) {
if ($numRows = mysql_affected_rows ($conn)) {
echo '<P>Your modifications have been processed successfully.';
} else {
echo '<P>Your modifications were correctly formed, but had no effect on the database.';
}
} else {
echo "<P>There was an error in your input. If you don't know what it is, I'm not going to tell you.";
}
} else {
$query = "SELECT n_id, n_date, n_user, n_news FROM news_main "
. "WHERE n_id=$newsID";
$result = mysql_db_query (sqlDB, $query, $conn);
if ($result) {
$numRows = mysql_num_rows ($result);
if ($numRows == 1) {
$news = mysql_fetch_array ($result);
newsEntryEditor ($news);
} else {
echo "<P>MOOOOO! Rows = $numRows";
}
} else {
echo "<P>MOOOOO! No result.";
}
}
} else {?>
<DIV class="newsBox">
<DIV class="newsTitle"><H2>Edit News</H2></DIV>
<TABLE width="100%">
<?
$query = 'SELECT n_id, n_date, n_user, n_news FROM news_main' .
' ORDER BY n_date DESC';
if ($result = mysql_db_query (sqlDB, $query, $conn)) {
if ($numRows = mysql_num_rows ($result)) {?>
<TR>
<TH align="left">ID</TH>
<TH align="left">Date</TH>
<TH align="left">User</TH>
<TH align="left">Text</TH>
</TR><?
for ($i = 0; $i < $numRows; $i++) {
$news[$i] = mysql_fetch_array ($result);
echo newsEntrySummary ($news[$i]);
}
} else {
}
} else {
}
tableFooter ();
?>
</DIV>
<?
}
} else {
echo '<P>You suck, butthead.';
}
?>
<?
require siteHome . "/parts/postamble.php"; // Finish this sucker up
?>

16
pages.txt Normal file
View File

@ -0,0 +1,16 @@
about About The Project
bugs Bug Tracking System
cvs Version Control System
devtools Developer Tools
docs Documentation
files Downloads
home Home Page
lists Mailing Lists
news News Archives
patches Patch Manager
plans Developer Plans
progress Progress Report
shots Screenshots
support Support Manager
surveys Surveys
tasks Task Manager

View File

@ -2,10 +2,13 @@
// helpful constants
if (!defined( '_COLORS_' )) {
define ('_COLORS_', 1);
define ('black', "black");
define ('white', "white");
define ('black', "black");
define ('white', "white");
define ('thisURL', $_SERVER['SCRIPT_NAME']);
define ('thisURL', $_SERVER['SCRIPT_NAME']);
if (!$currPage)
$currPage = 'none';
if (!$theme && date ('m') == 12)
$theme = "christmas";
@ -16,30 +19,18 @@
switch ($theme) {
case "christmas":
define ('bgColor', black);
define ('textColor', white);
define ('linkColor', '#aaffaa');
define ('activeLinkColor', white);
define ('visitedLinkColor', '#80ff80');
define ('tableHeadColor', '#7f000c');
define ('tableBgColor', black);
define ('menuHeadColor', '#7f000c');
define ('menuBgColor', '#084508');
define ('featureHeadColor', tableHeadColor);
define ('featureHeadColor', '#7f000c');
define ('featureBgColor', '#083008');
break;
default:
define ('bgColor', black);
define ('textColor', white);
define ('linkColor', '#aaaaff');
define ('activeLinkColor', white);
define ('visitedLinkColor', '#8080ff');
define ('tableHeadColor', '#737b9c');
define ('tableBgColor', black);
define ('menuHeadColor', '#737b9c');
define ('menuBgColor', '#4b4f66');
define ('featureHeadColor', tableHeadColor);
define ('featureHeadColor', '#737b9c');
define ('featureBgColor', '#262633');
}
}
@ -61,7 +52,7 @@
Require a library module if it hasn't already been.
*/
function reqIfNeeded( $libNames )
function reqIfNeeded ($libNames)
{
global $has, $needs;
@ -86,7 +77,7 @@
addToArray ($libName, $has);
}
/*
need
@ -103,6 +94,14 @@
}
reqIfNeeded ($libNames);
}
function bailout ($str)
{
if (strlen ($str))
echo $str;
require siteHome . '/parts/postamble.php'; // end page
die;
}
} // !_LIBFUNCS_
?>

18
parts/member_stuff.php Normal file
View File

@ -0,0 +1,18 @@
<?
need ("feature");
@featureOpen ("News");
?>
<P>News: [&nbsp;<A href="news_add.php">Post</A>&nbsp;]</P>
<?
@featureClose ();
if ($userInfo['u_admin']) {
@featureOpen ("Admin");
?>
<P>News: [&nbsp;<A href="news_add.php">Add</A>&nbsp;|&nbsp;<A href="news_del.php">Del</A>&nbsp;|&nbsp;<A href="news_edit.php">Edit</A>&nbsp;]</P>
<P>Users: [&nbsp;<A href="user_add.php">Add</A>&nbsp;|&nbsp;<A href="user_del.php">Del</A>&nbsp;|&nbsp;<A href="user_edit.php">Edit</A>&nbsp;]</P>
<?
@featureClose ();
}
?>

View File

@ -6,4 +6,5 @@
<A href="/copyright.php">Additional Copyright and Trademark Acknowledgements</A>
</SPAN>
</DIV>
<A id="pi" href="/members.php">&#x03c0;</A>
</HTML>

View File

@ -1,11 +1,9 @@
<? // Preamble
$pageName = "Page Name";
$focused = "none"; // Dock icon name to get a border
require "parts/preamble.php"; // Load most of document
$pageName = "Page Subtitle";
$currPage = "none"; // Page name, for menu -- see pages.txt
require "parts/preamble.php"; // Load up most of the document
?>
<!--SEARCHME-->
Page content goes here. Yes, it's that simple.
<!--NOSEARCH-->
Page content goes here.
<?
require "parts/postamble.php"; // Finish this sucker up
require siteHome . "/parts/postamble.php"; // Finish this sucker up
?>