diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-11-18 22:19:17 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-11-18 22:19:17 +0000 |
commit | 5c0558b50366fe42634963b9676d9f4f697d07c4 (patch) | |
tree | 4453f174f463e2a1779b6a6a02e34e973d62938e /modules/book.module | |
parent | 36cb350ef1e45ec946242cb2c52b3f4d9004600a (diff) | |
download | brdo-5c0558b50366fe42634963b9676d9f4f697d07c4.tar.gz brdo-5c0558b50366fe42634963b9676d9f4f697d07c4.tar.bz2 |
- Applied Natrak's "create PHP content" patch.
Diffstat (limited to 'modules/book.module')
-rw-r--r-- | modules/book.module | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/book.module b/modules/book.module index d333da71c..504845d8d 100644 --- a/modules/book.module +++ b/modules/book.module @@ -173,6 +173,14 @@ function book_delete(&$node) { db_query("DELETE FROM book WHERE nid = '%d'", $node->nid); } +function book_validate($node, &$error) { + + // Make sure user has permissions to create php content: + $node->format = $node->format && user_access("create php content"); + + return $node; +} + function book_form(&$node, &$help, &$error) { global $user, $op; @@ -198,7 +206,9 @@ function book_form(&$node, &$help, &$error) { if (user_access("administer nodes")) { $output .= form_select(t("Weight"), "weight", $node->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 pages will sink and the lighter pages will be positioned nearer the top.")); - $output .= form_select("Type", "format", $node->format, array(0 => "HTML / text", 1 => "PHP")); + if (user_access("create php content")) { + $output .= form_select("Type", "format", $node->format, array(0 => "HTML / text", 1 => "PHP")); + } } else { @@ -327,7 +337,7 @@ function book_body($node) { */ if ($op == t("Preview")) { - if (user_access("administer nodes")) { + if (user_access("create php content")) { $node->body = stripslashes($node->body); // see also book_form() } else { |