diff options
-rw-r--r-- | modules/book.module | 15 | ||||
-rw-r--r-- | modules/book/book.module | 15 | ||||
-rw-r--r-- | modules/page.module | 49 | ||||
-rw-r--r-- | modules/page/page.module | 49 |
4 files changed, 78 insertions, 50 deletions
diff --git a/modules/book.module b/modules/book.module index 58ae523b9..80f9fa50c 100644 --- a/modules/book.module +++ b/modules/book.module @@ -162,12 +162,19 @@ function book_delete(&$node) { } function book_form(&$node, &$help, &$error) { - global $user; + global $user, $op; $output .= form_select(t("Parent"), "parent", $node->parent, book_toc(), t("The parent subject or category the page belongs in.")); - if ($node->teaser && !$node->format) { - $output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]); + if ($node->format) { + if ($op != t("Preview")) { + $node->body = addslashes($node->body); + } + } + else { + if ($node->teaser) { + $output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]); + } } $output .= form_textarea(t("Body"), "body", $node->body, 60, 20, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))); @@ -313,7 +320,7 @@ function book_body($node) { ob_end_clean(); } else { - $output = check_output($node->body, 1); + $output = check_output(filter($node->body), 1); } return $output; diff --git a/modules/book/book.module b/modules/book/book.module index 58ae523b9..80f9fa50c 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -162,12 +162,19 @@ function book_delete(&$node) { } function book_form(&$node, &$help, &$error) { - global $user; + global $user, $op; $output .= form_select(t("Parent"), "parent", $node->parent, book_toc(), t("The parent subject or category the page belongs in.")); - if ($node->teaser && !$node->format) { - $output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]); + if ($node->format) { + if ($op != t("Preview")) { + $node->body = addslashes($node->body); + } + } + else { + if ($node->teaser) { + $output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]); + } } $output .= form_textarea(t("Body"), "body", $node->body, 60, 20, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))); @@ -313,7 +320,7 @@ function book_body($node) { ob_end_clean(); } else { - $output = check_output($node->body, 1); + $output = check_output(filter($node->body), 1); } return $output; diff --git a/modules/page.module b/modules/page.module index d715de045..61d15c9b8 100644 --- a/modules/page.module +++ b/modules/page.module @@ -2,8 +2,8 @@ // $Id$ function page_node($field) { - $info["name"] = t("static page"); - $info["description"] = t("If you just want to add a static page with a link in the menu to your site, this would be the best choice. Unlike a story, a page by-passes the submission queue."); + $info["name"] = t("page"); + $info["description"] = t("If you just want to add a page with a link in the menu to your site, this would be the best choice. Unlike a story, a page by-passes the submission queue."); return $info[$field]; } @@ -48,7 +48,6 @@ function page_delete(&$node) { function page_load($node) { $page = db_fetch_object(db_query("SELECT format, link FROM page WHERE nid = '$node->nid'")); - return $page; } @@ -66,15 +65,16 @@ function page_link($type) { function page_body($node) { global $theme, $op; - if ($node->format) { - /* - ** Make sure only authorized users can preview PHP pages. - */ + /* + ** Make sure only authorized users can preview static (PHP) + ** pages. + */ - if ($op == t("Preview") && !user_access("adminster nodes")) { - return; - } + if ($op == t("Preview") && !user_access("adminster nodes")) { + return; + } + if ($node->format) { ob_start(); eval($node->body); $output = ob_get_contents(); @@ -95,23 +95,30 @@ function page_view($node, $main = 0) { ** will be generated. */ - $theme->box($node->title, page_body($body)); + $output .= page_body($node); + + /* + ** Add the node specific links: + */ + + $output .= "<div align=\"right\">". $theme->links(link_node($node, $main)) ."</div>"; + + $theme->box($node->title, $output); } function page_form(&$node, &$help, &$error) { global $op; - if ($node->teaser && !$node->format) { - $output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]); + if ($node->format) { + if ($op != t("Preview")) { + $node->body = addslashes($node->body); + } + } + else { + if ($node->teaser) { + $output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]); + } } - - /* - ** Q: s this still required? - ** - ** if ($op != t("Preview") && $node->format) { - ** $node->body = addslashes($node->body); - ** } - */ $output .= form_textarea("Body", "body", $node->body, 60, 20); $output .= form_textfield("Link", "link", $node->link, 60, 64); diff --git a/modules/page/page.module b/modules/page/page.module index d715de045..61d15c9b8 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -2,8 +2,8 @@ // $Id$ function page_node($field) { - $info["name"] = t("static page"); - $info["description"] = t("If you just want to add a static page with a link in the menu to your site, this would be the best choice. Unlike a story, a page by-passes the submission queue."); + $info["name"] = t("page"); + $info["description"] = t("If you just want to add a page with a link in the menu to your site, this would be the best choice. Unlike a story, a page by-passes the submission queue."); return $info[$field]; } @@ -48,7 +48,6 @@ function page_delete(&$node) { function page_load($node) { $page = db_fetch_object(db_query("SELECT format, link FROM page WHERE nid = '$node->nid'")); - return $page; } @@ -66,15 +65,16 @@ function page_link($type) { function page_body($node) { global $theme, $op; - if ($node->format) { - /* - ** Make sure only authorized users can preview PHP pages. - */ + /* + ** Make sure only authorized users can preview static (PHP) + ** pages. + */ - if ($op == t("Preview") && !user_access("adminster nodes")) { - return; - } + if ($op == t("Preview") && !user_access("adminster nodes")) { + return; + } + if ($node->format) { ob_start(); eval($node->body); $output = ob_get_contents(); @@ -95,23 +95,30 @@ function page_view($node, $main = 0) { ** will be generated. */ - $theme->box($node->title, page_body($body)); + $output .= page_body($node); + + /* + ** Add the node specific links: + */ + + $output .= "<div align=\"right\">". $theme->links(link_node($node, $main)) ."</div>"; + + $theme->box($node->title, $output); } function page_form(&$node, &$help, &$error) { global $op; - if ($node->teaser && !$node->format) { - $output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]); + if ($node->format) { + if ($op != t("Preview")) { + $node->body = addslashes($node->body); + } + } + else { + if ($node->teaser) { + $output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]); + } } - - /* - ** Q: s this still required? - ** - ** if ($op != t("Preview") && $node->format) { - ** $node->body = addslashes($node->body); - ** } - */ $output .= form_textarea("Body", "body", $node->body, 60, 20); $output .= form_textfield("Link", "link", $node->link, 60, 64); |