diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book.module | 35 | ||||
-rw-r--r-- | modules/book/book.module | 35 | ||||
-rw-r--r-- | modules/drupal.module | 20 | ||||
-rw-r--r-- | modules/drupal/drupal.module | 20 | ||||
-rw-r--r-- | modules/forum.module | 7 | ||||
-rw-r--r-- | modules/forum/forum.module | 7 | ||||
-rw-r--r-- | modules/headline.module | 18 | ||||
-rw-r--r-- | modules/page.module | 9 | ||||
-rw-r--r-- | modules/page/page.module | 9 | ||||
-rw-r--r-- | modules/queue.module | 7 | ||||
-rw-r--r-- | modules/settings.module | 1 | ||||
-rw-r--r-- | modules/story.module | 14 | ||||
-rw-r--r-- | modules/story/story.module | 14 |
13 files changed, 103 insertions, 93 deletions
diff --git a/modules/book.module b/modules/book.module index defdd8ae6..215d4505b 100644 --- a/modules/book.module +++ b/modules/book.module @@ -124,8 +124,10 @@ function book_form($edit = array()) { $form .= form_select(t("Weight"), "weight", $edit[weight], array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30), t("The heavier nodes will sink and the lighter nodes will be positioned nearer the top.")); } - $form .= form_hidden("pid", $edit[pid]); - $form .= form_hidden("nid", $edit[nid]); + if ($edit[nid] > 0) { + $form .= form_hidden("pid", $edit[pid]); + $form .= form_hidden("nid", $edit[nid]); + } if (!$edit) { $form .= form_submit(t("Preview")); @@ -143,7 +145,14 @@ function book_form($edit = array()) { } function book_save($edit) { - node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book")), array(userid => $edit[userid]))); + global $status, $user; + + if (!$edit[nid]) { + node_save($edit, array(author => $user->id, body, cid, comment => category_comment($edit[cid]), log, moderate => topic_moderate($edit[tid]), promote => category_promote($edit[cid]), score => 0, status => (category_submission($edit[cid]) ? $status[queued] : $status[posted]), tid, timestamp => time(), title, type => "book", votes => 0, weight)); + } + else if (user_access($user)) { + node_save($edit, array(body, cid, log, parent, tid, title, type => "book", weight)); + } } function book_parent($nid) { @@ -174,26 +183,6 @@ function book_tree($parent = "", $depth = 0) { return $output; } -/* -function book_tree($parent = 0, $depth = 0) { - global $PHP_SELF, $status; - - // if (($parent > 0) && ($depth < 3 || strstr($PHP_SELF,"admin.php"))) { - if ($depth < 3 || strstr($PHP_SELF,"admin.php")) { - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight", 1); - $output .= "<UL>"; - while ($node = db_fetch_object($result)) { - $output .= "<LI><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A>"; - if ($PHP_SELF == "/admin.php") $output .= " <SMALL>(weight: $node->weight/$node->parent, status: $node->status) (<A HREF=\"admin.php?mod=book&op=edit&id=$node->nid\">edit</A>)</SMALL>\n"; - if ($node->pid) $output .= book_tree($node->pid, $depth + 1); - $output .= book_tree($node->nid, $depth + 1); - } - $output .= "</UL>"; - } - return $output; -} -*/ - function book_list($query = array()) { return node_overview($query); } diff --git a/modules/book/book.module b/modules/book/book.module index defdd8ae6..215d4505b 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -124,8 +124,10 @@ function book_form($edit = array()) { $form .= form_select(t("Weight"), "weight", $edit[weight], array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30), t("The heavier nodes will sink and the lighter nodes will be positioned nearer the top.")); } - $form .= form_hidden("pid", $edit[pid]); - $form .= form_hidden("nid", $edit[nid]); + if ($edit[nid] > 0) { + $form .= form_hidden("pid", $edit[pid]); + $form .= form_hidden("nid", $edit[nid]); + } if (!$edit) { $form .= form_submit(t("Preview")); @@ -143,7 +145,14 @@ function book_form($edit = array()) { } function book_save($edit) { - node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book")), array(userid => $edit[userid]))); + global $status, $user; + + if (!$edit[nid]) { + node_save($edit, array(author => $user->id, body, cid, comment => category_comment($edit[cid]), log, moderate => topic_moderate($edit[tid]), promote => category_promote($edit[cid]), score => 0, status => (category_submission($edit[cid]) ? $status[queued] : $status[posted]), tid, timestamp => time(), title, type => "book", votes => 0, weight)); + } + else if (user_access($user)) { + node_save($edit, array(body, cid, log, parent, tid, title, type => "book", weight)); + } } function book_parent($nid) { @@ -174,26 +183,6 @@ function book_tree($parent = "", $depth = 0) { return $output; } -/* -function book_tree($parent = 0, $depth = 0) { - global $PHP_SELF, $status; - - // if (($parent > 0) && ($depth < 3 || strstr($PHP_SELF,"admin.php"))) { - if ($depth < 3 || strstr($PHP_SELF,"admin.php")) { - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight", 1); - $output .= "<UL>"; - while ($node = db_fetch_object($result)) { - $output .= "<LI><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A>"; - if ($PHP_SELF == "/admin.php") $output .= " <SMALL>(weight: $node->weight/$node->parent, status: $node->status) (<A HREF=\"admin.php?mod=book&op=edit&id=$node->nid\">edit</A>)</SMALL>\n"; - if ($node->pid) $output .= book_tree($node->pid, $depth + 1); - $output .= book_tree($node->nid, $depth + 1); - } - $output .= "</UL>"; - } - return $output; -} -*/ - function book_list($query = array()) { return node_overview($query); } diff --git a/modules/drupal.module b/modules/drupal.module index e92f628a6..b1406ca68 100644 --- a/modules/drupal.module +++ b/modules/drupal.module @@ -18,16 +18,16 @@ function drupal_page() { $theme->box("Screenshots", $output); */ - $output = "<H3>Download</H3>\n"; - $output .= " <LI><A HREF=\"drupal/drupal-2.00.tgz\">drupal 2.00</A> (2001/03/15 - latest version)</LI>\n"; - $output .= " <LI>drupal 1.00 (2001/01/15)</LI>\n"; - $output .= "<H3>Documentation</H3>\n"; - $output .= " <LI><A HREF=\"node.php?title=drupal+handbook\">drupal handbook</A></LI>\n"; - $output .= "<H3>Mailing lists</H3>\n"; - $output .= " <LI><A HREF=\"node.php?title=mailing+lists\">mailing lists</A></LI>"; - $output .= "<H3>Development</H3>\n"; - $output .= " <LI><A HREF=\"node.php?title=development\">drupal development</A> (<A HREF=\"node.php?title=CVS\">CVS</A>)</LI>\n"; - $theme->box("Support and development", $output); + $output = "<H3>Download Drupal</H3>\n"; + $output .= " <LI><A HREF=\"drupal/drupal-2.00.tgz\">Drupal 2.00</A> (2001/03/15 - latest version)</LI>\n"; + $output .= " <LI>Drupal 1.00 (2001/01/15)</LI>\n"; + $output .= "<H3>Drupal documentation</H3>\n"; + $output .= " <LI><A HREF=\"node.php?title=drupal+handbook\">Drupal handbook</A></LI>\n"; + $output .= "<H3>Drupal mailing lists</H3>\n"; + $output .= " <LI><A HREF=\"node.php?title=mailing+lists\">Mailing list information</A></LI>"; + $output .= "<H3>Drupal development</H3>\n"; + $output .= " <LI><A HREF=\"node.php?title=development\">Development information</A>, <A HREF=\"node.php?title=CVS\">CVS instructions</A>, <A HREF=\"module.php?mod=cvs\">CVS log messages</A></LI>\n"; + $theme->box("Drupal support and development", $output); $theme->footer(); } diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module index e92f628a6..b1406ca68 100644 --- a/modules/drupal/drupal.module +++ b/modules/drupal/drupal.module @@ -18,16 +18,16 @@ function drupal_page() { $theme->box("Screenshots", $output); */ - $output = "<H3>Download</H3>\n"; - $output .= " <LI><A HREF=\"drupal/drupal-2.00.tgz\">drupal 2.00</A> (2001/03/15 - latest version)</LI>\n"; - $output .= " <LI>drupal 1.00 (2001/01/15)</LI>\n"; - $output .= "<H3>Documentation</H3>\n"; - $output .= " <LI><A HREF=\"node.php?title=drupal+handbook\">drupal handbook</A></LI>\n"; - $output .= "<H3>Mailing lists</H3>\n"; - $output .= " <LI><A HREF=\"node.php?title=mailing+lists\">mailing lists</A></LI>"; - $output .= "<H3>Development</H3>\n"; - $output .= " <LI><A HREF=\"node.php?title=development\">drupal development</A> (<A HREF=\"node.php?title=CVS\">CVS</A>)</LI>\n"; - $theme->box("Support and development", $output); + $output = "<H3>Download Drupal</H3>\n"; + $output .= " <LI><A HREF=\"drupal/drupal-2.00.tgz\">Drupal 2.00</A> (2001/03/15 - latest version)</LI>\n"; + $output .= " <LI>Drupal 1.00 (2001/01/15)</LI>\n"; + $output .= "<H3>Drupal documentation</H3>\n"; + $output .= " <LI><A HREF=\"node.php?title=drupal+handbook\">Drupal handbook</A></LI>\n"; + $output .= "<H3>Drupal mailing lists</H3>\n"; + $output .= " <LI><A HREF=\"node.php?title=mailing+lists\">Mailing list information</A></LI>"; + $output .= "<H3>Drupal development</H3>\n"; + $output .= " <LI><A HREF=\"node.php?title=development\">Development information</A>, <A HREF=\"node.php?title=CVS\">CVS instructions</A>, <A HREF=\"module.php?mod=cvs\">CVS log messages</A></LI>\n"; + $theme->box("Drupal support and development", $output); $theme->footer(); } diff --git a/modules/forum.module b/modules/forum.module index 5a14831c1..8e3693f5f 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -23,8 +23,11 @@ function forum_form($edit = array()) { } function forum_save($edit) { - global $status; - node_save(array_merge($edit, array(type => "forum", status => $status[posted]))); + global $user, $status; + + if (user_access($user)) { + node_save($edit, array(author => $user->id, body, cid, comment => category_comment($edit[cid]), moderate => topic_moderate($edit[tid]), promote => category_promote($edit[cid]), score => 0, status => $status[posted], tid, timestamp => time(), title, type => "forum", votes => 0)); + } } function forum_num_comments($nid) { diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 5a14831c1..8e3693f5f 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -23,8 +23,11 @@ function forum_form($edit = array()) { } function forum_save($edit) { - global $status; - node_save(array_merge($edit, array(type => "forum", status => $status[posted]))); + global $user, $status; + + if (user_access($user)) { + node_save($edit, array(author => $user->id, body, cid, comment => category_comment($edit[cid]), moderate => topic_moderate($edit[tid]), promote => category_promote($edit[cid]), score => 0, status => $status[posted], tid, timestamp => time(), title, type => "forum", votes => 0)); + } } function forum_num_comments($nid) { diff --git a/modules/headline.module b/modules/headline.module index 666c694e3..1d4474f00 100644 --- a/modules/headline.module +++ b/modules/headline.module @@ -64,7 +64,7 @@ function headline_help() { <P>Drupal's headline module both imports and exports RDF/RSS headlines.</P> <P>A lot of news-oriented websites are now publishing news (headlines) and making their content available through XML, RSS and RDF backend files. They syndicate free content and allow retrieval and further transmission, aggregation, and online publication. In its current state, drupal's headline module supports RDF and RSS backends.</P> <P>RSS was originally developed by Netscape to allow adding news channels to "My Netscape" sites, but it has since become adopted as the <I>de facto</I> net standard for distributing headlines and brief dynamic texts.</P> - <P>The headline module goes out to a list of configured news sites once an hour or so (driven by cron), downloads new RSS/RDF data and makes it available to your visitors. In addition, your headlines are exported as well and can be retrieved by other sites from <CODE><?php echo variable_get(site_url, "http://yourdomain.com/"); ?>export/headlines.rdf</CODE>.</P> + <P>The headline module goes out to a list of configured news sites once an hour or so (driven by cron), downloads new RSS/RDF data and makes it available to your visitors. In addition, your headlines are exported as well and can be retrieved by other sites from <CODE><?php echo path_uri(); ?>export/headlines.rdf</CODE>.</P> <?php } @@ -146,7 +146,7 @@ function headline_admin_add($id) { function headline_admin_edit($id) { $result = db_query("SELECT * FROM channel WHERE id='$id' ORDER BY id"); - if ($channel = db_fetch_object($result)) { + if ($channel = db_fetch_object($result)) { $output .= " <FORM ACTION=\"admin.php?mod=headline\" METHOD=\"post\">\n"; $output .= " <INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$id\">\n"; $output .= " <P>\n"; @@ -235,7 +235,7 @@ function headline_export_rdf() { print "<channel>\n"; print " <title>". variable_get(site_name, "drupal") ."</title>\n"; - print " <link>". variable_get(site_url, "http://drupal/") ."</link>\n"; + print " <link>". path_uri() ."</link>\n"; print " <description>". variable_get(site_name, "drupal") ."</description>\n"; print "</channel>\n"; @@ -244,7 +244,7 @@ function headline_export_rdf() { while ($node = db_fetch_object($result)) { print "<item>\n"; print " <title>". check_export($node->title) ."</title>\n"; - print " <link>". variable_get(site_url, "http://drupal/") ."node.php?id=$node->nid</link>\n"; + print " <link>". path_uri() ."node.php?id=$node->nid</link>\n"; print "</item>\n"; } @@ -262,9 +262,9 @@ function headline_export_rss() { print "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"; print "xmlns=\"http://purl.org/rss/1.0/\">\n\n"; - print "<channel rdf:about=\"". variable_get(site_url, "http://drupal/") ."export/headlinesRSS10.rdf\">\n"; + print "<channel rdf:about=\"". path_uri() ."export/headlinesRSS10.rdf\">\n"; print " <title>". variable_get(site_name, "drupal") ."</title>\n"; - print " <link>". variable_get(site_url, "http://drupal/") ."</link>\n"; + print " <link>". path_uri() ."</link>\n"; print " <description>". variable_get(site_name, "drupal") ."</description>\n"; print " <items>\n"; @@ -273,7 +273,7 @@ function headline_export_rss() { $result = db_query("SELECT * FROM node WHERE promote = '1' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10"); while ($node = db_fetch_object($result)) { - print " <rdf:li resource=\"". variable_get(site_url, "http://drupal/") ."node.php?id=$node->nid\" />\n"; + print " <rdf:li resource=\"". path_uri() ."node.php?id=$node->nid\" />\n"; } print " </rdf:Seq>\n"; @@ -283,9 +283,9 @@ function headline_export_rss() { $result = db_query("SELECT * FROM node WHERE promote = '1' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10"); while ($node = db_fetch_object($result)) { - print "<item rdf:about=\"". variable_get(site_url, "http://drupal/") ."node.php?id=$node->nid\">\n"; + print "<item rdf:about=\"". path_uri() ."node.php?id=$node->nid\">\n"; print " <title>". check_export($node->title) ."</title>\n"; - print " <link>". variable_get(site_url, "http://drupal/") ."node.php?id=$node->nid</link>\n"; + print " <link>". path_uri() ."node.php?id=$node->nid</link>\n"; if ($node->abstract) print " <description>". check_output($node->abstract, 1) ."</description>\n"; if ($node->body) print " <description>". check_output($node->body, 1) ."</description>\n"; diff --git a/modules/page.module b/modules/page.module index c1c380a11..39ab6f63b 100644 --- a/modules/page.module +++ b/modules/page.module @@ -1,6 +1,6 @@ <?php -$GLOBALS[format] = array(0 => HTML, 1 => PHP, 2 => text); +$GLOBALS[format] = array(0 => "HTML", 1 => "PHP", 2 => "text"); function page_view($node, $main = 0) { global $format, $theme; @@ -37,8 +37,11 @@ function page_form($edit = array()) { } function page_save($edit) { - global $status; - node_save(array_merge($edit, array(type => "page", status => $status[posted]))); + global $status, $user; + + if (user_access($user)) { + node_save($edit, array(author => $user->id, body, cid, comment => category_comment($edit[cid]), format, moderate => topic_moderate($edit[tid]), promote => category_promote($edit[cid]), score => 0, status => $status[posted], tid, timestamp => time(), title, type => "page", votes => 0)); + } } function page_query($type = "") { diff --git a/modules/page/page.module b/modules/page/page.module index c1c380a11..39ab6f63b 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -1,6 +1,6 @@ <?php -$GLOBALS[format] = array(0 => HTML, 1 => PHP, 2 => text); +$GLOBALS[format] = array(0 => "HTML", 1 => "PHP", 2 => "text"); function page_view($node, $main = 0) { global $format, $theme; @@ -37,8 +37,11 @@ function page_form($edit = array()) { } function page_save($edit) { - global $status; - node_save(array_merge($edit, array(type => "page", status => $status[posted]))); + global $status, $user; + + if (user_access($user)) { + node_save($edit, array(author => $user->id, body, cid, comment => category_comment($edit[cid]), format, moderate => topic_moderate($edit[tid]), promote => category_promote($edit[cid]), score => 0, status => $status[posted], tid, timestamp => time(), title, type => "page", votes => 0)); + } } function page_query($type = "") { diff --git a/modules/queue.module b/modules/queue.module index c864e9169..9b0bcfcb9 100644 --- a/modules/queue.module +++ b/modules/queue.module @@ -97,7 +97,7 @@ function queue_node($id) { } function queue_page() { - global $id, $op, $user, $vote; + global $id, $op, $theme, $user, $vote; if ($user->id) { switch($op) { @@ -112,6 +112,11 @@ function queue_page() { break; } } + else { + $theme->header(); + $theme->box(t("Moderation queue"), notice_account()); + $theme->footer(); + } } ?> diff --git a/modules/settings.module b/modules/settings.module index 015d457a8..2edda844a 100644 --- a/modules/settings.module +++ b/modules/settings.module @@ -6,7 +6,6 @@ function settings_conf() { // general settings: $output .= form_textfield(t("Name"), "site_name", variable_get(site_name, "drupal"), 30, 55, t("The name of this website.")); $output .= form_textfield(t("Slogan"), "site_slogan", variable_get(site_slogan, ""), 30, 55, t("The slogan of this website")); - $output .= form_textfield(t("URL"), "site_url", variable_get(site_url, "http://drupal/"), 30, 55, t("The fully qualified URL of this website: starts with \"http://\" and ends with a trailing slash!")); $output .= form_textfield(t("E-mail address"), "site_mail", variable_get(site_mail, "root@localhost"), 30, 55, t("A valid e-mail address for this website, used by the auto-mailer to create new user accounts.")); $output .= form_textarea(t("Footer message"), "site_footer", variable_get(site_footer, ""), 55, 3, t("This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.")); $output .= form_textfield(t("Anonymous user"), "anonymous", variable_get(anonymous, "Anonymous"), 30, 55, t("The name used to indicate anonymous users.")); diff --git a/modules/story.module b/modules/story.module index dfb6c6cef..7f0c1ba64 100644 --- a/modules/story.module +++ b/modules/story.module @@ -45,8 +45,9 @@ function story_form($edit = array()) { $form .= form_textarea(t("Body"), "body", $edit[body], 50, 15, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html)); // hidden fields: - $form .= form_hidden("timestamp", $edit[timestamp]); - $form .= form_hidden("nid", $edit[nid]); + if ($edit[nid] > 0) { + $form .= form_hidden("nid", $edit[nid]); + } if (!$edit) { $form .= form_submit(t("Preview")); @@ -68,7 +69,14 @@ function story_form($edit = array()) { } function story_save($edit) { - node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "story")), array(userid => $edit[userid]))); + global $status, $user; + + if (!$edit[nid]) { + node_save($edit, array(abstract, author => $user->id, body, cid, comment => category_comment($edit[cid]), moderate => topic_moderate($edit[tid]), promote => category_promote($edit[cid]), score => 0, status => (category_submission($edit[cid]) ? $status[queued] : $status[posted]), tid, timestamp => time(), title, type => "story", votes => 0)); + } + else if (user_access($user)) { + node_save($edit, array(abstract, body, cid, tid, title, type => "story")); + } } function story_block() { diff --git a/modules/story/story.module b/modules/story/story.module index dfb6c6cef..7f0c1ba64 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -45,8 +45,9 @@ function story_form($edit = array()) { $form .= form_textarea(t("Body"), "body", $edit[body], 50, 15, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html)); // hidden fields: - $form .= form_hidden("timestamp", $edit[timestamp]); - $form .= form_hidden("nid", $edit[nid]); + if ($edit[nid] > 0) { + $form .= form_hidden("nid", $edit[nid]); + } if (!$edit) { $form .= form_submit(t("Preview")); @@ -68,7 +69,14 @@ function story_form($edit = array()) { } function story_save($edit) { - node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "story")), array(userid => $edit[userid]))); + global $status, $user; + + if (!$edit[nid]) { + node_save($edit, array(abstract, author => $user->id, body, cid, comment => category_comment($edit[cid]), moderate => topic_moderate($edit[tid]), promote => category_promote($edit[cid]), score => 0, status => (category_submission($edit[cid]) ? $status[queued] : $status[posted]), tid, timestamp => time(), title, type => "story", votes => 0)); + } + else if (user_access($user)) { + node_save($edit, array(abstract, body, cid, tid, title, type => "story")); + } } function story_block() { |