Commit 7a45d84a authored by Dries's avatar Dries

- added a whole bunch of NEW modules
parent c514e3cd
<?
$module = array("admin" => "account_admin");
function account_display($order = "username") {
$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", "timezone" => "timezone", "username" => "userid");
$show = array("ID" => "id", "username" => "userid", "$order" => "$sort[$order]", "status" => "status");
$stat = array(0 => "blocked", 1 => "not confirmed", 2 => "open");
// Perform query:
$result = db_query("SELECT u.id, u.userid, u.$sort[$order], u.status FROM users u ORDER BY $sort[$order]");
// Generate output:
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
$output .= " <TR>\n";
$output .= " <TH ALIGN=\"right\" COLSPAN=\"". (sizeof($show) + 1) ."\">\n";
$output .= " <FORM ACTION=\"admin.php?mod=account\" METHOD=\"post\">\n";
$output .= " <SELECT NAME=\"order\">\n";
foreach ($sort as $key=>$value) {
$output .= " <OPTION VALUE=\"$key\"". ($key == $order ? " SELECTED" : "") .">Sort by $key</OPTION>\n";
}
$output .= " </SELECT>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update\">\n";
$output .= " </FORM>\n";
$output .= " </TH>\n";
$output .= " </TR>\n";
$output .= " <TR>\n";
foreach ($show as $key=>$value) {
$output .= " <TH>$key</TH>\n";
}
$output .= " <TH>operations</TH>\n";
$output .= " </TR>\n";
while ($account = db_fetch_array($result)) {
$output .= " <TR>\n";
foreach ($show as $key=>$value) {
switch($value) {
case "real_email":
$output .= " <TD>". format_email($account[$value]) ."</TD>\n";
break;
case "last_access":
$output .= " <TD>". format_date($account[$value]) ."</TD>\n";
break;
case "status":
$output .= " <TD ALIGN=\"center\">". $stat[$account[$value]] ."</TD>\n";
break;
case "timezone":
$output .= " <TD ALIGN=\"center\">". format_data($account[$value] / 3600) ."</TD>\n";
break;
case "url":
$output .= " <TD>". format_url($account[$value]) ."</TD>\n";
break;
case "userid":
$output .= " <TD>". format_username($account[$value], 1) ."</TD>\n";
break;
default:
$output .= " <TD>". format_data($account[$value]) ."</TD>\n";
}
}
$output .= " <TD ALIGN=\"center\"><A HREF=\"admin.php?mod=account&op=view&name=$account[userid]\">view</A></TD>\n";
$output .= " </TR>\n";
}
$output .= "</TABLE>\n";
print $output;
}
function account_stories($id) {
$result = db_query("SELECT * FROM stories WHERE author = $id ORDER BY timestamp DESC");
while ($story = db_fetch_object($result)) {
$output .= "<LI><A HREF=\"discussion.php?id=$story->id\">". check_output($story->subject) ."</A></LI>\n";
}
return $output;
}
function account_comments($id) {
$result = db_query("SELECT * FROM comments WHERE author = $id ORDER BY timestamp DESC");
while ($comment = db_fetch_object($result)) {
$output .= "<LI><A HREF=\"discussion.php?id=$comment->sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></LI>\n";
}
return $output;
}
function account_view($name) {
$status = array(0 => "blocked", 1 => "not confirmed", 2 => "open");
$result = db_query("SELECT * FROM users WHERE userid = '$name'");
if ($account = db_fetch_object($result)) {
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
$output .= " <TR><TD ALIGN=\"right\"><B>ID:</B></TD><TD>$account->id</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Status:</B></TD><TD>". $status[$account->status] ."</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($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";
$output .= " <TR><TD ALIGN=\"right\"><B>Signature:</B></TD><TD>". format_data($account->signature) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Theme:</B></TD><TD>". format_data($account->theme) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Timezone:</B></TD><TD>". format_data($account->timezone / 3600) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Submitted stories:</B></TD><TD>". format_data(account_stories($account->id)) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Submitted comments:</B></TD><TD>". format_data(account_comments($account->id)) ."</TD></TR>\n";
$output .= "</TABLE>\n";
print "$output";
}
}
function account_admin() {
global $op, $name, $order;
switch ($op) {
case "view":
account_view($name);
break;
case "Update":
account_display($order);
break;
default:
account_display();
}
}
?>
\ No newline at end of file
<?
$module = array("page" => "backend_page",
"admin" => "backend_admin");
include "includes/theme.inc";
include "modules/backend.class";
function backend_page() {
global $theme;
// Get channel info:
$result = db_query("SELECT * FROM channel ORDER BY id");
$theme->header();
print "<TABLE BORDER=\"0\">\n";
while ($channel = db_fetch_object($result)) {
if ($state % 3 == 0) print " <TR>\n";
print " <TD ALIGN=\"center\" VALIGN=\"top\" WIDTH=\"33%\">\n";
// Load backend from database:
$backend = new backend($channel->id);
// Read headlines from backend class:
$content = "";
for (reset($backend->headlines); $headline = current($backend->headlines); next($backend->headlines)) {
$content .= "<LI>$headline</LI>\n";
}
// Print backend box to screen:
$theme->box($backend->site, "$content<P ALIGN=\"right\">[ <A HREF=\"$backend->url\">more</A> ]\n");
print " </TD>\n";
if ($state % 3 == 2) print " </TR>\n";
$state += 1;
}
print "</TABLE>\n";
$theme->footer();
}
function backend_admin_main() {
global $theme;
// Get channel info:
$result = db_query("SELECT * FROM channel ORDER BY id");
$output .= "<TABLE BORDER=\"1\" CELLSPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TH>Site</TH><TH>Contact</TH><TH>Last updated</TH><TH COLSPAN=\"2\">Operations</TH></TR>\n";
while ($channel = db_fetch_object($result)) {
// Load backend from database:
$backend = new backend($channel->id);
$output .= "<TR>\n";
$output .= " <TD><A HREF=\"$backend->url\">$backend->site</A></TD>\n";
$output .= " <TD><A HREF=\"mailto:$backend->contact\">$backend->contact</A></TD>\n";
$output .= " <TD ALIGN=\"center\">". round((time() - $backend->timestamp) / 60) ." min. ago</TD>\n";
$output .= " <TD ALIGN=\"center\"><A HREF=\"admin.php?mod=backend&op=refresh&id=$backend->id\">refresh</A></TD>\n";
$output .= " <TD ALIGN=\"center\"><A HREF=\"admin.php?mod=backend&op=delete&id=$backend->id\">delete</A></TD>\n";
$output .= "</TR>\n";
}
$output .= "</TABLE>\n";
$output .= "<BR><BR>\n";
$output .= "<HR>\n";
$output .= " <FORM ACTION=\"admin.php?mod=backend\" METHOD=\"post\">\n";
$output .= " <P>\n";
$output .= " <B>Site name:</B><BR>\n";
$output .= " <INPUT TYPE=\"text\" NAME=\"site\" SIZE=\"50\">\n";
$output .= " </P>\n";
$output .= " <P>\n";
$output .= " <B>URL:</B><BR>\n";
$output .= " <INPUT TYPE=\"text\" NAME=\"url\" SIZE=\"50\">\n";
$output .= " </P>\n";
$output .= " <P>\n";
$output .= " <B>Backend file:</B><BR>\n";
$output .= " <INPUT TYPE=\"text\" NAME=\"file\" SIZE=\"50\">\n";
$output .= " </P>\n";
$output .= " <P>\n";
$output .= " <B>Contact information:</B><BR>\n";
$output .= " <INPUT TYPE=\"text\" NAME=\"contact\" SIZE=\"50\">\n";
$output .= " </P>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Add backend\">\n";
$output .= " </FORM>\n";
print $output;
}
function backend_admin() {
global $op, $id, $site, $url, $file, $contact;
switch($op) {
case "refresh":
$backend = new backend($id);
$backend->refresh();
backend_admin_main();
break;
case "delete":
$backend = new backend($id);
$backend->dump();
$backend->delete();
backend_admin_main();
break;
case "Add backend":
$backend = new backend($id, $site, $url, $file, $contact);
$backend->add();
// fall through:
default:
backend_admin_main();
}
}
?>
<?
$module = array("admin" => "ban_admin");
include "includes/ban.inc";
function ban_check($mask, $category) {
$ban = ban_match($mask, $category);
$output .= "". ($ban ? "Matched ban '<B>$ban->mask</B>' with reason: <I>$ban->reason</I>.<P>\n" : "No matching bans for '$mask'.<P>\n") ."";
print $output;
}
function ban_new($mask, $category, $reason) {
ban_add($mask, $category, $reason, &$message);
$output .= "$message\n";
print $output;
}
function ban_display($category = "") {
global $type2index;
// initialize variable:
$category = $category ? $category : 1;
// Perform query:
$result = db_query("SELECT * FROM bans WHERE type = $category ORDER BY mask");
// Generate output:
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
$output .= " <TR>\n";
$output .= " <TH COLSPAN=\"3\">\n";
$output .= " <FORM ACTION=\"admin.php?mod=ban\" METHOD=\"post\">\n";
$output .= " <SELECT NAME=\"category\">\n";
for (reset($type2index); $cur = current($type2index); next($type2index)) {
$output .= " <OPTION VALUE=\"$cur\"". ($cur == $category ? " SELECTED" : "") .">Sort by ". key($type2index) ."</OPTION>\n";
}
$output .= " </SELECT>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update\">\n";
$output .= " </FORM>\n";
$output .= " </TH>\n";
$output .= " </TR>\n";
$output .= " <TR>\n";
$output .= " <TH>mask</TH>\n";
$output .= " <TH>reason</TH>\n";
$output .= " <TH>operations</TH>\n";
$output .= " </TR>\n";
while ($ban = db_fetch_object($result)) {
$output .= " <TR><TD>$ban->mask</TD><TD>$ban->reason</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=ban&op=delete&category=$category&id=$ban->id\">delete</A></TD></TR>\n";
}
$output .= " <TR><TD COLSPAN=\"3\"><SMALL>%: matches any number of characters, even zero characters.<BR>_: matches exactly one character.</SMALL></TD></TR>\n";
$output .= "</TABLE>\n";
$output .= "<BR><HR>\n";
$output .= "<H3>Add new ban:</H3>\n";
$output .= "<FORM ACTION=\"admin.php?mod=ban\" METHOD=\"post\">\n";
$output .= "<B>Banmask:</B><BR>\n";
$output .= "<INPUT TYPE=\"text\" NAME=\"mask\" SIZE=\"35\"><P>\n";
$output .= "<B>Type:</B><BR>\n";
$output .= "<SELECT NAME=\"category\"\">\n";
for (reset($type2index); $cur = current($type2index); next($type2index)) {
$output .= "<OPTION VALUE=\"$cur\"". ($cur == $category ? " SELECTED" : "") .">". key($type2index) ."</OPTION>\n";
}
$output .= "</SELECT><P>\n";
$output .= "<B>Reason:</B><BR>\n";
$output .= "<TEXTAREA NAME=\"reason\" COLS=\"50\" ROWS=\"5\"></TEXTAREA><P>\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Add ban\"><BR>\n";
$output .= "</FORM>\n";
$output .= "<BR><HR>\n";
$output .= "<H3>Ban check:</H3>\n";
$output .= "<FORM ACTION=\"admin.php?mod=ban\" METHOD=\"post\">\n";
$output .= "<B>Banmask:</B><BR>\n";
$output .= "<INPUT TYPE=\"text\" NAME=\"mask\" SIZE=\"35\"><P>\n";
$output .= "<B>Type:</B><BR>\n";
$output .= "<SELECT NAME=\"category\"\">\n";
for (reset($type2index); $cur = current($type2index); next($type2index)) {
$output .= "<OPTION VALUE=\"$cur\"". ($cur == $category ? " SELECTED" : "") .">". key($type2index) ."</OPTION>\n";
}
$output .= "</SELECT><P>\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Check ban\"><BR>\n";
$output .= "</FORM>\n";
print $output;
}
function ban_admin() {
global $op, $id, $mask, $category, $reason;
switch ($op) {
case "Add ban":
ban_new($mask, $category, $reason);
ban_display($category);
break;
case "Check ban":
ban_check($mask, $category);
ban_display($category);
break;
case "delete":
ban_delete($id);
default:
ban_display($category);
}
}
?>
<?
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;
}
}
?>
<?
$module = array("admin" => "comment_admin");
function comment_edit($id) {
$result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.cid = $id");
$comment = db_fetch_object($result);
$output .= "<FORM ACTION=\"admin.php?mod=comment&op=save&id=$id\" METHOD=\"post\">\n";
$output .= "<P>\n";
$output .= " <B>Author:</B><BR>\n";
$output .= " ". format_username($comment->userid, 1) ."\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <B>Subject:</B><BR>\n";
$output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" VALUE=\"". check_output(check_field($comment->subject)) ."\"><BR>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= "<B>Comment:</B><BR>\n";
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">". check_output($comment->comment) ."</TEXTAREA><BR>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save comment\">\n";
$output .= "</P>\n";
$output .= "</FORM>\n";
print $output;
}
function comment_save($id, $subject, $comment) {
db_query("UPDATE comments SET subject = '". check_input($subject) ."', comment = '". check_input($comment) ."' WHERE cid = $id");
watchdog("message", "modified comment `$subject'.");
}
function comment_display($order = "date") {
// Initialize variables:
$fields = array("author" => "author", "date" => "timestamp DESC", "subject" => "subject");
// Perform SQL query:
$result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author ORDER BY c.$fields[$order] LIMIT 50");
// Display comments:
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
$output .= " <TR>\n";
$output .= " <TH ALIGN=\"right\" COLSPAN=\"5\">\n";
$output .= " <FORM ACTION=\"admin.php?mod=comment\" METHOD=\"post\">\n";
$output .= " <SELECT NAME=\"order\">\n";
foreach ($fields as $key=>$value) {
$output .= " <OPTION VALUE=\"$key\"". ($key == $order ? " SELECTED" : "") .">Sort by $key</OPTION>\n";
}
$output .= " </SELECT>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update\">\n";
$output .= " </FORM>\n";
$output .= " </TH>\n";
$output .= " </TR>\n";
$output .= " <TR>\n";
$output .= " <TH>subject</TH>\n";
$output .= " <TH>author</TH>\n";
$output .= " <TH>operations</TH>\n";
$output .= " </TR>\n";
while ($comment = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"discussion.php?id=$comment->sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD><TD>". format_username($comment->userid, 1) ."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=comment&op=edit&id=$comment->cid\">edit</A></TD></TR>\n";
}
$output .= "</TABLE>\n";
print $output;
}
function comment_admin() {
global $op, $id, $subject, $comment, $order;
switch ($op) {
case "edit":
comment_edit($id);
break;
case "Save comment":
comment_save($id, $subject, $comment);
comment_edit($id);
break;
case "Update":
comment_display($order);
break;
default:
comment_display();
}
}
?>
\ No newline at end of file
<?
$module = array("admin" => "comment_admin");
function comment_edit($id) {
$result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.cid = $id");
$comment = db_fetch_object($result);
$output .= "<FORM ACTION=\"admin.php?mod=comment&op=save&id=$id\" METHOD=\"post\">\n";
$output .= "<P>\n";
$output .= " <B>Author:</B><BR>\n";
$output .= " ". format_username($comment->userid, 1) ."\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <B>Subject:</B><BR>\n";
$output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" VALUE=\"". check_output(check_field($comment->subject)) ."\"><BR>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= "<B>Comment:</B><BR>\n";
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">". check_output($comment->comment) ."</TEXTAREA><BR>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save comment\">\n";
$output .= "</P>\n";
$output .= "</FORM>\n";
print $output;
}
function comment_save($id, $subject, $comment) {
db_query("UPDATE comments SET subject = '". check_input($subject) ."', comment = '". check_input($comment) ."' WHERE cid = $id");
watchdog("message", "modified comment `$subject'.");
}
function comment_display($order = "date") {
// Initialize variables:
$fields = array("author" => "author", "date" => "timestamp DESC", "subject" => "subject");
// Perform SQL query:
$result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author ORDER BY c.$fields[$order] LIMIT 50");
// Display comments:
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
$output .= " <TR>\n";
$output .= " <TH ALIGN=\"right\" COLSPAN=\"5\">\n";
$output .= " <FORM ACTION=\"admin.php?mod=comment\" METHOD=\"post\">\n";
$output .= " <SELECT NAME=\"order\">\n";
foreach ($fields as $key=>$value) {
$output .= " <OPTION VALUE=\"$key\"". ($key == $order ? " SELECTED" : "") .">Sort by $key</OPTION>\n";
}
$output .= " </SELECT>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update\">\n";
$output .= " </FORM>\n";
$output .= " </TH>\n";
$output .= " </TR>\n";
$output .= " <TR>\n";
$output .= " <TH>subject</TH>\n";
$output .= " <TH>author</TH>\n";
$output .= " <TH>operations</TH>\n";
$output .= " </TR>\n";
while ($comment = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"discussion.php?id=$comment->sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD><TD>". format_username($comment->userid, 1) ."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=comment&op=edit&id=$comment->cid\">edit</A></TD></TR>\n";
}
$output .= "</TABLE>\n";
print $output;
}
function comment_admin() {
global $op, $id, $subject, $comment, $order;
switch ($op) {
case "edit":
comment_edit($id);
break;
case "Save comment":
comment_save($id, $subject, $comment);
comment_edit($id);
break;
case "Update":
comment_display($order);
break;