diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-04-20 11:52:50 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-04-20 11:52:50 +0000 |
commit | 8043cb998f3325731bfab8d82251fa49639aec1d (patch) | |
tree | 3774b206865eb631134c447aa36e90af762b8c5b /modules/node | |
parent | 0a966e1ed42d1b7d0827b0318bcefb7101ac56df (diff) | |
download | brdo-8043cb998f3325731bfab8d82251fa49639aec1d.tar.gz brdo-8043cb998f3325731bfab8d82251fa49639aec1d.tar.bz2 |
- Applied Marco's big patch, including contributions from Moshe:
+ Changed the db_query() API.
+ Wrapped all links in l(), lm(), la(), ..., drupal_url() functions.
+ XHTML-ified some HTML.
+ Wrapped a lot of text in the administrative pages in a t()
function.
+ Replaced all $REQUEST_URI/$PATH_INFOs by request_uri().
+ Small bugfixes (eg. bug in book_export_html() and clean-ups (eg.
RSS code).
+ Fixed some bugs in the taxonomy module (eg. tree making bug), added
new functionality (eg. new APIs for use by other modules), included
Moshe's taxonomy extensions, and some documentation udpates.
+ ...
Diffstat (limited to 'modules/node')
-rw-r--r-- | modules/node/node.module | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/modules/node/node.module b/modules/node/node.module index cda4d98e3..2db4862ce 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -364,7 +364,7 @@ function node_filter_line($text) { } function node_comment_mode($nid) { - return db_result(db_query("SELECT comment FROM node WHERE nid = '".check_query($nid)."'")); + return db_result(db_query("SELECT comment FROM node WHERE nid = '%s'", $nid)); } function node_filter($text) { @@ -376,11 +376,11 @@ function node_filter($text) { 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>"; + $links[] = la(t("content management"), array("mod" => "node")); } if ($type == "page" && user_access("post content")) { - $links[] = "<a href=\"module.php?mod=node&op=add\" title=\"". t("Submit or suggest new content.") ."\">". t("submit") ."</a>"; + $links[] = lm(t("submit"), array("mod" => "node", "op" => "add"), t("Submit or suggest new content.")); } if ($type == "node") { @@ -389,11 +389,11 @@ function node_link($type, $node = 0, $main = 0) { } if ($main == 1 && $node->teaser != $node->body) { - $links[] = "<a href=\"node.php?id=$node->nid\" title=\"". t("Read the rest of this posting.") ."\">". t("read more") ."</a>"; + $links[] = l(t("read more"), array("id" => $node->nid), t("Read the rest of this posting.")); } if (user_access("administer nodes")) { - $links[] = "<a href=\"admin.php?mod=node&op=edit&id=$node->nid\" title=\"". t("Administer this node.") ."\">". t("administer") ."</a>"; + $links[] = la(t("administer"), array("mod" => "node", "op" => "edit", "id" => $node->nid), t("Administer this node.")); } } @@ -462,7 +462,7 @@ function node_admin_edit($node) { $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">"; $output .= " <tr><th>older revisions</th><th colspan=\"3\">operations</th></tr>"; foreach ($node->revisions as $key => $revision) { - $output .= " <tr><td>". strtr(t("revision #%r revised by %u on %d"), array("%r" => $key, "%u" => format_name(user_load(array("uid" => $revision["uid"]))), "%d" => format_date($revision["timestamp"], "small"))) . ($revision["history"] ? "<br /><small>". $revision["history"] ."</small>" : "") ."</td><td><a href=\"node.php?id=$node->nid&revision=$key\">". t("view revision") ."</a></td><td><a href=\"admin.php?mod=node&op=rollback+revision&id=$node->nid&revision=$key\">". t("rollback revision") ."</a></td><td><a href=\"admin.php?mod=node&op=delete+revision&id=$node->nid&revision=$key\">". t("delete revision") ."</a></td></tr>"; + $output .= " <tr><td>". t("revision #%r revised by %u on %d", array("%r" => $key, "%u" => format_name(user_load(array("uid" => $revision["uid"]))), "%d" => format_date($revision["timestamp"], "small"))) . ($revision["history"] ? "<br /><small>". $revision["history"] ."</small>" : "") ."</td><td>".l(t("view revision"), array("id" => $node->nid, "revision" =>$key))."</td><td>".la(t("rollback revision"), array("mod" => "node", "op" => "rollback+revision", "id" => $node->nid, "revision" => $key))."</td><td>". la(t("delete revision"), array("mod" => "node", "op" => "delete+revision", "id" => $node->nid, "revision" => $key))."</td></tr>"; } $output .= "</table>"; } @@ -487,7 +487,7 @@ function node_admin_nodes() { $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid ". $queries[$query ? $query : 1][0] ." LIMIT 50"); foreach ($queries as $key => $value) { - $links[] = "<a href=\"admin.php?mod=node&op=nodes&query=$key\">$value[1]</a>"; + $links[] = la($value[1], array("mod" => "node", "op" => "nodes", "query" => $key)); } $output .= "<small>". implode(" :: ", $links) ."</small><hr />"; @@ -495,7 +495,7 @@ function node_admin_nodes() { $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; $output .= " <tr><th>title</th><th>type</th><th>author</th><th>status</th><th colspan=\"2\">operations</th></tr>\n"; while ($node = db_fetch_object($result)) { - $output .= "<tr><td><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></td><td>$node->type</td><td nowrap=\"nowrap\">". format_name($node) ."</td><td>". ($node->status ? t("published") : t("not published")) ."</td><td nowrap=\"nowrap\"><a href=\"admin.php?mod=node&op=edit&id=$node->nid\">". t("edit node") ."</a></td><td nowrap=\"nowrap\"><a href=\"admin.php?mod=node&op=delete&id=$node->nid\">". t("delete node") ."</a></td></tr>"; + $output .= "<tr><td>".l(check_output($node->title), array("id" => $node->nid))."</td><td>$node->type</td><td nowrap=\"nowrap\">". format_name($node) ."</td><td>". ($node->status ? t("published") : t("not published")) ."</td><td nowrap=\"nowrap\">".la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid))."</td><td nowrap=\"nowrap\">".la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid))."</td></tr>"; } $output .= "</table>"; @@ -611,10 +611,10 @@ function node_admin() { ** Compile a list of the administrative links: */ - $links[] = "<a href=\"admin.php?mod=node&op=nodes\">nodes</a>"; - $links[] = "<a href=\"admin.php?mod=node&op=search\">search content</a>"; - $links[] = "<a href=\"admin.php?mod=node&op=settings\">settings</a>"; - $links[] = "<a href=\"admin.php?mod=node&op=help\">help</a>"; + $links[] = la(t("nodes"), array("mod" => "node", "op" => "nodes")); + $links[] = la(t("search content"), array("mod" => "node", "op" => "search")); + $links[] = la(t("settings"), array("mod" => "node", "op" => "settings")); + $links[] = la(t("help"), array("mod" => "node", "op" => "help")); print "<small>". implode(" · ", $links) ."</small><hr />"; @@ -623,7 +623,7 @@ function node_admin() { print node_help(); break; case "search": - print search_type("node", "admin.php?mod=node&op=search"); + print search_type("node", drupal_url(array("mod" => "node", "op" => "search"), "admin")); break; case t("Save configuration"): case t("Reset to defaults"): @@ -666,7 +666,7 @@ function node_block() { global $theme; $block[0][subject] = t("Syndicate"); - $block[0][content] = "<div align=\"center\"><a href=\"module.php?mod=node&op=feed\" title=\"". t("Read the XML version of this page.")."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" /></a></div>\n"; + $block[0][content] = "<div align=\"center\">".lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" />", array("mod" => "node", "op" => "feed"), t("Read the XML version of this page."))."</div>\n"; $block[0][info] = "Syndicate"; return $block; @@ -679,7 +679,7 @@ function node_feed() { while ($node = db_fetch_object($result)) { $item = node_load(array("nid" => $node->nid, "type" => $node->type)); - $link = path_uri() ."node.php?id=$item->nid"; + $link = path_uri() .drupal_url(array("id" => $item->nid), "node"); $items .= format_rss_item($item->title, $link, $item->teaser); } @@ -745,7 +745,7 @@ function node_validate($node, &$error) { $node->uid = $account->uid; } else { - $error["name"] = "<div style=\"color: red;\">". strtr(t("The name '%u' does not exist."), array ("%u" => $node->name)) ."</div>"; + $error["name"] = "<div style=\"color: red;\">". t("The name '%u' does not exist.", array ("%u" => $node->name)) ."</div>"; } /* @@ -902,7 +902,7 @@ function node_add($type) { foreach (module_list() as $name) { if (module_hook($name, "node") && node_access("create", array("type" => $name))) { $output .= "<li>"; - $output .= " <a href=\"module.php?mod=node&op=add&type=$name\" title=\"". strtr(t("Add a new %s."), array("%s" => module_invoke($name, "node", "name"))) ."\">". module_invoke($name, "node", "name") ."</a>"; + $output .= " ".lm(module_invoke($name, "node", "name"), array("mod" => "node", "op" => "add", "type" => $name), t("Add a new %s.", array("%s" => module_invoke($name, "node", "name")))); $output .= " <div style=\"margin-left: 20px;\">". module_invoke($name, "node", "description") ."</div>"; $output .= "</li>"; } @@ -1105,11 +1105,11 @@ function node_submit($node) { } if ($nid && node_access("view", $node)) { - $links[] = "<a href=\"node.php?id=$nid\">". t("view") ."</a>"; + $links[] = l(t("view"), array("id" => $nid)); } if ($nid && node_access("update", $node)) { - $links[] = "<a href=\"module.php?mod=node&op=edit&id=$nid\">". t("edit") ."</a>"; + $links[] = lm(t("edit"), array("mod" => "node", "op" => "edit", "id" => $nid)); } $output .= "<p>". $theme->links($links) ."</p>"; |