Commit 11ee95da authored by Dries's avatar Dries
Browse files

A big, fat commit with a shitload of internal changes.  Not that much
visual changes:

- removed redundant files user.class.php, calendar.class.php
  and backend.class.php.
- converted *all* mysql queries to queries supported by the
  database abstraction layer.
- expanded the watchdog to record more information on what
  actually happened.
- bugfix: anonymous readers where not able to view comments.
- bugfix: anonymous readers could gain read-only access to
  the submission queue.
- bugfix: invalid includes in backend.php
- bugfix: invalid use of '$user->block'

and last but not least:

- redid 50% of the user account system
parent 43af5a73
This diff is collapsed.
......@@ -8,7 +8,7 @@
*/
function account_display($order = "username") {
$sort = array("ID" => "id", "fake e-mail address" => "femail", "homepage" => "url", "hostname" => "last_host", "last access date" => "last_access", "real e-mail address" => "email", "real name" => "name", "status" => "status", "theme" => "theme", "username" => "userid");
$sort = array("ID" => "id", "fake e-mail address" => "fake_email", "homepage" => "url", "hostname" => "last_host", "last access date" => "last_access", "real e-mail address" => "real_email", "real name" => "name", "status" => "status", "theme" => "theme", "username" => "userid");
$show = array("ID" => "id", "username" => "userid", "$order" => "$sort[$order]", "status" => "status");
### Perform query:
......@@ -39,7 +39,7 @@ function account_display($order = "username") {
$output .= " <TR>\n";
foreach ($show as $key=>$value) {
switch($value) {
case "email":
case "real_email":
$output .= " <TD>". format_email_address($account[$value]) ."</TD>\n";
break;
case "last_access":
......@@ -91,8 +91,8 @@ function account_view($name) {
$output .= " <TR><TD ALIGN=\"right\"><B>ID:</B></TD><TD>$account->id</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Username:</B></TD><TD>$account->userid</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Real name:</B></TD><TD>". format_data($account->name) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Real e-mail address:</B></TD><TD>". format_email_address($account->email) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Fake e-mail address:</B></TD><TD>". format_data($account->femail) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Real e-mail address:</B></TD><TD>". format_email_address($account->real_email) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Fake e-mail address:</B></TD><TD>". format_data($account->fake_email) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>URL of homepage:</B></TD><TD>". format_url($account->url) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Last access:</B></TD><TD>". format_date($account->last_access) ." from $account->last_host</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Bio information:</B></TD><TD>". format_data($account->bio) ."</TD></TR>\n";
......@@ -110,10 +110,10 @@ function account_view($name) {
*/
function log_display($order = "date") {
$colors = array("#FFFFFF", "#FFFFFF", "#90EE90", "#CD5C5C");
$fields = array("date" => "id DESC", "username" => "user", "message" => "message DESC", "level" => "level DESC");
$fields = array("date" => "id DESC", "username" => "user", "location" => "location", "message" => "message DESC", "level" => "level DESC");
### Perform query:
$result = db_query("SELECT l.*, u.userid FROM logs l LEFT JOIN users u ON l.user = u.id ORDER BY l.$fields[$order]");
$result = db_query("SELECT l.*, u.userid FROM watchdog l LEFT JOIN users u ON l.user = u.id ORDER BY l.$fields[$order]");
### Generate output:
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
......@@ -146,13 +146,14 @@ function log_display($order = "date") {
}
function log_view($id) {
$result = db_query("SELECT l.*, u.userid FROM logs l LEFT JOIN users u ON l.user = u.id WHERE l.id = $id");
$result = db_query("SELECT l.*, u.userid FROM watchdog l LEFT JOIN users u ON l.user = u.id WHERE l.id = $id");
if ($log = db_fetch_object($result)) {
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Level:</B></TD><TD>$log->level</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Date:</B></TD><TD>". format_date($log->timestamp, "extra large") ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>User:</B></TD><TD>". format_username($log->userid, 1) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Location:</B></TD><TD>$log->location</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Message:</B></TD><TD>$log->message</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Hostname:</B></TD><TD>$log->hostname</TD></TR>\n";
$output .= "</TABLE>\n";
......@@ -557,7 +558,6 @@ function info_display() {
$output .= "sitename: $sitename<BR>\n";
$output .= "e-mail address: $contact_email<BR>\n";
$output .= "signature: $contact_signature<BR>\n";
$output .= "send e-mail notifications: $notify<BR>\n";
$output .= "allowed HTML tags: <I>". htmlspecialchars($allowed_html) ."</I><BR>\n";
$output .= "anonymous user: $anonymous<BR>\n";
......
......@@ -66,7 +66,6 @@ function diary_display($username) {
function diary_add() {
global $theme, $user, $allowed_html;
### Submission form:
$output .= "<FORM ACTION=\"diary.php\" METHOD=\"post\">\n";
$output .= "<P>\n";
......
......@@ -23,33 +23,33 @@ function discussion_moderate($moderate) {
}
}
function discussion_kids($cid, $mode, $thold, $level = 0, $dummy = 0) {
function discussion_kids($cid, $mode, $threshold, $level = 0, $dummy = 0) {
global $user, $theme;
$comments = 0;
$result = db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.pid = $cid AND (c.votes = 0 OR c.score / c.votes >= $thold) ORDER BY c.timestamp, c.cid");
$result = db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.pid = $cid AND (c.votes = 0 OR c.score / c.votes >= $threshold) ORDER BY c.timestamp, c.cid");
if ($mode == "nested") {
while ($comment = db_fetch_object($result)) {
if ($comment->score >= $thold) {
if ($comment->score >= $threshold) {
if ($level && !$comments) print "<UL>";
$comments++;
$link = "<A HREF=\"discussion.php?op=reply&sid=$comment->sid&pid=$comment->cid\"><FONT COLOR=\"$theme->hlcolor2\">reply to this comment</FONT></A>";
$theme->comment($comment->userid, stripslashes($comment->subject), stripslashes($comment->comment), $comment->timestamp, stripslashes($comment->url), stripslashes($comment->femail), discussion_score($comment), $comment->votes, $comment->cid, $link);
$theme->comment($comment->userid, stripslashes($comment->subject), stripslashes($comment->comment), $comment->timestamp, stripslashes($comment->url), stripslashes($comment->fake_email), discussion_score($comment), $comment->votes, $comment->cid, $link);
discussion_kids($comment->cid, $mode, $thold, $level + 1, $dummy + 1);
discussion_kids($comment->cid, $mode, $threshold, $level + 1, $dummy + 1);
}
}
}
else { // mode == 'flat'
while ($comment = db_fetch_object($result)) {
if ($comment->score >= $thold) {
if ($comment->score >= $threshold) {
$link = "<A HREF=\"discussion.php?op=reply&sid=$comment->sid&pid=$comment->cid\"><FONT COLOR=\"$theme->hlcolor2\">reply to this comment</FONT></A>";
$theme->comment($comment->userid, check_output($comment->subject), check_output($comment->comment), $comment->timestamp, $comment->url, $comment->femail, discussion_score($comment), $comment->votes, $comment->cid, $link);
$theme->comment($comment->userid, check_output($comment->subject), check_output($comment->comment), $comment->timestamp, $comment->url, $comment->fake_email, discussion_score($comment), $comment->votes, $comment->cid, $link);
}
discussion_kids($comment->cid, $mode, $thold);
discussion_kids($comment->cid, $mode, $threshold);
}
}
......@@ -58,11 +58,11 @@ function discussion_kids($cid, $mode, $thold, $level = 0, $dummy = 0) {
}
}
function discussion_childs($cid, $thold, $level = 0, $thread) {
function discussion_childs($cid, $threshold, $level = 0, $thread) {
global $theme, $user;
### Perform SQL query:
$result = db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.pid = $cid AND (c.votes = 0 OR c.score / c.votes >= $thold) ORDER BY c.timestamp, c.cid");
$result = db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.pid = $cid AND (c.votes = 0 OR c.score / c.votes >= $threshold) ORDER BY c.timestamp, c.cid");
if ($level == 0) $thread = "";
$comments = 0;
......@@ -78,7 +78,7 @@ function discussion_childs($cid, $thold, $level = 0, $thread) {
$thread .= "<LI><A HREF=\"discussion.php?id=$comment->sid&cid=$comment->cid&pid=$comment->pid\">". check_output($comment->subject) ."</A> by ". format_username($comment->userid) ." <SMALL>(". discussion_score($comment) .")<SMALL></LI>";
### Recursive:
discussion_childs($comment->cid, $thold, $level + 1, &$thread);
discussion_childs($comment->cid, $threshold, $level + 1, &$thread);
}
if ($level && $comments) {
......@@ -88,12 +88,15 @@ function discussion_childs($cid, $thold, $level = 0, $thread) {
return $thread;
}
function discussion_settings($mode, $order, $thold) {
function discussion_settings($mode, $order, $threshold) {
global $user;
if ($user->id) {
db_query("UPDATE users SET umode = '$mode', uorder = '$order', thold = '$thold' WHERE id = '$user->id'");
user_rehash();
$data[mode] = $mode;
$data[sort] = $order;
$data[threshold] = $threshold;
user_save($data, $user->id);
}
}
......@@ -103,9 +106,9 @@ function discussion_display($sid, $pid, $cid, $level = 0) {
### Pre-process variables:
$pid = (empty($pid)) ? 0 : $pid;
$cid = (empty($cid)) ? 0 : $cid;
$mode = ($user) ? $user->umode : "threaded";
$order = ($user) ? $user->uorder : "1";
$thold = ($user) ? $user->thold : "0";
$mode = ($user->id) ? $user->mode : "threaded";
$order = ($user->id) ? $user->sort : "1";
$threshold = ($user->id) ? $user->threshold : "0";
### Compose story-query:
$result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.status != 0 AND s.id = $sid");
......@@ -116,10 +119,10 @@ function discussion_display($sid, $pid, $cid, $level = 0) {
else $theme->article($story, "[ <A HREF=\"\"><FONT COLOR=\"$theme->hlcolor2\">home</FONT></A> | <A HREF=\"discussion.php?op=reply&sid=$story->id&pid=0\"><FONT COLOR=\"$theme->hlcolor2\">add a comment</FONT></A> ]");
### Display `comment control'-box:
if ($user->id) $theme->commentControl($sid, $title, $thold, $mode, $order);
if ($user->id) $theme->commentControl($sid, $title, $threshold, $mode, $order);
### Compose query:
$query .= "SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.sid = $sid AND c.pid = $pid AND (c.votes = 0 OR c.score / c.votes >= $thold)";
$query .= "SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.sid = $sid AND c.pid = $pid AND (c.votes = 0 OR c.score / c.votes >= $threshold)";
if ($order == 1) $query .= " ORDER BY c.timestamp DESC";
if ($order == 2) $query .= " ORDER BY c.score DESC";
$result = db_query($query);
......@@ -139,12 +142,12 @@ function discussion_display($sid, $pid, $cid, $level = 0) {
### Display the comments:
if (empty($mode) || $mode == "threaded") {
$thread = discussion_childs($comment->cid, $thold);
$theme->comment($comment->userid, check_output($comment->subject), check_output($comment->comment), $comment->timestamp, $comment->url, $comment->femail, discussion_score($comment), $comment->votes, $comment->cid, $link, $thread);
$thread = discussion_childs($comment->cid, $threshold);
$theme->comment($comment->userid, check_output($comment->subject), check_output($comment->comment), $comment->timestamp, $comment->url, $comment->fake_email, discussion_score($comment), $comment->votes, $comment->cid, $link, $thread);
}
else {
$theme->comment($comment->userid, check_output($comment->subject), check_output($comment->comment), $comment->timestamp, $comment->url, $comment->femail, discussion_score($comment), $comment->votes, $comment->cid, $link);
discussion_kids($comment->cid, $mode, $thold, $level);
$theme->comment($comment->userid, check_output($comment->subject), check_output($comment->comment), $comment->timestamp, $comment->url, $comment->fake_email, discussion_score($comment), $comment->votes, $comment->cid, $link);
discussion_kids($comment->cid, $mode, $threshold, $level);
}
}
......@@ -159,7 +162,7 @@ function discussion_reply($pid, $sid) {
### Extract parent-information/data:
if ($pid) {
$item = db_fetch_object(db_query("SELECT comments.*, users.userid FROM comments LEFT JOIN users ON comments.author = users.id WHERE comments.cid = $pid"));
$theme->comment($item->userid, check_output(stripslashes($item->subject)), check_output(stripslashes($item->comment)), $item->timestamp, stripslashes($item->url), stripslashes($item->femail), discussion_score($comment), $comment->votes, $item->cid, "reply to this comment");
$theme->comment($item->userid, check_output(stripslashes($item->subject)), check_output(stripslashes($item->comment)), $item->timestamp, stripslashes($item->url), stripslashes($item->fake_email), discussion_score($comment), $comment->votes, $item->cid, "reply to this comment");
}
else {
$item = db_fetch_object(db_query("SELECT stories.*, users.userid FROM stories LEFT JOIN users ON stories.author = users.id WHERE stories.status != 0 AND stories.id = $sid"));
......@@ -211,7 +214,7 @@ function comment_preview($pid, $sid, $subject, $comment) {
### Preview comment:
if ($user->id) $theme->comment("", check_output(stripslashes($subject)), check_output(stripslashes($comment)), time(), "", "", "", "", "", "reply to this comment");
else $theme->comment($user->userid, check_output(stripslashes($subject)), check_output(stripslashes($comment)), time(), stripslashes($user->url), stripslashes($user->femail), "", "", "", "reply to this comment");
else $theme->comment($user->userid, check_output(stripslashes($subject)), check_output(stripslashes($comment)), time(), stripslashes($user->url), stripslashes($user->fake_email), "", "", "", "reply to this comment");
### Build reply form:
$output .= "<FORM ACTION=\"discussion.php\" METHOD=\"post\">\n";
......@@ -308,7 +311,7 @@ function comment_post($pid, $sid, $subject, $comment) {
$theme->footer();
break;
case "Save":
discussion_settings($mode, $order, $thold);
discussion_settings($mode, $order, $threshold);
$theme->header();
discussion_display($id, $pid, $sid);
$theme->footer();
......
......@@ -51,6 +51,20 @@
<DT><B>Is the source code of this site available?</B></DT>
<DD>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>, and is inspired by several <A HREF=\"http://www.fsf.org/\">Free Software</A> projects. Therefor we have decided to make the software engine of this site available under terms of GPL.<P>However, the sources are <B>not</B> available yet at this time, but will be released as soon we have a first, well-rounded source tree that has proven to be stable. If you can't wait or in case you have big plans (like `total domination') with the engine, don't hesitate to contact us and we might grant you CVS access.<P></DD>
<DT><B>What features does the engine have?</B></DT>
<DD>
<LI>a theme system: the entire website is fully themable in terms of colors, layout, look-and-feel and markup.</LI>
<LI>a user account system with session management, secure authentication, human-readable password generator, user and page preferences, comment tracker and so on.</LI>
<LI>a discussion system: supports different display (<I>threaded</I>, <I>flat</I>, <I>netsted</I>) and order (<I>newest first</I>, <I>oldest first</I>, <I>highest scorings first</I>), comment moderation, customable HTML-support, etc.</LI>
<LI>a database abstraction layer: allows the website to run on top of different database systems.</LI>
<LI>anonymous reader/poster support across the entire site in case visitors prefers to remain anonymous or in case cookies are disabled.</LI>
<LI>a submission queue and submission moderation.</LI>
<LI>an embedded diary system.</LI>
<LI>an administrator section which is considered the control center of the website.</LI>
<LI>a RDF/RSS backend which allows third party websites to become <I>channels</I> in your website with a minimum of extra work.</LI>
<P>
</DD>
<DT><B>What is your privacy policy?</B></DT>
<DD>--- under construction ---<P></DD>
......
<?
include "function.inc";
class backend {
// Channel properties:
var $id;
var $url;
var $site;
var $file;
var $contact;
var $timestamp;
// Contains the raw rdf/rss/xml file:
var $data;
// Contains the parsed rdf/rss/xml file:
var $headlines = array(); // latest headlines
#####
# Syntax.......: backend(...);
# Description..: Constructor - initializes the internal variables.
#
function backend($id, $site, $url, $file, $contact, $timout = 1800) {
### Get channel info:
$result = db_query("SELECT * FROM channel WHERE id = '$id' OR site = '$site'");
if ($channel = db_fetch_object($result)) {
### Initialize internal variables:
$this->id = $channel->id;
$this->site = $channel->site;
$this->file = $channel->file;
$this->url = $channel->url;
$this->contact = $channel->contact;
$this->timestamp = $channel->timestamp;
### Check to see whether we have to update our headlines first:
if (time() - $this->timestamp > $timout) $this->url2sql();
### Read headlines:
$result = db_query("SELECT * FROM headlines WHERE id = $this->id ORDER BY number");
while ($headline = db_fetch_object($result)) {
array_push($this->headlines, "<A HREF=\"$headline->link\">$headline->title</A>");
}
}
else {
$this->site = $site;
$this->url = $url;
$this->file = $file;
$this->contact = $contact;
}
}
#####
# Syntax.......: rdf2sql(optional timout value in seconds);
# Description..: Reads a RDF file from a server, parses it and inserts
# the fresh data in a MySQL table.
#
function rdf2sql($timout = 10) {
if ($this->file) {
### Decode URL:
$url = parse_url($this->file);
$host = $url[host];
$port = $url[port] ? $url[port] : 80;
$path = $url[path];
// print "<PRE><B>Debug:</B> $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 = db_query("DELETE FROM headlines WHERE id = $this->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 = db_query("INSERT INTO headlines (id, title, link, number) VALUES('$this->id', '$title', '$link', '$number')");
}
### Mark channels as being updated:
$result = db_query("UPDATE channel SET timestamp = '". time() ."' WHERE id = $this->id");
$this->timestamp = time();
}
else print "<HR>RDF parser: 404 error?<BR><BR><PRE>$data</PRE><HR>";
}
}
}
#####
# Syntax.......: rss2sql(optional timout value in seconds);
# Description..: Reads a RSS file from a server, parses it and inserts
# the fresh data in a MySQL table.
#
function rss2sql($timout = 10) {
print "backend->rss2sql : TODO<BR>";
}
#####
# Syntax.......: xml2sql(optional timout value in seconds);
# Description..: Reads a XML file from a server, parses it and inserts
# the fresh data in a MySQL table.
#
function xml2sql($timout = 10) {
print "backend->xml2sql : TODO<BR>";
}
#####
# Syntax.......: url2sql(optional timout value in seconds);
# Description..: Generic function to fetch fresh headlines. It checks whether
# we are dealing with a remote RDF, RSS or XML file and calls
# the appropriate function to fetch the headline. The function
# is an abstraction towards the programmer as he doesn't need
# to know with what file extension we are dealing.
#
function url2sql($timout = 10) {
if (strstr($this->file, ".rdf")) $this->rdf2sql($timout);
if (strstr($this->file, ".rss")) $this->rss2sql($timout);
if (strstr($this->file, ".xml")) $this->xml2sql($timout);
}
#####
# Syntax.......:
# Description..:
#
function displayHeadlines($timout = 1800) {
global $theme;
### Get channel info:
$result = db_query("SELECT * FROM channel WHERE site = '$this->site'");
if ($this->id) {
### Check to see whether we have to update our headlines first:
if (time() - $this->timestamp > $timout) $this->url2sql();
### Grab headlines from database:
$result = db_query("SELECT * FROM headlines WHERE id = $this->id ORDER BY number");
while ($headline = db_fetch_object($result)) {
$content .= "<LI><A HREF=\"$headline->link\">$headline->title</A></LI>";
}
### Add timestamp:
$update = round((time() - $this->timestamp) / 60);
$content .= "<P ALIGN=\"right\">[ <A HREF=\"backend.php?op=reset&site=$this->site\"><FONT COLOR=\"$theme->hlcolor2\">reset</FONT></A> | updated $update min. ago ]</P>";
### Display box:
$theme->box("$this->site", $content);
}
else print "<P>Warning: something whiched happened: specified channel could not be found in database.</P>";
}
#####
# Syntax.......: add()
# Description..: Adds this backend to the database.
#
function add() {
### Add channel:
$result = db_query("INSERT INTO channel (site, file, url, contact, timestamp) VALUES ('$this->site', '$this->file', '$this->url', '$this->contact', 42)");
}
#####
# Syntax.......: delete()
# Description..: Deletes this backend
#
function delete() {
### Delete channel:
$result = db_query("DELETE FROM channel WHERE id = $this->id");
### Delete headlines:
$result = db_query("DELETE FROM headlines WHERE id = $this->id");
}
#####
# Syntax.......: refresh()
# Description..: Deletes all headlines associated with this backend.
#
function refresh() {
### Delete headlines:
$result = db_query("DELETE FROM headlines WHERE id = $this->id");
### Mark channel as invalid to enforce an update:
$result = db_query("UPDATE channel SET timestamp = 42 WHERE id = $this->id");
}
#####
# Syntax.......: dump()
# Description..: Dumps the content of this class to screen.
#
function dump() {
print "<B>Dump backend:</B><BR>";
print "Id: $this->id<BR>";
print "Site: $this->site<BR>";
print "URL: $this->url<BR>";
print "File: $this->file<BR>";
print "Contact: $this->contact<BR>";
}
}
?>
<?
class calendar {
var $date;
function calendar($date) {
$this->date = $date;
}
function display() {
global $PHP_SELF;
### Extract information from the given date:
$month = date("n", $this->date);
$year = date("Y", $this->date);
$day = date("d", $this->date);
### Extract first day of the month:
$first = date("w", mktime(0, 0, 0, $month, 1, $year));
### Extract last day of the month:
$last = date("t", mktime(0, 0, 0, $month, 1, $year));
### Calculate previous and next months dates:
$prev = mktime(0, 0, 0, $month - 1, $day, $year);
$next = mktime(0, 0, 0, $month + 1, $day, $year);
### Generate calendar header:
$output .= "\n<!-- calendar -->\n";
$output .= "<TABLE WIDTH=\"100%\" BORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"1\">\n";
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"7\"><SMALL><A HREF=\"$PHP_SELF?date=$prev\">&lt;</A> &nbsp; ". date("F Y", $this->date) ." &nbsp; <A HREF=\"$PHP_SELF?date=$next\">&gt;</A></SMALL></TD></TR>\n";
$output .= " <TR><TD ALIGN=\"center\"><SMALL>S</SMALL></TD><TD ALIGN=\"center\"><SMALL>M</SMALL></TD><TD ALIGN=\"center\"><SMALL>T</SMALL></TD><TD ALIGN=\"center\"><SMALL>W</SMALL></TD><TD ALIGN=\"center\"><SMALL>T</SMALL></TD><TD ALIGN=\"center\"><SMALL>F</SMALL></TD><TD ALIGN=\"center\"><SMALL>S</SMALL></TD></TR>\n";
### Initialize temporary variables:
$nday = 1;
$sday = $first;
### Loop through all the days of the month:
while ($nday <= $last) {
### Set up blank days for first week of the month:
if ($first) {
$output .= " <TR><TD COLSPAN=\"$first\">&nbsp</TD>\n";
$first = 0;
}
### Start every week on a new line:
if ($sday == 0) $output .= " <TR>\n";
### Print one cell:
$date = mktime(24, 0, 0, $month, $nday, $year);
if ($nday == $day) $output .= " <TD ALIGN=\"center\"><SMALL><B>$nday</B></SMALL></TD>\n";
else if ($date > time()) $output .= " <TD ALIGN=\"center\"><SMALL>$nday</SMALL></TD>\n";
else $output .= " <TD ALIGN=\"center\"><SMALL><A HREF=\"$PHP_SELF?date=$date\" STYLE=\"text-decoration: none;\">$nday</A></SMALL></TD>\n";
### Start every week on a new line:
if ($sday == 6) $output .= " </TR>\n";
### Update temporary variables:
$sday++;
$sday = $sday % 7;
$nday++;
}
### Complete the calendar:
if ($sday) {
$end = 7 - $sday;
$output .= " <TD COLSPAN=\"$end\">&nbsp;</TD>\n </TR>\n";
}
$output .= "</TABLE>\n\n";
### Return calendar:
return $output;
}
}
?>
......@@ -9,7 +9,7 @@
$dbpass = "Abc123";
$dbname = "dries";
#$dbhost = "localhost";
#$dbhost = "";
#$dbuname = "dries";
#$dbpass = "oakley";
#$dbname = "dries";
......@@ -24,7 +24,6 @@
# 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://beta.drop.org/";
#
# Notify:
......@@ -80,13 +79,13 @@
#
$themes = array("Marvin" => array(
"themes/marvin/marvin.theme",
"white, simple"),
"classic theme, white, basic design with a fresh look"),
"Zaphod" => array(
"themes/zaphod/zaphod.theme",
"yellow, simple"),
"classis theme, yellow, structured, advanced navigation"),
"UnConeD" => array(
"themes/unconed/unconed.theme",
"gray, flashy"));
"modern theme, gray and blue, high coolness factor"));
#
# Submission moderation votes:
......@@ -105,11 +104,4 @@