Commit 336b713a authored by Dries's avatar Dries

- A large batch of updates, amongst them a rewritten node system.  More
  information available on the mailing list.
parent aafedfb3
......@@ -51,5 +51,5 @@ function admin_page($mod) {
if (user_access("access administration pages")) {
admin_page($mod);
}
?>
\ No newline at end of file
......@@ -18,5 +18,5 @@
foreach (module_list() as $module) {
module_invoke($module, "cron");
}
?>
\ No newline at end of file
This diff is collapsed.
......@@ -13,5 +13,5 @@
else {
drupal_goto("index.php");
}
?>
\ No newline at end of file
......@@ -83,7 +83,7 @@ function comment_reply($pid, $id) {
comment_view(new Comment($item->uid, $item->name, $item->subject, $item->comment, $item->timestamp, $item->url, $item->cid, $item->lid), t("reply to this comment"));
}
else {
node_view(node_get_object(array("nid" => $id)));
node_view(node_load(array("nid" => $id)));
$pid = 0;
}
......@@ -351,5 +351,5 @@ function comment_render($lid, $cid) {
}
}
?>
......@@ -89,6 +89,14 @@ function drupal_goto($url) {
else {
header("Location: $url?". SID);
}
/*
** The "Location" header sends a REDIRECT status code to the http
** deamon. In some cases this can go wrong, so we make sure none
** of the code /below/ gets executed when we redirect.
*/
exit();
}
function check_form($text) {
......@@ -209,7 +217,7 @@ function format_interval($timestamp) {
function format_date($timestamp, $type = "medium", $format = "") {
global $user;
$timestamp += ($user->timezone) ? $user->timezone - date("Z") : 0;
// $timestamp += ($user->timezone) ? $user->timezone - date("Z") : 0;
switch ($type) {
case "small":
......@@ -327,7 +335,6 @@ function field_merge($a, $b) {
function link_page() {
$links[] = "<a href=\"index.php\">". t("home") ."</a>";
$links[] = "<a href=\"submit.php\">". t("submit") ."</a>";
foreach (module_list() as $name) {
if (module_hook($name, "link")) {
......
......@@ -5,8 +5,10 @@
# Database settings:
#
# $db_url = "pgsql://userer:password@hostname/database";
# $db_url = "mysql://userer:password@hostname/database";
# $db_url = "pgsql://user:password@hostname/database";
# $db_url = "mysql://user:password@hostname/database";
$db_url = "mysql://drop:drop@localhost/drop";
#
# PHP settings:
......
......@@ -10,5 +10,5 @@ function t($string) {
global $languages;
return ($languages && function_exists("locale") ? locale($string) : $string);
}
?>
\ No newline at end of file
......@@ -24,17 +24,18 @@ function module_list() {
static $list;
if (!$list) {
$handle = opendir("modules");
$list = array();
while ($file = readdir($handle)) {
if (".module" == substr($file, -7)) {
$filename = substr($file, 0, -7);
include "modules/$filename.module";
$list[$filename] = $filename;
if ($handle = @opendir("modules")) {
$list = array();
while ($file = readdir($handle)) {
if (".module" == substr($file, -7)) {
$filename = substr($file, 0, -7);
include "modules/$filename.module";
$list[$filename] = $filename;
}
}
closedir($handle);
asort($list);
}
closedir($handle);
asort($list);
}
return $list;
......@@ -90,5 +91,5 @@ function module_rehash($name) {
db_query("DELETE FROM blocks WHERE module = '$name'");
}
}
?>
This diff is collapsed.
......@@ -83,5 +83,5 @@ function search_type($type = 0, $action = 0, $query = 0, $options = 0) {
return search_form($action, $query, $options) . search_data();
}
?>
......@@ -135,7 +135,7 @@ function theme_blocks($region, &$theme) {
case "/node.php":
if ($region != "left") {
if ($user->uid) $node = db_fetch_object(db_query("SELECT * FROM node WHERE nid = '$id'"));
if ($node->status == node_status("queued")) theme_moderation_results($theme, $node, $region);
if ($node->moderate == 1) theme_moderation_results($theme, $node, $region);
}
default:
if ($user->uid) $result = db_query("SELECT * FROM blocks b LEFT JOIN layout l ON b.name = l.block WHERE (b.status = 2 OR (b.status = 1 AND l.uid = '$user->uid'))". (($region == "left" OR $region == "right") ? ($region == "left" ? " AND b.region = 0" : " AND b.region = 1") : "") ." AND (b.path = '' OR '". strrchr($REQUEST_URI, "/") ."' RLIKE b.path) ORDER BY weight");
......
......@@ -34,5 +34,5 @@ function variable_del($name) {
unset($conf[$name]);
}
?>
\ No newline at end of file
......@@ -10,5 +10,5 @@
$function();
page_footer();
?>
......@@ -8,5 +8,5 @@
module_invoke($mod, "page");
page_footer();
?>
......@@ -689,5 +689,5 @@ function import_page() {
}
}
}
?>
......@@ -689,5 +689,5 @@ function import_page() {
}
}
}
?>
......@@ -57,7 +57,7 @@ function block_admin_display() {
$region .= " <option value=\"0\"". (($block->region == 0) ? " selected" : "") .">left</option>\n";
$region .= " <option value=\"1\"". (($block->region == 1) ? " selected" : "") .">right</option>\n";
$region .= "</select>\n";
$path = "<input name=\"edit[$block->name][path]\" value=\"$block->path\">\n";
$output .= " <tr><td>". $block->name ."</td><td align=\"center\">$module</td><td>$status</td><td>$weight</td><td>$region</td><td>$path</td></tr>\n";
......@@ -150,5 +150,5 @@ function block_admin() {
print message_access();
}
}
?>
......@@ -57,7 +57,7 @@ function block_admin_display() {
$region .= " <option value=\"0\"". (($block->region == 0) ? " selected" : "") .">left</option>\n";
$region .= " <option value=\"1\"". (($block->region == 1) ? " selected" : "") .">right</option>\n";
$region .= "</select>\n";
$path = "<input name=\"edit[$block->name][path]\" value=\"$block->path\">\n";
$output .= " <tr><td>". $block->name ."</td><td align=\"center\">$module</td><td>$status</td><td>$weight</td><td>$region</td><td>$path</td></tr>\n";
......@@ -150,5 +150,5 @@ function block_admin() {
print message_access();
}
}
?>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
// $Id$
// $Id$
function box_help() {
?>
......@@ -139,5 +138,5 @@ function box_admin() {
print message_access();
}
}
?>
\ No newline at end of file
......@@ -100,5 +100,5 @@ function calendar_block() {
return $block;
}
?>
......@@ -28,8 +28,8 @@ function comment_edit($id) {
$comment = db_fetch_object($result);
$form .= form_item(t("Author"), format_name($comment));
$form .= form_textfield(t("Subject"), "subject", $comment->subject, 50, 128);
$form .= form_textarea(t("Comment"), "comment", $comment->comment, 50, 10);
$form .= form_textfield(t("Subject"), "subject", $comment->subject, 70, 128);
$form .= form_textarea(t("Comment"), "comment", $comment->comment, 70, 15);
$form .= form_submit(t("Submit"));
return form($form);
......@@ -89,5 +89,5 @@ function comment_admin() {
print message_access();
}
}
?>
......@@ -28,8 +28,8 @@ function comment_edit($id) {
$comment = db_fetch_object($result);
$form .= form_item(t("Author"), format_name($comment));
$form .= form_textfield(t("Subject"), "subject", $comment->subject, 50, 128);
$form .= form_textarea(t("Comment"), "comment", $comment->comment, 50, 10);
$form .= form_textfield(t("Subject"), "subject", $comment->subject, 70, 128);
$form .= form_textarea(t("Comment"), "comment", $comment->comment, 70, 15);
$form .= form_submit(t("Submit"));
return form($form);
......@@ -89,5 +89,5 @@ function comment_admin() {
print message_access();
}
}
?>
......@@ -57,5 +57,5 @@ function cvs_page() {
$theme->footer();
}
}
?>
\ No newline at end of file
<?php
// $Id$
function forum_status() {
return array(dumped, posted);
}
function forum_link($type) {
if ($type == "page" && user_access("access content")) {
$links[] = "<a href=\"module.php?mod=forum\">". t("forum") ."</a>";
......@@ -19,20 +15,27 @@ function forum_view($node) {
$theme->box(t("Discussion forum"), $output);
}
function forum_form($edit = array()) {
function forum_form($node) {
$form .= form_textfield("Subject", "title", $edit[title], 50, 64);
$form .= form_textarea("Body", "body", $edit[body], 70, 10);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit(t("Submit"));
$output .= form_textarea("Body", "body", $node->body, 60, 10);
return form($form);
return $output;
}
function forum_save($edit) {
global $user, $status;
function forum_save() {
if (user_access("administer nodes")) {
if ($node->nid) {
return array();
}
else {
return array("promote" => 0, "moderate" => 0, "status" => 1);
}
}
else {
return 0;
}
node_save($edit, array(uid => $user->uid, body, comment => 1, moderate => 0, promote => 0, score => 0, status => $status[posted], timestamp => time(), title, type => "forum", votes => 0));
}
function forum_num_comments($nid) {
......@@ -52,10 +55,10 @@ function forum_page() {
$result = db_query("SELECT nid FROM node WHERE type = 'forum' ORDER BY title");
$output .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n";
$output .= " <TR><TH>". t("Forum") ."</TH><TH>". t("Comments") ."</TH><TH>". t("Last comment") ."</TH><TH>". t("Moderators") ."</TH></TR>";
$output .= " <TR><TH>". t("Forum") ."</TH><TH>". t("Comments") ."</TH><TH>". t("Last comment") ."</TH></TR>";
while ($node = db_fetch_object($result)) {
$node = node_get_object(array("nid" => $node->nid));
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A><BR><SMALL>". check_output($node->body, 1) ."</SMALL></TD><TD ALIGN=\"center\">". forum_num_comments($node->nid) ."</TD><TD ALIGN=\"center\">". forum_last_comment($node->nid) ."</TD><TD ALIGN=\"center\"><SMALL>". check_output($node->moderate) ."</SMALL></TD></TR>";
$node = node_load(array("nid" => $node->nid));
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A><BR><SMALL>". check_output($node->body, 1) ."</SMALL></TD><TD ALIGN=\"center\">". forum_num_comments($node->nid) ."</TD><TD ALIGN=\"center\">". forum_last_comment($node->nid) ."</TD></TR>";
}
$output .= "</TABLE>\n";
......@@ -69,5 +72,5 @@ function forum_page() {
$theme->footer();
}
}
?>
\ No newline at end of file
<?php
// $Id$
function forum_status() {
return array(dumped, posted);
}
function forum_link($type) {
if ($type == "page" && user_access("access content")) {
$links[] = "<a href=\"module.php?mod=forum\">". t("forum") ."</a>";
......@@ -19,20 +15,27 @@ function forum_view($node) {
$theme->box(t("Discussion forum"), $output);
}
function forum_form($edit = array()) {
function forum_form($node) {
$form .= form_textfield("Subject", "title", $edit[title], 50, 64);
$form .= form_textarea("Body", "body", $edit[body], 70, 10);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit(t("Submit"));
$output .= form_textarea("Body", "body", $node->body, 60, 10);
return form($form);
return $output;
}
function forum_save($edit) {
global $user, $status;
function forum_save() {
if (user_access("administer nodes")) {
if ($node->nid) {
return array();
}
else {
return array("promote" => 0, "moderate" => 0, "status" => 1);
}
}
else {
return 0;
}
node_save($edit, array(uid => $user->uid, body, comment => 1, moderate => 0, promote => 0, score => 0, status => $status[posted], timestamp => time(), title, type => "forum", votes => 0));
}
function forum_num_comments($nid) {
......@@ -52,10 +55,10 @@ function forum_page() {
$result = db_query("SELECT nid FROM node WHERE type = 'forum' ORDER BY title");
$output .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n";
$output .= " <TR><TH>". t("Forum") ."</TH><TH>". t("Comments") ."</TH><TH>". t("Last comment") ."</TH><TH>". t("Moderators") ."</TH></TR>";
$output .= " <TR><TH>". t("Forum") ."</TH><TH>". t("Comments") ."</TH><TH>". t("Last comment") ."</TH></TR>";
while ($node = db_fetch_object($result)) {
$node = node_get_object(array("nid" => $node->nid));
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A><BR><SMALL>". check_output($node->body, 1) ."</SMALL></TD><TD ALIGN=\"center\">". forum_num_comments($node->nid) ."</TD><TD ALIGN=\"center\">". forum_last_comment($node->nid) ."</TD><TD ALIGN=\"center\"><SMALL>". check_output($node->moderate) ."</SMALL></TD></TR>";
$node = node_load(array("nid" => $node->nid));
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A><BR><SMALL>". check_output($node->body, 1) ."</SMALL></TD><TD ALIGN=\"center\">". forum_num_comments($node->nid) ."</TD><TD ALIGN=\"center\">". forum_last_comment($node->nid) ."</TD></TR>";
}
$output .= "</TABLE>\n";
......@@ -69,5 +72,5 @@ function forum_page() {
$theme->footer();
}
}
?>
\ No newline at end of file
......@@ -17,5 +17,5 @@ function help_admin() {
}
}
}
?>
......@@ -17,5 +17,5 @@ function help_admin() {
}
}
}
?>
......@@ -689,5 +689,5 @@ function import_page() {
}
}
}
?>
......@@ -238,5 +238,5 @@ function locale($string) {
}
return $string;
}
?>
......@@ -238,5 +238,5 @@ function locale($string) {
}
return $string;
}
?>
......@@ -190,5 +190,5 @@ function meta_admin() {
print message_access();
}
}
?>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -3,14 +3,6 @@
$GLOBALS["format"] = array(0 => "HTML", 1 => "PHP", 2 => "text");
class Page {
function Page($page) {
$this = new Node($page);
$this->body = $page["body"];
$this->format = $page["format"];
}
}
function page_link($type) {
if ($type == "page") {
$result = db_query("SELECT nid,link FROM page WHERE link != '' ORDER BY link");
......@@ -22,6 +14,11 @@ function page_link($type) {
return $links ? $links : array();
}
function page_load($node) {
$page = db_fetch_object(db_query("SELECT format, link FROM page WHERE nid = '$node->nid'"));
return $page;
}
function page_view($node, $main = 0) {
global $format, $theme;
......@@ -38,42 +35,35 @@ function page_view($node, $main = 0) {
}
function page_status() {
return array(dumped, posted);
}
function page_form($edit = array()) {
function page_form($node) {
global $format, $op;
if ($op != t("Preview") && $format[$edit["format"]] == "PHP") {
$edit["body"] = addslashes($edit["body"]);
if ($op != t("Preview") && $format[$node->format] == "PHP") {
$node->body = addslashes($node->body);
}
if ($edit["title"]) {
$form = page_view(new Page(node_preview($edit)));
}
$output .= form_textarea("Body", "body", $node->body, 60, 30);
$output .= form_select("Type", "format", $node->format, $format);
return $output;
}
$form .= form_textfield("Subject", "title", $edit["title"], 50, 64);
$form .= form_textfield("Link", "link", $edit["link"], 50, 64);
$form .= form_textarea("Body", "body", $edit["body"], 70, 30);
$form .= form_select("Type", "format", $edit["format"], $format);
$form .= form_hidden("nid", $edit["nid"]);
function page_save() {
if ($edit["title"]) {
$form .= form_submit(t("Preview"));
$form .= form_submit(t("Submit"));
if (user_access("administer nodes")) {
if ($node->nid) {
return array();
}
else {
return array("promote" => 0, "moderate" => 0, "status" => 1);
}
}
else {
$form .= form_submit(t("Preview"));
return 0;
}
return form($form);
}
function page_save($edit) {
global $status, $user;
node_save($edit, array(uid => $user->uid, link, body, comment => variable_get("page_comment", 0), format, moderate => variable_get("page_moderate", ""), promote => variable_get("page_promote", 0), score => 0, status => $status["posted"], timestamp => time(), title, type => "page", votes => 0));
}
?>
\ No newline at end of file
This diff is collapsed.
<?php
// $Id$
/*
class Poll {
function Poll($poll) {
$this = new Node($poll);
......@@ -180,13 +182,13 @@ function poll_form($edit = array(), $nocheck = 0) {
if ($admin && !is_array($edit[choices])) $edit = poll_get_choices_array($edit);
/* Mini-form for number of choiceboxes */
// Mini-form for number of choiceboxes
$choices = $edit[choices] ? $edit[choices] : max(2, count($edit[choices]) ? count($edit[choices]) : 5);
for ($c = 2; $c <= 20; $c++) $opts[$c]=$c;
$form .= form_select(t("Number of choices"), "choices", $choices, $opts, t("This box only specifies the number of boxes in this form, it doesn't have to equal the actual amount of choices in the poll."));
$form .= form_submit(t("Preview")) . "<br><br><br>";
/* Main form */
// Main form
$form .= form_item(t("Your name"), ($edit[name] ? $edit[name] : ($user->name ? $user->name : variable_get(anonymous, "Anonymous"))));
$form .= form_hidden("name", $edit[name]);
$form .= form_textfield(t("Question"), "title", $edit[title], 50, 127);
......@@ -279,5 +281,5 @@ function poll_user() {
$theme->box(t("Submit"), poll_form());
}
}
*/
?>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -96,5 +96,5 @@ function statistics_admin() {
}
}
}
?>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment