summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/book.module14
-rw-r--r--modules/book/book.module14
-rw-r--r--modules/system.module2
-rw-r--r--modules/system/system.module2
4 files changed, 26 insertions, 6 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 {
diff --git a/modules/book/book.module b/modules/book/book.module
index d333da71c..504845d8d 100644
--- a/modules/book/book.module
+++ b/modules/book/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 {
diff --git a/modules/system.module b/modules/system.module
index 4ca23b860..c20d1c848 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -29,7 +29,7 @@ function system_help_cron() {
}
function system_perm() {
- return array("administer site configuration", "access administration pages");
+ return array("administer site configuration", "access administration pages", "create php content");
}
function system_link($type) {
diff --git a/modules/system/system.module b/modules/system/system.module
index 4ca23b860..c20d1c848 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -29,7 +29,7 @@ function system_help_cron() {
}
function system_perm() {
- return array("administer site configuration", "access administration pages");
+ return array("administer site configuration", "access administration pages", "create php content");
}
function system_link($type) {