Commit d386c110 authored by Dries's avatar Dries

parent 34a927e6
......@@ -5,4 +5,4 @@
* http://drop.org/module.php?mod=drupal
- drupal project page
\ No newline at end of file
......@@ -5,8 +5,8 @@
// validate user permission:
if (!($user->permissions == 1 || $user->id == 1)) exit();
function admin_page($mod) {
global $repository, $menu, $modules;
function admin_page($mod) {
global $repository, $site_name, $menu, $modules;
function module($name, $module) {
global $menu, $modules;
......@@ -17,7 +17,7 @@ function module($name, $module) {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><TITLE>Administration</TITLE></HEAD>
<HEAD><TITLE><? echo $site_name; ?> administration</TITLE></HEAD>
<STYLE>
body { font-family: helvetica, arial; }
h1 { font-size: 18pt; font-weight: bold; color: #990000; }
......@@ -30,10 +30,10 @@ function module($name, $module) {
<H1>Administration</H1>
<?
ksort($repository);
ksort($repository);
module_iterate("module");
?>
?>
<HR><? echo $menu; ?><A HREF="">home</A><HR>
<?
......
......@@ -6,12 +6,12 @@ function cron_run() {
global $repository;
$time = time();
$result = db_query("SELECT * FROM crons WHERE $time - timestamp > scheduled");
while ($task = db_fetch_object($result)) {
if ($repository[$task->module]["cron"]) {
watchdog("message", "cron: executed '". $task->module ."_cron()'");
watchdog("message", "cron: executed '". $task->module ."_cron()'");
$repository[$task->module]["cron"]();
}
}
......
......@@ -4,7 +4,7 @@ function error_flood() {
global $site_email;
print "WARNING: submission rate exceeded. We detected too much data or events from your IP. Please wait a few minutes and try again. If you think this is not justified, please contact us at <A HREF=\"mailto:$site_email\">$site_email</A>.";
}
}
function error_httpd() {
global $REDIRECT_STATUS, $REDIRECT_URL, $HTTP_REFERER, $HTTP_USER_AGENT;
......@@ -30,7 +30,7 @@ function error_httpd() {
}
watchdog("error", "message: `$message' - requested url: $REDIRECT_URL - referring url: $HTTP_REFERER - user agent: $HTTP_USER_AGENT");
print "<PRE>\n";
print "<H1>Oops, an error occured!</H1>\n";
print "<B>Processed output:</B><BR>\n";
......@@ -43,7 +43,7 @@ function error_httpd() {
switch ($op) {
case "flood":
error_flood();
error_flood();
break;
default:
error_httpd();
......
<?
$type2index = array("addresses" => 0x01,
"profanity" => 0x02,
$type2index = array("addresses" => 0x01,
"profanity" => 0x02,
"hostnames" => 0x03,
"usernames" => 0x04);
$index2type = array(0x01 => "addresses",
$index2type = array(0x01 => "addresses",
0x02 => "profanity",
0x03 => "hostnames",
0x04 => "usernames");
......@@ -14,7 +14,7 @@
function ban_match($mask, $category) {
// Perform query:
$result = db_query("SELECT * FROM bans WHERE type = $category AND LOWER('$mask') LIKE LOWER(mask)");
// Return result:
return db_fetch_object($result);
}
......@@ -36,7 +36,7 @@ function ban_add($mask, $category, $reason, $message = "") {
watchdog("message", "added new ban `$mask' to category `". $index2type[$category] ."' with reason `$reason'.");
}
}
function ban_delete($id) {
global $index2type;
......
......@@ -20,8 +20,8 @@ function db_query($query, $debug = false) {
// debug output (if required):
if ($debug) print "<PRE>query: ". htmlspecialchars($query) ."<BR>error message: ". mysql_error() ."</PRE>";
if (!$qid) watchdog("error", "database: ". mysql_error() ."<BR>query: ". htmlspecialchars($query) ."");
// return result from query:
// return result from query:
return $qid;
}
......
......@@ -19,21 +19,21 @@ $site_email = "info@yourdomain.com";
#
# Comment votes:
# the keys of this associative array are displayed in each
# comment's selection box whereas the corresponding values
# represent the mathematical calculation to be performed
# the keys of this associative array are displayed in each
# comment's selection box whereas the corresponding values
# represent the mathematical calculation to be performed
# to update a comment's value.
#
$comment_votes = array("none" => "none",
"-1" => "- 1",
$comment_votes = array("none" => "none",
"-1" => "- 1",
"0" => "+ 0",
"+1" => "+ 1",
"+2" => "+ 2",
"+3" => "+ 3",
"+4" => "+ 4",
"+3" => "+ 3",
"+4" => "+ 4",
"+5" => "+ 5");
#
#
# Allowed HTML tags:
#
$allowed_html = "<A><B><BLOCKQUOTE><BR><DD><DL><DT><EM><HR><I><LI><SMALL><OL><U><UL>";
......@@ -52,18 +52,18 @@ $themes = array("UnConeD" => array(
"themes/unconed/unconed.theme",
"modern theme, gray and blue, high coolness factor"),
"Marvin" => array(
"themes/marvin/marvin.theme",
"themes/marvin/marvin.theme",
"classic theme, white, basic design with a fresh look"));
#
# Submission moderation votes:
# the keys of this associative array are displayed in each
# submission's selection box whereas the corresponding values
# represent the mathematical calculation to be performed to
# the keys of this associative array are displayed in each
# submission's selection box whereas the corresponding values
# represent the mathematical calculation to be performed to
# update a comment's value.
# Warning: changing $submission_votes will affect the integrity
# of all pending stories in the open submission queue. Do not
# change this setting unless there are no pending stories in the
# of all pending stories in the open submission queue. Do not
# change this setting unless there are no pending stories in the
# submission queue or unless you know what you are doing.
$submission_votes = array("neutral (+0)" => "+ 0",
"post it (+1)" => "+ 1",
......@@ -75,7 +75,7 @@ $submission_votes = array("neutral (+0)" => "+ 0",
# submission. It is supposed to stop malicious attempts to screw
# with the database and to stop denial of service attacks.
# Example:
# '"comment" => 60' means that there is only one new comment
# '"comment" => 60' means that there is only one new comment
# allowed from the same IP-address every 60 seconds.
#
$submission_rate = array("comment" => "60", // 60 seconds = 1 minute
......@@ -83,7 +83,7 @@ $submission_rate = array("comment" => "60", // 60 seconds = 1 minute
"story" => "300"); // 300 seconds = 5 minutes
#
# Submission size:
# the maximum length (i.e. the maximum number of characters) a
# the maximum length (i.e. the maximum number of characters) a
# story, a diary entry, or a comment is allowed to be.
#
$submission_size = 12000; // 12.000 characters is more or less 300 lines
......
......@@ -16,7 +16,7 @@ function module_rehash_crons($name, $module) {
if ($module["cron"]) {
if (!db_fetch_object(db_query("SELECT * FROM crons WHERE module = '$name'"))) {
db_query("INSERT INTO crons (module, scheduled, timestamp) VALUES ('". check_input($name) ."', '172800', '0')");
}
}
}
else {
db_query("DELETE FROM crons WHERE module = '$name'");
......@@ -24,7 +24,7 @@ function module_rehash_crons($name, $module) {
}
function module_rehash_blocks($name, $module) {
db_query("DELETE FROM blocks WHERE module = '$name'");
db_query("DELETE FROM blocks WHERE module = '$name'");
if ($module["block"] && $blocks = $module["block"]()) {
foreach ($blocks as $offset=>$block) {
db_query("INSERT INTO blocks (name, module, offset) VALUES ('". check_input($block["info"]) ."', '". check_input($name) ."', '". check_input($offset) ."')");
......@@ -34,7 +34,7 @@ function module_rehash_blocks($name, $module) {
function module_rehash($name) {
global $repository;
if ($module = $repository[$name]) {
$result = db_query("SELECT * FROM modules WHERE name = '$name'");
......
......@@ -12,7 +12,7 @@ function submission_score($id) {
function submission_vote($id, $vote, $comment) {
global $user;
if (!user_getHistory($user->history, "s$id")) {
// Update submission's score- and votes-field:
db_query("UPDATE stories SET score = score $vote, votes = votes + 1 WHERE id = $id");
......@@ -25,9 +25,9 @@ function submission_vote($id, $vote, $comment) {
// Update user's history record:
user_setHistory($user, "s$id", $vote);
// Update story table (if required):
$result = db_query("SELECT * FROM stories WHERE id = $id");
$result = db_query("SELECT * FROM stories WHERE id = $id");
if ($submission = db_fetch_object($result)) {
if (section_post_threshold($submission->section) <= $submission->score) {
db_query("UPDATE stories SET status = 2, timestamp = '". time() ."' WHERE id = $id");
......
......@@ -4,7 +4,7 @@ function theme_load() {
global $user, $themes;
if ($user->theme && file_exists($themes[$user->theme][0])) {
include_once $themes[$user->theme][0];
include_once $themes[$user->theme][0];
}
else {
include_once $themes[key($themes)][0];
......@@ -14,8 +14,8 @@ function theme_load() {
function theme_account($theme) {
global $user, $site_name, $links, $menu;
if ($user->id) {
if ($user->id) {
function submission_number() {
$result = db_query("SELECT COUNT(id) FROM stories WHERE status = 1");
......@@ -72,7 +72,7 @@ function menu($name, $module) {
function theme_blocks($region, $theme) {
global $id, $PHP_SELF, $user;
switch (strrchr($PHP_SELF, "/")) {
case "/story.php":
if ($user->id) $story = db_fetch_object(db_query("SELECT * FROM stories WHERE id = '$id'"));
......@@ -84,7 +84,7 @@ function theme_blocks($region, $theme) {
else $result = db_query("SELECT * FROM blocks WHERE status = 2 ORDER BY weight");
while ($block = db_fetch_object($result)) {
$blocks = module_execute($block->module, "block");
$theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]);
$theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]);
}
break;
}
......@@ -102,7 +102,7 @@ function theme_moderation_results($theme, $story) {
while ($account = db_fetch_object($result)) {
$output .= format_username($account->userid) ." voted `". user_getHistory($account->history, "s$story->id") ."'.<BR>";
}
$theme->box("Moderation results", ($output ? $output : "This story has not been moderated yet."));
}
}
......@@ -116,7 +116,7 @@ function theme_related_links($theme, $story) {
if (!stristr($link, "mailto:")) $content .= "<LI>$link</LI>";
}
// Stories in the same section:
// Stories in the same section:
$content .= " <LI>More about <A HREF=\"index.php?section=". urlencode($story->section) ."\">$story->section</A>.</LI>";
// Stories from the same author:
......@@ -137,11 +137,11 @@ function theme_new_headlines($theme, $num = 10) {
function theme_old_headlines($theme, $num = 10) {
global $user;
if ($user->stories) $result = db_query("SELECT id, subject, timestamp FROM stories WHERE status = 2 ORDER BY timestamp DESC LIMIT $user->stories, $num");
else $result = db_query("SELECT id, subject, timestamp FROM stories WHERE status = 2 ORDER BY timestamp DESC LIMIT $num, $num");
while ($story = db_fetch_object($result)) {
while ($story = db_fetch_object($result)) {
if ($time != date("F jS", $story->timestamp)) {
$content .= "<P><B>". date("l, M jS", $story->timestamp) ."</B></P>\n";
$time = date("F jS", $story->timestamp);
......
......@@ -12,12 +12,12 @@ function User($userid, $passwd = "") {
function user_save($data, $id = 0) {
global $user;
foreach ($data as $key=>$value) {
if ($key == "passwd") $query .= "$key = PASSWORD('". addslashes($value) ."'), ";
else $query .= "$key = '". addslashes($value) ."', ";
}
if (empty($id)) {
db_query("INSERT INTO users SET $query last_access = '". time() ."', last_host = '$GLOBALS[REMOTE_HOST]'");
}
......@@ -36,7 +36,7 @@ function user_getHistory($history, $field) {
if (reset($entry) == $field) $rval = end($entry);
}
return $rval;
}
}
function user_setHistory(&$user, $field, $value) {
......@@ -56,7 +56,7 @@ function user_setHistory(&$user, $field, $value) {
$entry = explode(":", current($data));
if ($entry[0] == $field) $entry[1] = $value;
$rval .= "$entry[0]:$entry[1];";
}
}
}
else {
// not found: add new entry:
......
......@@ -12,8 +12,8 @@ function watchdog($id, $message) {
if ($watchdog[$id][1] && !($user->permissions == 1 || $user->id == 1)) {
if ($log = db_fetch_object(db_query("SELECT * FROM watchdog WHERE hostname = '". getenv("REMOTE_ADDR") ."' AND level = '". $watchdog[$id][0] ."'"))) {
if (time() - $log->timestamp < $watchdog[$id][1]) {
watchdog("warning", "'". getenv("REMOTE_ADDR") ."' exceeded '$id' submission rate");
if (time() - $log->timestamp < $watchdog[$id][1]) {
watchdog("warning", "'". getenv("REMOTE_ADDR") ."' exceeded '$id' submission rate");
header("Location: error.php?op=flood");
exit();
}
......@@ -28,5 +28,5 @@ function watchdog_clean($history = 302400) {
$timestamp = time() - $history;
db_query("DELETE FROM watchdog WHERE timestamp < $timestamp");
}
?>
......@@ -24,7 +24,7 @@ function account_display($order = "username") {
// Perform query:
$result = db_query("SELECT u.id, u.userid, u.". strtok($sort[$order], " ") .", u.url FROM users u ORDER BY $sort[$order]");
// Generate output:
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR>\n";
......@@ -57,7 +57,7 @@ function account_display($order = "username") {
case "last_access":
$output .= " <TD>". format_interval(time() - $account[$value]) ." ago</TD>\n";
break;
case "status":
case "status":
$output .= " <TD ALIGN=\"center\">". $stat[$account[$value]] ."</TD>\n";
break;
case "permissions":
......@@ -117,12 +117,12 @@ function account_edit($name) {
if ($account = db_fetch_object($result)) {
foreach ($status as $key=>$value) {
$stat .= " <OPTION VALUE=\"$key\"". (($account->status == $key) ? " SELECTED" : "") .">$value</OPTION>\n";
$stat .= " <OPTION VALUE=\"$key\"". (($account->status == $key) ? " SELECTED" : "") .">$value</OPTION>\n";
}
$stat = "<SELECT NAME=\"edit[status]\">\n$stat</SELECT>\n";
foreach ($permissions as $key=>$value) {
$perm .= " <OPTION VALUE=\"$key\"". (($account->permissions == $key) ? " SELECTED" : "") .">$value</OPTION>\n";
$perm .= " <OPTION VALUE=\"$key\"". (($account->permissions == $key) ? " SELECTED" : "") .">$value</OPTION>\n";
}
$perm = "<SELECT NAME=\"edit[permissions]\">\n$perm</SELECT>\n";
......@@ -202,7 +202,7 @@ function account_admin() {
account_display($order);
break;
default:
account_display();
account_display();
}
}
......
......@@ -36,7 +36,7 @@ function affiliate_block() {
$content .= " </SELECT>\n";
$content .= "</FORM>\n";
$content .= "</CENTER>\n";
$blocks[0]["subject"] = "Affiliate sites";
$blocks[0]["content"] = $content;
$blocks[0]["info"] = "Affiliate sites (selection)";
......@@ -51,7 +51,7 @@ function affiliate_block() {
$blocks[1]["subject"] = "Affiliate sites";
$blocks[1]["content"] = $content;
$blocks[1]["info"] = "Affiliate sites (sequential)";
return $blocks;
}
......
......@@ -48,27 +48,29 @@ class backend {
}
function rdf2sql($timout = 10) {
global $site_name;
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, "User-Agent: $site_name\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")) {
......@@ -80,7 +82,7 @@ class backend {
$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;
......@@ -90,18 +92,18 @@ class backend {
$link = ereg_replace(".*<link>", "", $item);
$link = ereg_replace("</link>.*", "", $link);
$title = ereg_replace(".*<title>", "", $item);
$title = ereg_replace("</title>.*", "", $title);
$title = ereg_replace("</title>.*", "", $title);
// Clean headlines:
$title = stripslashes($title);
// Count the number of stories:
$number += 1;
// Insert item in database:
$result = db_query("INSERT INTO headlines (id, title, link, number) VALUES('". check_input($this->id) ."', '". check_input($title) ."', '". check_input($link) ."', '". check_input($number) ."')");
}
// Mark channels as being updated:
$result = db_query("UPDATE channel SET timestamp = '". time() ."' WHERE id = $this->id");
$this->timestamp = time();
......@@ -143,8 +145,8 @@ class backend {
}
// 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>";
$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);
}
......@@ -152,24 +154,24 @@ class backend {
}
function add() {
// Add channel:
// Add channel:
$result = db_query("INSERT INTO channel (site, file, url, contact, timestamp) VALUES ('". check_input($this->site) ."', '". check_input($this->file) ."', '". check_input($this->url) ."', '". check_input($this->contact) ."', 1)");
}
function delete() {
// Delete channel:
// Delete channel:
$result = db_query("DELETE FROM channel WHERE id = $this->id");
// Delete headlines:
$result = db_query("DELETE FROM headlines WHERE id = $this->id");
$result = db_query("DELETE FROM headlines WHERE id = $this->id");
}
function refresh() {
// Delete headlines:
$result = db_query("DELETE FROM headlines WHERE id = $this->id");
$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 = 1 WHERE id = $this->id");
$result = db_query("UPDATE channel SET timestamp = 1 WHERE id = $this->id");
}
function dump() {
......
......@@ -37,12 +37,12 @@ function ban_admin_new($mask, $category, $reason) {
function ban_display($category = "") {
global $type2index;
// initialize variable:
// 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=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR>\n";
......@@ -67,7 +67,7 @@ function ban_display($category = "") {
}
$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";
print $output;
}
......@@ -88,7 +88,7 @@ function ban_admin_add() {
$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";
print $output;
}
......
......@@ -17,18 +17,18 @@ function block_page() {
global $theme;
$result = db_query("SELECT * FROM blocks WHERE status = 1 ORDER BY module");
$theme->header();
print "<TABLE BORDER=\"0\">\n";
while ($block = db_fetch_object($result)) {
if ($state % 3 == 0) print " <TR>\n";
print " <TD ALIGN=\"center\" VALIGN=\"top\" WIDTH=\"33%\">\n";
print " <TD ALIGN=\"center\" VALIGN=\"top\" WIDTH=\"33%\">\n";
$blocks = module_execute($block->module, "block");
$theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]);
print " </TD>\n";
if ($state % 3 == 2) print " </TR>\n";
$state += 1;
}
}
print "</TABLE>\n";
$theme->footer();
}
......@@ -43,12 +43,12 @@ function block_admin_display() {
global $repository;
$result = db_query("SELECT * FROM blocks ORDER BY module");
// Generate output:
$output .= "<FORM ACTION=\"admin.php?mod=block\" METHOD=\"post\">\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>block</TH><TH>module</TH><TH>status</TH><TH>weight</TH><TH>region</TH></TR>\n";
while ($block = db_fetch_object($result)) {
$module = ($repository[$block->module]["admin"]) ? "<A HREF=\"admin.php?mod=$block->module\">$block->module</A>" : $block->module;
......@@ -70,12 +70,12 @@ function block_admin_display() {
$region .= "</SELECT>\n";
$output .= " <TR><TD>". $block->name ."</TD><TD ALIGN=\"center\">$module</TD><TD>$status</TD><TD>$weight</TD><TD>$region</TD></TR>\n";
unset($status);
unset($weight);
unset($region);
}
$output .= "</TABLE>\n";
$output .= "<INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Save blocks\">\n";
$output .= "</FORM>\n";
......@@ -95,7 +95,7 @@ function block_admin_overview() {
$rblocks .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
while ($block = db_fetch_object($result)) $rblocks .= " <TR><TD NOWRAP>". ($block->status == 2 ? "<B>$block->name</B>" : $block->name) ."</TD><TD>$block->weight</TD></TR>\n";
$rblocks .= "</TABLE>\n";
$output .= "<P><B>layout 1:</B></P>\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">$site_name header</TD></TR>\n";
......@@ -127,7 +127,7 @@ function block_admin_overview() {
function block_admin() {
global $op, $edit;
print "<SMALL><A HREF=\"admin.php?mod=block\">configure</A> | <A HREF=\"admin.php?mod=block&op=overview\">overview</A> | <A HREF=\"admin.php?mod=block&op=help\">help</A></SMALL><HR>\n";
switch ($op) {
......@@ -143,7 +143,7 @@ function block_admin() {
default:
block_admin_display();
}
}
?>
......@@ -17,18 +17,18 @@ function block_page() {
global $theme;
$result = db_query("SELECT * FROM blocks WHERE status = 1 ORDER BY module");
$theme->header();
print "<TABLE BORDER=\"0\">\n";
while ($block = db_fetch_object($result)) {
if ($state % 3 == 0) print " <TR>\n";
print " <TD ALIGN=\"center\" VALIGN=\"top\" WIDTH=\"33%\">\n";
print " <TD ALIGN=\"center\" VALIGN=\"top\" WIDTH=\"33%\">\n";
$blocks = module_execute($block->module, "block");
$theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]);
print " </TD>\n";
if ($state % 3 == 2) print " </TR>\n";
$state += 1;
}
}
print "</TABLE>\n";
$theme->footer();
}
......@@ -43,12 +43,12 @@ function block_admin_display() {
global $repository;
$result = db_query("SELECT * FROM blocks ORDER BY module");
// Generate output:
$output .= "<FORM ACTION=\"admin.php?mod=block\" METHOD=\"post\">\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>block</TH><TH>module</TH><TH>status</TH><TH>weight</TH><TH>region</TH></TR>\n";
while ($block = db_fetch_object($result)) {
$module = ($repository[$block->module]["admin"]) ? "<A HREF=\"admin.php?mod=$block->module\">$block->module</A>" : $block->module;
......@@ -70,12 +70,12 @@ function block_admin_display() {
$region .= "</SELECT>\n";
$output .= " <TR><TD>". $block->name ."</TD><TD ALIGN=\"center\">$module</TD><TD>$status</TD><TD>$weight</TD><TD>$region</TD></TR>\n";
unset($status);
unset($weight);
unset($region);
}
$output .= "</TABLE>\n";
$output .= "<INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Save blocks\">\n";
$output .= "</FORM>\n";
......@@ -95,7 +95,7 @@ function block_admin_overview() {
$rblocks .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
while ($block = db_fetch_object($result)) $rblocks .= " <TR><TD NOWRAP>". ($block->status == 2 ? "<B>$block->name</B>" : $block->name) ."</TD><TD>$block->weight</TD></TR>\n";
$rblocks .= "</TABLE>\n";
$output .= "<P><B>layout 1:</B></P>\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">$site_name header</TD></TR>\n";
......@@ -127,7 +127,7 @@ function block_admin_overview() {
function block_admin() {
global $op, $edit;
print "<SMALL><A HREF=\"admin.php?mod=block\">configure</A> | <A HREF=\"admin.php?mod=block&op=overview\">overview</A> | <A HREF=\"admin.php?mod=block&op=help\">help</A></SMALL><HR>\n";
switch ($op) {
......@@ -143,7 +143,7 @@ function block_admin() {
default:
block_admin_display();
}
}
?>
......@@ -50,9 +50,9 @@ function box_block() {
function box_admin_display() {
$type = array(0 => "ASCII", 1 => "HTML", 2 => "PHP");
$result = db_query("SELECT * FROM boxes");
while ($block = db_fetch_object($result)) {
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
$output .= " <TR><TH>Subject:</TH><TD>". format_data($block->subject) ."</TD></TR>\n";
......@@ -89,7 +89,7 @@ function box_admin_new() {
}
function box_admin_add($subject, $content, $info, $link, $type) {
db_query("INSERT INTO boxes (subject, content, info, link, type) VALUES ('". check_input($subject) ."', '". check_code($content) ."', '". check_input($info) ."', '". check_input($link) ."', '". check_input($type) ."')");
db_query("INSERT INTO boxes (subject, content, info, link, type) VALUES ('". check_input($subject) ."', '". check_code($content) ."', '". check_input($info) ."', '". check_input($link) ."', '". check_input($type) ."')");
}
function box_admin_delete($id) {
......@@ -108,7 +108,7 @@ function box_admin_edit($id) {