Commit 03c06a86 authored by Dries's avatar Dries

Oops, a rather large commit:

- Changed meta.module, node.module and index.php to use comma-seperated
  lists of attributes rather then "foo=a,bar=b" lists.  This makes it a
  a lot easier to use both modules.  In addition, error handling can be
  discarded as it can't be made any simpler, really ...

  It fits rather nicely in Drupal's design so I'm getting more and more
  happy with this meta.module (but we are not 100% there yet).

- node.module, node.inc:

   + Improved the node-related admin interface so that navigating back
     and forth the administrative menus is made both easier and faster.

   + Removed some redundant database fields from the node table.  See
     2.00-to-x.xx.sql!

   + Added 2 news hooks called "node_insert" and "node_update".  Just
     like this is the case with the existing hook "node_delete" these
     new hooks will automatically get called when a node has been
     inserted or udpated.  Note that this is an optional call-back that
     only needs to be implemented when required.  With the addition of
     these two hooks, the node mechanism (version 1) is pretty well
     completed.

- watchdog.module:
   + Fixed bug whit the 'regular messages' query in the watchdog.module.

- book.module:
   + Fixed bug in book.module: the 'parent' was not set properly when
     updating a book page.
   + Made it so that older versions of a book page are automatically
     reactived upon deletion of the most recent version, i.e. when
     doing a version roll-back.

- comment.inc:
   + Undid Remco's patch to comment.inc; it does not work in some cases.


- conf.module:
   + Fine-tuned some of the options in conf.module a bit.

- marvin.theme:
   + Visual changes to make it look better on Windows browsers.  Mind
     to give some feedback on this?
   + Fixed 3 HTML typos/bugs.
   + XHTML-ified the theme at a best effort basis; I didn't carry the
     XHTML specification with me.
   + Made use of the theme_slogan variable to display the site's slogan.
   + As soon we have at least one valid XHTML theme we can wonder on how
     to integrate other XML namespaces (cfr. MathML story at drop.org).

- database.mysql:
   + Updated database.mysql so that it contains all the latest "database
     patches".
parent d388033e
......@@ -24,7 +24,7 @@ function account_email() {
function account_create($error = "") {
global $theme;
if ($error) {
$output .= "<P><FONT COLOR=\"red\">". t("Failed to create account") .": ". check_output($error) .".</FONT></P>\n";
watchdog("account", "failed to create account: $error.");
......
# MySQL dump 7.1
#
# Host: localhost Database: drop
#--------------------------------------------------------
# Server version 3.22.32
#
# Table structure for table 'access'
#
DROP TABLE IF EXISTS access;
CREATE TABLE access (
id tinyint(10) DEFAULT '0' NOT NULL auto_increment,
......@@ -17,9 +9,6 @@ CREATE TABLE access (
PRIMARY KEY (id)
);
#
# Table structure for table 'blocks'
#
DROP TABLE IF EXISTS blocks;
CREATE TABLE blocks (
name varchar(64) DEFAULT '' NOT NULL,
......@@ -32,9 +21,6 @@ CREATE TABLE blocks (
PRIMARY KEY (name)
);
#
# Table structure for table 'book'
#
DROP TABLE IF EXISTS book;
CREATE TABLE book (
lid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
......@@ -43,12 +29,11 @@ CREATE TABLE book (
section int(10) DEFAULT '0' NOT NULL,
parent int(10) DEFAULT '0' NOT NULL,
weight tinyint(3) DEFAULT '0' NOT NULL,
pid int(10) DEFAULT '0' NOT NULL,
log text NOT NULL,
PRIMARY KEY (lid)
);
#
# Table structure for table 'boxes'
#
DROP TABLE IF EXISTS boxes;
CREATE TABLE boxes (
id tinyint(4) DEFAULT '0' NOT NULL auto_increment,
......@@ -62,9 +47,15 @@ CREATE TABLE boxes (
PRIMARY KEY (id)
);
#
# Table structure for table 'category'
#
DROP TABLE IF EXISTS bundle;
CREATE TABLE bundle (
bid int(11) DEFAULT '0' NOT NULL auto_increment,
title varchar(255) DEFAULT '' NOT NULL,
attributes varchar(255) DEFAULT '' NOT NULL,
UNIQUE title (title),
PRIMARY KEY (bid)
);
DROP TABLE IF EXISTS category;
CREATE TABLE category (
cid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
......@@ -80,9 +71,6 @@ CREATE TABLE category (
PRIMARY KEY (cid)
);
#
# Table structure for table 'channel'
#
DROP TABLE IF EXISTS channel;
CREATE TABLE channel (
id int(11) DEFAULT '0' NOT NULL auto_increment,
......@@ -97,9 +85,15 @@ CREATE TABLE channel (
PRIMARY KEY (id)
);
#
# Table structure for table 'comments'
#
DROP TABLE IF EXISTS collection;
CREATE TABLE collection (
cid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
name varchar(32) DEFAULT '' NOT NULL,
types varchar(128) DEFAULT '' NOT NULL,
UNIQUE name (name),
PRIMARY KEY (cid)
);
DROP TABLE IF EXISTS comments;
CREATE TABLE comments (
cid int(6) DEFAULT '0' NOT NULL auto_increment,
......@@ -118,9 +112,6 @@ CREATE TABLE comments (
KEY lid (lid)
);
#
# Table structure for table 'cvs'
#
DROP TABLE IF EXISTS cvs;
CREATE TABLE cvs (
user varchar(32) DEFAULT '' NOT NULL,
......@@ -130,9 +121,6 @@ CREATE TABLE cvs (
timestamp int(11) DEFAULT '0' NOT NULL
);
#
# Table structure for table 'diaries'
#
DROP TABLE IF EXISTS diaries;
CREATE TABLE diaries (
id int(5) DEFAULT '0' NOT NULL auto_increment,
......@@ -142,9 +130,51 @@ CREATE TABLE diaries (
PRIMARY KEY (id)
);
#
# Table structure for table 'forum'
#
DROP TABLE IF EXISTS diary;
CREATE TABLE diary (
lid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
nid int(10) unsigned DEFAULT '0' NOT NULL,
body text NOT NULL,
PRIMARY KEY (lid)
);
DROP TABLE IF EXISTS entry;
CREATE TABLE entry (
eid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
name varchar(32) DEFAULT '' NOT NULL,
attributes varchar(255) DEFAULT '' NOT NULL,
collection varchar(32) DEFAULT '' NOT NULL,
UNIQUE name (name,collection),
PRIMARY KEY (eid)
);
DROP TABLE IF EXISTS feed;
CREATE TABLE feed (
fid int(11) DEFAULT '0' NOT NULL auto_increment,
title varchar(255) DEFAULT '' NOT NULL,
link varchar(255) DEFAULT '' NOT NULL,
refresh int(11),
uncache int(11),
timestamp int(11),
attributes varchar(255) DEFAULT '' NOT NULL,
UNIQUE title (title),
UNIQUE link (link),
PRIMARY KEY (fid)
);
DROP TABLE IF EXISTS file;
CREATE TABLE file (
lid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
nid int(10) unsigned DEFAULT '0' NOT NULL,
version varchar(10) DEFAULT '' NOT NULL,
url varchar(255) DEFAULT '' NOT NULL,
downloads int(10) unsigned DEFAULT '0' NOT NULL,
abstract text NOT NULL,
description text NOT NULL,
homepage varchar(255) DEFAULT '' NOT NULL,
PRIMARY KEY (lid)
);
DROP TABLE IF EXISTS forum;
CREATE TABLE forum (
lid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
......@@ -153,31 +183,25 @@ CREATE TABLE forum (
PRIMARY KEY (lid)
);
#
# Table structure for table 'headlines'
#
DROP TABLE IF EXISTS headlines;
CREATE TABLE headlines (
id int(11) DEFAULT '0' NOT NULL,
DROP TABLE IF EXISTS item;
CREATE TABLE item (
iid int(11) DEFAULT '0' NOT NULL auto_increment,
fid int(11) DEFAULT '0' NOT NULL,
title varchar(255) DEFAULT '' NOT NULL,
link varchar(255) DEFAULT '' NOT NULL,
number int(3) DEFAULT '0' NOT NULL,
UNIQUE title (title),
UNIQUE link (link)
author varchar(255) DEFAULT '' NOT NULL,
description text NOT NULL,
timestamp int(11),
attributes varchar(255) DEFAULT '' NOT NULL,
PRIMARY KEY (iid)
);
#
# Table structure for table 'layout'
#
DROP TABLE IF EXISTS layout;
CREATE TABLE layout (
user int(11) DEFAULT '0' NOT NULL,
block varchar(64) DEFAULT '' NOT NULL
);
#
# Table structure for table 'locales'
#
DROP TABLE IF EXISTS locales;
CREATE TABLE locales (
id int(11) DEFAULT '0' NOT NULL auto_increment,
......@@ -194,24 +218,16 @@ CREATE TABLE locales (
PRIMARY KEY (id)
);
#
# Table structure for table 'modules'
#
DROP TABLE IF EXISTS modules;
CREATE TABLE modules (
name varchar(64) DEFAULT '' NOT NULL,
PRIMARY KEY (name)
);
#
# Table structure for table 'node'
#
DROP TABLE IF EXISTS node;
CREATE TABLE node (
nid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
lid int(10) DEFAULT '0' NOT NULL,
pid int(10) DEFAULT '0' NOT NULL,
log text NOT NULL,
type varchar(16) DEFAULT '' NOT NULL,
title varchar(128) DEFAULT '' NOT NULL,
score int(11) DEFAULT '0' NOT NULL,
......@@ -219,12 +235,14 @@ CREATE TABLE node (
author int(6) DEFAULT '0' NOT NULL,
status int(4) DEFAULT '1' NOT NULL,
timestamp int(11) DEFAULT '0' NOT NULL,
cid int(10) unsigned DEFAULT '0' NOT NULL,
tid int(10) unsigned DEFAULT '0' NOT NULL,
comment int(2) DEFAULT '1' NOT NULL,
promote int(2) DEFAULT '1' NOT NULL,
moderate text NOT NULL,
users text NOT NULL,
timestamp_posted int(11) DEFAULT '0' NOT NULL,
timestamp_queued int(11) DEFAULT '0' NOT NULL,
timestamp_hidden int(11) DEFAULT '0' NOT NULL,
attributes varchar(255) DEFAULT '' NOT NULL,
KEY type (lid,type),
KEY author (author),
KEY title (title,type),
......@@ -233,9 +251,6 @@ CREATE TABLE node (
KEY status (status)
);
#
# Table structure for table 'page'
#
DROP TABLE IF EXISTS page;
CREATE TABLE page (
lid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
......@@ -245,9 +260,7 @@ CREATE TABLE page (
PRIMARY KEY (lid)
);
#
# Table structure for table 'poll'
#
DROP TABLE IF EXISTS poll;
CREATE TABLE poll (
lid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
nid int(10) unsigned DEFAULT '0' NOT NULL,
......@@ -257,9 +270,7 @@ CREATE TABLE poll (
PRIMARY KEY (lid)
);
#
# Table structure for table 'poll_choices'
#
DROP TABLE IF EXISTS poll_choices;
CREATE TABLE poll_choices (
chid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
nid int(10) unsigned DEFAULT '0' NOT NULL,
......@@ -269,9 +280,6 @@ CREATE TABLE poll_choices (
PRIMARY KEY (chid)
);
#
# Table structure for table 'rating'
#
DROP TABLE IF EXISTS rating;
CREATE TABLE rating (
user int(6) DEFAULT '0' NOT NULL,
......@@ -280,9 +288,6 @@ CREATE TABLE rating (
PRIMARY KEY (user)
);
#
# Table structure for table 'story'
#
DROP TABLE IF EXISTS story;
CREATE TABLE story (
lid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
......@@ -292,36 +297,16 @@ CREATE TABLE story (
PRIMARY KEY (lid)
);
#
# Table structure for table 'testac'
#
DROP TABLE IF EXISTS testac;
CREATE TABLE testac (
object_id int(11),
object_title varchar(64)
);
#
# Table structure for table 'testad'
#
DROP TABLE IF EXISTS testad;
CREATE TABLE testad (
object_id int(11),
object_title varchar(64)
);
#
# Table structure for table 'testae'
#
DROP TABLE IF EXISTS testae;
CREATE TABLE testae (
object_id int(11),
object_title varchar(64)
DROP TABLE IF EXISTS tag;
CREATE TABLE tag (
tid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
name varchar(32) DEFAULT '' NOT NULL,
attributes varchar(255) DEFAULT '' NOT NULL,
collections varchar(32) DEFAULT '' NOT NULL,
UNIQUE name (name,collections),
PRIMARY KEY (tid)
);
#
# Table structure for table 'topic'
#
DROP TABLE IF EXISTS topic;
CREATE TABLE topic (
tid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
......@@ -332,9 +317,6 @@ CREATE TABLE topic (
PRIMARY KEY (tid)
);
#
# Table structure for table 'users'
#
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
......@@ -362,9 +344,6 @@ CREATE TABLE users (
PRIMARY KEY (id)
);
#
# Table structure for table 'variable'
#
DROP TABLE IF EXISTS variable;
CREATE TABLE variable (
name varchar(32) DEFAULT '' NOT NULL,
......@@ -372,15 +351,11 @@ CREATE TABLE variable (
PRIMARY KEY (name)
);
#
# Table structure for table 'watchdog'
#
DROP TABLE IF EXISTS watchdog;
CREATE TABLE watchdog (
id int(5) DEFAULT '0' NOT NULL auto_increment,
user int(6) DEFAULT '0' NOT NULL,
type varchar(16) DEFAULT '' NOT NULL,
link varchar(16) DEFAULT '' NOT NULL,
message varchar(255) DEFAULT '' NOT NULL,
location varchar(128) DEFAULT '' NOT NULL,
hostname varchar(128) DEFAULT '' NOT NULL,
......
......@@ -71,7 +71,7 @@ function comment_form($edit) {
$form .= form_submit(t("Preview comment"));
$form .= form_submit(t("Post comment"));
}
return form($REQUEST_URL, $form);
}
......@@ -230,7 +230,7 @@ function comment_thread_min($cid, $threshold) {
while ($comment = db_fetch_object($result)) {
print "<UL>";
print " <LI>". comment_view($comment) ."</LI>\n";
print comment_view($comment);
comment_thread_min($comment->cid, $threshold);
print "</UL>";
}
......
......@@ -63,7 +63,7 @@ function node_get_comments($nid) {
}
function node_save($node, $filter) {
$rows = array(nid, pid, lid, cid, tid, log, type, title, score, votes, author, status, comment, promote, moderate, attributes, timestamp, timestamp_posted, timestamp_queued, timestamp_hidden);
$rows = array(nid, lid, cid, tid, type, title, score, votes, author, status, comment, promote, moderate, attributes, timestamp, timestamp_posted, timestamp_queued, timestamp_hidden);
if ($node[nid] > 0) {
$n = node_get_object(array("nid" => $node[nid]));
......@@ -82,7 +82,8 @@ function node_save($node, $filter) {
if ($u1) db_query("UPDATE node SET ". implode(", ", $u1) ." WHERE nid = '$node[nid]'");
if ($u2) db_query("UPDATE $n->type SET ". implode(", ", $u2) ." WHERE nid = '$node[nid]'");
if ($n->pid && ($node[status] == node_status("posted"))) db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$n->pid'");
if ($node[nid]) module_invoke($n->type, "update", node_get_object(array(nid => $n->nid)));
return $node[nid];
}
......@@ -123,9 +124,6 @@ function node_save($node, $filter) {
if ($result && $lid = db_insert_id()) {
$result = db_query("UPDATE node SET lid = '$lid' WHERE nid = '$nid'");
if ($result) {
if (($node[pid]) && ($node[status] == node_status("posted"))) {
db_query("UPDATE node SET status = '". node_status(expired) ."' WHERE nid = '$node[pid]'");
}
watchdog("special", "node: added $filter[type] '$node[title]'");
}
else {
......@@ -142,6 +140,8 @@ function node_save($node, $filter) {
}
}
if ($nid) module_invoke($filter[type], "insert", node_get_object(array(nid => $nid)));
return $nid;
}
}
......@@ -222,10 +222,9 @@ function node_attributes_save($type, $edit) {
}
function node_attributes_view($string) {
foreach (explode(",", $string) as $data) {
$entry = explode("=", $data);
if ($entry[0] && $entry[1]) {
$array[] = "<a href=\"?$entry[0]=$entry[1]\">$entry[1]</a>";
foreach (explode(",", $string) as $attribute) {
if ($attribute = trim($attribute)) {
$array[] = "<a href=\"?meta=". urlencode($attribute) ."\">$attribute</a>";
}
}
return $array ? $array : array();
......
......@@ -4,13 +4,7 @@
page_header();
foreach(explode("&", $QUERY_STRING) as $attribute) {
if ($attribute) $query .= "attributes LIKE '%". check_input($attribute) ."%' AND ";
}
$query = !$date ? $query : "";
$result = db_query("SELECT nid, type FROM node WHERE $query promote = '1' AND status = '". node_status("posted") ."' AND timestamp <= '". ($date > 0 ? check_input($date) : time()) ."' ORDER BY timestamp DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get(default_nodes_main, 10)));
$result = db_query("SELECT nid, type FROM node WHERE ". ($meta ? "attributes LIKE '%". check_input($meta) ."%' AND " : "") ." promote = '1' AND status = '". node_status("posted") ."' AND timestamp <= '". ($date > 0 ? check_input($date) : time()) ."' ORDER BY timestamp DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get(default_nodes_main, 10)));
$theme->header();
while ($node = db_fetch_object($result)) {
......
......@@ -169,36 +169,36 @@ function account_save($edit, &$name) {
}
}
db_query("UPDATE users SET $query access = '' WHERE userid = '$name'");
if ($edit[access]) {
foreach ($edit[access] as $key=>$value) {
$account = user_load($name);
db_query("UPDATE users SET access = '". field_set($account->access, $value, 1) ."' WHERE id = $account->id");
}
}
watchdog("account", "account: modified user '$name'");
}
else {
$edit[userid] = trim($edit[userid]);
$edit[real_email] = trim($edit[real_email]);
$edit[name] = $edit[realname];
if ($error = account_validate($edit)) {
return $error;
}
else {
$edit[passwd] = account_password();
$edit[hash] = substr(md5("$edit[userid]. ". time()), 0, 12);
$user = user_save("", array("userid" => $edit[userid], "real_email" => $edit[real_email], "passwd" => $edit[passwd], "status" => 1, "hash" => $edit[hash]));
$link = path_uri() ."account.php?op=confirm&name=$edit[userid]&hash=$edit[hash]";
$subject = strtr(t("Account details for %a"), array("%a" => variable_get(site_name, "drupal")));
$message = strtr(t("%a,\n\n\nsomeone signed up for a user account on %b and supplied this e-mail address as their contact. If it wasn't you, don't get your panties in a knot and simply ignore this mail. If this was you, you will have to confirm your account first or you will not be able to login. To confirm your account visit the URL below:\n\n %c\n\nOnce confirmed you can login using the following username and password:\n\n username: %a\n password: %d\n\n\n-- %b team\n"), array("%a" => $edit[userid], "%b" => variable_get(site_name, "drupal"), "%c" => $link, "%d" => $edit[passwd]));
watchdog("account", "new account: `$edit[userid]' &lt;$edit[real_email]&gt;");
mail($edit[real_email], $subject, $message, "From: noreply");
$name = $edit[userid];
}
......
......@@ -116,10 +116,8 @@ function book_form($edit = array()) {
$form .= form_hidden(userid, $edit[userid]);
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
if ($edit[pid]) {
$node = node_get_object(array("nid" => $edit[pid]));
$form .= form_item(t("Parent"), "<A HREF=\"node.php?id=$node->id\">". check_output($node->title) ."</A>", t("The parent subject or category the page belongs in."));
$form .= form_hidden("parent", $edit[parent]);
if ($edit[pid] > 0) {
$form .= form_hidden("pid", $edit[pid]);
}
else {
$form .= form_select(t("Parent"), "parent", $edit[parent], book_toc(), t("The parent subject or category the page belongs in."));
......@@ -133,11 +131,10 @@ function book_form($edit = array()) {
}
if ($edit[nid] > 0) {
$form .= form_hidden("pid", $edit[pid]);
$form .= form_hidden("nid", $edit[nid]);
}
if (!$edit[title]) {
if ($edit && !$edit[title]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a title.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
......@@ -153,13 +150,31 @@ function book_save($edit) {
global $status, $user;
if (!$edit[nid]) {
node_save($edit, array(author => $user->id, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight));
node_save($edit, array(author => $user->id, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, pid, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight));
}
else if (user_access($user)) {
node_save($edit, array(body, log, parent, title, type => "book", weight));
}
}
function book_delete($node) {
if ($node->pid && $node->status == node_status("posted")) {
db_query("UPDATE node SET status = '". node_status("posted") ."' WHERE nid = '$node->pid'");
}
}
function book_insert($node) {
if ($node->pid && $node->status == node_status("posted")) {
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
}
}
function book_update($node) {
if ($node->pid && $node->status == node_status("posted")) {
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
}
}
function book_parent($nid) {
global $status;
if ($node = node_get_object(array("nid" => $nid))) {
......@@ -206,7 +221,7 @@ function book_page() {
$theme->footer();
}
function book_update($id) {
function book_edit($id) {
global $status;
if ($node = node_get_object(array("nid" => $id))) {
......@@ -229,7 +244,7 @@ function book_user() {
switch($op) {
case "update":
$theme->box($title, book_update($id));
$theme->box($title, book_edit($id));
break;
case t("Preview"):
$theme->box($title, book_form($edit));
......
......@@ -116,10 +116,8 @@ function book_form($edit = array()) {
$form .= form_hidden(userid, $edit[userid]);
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
if ($edit[pid]) {
$node = node_get_object(array("nid" => $edit[pid]));
$form .= form_item(t("Parent"), "<A HREF=\"node.php?id=$node->id\">". check_output($node->title) ."</A>", t("The parent subject or category the page belongs in."));
$form .= form_hidden("parent", $edit[parent]);
if ($edit[pid] > 0) {
$form .= form_hidden("pid", $edit[pid]);
}
else {
$form .= form_select(t("Parent"), "parent", $edit[parent], book_toc(), t("The parent subject or category the page belongs in."));
......@@ -133,11 +131,10 @@ function book_form($edit = array()) {
}
if ($edit[nid] > 0) {
$form .= form_hidden("pid", $edit[pid]);
$form .= form_hidden("nid", $edit[nid]);
}
if (!$edit[title]) {
if ($edit && !$edit[title]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a title.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
......@@ -153,13 +150,31 @@ function book_save($edit) {
global $status, $user;
if (!$edit[nid]) {
node_save($edit, array(author => $user->id, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight));
node_save($edit, array(author => $user->id, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, pid, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight));
}
else if (user_access($user)) {
node_save($edit, array(body, log, parent, title, type => "book", weight));
}
}
function book_delete($node) {
if ($node->pid && $node->status == node_status("posted")) {
db_query("UPDATE node SET status = '". node_status("posted") ."' WHERE nid = '$node->pid'");
}
}
function book_insert($node) {
if ($node->pid && $node->status == node_status("posted")) {
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
}
}
function book_update($node) {
if ($node->pid && $node->status == node_status("posted")) {
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
}
}
function book_parent($nid) {
global $status;
if ($node = node_get_object(array("nid" => $nid))) {
......@@ -206,7 +221,7 @@ function book_page() {
$theme->footer();
}
function book_update($id) {
function book_edit($id) {
global $status;
if ($node = node_get_object(array("nid" => $id))) {
......@@ -229,7 +244,7 @@ function book_user() {
switch($op) {
case "update":
$theme->box($title, book_update($id));
$theme->box($title, book_edit($id));
break;
case t("Preview"):
$theme->box($title, book_form($edit));
......
......@@ -31,7 +31,7 @@ function conf_view_system() {
// node settings:
$output .= "<H3>Node settings</H3>\n";
$output .= form_select(t("Default number of nodes to display"), "default_nodes_main", variable_get("default_nodes_main", 10), array(10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30), t("The default maximum number of nodes to display on the main page."));
$output .= form_select(t("Default number of nodes to display"), "default_nodes_main", variable_get("default_nodes_main", 10), array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30), t("The default maximum number of nodes to display on the main page."));
$output .= "<HR>\n";
// comment settings:
......
......@@ -22,7 +22,7 @@ function meta_form($type, $edit = array()) {
function meta_save($type, $edit = array()) {
$result = db_query("SELECT * FROM collection WHERE types LIKE '%". check_input($type) ."%'");
while ($collection = db_fetch_object($result)) {
$output = field_merge($output, $edit[$collection->name]);
$output .= ", ". $edit[$collection->name];
}
return $output;
}
......@@ -54,8 +54,8 @@ function meta_form_tag($edit = array()) {
global $REQUEST_URI;
$form .= form_textfield("Meta-tag name", "name", $edit[name], 50, 64, "Required. The name for this meta-tag. Example: 'Apache'.");
$form .= form_textfield("Attributes", "attributes", $edit[attributes], 50, 64, htmlentities("Required. Format: <type>=<value>,<type>=<value>;. Example: 'software=apache,type=webserver,os=linux,'."));
$form .= form_textfield("Collections", "collections", $edit[collections], 50, 64, "Required. A comma-seperated list of collections you want to associate this meta-tag with. Example: 'Software, Internet'");
$form .= form_textfield("Attributes", "attributes", $edit[attributes], 50, 64, "Required. A comma-seperated list of keywords you want to associate this meta-tag with. Example: 'Computers, Software, Webservers'.");
$form .= form_textfield("Collections", "collections", $edit[collections], 50, 64, "Required. A comma-seperated list of collections you want to associate this meta-tag with. Example: 'Section'.");
$form .= form_submit("Submit");
if ($edit[tid]) {
......