summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries Buytaert2000-05-18 19:52:00 +0000
committerDries Buytaert2000-05-18 19:52:00 +0000
commit2569242afd5eec297e7d72065f4e3dd2586d0fd8 (patch)
treea299576f5ee985ffc587f9803c3fb773488d3772
parent008612ad4999138662a32abab2115cf3f03bca64 (diff)
Imported sourcesstart
-rw-r--r--Makefile17
-rw-r--r--account.php489
-rw-r--r--admin.php798
-rw-r--r--article.php33
-rw-r--r--authentication.inc20
-rw-r--r--comments.php525
-rw-r--r--config.inc71
-rw-r--r--drop.tar.gzbin0 -> 150465 bytes
-rw-r--r--faq.php84
-rw-r--r--functions.inc235
-rw-r--r--mysql.tables396
-rw-r--r--password.dict16
-rw-r--r--poll.php278
-rw-r--r--queue.php50
-rw-r--r--rdf.php247
-rw-r--r--refer.php171
-rw-r--r--search.php96
-rw-r--r--submit.php175
-rw-r--r--theme.inc7
-rw-r--r--themes/index.php1
-rw-r--r--themes/jeroen/footer.php45
-rw-r--r--themes/jeroen/header.php29
-rw-r--r--themes/jeroen/images/dropfaq.gifbin0 -> 1186 bytes
-rw-r--r--themes/jeroen/theme.class304
-rw-r--r--themes/jeroen/theme.php119
-rw-r--r--themes/list.php7
-rw-r--r--update.txt2
-rw-r--r--webboard.php545
28 files changed, 4760 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..3b8b956
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,17 @@
+UPDATE=update.txt
+
+clean:
+ rm -f *~ DEADJOE core
+
+backup:
+ @echo "- Generating $(UPDATE) ..."
+ @echo "This tarball has been created on:" > $(UPDATE)
+ @date >> $(UPDATE)
+ @echo "- Removing older archives ..."
+ @rm -f drop.tar.gz
+ @echo "- Archiving PHP files ..."
+ @tar -cf drop.tar *
+ @gzip drop.tar
+ @cp -f drop.tar.gz /home/dries/backup
+ @echo "- A fresh archive is now available at http://www.drop.org/drop.tar.gz."
+ @echo " (MySQL backup NOT included.)" \ No newline at end of file
diff --git a/account.php b/account.php
new file mode 100644
index 0000000..d2f9591
--- /dev/null
+++ b/account.php
@@ -0,0 +1,489 @@
+<?
+
+function navigation() {
+ ?>
+ <P ALIGN="center">[ <A HREF="account.php">User info</A> | <A HREF="account.php?op=edituser">Edit user info</A> | <A HREF="account.php?op=edithome">Customize homepage</A> | <A HREF="account.php?op=editcomm">Customize comments</A> | <A HREF="account.php?op=logout">Logout</A> ]</P>
+ <?
+}
+
+function validateAccount($uname, $email) {
+
+ ### Verify username and e-mail address:
+ if ((!$email) || ($email=="") || (strrpos($uname,' ') > 0) || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $email))) $rval = "the specified e-mail address is not valid.<BR>";
+ if ((!$uname) || ($uname=="") || (ereg("[^a-zA-Z0-9_-]",$uname))) $rval = "the specified username '$uname' is not valid.<BR>";
+ if ((strlen($uname) > 15) || (strrpos($uname,' ') > 0)) $rval = "the specified username is too long: it must be less than 15 characters.";
+ if (eregi("^((root)|(httpd)|(operator)|(admin)|(administrator)|(news)|(deamon)|(nobody)|(ftp))$", $uname)) $rval = "the specified username is reserved.";
+
+ ### Verify whether username and e-mail address are uniqua:
+ dbconnect();
+ if (mysql_num_rows(mysql_query("select uname from users where uname='$uname'")) > 0) $rval = "the specified username is already taken.";
+ if (mysql_num_rows(mysql_query("select email from users where email='$email'")) > 0) $rval = "the specified e-mail address is already registered.";
+ return($rval);
+}
+
+function generatePassword($dictionary = "password.dict", $min_length = 6, $max_length = 9) {
+ mt_srand((double)microtime()*1000000);
+ $fp=fopen($dictionary, "r");
+ $size=filesize($dictionary);
+
+ while(strlen($password) < $min_length) {
+ ### Move to a random spot in the file:
+ fseek($fp,mt_rand(0,$size-8));
+ ### Finish off the current word:
+ fgets($fp,4096);
+ $word=trim(fgets($fp,4096));
+ if((strlen($word) + strlen($password)) <= $max_length) $password.=$word;
+ }
+ fclose($fp);
+ return $password;
+}
+
+function confirmNewUser($uname, $email) {
+ include "functions.inc";
+ include "theme.inc";
+ $theme->header();
+
+ if ($error = validateAccount($uname, $email)) {
+ print "<B>Error:</B> $error";
+ }
+ else {
+ ### Display account information:
+ print "<U>Account information:</U><BR><UL><LI>username: $uname</LI><LI>e-mail address: $email</LI></UL>";
+ ?>
+ <FORM ACTION="account.php" METHOD="post">
+ <INPUT TYPE="hidden" NAME="uname" VALUE="<?PHP echo"$uname"; ?>">
+ <INPUT TYPE="hidden" NAME="email" VALUE="<?PHP echo"$email"; ?>">
+ <BR><BR><INPUT TYPE="submit" NAME="op" VALUE="Create account">
+ </FORM>
+ <?
+ }
+ $theme->footer();
+}
+
+function finishNewUser($uname, $email) {
+ include "functions.inc";
+ include "theme.inc";
+ $theme->header();
+
+ dbconnect();
+
+ $pass = generatePassword();
+ $result = mysql_query("insert into users values (NULL,'','$uname','$email','','','$pass',10,'',0,0,0,'',0,'','','$commentlimit')");
+
+ if (!$result) {
+ echo mysql_errno(). ": ".mysql_error(). "<BR>";
+ }
+ else {
+ if ($system == 1) {
+ echo "Your password is: <B>$pass</B><BR>";
+ echo "<A HREF=\"account.php?op=login&uname=$uname&pass=$makepass\">Login</A> to change your personal settings.";
+ } else {
+ $message = "Your $sitename member account has been created succesfully. To be able to use it you must login using the information below. Please save this mail for further reference.\n\n username: $uname\n e-mail: $email\n password: $pass\n\nThis password is generated by a randomizer. It is recommended that you change this password immediately.\n\n$contact_signature";
+ $subject="Account details for $sitename";
+ mail($email, $subject, $message, "From: $contact_email\nX-Mailer: PHP/" . phpversion());
+ echo "Your member account has been created and the details necessary to login have been sent to your e-mail account <B>$email</B>. Once you received the account confirmation, hit <A HREF=\"account.php\">this link</A> to login.";
+ }
+ }
+ $theme->footer();
+}
+
+
+function userinfo($uname) {
+ global $user, $cookie;
+
+ $result = mysql_query("SELECT femail, url, bio, signature FROM users WHERE uname = '$uname'");
+ $userinfo = mysql_fetch_array($result);
+
+
+ cookiedecode($user);
+
+ include "theme.inc";
+ $theme->header();
+
+ if ($uname == $cookie[1]) {
+ print "<P>Welcome $uname! This is <B>your</B> user info page. There are many more, but this one is yours. You are probably most interested in editing something, but if you need to kill some time, this place is as good as any other place.</P>";
+ }
+ if ((mysql_num_rows($result) == 1) && ($userinfo[url] || $userinfo[femail] || $userinfo[bio])) {
+ print "<TABLE WIDTH=\"100%\">";
+ ### Name:
+ print "<TR><TD ALIGN=\"right\"><B>Name:</B></TD><TD><B>$uname</B></TD></TR>\n";
+ ### URL:
+ if ($userinfo[url]) print "<TR><TD ALIGN=\"right\"><B>URL:</B></TD><TD><A HREF=\"$userinfo[url]\">$userinfo[url]</A></TD></TR>\n";
+ else print "<TR><TD ALIGN=\"right\"><B>URL:</B></TD><TD>not available</TD></TR>\n";
+ ### E-mail:
+ if ($userinfo[femail]) print "<TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>E-mail:</B></TD><TD><A HREF=\"mailto:$userinfo[femail]\">$userinfo[femail]</A><BR><I>(Might be spam-proofed or even completly fake.)</I></TD></TR>\n";
+ else print "<TR><TD ALIGN=\"right\"><B>E-mail:</B></TD><TD>not available</TD></TR>\n";
+ ### Bio:
+ if ($userinfo[bio]) print "<TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Bio:</B></TD><TD>". nl2br($userinfo[bio]) ."</TD></TR>\n";
+ else print "<TR><TD ALIGN=\"right\"><B>Bio:</B></TD><TD>not available</TD></TR>\n";
+ ### Signature:
+ if ($userinfo[bio]) print "<TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Signature:</B></TD><TD>". nl2br($userinfo[signature]) ."</TD></TR>\n";
+ else print "<TR><TD ALIGN=\"right\"><B>Signature:</B></TD><TD>not available</TD></TR>\n";
+ print "</TABLE><BR><BR>";
+ } else {
+ echo "<P>No information available for <B>$uname</B>.</P>";
+ }
+ $theme->footer();
+}
+
+function main($user) {
+ global $fail;
+ if(!isset($user)) {
+ include "config.inc";
+ include "functions.inc";
+ include "theme.inc";
+ $theme->header();
+ ?>
+ <?
+ if ($fail) print "<CENTER><BLINK><H3>Authentication failed!</H3></BLINK></CENTER>";
+ ?>
+ <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0" WIDTH="100%">
+ <TR>
+ <TD ALIGN="center" VALIGN="bottom" WIDTH="33%">
+ <FORM ACTION="account.php" METHOD="post">
+ <?
+ $theme->box("Login", "<TABLE BORDER=\"0\"><TR><TD ALIGN=\"right\" WIDTH=\"80\">Username:</TD><TD><INPUT TYPE=\"text\" NAME=\"uname\" SIZE=\"12\" MAXLENGHT=\"15\"></TD></TR><TR><TD ALIGN=\"right\">Password:</TD><TD><INPUT TYPE=\"password\" NAME=\"pass\" SIZE=\"12\" MAXLENGTH=\"12\"></TD></TR><TR><TD ALIGN=\"center\" COLSPAN=\"2\"><INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Login\"></TD></TR></TABLE>");
+ ?>
+ </FORM>
+ </TD>
+ <TD ALIGN="center" VALIGN="bottom" WIDTH="33%">
+ <FORM ACTION="account.php" METHOD="post">
+ <?
+ $theme->box("Forgot your password?", "<TABLE BORDER=\"0\"><TR><TD ALIGN=\"right\" WIDTH=\"80\">Username:</TD><TD><INPUT TYPE=\"text\" NAME=\"uname\" SIZE=\"12\" MAXLENGHT=\"15\"></TD></TR><TR><TD COLSPAN=\"3\"><FONT SIZE=\"2\"><I>Fill out your username and your password will be mailed to the e-mail account associated with your username.</I></FONT></TD></TR><TR><TD ALIGN=\"center\" COLSPAN=\"2\"><INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Mail password\"></TD></TR></TABLE>");
+ ?>
+ </FORM>
+ </TD>
+ <TD ALIGN="center" VALIGN="bottom" WIDTH="33%">
+ <FORM ACTION="account.php" METHOD="post">
+ <?
+ $theme->box("Register as new user", "<TABLE BORDER=\"0\"><TR><TD ALIGN=\"right\" WIDTH=\"80\">Username:</TD><TD><INPUT TYPE=\"text\" NAME=\"uname\" SIZE=\"12\" MAXLENGTH=\"20\"></TD></TR><TR><TD ALIGN=\"right\">E-mail:</TD><TD><INPUT TYPE=\"text\" NAME=\"email\" SIZE=\"12\" MAXLENGTH=\"55\"></TD></TR><TR><TD ALIGN=\"center\" COLSPAN=\"2\"><INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Sign up\"></TD></TR></TABLE>");
+ ?>
+ </FORM>
+ </TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="3">
+ <P>Logging in will allow you to post comments as yourself. If you don't login, you will only be able to post as <B><?php echo"$anonymous"; ?></B>.</P>
+ </TD>
+ </TR>
+ </TABLE>
+ <?PHP
+ $theme->footer();
+ }
+ elseif(isset($user)) {
+ global $cookie;
+ include "functions.inc";
+ cookiedecode($user);
+ dbconnect();
+ userinfo($cookie[1]);
+ }
+}
+
+function logout() {
+ setcookie("user");
+ include "functions.inc";
+ include "theme.inc";
+ $theme->header();
+ ?>
+ <BR><BR><BR><BR>
+ <P ALIGN="center"><FONT SIZE="+2"><B>You are now logged out!</B></FONT></P>
+ <P>You have been logged out of the system. Since authentication details are stored by using cookies, logging out is only necessary to prevent those who have access to your computer from abusing your account.</P>
+ <?
+ $theme->footer();
+}
+
+function mailPassword($uname) {
+ include "functions.inc";
+ dbconnect();
+ $result = mysql_query("select pass, email from users where uname = '$uname'");
+ if(!$account = mysql_fetch_object($result)) {
+ echo "Sorry, no corresponding account information was found.";
+ } else {
+ $message = "$uname,\n\n\na visitor from ".getenv("REMOTE_ADDR")." (most probably you) has just requested the password associated with the e-mail address '$account->email', to be sent. The password is '$account->pass' (without the quotes).\n\nIf you didn't ask for this, don't get your panties all in a knot. You are seeing this message, not 'them'. So if you can't be trusted with your own password, we might have an issue, otherwise, you can just disregard this message.\n\n\n$contact_signature";
+ $subject="[$sitename] password for $account->uname";
+ mail($account->email, $subject, $message, "From: $contact_email\nX-Mailer: PHP/" . phpversion());
+ $titlebar = "You password has been sent.";
+ include "theme.inc";
+ $theme->header();
+ print "The requested password has been sent to the e-mail account associated with the username '<B>$uname</B>'.";
+ $theme->footer();
+ }
+}
+
+function docookie($setuid, $setuname, $setpass, $setstorynum, $setumode, $setuorder, $setthold, $setnoscore, $setublockon, $settheme) {
+ $info = base64_encode("$setuid:$setuname:$setpass:$setstorynum:$setumode:$setuorder:$setthold:$setnoscore:$setublockon:$settheme");
+ setcookie("user","$info", time() + 15552000); // 6 month = 15552000
+}
+
+function login($uname, $pass) {
+ global $setinfo;
+ include "functions.inc";
+ dbconnect();
+ $result = mysql_query("select uid, storynum, umode, uorder, thold, noscore, ublockon, theme, signature FROM users WHERE uname = '$uname' AND pass = '$pass'");
+ if (mysql_num_rows($result) == 1) {
+ $setinfo = mysql_fetch_array($result);
+ docookie($setinfo[uid], $uname, $pass, $setinfo[storynum], $setinfo[umode], $setinfo[uorder], $setinfo[thold], $setinfo[noscore], $setinfo[ublockon], $setinfo[theme]);
+ Header("Location: account.php?op=userinfo&uname=$uname");
+ } else {
+ Header("Location: account.php?fail=1");
+ }
+}
+
+function user_edit_info() {
+ include "functions.inc";
+ global $user, $userinfo;
+ getusrinfo($user);
+
+ include "theme.inc";
+ $theme->header();
+ ?>
+
+ <FORM ACTION="account.php" METHOD="post">
+
+ <B>Real name:</B><BR>
+ <INPUT TYPE="text" name="name" value="<?PHP echo"$userinfo[name]"; ?>" SIZE="30" MAXLENGHT="55"><BR>
+ <I>Optional.</I><BR><BR>
+
+ <B>Real e-mail address:</B><BR>
+ <INPUT TYPE="text" NAME="email" VALUE="<?PHP echo"$userinfo[email]"; ?>" SIZE="30" MAXLENGHT="55"><BR>
+ <I>Required, but never displayed publicly: needed in case you lose your password.</I><BR><BR>
+
+ <B>Fake e-mail address:</B><BR>
+ <INPUT TYPE="text" NAME="femail" VALUE="<?PHP echo"$userinfo[femail]"; ?>" SIZE="30" MAXLENGHT="55"><BR>
+ <I>Optional, and displayed publicly by your comments. You may spam proof it if you want.</I><BR><BR>
+
+ <B>URL of homepage:</B><BR>
+ <INPUT TYPE="text" name="url" value="<?PHP echo"$userinfo[url]"; ?>" SIZE="30" MAXLENGTH="100"><BR>
+ <I>Optional, but make sure you enter fully qualified URLs only. That is, remember to include "http://".</I><BR><BR>
+
+ <B>Bio:</B> (255 char limit)<BR>
+ <TEXTAREA WRAP="virtual" COLS="50" ROWS="5" NAME="bio"><?PHP echo"$userinfo[bio]"; ?></TEXTAREA><BR>
+ <I>Optional. This biographical information is publicly displayed on your user page.</I><BR><BR>
+
+ <B>Password:</B> <BR>
+ <INPUT TYPE="password" NAME="pass" SIZE="10" MAXLENGTH="20"> <INPUT TYPE="password" NAME="vpass" SIZE="10" MAXLENGTH="20"><BR>
+ <I>Enter your new password twice if you want to change your current password or leave it blank if you are happy with your current password.</I><BR><BR>
+
+ <INPUT TYPE="hidden" NAME="uname" VALUE="<?PHP echo"$userinfo[uname]"; ?>">
+ <INPUT TYPE="hidden" NAME="uid" VALUE="<?PHP echo"$userinfo[uid]"; ?>">
+ <INPUT TYPE="submit" NAME="op" VALUE="Save user information">
+
+ </FORM>
+
+ <?PHP
+ $theme->footer();
+}
+
+function user_save_info($uid, $name, $uname, $email, $femail, $url, $pass, $vpass, $bio) {
+ global $user, $cookie, $userinfo;
+ include "functions.inc";
+ if ((isset($pass)) && ("$pass" != "$vpass")) {
+ echo "The verification password is not the same as the first password.";
+ }
+ elseif (($pass != "") && (strlen($pass) < $minpass)) {
+ echo "Sorry, your password must be at least $minpass charachters long.";
+ }
+ else {
+ if ($bio) {
+ $bio = FixQuotes($bio);
+ }
+ if ($pass != "") {
+ dbconnect();
+ cookiedecode($user);
+ mysql_query("UPDATE users SET name = '$name', email = '$email', femail = '$femail', url = '$url', pass = '$pass', bio = '$bio' WHERE uid = $uid");
+ $result = mysql_query("SELECT uid, uname, pass, storynum, umode, uorder, thold, noscore, ublockon, theme from users where uname='$uname' and pass='$pass'");
+ $userinfo = mysql_fetch_array($result);
+ docookie($userinfo[uid],$userinfo[uname],$userinfo[pass],$userinfo[storynum],$userinfo[umode],$userinfo[uorder],$userinfo[thold],$userinfo[noscore],$userinfo[ublockon],$userinfo[theme]);
+ }
+ else {
+ dbconnect();
+ mysql_query("UPDATE users SET name = '$name', email = '$email', femail = '$femail', url = '$url', bio = '$bio' WHERE uid=$uid");
+ }
+ }
+}
+
+function user_edit_home() {
+ include "functions.inc";
+ global $user, $userinfo;
+ getusrinfo($user);
+ include "theme.inc";
+ $theme->header();
+
+ ?>
+ <FORM ACTION="account.php" method="post">
+
+ <P>
+ <B>Maximum number of stories:</B><BR>
+ <INPUT TYPE="text" NAME="storynum" SIZE="3" MAXLENGHT="3" VALUE="<?PHP echo"$userinfo[storynum]"; ?>">
+ </P>
+
+ <P>
+ <B>Theme:</B><BR>
+ <SELECT NAME="theme">
+ <?php
+ include "themes/list.php";
+ $themelist = explode(" ", $themelist);
+ for ($i=0; $i < sizeof($themelist); $i++) {
+ if ($themelist[$i]!="") {
+ echo "<OPTION VALUE=\"$themelist[$i]\" ";
+ if ((($userinfo[theme]=="") && ($themelist[$i]=="default")) || ($userinfo[theme]==$themelist[$i])) echo "SELECTED";
+ echo ">$themelist[$i]\n";
+ }
+ }
+ if ($userinfo[theme]=="") $userinfo[theme] = "default";
+ ?>
+ </SELECT><BR>
+ <I>Changes the look and feel of the site.</I>
+ </P>
+
+ <P>
+ <B>User block:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="50" ROWS="5" NAME="ublock"><? echo"$userinfo[ublock]"; ?></TEXTAREA><BR>
+ <INPUT TYPE="checkbox" NAME="ublockon" <? if ($userinfo[ublockon]==1) { echo "checked"; } ?>> Enable user box.<BR>
+ <I>Enable the checkbox and whatever you enter below will appear on your costum main page.</I>
+ </P>
+
+ <INPUT TYPE="hidden" name="uname" value="<?PHP echo"$userinfo[uname]"; ?>">
+ <INPUT TYPE="hidden" name="uid" value="<?PHP echo"$userinfo[uid]"; ?>">
+ <INPUT TYPE="submit" name="op" value="Save homepage settings">
+ </FORM>
+ <?PHP
+ $theme->footer();
+}
+
+function user_save_home($uid, $uname, $storynum, $theme, $ublockon, $ublock) {
+ global $user, $userinfo;
+ include "functions.inc";
+ dbconnect();
+ if(isset($ublockon)) $ublockon=1; else $ublockon=0;
+ $ublock = FixQuotes($ublock);
+ mysql_query("LOCK TABLES users WRITE");
+ mysql_query("update users set storynum='$storynum', ublockon='$ublockon', ublock='$ublock', theme='$theme' where uid=$uid");
+ getusrinfo($user);
+ mysql_query("UNLOCK TABLES");
+ docookie($userinfo[uid],$userinfo[uname],$userinfo[pass],$userinfo[storynum],$userinfo[umode],$userinfo[uorder],$userinfo[thold],$userinfo[noscore],$userinfo[ublockon],$userinfo[theme]);
+ Header("Location: account.php?theme=$theme");
+}
+
+function user_edit_comm() {
+ include "functions.inc";
+ global $user, $userinfo;
+ getusrinfo($user);
+
+ include "theme.inc";
+ $theme->header();
+ ?>
+
+ <FORM ACTION="account.php" METHOD="post">
+ <B>Display Mode:</B><BR>
+ <SELECT NAME="umode">
+ <OPTION VALUE="nocomments" <?PHP if ($userinfo[umode] == 'nocomments') { echo "SELECTED"; } ?>>No comments
+ <OPTION VALUE="nested" <?PHP if ($userinfo[umode] == 'nested') { echo "SELECTED"; } ?>>Nested
+ <OPTION VALUE="flat" <?PHP if ($userinfo[umode] == 'flat') { echo "SELECTED"; } ?>>Flat
+ <OPTION VALUE="threaded" <?PHP if (!isset($userinfo[umode]) || ($userinfo[umode]=="") || $userinfo[umode]=='threaded') { echo "SELECTED"; } ?>>Threaded
+ </SELECT>
+ <BR><BR>
+
+ <B>Sort order:</B><BR>
+ <SELECT NAME="uorder">
+ <OPTION VALUE="0" <?PHP if (!$userinfo[uorder]) { echo "SELECTED"; } ?>>Oldest first
+ <OPTION VALUE="1" <?PHP if ($userinfo[uorder]==1) { echo "SELECTED"; } ?>>Newest first
+ <OPTION VALUE="2" <?PHP if ($userinfo[uorder]==2) { echo "SELECTED"; } ?>>Highest scoring first
+ </SELECT>
+ <BR><BR>
+
+ <B>Threshold:</B><BR>
+ <SELECT NAME="thold">
+ <OPTION VALUE="-1" <?PHP if ($userinfo[thold]==-1) { echo "SELECTED"; } ?>>-1: Display uncut and raw comments.
+ <OPTION VALUE="0" <?PHP if ($userinfo[thold]==0) { echo "SELECTED"; } ?>>0: Display almost all comments.
+ <OPTION VALUE="1" <?PHP if ($userinfo[thold]==1) { echo "SELECTED"; } ?>>1: Display almost no anonymous comments.
+ <OPTION VALUE="2" <?PHP if ($userinfo[thold]==2) { echo "SELECTED"; } ?>>2: Display comments with score +2 only.
+ <OPTION VALUE="3" <?PHP if ($userinfo[thold]==3) { echo "SELECTED"; } ?>>3: Display comments with score +3 only.
+ <OPTION VALUE="4" <?PHP if ($userinfo[thold]==4) { echo "SELECTED"; } ?>>4: Display comments with score +4 only.
+ <OPTION VALUE="5" <?PHP if ($userinfo[thold]==5) { echo "SELECTED"; } ?>>5: Display comments with score +5 only.
+ </SELECT><BR>
+ <I>Comments that scored less than this setting will be ignored.<BR>Anonymous comments start at 0, comments of people logged on start at 1 and moderators can add and subtract points.</I>
+ <BR><BR>
+
+ <B>Signature:</B> (255 char limit)<BR>
+ <TEXTAREA WRAP="virtual" COLS="50" ROWS="4" NAME="signature"><?PHP echo "$userinfo[signature]"; ?></TEXTAREA><BR>
+ <I>Optional. This information will be publicly displayed at the end of your comments.</I>
+ <BR><BR>
+
+ <INPUT TYPE="hidden" NAME="uname" VALUE="<?PHP echo"$userinfo[uname]"; ?>">
+ <INPUT TYPE="hidden" NAME="uid" VALUE="<?PHP echo"$userinfo[uid]"; ?>">
+ <INPUT TYPE="submit" NAME="op" VALUE="Save comments settings">
+ </FORM>
+ <?PHP
+ $theme->footer();
+}
+
+function user_save_comm($uid, $uname, $umode, $uorder, $thold, $noscore, $signature) {
+ global $user, $userinfo;
+ include "functions.inc";
+ dbconnect();
+ if(isset($noscore)) $noscore = 1; else $noscore = 0;
+ mysql_query("LOCK TABLES users WRITE");
+// print "UPDATE users SET umode = '$umode', uorder = '$uorder', thold = '$thold', noscore = '$noscore', signature = '$signature' WHERE uid = $uid<BR>";
+ mysql_query("UPDATE users SET umode = '$umode', uorder = '$uorder', thold = '$thold', noscore = '$noscore', signature = '$signature' WHERE uid = $uid");
+ getusrinfo($user);
+ mysql_query("UNLOCK TABLES");
+ docookie($userinfo[uid],$userinfo[uname],$userinfo[pass],$userinfo[storynum],$userinfo[umode],$userinfo[uorder],$userinfo[thold],$userinfo[noscore],$userinfo[ublockon],$userinfo[theme]);
+ Header("Location: account.php");
+}
+
+switch($op) {
+ case "logout":
+ logout();
+ break;
+ case "lost_pass":
+ lost_pass();
+ break;
+ case "Sign up":
+ confirmNewUser($uname, $email);
+ break;
+ case "Create account":
+ finishNewUser($uname, $email);
+ break;
+ case "Mail password":
+ mailPassword($uname);
+ break;
+ case "userinfo":
+ include "functions.inc";
+ dbconnect();
+ userinfo($uname);
+ break;
+ case "Login":
+ login($uname, $pass);
+ break;
+ case "dummy":
+ // this is needed to give the cookie a chance to digest
+ include "config.inc";
+ header("Location: account.php");
+ break;
+ case "edituser":
+ user_edit_info();
+ break;
+ case "Save user information":
+ user_save_info($uid, $name, $uname, $email, $femail, $url, $pass, $vpass, $bio);
+ userinfo($uname);
+ break;
+ case "edithome":
+ user_edit_home();
+ break;
+ case "Save homepage settings":
+ user_save_home($uid, $uname, $storynum, $theme, $ublockon, $ublock);
+ userinfo($uname);
+ break;
+ case "editcomm":
+ user_edit_comm();
+ break;
+ case "Save comments settings":
+ user_save_comm($uid, $uname, $umode, $uorder, $thold, $noscore, $signature);
+ userinfo($uname);
+ break;
+ default:
+ main($user);
+ break;
+}
+?> \ No newline at end of file
diff --git a/admin.php b/admin.php
new file mode 100644
index 0000000..1993c14
--- /dev/null
+++ b/admin.php
@@ -0,0 +1,798 @@
+<?PHP
+
+include "functions.inc";
+include "authentication.inc";
+
+function login() {
+ include "theme.inc";
+ $theme->header();
+ $theme->box("Login", "<FORM ACTION=\"admin.php\" METHOD=\"post\"><P>Name: <INPUT TYPE=\"text\" NAME=\"aid\" SIZE=\"20\" MAXLENGTH=\"20\"><P>Password: <INPUT TYPE=\"password\" NAME=\"pwd\" SIZE=\"20\" MAXLENGTH=\"18\"><P><INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"login\"></FORM>");
+ $theme->footer();
+}
+
+function logout() {
+ setcookie("admin");
+
+ include "theme.inc";
+ $theme->header();
+ ?>
+ <BR><BR><BR><BR>
+ <P ALIGN="center"><FONT SIZE="+2"><B>You are now logged out!</B></FONT></P>
+ <P>You have been logged out of the system. Since authentication details are stored by using cookies, logging out is only necessary to prevent those who have access to your computer from abusing your account.</P>
+ <?
+ $theme->footer();
+}
+
+function backup() {
+ include "config.inc";
+ if ($system == 0) {
+ exec("mysqldump -h $dbhost -u $dbuname -p$dbpass $dbname | mail -s \"[$sitename] MySQL backup\" $notify_email");
+ exec("mysqldump -h $dbhost -u $dbuname -p$dbpass $dbname > ../$sitename-backup-". date("Ymd", time()).".mysql");
+ }
+ else print "<P><B>Warning:</B> the backup feature is only supported on UNIX systems. Check your configuration file if you are using a UNIX system.</P>";
+}
+
+function main() {
+ include "config.inc";
+ include "theme.inc";
+ $theme->header();
+ dbconnect();
+
+ $result = mysql_query("SELECT qid, subject, timestamp FROM queue order by timestamp");
+
+ echo "<FORM ACTION=\"admin.php\" METHOD=\"post\">";
+ echo "<TABLE WIDTH=\"100%\">";
+
+ if (mysql_num_rows($result) != 0) {
+ while (list($qid, $subject, $timestamp) = mysql_fetch_row($result)) {
+
+ ### format date:
+ $datetime = date("F d - h:i:s A", $timestamp);
+
+ ### generate overview:
+ echo " <TR>";
+ echo " <TD BGCOLOR=\"#c0c0c0\" WIDTH=\"11\" ALIGN=\"middle\"><INPUT TYPE=\"radio\" NAME=\"qid\" VALUE=\"$qid\"></TD>";
+ echo " <TD BGCOLOR=\"#c0c0c0\"><A HREF=\"admin.php?op=submission&qid=$qid\">$subject</A></TD>";
+ echo " <TD BGCOLOR=\"#c0c0c0\">$datetime</TD>";
+ echo " </TR>";
+ $dummy++;
+ }
+ }
+
+ if ($dummy < 1) {
+ echo " <TR><TD ALIGN=\"center\" BGCOLOR=\"#c0c0c0\" COLSPAN=\"3\">There are currently <B>no</B> new submissions available.</TD></TR>";
+ }
+ else {
+ echo " <TR><TD COLSPAN=\"3\"><INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Delete article\"> <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"View article\"></TD></TR>";
+ }
+
+ echo " <TR><TD COLSPAN=\"3\">Article ID: <INPUT TYPE=\"text\" NAME=\"sid\" SIZE=\"5\"> <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Edit article\"></TD></TR>";
+ echo " <TR><TD COLSPAN=\"3\"><A HREF=\"admin.php?op=news_admin_write\">Write and post an article as administrator.</A></TD></TR>";
+ echo "</TABLE></FORM>";
+
+ mysql_free_result($result);
+ ?>
+ <HR>
+ <LI><A HREF="admin.php?op=blocks">Edit global blocks on main page.</A></LI><BR>
+ <I>Allows you to update the content blocks on the main page.</I>
+ <HR>
+ <LI><A HREF="admin.php?op=user_overview">Edit user accounts.</A></LI><BR>
+ <I>Add, delete, block, view and update user accounts.</I>
+ <HR>
+ <LI><A HREF="admin.php?op=mod_authors">Edit adminstrators accounts.</A></LI><BR>
+ <HR>
+ <LI><A HREF="admin.php?op=backup">Backup MySQL tables.</A></LI><BR>
+ <I>Will mail a backup of the MySQL database to '<? echo $notify_email; ?>'.</I>
+ <HR>
+ <LI><A HREF="webboard.php?section=webboard">Webboard manager.</A></LI><BR>
+ <I>Allows you to delete flamebait post or threads from the webboard.</I>
+ <HR>
+ <LI><A HREF="poll.php?section=poll">Poll manager.</A></LI><BR>
+ <I>Install, delete or update polls.</I>
+ <HR>
+ <LI><A HREF="refer.php?section=refer">Referring site manager.</A></LI><BR>
+ <I>Edit, block or delete sites that participate with the referring site program.</I>
+ <HR>
+ <LI><A HREF="">Resource manager.</A> (not implemented yet)</LI><BR>
+ <I>Allows admins to maintain a list of resources, news sites and other interesting start points to start their search for news.</I>
+ <HR>
+ <LI><A HREF="admin.php?op=logout">Logout</A></LI>
+ <?PHP
+ $theme->footer();
+}
+
+/*********************************************************/
+/* block functions */
+/*********************************************************/
+
+function block_overview() {
+ include "theme.inc";
+ $theme->header();
+
+ dbconnect();
+ $result = mysql_query("SELECT id, title, content FROM blocks");
+
+ if (mysql_num_rows($result) > 0) {
+ while(list($id, $title, $content) = mysql_fetch_array($result)) {
+ echo "<FORM ACTION=\"admin.php\" METHOD=\"post\">";
+ echo " <B>Title:</B><BR>";
+ echo " <INPUT TYPE=\"text\" NAME=\"title\" SIZE=\"60\" MAXLENGTH=\"60\" VALUE=\"$title\">";
+ echo " <BR><BR>";
+
+ echo " <B>Content:</B><BR>";
+ echo " <TEXTAREA WRAP=\"virtual\" COLS=\"60\" ROWS=\"8\" NAME=\"content\">$content</TEXTAREA>";
+ echo " <BR><BR>";
+
+ echo " <INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$id\">";
+ echo " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update block\"> <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Delete block\">";
+ echo "</FORM>";
+ }
+ }
+ ?>
+ <HR>
+ <FORM ACTION="admin.php" METHOD="post">
+ <B>Title:</B><BR>
+ <INPUT TYPE="text" NAME="title" SIZE="60" MAXLENGTH="60">
+ <BR><BR>
+
+ <B>Content:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="content"></TEXTAREA>
+ <BR><BR>
+ <INPUT TYPE="submit" NAME="op" VALUE="Add new block">
+ </FORM>
+
+ <?php
+ $theme->footer();
+}
+
+function block_add($title, $content) {
+ dbconnect();
+ mysql_query("INSERT INTO blocks VALUES (NULL,'$aid','$title','$content')");
+ header("Location: admin.php?op=main");
+}
+
+function block_update($id, $title, $content) {
+ dbconnect();
+ mysql_query("update blocks set title='$title', content='$content' where id=$id");
+ header("Location: admin.php?op=main");
+}
+
+function block_delete($id) {
+ dbconnect();
+ mysql_query("DELETE FROM blocks WHERE id = '$id'");
+ header("Location: admin.php?op=main");
+}
+
+
+/*********************************************************/
+/* user account functions */
+/*********************************************************/
+
+function user_overview() {
+ include "theme.inc";
+ $theme->header();
+ dbconnect();
+ $result = mysql_query("SELECT * FROM users");
+ while ($account = mysql_fetch_object($result)) {
+ $count++;
+ print "$count. $account->uname [ <A HREF=\"account.php?op=userinfo&uname=$account->uname\">view</A> | edit | block | delete ]<BR>";
+ }
+ $theme->footer();
+}
+
+/*********************************************************/
+/* article functions */
+/*********************************************************/
+function news_queue_delete($qid) {
+ dbconnect();
+ $result = mysql_query("DELETE FROM queue WHERE qid = $qid");
+ header("Location: admin.php?op=main");
+}
+
+
+function news_display($qid) {
+ global $user, $subject, $article;
+
+ include "config.inc";
+ include "header.inc";
+
+ dbconnect();
+
+ if (isset($qid)) $result = mysql_query("SELECT qid, uid, uname, timestamp, subject, abstract, article, category FROM queue WHERE qid = $qid");
+ else $result = mysql_query("SELECT qid, uid, uname, timestamp, subject, abstract, article, category FROM queue LIMIT 1");
+
+ list($qid, $uid, $uname, $timestamp, $subject, $abstract, $article, $category) = mysql_fetch_row($result);
+ mysql_free_result($result);
+
+ $subject = stripslashes($subject);
+ $abstract = stripslashes($abstract);
+ $article = stripslashes($article);
+
+ $theme->preview("", $uname, $timestamp, $subject, "", $abstract, "", $article);
+ ?>
+
+ <FORM ACTION="admin.php" METHOD="post">
+
+ <P>
+ <B>Author or poster:</B><br>
+ <INPUT TYPE="text" NAME="author" SIZE="50" VALUE="<?PHP echo "$uname"; ?>">
+ </P>
+
+ <P>
+ <B>Subject:</B><BR>
+ <INPUT TYPE="text" NAME="subject" SIZE="50" VALUE="<?PHP echo"$subject"; ?>">
+ </P>
+
+ <P>
+ <B>Department:</B><BR>
+ <INPUT TYPE="text" NAME="department" SIZE="50" VALUE=""> dept.<BR>
+ <I>
+ <FONT SIZE="2">
+ Example departments:
+ <UL>
+ <LI>we-saw-it-coming dept.</LI>
+ <LI>don't-get-your-panties-in-a-knot dept.</LI>
+ <LI>brain-melt dept.</LI>
+ <LI>beats-the-heck-out-of-me dept.</LI>
+ </UL>
+ </FONT>
+ </I>
+ </P>
+
+ <P>
+ <B>Category:</B><BR>
+ <SELECT NAME="category">
+ <?PHP
+ for ($i = 0; $i < sizeof($categories); $i++) {
+ echo "<OPTION VALUE=\"$categories[$i]\" ";
+ if ($category == $categories[$i]) echo "SELECTED";
+ echo ">$categories[$i]\n";
+ }
+ ?>
+ </SELECT>
+ </P>
+
+ <P>
+ <B>Author's abstract:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="abstract"><?PHP echo "$abstract"; ?></TEXTAREA><BR>
+ <FONT SIZE="2"><I>Will be displayed on the main page!</I></FONT>
+ </P>
+
+ <P>
+ <B>Editor's comments:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="5" NAME="comments"></TEXTAREA><BR>
+ <FONT SIZE="2"><I>Will be displayed on the main page after the abstract.</I></FONT>
+ </P>
+
+ <P>
+ <B>Extended article:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="12" NAME="article"><?PHP echo "$article"; ?></TEXTAREA><BR>
+ <FONT SIZE="2">Will be displayed on the article's page when following the 'read more'-link.</FONT></I>
+ </P>
+
+ <INPUT TYPE="hidden" NAME="qid" VALUE="<?PHP echo "$qid"; ?>">
+ <INPUT TYPE="hidden" NAME="uid" VALUE="<?PHP echo "$uid"; ?>">
+ <INPUT TYPE="submit" NAME="op" VALUE="Delete article">
+ <INPUT TYPE="submit" NAME="op" VALUE="Preview article">
+ <INPUT TYPE="submit" NAME="op" VALUE="Post article">
+ </FORM>
+
+ <?PHP
+ $theme->footer();
+}
+
+function news_preview($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article) {
+ global $user, $boxstuff, $aid;
+ include "config.inc";
+ include "theme.inc";
+
+ $theme->header();
+
+ $subject = stripslashes($subject);
+ $agstract = stripslashes($abstract);
+ $comments = stripslashes($comments);
+ $article = stripslashes($article);
+
+ $theme->preview($aid, $author, time(), $subject, $department, $abstract, $comments, $article);
+ $theme->footer();
+ ?>
+
+
+ <FORM ACTION="admin.php" METHOD="post">
+
+ <P>
+ <B>Author or poster:</B><br>
+ <INPUT TYPE="text" NAME="author" SIZE="50" VALUE="<?PHP echo "$author"; ?>">
+ </P>
+
+ <P>
+ <B>Subject:</B><BR>
+ <INPUT TYPE="text" NAME="subject" SIZE="50" VALUE="<?PHP echo"$subject"; ?>">
+ </P>
+
+ <P>
+ <B>Department:</B><BR>
+ <INPUT TYPE="text" NAME="department" SIZE="50" VALUE="<?PHP echo"$department"; ?>"> dept.<BR>
+ <I><FONT SIZE="2">
+ Example departments:
+ <UL>
+ <LI>we-saw-it-coming dept.</LI>
+ <LI>don't-get-your-panties-in-a-knot dept.</LI>
+ <LI>brain-melt dept.</LI>
+ <LI>beats-the-heck-out-of-me dept.</LI>
+ </UL>
+ </FONT></I>
+ </P>
+
+ <P>
+ <B>Category:</B><BR>
+ <SELECT NAME="category">
+ <?PHP
+ for ($i = 0; $i < sizeof($categories); $i++) {
+ echo "<OPTION VALUE=\"$categories[$i]\" ";
+ if ($category == $categories[$i]) echo "SELECTED";
+ echo ">$categories[$i]\n";
+ }
+ ?>
+ </SELECT>
+ </P>
+
+ <P>
+ <B>Author's abstract:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="abstract"><?PHP echo "$abstract"; ?></TEXTAREA><BR>
+ <FONT SIZE="2"><I>Will be displayed on the main page!</I></FONT>
+ </P>
+
+ <P>
+ <B>Editor's comments:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="5" NAME="comments"><? echo "$comments"; ?></TEXTAREA><BR>
+ <FONT SIZE="2"><I>Will be displayed on the main page after the abstract.</I></FONT>
+ </P>
+
+ <P>
+ <B>Extended article:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="12" NAME="article"><? echo "$article"; ?></TEXTAREA><BR>
+ <I><FONT SIZE="2">Will be displayed on the article's page when following the 'read more'-link.</FONT></I>
+ </P>
+
+ <INPUT TYPE="hidden" NAME="qid" VALUE="<?PHP echo "$qid"; ?>">
+ <INPUT TYPE="hidden" NAME="uid" VALUE="<?PHP echo "$uid"; ?>">
+ <INPUT TYPE="submit" NAME="op" VALUE="Delete article">
+ <INPUT TYPE="submit" NAME="op" VALUE="Preview article">
+ <INPUT TYPE="submit" NAME="op" VALUE="Post article">
+ </FORM>
+
+ <?PHP
+ $theme->footer();
+}
+
+function news_post($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article) {
+ global $aid;
+ dbconnect();
+
+ if ($uid == -1) $author = "";
+
+ $subject = stripslashes(FixQuotes($subject));
+ $abstract = stripslashes(FixQuotes($abstract));
+ $comments = stripslashes(FixQuotes($comments));
+ $article = stripslashes(FixQuotes($article));
+
+ $result = mysql_query("INSERT INTO stories (sid, aid, subject, time, abstract, comments, article, category, informant, department) VALUES (NULL, '$aid', '$subject', '". time() ."', '$abstract', '$comments', '$article', '$category', '$author', '$department')");
+
+ ### remove article from queue:
+ news_queue_delete($qid);
+}
+
+function news_edit($sid) {
+ global $user, $subject, $abstract, $comments, $article;
+
+ include "theme.inc";
+ include "config.inc";
+
+ $theme->header();
+
+ dbconnect();
+
+ $result = mysql_query("SELECT * FROM stories where sid = $sid");
+ $article = mysql_fetch_object($result);
+ mysql_free_result($result);
+
+ $theme->preview($article->author, $article->informant, $article->time, $article->subject, $article->department, $article->abstract, $article->comments, $article->article);
+
+ ?>
+
+ <FORM ACTION="admin.php" METHOD="post">
+
+ <P>
+ <B>Author or poster:</B><BR>
+ <INPUT TYPE="text" NAME="author" SIZE="50" VALUE="<?PHP echo "$article->aid"; ?>">
+ </P>
+
+ <P>
+ <B>Subject:</B><BR>
+ <INPUT TYPE="text" NAME="subject" SIZE="50" VALUE="<?PHP echo"$article->subject"; ?>">
+ </P>
+
+ <P>
+ <B>Department:</B><BR>
+ <INPUT TYPE="text" NAME="department" SIZE="50" VALUE="<?PHP echo"$article->department"; ?>"> dept.<BR>
+ <I><FONT SIZE="2">
+ Example departments:
+ <UL>
+ <LI>we-saw-it-coming dept.</LI>
+ <LI>don't-get-your-panties-in-a-knot dept.</LI>
+ <LI>brain-melt dept.</LI>
+ <LI>beats-the-heck-out-of-me dept.</LI>
+ </UL>
+ </FONT></I>
+ </P>
+
+ <P>
+ <B>Category:</B><BR>
+ <SELECT NAME="category">
+ <?PHP
+ for ($i = 0; $i < sizeof($categories); $i++) {
+ echo "<OPTION VALUE=\"$categories[$i]\" ";
+ if ($article->category == $categories[$i]) echo "SELECTED";
+ echo ">$categories[$i]\n";
+ }
+ ?>
+ </SELECT>
+ </P>
+
+ <P>
+ <B>Author's abstract:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="abstract"><?PHP echo "$article->abstract"; ?></TEXTAREA><BR>
+ <FONT SIZE="2"><I>Will be displayed on the main page!</I></FONT>
+ </P>
+
+ <P>
+ <B>Editor's comments:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="5" NAME="comments"><? echo "$article->comments"; ?></TEXTAREA><BR>
+ <FONT SIZE="2"><I>Will be displayed on the main page after the abstract.</I></FONT>
+ </P>
+
+ <P>
+ <B>Extended article:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="12" NAME="article"><? echo "$article->article"; ?></TEXTAREA><BR>
+ <I><FONT SIZE="2">Will be displayed on the article's page when following the 'read more'-link.</FONT></I>
+ </P>
+
+
+ <INPUT TYPE="hidden" NAME="sid" SIZE=60 VALUE="<?PHP echo"$sid"; ?>">
+ <INPUT TYPE="submit" NAME="op" VALUE="Update article"></FORM>
+
+ <?PHP
+ $theme->footer();
+}
+
+function news_update($sid, $subject, $category, $department, $abstract, $comments, $article) {
+ global $aid;
+ dbconnect();
+ $subject = stripslashes(FixQuotes($subject));
+ $department = stripslashes(FixQuotes($department));
+ $abstract = stripslashes(FixQuotes($abstract));
+ $comments = stripslashes(FixQuotes($comments));
+ $article = stripslashes(FixQuotes($article));
+ mysql_query("UPDATE stories SET subject = '$subject', category = '$category', department = '$department', abstract = '$abstract', comments = '$comments', article = '$article' WHERE sid = $sid");
+ header("Location: admin.php?op=main");
+}
+
+function news_admin_write() {
+ include "theme.inc";
+ include "config.inc";
+ dbconnect();
+
+ $theme->header();
+ ?>
+
+ <FORM ACTION="admin.php" METHOD="post">
+
+ <P>
+ <B>Subject:</B><BR>
+ <INPUT TYPE="text" NAME="subject" SIZE="50" VALUE="">
+ </P>
+
+ <P>
+ <B>Department:</B><BR>
+ <INPUT TYPE="text" NAME="department" SIZE="50" VALUE=""> dept.<BR>
+ <I>
+ <FONT SIZE="2">
+ Example departments:
+ <UL>
+ <LI>we-saw-it-coming dept.</LI>
+ <LI>don't-get-your-panties-in-a-knot dept.</LI>
+ <LI>brain-melt dept.</LI>
+ <LI>beats-the-heck-out-of-me dept.</LI>
+ </UL>
+ </FONT>
+ </I>
+ </P>
+
+ <P>
+ <B>Category:</B><BR>
+ <SELECT NAME="category">
+ <?PHP
+ for ($i = 0; $i < sizeof($categories); $i++) {
+ echo "<OPTION VALUE=\"$categories[$i]\">$categories[$i]\n";
+ }
+ ?>
+ </SELECT>
+ </P>
+
+ <P>
+ <B>Introduction of article:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="7" NAME="abstract"></TEXTAREA><BR>
+ <FONT SIZE="2"><I>Will be displayed on the main page.</I></FONT>
+ </P>
+
+ <P>
+ <B>Rest of article:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="article"></TEXTAREA><BR>
+ <I><FONT SIZE="2">Will be displayed on the article's page when following the 'read more'-link.</FONT></I>
+ </P>
+
+ <INPUT TYPE="submit" NAME="op" VALUE="Preview admin article">
+ <INPUT TYPE="submit" NAME="op" VALUE="Post admin article">
+ </FORM>
+ <?
+ $theme->footer();
+}
+
+function news_admin_preview($subject, $category, $department, $abstract, $article) {
+ global $aid;
+ include "theme.inc";
+ include "config.inc";
+ $subject = stripslashes($subject);
+ $intro = stripslashes($intro);
+ $rest = stripslashes($rest);
+
+ $theme->header();
+ $theme->preview("", $aid, $time, $subject, "", $abstract, "", $article);
+ ?>
+
+ <FORM ACTION="admin.php" METHOD="post">
+
+ <P>
+ <B>Subject:</B><BR>
+ <INPUT TYPE="text" NAME="subject" SIZE="50" VALUE="<? echo "$subject"; ?>">
+ </P>
+
+ <P>
+ <B>Department:</B><BR>
+ <INPUT TYPE="text" NAME="department" SIZE="50" VALUE="<? echo "$department"; ?>"> dept.<BR>
+ <I>
+ <FONT SIZE="2">
+ Example departments:
+ <UL>
+ <LI>we-saw-it-coming dept.</LI>
+ <LI>don't-get-your-panties-in-a-knot dept.</LI>
+ <LI>brain-melt dept.</LI>
+ <LI>beats-the-heck-out-of-me dept.</LI>
+ </UL>
+ </FONT>
+ </I>
+ </P>
+
+ <P>
+ <B>Category:</B><BR>
+ <SELECT NAME="category">
+ <?PHP
+ for ($i = 0; $i < sizeof($categories); $i++) {
+ echo "<OPTION VALUE=\"$categories[$i]\" ";
+ if ($category == $categories[$i]) echo "SELECTED";
+ echo ">$categories[$i]\n";
+ }
+ ?>
+ </SELECT>
+ </P>
+
+ <P>
+ <B>Introduction of article:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="7" NAME="abstract"><? echo "$abstract"; ?></TEXTAREA><BR>
+ <FONT SIZE="2"><I>Will be displayed on the main page.</I></FONT>
+ </P>
+
+ <P>
+ <B>Rest of article:</B><BR>
+ <TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="article"><? echo "$article"; ?></TEXTAREA><BR>
+ <I><FONT SIZE="2">Will be displayed on the article's page when following the 'read more'-link.</FONT></I>
+ </P>
+
+ <INPUT TYPE="submit" NAME="op" VALUE="Preview admin article">
+ <INPUT TYPE="submit" NAME="op" VALUE="Post admin article">
+ </FORM>
+
+ <?
+ $theme->footer();
+}
+
+function news_admin_post($subject, $category, $department, $abstract, $article, $category) {
+ global $aid;
+ dbconnect();
+
+ $subject = stripslashes(FixQuotes($subject));
+ $intro = stripslashes(FixQuotes($intro));
+ $rest = stripslashes(FixQuotes($rest));
+
+ $result = mysql_query("INSERT INTO stories VALUES (NULL, '$aid', '$subject', '". time() ."', '$abstract', '', '$article', '$category', '$aid', '$department')");
+ if (!$result) {
+ echo mysql_errno(). ": ".mysql_error(). "<BR>";
+ exit();
+ }
+ header("Location: admin.php?op=main");
+}
+
+/*********************************************************/
+/* admin admining */
+/*********************************************************/
+
+function displayadmins() {
+ $titlebar = "<b>current authors</b>";
+ include "header.inc";
+ dbconnect();
+ $result = mysql_query("select aid from authors");
+ echo "<table border=1>";
+ while(list($a_aid) = mysql_fetch_row($result)) {
+ echo "<tr><td>$a_aid</td>";
+ echo "<td><a href=\"$that_url/admin.php?op=modifyadmin&chng_aid=$a_aid\">Modify Info</a></td>";
+ echo "<td><a href=\"$that_url/admin.php?op=deladmin&del_aid=$a_aid\">Delete Author</a></td></tr>";
+ }
+ echo "</table>";
+ echo "<form action=\"$that_url/admin.php\" method=\"post\">";
+ echo "Handle: <INPUT TYPE=\"text\" NAME=\"add_aid\" size=30 maxlength=30><br>";
+ echo "Name: <INPUT TYPE=\"text\" NAME=\"add_name\" size=30 maxlength=60><br>";
+ echo "Email: <INPUT TYPE=\"text\" NAME=\"add_email\" size=30 maxlength=60><br>";
+ echo "URL: <INPUT TYPE=\"text\" NAME=\"add_url\" size=30 maxlength=60><br>";
+ echo "Password: <INPUT TYPE=\"text\" NAME=\"add_pwd\" size=12 maxlength=12><br>";
+ echo " <INPUT TYPE=submit NAME=op VALUE=\"Add author\"></form>";
+ include "footer.inc";
+}
+
+function modifyadmin($chng_aid) {
+ $titlebar = "<b>update $chng_aid</b>";
+ include "header.inc";
+ dbconnect();
+ $result = mysql_query("select aid, name, url, email, pwd from authors where aid='$chng_aid'");
+ list($chng_aid, $chng_name, $chng_url, $chng_email, $chng_pwd) = mysql_fetch_row($result);
+ echo "<form action=\"admin.php\" method=\"post\">";
+ echo "Name: $chng_name<INPUT TYPE=\"hidden\" NAME=\"chng_name\" VALUE=\"$chng_name\"><br>";
+ echo "Handle: <INPUT TYPE=\"text\" NAME=\"chng_aid\" VALUE=\"$chng_aid\"><br>";
+ echo "Email: <INPUT TYPE=\"text\" NAME=\"chng_email\" VALUE=\"$chng_email\" size=30 maxlength=60><br>";
+ echo "URL: <INPUT TYPE=\"text\" NAME=\"chng_url\" VALUE=\"$chng_url\" size=30 maxlength=60><br>";
+ echo "Password: <INPUT TYPE=\"password\" NAME=\"chng_pwd\" VALUE=\"$chng_pwd\" size=12 maxlength=12><br>";
+ echo "Retype Password: <INPUT TYPE=\"password\" NAME=\"chng_pwd2\" size=12 maxlength=12> (for changes only)<br>";
+ echo " <INPUT TYPE=submit NAME=op VALUE=\"Update Author\"></form>";
+ include "footer.inc";
+}
+
+function updateadmin($chng_aid, $chng_name, $chng_email, $chng_url, $chng_pwd, $chng_pwd2) {
+ if ($chng_pwd2 != "") {
+ if($chng_pwd != $chng_pwd2) {
+ $titlebar = "<b>bad pass</b>";
+ include "header.inc";
+ echo "Sorry, the new passwords do not match. Click back and try again";
+ include "footer.inc";
+ exit;
+ }
+ dbconnect();
+ $result = mysql_query("update authors set aid='$chng_aid', email='$chng_email', url='$chng_url', pwd='$chng_pwd' where NAME='$chng_name'");
+ header("Location: admin.php?op=main");
+ } else {
+ dbconnect();
+ $result = mysql_query("update authors set aid='$chng_aid', email='$chng_email', url='$chng_url' where NAME='$chng_name'");
+ header("Location: admin.php?op=main");
+ }
+}
+
+
+if ($admin) {
+ switch($op) {
+ case "main":
+ main();
+ break;
+ case "blocks":
+ block_overview();
+ break;
+ case "Add new block":
+ block_add($title, $content);
+ break;
+ case "Delete block":
+ block_delete($id);
+ break;
+ case "Update block":
+ block_update($id, $title, $content);
+ break;
+ case "submission":
+ // fall through
+ case "View article":
+ news_display($qid);
+ break;
+ case "Preview article":
+ news_preview($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article);
+ break;
+ case "Post article":
+ news_post($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article);
+ break;
+ case "Edit article":
+ news_edit($sid);
+ break;
+ case "Update article":
+ news_update($sid, $subject, $category, $department, $abstract, $comments, $article);
+ break;
+ case "Delete article":
+ news_queue_delete($qid);
+ break;
+ case "news_admin_write":
+ news_admin_write($sid);
+ break;
+ case "Preview admin article":
+ news_admin_preview($subject, $category, $department, $abstract, $article);
+ break;
+ case "Post admin article":
+ news_admin_post($subject, $category, $department, $abstract, $article);
+ break;
+ case "mod_authors":
+ displayadmins();
+ break;
+ case "modifyadmin":
+ modifyadmin($chng_aid);
+ break;
+ case "Update author":
+ updateadmin($chng_aid, $chng_name, $chng_email, $chng_url, $chng_pwd, $chng_pwd2);
+ break;
+ case "Add author":
+ dbconnect();
+ $result = mysql_query("INSERT INTO authors VALUES ('$add_aid','$add_name','$add_url','$add_email','$add_pwd')");
+ if (!$result) {
+ echo mysql_errno(). ": ".mysql_error(). "<br>"; return;
+ }
+ header("Location: $that_url/admin.php?op=main");
+ break;
+ case "deladmin":
+ include "header.inc";
+ echo "Are you sure you want to delete $del_aid?<br>";
+ echo "<a href=\"$that_url/admin.php?op=deladminconf&del_aid=$del_aid\">Yes</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"$that_url/admin.php?op=main\">No</a>";
+ include "footer.inc";
+ break;
+ case "deladminconf":
+ dbconnect();
+ mysql_query("delete from authors where aid='$del_aid'");
+ header("Location: $that_url/admin.php?op=main");
+ break;
+ case "create":
+ poll_createPoll();
+ break;
+ case "createPosted":
+ poll_createPosted();
+ break;
+ case "remove":
+ poll_removePoll();
+ break;
+ case "removePosted":
+ poll_removePosted();
+ break;
+ case "user_overview":
+ user_overview();
+ break;
+ case "backup":
+ backup();
+ main();
+ break;
+ case "view":
+ poll_viewPoll();
+ break;
+ case "viewPosted":
+ poll_viewPosted();
+ break;
+ case "logout":
+ logout();
+ break;
+ default:
+ main();
+ break;
+ }
+} else {
+ login();
+}
+?> \ No newline at end of file
diff --git a/article.php b/article.php
new file mode 100644
index 0000000..aff2d36
--- /dev/null
+++ b/article.php
@@ -0,0 +1,33 @@
+<?PHP
+ if(!isset($sid) && !isset($tid)) { exit(); }
+
+ include "config.inc";
+ include "functions.inc";
+ include "theme.inc";
+
+ dbconnect();
+
+ if ($save) {
+ cookiedecode($user);
+ mysql_query("UPDATE users SET umode='$mode', uorder='$order', thold='$thold' where uid='$cookie[0]'");
+ getusrinfo($user);
+ $info = base64_encode("$userinfo[uid]:$userinfo[uname]:$userinfo[pass]:$userinfo[storynum]:$userinfo[umode]:$userinfo[uorder]:$userinfo[thold]:$userinfo[noscore]");
+ setcookie("user","$info",time() + 15552000);
+ }
+
+ if($op == "reply") Header("Location: comments.php?op=reply&pid=0&sid=$sid&mode=$mode&order=$order&thold=$thold");
+
+ $result = mysql_query("SELECT * FROM stories WHERE sid = $sid");
+ list($sid, $aid, $subject, $time, $abstract, $comments, $article, $category, $informant, $department) = mysql_fetch_row($result);
+
+ $theme->header();
+
+ $reply = "[ <A HREF=\"\"><FONT COLOR=\"$theme->hlcolor2\">home</FONT></A> | <A HREF=\"comments.php?op=reply&pid=0&sid=$sid\"><FONT COLOR=\"$theme->hlcolor2\">add a comment</FONT></A> ]";
+
+ $theme->article($aid, $informant, $time, stripslashes($subject), $department, stripslashes($abstract), stripslashes($comments), stripslashes($article), $reply);
+
+ cookiedecode($user);
+ if ($mode != "nocomments") include "comments.php";
+
+ $theme->footer();
+?> \ No newline at end of file
diff --git a/authentication.inc b/authentication.inc
new file mode 100644
index 0000000..16a91c4
--- /dev/null
+++ b/authentication.inc
@@ -0,0 +1,20 @@
+<?
+
+if ((isset($aid)) && (isset($pwd)) && ($op == "login")) {
+ $admin = base64_encode("$aid:$pwd");
+ setcookie("admin","$admin",time()+2592000); // 1 mo is 2592000
+}
+
+if (isset($admin)) {
+ $admin = base64_decode($admin);
+ $admin = explode(":", $admin);
+ $aid = "$admin[0]";
+ $pwd = "$admin[1]";
+ dbconnect();
+ if (mysql_num_rows(mysql_query("SELECT * FROM authors WHERE aid = '$aid' AND pwd = '$pwd'")) == 1) $admin = 1;
+ else $admin = 0;
+} else {
+ $admin = 0;
+}
+
+?> \ No newline at end of file
diff --git a/comments.php b/comments.php
new file mode 100644
index 0000000..6cbb288
--- /dev/null
+++ b/comments.php
@@ -0,0 +1,525 @@
+<?
+
+function moderate_1() {
+ include "config.inc";
+ global $admin;
+ echo "<FORM ACTION=\"comments.php\" METHOD=\"post\">";
+}
+
+function moderate_2($tid, $reason) {
+ include "config.inc";
+
+ echo "<SELECT NAME=\"meta:$tid\">";
+ for($i = 0; $i < sizeof($comments_meta_reasons); $i++) {
+ echo "<OPTION VALUE=\"$i\">$comments_meta_reasons[$i]</OPTION>\n";
+ }
+ echo "</SELECT>";
+}
+
+function moderate_3($sid, $mode, $order, $thold = 0) {
+ echo "<INPUT TYPE=\"hidden\" NAME=\"sid\" VALUE=\"$sid\"><INPUT TYPE=\"hidden\" NAME=\"mode\" VALUE=\"$mode\"><INPUT TYPE=\"hidden\" NAME=\"order\" VALUE=\"$order\"><INPUT TYPE=\"hidden\" NAME=\"thold\" VALUE=\"$thold\"><INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Moderate\"></FORM>";
+}
+
+function displayControlBlock($sid, $title, $thold, $mode, $order) {
+ global $user, $theme;
+ dbconnect();
+ $query = mysql_query("SELECT sid FROM comments WHERE sid = $sid");
+
+ if (!$query) $count = 0; else $count = mysql_num_rows($query);
+ if (!isset($thold)) $thold = 0;
+
+ ?>
+ <TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2">
+ <TR>
+ <TD ALIGN="center" BGCOLOR="<? echo "$theme->bgcolor2"; ?>"><FONT COLOR="<? echo "$theme->bgcolor1" ?>" SIZE="+1"><B>Comment control</B></FONT></TD>
+ </TR>
+ <TR>
+ <TD ALIGN="center" BGCOLOR="<? echo "$theme->bgcolor1"; ?>">
+ <FORM METHOD="get" ACTION="article.php">
+ <FONT SIZE="2">
+ <SELECT NAME="thold">
+ <OPTION VALUE="-1" <? if ($thold == -1) { echo "SELECTED"; } ?>>Threshold: -1
+ <OPTION VALUE="0" <? if ($thold == 0) { echo "SELECTED"; } ?>>Threshold: 0
+ <OPTION VALUE="1" <? if ($thold == 1) { echo "SELECTED"; } ?>>Threshold: 1
+ <OPTION VALUE="2" <? if ($thold == 2) { echo "SELECTED"; } ?>>Threshold: 2
+ <OPTION VALUE="3" <? if ($thold == 3) { echo "SELECTED"; } ?>>Threshold: 3
+ <OPTION VALUE="4" <? if ($thold == 4) { echo "SELECTED"; } ?>>Threshold: 4
+ <OPTION VALUE="5" <? if ($thold == 5) { echo "SELECTED"; } ?>>Threshold: 5
+ </SELECT>
+ <SELECT NAME="mode">
+ <OPTION VALUE="nocomments" <? if ($mode == 'nocomments') { echo "SELECTED"; } ?>>No comments
+ <OPTION VALUE="nested" <? if ($mode == 'nested') { echo "SELECTED"; } ?>>Nested
+ <OPTION VALUE="flat" <? if ($mode == 'flat') { echo "SELECTED"; } ?>>Flat
+ <OPTION VALUE="threaded" <? if (!isset($mode) || $mode=='threaded' || $mode=="") { echo "SELECTED"; } ?>>Threaded
+ </SELECT>
+ <SELECT NAME="order">
+ <OPTION VALUE="0" <? if (!$order) { echo "SELECTED"; } ?>>Oldest first
+ <OPTION VALUE="1" <? if ($order==1) { echo "SELECTED"; } ?>>Newest first
+ <OPTION VALUE="2" <? if ($order==2) { echo "SELECTED"; } ?>>Highest scoring first
+ </SELECT>
+ <INPUT TYPE="hidden" NAME="sid" VALUE="<? echo "$sid"; ?>"> <INPUT TYPE="submit" VALUE="Refresh">
+ <?
+ if (isset($user)) echo "<BR><CENTER><INPUT TYPE=\"checkbox\" NAME=\"save\"> Save preferences</CENTER>";
+ ?>
+ </FONT>
+ </FORM>
+ </TD>
+ </TR>
+ <?
+ $result = mysql_query("SELECT COUNT(tid) FROM comments WHERE sid = $sid AND score < $thold");
+ if ($result && $number = mysql_result($result, 0)) {
+ ?>
+ <TR>
+ <TD ALIGN="center" BGCOLOR="<? echo "$theme->bgcolor2"; ?>"><SMALL><FONT COLOR="<? echo "$theme->fgcolor2"; ?>">There are at least <? echo $number; ?> comments below your threshold.</FONT></SMALL></TD>
+ </TR>
+ <?
+ }
+ ?>
+ </TABLE>
+<?
+}
+
+function displayKids ($tid, $mode, $order = 0, $thold = 0, $level = 0, $dummy = 0) {
+ global $user, $cookie, $theme;
+ include "config.inc";
+ $comments = 0;
+ cookiedecode($user);
+
+ $result = mysql_query("SELECT tid, pid, sid, date, name, email, url, host_name, subject, comment, score, reason FROM comments WHERE pid = $tid ORDER BY date, tid");
+
+ if ($mode == 'nested') {
+ while (list($r_tid, $r_pid, $r_sid, $r_date, $r_name, $r_email, $r_url, $r_host_name, $r_subject, $r_comment, $r_score, $r_reason) = mysql_fetch_row($result)) {
+ if ($r_score >= $thold) {
+ if ($level && !$comments) {
+ echo "<UL>";
+ $tblwidth -= 5;
+ }
+ $comments++;
+
+ $link = "<A HREF=\"comments.php?op=reply&pid=$r_tid&sid=$r_sid&mode=$mode&order=$order&thold=$thold\">reply to this comment</A>";
+
+ $theme->comment($r_name, $r_subject, $r_tid, $r_date, $r_url, $r_email, $r_score, $r_reason, $r_comment, $link);
+
+ displayKids($r_tid, $mode, $order, $thold, $level + 1, $dummy + 1);
+ }
+ }
+ } elseif ($mode == 'flat') {
+ while (list($r_tid, $r_pid, $r_sid, $r_date, $r_name, $r_email, $r_url, $r_host_name, $r_subject, $r_comment, $r_score, $r_reason) = mysql_fetch_row($result)) {
+ if ($r_score >= $thold) {
+ if (!eregi("[a-z0-9]",$r_name)) $r_name = $anonymous;
+ if (!eregi("[a-z0-9]",$r_subject)) $r_subject = "[no subject]";
+
+ $link = "<A HREF=\"comments.php?op=reply&pid=$r_tid&sid=$r_sid&mode=$mode&order=$order&thold=$thold\">reply to this comment</A>";
+
+ $theme->comment($r_name, $r_subject, $r_tid, $r_date, $r_url, $r_email, $r_score, $r_reason, $r_comment, $link);
+ }
+ displayKids($r_tid, $mode, $order, $thold);
+ }
+ } else {
+ echo "ERROR: we should not get here!";
+ }
+
+ if ($level && $comments) {
+ echo "</UL>";
+ }
+}
+
+function displayBabies ($tid, $level = 0, $dummy = 0, $thread) {
+ global $datetime, $theme, $user, $cookie;
+
+ include "config.inc";
+
+ $comments = 0;
+ $result = mysql_query("SELECT tid, pid, sid, date, name, email, url, host_name, subject, comment, score, reason FROM comments WHERE pid = $tid ORDER BY date, tid");
+
+ if ($level == 0) $thread = "";
+
+ while (list($r_tid, $r_pid, $r_sid, $r_date, $r_name, $r_email, $r_url, $r_host_name, $r_subject, $r_comment, $r_score, $r_reason) = mysql_fetch_row($result)) {
+ if ($level && !$comments) {
+ $thread .= "<UL>";
+ }
+
+ $comments++;
+ if (!eregi("[a-z0-9]",$r_name)) { $r_name = $anonymous; }
+ if (!eregi("[a-z0-9]",$r_subject)) { $r_subject = "[no subject]"; }
+
+ if ($user) {
+ ### Make sure to respect the user preferences:
+ $thread .= "<LI><A HREF=\"comments.php?op=showreply&tid=$r_tid&pid=$r_pid&sid=$r_sid";
+ if (isset($cookie[4])) { $thread .= "&mode=$cookie[4]"; } else { $thread .= "&mode=threaded"; }
+ if (isset($cookie[5])) { $thread .= "&order=$cookie[5]"; } else { $thread .= "&order=0"; }
+ if (isset($cookie[6])) { $thread .= "&thold=$cookie[6]"; } else { $thread .= "&thold=0"; }
+ $thread .= "\">$r_subject</A> by $r_name <FONT SIZE=\"2\">(". formatTimestamp($r_date) .")</FONT></LI>";
+ }
+ else {
+ $thread .= "<LI><A HREF=\"comments.php?op=showreply&tid=$r_tid&pid=$r_pid&sid=$r_sid&mode=threaded&order=1&thold=0\">$r_subject</A> by $r_name <FONT SIZE=\"2\">(". formatTimestamp($r_date) .")</FONT></LI>";
+ }
+ displayBabies($r_tid, $level + 1, $dummy + 1, &$thread);
+ }
+
+ if ($level && $comments) {
+ $thread .= "</UL>";
+ }
+
+ return $thread;
+}
+
+function displayTopic ($sid, $pid = 0, $tid = 0, $mode = "threaded", $order = 0, $thold = 0, $level = 0, $nokids = 0) {
+ global $user, $cookie, $theme, $functions;
+
+ ### include required files:
+ if ($functions) {
+ include "config.inc";
+ }
+ else {
+ include "functions.inc";
+ include "theme.inc";
+ $theme->header();
+ }
+
+ ### ensure default value:
+ if (!isset($pid)) $pid = 0;
+
+ ### connect to database:
+ dbconnect();
+
+ $count_times = 0;
+ cookiedecode($user);
+
+ $q = "SELECT tid, pid, sid, date, name, email, url, host_name, subject, comment, score, reason FROM comments WHERE sid = $sid AND pid = $pid";
+
+ if ($mode == 'threaded' || mode == 'nested') {
+ if ($thold != "") {
+ $q .= " AND score >= $thold";
+ } else {
+ $q .= " AND score >= 0";
+ }
+ }
+
+ if ($order == 1) $q .= " ORDER BY date DESC";
+ if ($order == 2) $q .= " ORDER BY score DESC";
+
+ $res = mysql_query("$q");
+
+ $num_tid = mysql_num_rows($res);
+
+ displayControlBlock($sid, $title, $thold, $mode, $order);
+
+ moderate_1();
+
+ while ($count_times < $num_tid) {
+ list($tid, $pid, $sid, $date, $name, $email, $url, $host_name, $subject, $comment, $score, $reason) = mysql_fetch_row($res);
+ if ($name == "") { $name = $anonymous; }
+ if ($subject == "") { $subject = "[no subject]"; }
+
+ ### Dynamically generate the link:
+ if ($pid != 0) {
+ list($erin) = mysql_fetch_row(mysql_query("SELECT pid FROM comments WHERE tid=$pid"));
+ $link = "<A HREF=\"comments.php?sid=$sid&pid=$erin&mode=$mode&order=$order&thold=$thold\">return to parent</A> | <A HREF=\"comments.php?op=reply&pid=$tid&sid=$sid&mode=$mode&order=$order&thold=$thold\">reply to this comment</A>";
+ }
+ else {
+ $link = "<A HREF=\"comments.php?op=reply&pid=$tid&sid=$sid&mode=$mode&order=$order&thold=$thold\">reply to this comment</A> ";
+ }
+
+ if ($mode == "threaded") {
+ $thread = displayBabies($tid, $mode, $order, $thold, $level);
+ $theme->comment($name, $subject, $tid, $date, $url, $email, $score, $reason, $comment, $link, $thread);
+ }
+ else {
+ $theme->comment($name, $subject, $tid, $date, $url, $email, $score, $reason, $comment, $link);
+ displayKids($tid, $mode, $order, $thold, $level);
+ }
+
+ echo "</UL>";
+ echo "</P>";
+ $count_times += 1;
+ }
+
+ moderate_3($sid, $mode, $order, $thold);
+
+ if ($pid == 0) return array($sid, $pid, $subject);
+ else $theme->footer();
+}
+
+
+function reply($pid, $sid, $mode, $order, $thold) {
+ include "functions.inc";
+ include "theme.inc";
+
+ global $user, $cookie;
+ dbconnect();
+
+ $theme->header();
+
+ if ($pid != 0) {
+ list($date, $name, $email, $url, $subject, $comment, $score) = mysql_fetch_row(mysql_query("SELECT date, name, email, url, subject, comment, score FROM comments WHERE tid = $pid"));
+ } else {
+ list($date, $subject, $comment, $name) = mysql_fetch_row(mysql_query("SELECT time, subject, abstract, informant FROM stories WHERE sid = $sid"));
+ }
+
+ ### Pre-process the variables:
+ if ($comment == "") $comment = $comment;
+ if ($subject == "") $subject = "[no subject]";
+ if ($name == "") $name = $anonymous;
+
+ ### Display parent comment:
+ echo "<TABLE WIDTH=\"100%\" BORDER=\"0\">";
+ if ($email) {
+ echo " <TR BGCOLOR=\"$theme->bgcolor1\"><TD><FONT COLOR=\"$theme->hlcolor1\"><B>$subject</B><BR>by <A HREF=\"mailto:$email\">$name</A> <B>($email)</B> on ". formatTimestamp($date) ."</FONT></TD></TR>";
+ }
+ else {
+ echo " <TR BGCOLOR=\"$theme->bgcolor1\"><TD><FONT COLOR=\"$theme->hlcolor1\"><B>$subject</B><BR>by $name on ". formatTimestamp($date) ."</FONT></TD></TR>";
+ }
+ echo " <TR BGCOLOR=\"$theme->bgcolor2\"><TD>$comment</TD></TR>";
+ echo "</TABLE>";
+
+ if (!isset($pid) || !isset($sid)) { exit(); }
+ if ($pid == 0) {
+ list($subject) = mysql_fetch_row(mysql_query("SELECT subject FROM stories WHERE sid = $sid"));
+ }
+ else {
+ list($subject) = mysql_fetch_row(mysql_query("SELECT subject FROM comments WHERE tid = $pid"));
+ }
+
+ ### Build reply form:
+ echo "<FORM ACTION=\"comments.php\" METHOD=\"post\">";
+
+ echo "<B>Your name:</B><BR> ";
+ if ($user) {
+ cookiedecode($user);
+ echo "<A HREF=\"account.php\">$cookie[1]</A> &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
+ }
+ else {
+ echo "$anonymous";
+ $postanon = 2;
+ }
+ echo "<BR><BR>";
+
+ echo "<B>Subject:</B><BR>";
+ if (!eregi("Re:",$subject)) $subject = "Re: $subject";
+ // Only one 'Re:' will just do fine. ;)
+ echo "<INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"60\" MAXLENGTH=\"60\" VALUE=\"$subject\">";
+ echo "<BR><BR>";
+
+ if ($user) {
+ $userinfo = getusrinfo($user);
+ echo "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">$userinfo[signature]</TEXTAREA><BR>";
+ echo "<INPUT TYPE=\"checkbox\" NAME=\"postanon\"> Post this comment anonymously.";
+ echo "<BR><BR>";
+ }
+ else {
+ echo "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\"></TEXTAREA>";
+ echo "<BR><BR>";
+ }
+
+ echo "<INPUT TYPE=\"hidden\" NAME=\"pid\" VALUE=\"$pid\">";
+ echo "<INPUT TYPE=\"hidden\" NAME=\"sid\" VALUE=\"$sid\"><INPUT TYPE=\"hidden\" NAME=\"mode\" VALUE=\"$mode\">";
+ echo "<INPUT TYPE=\"hidden\" NAME=\"order\" VALUE=\"$order\"><INPUT TYPE=\"hidden\" NAME=\"thold\" VALUE=\"$thold\">";
+ echo "<INPUT TYPE=submit NAME=op VALUE=\"Preview comment\"> <INPUT TYPE=submit NAME=op VALUE=\"Post comment\"> <SELECT NAME=\"posttype\"><OPTION VALUE=\"exttrans\">HTML to text<OPTION VALUE=\"html\">HTML-formatted<OPTION VALUE=\"plaintext\" SELECTED>Plain text</SELECT></FORM>";
+
+ echo "<FONT SIZE=\"2\">Allowed HTML-tags:<BR>";
+ for ($i=0; $i < sizeof($AllowableHTML); $i++) {
+ if (!eregi("/",$AllowableHTML[$i])) echo " &lt;$AllowableHTML[$i]&gt;";
+ }
+
+ $theme->footer();
+}
+
+function replyPreview ($pid, $sid, $subject, $comment, $postanon, $mode, $order, $thold, $posttype) {
+ include "functions.inc";
+ include "theme.inc" ;
+
+ global $user, $cookie, $bgcolor1, $bgcolor2;
+
+ cookiedecode($user);
+ $subject = stripslashes($subject);
+ $comment = stripslashes($comment);
+
+ $theme->header();
+
+ ### Display preview:
+ echo "<TABLE WIDTH=\"100%\" BORDER=\"0\">";
+ if ($user) {
+ echo " <TR BGCOLOR=\"$bgcolor1\"><TD><B>$subject</B><BR>by $cookie[1].</TD></TR>";
+ }
+ else {
+ echo " <TR BGCOLOR=\"$bgcolor1\"><TD><B>$subject</B><BR>by $anonymous.</TD></TR>";
+ }
+
+ if ($posttype == "exttrans") {
+ echo " <TR BGCOLOR=\"$bgcolor2\"><TD>". nl2br(htmlspecialchars($comment)) ."</TD></TR>";
+ }
+ elseif ($posttype == "plaintext") {
+ echo " <TR BGCOLOR=\"$bgcolor2\"><TD>". nl2br($comment) ."</TD></TR>";
+ }
+ else {
+ echo " <TR BGCOLOR=\"$bgcolor2\"><TD>$comment</TD></TR>";
+ }
+ echo "</TABLE>";
+
+ ### Build reply form:
+ echo "<FORM ACTION=\"comments.php\" METHOD=\"post\">";
+
+ echo "<B>Your name:</B><BR> ";
+ if ($user) {
+ cookiedecode($user);
+ echo "<A HREF=\"account.php\">$cookie[1]</A> &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
+ } else {
+ echo "$anonymous";
+ $postanon = 2;
+ }
+ echo "<BR><BR>";
+
+ echo "<B>Subject:</B><BR>";
+ if (!eregi("Re:",$subject)) $subject = "Re: $subject"; // one Re: will do ;)
+ echo "<INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"60\" MAXLENGTH=\"60\" VALUE=\"$subject\">";
+ echo "<BR><BR>";
+
+ $userinfo = getusrinfo($user);
+ echo "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">$comment</TEXTAREA>";
+ if ($user) {
+ if ($postanon) echo "<BR><INPUT TYPE=\"checkbox\" NAME=\"postanon\" CHECKED> Post this comment anonymously.";
+ else echo "<BR><INPUT TYPE=\"checkbox\" NAME=\"postanon\"> Post this comment anonymously.";
+ }
+ echo "<BR><BR>";
+
+ echo "<INPUT TYPE=\"hidden\" NAME=\"pid\" VALUE=\"$pid\">";
+ echo "<INPUT TYPE=\"hidden\" NAME=\"sid\" VALUE=\"$sid\"><INPUT TYPE=\"hidden\" NAME=\"mode\" VALUE=\"$mode\">";
+ echo "<INPUT TYPE=\"hidden\" NAME=\"order\" VALUE=\"$order\"><INPUT TYPE=\"hidden\" NAME=\"thold\" VALUE=\"$thold\">";
+ echo "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview comment\"> ";
+ echo "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Post comment\"> ";
+ echo "<SELECT NAME=\"posttype\">";
+ if ($posttype == "exttrans") echo " <OPTION VALUE=\"exttrans\" SELECTED>HTML to text";
+ else echo " <OPTION VALUE=\"exttrans\">HTML to text";
+ if ($posttype == "html") echo " <OPTION VALUE=\"html\" SELECTED>HTML-formatted";
+ else echo " <OPTION VALUE=\"html\">HTML-formatted";
+ if ($posttype == "plaintext") echo " <OPTION VALUE=\"plaintext\" SELECTED>Plain text";
+ else echo " <OPTION VALUE=\"plaintext\">Plain text";
+ echo "</SELECT>";
+ echo "</FORM>";
+
+ echo "<FONT SIZE=\"2\">Allowed HTML-tags:<BR>";
+ for ($i=0; $i < sizeof($AllowableHTML); $i++) {
+ if (!eregi("/",$AllowableHTML[$i])) echo " &lt;$AllowableHTML[$i]&gt;";
+ }
+
+ $theme->footer();
+}
+
+function postComment($postanon, $subject, $comment, $pid, $sid, $host_name, $mode, $order, $thold, $posttype) {
+ global $user, $userinfo, $cookie;
+ include "functions.inc";
+ include "config.inc";
+ dbconnect();
+
+ $subject = FixQuotes($subject);
+ $comment = FixQuotes($comment);
+ $author = FixQuotes($author);
+
+ if ($posttype == "exttrans") $comment = nl2br(htmlspecialchars($comment));
+ elseif($posttype == "plaintext") $comment = nl2br($comment);
+ else $comment = $comment;
+
+ if (($user) && (!$postanon)) {
+ getusrinfo($user);
+ $name = $userinfo[uname];
+ $email = $userinfo[femail];
+ $url = $userinfo[url];
+ $score = 1;
+ } else {
+ $name = "";
+ $email = "";
+ $url = "";
+ $score = 0;
+ }
+ $ip = getenv("REMOTE_ADDR");
+
+ ### Check for fake threads:
+ $fake = mysql_result(mysql_query("SELECT COUNT(*) FROM stories WHERE sid = $sid"), 0);
+
+ ### Check for duplicate comments:
+ $duplicate = mysql_result(mysql_query("SELECT COUNT(*) FROM comments WHERE pid = '$pid' AND sid = '$sid' AND subject = '$subject' AND comment = '$comment'"), 0);
+
+ if ($fake != 1) {
+ include "theme.inc";
+ $theme->header();
+ $theme->box("fake comment", "fake comment: $fake");
+ $theme->footer();
+ }
+ elseif ($duplicate != 0) {
+ include "theme.inc";
+ $theme->header();
+ $theme->box("duplicate comment", "duplicate comment: $duplicate");
+ $theme->footer();
+ }
+ else {
+ ### Add comment to table:
+ $reason = (int) sizeof($comments_meta_reasons) / 2;
+ mysql_query("INSERT INTO comments (tid, pid, sid, date, name, email, url, host_name, subject, comment, score, reason) VALUES (NULL, '$pid', '$sid', now(), '$name', '$email', '$url', '$ip', '$subject', '$comment', '$score', '$reason')");
+
+ ### Compose header:
+ if ($user) {
+ $header = "article.php?sid=$sid";
+ if (isset($cookie[4])) { $header .= "&mode=$cookie[4]"; } else { $header .= "&mode=threaded"; }
+ if (isset($cookie[5])) { $header .= "&order=$cookie[5]"; } else { $header .= "&order=0"; }
+ if (isset($cookie[6])) { $header .= "&thold=$cookie[6]"; } else { $header .= "&thold=1"; }
+ }
+ else {
+ $header .= "article.php?sid=$sid&mode=threaded&order=1&thold=0";
+ }
+ header("Location: $header");
+ }
+}
+
+function moderate($tid, $meta_value = 0) {
+ include "config.inc";
+ if ($meta_value != -1) {
+ ### Compose query:
+ $query = "UPDATE comments SET";
+ if ($meta_value > (sizeof($comments_meta_reasons) / 2)) {
+ $query .= " score = score + 1, reason = $meta_value WHERE tid = $tid";
+ }
+ elseif ($meta_value < ((sizeof($comments_meta_reasons) / 2) - 1)) {
+ $query .= " score = score - 1, reason = $meta_value WHERE tid = $tid";
+ }
+ else {
+ $query .= " reason = $meta_value WHERE tid = $tid";
+ }
+
+ ### Perform query:
+ mysql_query("$query");
+ }
+}
+
+switch($op) {
+ case "reply":
+ reply($pid, $sid, $mode, $order, $thold);
+ break;
+ case "Preview comment":
+ replyPreview($pid, $sid, $subject, $comment, $postanon, $mode, $order, $thold, $posttype);
+ break;
+ case "Post comment":
+ postComment($postanon, $subject, $comment, $pid, $sid, $host_name, $mode, $order, $thold, $posttype);
+ break;
+ case "Moderate":
+ include "functions.inc";
+ dbconnect();
+
+ while (list($name, $value) = each($HTTP_POST_VARS)) {
+ if (eregi("meta", $name)) {
+ ### extract comment id (tid):
+ $info = explode(":", $name);
+ moderate($info[1], $value);
+ }
+ }
+
+ Header("Location: article.php?sid=$sid&mode=$mode&order=$order&thold=$thold");
+ break;
+ case "showreply":
+ displayTopic($sid, $pid, $tid, $mode, $order, $thold);
+ break;
+ default:
+ displayTopic($sid, $pid, $tid, $mode, $order, $thold);
+}
+
+?> \ No newline at end of file
diff --git a/config.inc b/config.inc
new file mode 100644
index 0000000..f9cbaae
--- /dev/null
+++ b/config.inc
@@ -0,0 +1,71 @@
+<?PHP
+
+#
+# MySQL settings:
+#
+$dbhost = "zind.net";
+$dbuname = "dries";
+$dbpass = "Abc123";
+$dbname = "dries";
+
+#
+# Name of the site
+#
+$sitename = "drop.org";
+
+#
+# Contact information:
+# The contact information will be used to send out automated mails
+# to users, account holders or visitors.
+$contact_email = "droppies@zind.net";
+$contact_signature = "Kind regards,\n\n-- the drop.org crew\nhttp://www.drop.org/";
+
+#
+# Notify information:
+# The notify information will be used to send out automated mails
+# for internal purpose.
+#
+$notify_email = $contact_email;
+$notify_subject = "submission: ";
+$notify_message = "New submission: '$subject'\n\n$story";
+$notify_from = "droppies@zind.net";
+
+#
+# Comment meta reasons:
+# The comment meta reasons are the various meta reasons used to
+# moderate comments. The array should always be 'balanced': that
+# the number of good reasons should equal the number of bad reason
+# and those should be ordered from bad to good.
+#
+$comments_meta_reasons = array('Off topic', 'Redundant', 'Insightfull', 'As is', 'Interesting', 'Informative', 'Funny');
+
+#
+# Categories:
+#
+$categories = array('Announcements', 'Coding', 'Geeking', 'Drop.org', 'Gaming', 'Girls', 'Graphics', 'Hardware', 'Humor', 'Internet', 'Music', 'Movies', 'Politics', 'Science', 'Software', 'Space', 'Webdesign', 'Quickies');
+
+#
+# Notify:
+# Set to '1' to receive an e-mail when news has been submitted
+# through submit.php
+#
+$notify = 1;
+
+#
+# Allowed HTML tags:
+#
+$allowableHTML = array('B','/B','I','/I','P .*','P','/P','A .*','/A','LI','OL','/OL','UL','/UL','EM','/EM','BR','STRONG','/STRONG','BLOCKQUOTE','/BLOCKQUOTE','HR','DIV .*','DIV','/DIV','TT','/TT');
+
+#
+# Name of the 'anonymous' user account:
+#
+$anonymous = "Anonymous Chicken";
+
+#
+# Debug flag:
+# Set to '1' if you are using Windows so the engine won't try
+# to send out mails and such. When using Unix or Linux, set
+# to '0'
+$system = 0;
+
+?> \ No newline at end of file
diff --git a/drop.tar.gz b/drop.tar.gz
new file mode 100644
index 0000000..e05966d
--- /dev/null
+++ b/drop.tar.gz
Binary files differ
diff --git a/faq.php b/faq.php
new file mode 100644
index 0000000..7880582
--- /dev/null
+++ b/faq.php
@@ -0,0 +1,84 @@
+<?PHP
+
+function defaultDisplay() {
+ include "functions.inc";
+ include "theme.inc";
+ $theme->header();
+ ?>
+ <PRE>
+ <FONT FACE="courier">
+<H3>General</H3>
+
+* Mission statement:
+--------------------
+
+ - New generation of weblog systems: mixture of slashdot.org,
+ squishdot.org, kuro5hin.org, etc.
+ - History
+
+
+* Frequently asked questions:
+-----------------------------
+
+ 1. What is this site about, alas what is our 'mission statement'?
+ See above.
+
+
+ 2. What kind of news should I submit?
+ Anything you find interesting. Read the site for a bit.
+ If the stories that appear on this site interest you, and
+ you come across a story that also interests you, chances
+ are, it will interest us too.
+ In general we prefer stories that some meat to them. We
+ encourage submitters to extend their posts, and perhaps
+ to offer some insight or explanation as to why they
+ thought their item was interesting, and what it means to
+ us.
+ todo: automatically generate a list of the available
+ news categories.
+
+ 3. How to create an account?
+ - todo: explanation to write.
+
+ 4. What can I do with an account?
+ - todo: check completed features (see below) as for now.
+
+ 5. What is comment moderation and how does it work?
+ After a weblog gains some popularity, an inevitable question
+ shows up: "how do we sort the wheat from the chaff?".
+ The purpose of comment moderation is two-fold:
+ * To bring the really good comments to everyone's attention.
+ * To hide or get get rid of spam, flamebait and trolls.
+ In the latter, comment moderation provides a technical solution
+ to a social problem.
+
+ 6. What is story moderation and how does it work?
+ Under construction.
+
+ 7. Is the source code of this weblog engine available?
+ This site is powered by <A HREF="http://www.fsf.org/">Free Software</A>; including <A HREF="http://www.apache.org/">Apache</A>,
+ <A HREF="http://www.php.net/">PHP</A>, <A HREF="http://www.mysql.com/">MySQL</A> and <A HREF="http://www.linux.com/">Linux</A>. Therefor we have decided to make
+ the software engine of this site available under terms of
+ GPL.
+
+
+* Disclaimer:
+-------------
+
+ - todo: general disclaimer
+ - Short version: comments are owned by the poster and this site is
+ not responsible for what tey say.
+
+ </FONT>
+ </PRE>
+ <?php
+ $theme->footer();
+}
+
+switch($op) {
+ default:
+ defaultDisplay();
+ break;
+}
+
+?> \ No newline at end of file
diff --git a/functions.inc b/functions.inc
new file mode 100644
index 0000000..7b65c24
--- /dev/null
+++ b/functions.inc
@@ -0,0 +1,235 @@
+<?
+
+include "config.inc";
+$functions = 1;
+
+function dbconnect() {
+ include "config.inc";
+ mysql_pconnect($dbhost, $dbuname, $dbpass);
+ @mysql_select_db("$dbname") or die ("Unable to select database");
+}
+
+function counter() {
+ dbconnect();
+ mysql_query("UPDATE vars SET value=value+1 where name='totalhits'");
+}
+
+function cookiedecode($user) {
+ global $cookie;
+ $user = base64_decode($user);
+ $cookie = explode(":", $user);
+ return $cookie;
+}
+
+function getusrinfo($user) {
+ global $userinfo;
+ $user2 = base64_decode($user);
+ dbconnect();
+ $user3 = explode(":", $user2);
+ $result = mysql_query("SELECT uid, name, uname, email, femail, url, pass, storynum, umode, uorder, thold, noscore, bio, ublockon, ublock, theme, signature FROM users WHERE uname = '$user3[1]' AND pass = '$user3[2]'");
+ if(mysql_num_rows($result)==1) {
+ $userinfo = mysql_fetch_array($result);
+ } else {
+ echo "<b>A problem occured</b><br>";
+ }
+ return $userinfo;
+}
+
+function FixQuotes ($what = "") {
+ $what = ereg_replace("'","''",$what);
+ while (eregi("\\\\'", $what)) {
+ $what = ereg_replace("\\\\'","'",$what);
+ }
+ return $what;
+}
+
+function check_html($message) {
+ ## TODO
+ return $message;
+}
+
+function filter_text($message, $strip="") {
+ ### TODO
+ return check_html($text, $strip);
+}
+
+function formatTimestamp($time) {
+ ### Should be removed as soon as possible!
+ global $datetime;
+ ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
+ $datetime = date("l, F d, Y - h:i A", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
+ return($datetime);
+}
+
+function addRefer($url) {
+ dbconnect();
+
+ $query = "SELECT * FROM refer WHERE url = '$url'";
+ $result = mysql_query($query);
+
+ if ($site = mysql_fetch_object($result)) {
+ if ($site->status) {
+ $site->refers++;
+ $query = "UPDATE refer SET refers = '$site->refers', access_dt = '". time() ."' WHERE url = '$url'";
+ $result = mysql_query($query);
+ }
+ }
+ else {
+ $query = "INSERT INTO refer (url, name, refers, create_dt, access_dt) VALUES ('$url', '', '1', '". time() ."', '". time() ."')";
+ $result = mysql_query($query);
+ }
+}
+
+function displayRelatedLinks($theme, $sid = 0) {
+ dbconnect();
+
+ $result = mysql_query("SELECT * FROM stories WHERE sid = $sid");
+
+ if ($story = mysql_fetch_object($result)) {
+ ### parse story for A HREF-tags:
+ $text = "$story->abstract $story->comments $story->article";
+ while ($text = stristr($text, "<A HREF=")) {
+ $link = substr($text, 0, strpos($text, "</a>") + 4);
+ $text = stristr($text, "</A>");
+ if (!stristr($link, "mailto:")) $content .= "<LI>$link</LI>";
+ }
+
+ ### default related links:
+ $content .= " <LI>More about <A HREF=\"search.php?category=$story->category\">$story->category</A>.</LI>";
+ $content .= " <LI>Also by <A HREF=\"search.php?author=$story->aid\">$story->aid</A>.</LI>";
+
+ $theme->box("Related links", $content);
+ }
+}
+
+function displayOldHeadlines($theme) {
+ global $user, $cookie;
+
+ if ($cookie[3]) $result = mysql_query("SELECT sid, subject, time FROM stories ORDER BY time DESC LIMIT $cookie[3], 10");
+ else $result = mysql_query("SELECT sid, subject, time FROM stories ORDER BY time DESC LIMIT 10, 10");
+
+ while ($story = mysql_fetch_object($result)) {
+
+ if ($time != date("F jS", $story->time)) {
+ $content .= "<P><B>". date("l, F jS", $story->time) ."</B></P>";
+ $time = date("F jS", $story->time);
+ }
+
+ if ($user) {
+ $content .= "<LI><A HREF=\"article.php?sid=$story->sid";
+ if (isset($cookie[4])) { $content .= "&mode=$cookie[4]"; } else { $content .= "&mode=threaded"; }
+ if (isset($cookie[5])) { $content .= "&order=$cookie[5]"; } else { $content .= "&order=0"; }
+ if (isset($cookie[6])) { $content .= "&thold=$cookie[6]"; } else { $content .= "&thold=0"; }
+ $content .= "\">$story->subject</A></LI>";
+ }
+ else {
+ $content .= "<LI><A HREF=\"article.php?sid=$story->sid&mode=threaded&order=1&thold=0\">$story->subject</A></LI>";
+ }
+ }
+ $content .= "<P ALIGN=\"right\">[ <A HREF=\"search.php\"><FONT COLOR=\"$theme->hlcolor2\">more</FONT></A> ]</P>";
+
+ $theme->box("Older headlines", $content);
+}
+
+function displayNewHeadlines($theme, $num = 10) {
+ global $user, $cookie;
+
+ dbconnect();
+
+ $content = "";
+ $result = mysql_query("SELECT sid, subject FROM stories ORDER BY time DESC LIMIT $num");
+ while(list($sid, $subject) = mysql_fetch_row($result)) {
+ if ($user) {
+ $content .= "<LI><A HREF=\"article.php?sid=$sid";
+ if (isset($cookie[4])) { $content .= "&mode=$cookie[4]"; } else { $content .= "&mode=threaded"; }
+ if (isset($cookie[5])) { $content .= "&order=$cookie[5]"; } else { $content .= "&order=0"; }
+ if (isset($cookie[6])) { $content .= "&thold=$cookie[6]"; } else { $content .= "&thold=0"; }
+ $content .= "\">$subject</A></LI>";
+ }
+ else {
+ $content .= "<LI><A HREF=\"article.php?sid=$sid&mode=threaded&order=1&thold=0\">$subject</A></LI>";
+ }
+ }
+ $content .= "<P ALIGN=\"right\">[ <A HREF=\"search.php\"><FONT COLOR=\"$theme->hlcolor2\">more</FONT></A> ]</P>";
+ $theme->box("Latest headlines", $content);
+}
+
+function displayAdminblock($theme) {
+ $result = mysql_query("SELECT title, content FROM blocks");
+ while (list($title, $content) = mysql_fetch_array($result)) {
+ $theme->box($title, nl2br($content));
+ }
+}
+
+function displayUserblock($theme) {
+ global $cookie;
+ dbconnect();
+ if ($cookie[8]) {
+ $block = mysql_query("SELECT ublock FROM users WHERE uid = '$cookie[0]'");
+ list($content) = mysql_fetch_row($block);
+ $content .= "<P ALIGN=\"right\">[ <A HREF=\"account.php?op=edithome\"><FONT COLOR=\"$theme->hlcolor2\">edit</FONT></A> | <A HREF=\"account.php?op=logout\"><FONT COLOR=\"$theme->hlcolor2\">logout</FONT></A> ]</P>";
+ $theme->box("$cookie[1]'s box", $content);
+ }
+}
+
+function displayAccount($theme) {
+ global $user, $cookie;
+
+ if ($user) {
+ ### Display userblock if any:
+ displayUserblock();
+ }
+ else {
+ $content = "<CENTER><FORM METHOD=\"post\" ACTION=\"account.php\">\n <P>Username:<BR><INPUT TYPE=\"text\" NAME=\"uname\" MAXLENGTH=\"50\" SIZE=\"12\"></P>\n<P>Password:<BR> <INPUT TYPE=\"password\" NAME=\"pass\" MAXLENGTH=\"25\" SIZE=\"12\"></P>\n<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Login\">\n</FORM>\n<P><A HREF=\"account.php\">Register</A> as new user.<BR><A HREF=\"account.php\">Forgot</A> your password?</P></CENTER>";
+ $theme->box("Login", $content);
+ }
+}
+
+
+function displayAccountSettings($theme) {
+ global $user;
+
+ if ($user) {
+ ### Display account settings:
+ $content .= "<LI><A HREF=\"account.php\">User info</A></LI>";
+ $content .= "<LI><A HREF=\"account.php?op=edituser\">Edit user info</A></LI>";
+ $content .= "<LI><A HREF=\"account.php?op=edithome\">Customize homepage</A></LI>";
+ $content .= "<LI><A HREF=\"account.php?op=editcomm\">Customize comments</A></LI>";
+ $content .= "<LI><A HREF=\"account.php?op=logout\">Logout</A></LI>";
+
+ ### Decode user cookie to extract name:
+ $cookie = cookiedecode($user);
+
+ $theme->box("$cookie[1]'s acount", "$content");
+ }
+}
+
+function displayReferrals($theme, $number = 10) {
+ $count = 1;
+
+ dbconnect();
+ if ($number) {
+ $query = "SELECT * FROM refer ORDER BY refers DESC LIMIT $number";
+ $result = mysql_query($query);
+ }
+ else {
+ $query = "SELECT * FROM refer ORDER BY refers DESC";
+ $result = mysql_query($query);
+ }
+
+ while (($site = mysql_fetch_object($result)) && ($count <= $number)) {
+ if ($site->name) $rval .= "$count. <A HREF=\"$site->url\">$site->name</A> ($site->refers)<BR>";
+ else $rval .= "$count. <A HREF=\"$site->url\">$site->url</A> ($site->refers)<BR>";
+ $count++;
+ }
+
+ $theme->box("Referring sites", "$rval <P ALIGN=\"right\">[ <A HREF=\"refer.php#refer-info\"><FONT COLOR=\"$theme->hlcolor2\">info</FONT></A> | <A HREF=\"refer.php#refer-more\"><FONT COLOR=\"$theme->hlcolor2\">more</FONT></A> ]</P>");
+}
+
+function displayPoll($theme) {
+ global $answer, $answer1, $answer2, $answer3, $answer4, $answer5, $answer6, $id, $method, $section, $poll, $question;
+ // Pass the URI and FORM parameters along to poll.php.
+ $box = 1;
+ include "poll.php";
+}
+?> \ No newline at end of file
diff --git a/mysql.tables b/mysql.tables
new file mode 100644
index 0000000..a001247
--- /dev/null
+++ b/mysql.tables
@@ -0,0 +1,396 @@
+# MySQL dump 7.1
+#
+# Host: zind.net Database: dries
+#--------------------------------------------------------
+# Server version 3.22.32
+
+#
+# Table structure for table 'authors'
+#
+CREATE TABLE authors (
+ aid varchar(30) DEFAULT '' NOT NULL,
+ name varchar(50),
+ url varchar(60),
+ email varchar(60),
+ pwd varchar(12),
+ PRIMARY KEY (aid)
+);
+
+#
+# Dumping data for table 'authors'
+#
+
+INSERT INTO authors VALUES ('Dries','Dries','http://www.buytaert.net/','dries@drop.org','iamgod');
+INSERT INTO authors VALUES ('Natrak','Natrak','','natrak@drop.org','db=god');
+INSERT INTO authors VALUES ('Jeroen','Jeroen','http://www.drop.org','jeroen@drop.org','W1ne gums!');
+INSERT INTO authors VALUES ('UnConeD','UnConeD','','unconed@drop.org','db=god');
+
+#
+# Table structure for table 'blocks'
+#
+CREATE TABLE blocks (
+ id tinyint(4) DEFAULT '0' NOT NULL auto_increment,
+ author varchar(30),
+ title varchar(60),
+ content text,
+ PRIMARY KEY (id)
+);
+
+#
+# Dumping data for table 'blocks'
+#
+
+INSERT INTO blocks VALUES (1,'','Development','<P>These links point to pages or sections that are not properly integrated yet. They are here for development or debuging purpose.</P>\r\n<LI><A HREF=\"queue.php\">submission queue</A></LI>\r\n');
+
+#
+# Table structure for table 'channel'
+#
+CREATE TABLE channel (
+ id int(11) DEFAULT '0' NOT NULL auto_increment,
+ site varchar(255) DEFAULT '' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ rdf varchar(255) DEFAULT '' NOT NULL,
+ timestamp int(11),
+ UNIQUE site (site),
+ UNIQUE url (url),
+ UNIQUE rdf (rdf),
+ PRIMARY KEY (id)
+);
+
+#
+# Dumping data for table 'channel'
+#
+
+INSERT INTO channel VALUES (1,'Slashdot','http://www.slashdot.org/','http://www.slashdot.org/slashdot.rdf',958655281);
+INSERT INTO channel VALUES (2,'Kuro5hin','http://www.kuro5hin.org/','http://www.kuro5hin.org/backend.rdf',958655282);
+INSERT INTO channel VALUES (3,'Mozilla','http://www.mozilla.org/','http://www.mozilla.org/news.rdf',958655283);
+INSERT INTO channel VALUES (4,'Geeknews','http://www.geeknews.net/','http://www.geeknews.net/geeknews.rdf',958655332);
+INSERT INTO channel VALUES (5,'FreakTech','http://sunsite.auc.dk/FreakTech/','http://sunsite.auc.dk/FreakTech/FreakTech.rdf',958655343);
+INSERT INTO channel VALUES (6,'Freshmeat','http://www.freshmeat.net/','http://www.freshmeat.net/backend/fm.rdf',958655343);
+INSERT INTO channel VALUES (7,'Slashcode','http://www.slashcode.com/','http://www.slashcode.com/slashcode.rdf',958655344);
+INSERT INTO channel VALUES (8,'Linux Today','http://linuxtoday.com/','http://linuxtoday.com/backend/my-netscape.rdf',958655345);
+INSERT INTO channel VALUES (9,'BetaZine','http://www.betazine.com/','http://www.betazine.com/xml/betazine.txt',958655345);
+INSERT INTO channel VALUES (10,'Dr. Dobb TechNetCast','http://www.technetcast.com/','http://www.technetcast.com/tnc_headlines.rdf',958655346);
+
+#
+# Table structure for table 'comments'
+#
+CREATE TABLE comments (
+ tid int(11) DEFAULT '0' NOT NULL auto_increment,
+ pid int(11) DEFAULT '0',
+ sid int(11) DEFAULT '0',
+ date datetime,
+ name varchar(60) DEFAULT '' NOT NULL,
+ email varchar(60),
+ url varchar(60),
+ host_name varchar(60),
+ subject varchar(60) DEFAULT '' NOT NULL,
+ comment text NOT NULL,
+ score tinyint(4) DEFAULT '0' NOT NULL,
+ reason tinyint(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (tid)
+);
+
+#
+# Dumping data for table 'comments'
+#
+
+INSERT INTO comments VALUES (1,0,9,'2000-05-03 20:47:54','','','','127.0.0.1','Re: my subject','my reply',0,2);
+INSERT INTO comments VALUES (2,0,9,'2000-05-04 14:04:55','Dries','grmbl_at_buytaert.net','http://www.buytaert.net/','212.100.176.145','Re: my subject','a test post\r<br>\n\r<br>\nhi mom!',2,4);
+INSERT INTO comments VALUES (3,0,2,'2000-05-04 15:17:59','Dries','grmbl_at_buytaert.net','http://www.buytaert.net/','212.100.176.145','Test comment','Let this be a test comment\r<br>\n--\r<br>\nHi dad!',2,4);
+INSERT INTO comments VALUES (4,0,3,'2000-05-04 20:30:23','Dries','grmbl_at_buytaert.net','http://www.buytaert.net/','212.100.176.145','Re: Science: Controlling Your Computer with Your Brain','First I was a bit confused about the 2 slashed in the \'/not/\' but it looks like that was on purpose, right?\r<br>\n\r<br>\n-- Dries',2,5);
+INSERT INTO comments VALUES (5,4,3,'2000-05-05 12:37:58','Jeroen','jeroen@drop.org','http://www.drop.org','212.100.176.145','Re: Science: Controlling Your Computer with Your Brain','I don\'t know Dries, I just copied it from Slashdot, don\'t ask me what it \r<br>\nmeans, those slashes.\r<br>\n\r<br>\nJeroen.',2,5);
+INSERT INTO comments VALUES (6,0,5,'2000-05-06 01:44:22','Dries','grmbl_at_buytaert.net','http://www.buytaert.net/','195.95.26.59','Re: Getting involved in the PHP','As you can see there is a problem with quotes. In addition I forgot to close a TAG which fuxered up the rest of the page: a good reason to have the check-for-allowed-HTML-tags functions and the like.\r<br>\n\r<br>\nNight,\r<br>\n\r<br>\n-- Dries',1,3);
+INSERT INTO comments VALUES (7,0,8,'2000-05-07 12:12:36','Dries','grmbl_at_buytaert_dot_net','http://www.buytaert.net/','195.95.26.206','Re: Oops. Forgot the URL','Oops. Looks like I forgot the URL to the MP3 player page. I tried to edit my story that didn\'t work: looks like we found yet another bug. I\'ll look into that later today.\r\n\r\nAnyway, the URL is: <A HREF=\"http://www.thinkgeek.com/brain/bazaar/mart/cart.cgi?action=view&type=item&itemid=325e\">http://www.thinkgeek.com/brain/bazaar/mart/cart.cgi?action=view&type=item&itemid=325e</A>.\r\n\r\n-- Dries',1,3);
+INSERT INTO comments VALUES (8,0,8,'2000-05-07 12:19:21','Dries','grmbl_at_buytaert_dot_net','http://www.buytaert.net/','195.95.26.206','Re: Geez - alignment problem','Geez. The alignment of this page looks f*cked up as well. Gotta fix that too I\'m afraid. I sorta lost track about all \'open\' bugs.\r<br>\n\r<br>\n-- Dries',1,3);
+INSERT INTO comments VALUES (9,8,8,'2000-05-08 08:39:20','Dries','grmbl_at_buytaert_dot_net','http://www.buytaert.net/','212.100.176.145','Re: Geez - alignment problem','Odd. When using Netscape(Linux) the alignment looks perfectly normal. I won\'t be able to fix it untill next weekend. Maybe one of the Microsofties could look into it? :-)\r<br>\n\r<br>\n-- Dries',1,3);
+INSERT INTO comments VALUES (10,0,7,'2000-05-08 15:14:17','Jeroen','jeroen@drop.org','http://www.drop.org','212.100.176.145','Re: NASA snake-bots','Why do you always say ./ instead of /.?\r<br>\nIs it because you want to revolt? Or because you\r<br>\nthink it types easier?\r<br>\n\r<br>\n. . .Jeroen',1,3);
+INSERT INTO comments VALUES (11,10,7,'2000-05-08 15:28:00','Jeroen','jeroen@drop.org','http://www.drop.org','212.100.176.145','Re: NASA snake-bots','Ahh man we really got to do something about this HTML \r<br>\nin our signatures. Are we gonna allow it or not, I had some\r<br>\ntrouble with it though. You see, i want, and don\'t ask me why,\r<br>\na signature that looks like this:\r<br>\n.<space><space>.<space>..<space>Jeroen\r<br>\nbut however, it seems that when you edit you signature in the\r<br>\n\"user account\"-section and save it, your signature allready\r<br>\ngets HTML-parsed. *still with me?* OK, now when you post\r<br>\na message it displays your signature correctly without the\r<br>\nHTML tags. Now when you post your message its parses it\r<br>\nand doesn\'t see no \'s between the dots so it displays\r<br>\nthe signature as if there were no HTML in it.\r<br>\nAnd that is not what I had in mind... :/\r<br>\n\r<br>\n.&nbsp;&nbsp;.&nbsp;..&nbsp;Jeroen (now I specifically typed the HTML in my signature and didn\'t take the preview)',1,3);
+INSERT INTO comments VALUES (12,2,9,'2000-05-08 18:04:23','','','','212.100.176.145','Re: my subject','UHM - how could the previous message show up? I did not reply to it nor does the date make sense.\r<br>\n\r<br>\n-- Dries',0,3);
+INSERT INTO comments VALUES (13,0,10,'2000-05-10 10:24:41','natrak','natrak@zind-dot-net','http://natrak.net/','212.242.56.160','Re: Updates','Updates\r<br>\nby Dries on Tuesday, November 30, 1999 - 12:00 AM\r<br>\n\r<br>\nIsnt that the wrong date? Whats going on?:)\r<br>\nThe system time on zind is set to CET in case you wonder...\r<br>\n\r<br>\nAnd on the subject of bumber stickers get the 3rd one :PpP\r<br>\nCare are just that *smile*\r<br>\n\r<br>\nN.',1,3);
+INSERT INTO comments VALUES (14,13,10,'2000-05-10 12:14:12','Dries','grmbl_at_buytaert_dot_net','http://www.buytaert.net/','212.100.176.145','Re: Updates','Umh, where (url?) do you see the wrong date? I can\'t find it here ...\r<br>\n\r<br>\nNo comment on your comment on the bumper stickers. :P\r<br>\n\r<br>\n-- Dries',1,3);
+INSERT INTO comments VALUES (15,0,11,'2000-05-10 13:12:44','','','','213.224.83.6','Re: New Lara Croft model unveiled','One word.... <B>HUBBA HUBBA HUBBA</B>!\r<br>\n\r<br>\nOh wait, that\'s three :P\r<br>\n\r<br>\nWho needs Jeri Ryan (Seven of Nine) when you can have Lucy Clarkson? Drop the borg implants, gimme those combat boots!\r<br>\n',1,6);
+INSERT INTO comments VALUES (16,15,11,'2000-05-10 16:16:05','Dries','grmbl_at_buytaert_dot_net','http://www.buytaert.net/','212.100.176.145','Re: New Lara Croft model unveiled','Just wondering: could this Anonymous Chicken stand up, raise his finger and tell us his name? :-)\r<br>\n\r<br>\n-- Dries',1,3);
+INSERT INTO comments VALUES (17,0,11,'2000-05-14 12:32:26','Dries','grmbl_at_buytaert_dot_net','http://www.buytaert.net/','212.100.176.145','UnConeD','Your \"editors note\" thingy isn\'t themed very well. Apart from that, your theme looks very, very nice. :-)\r<br>\n\r<br>\n-- Dries',1,3);
+
+#
+# Table structure for table 'headlines'
+#
+CREATE TABLE headlines (
+ id int(11) DEFAULT '0' NOT NULL,
+ title varchar(255) DEFAULT '' NOT NULL,
+ link varchar(255) DEFAULT '' NOT NULL,
+ number int(3) DEFAULT '0' NOT NULL,
+ UNIQUE title (title),
+ UNIQUE link (link)
+);
+
+#
+# Dumping data for table 'headlines'
+#
+
+INSERT INTO headlines VALUES (2,'WWW9 Conference - Amsterdam','http://www.kuro5hin.org/?op=displaystory;sid=2000/5/16/12753/2799',5);
+INSERT INTO headlines VALUES (2,'Lost in the shuffle: Microsoft\'s proposed remedies','http://www.kuro5hin.org/?op=displaystory;sid=2000/5/15/12406/2367',7);
+INSERT INTO headlines VALUES (2,'Sniff Your PC','http://www.kuro5hin.org/?op=displaystory;sid=2000/5/16/01250/2618',6);
+INSERT INTO headlines VALUES (2,'The US Gov\'t and Unix','http://www.kuro5hin.org/?op=displaystory;sid=2000/5/17/53433/1439',4);
+INSERT INTO headlines VALUES (3,'Scalable Vector Graphics','http://www.mozilla.org/projects/svg/',2);
+INSERT INTO headlines VALUES (4,'Pizza! Pizza! - Linux Style\n','http://geeknews.net/index.shtml#954012496\n',13);
+INSERT INTO headlines VALUES (3,'XPInstall Newsgroup','http://www.mozilla.org/news.html',15);
+INSERT INTO headlines VALUES (3,'mozilla.party.jp','http://www.gimlay.org/~andoh/mozilla/flyer.html',11);
+INSERT INTO headlines VALUES (3,'Mozilla World Tour','http://ftp.mozilla.org/pub/mozilla/l10n/lang/m14/',9);
+INSERT INTO headlines VALUES (3,'Milestone 15 Released','http://www.mozilla.org/projects/seamonkey/release-notes/',4);
+INSERT INTO headlines VALUES (3,'Mozilla Does SSL','http://docs.iplanet.com/docs/manuals/psm/psm-mozilla/index.html',12);
+INSERT INTO headlines VALUES (3,'Beta Plans','http://www.mozilla.org/beta.html',10);
+INSERT INTO headlines VALUES (3,'Mozilla Developer Meeting','http://www.alphanumerica.com/events/mozilla-conference-1.0/',8);
+INSERT INTO headlines VALUES (3,'mozilla.party, 3.0','http://www.mozilla.org/party/2000/flyer.html',13);
+INSERT INTO headlines VALUES (3,'Help Wanted','http://www.mozilla.org/help-wanted.html',5);
+INSERT INTO headlines VALUES (4,'PowerPC Television Set-Top Boxes from IBM \n','http://geeknews.net/index.shtml#954013035\n',12);
+INSERT INTO headlines VALUES (4,'KURT - a Real-Time modification to Linux\n','http://geeknews.net/index.shtml#954013187\n',11);
+INSERT INTO headlines VALUES (4,'Hacking the CCM-202 Hybrid Cable Modem\n','http://geeknews.net/index.shtml#954024844\n',7);
+INSERT INTO headlines VALUES (4,'AMD News &amp; Info for the Masses\n','http://geeknews.net/index.shtml#954014581\n',9);
+INSERT INTO headlines VALUES (4,'EPoX EP-7KXA Review\n','http://geeknews.net/index.shtml#954015133\n',8);
+INSERT INTO headlines VALUES (4,'MS offers terms for DoJ settlement\n','http://geeknews.net/index.shtml#954013627\n',10);
+INSERT INTO headlines VALUES (4,'Cool Cases?\n','http://geeknews.net/index.shtml#954040599\n',6);
+INSERT INTO headlines VALUES (4,'Rack that iMac \n','http://geeknews.net/index.shtml#954057516\n',5);
+INSERT INTO headlines VALUES (5,'140 gigabytes CDROM','http://sunsite.auc.dk/FreakTech/',1);
+INSERT INTO headlines VALUES (6,'quick finder','http://core.freshmeat.net/search.php3',11);
+INSERT INTO headlines VALUES (6,'Bahamut 1.4.3-RELEASE','http://freshmeat.net/news/2000/05/18/958623620.html',10);
+INSERT INTO headlines VALUES (6,'TkDNS 0.2','http://freshmeat.net/news/2000/05/18/958632369.html',9);
+INSERT INTO headlines VALUES (6,'mod_perl 1.24','http://freshmeat.net/news/2000/05/18/958632380.html',8);
+INSERT INTO headlines VALUES (6,'xsu 0.1','http://freshmeat.net/news/2000/05/18/958632460.html',7);
+INSERT INTO headlines VALUES (6,'Sportal 1.3','http://freshmeat.net/news/2000/05/18/958640264.html',4);
+INSERT INTO headlines VALUES (6,'Pan 0.8.0','http://freshmeat.net/news/2000/05/18/958632486.html',6);
+INSERT INTO headlines VALUES (6,'Arping 0.4','http://freshmeat.net/news/2000/05/18/958640941.html',2);
+INSERT INTO headlines VALUES (7,'New Slashcode site for I18N/L10N/G11N','http://slashcode.com/article.pl?sid=00/05/01/1656221',8);
+INSERT INTO headlines VALUES (7,'New Slashdot Servers','http://slashcode.com/article.pl?sid=00/04/28/1336253',10);
+INSERT INTO headlines VALUES (7,'Missing \"From the Dept\"','http://slashcode.com/article.pl?sid=00/05/01/1659239',7);
+INSERT INTO headlines VALUES (8,'Search','http://linuxtoday.com/search.php3',6);
+INSERT INTO headlines VALUES (7,'Support for RSS 0.91','http://slashcode.com/article.pl?sid=00/05/01/1733225',4);
+INSERT INTO headlines VALUES (7,'portald: Through a Firewall','http://slashcode.com/article.pl?sid=00/05/01/1723207',6);
+INSERT INTO headlines VALUES (7,'Move to SourceForge','http://slashcode.com/article.pl?sid=00/04/28/1345220',9);
+INSERT INTO headlines VALUES (1,'E3: Linux Still Waiting In The Wings','http://slashdot.org/article.pl?sid=00/05/17/189220',9);
+INSERT INTO headlines VALUES (1,'Government Gives Microsoft Offer Thumbs Down','http://slashdot.org/article.pl?sid=00/05/18/0222239',6);
+INSERT INTO headlines VALUES (1,'H.R. 3113: Spam Bounty Hunters Wanted','http://slashdot.org/article.pl?sid=00/05/17/2136258',7);
+INSERT INTO headlines VALUES (1,'Dialectizer Shut Down','http://slashdot.org/article.pl?sid=00/05/17/1240227',10);
+INSERT INTO headlines VALUES (1,'OpenBSD, Reductionist Design','http://slashdot.org/article.pl?sid=00/05/17/2117221',3);
+INSERT INTO headlines VALUES (1,'Online Book About Nano/AI','http://slashdot.org/article.pl?sid=00/05/17/200231',5);
+INSERT INTO headlines VALUES (1,'Main Linux distibutions port their Linux to IBM\'s S/390','http://slashdot.org/article.pl?sid=00/05/18/1218234',2);
+INSERT INTO headlines VALUES (2,'U.S. House caves in to email hoax','http://www.kuro5hin.org/?op=displaystory;sid=2000/5/17/162615/239',1);
+INSERT INTO headlines VALUES (3,'Mozilla Turns 2','http://www.mozillazine.org/screenshots/alookback.html',7);
+INSERT INTO headlines VALUES (3,'O\'Reilly OSS Convention','http://conferences.oreilly.com/oscon2000/sessions/mozilla.html',1);
+INSERT INTO headlines VALUES (4,'Phezcount 1.7h \n','http://geeknews.net/index.shtml#954123999\n',2);
+INSERT INTO headlines VALUES (4,'Old BetaNews?\n','http://geeknews.net/index.shtml#954057866\n',4);
+INSERT INTO headlines VALUES (4,'Pyra looking to Hire\'a Few Good Geeks\n','http://geeknews.net/index.shtml#954061597\n',3);
+INSERT INTO headlines VALUES (8,'Canada Computes: Get to the root of Linux&#38;#37;s file system','http://linuxtoday.com/news_story.php3?ltsn=2000-05-18-005-20-PS-HL',3);
+INSERT INTO headlines VALUES (8,'32BitsOnline: Rebel With a Clue: The Rebel.com OfficeServer (Netwinder) revisited.','http://linuxtoday.com/news_story.php3?ltsn=2000-05-18-007-20-PS-HW-SV',1);
+INSERT INTO headlines VALUES (8,'Advogato: Open Source and Business: where do you draw the line?','http://linuxtoday.com/news_story.php3?ltsn=2000-05-18-003-20-OP-BZ-CY',5);
+INSERT INTO headlines VALUES (9,'Wow! The new screenshots look great. The style suits polygons better than any ga','http://www.betazine.com/bz-news-reel.php3?inid=1281',7);
+INSERT INTO headlines VALUES (9,'Neuron Entertainment, Inc. Starts Building Filbert Fledgling(TM)','http://www.betazine.com/bz-news-reel.php3?inid=1284',4);
+INSERT INTO headlines VALUES (9,'Crossroads in open beta','http://www.betazine.com/bz-news-reel.php3?inid=1285',3);
+INSERT INTO headlines VALUES (9,'Spheres 2000 - one from the little guy - seeking some testers','http://www.betazine.com/bz-news-reel.php3?inid=1280',8);
+INSERT INTO headlines VALUES (9,'Microsoft today announced that the official Web site for Dungeon Siege','http://www.betazine.com/bz-news-reel.php3?inid=1282',6);
+INSERT INTO headlines VALUES (9,'The World Called Hollow - now in open beta','http://www.betazine.com/bz-news-reel.php3?inid=1283',5);
+INSERT INTO headlines VALUES (6,'the Anomy mail sanitizer 1.10','http://freshmeat.net/news/2000/05/18/958632554.html',5);
+INSERT INTO headlines VALUES (6,'buffer 0.81','http://freshmeat.net/news/2000/05/18/958641773.html',1);
+INSERT INTO headlines VALUES (10,'God and Computers: Donald Knuth','http://www.technetcast.com/tnc_program.html?program_id=50',7);
+INSERT INTO headlines VALUES (10,'XML Standards Update','http://www.technetcast.com/tnc_program.html?program_id=70',5);
+INSERT INTO headlines VALUES (10,'Tim O\'Reilly on Open Source and InfoWare','http://www.technetcast.com/tnc_program.html?program_id=48',8);
+INSERT INTO headlines VALUES (10,'Perl Creator Larry Wall','http://www.technetcast.com/tnc_program.html?program_id=52',6);
+INSERT INTO headlines VALUES (10,'Linus Torvalds At LinuxWorld','http://www.technetcast.com/tnc_program.html?program_id=72',4);
+INSERT INTO headlines VALUES (7,'Undefined subroutine Error','http://slashcode.com/article.pl?sid=00/05/01/1727253',5);
+INSERT INTO headlines VALUES (7,'Rewriting Slash from Scratch','http://slashcode.com/article.pl?sid=00/05/01/1735211',3);
+INSERT INTO headlines VALUES (7,'Possible Bug in imagesize.pm','http://slashcode.com/article.pl?sid=00/05/01/1749224',2);
+INSERT INTO headlines VALUES (1,'Court Rules For Connectix, Against Sony','http://slashdot.org/article.pl?sid=00/05/17/216207',8);
+INSERT INTO headlines VALUES (1,'Alpha Release Of Red Hat\'s Itanium Distro','http://slashdot.org/article.pl?sid=00/05/18/0325253',4);
+INSERT INTO headlines VALUES (1,'Boo No More','http://slashdot.org/article.pl?sid=00/05/18/1132240',1);
+INSERT INTO headlines VALUES (3,'MathML Status Update','http://www.mozilla.org/projects/mathml/update.html',3);
+INSERT INTO headlines VALUES (8,'Canada Computes: Open source made easy [Book Review]','http://linuxtoday.com/news_story.php3?ltsn=2000-05-18-006-20-PS-BR-RH',2);
+INSERT INTO headlines VALUES (8,'Ottawa Citizen: Corel faces revenue crunch waiting for Linux sales: experts','http://linuxtoday.com/news_story.php3?ltsn=2000-05-18-004-20-PS-BZ-CL',4);
+INSERT INTO headlines VALUES (7,'Hiatus Coming To A Close','http://slashcode.com/article.pl?sid=00/05/10/1516237',1);
+INSERT INTO headlines VALUES (9,'Jubal Announces Third Millenium!','http://www.betazine.com/bz-news-reel.php3?inid=1286',2);
+INSERT INTO headlines VALUES (9,'Wrath: Zerosen - is accepting alpha testers. Sign up today!','http://www.betazine.com/bz-news-reel.php3?inid=1287',1);
+INSERT INTO headlines VALUES (10,'Playstation2 and Sega','http://www.technetcast.com/tnc_program.html?program_id=76',3);
+INSERT INTO headlines VALUES (10,'Computer Crime','http://www.technetcast.com/tnc_program.html?program_id=79',1);
+INSERT INTO headlines VALUES (2,'MLP: Dog Shoots Cat Dead, and Other Tales','http://www.kuro5hin.org/?op=displaystory;sid=2000/5/17/164024/536',2);
+INSERT INTO headlines VALUES (4,'Linksys Etherfast Cable/DSL Router Review\n','http://geeknews.net/index.shtml#954124498\n',1);
+INSERT INTO headlines VALUES (10,'Danny Hillis on Game Software Development','http://www.technetcast.com/tnc_program.html?program_id=77',2);
+INSERT INTO headlines VALUES (2,'More thoughts on filtering software','http://www.kuro5hin.org/?op=displaystory;sid=2000/5/17/1448/34580',3);
+INSERT INTO headlines VALUES (6,'XMPS 0.1.0','http://freshmeat.net/news/2000/05/18/958640663.html',3);
+INSERT INTO headlines VALUES (3,'Netscape 6 Preview Release 1','http://www.netscape.com/download/previewrelease.html',6);
+
+#
+# Table structure for table 'poll'
+#
+CREATE TABLE poll (
+ id int(11) DEFAULT '0' NOT NULL auto_increment,
+ question varchar(150),
+ answer1 varchar(100),
+ answer2 varchar(100),
+ answer3 varchar(100),
+ answer4 varchar(100),
+ answer5 varchar(100),
+ answer6 varchar(100),
+ votes1 tinyint(4),
+ votes2 tinyint(4),
+ votes3 tinyint(4),
+ votes4 tinyint(4),
+ votes5 tinyint(4),
+ votes6 tinyint(4),
+ status tinyint(4) DEFAULT '0',
+ PRIMARY KEY (id)
+);
+
+#
+# Dumping data for table 'poll'
+#
+
+INSERT INTO poll VALUES (8,'What chips do you prefer?','Mama Mia\'s','Doritos','Chipsletten','Hula Hoops','Pepper n\' Salt','Regular salt',NULL,0,0,0,0,NULL,0);
+INSERT INTO poll VALUES (3,'My favorite puppet is?','Kermit','Miss Piggy','Gonzo','Dr. Teeth','UnConeD','',0,0,1,NULL,5,NULL,0);
+INSERT INTO poll VALUES (4,'I eat my waffles ...','in fork sized pieces','one square at the time','one huge bite','on a train','I hate waffles','huh?',1,3,9,1,NULL,NULL,0);
+INSERT INTO poll VALUES (9,'Fear leads to anger, anger leads to hate, and hate leads to ...','war','revolution','suffering','migraine','alcohol abuse','',NULL,1,1,2,2,NULL,0);
+INSERT INTO poll VALUES (10,'Fear leads to anger, anger leads to hate, and hate leads to ...','war','revolution','suffering','migraine','alcohol abuse','',1,2,4,3,5,NULL,0);
+INSERT INTO poll VALUES (11,'What do you think Jeroen should learn, or get better in?','HTML','PHP','The Gimp (GFX)','English','All *sigh*','',NULL,NULL,NULL,NULL,NULL,NULL,0);
+INSERT INTO poll VALUES (12,'What have your friends done for you lately?','Provided an alibi.','\n Shared a drink, some laughs, and some code.','Sent me an email saying ILOVEYOU.','Asked me to fix their computer.','Well, if I had some friends, I\'m quite sure they would do wonderful things for me.','',1,3,NULL,1,1,NULL,1);
+
+#
+# Table structure for table 'queue'
+#
+CREATE TABLE queue (
+ qid smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment,
+ uid mediumint(9) DEFAULT '0' NOT NULL,
+ uname varchar(40) DEFAULT '' NOT NULL,
+ subject varchar(100) DEFAULT '' NOT NULL,
+ article text,
+ timestamp int(11),
+ category varchar(64),
+ abstract text,
+ value int(11),
+ votes int(11),
+ PRIMARY KEY (qid)
+);
+
+#
+# Dumping data for table 'queue'
+#
+
+INSERT INTO queue VALUES (1,1,'Dries','Delete this submission','Ingore me!',957626169,'Drop.org','Delete this submission, will ya! I was just checking whether the \'notify-on-new-submissions-through-submit.php\' feature was working.',0,0);
+INSERT INTO queue VALUES (2,1,'Dries','Free porn!','Better luck next time.',957903654,'Girls','Forget about it ... this is yet another dummy submission! :)',0,0);
+
+#
+# Table structure for table 'refer'
+#
+CREATE TABLE refer (
+ url varchar(255) DEFAULT '' NOT NULL,
+ name varchar(255),
+ status int(1) DEFAULT '1',
+ refers int(7) DEFAULT '0',
+ create_dt int(11),
+ access_dt int(11),
+ PRIMARY KEY (url)
+);
+
+#
+# Dumping data for table 'refer'
+#
+
+INSERT INTO refer VALUES ('http://www.buytaert.net/','buytaert.net',1,42,NULL,NULL);
+INSERT INTO refer VALUES ('http://www.atlantis.lan/','',1,7,955955129,955957398);
+
+#
+# Table structure for table 'stories'
+#
+CREATE TABLE stories (
+ sid int(11) DEFAULT '0' NOT NULL auto_increment,
+ aid varchar(30) DEFAULT '' NOT NULL,
+ subject varchar(255),
+ time int(11),
+ abstract text,
+ comments text,
+ article text,
+ category varchar(128),
+ informant varchar(20) DEFAULT '' NOT NULL,
+ department varchar(128),
+ PRIMARY KEY (sid)
+);
+
+#
+# Dumping data for table 'stories'
+#
+
+INSERT INTO stories VALUES (1,'Dries','My first news message!',957443997,'This is the very first internal beta of the drop.org engine. It\'s still beta-ware and bugs need to be tracked down during the next weeks.','','','Drop.org','Dries','track-those-bugs-down');
+INSERT INTO stories VALUES (2,'Dries','Test message',957445708,'Let this be a test message.','','Don\\\'t forget to mail your comments and bugreports to the mailinglist. ','Drop.org','Dries','test-like-you-have-never-tested-before');
+INSERT INTO stories VALUES (3,'Jeroen','Science: Controlling Your Computer with Your Brain',957464588,'Jeroen sent this article in - I\'m not sure how to title it. It\'s /not/ about your\r\n computer controlling your brain or anything. What it is about is <A HREF=\"http://www.rochester.edu/pr/releases/cs/bayliss.html\">some interesting research</A>\r\n that has gone on into detection of brain activity, and interpretation of that. So, that could\r\n mean sitting in front of your machine and thinking what you wanted to type, or open, or\r\n whatever - it could also mean that people stricken with certain types of paralysis could\r\n use computers more easily. ','','','Sience','Jeroen','');
+INSERT INTO stories VALUES (4,'Dries','Layout enhancements',957568850,'Evening. I just made a couple of enhancements to the PHP in order to make things look better on IE 4.0 @ 800x600. Hopefully, I didn\\\'t broke the look of other browsers: it is not easy to make things look perty on all browsers. If it doesn\\\'t display correct on your browser, then let us know. :)','','','Drop.org','Dries','we-make-things-look-better');
+INSERT INTO stories VALUES (5,'Dries','Getting involved in the PHP',957570149,'If you want to get involved in the PHP-part of this website you\'ll have to go through a learning phase. Sometimes it\'s a pain but once you get the design picture it is as easy as eating cake, or winegums for that matter.\r\n\r\nCheck the \'read more\' link for pointers to stuff one could easily start with.','','<LI>A check-all-posts-for-allowed-HTML-tags function should be written and incorporated in comments.php, submit.php, webboard.php</LI>\r\n<LI>A check-all-posts-for-flamebaits function should be written and incorporated in comments.php, submit.php and webboard.php</LI>\r\n<LI>The colors on the webboard are whacked up in some places. Instead of fixing them, we should come up with better names for these color variables and we should add some extra colors for highlighting purpose and such. Also, it would be nice if we could use a class for it rather then having to \'global\' a list of 5 or more colors: <CODE>global $bgcolor1, $bgcolor2, ..., $bgcolor3;</CODE> Just \'global\' an object <CODE>$colors</CODE> and use it like <CODE>$color->bgcolor, $color->tdcolor, $color->hlcolor</CODE>, etc. In other words ... an overhaul of the color stuff in *all* pages: it\'s not difficult and it\'s a good way to explore the code.</LI>\r\n<LI>Make a theme: plain easy. Just make a new directory in the /themes-directory and your theme will be automatically integrated.</LI>\r\n<LI>Replace the cookie stuff by PHP4-sessions.</LI>\r\n\r\nDon\'t be afraid to move things around or to change the naming of some parts. Just try to make/keep it consistent though.\r\n\r\nIn addition, you could also check the lengthy mail for things that are left to be done.\r\n\r\nOff to bed, I am. I won\'t even bother to spell-check this mail. ;)\r\n','Webdesign','Dries','don\'t-be-afraid-to-learn');
+INSERT INTO stories VALUES (6,'Dries','Quickies',957625993,'Want some <A HREF=\"http://www.vir2l.com/\">eye candy</A>? <A HREF=\"http://www.phpbuilder.com/\">PHPbuilder.com</A> features 2 new articles which is exactly what we have been waiting for: <A HREF=\"http://phpbuilder.com/columns/tim20000505.php3\">A Complete, Secure User Login System</A> (we need to partially rewrite our user system) and <A HREF=\"http://phpbuilder.com/columns/justin20000428.php3\">PHP and XML: using expat functions</A> (we might want to follow the new trends). PHP monkeys we are. I was pleased to find this <A HREF=\"http://rootprompt.org/article.php3?article=359\">Emacs Beginner\'s Tutorial</A>: I\'m printing it now so I have something to read in my bed tonight. I also ran accross a <A HREF=\"http://tortie.me.uiuc.edu/~dorneich/lego/misc/legoGeekCode2.txt\">legoGeekCode</A>. Oh, and it looks like they revamped the main page of <A HREF=\"http://www.linux.com/\">linux.com</A>.','','','Quickies','Dries','we-love-quickies');
+INSERT INTO stories VALUES (7,'Dries','NASA snake-bots',957685364,'<A HREF=\"http://www.nasa.gov/\">NASA</A>\'s been working on some pretty cool <A HREF=\"http://www.space.com/news/snakebots_000504.html\">snake-bots</A> for exploring outer space. All kinds of neat features and capabilities ... take a look at the pictures: they look practical and intriguing! (from ./) <I>Mammy, can I have one too?</I>','','','Space','Dries','please-don\'t-gain-consciousness');
+INSERT INTO stories VALUES (8,'Dries','From bumper stickers to mp3 players.',957693553,'When looking for <A HREF=\"http://www.thinkgeek.com/stuff/stickers.html\">cool bumper stickers</A> to decorate my new car (you know what to buy me know), I ran accross this <A HREF=\"http://www.thinkgeek.com/brain/bazaar/mart/cart.cgi?action=view&type=item&itemid=325e\">Portable MP3 Juke Box</A>.\r\nThis momma is portable and has over 80 hours (4.86 GB) of playback time! That\'s about 1200 songs or 120 CDs! $719 is a little expensive though. I gotta be carefull because I suffer from those impulsive just-buy-it-think-afterwards moods. I really need an MP3 player: when I listen to music - and I listen music quite much - I listen to my mp3 collection 80% of the time. I hardly use CDs or cassettes anymore, so from that point of view: an MP3 player would be the way to go.\r\nPS: I\'m just rambling a bit because I\'m sick of writing uni papers and because it\'s better to test drop.org with semi-useful stuff then with complete junk. Right? *g*\r\nAnyway, I guess I could use some <A HREF=\"http://www.thinkgeek.com/brain/bazaar/mart/cart.cgi?action=view&type=item&itemid=287d\">Penguin Mints</A>: three penguin mints are equivalent to about 1 coke in terms of caffeine.','','','Geeking','Dries','It\'s-gotta-be-mine-mine-mine');
+INSERT INTO stories VALUES (9,'Jeroen','Windows Source Code Proposal Confirmed',957790469,'ChipX86 writes: \\\"We\\\'ve all heard the rumors about Microsoft proposing to open source\r\n Windows. Now it appears to be confirmed. This article on MSNBC says that Microsoft\r\n would \\\'... provide open, timely and complete access to the parts of the Windows\r\n operating system code used by independent software companies to design their\r\n software applications to run on Windows.\\\'\\\" From the sound of it, this seems like more of a delay tactic than a\r\n straight proposal, but interesting nonetheless. (How open is \\\"open,\\\" by the way? What about \\\"Timely\\\"?) ','','','Announcements','Jeroen','from the please-don\\\'t-gain-consciousness');
+INSERT INTO stories VALUES (10,'Dries','Updates',957877356,'drop.org has been activated, Natrak smoothly switched things, the mailing list is now up and running and all droppies have receeived there personal drop.org e-mail address. Oh behave, baby! I fixed a few problems which actually allowed me to fix my typoes in my previous post: now, you can actually check what particular <A HREF=\"http://www.thinkgeek.com/stuff/stickers.html\">bumper stickers</A> I\'m interested in! *hint*hint*<BR>Oh, I installed a new poll and whilst doing so I discovered a few poll problems I\'ll have to fix.<BR>\r\nAnyway, I\'ll keep rambling as well as adding (semi-useless) posts to test our beast. My mom tends to talk to the walls ... at least I made some genetical progress, don\'t you think?','','','Drop.org','Dries','what-service-pack-you-say?');
+INSERT INTO stories VALUES (11,'Dries','New Lara Croft model unveiled',957955426,'16 year old Lucy Clarkson, <A HREF=\"http://www.core-design.com/newlara/newlara.htm\">seen here</A>, is the new Lara Croft model. Her vital statistics, you ask? 32 <B><BLINK>DD</BLINK></B> - 25 - 36. Lucy will make her debut appearance as Lara Croft at America\'s E3 show, Los Angeles this week, May 11-13.<BR>Well, what can I say ... she has what it needs: the breasts. *g*\r\n','UPDATE: <A HREF=\"http://www.core-design.com/\">core-design.com</A> has updated their website with more pictures of the new Lara Croft model. Check them <A HREF=\"http://www.core-design.com/lara.htm\">here</A>!','','Gaming','Dries','fieuw-pff-wow-dang-boink');
+INSERT INTO stories VALUES (12,'Dries','Theme system update',958130349,'Our theme system has been overhauled, revamped and recoded from scratch. Nuff said, just post your comments! :-)\r\n','','','Drop.org','Dries','we-had-to-go-through-all-the-files');
+INSERT INTO stories VALUES (13,'Dries','Pyramid Mistery',958131056,'If you are - just like me - interested in the pyramid mysteries then you should check out <A HREF=\"http://ourworld.compuserve.com/homepages/FDoernenburg/mainpyr.htm\">this page</A>. It is a somewhat skeptical page about the Great Pyramids and because of all those truly whacked mysteries they claim that they could not have been built by the ancient Egyptians. What do you think?','','','Science','Dries','living-farao\'s');
+INSERT INTO stories VALUES (14,'Dries','Make your own mech.',958313828,'Some guys over at <A HREF=\"http://www.mechaps.com/\">http://www.mechaps.com/</A> are building their own mech. Why you ask? <I>\"Why Not.\"</I>, they say. <I>\"To be cool. To be worshipped by nerds across the globe. They can be used for construction. Mechs may also be useful as a war machine, as they can be manufactured cheaply, are very modular, easy to repair, and inexpensive to operate.\"</I><BR>\r\n\'Some are born nuts, some achieve nutness, and some have nutness thrust upon them ...\' (DriesSpeare)','','','Geeking','Dries','you-gotta-be-kidding-me');
+INSERT INTO stories VALUES (15,'Dries','NASA Proposes Launch Solar Sail Vehicle For 2010',958395687,'Apparently, NASA plans to launch a <A HREF=\"http://www1.msfc.nasa.gov/NEWSROOM/news/releases/2000/00-150.html\"> solar sail spacecraft</A> in the year 2010 according to this press release. The the first trip\r\nwill take about 15 years, traveling about 58 miles per second. The sail will be 440 yards in width, and will be constructed of a reflective carbon-fiber material. \'This will be humankind\'s first planned venture outside our solar system,\' said Les Johnson, manager of Interstellar Propulsion Research at the Marshall Center. \'This is a\r\nstretch goal that is among the most audacious things we\'ve ever undertaken.\' Check the <A HREF=\"http://www1.msfc.nasa.gov/NEWSROOM/news/photos/2000/photos00-150.htm\">pictures</A>!<BR>If you want to do cool stuff, you want to work for/with NASA!','','','Space','Dries','we-have-an-overheated-cool-o-matic');
+
+#
+# Table structure for table 'users'
+#
+CREATE TABLE users (
+ uid int(11) DEFAULT '0' NOT NULL auto_increment,
+ name varchar(60) DEFAULT '' NOT NULL,
+ uname varchar(15) DEFAULT '' NOT NULL,
+ email varchar(60) DEFAULT '' NOT NULL,
+ femail varchar(60) DEFAULT '' NOT NULL,
+ url varchar(100) DEFAULT '' NOT NULL,
+ pass varchar(20) DEFAULT '' NOT NULL,
+ storynum tinyint(4) DEFAULT '10' NOT NULL,
+ umode varchar(10) DEFAULT '' NOT NULL,
+ uorder tinyint(1) DEFAULT '0' NOT NULL,
+ thold tinyint(1) DEFAULT '0' NOT NULL,
+ noscore tinyint(1) DEFAULT '0' NOT NULL,
+ bio tinytext NOT NULL,
+ ublockon tinyint(1) DEFAULT '0' NOT NULL,
+ ublock text,
+ theme varchar(255) DEFAULT '' NOT NULL,
+ signature varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (uid)
+);
+
+#
+# Dumping data for table 'users'
+#
+
+INSERT INTO users VALUES (1,'D. Buytaert','Dries','grmbl@buytaert.net','dries_at_drop_dot_org','http://www.buytaert.net/','javastar',10,'flat',1,0,0,'Hi mom!',0,'','UnConeD','Hi dad!');
+INSERT INTO users VALUES (2,'Kjartan Mannes','natrak','natrak@zind.net','natrak@zind-dot-net','http://natrak.net/','lovesilse',10,'nested',0,0,0,'Hmmmm.... coming soon? :P\r\n',0,'','UnConeD','N.');
+INSERT INTO users VALUES (3,'Jeroen Bensch','Jeroen','jbensch@advalvas.be','jeroen@drop.org','http://www.drop.org','Pass th1s!',15,'threaded',1,0,0,'I am a student computer science at the university of Antwerp in Belgium (Europe).<BR>\r\nI am 1.86m tall, have brown hair and blue/green eyes... anything else?',0,'','UnConeD','. . .. Jeroen');
+INSERT INTO users VALUES (4,'Steven Wittens','UnConeD','unconed@projectx.mx.dk','','','A3h26gv4m9r',10,'',0,0,0,'',0,'','UnConeD','4096');
+
+#
+# Table structure for table 'webboard'
+#
+CREATE TABLE webboard (
+ topic_id int(11) DEFAULT '0' NOT NULL auto_increment,
+ parent_id int(11) DEFAULT '0',
+ root_id int(11) DEFAULT '0',
+ subject varchar(255),
+ message text,
+ create_dt int(11) DEFAULT '0',
+ author varchar(255),
+ hostname varchar(255),
+ PRIMARY KEY (topic_id)
+);
+
+#
+# Dumping data for table 'webboard'
+#
+
+INSERT INTO webboard VALUES (1,0,1,'First message','Euh ... hi mom!',957442705,'Dries','212.100.176.145');
+INSERT INTO webboard VALUES (2,0,2,'just testing of course what else?','I have allready found some bugs, how about you?\r\n\r\nJeroen.',957454049,'Jeroen','212.100.176.145');
+INSERT INTO webboard VALUES (3,0,3,'just testing of course what else?','I have allready found some bugs, how about you?\r\n\r\nJeroen.',957454098,'Jeroen','212.100.176.145');
+INSERT INTO webboard VALUES (4,3,3,'Re: just testing of course what else?&nbsp; [NT]','',957454259,'Jeroen','212.100.176.145');
+INSERT INTO webboard VALUES (5,0,5,'happy testing','The webboard should be sorta stable as it is clearly the good ol\' atlantis.lan webboard. I made a few changes though to fix (?) the login problem and to allow anonymous posters (alas: Anonymous Chickens) to post.\r\n\r\n-- Dries',957457010,'Dries','212.100.176.145');
+INSERT INTO webboard VALUES (6,5,5,'Re: happy testing','Well it is very stable but the colors aren\'t right.\r\nIt is all bordeaux and grey when displaying the webboard\r\nthreaded, but if you select a message to read it the bordeax\r\ndissapears. This can\'t be right can it?\r\n\r\n. . .Jeroen',957523760,'Jeroen','212.100.176.145');
+INSERT INTO webboard VALUES (7,6,5,'Re: Re: happy testing','Your right: it\'s a bug. We should make a list of all bugs - I\'ll try to fix it tonight.\r\n\r\n-- Dries',957529636,'Dries','195.162.202.97');
+INSERT INTO webboard VALUES (8,0,8,'*pompidom*&nbsp; [NT]','',958579616,'Anonymous Chicken','212.100.176.145');
+
diff --git a/password.dict b/password.dict
new file mode 100644
index 0000000..0267964
--- /dev/null
+++ b/password.dict
@@ -0,0 +1,16 @@
+foo
+bar
+guy
+neo
+geek
+nerd
+fish
+hack
+star
+moon
+hero
+cola
+girl
+fish
+java
+boss
diff --git a/poll.php b/poll.php
new file mode 100644
index 0000000..e1e530b
--- /dev/null
+++ b/poll.php
@@ -0,0 +1,278 @@
+<?
+
+ ### poll.php.inc specific settings:
+
+ # Use cookie:
+ # (1 = enabled, 0 = disabled)
+ $cookieUse = 1; // 1 = Enabled 0=Disabled
+
+ # When should cookie expire:
+ // $cookieExpire = 604800; // Expires in a week
+ $cookieExpire = 60; // Expires in a week
+
+ # Bar image we should use:
+ $barImage = "./images/poll.gif"; // Image to use
+
+ # Bar height:
+ $barHeight = "15"; // Image height
+
+ /*
+ CREATE TABLE poll (
+ id int(11) DEFAULT '0' NOT NULL auto_increment,
+ question varchar(150),
+ answer1 varchar(100),
+ answer2 varchar(100),
+ answer3 varchar(100),
+ answer4 varchar(100),
+ answer5 varchar(100),
+ answer6 varchar(100),
+ votes1 tinyint(4),
+ votes2 tinyint(4),
+ votes3 tinyint(4),
+ votes4 tinyint(4),
+ votes5 tinyint(4),
+ votes6 tinyint(4),
+ status tinyint(4) DEFAULT '0',
+ PRIMARY KEY (id)
+ );
+ */
+
+
+function deletePoll($id) {
+ dbconnect();
+ $query = "DELETE FROM poll WHERE id = $id";
+ $result = mysql_query($query);
+}
+
+function enablePoll($id) {
+ dbconnect();
+ $query = "UPDATE poll SET status = 0 WHERE status = 1";
+ $result = mysql_query($query);
+
+ $query = "UPDATE poll SET status = 1 WHERE id = $id";
+ $result = mysql_query($query);
+}
+
+function disablePoll($id) {
+ dbconnect();
+ $query = "UPDATE poll SET status = 0 WHERE id = $id";
+ $result = mysql_query($query);
+}
+
+function castVote($vote) {
+ dbconnect();
+ $query = "SELECT * FROM poll WHERE status = 1";
+ $result = mysql_query($query);
+ if ($poll = mysql_fetch_object($result)) {
+ $vote = "votes$vote";
+ $result = $poll->$vote + 1;
+ $query = "UPDATE poll SET $vote = '$result' WHERE id = $poll->id";
+ $result = mysql_query($query);
+ }
+}
+
+function addPoll($question, $answer1, $answer2, $answer3 = "", $answer4 = "", $answer5 = "", $answer6 = "") {
+ dbconnect();
+ $query = "INSERT INTO poll (question, answer1, answer2, answer3, answer4, answer5, answer6) VALUES ('$question', '$answer1', '$answer2', '$answer3', '$answer4', '$answer5', '$answer6')";
+ $result = mysql_query($query);
+}
+
+function updatePoll($id, $question, $answer1, $answer2, $answer3 = "", $answer4 = "", $answer5 = "", $answer6 = "") {
+ dbconnect();
+ $query = "UPDATE poll SET question = '$question', answer1 = '$answer1', answer2 = '$answer2', answer3 = '$answer3', answer4 = '$answer4', answer5 = '$answer5', answer6 = '$answer6' WHERE id = $id";
+ $result = mysql_query($query);
+}
+
+function getPoll($id) {
+ dbconnect();
+ $query = "SELECT * FROM poll WHERE id = $id";
+ $result = mysql_query($query);
+ if ($poll = mysql_fetch_object($result)) return $poll;
+}
+
+function getActivePoll() {
+ dbconnect();
+ $query = "SELECT * FROM poll WHERE status = 1";
+ $result = mysql_query($query);
+ if ($poll = mysql_fetch_object($result)) return $poll->id;
+}
+
+function getPollArray() {
+ dbconnect();
+
+ $query = "SELECT * FROM poll";
+ $result = mysql_query($query);
+
+ $index = 0;
+ while ($poll = mysql_fetch_object($result)) {
+ $rval[$index] = $poll;
+ $index++;
+ }
+
+ return $rval;
+}
+
+function displayForm() {
+ global $PHP_SELF;
+
+ if ($poll = getPoll(getActivePoll())) {
+ $rval = "<P ALIGN=\"center\"><B>$poll->question</B></P>\n";
+ $rval .= "<FORM METHOD=\"post\" ACTION=\"$PHP_SELF?section=poll&method=vote\">\n";
+ if ($poll->answer1) $rval .= " <INPUT TYPE=\"radio\" NAME=\"answer\" VALUE=\"1\"> $poll->answer1<BR>\n";
+ if ($poll->answer2) $rval .= " <INPUT TYPE=\"radio\" NAME=\"answer\" VALUE=\"2\"> $poll->answer2<BR>\n";
+ if ($poll->answer3) $rval .= " <INPUT TYPE=\"radio\" NAME=\"answer\" VALUE=\"3\"> $poll->answer3<BR>\n";
+ if ($poll->answer4) $rval .= " <INPUT TYPE=\"radio\" NAME=\"answer\" VALUE=\"4\"> $poll->answer4<BR>\n";
+ if ($poll->answer5) $rval .= " <INPUT TYPE=\"radio\" NAME=\"answer\" VALUE=\"5\"> $poll->answer5<BR>\n";
+ if ($poll->answer6) $rval .= " <INPUT TYPE=\"radio\" NAME=\"answer\" VALUE=\"6\"> $poll->answer6<BR>\n";
+ $rval .= " <BR><CENTER><INPUT TYPE=\"submit\" NAME=\"vote\" VALUE=\"Vote\"></CENTER>\n";
+ $rval .= "</FORM>";
+ }
+ else {
+ $rval = "There is currently no poll available.";
+ }
+ return $rval;
+}
+
+function displayResult($id) {
+ global $PHP_SELF, $barImage;
+
+ if ($poll = getPoll($id)) {
+ # total number of votes:
+ $total = $poll->votes1 + $poll->votes2 + $poll->votes3 + $poll->votes4 + $poll->votes5 + $poll->votes6;
+ $rval = "<P ALIGN=\"center\"><B>$poll->question</B></P>\n";
+
+ if ($total) {
+ # percentage:
+ if ($poll->answer1) {
+ $per1 = round($poll->votes1 / $total * 100);
+ $wid1 = ($per1) ? $per1 : 1;
+ $rval .= "<P>$poll->answer1<BR><IMG SRC=\"$barImage\" HEIGHT=\"8\" WIDTH=\"$wid1\"> $poll->votes1 ($per1 %)</P>";
+ }
+ if ($poll->answer2) {
+ $per2 = round($poll->votes2 / $total * 100);
+ $wid2 = ($per2) ? $per2 : 1;
+ $rval .= "<P>$poll->answer2<BR><IMG SRC=\"$barImage\" HEIGHT=\"8\" WIDTH=\"$wid2\"> $poll->votes2 ($per2 %)</P>";
+ }
+ if ($poll->answer3) {
+ $per3 = round($poll->votes3 / $total * 100);
+ $wid3 = ($per3) ? $per3 : 1;
+ $rval .= "<P>$poll->answer3<BR><IMG SRC=\"$barImage\" HEIGHT=\"8\" WIDTH=\"$wid3\"> $poll->votes3 ($per3 %)</P>";
+ }
+ if ($poll->answer4) {
+ $per4 = round($poll->votes4 / $total * 100);
+ $wid4 = ($per4) ? $per4 : 1;
+ $rval .= "<P>$poll->answer4<BR><IMG SRC=\"$barImage\" HEIGHT=\"8\" WIDTH=\"$wid4\"> $poll->votes4 ($per4 %)</P>";
+ }
+ if ($poll->answer5) {
+ $per5 = round($poll->votes5 / $total * 100);
+ $wid5 = ($per5) ? $per5 : 1;
+ $rval .= "<P>$poll->answer5<BR><IMG SRC=\"$barImage\" HEIGHT=\"8\" WIDTH=\"$wid5\"> $poll->votes5 ($per5 %)</P>";
+ }
+ if ($poll->answer6) {
+ $per6 = round($poll->votes6 / $total * 100);
+ $wid6 = ($per6) ? $per6 : 1;
+ $rval .= "<P>$poll->answer6<BR><IMG SRC=\"$barImage\" HEIGHT=\"8\" WIDTH=\"$wid6\"> $poll->votes6 ($per6 %)</P>";
+ }
+ }
+ $rval .= "<BR><P>Total votes: $total</P>";
+ }
+ else {
+ $rval = "There is currently no poll available.";
+ }
+ return $rval;
+}
+
+function adminPolls() {
+ global $PHP_SELF;
+
+ $polls = getPollArray();
+ $rval = "<TABLE WIDTH=\"100%\">\n";
+ for (reset($polls); $poll = current($polls); next($polls)) {
+ $status = ($poll->status) ? "<TD WIDTH=\"20\"><FONT COLOR=\"blue\" SIZE=\"+2\">*</FONT></TD><TD WIDTH=\"40\"><A HREF=\"$PHP_SELF?section=poll&method=disable&id=$poll->id\">disable</A></TD>" : "<TD WIDTH=\"20\"><FONT COLOR=\"yellow\" SIZE=\"+2\">*</FONT></TD><TD WIDTH=\"40\" ><A HREF=\"$PHP_SELF?section=poll&method=enable&id=$poll->id\">enable</A></TD>";
+ $rval .= " <TR><TD WIDTH=\"50%\" >$poll->question</TD>$status<TD WIDTH=\"40\"><A HREF=\"$PHP_SELF?section=poll&method=result&id=$poll->id\">view</A></TD><TD WIDTH=\"40\"><A HREF=\"$PHP_SELF?section=poll&method=edit&id=$poll->id\">edit</A></TD><TD WIDTH=\"40\"><A HREF=\"$PHP_SELF?section=poll&method=delete&id=$poll->id\">delete</A></TD></TR>\n";
+ }
+ $rval .= "</TABLE>";
+
+ return $rval;
+}
+
+if (!$box) {
+ include "functions.inc";
+ include "theme.inc";
+ $theme->header();
+}
+
+if ($section == "poll") {
+ include "authentication.inc";
+ if ($method == "add") {
+ if ($admin) {
+ addPoll($question, $answer1, $answer2, $answer3, $answer4, $answer5, $answer6);
+ $theme->box("Poll manager", "<P><B><U>Status:</U></B> new poll added.</P>\n<P><B><U>Overview:</U></B></P>\n". adminPolls() ."<P><B><U>Add poll:</U></B></P>\n<FORM METHOD=\"post\" ACTION=\"$PHP_SELF?section=poll&method=add\">\n<TABLE>\n <TR><TD>Question:</TD><TD><INPUT TYPE=\"text\" NAME=\"question\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 1:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer1\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 2:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer2\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 3:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer3\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 4:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer4\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 5:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer5\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 6:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer6\" SIZE=\"35\"></TD></TR>\n <TR><TD ALIGN=\"center\" COLSPAN=\"2\"><INPUT TYPE=\"submit\" VALUE=\"Add poll\" NAME=\"add\">&nbsp;<INPUT TYPE=\"reset\" VALUE=\"Reset\"></TD></TR>\n</TABLE>\n</FORM>");
+ }
+ else $theme->box("Failed", "You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
+ }
+ else if ($method == "edit") {
+ if ($admin) {
+ $poll = getPoll($id);
+ $theme->box("Poll manager", "<P><B><U>Edit poll:</U></B></P>\n<FORM METHOD=\"post\" ACTION=\"$PHP_SELF?section=poll&method=update&id=$poll->id\">\n<TABLE>\n <TR><TD>Question:</TD><TD><INPUT TYPE=\"text\" NAME=\"question\" SIZE=\"35\" VALUE=\"$poll->question\"></TD></TR>\n <TR><TD>Answer 1:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer1\" SIZE=\"35\" VALUE=\"$poll->answer1\"></TD></TR>\n <TR><TD>Answer 2:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer2\" SIZE=\"35\" VALUE=\"$poll->answer2\"></TD></TR>\n <TR><TD>Answer 3:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer3\" SIZE=\"35\" VALUE=\"$poll->answer3\"></TD></TR>\n <TR><TD>Answer 4:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer4\" SIZE=\"35\" VALUE=\"$poll->answer4\"></TD></TR>\n <TR><TD>Answer 5:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer5\" SIZE=\"35\" VALUE=\"$poll->answer5\"></TD></TR>\n <TR><TD>Answer 6:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer6\" SIZE=\"35\" VALUE=\"$poll->answer6\"></TD></TR>\n <TR><TD ALIGN=\"center\" COLSPAN=\"2\"><INPUT TYPE=\"submit\" VALUE=\"Update poll\" NAME=\"add\">&nbsp;<INPUT TYPE=\"reset\" VALUE=\"Reset\"></TD></TR>\n</TABLE>\n</FORM>");
+ }
+ else $theme->box("Failed", "You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
+ }
+ else if ($method == "enable") {
+ if ($admin) {
+ enablePoll($id);
+ $theme->box("Poll manager", "<P><B><U>Status:</U></B> poll enabled.</P>\n<P><B><U>Overview:</U></B></P>\n". adminPolls() ."<P><B><U>Add poll:</U></B></P>\n<FORM METHOD=\"post\" ACTION=\"$PHP_SELF?section=poll&method=add\">\n<TABLE>\n <TR><TD>Question:</TD><TD><INPUT TYPE=\"text\" NAME=\"question\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 1:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer1\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 2:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer2\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 3:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer3\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 4:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer4\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 5:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer5\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 6:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer6\" SIZE=\"35\"></TD></TR>\n <TR><TD ALIGN=\"center\" COLSPAN=\"2\"><INPUT TYPE=\"submit\" VALUE=\"Add poll\" NAME=\"add\">&nbsp;<INPUT TYPE=\"reset\" VALUE=\"Reset\"></TD></TR>\n</TABLE>\n</FORM>");
+ }
+ else $theme->box("Failed", "You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
+ }
+ else if ($method == "delete") {
+ if ($admin) {
+ deletePoll($id);
+ $theme->box("Poll manager", "<P><B><U>Status:</U></B> poll deleted.</P>\n<P><B><U>Overview:</U></B></P>\n". adminPolls() ."<P><B><U>Add poll:</U></B></P>\n<FORM METHOD=\"post\" ACTION=\"$PHP_SELF?section=poll&method=add\">\n<TABLE>\n <TR><TD>Question:</TD><TD><INPUT TYPE=\"text\" NAME=\"question\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 1:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer1\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 2:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer2\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 3:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer3\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 4:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer4\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 5:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer5\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 6:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer6\" SIZE=\"35\"></TD></TR>\n <TR><TD ALIGN=\"center\" COLSPAN=\"2\"><INPUT TYPE=\"submit\" VALUE=\"Add poll\" NAME=\"add\">&nbsp;<INPUT TYPE=\"reset\" VALUE=\"Reset\"></TD></TR>\n</TABLE>\n</FORM>");
+ }
+ else $theme->box("Failed", "You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
+ }
+ else if ($method == "disable") {
+ if ($admin) {
+ disablePoll($id);
+ $theme->box("Poll manager", "<P><B><U>Status:</U></B> poll disabled.</P>\n<P><B><U>Overview:</U></B></P>\n". adminPolls() ."<P><B><U>Add poll:</U></B></P>\n<FORM METHOD=\"post\" ACTION=\"$PHP_SELF?section=poll&method=add\">\n<TABLE>\n <TR><TD>Question:</TD><TD><INPUT TYPE=\"text\" NAME=\"question\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 1:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer1\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 2:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer2\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 3:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer3\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 4:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer4\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 5:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer5\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 6:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer6\" SIZE=\"35\"></TD></TR>\n <TR><TD ALIGN=\"center\" COLSPAN=\"2\"><INPUT TYPE=\"submit\" VALUE=\"Add poll\" NAME=\"add\">&nbsp;<INPUT TYPE=\"reset\" VALUE=\"Reset\"></TD></TR>\n</TABLE>\n</FORM>");
+ }
+ else $theme->box("Failed", "You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>"); }
+ else if ($method == "update") {
+ if ($admin) {
+ updatePoll($id, $question, $answer1, $answer2, $answer3, $answer4, $answer5, $answer6);
+ $theme->box("Poll manager", "<P><B><U>Status:</U></B> poll updated.</P>\n<P><B><U>Overview:</U></B></P>\n". adminPolls() ."<P><B><U>Add poll:</U></B></P>\n<FORM METHOD=\"post\" ACTION=\"$PHP_SELF?section=poll&method=add\">\n<TABLE>\n <TR><TD>Question:</TD><TD><INPUT TYPE=\"text\" NAME=\"question\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 1:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer1\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 2:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer2\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 3:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer3\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 4:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer4\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 5:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer5\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 6:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer6\" SIZE=\"35\"></TD></TR>\n <TR><TD ALIGN=\"center\" COLSPAN=\"2\"><INPUT TYPE=\"submit\" VALUE=\"Add poll\" NAME=\"add\">&nbsp;<INPUT TYPE=\"reset\" VALUE=\"Reset\"></TD></TR>\n</TABLE>\n</FORM>");
+ }
+ else $theme->box("Failed", "You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
+ }
+ else if ($method == "result") {
+ if ($id) $theme->box("Voting poll", displayResult($id));
+ else $theme->box("Voting poll", displayResult(getActivePoll()));
+ }
+ else if ($method == "vote") {
+ if ($poll) {
+ $theme->box("Voting poll", displayResult(getActivePoll()) ."<P><B>Note:</B> you have voted already recently.</P>");
+ }
+ else {
+ castVote($answer);
+ $theme->box("Voting poll", displayResult(getActivePoll()));
+ }
+ }
+ else {
+ if ($admin) {
+ $theme->box("Poll manager", "<P><B><U>Overview:</U></B></P>\n". adminPolls() ."<P><B><U>Add poll:</U></B></P>\n<FORM METHOD=\"post\" ACTION=\"$PHP_SELF?section=poll&method=add\">\n<TABLE>\n <TR><TD>Question:</TD><TD><INPUT TYPE=\"text\" NAME=\"question\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 1:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer1\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 2:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer2\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 3:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer3\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 4:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer4\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 5:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer5\" SIZE=\"35\"></TD></TR>\n <TR><TD>Answer 6:</TD><TD><INPUT TYPE=\"text\" NAME=\"answer6\" SIZE=\"35\"></TD></TR>\n <TR><TD ALIGN=\"center\" COLSPAN=\"2\"><INPUT TYPE=\"submit\" VALUE=\"Add poll\" NAME=\"add\">&nbsp;<INPUT TYPE=\"reset\" VALUE=\"Reset\"></TD></TR>\n</TABLE>\n</FORM>");
+ }
+ else $theme->box("Failed", "You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
+ }
+}
+else {
+ if ($poll) {
+ $theme->box("Voting poll", displayResult(getActivePoll()) ."<P><B>Note:</B> you have voted already recently.</P>");
+ }
+ else {
+ $theme->box("Voting poll", displayForm() ."<P ALIGN=\"right\">[ <A HREF=\"$PHP_SELF?section=poll&method=result\"><FONT COLOR=\"$theme->hlcolor2\">results</FONT></A> ]</P>");
+ }
+}
+
+if (!$box) $theme->footer();
+?> \ No newline at end of file
diff --git a/queue.php b/queue.php
new file mode 100644
index 0000000..2964b60
--- /dev/null
+++ b/queue.php
@@ -0,0 +1,50 @@
+<?
+
+function displayMain() {
+ include "functions.inc";
+ include "theme.inc";
+
+
+ dbconnect();
+
+ $result = mysql_query("SELECT * FROM queue");
+
+ $content .= "<P>Anyone who happens by, and has some news or some thoughts they'd like to share, can <A HREF=\"submit.php\">submit</A> new content for consideration. After someone has submitted something, their story is added to a queue. All registered users can access this list of pending stories, that is, stories that have been submitted, but do not yet appear on the public front page. Those registered users can vote whether they think the story should be posted or not. When enough people vote to post a story, the story is pushed over the threshold and up it goes on the public page. On the other hand, when too many people voted to drop a story, the story will be trashed.</P><P>Basically, this means that you, the community, are truly the editors of this site as you have the final decision on the content of this site. It's you judging the overall quality of a story. But remember, vote on whether the story is interesting, not on whether you agree with it or not. If the story goes up, you can disagree all you want, but don't vote 'no' because you think the ideas expressed are wrong. Instead, vote 'no' when you think the story is plain boring.</P>";
+ $content .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n";
+ $content .= " <TR BGCOLOR=\"$bgcolor1\"><TD>Subject</TD><TD>Category</TD><TD>Date</TD><TD>Author</TD><TD>Score</TD></TR>\n";
+
+ while ($submission = mysql_fetch_object($result)) {
+ $content .= " <TR><TD WIDTH=\"100%\"><A HREF=\"queue.php?op=view&qid=$submission->qid\">$submission->subject</A></TD><TD>$submission->category</TD><TD NOWRAP>". date("Y-m-d h:m:s", $submission->timestamp) ."</TD><TD NOWRAP>$submission->uname</TD><TD>O</TD></TR>\n";
+ }
+
+ $content .= "</TABLE>\n";
+
+ $theme->header();
+ $theme->box("Pending stories", $content);
+ $theme->footer();
+}
+
+function displaySubmission($qid) {
+ include "functions.inc";
+ include "theme.inc";
+
+ dbconnect();
+
+ $result = mysql_query("SELECT * FROM queue WHERE qid = $qid");
+ $submission = mysql_fetch_object($result);
+
+ $theme->header();
+ $theme->article("", $submission->uname, $submission->time, $submission->subject, "", $submission->abstract, "", $submission->article, "[ <A HREF=\"javascript: history.back()\"><FONT COLOR=\"$theme->hlcolor2\">back</FONT></A> ]");
+ $theme->footer();
+}
+
+switch($op) {
+ case "view":
+ displaySubmission($qid);
+ break;
+ default:
+ displayMain();
+ break;
+}
+
+?> \ No newline at end of file
diff --git a/rdf.php b/rdf.php
new file mode 100644
index 0000000..adc38dd
--- /dev/null
+++ b/rdf.php
@@ -0,0 +1,247 @@
+<?
+
+include "functions.inc";
+include "theme.inc";
+
+class rdf {
+ // Contains the raw rdf file:
+ var $data;
+
+ // Contains the parsed rdf file:
+ var $title; // website name
+ var $items; // latest headlines
+
+ function url2sql($site, $timout = 10) {
+ ### Connect to database:
+ dbconnect();
+
+ ### Get channel info:
+ $result = mysql_query("SELECT * FROM channel WHERE site = '$site'");
+
+ if ($channel = mysql_fetch_object($result)) {
+ ### Decode URL:
+ $url = parse_url($channel->rdf);
+ $host = $url[host];
+ $port = $url[port] ? $url[port] : 80;
+ $path = $url[path];
+
+ // print "<PRE>$url - $host - $port - $path</PRE>";
+
+ ### Retrieve data from website:
+ $fp = fsockopen($host, $port, &$errno, &$errstr, $timout);
+
+ if ($fp) {
+ ### Get data from URL:
+ fputs($fp, "GET $path HTTP/1.0\n");
+ fputs($fp, "User-Agent: headline grabber\n");
+ fputs($fp, "Host: ". $host ."\n");
+ fputs($fp, "Accept: */*\n\n");
+
+ while(!feof($fp)) $data .= fgets($fp, 128);
+
+ // print "<PRE>$data</PRE><HR>";
+
+ if (strstr($data, "200 OK")) {
+
+ ### Remove existing entries:
+ $result = mysql_query("DELETE FROM headlines WHERE id = $channel->id");
+
+ ### Strip all 'junk':
+ $data = ereg_replace("<?xml.*/image>", "", $data);
+ $data = ereg_replace("</rdf.*", "", $data);
+ $data = chop($data);
+
+ ### Iterating through our data processing each entry/item:
+ $items = explode("</item>", $data);
+ $number = 0;
+
+ for (reset($items); $item = current($items); next($items)) {
+ ### Extract data:
+ $link = ereg_replace(".*<link>", "", $item);
+ $link = ereg_replace("</link>.*", "", $link);
+ $title = ereg_replace(".*<title>", "", $item);
+ $title = ereg_replace("</title>.*", "", $title);
+
+ ### Clean headlines:
+ $title = stripslashes(fixquotes($title));
+
+ ### Count the number of stories:
+ $number += 1;
+
+ ### Insert item in database:
+ $result = mysql_query("INSERT INTO headlines (id, title, link, number) VALUES('$channel->id', '$title', '$link', '$number')");
+ }
+
+ ### Mark channels as being updated:
+ $result = mysql_query("UPDATE channel SET timestamp = '". time() ."' WHERE id = $channel->id");
+ }
+ else print "<HR>RDF parser: 404 error?<BR><BR><PRE>$data</PRE><HR>";
+ }
+ }
+ }
+
+ function displayHeadlines($site, $timout = 1800) {
+ global $theme;
+
+ ### Connect to database:
+ dbconnect();
+
+ ### Get channel info:
+ $result = mysql_query("SELECT * FROM channel WHERE site = '$site'");
+
+ if ($channel = mysql_fetch_object($result)) {
+
+ ### Check to see whether we have to update our headlines first:
+ if (time() - $channel->timestamp > $timout) $this->url2sql($site);
+
+ ### Grab headlines from database:
+ $result = mysql_query("SELECT * FROM headlines WHERE id = $channel->id ORDER BY number");
+ while ($headline = mysql_fetch_object($result)) {
+ $content .= "<LI><A HREF=\"$headline->link\">$headline->title</A></LI>";
+ }
+ ### Add timestamp:
+ $update = round((time() - $channel->timestamp) / 60);
+ $content .= "<P ALIGN=\"right\">[ <A HREF=\"rdf.php?op=reset&id=$channel->id\"><FONT COLOR=\"$theme->hlcolor2\">reset</FONT></A> | updated $update min. ago ]</P>";
+
+ ### Display box:
+ $theme->box("$channel->site", $content);
+ }
+ else print "<P>Warning: something whiched happened: specified channel could not be found in database.</P>";
+ }
+
+ function addChannel($site, $url, $rdf) {
+ ### Connect to database:
+ dbconnect();
+
+ ### Add channel:
+ $query = mysql_query("INSERT INTO channel (site, url, rdf, timestamp) VALUES ('$site', '$url', '$rdf', now())");
+ }
+
+ function resetChannel($id) {
+ ### Connect to database:
+ dbconnect();
+
+ ### Delete headlines:
+ $result = mysql_query("DELETE FROM headlines WHERE id = $id");
+
+ ### Mark channel as invalid to enforce an update:
+ $result = mysql_query("UPDATE channel SET timestamp = 42 WHERE id = $id");
+ }
+}
+
+function adminAddChannel() {
+ ?>
+ <HR>
+ <FORM ACTION="rdf.php" METHOD="post">
+ <P>
+ <B>Site name:</B><BR>
+ <INPUT TYPE="text" NAME="site" SIZE="50">
+ </P>
+
+ <P>
+ <B>URL:</B><BR>
+ <INPUT TYPE="text" NAME="url" SIZE="50">
+ </P>
+
+ <P>
+ <B>RDF file:</B><BR>
+ <INPUT TYPE="text" NAME="rdf" SIZE="50">
+ </P>
+ <INPUT TYPE="submit" NAME="op" VALUE="Add RDF channel">
+ </FORM>
+ <?
+}
+
+function adminDisplayAll() {
+ ### Connect to database:
+ dbconnect();
+
+ ### Get channel info:
+ $result = mysql_query("SELECT * FROM channel ORDER BY id");
+
+ print "<TABLE BORDER=\"0\">";
+ while ($channel = mysql_fetch_object($result)) {
+ if ($state % 3 == 0) print " <TR>";
+
+ print " <TD ALIGN=\"center\" VALIGN=\"top\" WIDTH=\"33%\">";
+ $rdf = new rdf();
+ $rdf->displayHeadlines($channel->site);
+ print " </TD>";
+
+ if ($state % 3 == 2) print " </TR>";
+
+ $state += 1;
+ }
+ print "</TABLE>";
+}
+
+function adminDisplayInfo() {
+ ?>
+ <H1>Headlines</H1>
+ <H3>Concept</H3>
+ <P>
+ RDF support can change a portal in a significant way: third party websites
+ can become <I>channels</I> in our portal without having to make 'real' deals
+ and with a minimum of extra work. All they need to do is to publish an RDF,
+ so we can include their latest updates in our portal. Yet another easy way
+ to add content.
+ </P>
+ <P>
+ That in and of itself is interesting, but it's not half so interesting as
+ the fact that other sites can include our headlines as well. Anyone can
+ grab our RDF, anyone can parse it, and anyone can put a list of our
+ headlines. Yet another way to generate more traffic.
+ </P>
+
+ <H3>Features</H3>
+ <P>
+ One of the most important features (if not the most important) is
+ chaching support. To avoid bogging down other portals with a continous
+ stream of headline grabbing, all headlines are cached and refreshed once
+ in a while. The 'while' can be costumized but is set to 30 minutes by
+ default.
+ </P>
+ <P>
+ You can reset a channel, that is force to update a channels headlines
+ and you can add new channels. If you don't know what channel to add,
+ check <A HREF="http://www.xmltree.com/">http://www.xmltree.com/</A>.
+ Make sure you don't add anything except valid RDF files!
+ </P>
+
+ <H3>Status</H3>
+ <P>
+ The RDF parser is still in beta and needs proper integration in the engine.
+ Until then this test page generates nothing more then an overview off all
+ subscribed channels along with their headlines: handy for news squatting. ;)
+ </P>
+ <P>
+ RDF files are non-proprietary and publically available. Unfortunatly,
+ RDF is not the only standard: another commonly used format is RSS which
+ would be nice to support as well.
+ </P>
+ <HR>
+ <?
+}
+
+$theme->header();
+
+switch($op) {
+ case "reset":
+ $channel = new rdf();
+ $channel->resetChannel($id);
+ print "<H2>channel has been reset</H2>";
+ print "<A HREF=\"rdf.php\">back</A>";
+ break;
+ case "Add RDF channel":
+ $channel = new rdf();
+ $channel->addChannel($site, $url, $rdf);
+ // fall through:
+ default:
+ adminDisplayInfo();
+ adminDisplayAll();
+ adminAddChannel();
+}
+
+$theme->footer();
+
+?>
diff --git a/refer.php b/refer.php
new file mode 100644
index 0000000..9cee9e7
--- /dev/null
+++ b/refer.php
@@ -0,0 +1,171 @@
+<?
+
+### Include global settings:
+include "config.inc";
+
+include "functions.inc";
+include "authentication.inc";
+include "theme.inc";
+
+$theme->header();
+
+dbconnect();
+
+/*
+function addRefer($url) {
+ $query = "SELECT * FROM refer WHERE url = '$url'";
+ $result = mysql_query($query);
+
+ if ($site = mysql_fetch_object($result)) {
+ if ($site->status) {
+ $site->refers++;
+ $query = "UPDATE refer SET refers = '$site->refers', access_dt = '". time() ."' WHERE url = '$url'";
+ $result = mysql_query($query);
+ }
+ }
+ else {
+ $query = "INSERT INTO refer (url, name, refers, create_dt, access_dt) VALUES ('$url', '', '1', '". time() ."', '". time() ."')";
+ $result = mysql_query($query);
+ }
+}
+*/
+
+function blockRefer($url) {
+ $query = "UPDATE refer SET status = '0' WHERE url = '$url'";
+ $result = mysql_query($query);
+}
+
+function setReferName($url, $name) {
+ $query = "UPDATE refer SET name = '$name' WHERE url = '$url'";
+ $result = mysql_query($query);
+}
+
+function deleteRefer($url) {
+ $query = "DELETE FROM refer WHERE url = '$url'";
+ $result = mysql_query($query);
+}
+
+function openRefer($url) {
+ $query = "UPDATE refer SET status = '1' WHERE url = '$url'";
+ $result = mysql_query($query);
+}
+
+function getReferArray($number = "") {
+ if ($number) {
+ $query = "SELECT * FROM refer ORDER BY refers DESC LIMIT $number";
+ $result = mysql_query($query);
+ }
+ else {
+ $query = "SELECT * FROM refer ORDER BY refers DESC";
+ $result = mysql_query($query);
+ }
+
+ $index = 0;
+ while ($site = mysql_fetch_object($result)) {
+ $rval[$index] = $site;
+ $index++;
+ }
+ return $rval;
+}
+
+$info = "<P>If you are not familiar with \"top sites\"-lists: we use a script that keeps track of the number of visitor your website referred to our site and we rank you according to that number. This can be a good, free way of increasing your website traffic: it is our way to give a link back to referring sites. In order to take advantage of this feature, you have to do is to use the following code when linking to our site:</P><BR><CENTER><FONT COLOR=\"orange\"><CODE>&lt;A HREF=\"http://this-site.com/<B>?url=http://www.your-website.com/</B>\"&gt;&lt;IMG SRC=\"this-site-button.gif\"&gt;&lt/A&gt;</CODE></FONT></CENTER><BR><P>By using the above line of code you will automatically participate in our referring site program. Note however that it will only work if you applied to above code correctly, that is, make sure you don't forget the <I>?url=http://www.your-website.com/</I> part. The more visitors you refer, the higher your ranking.</P><P>The highest ranked sites will be automatically included in most (if not all) our pages!</P>\n";
+
+function referList($number = "", $detail = "0") {
+ $site = getReferArray($number);
+ $count = 1;
+
+ if ($detail) {
+ $rval .= "<TABLE CELLSPACING=\"2\" CELLPADDING=\"4\" WIDTH=\"100%\">\n";
+ $rval .= " <TR><TD><B>Rank</B></TD><TD><B>Referrals</B></TD><TD><B>URL or name</B></TD><TD NOWRAP><B>Last refer</B></TD></TR>\n";
+
+ for (reset($site); $entry = current($site); next($site)) {
+
+ $last = date("d/m/y - H:i:s", $entry->access_dt) ." &nbsp; <SMALL><I>(". round((time() - $entry->access_dt) / 86400) ." days ago)</I></SMALL>";
+
+ if ($entry->name) $rval .= " <TR><TD>$count</TD><TD>$entry->refers</TD><TD><A HREF=\"$entry->url\">$entry->name</A></TD><TD>$last</TD><TR>\n";
+ else $rval .= " <TR><TD>$count</TD><TD>$entry->refers</TD><TD><A HREF=\"$entry->url\">$entry->url</A></TD><TD>$last</TD></TR>\n";
+ $count++;
+ }
+ $rval .= "</TABLE>\n";
+ }
+ else {
+ for (reset($site); $entry = current($site); next($site)) {
+ if ($entry->name) $rval .= "$count. <A HREF=\"$entry->url\">$entry->name</A> ($entry->refers)<BR>";
+ else $rval .= "$count. <A HREF=\"$entry->url\">$entry->url</A> ($entry->refers)<BR>";
+ $count++;
+ }
+ }
+ return $rval;
+}
+
+function referAdmin($number = "") {
+ global $PHP_SELF, $bgcolor1, $bgcolor2;
+
+ $site = getReferArray($number);
+ $count = 1;
+ $rval .= "<TABLE CELLSPACING=\"2\" CELLPADDING=\"4\" WIDTH=\"100%\">\n";
+ $rval .= "<TR BGCOLOR=\"$bgcolor2\"><TD>#</TD><TD COLSPAN=\"2\">URL or name</TD><TD NOWRAP>First refer</TD><TD NOWRAP>Last refer</TD><TD>&nbsp;</TD><TD COLSPAN=\"3\">Commands</TD></TR>\n";
+
+ for (reset($site); $entry = current($site); next($site)) {
+ if ($entry->status) {
+ $delete = "delete";
+ $block = "<A HREF=\"$PHP_SELF?section=refer&method=block&url=$entry->url\">block</A>";
+ $status = "<FONT COLOR=\"orange\" SIZE=\"+2\">*</FONT>";
+ }
+ else {
+ $delete = "<A HREF=\"$PHP_SELF?section=refer&method=delete&url=$entry->url\">delete</A>";
+ $block = "<A HREF=\"$PHP_SELF?section=refer&method=open&url=$entry->url\">open</A>";
+ $status = "<FONT COLOR=\"red\" SIZE=\"+2\">*</FONT>";
+ }
+
+ $first = date("d/m/y - H:i:s", $entry->create_dt) ."<BR><FONT SIZE=\"-1\"><I>(". round((time() - $entry->create_dt) / 86400) ." days ago)</I></FONT>";
+ $last = date("d/m/y - H:i:s", $entry->access_dt) ."<BR><FONT SIZE=\"-1\"><I>(". round((time() - $entry->access_dt) / 86400) ." days ago)</I></FONT>";
+
+ if ($entry->name) $rval .= "<TR BGCOLOR=\"$bgcolor1\"><TD>$count</TD><TD><A HREF=\"$entry->url\">$entry->name</A></TD><TD>$entry->refers</TD><TD>$first</TD><TD>$last</TD><TD>$status</TD><TD>$block</TD><TD>$delete</TD><TD><A HREF=\"$PHP_SELF?section=refer&method=edit&url=$entry->url\">edit</A></TD></TR>";
+ else $rval .= "<TR BGCOLOR=\"$bgcolor1\"><TD>$count</TD><TD><A HREF=\"$entry->url\">$entry->url</A></TD><TD>$entry->refers</TD><TD>$first</TD><TD>$last</TD><TD>$status</TD><TD>$block</TD><TD>$delete</TD><TD><A HREF=\"$PHP_SELF?section=refer&method=edit&url=$entry->url\">edit</A></TD></TR>";
+ $count++;
+ }
+ $rval .= "</TABLE>\n";
+ return $rval;
+}
+
+/*
+### log valid refers:
+if (($url) && ($section != "refer") && (strstr(getenv("HTTP_REFERER"), $url))) {
+ addRefer($url);
+}
+*/
+
+### parse URI:
+if ($section == "refer") {
+ if ($admin) {
+ if ($method == "block") {
+ blockRefer($url);
+ print referAdmin();
+ }
+ else if ($method == "open") {
+ openRefer($url);
+ print referAdmin();
+ }
+ else if ($method == "delete") {
+ deleteRefer($url);
+ print referAdmin();
+ }
+ else if ($method == "edit") {
+ print "<FORM METHOD=\"post\" ACTION=\"$PHP_SELF?section=refer&method=update&url=$url\">\nEnter a description for $url:<BR><INPUT TYPE=\"text\" LENGTH=\"40\" NAME=\"name\">\n<INPUT TYPE=\"submit\" NAME=\"update\" VALUE=\"Update\">\n</FORM>";
+ }
+ else if ($method == "update") {
+ setReferName($url, $name);
+ print referAdmin();
+ }
+ else {
+ print referAdmin();
+ }
+ }
+}
+else {
+ $theme->box("Referring sites", "<P><U><A NAME=\"#refer-info\">Information:</A></U></P><P>$info</P><BR><BR><P><U><A NAME=\"#refer-more\">Complete list:</A></U></P>". referList("", 1));
+}
+
+$theme->footer();
+?>
diff --git a/search.php b/search.php
new file mode 100644
index 0000000..5d5c2c3
--- /dev/null
+++ b/search.php
@@ -0,0 +1,96 @@
+<?
+
+include "functions.inc";
+include "theme.inc";
+
+$theme->header();
+
+dbconnect();
+$terms = stripslashes($terms);
+
+?>
+
+<TABLE WIDTH="100%" BORDER="0">
+ <TR VALIGN="center">
+ <TD COLSPAN="3">
+ <FORM ACTION="<? print basename($GLOBALS[PHP_SELF]); ?>" METHOD="POST"><BR>
+ <INPUT SIZE="50" VALUE="<? print "$terms"; ?>" NAME="terms" TYPE="text"><BR>
+ <SELECT NAME="category">
+ <?
+ if ($category != "") print " <OPTION VALUE=\"$category\">$category</OPTION>";
+ print "<OPTION VALUE=\"\">All categories</OPTION>";
+ for ($i = 0; $i < sizeof($categories); $i++) {
+ print " <OPTION VALUE=\"$categories[$i]\">$categories[$i]";
+ }
+ ?>
+ </SELECT>
+ <SELECT NAME="author">
+ <?
+ $result = mysql_query("SELECT aid FROM authors ORDER BY aid");
+ if ($author != "") print " <OPTION VALUE=\"$author\">$author";
+ print " <OPTION VALUE=\"\">All authors";
+ while(list($authors) = mysql_fetch_row($result)) {
+ print " <OPTION VALUE=\"$authors\">$authors";
+ }
+ ?>
+ </SELECT>
+ <SELECT NAME="order">
+ <?
+ if ($order == "Oldest first") {
+ print "<OPTION VALUE=\"Oldest first\">Oldest first";
+ print "<OPTION VALUE=\"Newest first\">Newest first";
+ }
+ else {
+ print "<OPTION VALUE=\"Newest first\">Newest first";
+ print "<OPTION VALUE=\"Oldest first\">Oldest first";
+ }
+ ?>
+ </SELECT>
+ <INPUT TYPE="submit" VALUE="Search">
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <?
+ ### Compose query:
+ $query = "SELECT DISTINCT s.sid, s.aid, s.subject, s.time FROM stories s, authors a WHERE s.sid != 0 ";
+ // Note: s.sid is a dummy clause used to enforce the WHERE-tag.
+ if ($terms != "") $query .= "AND (s.subject LIKE '%$terms%' OR s.introtext LIKE '%$terms%') ";
+ if ($author != "") $query .= "AND s.aid = '$author' ";
+ if ($category != "") $query .= "AND s.category = '$category' ";
+ if ($order == "Oldest first") $query .= " ORDER BY s.time ASC";
+ else $query .= " ORDER BY s.time DESC";
+
+ ### Perform query:
+ $result = mysql_query("$query");
+
+ ### Display search results:
+ print "<HR>";
+ while (list($sid, $aid, $subject, $time) = mysql_fetch_row($result)) {
+ $num++;
+
+ if ($user) {
+ $link = "<A HREF=\"article.php?sid=$sid";
+ if (isset($cookie[4])) { $link .= "&mode=$cookie[4]"; } else { $link .= "&mode=threaded"; }
+ if (isset($cookie[5])) { $link .= "&order=$cookie[5]"; } else { $link .= "&order=0"; }
+ if (isset($cookie[6])) { $link .= "&thold=$cookie[6]"; } else { $link .= "&thold=0"; }
+ $link .= "\">$subject</A>";
+ }
+ else {
+ $link = "<A HREF=\"article.php?sid=$sid&mode=threaded&order=1&thold=0\">$subject</A>";
+ }
+
+ print "<P>$num) <B>$link</B><BR><SMALL>by <B><A HREF=\"account.php?op=userinfo&uname=$aid\">$aid</A></B>, posted on ". date("l, F d, Y - H:i A", $time) .".</SMALL></P>\n";
+ }
+
+ if ($num == 0) print "<P>Your search did <B>not</B> match any articles in our database: <UL><LI>Try using fewer words.</LI><LI>Try using more general keywords.</LI><LI>Try using different keywords.</LI></UL></P>";
+ else print "<P><B>$num</B> results matched your search query.</P>";
+ ?>
+
+ </TD>
+ </TR>
+</TABLE>
+
+<?
+ $theme->footer();
+?> \ No newline at end of file
diff --git a/submit.php b/submit.php
new file mode 100644
index 0000000..83db2ef
--- /dev/null
+++ b/submit.php
@@ -0,0 +1,175 @@
+<?PHP
+
+function defaultDisplay() {
+ include "functions.inc";
+ include "theme.inc";
+ $theme->header();
+
+ global $user, $cookie;
+ if (isset($user)) getusrinfo($user);
+
+ print "<FORM ACTION=\"submit.php\" METHOD=\"post\">";
+
+ print "<P>\n <B>Your name:</B><BR>";
+ if ($user) {
+ cookiedecode($user);
+ echo " <A HREF=\"account.php\">$cookie[1]</A> &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
+ } else {
+ echo "$anonymous &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"account.php\">login</A> | <A HREF=\"account.php\">create an account</A> ]</FONT>";
+ }
+ ?>
+
+ <P>
+ <B>Subject:</B><BR>
+ <INPUT TYPE="text" NAME="subject" SIZE="50"><BR>
+ <FONT SIZE="2"><I>Bad subjects are 'Check this out!' or 'An article'. Be descriptive, clear and simple!</I></FONT>
+ </P>
+
+ <P><B>Category:</B><BR>
+ <SELECT NAME="category">
+ <?PHP
+ for ($i = 0; $i < sizeof($categories); $i++) {
+ echo "<OPTION VALUE=\"$categories[$i]\">$categories[$i]\n";
+ }
+ ?>
+ </SELECT>
+ </P>
+
+ <P>
+ <B>Abstract:</B></I><BR>
+ <TEXTAREA WRAP="virtual" COLS="50" ROWS="8" NAME="abstract"></TEXTAREA><BR>
+ <FONT SIZE="2"><I>HTML is nice and dandy, but double check those URLs and HTML tags!</FONT>
+ </P>
+
+ <P>
+ <B>Extended story:</B></I><BR>
+ <TEXTAREA WRAP="virtual" COLS="50" ROWS="15" NAME="story"></TEXTAREA><BR>
+ <FONT SIZE="2"><I>HTML is nice and dandy, but double check those URLs and HTML tags!</FONT>
+ </P>
+
+ <P>
+ <INPUT TYPE="submit" NAME="op" VALUE="Preview story"> (You must preview at least once before you can submit.)
+ </P>
+
+ <P>
+ <FONT SIZE="2"><B>Important:</B> remember to include the exact URL of your <U>source</U> in case you refer to a story found on another website or your submission might be rejected!</FONT>
+ </P>
+
+ </FORM>
+ <?PHP
+ $theme->footer();
+}
+
+function PreviewStory($name, $address, $subject, $abstract, $story, $category) {
+ global $user, $cookie;
+ include "functions.inc";
+ include "theme.inc";
+ $theme->header();
+
+ print "<B>Preview:</B><BR>";
+ $theme->preview("", $cookie[1], date("l, F d, Y - H:i A", time()), stripslashes($subject), "we-hate-typoes", stripslashes($abstract), "", stripslashes($story));
+ print "<FORM ACTION=\"submit.php\" METHOD=\"post\">";
+
+ print "<P>\n <B>Your name:</B><BR>";
+ if ($user) {
+ cookiedecode($user);
+ echo " <A HREF=\"account.php\">$cookie[1]</A> &nbsp; &nbsp; <FONT SIZE=\"2\"> [ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
+ } else {
+ echo "$anonymous &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"$account.php\">login</A> | <A HREF=\"account.php\">create an account</A> ]</FONT>";
+ }
+ ?>
+
+ <P>
+ <B>Subject:</B><BR>
+ <INPUT TYPE="text" NAME="subject" SIZE="50" VALUE="<? print $subject; ?>"><BR>
+ <FONT SIZE="2"><I>Bad subjects are 'Check this out!' or 'An article'. Be descriptive, clear and simple!</I></FONT>
+ </P>
+
+ <P><B>Category:</B><BR>
+ <SELECT NAME="category">
+ <?PHP
+ for ($i = 0; $i < sizeof($categories); $i++) {
+ print "<OPTION VALUE=\"$categories[$i]\" ";
+ if ($category == $categories[$i]) print "SELECTED";
+ print ">$categories[$i]\n";
+ }
+ ?>
+ </SELECT>
+ </P>
+
+ <P>
+ <B>Abstract:</B></I><BR>
+ <TEXTAREA WRAP="virtual" COLS="50" ROWS="8" NAME="abstract"><? print $abstract; ?></TEXTAREA><BR>
+ <FONT SIZE="2"><I>HTML is nice and dandy, but double check those URLs and HTML tags!</FONT>
+ </P>
+
+ <P>
+ <B>Extended story:</B></I><BR>
+ <TEXTAREA WRAP="virtual" COLS="50" ROWS="15" NAME="story"><? print $story; ?></TEXTAREA><BR>
+ <FONT SIZE="2"><I>HTML is nice and dandy, but double check those URLs and HTML tags!</FONT>
+ </P>
+
+ <P>
+ <INPUT TYPE="submit" NAME="op" VALUE="Preview again"> <INPUT TYPE="submit" NAME="op" VALUE="Submit story">
+ </P>
+
+ <P>
+ <FONT SIZE="2"><B>Important:</B> remember to include the exact URL of your <U>source</U> in case you refer to a story found on another website or your submission might be rejected!</FONT>
+ </P>
+
+ </FORM>
+ <?PHP
+ $theme->footer();
+}
+
+function submitStory($name, $address, $subject, $abstract, $article, $category) {
+ global $user, $cookie;
+ include "functions.inc";
+
+ ### Display confirmation message:
+ include "theme.inc";
+ $theme->header();
+ $theme->box("Thanks for your submission.", "Thanks for your submission. The gnomes in our basement will frown at it, poke at it, and - if you are lucky - even post it!");
+ $theme->footer();
+
+ ### Add submission to queue:
+ dbconnect();
+ if ($user) {
+ cookiedecode($user);
+ $uid = $cookie[0];
+ $name = $cookie[1];
+ }
+ else {
+ $uid = -1;
+ $name = $anonymous;
+ }
+
+ $subject = stripslashes(FixQuotes(check_html($subject, "nohtml")));
+ $abstract = stripslashes(FixQuotes(check_html($abstract)));
+ $article = stripslashes(FixQuotes(check_html($article)));
+
+ $result = mysql_query("INSERT INTO queue VALUES (NULL, '$uid', '$name', '$subject', '$article', '". time() ."', '$category', '$abstract', 0, 0)");
+
+ ### Send notification mail (if required):
+ if ($notify) {
+ $message = "New submission:\n\nsubject...: $subject\nauthor....: $name\ncategory..: $category\nabstract..:\n$abstract\n\narticle...:\n$article";
+ mail($notify_email, "$notify_subject $subject", $message, "From: $notify_from\nX-Mailer: PHP/" . phpversion());
+ }
+}
+
+switch($op) {
+ case "Preview story":
+ PreviewStory($name, $address, $subject, $abstract, $story, $category);
+ break;
+ case "Preview again":
+ PreviewStory($name, $address, $subject, $abstract, $story, $category);
+ break;
+ case "Submit story":
+ SubmitStory($name, $address, $subject, $abstract, $story, $category);
+ break;
+ default:
+ defaultDisplay();
+ break;
+}
+
+?> \ No newline at end of file
diff --git a/theme.inc b/theme.inc
new file mode 100644
index 0000000..bd80914
--- /dev/null
+++ b/theme.inc
@@ -0,0 +1,7 @@
+<?
+ global $user;
+ if (isset($user)) $cookie = explode(":", base64_decode($user));
+ if (isset($cookie[9])) include "themes/$cookie[9]/theme.class";
+ else include "themes/default/theme.class";
+ $theme = new Theme();
+?> \ No newline at end of file
diff --git a/themes/index.php b/themes/index.php
new file mode 100644
index 0000000..9e8407c
--- /dev/null
+++ b/themes/index.php
@@ -0,0 +1 @@
+<A HREF="/">home</A> \ No newline at end of file
diff --git a/themes/jeroen/footer.php b/themes/jeroen/footer.php
new file mode 100644
index 0000000..a48c8b0
--- /dev/null
+++ b/themes/jeroen/footer.php
@@ -0,0 +1,45 @@
+ </TD>
+ <TD VALIGN="top" WIDTH="150">
+ <?
+ global $PHP_SELF;
+
+ if (strstr($PHP_SELF, "index.php")) {
+ global $user;
+
+ ### Display login box:
+ displayAccount();
+
+ ### Display voting poll:
+ displayPoll();
+
+ ### Display old headlines:
+ displayOldHeadlines();
+ }
+ elseif (strstr($PHP_SELF, "account.php")) {
+ ### Display account settings:
+ displayAccountSettings();
+ }
+ elseif (strstr($PHP_SELF, "article.php")) {
+ global $sid;
+
+ ### Display related links:
+ displayRelatedLinks($sid);
+
+ ### Display new headlines:
+ displayNewHeadlines();
+ }
+ else {
+ ### Display new headlines:
+ displayNewHeadlines();
+ }
+ ?>
+ </TD>
+ </TR>
+ <TR>
+ <TD ALIGN="center" COLSPAN="3">
+ <FONT SIZE="2">[ <A HREF="">home</A> | <A HREF="/faq.php"><IMG BORDER="0" SRC="themes/Jeroen/images/dropfaq.gif" ALT="Frequently Asked Questions"></A> | <A HREF="/search.php">search</A> | <A HREF="/submit.php">submit news</A> | <A HREF="/account.php">user account</A> | <A HREF="/webboard.php">webboard</A> ] </FONT>
+ </TD>
+ </TR>
+ </TABLE>
+</BODY>
+</HTML>
diff --git a/themes/jeroen/header.php b/themes/jeroen/header.php
new file mode 100644
index 0000000..b884c6d
--- /dev/null
+++ b/themes/jeroen/header.php
@@ -0,0 +1,29 @@
+<HTML>
+ <HEAD>
+ <TITLE><? include "config.inc"; echo $sitename; ?></TITLE>
+ <META NAME="description" CONTENT="geek-village: release your inner geek">
+ <META NAME="keywords" CONTENT="geek, nerd, weblog, portal, computer, sience, news, announcements, hype, cult, irc, foo, bar">
+ </HEAD>
+ <STYLE type="text/css">
+ <!--
+ BODY,TD,P,UL,LI,DIV,FORM,EM,BLOCKQUOTE { font-size: 8pt; font-family: verdana,helvetica,arial; }
+ -->
+ </STYLE>
+ <BODY TEXT="#000000" BGCOLOR="#FEFEFE" ALINK="#D5AE83" LINK="#CECECE" VLINK="#FEFEFE">
+ <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">
+ <TR>
+ <TD COLSPAN="3"><IMG SRC="images/logo.gif" ALT="drop.org logo"></TD>
+ </TR>
+ <TR><TD ALIGN="right" COLSPAN="3"><FONT SIZE="2"><A HREF="">home</A> | <A HREF="/faq.php"><IMG BORDER="0" SRC="themes/Jeroen/images/dropfaq.gif" ALT="Frequently Asked Questions"></A> | <A HREF="/search.php">search</A> | <A HREF="/submit.php">submit news</A> | <A HREF="/account.php">user account</A> | <A HREF="/webboard.php">webboard</A></FONT><HR></TD></TR>
+ <TR>
+ <TD VALIGN="top" WIDTH="120">
+ <?
+ dbconnect();
+
+ ### Display admin blocks:
+ displayAdminblock();
+
+ ### Display referring sites:
+ displayReferrals();
+ ?>
+ <TD VALIGN="top" WIDTH="440">
diff --git a/themes/jeroen/images/dropfaq.gif b/themes/jeroen/images/dropfaq.gif
new file mode 100644
index 0000000..9f890ea
--- /dev/null
+++ b/themes/jeroen/images/dropfaq.gif
Binary files differ
diff --git a/themes/jeroen/theme.class b/themes/jeroen/theme.class
new file mode 100644
index 0000000..abb1350
--- /dev/null
+++ b/themes/jeroen/theme.class
@@ -0,0 +1,304 @@
+<?
+
+ class Theme {
+ ### color set #1:
+ var $bgcolor1 = "blue"; // background color
+ var $fgcolor1 = "red"; // table body color
+ var $hlcolor1 = "#AAAAAA"; // high-light color
+
+ ### color set #2:
+ var $bgcolor2 = "#EEEEEE";
+ var $fgcolor2 = "#666699";
+ var $hlcolor2 = "#666699";
+
+ ### color set #3:
+ var $bgcolor3 = "#EEEEEE";
+ var $fgcolor3 = "yellow";
+ var $hlcolor3 = "yellow";
+
+ ######
+ # Syntax.......: header($title);
+ # Description..: a function to draw the page header.
+ function header($title) {
+ ?>
+ <HTML>
+ <HEAD>
+ <TITLE><? include "config.inc"; echo $sitename; ?></TITLE>
+ <META NAME="description" CONTENT="drop.org">
+ <META NAME="keywords" CONTENT="drop, weblog, portal, community, news, article, announcements, stories, story, computer, science, space, hype, cult, geek, nerd, foo, bar">
+ </HEAD>
+ <STYLE type="text/css">
+ <!--
+ BODY,TD,P,UL,LI,DIV,FORM,EM,BLOCKQUOTE { font-size: 8pt; font-family: verdana,helvetica,arial; }
+ -->
+ </STYLE>
+ <BODY TEXT="#000000" BGCOLOR="#FFFFFF" ALINK="#CCCCCC" LINK="#444444" VLINK="#666666">
+ <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">
+ <TR>
+ <TD COLSPAN="3"><IMG SRC="/themes/default/images/logo.gif" ALT="drop.org logo"></TD>
+ </TR>
+ <TR><TD ALIGN="right" COLSPAN="3"><FONT SIZE="2"><A HREF="">home</A> | <A HREF="/faq.php">faq</A> | <A HREF="/search.php">search</A> | <A HREF="/submit.php">submit news</A> | <A HREF="/account.php">user account</A> | <A HREF="/webboard.php">webboard</A></FONT><HR></TD></TR>
+ <TR>
+ <TD VALIGN="top" WIDTH="120">
+ <?
+ dbconnect();
+
+ ### Display admin blocks:
+ displayAdminblock($this);
+
+ ### Display referring sites:
+ displayReferrals($this);
+ ?>
+ </TD>
+ <TD VALIGN="top" WIDTH="440">
+ <?
+ }
+
+ ######
+ # Syntax.......: abstract(...);
+ # Description..: a function to draw an abstract story box, that is the
+ # boxes displayed on the main page.
+ function abstract($editor, $informant, $timestamp, $subject, $abstract, $comments, $category, $department, $link) {
+ $timestamp = date("l, F d, Y - h:i:s A", $timestamp);
+
+ include "config.inc";
+ ?>
+ <TABLE BORDER="0" CELLPADDING="4" WIDTH="100%">
+ <TR BGCOLOR="<? echo $this->bgcolor1; ?>"><TD COLSPAN="2"><FONT COLOR="<? echo $this->bgcolor2; ?>"><B><? echo $subject; ?></B></FONT></TD></TR>
+ <TR BGCOLOR="<? echo $this->bgcolor2; ?>">
+ <TD>
+ <?
+ if ($informant) {
+ print "<FONT SIZE=\"-1\">Posted by <A HREF=\"account.php?op=userinfo&uname=$informant\">$informant</A> on $timestamp"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT></TD><TD ALIGN=\"center\" WIDTH=\"80\"><B><A HREF=\"search.php?category=$category\"><FONT COLOR=\"#83997A\">$category</FONT></A></B>";
+ }
+ else {
+ print "<FONT SIZE=\"-1\">Posted by $anonymous on $timestamp"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT></TD><TD ALIGN=\"center\" WIDTH=\"80\"><A HREF=\"search.php?category=$category\">$category</A>";
+ }
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $this->bgcolor3; ?>">
+ <TD COLSPAN="2">
+ <?
+ if ($comments) {
+ echo "<P>$abstract</P><P><FONT COLOR=\"$this->bgcolor1\">Editor's note by <A HREF=\"account.php?op=userinfo&uname=$editor\">$editor</A>:</FONT> $comments</P>";
+ }
+ else {
+ echo $abstract;
+ }
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $this->bgcolor2; ?>"><TD ALIGN="right" COLSPAN="2"><? echo $link ?></TD></TR>
+ </TABLE><BR>
+ <?
+ }
+
+ ######
+ # Syntax.......: article(...);
+ # Description..: a function to dispay a complete article (without user
+ # comments). It's what you get when you followed for
+ # instance one of read-more links on the main page.
+ function article($editor, $informant, $timestamp, $subject, $department, $abstract, $comments, $article, $reply) {
+ $timestamp = date("l, F d, Y - h:i:s A", $timestamp);
+
+ include "config.inc";
+ ?>
+ <TABLE BORDER="0" CELLPADDING="4" WIDTH="100%">
+ <TR BGCOLOR="<? echo $this->bgcolor1; ?>"><TD><FONT COLOR="<? echo $this->bgcolor2; ?>"><B><? echo $subject; ?></B></FONT></TD></TR>
+ <TR BGCOLOR="<? echo $this->bgcolor2; ?>">
+ <TD>
+ <?
+ if ($informant) {
+ print "<FONT SIZE=\"-1\">Posted by <A HREF=\"account.php?op=userinfo&uname=$informant\">$informant</A> on $timestamp"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT>";
+ }
+ else {
+ print "<FONT SIZE=\"-1\">Posted by $anonymous on $timestamp"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT>";
+ }
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $this->bgcolor3; ?>">
+ <TD>
+ <?
+ if ($abstract) echo "<P>$abstract<P>";
+ if ($comments) echo "<P><FONT COLOR=\"$this->bgcolor1\">Editor's note by <A HREF=\"account.php?op=userinfo&uname=$editor\">$editor</A>:</FONT> $comments</P>";
+ if ($article) echo "<P>$article</P>";
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $this->bgcolor2; ?>"><TD ALIGN="right"><? echo "$reply"; ?></TD></TR>
+ </TABLE><BR>
+ <?
+ }
+
+ ######
+ # Syntax.......: comment(...);
+ # Description..: this function is used to theme user comments.
+ function comment($poster, $subject, $tid, $date, $url, $email, $score, $reason, $comment, $link, $thread = "") {
+ include "config.inc";
+
+ if (!eregi("[a-z0-9]",$poster)) $poster = $anonymous;
+ if (!eregi("[a-z0-9]",$subject)) $subject = "[no subject]";
+ echo "<A NAME=\"$tid\">";
+
+ ### Create comment header:
+ echo "<TABLE BORDER=\"0\" CELLPADDING=\"4\" CELLSPACING=\"2\" WIDTH=\"100%\">";
+ echo " <TR BGCOLOR=\"$this->bgcolor2\">";
+ echo " <TD>";
+ echo " <TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\"WIDTH=\"100%\">";
+
+ ### Subject:
+ echo " <TR>";
+ echo " <TD ALIGN=\"right\" WIDTH=\"5%\"><FONT COLOR=\"$this->bgcolor1\"><B>Subject:</B></FONT></TD><TD WIDTH=\"80%\">";
+ echo " <B><FONT COLOR=\"$this->bgcolor1\">$subject</FONT></B>";
+ echo " &nbsp; <FONT SIZE=\"2\"> [Score: $score";
+ if (isset($reason)) echo ", $comments_meta_reasons[$reason]";
+ echo "]</FONT>";
+ echo " </TD>";
+
+ ### Moderation:
+ echo " <TD ALIGN=\"right\" ROWSPAN=\"3\" VALIGN=\"middle\" WIDTH=\"15%\">";
+ echo " <SELECT NAME=\"meta:$tid\">";
+ echo " <OPTION VALUE=\"-1\">Moderate</OPTION>\n";
+ for ($i = 0; $i < sizeof($comments_meta_reasons); $i++) {
+ echo " <OPTION VALUE=\"$i\">$comments_meta_reasons[$i]</OPTION>\n";
+ }
+ echo " </SELECT>";
+ echo " </TD>";
+ echo " </TR>";
+
+ ### Author:
+ echo " <TR>";
+ echo " <TD ALIGN=\"right\" VALIGN=\"top\">Author:</TD><TD><B>$poster</B> ";
+ if ($poster != $anonymous) {
+ ### Display extra information line:
+ $info .= "<A HREF=\"account.php?op=userinfo&uname=$poster\">user info</A>";
+ if ($email) $info .= " | <A HREF=\"mailto:$email\">$email</A>";
+ if (eregi("http://",$url)) $info .= " | <A HREF=\"$url\" TARGET=\"_new\">$url</A>";
+ echo "<BR><FONT SIZE=\"2\">[ $info ]</FONT>";
+ }
+ echo " </TD>";
+ echo " </TR>";
+
+ ### Date
+ echo " <TR><TD ALIGN=\"right\">Date:</TD><TD>". formatTimestamp($date) ."</TD></TR>";
+
+ echo " </TABLE>";
+ echo " </TD>";
+ echo " </TR>";
+
+ ### Print body of comment:
+ if ($comment) echo " <TR><TD BGCOLOR=\"$this->bgcolor3\">$comment</TD></TR>";
+
+ ### Print thread (if any):
+ if ($thread) echo " <TR><TD BGCOLOR=\"$this->bgcolor2\">$thread</TD></TR>";
+
+ ### Print bottom link(s):
+ echo " <TR><TD ALIGN=\"right\" BGCOLOR=\"$this->bgcolor2\">[ $link ]</TD></TR>";
+ echo " </TABLE>";
+ }
+
+ ######
+ # Syntax.......: preview(...);
+ # Description..: this function is used to preview a story and is used at
+ # different parts of the homepage: when a visitors sumbits
+ # news, when an editor wants to post news, when people
+ # check the entries in the sumbission queue, etc.
+ function preview($editor, $informant, $timestamp, $subject, $department, $abstract, $comments, $article) {
+ include "config.inc";
+ ?>
+ <TABLE BORDER="0" CELLPADDING="4" WIDTH="100%">
+ <TR BGCOLOR="<? echo $this->bgcolor1; ?>"><TD><FONT COLOR="<? echo $this->bgcolor2; ?>"><B><? echo $subject; ?></B></FONT></TD></TR>
+ <TR BGCOLOR="<? echo $this->bgcolor2; ?>">
+ <TD>
+ <?
+ if ($informant) {
+ print "<FONT SIZE=\"-1\">Posted by <A HREF=\"account.php?op=userinfo&uname=$informant\">$informant</A> on $timestamp"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT>";
+ }
+ else {
+ print "<FONT SIZE=\"-1\">Posted by $anonymous on $timestamp"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT>";
+ }
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $this->bgcolor3; ?>">
+ <TD>
+ <?
+ if ($abstract) echo "<P>$abstract<P>";
+ if ($comments) echo "<P><FONT COLOR=\"$this->bgcolor1\">Editor's note by <A HREF=\"account.php?op=userinfo&uname=$editor\">$editor</A>:</FONT> $comments</P>";
+ if ($article) echo "<P>$article</P>";
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $this->bgcolor2; ?>"><TD ALIGN="right">&nbsp;</TD></TR>
+ </TABLE><BR>
+ <?
+ }
+
+ ######
+ # Syntax.......: box($title, $body);
+ # Description..: a function to draw a box/block.
+ function box($subject, $content) {
+ include "config.inc";
+ print "<TABLE BORDER=\"0\" CELLPADDING=\"3\" CELLSPACING=\"3\" WIDTH=\"100%\">";
+ print " <TR><TD ALIGN=\"center\" BGCOLOR=\"$this->bgcolor1\" WIDTH=\"100%\"><FONT COLOR=\"$this->fgcolor1\"><B>$subject</B></FONT></TD></TR>";
+ print " <TR><TD BGCOLOR=\"$this->bgcolor2\">$content</TD></TR>";
+ print "</TABLE><BR>";
+ }
+
+ ######
+ # Syntax.......: footer();
+ # Description..: a function to draw the page footer.
+ function footer() {
+ ?>
+ </TD>
+ <TD VALIGN="top" WIDTH="150">
+ <?
+ global $PHP_SELF;
+
+ if (strstr($PHP_SELF, "index.php")) {
+ global $user;
+
+ ### Display login box:
+ displayAccount($this);
+
+ ### Display voting poll:
+ displayPoll($this);
+
+ ### Display old headlines:
+ displayOldHeadlines($this);
+ }
+ elseif (strstr($PHP_SELF, "account.php")) {
+ ### Display account settings:
+ displayAccountSettings($this);
+ }
+ elseif (strstr($PHP_SELF, "article.php")) {
+ global $sid;
+
+ ### Display related links:
+ displayRelatedLinks($this, $sid);
+
+ ### Display new headlines:
+ displayNewHeadlines($this);
+ }
+ else {
+ ### Display new headlines:
+ displayNewHeadlines($this);
+ }
+ ?>
+ </TD>
+ </TR>
+ <TR>
+ <TD ALIGN="center" COLSPAN="3">
+ <FONT SIZE="2">[ <A HREF="">home</A> | <A HREF="/faq.php">faq</A> | <A HREF="/search.php">search</A> | <A HREF="/submit.php">submit news</A> | <A HREF="/account.php">user account</A> | <A HREF="/webboard.php">webboard</A> ] </FONT>
+ </TD>
+ </TR>
+ </TABLE>
+ </BODY>
+ </HTML>
+ <?
+ }
+ }
+
+?>
diff --git a/themes/jeroen/theme.php b/themes/jeroen/theme.php
new file mode 100644
index 0000000..c6645bc
--- /dev/null
+++ b/themes/jeroen/theme.php
@@ -0,0 +1,119 @@
+<?php
+$bgcolor1 = "#CECECE";
+$bgcolor2 = "#486591";
+$bgcolor3 = "#CECECE";
+
+function themeindex($editor, $informant, $datetime, $subject, $abstract, $comments, $category, $department, $link) {
+ global $bgcolor1, $bgcolor2, $bgcolor3;
+
+ $datetime = date("l, F d, Y - h:i:s A", $datetime);
+
+ include "config.inc";
+ ?>
+ <TABLE BORDER="0" CELLPADDING="4" WIDTH="100%">
+ <TR BGCOLOR="<? echo $bgcolor1; ?>"><TD COLSPAN="2"><FONT COLOR="<? echo $bgcolor2; ?>"><B><? echo $subject; ?></B></FONT></TD></TR>
+ <TR BGCOLOR="<? echo $bgcolor2; ?>">
+ <TD>
+ <?
+ if ($informant) {
+ print "<FONT SIZE=\"-1\">Posted by <A HREF=\"account.php?op=userinfo&uname=$informant\">$informant</A> on $datetime"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT></TD><TD ALIGN=\"center\" WIDTH=\"80\"><A HREF=\"search.php?category=$category\">$category</A>";
+ }
+ else {
+ print "<FONT SIZE=\"-1\">Posted by $anonymous on $datetime"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT></TD><TD ALIGN=\"center\" WIDTH=\"80\"><A HREF=\"search.php?category=$category\">$category</A>";
+ }
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $bgcolor3; ?>">
+ <TD COLSPAN="2">
+ <?
+ if ($comments) {
+ echo "<P>$abstract</P><P><FONT COLOR=\"$bgcolor1\">Editor's note by <A HREF=\"account.php?op=userinfo&uname=$editor\">$editor</A>:</FONT> $comments</P>";
+ }
+ else {
+ echo $abstract;
+ }
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $bgcolor2; ?>"><TD ALIGN="right" COLSPAN="2"><? echo $link ?></TD></TR>
+ </TABLE><BR>
+ <?
+}
+
+function themearticle($editor, $informant, $datetime, $subject, $department, $abstract, $comments, $article, $reply) {
+ global $bgcolor1, $bgcolor2, $bgcolor3;
+
+ $datetime = date("l, F d, Y - h:i:s A", $datetime);
+
+ include "config.inc";
+ ?>
+ <TABLE BORDER="0" CELLPADDING="4" WIDTH="100%">
+ <TR BGCOLOR="<? echo $bgcolor1; ?>"><TD><FONT COLOR="<? echo $bgcolor2; ?>"><B><? echo $subject; ?></B></FONT></TD></TR>
+ <TR BGCOLOR="<? echo $bgcolor2; ?>">
+ <TD>
+ <?
+ if ($informant) {
+ print "<FONT SIZE=\"-1\">Posted by <A HREF=\"account.php?op=userinfo&uname=$informant\">$informant</A> on $datetime"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT>";
+ }
+ else {
+ print "<FONT SIZE=\"-1\">Posted by $anonymous on $datetime"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT>";
+ }
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $bgcolor3; ?>">
+ <TD>
+ <?
+ if ($abstract) echo "<P>$abstract<P>";
+ if ($comments) echo "<P><FONT COLOR=\"$bgcolor1\">Editor's note by <A HREF=\"account.php?op=userinfo&uname=$editor\">$editor</A>:</FONT> $comments</P>";
+ if ($article) echo "<P>$article</P>";
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $bgcolor2; ?>"><TD ALIGN="right"><? echo "$reply"; ?></TD></TR>
+ </TABLE><BR>
+ <?
+}
+
+function themepreview($editor, $informant, $datetime, $subject, $department, $abstract, $comments, $article) {
+ global $bgcolor1, $bgcolor2, $bgcolor3;
+ include "config.inc";
+ ?>
+ <TABLE BORDER="0" CELLPADDING="4" WIDTH="100%">
+ <TR BGCOLOR="<? echo $bgcolor1; ?>"><TD><FONT COLOR="<? echo $bgcolor2; ?>"><B><? echo $subject; ?></B></FONT></TD></TR>
+ <TR BGCOLOR="<? echo $bgcolor2; ?>">
+ <TD>
+ <?
+ if ($informant) {
+ print "<FONT SIZE=\"-1\">Posted by <A HREF=\"account.php?op=userinfo&uname=$informant\">$informant</A> on $datetime"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT>";
+ }
+ else {
+ print "<FONT SIZE=\"-1\">Posted by $anonymous on $datetime"; ?><? if ($department) echo "<BR>from the $department dept."; ?><? print "</FONT>";
+ }
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $bgcolor3; ?>">
+ <TD>
+ <?
+ if ($abstract) echo "<P>$abstract<P>";
+ if ($comments) echo "<P><FONT COLOR=\"$bgcolor1\">Editor's note by <A HREF=\"account.php?op=userinfo&uname=$editor\">$editor</A>:</FONT> $comments</P>";
+ if ($article) echo "<P>$article</P>";
+ ?>
+ </TD>
+ </TR>
+ <TR BGCOLOR="<? echo $bgcolor2; ?>"><TD ALIGN="right">&nbsp;</TD></TR>
+ </TABLE><BR>
+ <?
+}
+
+function themebox($subject, $content) {
+ global $bgcolor1, $bgcolor2, $bgcolor3;
+ include "config.inc";
+ print "<TABLE BORDER=\"0\" CELLPADDING=\"3\" CELLSPACING=\"3\" WIDTH=\"100%\">";
+ print " <TR><TD ALIGN=\"center\" BGCOLOR=\"$bgcolor1\"><FONT COLOR=\"$bgcolor2\"><B>$subject</B></FONT></TD></TR>";
+ print " <TR><TD BGCOLOR=\"$bgcolor2\">$content</TD></TR>";
+ print "</TABLE><BR>";
+}
+?> \ No newline at end of file
diff --git a/themes/list.php b/themes/list.php
new file mode 100644
index 0000000..99ad96a
--- /dev/null
+++ b/themes/list.php
@@ -0,0 +1,7 @@
+<?php
+ $handle=opendir('themes');
+ while ($file = readdir($handle)) {
+ if(!ereg("[.]",$file)) $themelist .= "$file ";
+ }
+ closedir($handle);
+?> \ No newline at end of file
diff --git a/update.txt b/update.txt
new file mode 100644
index 0000000..cddfb91
--- /dev/null
+++ b/update.txt
@@ -0,0 +1,2 @@
+This tarball has been created on:
+Thu May 18 20:30:40 CEST 2000
diff --git a/webboard.php b/webboard.php
new file mode 100644
index 0000000..8820e45
--- /dev/null
+++ b/webboard.php
@@ -0,0 +1,545 @@
+<?
+
+include "functions.inc";
+include "theme.inc";
+
+$theme->header();
+
+### parameters:
+$timeout = 70000;
+$width = "100%";
+
+#####
+# Syntax.......: text2html(number);
+# Description..: Converst ascii text into HTML.
+#
+function text2html($text) {
+ return nl2br(stripslashes(trim($text)));
+}
+
+function displayThread($id, $current = 0) {
+ global $PHP_SELF, $timeout, $new, $theme;
+
+ $query = "SELECT * FROM webboard WHERE topic_id = $id";
+ $result = mysql_query($query);
+
+ if (mysql_num_rows($result)) {
+ ### fields from MySQL table:
+ $author = text2html(mysql_result($result, 0, "author"));
+ $subject = text2html(mysql_result($result, 0, "subject"));
+ $create_dt = mysql_result($result, 0, "create_dt");
+ $date = date("D, M d - H:i:s", $create_dt);
+
+ ### highlight current post:
+ if ($id == $current) print "<FONT COLOR=\"$theme->hlcolor2\">";
+
+ print "<UL>\n";
+
+ ### indicate new post:
+ if (time() - $create_dt > $timeout) print " <LI><A HREF=\"$PHP_SELF?display=$id\">$subject</A> by <B>$author</B> ($date)</LI>\n";
+ else print " <LI><A HREF=\"$PHP_SELF?display=$id\">$subject</A> by <B>$author</B> ($date) &nbsp; <FONT COLOR=\"$theme->hlcolor2\">new</FONT></LI>\n";
+
+ ### highlight current post:
+ if ($id == $current) print "</FONT>";
+ }
+
+ $query = "SELECT DISTINCT topic_id FROM webboard WHERE parent_id = $id ORDER BY create_dt ASC";
+ $result = mysql_query($query);
+
+ ### recursive call to process childeren:
+ while ($row = mysql_fetch_object($result)) displayThread($row->topic_id, $current);
+
+ print "</UL>\n";
+}
+
+
+#####
+# Syntax.......: displayThreadedOverview(id)
+# Description..: Displays all 'child'-posts of the 'root'-post specified by
+# start_id. The posts are displayed in a typical threaded
+# style.
+#
+function displayThreadedOverview($id = 0) {
+ global $PHP_SELF, $active, $timeout, $new, $width, $theme;
+
+
+ $current = getCurrentPosts();
+ $total = getTotalPosts();
+
+ $query = "SELECT DISTINCT root_id FROM webboard WHERE parent_id = $id ORDER BY create_dt DESC";
+ $result = mysql_query($query);
+
+ print "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"4\" WIDTH=\"$width\">\n";
+ print " <TR BGCOLOR=\"$theme->bgcolor1\"><TD>\n";
+ print " <TABLE BORDER=\"0\" CELLPADDING=\"4\" WIDTH=\"100%\">\n";
+ print " <TR>\n";
+ print " <TD ALIGN=\"left\"><FONT COLOR=\"$theme->fgcolor1\" SIZE=\"+1\"><B>Threaded overview</B></FONT></TD>\n";
+ print " <TD ALIGN=\"right\">[ <A NAME=\"top\"><A HREF=\"#post\"><FONT COLOR=\"$theme->hlcolor1\">post</FONT></A></A> | <A HREF=\"$PHP_SELF?threaded=0\"><FONT COLOR=\"$theme->hlcolor1\">chronological</FONT></A> ]</FONT></TD>\n";
+ print " </TR>\n";
+ print " </TABLE>\n";
+ print " </TD></TR>\n";
+
+ while ($row = mysql_fetch_object($result)) {
+ print " <TR><TD BGCOLOR=\"$theme->bgcolor2\">\n";
+ displayThread($row->root_id);
+ print " </TD></TR>\n";
+ }
+
+ print " <TR BGCOLOR=\"$theme->bgcolor1\"><TD>\n";
+ print " <TABLE BORDER=\"0\" CELLPADDING=\"4\" WIDTH=\"100%\">\n";
+ print " <TR>\n";
+ print " <TD ALIGN=\"left\"><FONT COLOR=\"$theme->fgcolor1\"[ <A HREF=\"javascript: history.back()\"><FONT COLOR=\"$theme->hlcolor1\">back</FONT></A> | <A HREF=\"/\"><FONT COLOR=\"$theme->hlcolor1\">home</FONT></A> | <A NAME=\"post\"><A HREF=\"#top\"><FONT COLOR=\"$theme->hlcolor1\">top</FONT></A></A> ]</FONT></TD>\n";
+ print " <TD ALIGN=\"center\"><FONT COLOR=\"$theme->fgcolor1\">[ current: $current | total: $total ]</FONT></TD>\n";
+ print " <TD ALIGN=\"right\"><FONT COLOR=\"$theme->fgcolor1\">[ <A HREF=\"$PHP_SELF?threaded=0\"><FONT COLOR=\"$theme->hlcolor1\">chronological</FONT></A> | <A HREF=\"$PHP_SELF?threaded=1\"><FONT COLOR=\"$theme->hlcolor1\">threaded</FONT></A> ]</FONT></TD>\n";
+ print " </TR>\n";
+ print " </TABLE>\n";
+ print " </TD></TR>\n";
+ print "</TABLE>\n";
+}
+
+
+#####
+# Syntax.......: displayChronologicalOverview
+# Description..: Displays all 'child'-posts of the 'root'-post specified by
+# start_id. The posts are displayed chronological in a
+# typical mailing-list alike style.
+#
+function displayChronologicalOverview($id = 0) {
+ global $PHP_SELF, $theme, $timeout, $width;
+
+ $query = "SELECT DISTINCT topic_id, subject, message, author, create_dt FROM webboard ORDER BY create_dt DESC";
+ $result = mysql_query($query);
+
+ $current = getCurrentPosts();
+ $total = getTotalPosts();
+
+ print "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"4\" WIDTH=\"$width\">\n";
+ print " <TR BGCOLOR=\"$theme->bgcolor1\"><TD COLSPAN=\"3\">\n";
+ print " <TABLE BORDER=\"0\" CELLPADDING=\"4\" WIDTH=\"100%\">\n";
+ print " <TR>\n";
+ print " <TD ALIGN=\"left\"><FONT COLOR=\"$theme->fgcolor1\" SIZE=\"+1\"><B>Chronological overview</B></FONT></TD>\n";
+ print " <TD ALIGN=\"right\"><FONT COLOR=\"$theme->fgcolor1\"[ <A NAME=\"top\"><A HREF=\"#post\"><FONT COLOR=\"$theme->hlcolor1\">post</FONT></A></A> | <A HREF=\"$PHP_SELF?threaded=1\"><FONT COLOR=\"$theme->hlcolor1\">threaded</FONT></A> ]</FONT></TD>\n";
+ print " </TR>\n";
+ print " </TABLE>\n";
+ print " </TD></TR>\n";
+
+ while ($row = mysql_fetch_row($result)) {
+ list($topic_id, $subject, $message, $author, $create_dt) = $row;
+ $subject = text2html($subject);
+ $author = text2html($author);
+ $date = date("d/m/y - h:i:s", $create_dt);
+
+ ### indicate new post:
+ if (time() - $create_dt > $timeout) print "<TR><TD BGCOLOR=\"$theme->bgcolor2\"><A HREF=\"$PHP_SELF?display=$topic_id\">$subject</A></TD><TD BGCOLOR=\"$theme->bgcolor2\">$author</TD><TD BGCOLOR=\"$theme->bgcolor2\" NOWRAP>$date</TD><TD></TD></TR>\n";
+ else print "<TR><TD BGCOLOR=\"$theme->bgcolor2\"><A HREF=\"$PHP_SELF?display=$topic_id\">$subject</A></TD><TD BGCOLOR=\"$$theme->bgcolor2\">$author</TD><TD BGCOLOR=\"$theme->bgcolor2\" NOWRAP>$date</TD><TD><FONT COLOR=\"$theme->hlcolor2\">new</FONT></TD></TR>\n";
+ }
+
+ print " <TR BGCOLOR=\"$theme->bgcolor1\"><TD COLSPAN=\"3\">\n";
+ print " <TABLE BORDER=\"0\" CELLPADDING=\"4\" WIDTH=\"100%\">\n";
+ print " <TR>\n";
+ print " <TD ALIGN=\"left\"><FONT COLOR=\"$theme->fgcolor1\"[ <A HREF=\"javascript: history.back()\"><FONT COLOR=\"$theme->hlcolor1\">back</FONT></A> | <A HREF=\"/\"><FONT COLOR=\"$theme->hlcolor1\">home</FONT></A> | <A NAME=\"post\"><A HREF=\"#top\"><FONT COLOR=\"$theme->hlcolor1\">top</FONT></A></A> ]</FONT></TD>\n";
+ print " <TD ALIGN=\"center\"><FONT COLOR=\"$theme->fgcolor1\"[ current: $current | total: $total ]</FONT></TD>\n";
+ print " <TD ALIGN=\"right\"><FONT COLOR=\"$theme->fgcolor1\"[ <A HREF=\"$PHP_SELF?threaded=0\"><FONT COLOR=\"$theme->hlcolor1\">chronological</FONT></A> | <A HREF=\"$PHP_SELF?threaded=1\"><FONT COLOR=\"$theme->hlcolor1\">threaded</FONT></A> ]</FONT></TD>\n";
+ print " </TR>\n";
+ print " </TABLE>\n";
+ print " </TD></TR>\n";
+ print "</TABLE>\n";
+}
+
+#####
+# Syntax.......: getRecentThreads
+# Description..:
+#
+function getRecentThreads($number = 5, $filename = "webboard.php") {
+ global $timeout, $theme;
+
+ $query = "SELECT * FROM webboard WHERE parent_id = 0 ORDER BY create_dt DESC LIMIT $number";
+ $result = mysql_query($query);
+
+ $rval = "<UL>\n";
+
+ while ($object = mysql_fetch_object($result)) {
+ ### fields from MySQL table:
+ $topic_id = $object->topic_id;
+ $author = text2html($object->author);
+ $subject = text2html($object->subject);
+ $create_dt = $object->create_dt;
+ $date = date("d/m/y - h:i:s", $create_dt);
+ $size = getThreadSize($object->topic_id);
+
+ ### indicate new post:
+ if (time() - $create_dt > $timeout) $rval .= " <LI><A HREF=\"$filename?display=$topic_id\">$subject</A> by <B>$author</B> ($date) [$size]</LI>\n";
+ else $rval .= " <LI><A HREF=\"$filename?display=$topic_id\">$subject</A> by <B>$author</B> ($date) [$size] &nbsp; <FONT COLOR=\"$theme->hlcolor2\">new</FONT></LI>\n";
+ }
+
+ $rval .= "</UL>\n";
+
+ return $rval;
+}
+
+#####
+# Syntax.......:
+# Description..:
+#
+function displayAdminOverview($id = 0) {
+ global $PHP_SELF;
+
+ $query = "SELECT DISTINCT t.topic_id, t.parent_id, t.root_id, t.subject, t.message, t.author, t.hostname, t.create_dt FROM webboard t, webboard r WHERE t.parent_id = $id ORDER BY create_dt DESC";
+ $result = mysql_query($query);
+
+ print "<UL>\n";
+ while ($row = mysql_fetch_row($result)) {
+ list($topic_id, $parent_id, $root_id, $subject, $message, $author, $hostname, $create_dt) = $row;
+ $date = date("D, M d - H:i:s", $create_dt);
+ print " <LI><INPUT TYPE=\"checkbox\" NAME=\"delete\" VALUE=\"$topic_id\"> <A HREF=\"$PHP_SELF?display=$topic_id\">$subject</A> by <B>$author</B> ($date)\n";
+ displayAdminOverview($topic_id);
+ }
+ print "</UL>\n";
+}
+
+#####
+# Syntax.......: displayMessage(id)
+# Description..:
+#
+function displayMessage($id = 0) {
+ global $PHP_SELF, $theme, $width;
+
+ $query = "SELECT * FROM webboard WHERE topic_id = $id";
+ $result = mysql_query($query);
+
+ if (mysql_num_rows($result)) {
+ ### fields from MySQL table:
+ $author = text2html(mysql_result($result, 0, "author"));
+ $subject = text2html(mysql_result($result, 0, "subject"));
+ $message = text2html(mysql_result($result, 0, "message"));
+ $hostname = text2html(mysql_result($result, 0, "hostname"));
+ $date = date("l, F d - h:i:s A", mysql_result($result, 0, "create_dt"));
+ $topic_id = mysql_result($result, 0, "topic_id");
+ $root_id = mysql_result($result, 0, "root_id");
+
+ ### previous and next posts:
+ $prev_msg = getPrevPost($topic_id);
+ $next_msg = getNextPost($topic_id);
+
+ ### previous and next threads:
+ $next_thread = getNextThread($root_id);
+ $prev_thread = getPrevThread($root_id);
+
+ ### generate output table:
+ print "<TABLE BORDER=\"0\" CELLPADDING=\"4\" WIDTH=\"$width\">\n";
+ print " <TR BGCOLOR=\"$theme->bgcolor1\"><TD COLSPAN=\"2\"><TABLE BORDER=\"0\" WIDTH=\"100%\"><TR><TD><FONT COLOR=\"$theme->fgcolor1\"><A NAME=\"top\">Current message</A></FONT></TD><TD ALIGN=\"right\"><FONT COLOR=\"$theme->fgcolor1\">[ <A HREF=\"$PHP_SELF?display=$prev_msg\"><FONT COLOR=\"$theme->hlcolor1\">previous message</FONT></A> | <A HREF=\"$PHP_SELF?display=$next_msg\"><FONT COLOR=\"$theme->hlcolor1\">next message</FONT></A> ]</FONT></TD></TR></TABLE></TD></TR>\n";
+ print " <TR BGCOLOR=\"$theme->bgcolor2\"><TD COLSPAN=\"2\">Subject: <B>$subject</B></TD></TR>\n";
+ print " <TR BGCOLOR=\"$theme->bgcolor2\"><TD><FONT COLOR=\"$theme->hlcolor2\">by <B>$author</B> on $date</FONT></TD><TD ALIGN=\"right\">Hostname/IP: $hostname</TD></TR>\n";
+ print " <TR BGCOLOR=\"$theme->bgcolor2\"><TD COLSPAN=\"2\">$message</TD></TR>\n";
+ print " <TR><TD COLSPAN=\"2\"></TD></TR>\n";
+ print " <TR BGCOLOR=\"$theme->bgcolor1\"><TD COLSPAN=\"2\"><TABLE BORDER=\"0\" WIDTH=\"100%\"><TR><TD><FONT COLOR=\"$theme->fgcolor1\">Current thread</FONT></TD><TD ALIGN=\"right\"><FONT COLOR=\"$theme->fgcolor1\">[ <A HREF=\"$PHP_SELF?display=$prev_thread\"><FONT COLOR=\"$theme->hlcolor1\">previous thread</FONT></A> | <A HREF=\"$PHP_SELF?display=$next_thread\"><FONT COLOR=\"$theme->hlcolor1\">next thread</FONT></A> ]</FONT></TD></TR></TABLE></TD></TR>\n";
+ print " <TR BGCOLOR=\"$theme->bgcolor2\"><TD COLSPAN=\"2\">\n";
+ displayThread($root_id, $id);
+ print " </TD></TR>\n";
+ print " <TR BGCOLOR=\"$theme->bgcolor2\"><TD COLSPAN=\"2\"></TD></TR>\n";
+ print " <TR BGCOLOR=\"$theme->bgcolor1\"><TD COLSPAN=\"2\">\n";
+ print " <TABLE BORDER=\"0\" CELLPADDING=\"4\" WIDTH=\"100%\">\n";
+ print " <TR>\n";
+ print " <TD ALIGN=\"left\"><FONT COLOR=\"$theme->fgcolor1\">[ <A HREF=\"javascript: history.back()\"><FONT COLOR=\"$theme->hlcolor1\">back</FONT></A> | <A HREF=\"/\"><FONT COLOR=\"$theme->hlcolor1\">home</FONT></A> | <A HREF=\"#top\"><FONT COLOR=\"$theme->hlcolor1\">top</FONT></A> ]</FONT></TD>\n";
+ print " <TD ALIGN=\"center\">&nbsp;</TD>\n";
+ print " <TD ALIGN=\"right\"><FONT COLOR=\"$theme->fgcolor1\">[ <A HREF=\"$PHP_SELF?threaded=0\"><FONT COLOR=\"$theme->hlcolor1\">chronological</FONT></A> | <A HREF=\"$PHP_SELF?threaded=1\"><FONT COLOR=\"$theme->fgcolor1\">threaded</FONT></A> ]</FONT></TD>\n";
+ print " </TR>\n";
+ print " </TABLE>\n";
+ print " </TD></TR>\n";
+ print "</TABLE>\n";
+ print "<BR><BR>\n";
+ }
+ else {
+ print "<P><B>Error:</B> no such message in database. The message you are looking for might have expired and does no longer exsist, or might have been explicitly removed by the webboard administrator.</P>";
+ }
+}
+
+#####
+# Syntax.......: printForm(id)
+# Description..:
+#
+function printForm($id = 0, $author = "", $signature = "") {
+ global $PHP_SELF;
+
+ ### initialize variables:
+ $parent_id = 0;
+ $root_id = 0;
+
+ if ($id) {
+ $query = "SELECT * FROM webboard WHERE topic_id = $id";
+ $result = mysql_query($query);
+
+ if (mysql_num_rows($result)) {
+ ### fields from MySQL table:
+ $subject = text2html(mysql_result($result, 0, "subject"));
+ $subject = "Re: $subject";
+ $parent_id = $id;
+ $root_id = mysql_result($result, 0, "root_id");
+ }
+ }
+
+ print "<FORM METHOD=\"post\" ACTION=\"$PHP_SELF?post\">\n";
+ print " <TABLE BORDER=\"0\" CELLSPACING=\"10\">\n";
+ print " <TR><TD ALIGN=\"right\" VALIGN=\"top\">Author:</TD><TD>$author</TD></TR>\n";
+ print " <TR><TD ALIGN=\"right\" VALIGN=\"top\">Subject:</TD><TD><INPUT TYPE=\"text\" NAME=\"subject\" MAXLENGTH=\"75\" SIZE=\"50\" VALUE=\"$subject\"></TD></TR>\n";
+ print " <TR><TD ALIGN=\"right\" VALIGN=\"top\">Message:</TD><TD><TEXTAREA NAME=\"message\" COLS=\"45\" ROWS=\"10\" WRAP=\"virtual\">$signature</TEXTAREA></TR>\n";
+ print " <TR>\n";
+ print " <TD ALIGN=\"center\" COLSPAN=\"2\">\n";
+ print " <INPUT TYPE=\"hidden\" NAME=\"author\" VALUE=\"$author\">\n";
+ print " <INPUT TYPE=\"hidden\" NAME=\"parent_id\" VALUE=\"$parent_id\">\n";
+ print " <INPUT TYPE=\"hidden\" NAME=\"root_id\" VALUE=\"$root_id\">\n";
+ print " <INPUT TYPE=\"submit\" NAME=\"post\" VALUE=\"Post message\">\n";
+ print " </TD>\n";
+ print " </TR>\n";
+ print " </TABLE>\n";
+ print "</FORM>\n";
+}
+
+/*
+#####
+# Syntax.......: fixQuotes(text)
+# Description..:
+#
+function fixQuotes ($what = "") {
+ $what = ereg_replace("'","''",$what);
+ $counter = 0;
+ while (eregi("\\\\'", $what) && $counter < 10) { $what = ereg_replace("\\\\'","'",$what); }
+ return $what;
+}
+*/
+
+#####
+# Syntax.......: postMessage(subject, author, message, parent_id, root_id, html_tags)
+# Description..:
+#
+function postMessage ($subject="[no subject]", $author = "Anonymous Chicken", $message, $parent_id = 0, $root_id = 0, $html_tags = "0") {
+
+ if ($html_tags) {
+ $subject = fixQuotes($subject);
+ $message = fixQuotes($message);
+ $author = fixQuotes($author);
+ $date = time();
+ }
+ else {
+ $subject = fixQuotes(strip_tags($subject));
+ $message = fixQuotes(strip_tags($message));
+ $author = fixQuotes(strip_tags($author));
+ $date = time();
+ }
+
+ ### [NT]-feature:
+ if (!$message) $subject .= "&nbsp; [NT]";
+
+ ### 'Anonymous Chicken'-feature:
+ if (!$author) $author = "Anonymous Chicken";
+
+ ### insert new post:
+ $query = "INSERT INTO webboard (subject, message, parent_id, root_id, author, hostname, create_dt) VALUES ('$subject', '$message', $parent_id, $root_id, '$author', '".getenv("REMOTE_ADDR")."', $date)";
+
+ $result = mysql_query($query);
+
+ if (!$result) {
+ print "<P><B>Error:</B> failed to perform query!</P>\n";
+ }
+
+ $result = mysql_query("select last_insert_id()");
+ list($topic_id) = mysql_fetch_array($result);
+
+ if (isset($topic_id) && ($topic_id > 0)) {
+ if ($root_id == 0) {
+ $root_id = $topic_id;
+ mysql_query("UPDATE webboard SET root_id=$topic_id WHERE topic_id = $topic_id AND root_id=0");
+ }
+ }
+ else {
+ print "<P><B>Error:</B> failed to perform query!</P>\n";
+ }
+
+ return $topic_id;
+}
+
+#####
+# Syntax.......: getTotalPosts()
+# Description..: Returns the total number of posts that have passed the
+# weboard.
+#
+function getTotalPosts() {
+ $query = "SELECT MAX(topic_id) FROM webboard";
+ $result = mysql_query($query);
+ if ($result) return mysql_result($result, 0);
+}
+
+
+function getThreadSize($id) {
+ $query = "SELECT * FROM webboard WHERE parent_id = $id";
+ $result = mysql_query($query);
+ $size = 1;
+ while ($thread = mysql_fetch_object($result)) {
+ $size += getThreadSize($thread->topic_id);
+ }
+ return $size;
+}
+
+#####
+# Syntax.......: getNextPost()
+# Description..: Returns the next post.
+#
+function getNextPost($id) {
+ ### Resolve root_id of $id:
+ $query = "SELECT root_id FROM webboard WHERE topic_id = $id";
+ $result = mysql_query($query);
+ $root_id = mysql_result($result, 0);
+
+ ### Resolve next message:
+ $query = "SELECT topic_id FROM webboard WHERE root_id = $root_id AND topic_id > $id ORDER BY create_dt";
+ $result = mysql_query($query);
+ if (mysql_num_rows($result)) return mysql_result($result, 0);
+ else return 0;
+}
+
+#####
+# Syntax.......: getPrevPost()
+# Description..: Returns the next post.
+#
+function getPrevPost($id) {
+ ### Resolve root_id of $id:
+ $query = "SELECT root_id FROM webboard WHERE topic_id = $id";
+ $result = mysql_query($query);
+ $root_id = mysql_result($result, 0);
+
+ ### Resolve next message:
+ $query = "SELECT topic_id FROM webboard WHERE root_id = $root_id AND topic_id < $id ORDER BY create_dt DESC";
+ $result = mysql_query($query);
+ if (mysql_num_rows($result)) return mysql_result($result, 0);
+ else return 0;
+}
+
+#####
+# Syntax.......: getNextThread(root_id)
+# Description..: Returns the next thread.
+#
+function getNextThread($root_id) {
+ $query = "SELECT root_id FROM webboard WHERE root_id > $root_id ORDER BY root_id";
+ $result = mysql_query($query);
+ if (mysql_num_rows($result)) return mysql_result($result, 0);
+ else return 0;
+}
+
+#####
+# Syntax.......: getPrevThread(root_id)
+# Description..: Returns the previous thread.
+#
+function getPrevThread($root_id) {
+ $query = "SELECT root_id FROM webboard WHERE root_id < $root_id ORDER BY root_id DESC";
+ $result = mysql_query($query);
+ if (mysql_num_rows($result)) return mysql_result($result, 0);
+ else return 0;
+}
+
+#####
+# Syntax.......: getCurrentPosts()
+# Description..: Returns the total number of current/active posts.
+#
+function getCurrentPosts() {
+ $query = "SELECT COUNT(topic_id) FROM webboard";
+ $result = mysql_query($query);
+ if ($result) return mysql_result($result, 0);
+}
+
+#####
+# Syntax.......: deleteThread(id)
+# Description..: Deletes a thread including all child threads.
+#
+function deleteThread($id) {
+ ### delete thread:
+ $query = "SELECT topic_id FROM webboard WHERE parent_id = $id";
+ $result = mysql_query($query);
+
+ while ($post = mysql_fetch_object($result)) {
+ deleteThread($post->topic_id);
+ }
+
+ ### delete individual post:
+ $query = "DELETE FROM webboard WHERE topic_id = $id";
+ $result = mysql_query($query);
+}
+
+#####
+# Syntax.......: expireThread(timout)
+# Description..: Checks for expired threads and automatically deletes
+# them (if any).
+#
+function expireThread($expire, $number = 40) {
+ $query = "SELECT root_id, MAX(create_dt) FROM webboard GROUP BY root_id";
+ $result = mysql_query($query);
+
+ while (getCurrentPosts() > $number && $result && $row = mysql_fetch_row($result)) {
+ list($root_id, $create_dt) = $row;
+ if (time() - $create_dt > $expire) deleteThread($root_id);
+ }
+}
+
+
+function displayForm($id = "0") {
+ global $anonymous, $login, $support, $subscribe, $bgcolor2, $bgcolor3, $cookie;
+
+ if ($cookie[1]) printForm($id, $cookie[1]);
+ else printForm($id, $anonymous);
+}
+
+
+
+$id = $display;
+
+if ($id) {
+ displayMessage($id);
+ displayForm($id);
+}
+else if ($section == "policy") {
+ themebox("Webboard policy", "<P>Webboards are normally used to post notices, hints, questions and such. Messages ideally should be written such that others can read them and get some value in them.</P><P>Everyday we see posts from people who choose to swear, insult and threaten users on the webboard. Therefor we track all IP addresses of people posting: we know who comes, what they look at, how long they stay and - last but not least - we have a valid e-mail address. Please do not use profanity. Everyone is entitled to their opinion, but refrain from posting insults.</P><P>If you are a webboard user and see an offensive post or are being victimed by someone on the webboard, please contact us immediately at <A HREF=\"mailto:info@projectx.mx.dk\">info@projectx.mx.dk</A>.</P><P>We do take our webboard policy serious and we won't hesitate to e-mail the internet provider of the abuser to advise them of the situation. In addition we will block an abusers ProjectX account, his IP or even its entire ISP: as each internet user is assigned a unique IP address on the net, we can track people down and then 'screen' them out when they try to return. In most cases it means blocking entire address blocks or even ISPs.</P><P>Think before you post.</P><P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>", 500);
+}
+else if ($post) {
+ $id = postMessage($subject, $author, $message, $parent_id, $root_id, 1);
+ print "<P><FONT SIZE=\"+1\">Your message has been posted:</FONT></P>\n";
+ displayMessage($id);
+ displayForm($id);
+}
+else if (isset($threaded) && ($threaded == 0)) {
+ displayChronologicalOverview();
+ displayForm();
+}
+else if ($delete) {
+ ### check permissions:
+ if ($admin) {
+ ### delete thread:
+ deleteThread($delete);
+ print "<FORM ACTION=\"$PHP_SELF?delete=1\" METHOD=\"POST\">\n";
+ displayAdminOverview(0);
+ print "<INPUT TYPE=\"submit\" VALUE=\"Delete\">\n";
+ print "</FORM>\n";
+ }
+ else displayBox("Failed", "You don't have permission to access this section.");
+}
+else if ($section == "webboard") {
+ ### display administrator overview:
+ print "<FORM ACTION=\"$PHP_SELF?delete=1\" METHOD=\"POST\">\n";
+ displayAdminOverview(0);
+ print "<INPUT TYPE=\"submit\" VALUE=\"Delete\">\n";
+ print "</FORM>\n";
+}
+else {
+ displayThreadedOverview();
+ displayForm();
+}
+
+### Check to see if a certain thread has expired:
+if (time() % 20 == 0) {
+ expireThread(302400); // 604800 = 7 days
+}
+
+### Close connection with MySQL server/database:
+mysql_close();
+
+$theme->footer();
+
+?> \ No newline at end of file