Commit f5be5fdf authored by Kjartan's avatar Kjartan

- modified node_save so that revisions are not validated using check_input,

  as this breaks revisions.
- modified link_node() to take a third parameter $main, which will be passed on
  to _link hooks. This lets modules decide which links a node will get when
  shown on the main page, or when not.
- updated themes to use the new syntax.
parent dcf8e14a
......@@ -350,10 +350,10 @@ function link_page() {
return $links;
}
function link_node($node) {
function link_node($node, $main = 0) {
foreach (module_list() as $name) {
if (module_hook($name, "link")) {
$links = array_merge($links, module_invoke($name, "link", "node", $node));
$links = array_merge($links, module_invoke($name, "link", "node", $node, $main));
}
}
......
......@@ -69,8 +69,8 @@ function node($node, $main) {
else {
$output .= check_output($node->body, 1);
}
if ($main) {
$output .= "<br />[ ". $this->links(link_node($node)) ." ]";
if ($links = link_node($node, $main)) {
$output .= "<br />[ ". $this->links($links) ." ]";
}
$output .= "<hr />";
......
......@@ -88,7 +88,6 @@ function node_filter_link($text) {
}
function node_filter_line($text) {
/*
** If HTML mark-up is being used, strip regular mark-up:
*/
......@@ -129,7 +128,7 @@ function node_filter($text) {
return node_filter_line($text);
}
function node_link($type, $node = 0) {
function node_link($type, $node = 0, $main = 0) {
if ($type == "admin" && user_access("administer nodes")) {
$links[] = "<a href=\"admin.php?mod=node\">content management</a>";
......@@ -140,12 +139,11 @@ function node_link($type, $node = 0) {
}
if ($type == "node") {
if ($node->links) {
$links = $node->links;
}
if ($node->teaser != $node->body) {
if ($node->teaser != $node->body && $main) {
$links[] = "<a href=\"node.php?id=". $node->nid ."\">". t("read more") ."</a>";
}
......
......@@ -88,7 +88,6 @@ function node_filter_link($text) {
}
function node_filter_line($text) {
/*
** If HTML mark-up is being used, strip regular mark-up:
*/
......@@ -129,7 +128,7 @@ function node_filter($text) {
return node_filter_line($text);
}
function node_link($type, $node = 0) {
function node_link($type, $node = 0, $main = 0) {
if ($type == "admin" && user_access("administer nodes")) {
$links[] = "<a href=\"admin.php?mod=node\">content management</a>";
......@@ -140,12 +139,11 @@ function node_link($type, $node = 0) {
}
if ($type == "node") {
if ($node->links) {
$links = $node->links;
}
if ($node->teaser != $node->body) {
if ($node->teaser != $node->body && $main) {
$links[] = "<a href=\"node.php?id=". $node->nid ."\">". t("read more") ."</a>";
}
......
......@@ -69,8 +69,8 @@ function node($node, $main = 0) {
print " <tr><td colspan=\"2\">&nbsp;</td></tr>\n";
if ($main) {
print " <tr><td colspan=\"2\">". $this->links(link_node($node)) ."</td></tr>\n";
if ($links = link_node($node, $main)) {
print " <tr><td colspan=\"2\">". $this->links($links) ."</td></tr>\n";
}
print "</table>\n";
......
......@@ -110,8 +110,8 @@ function node($node, $main = 0) {
</TD>
</TR>
<?php
if ($main) {
echo "<TR BGCOLOR=\"". $this->bgcolor3 ."\"><TD BGCOLOR=\"". $this->bgcolor3 ."\" ALIGN=\"right\" COLSPAN=\"2\">[ ". $this->links(link_node($node)) ." ]</TD></TR>";
if ($links = link_node($node, $main)) {
echo "<TR BGCOLOR=\"". $this->bgcolor3 ."\"><TD BGCOLOR=\"". $this->bgcolor3 ."\" ALIGN=\"right\" COLSPAN=\"2\">[ ". $this->links($links) ." ]</TD></TR>";
}
?>
</TABLE></TD></TR></TABLE><BR>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment