Commit 5a667eb5 authored by Dries's avatar Dries

- Url aliasing improvements.  Patch by Matt.  See mailing list for more
  information.
parent 13f12eb4
......@@ -264,7 +264,6 @@ CREATE TABLE node (
nid int(10) unsigned NOT NULL auto_increment,
type varchar(16) NOT NULL default '',
title varchar(128) NOT NULL default '',
path varchar(250) NULL default '',
score int(11) NOT NULL default '0',
votes int(11) NOT NULL default '0',
uid int(10) NOT NULL default '0',
......@@ -286,7 +285,6 @@ CREATE TABLE node (
KEY status (status),
KEY uid (uid),
KEY node_moderate (moderate),
KEY node_path (path(5)),
KEY node_promote_status (promote, status)
) TYPE=MyISAM;
......@@ -303,6 +301,19 @@ CREATE TABLE page (
KEY nid (nid)
) TYPE=MyISAM;
--
-- Table structure for table 'path'
--
CREATE TABLE path (
alid int(10) unsigned NOT NULL auto_increment,
old varchar(128) NOT NULL default '',
new varchar(128) NOT NULL default '',
PRIMARY KEY (alid),
UNIQUE KEY new (new),
UNIQUE KEY old (old)
) TYPE=MyISAM;
--
-- Table structure for table 'permission'
--
......
......@@ -25,6 +25,22 @@ function conf_init() {
return "conf";
}
/**
* Build the alias/path array
*/
function get_url_map() {
static $map;
if (empty($map)) {
$result = db_query("SELECT * FROM {path}");
while ($data = db_fetch_object($result)) {
$map[$data->new] = $data->old;
}
}
return $map;
}
function error_handler($errno, $message, $filename, $line, $variables) {
$types = array(1 => "error", 2 => "warning", 4 => "parse error", 8 => "notice", 16 => "core error", 32 => "core warning", 64 => "compile error", 128 => "compile warning", 256 => "user error", 512 => "user warning", 1024 => "user notice");
$entry = $types[$errno] .": $message in $filename on line $line.";
......@@ -1054,6 +1070,23 @@ function form_allowed_tags_text() {
return variable_get("allowed_html", "") ? (t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))) : "";
}
/**
* Given an old url, return the alias.
*/
function get_url_alias($path) {
$map = get_url_map();
return array_search($path, $map);
}
/**
* Given an alias, return the old url.
*/
function get_old_url($path) {
$map = get_url_map();
return $map[$path];
}
function url($url = NULL, $query = NULL) {
global $base_url;
......@@ -1068,6 +1101,10 @@ function url($url = NULL, $query = NULL) {
$script = (strpos($_SERVER["SERVER_SOFTWARE"], "Apache") === false) ? "index.php" : "";
}
if ($alias = get_url_alias($url)) {
$url = $alias;
}
if (variable_get("clean_url", "0") == "0") {
if (isset($url)) {
if (isset($query)) {
......@@ -1243,6 +1280,16 @@ function drupal_page_footer() {
// spit out the correct charset http header
header("Content-Type: text/html; charset=utf-8");
// initialize the _GET["q"] prior to loading the modules and invoking their 'init' hook:
if (!empty($_GET["q"])) {
if ($path = get_old_url(trim($_GET["q"], "/"))) {
$_GET["q"] = $path;
}
}
else {
$_GET["q"] = variable_get("site_frontpage", "node");
}
// initialize installed modules:
module_init();
......
......@@ -3,23 +3,14 @@
include_once "includes/common.inc";
if (!empty($_GET["q"])) {
if (module_exist("node") && $path = node_get_alias($_GET["q"])) {
$_GET["q"] = $path;
}
}
else {
$_GET["q"] = variable_get("site_frontpage", "node");
}
$mod = arg(0);
drupal_page_header();
check_php_setting("magic_quotes_gpc", 0);
menu_build("system");
$mod = arg(0);
if (isset($mod) && module_hook($mod, "page")) {
module_invoke($mod, "page");
}
......
......@@ -110,14 +110,13 @@ function forum_link($type, $node = 0, $main = 0) {
if (!$main && $type == "node" && $node->type == "forum") {
// get previous and next topic
$result = db_query("SELECT n.nid, n.title, n.body, n.path, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid);
$result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid);
while ($topic = db_fetch_object($result)) {
if ($stop == 1) {
$next->nid = $topic->nid;
$next->title = $topic->title;
$next->body = $topic->body;
$next->path = $topic->path;
break;
}
if ($topic->nid == $node->nid) {
......@@ -127,16 +126,15 @@ function forum_link($type, $node = 0, $main = 0) {
$prev->nid = $topic->nid;
$prev->title = $topic->title;
$prev->body = $topic->body;
$prev->path = $topic->path;
}
}
if ($prev) {
$links[] = l(t("previous forum topic"), node_url($prev), array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100)."..."));
$links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100)."..."));
}
if ($next) {
$links[] = l(t("next forum topic"), node_url($next), array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100)."..."));
$links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100)."..."));
}
}
......
......@@ -110,14 +110,13 @@ function forum_link($type, $node = 0, $main = 0) {
if (!$main && $type == "node" && $node->type == "forum") {
// get previous and next topic
$result = db_query("SELECT n.nid, n.title, n.body, n.path, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid);
$result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid);
while ($topic = db_fetch_object($result)) {
if ($stop == 1) {
$next->nid = $topic->nid;
$next->title = $topic->title;
$next->body = $topic->body;
$next->path = $topic->path;
break;
}
if ($topic->nid == $node->nid) {
......@@ -127,16 +126,15 @@ function forum_link($type, $node = 0, $main = 0) {
$prev->nid = $topic->nid;
$prev->title = $topic->title;
$prev->body = $topic->body;
$prev->path = $topic->path;
}
}
if ($prev) {
$links[] = l(t("previous forum topic"), node_url($prev), array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100)."..."));
$links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100)."..."));
}
if ($next) {
$links[] = l(t("next forum topic"), node_url($next), array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100)."..."));
$links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100)."..."));
}
}
......
......@@ -77,7 +77,7 @@ function node_system($field){
function node_title_list($result, $title = NULL) {
while ($node = db_fetch_object($result)) {
$number = module_invoke("comment", "num_all", $node->nid);
$items[] = l($node->title, node_url($node), array("title" => format_plural($number, "%count comment", "%count comments")));
$items[] = l($node->title, "node/view/$node->nid", array("title" => format_plural($number, "%count comment", "%count comments")));
}
return theme("theme_node_list", $items, $title);
......@@ -465,7 +465,7 @@ function node_access($op, $node = 0) {
}
function node_perm() {
return array("administer nodes", "access content", "create custom URLs");
return array("administer nodes", "access content");
}
function node_search($keys) {
......@@ -603,7 +603,7 @@ function node_admin_edit($node) {
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
$output .= " <tr><th>". t("older revisions") ."</th><th colspan=\"3\">". t("operations") ."</th></tr>";
foreach ($node->revisions as $key => $revision) {
$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"), node_url($node), array(), "revision=$key") ."</td><td>". l(t("rollback revision"), "admin/node/rollback+revision/$node->nid/$key") ."</td><td>". l(t("delete revision"), "admin/node/delete+revision/$node->nid/$key") ."</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"), "node/view/$node->nid", array(), "revision=$key") ."</td><td>". l(t("rollback revision"), "admin/node/rollback+revision/$node->nid/$key") ."</td><td>". l(t("delete revision"), "admin/node/delete+revision/$node->nid/$key") ."</td></tr>";
}
$output .= "</table>";
}
......@@ -698,7 +698,7 @@ function node_admin_nodes() {
$header = array(NULL, t("title"), t("type"), t("author"), t("status"), array ("data" => t("operations"), "colspan" => 2));
while ($node = db_fetch_object($result)) {
$rows[] = array(form_checkbox(NULL, "status][$node->nid", 1, 0), l($node->title, node_url($node)) ." ". (node_is_new($node->nid, $node->changed) ? theme_mark() : ""), module_invoke($node->type, "node", "name"), format_name($node), ($node->status ? t("published") : t("not published")), l(t("edit node"), "admin/node/edit/$node->nid"), l(t("delete node"), "admin/node/delete/$node->nid"));
$rows[] = array(form_checkbox(NULL, "status][$node->nid", 1, 0), l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme_mark() : ""), module_invoke($node->type, "node", "name"), format_name($node), ($node->status ? t("published") : t("not published")), l(t("edit node"), "admin/node/edit/$node->nid"), l(t("delete node"), "admin/node/delete/$node->nid"));
}
if ($pager = pager_display(NULL, 50, 0, "admin")) {
......@@ -945,23 +945,6 @@ function node_block($op = "list", $delta = 0) {
}
}
function node_get_alias($path) {
$result = db_query("SELECT nid FROM {node} WHERE path = '%s'", trim($path, "/"));
if ($node = db_fetch_object($result)) {
return "node/view/$node->nid";
}
}
function node_url($node) {
if ($node->path != NULL) {
return $node->path;
}
else {
return "node/view/$node->nid";
}
}
function node_feed($nodes = 0, $channel = array()) {
global $base_url, $languages;
......@@ -974,7 +957,7 @@ function node_feed($nodes = 0, $channel = array()) {
*/
if (!$nodes) {
$nodes = db_query_range("SELECT nid, path FROM {node} WHERE promote = '1' AND status = '1' ORDER BY created DESC", 0, 15);
$nodes = db_query_range("SELECT nid, FROM {node} WHERE promote = '1' AND status = '1' ORDER BY created DESC", 0, 15);
}
while ($node = db_fetch_object($nodes)) {
......@@ -983,7 +966,7 @@ function node_feed($nodes = 0, $channel = array()) {
*/
$item = node_load(array("nid" => $node->nid));
$link = url(node_url($node));
$link = url("node/view/$node->nid");
$items .= format_rss_item($item->title, $link, ($item->teaser ? $item->teaser : $item->body), array("pubDate" => date("r", $item->changed)));
}
......@@ -1024,19 +1007,6 @@ function node_validate($node, &$error) {
}
}
/*
** Clean the path field:
*/
if ($node->path) {
if (!valid_url($node->path)) {
$error["path"] = theme("theme_error", t("The specified path is not valid."));
}
else if (db_result(db_query("SELECT COUNT(nid) FROM {node} WHERE nid != %d AND path = '%s'", $node->nid, $node->path))) {
$error["path"] = theme("theme_error", t("The specified path is already in use."));
}
}
/*
** Common default values:
*/
......@@ -1120,41 +1090,6 @@ function node_validate($node, &$error) {
}
function node_clean_path($path) {
/*
** Clean the node path
*/
global $base_url;
/*
** Replace absolute URL for this site with relative URL.
*/
$path = str_replace($base_url, "", $path);
/*
** Only allow alpha numeric characters and slashes.
*/
$path = preg_replace("'[^a-zA-Z0-9/.]'", " ", $path);
/*
** Remove all whitespace.
*/
$path = str_replace(" ", "", $path);
/*
** Replace two or more sequential slashes with only one slashes.
*/
$path = preg_replace("'//*'","/",$path);
/*
** Remove beginning and trailing slashes.
*/
$path = trim($path, "/");
return $path;
}
function node_form($edit, $error = NULL) {
/*
......@@ -1229,10 +1164,6 @@ function node_form($edit, $error = NULL) {
$output .= "<div class=\"standard\">";
$output .= form_textfield(t("Title"), "title", $edit->title, 60, 128, $error["title"]);
if (user_access("create custom URLs")) {
$output .= form_textfield(t("Path alias"), "path", ($edit->path == "node/view/$edit->nid") ? "" : $edit->path, 60, 250, $error["path"] ? $error["path"] : t("Optionally specify an alternative URL by which this node can be accessed. For example, type 'about' when writing an about page. Don't add a trailing slash or the URL won't work."));
}
/*
** Add the node specific fields:
*/
......@@ -1454,7 +1385,7 @@ function node_submit($node) {
if (node_access("update", $node)) {
$node->nid = node_save($node);
watchdog("special", "$node->type: updated '$node->title'", l(t("view post"), node_url($node)));
watchdog("special", "$node->type: updated '$node->title'", l(t("view post"), "node/view/$node->nid"));
$output = t("The %name has been updated.", array ("%name" => module_invoke($node->type, "node", "name")));
}
}
......@@ -1475,7 +1406,7 @@ function node_submit($node) {
throttle("node", variable_get("max_node_rate", 900));
$node->nid = node_save($node);
watchdog("special", "$node->type: added '$node->title'", l(t("view post"), node_url($node)));
watchdog("special", "$node->type: added '$node->title'", l(t("view post"), "node/view/$node->nid"));
$output = t("Thanks for your submission.");
}
}
......@@ -1496,7 +1427,7 @@ function node_submit($node) {
}
if ($node->nid && node_access("view", $node)) {
$links[] = l(t("view"), node_url($node));
$links[] = l(t("view"), "node/view/$node->nid");
}
if ($node->nid && node_access("update", $node)) {
......@@ -1643,7 +1574,7 @@ function node_nodeapi(&$node, $op, $arg = 0) {
$output[t("revision")] = form_checkbox("", "node_revision_$node->type", 1, variable_get("node_revision_$node->type", 0));
return $output;
case "fields":
return array("nid", "uid", "type", "title", "path", "teaser", "body", "revisions", "status", "promote", "moderate", "static", "created", "changed");
return array("nid", "uid", "type", "title", "teaser", "body", "revisions", "status", "promote", "moderate", "static", "created", "changed");
}
}
......
......@@ -77,7 +77,7 @@ function node_system($field){
function node_title_list($result, $title = NULL) {
while ($node = db_fetch_object($result)) {
$number = module_invoke("comment", "num_all", $node->nid);
$items[] = l($node->title, node_url($node), array("title" => format_plural($number, "%count comment", "%count comments")));
$items[] = l($node->title, "node/view/$node->nid", array("title" => format_plural($number, "%count comment", "%count comments")));
}
return theme("theme_node_list", $items, $title);
......@@ -465,7 +465,7 @@ function node_access($op, $node = 0) {
}
function node_perm() {
return array("administer nodes", "access content", "create custom URLs");
return array("administer nodes", "access content");
}
function node_search($keys) {
......@@ -603,7 +603,7 @@ function node_admin_edit($node) {
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
$output .= " <tr><th>". t("older revisions") ."</th><th colspan=\"3\">". t("operations") ."</th></tr>";
foreach ($node->revisions as $key => $revision) {
$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"), node_url($node), array(), "revision=$key") ."</td><td>". l(t("rollback revision"), "admin/node/rollback+revision/$node->nid/$key") ."</td><td>". l(t("delete revision"), "admin/node/delete+revision/$node->nid/$key") ."</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"), "node/view/$node->nid", array(), "revision=$key") ."</td><td>". l(t("rollback revision"), "admin/node/rollback+revision/$node->nid/$key") ."</td><td>". l(t("delete revision"), "admin/node/delete+revision/$node->nid/$key") ."</td></tr>";
}
$output .= "</table>";
}
......@@ -698,7 +698,7 @@ function node_admin_nodes() {
$header = array(NULL, t("title"), t("type"), t("author"), t("status"), array ("data" => t("operations"), "colspan" => 2));
while ($node = db_fetch_object($result)) {
$rows[] = array(form_checkbox(NULL, "status][$node->nid", 1, 0), l($node->title, node_url($node)) ." ". (node_is_new($node->nid, $node->changed) ? theme_mark() : ""), module_invoke($node->type, "node", "name"), format_name($node), ($node->status ? t("published") : t("not published")), l(t("edit node"), "admin/node/edit/$node->nid"), l(t("delete node"), "admin/node/delete/$node->nid"));
$rows[] = array(form_checkbox(NULL, "status][$node->nid", 1, 0), l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme_mark() : ""), module_invoke($node->type, "node", "name"), format_name($node), ($node->status ? t("published") : t("not published")), l(t("edit node"), "admin/node/edit/$node->nid"), l(t("delete node"), "admin/node/delete/$node->nid"));
}
if ($pager = pager_display(NULL, 50, 0, "admin")) {
......@@ -945,23 +945,6 @@ function node_block($op = "list", $delta = 0) {
}
}
function node_get_alias($path) {
$result = db_query("SELECT nid FROM {node} WHERE path = '%s'", trim($path, "/"));
if ($node = db_fetch_object($result)) {
return "node/view/$node->nid";
}
}
function node_url($node) {
if ($node->path != NULL) {
return $node->path;
}
else {
return "node/view/$node->nid";
}
}
function node_feed($nodes = 0, $channel = array()) {
global $base_url, $languages;
......@@ -974,7 +957,7 @@ function node_feed($nodes = 0, $channel = array()) {
*/
if (!$nodes) {
$nodes = db_query_range("SELECT nid, path FROM {node} WHERE promote = '1' AND status = '1' ORDER BY created DESC", 0, 15);
$nodes = db_query_range("SELECT nid, FROM {node} WHERE promote = '1' AND status = '1' ORDER BY created DESC", 0, 15);
}
while ($node = db_fetch_object($nodes)) {
......@@ -983,7 +966,7 @@ function node_feed($nodes = 0, $channel = array()) {
*/
$item = node_load(array("nid" => $node->nid));
$link = url(node_url($node));
$link = url("node/view/$node->nid");
$items .= format_rss_item($item->title, $link, ($item->teaser ? $item->teaser : $item->body), array("pubDate" => date("r", $item->changed)));
}
......@@ -1024,19 +1007,6 @@ function node_validate($node, &$error) {
}
}
/*
** Clean the path field:
*/
if ($node->path) {
if (!valid_url($node->path)) {
$error["path"] = theme("theme_error", t("The specified path is not valid."));
}
else if (db_result(db_query("SELECT COUNT(nid) FROM {node} WHERE nid != %d AND path = '%s'", $node->nid, $node->path))) {
$error["path"] = theme("theme_error", t("The specified path is already in use."));
}
}
/*
** Common default values:
*/
......@@ -1120,41 +1090,6 @@ function node_validate($node, &$error) {
}
function node_clean_path($path) {
/*
** Clean the node path
*/
global $base_url;
/*
** Replace absolute URL for this site with relative URL.
*/
$path = str_replace($base_url, "", $path);
/*
** Only allow alpha numeric characters and slashes.
*/
$path = preg_replace("'[^a-zA-Z0-9/.]'", " ", $path);
/*
** Remove all whitespace.
*/
$path = str_replace(" ", "", $path);
/*
** Replace two or more sequential slashes with only one slashes.
*/
$path = preg_replace("'//*'","/",$path);
/*
** Remove beginning and trailing slashes.
*/
$path = trim($path, "/");
return $path;
}
function node_form($edit, $error = NULL) {
/*
......@@ -1229,10 +1164,6 @@ function node_form($edit, $error = NULL) {
$output .= "<div class=\"standard\">";
$output .= form_textfield(t("Title"), "title", $edit->title, 60, 128, $error["title"]);
if (user_access("create custom URLs")) {
$output .= form_textfield(t("Path alias"), "path", ($edit->path == "node/view/$edit->nid") ? "" : $edit->path, 60, 250, $error["path"] ? $error["path"] : t("Optionally specify an alternative URL by which this node can be accessed. For example, type 'about' when writing an about page. Don't add a trailing slash or the URL won't work."));
}
/*
** Add the node specific fields:
*/
......@@ -1454,7 +1385,7 @@ function node_submit($node) {
if (node_access("update", $node)) {
$node->nid = node_save($node);
watchdog("special", "$node->type: updated '$node->title'", l(t("view post"), node_url($node)));
watchdog("special", "$node->type: updated '$node->title'", l(t("view post"), "node/view/$node->nid"));
$output = t("The %name has been updated.", array ("%name" => module_invoke($node->type, "node", "name")));
}
}
......@@ -1475,7 +1406,7 @@ function node_submit($node) {
throttle("node", variable_get("max_node_rate", 900));
$node->nid = node_save($node);
watchdog("special", "$node->type: added '$node->title'", l(t("view post"), node_url($node)));
watchdog("special", "$node->type: added '$node->title'", l(t("view post"), "node/view/$node->nid"));
$output = t("Thanks for your submission.");
}
}
......@@ -1496,7 +1427,7 @@ function node_submit($node) {
}
if ($node->nid && node_access("view", $node)) {
$links[] = l(t("view"), node_url($node));
$links[] = l(t("view"), "node/view/$node->nid");
}
if ($node->nid && node_access("update", $node)) {
......@@ -1643,7 +1574,7 @@ function node_nodeapi(&$node, $op, $arg = 0) {
$output[t("revision")] = form_checkbox("", "node_revision_$node->type", 1, variable_get("node_revision_$node->type", 0));
return $output;
case "fields":
return array("nid", "uid", "type", "title", "path", "teaser", "body", "revisions", "status", "promote", "moderate", "static", "created", "changed");
return array("nid", "uid", "type", "title", "teaser", "body", "revisions", "status", "promote", "moderate", "static", "created", "changed");
}
}
......
......@@ -89,9 +89,9 @@ function page_link($type) {
$links = array();
if ($type == "page" && user_access("access content")) {
$result = db_query("SELECT n.nid, n.title, n.path, p.link, p.description FROM {page} p INNER JOIN {node} n ON p.nid = n.nid WHERE n.status = '1' AND p.link != '' ORDER BY p.link");
$result = db_query("SELECT n.nid, n.title, p.link, p.description FROM {page} p INNER JOIN {node} n ON p.nid = n.nid WHERE n.status = '1' AND p.link != '' ORDER BY p.link");
while ($page = db_fetch_object($result)) {
$links[] = l($page->link, node_url($page), array("title" => $page->description));
$links[] = l($page->link, "node/view/$page->nid", array("title" => $page->description));
}
}
......
......@@ -89,9 +89,9 @@ function page_link($type) {
$links = array();
if ($type == "page" && user_access("access content")) {
$result = db_query("SELECT n.nid, n.title, n.path, p.link, p.description FROM {page} p INNER JOIN {node} n ON p.nid = n.nid WHERE n.status = '1' AND p.link != '' ORDER BY p.link");
$result = db_query("SELECT n.nid, n.title, p.link, p.description FROM {page} p INNER JOIN {node} n ON p.nid = n.nid WHERE n.status = '1' AND p.link != '' ORDER BY p.link");
while ($page = db_fetch_object($result)) {
$links[] = l($page->link, node_url($page), array("title" => $page->description));
$links[] = l($page->link, "node/view/$page->nid", array("title" => $page->description));
}
}
......
......@@ -400,7 +400,7 @@ function statistics_admin_accesslog_table($type, $id) {
$url = message_na();
}
$rows[] = array(array("data" => format_date($log->timestamp, "small"), "nowrap" => "nowrap"), ($node->nid ? l($node->title, node_url($node)) : message_na()), format_name($user), $log->hostname ? $log->hostname : message_na(), $url, ($log->nid ? l(t("track node"), "admin/statistics/log/node/$log->nid") : ""), ($user->uid ? l(t("track user"), "admin/statistics/log/user/$user->uid") : ""), ($log->hostname ? l(t("track host"), "admin/statistics/log/host/$log->hostname") : ""));
$rows[] = array(array("data" => format_date($log->timestamp, "small"), "nowrap" => "nowrap"), ($node->nid ? l($node->title, "node/view/$node->nid") : message_na()), format_name($user), $log->hostname ? $log->hostname : message_na(), $url, ($log->nid ? l(t("track node"), "admin/statistics/log/node/$log->nid") : ""), ($user->uid ? l(t("track user"), "admin/statistics/log/user/$user->uid") : ""), ($log->hostname ? l(t("track host"), "admin/statistics/log/host/$log->hostname") : ""));
}
if ($pager = pager_display(NULL, 50, 0, "admin", tablesort_pager())) {
......
......@@ -400,7 +400,7 @@ function statistics_admin_accesslog_table($type, $id) {
$url = message_na();
}
$rows[] = array(array("data" => format_date($log->timestamp, "small"), "nowrap" => "nowrap"), ($node->nid ? l($node->title, node_url($node)) : message_na()), format_name($user), $log->hostname ? $log->hostname : message_na(), $url, ($log->nid ? l(t("track node"), "admin/statistics/log/node/$log->nid") : ""), ($user->uid ? l(t("track user"), "admin/statistics/log/user/$user->uid") : ""), ($log->hostname ? l(t("track host"), "admin/statistics/log/host/$log->hostname") : ""));
$rows[] = array(array("data" => format_date($log->timestamp, "small"), "nowrap" => "nowrap"), ($node->nid ? l($node->title, "node/view/$node->nid") : message_na()), format_name($user), $log->hostname ? $log->hostname : message_na(), $url, ($log->nid ? l(t("track node"), "admin/statistics/log/node/$log->nid") : ""), ($user->uid ? l(t("track user"), "admin/statistics/log/user/$user->uid") : ""), ($log->hostname ? l(t("track host"), "admin/statistics/log/host/$log->hostname") : ""));
}
if ($pager = pager_display(NULL, 50, 0, "admin", tablesort_pager())) {
......
......@@ -33,7 +33,7 @@ function title_page() {
$header = array(t("Type"), t("Title"), t("Author"));
while ($node = db_fetch_object($result)) {
$type = ucfirst(module_invoke($node->type, "node", "name"));
$title = l($node->title, node_url($node));
$title = l($node->title, "node/view/$node->nid");
$author = format_name($node);
$rows[] = array(array("data" => $type, "class" => "type"), array("data" => $title, "class" => "content"), array("data" => $author, "class" => "author"));
}
......
......@@ -59,7 +59,7 @@ function tracker_posts($id = 0) {
}
$type = ucfirst(module_invoke($node->type, "node", "name"));
$title = l($node->title, node_url($node)) ." ". (node_is_new($node->nid, $node->changed) ? theme("theme_mark") : "");
$title = l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme("theme_mark") : "");
$author = format_name($node);
$comments = array();
......
......@@ -59,7 +59,7 @@ function tracker_posts($id = 0) {
}
$type = ucfirst(module_invoke($node->type, "node", "name"));
$title = l($node->title, node_url($node)) ." ". (node_is_new($node->nid, $node->changed) ? theme("theme_mark") : "");
$title = l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme("theme_mark") : "");
$author = format_name($node);
$comments = array();
......
......@@ -35,7 +35,7 @@ function Theme_xtemplate() {
function node($node, $main = 0) {
$this->template->assign(array(
"link" => url(node_url($node)),
"link" => url("node/view/$node->nid"),