From 8043cb998f3325731bfab8d82251fa49639aec1d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 20 Apr 2002 11:52:50 +0000 Subject: - 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. + ... --- modules/node.module | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'modules/node.module') diff --git a/modules/node.module b/modules/node.module index cda4d98e3..2db4862ce 100644 --- a/modules/node.module +++ b/modules/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[] = "content management"; + $links[] = la(t("content management"), array("mod" => "node")); } if ($type == "page" && user_access("post content")) { - $links[] = "". t("submit") .""; + $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[] = "nid\" title=\"". t("Read the rest of this posting.") ."\">". t("read more") .""; + $links[] = l(t("read more"), array("id" => $node->nid), t("Read the rest of this posting.")); } if (user_access("administer nodes")) { - $links[] = "nid\" title=\"". t("Administer this node.") ."\">". t("administer") .""; + $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 .= ""; $output .= " "; foreach ($node->revisions as $key => $revision) { - $output .= " "; + $output .= " "; } $output .= "
older revisionsoperations
". 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"] ? "
". $revision["history"] ."" : "") ."
nid&revision=$key\">". t("view revision") ."nid&revision=$key\">". t("rollback revision") ."nid&revision=$key\">". t("delete revision") ."
". 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"] ? "
". $revision["history"] ."" : "") ."
".l(t("view revision"), array("id" => $node->nid, "revision" =>$key))."".la(t("rollback revision"), array("mod" => "node", "op" => "rollback+revision", "id" => $node->nid, "revision" => $key))."". la(t("delete revision"), array("mod" => "node", "op" => "delete+revision", "id" => $node->nid, "revision" => $key))."
"; } @@ -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[] = "$value[1]"; + $links[] = la($value[1], array("mod" => "node", "op" => "nodes", "query" => $key)); } $output .= "". implode(" :: ", $links) ."
"; @@ -495,7 +495,7 @@ function node_admin_nodes() { $output .= "\n"; $output .= " \n"; while ($node = db_fetch_object($result)) { - $output .= ""; + $output .= ""; } $output .= "
titletypeauthorstatusoperations
nid\">". check_output($node->title) ."$node->type". format_name($node) ."". ($node->status ? t("published") : t("not published")) ."nid\">". t("edit node") ."nid\">". t("delete node") ."
".l(check_output($node->title), array("id" => $node->nid))."$node->type". format_name($node) ."". ($node->status ? t("published") : t("not published")) ."".la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid))."".la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid))."
"; @@ -611,10 +611,10 @@ function node_admin() { ** Compile a list of the administrative links: */ - $links[] = "nodes"; - $links[] = "search content"; - $links[] = "settings"; - $links[] = "help"; + $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 "". implode(" · ", $links) ."
"; @@ -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] = "
image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" />
\n"; + $block[0][content] = "
".lm("image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" />", array("mod" => "node", "op" => "feed"), t("Read the XML version of this page."))."
\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"] = "
". strtr(t("The name '%u' does not exist."), array ("%u" => $node->name)) ."
"; + $error["name"] = "
". t("The name '%u' does not exist.", array ("%u" => $node->name)) ."
"; } /* @@ -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 .= "
  • "; - $output .= " module_invoke($name, "node", "name"))) ."\">". module_invoke($name, "node", "name") .""; + $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 .= "
    ". module_invoke($name, "node", "description") ."
    "; $output .= "
  • "; } @@ -1105,11 +1105,11 @@ function node_submit($node) { } if ($nid && node_access("view", $node)) { - $links[] = "". t("view") .""; + $links[] = l(t("view"), array("id" => $nid)); } if ($nid && node_access("update", $node)) { - $links[] = "". t("edit") .""; + $links[] = lm(t("edit"), array("mod" => "node", "op" => "edit", "id" => $nid)); } $output .= "

    ". $theme->links($links) ."

    "; -- cgit v1.2.3