- Applied Natrak's "create PHP content" patch.

4.1.x
Dries Buytaert 2002-11-18 22:19:17 +00:00
parent 36cb350ef1
commit 5c0558b503
4 changed files with 26 additions and 6 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {

View File

@ -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) {