47 lines
1.3 KiB
Plaintext
47 lines
1.3 KiB
Plaintext
<?php
|
|
|
|
$GLOBALS[format] = array(0 => "HTML", 1 => "PHP", 2 => "text");
|
|
|
|
function page_view($node, $main = 0) {
|
|
global $format, $theme;
|
|
|
|
switch ($format[$node->format]) {
|
|
case "PHP":
|
|
$output = eval($node->body);
|
|
break;
|
|
case "text":
|
|
$output = nl2br(htmlentities($node->body));
|
|
break;
|
|
default:
|
|
$output = check_output($node->body, 1);
|
|
}
|
|
|
|
$theme->box(check_output($node->title), $output);
|
|
}
|
|
|
|
function page_status() {
|
|
return array(dumped, posted);
|
|
}
|
|
|
|
function page_form($edit = array()) {
|
|
global $format, $REQUEST_URI;
|
|
|
|
$form .= form_textfield("Subject", "title", $edit[title], 50, 64);
|
|
$form .= structure_form("page", $edit);
|
|
$form .= form_textarea("Body", "body", $edit[body], 50, 10);
|
|
$form .= form_select("Type", "format", $edit[format], $format);
|
|
$form .= form_hidden("nid", $edit[nid]);
|
|
$form .= form_submit("Submit");
|
|
|
|
return form($REQUEST_URI, $form);
|
|
}
|
|
|
|
function page_save($edit) {
|
|
global $status, $user;
|
|
|
|
if (user_access($user)) {
|
|
node_save($edit, array(author => $user->id, body, cid, comment => variable_get("page_comment", 0), format, moderate => variable_get("page_moderate", ""), promote => variable_get("page_promote", 0), score => 0, status => $status[posted], tid, timestamp => time(), title, type => "page", votes => 0));
|
|
}
|
|
}
|
|
|
|
?> |