Commit de2e3939 authored by Dries's avatar Dries

- various updates, bugfixes and improvements

parent b1d395d5
......@@ -32,10 +32,9 @@ ErrorDocument 500 /error.php
php_value magic_quotes_gpc 1
php_value magic_quotes_runtime 0
php_value magic_quotes_sybase 0
php_value session.name DROPID
php_value session.auto_start 0
php_value session.cookie_lifetime 2000000
php_value session.gc_maxlifetime 2000000
php_value session.cache_expire 200000
php_value session.save_path /tmp/dropsessions
# php_value session.save_path /tmp/dropsessions
</IfModule>
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
verbatim copies of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your freedom to
share and change it. By contrast, the GNU General Public License is
......@@ -53,9 +53,9 @@ free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
MODIFICATION
MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms
......@@ -242,7 +242,7 @@ exceptions for this. Our decision will be guided by the two goals of
preserving the free status of all derivatives of our free software and of
promoting the sharing and reuse of software generally.
NO WARRANTY
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE,
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT
......@@ -271,4 +271,4 @@ PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN
IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
<?
include "includes/common.inc";
include_once "includes/common.inc";
function account_get_user($uname) {
$result = db_query("SELECT * FROM users WHERE userid = '$uname'");
......@@ -56,7 +56,6 @@ function account_session_start($userid, $passwd) {
$user = new User($userid, $passwd);
if ($user->id) {
session_start();
session_register("user");
watchdog("message", "session opened for user `$user->userid'");
}
......
<?
include "includes/common.inc";
include_once "includes/common.inc";
// validate user permission:
if (!($user->permissions == 1 || $user->id == 1)) exit();
if (!user_permission($user)) exit();
function admin_page($mod) {
global $repository, $site_name, $menu, $modules;
......
<?
include "includes/common.inc";
include_once "includes/common.inc";
function cron_run() {
global $repository;
......
......@@ -15,6 +15,7 @@ CREATE TABLE blocks (
status tinyint(2) DEFAULT '0' NOT NULL,
weight tinyint(1) DEFAULT '0' NOT NULL,
region tinyint(1) DEFAULT '0' NOT NULL,
remove tinyint(1) DEFAULT '0' NOT NULL,
PRIMARY KEY (name)
);
......
......@@ -39,7 +39,7 @@ function error_httpd() {
print "</PRE>\n";
}
include "includes/common.inc";
include_once "includes/common.inc";
switch ($op) {
case "flood":
......
<?
include "includes/common.inc";
include_once "includes/common.inc";
function export($name, $module) {
global $REQUEST_URI;
module_execute($name, "export", explode("/", $REQUEST_URI));
module_execute($name, "export", explode("/", strrchr($REQUEST_URI, "/export")));
}
module_iterate("export");
......
......@@ -8,7 +8,7 @@
$cmodes = array(1 => "List - min", 2 => "List - max", 3 => "Threaded - min", 4 => "Threaded - max");
$corder = array(1 => "Date - new", 2 => "Date - old", 3 => "Rate - high", 4 => "Rate - low");
$link = ($mod) ? $mod : substr($PHP_SELF, 1, strlen($PHP_SELF) - 5);
$link = ($mod) ? $mod : substr(strrchr($PHP_SELF, "/"), 1, strrchr($PHP_SELF, "/") - 4);
class Comment {
function Comment($userid, $subject, $comment, $timestamp, $url, $fake_email, $score, $votes, $cid, $lid) {
......@@ -32,12 +32,12 @@ function comment_moderate($moderate) {
$none = $comment_votes[key($comment_votes)];
foreach ($moderate as $id=>$vote) {
if ($vote != $comment_votes[$none] && !user_getHistory($user->history, "c$id")) {
if ($vote != $comment_votes[$none] && !user_get_history($user->history, "c$id")) {
// Update the comment's score:
$result = db_query("UPDATE comments SET score = score $vote, votes = votes + 1 WHERE cid = $id");
// Update the user's history:
user_setHistory($user, "c$id", $vote);
user_set_history("c$id", $vote);
}
}
}
......@@ -54,7 +54,7 @@ function comment_settings($mode, $order, $threshold) {
}
function comment_reply($pid, $id) {
global $allowed_html, $link, $theme, $user;
global $allowed_html, $link, $REQUEST_URI, $theme, $user;
// Extract parent-information/data:
if ($pid) {
......@@ -70,7 +70,7 @@ function comment_reply($pid, $id) {
}
// Build reply form:
$output .= "<FORM ACTION=\"". comment_uri() ."\" METHOD=\"post\">\n";
$output .= "<FORM ACTION=\"$REQUEST_URI\" METHOD=\"post\">\n";
// Name field:
$output .= "<P>\n";
......@@ -105,13 +105,13 @@ function comment_reply($pid, $id) {
}
function comment_preview($pid, $id, $subject, $comment) {
global $allowed_html, $link, $theme, $user;
global $allowed_html, $link, $REQUEST_URI, $theme, $user;
// Preview comment:
$theme->comment(new Comment($user->userid, $subject, $comment, time(), $user->url, $user->fake_email, 0, 0, 0, 0), "reply to this comment");
// Build reply form:
$output .= "<FORM ACTION=\"". comment_uri() ."\" METHOD=\"post\">\n";
$output .= "<FORM ACTION=\"$REQUEST_URI\" METHOD=\"post\">\n";
// Name field:
$output .= "<P>\n";
......@@ -160,7 +160,6 @@ function comment_post($pid, $id, $subject, $comment) {
if ($duplicate != 0) {
watchdog("error", "comment: attempt to insert duplicate comment");
$theme->box("duplicate comment", "duplicate comment: $duplicate");
}
else {
// Validate subject:
......@@ -171,9 +170,6 @@ function comment_post($pid, $id, $subject, $comment) {
// Add comment to database:
db_query("INSERT INTO comments (link, lid, pid, author, subject, comment, hostname, timestamp, score) VALUES ('". check_input($link) ."', $id, $pid, '$user->id', '". check_input($subject) ."', '". check_input($comment) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."', '". ($user->userid ? 1 : 0) ."')");
// Compose header:
header("Location: ". comment_uri("id=$id"));
}
}
......@@ -203,7 +199,7 @@ function comment_moderation($comment) {
if ($op == "reply") {
$output .= "&nbsp;";
}
else if ($user->id && $user->userid != $comment->userid && !user_getHistory($user->history, "c$comment->cid")) {
else if ($user->id && $user->userid != $comment->userid && !user_get_history($user->history, "c$comment->cid")) {
$output .= "<SELECT NAME=\"moderate[$comment->cid]\">\n";
foreach ($comment_votes as $key=>$value) $output .= " <OPTION VALUE=\"$value\">$key</OPTION>\n";
$output .= "</SELECT>\n";
......@@ -282,8 +278,8 @@ function comment_uri($args = 0) {
function comment_link($comment, $return = 1) {
global $link, $theme;
if ($return) return "<A HREF=\"". comment_uri("id=$comment->lid#$comment->cid") ."\"><FONT COLOR=\"$theme->hlcolor2\">return</FONT></A> | <A HREF=\"". comment_uri("op=reply&id=$comment->lid&pid=$comment->cid") ."\"><FONT COLOR=\"$theme->hlcolor2\">reply to this comment</FONT></A>";
else return "<A HREF=\"". comment_uri("op=reply&id=$comment->lid&pid=$comment->cid") ."\"><FONT COLOR=\"$theme->hlcolor2\">reply to this comment</FONT></A>";
if ($return) return "<A HREF=\"". comment_uri("id=$comment->lid#$comment->cid") ."\"><FONT COLOR=\"$theme->link\">return</FONT></A> | <A HREF=\"". comment_uri("op=reply&id=$comment->lid&pid=$comment->cid") ."\"><FONT COLOR=\"$theme->link\">reply to this comment</FONT></A>";
else return "<A HREF=\"". comment_uri("op=reply&id=$comment->lid&pid=$comment->cid") ."\"><FONT COLOR=\"$theme->link\">reply to this comment</FONT></A>";
}
function comment_comment($comment, $folded = 0) {
......
<?
$cf = strtr($HTTP_HOST ."". substr($REQUEST_URI, 0, strrpos($REQUEST_URI, "/")), "/:", "..");
include_once "includes/$cf.conf";
function conf_load() {
global $HTTP_HOST, $REQUEST_URI;
$file = strtr($HTTP_HOST ."". substr($REQUEST_URI, 0, strrpos($REQUEST_URI, "/")), "/:", "..");
while ($file && !file_exists("includes/$file.conf")) {
$file = substr($file, 0, strrpos($file, "."));
}
return $file;
}
$conf = conf_load();
include_once "includes/$conf.conf";
include_once "includes/database.inc";
include_once "includes/watchdog.inc";
include_once "includes/function.inc";
......@@ -10,7 +20,7 @@
include_once "includes/theme.inc";
include_once "includes/user.inc";
session_start();
user_load();
$theme = theme_load();
......
......@@ -16,7 +16,6 @@ $site_name = "site name";
$site_url = "http://yourdomain.com/";
$site_email = "info@yourdomain.com";
#
# Comment votes:
# the keys of this associative array are displayed in each
......
......@@ -24,12 +24,18 @@ function module_rehash_crons($name, $module) {
}
function module_rehash_blocks($name, $module) {
db_query("DELETE FROM blocks WHERE module = '$name'");
db_query("UPDATE blocks SET remove = '1' 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) ."')");
if (!db_fetch_object(db_query("SELECT * FROM blocks WHERE module = '$name' AND name = '". check_input($block["info"]) ."'"))) {
db_query("INSERT INTO blocks (name, module, offset) VALUES ('". check_input($block["info"]) ."', '". check_input($name) ."', '". check_input($offset) ."')");
}
else {
db_query("UPDATE blocks SET offset = '". check_input($offset) ."', remove = '0' WHERE module = '$name' AND name = '". check_input($block["info"]) ."'");
}
}
}
db_query("DELETE FROM blocks WHERE module = '$name' AND remove = '1'");
}
function module_rehash($name) {
......
......@@ -11,4 +11,9 @@ function Story($userid, $subject, $abstract, $article, $section, $timestamp) {
}
}
function story_visible($story) {
global $user;
return ($story->status == 1 && $user->id) || ($story->status == 2) || user_permission();
}
?>
\ No newline at end of file
......@@ -13,7 +13,7 @@ function submission_score($id) {
function submission_vote($id, $vote, $comment) {
global $user;
if (!user_getHistory($user->history, "s$id")) {
if (!user_get_history($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");
......@@ -24,7 +24,7 @@ function submission_vote($id, $vote, $comment) {
}
// Update user's history record:
user_setHistory($user, "s$id", $vote);
user_set_history("s$id", $vote);
// Update story table (if required):
$result = db_query("SELECT * FROM stories WHERE id = $id");
......
......@@ -41,7 +41,7 @@ function menu($name, $module) {
$content .= "<LI><A HREF=\"account.php?op=edit&topic=content\">edit site content</A></LI>\n";
$content .= "<P>\n";
if (($user->id) && ($user->permissions == 1 || $user->id == 1)) {
if (user_permission($user)) {
$content .= "<LI><A HREF=\"admin.php\">administer ". $site_name ."</A></LI>\n";
$content .= "<P>\n";
}
......@@ -91,16 +91,16 @@ function theme_blocks($region, $theme) {
}
function theme_morelink($theme, $story) {
return ($story->article) ? "[ <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->hlcolor2\"><B>read more</B></FONT></A> | ". strlen($story->article) ." bytes | <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->hlcolor2\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]" : "[ <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->hlcolor2\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]";
return ($story->article) ? "[ <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->link\"><B>read more</B></FONT></A> | ". strlen($story->article) ." bytes | <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->link\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]" : "[ <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->link\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]";
}
function theme_moderation_results($theme, $story) {
global $user;
if ($user->id && $story->id && ($user->id == $story->author || user_getHistory($user->history, "s$story->id"))) {
if ($user->id && $story->id && ($user->id == $story->author || user_get_history($user->history, "s$story->id"))) {
$result = db_query("SELECT * FROM users WHERE history LIKE '%s$story->id%'");
while ($account = db_fetch_object($result)) {
$output .= format_username($account->userid) ." voted `". user_getHistory($account->history, "s$story->id") ."'.<BR>";
$output .= format_username($account->userid) ." voted `". user_get_history($account->history, "s$story->id") ."'.<BR>";
}
$theme->box("Moderation results", ($output ? $output : "This story has not been moderated yet."));
......@@ -131,7 +131,6 @@ function theme_new_headlines($theme, $num = 10) {
$content = "";
$result = db_query("SELECT id, subject FROM stories WHERE status = 2 ORDER BY id DESC LIMIT $num");
while ($story = db_fetch_object($result)) $content .= "<LI><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></LI>\n";
$content .= "<P ALIGN=\"right\">[ <A HREF=\"search.php\"><FONT COLOR=\"$theme->hlcolor2\">more</FONT></A> ]</P>";
$theme->box("Latest headlines", $content);
}
......@@ -148,8 +147,6 @@ function theme_old_headlines($theme, $num = 10) {
}
$content .= "<LI><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></LI>\n";
}
$content .= "<P ALIGN=\"right\">[ <A HREF=\"search.php\"><FONT COLOR=\"$theme->hlcolor2\">more</FONT></A> ]</P>";
$theme->box("Older headlines", $content);
}
......
<?
class User {
function User($userid, $passwd = "") {
function User($userid) {
$result = db_query("SELECT * FROM users WHERE userid = '$userid' && STATUS = 2");
if (db_num_rows($result) == 1) {
foreach (db_fetch_row($result) as $key=>$value) { $field = mysql_field_name($result, $key); $this->$field = stripslashes($value); $this->field[] = $field; }
}
}
function User($userid, $passwd) {
$result = db_query("SELECT * FROM users WHERE LOWER(userid) = LOWER('$userid') && passwd = PASSWORD('$passwd') && STATUS = 2");
if (db_num_rows($result) == 1) {
foreach (db_fetch_row($result) as $key=>$value) { $field = mysql_field_name($result, $key); $this->$field = stripslashes($value); $this->field[] = $field; }
......@@ -10,6 +16,12 @@ function User($userid, $passwd = "") {
}
}
function user_load() {
global $db_name;
session_name($db_name);
session_start();
}
function user_save($data, $id = 0) {
global $user;
......@@ -29,7 +41,7 @@ function user_save($data, $id = 0) {
}
}
function user_getHistory($history, $field) {
function user_get_history($history, $field) {
$data = explode(";", $history);
for (reset($data); current($data); next($data)) {
$entry = explode(":", current($data));
......@@ -38,8 +50,8 @@ function user_getHistory($history, $field) {
return $rval;
}
function user_setHistory(&$user, $field, $value) {
function user_set_history($field, $value) {
global $user;
$history = $user->history;
if (!$value) {
// remove entry:
......@@ -71,4 +83,13 @@ function user_setHistory(&$user, $field, $value) {
db_query($query);
}
function user_rehash() {
global $user;
if ($user->id) $user = new User($user->userid);
}
function user_permission($account) {
return ($account->permissions == 1 || $account->id == 1);
}
?>
\ No newline at end of file
......@@ -9,8 +9,8 @@
function watchdog($id, $message) {
global $user, $watchdog, $watchdog_history;
if ($watchdog[$id][1] && !($user->permissions == 1 || $user->id == 1)) {
/*
if ($watchdog[$id][1] && !user_permission()) {
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");
......@@ -19,6 +19,7 @@ function watchdog($id, $message) {
}
}
}
*/
// Perform query to add new watchdog entry:
db_query("INSERT INTO watchdog (level, timestamp, user, message, location, hostname) VALUES ('". $watchdog[$id][0] ."', '". time() ."', '". check_input($user->id) ."', '". check_input($message) ."', '". check_input(getenv("REQUEST_URI")) ."', '". check_input(getenv("REMOTE_ADDR")) ."')");
......
<?
include "includes/common.inc";
include_once "includes/common.inc";
// Initialize/pre-process variables:
$number = ($user->stories) ? $user->stories : 10;
......
......@@ -51,13 +51,13 @@ function account_display($order = "username") {
$output .= " <TR>\n";
foreach ($show as $key=>$value) {
switch($value = strtok($value, " ")) {
case "real_email":
case "real_email":
$output .= " <TD>". format_email($account[$value]) ."</TD>\n";
break;
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":
......@@ -69,7 +69,7 @@ function account_display($order = "username") {
case "url":
$output .= " <TD>". format_url($account[$value]) ."</TD>\n";
break;
case "userid":
case "userid":
$output .= " <TD>". format_username($account[$value], 1) ."</TD>\n";
break;
default:
......@@ -100,7 +100,7 @@ function account_comments($id) {
return $output;
}
function account_save($name, $edit) {
function account_edit_save($name, $edit) {
foreach ($edit as $key=>$value) {
$query .= "$key = '". addslashes($value) ."', ";
}
......@@ -195,7 +195,7 @@ function account_admin() {
account_view($name);
break;
case "Save account":
account_save($name, $edit);
account_edit_save($name, $edit);
account_view($name);
break;
case "Update":
......
......@@ -37,7 +37,6 @@ class backend {
while ($headline = db_fetch_object($result)) {
array_push($this->headlines, "<A HREF=\"$headline->link\">$headline->title</A>");
}
}
else {
$this->site = $site;
......@@ -94,9 +93,6 @@ class backend {
$title = ereg_replace(".*<title>", "", $item);
$title = ereg_replace("</title>.*", "", $title);
// Clean headlines:
$title = stripslashes($title);
// Count the number of stories:
$number += 1;
......@@ -145,7 +141,6 @@ 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>";
// Display box:
$theme->box("$this->site", $content);
......
......@@ -3,7 +3,7 @@
$module = array("help" => "ban_help",
"admin" => "ban_admin");
include "includes/ban.inc";
include_once "includes/ban.inc";
function ban_help() {
......
......@@ -17,6 +17,13 @@ function cron_save($edit) {
}
}
function cron_execute($name) {
global $repository;
watchdog("message", "cron: executed '". $name ."_cron()'");
$repository[$name]["cron"]();
db_query("UPDATE crons SET timestamp = ". time() ." WHERE module = '$name'");
}
function cron_display() {
$intervals = array(300, 900, 1800, 3600, 7200, 10800, 21600, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200);
......@@ -29,7 +36,7 @@ function cron_display() {
$output .= " <TR><TH>module</TH><TH>period</TH><TH>last execution</TH><TH>operations</TH></TR>\n";
while ($cron = db_fetch_object($result)) {
foreach ($intervals as $value) $period .= "<OPTION VALUE=\"$value\"". (($cron->scheduled == $value) ? " SELECTED" : "") .">every ". format_interval($value) ."</OPTION>\n";
$output .= " <TR><TD>". check_output($cron->module) ."</TD><TD><SELECT NAME=\"edit[$cron->module]\">$period</SELECT></TD><TD>". format_interval(time() - $cron->timestamp) ." ago</TD><TD ALIGN=\"center\"><A HREF=\"cron.php\">execute</A></TD></TR>\n";
$output .= " <TR><TD>". check_output($cron->module) ."</TD><TD><SELECT NAME=\"edit[$cron->module]\">$period</SELECT></TD><TD ALIGN=\"center\">". ($cron->timestamp ? format_interval(time() - $cron->timestamp) ." ago" : "never" )."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=cron&op=execute&name=$cron->module\">execute</A></TD></TR>\n";
unset($period);
}
$output .= "</TABLE>\n";
......@@ -47,6 +54,10 @@ function cron_admin() {
case "help":
cron_help();
break;
case "execute":
cron_execute($name);
cron_display();
break;
case "Save crons":
cron_save($edit);
// fall through
......
......@@ -8,7 +8,7 @@
"admin" => "diary_admin",
"export" => "diary_export");
include "includes/common.inc";
include_once "includes/common.inc";
function diary_page_overview($num = 20) {
global $theme, $user;
......
......@@ -50,6 +50,9 @@ function drupal_page() {
break;
case "Post comment":
comment_post($pid, $id, $subject, $comment);
$theme->header();
drupal_render($id, $cid);
$theme->footer();
break;
case "reply":
$theme->header();
......
......@@ -50,6 +50,9 @@ function drupal_page() {
break;
case "Post comment":
comment_post($pid, $id, $subject, $comment);
$theme->header();
drupal_render($id, $cid);
$theme->footer();
break;
case "reply":
$theme->header();
......
......@@ -2,7 +2,7 @@
$module = array("page" => "faq_page");
include "includes/common.inc";
include_once "includes/common.inc";
function faq_page() {
global $theme, $site_name, $site_email;
......
......@@ -7,9 +7,8 @@
"admin" => "headline_admin",
"export" => "headline_export");
include "includes/common.inc";
include "modules/backend.class";
include_once "includes/common.inc";
include_once "modules/backend.class";
function headline_blocks() {
global $theme;
......@@ -37,7 +36,7 @@ function headline_blocks() {
}
// Print backend box to screen:
$theme->box($backend->site, "$content<P ALIGN=\"right\">[ <A HREF=\"$backend->url\">more</A> ]\n");
$theme->box($backend->site, $content);
print " </TD>\n";
if ($state % 3 == 2) print " </TR>\n";
......@@ -185,8 +184,7 @@ function headline_admin() {
function headline_export($uri) {
global $site_name, $site_url, $HTTP_REFERER, $HTTP_USER_AGENT;
if ($uri[2] == "headlines.rdf") {
if ($uri[1] == "headlines.rdf") {
watchdog("message", "grabbed 'headlines.rdf' - referring url: $HTTP_REFERER - user agent: $HTTP_USER_AGENT");
header("Content-Type: text/plain");
......
<?
$module = array("admin" => "module_admin");
$module = array("help" => "module_help",
"admin" => "module_admin");
function module_help() {
?>
The module administration page provide you a list of all available modules. Moreover, it allows you to "rehash" modules. Whenever you install a new module or when an existing module has been changed or updated, it requires "rehasing": when you rehash a module, the module is registered to the engine and properly initialized.
<?
}
function module_admin_rehash() {
global $repository;
......@@ -41,16 +48,23 @@ function module_row($name, $module) {
function module_admin() {
global $op, $name;
print "<SMALL><A HREF=\"admin.php?mod=module\">overview</A> | <A HREF=\"admin.php?mod=module&op=help\">help</A></SMALL><HR>\n";
switch ($op) {
case "Rehash modules":
module_admin_rehash();
case "help":
module_help();
break;
case "rehash":
module_rehash($name);
module_admin_display();
break;
case "Rehash modules":
module_admin_rehash();
module_admin_display();
break;
default:
module_admin_display();
}
module_admin_display();
}
?>
......@@ -12,8 +12,8 @@
function section_help() {
?>
<P>When submitting new stories, every story is assigned a section or category. These sections can be maintained from the administration pages.</P>
<P>For moderation purpose, you can specify a post, dump and expiration thresholds for each available section according to type and urgency level a section. Some section do not really "expire" and stay interesting and active as time passes by, whereas news-related stories are only considered "hot" over a short period of time.</P>
<P>When submitting new stories, every story is assigned a section or category. Sections can be maintained from the administration pages.</P>
<P>For moderation purpose, you can specify a post, dump and expiration thresholds for each available section according to type and urgency level of a section. This is useful considering the fact that some sections do not really "expire" and stay interesting and active as time passes by, whereas news-related stories are only considered "hot" over a short period of time.</P>
<?
}
......@@ -113,7 +113,7 @@ function section_admin() {
switch($op) {
case "add":
section_add($edit);
section_add();
break;
case "help":
section_help();
......
<?
include "includes/common.inc";
include_once "includes/common.inc";
$theme->header();
......
<?
include "includes/common.inc";
include_once "includes/common.inc";
include_once "includes/story.inc";
function story_render($id, $cid) {
global $theme, $user;
$result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.status != 0 AND s.id = $id");
$story = db_fetch_object(db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.id = $id"));
if ($story = db_fetch_object($result)) {
if (story_visible($story)) {
$theme->article($story, "[ <A HREF=\"story.php?op=reply&id=$id&pid=0\">reply to this story</A> ]");
comment_render($id, $cid);
}
else {
$theme->box("Warning message", "The story you requested is no longer available or does not exist.");
$theme->box("Warning message", "The story you requested is not available or does not exist.");
}
}
......@@ -24,6 +25,9 @@ function story_render($id, $cid) {
break;
case "Post comment":
comment_post($pid, $id, $subject, $comment);
$theme->header();
story_render($id, $cid);
$theme->footer();
break;
case "Add comment":
$theme->header();
......
<?
include "includes/submission.inc";
include "includes/common.inc";
include_once "includes/submission.inc";