summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-01-21 19:41:11 +0000
committerDries Buytaert <dries@buytaert.net>2001-01-21 19:41:11 +0000
commitea9788853352750389307d94999ebe58991929b1 (patch)
tree50634b44ac6bf11dd346d9b6f034e415bea4b8c2
parent7cc7b405e323f36037dab894b69d6fd739915d5d (diff)
downloadbrdo-ea9788853352750389307d94999ebe58991929b1.tar.gz
brdo-ea9788853352750389307d94999ebe58991929b1.tar.bz2
I know, I know, it is getting nasty lately but I have another large commit after nothing but code.
This time I redid the "category"-stuff. Categories - from now on called sections - are now maintained from the admin pages, can have their own post, dump and timout thresholds as discussed earlier (some weeks ago). By tomorrow evening users will be able to enable or disable section as well - i.e. to customize the content of drop.org.
-rw-r--r--account.php4
-rw-r--r--database/database.mysql13
-rw-r--r--includes/common.inc2
-rw-r--r--includes/function.inc12
-rw-r--r--includes/hostname.conf16
-rw-r--r--includes/section.inc25
-rw-r--r--includes/story.inc4
-rw-r--r--includes/submission.inc21
-rw-r--r--includes/theme.inc16
-rw-r--r--includes/user.inc4
-rw-r--r--index.php8
-rw-r--r--modules/section.module136
-rw-r--r--modules/story.module32
-rw-r--r--modules/story/story.module32
-rw-r--r--modules/wishlist.module10
-rw-r--r--search.php31
-rw-r--r--submission.php17
-rw-r--r--submit.php39
-rw-r--r--themes/marvin/marvin.theme4
-rw-r--r--themes/unconed/unconed.theme10
20 files changed, 282 insertions, 154 deletions
diff --git a/account.php b/account.php
index aaa4cb597..d858b1c33 100644
--- a/account.php
+++ b/account.php
@@ -454,12 +454,12 @@ function account_track_stories() {
$msg = "<P>This page might be helpful in case you want to keep track of the stories you contributed. You are presented an overview of your stories along with the number of replies each story got.\n<P>\n";
- $result = db_query("SELECT s.id, s.subject, s.timestamp, s.category, COUNT(c.cid) as count FROM stories s LEFT JOIN comments c ON c.lid = s.id WHERE s.status = 2 AND s.author = $user->id GROUP BY s.id DESC");
+ $result = db_query("SELECT s.id, s.subject, s.timestamp, s.section, COUNT(c.cid) as count FROM stories s LEFT JOIN comments c ON c.lid = s.id WHERE s.status = 2 AND s.author = $user->id GROUP BY s.id DESC");
while ($story = db_fetch_object($result)) {
$output .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Subject:</B></TD><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A> (". format_plural($story->count, "comment", "comments") .")</TD></TR>\n";
- $output .= " <TR><TD ALIGN=\"right\"><B>Category:</B></TD><TD><A HREF=\"search.php?category=". urlencode($story->category) ."\">". check_output($story->category) ."</A></TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"right\"><B>Section:</B></TD><TD><A HREF=\"search.php?section=". urlencode($story->section) ."\">". check_output($story->section) ."</A></TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Date:</B></TD><TD>". format_date($story->timestamp) ."</TD></TR>\n";
$output .= "</TABLE>\n";
$output .= "<P>\n";
diff --git a/database/database.mysql b/database/database.mysql
index e293a2eb0..7816f7989 100644
--- a/database/database.mysql
+++ b/database/database.mysql
@@ -8,11 +8,19 @@ CREATE TABLE affiliates (
PRIMARY KEY (id)
);
+CREATE TABLE sections (
+ name varchar(64) DEFAULT '' NOT NULL,
+ post tinyint(3) DEFAULT '0' NOT NULL,
+ dump tinyint(3) DEFAULT '0' NOT NULL,
+ timout tinyint(3) DEFAULT '0' NOT NULL,
+ status tinyint(2) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (name)
+);
+
CREATE TABLE blocks (
name varchar(64) DEFAULT '' NOT NULL,
module varchar(64) DEFAULT '' NOT NULL,
offset tinyint(2) DEFAULT '0' NOT NULL,
- status tinyint(2) DEFAULT '0' NOT NULL,
weight tinyint(1) DEFAULT '0' NOT NULL,
region tinyint(1) DEFAULT '0' NOT NULL,
PRIMARY KEY (name)
@@ -119,8 +127,7 @@ CREATE TABLE stories (
abstract text NOT NULL,
updates text NOT NULL,
article text NOT NULL,
- category varchar(128) DEFAULT '' NOT NULL,
- department varchar(128) DEFAULT '' NOT NULL,
+ section varchar(64) DEFAULT '' NOT NULL,
timestamp int(11) DEFAULT '0' NOT NULL,
score int(11) DEFAULT '0' NOT NULL,
votes int(11) DEFAULT '0' NOT NULL,
diff --git a/includes/common.inc b/includes/common.inc
index 22338070f..49822a83e 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -10,6 +10,6 @@ include_once "includes/user.inc";
session_start();
-$theme = load_theme();
+$theme = theme_load();
?> \ No newline at end of file
diff --git a/includes/function.inc b/includes/function.inc
index e564b3149..98a9da53e 100644
--- a/includes/function.inc
+++ b/includes/function.inc
@@ -1,17 +1,5 @@
<?
-function load_theme() {
- global $user, $themes;
-
- if ($user->theme && file_exists($themes[$user->theme][0])) {
- include_once $themes[$user->theme][0];
- }
- else {
- include_once $themes[key($themes)][0];
- }
- return new Theme();
-}
-
function check_textfield($message) {
global $allowed_html;
return strip_tags(str_replace("\"", "&quot;", stripslashes($message)), $allowed_html);
diff --git a/includes/hostname.conf b/includes/hostname.conf
index 2b81c326b..d1e83b55f 100644
--- a/includes/hostname.conf
+++ b/includes/hostname.conf
@@ -33,22 +33,6 @@ $comment_votes = array("none" => "none",
"+4" => "+ 4",
"+5" => "+ 5");
-#
-# Categories:
-#
-$categories = array("Announcements",
- "Arts & Humanities",
- "Business & Economy",
- "Coding & Webdesign",
- "Computers & Internet",
- "Drop.org",
- "Entertainment",
- "News & Media",
- "Politics & Freedom",
- "Reviews",
- "Science",
- "Society & Culture");
-
#
# Allowed HTML tags:
#
diff --git a/includes/section.inc b/includes/section.inc
new file mode 100644
index 000000000..0bebaf026
--- /dev/null
+++ b/includes/section.inc
@@ -0,0 +1,25 @@
+<?
+
+function section_get() {
+ $array = array();
+ $result = db_query("SELECT name FROM sections");
+ while ($section = db_fetch_object($result)) array_push($array, $section->name);
+ return $array;
+}
+
+function section_post_threshold($section, $threshold = 5) {
+ $result = db_query("SELECT post FROM sections WHERE name = '$section'");
+ return ($result) ? db_result($result, 0) : $threshold;
+}
+
+function section_dump_threshold($section, $threshold = - 3) {
+ $result = db_query("SELECT dump FROM sections WHERE name = '$section'");
+ return ($result) ? db_result($result, 0) : $threshold;
+}
+
+function section_timout_threshold($section, $threshold = 10) {
+ $result = db_query("SELECT timout FROM sections WHERE name = '$section'");
+ return ($result) ? db_result($result, 0) : $threshold;
+}
+
+?> \ No newline at end of file
diff --git a/includes/story.inc b/includes/story.inc
index d0c40ab14..2ec39ca16 100644
--- a/includes/story.inc
+++ b/includes/story.inc
@@ -1,12 +1,12 @@
<?
class Story {
- function Story($userid, $subject, $abstract, $article, $category, $timestamp) {
+ function Story($userid, $subject, $abstract, $article, $section, $timestamp) {
$this->userid = $userid;
$this->subject = $subject;
$this->abstract = $abstract;
$this->article = $article;
- $this->category = $category;
+ $this->section = $section;
$this->timestamp = $timestamp;
}
}
diff --git a/includes/submission.inc b/includes/submission.inc
index 628aeae75..609dc06d9 100644
--- a/includes/submission.inc
+++ b/includes/submission.inc
@@ -11,7 +11,7 @@ function submission_score($id) {
}
function submission_vote($id, $vote, $comment) {
- global $submission_post_threshold, $submission_dump_threshold, $user;
+ global $user;
if (!user_getHistory($user->history, "s$id")) {
// Update submission's score- and votes-field:
@@ -19,27 +19,30 @@ function submission_vote($id, $vote, $comment) {
// Update the comments (if required):
if ($comment) {
- watchdog("comment", "moderation: added comment with subject '$subject'");
-
db_query("INSERT INTO comments (lid, link, author, subject, comment, hostname, timestamp, score) VALUES($id, 'story', $user->id, '". check_input(substr($comment, 0, 29)) ." ...', '". check_input($comment) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."', '1')");
+ watchdog("comment", "moderation: added comment with subject '$subject'");
}
// Update user's history record:
- user_setHistory($user, "s$id", $vote); // s = submission
+ user_setHistory($user, "s$id", $vote);
// Update story table (if required):
$result = db_query("SELECT * FROM stories WHERE id = $id");
if ($submission = db_fetch_object($result)) {
- if ($submission->score >= $submission_post_threshold) {
+ if ($submission->score >= section_post_threshold($submission->section)) {
db_query("UPDATE stories SET status = 2, timestamp = '". time() ."' WHERE id = $id");
- watchdog("message", "posted story `$submission->subject'");
+ watchdog("message", "posted story '$submission->subject'");
+ }
+ else if ($submission->score <= section_dump_threshold($submission->section)) {
+ db_query("UPDATE stories SET status = 0, timestamp = '". time() ."' WHERE id = $id");
+ watchdog("message", "dumped story '$submission->subject'");
}
- if ($submission->score <= $submission_dump_threshold) {
+ else if ($submission->votes >= section_timout_threshold($submission->section)) {
db_query("UPDATE stories SET status = 0, timestamp = '". time() ."' WHERE id = $id");
- watchdog("message", "dumped story `$submission->subject'");
+ watchdog("message", "expired story '$submission->subject'");
}
}
}
}
-?>
+?> \ No newline at end of file
diff --git a/includes/theme.inc b/includes/theme.inc
index 166470e10..bc09e1588 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -1,5 +1,17 @@
<?
+function theme_load() {
+ global $user, $themes;
+
+ if ($user->theme && file_exists($themes[$user->theme][0])) {
+ include_once $themes[$user->theme][0];
+ }
+ else {
+ include_once $themes[key($themes)][0];
+ }
+ return new Theme();
+}
+
function theme_account($theme) {
global $user, $site_name, $links, $menu;
@@ -104,8 +116,8 @@ function theme_related_links($theme, $story) {
if (!stristr($link, "mailto:")) $content .= "<LI>$link</LI>";
}
- // Stories in the same category:
- $content .= " <LI>More about <A HREF=\"search.php?category=". urlencode($story->category) ."\">$story->category</A>.</LI>";
+ // 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:
if ($story->userid) $content .= " <LI>Also by <A HREF=\"search.php?author=". urlencode($story->userid) ."\">$story->userid</A>.</LI>";
diff --git a/includes/user.inc b/includes/user.inc
index 4c640a7c4..6f87df47e 100644
--- a/includes/user.inc
+++ b/includes/user.inc
@@ -71,8 +71,4 @@ function user_setHistory(&$user, $field, $value) {
db_query($query);
}
-function user_clean() {
- // todo - called by cron job
-}
-
?> \ No newline at end of file
diff --git a/index.php b/index.php
index 2dc1f4025..924c157c4 100644
--- a/index.php
+++ b/index.php
@@ -2,18 +2,12 @@
include "includes/common.inc";
-// Security check:
-if (strstr($number, " ") || strstr($date, " ")) {
- watchdog("error", "main page: attempt to provide malicious input through URI");
- exit();
-}
-
// Initialize/pre-process variables:
$number = ($user->stories) ? $user->stories : 10;
$date = ($date) ? $date : time();
// Perform query:
-$result = db_query("SELECT stories.*, users.userid, COUNT(comments.lid) AS comments FROM stories LEFT JOIN comments ON stories.id = comments.lid LEFT JOIN users ON stories.author = users.id WHERE stories.status = 2 AND stories.timestamp <= $date GROUP BY stories.id ORDER BY stories.timestamp DESC LIMIT $number");
+$result = db_query("SELECT stories.*, users.userid, COUNT(comments.lid) AS comments FROM stories LEFT JOIN comments ON stories.id = comments.lid LEFT JOIN users ON stories.author = users.id WHERE stories.status = 2 ". ($section ? "AND section = '$section' " : "") ."AND stories.timestamp <= $date GROUP BY stories.id ORDER BY stories.timestamp DESC LIMIT $number");
// Display stories:
$theme->header();
diff --git a/modules/section.module b/modules/section.module
new file mode 100644
index 000000000..aa18e6720
--- /dev/null
+++ b/modules/section.module
@@ -0,0 +1,136 @@
+<?
+
+$module = array("help" => "section_help",
+ "block" => "section_block",
+ "admin" => "section_admin");
+
+// global variables:
+$_section = array("status" => array(2 => "enabled: always", 1 => "enabled: custom", 0 => "disabled"),
+ "timout" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100),
+ "post" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100),
+ "dump" => array(-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -20, -25, -30));
+
+function section_help() {
+ ?>
+ under construction
+ <?
+}
+
+function section_block() {
+ $result = db_query("SELECT se.name, COUNT(st.id) AS stories FROM sections se LEFT JOIN stories st ON se.name = st.section GROUP BY se.name");
+ while ($_section = db_fetch_object($result)) {
+ $content .= "<LI><A HREF=\"?section=". urlencode($_section->name) ."\">$_section->name</A> (". format_data($_section->stories, 0) .")</LI>\n";
+ }
+
+ $block[0]["subject"] = "Sections";
+ $block[0]["content"] = $content;
+ $block[0]["info"] = "Section list";
+
+ return $block;
+}
+
+function section_add() {
+ global $_section;
+
+ $output .= " <FORM ACTION=\"admin.php?mod=section\" METHOD=\"post\">\n";
+ $output .= " <P>\n";
+ $output .= " <B>Section name:</B><BR>\n";
+ $output .= " <INPUT TYPE=\"text\" NAME=\"edit[name]\" SIZE=\"50\">\n";
+ $output .= " </P>\n";
+ $output .= " <P>\n";
+ $output .= " <B>Post threshold:</B><BR>\n";
+ $output .= " <SELECT NAME=\"edit[post]\">\n";
+ foreach ($_section[post] as $value) $output .= "<OPTION VALUE=\"$value\">". format_plural($value, "point", "points") ."</OPTION>\n";
+ $output .= " </SELECT>\n";
+ $output .= " </P>\n";
+ $output .= " <P>\n";
+ $output .= " <B>Dump threshold:</B><BR>\n";
+ $output .= " <SELECT NAME=\"edit[dump]\">\n";
+ foreach ($_section[dump] as $value) $output .= "<OPTION VALUE=\"$value\">". format_plural($value, "point", "points") ."</OPTION>\n";
+ $output .= " </SELECT>\n";
+ $output .= " </P>\n";
+ $output .= " <P>\n";
+ $output .= " <B>Timout threshold:</B><BR>\n";
+ $output .= " <SELECT NAME=\"edit[timout]\">\n";
+ foreach ($_section[timout] as $value) $output .= "<OPTION VALUE=\"$value\">". format_plural($value, "vote", "votes") ."</OPTION>\n";
+ $output .= " </SELECT>\n";
+ $output .= " </P>\n";
+ $output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Add section\">\n";
+ $output .= " </FORM>\n";
+
+ print $output;
+}
+
+function section_add_save($edit) {
+ db_query("INSERT INTO sections (name, post, dump, timout) VALUES ('". check_input($edit[name]) ."', '". check_input($edit[post]) ."', '". check_input($edit[dump]) ."', '". check_input($edit[timout]) ."')");
+}
+
+function section_delete($name) {
+ db_query("DELETE FROM sections WHERE name = '$name'");
+}
+
+function section_display() {
+ global $_section;
+
+ $status = $_section[status];
+ $timout = $_section[timout];
+ $post = $_section[post];
+ $dump = $_section[dump];
+
+ // Perform query:
+ $result = db_query("SELECT * FROM sections");
+
+ // Generate output:
+ $output .= "<FORM ACTION=\"admin.php?mod=section\" METHOD=\"post\">\n";
+ $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
+ $output .= " <TR><TH>section name</TH><TH>status</TH><TH>post threshold</TH><TH>dump threshold</TH><TH>expiration threshold<TH>operations</TH></TR>\n";
+ while ($_section = db_fetch_object($result)) {
+ foreach ($status as $key=>$value) $options0 .= "<OPTION VALUE=\"$key\"". (($_section->status == $key) ? " SELECTED" : "") .">$value</OPTION>\n";
+ foreach ($post as $value) $options1 .= "<OPTION VALUE=\"$value\"". (($_section->post == $value) ? " SELECTED" : "") .">". format_plural($value, "point", "points") ."</OPTION>\n";
+ foreach ($dump as $value) $options2 .= "<OPTION VALUE=\"$value\"". (($_section->dump == $value) ? " SELECTED" : "") .">". format_plural($value, "point", "points") ."</OPTION>\n";
+ foreach ($timout as $value) $options3 .= "<OPTION VALUE=\"$value\"". (($_section->timout == $value) ? " SELECTED" : "") .">". format_plural($value, "vote", "votes") ."</OPTION>\n";
+ $output .= " <TR><TD>". check_output($_section->name) ."</TD><TD><SELECT NAME=\"edit[$_section->name][status]\">$options0</SELECT></TD><TD><SELECT NAME=\"edit[$_section->name][post]\">$options1</SELECT></TD><TD><SELECT NAME=\"edit[$_section->name][dump]\">$options2</SELECT></TD><TD><SELECT NAME=\"edit[$_section->name][timout]\">$options3</SELECT></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=section&op=delete&name=". urlencode($_section->name) ."\">delete</A></TD></TR>\n";
+ unset($options0); unset($options1); unset($options2); unset($options3);
+ }
+ $output .= "</TABLE>\n";
+ $output .= "<INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Save sections\">\n";
+ $output .= "</FORM>\n";
+
+ print $output;
+}
+
+function section_display_save($edit) {
+ foreach ($edit as $key=>$value) {
+ db_query("UPDATE sections SET status = '". $value[status] ."', post = '". $value[post] ."', dump = '". $value[dump] ."', timout = '". $value[timout] ."' WHERE name = '$key'");
+ }
+}
+
+function section_admin() {
+ global $op, $edit, $name;
+
+ print "<SMALL><A HREF=\"admin.php?mod=section&op=add\">add new section</A> | <A HREF=\"admin.php?mod=section\">overview</A> | <A HREF=\"admin.php?mod=section&op=help\">help</A></SMALL><HR>\n";
+
+ switch($op) {
+ case "add":
+ section_add($edit);
+ break;
+ case "help":
+ section_help();
+ break;
+ case "delete":
+ section_delete($name);
+ section_display();
+ break;
+ case "Add section":
+ section_add_save($edit);
+ section_display();
+ break;
+ case "Save sections":
+ section_display_save($edit);
+ // fall through
+ default:
+ section_display();
+ }
+}
+
+?>
diff --git a/modules/story.module b/modules/story.module
index dbf7cc7f9..762626ec4 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -5,6 +5,8 @@ $module = array("cron" => "story_cron",
"block" => "story_block",
"admin" => "story_admin");
+include_once "includes/section.inc";
+
function story_cron() {
$result = db_query("SELECT * FROM stories WHERE status = 3 AND timestamp <= ". time() ."");
while ($story = db_fetch_object($result)) {
@@ -46,7 +48,7 @@ function story_block() {
}
function story_add() {
- global $allowed_html, $categories;
+ global $allowed_html;
$output .= "<FORM ACTION=\"admin.php?mod=story\" METHOD=\"post\">\n";
@@ -55,10 +57,10 @@ function story_add() {
$output .= " <INPUT TYPE=\"text\" NAME=\"edit[subject]\" SIZE=\"50\" MAXLENGTH=\"60\"><BR>\n";
$output .= "</P>\n";
- $output .= "<P><B>Category:</B><BR>\n";
- $output .= " <SELECT NAME=\"edit[category]\">\n";
- for ($i = 0; $i < sizeof($categories); $i++) {
- $output .= " <OPTION VALUE=\"$categories[$i]\">$categories[$i]</OPTION>\n";
+ $output .= "<P><B>Section:</B><BR>\n";
+ $output .= " <SELECT NAME=\"edit[section]\">\n";
+ foreach ($sections = section_get() as $value) {
+ $output .= " <OPTION VALUE=\"$value\">$value</OPTION>\n";
}
$output .= " </SELECT>\n";
$output .= "</P>\n";
@@ -96,12 +98,12 @@ function story_add() {
function story_add_save($edit) {
global $user;
$timestamp = ($edit[status] == 3 && strtotime($edit[date]) > time()) ? strtotime($edit[date]) : time();
- db_query("INSERT INTO stories (author, subject, abstract, article, category, status, timestamp) VALUES ('$user->id', '". check_input($edit[subject]) ."', '". check_input($edit[abstract]) ."', '". check_input($edit[article]) ."', '". check_input($edit[category]) ."', '$edit[status]', '$timestamp')");
+ db_query("INSERT INTO stories (author, subject, abstract, article, section, status, timestamp) VALUES ('$user->id', '". check_input($edit[subject]) ."', '". check_input($edit[abstract]) ."', '". check_input($edit[article]) ."', '". check_input($edit[section]) ."', '$edit[status]', '$timestamp')");
watchdog("story", "story: added '$edit[subject]'");
}
function story_edit($id) {
- global $allowed_html, $categories;
+ global $allowed_html;
$result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.id = $id");
$story = db_fetch_object($result);
@@ -119,10 +121,10 @@ function story_edit($id) {
$output .= "</P>\n";
$output .= "<P>\n";
- $output .= " <B>Category:</B><BR>\n";
- $output .= " <SELECT NAME=\"edit[category]\">\n";
- for ($i = 0; $i < sizeof($categories); $i++) {
- $output .= " <OPTION VALUE=\"$categories[$i]\"". ($story->category == $categories[$i] ? " SELECTED" : "") .">$categories[$i]</OPTION>\n";
+ $output .= " <B>Section:</B><BR>\n";
+ $output .= " <SELECT NAME=\"edit[section]\">\n";
+ foreach ($sections = section_get() as $value) {
+ $output .= " <OPTION VALUE=\"$value\"". ($story->section == $value ? " SELECTED" : "") .">$value</OPTION>\n";
}
$output .= "</SELECT>\n";
$output .= "</P>\n";
@@ -163,8 +165,8 @@ function story_edit($id) {
}
function story_edit_save($id, $edit) {
- if ($edit[status] == 3 && strtotime($edit[date]) > time()) db_query("UPDATE stories SET subject = '". check_input($edit[subject]) ."', abstract = '". check_input($edit[abstract]) ."', updates = '". check_input($edit[updates]) ."', article = '". check_input($edit[article]) ."', category = '". check_input($edit[category]) ."', status = '$edit[status]', timestamp = '". strtotime($edit[date]) ."' WHERE id = '$id'");
- else db_query("UPDATE stories SET subject = '". check_input($edit[subject]) ."', abstract = '". check_input($edit[abstract]) ."', updates = '". check_input($edit[updates]) ."', article = '". check_input($edit[article]) ."', category = '". check_input($edit[category]) ."', status = '$edit[status]' WHERE id = '$id'");
+ if ($edit[status] == 3 && strtotime($edit[date]) > time()) db_query("UPDATE stories SET subject = '". check_input($edit[subject]) ."', abstract = '". check_input($edit[abstract]) ."', updates = '". check_input($edit[updates]) ."', article = '". check_input($edit[article]) ."', section = '". check_input($edit[section]) ."', status = '$edit[status]', timestamp = '". strtotime($edit[date]) ."' WHERE id = '$id'");
+ else db_query("UPDATE stories SET subject = '". check_input($edit[subject]) ."', abstract = '". check_input($edit[abstract]) ."', updates = '". check_input($edit[updates]) ."', article = '". check_input($edit[article]) ."', section = '". check_input($edit[section]) ."', status = '$edit[status]' WHERE id = '$id'");
watchdog("message", "story: modified `$edit[subject]'");
}
@@ -189,14 +191,14 @@ function story_display() {
$result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 0 ORDER BY timestamp DESC LIMIT 5");
$output .= " <TR><TH COLSPAN=\"4\">dumped stories</TTH></TR>\n";
while ($story = db_fetch_object($result)) {
- $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n";
+ $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->section</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n";
}
// Posted stories:
$result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 2 ORDER BY timestamp DESC LIMIT 15");
$output .= " <TR><TH COLSPAN=\"4\">posted stories</TH></TR>\n";
while ($story = db_fetch_object($result)) {
- $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n";
+ $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->section</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n";
}
$output .= "</TABLE>\n";
diff --git a/modules/story/story.module b/modules/story/story.module
index dbf7cc7f9..762626ec4 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -5,6 +5,8 @@ $module = array("cron" => "story_cron",
"block" => "story_block",
"admin" => "story_admin");
+include_once "includes/section.inc";
+
function story_cron() {
$result = db_query("SELECT * FROM stories WHERE status = 3 AND timestamp <= ". time() ."");
while ($story = db_fetch_object($result)) {
@@ -46,7 +48,7 @@ function story_block() {
}
function story_add() {
- global $allowed_html, $categories;
+ global $allowed_html;
$output .= "<FORM ACTION=\"admin.php?mod=story\" METHOD=\"post\">\n";
@@ -55,10 +57,10 @@ function story_add() {
$output .= " <INPUT TYPE=\"text\" NAME=\"edit[subject]\" SIZE=\"50\" MAXLENGTH=\"60\"><BR>\n";
$output .= "</P>\n";
- $output .= "<P><B>Category:</B><BR>\n";
- $output .= " <SELECT NAME=\"edit[category]\">\n";
- for ($i = 0; $i < sizeof($categories); $i++) {
- $output .= " <OPTION VALUE=\"$categories[$i]\">$categories[$i]</OPTION>\n";
+ $output .= "<P><B>Section:</B><BR>\n";
+ $output .= " <SELECT NAME=\"edit[section]\">\n";
+ foreach ($sections = section_get() as $value) {
+ $output .= " <OPTION VALUE=\"$value\">$value</OPTION>\n";
}
$output .= " </SELECT>\n";
$output .= "</P>\n";
@@ -96,12 +98,12 @@ function story_add() {
function story_add_save($edit) {
global $user;
$timestamp = ($edit[status] == 3 && strtotime($edit[date]) > time()) ? strtotime($edit[date]) : time();
- db_query("INSERT INTO stories (author, subject, abstract, article, category, status, timestamp) VALUES ('$user->id', '". check_input($edit[subject]) ."', '". check_input($edit[abstract]) ."', '". check_input($edit[article]) ."', '". check_input($edit[category]) ."', '$edit[status]', '$timestamp')");
+ db_query("INSERT INTO stories (author, subject, abstract, article, section, status, timestamp) VALUES ('$user->id', '". check_input($edit[subject]) ."', '". check_input($edit[abstract]) ."', '". check_input($edit[article]) ."', '". check_input($edit[section]) ."', '$edit[status]', '$timestamp')");
watchdog("story", "story: added '$edit[subject]'");
}
function story_edit($id) {
- global $allowed_html, $categories;
+ global $allowed_html;
$result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.id = $id");
$story = db_fetch_object($result);
@@ -119,10 +121,10 @@ function story_edit($id) {
$output .= "</P>\n";
$output .= "<P>\n";
- $output .= " <B>Category:</B><BR>\n";
- $output .= " <SELECT NAME=\"edit[category]\">\n";
- for ($i = 0; $i < sizeof($categories); $i++) {
- $output .= " <OPTION VALUE=\"$categories[$i]\"". ($story->category == $categories[$i] ? " SELECTED" : "") .">$categories[$i]</OPTION>\n";
+ $output .= " <B>Section:</B><BR>\n";
+ $output .= " <SELECT NAME=\"edit[section]\">\n";
+ foreach ($sections = section_get() as $value) {
+ $output .= " <OPTION VALUE=\"$value\"". ($story->section == $value ? " SELECTED" : "") .">$value</OPTION>\n";
}
$output .= "</SELECT>\n";
$output .= "</P>\n";
@@ -163,8 +165,8 @@ function story_edit($id) {
}
function story_edit_save($id, $edit) {
- if ($edit[status] == 3 && strtotime($edit[date]) > time()) db_query("UPDATE stories SET subject = '". check_input($edit[subject]) ."', abstract = '". check_input($edit[abstract]) ."', updates = '". check_input($edit[updates]) ."', article = '". check_input($edit[article]) ."', category = '". check_input($edit[category]) ."', status = '$edit[status]', timestamp = '". strtotime($edit[date]) ."' WHERE id = '$id'");
- else db_query("UPDATE stories SET subject = '". check_input($edit[subject]) ."', abstract = '". check_input($edit[abstract]) ."', updates = '". check_input($edit[updates]) ."', article = '". check_input($edit[article]) ."', category = '". check_input($edit[category]) ."', status = '$edit[status]' WHERE id = '$id'");
+ if ($edit[status] == 3 && strtotime($edit[date]) > time()) db_query("UPDATE stories SET subject = '". check_input($edit[subject]) ."', abstract = '". check_input($edit[abstract]) ."', updates = '". check_input($edit[updates]) ."', article = '". check_input($edit[article]) ."', section = '". check_input($edit[section]) ."', status = '$edit[status]', timestamp = '". strtotime($edit[date]) ."' WHERE id = '$id'");
+ else db_query("UPDATE stories SET subject = '". check_input($edit[subject]) ."', abstract = '". check_input($edit[abstract]) ."', updates = '". check_input($edit[updates]) ."', article = '". check_input($edit[article]) ."', section = '". check_input($edit[section]) ."', status = '$edit[status]' WHERE id = '$id'");
watchdog("message", "story: modified `$edit[subject]'");
}
@@ -189,14 +191,14 @@ function story_display() {
$result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 0 ORDER BY timestamp DESC LIMIT 5");
$output .= " <TR><TH COLSPAN=\"4\">dumped stories</TTH></TR>\n";
while ($story = db_fetch_object($result)) {
- $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n";
+ $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->section</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n";
}
// Posted stories:
$result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 2 ORDER BY timestamp DESC LIMIT 15");
$output .= " <TR><TH COLSPAN=\"4\">posted stories</TH></TR>\n";
while ($story = db_fetch_object($result)) {
- $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n";
+ $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->section</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n";
}
$output .= "</TABLE>\n";
diff --git a/modules/wishlist.module b/modules/wishlist.module
index d22362a3c..bfeb33ce1 100644
--- a/modules/wishlist.module
+++ b/modules/wishlist.module
@@ -28,7 +28,6 @@ function wishlist_page() {
<UL>
<LI>post/edit hash - magic cookie: to prevent malicious external access and to prevent duplicate posts because of hitting the "reload" button</LI>
<LI>URL validator</LI>
- <LI>more adaptive submission queue</LI>
<LI>archive function</LI>
<LI>caching</LI>
<LI>more configuration options:</LI>
@@ -54,14 +53,7 @@ function wishlist_page() {
<LI>automatically post scheduled stories</LI>
<LI>review system</LI>
</UL>
-
- <H3>Public release</H3>
- <UL>
- <LI>make (or find and install) a "task manager / todo list / progress meter / bug report"-tool so we can get ourselves and the project somewhat organized. Ideally we would have a "project module".</LI>
- <LI>setup a developers mailing list</LI>
- <LI>code revision to close possible security holes</LI>
- </UL>
-
+
<H3>Themes</H3>
<UL>
<LI>create a theme with topic icons - graphical theme</LI>
diff --git a/search.php b/search.php
index 8ece2add4..e2f6feaa3 100644
--- a/search.php
+++ b/search.php
@@ -1,5 +1,6 @@
<?
include "includes/common.inc";
+ include "includes/section.inc";
$theme->header();
@@ -11,24 +12,21 @@
$output .= " <FORM ACTION=\"search.php\" METHOD=\"POST\">\n";
$output .= " <INPUT SIZE=\"50\" VALUE=\"$terms\" NAME=\"terms\" TYPE=\"text\"><BR>\n";
- // category:
- $output .= "<SELECT NAME=\"category\">\n";
- if ($category) $output .= " <OPTION VALUE=\"$category\">$category</OPTION>\n";
- $output .= " <OPTION VALUE=\"\">All categories</OPTION>\n";
- for ($i = 0; $i < sizeof($categories); $i++) {
- $output .= " <OPTION VALUE=\"$categories[$i]\">$categories[$i]</OPTION>\n";
- }
+ // section:
+ $output .= "<SELECT NAME=\"section\">\n";
+ $output .= " <OPTION VALUE=\"\">All sections</OPTION>\n";
+ foreach ($sections = section_get() as $value) $output .= " <OPTION VALUE=\"$value\"". ($section == $value ? " SELECTED" : "") .">$value</OPTION>\n";
$output .= "</SELECT>\n";
// order:
$output .= "<SELECT NAME=\"order\">\n";
- if ($order == "Oldest first") {
- $output .= " <OPTION VALUE=\"Oldest first\">Oldest first</OPTION>\n";
- $output .= " <OPTION VALUE=\"Newest first\">Newest first</OPTION>\n";
+ if ($order == 1) {
+ $output .= " <OPTION VALUE=\"1\">Oldest first</OPTION>\n";
+ $output .= " <OPTION VALUE=\"2\">Newest first</OPTION>\n";
}
else {
- $output .= " <OPTION VALUE=\"Newest first\">Newest first</OPTION>\n";
- $output .= " <OPTION VALUE=\"Oldest first\">Oldest first</OPTION>\n";
+ $output .= " <OPTION VALUE=\"1\">Newest first</OPTION>\n";
+ $output .= " <OPTION VALUE=\"2\">Oldest first</OPTION>\n";
}
$output .= "</SELECT>\n";
@@ -42,9 +40,9 @@
$query = "SELECT s.id, s.subject, u.userid, s.timestamp, COUNT(c.cid) AS comments FROM stories s LEFT JOIN users u ON s.author = u.id LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 ";
$query .= ($author) ? "AND u.userid = '$author' " : "";
$query .= ($terms) ? "AND (s.subject LIKE '%$terms%' OR s.abstract LIKE '%$terms%' OR s.updates LIKE '%$terms%') " : "";
- $query .= ($category) ? "AND s.category = '$category' GROUP BY s.id " : "GROUP BY s.id ";
- $query .= ($order == "Oldest first") ? "ORDER BY s.timestamp ASC" : "ORDER BY s.timestamp DESC";
- $result = db_query("$query");
+ $query .= ($section) ? "AND s.section = '$section' GROUP BY s.id " : "GROUP BY s.id ";
+ $query .= ($order == 1) ? "ORDER BY s.timestamp ASC" : "ORDER BY s.timestamp DESC";
+ $result = db_query($query);
// Display search results:
$output .= "<HR>\n";
@@ -63,4 +61,5 @@
$theme->box("Search", $output);
$theme->footer();
-?>
+
+?> \ No newline at end of file
diff --git a/submission.php b/submission.php
index e341d38e2..dd1d613f6 100644
--- a/submission.php
+++ b/submission.php
@@ -11,15 +11,15 @@ function submission_display_main() {
$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 get 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=\"4\" CELLPADDING=\"4\">\n";
- $content .= " <TR BGCOLOR=\"$bgcolor1\"><TH>Subject</TH><TH>Category</TH><TH>Date</TH><TH>Author</TH><TH>Score</TH></TR>\n";
+ $content .= " <TR BGCOLOR=\"$bgcolor1\"><TH>Subject</TH><TH>Section</TH><TH>Date</TH><TH>Author</TH><TH>Score</TH></TR>\n";
while ($submission = db_fetch_object($result)) {
- if ($user->id == $submission->author || user_getHistory($user->history, "s$submission->id")) $content .= " <TR><TD WIDTH=\"100%\"><A HREF=\"submission.php?op=view&id=$submission->id\">". stripslashes($submission->subject) ."</A></TD><TD>$submission->category</TD><TD ALIGN=\"center\">". date("Y-m-d", $submission->timestamp) ."<BR>". date("H:m:s", $submission->timestamp) ."</TD><TD ALIGN=\"center\">". format_username($submission->userid) ."</TD><TD ALIGN=\"center\">". submission_score($submission->id) ."</TD></TR>\n";
- else $content .= " <TR><TD WIDTH=\"100%\"><A HREF=\"submission.php?op=view&id=$submission->id\">". stripslashes($submission->subject) ."</A></TD><TD>$submission->category</TD><TD ALIGN=\"center\">". date("Y-m-d", $submission->timestamp) ."<BR>". date("H:m:s", $submission->timestamp) ."</TD><TD ALIGN=\"center\">". format_username($submission->userid) ."</TD><TD ALIGN=\"center\"><A HREF=\"submission.php?op=view&id=$submission->id\">vote</A></TD></TR>\n";
+ if ($user->id == $submission->author || user_getHistory($user->history, "s$submission->id")) $content .= " <TR><TD WIDTH=\"100%\"><A HREF=\"submission.php?op=view&id=$submission->id\">". stripslashes($submission->subject) ."</A></TD><TD>$submission->section</TD><TD ALIGN=\"center\">". date("Y-m-d", $submission->timestamp) ."<BR>". date("H:m:s", $submission->timestamp) ."</TD><TD ALIGN=\"center\">". format_username($submission->userid) ."</TD><TD ALIGN=\"center\">". submission_score($submission->id) ."</TD></TR>\n";
+ else $content .= " <TR><TD WIDTH=\"100%\"><A HREF=\"submission.php?op=view&id=$submission->id\">". stripslashes($submission->subject) ."</A></TD><TD>$submission->section</TD><TD ALIGN=\"center\">". date("Y-m-d", $submission->timestamp) ."<BR>". date("H:m:s", $submission->timestamp) ."</TD><TD ALIGN=\"center\">". format_username($submission->userid) ."</TD><TD ALIGN=\"center\"><A HREF=\"submission.php?op=view&id=$submission->id\">vote</A></TD></TR>\n";
}
$content .= "</TABLE>\n";
$theme->header();
- $theme->box("Submission queue - Pending stories", $content);
+ $theme->box("Open submission queue - Pending stories", $content);
$theme->footer();
}
@@ -44,18 +44,16 @@ function submission_display_item($id) {
foreach ($submission_votes as $key=>$value) print " <OPTION VALUE=\"$value\">". $key ."</OPTION>\n";
print " </SELECT>\n";
print "</P>\n";
-
print "<P>\n";
print " <B>Comment:</B><BR>\n";
print " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"7\" NAME=\"comment\"></TEXTAREA>\n";
print "</P>\n";
-
print "<INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$submission->id\">\n";
print "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Vote\">\n";
print "</FORM>\n";
- }
- $theme->footer();
+ $theme->footer();
+ }
}
// Security check:
@@ -71,8 +69,7 @@ if ($user->id) {
break;
case "Vote";
submission_vote($id, $vote, $comment);
- submission_display_item($id);
- break;
+ // fall through
default:
submission_display_main();
break;
diff --git a/submit.php b/submit.php
index f6b8c9ef0..cb1558466 100644
--- a/submit.php
+++ b/submit.php
@@ -1,7 +1,7 @@
<?
function submit_enter() {
- global $anonymous, $categories, $allowed_html, $theme, $user;
+ global $anonymous, $allowed_html, $theme, $user;
// Guidlines:
$output .= "<P>Got some news or some thoughts you would like to share? Fill out this form and they will automatically get whisked away to our submission queue where our moderators will frown at it, poke at it and hopefully post it. Every registered user is automatically a moderator and can vote whether or not your sumbission should be carried to the front page for discussion.</P>\n";
@@ -21,13 +21,9 @@ function submit_enter() {
$output .= " <SMALL><I>Bad subjects are 'Check this out!' or 'An article'. Be descriptive, clear and simple!</I></SMALL>\n";
$output .= "</P>\n";
- $output .= "<P><B>Category:</B><BR>\n";
- $output .= " <SELECT NAME=\"category\">\n";
-
- for ($i = 0; $i < sizeof($categories); $i++) {
- $output .= " <OPTION VALUE=\"$categories[$i]\">$categories[$i]</OPTION>\n";
- }
-
+ $output .= "<P><B>Section:</B><BR>\n";
+ $output .= " <SELECT NAME=\"section\">\n";
+ foreach ($sections = section_get() as $value) $output .= " <OPTION VALUE=\"$value\">$value</OPTION>\n";
$output .= " </SELECT>\n";
$output .= "</P>\n";
@@ -55,8 +51,8 @@ function submit_enter() {
$theme->footer();
}
-function submit_preview($subject, $abstract, $article, $category) {
- global $categories, $allowed_html, $theme, $user;
+function submit_preview($subject, $abstract, $article, $section) {
+ global $allowed_html, $theme, $user;
include "includes/story.inc";
@@ -73,13 +69,9 @@ function submit_preview($subject, $abstract, $article, $category) {
$output .= " <SMALL><I>Bad subjects are 'Check this out!' or 'An article'. Be descriptive, clear and simple!</I></SMALL>\n";
$output .= "</P>\n";
- $output .= "<P><B>Category:</B><BR>\n";
- $output .= " <SELECT NAME=\"category\">\n";
- for ($i = 0; $i < sizeof($categories); $i++) {
- $output .= " <OPTION VALUE=\"$categories[$i]\" ";
- if ($category == $categories[$i]) $output .= "SELECTED";
- $output .= ">$categories[$i]</OPTION>\n";
- }
+ $output .= "<P><B>Section:</B><BR>\n";
+ $output .= " <SELECT NAME=\"section\">\n";
+ foreach ($sections = section_get() as $value) $output .= " <OPTION VALUE=\"$value\"". ($section == $value ? " SELECTED" : "") .">$value</OPTION>\n";
$output .= "</SELECT>\n";
$output .= "</P>\n";
@@ -111,29 +103,28 @@ function submit_preview($subject, $abstract, $article, $category) {
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\">\n";
$output .= "</P>\n";
}
- else {
+ else {
$output .= "<P>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\">\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Submit submission\">\n";
$output .= "</P>\n";
}
-
$output .= "</FORM>\n";
$theme->header();
- $theme->article(new Story($user->userid, $subject, $abstract, $article, $category, time()));
+ $theme->article(new Story($user->userid, $subject, $abstract, $article, $section, time()));
$theme->box("Submit a story", $output);
$theme->footer();
}
-function submit_submit($subject, $abstract, $article, $category) {
+function submit_submit($subject, $abstract, $article, $section) {
global $user, $theme;
// Add log entry:
watchdog("story", "story: added '$subject'");
// Add submission to SQL table:
- db_query("INSERT INTO stories (author, subject, abstract, article, category, timestamp) VALUES ('$user->id', '". check_input($subject) ."', '". check_input($abstract) ."', '". check_input($article) ."', '". check_input($category) ."', '". time() ."')");
+ db_query("INSERT INTO stories (author, subject, abstract, article, section, timestamp) VALUES ('$user->id', '". check_input($subject) ."', '". check_input($abstract) ."', '". check_input($article) ."', '". check_input($section) ."', '". time() ."')");
// Display confirmation message:
$theme->header();
@@ -145,10 +136,10 @@ include "includes/common.inc";
switch($op) {
case "Preview submission":
- submit_preview($subject, $abstract, $article, $category);
+ submit_preview($subject, $abstract, $article, $section);
break;
case "Submit submission":
- submit_submit($subject, $abstract, $article, $category);
+ submit_submit($subject, $abstract, $article, $section);
break;
default:
submit_enter();
diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme
index 9f562af61..d7b812050 100644
--- a/themes/marvin/marvin.theme
+++ b/themes/marvin/marvin.theme
@@ -54,7 +54,7 @@
print " <TR VALIGN=\"bottom\"><TD COLSPAN=\"2\" BGCOLOR=\"#000000\" WIDTH=\"100%\"><IMG SRC=\"themes/marvin/images/pixel.gif\" WIDTH=\"1\" HEIGHT=\"0\" ALT=\"\"></TD></TR>\n";
print " <TR>\n";
print " <TD>\n";
- print " <FONT COLOR=\"#7C7C7C\"><SMALL>Submitted by ". format_username($story->userid) ." on ". format_date($story->timestamp, "extra large"). ""; ?><? if ($story->department) print "<BR>from the $story->department dept."; ?><? print "</SMALL></FONT></TD><TD ALIGN=\"right\" VALIGN=\"top\" NOWRAP><SMALL><A HREF=\"search.php?category=". urlencode($story->category) ."\"><FONT COLOR=\"#83997A\">$story->category</FONT></A></SMALL>\n";
+ print " <FONT COLOR=\"#7C7C7C\"><SMALL>Submitted by ". format_username($story->userid) ." on ". format_date($story->timestamp, "extra large"). ""; ?><? if ($story->department) print "<BR>from the $story->department dept."; ?><? print "</SMALL></FONT></TD><TD ALIGN=\"right\" VALIGN=\"top\" NOWRAP><SMALL><A HREF=\"?section=". urlencode($story->section) ."\"><FONT COLOR=\"#83997A\">$story->section</FONT></A></SMALL>\n";
print " </TD>\n";
print " </TR>\n";
print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
@@ -77,7 +77,7 @@
print " <TR VALIGN=\"bottom\"><TD COLSPAN=\"2\" BGCOLOR=\"#000000\" WIDTH=\"100%\"><IMG SRC=\"themes/marvin/images/pixel.gif\" WIDTH=\"1\" HEIGHT=\"0\" ALT=\"\"></TD></TR>\n";
print " <TR>\n";
print " <TD>\n";
- print " <FONT COLOR=\"#7C7C7C\"><SMALL>Submitted by ". format_username($story->userid) ." on ". format_date($story->timestamp, "extra large") .""; ?><? if ($story->department) print "<BR>from the $story->department dept."; ?><? print "</SMALL></FONT></TD><TD ALIGN=\"right\" VALIGN=\"top\" NOWRAP><SMALL><A HREF=\"search.php?category=". urlencode($story->category) ."\"><FONT COLOR=\"#83997A\">$story->category</FONT></A></SMALL>\n";
+ print " <FONT COLOR=\"#7C7C7C\"><SMALL>Submitted by ". format_username($story->userid) ." on ". format_date($story->timestamp, "extra large") .""; ?><? if ($story->department) print "<BR>from the $story->department dept."; ?><? print "</SMALL></FONT></TD><TD ALIGN=\"right\" VALIGN=\"top\" NOWRAP><SMALL><A HREF=\"index.php?section=". urlencode($story->section) ."\"><FONT COLOR=\"#83997A\">$story->section</FONT></A></SMALL>\n";
print " </TD>\n";
print " </TR>\n";
print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme
index 34bf2677d..517c56394 100644
--- a/themes/unconed/unconed.theme
+++ b/themes/unconed/unconed.theme
@@ -12,7 +12,7 @@
var $bgcolor1 = "#B5BECE";
var $fgcolor1 = "#000000"; // table body color
var $hlcolor1 = "#000000"; // high-light color
- var $categorycolor = "#202020";
+ var $sectioncolor = "#202020";
// color set #2:
var $bgcolor2 = "#EEEEEE";
@@ -81,13 +81,13 @@
<TR><TD BGCOLOR="<? echo $this->bgcolor1; ?>" COLSPAN="2"><FONT COLOR="<? echo $this->fgcolor1; ?>"><B><? echo "". check_output($story->subject, 1) .""; ?></B></FONT></TD></TR>
<TR BGCOLOR="<? echo $this->bgcolor2; ?>">
<?
- if ($story->category) { print "<TD BGCOLOR=\"$this->bgcolor2\">"; }
+ if ($story->section) { print "<TD BGCOLOR=\"$this->bgcolor2\">"; }
else { print "<TD COLSPAN=\"2\" BGCOLOR=\"$this->bgcolor2\">"; }
if ($story->userid) { print "<SMALL>Posted by " . format_username($story->userid) . " on $timestamp"; }
else { print "<SMALL>Posted by $anonymous on $timestamp"; }
if ($story->department) { print " - from the $story->department dept."; }
print "</SMALL>";
- if ($story->category) { print "</TD><TD BGCOLOR=\"$this->bgcolor2\" ALIGN=\"center\"><B><A HREF=\"search.php?category=" . urlencode($story->category) . "\"><FONT COLOR=\"$this->categorycolor\">$story->category</FONT></A></B>"; }
+ if ($story->section) { print "</TD><TD BGCOLOR=\"$this->bgcolor2\" ALIGN=\"center\"><B><A HREF=\"index.php?section=" . urlencode($story->section) . "\"><FONT COLOR=\"$this->sectioncolor\">$story->section</FONT></A></B>"; }
?>
</TD>
</TR>
@@ -116,13 +116,13 @@
<TR><TD COLSPAN="2" BGCOLOR="<? echo $this->bgcolor1; ?>"><FONT COLOR="<? echo $this->fgcolor1; ?>"><B><? echo check_output($story->subject, 1); ?></B></FONT></TD></TR>
<TR BGCOLOR="<? echo $this->bgcolor3; ?>">
<?
- if ($story->category) { print "<TD BGCOLOR=\"$this->bgcolor3\">"; }
+ if ($story->section) { print "<TD BGCOLOR=\"$this->bgcolor3\">"; }
else { print "<TD COLSPAN=\"2\" BGCOLOR=\"$this->bgcolor3\">"; }
if ($story->userid) { print "<SMALL>Posted by " . format_username($story->userid) . " on $timestamp"; }
else { print "<SMALL>Posted by $anonymous on $timestamp"; }
if ($story->department) { print " - from the $story->department dept."; }
print "</SMALL>";
- if ($story->category) { print "</TD><TD BGCOLOR=\"$this->bgcolor3\" ALIGN=\"center\"><B><A HREF=\"search.php?category=" . urlencode($story->category) . "\"><FONT COLOR=\"$this->categorycolor\">$story->category</FONT></A></B>"; }
+ if ($story->section) { print "</TD><TD BGCOLOR=\"$this->bgcolor3\" ALIGN=\"center\"><B><A HREF=\"index.php?section=" . urlencode($story->section) . "\"><FONT COLOR=\"$this->sectioncolor\">$story->section</FONT></A></B>"; }
?>
</TD>
</TR>