summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-01-06 19:51:01 +0000
committerDries Buytaert <dries@buytaert.net>2003-01-06 19:51:01 +0000
commit89b2069e4dcc160835eefa0ba11da550c31bdafc (patch)
tree773450f8397097adf4c186eabb8bc0ff53c0ea77
parent97858f9b2ebf7f32f00ab7688dc2eb6b3371207b (diff)
downloadbrdo-89b2069e4dcc160835eefa0ba11da550c31bdafc.tar.gz
brdo-89b2069e4dcc160835eefa0ba11da550c31bdafc.tar.bz2
- Clean URL patch.
-rw-r--r--admin.php90
-rw-r--r--includes/common.inc118
-rw-r--r--includes/conf.php5
-rw-r--r--includes/menu.inc8
-rw-r--r--includes/module.inc1
-rw-r--r--includes/pager.inc3
-rw-r--r--index.php35
-rw-r--r--module.php15
-rw-r--r--modules/admin.module89
-rw-r--r--modules/aggregator.module89
-rw-r--r--modules/aggregator/aggregator.module89
-rw-r--r--modules/archive.module99
-rw-r--r--modules/archive/archive.module99
-rw-r--r--modules/block.module24
-rw-r--r--modules/block/block.module24
-rw-r--r--modules/blog.module49
-rw-r--r--modules/blog/blog.module49
-rw-r--r--modules/bloggerapi.module6
-rw-r--r--modules/book.module62
-rw-r--r--modules/book/book.module62
-rw-r--r--modules/cloud.module26
-rw-r--r--modules/comment.module103
-rw-r--r--modules/comment/comment.module103
-rw-r--r--modules/drupal.module6
-rw-r--r--modules/drupal/drupal.module6
-rw-r--r--modules/forum.module54
-rw-r--r--modules/forum/forum.module54
-rw-r--r--modules/help.module4
-rw-r--r--modules/help/help.module4
-rw-r--r--modules/import.module89
-rw-r--r--modules/jabber.module2
-rw-r--r--modules/locale.module27
-rw-r--r--modules/locale/locale.module27
-rw-r--r--modules/node.module167
-rw-r--r--modules/node/node.module167
-rw-r--r--modules/page.module4
-rw-r--r--modules/page/page.module4
-rw-r--r--modules/ping.module2
-rw-r--r--modules/ping/ping.module2
-rw-r--r--modules/poll.module8
-rw-r--r--modules/poll/poll.module8
-rw-r--r--modules/queue.module16
-rw-r--r--modules/search.module14
-rw-r--r--modules/search/search.module14
-rw-r--r--modules/statistics.module73
-rw-r--r--modules/statistics/statistics.module73
-rw-r--r--modules/story.module2
-rw-r--r--modules/story/story.module2
-rw-r--r--modules/system.module26
-rw-r--r--modules/system/system.module26
-rw-r--r--modules/taxonomy.module73
-rw-r--r--modules/taxonomy/taxonomy.module73
-rw-r--r--modules/throttle.module10
-rw-r--r--modules/throttle/throttle.module10
-rw-r--r--modules/tracker.module24
-rw-r--r--modules/tracker/tracker.module24
-rw-r--r--modules/user.module142
-rw-r--r--modules/user/user.module142
-rw-r--r--modules/watchdog.module25
-rw-r--r--modules/watchdog/watchdog.module25
-rw-r--r--node.php74
-rw-r--r--update.php22
62 files changed, 1389 insertions, 1384 deletions
diff --git a/admin.php b/admin.php
deleted file mode 100644
index e90d0e482..000000000
--- a/admin.php
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-// $Id$
-
-include_once "includes/common.inc";
-
-function status($message) {
- if ($message) {
- return "<b>Status:</b> $message<hr />\n";
- }
-}
-
-function admin_page($mod) {
- global $user;
-
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <title><?php echo variable_get("site_name", "drupal") . " " . t("administration pages"); ?></title>
- <link rel="stylesheet" type="text/css" media="print" href="misc/print.css" />
- <style type="text/css" title="layout" media="Screen">
- @import url("misc/admin.css");
- </style>
- </head>
- <body>
- <?php
- // NOTE: we include a dummy "print.css" to remove the "flash of unstyled content" (FUOC) problems in IE.
-
- module_invoke_all("link", "admin");
-
- /*
- ** Menu:
- */
-
- print "<div id=\"menu\">";
- echo "<h1><a href=\"index.php\">". variable_get("site_name", "drupal") ."</a></h1>";
- print menu_tree() ;
-
- print "</div>";
-
- /*
- ** Body:
- */
-
- print "<a href=\"http://drupal.org/\"><img align=\"right\" src=\"misc/druplicon-small.gif\" alt=\"Druplicon - Drupal logo\" border=\"0\" /></a>";
- print "<div id=\"main\">";
-
- if ($path = menu_path()) {
- print "<h2>". la(t("Administration")) ." &gt; $path</h2>";
- }
- else {
- print "<h2>". t("Administration") ."</h2>";
- }
-
- if ($menu = menu_menu()) {
- print "$menu<br />";
- }
-
- print "<br /><hr /><br />";
-
- if ($help = menu_help()) {
- print "<small>$help</small><br /><br />";
- }
-
- if ($mod) {
- print module_invoke($mod, "admin");
- }
- else {
- print watchdog_overview("actions");
- }
-
- print "</div>";
-
- db_query("DELETE FROM menu");
- ?>
- </body>
- </html>
- <?php
-}
-
-if (user_access("access administration pages")) {
- page_header();
- admin_page($mod);
- page_footer();
-}
-else {
- print message_access();
-}
-
-?>
diff --git a/includes/common.inc b/includes/common.inc
index 2acf36743..b22238693 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -2,7 +2,7 @@
// $Id$
function conf_init() {
- global $HTTP_HOST;
+ global $HTTP_HOST, $PHP_SELF;
/*
** Try finding a matching configuration file by stripping the website's
@@ -10,7 +10,9 @@ function conf_init() {
** default value 'conf'.
*/
- $file = strtolower(strtr($HTTP_HOST . substr(request_uri(), 0, strrpos(request_uri(), "/")), "/:", ".."));
+ $uri = $PHP_SELF;
+
+ $file = strtolower(strtr($HTTP_HOST . substr($uri, 0, strrpos($uri, "/")), "/:", ".."));
while (strlen($file) > 4) {
if (file_exists("includes/$file.php")) {
@@ -35,7 +37,7 @@ function error_handler($errno, $message, $filename, $line, $variables) {
function watchdog($type, $message, $link = NULL) {
global $user;
- db_query("INSERT INTO watchdog (uid, type, message, link, location, hostname, timestamp) VALUES ('$user->uid', '%s', '%s', '%s', '%s', '%s', '%s')", $type, $message, $link, request_uri(), getenv("REMOTE_ADDR"), time());
+ db_query("INSERT INTO watchdog (uid, type, message, link, location, hostname, timestamp) VALUES ('$user->uid', '%s', '%s', '%s', '%s', '%s', '%s')", $type, $message, $link, $uri, getenv("REMOTE_ADDR"), time());
}
function throttle($type, $rate) {
@@ -56,6 +58,18 @@ function check_php_setting($name, $value) {
}
}
+function arg($index) {
+
+ global $q;
+ static $arguments;
+
+ if (empty($arguments)) {
+ $arguments = explode("/", $q);
+ }
+
+ return $arguments[$index];
+}
+
function array2object($node) {
if (is_array($node)) {
@@ -85,8 +99,11 @@ function object2array($node) {
}
function path_uri($brief = 0) {
- global $HTTP_HOST;
- $path = $HTTP_HOST . substr(request_uri(), 0, strrpos(request_uri(), "/")) ."/";
+ global $HTTP_HOST, $PHP_SELF;
+
+ $uri = $PHP_SELF;
+ $path = $HTTP_HOST . substr($uri, 0, strrpos($uri, "/")) ."/";
+
if (!$brief) {
$path = "http://". $path;
}
@@ -133,9 +150,8 @@ function t($string, $args = 0) {
** translation string is for example:
**
** $msg = t("You must login below or <a href=\"%url\">create a new
- ** account</a> before viewing the next page.", array ("%url"
- ** => drupal_url(array ("mod" => "user", "op" => "register"),
- ** "module")));
+ ** account</a> before viewing the next page.", array("%url"
+ ** => url("user/register")));
*/
$string = ($languages && function_exists("locale") ? locale($string) : $string);
@@ -277,12 +293,12 @@ function search_item($item, $type) {
* Render a generic search form.
*
* "Generic" means "universal usable" - that is, usable not only from
- * module.php?mod=search, but also as a simple seach box (without
+ * 'site.com/search', but also as a simple seach box (without
* "Restrict search to", help text, etc) from theme's header etc.
* This means: provide options to only conditionally render certain
* parts of this form.
*
- * @param $action Form action. Defaults to module.php?mod=search.
+ * @param $action Form action. Defaults to 'site.com/search'.
* @param $query Query string. Defaults to global $keys.
* @param $options != 0: Render additional form fields/text
* ("Restrict search to", help text, etc).
@@ -291,7 +307,7 @@ function search_form($action = 0, $query = 0, $options = 0) {
global $keys;
if (!$action) {
- $action = drupal_url(array("mod" => "search"), "module");
+ $action = url("search");
}
if (!$query) {
@@ -310,8 +326,6 @@ function search_form($action = 0, $query = 0, $options = 0) {
$output .= " <input type=\"checkbox\" name=\"edit[type][$name]\" ". ($edit["type"][$name] ? " checked=\"checked\"" : "") ." /> ". t($name);
}
}
-
- // TODO: (link to) search hints
}
$form .= "<br />";
@@ -354,7 +368,7 @@ function search_data() {
*
* @param $type If set, search only nodes of this type.
* Otherwise, search all types.
- * @param $action Form action. Defaults to module.php?mod=search.
+ * @param $action Form action. Defaults to 'site.com/search'.
* @param $query Query string. Defaults to global $keys.
* @param $options != 0: Render additional form fields/text
* ("Restrict search to", help text, etc).
@@ -638,11 +652,11 @@ function format_name($object) {
global $PHP_SELF;
if ($object->uid && $object->name) {
- if (strstr($PHP_SELF, "admin.php")) {
- $output = la($object->name, array("mod" => "user", "op" => "edit", "id" => $object->uid), "", array("title" => t("Administer user profile.")));
+ if (strstr($PHP_SELF, "admin")) {
+ $output = l($object->name, "admin/user/edit/$object->uid", array("title" => t("Administer user profile.")));
}
else {
- $output = lm($object->name, array("mod" => "user", "op" => "view", "id" => $object->uid), "", array("title" => t("View user profile.")));
+ $output = l($object->name, "user/view/$object->uid", array("title" => t("View user profile.")));
}
}
else {
@@ -652,10 +666,6 @@ function format_name($object) {
return $output;
}
-function format_tag($link, $text) {
- return l(($text ? $text : $link), array("title" => $link));
-}
-
function form($form, $method = "post", $action = 0, $options = 0) {
return "<form action=\"". ($action ? $action : htmlentities(request_uri())) ."\" method=\"$method\"". ($options ? " $options" : "") .">\n$form</form>\n";
}
@@ -737,72 +747,22 @@ function drupal_parse_url($url = NULL) {
return $cache[$url];
}
-/**
- * Build an URL; use this functions when you must write an URL
- * for example in a form or a redirect.
- *
- * @param $args dictionary of arguments to be passed to the script
- * @param $script script to be invoked; optional, defaults to node
- * @param $anchor optional, anchor name
- */
-function drupal_url($args = array(), $script = "node", $anchor = 0) {
- static $search, $replace;
-
- if (!$search) {
- /*
- According to RFC 1738 [3] the special characters "$-_.+!*'()," and the
- reserved characters "/:@#?&=" can be used unencoded within an URL
- */
- $search = array("%24", "%2B", "%21", "%2A", "%27", "%28", "%29", "%2C", "%2F", "%3A", "%40", "%23", "%3F", "%26", "%3D");
- $replace = array("$", "+", "!", "*", "'", "(", ")", ",", "/", ":", "@", "#", "?", "&", "=");
- }
-
- $t = array();
- foreach ($args as $key => $value) {
- $t[] = "$key=". str_replace($search, $replace, urlencode($value));
- }
- if (count($t)) {
- return "$script.php?". implode("&amp;", $t) . ($anchor ? "#$anchor" : "");
- }
- else {
- return "$script.php". ($anchor ? "#$anchor" : "");
- }
+function url($url, $query = NULL) {
+ return "?q=$url". ($query ? "&$query" : "");
}
-/**
- * Build a HTML link; use this functions when you must write a link
- * to another drupal page
- *
- * @param $args dictionary of arguments to be passed to the script
- * @param $text text of the link
- * @param $anchor optional, anchor name
- * @param $script script to be invoked; optional, defaults to node
- * @param $attributes optional, dictionary of attributes for the <a> tag such as 'target', 'name', 'class', etc.
- */
-function l($text, $args = array(), $script = "node", $anchor = "", $attributes = array()) {
- $t = array();
- foreach ($attributes as $key => $value) {
- $t[] = "$key=\"$value\"";
- }
- return "<a href=\"". drupal_url($args, $script, $anchor) ."\" ". implode($t, " ") .">$text</a>";
-}
+function l($text, $url, $attributes = array(), $query = NULL) {
-function la($text, $args = array(), $anchor = "", $attributes = array()) {
- // we don't call l() to avoid another duplication of the array
- $t = array();
- foreach ($attributes as $key => $value) {
- $t[] = "$key=\"$value\"";
+ if (!is_array($attributes)) {
+ print "$text - $url";
}
- return "<a href=\"". drupal_url($args, "admin", $anchor) ."\" ". implode($t, " ") .">$text</a>";
-}
-function lm($text, $args = array(), $anchor = "", $attributes = array()) {
- // we don't call l() to avoid another duplication of the array
$t = array();
foreach ($attributes as $key => $value) {
$t[] = "$key=\"$value\"";
}
- return "<a href=\"". drupal_url($args, "module", $anchor) ."\" ". implode($t, " ") .">$text</a>";
+
+ return "<a href=\"". url($url, $query) ."\" ". implode($t, " ") .">$text</a>";
}
function field_get($string, $name) {
@@ -825,7 +785,7 @@ function link_page() {
return $custom_links;
}
else {
- $links[] = l(t("home"), array(), "index", "", array("title" => t("Return to the main page.")));
+ $links[] = "<a href=\"index.php\" title=\"". t("Return to the main page.") ."\">". t("home") ."</a>";
foreach (module_list() as $name) {
if (module_hook($name, "link")) {
$links = array_merge($links, module_invoke($name, "link", "page"));
diff --git a/includes/conf.php b/includes/conf.php
index bebc4f491..b4c97313f 100644
--- a/includes/conf.php
+++ b/includes/conf.php
@@ -45,8 +45,7 @@ $languages = array("en" => "English");
# top of every page.
// $custom_links = array(
// "<a href=\"index.php\">home</a>",
-// "<a href=\"module.php?mod=user\">school</a>",
-// "<a href=\"module.php?mod=blog\">work</a>");
-
+// "<a href=\"blog\">journal</a>",
+// "<a href=\"story\">articles</a>");
?>
diff --git a/includes/menu.inc b/includes/menu.inc
index fff05a4d8..345f42d03 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -2,7 +2,7 @@
function menu_trail() {
- global $REQUEST_URI;
+ global $QUERY_STRING;
static $trail = NULL;
/*
@@ -12,8 +12,7 @@ function menu_trail() {
if (empty($trail)) {
$path = array();
- $link = substr($REQUEST_URI, strrpos($REQUEST_URI, "/") + 1, strlen($REQUEST_URI));
- $item = db_fetch_object(db_query("SELECT * FROM menu WHERE link = '%s'", $link));
+ $item = db_fetch_object(db_query("SELECT * FROM menu WHERE link LIKE '%%%s'", $QUERY_STRING));
/*
** Compile an array of menu objects that represent the path to
@@ -38,14 +37,13 @@ function menu_trail() {
}
function menu_item($item) {
- global $REQUEST_URI;
/*
** If you want to theme your links, or if you want to replace them
** by an image, this would be the function to customize.
*/
- if (stristr($REQUEST_URI, $item->link) == $item->link) {
+ if (stristr(request_uri(), $item->link) == $item->link) {
return t($item->name);
}
else if ($item->title) {
diff --git a/includes/module.inc b/includes/module.inc
index e9994ba15..63e67801c 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -4,6 +4,7 @@
// initialize modules:
function module_init() {
// Note: changing this also requires changing system_admin() @ modules/system.module.
+ require_once "modules/admin.module";
require_once "modules/user.module";
require_once "modules/system.module";
require_once "modules/watchdog.module";
diff --git a/includes/pager.inc b/includes/pager.inc
index 8f93a5a54..0ec810171 100644
--- a/includes/pager.inc
+++ b/includes/pager.inc
@@ -295,7 +295,8 @@ function pager_link($from_new, $attributes = array()) {
$url["query"] = array_merge($url["query"], $attributes);
}
- return drupal_url($url["query"], $url["script"]);
+ // TODO: should use 'url()':
+ // return drupal_url($url["query"], $url["script"]);
}
function pager_load_array($value, $element, $old_array) {
diff --git a/index.php b/index.php
index 0d725ebcb..a31d94bd4 100644
--- a/index.php
+++ b/index.php
@@ -3,19 +3,34 @@
include_once "includes/common.inc";
-page_header();
-
-check_php_setting("magic_quotes_gpc", 0);
-check_php_setting("register_globals", 1);
+if ($q) {
+ $mod = arg(0);
+}
-if (module_hook(variable_get("site_frontpage", "node"), "page")) {
- module_invoke(variable_get("site_frontpage", "node"), "page");
+if ($mod && module_hook($mod, "page")) {
+ if ($mod != "admin") {
+ page_header();
+ }
+ module_invoke($mod, "page");
+ if ($mod != "admin") {
+ page_footer();
+ }
}
else {
- $theme->header();
- $theme->footer();
-}
+ page_header();
-page_footer();
+ check_php_setting("magic_quotes_gpc", 0);
+ check_php_setting("register_globals", 1);
+
+ if (module_hook(variable_get("site_frontpage", "node"), "page")) {
+ module_invoke(variable_get("site_frontpage", "node"), "page");
+ }
+ else {
+ $theme->header();
+ $theme->footer();
+ }
+
+ page_footer();
+}
?>
diff --git a/module.php b/module.php
deleted file mode 100644
index 4767459d0..000000000
--- a/module.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-// $Id$
-
-include_once "includes/common.inc";
-
-if (module_hook($mod, "page")) {
- page_header();
- module_invoke($mod, "page");
- page_footer();
-}
-else {
- header("Location: index.php");
-}
-
-?>
diff --git a/modules/admin.module b/modules/admin.module
new file mode 100644
index 000000000..a2ddfe73d
--- /dev/null
+++ b/modules/admin.module
@@ -0,0 +1,89 @@
+<?php
+// $Id$
+
+include_once "includes/common.inc";
+
+function status($message) {
+ if ($message) {
+ return "<b>Status:</b> $message<hr />\n";
+ }
+}
+
+function admin_page($mod) {
+ global $user;
+
+ if (user_access("access administration pages")) {
+ page_header();
+
+ ?>
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+ <html>
+ <head>
+ <title><?php echo variable_get("site_name", "drupal") . " " . t("administration pages"); ?></title>
+ <link rel="stylesheet" type="text/css" media="print" href="misc/print.css" />
+ <style type="text/css" title="layout" media="Screen">
+ @import url("misc/admin.css");
+ </style>
+ </head>
+ <body>
+ <?php
+ // NOTE: we include a dummy "print.css" to remove the "flash of unstyled content" (FUOC) problems in IE.
+
+ module_invoke_all("link", "admin");
+
+ /*
+ ** Menu:
+ */
+
+ print "<div id=\"menu\">";
+ echo "<h1><a href=\"index.php\">". variable_get("site_name", "drupal") ."</a></h1>";
+ print menu_tree() ;
+
+ print "</div>";
+
+ /*
+ ** Body:
+ */
+
+ print "<a href=\"http://drupal.org/\"><img align=\"right\" src=\"misc/druplicon-small.gif\" alt=\"Druplicon - Drupal logo\" border=\"0\" /></a>";
+ print "<div id=\"main\">";
+
+ if ($path = menu_path()) {
+ print "<h2>". l(t("Administration"), "admin") ." &gt; $path</h2>";
+ }
+ else {
+ print "<h2>". t("Administration") ."</h2>";
+ }
+
+ if ($menu = menu_menu()) {
+ print "$menu<br />";
+ }
+
+ print "<br /><hr /><br />";
+
+ if ($help = menu_help()) {
+ print "<small>$help</small><br /><br />";
+ }
+
+ if (arg(1)) {
+ print module_invoke(arg(1), "admin");
+ }
+ else {
+ print watchdog_overview("actions");
+ }
+
+ print "</div>";
+
+ db_query("DELETE FROM menu");
+ ?>
+ </body>
+ </html>
+ <?php
+ page_footer();
+ }
+ else {
+ print message_access();
+ }
+}
+
+?>
diff --git a/modules/aggregator.module b/modules/aggregator.module
index a679780cb..25d218c02 100644
--- a/modules/aggregator.module
+++ b/modules/aggregator.module
@@ -31,15 +31,15 @@ function import_perm() {
function import_link($type) {
if ($type == "page" && user_access("access news feeds")) {
- $links[] = lm(t("news feeds"), array("mod" => "import"), "", array("title" => t("Read the latest news from syndicated websites.")));
+ $links[] = l(t("news feeds"), "import", array("title" => t("Read the latest news from syndicated websites.")));
}
if ($type == "admin" && user_access("administer news feeds")) {
- menu_add("news aggregation", "admin.php?mod=import", "Content syndication through RDF/RSS feeds.", NULL, NULL, 3);
- menu_add("add new feed", "admin.php?mod=import&op=add&type=feed", "Add new news feed.", NULL, "news aggregation", 2);
- menu_add("add new bundle", "admin.php?mod=import&op=add&type=bundle", "Create a new bundle.", NULL, "news aggregation", 3);
- menu_add("tag news items", "admin.php?mod=import&op=tag", "Assign bundle attributes to a news item.", NULL, "news aggregation", 4);
- menu_add("help", "admin.php?mod=import&op=help", "More information about news aggregation.", NULL, "news aggregation", 5);
+ menu_add("news aggregation", url("admin/import"), "Content syndication through RDF/RSS feeds.", NULL, NULL, 3);
+ menu_add("add new feed", url("admin/import/add/feed"), "Add new news feed.", NULL, "news aggregation", 2);
+ menu_add("add new bundle", url("admin/import/add/bundle"), "Create a new bundle.", NULL, "news aggregation", 3);
+ menu_add("tag news items", url("admin/import/tag"), "Assign bundle attributes to a news item.", NULL, "news aggregation", 4);
+ menu_add("help", url("admin/import/help"), "More information about news aggregation.", NULL, "news aggregation", 5);
}
return $links ? $links : array();
@@ -63,7 +63,7 @@ function import_format_item($item, $feed = 0) {
global $theme, $user;
if ($user->uid && user_access("maintain personal blog")) {
- $output .= lm("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $output .= l("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
// external link
@@ -116,13 +116,13 @@ function import_block($op, $delta) {
$feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%d'", $delta));
if ($feed) {
$block["subject"] = $feed->title;
- $block["content"] = import_feed_block($feed) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "feed", "id" => $feed->fid), "", array("title" => t("View this feed's recent news."))) ."</div></p>";
+ $block["content"] = import_feed_block($feed) ."<p><div align=\"right\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div></p>";
}
else {
// it was a bundle. this is NOT elegant
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%d'", $delta));
$block["subject"] = $bundle->title;
- $block["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), "", array("title" => t("View this bundle's recent news."))) ."</div></p>";
+ $block["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div></p>";
}
return $block;
@@ -136,7 +136,7 @@ function import_get_bundles($attributes = 0) {
$result = db_query("SELECT * FROM bundle ORDER BY title");
while ($bundle = db_fetch_object($result)) {
$block[$bundle->bid]["subject"] = $bundle->title;
- $block[$bundle->bid]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), "", array("title" => t("View this bundle's recent news."))) ."</div></p>";
+ $block[$bundle->bid]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div></p>";
$block[$bundle->bid]["info"] = "$bundle->title bundle";
}
@@ -150,7 +150,7 @@ function import_get_feeds($attributes = 0) {
$result = db_query("SELECT * FROM feed ORDER BY fid");
while ($feed = db_fetch_object($result)) {
$block[$feed->fid]["subject"] = $feed->title;
- $block[$feed->fid]["content"] = import_feed_block($feed) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "feed", "id" => $feed->fid), "", array("title" => t("View this feed's recent news."))) ."</div></p>";
+ $block[$feed->fid]["content"] = import_feed_block($feed) ."<p><div align=\"right\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div></p>";
$block[$feed->fid]["info"] = "$feed->title feed";
}
@@ -387,7 +387,7 @@ function import_view() {
$header = array(t("title"), t("attributes"), t("items"), t("last update"), t("next update"), array("data" => t("operations"), "colspan" => 3));
unset($rows);
while ($feed = db_fetch_object($result)) {
- $rows[] = array($feed->title, $feed->attributes, format_plural($feed->items, "item", "items"), ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never"), ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never"), la(t("edit feed"), array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $feed->fid)), la(t("remove items"), array("mod" => "import", "type" => "feed", "op" => "remove", "id" => $feed->fid)), la(t("update items"), array("mod" => "import", "type" => "feed", "op" => "update", "id" => $feed->fid)));
+ $rows[] = array($feed->title, $feed->attributes, format_plural($feed->items, "item", "items"), ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never"), ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never"), l(t("edit feed"), "admin/import/edit/feed/$feed->fid"), l(t("remove items"), "admin/import/remove/$feed->fid"), l(t("update items"), "admin/import/update/$feed->fid"));
}
$output .= table($header, $rows);
@@ -398,7 +398,7 @@ function import_view() {
$header = array(t("title"), t("attributes"), t("operations"));
unset($rows);
while ($bundle = db_fetch_object($result)) {
- $rows[] = array($bundle->title, $bundle->attributes, la(t("edit bundle"), array("mod" => "import", "type" => "bundle", "op" => "edit", "id" => $bundle->bid)));
+ $rows[] = array($bundle->title, $bundle->attributes, l(t("edit bundle"), "admin/import/edit/bundle/$bundle->bid"));
}
$output .= table($header, $rows);
@@ -411,7 +411,7 @@ function import_tag() {
$header = array(t("date"), t("feed"), t("news item"));
while ($item = db_fetch_object($result)) {
- $rows[] = array(array("data" => format_date($item->timestamp, "small"), "nowrap" => "nowrap", "valign" => "top"), array("data" => la($item->feed, array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $item->fid)), "valign" => "top"), "<a href=\"$item->link\">$item->title</a>". ($item->description ? "<br /><small><i>$item->description</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" />");
+ $rows[] = array(array("data" => format_date($item->timestamp, "small"), "nowrap" => "nowrap", "valign" => "top"), array("data" => l($item->feed, "admin/import/edit/feed/$item->fid"), "valign" => "top"), "<a href=\"$item->link\">$item->title</a>". ($item->description ? "<br /><small><i>$item->description</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" />");
}
$output .= table($header, $rows);
@@ -421,16 +421,20 @@ function import_tag() {
}
function import_admin() {
- global $op, $id, $type, $edit;
+ global $op, $edit;
if (user_access("administer news feeds")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case "help":
print import_help();
break;
case "add":
- if ($type == "bundle") {
+ if (arg(3) == "bundle") {
print import_form_bundle();
}
else {
@@ -438,19 +442,19 @@ function import_admin() {
}
break;
case "edit":
- if ($type == "bundle") {
- print import_form_bundle(import_get_bundle($id));
+ if (arg(3) == "bundle") {
+ print import_form_bundle(import_get_bundle(arg(4)));
}
else {
- print import_form_feed(import_get_feed($id));
+ print import_form_feed(import_get_feed(arg(4)));
}
break;
case "remove":
- print status(import_remove(import_get_feed($id)));
+ print status(import_remove(import_get_feed(arg(3))));
print import_view();
break;
case "update":
- print status(import_refresh(import_get_feed($id)));
+ print status(import_refresh(import_get_feed(arg(3))));
print import_view();
break;
case "tag":
@@ -464,7 +468,7 @@ function import_admin() {
$edit["title"] = 0;
// fall through:
case "Submit":
- if ($type == "bundle") {
+ if (arg(3) == "bundle") {
print status(import_save_bundle($edit));
}
else {
@@ -483,12 +487,13 @@ function import_admin() {
function import_page_info() {
global $theme;
- $links[] = lm(t("latest news"), array("mod" => "import"), "", array("title" => t("Read the latest news from syndicated websites.")));
- $links[] = lm(t("news by source"), array("mod" => "import", "op" => "feeds"), "", array("title" => t("View the latest headlines sorted by source.")));
- $links[] = lm(t("news by topic"), array("mod" => "import", "op" => "bundles"), "", array("title" => t("View the latest headlines sorted by topic.")));
- $links[] = lm(t("news sources"), array("mod" => "import", "op" => "sources"), "", array("title" => t("View a list of all the websites we syndicate from.")));
+ $links[] = l(t("latest news"), "import", array("title" => t("Read the latest news from syndicated websites.")));
+ $links[] = l(t("news by source"), "import/feeds", array("title" => t("View the latest headlines sorted by source.")));
+ $links[] = l(t("news by topic"), "import/bundles", array("title" => t("View the latest headlines sorted by topic.")));
+ $links[] = l(t("news sources"), "import/sources", array("title" => t("View a list of all the websites we syndicate from.")));
+
if (user_access("administer news feeds")) {
- $links[] = la(t("administer news feeds"), array("mod" => "import"), "", array("title" => t("View the news feed administrative pages.")));
+ $links[] = l(t("administer news feeds"), "admin/import", array("title" => t("View the news feed administrative pages.")));
}
return "<div align=\"center\">". $theme->links($links) ."</div>";
@@ -502,12 +507,12 @@ function import_page_last() {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("maintain personal blog")) {
- $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $links[] = l(t("blog it"), "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
- $links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
+ $links[] = l(t("feed"), "import/feed/$item->fid", array("title" => t("Read more syndicated news from this feed.")));
if ($item->link) {
- $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
+ $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". l($item->ftitle, "import/feed/$item->fid", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
}
if ($item->description) {
@@ -531,14 +536,14 @@ function import_page_feed($fid) {
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\"><a href=\"$feed->link\">$feed->link</a></div></p>";
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">$feed->description</div></p>";
- $header .= "<p><b>". t("Last update") .":</b><div style=\"margin-left: 20px;\">". format_interval(time() - $feed->timestamp) ." ". t("ago") ."<a href=\"$feed->url\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br /><br /></div></p>\n";
+ $header .= "<p><b>". t("Last update") .":</b><div style=\"margin-left: 20px;\">". format_interval(time() - $feed->timestamp) ." ". t("ago") ." <a href=\"$feed->url\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br /><br /></div></p>\n";
$result = db_query("SELECT * FROM item WHERE fid = '%s' ORDER BY iid DESC LIMIT ". variable_get("import_page_limit", 75), $fid);
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("maintain personal blog")) {
- $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $links[] = l(t("blog it"), "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
@@ -565,7 +570,7 @@ function import_page_bundle($bid) {
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%s'", $bid));
- $header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". lm($bundle->title, array("mod" => "import", "op" => "bundle", "id" => $bundle->bid)) ."</div></p>";
+ $header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". l($bundle->title, "import/bundle/$bundle->bid") ."</div></p>";
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". t("A composite news feed about") ." $bundle->attributes.</div></p>";
$keys = explode(",", $bundle->attributes);
@@ -575,13 +580,13 @@ function import_page_bundle($bid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("maintain personal blog")) {
- $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $links[] = l(t("blog it"), "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
- $links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
+ $links[] = l(t("feed"), "import/feed/$item->fid", array("title" => t("Read more syndicated news from this feed.")));
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
if ($item->link) {
- $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
+ $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". l($item->ftitle, "import/feed/$item->fid", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
}
if ($item->description) {
@@ -606,11 +611,11 @@ function import_page_sources() {
$result = db_query("SELECT * FROM feed ORDER BY title");
while ($feed = db_fetch_object($result)) {
- $output .= lm($feed->title, array("mod" => "import", "op" => "feed", "id" => $feed->fid));
+ $output .= l($feed->title, "import/feed/$feed->fid");
$output .= "<div style=\"margin-left: 20px;\">$feed->description</div><br />";
}
- $output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "import", "op" => "fd"), "", array("title" => t("View the list of syndicated websites in XML format."))) ."<br />\n";
+ $output .= l("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", "import/fd", array("title" => t("View the list of syndicated websites in XML format."))) ."<br />";
$theme->header();
$theme->box(t("News feeds"), import_page_info());
@@ -674,15 +679,13 @@ function import_page_blocks($blocks) {
}
function import_page() {
- global $op, $id;
-
if (user_access("access news feeds")) {
- switch ($op) {
+ switch (arg(1)) {
case "feed":
- import_page_feed($id);
+ import_page_feed(arg(2));
break;
case "bundle":
- import_page_bundle($id);
+ import_page_bundle(arg(2));
break;
case "feeds":
import_page_feeds();
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index a679780cb..25d218c02 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -31,15 +31,15 @@ function import_perm() {
function import_link($type) {
if ($type == "page" && user_access("access news feeds")) {
- $links[] = lm(t("news feeds"), array("mod" => "import"), "", array("title" => t("Read the latest news from syndicated websites.")));
+ $links[] = l(t("news feeds"), "import", array("title" => t("Read the latest news from syndicated websites.")));
}
if ($type == "admin" && user_access("administer news feeds")) {
- menu_add("news aggregation", "admin.php?mod=import", "Content syndication through RDF/RSS feeds.", NULL, NULL, 3);
- menu_add("add new feed", "admin.php?mod=import&op=add&type=feed", "Add new news feed.", NULL, "news aggregation", 2);
- menu_add("add new bundle", "admin.php?mod=import&op=add&type=bundle", "Create a new bundle.", NULL, "news aggregation", 3);
- menu_add("tag news items", "admin.php?mod=import&op=tag", "Assign bundle attributes to a news item.", NULL, "news aggregation", 4);
- menu_add("help", "admin.php?mod=import&op=help", "More information about news aggregation.", NULL, "news aggregation", 5);
+ menu_add("news aggregation", url("admin/import"), "Content syndication through RDF/RSS feeds.", NULL, NULL, 3);
+ menu_add("add new feed", url("admin/import/add/feed"), "Add new news feed.", NULL, "news aggregation", 2);
+ menu_add("add new bundle", url("admin/import/add/bundle"), "Create a new bundle.", NULL, "news aggregation", 3);
+ menu_add("tag news items", url("admin/import/tag"), "Assign bundle attributes to a news item.", NULL, "news aggregation", 4);
+ menu_add("help", url("admin/import/help"), "More information about news aggregation.", NULL, "news aggregation", 5);
}
return $links ? $links : array();
@@ -63,7 +63,7 @@ function import_format_item($item, $feed = 0) {
global $theme, $user;
if ($user->uid && user_access("maintain personal blog")) {
- $output .= lm("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $output .= l("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
// external link
@@ -116,13 +116,13 @@ function import_block($op, $delta) {
$feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%d'", $delta));
if ($feed) {
$block["subject"] = $feed->title;
- $block["content"] = import_feed_block($feed) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "feed", "id" => $feed->fid), "", array("title" => t("View this feed's recent news."))) ."</div></p>";
+ $block["content"] = import_feed_block($feed) ."<p><div align=\"right\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div></p>";
}
else {
// it was a bundle. this is NOT elegant
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%d'", $delta));
$block["subject"] = $bundle->title;
- $block["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), "", array("title" => t("View this bundle's recent news."))) ."</div></p>";
+ $block["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div></p>";
}
return $block;
@@ -136,7 +136,7 @@ function import_get_bundles($attributes = 0) {
$result = db_query("SELECT * FROM bundle ORDER BY title");
while ($bundle = db_fetch_object($result)) {
$block[$bundle->bid]["subject"] = $bundle->title;
- $block[$bundle->bid]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), "", array("title" => t("View this bundle's recent news."))) ."</div></p>";
+ $block[$bundle->bid]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div></p>";
$block[$bundle->bid]["info"] = "$bundle->title bundle";
}
@@ -150,7 +150,7 @@ function import_get_feeds($attributes = 0) {
$result = db_query("SELECT * FROM feed ORDER BY fid");
while ($feed = db_fetch_object($result)) {
$block[$feed->fid]["subject"] = $feed->title;
- $block[$feed->fid]["content"] = import_feed_block($feed) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "feed", "id" => $feed->fid), "", array("title" => t("View this feed's recent news."))) ."</div></p>";
+ $block[$feed->fid]["content"] = import_feed_block($feed) ."<p><div align=\"right\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div></p>";
$block[$feed->fid]["info"] = "$feed->title feed";
}
@@ -387,7 +387,7 @@ function import_view() {
$header = array(t("title"), t("attributes"), t("items"), t("last update"), t("next update"), array("data" => t("operations"), "colspan" => 3));
unset($rows);
while ($feed = db_fetch_object($result)) {
- $rows[] = array($feed->title, $feed->attributes, format_plural($feed->items, "item", "items"), ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never"), ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never"), la(t("edit feed"), array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $feed->fid)), la(t("remove items"), array("mod" => "import", "type" => "feed", "op" => "remove", "id" => $feed->fid)), la(t("update items"), array("mod" => "import", "type" => "feed", "op" => "update", "id" => $feed->fid)));
+ $rows[] = array($feed->title, $feed->attributes, format_plural($feed->items, "item", "items"), ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never"), ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never"), l(t("edit feed"), "admin/import/edit/feed/$feed->fid"), l(t("remove items"), "admin/import/remove/$feed->fid"), l(t("update items"), "admin/import/update/$feed->fid"));
}
$output .= table($header, $rows);
@@ -398,7 +398,7 @@ function import_view() {
$header = array(t("title"), t("attributes"), t("operations"));
unset($rows);
while ($bundle = db_fetch_object($result)) {
- $rows[] = array($bundle->title, $bundle->attributes, la(t("edit bundle"), array("mod" => "import", "type" => "bundle", "op" => "edit", "id" => $bundle->bid)));
+ $rows[] = array($bundle->title, $bundle->attributes, l(t("edit bundle"), "admin/import/edit/bundle/$bundle->bid"));
}
$output .= table($header, $rows);
@@ -411,7 +411,7 @@ function import_tag() {
$header = array(t("date"), t("feed"), t("news item"));
while ($item = db_fetch_object($result)) {
- $rows[] = array(array("data" => format_date($item->timestamp, "small"), "nowrap" => "nowrap", "valign" => "top"), array("data" => la($item->feed, array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $item->fid)), "valign" => "top"), "<a href=\"$item->link\">$item->title</a>". ($item->description ? "<br /><small><i>$item->description</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" />");
+ $rows[] = array(array("data" => format_date($item->timestamp, "small"), "nowrap" => "nowrap", "valign" => "top"), array("data" => l($item->feed, "admin/import/edit/feed/$item->fid"), "valign" => "top"), "<a href=\"$item->link\">$item->title</a>". ($item->description ? "<br /><small><i>$item->description</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" />");
}
$output .= table($header, $rows);
@@ -421,16 +421,20 @@ function import_tag() {
}
function import_admin() {
- global $op, $id, $type, $edit;
+ global $op, $edit;
if (user_access("administer news feeds")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case "help":
print import_help();
break;
case "add":
- if ($type == "bundle") {
+ if (arg(3) == "bundle") {
print import_form_bundle();
}
else {
@@ -438,19 +442,19 @@ function import_admin() {
}
break;
case "edit":
- if ($type == "bundle") {
- print import_form_bundle(import_get_bundle($id));
+ if (arg(3) == "bundle") {
+ print import_form_bundle(import_get_bundle(arg(4)));
}
else {
- print import_form_feed(import_get_feed($id));
+ print import_form_feed(import_get_feed(arg(4)));
}
break;
case "remove":
- print status(import_remove(import_get_feed($id)));
+ print status(import_remove(import_get_feed(arg(3))));
print import_view();
break;
case "update":
- print status(import_refresh(import_get_feed($id)));
+ print status(import_refresh(import_get_feed(arg(3))));
print import_view();
break;
case "tag":
@@ -464,7 +468,7 @@ function import_admin() {
$edit["title"] = 0;
// fall through:
case "Submit":
- if ($type == "bundle") {
+ if (arg(3) == "bundle") {
print status(import_save_bundle($edit));
}
else {
@@ -483,12 +487,13 @@ function import_admin() {
function import_page_info() {
global $theme;
- $links[] = lm(t("latest news"), array("mod" => "import"), "", array("title" => t("Read the latest news from syndicated websites.")));
- $links[] = lm(t("news by source"), array("mod" => "import", "op" => "feeds"), "", array("title" => t("View the latest headlines sorted by source.")));
- $links[] = lm(t("news by topic"), array("mod" => "import", "op" => "bundles"), "", array("title" => t("View the latest headlines sorted by topic.")));
- $links[] = lm(t("news sources"), array("mod" => "import", "op" => "sources"), "", array("title" => t("View a list of all the websites we syndicate from.")));
+ $links[] = l(t("latest news"), "import", array("title" => t("Read the latest news from syndicated websites.")));
+ $links[] = l(t("news by source"), "import/feeds", array("title" => t("View the latest headlines sorted by source.")));
+ $links[] = l(t("news by topic"), "import/bundles", array("title" => t("View the latest headlines sorted by topic.")));
+ $links[] = l(t("news sources"), "import/sources", array("title" => t("View a list of all the websites we syndicate from.")));
+
if (user_access("administer news feeds")) {
- $links[] = la(t("administer news feeds"), array("mod" => "import"), "", array("title" => t("View the news feed administrative pages.")));
+ $links[] = l(t("administer news feeds"), "admin/import", array("title" => t("View the news feed administrative pages.")));
}
return "<div align=\"center\">". $theme->links($links) ."</div>";
@@ -502,12 +507,12 @@ function import_page_last() {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("maintain personal blog")) {
- $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $links[] = l(t("blog it"), "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
- $links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
+ $links[] = l(t("feed"), "import/feed/$item->fid", array("title" => t("Read more syndicated news from this feed.")));
if ($item->link) {
- $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
+ $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". l($item->ftitle, "import/feed/$item->fid", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
}
if ($item->description) {
@@ -531,14 +536,14 @@ function import_page_feed($fid) {
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\"><a href=\"$feed->link\">$feed->link</a></div></p>";
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">$feed->description</div></p>";
- $header .= "<p><b>". t("Last update") .":</b><div style=\"margin-left: 20px;\">". format_interval(time() - $feed->timestamp) ." ". t("ago") ."<a href=\"$feed->url\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br /><br /></div></p>\n";
+ $header .= "<p><b>". t("Last update") .":</b><div style=\"margin-left: 20px;\">". format_interval(time() - $feed->timestamp) ." ". t("ago") ." <a href=\"$feed->url\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br /><br /></div></p>\n";
$result = db_query("SELECT * FROM item WHERE fid = '%s' ORDER BY iid DESC LIMIT ". variable_get("import_page_limit", 75), $fid);
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("maintain personal blog")) {
- $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $links[] = l(t("blog it"), "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
@@ -565,7 +570,7 @@ function import_page_bundle($bid) {
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%s'", $bid));
- $header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". lm($bundle->title, array("mod" => "import", "op" => "bundle", "id" => $bundle->bid)) ."</div></p>";
+ $header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". l($bundle->title, "import/bundle/$bundle->bid") ."</div></p>";
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". t("A composite news feed about") ." $bundle->attributes.</div></p>";
$keys = explode(",", $bundle->attributes);
@@ -575,13 +580,13 @@ function import_page_bundle($bid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("maintain personal blog")) {
- $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $links[] = l(t("blog it"), "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
- $links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
+ $links[] = l(t("feed"), "import/feed/$item->fid", array("title" => t("Read more syndicated news from this feed.")));
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
if ($item->link) {
- $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
+ $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". l($item->ftitle, "import/feed/$item->fid", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
}
if ($item->description) {
@@ -606,11 +611,11 @@ function import_page_sources() {
$result = db_query("SELECT * FROM feed ORDER BY title");
while ($feed = db_fetch_object($result)) {
- $output .= lm($feed->title, array("mod" => "import", "op" => "feed", "id" => $feed->fid));
+ $output .= l($feed->title, "import/feed/$feed->fid");
$output .= "<div style=\"margin-left: 20px;\">$feed->description</div><br />";
}
- $output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "import", "op" => "fd"), "", array("title" => t("View the list of syndicated websites in XML format."))) ."<br />\n";
+ $output .= l("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", "import/fd", array("title" => t("View the list of syndicated websites in XML format."))) ."<br />";
$theme->header();
$theme->box(t("News feeds"), import_page_info());
@@ -674,15 +679,13 @@ function import_page_blocks($blocks) {
}
function import_page() {
- global $op, $id;
-
if (user_access("access news feeds")) {
- switch ($op) {
+ switch (arg(1)) {
case "feed":
- import_page_feed($id);
+ import_page_feed(arg(2));
break;
case "bundle":
- import_page_bundle($id);
+ import_page_bundle(arg(2));
break;
case "feeds":
import_page_feeds();
diff --git a/modules/archive.module b/modules/archive.module
index d2f33c0ab..fb21d06e3 100644
--- a/modules/archive.module
+++ b/modules/archive.module
@@ -6,22 +6,26 @@ function archive_system($field){
return $system[$field];
}
-function archive_display($original = 0) {
+function archive_calendar($original = 0) {
- // Prevent future dates:
+ // Extract today's date:
$today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time()));
- $original = (($original && $original <= $today) ? $original : $today);
- // Extract information from the given date:
- $month = date("n", $original);
- $year = date("Y", $original);
- $day = date("d", $original);
+ // Extract the requested date:
+ if (arg(0) == "archive" && arg(3)) {
+ $year = arg(1);
+ $month = arg(2);
+ $day = arg(3);
- // Extract today's date:
- $today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time()));
+ $requested = mktime(23, 59, 59, $month, $day, $year);
+ }
+ else {
+ $year = date("Y", time());
+ $month = date("n", time());
+ $day = date("d", time());
- // Extract the timestamp of the last day of today's month:
- $thislast = mktime(23, 59, 59, date("n", time()), date("t", time()), date("Y", time()));
+ $requested = $today;
+ }
// Extract first day of the month:
$first = date("w", mktime(0, 0, 0, $month, 1, $year));
@@ -38,7 +42,7 @@ function archive_display($original = 0) {
// Generate calendar header:
$output .= "\n<!-- calendar -->\n";
$output .= "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"1\">\n";
- $output .= " <tr><td align=\"center\" colspan=\"7\"><small>". lm("&lt;", array("mod" => "archive", "date" => $prev)) ."&nbsp;". date("F Y", $original) ."&nbsp;". ($next <= $thislast ? lm("&gt;", array("mod" => "archive", "date" => $next)) : "&gt;") ."</small></td></tr>\n";
+ $output .= " <tr><td align=\"center\" colspan=\"7\"><small>". l("&lt;", "archive/". date("Y/m/d", $prev)) ." ". date("F Y", $requested) ." ". ($next <= time() ? l("&gt;", "archive/". date("Y/m/d", $next)) : "&gt;") ."</small></td></tr>\n";
// Generate the days of the week:
$somesunday = mktime(0, 0, 0, 3, 20, 1994);
@@ -69,15 +73,14 @@ function archive_display($original = 0) {
// Print one cell:
$date = mktime(0, 0, 0, $month, $nday, $year);
- if ($date == $original) {
+ if ($date == $requested) {
$output .= " <td align=\"center\"><small><b>$nday</b></small></td>\n";
}
else if ($date > $today) {
$output .= " <td align=\"center\"><small>$nday</small></td>\n";
}
else {
- // due to text-decoration we use drupal_url() instead of lm()
- $output .= " <td align=\"center\"><small>". lm($nday, array("mod" => "archive", "date" => $date), "", array("style" => "text-decoration: none;")) ."</small></td>\n";
+ $output .= " <td align=\"center\"><small>". l($nday, "archive/$year/$month/$nday", array("style" => "text-decoration: none;")) ."</small></td>\n";
}
// Start every week on a new line:
@@ -112,7 +115,7 @@ function archive_block($op = "list", $delta = 0) {
switch ($delta) {
case 0:
$block["subject"] = t("Browse archives");
- $block["content"] = archive_display($date);
+ $block["content"] = archive_calendar();
return $block;
}
}
@@ -120,7 +123,7 @@ function archive_block($op = "list", $delta = 0) {
function archive_link($type) {
if ($type == "page" && user_access("access content")) {
- $links[] = lm(t("archives"), array("mod" => "archive"), "", array("title" => t("Read the older content in our archive.")));
+ $links[] = l(t("archives"), "archive", array("title" => t("Read the older content in our archive.")));
}
return $links ? $links : array();
@@ -132,50 +135,46 @@ function archive_page() {
$theme->header();
if (user_access("access content")) {
+ if ($op == t("Show")) {
+ $year = $edit["year"];
+ $month = $edit["month"];
+ $day = $edit["day"];
+ }
+ else {
+ $year = arg(1);
+ $month = arg(2);
+ $day = arg(3);
+ }
- switch ($op) {
- case t("Show"):
- $date = mktime(0, 0, 0, $edit["month"], $edit["day"], $edit["year"]);
- // Fall though
- default:
-
- /*
- ** Prepare the values of the form fields:
- */
-
- $years = array(2000 => "2000", 2001 => "2001", 2002 => "2002", 2003 => "2003", 2004 => "2004", 2005 => "2005");
- $months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December"));
- for ($i = 1; $i <= 31; $i++) $days[$i] = $i;
+ $date = mktime(0, 0, 0, $month, $day, $year);
- /*
- ** If a timestamp is being specified, extract the date:
- */
+ /*
+ ** Prepare the values of the form fields:
+ */
- if ($date) {
- $edit["year"] = date("Y", $date);
- $edit["month"] = date("m", $date);
- $edit["day"] = date("d", $date);
- }
+ $years = array(2000 => "2000", 2001 => "2001", 2002 => "2002", 2003 => "2003", 2004 => "2004", 2005 => "2005");
+ $months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December"));
+ for ($i = 1; $i <= 31; $i++) $days[$i] = $i;
- $start = form_select("", "year", ($edit["year"] ? $edit["year"] : date("Y")), $years) . form_select("", "month", ($edit["month"] ? $edit["month"] : date("m")), $months) . form_select("", "day", ($edit["day"] ? $edit["day"] : date("d")), $days) . form_submit(t("Show"));
- $start = ereg_replace("<[/]?p>", "", $start);
+ $start = form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show"));
+ $start = ereg_replace("<[/]?p>", "", $start);
- $theme->box(t("Archives"), form($start));
+ $theme->box(t("Archives"), form($start));
- /*
- ** Fetch nodes for the selected date, or current date if none
- ** selected.
- */
+ /*
+ ** Fetch nodes for the selected date, or current date if none
+ ** selected.
+ */
- $result = db_query("SELECT nid FROM node WHERE status = '1' AND created > ". ($date > 0 ? check_query($date) : time()) ." ORDER BY created LIMIT 20");
+ if ($year && $month && $day) {
+ $result = db_query("SELECT nid FROM node WHERE status = '1' AND created > %d ORDER BY created LIMIT 20", $date);
- while ($nid = db_fetch_object($result)) {
- node_view(node_load(array("nid" => $nid->nid)), 1);
- }
+ while ($nid = db_fetch_object($result)) {
+ node_view(node_load(array("nid" => $nid->nid)), 1);
}
+ }
}
else {
- #$theme->box(t("Access denied"), message_access());
message_access();
}
diff --git a/modules/archive/archive.module b/modules/archive/archive.module
index d2f33c0ab..fb21d06e3 100644
--- a/modules/archive/archive.module
+++ b/modules/archive/archive.module
@@ -6,22 +6,26 @@ function archive_system($field){
return $system[$field];
}
-function archive_display($original = 0) {
+function archive_calendar($original = 0) {
- // Prevent future dates:
+ // Extract today's date:
$today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time()));
- $original = (($original && $original <= $today) ? $original : $today);
- // Extract information from the given date:
- $month = date("n", $original);
- $year = date("Y", $original);
- $day = date("d", $original);
+ // Extract the requested date:
+ if (arg(0) == "archive" && arg(3)) {
+ $year = arg(1);
+ $month = arg(2);
+ $day = arg(3);
- // Extract today's date:
- $today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time()));
+ $requested = mktime(23, 59, 59, $month, $day, $year);
+ }
+ else {
+ $year = date("Y", time());
+ $month = date("n", time());
+ $day = date("d", time());
- // Extract the timestamp of the last day of today's month:
- $thislast = mktime(23, 59, 59, date("n", time()), date("t", time()), date("Y", time()));
+ $requested = $today;
+ }
// Extract first day of the month:
$first = date("w", mktime(0, 0, 0, $month, 1, $year));
@@ -38,7 +42,7 @@ function archive_display($original = 0) {
// Generate calendar header:
$output .= "\n<!-- calendar -->\n";
$output .= "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"1\">\n";
- $output .= " <tr><td align=\"center\" colspan=\"7\"><small>". lm("&lt;", array("mod" => "archive", "date" => $prev)) ."&nbsp;". date("F Y", $original) ."&nbsp;". ($next <= $thislast ? lm("&gt;", array("mod" => "archive", "date" => $next)) : "&gt;") ."</small></td></tr>\n";
+ $output .= " <tr><td align=\"center\" colspan=\"7\"><small>". l("&lt;", "archive/". date("Y/m/d", $prev)) ." ". date("F Y", $requested) ." ". ($next <= time() ? l("&gt;", "archive/". date("Y/m/d", $next)) : "&gt;") ."</small></td></tr>\n";
// Generate the days of the week:
$somesunday = mktime(0, 0, 0, 3, 20, 1994);
@@ -69,15 +73,14 @@ function archive_display($original = 0) {
// Print one cell:
$date = mktime(0, 0, 0, $month, $nday, $year);
- if ($date == $original) {
+ if ($date == $requested) {
$output .= " <td align=\"center\"><small><b>$nday</b></small></td>\n";
}
else if ($date > $today) {
$output .= " <td align=\"center\"><small>$nday</small></td>\n";
}
else {
- // due to text-decoration we use drupal_url() instead of lm()
- $output .= " <td align=\"center\"><small>". lm($nday, array("mod" => "archive", "date" => $date), "", array("style" => "text-decoration: none;")) ."</small></td>\n";
+ $output .= " <td align=\"center\"><small>". l($nday, "archive/$year/$month/$nday", array("style" => "text-decoration: none;")) ."</small></td>\n";
}
// Start every week on a new line:
@@ -112,7 +115,7 @@ function archive_block($op = "list", $delta = 0) {
switch ($delta) {
case 0:
$block["subject"] = t("Browse archives");
- $block["content"] = archive_display($date);
+ $block["content"] = archive_calendar();
return $block;
}
}
@@ -120,7 +123,7 @@ function archive_block($op = "list", $delta = 0) {
function archive_link($type) {
if ($type == "page" && user_access("access content")) {
- $links[] = lm(t("archives"), array("mod" => "archive"), "", array("title" => t("Read the older content in our archive.")));
+ $links[] = l(t("archives"), "archive", array("title" => t("Read the older content in our archive.")));
}
return $links ? $links : array();
@@ -132,50 +135,46 @@ function archive_page() {
$theme->header();
if (user_access("access content")) {
+ if ($op == t("Show")) {
+ $year = $edit["year"];
+ $month = $edit["month"];
+ $day = $edit["day"];
+ }
+ else {
+ $year = arg(1);
+ $month = arg(2);
+ $day = arg(3);
+ }
- switch ($op) {
- case t("Show"):
- $date = mktime(0, 0, 0, $edit["month"], $edit["day"], $edit["year"]);
- // Fall though
- default:
-
- /*
- ** Prepare the values of the form fields:
- */
-
- $years = array(2000 => "2000", 2001 => "2001", 2002 => "2002", 2003 => "2003", 2004 => "2004", 2005 => "2005");
- $months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December"));
- for ($i = 1; $i <= 31; $i++) $days[$i] = $i;
+ $date = mktime(0, 0, 0, $month, $day, $year);
- /*
- ** If a timestamp is being specified, extract the date:
- */
+ /*
+ ** Prepare the values of the form fields:
+ */
- if ($date) {
- $edit["year"] = date("Y", $date);
- $edit["month"] = date("m", $date);
- $edit["day"] = date("d", $date);
- }
+ $years = array(2000 => "2000", 2001 => "2001", 2002 => "2002", 2003 => "2003", 2004 => "2004", 2005 => "2005");
+ $months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December"));
+ for ($i = 1; $i <= 31; $i++) $days[$i] = $i;
- $start = form_select("", "year", ($edit["year"] ? $edit["year"] : date("Y")), $years) . form_select("", "month", ($edit["month"] ? $edit["month"] : date("m")), $months) . form_select("", "day", ($edit["day"] ? $edit["day"] : date("d")), $days) . form_submit(t("Show"));
- $start = ereg_replace("<[/]?p>", "", $start);
+ $start = form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show"));
+ $start = ereg_replace("<[/]?p>", "", $start);
- $theme->box(t("Archives"), form($start));
+ $theme->box(t("Archives"), form($start));
- /*
- ** Fetch nodes for the selected date, or current date if none
- ** selected.
- */
+ /*
+ ** Fetch nodes for the selected date, or current date if none
+ ** selected.
+ */
- $result = db_query("SELECT nid FROM node WHERE status = '1' AND created > ". ($date > 0 ? check_query($date) : time()) ." ORDER BY created LIMIT 20");
+ if ($year && $month && $day) {
+ $result = db_query("SELECT nid FROM node WHERE status = '1' AND created > %d ORDER BY created LIMIT 20", $date);
- while ($nid = db_fetch_object($result)) {
- node_view(node_load(array("nid" => $nid->nid)), 1);
- }
+ while ($nid = db_fetch_object($result)) {
+ node_view(node_load(array("nid" => $nid->nid)), 1);
}
+ }
}
else {
- #$theme->box(t("Access denied"), message_access());
message_access();
}
diff --git a/modules/block.module b/modules/block.module
index e8aebe304..44eddbbdb 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -51,10 +51,10 @@ function block_link($type) {
if ($type == "admin" && user_access("administer blocks")) {
$help["block"] = "Blocks are the boxes visible in the side bars on the left- and right-hand side of the website. They are either exported by the Drupal or by any of the active modules. Adminstrators can enable or disable block, as well control the block placement by assigning them a region and/or by assigning each block (within a region) a weight to sort them vertically. The path setting lets you define which pages you want the specific blocks to be shown.";
- menu_add("block management", "admin.php?mod=block", "Block management", $help["block"], NULL, 2);
- menu_add("add new block", "admin.php?mod=block&op=add", "Create a new block", $help["block"], "block management", 2);
- menu_add("preview placement", "admin.php?mod=block&op=preview", "Preview the block placement", $help["block"], "block management", 3);
- menu_add("help", "admin.php?mod=block&op=help", "More information about blocks", NULL, "block management", 5);
+ menu_add("block management", url("admin/block"), "Block management", $help["block"], NULL, 2);
+ menu_add("add new block", url("admin/block/add"), "Create a new block", $help["block"], "block management", 2);
+ menu_add("preview placement", url("admin/block/preview"), "Preview the block placement", $help["block"], "block management", 3);
+ menu_add("help", url("admin/block/help"), "More information about blocks", NULL, "block management", 5);
}
}
@@ -142,8 +142,8 @@ function block_admin_display() {
foreach ($blocks as $block) {
if ($block["module"] == "block") {
- $edit = la(t("edit"), array("mod" => "block", "op" => "edit", "id" => $block["delta"]));
- $delete = la(t("delete"), array("mod" => "block", "op" => "delete", "id" => $block["delta"]));
+ $edit = l(t("edit"), "admin/block/edit/". $block["delta"]);
+ $delete = l(t("delete"), "admin/block/delete". $block["delta"]);
}
else {
$edit = "";
@@ -258,10 +258,14 @@ function block_box_delete($bid) {
}
function block_admin() {
- global $op, $edit, $theme;
+ global $edit, $op, $theme;
if (user_access("administer blocks")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case "help":
block_help();
@@ -273,12 +277,10 @@ function block_admin() {
block_box_form();
break;
case "edit":
- global $id;
- block_box_form(block_box_get($id));
+ block_box_form(block_box_get(arg(3)));
break;
case "delete":
- global $id;
- print status(block_box_delete($id));
+ print status(block_box_delete(arg(3)));
cache_clear_all();
block_admin_display();
break;
diff --git a/modules/block/block.module b/modules/block/block.module
index e8aebe304..44eddbbdb 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -51,10 +51,10 @@ function block_link($type) {
if ($type == "admin" && user_access("administer blocks")) {
$help["block"] = "Blocks are the boxes visible in the side bars on the left- and right-hand side of the website. They are either exported by the Drupal or by any of the active modules. Adminstrators can enable or disable block, as well control the block placement by assigning them a region and/or by assigning each block (within a region) a weight to sort them vertically. The path setting lets you define which pages you want the specific blocks to be shown.";
- menu_add("block management", "admin.php?mod=block", "Block management", $help["block"], NULL, 2);
- menu_add("add new block", "admin.php?mod=block&op=add", "Create a new block", $help["block"], "block management", 2);
- menu_add("preview placement", "admin.php?mod=block&op=preview", "Preview the block placement", $help["block"], "block management", 3);
- menu_add("help", "admin.php?mod=block&op=help", "More information about blocks", NULL, "block management", 5);
+ menu_add("block management", url("admin/block"), "Block management", $help["block"], NULL, 2);
+ menu_add("add new block", url("admin/block/add"), "Create a new block", $help["block"], "block management", 2);
+ menu_add("preview placement", url("admin/block/preview"), "Preview the block placement", $help["block"], "block management", 3);
+ menu_add("help", url("admin/block/help"), "More information about blocks", NULL, "block management", 5);
}
}
@@ -142,8 +142,8 @@ function block_admin_display() {
foreach ($blocks as $block) {
if ($block["module"] == "block") {
- $edit = la(t("edit"), array("mod" => "block", "op" => "edit", "id" => $block["delta"]));
- $delete = la(t("delete"), array("mod" => "block", "op" => "delete", "id" => $block["delta"]));
+ $edit = l(t("edit"), "admin/block/edit/". $block["delta"]);
+ $delete = l(t("delete"), "admin/block/delete". $block["delta"]);
}
else {
$edit = "";
@@ -258,10 +258,14 @@ function block_box_delete($bid) {
}
function block_admin() {
- global $op, $edit, $theme;
+ global $edit, $op, $theme;
if (user_access("administer blocks")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case "help":
block_help();
@@ -273,12 +277,10 @@ function block_admin() {
block_box_form();
break;
case "edit":
- global $id;
- block_box_form(block_box_get($id));
+ block_box_form(block_box_get(arg(3)));
break;
case "delete":
- global $id;
- print status(block_box_delete($id));
+ print status(block_box_delete(arg(3)));
cache_clear_all();
block_admin_display();
break;
diff --git a/modules/blog.module b/modules/blog.module
index 14863d550..d08c94f27 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -52,7 +52,7 @@ function blog_head($main = 0) {
if ($mod == "blog" && $id) {
$account = user_load(array("uid" => $id));
- $output[] = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS - ". $account->name. "'s blog\" href=\"". path_uri(). "module.php?mod=blog&op=view&id=$id\" />";
+ $output[] = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS - ". $account->name. "'s blog\" href=\"". path_uri() . url("blog/view/$id") ." />";
}
return $output ? $output : array();
}
@@ -61,7 +61,7 @@ function blog_user($type, &$edit, &$user) {
switch ($type) {
case "view_public":
case "view_private":
- return form_item(t("Blog"), lm(t("view recent entries"), array("mod" => "blog", "id" => $user->uid), "") ."<br />". lm(t("view all entries"), array("mod" => "blog", "id" => $user->uid, "all" => 1), ""));
+ return form_item(t("Blog"), l(t("view recent blog entries"), "blog/$user->uid"));
}
}
@@ -130,16 +130,15 @@ function blog_feed_user($uid = 0) {
$result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '$uid' AND n.status = 1 ORDER BY n.nid DESC LIMIT 15");
$channel["title"] = $account->name. "'s blog";
- $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view", "id" => $uid), "module");
+ $channel["link"] = path_uri() . url("blog/view/$uid");
$channel["description"] = $term->description;
node_feed($result, $channel);
-
}
function blog_feed_last() {
$result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC LIMIT 15");
- $channel["title"] = variable_get("site_name", "drupal"). "blogs";
- $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view"), "module");
+ $channel["title"] = variable_get("site_name", "drupal") ." blogs";
+ $channel["link"] = path_uri() . url("blog/view");
$channel["description"] = $term->description;
node_feed($result, $channel);
}
@@ -153,16 +152,13 @@ function blog_page_user($uid = 0) {
else {
$account = $user;
}
- $links[] = lm(t("view %username's profile", array("%username" => $account->name)), array("mod" => "user", "id" => $account->uid), "", array("title" => t("View %username's profile information.", array("%username" => $account->name))));
- $links[] = lm(t("view recent blog entries"), array("mod" => "blog", "op" => "view"), "", array("title" => t("View all recent blog entries.")));
- $theme->box(t("%username's blog", array ("%username" => $account->name)), "<center>". $theme->links($links). "</center>");
$result = pager_query("SELECT nid FROM node WHERE type = 'blog' AND uid = '$account->uid' AND status = 1 ORDER BY nid DESC", $user->nodes ? $user->nodes : variable_get("default_nodes_main", 10));
while ($node = db_fetch_object($result)) {
node_view(node_load(array("nid" => $node->nid)), 1);
}
print pager_display(NULL, ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
- print lm("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", array("mod" => "blog", "op" => "feed", "id" => $account->uid), "", array("title" => t("View the XML version of %username's blog", array ("%username" => $account->name))));
+ print l("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", "blog/feed/$account->uid", array("title" => t("View the XML version of %username's blog", array ("%username" => $account->name))));
}
function blog_page_last() {
@@ -174,7 +170,7 @@ function blog_page_last() {
$output = node_view(node_load(array("nid" => $node->nid)), 1);
}
$output .= pager_display(NULL, ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
- $output .= lm("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", array("mod" => "blog", "op" => "feed"), "", array("title" => t("Read the XML version of all blogs.")));
+ $output .= l("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", "blog/feed", array("title" => t("Read the XML version of all blogs.")));
return $output;
}
@@ -182,7 +178,6 @@ function blog_form(&$node, &$help, &$error) {
global $nid, $iid;
if (isset($node->body)) {
-
/*
** Validate the size of the blog:
*/
@@ -205,7 +200,7 @@ function blog_form(&$node, &$help, &$error) {
*/
if ($nid && $blog = node_load(array("nid" => $nid))) {
- $node->body = "<i>". $blog->body ."</i> [".lm($blog->name, array("mod" => "blog", "id" => $blog->uid, "date" => $blog->created))."]";
+ $node->body = "<i>". $blog->body ."</i> [". l($blog->name, "node/view/$nid") ."]";
}
if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = '%s' AND i.fid = f.fid", $iid))) {
@@ -223,13 +218,13 @@ function blog_form(&$node, &$help, &$error) {
}
function blog_page() {
- global $theme, $id, $op, $name;
+ global $theme;
if (user_access("access content")) {
- switch ($op) {
+ switch (arg(1)) {
case "feed":
- if ($id) {
- blog_feed_user($id);
+ if (arg(2)) {
+ blog_feed_user(arg(2));
}
else {
blog_feed_last();
@@ -237,12 +232,8 @@ function blog_page() {
break;
default:
$theme->header();
- if ($name) {
- $user = user_load(array("name" => $name));
- $id = $user->uid;
- }
- if ($id) {
- blog_page_user($id);
+ if (arg(1)) {
+ blog_page_user(arg(1));
}
else {
print blog_page_last();
@@ -262,25 +253,25 @@ function blog_link($type, $node = 0, $main) {
global $user;
if ($type == "page" && user_access("access content")) {
- $links[] = lm(t("user blogs"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries.")));
+ $links[] = l(t("user blogs"), "blog", array("title" => t("Read the latest blog entries.")));
}
if ($type == "menu.create" && user_access("maintain personal blog")) {
- $links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), "", array("title" => t("Add a new personal blog entry.")));
+ $links[] = l(t("create blog entry"), "node/add/blog", array("title" => t("Add a new personal blog entry.")));
}
if ($type == "menu.view" && user_access("maintain personal blog")) {
- $links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), "", array("title" => t("Read your latest blog entries.")));
+ $links[] = l(t("view personal blog"), "blog/$user->uid", array("title" => t("Read your latest blog entries.")));
}
if ($type == "node" && $node->type == "blog") {
global $mod, $op, $id;
if (blog_access("update", $node)) {
- $links[] = lm(t("edit this blog"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Edit this blog entry.")));
+ $links[] = l(t("edit this blog entry"), "node/edit/$node->nid", array("title" => t("Edit this blog entry.")));
}
elseif (empty($id)) {
- $links[] = lm(t("%username's blog", array("%username" => $node->name)), array("mod" => "blog", "op" => "view", "id" => $node->uid), "", array("title" => t("Read %username's latest blog entries.", array("%username" => $node->name))));
+ $links[] = l(t("%username's blog", array("%username" => $node->name)), "blog/$node->uid", array("title" => t("Read %username's latest blog entries.", array("%username" => $node->name))));
}
}
@@ -296,7 +287,7 @@ function blog_block($op = "list", $delta = 0) {
else {
if (user_access("access content")) {
$block["content"] = node_title_list(db_query("SELECT u.uid, u.name, n.created, n.title, n.nid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC LIMIT 10"));
- $block["content"] .= "<div align=\"right\" id=\"blog_more\">". lm(t("more"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries."))) ."</div>";
+ $block["content"] .= "<div align=\"right\" id=\"blog_more\">". l(t("more"), "blog", array("title" => t("Read the latest blog entries."))) ."</div>";
$block["subject"] = t("User blogs");
}
return $block;
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 14863d550..d08c94f27 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -52,7 +52,7 @@ function blog_head($main = 0) {
if ($mod == "blog" && $id) {
$account = user_load(array("uid" => $id));
- $output[] = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS - ". $account->name. "'s blog\" href=\"". path_uri(). "module.php?mod=blog&op=view&id=$id\" />";
+ $output[] = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS - ". $account->name. "'s blog\" href=\"". path_uri() . url("blog/view/$id") ." />";
}
return $output ? $output : array();
}
@@ -61,7 +61,7 @@ function blog_user($type, &$edit, &$user) {
switch ($type) {
case "view_public":
case "view_private":
- return form_item(t("Blog"), lm(t("view recent entries"), array("mod" => "blog", "id" => $user->uid), "") ."<br />". lm(t("view all entries"), array("mod" => "blog", "id" => $user->uid, "all" => 1), ""));
+ return form_item(t("Blog"), l(t("view recent blog entries"), "blog/$user->uid"));
}
}
@@ -130,16 +130,15 @@ function blog_feed_user($uid = 0) {
$result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '$uid' AND n.status = 1 ORDER BY n.nid DESC LIMIT 15");
$channel["title"] = $account->name. "'s blog";
- $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view", "id" => $uid), "module");
+ $channel["link"] = path_uri() . url("blog/view/$uid");
$channel["description"] = $term->description;
node_feed($result, $channel);
-
}
function blog_feed_last() {
$result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC LIMIT 15");
- $channel["title"] = variable_get("site_name", "drupal"). "blogs";
- $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view"), "module");
+ $channel["title"] = variable_get("site_name", "drupal") ." blogs";
+ $channel["link"] = path_uri() . url("blog/view");
$channel["description"] = $term->description;
node_feed($result, $channel);
}
@@ -153,16 +152,13 @@ function blog_page_user($uid = 0) {
else {
$account = $user;
}
- $links[] = lm(t("view %username's profile", array("%username" => $account->name)), array("mod" => "user", "id" => $account->uid), "", array("title" => t("View %username's profile information.", array("%username" => $account->name))));
- $links[] = lm(t("view recent blog entries"), array("mod" => "blog", "op" => "view"), "", array("title" => t("View all recent blog entries.")));
- $theme->box(t("%username's blog", array ("%username" => $account->name)), "<center>". $theme->links($links). "</center>");
$result = pager_query("SELECT nid FROM node WHERE type = 'blog' AND uid = '$account->uid' AND status = 1 ORDER BY nid DESC", $user->nodes ? $user->nodes : variable_get("default_nodes_main", 10));
while ($node = db_fetch_object($result)) {
node_view(node_load(array("nid" => $node->nid)), 1);
}
print pager_display(NULL, ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
- print lm("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", array("mod" => "blog", "op" => "feed", "id" => $account->uid), "", array("title" => t("View the XML version of %username's blog", array ("%username" => $account->name))));
+ print l("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", "blog/feed/$account->uid", array("title" => t("View the XML version of %username's blog", array ("%username" => $account->name))));
}
function blog_page_last() {
@@ -174,7 +170,7 @@ function blog_page_last() {
$output = node_view(node_load(array("nid" => $node->nid)), 1);
}
$output .= pager_display(NULL, ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
- $output .= lm("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", array("mod" => "blog", "op" => "feed"), "", array("title" => t("Read the XML version of all blogs.")));
+ $output .= l("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", "blog/feed", array("title" => t("Read the XML version of all blogs.")));
return $output;
}
@@ -182,7 +178,6 @@ function blog_form(&$node, &$help, &$error) {
global $nid, $iid;
if (isset($node->body)) {
-
/*
** Validate the size of the blog:
*/
@@ -205,7 +200,7 @@ function blog_form(&$node, &$help, &$error) {
*/
if ($nid && $blog = node_load(array("nid" => $nid))) {
- $node->body = "<i>". $blog->body ."</i> [".lm($blog->name, array("mod" => "blog", "id" => $blog->uid, "date" => $blog->created))."]";
+ $node->body = "<i>". $blog->body ."</i> [". l($blog->name, "node/view/$nid") ."]";
}
if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = '%s' AND i.fid = f.fid", $iid))) {
@@ -223,13 +218,13 @@ function blog_form(&$node, &$help, &$error) {
}
function blog_page() {
- global $theme, $id, $op, $name;
+ global $theme;
if (user_access("access content")) {
- switch ($op) {
+ switch (arg(1)) {
case "feed":
- if ($id) {
- blog_feed_user($id);
+ if (arg(2)) {
+ blog_feed_user(arg(2));
}
else {
blog_feed_last();
@@ -237,12 +232,8 @@ function blog_page() {
break;
default:
$theme->header();
- if ($name) {
- $user = user_load(array("name" => $name));
- $id = $user->uid;
- }
- if ($id) {
- blog_page_user($id);
+ if (arg(1)) {
+ blog_page_user(arg(1));
}
else {
print blog_page_last();
@@ -262,25 +253,25 @@ function blog_link($type, $node = 0, $main) {
global $user;
if ($type == "page" && user_access("access content")) {
- $links[] = lm(t("user blogs"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries.")));
+ $links[] = l(t("user blogs"), "blog", array("title" => t("Read the latest blog entries.")));
}
if ($type == "menu.create" && user_access("maintain personal blog")) {
- $links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), "", array("title" => t("Add a new personal blog entry.")));
+ $links[] = l(t("create blog entry"), "node/add/blog", array("title" => t("Add a new personal blog entry.")));
}
if ($type == "menu.view" && user_access("maintain personal blog")) {
- $links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), "", array("title" => t("Read your latest blog entries.")));
+ $links[] = l(t("view personal blog"), "blog/$user->uid", array("title" => t("Read your latest blog entries.")));
}
if ($type == "node" && $node->type == "blog") {
global $mod, $op, $id;
if (blog_access("update", $node)) {
- $links[] = lm(t("edit this blog"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Edit this blog entry.")));
+ $links[] = l(t("edit this blog entry"), "node/edit/$node->nid", array("title" => t("Edit this blog entry.")));
}
elseif (empty($id)) {
- $links[] = lm(t("%username's blog", array("%username" => $node->name)), array("mod" => "blog", "op" => "view", "id" => $node->uid), "", array("title" => t("Read %username's latest blog entries.", array("%username" => $node->name))));
+ $links[] = l(t("%username's blog", array("%username" => $node->name)), "blog/$node->uid", array("title" => t("Read %username's latest blog entries.", array("%username" => $node->name))));
}
}
@@ -296,7 +287,7 @@ function blog_block($op = "list", $delta = 0) {
else {
if (user_access("access content")) {
$block["content"] = node_title_list(db_query("SELECT u.uid, u.name, n.created, n.title, n.nid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC LIMIT 10"));
- $block["content"] .= "<div align=\"right\" id=\"blog_more\">". lm(t("more"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries."))) ."</div>";
+ $block["content"] .= "<div align=\"right\" id=\"blog_more\">". l(t("more"), "blog", array("title" => t("Read the latest blog entries."))) ."</div>";
$block["subject"] = t("User blogs");
}
return $block;
diff --git a/modules/bloggerapi.module b/modules/bloggerapi.module
index abfc2e3b8..1b0adc76c 100644
--- a/modules/bloggerapi.module
+++ b/modules/bloggerapi.module
@@ -223,7 +223,7 @@ function bloggerapi_user_blogs() {
global $user;
if ($user->uid) {
- $struct = new xmlrpcval(array("url" => new xmlrpcval(path_uri() . drupal_url(array("mod" => "blog", "op" => "view", "id" => urlencode($user->uid)), "module")),
+ $struct = new xmlrpcval(array("url" => new xmlrpcval(path_uri() . url("blog/view". urlencode($user->uid))),
"blogid" => new xmlrpcval($user->uid),
"blogName" => new xmlrpcval($user->name . "'s blog at ". variable_get("site_name", "drupal"))
),"struct");
@@ -240,7 +240,7 @@ function bloggerapi_user_info() {
if ($user->uid) {
return new xmlrpcval(array("nickname" => new xmlrpcval($user->name, "string"),
"userid" => new xmlrpcval($user->id, "string"),
- "url" => new xmlrpcval(path_uri() . drupal_url(array("mod" => "blog", "op" => "view", "id" => urlencode($user->uid)), "module"), "string"),
+ "url" => new xmlrpcval(path_uri() . url("blog/view/". urlencode($user->uid)), "string"),
"email" => new xmlrpcval($user->mail, "string"),
"lastname" => new xmlrpcval(substr($user->name, strrpos($user->name," ")+1), "string"),
"firstname" => new xmlrpcval(substr($user->name, 0, strrpos($user->name," ")), "string"),
@@ -378,7 +378,7 @@ function bloggerapi_help() {
<h3>Introduction</h3>
<p><a href="http://www.blogger.com">Blogger</a>, the well-known public weblog service, provides an application programing interface (API) to allow remote procedure calls (RPC) to the Blogger service. Drupal supports this <a href="http://plant.blogger.com/api/index.html">Blogger API</a>, which means that many remote clients (e.g. <a href="radio.userland.com">Radio</a>, <a href="http://simon.kittle.info/textrouter">TextRouter</a>, <a href="http://blogbuddy.sourceforge.net/">Blogbuddy</a>, <a href="http://www.wbloggar.com/">w.bloggar</a>, <a href="http://www.tswoam.co.uk/index.php?n_go=16">PerlyBlog</a>), may post to Drupal. These clients provide a bevy of interesting capabilities like offline composing, spellcheck, and WYSIWYG editing; many folks prefer to blog with a client application over typical web forms. By supporting the Blogger API, Drupal grows grander than a web site engine, it's a <i>content accepting machine</i>&trade;.
-<p>The <a href="http://plant.blogger.com/api/index.html">Blogger RPC API</a> uses the <a href="http://www.xmlrpc.com">XML-RPC</a> protocol for communicating with the outside world. XML-RPC, originally developed by Dave Winer of <a href="http://www.userland.com">UserLand Software</a>, is a simple XML-based RPC specification ideally suited to the web. Drupal also uses XML-RPC for several other tasks (e.g. notifiying <a href="http://www.weblogs.com">weblogs.com</a> of blog updates and making/accepting <?php echo lm("Distributed Authentication", array("mod" => "user", "op" => "help")) ?> requests)</p>
+<p>The <a href="http://plant.blogger.com/api/index.html">Blogger RPC API</a> uses the <a href="http://www.xmlrpc.com">XML-RPC</a> protocol for communicating with the outside world. XML-RPC, originally developed by Dave Winer of <a href="http://www.userland.com">UserLand Software</a>, is a simple XML-based RPC specification ideally suited to the web. Drupal also uses XML-RPC for several other tasks (e.g. notifiying <a href="http://www.weblogs.com">weblogs.com</a> of blog updates and making/accepting <?php echo l("distributed authentication", "user/help"); ?> requests)</p>
<h3>Blogger API implementation</h3>
diff --git a/modules/book.module b/modules/book.module
index d79adb810..83074d1df 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -101,29 +101,29 @@ function book_save($op, $node) {
function book_link($type, $node = 0, $main = 0) {
if ($type == "page" && user_access("access content")) {
- $links[] = lm(t("collaborative book"), array("mod" => "book"), "", array("title" => t("Read and contribute to the collaborative books.")));
+ $links[] = l(t("collaborative book"), "book", array("title" => t("Read and contribute to the collaborative books.")));
}
if ($type == "menu.create" && user_access("maintain books")) {
- $links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), "", array("title" => t("Add a new book page.")));
+ $links[] = l(t("create book page"), "node/add/book", array("title" => t("Add a new book page.")));
}
if ($type == "node" && $node->type == "book" && book_access("update", $node)) {
- $links[] = lm(t("edit this page"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Suggest an update for this book page.")));
- $links[] = lm(t("printer-friendly version"), array("mod" => "book", "op" => "print", "id" => $node->nid), "", array("title" => t("Show a printer-friendly version of this book page and its sub-pages.")));
+ $links[] = l(t("edit this page"), "node/edit/$node->nid", array("title" => t("Suggest an update for this book page.")));
+ $links[] = l(t("printer-friendly version"), "book/print/$node->nid", array("title" => t("Show a printer-friendly version of this book page and its sub-pages.")));
}
if ($type == "admin" && user_access("maintain books")) {
$help["book"] = "The collaborative book offers a mean to organize content, authored by many users, in an online manual, outline or FAQ.";
$help["orphan"] = "As pages in a book are edited, reorganized and removed, child pages might be left behind. We refer to such pages as 'orphan pages'. On this page, administrators can review their books for orphans and reaffiliate those pages as desired.";
- menu_add("collaborative books", "admin.php?mod=book", "Maintain collaborative books.", $help["book"], "content management");
- menu_add("orphan pages", "admin.php?mod=book&op=orphan", "Display all orphan pages.", $orphan, "collaborative books", 8);
- menu_add("help", "admin.php?mod=book&op=help", "More information about the collaborative book.", NULL, "collaborative books", 9);
+ menu_add("collaborative books", url("admin/book"), "Maintain collaborative books.", $help["book"], "content management");
+ menu_add("orphan pages", url("admin/book/orphan"), "Display all orphan pages.", $orphan, "collaborative books", 8);
+ menu_add("help", url("admin/book/help"), "More information about the collaborative book.", NULL, "collaborative books", 9);
$result = db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title");
while ($book = db_fetch_object($result)) {
- menu_add("administer book '$book->title'", "admin.php?mod=book&op=view&id=$book->nid", "Display a book outline.", NULL, "collaborative books");
+ menu_add("administer book '$book->title'", url("admin/book/view/$book->nid"), "Display a book outline.", NULL, "collaborative books");
}
}
@@ -135,7 +135,7 @@ function book_load($node) {
$book = db_fetch_object(db_query("SELECT format, parent, weight, log FROM book WHERE nid = '%d'", $node->nid));
- if (strstr(request_uri(), drupal_url(array("mod" => "node", "op" => "edit"), "module"))) {
+ if (strstr(request_uri(), "node/edit")) {
/*
** If a user is about to update a book page, we overload some
@@ -285,7 +285,7 @@ function book_node_link($node = 0) {
$output .= form_hidden("nid", $node->nid);
- return form($output, "post", drupal_url(array("mod" => "book", "op" => "outline"), "admin"));
+ return form($output, "post", url("admin/book/outline"));
}
}
@@ -413,7 +413,7 @@ function book_view($node, $main = 0) {
if ($node->title) {
foreach (book_location($node) as $level) {
- $location .= "$indent ". l($level->title, array("id" => $level->nid)) ."<br />";
+ $location .= "$indent ". l($level->title, "node/view/$level->nid") ."<br />";
$indent .= "-";
}
@@ -435,8 +435,8 @@ function book_view($node, $main = 0) {
}
$output .= " <tr><td colspan=\"3\"><hr /></td></tr>";
- $output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? l(t("previous"), array("id" => $prev->nid), "node", "", array("title" => t("View the previous page in this book."))) : t("previous")) ."</td><td align=\"center\" width=\"34%\">". lm(t("index"), array("mod" => "book"), "", array("title" => t("View this book's table of contents."))) ."</td><td align=\"right\" width=\"33%\">". ($next ? l(t("next"), array("id" => $next->nid), "node", "", array("title" => t("View the next page in this book."))) : t("next")) ."</td></tr>";
- $output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<small>$prev->title</small>" : "&nbsp;") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? l(t("up"), array("id" => $node->parent), "node", "", array("title" => t("View this page's parent section."))) : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>$next->title</small>" : "&nbsp;") ."</td></tr>";
+ $output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? l(t("previous"), "node/view/$prev->nid", array("title" => t("View the previous page in this book."))) : t("previous")) ."</td><td align=\"center\" width=\"34%\">". l(t("index"), "book", array("title" => t("View this book's table of contents."))) ."</td><td align=\"right\" width=\"33%\">". ($next ? l(t("next"), "node/view/$next->nid", array("title" => t("View the next page in this book."))) : t("next")) ."</td></tr>";
+ $output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<small>$prev->title</small>" : "&nbsp;") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? l(t("up"), "node/view/$node->parent", array("title" => t("View this page's parent section."))) : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>$next->title</small>" : "&nbsp;") ."</td></tr>";
$output .= " <tr><td colspan=\"3\"><hr /></td></tr>";
$output .= " <tr><td colspan=\"3\" align=\"right\"><div style=\"margin: 10 10 10 10;\">". $theme->links(link_node($node, $main)) ."</div></td></tr>";
$output .= "</table>";
@@ -491,7 +491,7 @@ function book_tree_recurse($nid, $depth, $children) {
if ($depth > 0) {
if ($children[$nid]) {
foreach ($children[$nid] as $foo => $node) {
- $output .= "<li>". l($node->title, array("id" => $node->nid)) ."</li>";
+ $output .= "<li>". l($node->title, "node/view/$node->nid") ."</li>";
if ($tree = book_tree_recurse($node->nid, $depth - 1, $children)) {
$output .= "<ul>$tree</ul>";
@@ -537,7 +537,7 @@ function book_render() {
if ($node) {
// output the content:
- $output .= "<dt>". l($node->title, array("id" => $node->nid)) ."</dt><dd>". book_body($node) ."<br /><br /></dd>";
+ $output .= "<dt>". l($node->title, "node/view/$node->nid") ."</dt><dd>". book_body($node) ."<br /><br /></dd>";
}
}
@@ -547,12 +547,12 @@ function book_render() {
}
function book_page() {
- global $op, $id, $theme;
+ global $theme;
if (user_access("access content")) {
- switch ($op) {
+ switch (arg(1)) {
case "print":
- print book_print($id, $depth = 1);
+ print book_print(arg(2), $depth = 1);
break;
default:
book_render();
@@ -628,9 +628,9 @@ function book_admin_view_line($node, $depth = 0) {
$output .= "<tr>";
$output .= " <td><div style=\"padding-left: ". (25 * $depth) ."px;\">". form_textfield(NULL, "$node->nid][title", $node->title, 64, 255) ."</div></td>";
$output .= " <td>". form_weight(NULL, "$node->nid][weight", $node->weight) ."</td>";
- $output .= " <td>". l(t("view node"), array("id" => $node->nid)) ."</td>";
- $output .= " <td>". la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid)) ."</td>";
- $output .= " <td>". la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid)) ."</td>";
+ $output .= " <td>". l(t("view node"), "node/view/$node->nid") ."</td>";
+ $output .= " <td>". l(t("edit node"), "admin/node/edit/$node->nid") ."</td>";
+ $output .= " <td>". l(t("delete node"), "admin/node/delete/$node->nid") ."</td>";
$output .= "</tr>";
return $output;
@@ -707,7 +707,7 @@ function book_admin_orphan() {
$output .= " <tr><th>title</th><th colspan=\"2\">operations</th></tr>";
foreach ($pages as $nid => $node) {
if ($node->parent && empty($pages[$node->parent])) {
- $output .= "<tr><td>". l($node->title, array("id" => $node->nid)) ."</td><td>". la(t("edit page"), array("mod" => "node", "op" => "edit", "id" => $node->nid)) ."</td><td>". la(t("delete page"), array("mod" => "node", "op" => "delete", "id" => $node->nid)) ."</td>";
+ $output .= "<tr><td>". l($node->title, "node/view/$node->nid") ."</td><td>". l(t("edit page"), "admin/node/edit/$node->nid") ."</td><td>". l(t("delete page"), "admin/node/delete/$node->nid") ."</td>";
}
}
$output .= "</table>";
@@ -720,9 +720,13 @@ function book_admin_links() {
}
function book_admin() {
- global $id, $op, $edit;
+ global $op, $edit;
if (user_access("administer nodes")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case t("Edit book outline"):
case t("Add to book outline"):
@@ -734,10 +738,10 @@ function book_admin() {
print book_admin_orphan();
break;
case t("Save book pages");
- print status(book_admin_save($id, $edit));
+ print status(book_admin_save(arg(3), $edit));
// fall through:
case "view":
- print book_admin_view($id);
+ print book_admin_view(arg(3));
break;
case "help":
book_help();
@@ -755,11 +759,9 @@ function book_help() {
<p>Book pages are a special, powerful node type. These nodes are specifically designed to be included in a book. Their special power comes from the bilility to embed PHP within the body of the page. This capability is only offerred to administrators, since malicious users could abuse this power. In addiiton, book pages contain a <i>log message</i> field which helps your users understand the motivation behind an edit of a book page. Each edited version of a book page is usually stored as a new revision of a node. This capability makes it easy to revert to an old version of a page, should that become desirable.</p>
-<p>Like other node types, book submissions and edits may be subject to moderation, depending on your configuration. Similarly, books use <?php echo la("permissions", array("mod" => "user", "op" => "permission")) ?> to determine who may read and write to them. Only administrators are allowed to create new books, which are really just nodes whose parent is <i>&lt;root&gt;</i>. To include an existing node in your book, click on the "administer"-link in that node. At the bottom of this administration page, click on the <i>edit book outline</i> button. This enables you to place the node wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
+<p>Like other node types, book submissions and edits may be subject to moderation, depending on your configuration. Similarly, books use <?php echo l("permissions", "admin/user/permission") ?> to determine who may read and write to them. Only administrators are allowed to create new books, which are really just nodes whose parent is <i>&lt;root&gt;</i>. To include an existing node in your book, click on the "administer"-link in that node. At the bottom of this administration page, click on the <i>edit book outline</i> button. This enables you to place the node wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
-<p>Administrators may review the hierarchy of their books by clicking on the <?php echo la("collaborative book link", array("mod" => "book")) ?> in the adminstration pages. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a parent node is deleted, he may leave behind child nodes.
-These nodes are now <i>orphans</i>. Administrators should periodically <?php echo la("review their books for orphans", array("mod" => "book", "op" => "orphan")) ?> and reaffiliate those pages as desired. Finally, administrators may also
-<?php echo la("export their books", array("mod" => "book", "op" => "print")) ?> to a single, flat HTML page which is suitable for printing.</p>
+<p>Administrators may review the hierarchy of their books by clicking on the <?php echo l("collaborative book link", "admin/book") ?> in the adminstration pages. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a parent node is deleted, he may leave behind child nodes. These nodes are now <i>orphans</i>. Administrators should periodically <?php echo l("review their books for orphans", "admin/book/orphan") ?> and reaffiliate those pages as desired. Finally, administrators may also <?php echo l("export their books", "book/print") ?> to a single, flat HTML page which is suitable for printing.</p>
<a name="faq"></a><h3>Maintain a FAQ using a collaborative book</i></h3>
@@ -774,7 +776,7 @@ These nodes are now <i>orphans</i>. Administrators should periodically <?php ech
<li>Any comments attached to those relevant posts which you designate as book pages will also be transported into your book. This is a great feature, since much wisdom is shared via comments. And remember that all future comments and edits will automatically be reflected in your book.</li>
<li>You may wish to edit the title and teaser of posts when adding them to your FAQ. This is done on the same page as the <i>Edit book outline</i> button. Clear titles help users navigate quickly to the information that they seek.</li>
<li>Book pages may come from any content type (blog, story, page, etc.). If you are creating a post solely for inclusion in your book, then use the <i>Create book page</i> link.</li>
- <li>If you don't see the <i>administer</i> link, then you probably have insufficient <?php echo la("permissions", array("mod" => "user", "op" => "permission")) ?>.</li>
+ <li>If you don't see the <i>administer</i> link, then you probably have insufficient <?php echo l("permissions", "admin/user/permission") ?>.</li>
<li>If you want to get really fancy, note that Books are one of the few content types which allow raw PHP in their <i>body</i>. So you've got lots of geeky possibilities there.</li>
</ul>
<?php
diff --git a/modules/book/book.module b/modules/book/book.module
index d79adb810..83074d1df 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -101,29 +101,29 @@ function book_save($op, $node) {
function book_link($type, $node = 0, $main = 0) {
if ($type == "page" && user_access("access content")) {
- $links[] = lm(t("collaborative book"), array("mod" => "book"), "", array("title" => t("Read and contribute to the collaborative books.")));
+ $links[] = l(t("collaborative book"), "book", array("title" => t("Read and contribute to the collaborative books.")));
}
if ($type == "menu.create" && user_access("maintain books")) {
- $links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), "", array("title" => t("Add a new book page.")));
+ $links[] = l(t("create book page"), "node/add/book", array("title" => t("Add a new book page.")));
}
if ($type == "node" && $node->type == "book" && book_access("update", $node)) {
- $links[] = lm(t("edit this page"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Suggest an update for this book page.")));
- $links[] = lm(t("printer-friendly version"), array("mod" => "book", "op" => "print", "id" => $node->nid), "", array("title" => t("Show a printer-friendly version of this book page and its sub-pages.")));
+ $links[] = l(t("edit this page"), "node/edit/$node->nid", array("title" => t("Suggest an update for this book page.")));
+ $links[] = l(t("printer-friendly version"), "book/print/$node->nid", array("title" => t("Show a printer-friendly version of this book page and its sub-pages.")));
}
if ($type == "admin" && user_access("maintain books")) {
$help["book"] = "The collaborative book offers a mean to organize content, authored by many users, in an online manual, outline or FAQ.";
$help["orphan"] = "As pages in a book are edited, reorganized and removed, child pages might be left behind. We refer to such pages as 'orphan pages'. On this page, administrators can review their books for orphans and reaffiliate those pages as desired.";
- menu_add("collaborative books", "admin.php?mod=book", "Maintain collaborative books.", $help["book"], "content management");
- menu_add("orphan pages", "admin.php?mod=book&op=orphan", "Display all orphan pages.", $orphan, "collaborative books", 8);
- menu_add("help", "admin.php?mod=book&op=help", "More information about the collaborative book.", NULL, "collaborative books", 9);
+ menu_add("collaborative books", url("admin/book"), "Maintain collaborative books.", $help["book"], "content management");
+ menu_add("orphan pages", url("admin/book/orphan"), "Display all orphan pages.", $orphan, "collaborative books", 8);
+ menu_add("help", url("admin/book/help"), "More information about the collaborative book.", NULL, "collaborative books", 9);
$result = db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title");
while ($book = db_fetch_object($result)) {
- menu_add("administer book '$book->title'", "admin.php?mod=book&op=view&id=$book->nid", "Display a book outline.", NULL, "collaborative books");
+ menu_add("administer book '$book->title'", url("admin/book/view/$book->nid"), "Display a book outline.", NULL, "collaborative books");
}
}
@@ -135,7 +135,7 @@ function book_load($node) {
$book = db_fetch_object(db_query("SELECT format, parent, weight, log FROM book WHERE nid = '%d'", $node->nid));
- if (strstr(request_uri(), drupal_url(array("mod" => "node", "op" => "edit"), "module"))) {
+ if (strstr(request_uri(), "node/edit")) {
/*
** If a user is about to update a book page, we overload some
@@ -285,7 +285,7 @@ function book_node_link($node = 0) {
$output .= form_hidden("nid", $node->nid);
- return form($output, "post", drupal_url(array("mod" => "book", "op" => "outline"), "admin"));
+ return form($output, "post", url("admin/book/outline"));
}
}
@@ -413,7 +413,7 @@ function book_view($node, $main = 0) {
if ($node->title) {
foreach (book_location($node) as $level) {
- $location .= "$indent ". l($level->title, array("id" => $level->nid)) ."<br />";
+ $location .= "$indent ". l($level->title, "node/view/$level->nid") ."<br />";
$indent .= "-";
}
@@ -435,8 +435,8 @@ function book_view($node, $main = 0) {
}
$output .= " <tr><td colspan=\"3\"><hr /></td></tr>";
- $output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? l(t("previous"), array("id" => $prev->nid), "node", "", array("title" => t("View the previous page in this book."))) : t("previous")) ."</td><td align=\"center\" width=\"34%\">". lm(t("index"), array("mod" => "book"), "", array("title" => t("View this book's table of contents."))) ."</td><td align=\"right\" width=\"33%\">". ($next ? l(t("next"), array("id" => $next->nid), "node", "", array("title" => t("View the next page in this book."))) : t("next")) ."</td></tr>";
- $output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<small>$prev->title</small>" : "&nbsp;") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? l(t("up"), array("id" => $node->parent), "node", "", array("title" => t("View this page's parent section."))) : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>$next->title</small>" : "&nbsp;") ."</td></tr>";
+ $output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? l(t("previous"), "node/view/$prev->nid", array("title" => t("View the previous page in this book."))) : t("previous")) ."</td><td align=\"center\" width=\"34%\">". l(t("index"), "book", array("title" => t("View this book's table of contents."))) ."</td><td align=\"right\" width=\"33%\">". ($next ? l(t("next"), "node/view/$next->nid", array("title" => t("View the next page in this book."))) : t("next")) ."</td></tr>";
+ $output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<small>$prev->title</small>" : "&nbsp;") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? l(t("up"), "node/view/$node->parent", array("title" => t("View this page's parent section."))) : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>$next->title</small>" : "&nbsp;") ."</td></tr>";
$output .= " <tr><td colspan=\"3\"><hr /></td></tr>";
$output .= " <tr><td colspan=\"3\" align=\"right\"><div style=\"margin: 10 10 10 10;\">". $theme->links(link_node($node, $main)) ."</div></td></tr>";
$output .= "</table>";
@@ -491,7 +491,7 @@ function book_tree_recurse($nid, $depth, $children) {
if ($depth > 0) {
if ($children[$nid]) {
foreach ($children[$nid] as $foo => $node) {
- $output .= "<li>". l($node->title, array("id" => $node->nid)) ."</li>";
+ $output .= "<li>". l($node->title, "node/view/$node->nid") ."</li>";
if ($tree = book_tree_recurse($node->nid, $depth - 1, $children)) {
$output .= "<ul>$tree</ul>";
@@ -537,7 +537,7 @@ function book_render() {
if ($node) {
// output the content:
- $output .= "<dt>". l($node->title, array("id" => $node->nid)) ."</dt><dd>". book_body($node) ."<br /><br /></dd>";
+ $output .= "<dt>". l($node->title, "node/view/$node->nid") ."</dt><dd>". book_body($node) ."<br /><br /></dd>";
}
}
@@ -547,12 +547,12 @@ function book_render() {
}
function book_page() {
- global $op, $id, $theme;
+ global $theme;
if (user_access("access content")) {
- switch ($op) {
+ switch (arg(1)) {
case "print":
- print book_print($id, $depth = 1);
+ print book_print(arg(2), $depth = 1);
break;
default:
book_render();
@@ -628,9 +628,9 @@ function book_admin_view_line($node, $depth = 0) {
$output .= "<tr>";
$output .= " <td><div style=\"padding-left: ". (25 * $depth) ."px;\">". form_textfield(NULL, "$node->nid][title", $node->title, 64, 255) ."</div></td>";
$output .= " <td>". form_weight(NULL, "$node->nid][weight", $node->weight) ."</td>";
- $output .= " <td>". l(t("view node"), array("id" => $node->nid)) ."</td>";
- $output .= " <td>". la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid)) ."</td>";
- $output .= " <td>". la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid)) ."</td>";
+ $output .= " <td>". l(t("view node"), "node/view/$node->nid") ."</td>";
+ $output .= " <td>". l(t("edit node"), "admin/node/edit/$node->nid") ."</td>";
+ $output .= " <td>". l(t("delete node"), "admin/node/delete/$node->nid") ."</td>";
$output .= "</tr>";
return $output;
@@ -707,7 +707,7 @@ function book_admin_orphan() {
$output .= " <tr><th>title</th><th colspan=\"2\">operations</th></tr>";
foreach ($pages as $nid => $node) {
if ($node->parent && empty($pages[$node->parent])) {
- $output .= "<tr><td>". l($node->title, array("id" => $node->nid)) ."</td><td>". la(t("edit page"), array("mod" => "node", "op" => "edit", "id" => $node->nid)) ."</td><td>". la(t("delete page"), array("mod" => "node", "op" => "delete", "id" => $node->nid)) ."</td>";
+ $output .= "<tr><td>". l($node->title, "node/view/$node->nid") ."</td><td>". l(t("edit page"), "admin/node/edit/$node->nid") ."</td><td>". l(t("delete page"), "admin/node/delete/$node->nid") ."</td>";
}
}
$output .= "</table>";
@@ -720,9 +720,13 @@ function book_admin_links() {
}
function book_admin() {
- global $id, $op, $edit;
+ global $op, $edit;
if (user_access("administer nodes")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case t("Edit book outline"):
case t("Add to book outline"):
@@ -734,10 +738,10 @@ function book_admin() {
print book_admin_orphan();
break;
case t("Save book pages");
- print status(book_admin_save($id, $edit));
+ print status(book_admin_save(arg(3), $edit));
// fall through:
case "view":
- print book_admin_view($id);
+ print book_admin_view(arg(3));
break;
case "help":
book_help();
@@ -755,11 +759,9 @@ function book_help() {
<p>Book pages are a special, powerful node type. These nodes are specifically designed to be included in a book. Their special power comes from the bilility to embed PHP within the body of the page. This capability is only offerred to administrators, since malicious users could abuse this power. In addiiton, book pages contain a <i>log message</i> field which helps your users understand the motivation behind an edit of a book page. Each edited version of a book page is usually stored as a new revision of a node. This capability makes it easy to revert to an old version of a page, should that become desirable.</p>
-<p>Like other node types, book submissions and edits may be subject to moderation, depending on your configuration. Similarly, books use <?php echo la("permissions", array("mod" => "user", "op" => "permission")) ?> to determine who may read and write to them. Only administrators are allowed to create new books, which are really just nodes whose parent is <i>&lt;root&gt;</i>. To include an existing node in your book, click on the "administer"-link in that node. At the bottom of this administration page, click on the <i>edit book outline</i> button. This enables you to place the node wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
+<p>Like other node types, book submissions and edits may be subject to moderation, depending on your configuration. Similarly, books use <?php echo l("permissions", "admin/user/permission") ?> to determine who may read and write to them. Only administrators are allowed to create new books, which are really just nodes whose parent is <i>&lt;root&gt;</i>. To include an existing node in your book, click on the "administer"-link in that node. At the bottom of this administration page, click on the <i>edit book outline</i> button. This enables you to place the node wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
-<p>Administrators may review the hierarchy of their books by clicking on the <?php echo la("collaborative book link", array("mod" => "book")) ?> in the adminstration pages. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a parent node is deleted, he may leave behind child nodes.
-These nodes are now <i>orphans</i>. Administrators should periodically <?php echo la("review their books for orphans", array("mod" => "book", "op" => "orphan")) ?> and reaffiliate those pages as desired. Finally, administrators may also
-<?php echo la("export their books", array("mod" => "book", "op" => "print")) ?> to a single, flat HTML page which is suitable for printing.</p>
+<p>Administrators may review the hierarchy of their books by clicking on the <?php echo l("collaborative book link", "admin/book") ?> in the adminstration pages. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a parent node is deleted, he may leave behind child nodes. These nodes are now <i>orphans</i>. Administrators should periodically <?php echo l("review their books for orphans", "admin/book/orphan") ?> and reaffiliate those pages as desired. Finally, administrators may also <?php echo l("export their books", "book/print") ?> to a single, flat HTML page which is suitable for printing.</p>
<a name="faq"></a><h3>Maintain a FAQ using a collaborative book</i></h3>
@@ -774,7 +776,7 @@ These nodes are now <i>orphans</i>. Administrators should periodically <?php ech
<li>Any comments attached to those relevant posts which you designate as book pages will also be transported into your book. This is a great feature, since much wisdom is shared via comments. And remember that all future comments and edits will automatically be reflected in your book.</li>
<li>You may wish to edit the title and teaser of posts when adding them to your FAQ. This is done on the same page as the <i>Edit book outline</i> button. Clear titles help users navigate quickly to the information that they seek.</li>
<li>Book pages may come from any content type (blog, story, page, etc.). If you are creating a post solely for inclusion in your book, then use the <i>Create book page</i> link.</li>
- <li>If you don't see the <i>administer</i> link, then you probably have insufficient <?php echo la("permissions", array("mod" => "user", "op" => "permission")) ?>.</li>
+ <li>If you don't see the <i>administer</i> link, then you probably have insufficient <?php echo l("permissions", "admin/user/permission") ?>.</li>
<li>If you want to get really fancy, note that Books are one of the few content types which allow raw PHP in their <i>body</i>. So you've got lots of geeky possibilities there.</li>
</ul>
<?php
diff --git a/modules/cloud.module b/modules/cloud.module
index b6dbceac3..51789c387 100644
--- a/modules/cloud.module
+++ b/modules/cloud.module
@@ -36,15 +36,15 @@ function cloud_perm() {
function cloud_link($type) {
if ($type == "page" && user_access("access site cloud")) {
- $links[] = lm(t("site cloud"), array("mod" => "cloud"), "", array("title" => t("Monitor other sites in the cloud.")));
+ $links[] = l(t("site cloud"), "cloud", array("title" => t("Monitor other sites in the cloud.")));
}
if ($type == "admin" && user_access("administer site cloud")) {
$cloud = "The cloud monitor tracks or crawls other interesting websites and displays their last modification dates. Visitors to the host site learn about relevant sites and can easily see if there is new content.";
- menu_add("blogrolling", "admin.php?mod=cloud", "Maintain the sites in your blogroll.", $cloud, NULL, 3);
- menu_add("add new site", "admin.php?mod=cloud&op=add", "Add a new sites to your blogroll.", NULL, "blogrolling", 3);
- menu_add("help", "admin.php?mod=cloud&op=help", "More information about the site cloud.", NULL, "blogrolling", 9);
+ menu_add("blogrolling", url("admin/cloud"), "Maintain the sites in your blogroll.", $cloud, NULL, 3);
+ menu_add("add new site", url("admin/cloud/add"), "Add a new sites to your blogroll.", NULL, "blogrolling", 3);
+ menu_add("help", url("admin/cloud/help"), "More information about the site cloud.", NULL, "blogrolling", 9);
}
return $links ? $links : array();
@@ -57,11 +57,11 @@ function cloud_update($site) {
*/
if (!ereg("^http://|https://|ftp://", $site["link"])) {
- watchdog("warning", "cloud: invalid or missing URL for '". $site["name"] ."'");
+ watchdog("warning", "cloud: invalid or missing URL for '". $site["name"] ."'", l(t("edit site"), "admin/cloud/edit/". $site["sid"]));
}
if (!ereg("^http://|https://|ftp://", $site["feed"])) {
- watchdog("warning", "cloud: invalid or missing URL to monitor for '". $site["name"] ."'");
+ watchdog("warning", "cloud: invalid or missing URL to monitor for '". $site["name"] ."'", l(t("edit site"), "admin/cloud/edit/". $site["sid"]));
}
/*
@@ -126,7 +126,7 @@ function cloud_display() {
$header = array(t("site"), t("last update"), array("data" => t("operations"), "colspan" => 2));
while ($site = db_fetch_object($result)) {
- $rows[] = array("<a href=\"$site->link\">$site->name</a>", ($site->timestamp ? format_interval(time() - $site->timestamp) ." ago" : "never"), la(t("edit site"), array("mod" => "cloud", "op" => "edit", "id" => $site->sid)), la(t("update site"), array("mod" => "cloud", "op" => "update", "id" => $site->sid)));
+ $rows[] = array("<a href=\"$site->link\">$site->name</a>", ($site->timestamp ? format_interval(time() - $site->timestamp) ." ago" : "never"), l(t("edit site"), "admin/cloud/edit/$site->sid"), l(t("update site"), "admin/cloud/update/$site->sid"));
}
return table($header, $rows);
@@ -176,13 +176,17 @@ function cloud_block($op = "list", $delta = 0) {
}
else {
$block["subject"] = t("Site cloud");
- $block["content"] = cloud_list(20) ."<br /><div align=\"right\">". lm(t("more"), array("mod" => "cloud"), "", array("title" => t("Monitor other sites in the cloud."))) ."</div>";
+ $block["content"] = cloud_list(20) ."<br /><div align=\"right\">". l(t("more"), "cloud", array("title" => t("Monitor other sites in the cloud."))) ."</div>";
return $block;
}
}
function cloud_admin() {
- global $op, $id, $edit;
+ global $op, $edit;
+
+ if (empty($op)) {
+ $op = arg(2);
+ }
if (user_access("administer site cloud")) {
switch ($op) {
@@ -190,10 +194,10 @@ function cloud_admin() {
print cloud_form();
break;
case "edit":
- print cloud_form(cloud_get_site($id));
+ print cloud_form(cloud_get_site(arg(3)));
break;
case "update":
- print status(cloud_update(cloud_get_site($id)));
+ print status(cloud_update(cloud_get_site(arg(3))));
print cloud_display();
break;
case "help":
diff --git a/modules/comment.module b/modules/comment.module
index 8ac83dde8..45a96c3c4 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -8,8 +8,8 @@ function comment_help() {
$output .= "<p>The comment module enables users to submit posts that are directly associated with a piece of content. These associated posts are called <i>comments</i>. Comments may be <i>threaded</i>, which means that Drupal keeps track of multiple subconversations around a piece of content. Threading helps to keep the comment conversation more organized. Users are presented with several ways to view the comment conversation, and if desired, users may easily choose a <i>flat</i> presentation of comments instead of threaded. Further, users may choose to order their comments view by <i>newest first</i> or by <i>oldest first</i>. Finally, users may view a folded list or an expanded list of comments. Folded limits the comment display to <i>subject</i> only. Drupal remembers the comment view preference of each registered user whenever he changes a view setting.</p>";
$output .= "<p>Users may also choose to view a maximum number of comments; if there are more comments, navigation links are dispayed.</p>";
$output .= "<p>Since a busy site generates lots of comments, Drupal takes care to present a personalized view of comments for each user. The home page lists displays the number of read and unread comments for a given post for the current user. Also, the tracker module (when installed) displays all recent comments on the site. Finally, comments which the user has not yet read are highlighted with a red star (this graphic may depend on the current theme).</p>";
- $output .= "<p>Comments behave like other user submissions in Drupal. Specifically, ". la("filters", array("mod" => "system", "type" => "filter")) ." like smileys and HTML work fine if the administrator has enabled them. Also, throttles are usually enabled to prevent a single user from spamming the web site with too many comments in a short period of time.</p>";
- $output .= "<p>Administrators may control which persons are allowed to submit and administer comments. These controls appear in the ". la("user permissions", array("mod" => "user", "op" => "permission")) ." administration page. Additionally, administrators may edit or search through comments on the ". la("comments admininistration page", array("mod" => "comment")) .", as well as set the default display view for new users. Administrators can also state whether a certain role will have their comments published immediately, or just put in a queue to be reviewed.</p>";
+ $output .= "<p>Comments behave like other user submissions in Drupal. Specifically, ". l("filters", "admin/system&type=filter") ." like smileys and HTML work fine if the administrator has enabled them. Also, throttles are usually enabled to prevent a single user from spamming the web site with too many comments in a short period of time.</p>";
+ $output .= "<p>Administrators may control which persons are allowed to submit and administer comments. These controls appear in the ". l("user permissions", "admin/user/permission") ." administration page. Additionally, administrators may edit or search through comments on the ". l("comments admininistration page", "admin/comment") .", as well as set the default display view for new users. Administrators can also state whether a certain role will have their comments published immediately, or just put in a queue to be reviewed.</p>";
$output .= "<p>If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some \"moderation votes\"; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater \"weight\" in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment thresholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site.</p>";
return $output;
@@ -107,7 +107,7 @@ function comment_form($edit) {
$form .= form_submit(t("Post comment"));
}
- return form($form, "post", drupal_url(array("mod" => "comment", "op" => "reply", "id" => $edit["nid"]), "module"));
+ return form($form, "post", url("comment/reply". $edit["nid"]));
}
function comment_edit($cid) {
@@ -249,7 +249,7 @@ function comment_post($edit) {
** Add entry to the watchdog log:
*/
- watchdog("special", "comment: updated '". $edit["subject"] ."'", l(t("view comment"), array("id" => $edit["nid"], "cid" => $edit["cid"])));
+ watchdog("special", "comment: updated '". $edit["subject"] ."'", l(t("view comment"), "node/view/". $edit["nid"] ."#". $edit["cid"]));
}
else {
/*
@@ -282,7 +282,7 @@ function comment_post($edit) {
** Add entry to the watchdog log:
*/
- watchdog("special", "comment: added '". $edit["subject"] ."'", l(t("view comment"), array("id" => $edit["nid"], "cid" => $edit["cid"])));
+ watchdog("special", "comment: added '". $edit["subject"] ."'", l(t("view comment"), "node/view/". $edit["nid"] ."#". $edit["cid"]));
}
/*
@@ -317,7 +317,7 @@ function comment_links($comment, $return = 1) {
*/
if ($return) {
- $links[] = l(t("parent"), array("id" => $comment->nid), "node", $comment->cid);
+ $links[] = l(t("parent"), "node/view/$comment->nid#$comment->cid");
}
/*
@@ -325,8 +325,7 @@ function comment_links($comment, $return = 1) {
*/
if (user_access("administer comments") && user_access("access administration pages")) {
- $links[] = la(t("administer"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid));
- // $links[] = lm(t("unpublish"), array ("mod" => "comment", "op" => "Moderate comment", "moderation[$comment->cid]" => "offline", "edit[nid]" => $comment->nid), "", array ("title" => t("hide this comment by marking it non-published")));
+ $links[] = l(t("administer"), "admin/comment/edit/$comment->cid");
}
/*
@@ -336,9 +335,9 @@ function comment_links($comment, $return = 1) {
if (node_comment_mode($comment->nid) == 2) {
if (user_access("post comments")) {
if (comment_access("edit", $comment)) {
- $links[] = lm(t("edit your comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid), "", array("title" => t("Make changes to your comment.")));
+ $links[] = l(t("edit your comment"), "comment/edit/$comment->cid", array("title" => t("Make changes to your comment.")));
}
- $links[] = lm(t("reply to this comment"), array("mod" => "comment", "op" => "reply", "id" => $comment->nid, "pid" => $comment->cid));
+ $links[] = l(t("reply to this comment"), "comment/reply/$comment->nid/$comment->cid");
}
else {
$links[] = theme_invoke("comment_post_forbidden");
@@ -415,7 +414,7 @@ function comment_render($node, $cid = 0) {
** Single comment view
*/
- print "<form method=\"post\" action=\"". drupal_url(array("mod" => "comment"), "module") ."\">\n";
+ print "<form method=\"post\" action=\"". url("comment") ."\">\n";
print form_hidden("nid", $nid);
$result = db_query("SELECT c.cid, c.pid, c.nid, c.subject, c.comment, c.timestamp, u.uid, u.name, u.data, c.score, c.users FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '%d' AND c.status = 0 GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.timestamp, u.uid, u.name, u.data, c.score, c.users", $cid);
@@ -458,13 +457,13 @@ function comment_render($node, $cid = 0) {
$comment_num = db_num_rows($result);
if ($comment_num && ((variable_get("comment_controls", 0) == 0) || (variable_get("comment_controls", 0) == 2))) {
- print "<form method=\"post\" action=\"". drupal_url(array("mod" => "comment"), "module") ."\">\n";
+ print "<form method=\"post\" action=\"". url("comment") ."\">\n";
$theme->box(t("Control panel"), theme_invoke("comment_controls", $threshold, $mode, $order, $nid, $comment_page, $comment_num, $comments_per_page));
print form_hidden("nid", $nid);
print "</form>";
}
- print "<form method=\"post\" action=\"". drupal_url(array("mod" => "comment"), "module") ."\">\n";
+ print "<form method=\"post\" action=\"". url("comment") ."\">\n";
print form_hidden("nid", $nid);
if ($comment_num) {
@@ -580,7 +579,7 @@ function comment_render($node, $cid = 0) {
print "</form>";
if ($comment_num && ((variable_get("comment_controls", 0) == 1) || (variable_get("comment_controls", 0) == 2))) {
- print "<form method=\"post\" action=\"". drupal_url(array("mod" => "comment"), "module") ."\">\n";
+ print "<form method=\"post\" action=\"". url("comment") ."\">\n";
$theme->box(t("Control panel"), theme_invoke("comment_controls", $threshold, $mode, $order, $nid, $comment_page, $comment_num, $comments_per_page));
print form_hidden("nid", $nid);
print "</form>";
@@ -622,15 +621,15 @@ function comment_link($type, $node = 0, $main = 0) {
$new = comment_num_new($node->nid); // array!
if ($all) {
- $links[] = l(format_plural($all, 'comment', 'comments'), array("id" => $node->nid), "node", "comment", array("title" => t('Jump to first comment of this posting.')));
+ $links[] = l(format_plural($all, "comment", "comments"), "node/view/$node->nid#comment", array("title" => t('Jump to first comment of this posting.')));
if ($new["count_new"]) {
- $links[] = l($new["count_new"] ." ". t("new"), array("id" => $node->nid), "node", $new["id_first_new"], array("title" => t('Jump to first NEW comment of this posting.')));
+ $links[] = l($new["count_new"] ." ". t("new"), "node/view/$node->nid#". $new["id_first_new"], array("title" => t('Jump to first NEW comment of this posting.')));
}
}
else {
if (user_access("post comments")) {
- $links[] = lm(t("add new comment"), array("mod" => "comment", "op" => "reply", "id" => $node->nid), "", array("title" => t("Add a new comment to this page.")));
+ $links[] = l(t("add new comment"), "comment/reply/$node->nid", array("title" => t("Add a new comment to this page.")));
}
else {
$links[] = theme_invoke("comment_post_forbidden");
@@ -646,7 +645,7 @@ function comment_link($type, $node = 0, $main = 0) {
if ($node->comment == 2) {
if (user_access("post comments")) {
- $links[] = lm(t("add new comment"), array("mod" => "comment", "op" => "reply", "id" => $node->nid), "comment", array("title" => t("Share your thoughts and opinions related to this posting.")));
+ $links[] = l(t("add new comment"), "comment/reply/$node->nid", array("title" => t("Share your thoughts and opinions related to this posting.")));
}
else {
$links[] = theme_invoke("comment_post_forbidden");
@@ -661,18 +660,18 @@ function comment_link($type, $node = 0, $main = 0) {
if ($type == "admin" && user_access("administer comments")) {
$settings = "If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some 'moderation votes'; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater 'weight' in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment thresholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site.";
- menu_add("comment management", "admin.php?mod=comment", "Administer comments.", $help["comment"], "content management", 1, 1);
- menu_add("new or updated comments", "admin.php?mod=comment&status=0", "Display new or updated comments.", NULL, "comment management");
- menu_add("comments that await approval", "admin.php?mod=comment&status=1", "Display comments that await approval.", NULL, "comment management");
- menu_add("search comment", "admin.php?mod=comment&op=search", "Search a comment.", NULL, "comment management", 8);
- menu_add("help", "admin.php?mod=comment&op=help", "More information about the comment system.", NULL, "comment management", 9);
+ menu_add("comment management", url("admin/comment"), "Administer comments.", $help["comment"], "content management", 1, 1);
+ menu_add("new or updated comments", url("admin/comment&status=0"), "Display new or updated comments.", NULL, "comment management");
+ menu_add("comments that await approval", url("admin/comment&status=1"), "Display comments that await approval.", NULL, "comment management");
+ menu_add("search comment", url("admin/comment/search"), "Search a comment.", NULL, "comment management", 8);
+ menu_add("help", url("admin/comment/help"), "More information about the comment system.", NULL, "comment management", 9);
// comment settings:
if (user_access("administer moderation")) {
- menu_add("comment moderation votes", "admin.php?mod=comment&op=votes", "Configure the comment moderation votes.", $settings, "site configuration", 5);
- menu_add("comment moderation matrix", "admin.php?mod=comment&op=matrix", "Configure the comment moderation matrix.", $settings, "site configuration", 5);
- menu_add("comment moderation thresholds", "admin.php?mod=comment&op=filters", "Configure the comment moderation thresholds.", $settings, "site configuration", 5);
- menu_add("initial comment scores", "admin.php?mod=comment&op=roles", "Configure the initial comment score.", $settings, "site configuration", 5);
+ menu_add("comment moderation votes", url("admin/comment/votes"), "Configure the comment moderation votes.", $settings, "site configuration", 5);
+ menu_add("comment moderation matrix", url("admin/comment/matrix"), "Configure the comment moderation matrix.", $settings, "site configuration", 5);
+ menu_add("comment moderation thresholds", url("admin/comment/filters"), "Configure the comment moderation thresholds.", $settings, "site configuration", 5);
+ menu_add("initial comment scores", url("admin/comment/roles"), "Configure the initial comment score.", $settings, "site configuration", 5);
}
}
@@ -680,22 +679,26 @@ function comment_link($type, $node = 0, $main = 0) {
}
function comment_page() {
- global $theme, $op, $edit, $id, $pid, $cid;
+ global $theme, $op, $edit;
+
+ if (empty($op)) {
+ $op = arg(1);
+ }
switch ($op) {
case "edit":
$theme->header();
- comment_edit(check_query($id));
+ comment_edit(check_query(arg(2)));
$theme->footer();
break;
case t("Moderate comments"):
case t("Moderate comment"):
comment_moderate($edit);
- drupal_goto(drupal_url(array("id" => $edit["nid"])));
+ drupal_goto("node/view/". $edit["nid"]);
break;
case "reply":
$theme->header();
- comment_reply(check_query($pid), check_query($id));
+ comment_reply(check_query(arg(3)), check_query(arg(2)));
$theme->footer();
break;
case t("Preview comment"):
@@ -711,13 +714,13 @@ function comment_page() {
$theme->footer();
}
else {
- drupal_goto(drupal_url(array("id" => $edit["nid"]), "node"));
+ drupal_goto(url("node/view/". $edit["nid"]));
}
break;
case t("Update settings"):
global $mode, $order, $threshold, $comments_per_page;
comment_settings(check_query($mode), check_query($order), check_query($threshold), check_query($comments_per_page));
- drupal_goto(drupal_url(array("id" => $edit["nid"], "mode" => $mode, "order" => $order, "threshold" => $threshold, "comments_per_page" => $comments_per_page), "node"));
+ drupal_goto(url("node/view/". $edit["nid"], "mode=$mode&order=$order&threshold=$threshold&comments_per_page=$comments_per_page"));
break;
}
}
@@ -741,7 +744,7 @@ function comment_node_link($node) {
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
while ($comment = db_fetch_object($result)) {
- $output .= "<tr><td>". l($comment->subject, array("id" => $node->nid, "cid" => $comment->cid), "node", $comment->cid) ."</td><td>". format_name($comment) ."</td><td>". l(t("view comment"), array("id" => $node->nid, "cid" => $comment->cid), "node", $comment->cid) ."</td><td>". la(t("edit comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid)) ."</td><td>". la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid)) ."</td></tr>";
+ $output .= "<tr><td>". l($comment->subject, "node/view/$node->nid#$comment->cid") ."</td><td>". format_name($comment) ."</td><td>". l(t("view comment"), "node/view/$node->nid#$comment->cid") ."</td><td>". l(t("edit comment"), "admin/comment/edit/$comment->cid") ."</td><td>". l(t("delete comment"), "admin/comment/delete/$comment->cid") ."</td></tr>";
}
$output .= "</table>";
@@ -774,7 +777,7 @@ function comment_delete($edit) {
if ($edit["confirm"]) {
db_query("UPDATE comments SET status = 2 WHERE cid = '%d'", $edit["cid"]);
watchdog("special", "comment: deleted comment #". $edit["cid"]);
- $output = "Comment deleted.";
+ $output = "deleted comment.";
}
else {
$output .= form_item(t("Confirm deletion"), "");
@@ -790,7 +793,7 @@ function comment_delete($edit) {
function comment_save($id, $edit) {
db_query("UPDATE comments SET subject = '%s', comment = '%s', status = '%s' WHERE cid = '%d'", filter($edit["subject"]), filter($edit["comment"]), $edit["status"], $id);
watchdog("special", "comment: modified '". $edit["subject"] ."'");
- return "Comment updated.";
+ return "updated comment.";
}
function comment_admin_overview($status = 0) {
@@ -799,7 +802,7 @@ function comment_admin_overview($status = 0) {
$header = array(t("subject"), t("author"), t("status"), array("data" => t("operations"), "colspan" => 2));
while ($comment = db_fetch_object($result)) {
- $rows[] = array(l($comment->subject, array("id" => $comment->nid, "cid" => $comment->cid, "pid" => $comment->pid), "node", $comment->cid, array("title" => htmlentities(substr($comment->comment, 0, 128)))) ." ". (comment_is_new($comment) ? theme_mark() : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."</td><td>". la(t("edit comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid)), la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid)));
+ $rows[] = array(l($comment->subject, "node/view/$comment->nid/$comment->cid#$comment->cid", array("title" => htmlentities(substr($comment->comment, 0, 128)))) ." ". (comment_is_new($comment) ? theme_mark() : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."</td><td>". l(t("edit comment"), "admin/comment/edit/$comment->cid"), l(t("delete comment"), "admin/comment/delete/$comment->cid"));
}
if ($pager = pager_display(NULL, 50, 0, "admin")) {
@@ -904,7 +907,7 @@ function comment_mod_votes($edit) {
$result = db_query("SELECT mid, vote, weight FROM moderation_votes ORDER BY weight");
while ($vote = db_fetch_object($result)) {
- $output .= " <tr><td>$vote->vote</td><td align=\"center\">$vote->weight</td><td align=\"center\">". la(t("edit"), array("mod" => "comment", "op" => "votes", "mid" => $vote->mid)) ."</td></tr>";
+ $output .= " <tr><td>$vote->vote</td><td align=\"center\">$vote->weight</td><td align=\"center\">". l(t("edit"), "admin/comment/votes/$vote->mid") ."</td></tr>";
}
$output .= "</table>";
@@ -951,7 +954,7 @@ function comment_mod_filters($edit) {
$result = db_query("SELECT fid, filter, minimum FROM moderation_filters ORDER BY minimum");
while ($filter = db_fetch_object($result)) {
- $output .= " <tr><td>$filter->filter</td><td align=\"center\">$filter->minimum</td><td align=\"center\">". la(t("edit"), array("mod" => "comment", "op" => "filters", "fid" => $filter->fid)) ."</td></tr>";
+ $output .= " <tr><td>$filter->filter</td><td align=\"center\">$filter->minimum</td><td align=\"center\">". l(t("edit"), "admin/comment/filters/$filter->fid") ."</td></tr>";
}
$output .= "</table>";
@@ -979,16 +982,20 @@ function comment_mod_filters($edit) {
function comment_admin() {
global $op, $id, $edit, $mod, $keys, $order, $status, $comment_page, $comment_settings;
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
if (user_access("administer comments")) {
switch ($op) {
case "help":
print comment_help();
break;
case "edit":
- print comment_admin_edit($id);
+ print comment_admin_edit(arg(3));
break;
case "search":
- print search_type("comment", drupal_url(array("mod" => "comment", "op" => "search"), "admin"));
+ print search_type("comment", url("admin/comment/search"));
break;
case "votes":
case t("Add new vote"):
@@ -1019,7 +1026,7 @@ function comment_admin() {
}
break;
case "delete":
- print comment_delete(array("cid" => $id));
+ print comment_delete(array("cid" => arg(3)));
break;
case t("Delete"):
print status(comment_delete($edit));
@@ -1030,7 +1037,7 @@ function comment_admin() {
print comment_admin_overview($status, $comment_page);
break;
case t("Submit"):
- print status(comment_save(check_query($id), $edit));
+ print status(comment_save(check_query(arg(3)), $edit));
if (session_is_registered("comment_settings")) {
$status = $comment_settings["status"];
$comment_page = $comment_settings["comment_page"];
@@ -1104,13 +1111,13 @@ function comment_controls($threshold = 1, $mode = 3, $order = 1, $nid, $page = 0
if (($mode == 2 || $mode == 4) && $comment_num > $comments_per_page) {
if ($page > 1) {
- $p[] = l(t("previous"), array("id" => $nid, "comment_page" => $page - 1));
+ $p[] = l(t("previous"), "node/view/$nid&comment_page=". $page - 1);
}
for ($n = 1; $n <= ceil($comment_num / $comments_per_page); $n++) {
- $p[] = ($n == $page) ? "<b>&raquo;$n&laquo;</b>" : l($n, array("id" => $nid, "comment_page" => $n));
+ $p[] = ($n == $page) ? "<b>&raquo;$n&laquo;</b>" : l($n, "node/view/$nid&comment_page=$n");
}
if ($page < ceil($comment_num / $comments_per_page)) {
- $p[] = l(t("next"), array("id" => $nid, "comment_page" => $page + 1));
+ $p[] = l(t("next"), "node/view/$nid&comment_page". $page + 1);
}
$output .= form_item(t("Browse %a comments", array("%a" => $comment_num)), implode("&nbsp;&#149;&nbsp;", $p), t("There are more than %a comments in this node. Use these links to navigate through them.", array("%a" => $comments_per_page)));
}
@@ -1167,7 +1174,7 @@ function comment($comment, $link = 0) {
}
function comment_folded($comment) {
- print l($comment->subject, array("id" => $comment->nid, "cid" => $comment->cid), "node", $comment->cid) ." ". t("by") . " " . format_name($comment) ."</small><p />";
+ print l($comment->subject, "node/view/$comment->nid/$comment->cid#$comment->cid") ." ". t("by") . " " . format_name($comment) ."</small><p />";
}
function comment_flat_collapsed($comments, $threshold) {
@@ -1229,7 +1236,7 @@ function comment_post_forbidden() {
return t("You can't post comments.");
}
else {
- return t("Please %a, or %b, to add comments.", array("%a" => lm(t("login"), array("mod" => "user")), "%b" => lm(t("register"), array("mod" => "user", "op" => "register"))));
+ return t("Please %login, or %register, to add comments.", array("%login" => l(t("login"), "user/login"), "%register" => l(t("register"), "user/register")));
}
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 8ac83dde8..45a96c3c4 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -8,8 +8,8 @@ function comment_help() {
$output .= "<p>The comment module enables users to submit posts that are directly associated with a piece of content. These associated posts are called <i>comments</i>. Comments may be <i>threaded</i>, which means that Drupal keeps track of multiple subconversations around a piece of content. Threading helps to keep the comment conversation more organized. Users are presented with several ways to view the comment conversation, and if desired, users may easily choose a <i>flat</i> presentation of comments instead of threaded. Further, users may choose to order their comments view by <i>newest first</i> or by <i>oldest first</i>. Finally, users may view a folded list or an expanded list of comments. Folded limits the comment display to <i>subject</i> only. Drupal remembers the comment view preference of each registered user whenever he changes a view setting.</p>";
$output .= "<p>Users may also choose to view a maximum number of comments; if there are more comments, navigation links are dispayed.</p>";
$output .= "<p>Since a busy site generates lots of comments, Drupal takes care to present a personalized view of comments for each user. The home page lists displays the number of read and unread comments for a given post for the current user. Also, the tracker module (when installed) displays all recent comments on the site. Finally, comments which the user has not yet read are highlighted with a red star (this graphic may depend on the current theme).</p>";
- $output .= "<p>Comments behave like other user submissions in Drupal. Specifically, ". la("filters", array("mod" => "system", "type" => "filter")) ." like smileys and HTML work fine if the administrator has enabled them. Also, throttles are usually enabled to prevent a single user from spamming the web site with too many comments in a short period of time.</p>";
- $output .= "<p>Administrators may control which persons are allowed to submit and administer comments. These controls appear in the ". la("user permissions", array("mod" => "user", "op" => "permission")) ." administration page. Additionally, administrators may edit or search through comments on the ". la("comments admininistration page", array("mod" => "comment")) .", as well as set the default display view for new users. Administrators can also state whether a certain role will have their comments published immediately, or just put in a queue to be reviewed.</p>";
+ $output .= "<p>Comments behave like other user submissions in Drupal. Specifically, ". l("filters", "admin/system&type=filter") ." like smileys and HTML work fine if the administrator has enabled them. Also, throttles are usually enabled to prevent a single user from spamming the web site with too many comments in a short period of time.</p>";
+ $output .= "<p>Administrators may control which persons are allowed to submit and administer comments. These controls appear in the ". l("user permissions", "admin/user/permission") ." administration page. Additionally, administrators may edit or search through comments on the ". l("comments admininistration page", "admin/comment") .", as well as set the default display view for new users. Administrators can also state whether a certain role will have their comments published immediately, or just put in a queue to be reviewed.</p>";
$output .= "<p>If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some \"moderation votes\"; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater \"weight\" in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment thresholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site.</p>";
return $output;
@@ -107,7 +107,7 @@ function comment_form($edit) {
$form .= form_submit(t("Post comment"));
}
- return form($form, "post", drupal_url(array("mod" => "comment", "op" => "reply", "id" => $edit["nid"]), "module"));
+ return form($form, "post", url("comment/reply". $edit["nid"]));
}
function comment_edit($cid) {
@@ -249,7 +249,7 @@ function comment_post($edit) {
** Add entry to the watchdog log:
*/
- watchdog("special", "comment: updated '". $edit["subject"] ."'", l(t("view comment"), array("id" => $edit["nid"], "cid" => $edit["cid"])));
+ watchdog("special", "comment: updated '". $edit["subject"] ."'", l(t("view comment"), "node/view/". $edit["nid"] ."#". $edit["cid"]));
}
else {
/*
@@ -282,7 +282,7 @@ function comment_post($edit) {
** Add entry to the watchdog log:
*/
- watchdog("special", "comment: added '". $edit["subject"] ."'", l(t("view comment"), array("id" => $edit["nid"], "cid" => $edit["cid"])));
+ watchdog("special", "comment: added '". $edit["subject"] ."'", l(t("view comment"), "node/view/". $edit["nid"] ."#". $edit["cid"]));
}
/*
@@ -317,7 +317,7 @@ function comment_links($comment, $return = 1) {
*/
if ($return) {
- $links[] = l(t("parent"), array("id" => $comment->nid), "node", $comment->cid);
+ $links[] = l(t("parent"), "node/view/$comment->nid#$comment->cid");
}
/*
@@ -325,8 +325,7 @@ function comment_links($comment, $return = 1) {
*/
if (user_access("administer comments") && user_access("access administration pages")) {
- $links[] = la(t("administer"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid));
- // $links[] = lm(t("unpublish"), array ("mod" => "comment", "op" => "Moderate comment", "moderation[$comment->cid]" => "offline", "edit[nid]" => $comment->nid), "", array ("title" => t("hide this comment by marking it non-published")));
+ $links[] = l(t("administer"), "admin/comment/edit/$comment->cid");
}
/*
@@ -336,9 +335,9 @@ function comment_links($comment, $return = 1) {
if (node_comment_mode($comment->nid) == 2) {
if (user_access("post comments")) {
if (comment_access("edit", $comment)) {
- $links[] = lm(t("edit your comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid), "", array("title" => t("Make changes to your comment.")));
+ $links[] = l(t("edit your comment"), "comment/edit/$comment->cid", array("title" => t("Make changes to your comment.")));
}
- $links[] = lm(t("reply to this comment"), array("mod" => "comment", "op" => "reply", "id" => $comment->nid, "pid" => $comment->cid));
+ $links[] = l(t("reply to this comment"), "comment/reply/$comment->nid/$comment->cid");
}
else {
$links[] = theme_invoke("comment_post_forbidden");
@@ -415,7 +414,7 @@ function comment_render($node, $cid = 0) {
** Single comment view
*/
- print "<form method=\"post\" action=\"". drupal_url(array("mod" => "comment"), "module") ."\">\n";
+ print "<form method=\"post\" action=\"". url("comment") ."\">\n";
print form_hidden("nid", $nid);
$result = db_query("SELECT c.cid, c.pid, c.nid, c.subject, c.comment, c.timestamp, u.uid, u.name, u.data, c.score, c.users FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '%d' AND c.status = 0 GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.timestamp, u.uid, u.name, u.data, c.score, c.users", $cid);
@@ -458,13 +457,13 @@ function comment_render($node, $cid = 0) {
$comment_num = db_num_rows($result);
if ($comment_num && ((variable_get("comment_controls", 0) == 0) || (variable_get("comment_controls", 0) == 2))) {
- print "<form method=\"post\" action=\"". drupal_url(array("mod" => "comment"), "module") ."\">\n";
+ print "<form method=\"post\" action=\"". url("comment") ."\">\n";
$theme->box(t("Control panel"), theme_invoke("comment_controls", $threshold, $mode, $order, $nid, $comment_page, $comment_num, $comments_per_page));
print form_hidden("nid", $nid);
print "</form>";
}
- print "<form method=\"post\" action=\"". drupal_url(array("mod" => "comment"), "module") ."\">\n";
+ print "<form method=\"post\" action=\"". url("comment") ."\">\n";
print form_hidden("nid", $nid);
if ($comment_num) {
@@ -580,7 +579,7 @@ function comment_render($node, $cid = 0) {
print "</form>";
if ($comment_num && ((variable_get("comment_controls", 0) == 1) || (variable_get("comment_controls", 0) == 2))) {
- print "<form method=\"post\" action=\"". drupal_url(array("mod" => "comment"), "module") ."\">\n";
+ print "<form method=\"post\" action=\"". url("comment") ."\">\n";
$theme->box(t("Control panel"), theme_invoke("comment_controls", $threshold, $mode, $order, $nid, $comment_page, $comment_num, $comments_per_page));
print form_hidden("nid", $nid);
print "</form>";
@@ -622,15 +621,15 @@ function comment_link($type, $node = 0, $main = 0) {
$new = comment_num_new($node->nid); // array!
if ($all) {
- $links[] = l(format_plural($all, 'comment', 'comments'), array("id" => $node->nid), "node", "comment", array("title" => t('Jump to first comment of this posting.')));
+ $links[] = l(format_plural($all, "comment", "comments"), "node/view/$node->nid#comment", array("title" => t('Jump to first comment of this posting.')));
if ($new["count_new"]) {
- $links[] = l($new["count_new"] ." ". t("new"), array("id" => $node->nid), "node", $new["id_first_new"], array("title" => t('Jump to first NEW comment of this posting.')));
+ $links[] = l($new["count_new"] ." ". t("new"), "node/view/$node->nid#". $new["id_first_new"], array("title" => t('Jump to first NEW comment of this posting.')));
}
}
else {
if (user_access("post comments")) {
- $links[] = lm(t("add new comment"), array("mod" => "comment", "op" => "reply", "id" => $node->nid), "", array("title" => t("Add a new comment to this page.")));
+ $links[] = l(t("add new comment"), "comment/reply/$node->nid", array("title" => t("Add a new comment to this page.")));
}
else {
$links[] = theme_invoke("comment_post_forbidden");
@@ -646,7 +645,7 @@ function comment_link($type, $node = 0, $main = 0) {
if ($node->comment == 2) {
if (user_access("post comments")) {
- $links[] = lm(t("add new comment"), array("mod" => "comment", "op" => "reply", "id" => $node->nid), "comment", array("title" => t("Share your thoughts and opinions related to this posting.")));
+ $links[] = l(t("add new comment"), "comment/reply/$node->nid", array("title" => t("Share your thoughts and opinions related to this posting.")));
}
else {
$links[] = theme_invoke("comment_post_forbidden");
@@ -661,18 +660,18 @@ function comment_link($type, $node = 0, $main = 0) {
if ($type == "admin" && user_access("administer comments")) {
$settings = "If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some 'moderation votes'; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater 'weight' in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment thresholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site.";
- menu_add("comment management", "admin.php?mod=comment", "Administer comments.", $help["comment"], "content management", 1, 1);
- menu_add("new or updated comments", "admin.php?mod=comment&status=0", "Display new or updated comments.", NULL, "comment management");
- menu_add("comments that await approval", "admin.php?mod=comment&status=1", "Display comments that await approval.", NULL, "comment management");
- menu_add("search comment", "admin.php?mod=comment&op=search", "Search a comment.", NULL, "comment management", 8);
- menu_add("help", "admin.php?mod=comment&op=help", "More information about the comment system.", NULL, "comment management", 9);
+ menu_add("comment management", url("admin/comment"), "Administer comments.", $help["comment"], "content management", 1, 1);
+ menu_add("new or updated comments", url("admin/comment&status=0"), "Display new or updated comments.", NULL, "comment management");
+ menu_add("comments that await approval", url("admin/comment&status=1"), "Display comments that await approval.", NULL, "comment management");
+ menu_add("search comment", url("admin/comment/search"), "Search a comment.", NULL, "comment management", 8);
+ menu_add("help", url("admin/comment/help"), "More information about the comment system.", NULL, "comment management", 9);
// comment settings:
if (user_access("administer moderation")) {
- menu_add("comment moderation votes", "admin.php?mod=comment&op=votes", "Configure the comment moderation votes.", $settings, "site configuration", 5);
- menu_add("comment moderation matrix", "admin.php?mod=comment&op=matrix", "Configure the comment moderation matrix.", $settings, "site configuration", 5);
- menu_add("comment moderation thresholds", "admin.php?mod=comment&op=filters", "Configure the comment moderation thresholds.", $settings, "site configuration", 5);
- menu_add("initial comment scores", "admin.php?mod=comment&op=roles", "Configure the initial comment score.", $settings, "site configuration", 5);
+ menu_add("comment moderation votes", url("admin/comment/votes"), "Configure the comment moderation votes.", $settings, "site configuration", 5);
+ menu_add("comment moderation matrix", url("admin/comment/matrix"), "Configure the comment moderation matrix.", $settings, "site configuration", 5);
+ menu_add("comment moderation thresholds", url("admin/comment/filters"), "Configure the comment moderation thresholds.", $settings, "site configuration", 5);
+ menu_add("initial comment scores", url("admin/comment/roles"), "Configure the initial comment score.", $settings, "site configuration", 5);
}
}
@@ -680,22 +679,26 @@ function comment_link($type, $node = 0, $main = 0) {
}
function comment_page() {
- global $theme, $op, $edit, $id, $pid, $cid;
+ global $theme, $op, $edit;
+
+ if (empty($op)) {
+ $op = arg(1);
+ }
switch ($op) {
case "edit":
$theme->header();
- comment_edit(check_query($id));
+ comment_edit(check_query(arg(2)));
$theme->footer();
break;
case t("Moderate comments"):
case t("Moderate comment"):
comment_moderate($edit);
- drupal_goto(drupal_url(array("id" => $edit["nid"])));
+ drupal_goto("node/view/". $edit["nid"]);
break;
case "reply":
$theme->header();
- comment_reply(check_query($pid), check_query($id));
+ comment_reply(check_query(arg(3)), check_query(arg(2)));
$theme->footer();
break;
case t("Preview comment"):
@@ -711,13 +714,13 @@ function comment_page() {
$theme->footer();
}
else {
- drupal_goto(drupal_url(array("id" => $edit["nid"]), "node"));
+ drupal_goto(url("node/view/". $edit["nid"]));
}
break;
case t("Update settings"):
global $mode, $order, $threshold, $comments_per_page;
comment_settings(check_query($mode), check_query($order), check_query($threshold), check_query($comments_per_page));
- drupal_goto(drupal_url(array("id" => $edit["nid"], "mode" => $mode, "order" => $order, "threshold" => $threshold, "comments_per_page" => $comments_per_page), "node"));
+ drupal_goto(url("node/view/". $edit["nid"], "mode=$mode&order=$order&threshold=$threshold&comments_per_page=$comments_per_page"));
break;
}
}
@@ -741,7 +744,7 @@ function comment_node_link($node) {
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
while ($comment = db_fetch_object($result)) {
- $output .= "<tr><td>". l($comment->subject, array("id" => $node->nid, "cid" => $comment->cid), "node", $comment->cid) ."</td><td>". format_name($comment) ."</td><td>". l(t("view comment"), array("id" => $node->nid, "cid" => $comment->cid), "node", $comment->cid) ."</td><td>". la(t("edit comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid)) ."</td><td>". la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid)) ."</td></tr>";
+ $output .= "<tr><td>". l($comment->subject, "node/view/$node->nid#$comment->cid") ."</td><td>". format_name($comment) ."</td><td>". l(t("view comment"), "node/view/$node->nid#$comment->cid") ."</td><td>". l(t("edit comment"), "admin/comment/edit/$comment->cid") ."</td><td>". l(t("delete comment"), "admin/comment/delete/$comment->cid") ."</td></tr>";
}
$output .= "</table>";
@@ -774,7 +777,7 @@ function comment_delete($edit) {
if ($edit["confirm"]) {
db_query("UPDATE comments SET status = 2 WHERE cid = '%d'", $edit["cid"]);
watchdog("special", "comment: deleted comment #". $edit["cid"]);
- $output = "Comment deleted.";
+ $output = "deleted comment.";
}
else {
$output .= form_item(t("Confirm deletion"), "");
@@ -790,7 +793,7 @@ function comment_delete($edit) {
function comment_save($id, $edit) {
db_query("UPDATE comments SET subject = '%s', comment = '%s', status = '%s' WHERE cid = '%d'", filter($edit["subject"]), filter($edit["comment"]), $edit["status"], $id);
watchdog("special", "comment: modified '". $edit["subject"] ."'");
- return "Comment updated.";
+ return "updated comment.";
}
function comment_admin_overview($status = 0) {
@@ -799,7 +802,7 @@ function comment_admin_overview($status = 0) {
$header = array(t("subject"), t("author"), t("status"), array("data" => t("operations"), "colspan" => 2));
while ($comment = db_fetch_object($result)) {
- $rows[] = array(l($comment->subject, array("id" => $comment->nid, "cid" => $comment->cid, "pid" => $comment->pid), "node", $comment->cid, array("title" => htmlentities(substr($comment->comment, 0, 128)))) ." ". (comment_is_new($comment) ? theme_mark() : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."</td><td>". la(t("edit comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid)), la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid)));
+ $rows[] = array(l($comment->subject, "node/view/$comment->nid/$comment->cid#$comment->cid", array("title" => htmlentities(substr($comment->comment, 0, 128)))) ." ". (comment_is_new($comment) ? theme_mark() : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."</td><td>". l(t("edit comment"), "admin/comment/edit/$comment->cid"), l(t("delete comment"), "admin/comment/delete/$comment->cid"));
}
if ($pager = pager_display(NULL, 50, 0, "admin")) {
@@ -904,7 +907,7 @@ function comment_mod_votes($edit) {
$result = db_query("SELECT mid, vote, weight FROM moderation_votes ORDER BY weight");
while ($vote = db_fetch_object($result)) {
- $output .= " <tr><td>$vote->vote</td><td align=\"center\">$vote->weight</td><td align=\"center\">". la(t("edit"), array("mod" => "comment", "op" => "votes", "mid" => $vote->mid)) ."</td></tr>";
+ $output .= " <tr><td>$vote->vote</td><td align=\"center\">$vote->weight</td><td align=\"center\">". l(t("edit"), "admin/comment/votes/$vote->mid") ."</td></tr>";
}
$output .= "</table>";
@@ -951,7 +954,7 @@ function comment_mod_filters($edit) {
$result = db_query("SELECT fid, filter, minimum FROM moderation_filters ORDER BY minimum");
while ($filter = db_fetch_object($result)) {
- $output .= " <tr><td>$filter->filter</td><td align=\"center\">$filter->minimum</td><td align=\"center\">". la(t("edit"), array("mod" => "comment", "op" => "filters", "fid" => $filter->fid)) ."</td></tr>";
+ $output .= " <tr><td>$filter->filter</td><td align=\"center\">$filter->minimum</td><td align=\"center\">". l(t("edit"), "admin/comment/filters/$filter->fid") ."</td></tr>";
}
$output .= "</table>";
@@ -979,16 +982,20 @@ function comment_mod_filters($edit) {
function comment_admin() {
global $op, $id, $edit, $mod, $keys, $order, $status, $comment_page, $comment_settings;
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
if (user_access("administer comments")) {
switch ($op) {
case "help":
print comment_help();
break;
case "edit":
- print comment_admin_edit($id);
+ print comment_admin_edit(arg(3));
break;
case "search":
- print search_type("comment", drupal_url(array("mod" => "comment", "op" => "search"), "admin"));
+ print search_type("comment", url("admin/comment/search"));
break;
case "votes":
case t("Add new vote"):
@@ -1019,7 +1026,7 @@ function comment_admin() {
}
break;
case "delete":
- print comment_delete(array("cid" => $id));
+ print comment_delete(array("cid" => arg(3)));
break;
case t("Delete"):
print status(comment_delete($edit));
@@ -1030,7 +1037,7 @@ function comment_admin() {
print comment_admin_overview($status, $comment_page);
break;
case t("Submit"):
- print status(comment_save(check_query($id), $edit));
+ print status(comment_save(check_query(arg(3)), $edit));
if (session_is_registered("comment_settings")) {
$status = $comment_settings["status"];
$comment_page = $comment_settings["comment_page"];
@@ -1104,13 +1111,13 @@ function comment_controls($threshold = 1, $mode = 3, $order = 1, $nid, $page = 0
if (($mode == 2 || $mode == 4) && $comment_num > $comments_per_page) {
if ($page > 1) {
- $p[] = l(t("previous"), array("id" => $nid, "comment_page" => $page - 1));
+ $p[] = l(t("previous"), "node/view/$nid&comment_page=". $page - 1);
}
for ($n = 1; $n <= ceil($comment_num / $comments_per_page); $n++) {
- $p[] = ($n == $page) ? "<b>&raquo;$n&laquo;</b>" : l($n, array("id" => $nid, "comment_page" => $n));
+ $p[] = ($n == $page) ? "<b>&raquo;$n&laquo;</b>" : l($n, "node/view/$nid&comment_page=$n");
}
if ($page < ceil($comment_num / $comments_per_page)) {
- $p[] = l(t("next"), array("id" => $nid, "comment_page" => $page + 1));
+ $p[] = l(t("next"), "node/view/$nid&comment_page". $page + 1);
}
$output .= form_item(t("Browse %a comments", array("%a" => $comment_num)), implode("&nbsp;&#149;&nbsp;", $p), t("There are more than %a comments in this node. Use these links to navigate through them.", array("%a" => $comments_per_page)));
}
@@ -1167,7 +1174,7 @@ function comment($comment, $link = 0) {
}
function comment_folded($comment) {
- print l($comment->subject, array("id" => $comment->nid, "cid" => $comment->cid), "node", $comment->cid) ." ". t("by") . " " . format_name($comment) ."</small><p />";
+ print l($comment->subject, "node/view/$comment->nid/$comment->cid#$comment->cid") ." ". t("by") . " " . format_name($comment) ."</small><p />";
}
function comment_flat_collapsed($comments, $threshold) {
@@ -1229,7 +1236,7 @@ function comment_post_forbidden() {
return t("You can't post comments.");
}
else {
- return t("Please %a, or %b, to add comments.", array("%a" => lm(t("login"), array("mod" => "user")), "%b" => lm(t("register"), array("mod" => "user", "op" => "register"))));
+ return t("Please %login, or %register, to add comments.", array("%login" => l(t("login"), "user/login"), "%register" => l(t("register"), "user/register")));
}
}
diff --git a/modules/drupal.module b/modules/drupal.module
index 01d47a1cc..5ddbcd60a 100644
--- a/modules/drupal.module
+++ b/modules/drupal.module
@@ -4,9 +4,9 @@
function drupal_help_directory() {
?>
<p>The "drupal" module features a capability whereby other drupal sites may <i>call home</i> to report their existence. In turn, this enables a pod of Drupal sites to find, cooperate and advertise each other.</p>
- <p>Currently, the main application of this feature is the <a href="http://www.drupal.org/node.php?id=3">Drupal sites page</a>. By default, fresh Drupal installations can use <a href="http://www.drupal.org/">drupal.org</a> as their <i>directory server</i> and report their existence. This reporting occurs via scheduled <a href="http://www.xmlrpc.com/">XML-RPC</a> pings.</p>
- <p>Drupal administrators should simply enable this feature to get listed on the <a href="http://www.drupal.org/node.php?id=3">Drupal sites page</a>; just set your site's name, e-mail address, slogan and mission statement. Then make sure that the field called <i>Drupal XML-RPC server</i> on the <i>site settings</i> tab of the <i>site configuration</i> page is set to http://www.drupal.org/xmlrpc.php. Also, make sure you enable this feature using the checkbox directly below.</p>
- <p>The listing of your site will occur shortly after your site's next <a href="admin.php?mod=system&op=help">cron run</a>. Note that cron.php should be called using the domain name which you want to have listed at <a href="http://www.drupal.org/">drupal.org</a>. For example, don't kick off cron by requesting http://127.0.0.1/cron.php. Instead, use a publicly accessible domain name such as http:// www.mydomain.org/cron.php.</p>
+ <p>Currently, the main application of this feature is the <a href="http://www.drupal.org/node/view/3">Drupal sites page</a>. By default, fresh Drupal installations can use <a href="http://www.drupal.org/">drupal.org</a> as their <i>directory server</i> and report their existence. This reporting occurs via scheduled <a href="http://www.xmlrpc.com/">XML-RPC</a> pings.</p>
+ <p>Drupal administrators should simply enable this feature to get listed on the <a href="http://www.drupal.org/node/view/3">Drupal sites page</a>; just set your site's name, e-mail address, slogan and mission statement. Then make sure that the field called <i>Drupal XML-RPC server</i> on the <i>site settings</i> tab of the <i>site configuration</i> page is set to http://www.drupal.org/xmlrpc.php. Also, make sure you enable this feature using the checkbox directly below.</p>
+ <p>The listing of your site will occur shortly after your site's next ". l("cron run", "admin/system/help") .". Note that cron.php should be called using the domain name which you want to have listed at <a href="http://www.drupal.org/">drupal.org</a>. For example, don't kick off cron by requesting http://127.0.0.1/cron.php. Instead, use a publicly accessible domain name such as http:// www.mydomain.org/cron.php.</p>
<p>Also note that your installation need not use drupal.org as its directory server. For example, this feature is perfectly capable of aggregating pings from all of your departmental drupal installations sites within an enterprise.</p>
<?php
}
diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module
index 01d47a1cc..5ddbcd60a 100644
--- a/modules/drupal/drupal.module
+++ b/modules/drupal/drupal.module
@@ -4,9 +4,9 @@
function drupal_help_directory() {
?>
<p>The "drupal" module features a capability whereby other drupal sites may <i>call home</i> to report their existence. In turn, this enables a pod of Drupal sites to find, cooperate and advertise each other.</p>
- <p>Currently, the main application of this feature is the <a href="http://www.drupal.org/node.php?id=3">Drupal sites page</a>. By default, fresh Drupal installations can use <a href="http://www.drupal.org/">drupal.org</a> as their <i>directory server</i> and report their existence. This reporting occurs via scheduled <a href="http://www.xmlrpc.com/">XML-RPC</a> pings.</p>
- <p>Drupal administrators should simply enable this feature to get listed on the <a href="http://www.drupal.org/node.php?id=3">Drupal sites page</a>; just set your site's name, e-mail address, slogan and mission statement. Then make sure that the field called <i>Drupal XML-RPC server</i> on the <i>site settings</i> tab of the <i>site configuration</i> page is set to http://www.drupal.org/xmlrpc.php. Also, make sure you enable this feature using the checkbox directly below.</p>
- <p>The listing of your site will occur shortly after your site's next <a href="admin.php?mod=system&op=help">cron run</a>. Note that cron.php should be called using the domain name which you want to have listed at <a href="http://www.drupal.org/">drupal.org</a>. For example, don't kick off cron by requesting http://127.0.0.1/cron.php. Instead, use a publicly accessible domain name such as http:// www.mydomain.org/cron.php.</p>
+ <p>Currently, the main application of this feature is the <a href="http://www.drupal.org/node/view/3">Drupal sites page</a>. By default, fresh Drupal installations can use <a href="http://www.drupal.org/">drupal.org</a> as their <i>directory server</i> and report their existence. This reporting occurs via scheduled <a href="http://www.xmlrpc.com/">XML-RPC</a> pings.</p>
+ <p>Drupal administrators should simply enable this feature to get listed on the <a href="http://www.drupal.org/node/view/3">Drupal sites page</a>; just set your site's name, e-mail address, slogan and mission statement. Then make sure that the field called <i>Drupal XML-RPC server</i> on the <i>site settings</i> tab of the <i>site configuration</i> page is set to http://www.drupal.org/xmlrpc.php. Also, make sure you enable this feature using the checkbox directly below.</p>
+ <p>The listing of your site will occur shortly after your site's next ". l("cron run", "admin/system/help") .". Note that cron.php should be called using the domain name which you want to have listed at <a href="http://www.drupal.org/">drupal.org</a>. For example, don't kick off cron by requesting http://127.0.0.1/cron.php. Instead, use a publicly accessible domain name such as http:// www.mydomain.org/cron.php.</p>
<p>Also note that your installation need not use drupal.org as its directory server. For example, this feature is perfectly capable of aggregating pings from all of your departmental drupal installations sites within an enterprise.</p>
<?php
}
diff --git a/modules/forum.module b/modules/forum.module
index 87cd82db3..f1d507e3f 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -46,7 +46,7 @@ function forum_conf_options() {
$output .= form_select("Topics per page", "forum_per_page", variable_get("forum_per_page", 25), $number, "The default number of topics displayed per page; links to browse older messages are automatically being displayed.");
$forder = array(1 => "Date - newest first", 2 => "Date - oldest first", 3 => "Posts - most active first", 4=> "Posts - least active first");
$output .= form_select("Default order", "forum_order", variable_get("forum_order", 1), $forder, "The default display order for topics.");
- $output .= form_textfield("Number of topics in block", "forum_block_num", variable_get("forum_block_num", "5"), 5, 5, "The number of topics in the <b>Forum topics</b>-block. To enable the block, click ". la("here", array("mod" => "block")) .".");
+ $output .= form_textfield("Number of topics in block", "forum_block_num", variable_get("forum_block_num", "5"), 5, 5, "The number of topics in the <b>Forum topics</b>-block. To enable the block, click ". l("here", "admin/block") .".");
}
else {
$output .= _forum_message_taxonomy();
@@ -109,7 +109,7 @@ function forum_block($op = "list", $delta = 0) {
$content .= node_title_list(db_query("SELECT n.nid, n.title, u.uid, u.name FROM node n LEFT JOIN forum f ON n.nid = f.nid LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'forum' ORDER BY n.nid DESC LIMIT ". variable_get("forum_block_num", "5")), t("New forum topics:"));
if ($content) {
- $content .= "<div id=\"forum_more\" align=\"right\">". lm(t("more"), array("mod" => "forum")) ."</div>";
+ $content .= "<div id=\"forum_more\" align=\"right\">". l(t("more"), "forum") ."</div>";
}
cache_set("forum:block", $content, time() + variable_get("cache_clear", 120));
@@ -129,7 +129,7 @@ function forum_block($op = "list", $delta = 0) {
function forum_link($type, $node = 0, $main = 0) {
if ($type == "page" && user_access("access content")) {
- $links[] = lm(t("forum"), array("mod" => "forum"));
+ $links[] = l(t("forum"), "forum");
}
if (!$main && $type == "node" && $node->type == "forum") {
@@ -158,11 +158,11 @@ function forum_link($type, $node = 0, $main = 0) {
}
if ($prev) {
- $links[] = l(t("previous forum topic"), array("id" => $prev->nid), "node", "", 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"), array("id" => $next->nid), "node", "", 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)."..."));
}
}
@@ -181,7 +181,7 @@ function forum_view($node, $main = 0) {
/* TODO: find out what this code was ment to do and either use it or not.
- $output .= "<p>". _forum_get_icon($node) ." ". lm($voc->name, array("mod" => "forum")) ." : ". lm($term_data->name, array("mod" => "forum", "tid" => $term_data->tid));
+ $output .= "<p>". _forum_get_icon($node) ." ". l($voc->name, "forum") ." : ". l($term_data->name, "forum/$term_data->tid");
$output .= " / <b>$node->title</b><br>".t("%a by %b", array("%a" => format_date($node->created), "%b" => format_name($node)))."</p><p>". check_output($node->body) ."</p>";
$output .= "<p>". $theme->links(link_node($node, $main)) ."</p>";
@@ -190,7 +190,7 @@ function forum_view($node, $main = 0) {
*/
if (!$main) {
- $node->title = _forum_get_icon($node) ." ". lm($voc->name, array("mod" => "forum")) ." : ". lm($term_data->name, array("mod" => "forum", "tid" => $term_data->tid)) ." / <b>$node->title</b>";
+ $node->title = _forum_get_icon($node) ." ". l($voc->name, "forum") ." : ". l($term_data->name, "forum/$term_data->tid") ." / <b>$node->title</b>";
}
$theme->node($node, $main);
@@ -479,20 +479,16 @@ function _forum_message_taxonomy() {
}
function forum_page() {
- global $theme, $tid, $sortby, $forum_per_page, $offset, $op, $user;
+ global $theme, $sortby, $forum_per_page, $offset, $op, $user;
if (user_access("access content")) {
if (module_exist("taxonomy")) {
+ $tid = arg(1);
+
if ($op == "Update settings" && $user->uid) {
$user = user_save($user, array("sortby" => $sortby, "forum_per_page" => $forum_per_page));
}
- if ($op == "first_new") {
- if ($nid = _forum_first_new($tid)) {
- drupal_goto(drupal_url(array("id" => $nid), "node"));
- }
- }
-
if (empty($sortby)) {
$sortby = isset($user->sortby) ? $user->sortby : variable_get("forum_order",1);
}
@@ -526,9 +522,9 @@ function forum_page() {
}
}
-/**
-*** render functions
-**/
+/*
+** Render functions.
+*/
function forum_render($forums, $topics, $topic_num, $parents, $tid, $sortby, $forum_per_page, $offset) {
// forum list, topics list, topic browser and "add new topic" link
@@ -552,14 +548,14 @@ function forum_forum_list($forums, $parents, $tid) {
if ($parents) {
foreach($parents as $p) {
if ($tid != $p->tid) {
- $t[] = lm($p->name, array("mod" => "forum", "tid" => $p->tid));
+ $t[] = l($p->name, "forum/$p->tid");
}
else {
$t[] = $p->name;
}
}
}
- $t[] = lm(t("Discussion forum"), array("mod" => "forum"));
+ $t[] = l(t("Discussion forum"), "forum");
$output .= "<table border=\"0\" cellpadding=\"5\" width=\"100%\">\n";
$output .= " <tr><th colspan=\"3\" align=\"left\">".implode(" : ", array_reverse($t)) ."</th>";
@@ -569,24 +565,24 @@ function forum_forum_list($forums, $parents, $tid) {
foreach ($forums as $forum) {
if ($forum->container) {
- $output .= " <tr><td colspan=\"5\">". lm($forum->name, array("mod" => "forum", "tid" => $forum->tid)) ."<br /><small>". ($forum->description ? check_output($forum->description) : "") ."</small></td></tr>";
+ $output .= " <tr><td colspan=\"5\">". l($forum->name, "forum/$forum->tid") ."<br /><small>". ($forum->description ? check_output($forum->description) : "") ."</small></td></tr>";
}
else {
if ($user->uid) $new_topics = $forum->num_topics - $forum->old_topics;
$icon = _forum_get_folder_icon($new_topics);
$output .= " <tr><td>&nbsp;</td><td>$icon</td>";
- $output .= "<td><table border=\"0\"><tr><td width=\"". ($forum->depth * 20) ."\">&nbsp;</td><td>". lm($forum->name, array("mod" => "forum", "tid" => $forum->tid))."<div style=\"padding-top: 5px;\">". check_output($forum->description);
+ $output .= "<td><table border=\"0\"><tr><td width=\"". ($forum->depth * 20) ."\">&nbsp;</td><td>". l($forum->name, "forum/$forum->tid") ."<div style=\"padding-top: 5px;\">". check_output($forum->description);
$links = array();
if ($forum->last_post) {
- $links[] = l(t("the most recent topic"), array("id" => $forum->last_post->nid));
+ $links[] = l(t("the most recent topic"), "node/view/". $forum->last_post->nid);
}
if ($new_topics) {
- $links[] = lm(t("the first new topic"), array("mod" => "forum", "op" => "first_new", "tid" => $forum->tid));
+ $links[] = l(t("the first new topic"), "forum/$forum->tid#new");
}
if ($links) {
- $output .= "<br />Jump to: ". implode(", ", $links);
+ $output .= "<br />". t("Jump to") .": ". implode(", ", $links);
}
$output .= "</div></td></tr></table></td>";
@@ -645,7 +641,7 @@ function forum_topic_list($topics, $num_topics, $sortby, $forum_per_page, $offse
<td>"._forum_get_folder_icon($topic->new, $topic->num_comments, $topic->comment_mode)."</td>
<td>"._forum_get_icon($topic)."</td>
<td valign=\"top\">$topic->title</td>
- <td align=\"center\" valign=\"top\" colspan=\"3\">".lm(t("This topic has been moved"), array("mod" => "forum", "tid" => $topic->shadow))."</td>
+ <td align=\"center\" valign=\"top\" colspan=\"3\">". l(t("This topic has been moved"), "forum/$topic->shadow")."</td>
</tr>";
}
else {
@@ -653,7 +649,7 @@ function forum_topic_list($topics, $num_topics, $sortby, $forum_per_page, $offse
<tr>
<td>"._forum_get_folder_icon($topic->new, $topic->num_comments, $topic->comment_mode)."</td>
<td>"._forum_get_icon($topic)."</td>
- <td valign=\"top\">". l($topic->title, array("id" => $topic->nid))."</td>
+ <td valign=\"top\">". l($topic->title, "node/view/$topic->nid") ."</td>
<td align=\"center\" valign=\"top\" nowrap=\"nowrap\">".$topic->num_comments.($topic->new_replies ? " (".t("%a new", array("%a" => $topic->new_replies)).")" : "")."</td>
<td align=\"center\">"._forum_format($topic)."</td>
<td align=\"center\">"._forum_format($topic->last_reply)."</td>
@@ -667,18 +663,18 @@ function forum_topic_list($topics, $num_topics, $sortby, $forum_per_page, $offse
$output .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>";
if ($offset > 0) {
- $output .= "<td width=\"33%\"><div align=\"left\" style=\"font-style: bold;\">". lm(t("previous topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset-$forum_per_page))) ."</div></td>";
+ $output .= "<td width=\"33%\"><div align=\"left\" style=\"font-style: bold;\">". l(t("previous topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset-$forum_per_page))) ."</div></td>";
}
else {
$output .= "<td width=\"33%\">&nbsp;</td>";
}
if (user_access("create forum topics")) {
- $output .= "<td width=\"33%\"><div align=\"center\" style=\"font-style: bold;\">". lm(t("create new forum topic"), array("mod" => "node", "op" => "add", "type" => "forum", "tid" => $tid)) ."</div></td>";
+ $output .= "<td width=\"33%\"><div align=\"center\" style=\"font-style: bold;\">". l(t("create new forum topic"), array("mod" => "node", "op" => "add", "type" => "forum", "tid" => $tid)) ."</div></td>";
}
if (count($topics) >= $forum_per_page) {
- $output .= "<td width=\"33%\"><div align=\"right\" style=\"font-style: bold;\">". lm(t("next topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset+$forum_per_page))) ."</div></td>";
+ $output .= "<td width=\"33%\"><div align=\"right\" style=\"font-style: bold;\">". l(t("next topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset+$forum_per_page))) ."</div></td>";
}
else {
$output .= "<td width=\"33%\">&nbsp;</td>";
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 87cd82db3..f1d507e3f 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -46,7 +46,7 @@ function forum_conf_options() {
$output .= form_select("Topics per page", "forum_per_page", variable_get("forum_per_page", 25), $number, "The default number of topics displayed per page; links to browse older messages are automatically being displayed.");
$forder = array(1 => "Date - newest first", 2 => "Date - oldest first", 3 => "Posts - most active first", 4=> "Posts - least active first");
$output .= form_select("Default order", "forum_order", variable_get("forum_order", 1), $forder, "The default display order for topics.");
- $output .= form_textfield("Number of topics in block", "forum_block_num", variable_get("forum_block_num", "5"), 5, 5, "The number of topics in the <b>Forum topics</b>-block. To enable the block, click ". la("here", array("mod" => "block")) .".");
+ $output .= form_textfield("Number of topics in block", "forum_block_num", variable_get("forum_block_num", "5"), 5, 5, "The number of topics in the <b>Forum topics</b>-block. To enable the block, click ". l("here", "admin/block") .".");
}
else {
$output .= _forum_message_taxonomy();
@@ -109,7 +109,7 @@ function forum_block($op = "list", $delta = 0) {
$content .= node_title_list(db_query("SELECT n.nid, n.title, u.uid, u.name FROM node n LEFT JOIN forum f ON n.nid = f.nid LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'forum' ORDER BY n.nid DESC LIMIT ". variable_get("forum_block_num", "5")), t("New forum topics:"));
if ($content) {
- $content .= "<div id=\"forum_more\" align=\"right\">". lm(t("more"), array("mod" => "forum")) ."</div>";
+ $content .= "<div id=\"forum_more\" align=\"right\">". l(t("more"), "forum") ."</div>";
}
cache_set("forum:block", $content, time() + variable_get("cache_clear", 120));
@@ -129,7 +129,7 @@ function forum_block($op = "list", $delta = 0) {
function forum_link($type, $node = 0, $main = 0) {
if ($type == "page" && user_access("access content")) {
- $links[] = lm(t("forum"), array("mod" => "forum"));
+ $links[] = l(t("forum"), "forum");
}
if (!$main && $type == "node" && $node->type == "forum") {
@@ -158,11 +158,11 @@ function forum_link($type, $node = 0, $main = 0) {
}
if ($prev) {
- $links[] = l(t("previous forum topic"), array("id" => $prev->nid), "node", "", 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"), array("id" => $next->nid), "node", "", 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)."..."));
}
}
@@ -181,7 +181,7 @@ function forum_view($node, $main = 0) {
/* TODO: find out what this code was ment to do and either use it or not.
- $output .= "<p>". _forum_get_icon($node) ." ". lm($voc->name, array("mod" => "forum")) ." : ". lm($term_data->name, array("mod" => "forum", "tid" => $term_data->tid));
+ $output .= "<p>". _forum_get_icon($node) ." ". l($voc->name, "forum") ." : ". l($term_data->name, "forum/$term_data->tid");
$output .= " / <b>$node->title</b><br>".t("%a by %b", array("%a" => format_date($node->created), "%b" => format_name($node)))."</p><p>". check_output($node->body) ."</p>";
$output .= "<p>". $theme->links(link_node($node, $main)) ."</p>";
@@ -190,7 +190,7 @@ function forum_view($node, $main = 0) {
*/
if (!$main) {
- $node->title = _forum_get_icon($node) ." ". lm($voc->name, array("mod" => "forum")) ." : ". lm($term_data->name, array("mod" => "forum", "tid" => $term_data->tid)) ." / <b>$node->title</b>";
+ $node->title = _forum_get_icon($node) ." ". l($voc->name, "forum") ." : ". l($term_data->name, "forum/$term_data->tid") ." / <b>$node->title</b>";
}
$theme->node($node, $main);
@@ -479,20 +479,16 @@ function _forum_message_taxonomy() {
}
function forum_page() {
- global $theme, $tid, $sortby, $forum_per_page, $offset, $op, $user;
+ global $theme, $sortby, $forum_per_page, $offset, $op, $user;
if (user_access("access content")) {
if (module_exist("taxonomy")) {
+ $tid = arg(1);
+
if ($op == "Update settings" && $user->uid) {
$user = user_save($user, array("sortby" => $sortby, "forum_per_page" => $forum_per_page));
}
- if ($op == "first_new") {
- if ($nid = _forum_first_new($tid)) {
- drupal_goto(drupal_url(array("id" => $nid), "node"));
- }
- }
-
if (empty($sortby)) {
$sortby = isset($user->sortby) ? $user->sortby : variable_get("forum_order",1);
}
@@ -526,9 +522,9 @@ function forum_page() {
}
}
-/**
-*** render functions
-**/
+/*
+** Render functions.
+*/
function forum_render($forums, $topics, $topic_num, $parents, $tid, $sortby, $forum_per_page, $offset) {
// forum list, topics list, topic browser and "add new topic" link
@@ -552,14 +548,14 @@ function forum_forum_list($forums, $parents, $tid) {
if ($parents) {
foreach($parents as $p) {
if ($tid != $p->tid) {
- $t[] = lm($p->name, array("mod" => "forum", "tid" => $p->tid));
+ $t[] = l($p->name, "forum/$p->tid");
}
else {
$t[] = $p->name;
}
}
}
- $t[] = lm(t("Discussion forum"), array("mod" => "forum"));
+ $t[] = l(t("Discussion forum"), "forum");
$output .= "<table border=\"0\" cellpadding=\"5\" width=\"100%\">\n";
$output .= " <tr><th colspan=\"3\" align=\"left\">".implode(" : ", array_reverse($t)) ."</th>";
@@ -569,24 +565,24 @@ function forum_forum_list($forums, $parents, $tid) {
foreach ($forums as $forum) {
if ($forum->container) {
- $output .= " <tr><td colspan=\"5\">". lm($forum->name, array("mod" => "forum", "tid" => $forum->tid)) ."<br /><small>". ($forum->description ? check_output($forum->description) : "") ."</small></td></tr>";
+ $output .= " <tr><td colspan=\"5\">". l($forum->name, "forum/$forum->tid") ."<br /><small>". ($forum->description ? check_output($forum->description) : "") ."</small></td></tr>";
}
else {
if ($user->uid) $new_topics = $forum->num_topics - $forum->old_topics;
$icon = _forum_get_folder_icon($new_topics);
$output .= " <tr><td>&nbsp;</td><td>$icon</td>";
- $output .= "<td><table border=\"0\"><tr><td width=\"". ($forum->depth * 20) ."\">&nbsp;</td><td>". lm($forum->name, array("mod" => "forum", "tid" => $forum->tid))."<div style=\"padding-top: 5px;\">". check_output($forum->description);
+ $output .= "<td><table border=\"0\"><tr><td width=\"". ($forum->depth * 20) ."\">&nbsp;</td><td>". l($forum->name, "forum/$forum->tid") ."<div style=\"padding-top: 5px;\">". check_output($forum->description);
$links = array();
if ($forum->last_post) {
- $links[] = l(t("the most recent topic"), array("id" => $forum->last_post->nid));
+ $links[] = l(t("the most recent topic"), "node/view/". $forum->last_post->nid);
}
if ($new_topics) {
- $links[] = lm(t("the first new topic"), array("mod" => "forum", "op" => "first_new", "tid" => $forum->tid));
+ $links[] = l(t("the first new topic"), "forum/$forum->tid#new");
}
if ($links) {
- $output .= "<br />Jump to: ". implode(", ", $links);
+ $output .= "<br />". t("Jump to") .": ". implode(", ", $links);
}
$output .= "</div></td></tr></table></td>";
@@ -645,7 +641,7 @@ function forum_topic_list($topics, $num_topics, $sortby, $forum_per_page, $offse
<td>"._forum_get_folder_icon($topic->new, $topic->num_comments, $topic->comment_mode)."</td>
<td>"._forum_get_icon($topic)."</td>
<td valign=\"top\">$topic->title</td>
- <td align=\"center\" valign=\"top\" colspan=\"3\">".lm(t("This topic has been moved"), array("mod" => "forum", "tid" => $topic->shadow))."</td>
+ <td align=\"center\" valign=\"top\" colspan=\"3\">". l(t("This topic has been moved"), "forum/$topic->shadow")."</td>
</tr>";
}
else {
@@ -653,7 +649,7 @@ function forum_topic_list($topics, $num_topics, $sortby, $forum_per_page, $offse
<tr>
<td>"._forum_get_folder_icon($topic->new, $topic->num_comments, $topic->comment_mode)."</td>
<td>"._forum_get_icon($topic)."</td>
- <td valign=\"top\">". l($topic->title, array("id" => $topic->nid))."</td>
+ <td valign=\"top\">". l($topic->title, "node/view/$topic->nid") ."</td>
<td align=\"center\" valign=\"top\" nowrap=\"nowrap\">".$topic->num_comments.($topic->new_replies ? " (".t("%a new", array("%a" => $topic->new_replies)).")" : "")."</td>
<td align=\"center\">"._forum_format($topic)."</td>
<td align=\"center\">"._forum_format($topic->last_reply)."</td>
@@ -667,18 +663,18 @@ function forum_topic_list($topics, $num_topics, $sortby, $forum_per_page, $offse
$output .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>";
if ($offset > 0) {
- $output .= "<td width=\"33%\"><div align=\"left\" style=\"font-style: bold;\">". lm(t("previous topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset-$forum_per_page))) ."</div></td>";
+ $output .= "<td width=\"33%\"><div align=\"left\" style=\"font-style: bold;\">". l(t("previous topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset-$forum_per_page))) ."</div></td>";
}
else {
$output .= "<td width=\"33%\">&nbsp;</td>";
}
if (user_access("create forum topics")) {
- $output .= "<td width=\"33%\"><div align=\"center\" style=\"font-style: bold;\">". lm(t("create new forum topic"), array("mod" => "node", "op" => "add", "type" => "forum", "tid" => $tid)) ."</div></td>";
+ $output .= "<td width=\"33%\"><div align=\"center\" style=\"font-style: bold;\">". l(t("create new forum topic"), array("mod" => "node", "op" => "add", "type" => "forum", "tid" => $tid)) ."</div></td>";
}
if (count($topics) >= $forum_per_page) {
- $output .= "<td width=\"33%\"><div align=\"right\" style=\"font-style: bold;\">". lm(t("next topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset+$forum_per_page))) ."</div></td>";
+ $output .= "<td width=\"33%\"><div align=\"right\" style=\"font-style: bold;\">". l(t("next topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset+$forum_per_page))) ."</div></td>";
}
else {
$output .= "<td width=\"33%\">&nbsp;</td>";
diff --git a/modules/help.module b/modules/help.module
index 856fd83df..5bc931cec 100644
--- a/modules/help.module
+++ b/modules/help.module
@@ -8,7 +8,7 @@ function help_system($field){
function help_link($type) {
if ($type == "admin") {
- menu_add("help", "admin.php?mod=help", "Help", NULL, NULL, 9);
+ menu_add("help", url("admin/help"), "Help", NULL, NULL, 9);
}
}
@@ -16,7 +16,7 @@ function help_admin() {
foreach (module_list() as $name) {
if (module_hook($name, "help")) {
- $links[] = la($name, array("mod" => "help"), $name);
+ $links[] = l($name, "admin/help#$name");
}
}
diff --git a/modules/help/help.module b/modules/help/help.module
index 856fd83df..5bc931cec 100644
--- a/modules/help/help.module
+++ b/modules/help/help.module
@@ -8,7 +8,7 @@ function help_system($field){
function help_link($type) {
if ($type == "admin") {
- menu_add("help", "admin.php?mod=help", "Help", NULL, NULL, 9);
+ menu_add("help", url("admin/help"), "Help", NULL, NULL, 9);
}
}
@@ -16,7 +16,7 @@ function help_admin() {
foreach (module_list() as $name) {
if (module_hook($name, "help")) {
- $links[] = la($name, array("mod" => "help"), $name);
+ $links[] = l($name, "admin/help#$name");
}
}
diff --git a/modules/import.module b/modules/import.module
index a679780cb..25d218c02 100644
--- a/modules/import.module
+++ b/modules/import.module
@@ -31,15 +31,15 @@ function import_perm() {
function import_link($type) {
if ($type == "page" && user_access("access news feeds")) {
- $links[] = lm(t("news feeds"), array("mod" => "import"), "", array("title" => t("Read the latest news from syndicated websites.")));
+ $links[] = l(t("news feeds"), "import", array("title" => t("Read the latest news from syndicated websites.")));
}
if ($type == "admin" && user_access("administer news feeds")) {
- menu_add("news aggregation", "admin.php?mod=import", "Content syndication through RDF/RSS feeds.", NULL, NULL, 3);
- menu_add("add new feed", "admin.php?mod=import&op=add&type=feed", "Add new news feed.", NULL, "news aggregation", 2);
- menu_add("add new bundle", "admin.php?mod=import&op=add&type=bundle", "Create a new bundle.", NULL, "news aggregation", 3);
- menu_add("tag news items", "admin.php?mod=import&op=tag", "Assign bundle attributes to a news item.", NULL, "news aggregation", 4);
- menu_add("help", "admin.php?mod=import&op=help", "More information about news aggregation.", NULL, "news aggregation", 5);
+ menu_add("news aggregation", url("admin/import"), "Content syndication through RDF/RSS feeds.", NULL, NULL, 3);
+ menu_add("add new feed", url("admin/import/add/feed"), "Add new news feed.", NULL, "news aggregation", 2);
+ menu_add("add new bundle", url("admin/import/add/bundle"), "Create a new bundle.", NULL, "news aggregation", 3);
+ menu_add("tag news items", url("admin/import/tag"), "Assign bundle attributes to a news item.", NULL, "news aggregation", 4);
+ menu_add("help", url("admin/import/help"), "More information about news aggregation.", NULL, "news aggregation", 5);
}
return $links ? $links : array();
@@ -63,7 +63,7 @@ function import_format_item($item, $feed = 0) {
global $theme, $user;
if ($user->uid && user_access("maintain personal blog")) {
- $output .= lm("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $output .= l("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
// external link
@@ -116,13 +116,13 @@ function import_block($op, $delta) {
$feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%d'", $delta));
if ($feed) {
$block["subject"] = $feed->title;
- $block["content"] = import_feed_block($feed) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "feed", "id" => $feed->fid), "", array("title" => t("View this feed's recent news."))) ."</div></p>";
+ $block["content"] = import_feed_block($feed) ."<p><div align=\"right\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div></p>";
}
else {
// it was a bundle. this is NOT elegant
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%d'", $delta));
$block["subject"] = $bundle->title;
- $block["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), "", array("title" => t("View this bundle's recent news."))) ."</div></p>";
+ $block["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div></p>";
}
return $block;
@@ -136,7 +136,7 @@ function import_get_bundles($attributes = 0) {
$result = db_query("SELECT * FROM bundle ORDER BY title");
while ($bundle = db_fetch_object($result)) {
$block[$bundle->bid]["subject"] = $bundle->title;
- $block[$bundle->bid]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), "", array("title" => t("View this bundle's recent news."))) ."</div></p>";
+ $block[$bundle->bid]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div></p>";
$block[$bundle->bid]["info"] = "$bundle->title bundle";
}
@@ -150,7 +150,7 @@ function import_get_feeds($attributes = 0) {
$result = db_query("SELECT * FROM feed ORDER BY fid");
while ($feed = db_fetch_object($result)) {
$block[$feed->fid]["subject"] = $feed->title;
- $block[$feed->fid]["content"] = import_feed_block($feed) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "feed", "id" => $feed->fid), "", array("title" => t("View this feed's recent news."))) ."</div></p>";
+ $block[$feed->fid]["content"] = import_feed_block($feed) ."<p><div align=\"right\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div></p>";
$block[$feed->fid]["info"] = "$feed->title feed";
}
@@ -387,7 +387,7 @@ function import_view() {
$header = array(t("title"), t("attributes"), t("items"), t("last update"), t("next update"), array("data" => t("operations"), "colspan" => 3));
unset($rows);
while ($feed = db_fetch_object($result)) {
- $rows[] = array($feed->title, $feed->attributes, format_plural($feed->items, "item", "items"), ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never"), ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never"), la(t("edit feed"), array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $feed->fid)), la(t("remove items"), array("mod" => "import", "type" => "feed", "op" => "remove", "id" => $feed->fid)), la(t("update items"), array("mod" => "import", "type" => "feed", "op" => "update", "id" => $feed->fid)));
+ $rows[] = array($feed->title, $feed->attributes, format_plural($feed->items, "item", "items"), ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never"), ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never"), l(t("edit feed"), "admin/import/edit/feed/$feed->fid"), l(t("remove items"), "admin/import/remove/$feed->fid"), l(t("update items"), "admin/import/update/$feed->fid"));
}
$output .= table($header, $rows);
@@ -398,7 +398,7 @@ function import_view() {
$header = array(t("title"), t("attributes"), t("operations"));
unset($rows);
while ($bundle = db_fetch_object($result)) {
- $rows[] = array($bundle->title, $bundle->attributes, la(t("edit bundle"), array("mod" => "import", "type" => "bundle", "op" => "edit", "id" => $bundle->bid)));
+ $rows[] = array($bundle->title, $bundle->attributes, l(t("edit bundle"), "admin/import/edit/bundle/$bundle->bid"));
}
$output .= table($header, $rows);
@@ -411,7 +411,7 @@ function import_tag() {
$header = array(t("date"), t("feed"), t("news item"));
while ($item = db_fetch_object($result)) {
- $rows[] = array(array("data" => format_date($item->timestamp, "small"), "nowrap" => "nowrap", "valign" => "top"), array("data" => la($item->feed, array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $item->fid)), "valign" => "top"), "<a href=\"$item->link\">$item->title</a>". ($item->description ? "<br /><small><i>$item->description</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" />");
+ $rows[] = array(array("data" => format_date($item->timestamp, "small"), "nowrap" => "nowrap", "valign" => "top"), array("data" => l($item->feed, "admin/import/edit/feed/$item->fid"), "valign" => "top"), "<a href=\"$item->link\">$item->title</a>". ($item->description ? "<br /><small><i>$item->description</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" />");
}
$output .= table($header, $rows);
@@ -421,16 +421,20 @@ function import_tag() {
}
function import_admin() {
- global $op, $id, $type, $edit;
+ global $op, $edit;
if (user_access("administer news feeds")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case "help":
print import_help();
break;
case "add":
- if ($type == "bundle") {
+ if (arg(3) == "bundle") {
print import_form_bundle();
}
else {
@@ -438,19 +442,19 @@ function import_admin() {
}
break;
case "edit":
- if ($type == "bundle") {
- print import_form_bundle(import_get_bundle($id));
+ if (arg(3) == "bundle") {
+ print import_form_bundle(import_get_bundle(arg(4)));
}
else {
- print import_form_feed(import_get_feed($id));
+ print import_form_feed(import_get_feed(arg(4)));
}
break;
case "remove":
- print status(import_remove(import_get_feed($id)));
+ print status(import_remove(import_get_feed(arg(3))));
print import_view();
break;
case "update":
- print status(import_refresh(import_get_feed($id)));
+ print status(import_refresh(import_get_feed(arg(3))));
print import_view();
break;
case "tag":
@@ -464,7 +468,7 @@ function import_admin() {
$edit["title"] = 0;
// fall through:
case "Submit":
- if ($type == "bundle") {
+ if (arg(3) == "bundle") {
print status(import_save_bundle($edit));
}
else {
@@ -483,12 +487,13 @@ function import_admin() {
function import_page_info() {
global $theme;
- $links[] = lm(t("latest news"), array("mod" => "import"), "", array("title" => t("Read the latest news from syndicated websites.")));
- $links[] = lm(t("news by source"), array("mod" => "import", "op" => "feeds"), "", array("title" => t("View the latest headlines sorted by source.")));
- $links[] = lm(t("news by topic"), array("mod" => "import", "op" => "bundles"), "", array("title" => t("View the latest headlines sorted by topic.")));
- $links[] = lm(t("news sources"), array("mod" => "import", "op" => "sources"), "", array("title" => t("View a list of all the websites we syndicate from.")));
+ $links[] = l(t("latest news"), "import", array("title" => t("Read the latest news from syndicated websites.")));
+ $links[] = l(t("news by source"), "import/feeds", array("title" => t("View the latest headlines sorted by source.")));
+ $links[] = l(t("news by topic"), "import/bundles", array("title" => t("View the latest headlines sorted by topic.")));
+ $links[] = l(t("news sources"), "import/sources", array("title" => t("View a list of all the websites we syndicate from.")));
+
if (user_access("administer news feeds")) {
- $links[] = la(t("administer news feeds"), array("mod" => "import"), "", array("title" => t("View the news feed administrative pages.")));
+ $links[] = l(t("administer news feeds"), "admin/import", array("title" => t("View the news feed administrative pages.")));
}
return "<div align=\"center\">". $theme->links($links) ."</div>";
@@ -502,12 +507,12 @@ function import_page_last() {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("maintain personal blog")) {
- $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $links[] = l(t("blog it"), "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
- $links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
+ $links[] = l(t("feed"), "import/feed/$item->fid", array("title" => t("Read more syndicated news from this feed.")));
if ($item->link) {
- $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
+ $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". l($item->ftitle, "import/feed/$item->fid", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
}
if ($item->description) {
@@ -531,14 +536,14 @@ function import_page_feed($fid) {
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\"><a href=\"$feed->link\">$feed->link</a></div></p>";
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">$feed->description</div></p>";
- $header .= "<p><b>". t("Last update") .":</b><div style=\"margin-left: 20px;\">". format_interval(time() - $feed->timestamp) ." ". t("ago") ."<a href=\"$feed->url\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br /><br /></div></p>\n";
+ $header .= "<p><b>". t("Last update") .":</b><div style=\"margin-left: 20px;\">". format_interval(time() - $feed->timestamp) ." ". t("ago") ." <a href=\"$feed->url\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br /><br /></div></p>\n";
$result = db_query("SELECT * FROM item WHERE fid = '%s' ORDER BY iid DESC LIMIT ". variable_get("import_page_limit", 75), $fid);
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("maintain personal blog")) {
- $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $links[] = l(t("blog it"), "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
@@ -565,7 +570,7 @@ function import_page_bundle($bid) {
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%s'", $bid));
- $header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". lm($bundle->title, array("mod" => "import", "op" => "bundle", "id" => $bundle->bid)) ."</div></p>";
+ $header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". l($bundle->title, "import/bundle/$bundle->bid") ."</div></p>";
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". t("A composite news feed about") ." $bundle->attributes.</div></p>";
$keys = explode(",", $bundle->attributes);
@@ -575,13 +580,13 @@ function import_page_bundle($bid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("maintain personal blog")) {
- $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
+ $links[] = l(t("blog it"), "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
}
- $links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
+ $links[] = l(t("feed"), "import/feed/$item->fid", array("title" => t("Read more syndicated news from this feed.")));
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
if ($item->link) {
- $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
+ $output .= "<tr><td><a href=\"$item->link\">$item->title</a> &middot; ". l($item->ftitle, "import/feed/$item->fid", array("title" => t("View more information about this feed."))) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
}
if ($item->description) {
@@ -606,11 +611,11 @@ function import_page_sources() {
$result = db_query("SELECT * FROM feed ORDER BY title");
while ($feed = db_fetch_object($result)) {
- $output .= lm($feed->title, array("mod" => "import", "op" => "feed", "id" => $feed->fid));
+ $output .= l($feed->title, "import/feed/$feed->fid");
$output .= "<div style=\"margin-left: 20px;\">$feed->description</div><br />";
}
- $output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "import", "op" => "fd"), "", array("title" => t("View the list of syndicated websites in XML format."))) ."<br />\n";
+ $output .= l("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", "import/fd", array("title" => t("View the list of syndicated websites in XML format."))) ."<br />";
$theme->header();
$theme->box(t("News feeds"), import_page_info());
@@ -674,15 +679,13 @@ function import_page_blocks($blocks) {
}
function import_page() {
- global $op, $id;
-
if (user_access("access news feeds")) {
- switch ($op) {
+ switch (arg(1)) {
case "feed":
- import_page_feed($id);
+ import_page_feed(arg(2));
break;
case "bundle":
- import_page_bundle($id);
+ import_page_bundle(arg(2));
break;
case "feeds":
import_page_feeds();
diff --git a/modules/jabber.module b/modules/jabber.module
index ce8bf2286..9843a1ea4 100644
--- a/modules/jabber.module
+++ b/modules/jabber.module
@@ -174,7 +174,7 @@ function jabber_user($type, $edit, $user) {
return $output;
case "edit_form":
$result = user_get_authname($user, $module);
- $output .= form_textfield(t("$name ID"), "authname_" . $module, $result, 30, 55, t("You may login to %s using a valid %id.", array("%s" => variable_get("site_name", "this web site"), "%id" => lm("$name ID", array("mod" => "user", "op" => "help"), $module))));
+ $output .= form_textfield(t("$name ID"), "authname_" . $module, $result, 30, 55, t("You may login to %s using a valid %id.", array("%s" => variable_get("site_name", "this web site"), "%id" => l("$name ID", "user/help#$module"))));
return $output;
case "edit_validate":
return user_validate_authmap($user, $edit["authname_$module"], $module);
diff --git a/modules/locale.module b/modules/locale.module
index 48a480aff..70028aea7 100644
--- a/modules/locale.module
+++ b/modules/locale.module
@@ -48,13 +48,13 @@ function locale_link($type) {
global $languages;
if ($type == "admin" && user_access("administer locales")) {
- menu_add("locale", "admin.php?mod=locale", "Translate this site.", NULL, NULL, 3);
- menu_add("search string", "admin.php?mod=locale&op=search", "Search a string.", NULL, "locale", 8);
- menu_add("help", "admin.php?mod=locale&op=help", "More information about the locale system.", NULL, "locale", 9);
+ menu_add("locale", url("admin/locale"), "Translate this site.", NULL, NULL, 3);
+ menu_add("search string", url("admin/locale/search"), "Search a string.", NULL, "locale", 8);
+ menu_add("help", url("admin/locale/help"), "More information about the locale system.", NULL, "locale", 9);
foreach ($languages as $key => $value) {
- menu_add("translated '$key' strings", "admin.php?mod=locale&op=translated&language=$key", "Display translated '$key' strings.", NULL, "locale");
- menu_add("untranslated '$key' strings", "admin.php?mod=locale&op=untranslated&language=$key", "Display untranslated '$key' strings.", NULL, "locale");
+ menu_add("translated '$key' strings", url("admin/locale/translated/$key"), "Display translated '$key' strings.", NULL, "locale");
+ menu_add("untranslated '$key' strings", url("admin/locale/untranslated/$key"), "Display untranslated '$key' strings.", NULL, "locale");
}
}
}
@@ -164,7 +164,7 @@ function locale_seek() {
$header = array(t("string"), (($edit["status"] != 2 && strlen($edit["language"]) == 2) ? t("translated string") : t("languages")), array("data" => t("operations"), "colspan" => "2"));
while ($locale = db_fetch_object($result)) {
- $rows[] = array("$locale->string<br /><small><i>$locale->location</i></small>", array("data" => (($edit["status"] != 2 && strlen($edit["language"]) == 2) ? $locale->$edit["language"] : locale_languages($locale)), "align" => "center"), array("data" => la(t("edit locale"), array("mod" => "locale", "op" => "edit", "id" => $locale->lid)), "nowrap" => "nowrap"), array("data" => la(t("delete locale"), array("mod" => "locale", "op" => "delete", "id" => $locale->lid)), "nowrap" => "nowrap"));
+ $rows[] = array("$locale->string<br /><small><i>$locale->location</i></small>", array("data" => (($edit["status"] != 2 && strlen($edit["language"]) == 2) ? $locale->$edit["language"] : locale_languages($locale)), "align" => "center"), array("data" => l(t("edit locale"), "admin/locale/edit/$locale->lid"), "nowrap" => "nowrap"), array("data" => l(t("delete locale"), "admin/locale/delete/$locale->lid"), "nowrap" => "nowrap"));
}
$output .= table($header, $rows);
}
@@ -183,22 +183,25 @@ function locale_seek() {
}
function locale_admin() {
- global $id, $edit, $op, $language;
+ global $op, $edit;
if (user_access("administer locales")) {
locale_admin_initialize();
+ if (empty($op)) {
+ $op = arg(2);
+ }
switch ($op) {
case "delete":
- locale_delete(check_query($id));
+ locale_delete(check_query(arg(3)));
print locale_seek();
break;
case "help":
print locale_help();
break;
case "edit":
- print locale_edit(check_query($id));
+ print locale_edit(check_query(arg(3)));
break;
case "search":
case t("Search"):
@@ -206,16 +209,16 @@ function locale_admin() {
break;
case "translated":
$edit["status"] = 1;
- $edit["language"] = $language;
+ $edit["language"] = arg(3);
print locale_seek();
break;
case "untranslated":
$edit["status"] = 2;
- $edit["language"] = $language;
+ $edit["language"] = arg(3);
print locale_seek();
break;
case t("Save translations"):
- print locale_save(check_query($id));
+ print locale_save(check_query(arg(3)));
default:
print locale_seek();
}
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 48a480aff..70028aea7 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -48,13 +48,13 @@ function locale_link($type) {
global $languages;
if ($type == "admin" && user_access("administer locales")) {
- menu_add("locale", "admin.php?mod=locale", "Translate this site.", NULL, NULL, 3);
- menu_add("search string", "admin.php?mod=locale&op=search", "Search a string.", NULL, "locale", 8);
- menu_add("help", "admin.php?mod=locale&op=help", "More information about the locale system.", NULL, "locale", 9);
+ menu_add("locale", url("admin/locale"), "Translate this site.", NULL, NULL, 3);
+ menu_add("search string", url("admin/locale/search"), "Search a string.", NULL, "locale", 8);
+ menu_add("help", url("admin/locale/help"), "More information about the locale system.", NULL, "locale", 9);
foreach ($languages as $key => $value) {
- menu_add("translated '$key' strings", "admin.php?mod=locale&op=translated&language=$key", "Display translated '$key' strings.", NULL, "locale");
- menu_add("untranslated '$key' strings", "admin.php?mod=locale&op=untranslated&language=$key", "Display untranslated '$key' strings.", NULL, "locale");
+ menu_add("translated '$key' strings", url("admin/locale/translated/$key"), "Display translated '$key' strings.", NULL, "locale");
+ menu_add("untranslated '$key' strings", url("admin/locale/untranslated/$key"), "Display untranslated '$key' strings.", NULL, "locale");
}
}
}
@@ -164,7 +164,7 @@ function locale_seek() {
$header = array(t("string"), (($edit["status"] != 2 && strlen($edit["language"]) == 2) ? t("translated string") : t("languages")), array("data" => t("operations"), "colspan" => "2"));
while ($locale = db_fetch_object($result)) {
- $rows[] = array("$locale->string<br /><small><i>$locale->location</i></small>", array("data" => (($edit["status"] != 2 && strlen($edit["language"]) == 2) ? $locale->$edit["language"] : locale_languages($locale)), "align" => "center"), array("data" => la(t("edit locale"), array("mod" => "locale", "op" => "edit", "id" => $locale->lid)), "nowrap" => "nowrap"), array("data" => la(t("delete locale"), array("mod" => "locale", "op" => "delete", "id" => $locale->lid)), "nowrap" => "nowrap"));
+ $rows[] = array("$locale->string<br /><small><i>$locale->location</i></small>", array("data" => (($edit["status"] != 2 && strlen($edit["language"]) == 2) ? $locale->$edit["language"] : locale_languages($locale)), "align" => "center"), array("data" => l(t("edit locale"), "admin/locale/edit/$locale->lid"), "nowrap" => "nowrap"), array("data" => l(t("delete locale"), "admin/locale/delete/$locale->lid"), "nowrap" => "nowrap"));
}
$output .= table($header, $rows);
}
@@ -183,22 +183,25 @@ function locale_seek() {
}
function locale_admin() {
- global $id, $edit, $op, $language;
+ global $op, $edit;
if (user_access("administer locales")) {
locale_admin_initialize();
+ if (empty($op)) {
+ $op = arg(2);
+ }
switch ($op) {
case "delete":
- locale_delete(check_query($id));
+ locale_delete(check_query(arg(3)));
print locale_seek();
break;
case "help":
print locale_help();
break;
case "edit":
- print locale_edit(check_query($id));
+ print locale_edit(check_query(arg(3)));
break;
case "search":
case t("Search"):
@@ -206,16 +209,16 @@ function locale_admin() {
break;
case "translated":
$edit["status"] = 1;
- $edit["language"] = $language;
+ $edit["language"] = arg(3);
print locale_seek();
break;
case "untranslated":
$edit["status"] = 2;
- $edit["language"] = $language;
+ $edit["language"] = arg(3);
print locale_seek();
break;
case t("Save translations"):
- print locale_save(check_query($id));
+ print locale_save(check_query(arg(3)));
default:
print locale_seek();
}
diff --git a/modules/node.module b/modules/node.module
index f9ea17b38..dd81f731d 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -30,7 +30,7 @@ function node_title_list($result, $title = NULL) {
while ($node = db_fetch_object($result)) {
$number = module_invoke("comment", "num_all", $node->nid);
$name = strip_tags(format_name($node)); // required for anonymous users to work
- $items[] = l($node->title, array("id" => $node->nid), "node", "", array("title" => t("Author: %name, comments: %number", array("%name" => $name, "%number" => $number))));
+ $items[] = l($node->title, "node/view/$node->nid", array("title" => t("Author: %name, comments: %number", array("%name" => $name, "%number" => $number))));
}
return theme_invoke("theme_item_list", $items, $title);
@@ -303,6 +303,24 @@ function node_view($node, $main = 0) {
}
}
+function node_show($nid, $cid) {
+ global $theme, $revision;
+
+ $node = node_load(array("status" => 1, "nid" => $nid));
+
+ if (node_access("view", $node)) {
+ if (isset($revision)) {
+ $node = $node->revisions[$revision]["node"];
+ }
+
+ node_view($node);
+
+ if (function_exists("comment_render") && $node->comment) {
+ comment_render($node, $cid);
+ }
+ }
+}
+
function node_access($op, $node = 0) {
if (user_access("administer nodes")) {
@@ -388,7 +406,7 @@ function node_filter_html($text) {
function node_filter_link($text) {
$pat = '\[{2}([^\|]+)(\|([^\|]+)?)?\]{2}'; // [link|description]
- $dst = str_replace('%5C1', '\\1', format_tag('\\1', '\\3')); // [link|description]
+// $dst = str_replace('%5C1', '\\1', format_tag('\\1', '\\3')); // [link|description]
return ereg_replace($pat, $dst, $text);
}
@@ -407,7 +425,7 @@ function node_filter($text) {
$text = preg_replace("/\Whref\s*=[\s'\"]*javascript:[^>]+?>/i", ">", $text);
if (variable_get("filter_html", 0)) $text = node_filter_html($text);
- if (variable_get("filter_link", 0)) $text = node_filter_link($text);
+ // if (variable_get("filter_link", 0)) $text = node_filter_link($text);
return trim($text);
}
@@ -415,7 +433,7 @@ function node_filter($text) {
function node_link($type, $node = 0, $main = 0) {
if ($type == "page") {
- $links[] = lm(t("submit"), array("mod" => "node", "op" => "add"), "", array("title" => t("Submit or suggest new content.")));
+ $links[] = l(t("submit"), "node/add", array("title" => t("Submit or suggest new content.")));
}
if ($type == "node") {
@@ -424,23 +442,23 @@ function node_link($type, $node = 0, $main = 0) {
}
if ($main == 1 && $node->teaser && $node->teaser != $node->body) {
- $links[] = l(t("read more"), array("id" => $node->nid), "node", "", array("title" => t("Read the rest of this posting.")));
+ $links[] = l(t("read more"), "node/view/$node->nid", array("title" => t("Read the rest of this posting.")));
}
if (user_access("administer nodes")) {
- $links[] = la(t("administer"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Administer this node.")));
+ $links[] = l(t("administer"), "node/edit/$node->nid", array("title" => t("Administer this node.")));
}
}
if ($type = "admin" && user_access("administer nodes")) {
$search = "On this page you can search for a post. For example, one may search for 'br' and Drupal might return 'bread brakers', 'our daily bread' and 'brenda'.";
- menu_add("content management", "admin.php?mod=node", "Content management.", NULL, NULL);
- menu_add("submit new content", "module.php?mod=node&op=add", "Submit new content.", NULL, "content management", -1, 1);
- menu_add("new or updated posts", "admin.php?mod=node&op=nodes&query=0", "Display all new or updated posts.", NULL, "content management", 0, 1);
- menu_add("posts that await approval", "admin.php?mod=node&op=nodes&query=1", "Display posts that await approval.", NULL, "content management", 0, 1);
- menu_add("search content", "admin.php?mod=node&op=search", "Search a post.", $search, "content management", 5);
- menu_add("help", "admin.php?mod=node&op=help", "More information about content management.", NULL, "content management", 7);
+ menu_add("content management", url("admin/node"), "Content management.", NULL, NULL);
+ menu_add("submit new content", url("node/add"), "Submit new content.", NULL, "content management", -1, 1);
+ menu_add("new or updated posts", url("admin/node/nodes&query=0"), "Display all new or updated posts.", NULL, "content management", 0, 1);
+ menu_add("posts that await approval", url("admin/node/nodes&query=1"), "Display posts that await approval.", NULL, "content management", 0, 1);
+ menu_add("search content", url("admin/node/search"), "Search a post.", $search, "content management", 5);
+ menu_add("help", url("admin/node/help"), "More information about content management.", NULL, "content management", 7);
}
return $links ? $links : array();
@@ -469,7 +487,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"), 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 .= " <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", NULL, "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>";
}
@@ -496,7 +514,7 @@ function node_admin_nodes() {
$header = array(t("title"), t("type"), t("author"), t("status"), array("data" => t("operations"), "colspan" => 2));
while ($node = db_fetch_object($result)) {
- $rows[] = array(l($node->title, array("id" => $node->nid)), module_invoke($node->type, "node", "name"), 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)));
+ $rows[] = array(l($node->title, "node/view/$node->nid"), 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")) {
@@ -607,10 +625,14 @@ function node_revision_list($node) {
}
function node_admin() {
- global $op, $id, $revision, $edit;
+ global $op, $edit;
if (user_access("administer nodes")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
/*
** Compile a list of the administrative links:
*/
@@ -620,21 +642,21 @@ function node_admin() {
print node_help();
break;
case "search":
- print search_type("node", drupal_url(array("mod" => "node", "op" => "search"), "admin"));
+ print search_type("node", url("admin/node/search"));
break;
case "edit":
- print node_admin_edit($id);
+ print node_admin_edit(arg(3));
break;
case "delete":
- print node_delete(array("nid" => $id));
+ print node_delete(array("nid" => arg(3)));
break;
case "rollback+revision":
- print node_revision_rollback(node_load(array("nid" => $id)), $revision);
- print node_admin_edit($id);
+ print node_revision_rollback(node_load(array("nid" => arg(3))), arg(5));
+ print node_admin_edit(arg(4));
break;
case "delete+revision":
- print node_revision_delete(node_load(array("nid" => $id)), $revision);
- print node_admin_edit($id);
+ print node_revision_delete(node_load(array("nid" => arg(3))), arg(5));
+ print node_admin_edit(arg(4));
break;
case t("Preview"):
$edit = node_validate($edit, $error);
@@ -663,7 +685,7 @@ function node_block($op = "list", $delta = 0) {
}
else {
$block["subject"] = t("Syndicate");
- $block["content"] = "<div align=\"center\">". lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" />", array("mod" => "node", "op" => "feed"), "", array("title" => t("Read the XML version of this page."))) ."</div>\n";
+ $block["content"] = "<div align=\"center\">". l("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" />", "node/feed", array("title" => t("Read the XML version of this page."))) ."</div>";
return $block;
}
@@ -671,9 +693,11 @@ function node_block($op = "list", $delta = 0) {
function node_feed($nodes = 0, $channel = array()) {
/*
- a generic function for generating rss feeds from a set of nodes.
- $nodes should be an object as returned by db_query() which contains the nid field
- $channel is an associative array containing title, link, and description keys
+ ** A generic function for generating RSS feeds from a set of nodes.
+ ** - $nodes should be an object as returned by db_query() which contains
+ ** the nid field.
+ ** - $channel is an associative array containing title, link, and
+ ** description keys.
*/
if (!$nodes) {
@@ -682,7 +706,7 @@ function node_feed($nodes = 0, $channel = array()) {
while ($node = db_fetch_object($nodes)) {
$item = node_load(array("nid" => $node->nid));
- $link = path_uri(). drupal_url(array("id" => $item->nid), "node");
+ $link = path_uri() . url("node/view/$item->nid");
$items .= format_rss_item($item->title, $link, $item->teaser);
}
@@ -874,6 +898,7 @@ function node_form($edit, $error = NULL) {
$output .= form_textfield(t("Authored by"), "name", $edit->name, 20, 60, $error["name"]);
$output .= form_textfield(t("Authored on"), "date", $edit->date, 20, 25, $error["date"]);
$output .= "<br />";
+ $output .= form_select(t("Set public/published"), "status", $edit->status, array(t("Disabled"), t("Enabled")));
$output .= form_select(t("Moderation status"), "moderate", $edit->moderate, array(t("Approved"), t("Awaiting approval")));
$output .= form_select(t("Promote to front page"), "promote", $edit->promote, array(t("Disabled"), t("Enabled")));
$output .= form_select(t("Static on front page"), "static", $edit->static, array(t("Disabled"), t("Enabled")));
@@ -918,7 +943,7 @@ function node_add($type) {
foreach (module_list() as $name) {
if (module_hook($name, "node") && node_access("create", $name)) {
$output .= "<li>";
- $output .= " ". lm(module_invoke($name, "node", "name"), array("mod" => "node", "op" => "add", "type" => $name), "", array("title" => t("Add a new %s.", array("%s" => module_invoke($name, "node", "name")))));
+ $output .= " ". l(module_invoke($name, "node", "name"), "node/add/$name", array("title" => 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>";
}
@@ -1085,7 +1110,7 @@ function node_submit($node) {
taxonomy_node_save($nid, $node->taxonomy);
}
- watchdog("special", "$node->type: updated '$node->title'", l("view post", array("id" => $node->nid)));
+ watchdog("special", "$node->type: updated '$node->title'", l("view post", "node/view/$node->nid"));
$output = t("The node has been updated.");
}
}
@@ -1127,7 +1152,7 @@ function node_submit($node) {
taxonomy_node_save($nid, $node->taxonomy);
}
- watchdog("special", "$node->type: added '$node->title'", l("view post", array("id" => $nid)));
+ watchdog("special", "$node->type: added '$node->title'", l("view post", "node/view/$nid"));
$output = t("Thanks for your submission.");
}
}
@@ -1148,11 +1173,11 @@ function node_submit($node) {
}
if ($nid && node_access("view", $node)) {
- $links[] = l(t("view"), array("id" => $nid));
+ $links[] = l(t("view"), "node/view/$nid");
}
if ($nid && node_access("update", $node)) {
- $links[] = lm(t("edit"), array("mod" => "node", "op" => "edit", "id" => $nid));
+ $links[] = l(t("edit"), "node/edit/$nid");
}
$output .= "<p>". $theme->links($links) ."</p>";
@@ -1209,48 +1234,41 @@ function node_delete($edit) {
}
function node_page() {
- global $op, $id, $user, $edit, $type, $theme, $or, $and;
+ global $op, $id, $user, $edit, $theme, $or, $and;
- if ($op == "feed") {
- node_feed();
- return;
- }
+ if (user_access("access content")) {
+ if (empty($op)) {
+ $op = arg(1);
+ }
- /*
- ** Try to find a good title:
- */
+ if ($op == "feed") {
+ node_feed();
+ return;
+ }
- if ($type) {
- $title = ucfirst(module_invoke($type, "node", "name"));
- }
- else if ($edit["type"]) {
- $title = ucfirst(module_invoke($edit["type"], "node", "name"));
- }
- else {
- $title = t("Submission form");
- }
-
- $theme->header();
-
- switch ($op) {
- case "add":
- $theme->box($title, node_add($type));
- break;
- case "edit":
- $theme->box($title, node_edit($id));
- break;
- case t("Preview"):
- $edit = node_validate($edit, $error);
- $theme->box($title, node_preview($edit, $error));
- break;
- case t("Submit"):
- $theme->box($title, node_submit($edit));
- break;
- case t("Delete"):
- $theme->box($title, node_delete($edit));
- break;
- default:
- if (user_access("access content")) {
+ $theme->header();
+
+ switch ($op) {
+ case "add":
+ $theme->box(t("Create new post"), node_add(arg(2)));
+ break;
+ case "edit":
+ $theme->box(t("Edit post"), node_edit(arg(2)));
+ break;
+ case "view":
+ print node_show(arg(2), arg(3));
+ break;
+ case t("Preview"):
+ $edit = node_validate($edit, $error);
+ $theme->box(t("Preview post"), node_preview($edit, $error));
+ break;
+ case t("Submit"):
+ $theme->box(t("Submit post"), node_submit($edit));
+ break;
+ case t("Delete"):
+ $theme->box(t("Delete post"), node_delete($edit));
+ break;
+ default:
// prepare query
if ($or) {
foreach ((explode(",", $or)) as $t) {
@@ -1273,15 +1291,18 @@ function node_page() {
}
else {
$result = pager_query("SELECT nid, type FROM node WHERE ". ($id ? "nid = '$id'" : "promote = '1'") ." AND status = '1' ORDER BY static DESC, created DESC", ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
-
}
while ($node = db_fetch_object($result)) {
node_view(node_load(array("nid" => $node->nid, "type" => $node->type)), 1);
}
+
print pager_display(NULL, ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
- }
}
+ }
+ else {
+ $theme->box(t("Access denied"), message_access());
+ }
$theme->footer();
}
diff --git a/modules/node/node.module b/modules/node/node.module
index f9ea17b38..dd81f731d 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -30,7 +30,7 @@ function node_title_list($result, $title = NULL) {
while ($node = db_fetch_object($result)) {
$number = module_invoke("comment", "num_all", $node->nid);
$name = strip_tags(format_name($node)); // required for anonymous users to work
- $items[] = l($node->title, array("id" => $node->nid), "node", "", array("title" => t("Author: %name, comments: %number", array("%name" => $name, "%number" => $number))));
+ $items[] = l($node->title, "node/view/$node->nid", array("title" => t("Author: %name, comments: %number", array("%name" => $name, "%number" => $number))));
}
return theme_invoke("theme_item_list", $items, $title);
@@ -303,6 +303,24 @@ function node_view($node, $main = 0) {
}
}
+function node_show($nid, $cid) {
+ global $theme, $revision;
+
+ $node = node_load(array("status" => 1, "nid" => $nid));
+
+ if (node_access("view", $node)) {
+ if (isset($revision)) {
+ $node = $node->revisions[$revision]["node"];
+ }
+
+ node_view($node);
+
+ if (function_exists("comment_render") && $node->comment) {
+ comment_render($node, $cid);
+ }
+ }
+}
+
function node_access($op, $node = 0) {
if (user_access("administer nodes")) {
@@ -388,7 +406,7 @@ function node_filter_html($text) {
function node_filter_link($text) {
$pat = '\[{2}([^\|]+)(\|([^\|]+)?)?\]{2}'; // [link|description]
- $dst = str_replace('%5C1', '\\1', format_tag('\\1', '\\3')); // [link|description]
+// $dst = str_replace('%5C1', '\\1', format_tag('\\1', '\\3')); // [link|description]
return ereg_replace($pat, $dst, $text);
}
@@ -407,7 +425,7 @@ function node_filter($text) {
$text = preg_replace("/\Whref\s*=[\s'\"]*javascript:[^>]+?>/i", ">", $text);
if (variable_get("filter_html", 0)) $text = node_filter_html($text);
- if (variable_get("filter_link", 0)) $text = node_filter_link($text);
+ // if (variable_get("filter_link", 0)) $text = node_filter_link($text);
return trim($text);
}
@@ -415,7 +433,7 @@ function node_filter($text) {
function node_link($type, $node = 0, $main = 0) {
if ($type == "page") {
- $links[] = lm(t("submit"), array("mod" => "node", "op" => "add"), "", array("title" => t("Submit or suggest new content.")));
+ $links[] = l(t("submit"), "node/add", array("title" => t("Submit or suggest new content.")));
}
if ($type == "node") {
@@ -424,23 +442,23 @@ function node_link($type, $node = 0, $main = 0) {
}
if ($main == 1 && $node->teaser && $node->teaser != $node->body) {
- $links[] = l(t("read more"), array("id" => $node->nid), "node", "", array("title" => t("Read the rest of this posting.")));
+ $links[] = l(t("read more"), "node/view/$node->nid", array("title" => t("Read the rest of this posting.")));
}
if (user_access("administer nodes")) {
- $links[] = la(t("administer"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Administer this node.")));
+ $links[] = l(t("administer"), "node/edit/$node->nid", array("title" => t("Administer this node.")));
}
}
if ($type = "admin" && user_access("administer nodes")) {
$search = "On this page you can search for a post. For example, one may search for 'br' and Drupal might return 'bread brakers', 'our daily bread' and 'brenda'.";
- menu_add("content management", "admin.php?mod=node", "Content management.", NULL, NULL);
- menu_add("submit new content", "module.php?mod=node&op=add", "Submit new content.", NULL, "content management", -1, 1);
- menu_add("new or updated posts", "admin.php?mod=node&op=nodes&query=0", "Display all new or updated posts.", NULL, "content management", 0, 1);
- menu_add("posts that await approval", "admin.php?mod=node&op=nodes&query=1", "Display posts that await approval.", NULL, "content management", 0, 1);
- menu_add("search content", "admin.php?mod=node&op=search", "Search a post.", $search, "content management", 5);
- menu_add("help", "admin.php?mod=node&op=help", "More information about content management.", NULL, "content management", 7);
+ menu_add("content management", url("admin/node"), "Content management.", NULL, NULL);
+ menu_add("submit new content", url("node/add"), "Submit new content.", NULL, "content management", -1, 1);
+ menu_add("new or updated posts", url("admin/node/nodes&query=0"), "Display all new or updated posts.", NULL, "content management", 0, 1);
+ menu_add("posts that await approval", url("admin/node/nodes&query=1"), "Display posts that await approval.", NULL, "content management", 0, 1);
+ menu_add("search content", url("admin/node/search"), "Search a post.", $search, "content management", 5);
+ menu_add("help", url("admin/node/help"), "More information about content management.", NULL, "content management", 7);
}
return $links ? $links : array();
@@ -469,7 +487,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"), 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 .= " <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", NULL, "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>";
}
@@ -496,7 +514,7 @@ function node_admin_nodes() {
$header = array(t("title"), t("type"), t("author"), t("status"), array("data" => t("operations"), "colspan" => 2));
while ($node = db_fetch_object($result)) {
- $rows[] = array(l($node->title, array("id" => $node->nid)), module_invoke($node->type, "node", "name"), 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)));
+ $rows[] = array(l($node->title, "node/view/$node->nid"), 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")) {
@@ -607,10 +625,14 @@ function node_revision_list($node) {
}
function node_admin() {
- global $op, $id, $revision, $edit;
+ global $op, $edit;
if (user_access("administer nodes")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
/*
** Compile a list of the administrative links:
*/
@@ -620,21 +642,21 @@ function node_admin() {
print node_help();
break;
case "search":
- print search_type("node", drupal_url(array("mod" => "node", "op" => "search"), "admin"));
+ print search_type("node", url("admin/node/search"));
break;
case "edit":
- print node_admin_edit($id);
+ print node_admin_edit(arg(3));
break;
case "delete":
- print node_delete(array("nid" => $id));
+ print node_delete(array("nid" => arg(3)));
break;
case "rollback+revision":
- print node_revision_rollback(node_load(array("nid" => $id)), $revision);
- print node_admin_edit($id);
+ print node_revision_rollback(node_load(array("nid" => arg(3))), arg(5));
+ print node_admin_edit(arg(4));
break;
case "delete+revision":
- print node_revision_delete(node_load(array("nid" => $id)), $revision);
- print node_admin_edit($id);
+ print node_revision_delete(node_load(array("nid" => arg(3))), arg(5));
+ print node_admin_edit(arg(4));
break;
case t("Preview"):
$edit = node_validate($edit, $error);
@@ -663,7 +685,7 @@ function node_block($op = "list", $delta = 0) {
}
else {
$block["subject"] = t("Syndicate");
- $block["content"] = "<div align=\"center\">". lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" />", array("mod" => "node", "op" => "feed"), "", array("title" => t("Read the XML version of this page."))) ."</div>\n";
+ $block["content"] = "<div align=\"center\">". l("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" />", "node/feed", array("title" => t("Read the XML version of this page."))) ."</div>";
return $block;
}
@@ -671,9 +693,11 @@ function node_block($op = "list", $delta = 0) {
function node_feed($nodes = 0, $channel = array()) {
/*
- a generic function for generating rss feeds from a set of nodes.
- $nodes should be an object as returned by db_query() which contains the nid field
- $channel is an associative array containing title, link, and description keys
+ ** A generic function for generating RSS feeds from a set of nodes.
+ ** - $nodes should be an object as returned by db_query() which contains
+ ** the nid field.
+ ** - $channel is an associative array containing title, link, and
+ ** description keys.
*/
if (!$nodes) {
@@ -682,7 +706,7 @@ function node_feed($nodes = 0, $channel = array()) {
while ($node = db_fetch_object($nodes)) {
$item = node_load(array("nid" => $node->nid));
- $link = path_uri(). drupal_url(array("id" => $item->nid), "node");
+ $link = path_uri() . url("node/view/$item->nid");
$items .= format_rss_item($item->title, $link, $item->teaser);
}
@@ -874,6 +898,7 @@ function node_form($edit, $error = NULL) {
$output .= form_textfield(t("Authored by"), "name", $edit->name, 20, 60, $error["name"]);
$output .= form_textfield(t("Authored on"), "date", $edit->date, 20, 25, $error["date"]);
$output .= "<br />";
+ $output .= form_select(t("Set public/published"), "status", $edit->status, array(t("Disabled"), t("Enabled")));
$output .= form_select(t("Moderation status"), "moderate", $edit->moderate, array(t("Approved"), t("Awaiting approval")));
$output .= form_select(t("Promote to front page"), "promote", $edit->promote, array(t("Disabled"), t("Enabled")));
$output .= form_select(t("Static on front page"), "static", $edit->static, array(t("Disabled"), t("Enabled")));
@@ -918,7 +943,7 @@ function node_add($type) {
foreach (module_list() as $name) {
if (module_hook($name, "node") && node_access("create", $name)) {
$output .= "<li>";
- $output .= " ". lm(module_invoke($name, "node", "name"), array("mod" => "node", "op" => "add", "type" => $name), "", array("title" => t("Add a new %s.", array("%s" => module_invoke($name, "node", "name")))));
+ $output .= " ". l(module_invoke($name, "node", "name"), "node/add/$name", array("title" => 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>";
}
@@ -1085,7 +1110,7 @@ function node_submit($node) {
taxonomy_node_save($nid, $node->taxonomy);
}
- watchdog("special", "$node->type: updated '$node->title'", l("view post", array("id" => $node->nid)));
+ watchdog("special", "$node->type: updated '$node->title'", l("view post", "node/view/$node->nid"));
$output = t("The node has been updated.");
}
}
@@ -1127,7 +1152,7 @@ function node_submit($node) {
taxonomy_node_save($nid, $node->taxonomy);
}
- watchdog("special", "$node->type: added '$node->title'", l("view post", array("id" => $nid)));
+ watchdog("special", "$node->type: added '$node->title'", l("view post", "node/view/$nid"));
$output = t("Thanks for your submission.");
}
}
@@ -1148,11 +1173,11 @@ function node_submit($node) {
}
if ($nid && node_access("view", $node)) {
- $links[] = l(t("view"), array("id" => $nid));
+ $links[] = l(t("view"), "node/view/$nid");
}
if ($nid && node_access("update", $node)) {
- $links[] = lm(t("edit"), array("mod" => "node", "op" => "edit", "id" => $nid));
+ $links[] = l(t("edit"), "node/edit/$nid");
}
$output .= "<p>". $theme->links($links) ."</p>";
@@ -1209,48 +1234,41 @@ function node_delete($edit) {
}
function node_page() {
- global $op, $id, $user, $edit, $type, $theme, $or, $and;
+ global $op, $id, $user, $edit, $theme, $or, $and;
- if ($op == "feed") {
- node_feed();
- return;
- }
+ if (user_access("access content")) {
+ if (empty($op)) {
+ $op = arg(1);
+ }
- /*
- ** Try to find a good title:
- */
+ if ($op == "feed") {
+ node_feed();
+ return;
+ }
- if ($type) {
- $title = ucfirst(module_invoke($type, "node", "name"));
- }
- else if ($edit["type"]) {
- $title = ucfirst(module_invoke($edit["type"], "node", "name"));
- }
- else {
- $title = t("Submission form");
- }
-
- $theme->header();
-
- switch ($op) {
- case "add":
- $theme->box($title, node_add($type));
- break;
- case "edit":
- $theme->box($title, node_edit($id));
- break;
- case t("Preview"):
- $edit = node_validate($edit, $error);
- $theme->box($title, node_preview($edit, $error));
- break;
- case t("Submit"):
- $theme->box($title, node_submit($edit));
- break;
- case t("Delete"):
- $theme->box($title, node_delete($edit));
- break;
- default:
- if (user_access("access content")) {
+ $theme->header();
+
+ switch ($op) {
+ case "add":
+ $theme->box(t("Create new post"), node_add(arg(2)));
+ break;
+ case "edit":
+ $theme->box(t("Edit post"), node_edit(arg(2)));
+ break;
+ case "view":
+ print node_show(arg(2), arg(3));
+ break;
+ case t("Preview"):
+ $edit = node_validate($edit, $error);
+ $theme->box(t("Preview post"), node_preview($edit, $error));
+ break;
+ case t("Submit"):
+ $theme->box(t("Submit post"), node_submit($edit));
+ break;
+ case t("Delete"):
+ $theme->box(t("Delete post"), node_delete($edit));
+ break;
+ default:
// prepare query
if ($or) {
foreach ((explode(",", $or)) as $t) {
@@ -1273,15 +1291,18 @@ function node_page() {
}
else {
$result = pager_query("SELECT nid, type FROM node WHERE ". ($id ? "nid = '$id'" : "promote = '1'") ." AND status = '1' ORDER BY static DESC, created DESC", ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
-
}
while ($node = db_fetch_object($result)) {
node_view(node_load(array("nid" => $node->nid, "type" => $node->type)), 1);
}
+
print pager_display(NULL, ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
- }
}
+ }
+ else {
+ $theme->box(t("Access denied"), message_access());
+ }
$theme->footer();
}
diff --git a/modules/page.module b/modules/page.module
index 35e2b1583..42323a8ff 100644
--- a/modules/page.module
+++ b/modules/page.module
@@ -83,12 +83,12 @@ function page_link($type) {
if ($type == "page" && user_access("access content")) {
$result = db_query("SELECT n.nid, n.title, p.link, p.description FROM page p LEFT 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, array("id" => $page->nid), "node", "", array("title" => $page->description));
+ $links[] = l($page->link, "node/view/$page->nid", array("title" => $page->description));
}
}
if ($type == "menu.create" && user_access("maintain static pages")) {
- $links[] = lm(t("create static page"), array("mod" => "node", "op" => "add", "type" => "page"), "", array("title" => t("Add a new static page.")));
+ $links[] = l(t("create static page"), "node/add/page", array("title" => t("Add a new static page.")));
}
return $links ? $links : array();
diff --git a/modules/page/page.module b/modules/page/page.module
index 35e2b1583..42323a8ff 100644
--- a/modules/page/page.module
+++ b/modules/page/page.module
@@ -83,12 +83,12 @@ function page_link($type) {
if ($type == "page" && user_access("access content")) {
$result = db_query("SELECT n.nid, n.title, p.link, p.description FROM page p LEFT 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, array("id" => $page->nid), "node", "", array("title" => $page->description));
+ $links[] = l($page->link, "node/view/$page->nid", array("title" => $page->description));
}
}
if ($type == "menu.create" && user_access("maintain static pages")) {
- $links[] = lm(t("create static page"), array("mod" => "node", "op" => "add", "type" => "page"), "", array("title" => t("Add a new static page.")));
+ $links[] = l(t("create static page"), "node/add/page", array("title" => t("Add a new static page.")));
}
return $links ? $links : array();
diff --git a/modules/ping.module b/modules/ping.module
index a4410b436..40fe2adfd 100644
--- a/modules/ping.module
+++ b/modules/ping.module
@@ -32,7 +32,7 @@ function _ping_notify($name, $url) {
}
function ping_ping($name = "", $url = "") {
- $feed = $url . drupal_url(array("mod" => "node", "op" => "feed"), "module");
+ $feed = $url . url("node/feed");
$client = new xmlrpc_client("/RPC2", "rpc.weblogs.com", 80);
diff --git a/modules/ping/ping.module b/modules/ping/ping.module
index a4410b436..40fe2adfd 100644
--- a/modules/ping/ping.module
+++ b/modules/ping/ping.module
@@ -32,7 +32,7 @@ function _ping_notify($name, $url) {
}
function ping_ping($name = "", $url = "") {
- $feed = $url . drupal_url(array("mod" => "node", "op" => "feed"), "module");
+ $feed = $url . url("node/feed");
$client = new xmlrpc_client("/RPC2", "rpc.weblogs.com", 80);
diff --git a/modules/poll.module b/modules/poll.module
index a9d61bc79..90b23cda3 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -153,10 +153,10 @@ function poll_insert($node) {
function poll_link($type, $node = 0, $main) {
if ($type == "menu.create" && user_access("create polls")) {
- $links[] = lm(t("create poll"), array("mod" => "node", "op" => "add", "type" => "poll"), "", array("title" => t("Add a new poll.")));
+ $links[] = l(t("create poll"), "node/add/poll", array("title" => t("Add a new poll.")));
}
else if ($type == "page" && user_access("access content")) {
- $links[] = lm(t("polls"), array("mod" => "poll"), "", array("title" => t("View the list of polls on this site.")));
+ $links[] = l(t("polls"), "poll", array("title" => t("View the list of polls on this site.")));
}
else if ($type == "node" && $node->type == "poll") {
/*
@@ -221,7 +221,7 @@ function poll_page() {
$result = db_query("SELECT n.nid, n.title, p.active, SUM(c.chvotes) AS votes FROM node n LEFT JOIN poll p ON n.nid=p.nid LEFT JOIN poll_choices c ON n.nid=c.nid WHERE type = 'poll' AND status = '1' AND moderate = '0' GROUP BY n.nid, n.title, p.active, n.created ORDER BY n.created DESC");
$output = "<ul>";
while ($node = db_fetch_object($result)) {
- $output .= "<li>". l($node->title, array("id" => $node->nid)) ." - ". format_plural($node->votes, "vote", "votes") ." - ". ($node->active ? t("open") : t("closed")) ."</li>";
+ $output .= "<li>". l($node->title, "node/view/$node->nid") ." - ". format_plural($node->votes, "vote", "votes") ." - ". ($node->active ? t("open") : t("closed")) ."</li>";
}
$output .= "</ul>";
$theme->box(t("Polls"), $output);
@@ -384,7 +384,7 @@ function poll_view(&$node, $main = 0, $block = 0) {
$node->body = $node->teaser = "";
$links = link_node($node, $main);
- $links[] = lm(t("older polls"), array("mod" => "poll"), "", array("title" => t("View the list of polls on this site.")));
+ $links[] = l(t("older polls"), "poll", array("title" => t("View the list of polls on this site.")));
}
if (($node->allowvotes == 1) && !$pollresults[$node->nid]) {
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index a9d61bc79..90b23cda3 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -153,10 +153,10 @@ function poll_insert($node) {
function poll_link($type, $node = 0, $main) {
if ($type == "menu.create" && user_access("create polls")) {
- $links[] = lm(t("create poll"), array("mod" => "node", "op" => "add", "type" => "poll"), "", array("title" => t("Add a new poll.")));
+ $links[] = l(t("create poll"), "node/add/poll", array("title" => t("Add a new poll.")));
}
else if ($type == "page" && user_access("access content")) {
- $links[] = lm(t("polls"), array("mod" => "poll"), "", array("title" => t("View the list of polls on this site.")));
+ $links[] = l(t("polls"), "poll", array("title" => t("View the list of polls on this site.")));
}
else if ($type == "node" && $node->type == "poll") {
/*
@@ -221,7 +221,7 @@ function poll_page() {
$result = db_query("SELECT n.nid, n.title, p.active, SUM(c.chvotes) AS votes FROM node n LEFT JOIN poll p ON n.nid=p.nid LEFT JOIN poll_choices c ON n.nid=c.nid WHERE type = 'poll' AND status = '1' AND moderate = '0' GROUP BY n.nid, n.title, p.active, n.created ORDER BY n.created DESC");
$output = "<ul>";
while ($node = db_fetch_object($result)) {
- $output .= "<li>". l($node->title, array("id" => $node->nid)) ." - ". format_plural($node->votes, "vote", "votes") ." - ". ($node->active ? t("open") : t("closed")) ."</li>";
+ $output .= "<li>". l($node->title, "node/view/$node->nid") ." - ". format_plural($node->votes, "vote", "votes") ." - ". ($node->active ? t("open") : t("closed")) ."</li>";
}
$output .= "</ul>";
$theme->box(t("Polls"), $output);
@@ -384,7 +384,7 @@ function poll_view(&$node, $main = 0, $block = 0) {
$node->body = $node->teaser = "";
$links = link_node($node, $main);
- $links[] = lm(t("older polls"), array("mod" => "poll"), "", array("title" => t("View the list of polls on this site.")));
+ $links[] = l(t("older polls"), "poll", array("title" => t("View the list of polls on this site.")));
}
if (($node->allowvotes == 1) && !$pollresults[$node->nid]) {
diff --git a/modules/queue.module b/modules/queue.module
index f27b5b56a..8593bec83 100644
--- a/modules/queue.module
+++ b/modules/queue.module
@@ -25,7 +25,7 @@ function queue_perm() {
function queue_link($type) {
if ($type == "menu.view" && user_access("access submission queue")) {
- $links[] = lm(t("view submissions"), array("mod" => "queue"), "", array("title" => t("Moderate the content in the submission queue."))) ." (<span style=\"color: red;\">". queue_count() ."</span>)";
+ $links[] = l(t("view submissions"), "queue", array("title" => t("Moderate the content in the submission queue."))) ." (<span style=\"color: red;\">". queue_count() ."</span>)";
}
return $links ? $links : array();
@@ -88,10 +88,10 @@ function queue_overview() {
$output .= " <tr><th>". t("Subject") ."</th><th>". t("Author") ."</th><th>". t("Type") ."</th><th>". t("Score") ."</th></tr>";
while ($node = db_fetch_object($result)) {
if ($user->uid == $node->uid || field_get($node->users, $user->uid)) {
- $output .= " <tr><td>". lm($node->title, array("mod" => "queue", "op" => "view", "id" => $node->nid)) ."</td><td align=\"center\">". format_name($node) ."</td><td align=\"center\">". module_invoke($node->type, "node", "name") ."</td><td align=\"center\">". queue_score($node->nid) ."</td></tr>";
+ $output .= " <tr><td>". l($node->title, "queue/$node->nid") ."</td><td align=\"center\">". format_name($node) ."</td><td align=\"center\">". module_invoke($node->type, "node", "name") ."</td><td align=\"center\">". queue_score($node->nid) ."</td></tr>";
}
else {
- $output .= " <tr><td>". lm($node->title, array("mod" => "queue", "op" => "view", "id" => $node->nid)) ."</td><td align=\"center\">". format_name($node) ."</td><td align=\"center\">". module_invoke($node->type, "node", "name") ."</td><td align=\"center\">". lm(t("vote"), array("mod" => "queue", "op" => "view", "id" => $node->nid)) ."</td></tr>";
+ $output .= " <tr><td>". l($node->title, "queue/$node->nid") ."</td><td align=\"center\">". format_name($node) ."</td><td align=\"center\">". module_invoke($node->type, "node", "name") ."</td><td align=\"center\">". l(t("vote"), "queue/$node->nid") ."</td></tr>";
}
if ($node->teaser) {
@@ -161,11 +161,11 @@ function queue_view($nid) {
}
function queue_page() {
- global $user, $id, $op, $theme, $vote;
+ global $user, $theme, $vote;
if ($user->uid && user_access("access submission queue")) {
- if ($op) {
- queue_view(check_input($id));
+ if (arg(1)) {
+ queue_view(check_input(arg(1)));
}
else {
queue_overview();
@@ -184,7 +184,7 @@ function queue_block($op = "list", $delta = 0) {
return $blocks;
}
else {
- if (user_access("access submission queue") && (substr_count(request_uri(), drupal_url(array("mod" => "queue"), "module")) || substr_count(request_uri(), drupal_url()))) {
+ if (user_access("access submission queue") && (substr_count(request_uri(), url("queue")) || substr_count(request_uri(), url()))) {
global $user, $id;
if ($user->uid) {
$node = node_load(array("nid" => $id));
@@ -202,7 +202,7 @@ function queue_block($op = "list", $delta = 0) {
$block["content"] = $output ? $output : t("This node has not been moderated yet.");
}
}
- elseif ((user_access("access submission queue") || user_access("administer blocks")) && (substr_count(request_uri(), drupal_url(array("mod" => "user"), "module")) || substr_count(request_uri(), drupal_url(array(), "admin")))) {
+ elseif ((user_access("access submission queue") || user_access("administer blocks")) && (substr_count(request_uri(), url("user")) || substr_count(request_uri(), url("admin")))) {
$block["subject"] = t("Moderation results");
}
diff --git a/modules/search.module b/modules/search.module
index 5793ec051..4e964b0d0 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -29,7 +29,7 @@ function search_perm() {
*/
function search_link($type) {
if ($type == "page" && user_access("search content")) {
- $links[] = lm(t("search"), array("mod" => "search"), "", array("title" => t("Search for older content.")));
+ $links[] = l(t("search"), "search", array("title" => t("Search for older content.")));
}
return $links ? $links : array();
@@ -41,8 +41,6 @@ function search_conf_options() {
$output .= form_textarea(t("Noise words"), "noisewords", variable_get("noisewords", ""), 70, 10, t("These words will not be indexed, enter comma separated list, linebreaks and whitespace do not matter. Example: and, or, not, a, to, I, it, ..."));
$output .= form_select(t("Help text position"), "help_pos", variable_get("help_pos", 1), array("1" => t("Above search output"), "2" => t("Below search output"), "3" => t("Link from above search output"), "4" => t("Link from below search output")), t("Where to show the help text for users on the search page."));
- // $output .= form_item(t("Create search index"), la(t("reindex all"), array("mod" => "search", "op" => "reindex")));
-
return $output;
}
@@ -167,10 +165,10 @@ function do_search($search_array) {
$count = $value["count"];
switch ($type) {
case "node":
- $find[$i++] = array("count" => $count, "title" => $title, "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "node", "type" => "node", "op" => "edit", "id" => $lno), "admin") : drupal_url(array("id" => $lno))), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
+ $find[$i++] = array("count" => $count, "title" => $title, "link" => (strstr($PHP_SELF, "admin") ? url("admin/node/edit/$lno") : url("node/view/$lno")), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
break;
case "comment":
- $find[$i++] = array("count" => $count, "title" => $title, "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "comment", "op" => "edit", "id" =>$lno), "admin") : drupal_url(array("id" => $nid, "cid" => $lno))), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
+ $find[$i++] = array("count" => $count, "title" => $title, "link" => (strstr($PHP_SELF, "admin") ? url("admin/comment/edit/$lno") : url("node/view/$nid#$cid")), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
break;
}
}
@@ -322,7 +320,7 @@ function search_view() {
$output = search_data();
// Display form and search results:
- $help_link = lm(t("search help"), array("mod" => "search", "op" => "help"));
+ $help_link = l(t("search help"), "search/help");
switch (variable_get("help_pos", 1)) {
case "1":
$form = search_help(). $form;
@@ -363,9 +361,9 @@ function search_view() {
}
function search_page() {
- global $theme, $op;
+ global $theme;
- switch ($op) {
+ switch (arg(1)) {
case "help":
$theme->header();
$theme->box(t("Search Help"), search_help());
diff --git a/modules/search/search.module b/modules/search/search.module
index 5793ec051..4e964b0d0 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -29,7 +29,7 @@ function search_perm() {
*/
function search_link($type) {
if ($type == "page" && user_access("search content")) {
- $links[] = lm(t("search"), array("mod" => "search"), "", array("title" => t("Search for older content.")));
+ $links[] = l(t("search"), "search", array("title" => t("Search for older content.")));
}
return $links ? $links : array();
@@ -41,8 +41,6 @@ function search_conf_options() {
$output .= form_textarea(t("Noise words"), "noisewords", variable_get("noisewords", ""), 70, 10, t("These words will not be indexed, enter comma separated list, linebreaks and whitespace do not matter. Example: and, or, not, a, to, I, it, ..."));
$output .= form_select(t("Help text position"), "help_pos", variable_get("help_pos", 1), array("1" => t("Above search output"), "2" => t("Below search output"), "3" => t("Link from above search output"), "4" => t("Link from below search output")), t("Where to show the help text for users on the search page."));
- // $output .= form_item(t("Create search index"), la(t("reindex all"), array("mod" => "search", "op" => "reindex")));
-
return $output;
}
@@ -167,10 +165,10 @@ function do_search($search_array) {
$count = $value["count"];
switch ($type) {
case "node":
- $find[$i++] = array("count" => $count, "title" => $title, "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "node", "type" => "node", "op" => "edit", "id" => $lno), "admin") : drupal_url(array("id" => $lno))), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
+ $find[$i++] = array("count" => $count, "title" => $title, "link" => (strstr($PHP_SELF, "admin") ? url("admin/node/edit/$lno") : url("node/view/$lno")), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
break;
case "comment":
- $find[$i++] = array("count" => $count, "title" => $title, "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "comment", "op" => "edit", "id" =>$lno), "admin") : drupal_url(array("id" => $nid, "cid" => $lno))), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
+ $find[$i++] = array("count" => $count, "title" => $title, "link" => (strstr($PHP_SELF, "admin") ? url("admin/comment/edit/$lno") : url("node/view/$nid#$cid")), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
break;
}
}
@@ -322,7 +320,7 @@ function search_view() {
$output = search_data();
// Display form and search results:
- $help_link = lm(t("search help"), array("mod" => "search", "op" => "help"));
+ $help_link = l(t("search help"), "search/help");
switch (variable_get("help_pos", 1)) {
case "1":
$form = search_help(). $form;
@@ -363,9 +361,9 @@ function search_view() {
}
function search_page() {
- global $theme, $op;
+ global $theme;
- switch ($op) {
+ switch (arg(1)) {
case "help":
$theme->header();
$theme->box(t("Search Help"), search_help());
diff --git a/modules/statistics.module b/modules/statistics.module
index d465b23c3..48596fca3 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -3,17 +3,17 @@
// Initialization hook, runs each time statistic module is loaded
function statistics_init() {
- global $id, $mod, $nid, $user, $recent_activity;
+ global $user, $recent_activity;
if (variable_get("statistics_enable_node_counter", 0)) {
// node view counters are enabled
- if (isset($id) && empty($mod)) {
+ if (arg(0) == "node" && arg(1) == "view") {
// a node has been viewed, so updated the node's counters
- db_query("UPDATE statistics SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = '%s' WHERE nid = '%s'", time(), $id);
+ db_query("UPDATE statistics SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = '%s' WHERE nid = '%s'", time(), arg(3));
// if we affected 0 rows, this is the first time viewing the node
if (!db_affected_rows()) {
// must create a new row to store counter's for new node
- db_query("INSERT INTO statistics (nid, daycount, totalcount) VALUES('%s', daycount + 1, totalcount + 1)", $id);
+ db_query("INSERT INTO statistics (nid, daycount, totalcount) VALUES('%s', daycount + 1, totalcount + 1)", arg(2));
}
}
}
@@ -23,8 +23,8 @@ function statistics_init() {
$referrer = getenv("HTTP_REFERER");
$hostname = getenv("REMOTE_ADDR");
// log this page access
- if (isset($id) && empty($mod)) {
- db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', '%s')", $id, $referrer, $hostname, $user->uid, time());
+ if (arg(0) == "node" && arg(1) == "view") {
+ db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', '%s')", arg(2), $referrer, $hostname, $user->uid, time());
}
else {
db_query("INSERT INTO accesslog (url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s')", $referrer, $hostname, $user->uid, time());
@@ -90,7 +90,7 @@ function statistics_link($type, $node = 0, $main = 0) {
$statistics = statistics_get($node->nid);
if ($statistics) {
if (user_access("administer statistics")) {
- $links[] = la(format_plural($statistics[totalcount], t("read"), t("reads")), array("mod" => "statistics", "op" => "referrers", "nid" => $node->nid));
+ $links[] = l(format_plural($statistics[totalcount], t("read"), t("reads")), "admin/statistics/referrers/$node->nid");
}
else {
$links[] = format_plural($statistics[totalcount], t("read"), t("reads"));
@@ -101,7 +101,7 @@ function statistics_link($type, $node = 0, $main = 0) {
if ($type == "page" && user_access("access content")) {
$userlink = variable_get("statistics_userpage_link", "");
if ($userlink) {
- $links[] = lm(t($userlink), array("mod" => "statistics"), "", array("title" => t("View the top nodes for this site.")));
+ $links[] = l(t($userlink), "statistics", array("title" => t("View the top nodes for this site.")));
}
}
@@ -113,18 +113,18 @@ function statistics_link($type, $node = 0, $main = 0) {
$help["top nodes block"] = "The statistics module exports a block that can display the day's top viewed nodes, the all time top viewed nodes and the last nodes viewed. Each of these links can be enabled or disabled individually, and the number of nodes displayed for each can be configured with a drop down menu. If you disable all sections of this block, it will not appear.";
$help["who is online block"] = "This statistics module exports a block that can display how many user's and guests are currently online. You can configure the name of the block, the name of a sub-block for displaying names of user's currently online, how recently a user must have been active to be considered online, the maximum characters to display from a user's name and the maximum number of user names to display.";
- menu_add("popular posts", "admin.php?mod=statistics&op=statistics", "Display the top nodes.", $help["statistics"], "site monitoring", 2, 1);
- menu_add("referrer log", "admin.php?mod=statistics&op=referrers", "Display the referrers.", $help["referrers"], "site monitoring", 3, 1);
- menu_add("view all referrers", "admin.php?mod=statistics&op=referrers&view=all", "Display all referrers.", $help["referrers"], "referre logs", 1);
- menu_add("view internal referrers", "admin.php?mod=statistics&op=referrers&view=internal", "Display internal referrers.", $help["referrers"], "referrer log", 1);
- menu_add("view external referrers", "admin.php?mod=statistics&op=referrers&view=external", "Display external referrers.", $help["referrers"], "referrer log", 1);
- menu_add("access log", "admin.php?mod=statistics&op=log", "Display the access log.", $help["access"], "site monitoring", 4);
- menu_add("configure 'top nodes' page", "admin.php?mod=statistics&op=top+nodes+page", "Configure the top node page.", $help["top nodes page"], "site monitoring", 5);
- menu_add("help", "admin.php?mod=statistics&op=help", "More information about the statistics.", NULL, "site monitoring", 6);
+ menu_add("popular posts", url("admin/statistics/statistics"), "Display the top nodes.", $help["statistics"], "site monitoring", 2, 1);
+ menu_add("referrer log", url("admin/statistics/referrers"), "Display the referrers.", $help["referrers"], "site monitoring", 3, 1);
+ menu_add("view all referrers", url("admin/statistics/referrers/all"), "Display all referrers.", $help["referrers"], "referre logs", 1);
+ menu_add("view internal referrers", url("admin/statistics/referrers/internal"), "Display internal referrers.", $help["referrers"], "referrer log", 1);
+ menu_add("view external referrers", url("admin/statistics/referrers/external"), "Display external referrers.", $help["referrers"], "referrer log", 1);
+ menu_add("access log", url("admin/statistics/log"), "Display the access log.", $help["access"], "site monitoring", 4);
+ menu_add("configure 'top nodes' page", url("admin/statistics/top+nodes+page"), "Configure the top node page.", $help["top nodes page"], "site monitoring", 5);
+ menu_add("help", url("admin/statistics/help"), "More information about the statistics.", NULL, "site monitoring", 6);
// block configuration:
- menu_add("configure 'top nodes' block", "admin.php?mod=statistics&op=top+nodes+block", "Configure the 'top nodes block'", $help["top nodes block"], "block management", 2);
- menu_add("configure 'who is online' block", "admin.php?mod=statistics&op=whos+online+block", "Configure the 'top nodes block'", $help["who is online block"], "block management", 2);
+ menu_add("configure 'top nodes' block", url("admin/statistics/top+nodes+block"), "Configure the 'top nodes block'", $help["top nodes block"], "block management", 2);
+ menu_add("configure 'who is online' block", url("admin/statistics/whos+online+block"), "Configure the 'top nodes block'", $help["who is online block"], "block management", 2);
}
return $links ? $links : array();
@@ -148,11 +148,11 @@ function statistics_help() {
<p>If you enable the node view counters, this adds 1 database query for each node that is viewed (2 queries if it's the first time the node has ever been viewed).</p>
- <p>Finally, the statistics.module allows for a congestion controlling auto-throttle mechanism. If you have enabled the throttle.module, you can read more about this mechanism <?php print l("here", array("mod" => "help"), "admin", "throttle"); ?>.</p>
+ <p>Finally, the statistics.module allows for a congestion controlling auto-throttle mechanism. If you have enabled the throttle.module, you can read more about this mechanism <?php print l("here", "admin/help#throttle"); ?>.</p>
<p>If you enable the access log, this adds 1 database query for each page that Drupal displays. Logged information includes: HTTP referrer (if any), node being accessed (if any), user ID (if any), the IP address of the user, and the time the page was viewed.</p>
- <p>As with any new module, <i>statistics.module</i> needs to be enabled <?php print l("here", array("mod" => "system", "op" => "modules"), "admin"); ?> before you can use it. Also refer to the permissions section below, as this module supports four separate permissions.</p>
+ <p>As with any new module, <i>statistics.module</i> needs to be enabled <?php print l("here", "admin/system/modules"); ?> before you can use it. Also refer to the permissions section below, as this module supports four separate permissions.</p>
<h3>View statistics</h3>
@@ -164,7 +164,7 @@ function statistics_help() {
<h3>Configuring the statistics module</h3>
- <p>There are a couple of configuration options added to the main <?php print l("site configuration", array("mod" => "system"), "admin"); ?> admin page.
+ <p>There are a couple of configuration options added to the main <?php print l("site configuration", "admin/system"); ?> admin page.
<p>The first option, <i>enable access log</i>, allows you to turn the access log on and off. This log is used to store things like referrers and who's online. Enabling the log adds one database call per page displayed by Drupal.</p>
@@ -182,7 +182,7 @@ function statistics_help() {
<p>The administrative "top nodes block" screen also allows you to assign a name to the block.</p>
- <p>Don't forget to enable the block <?php print l("here", array("mod" => "block"), "admin"); ?>.</p>
+ <p>Don't forget to enable the block <?php print l("here", "admin/block"); ?>.</p>
<h3>Top nodes page</h3>
@@ -194,11 +194,11 @@ function statistics_help() {
<p>This module creates a block that can display how many user's and guests are currently online. You are able to configure the name of the block, the name of a sub-block for displaying names of user's currently online, how recently a user must have been active to be considered online, the maximum characters to display from a user's name and the maximum number of user names to display.</p>
- <p>Don't forget to enable the block <?php print l("here", array("mod" => "block"), "admin"); ?>.</p>
+ <p>Don't forget to enable the block <?php print l("here", "admin/block"); ?>.</p>
<h3>Permissions</h3>
<p>This module has four permissions that need to be configured in
-<?php print l("user permissions", array("mod" => "user", "op" => "permission"), "admin"); ?>.</p>
+<?php print l("user permissions", "admin/user/permission"); ?>.</p>
<ul>
<li><i>access statistics</i> - enable for user roles that get to see individual node counts. (This does not define access to the block)</li>
<li><i>access userlist</i> - enable for user roles that get to see the list of user's that are currently online within the "Who's online" block.</li>
@@ -243,7 +243,7 @@ If '<i>administer statistics</i>' and '<i>access statistics</i>' are both enable
else {
// throttle limit not reached, execute normally
}</pre></p>
-<p>Note: Even though the configuration for the throttle is handled by the 'throttle.module', the throttle logic itself is part of the 'statistics.module'. The configuration has been separated in order to make things easier for the average site that will not be utilizing the throttling mechanism. More information about how the throttle works can be found on the throttle.module help page. Find the throttle help page <?php print l("here", array("mod" => "help"), "admin", "throttle"); ?> if you have enabled the throttle.module).</p>
+<p>Note: Even though the configuration for the throttle is handled by the 'throttle.module', the throttle logic itself is part of the 'statistics.module'. The configuration has been separated in order to make things easier for the average site that will not be utilizing the throttling mechanism. More information about how the throttle works can be found on the throttle.module help page. Find the throttle help page <?php print l("here", "admin/help#throttle"); ?> if you have enabled the throttle.module).</p>
<?php
}
@@ -251,10 +251,15 @@ If '<i>administer statistics</i>' and '<i>access statistics</i>' are both enable
/* Administration hook, defines module's administrative page */
function statistics_admin() {
- global $op, $id, $edit, $nid;
+ global $op, $edit;
/* Only allow people with sufficient access. */
if ((user_access("administer statistics module")) || (user_access("administer statistics"))) {
+
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
/* non-configuration admin pages */
switch ($op) {
case "help":
@@ -264,8 +269,8 @@ function statistics_admin() {
print statistics_admin_displaycounts();
exit;
case "referrers":
- print statistics_recent_refer($nid);
- print statistics_top_refer($nid);
+ print statistics_recent_refer(arg(3));
+ print statistics_top_refer(arg(3));
exit;
case "log":
print statistics_admin_displaylog();
@@ -331,7 +336,7 @@ function statistics_admin_count_table($dbfield, $dbrows) {
$header = array(t("title"), t("today"), t("all time"), t("last hit"), t("operations"));
while ($nid = db_fetch_array($result)) {
- $rows[] = array(l($nid["title"], array("id" => $nid["nid"]), "node", "", array("title" => t("View this posting."))), $nid["daycount"], $nid["totalcount"], format_date($nid["timestamp"], "small"), la("view referrers", array("mod" => "statistics", "op" => "referrers", "nid" => $nid["nid"], "title" => "$nid[title]")));
+ $rows[] = array(l($nid["title"], "node/view/". $nid["nid"], array("title" => t("View this posting."))), $nid["daycount"], $nid["totalcount"], format_date($nid["timestamp"], "small"), l("view referrers", "admin/statistics/referrers/". $nid["nid"]));
}
return table($header, $rows);
@@ -384,7 +389,7 @@ function statistics_admin_accesslog_table($type, $id) {
$url = message_na();
}
- $rows[] = array(array("data" => format_date($log["timestamp"], "small"), "nowrap" => "nowrap"), ($node->nid ? la($node->title, array("mod" => "statistics", "op" => "log", "nid" => $node->nid), "") : message_na()), ($user->name ? la((strlen($user->name) > 18 ? substr($user->name, 0, 18) . '...' : $user->name), array("mod" => "statistics", "op" => "log", "uid" => $user->uid), "") : message_na()), ($log["hostname"] ? la($log["hostname"], array("mod" => "statistics", "op" => "log", "hostname" => $log["hostname"]), "") : message_na()), $url);
+ $rows[] = array(array("data" => format_date($log["timestamp"], "small"), "nowrap" => "nowrap"), ($node->nid ? l($node->title, "statistics/log/$node->nid") : message_na()), ($user->name ? l((strlen($user->name) > 18 ? substr($user->name, 0, 18) . '...' : $user->name), "admin/statistics/log/$user->uid") : message_na()), ($log["hostname"] ? l($log["hostname"], "admin/statistics/log/". $log["hostname"]) : message_na()), $url);
}
return table($header, $rows);
@@ -411,7 +416,7 @@ function statistics_recent_refer($nid = 0) {
}
$result = db_query($query);
- $output = "<h3>". t("Most recent %describe referrers for node", array("%describe" => $describe)) ."\"". l($node->title, array("id" => "$nid"), "node", "", array("title" => t("View this posting."))) ."\"</h3>";
+ $output = "<h3>". t("Most recent %describe referrers for node", array("%describe" => $describe)) ."\"". l($node->title, "node/view/$nid", array("title" => t("View this posting."))) ."\"</h3>";
}
else {
if ($view == "all") {
@@ -460,7 +465,7 @@ function statistics_top_refer($nid = 0) {
$describe = "external ";
}
- $output = "<h3>Top ". $describe ."referrers of the past ". format_interval(variable_get("statistics_flush_accesslog_timer", 259200)) ." for node \"". l($node->title, array("id" => "$nid"), "node", "", array("title" => t("View this posting."))) ."\"</h3>";
+ $output = "<h3>Top ". $describe ."referrers of the past ". format_interval(variable_get("statistics_flush_accesslog_timer", 259200)) ." for node \"". l($node->title, "node/view/$nid", array("title" => t("View this posting."))) ."\"</h3>";
}
else {
if ($view == "all") {
@@ -766,7 +771,7 @@ function statistics_display_online_block() {
while (($uid) && ($max_users)) {
$user = user_load(array("uid" => $uid));
/* When displaying name, be sure it's not more than defined max length */
- $items[] = lm((strlen($user->name) > $max_name_len ? substr($user->name, 0, $max_name_len) . '...' : $user->name), array("mod" => "user", "op" => "view", "id" => $user->uid));
+ $items[] = l((strlen($user->name) > $max_name_len ? substr($user->name, 0, $max_name_len) ."..." : $user->name), "user/view/$user->uid");
$uid = next($user_list);
/*
** When $max_users reaches zero, we break out even if there are
@@ -893,7 +898,7 @@ function statistics_summary($dbfield, $dbrows) {
$content = node_load(array("nid" => $nid["nid"]));
$links = link_node($content, 1);
- $output .= "<tr><td><b>". l($nid["title"], array("id" => $nid["nid"]), "node", "", array("title" => t("View this posting."))) ."</b></td><td align=\"right\"><small>". t("Submitted by %a on %b", array("%a" => format_name($content), "%b" => format_date($content->created, "large"))) ."</td></tr>";
+ $output .= "<tr><td><b>". l($nid["title"], "node/view/". $nid["nid"], array("title" => t("View this posting."))) ."</b></td><td align=\"right\"><small>". t("Submitted by %a on %b", array("%a" => format_name($content), "%b" => format_date($content->created, "large"))) ."</td></tr>";
$output .= "</small><tr><td colspan=\"2\"><div style=\"margin-left: 20px;\">". check_output($content->teaser) ."</div></td></tr>";
$output .= "<tr><td align=\"right\" colspan=\"2\">[ ". $theme->links($links) ." ]<br /><br /></td></tr>";
}
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index d465b23c3..48596fca3 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -3,17 +3,17 @@
// Initialization hook, runs each time statistic module is loaded
function statistics_init() {
- global $id, $mod, $nid, $user, $recent_activity;
+ global $user, $recent_activity;
if (variable_get("statistics_enable_node_counter", 0)) {
// node view counters are enabled
- if (isset($id) && empty($mod)) {
+ if (arg(0) == "node" && arg(1) == "view") {
// a node has been viewed, so updated the node's counters
- db_query("UPDATE statistics SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = '%s' WHERE nid = '%s'", time(), $id);
+ db_query("UPDATE statistics SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = '%s' WHERE nid = '%s'", time(), arg(3));
// if we affected 0 rows, this is the first time viewing the node
if (!db_affected_rows()) {
// must create a new row to store counter's for new node
- db_query("INSERT INTO statistics (nid, daycount, totalcount) VALUES('%s', daycount + 1, totalcount + 1)", $id);
+ db_query("INSERT INTO statistics (nid, daycount, totalcount) VALUES('%s', daycount + 1, totalcount + 1)", arg(2));
}
}
}
@@ -23,8 +23,8 @@ function statistics_init() {
$referrer = getenv("HTTP_REFERER");
$hostname = getenv("REMOTE_ADDR");
// log this page access
- if (isset($id) && empty($mod)) {
- db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', '%s')", $id, $referrer, $hostname, $user->uid, time());
+ if (arg(0) == "node" && arg(1) == "view") {
+ db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', '%s')", arg(2), $referrer, $hostname, $user->uid, time());
}
else {
db_query("INSERT INTO accesslog (url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s')", $referrer, $hostname, $user->uid, time());
@@ -90,7 +90,7 @@ function statistics_link($type, $node = 0, $main = 0) {
$statistics = statistics_get($node->nid);
if ($statistics) {
if (user_access("administer statistics")) {
- $links[] = la(format_plural($statistics[totalcount], t("read"), t("reads")), array("mod" => "statistics", "op" => "referrers", "nid" => $node->nid));
+ $links[] = l(format_plural($statistics[totalcount], t("read"), t("reads")), "admin/statistics/referrers/$node->nid");
}
else {
$links[] = format_plural($statistics[totalcount], t("read"), t("reads"));
@@ -101,7 +101,7 @@ function statistics_link($type, $node = 0, $main = 0) {
if ($type == "page" && user_access("access content")) {
$userlink = variable_get("statistics_userpage_link", "");
if ($userlink) {
- $links[] = lm(t($userlink), array("mod" => "statistics"), "", array("title" => t("View the top nodes for this site.")));
+ $links[] = l(t($userlink), "statistics", array("title" => t("View the top nodes for this site.")));
}
}
@@ -113,18 +113,18 @@ function statistics_link($type, $node = 0, $main = 0) {
$help["top nodes block"] = "The statistics module exports a block that can display the day's top viewed nodes, the all time top viewed nodes and the last nodes viewed. Each of these links can be enabled or disabled individually, and the number of nodes displayed for each can be configured with a drop down menu. If you disable all sections of this block, it will not appear.";
$help["who is online block"] = "This statistics module exports a block that can display how many user's and guests are currently online. You can configure the name of the block, the name of a sub-block for displaying names of user's currently online, how recently a user must have been active to be considered online, the maximum characters to display from a user's name and the maximum number of user names to display.";
- menu_add("popular posts", "admin.php?mod=statistics&op=statistics", "Display the top nodes.", $help["statistics"], "site monitoring", 2, 1);
- menu_add("referrer log", "admin.php?mod=statistics&op=referrers", "Display the referrers.", $help["referrers"], "site monitoring", 3, 1);
- menu_add("view all referrers", "admin.php?mod=statistics&op=referrers&view=all", "Display all referrers.", $help["referrers"], "referre logs", 1);
- menu_add("view internal referrers", "admin.php?mod=statistics&op=referrers&view=internal", "Display internal referrers.", $help["referrers"], "referrer log", 1);
- menu_add("view external referrers", "admin.php?mod=statistics&op=referrers&view=external", "Display external referrers.", $help["referrers"], "referrer log", 1);
- menu_add("access log", "admin.php?mod=statistics&op=log", "Display the access log.", $help["access"], "site monitoring", 4);
- menu_add("configure 'top nodes' page", "admin.php?mod=statistics&op=top+nodes+page", "Configure the top node page.", $help["top nodes page"], "site monitoring", 5);
- menu_add("help", "admin.php?mod=statistics&op=help", "More information about the statistics.", NULL, "site monitoring", 6);
+ menu_add("popular posts", url("admin/statistics/statistics"), "Display the top nodes.", $help["statistics"], "site monitoring", 2, 1);
+ menu_add("referrer log", url("admin/statistics/referrers"), "Display the referrers.", $help["referrers"], "site monitoring", 3, 1);
+ menu_add("view all referrers", url("admin/statistics/referrers/all"), "Display all referrers.", $help["referrers"], "referre logs", 1);
+ menu_add("view internal referrers", url("admin/statistics/referrers/internal"), "Display internal referrers.", $help["referrers"], "referrer log", 1);
+ menu_add("view external referrers", url("admin/statistics/referrers/external"), "Display external referrers.", $help["referrers"], "referrer log", 1);
+ menu_add("access log", url("admin/statistics/log"), "Display the access log.", $help["access"], "site monitoring", 4);
+ menu_add("configure 'top nodes' page", url("admin/statistics/top+nodes+page"), "Configure the top node page.", $help["top nodes page"], "site monitoring", 5);
+ menu_add("help", url("admin/statistics/help"), "More information about the statistics.", NULL, "site monitoring", 6);
// block configuration:
- menu_add("configure 'top nodes' block", "admin.php?mod=statistics&op=top+nodes+block", "Configure the 'top nodes block'", $help["top nodes block"], "block management", 2);
- menu_add("configure 'who is online' block", "admin.php?mod=statistics&op=whos+online+block", "Configure the 'top nodes block'", $help["who is online block"], "block management", 2);
+ menu_add("configure 'top nodes' block", url("admin/statistics/top+nodes+block"), "Configure the 'top nodes block'", $help["top nodes block"], "block management", 2);
+ menu_add("configure 'who is online' block", url("admin/statistics/whos+online+block"), "Configure the 'top nodes block'", $help["who is online block"], "block management", 2);
}
return $links ? $links : array();
@@ -148,11 +148,11 @@ function statistics_help() {
<p>If you enable the node view counters, this adds 1 database query for each node that is viewed (2 queries if it's the first time the node has ever been viewed).</p>
- <p>Finally, the statistics.module allows for a congestion controlling auto-throttle mechanism. If you have enabled the throttle.module, you can read more about this mechanism <?php print l("here", array("mod" => "help"), "admin", "throttle"); ?>.</p>
+ <p>Finally, the statistics.module allows for a congestion controlling auto-throttle mechanism. If you have enabled the throttle.module, you can read more about this mechanism <?php print l("here", "admin/help#throttle"); ?>.</p>
<p>If you enable the access log, this adds 1 database query for each page that Drupal displays. Logged information includes: HTTP referrer (if any), node being accessed (if any), user ID (if any), the IP address of the user, and the time the page was viewed.</p>
- <p>As with any new module, <i>statistics.module</i> needs to be enabled <?php print l("here", array("mod" => "system", "op" => "modules"), "admin"); ?> before you can use it. Also refer to the permissions section below, as this module supports four separate permissions.</p>
+ <p>As with any new module, <i>statistics.module</i> needs to be enabled <?php print l("here", "admin/system/modules"); ?> before you can use it. Also refer to the permissions section below, as this module supports four separate permissions.</p>
<h3>View statistics</h3>
@@ -164,7 +164,7 @@ function statistics_help() {
<h3>Configuring the statistics module</h3>
- <p>There are a couple of configuration options added to the main <?php print l("site configuration", array("mod" => "system"), "admin"); ?> admin page.
+ <p>There are a couple of configuration options added to the main <?php print l("site configuration", "admin/system"); ?> admin page.
<p>The first option, <i>enable access log</i>, allows you to turn the access log on and off. This log is used to store things like referrers and who's online. Enabling the log adds one database call per page displayed by Drupal.</p>
@@ -182,7 +182,7 @@ function statistics_help() {
<p>The administrative "top nodes block" screen also allows you to assign a name to the block.</p>
- <p>Don't forget to enable the block <?php print l("here", array("mod" => "block"), "admin"); ?>.</p>
+ <p>Don't forget to enable the block <?php print l("here", "admin/block"); ?>.</p>
<h3>Top nodes page</h3>
@@ -194,11 +194,11 @@ function statistics_help() {
<p>This module creates a block that can display how many user's and guests are currently online. You are able to configure the name of the block, the name of a sub-block for displaying names of user's currently online, how recently a user must have been active to be considered online, the maximum characters to display from a user's name and the maximum number of user names to display.</p>
- <p>Don't forget to enable the block <?php print l("here", array("mod" => "block"), "admin"); ?>.</p>
+ <p>Don't forget to enable the block <?php print l("here", "admin/block"); ?>.</p>
<h3>Permissions</h3>
<p>This module has four permissions that need to be configured in
-<?php print l("user permissions", array("mod" => "user", "op" => "permission"), "admin"); ?>.</p>
+<?php print l("user permissions", "admin/user/permission"); ?>.</p>
<ul>
<li><i>access statistics</i> - enable for user roles that get to see individual node counts. (This does not define access to the block)</li>
<li><i>access userlist</i> - enable for user roles that get to see the list of user's that are currently online within the "Who's online" block.</li>
@@ -243,7 +243,7 @@ If '<i>administer statistics</i>' and '<i>access statistics</i>' are both enable
else {
// throttle limit not reached, execute normally
}</pre></p>
-<p>Note: Even though the configuration for the throttle is handled by the 'throttle.module', the throttle logic itself is part of the 'statistics.module'. The configuration has been separated in order to make things easier for the average site that will not be utilizing the throttling mechanism. More information about how the throttle works can be found on the throttle.module help page. Find the throttle help page <?php print l("here", array("mod" => "help"), "admin", "throttle"); ?> if you have enabled the throttle.module).</p>
+<p>Note: Even though the configuration for the throttle is handled by the 'throttle.module', the throttle logic itself is part of the 'statistics.module'. The configuration has been separated in order to make things easier for the average site that will not be utilizing the throttling mechanism. More information about how the throttle works can be found on the throttle.module help page. Find the throttle help page <?php print l("here", "admin/help#throttle"); ?> if you have enabled the throttle.module).</p>
<?php
}
@@ -251,10 +251,15 @@ If '<i>administer statistics</i>' and '<i>access statistics</i>' are both enable
/* Administration hook, defines module's administrative page */
function statistics_admin() {
- global $op, $id, $edit, $nid;
+ global $op, $edit;
/* Only allow people with sufficient access. */
if ((user_access("administer statistics module")) || (user_access("administer statistics"))) {
+
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
/* non-configuration admin pages */
switch ($op) {
case "help":
@@ -264,8 +269,8 @@ function statistics_admin() {
print statistics_admin_displaycounts();
exit;
case "referrers":
- print statistics_recent_refer($nid);
- print statistics_top_refer($nid);
+ print statistics_recent_refer(arg(3));
+ print statistics_top_refer(arg(3));
exit;
case "log":
print statistics_admin_displaylog();
@@ -331,7 +336,7 @@ function statistics_admin_count_table($dbfield, $dbrows) {
$header = array(t("title"), t("today"), t("all time"), t("last hit"), t("operations"));
while ($nid = db_fetch_array($result)) {
- $rows[] = array(l($nid["title"], array("id" => $nid["nid"]), "node", "", array("title" => t("View this posting."))), $nid["daycount"], $nid["totalcount"], format_date($nid["timestamp"], "small"), la("view referrers", array("mod" => "statistics", "op" => "referrers", "nid" => $nid["nid"], "title" => "$nid[title]")));
+ $rows[] = array(l($nid["title"], "node/view/". $nid["nid"], array("title" => t("View this posting."))), $nid["daycount"], $nid["totalcount"], format_date($nid["timestamp"], "small"), l("view referrers", "admin/statistics/referrers/". $nid["nid"]));
}
return table($header, $rows);
@@ -384,7 +389,7 @@ function statistics_admin_accesslog_table($type, $id) {
$url = message_na();
}
- $rows[] = array(array("data" => format_date($log["timestamp"], "small"), "nowrap" => "nowrap"), ($node->nid ? la($node->title, array("mod" => "statistics", "op" => "log", "nid" => $node->nid), "") : message_na()), ($user->name ? la((strlen($user->name) > 18 ? substr($user->name, 0, 18) . '...' : $user->name), array("mod" => "statistics", "op" => "log", "uid" => $user->uid), "") : message_na()), ($log["hostname"] ? la($log["hostname"], array("mod" => "statistics", "op" => "log", "hostname" => $log["hostname"]), "") : message_na()), $url);
+ $rows[] = array(array("data" => format_date($log["timestamp"], "small"), "nowrap" => "nowrap"), ($node->nid ? l($node->title, "statistics/log/$node->nid") : message_na()), ($user->name ? l((strlen($user->name) > 18 ? substr($user->name, 0, 18) . '...' : $user->name), "admin/statistics/log/$user->uid") : message_na()), ($log["hostname"] ? l($log["hostname"], "admin/statistics/log/". $log["hostname"]) : message_na()), $url);
}
return table($header, $rows);
@@ -411,7 +416,7 @@ function statistics_recent_refer($nid = 0) {
}
$result = db_query($query);
- $output = "<h3>". t("Most recent %describe referrers for node", array("%describe" => $describe)) ."\"". l($node->title, array("id" => "$nid"), "node", "", array("title" => t("View this posting."))) ."\"</h3>";
+ $output = "<h3>". t("Most recent %describe referrers for node", array("%describe" => $describe)) ."\"". l($node->title, "node/view/$nid", array("title" => t("View this posting."))) ."\"</h3>";
}
else {
if ($view == "all") {
@@ -460,7 +465,7 @@ function statistics_top_refer($nid = 0) {
$describe = "external ";
}
- $output = "<h3>Top ". $describe ."referrers of the past ". format_interval(variable_get("statistics_flush_accesslog_timer", 259200)) ." for node \"". l($node->title, array("id" => "$nid"), "node", "", array("title" => t("View this posting."))) ."\"</h3>";
+ $output = "<h3>Top ". $describe ."referrers of the past ". format_interval(variable_get("statistics_flush_accesslog_timer", 259200)) ." for node \"". l($node->title, "node/view/$nid", array("title" => t("View this posting."))) ."\"</h3>";
}
else {
if ($view == "all") {
@@ -766,7 +771,7 @@ function statistics_display_online_block() {
while (($uid) && ($max_users)) {
$user = user_load(array("uid" => $uid));
/* When displaying name, be sure it's not more than defined max length */
- $items[] = lm((strlen($user->name) > $max_name_len ? substr($user->name, 0, $max_name_len) . '...' : $user->name), array("mod" => "user", "op" => "view", "id" => $user->uid));
+ $items[] = l((strlen($user->name) > $max_name_len ? substr($user->name, 0, $max_name_len) ."..." : $user->name), "user/view/$user->uid");
$uid = next($user_list);
/*
** When $max_users reaches zero, we break out even if there are
@@ -893,7 +898,7 @@ function statistics_summary($dbfield, $dbrows) {
$content = node_load(array("nid" => $nid["nid"]));
$links = link_node($content, 1);
- $output .= "<tr><td><b>". l($nid["title"], array("id" => $nid["nid"]), "node", "", array("title" => t("View this posting."))) ."</b></td><td align=\"right\"><small>". t("Submitted by %a on %b", array("%a" => format_name($content), "%b" => format_date($content->created, "large"))) ."</td></tr>";
+ $output .= "<tr><td><b>". l($nid["title"], "node/view/". $nid["nid"], array("title" => t("View this posting."))) ."</b></td><td align=\"right\"><small>". t("Submitted by %a on %b", array("%a" => format_name($content), "%b" => format_date($content->created, "large"))) ."</td></tr>";
$output .= "</small><tr><td colspan=\"2\"><div style=\"margin-left: 20px;\">". check_output($content->teaser) ."</div></td></tr>";
$output .= "<tr><td align=\"right\" colspan=\"2\">[ ". $theme->links($links) ." ]<br /><br /></td></tr>";
}
diff --git a/modules/story.module b/modules/story.module
index 259b2e3ba..48095da5e 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -66,7 +66,7 @@ function story_save($op, $node) {
function story_link($type) {
if ($type == "menu.create" && user_access("create stories")) {
- $links[] = lm(t("create story"), array("mod" => "node", "op" => "add", "type" => "story"), "", array("title" => t("Add a new story.")));
+ $links[] = l(t("create story"), "node/add/story", array("title" => t("Add a new story.")));
}
return $links ? $links : array();
diff --git a/modules/story/story.module b/modules/story/story.module
index 259b2e3ba..48095da5e 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -66,7 +66,7 @@ function story_save($op, $node) {
function story_link($type) {
if ($type == "menu.create" && user_access("create stories")) {
- $links[] = lm(t("create story"), array("mod" => "node", "op" => "add", "type" => "story"), "", array("title" => t("Add a new story.")));
+ $links[] = l(t("create story"), "node/add/story", array("title" => t("Add a new story.")));
}
return $links ? $links : array();
diff --git a/modules/system.module b/modules/system.module
index 112b05a57..a7f974069 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -34,12 +34,12 @@ function system_perm() {
function system_link($type) {
if ($type == "admin" && user_access("administer site configuration")) {
- menu_add("site configuration", "admin.php?mod=system", "Site configuration.", NULL, NULL, 2);
- menu_add("site settings", "admin.php?mod=system&op=options", "Site settings.", NULL, "site configuration", 1);
- menu_add("content filters", "admin.php?mod=system&op=filters", "Content filters.", NULL, "site configuration", 2);
- menu_add("module selector", "admin.php?mod=system&op=modules", "Module selector.", NULL, "site configuration", 3);
- menu_add("theme selector", "admin.php?mod=system&op=themes", "Theme selector.", NULL, "site configuration", 4);
- menu_add("help", "admin.php?mod=system&op=help", "Help.", NULL, "site configuration", 9);
+ menu_add("site configuration", url("admin/system"), "Site configuration.", NULL, NULL, 2);
+ menu_add("site settings", url("admin/system/options"), "Site settings.", NULL, "site configuration", 1);
+ menu_add("content filters", url("admin/system/filters"), "Content filters.", NULL, "site configuration", 2);
+ menu_add("module selector", url("admin/system/modules"), "Module selector.", NULL, "site configuration", 3);
+ menu_add("theme selector", url("admin/system/themes"), "Theme selector.", NULL, "site configuration", 4);
+ menu_add("help", url("admin/system/help"), "Help.", NULL, "site configuration", 9);
}
}
@@ -132,7 +132,7 @@ function system_view($type) {
default:
foreach (module_list() as $name) {
if (module_hook($name, "conf_options")) {
- $links[] = la(t("$name"), array("mod" => "system"), $name);
+ $links[] = l(t("$name"), "admin/system#$name");
}
}
@@ -218,9 +218,13 @@ function system_listing($type, $directory, $required = array()) {
}
function system_admin() {
- global $edit, $op, $type;
+ global $op, $edit;
if (user_access("administer site configuration")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case "help":
print system_help();
@@ -233,7 +237,7 @@ function system_admin() {
cache_clear_all();
case "modules":
// Note: changing this also requires changing module_init() @ includes/module.inc.
- $required = array("modules/user.module", "modules/system.module", "modules/watchdog.module");
+ $required = array("modules/admin.module", "modules/user.module", "modules/system.module", "modules/watchdog.module");
print system_listing("module", "modules", $required);
break;
case t("Save theme settings"):
@@ -247,12 +251,12 @@ function system_admin() {
break;
case t("Reset to defaults"):
print status(system_default($edit));
- print system_view($type);
+ print system_view(arg(3));
cache_clear_all();
break;
case t("Save configuration"):
print status(system_save($edit));
- print system_view($type);
+ print system_view(arg(3));
cache_clear_all();
break;
default:
diff --git a/modules/system/system.module b/modules/system/system.module
index 112b05a57..a7f974069 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -34,12 +34,12 @@ function system_perm() {
function system_link($type) {
if ($type == "admin" && user_access("administer site configuration")) {
- menu_add("site configuration", "admin.php?mod=system", "Site configuration.", NULL, NULL, 2);
- menu_add("site settings", "admin.php?mod=system&op=options", "Site settings.", NULL, "site configuration", 1);
- menu_add("content filters", "admin.php?mod=system&op=filters", "Content filters.", NULL, "site configuration", 2);
- menu_add("module selector", "admin.php?mod=system&op=modules", "Module selector.", NULL, "site configuration", 3);
- menu_add("theme selector", "admin.php?mod=system&op=themes", "Theme selector.", NULL, "site configuration", 4);
- menu_add("help", "admin.php?mod=system&op=help", "Help.", NULL, "site configuration", 9);
+ menu_add("site configuration", url("admin/system"), "Site configuration.", NULL, NULL, 2);
+ menu_add("site settings", url("admin/system/options"), "Site settings.", NULL, "site configuration", 1);
+ menu_add("content filters", url("admin/system/filters"), "Content filters.", NULL, "site configuration", 2);
+ menu_add("module selector", url("admin/system/modules"), "Module selector.", NULL, "site configuration", 3);
+ menu_add("theme selector", url("admin/system/themes"), "Theme selector.", NULL, "site configuration", 4);
+ menu_add("help", url("admin/system/help"), "Help.", NULL, "site configuration", 9);
}
}
@@ -132,7 +132,7 @@ function system_view($type) {
default:
foreach (module_list() as $name) {
if (module_hook($name, "conf_options")) {
- $links[] = la(t("$name"), array("mod" => "system"), $name);
+ $links[] = l(t("$name"), "admin/system#$name");
}
}
@@ -218,9 +218,13 @@ function system_listing($type, $directory, $required = array()) {
}
function system_admin() {
- global $edit, $op, $type;
+ global $op, $edit;
if (user_access("administer site configuration")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case "help":
print system_help();
@@ -233,7 +237,7 @@ function system_admin() {
cache_clear_all();
case "modules":
// Note: changing this also requires changing module_init() @ includes/module.inc.
- $required = array("modules/user.module", "modules/system.module", "modules/watchdog.module");
+ $required = array("modules/admin.module", "modules/user.module", "modules/system.module", "modules/watchdog.module");
print system_listing("module", "modules", $required);
break;
case t("Save theme settings"):
@@ -247,12 +251,12 @@ function system_admin() {
break;
case t("Reset to defaults"):
print status(system_default($edit));
- print system_view($type);
+ print system_view(arg(3));
cache_clear_all();
break;
case t("Save configuration"):
print status(system_save($edit));
- print system_view($type);
+ print system_view(arg(3));
cache_clear_all();
break;
default:
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index 6cb25f59b..e484dad27 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -32,7 +32,7 @@ function taxonomy_feed() {
}
$channel["title"] = variable_get("site_name", "drupal") ." - ". $term->name;
- $channel["link"] = path_uri() ."index.php?or=$or";
+ $channel["link"] = path_uri() ."?or=$or";
$channel["description"] = $term->description;
node_feed($result, $channel);
@@ -48,9 +48,9 @@ function taxonomy_link($type) {
$help["taxonomy"] = "The taxonomy module allows you to classify post into categories and subcategories; it allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically).";
$help["vocabulary"] = "When you create a controlled vocabulary you are creating a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each node of content (blog, story, etc.) using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slashdot.org's or Kuro5hin.org's sections. For more complex implementations, you might create a hierarchical list of categories.";
- menu_add("taxonomy", "admin.php?mod=taxonomy", "Administer taxonomies.", $help["taxonomy"], "content management", 1, 1);
- menu_add("add new vocabulary", "admin.php?mod=taxonomy&op=add&type=vocabulary", "Add a new vocabulary.", $help["vocabulary"], "taxonomy");
- menu_add("help", "admin.php?mod=taxonomy&op=help", "More information about taxonomies.", NULL, "taxonomy", 9);
+ menu_add("taxonomy", url("admin/taxonomy"), "Administer taxonomies.", $help["taxonomy"], "content management", 1, 1);
+ menu_add("add new vocabulary", url("admin/taxonomy/add/vocabulary"), "Add a new vocabulary.", $help["vocabulary"], "taxonomy");
+ menu_add("help", url("admin/taxonomy/help"), "More information about taxonomies.", NULL, "taxonomy", 9);
}
}
@@ -68,8 +68,8 @@ function taxonomy_form_vocabulary($edit = array()) {
$form .= form_textfield(t("Vocabulary name"), "name", $edit["name"], 50, 64, t("Required") . ". " . t("The name for this vocabulary. Example: 'Topic'") . ".");
$form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") . ". " . t("Description of the vocabulary, can be used by modules."));
$form .= form_select(t("Types"), "types", explode(",", $edit["types"]), $nodetypes, t("Required") . ". " . t("A list of node types you want to associate this vocabulary with."), "", 1);
- $form .= form_checkbox(t("Related terms"), "relations", 1, $edit["relations"], t("Optional") . ". " . t("Allows ". la("related terms", array("mod" => "taxonomy", "op" => "help"), "relatedterms") ." in this vocabulary."));
- $form .= form_select(t("Hierarchy"), "hierarchy", $edit["hierarchy"], array(t("Disabled"), t("Single"), t("Multiple")), t("Optional") . ". ". t("Allows ". la("a tree-like hierarchy", array("mod" => "taxonomy", "op" => "help"), "hierarchy") ." between terms of this vocabulary."), "", 0);
+ $form .= form_checkbox(t("Related terms"), "relations", 1, $edit["relations"], t("Optional") . ". " . t("Allows ". l("related terms", "admin/taxonomy/help#relatedterms") ." in this vocabulary."));
+ $form .= form_select(t("Hierarchy"), "hierarchy", $edit["hierarchy"], array(t("Disabled"), t("Single"), t("Multiple")), t("Optional") . ". ". t("Allows ". l("a tree-like hierarchy", "admin/taxonomy/help#hierarchy") ." between terms of this vocabulary."), "", 0);
$form .= form_checkbox(t("Multiple select"), "multiple", 1, $edit["multiple"], t("Optional") . ". " . t("Allows nodes to have more than one term in this vocabulary."));
$form .= form_checkbox(t("Required"), "required", 1, $edit["required"], t("If enabled every node <b>must</b> have at least one term in this vocabulary"));
$form .= form_weight(t("Weight"), "weight", $edit["weight"], 10, t("Optional. In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top."));
@@ -135,7 +135,7 @@ function _taxonomy_confirm_del_vocabulary($vid) {
}
function taxonomy_form_term($edit = array()) {
- global $vocabulary_id;
+ $vocabulary_id = arg(4);
if (!$vocabulary_id) {
$vocabulary_id = $edit["vid"];
@@ -160,14 +160,14 @@ function taxonomy_form_term($edit = array()) {
$exclude[] = $edit["tid"];
if ($vocabulary->hierarchy == 1) {
- $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") . ". " . la(t("Parent term"), array("mod" => "taxonomy", "op" => "help"), "parent") .".", 0, "<" . t("root") . ">", $exclude);
+ $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") . ". " . l(t("Parent term"), "admin/taxonomy/help#parent") .".", 0, "<" . t("root") . ">", $exclude);
}
elseif ($vocabulary->hierarchy == 2) {
- $form .= _taxonomy_term_select(t("Parents"), "parent", $parent, $vocabulary_id, t("Required") . ". ". la(t("Parent terms"), array("mod" => "taxonomy", "op" => "help"), "parent") .".", 1, "<" . t("root") . ">", $exclude);
+ $form .= _taxonomy_term_select(t("Parents"), "parent", $parent, $vocabulary_id, t("Required") . ". ". l(t("Parent terms"), "admin/taxonomy/help#parent") .".", 1, "<" . t("root") . ">", $exclude);
}
}
- $form .= form_textarea(t("Synonyms"), "synonyms", implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, t("Optional") . ". ". t(la("Synonyms", array("mod" => "taxonomy", "op" => "help"), "synonyms") ." of this term, one synonym per line."));
+ $form .= form_textarea(t("Synonyms"), "synonyms", implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, t("Optional") . ". ". t(l("Synonyms", "admin/taxonomy/help#synonyms") ." of this term, one synonym per line."));
$form .= form_weight(t("Weight"), "weight", $edit["weight"], 10, t("Optional. In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top."));
$form .= form_hidden("vid", $vocabulary->vid);
$form .= form_submit(t("Submit"));
@@ -275,13 +275,13 @@ function taxonomy_overview() {
foreach ($vocabularies as $vocabulary) {
$links = array();
- $rows[] = array($vocabulary->name, array("data" => $vocabulary->types, "align" => "center"), la(t("edit vocabulary"), array("mod" => "taxonomy", "type" => "vocabulary", "op" => "edit", "id" => $vocabulary->vid)), la(t("add term"), array("mod" => "taxonomy", "op" => "add", "type" => "leaf", "vocabulary_id" => $vocabulary->vid)), la(t("preview form"), array("mod" => "taxonomy", "type" => "vocabulary", "op" => "preview", "id" => $vocabulary->vid)));
+ $rows[] = array($vocabulary->name, array("data" => $vocabulary->types, "align" => "center"), l(t("edit vocabulary"), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"), l(t("add term"), "admin/taxonomy/add/term/$vocabulary->vid"), l(t("preview form"), "admin/taxonomy/preview/vocabulary/$vocabulary->vid"));
$tree = taxonomy_get_tree($vocabulary->vid);
if ($tree) {
unset($data);
foreach ($tree as $term) {
- $data .= _taxonomy_depth($term->depth) ." ". $term->name ." (". la(t("edit term"), array("mod" => "taxonomy", "op" => "edit", "type" => "term", "id" => $term->tid)) .")<br />";
+ $data .= _taxonomy_depth($term->depth) ." ". $term->name ." (". l(t("edit term"), "admin/taxonomy/edit/term/$term->tid") .")<br />";
}
$rows[] = array(array("data" => $data, "colspan" => 5));
}
@@ -642,9 +642,8 @@ function _prepare_insert($data, $stage) {
}
function taxonomy_page() {
- global $op;
- switch ($op) {
+ switch (arg(1)) {
case "feed":
taxonomy_feed();
break;
@@ -658,12 +657,16 @@ function taxonomy_page() {
*/
function taxonomy_admin() {
- global $edit, $type, $op, $id, $theme;
+ global $op, $edit, $theme;
if (user_access("administer taxonomy")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case "add":
- if ($type == "vocabulary") {
+ if (arg(3) == "vocabulary") {
print taxonomy_form_vocabulary();
}
else {
@@ -671,22 +674,22 @@ function taxonomy_admin() {
}
break;
case "edit":
- if ($type == "vocabulary") {
- print taxonomy_form_vocabulary(object2array(taxonomy_get_vocabulary($id)));
+ if (arg(3) == "vocabulary") {
+ print taxonomy_form_vocabulary(object2array(taxonomy_get_vocabulary(arg(4))));
}
else {
- print taxonomy_form_term(object2array(taxonomy_get_term($id)));
+ print taxonomy_form_term(object2array(taxonomy_get_term(arg(4))));
}
break;
case "preview":
- print taxonomy_form($id);
+ print taxonomy_form(arg(4));
break;
case "help":
print taxonomy_help();
break;
case t("Delete"):
if (!$edit["confirm"]) {
- if ($type == "vocabulary") {
+ if (arg(3) == "vocabulary") {
echo _taxonomy_confirm_del_vocabulary($edit["vid"]);
}
else {
@@ -699,7 +702,7 @@ function taxonomy_admin() {
// fall through:
}
case t("Submit"):
- if ($type == "vocabulary") {
+ if (arg(3) == "vocabulary") {
print status(taxonomy_save_vocabulary($edit));
}
else {
@@ -725,20 +728,20 @@ function taxonomy_help() {
?>
<h3>Background</h3>
- <p>Classifying nodes allows for the organization of content into categories and subcategories of description. These categories can be used to organize and retrieve similarly described content. Drupal's <i>taxonomy.module</i> is an extremely flexible classification system that allows for multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). For details about <a href="http://www.eleganthack.com/archives/002165.html#002165">classification types</a> and insight into the development of <i>taxonomy.module</i>, see this <a href="http://www.drupal.org/node.php?id=55">drupal.org discussion</a>.</p>
+ <p>Classifying nodes allows for the organization of content into categories and subcategories of description. These categories can be used to organize and retrieve similarly described content. Drupal's <i>taxonomy.module</i> is an extremely flexible classification system that allows for multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). For details about <a href="http://www.eleganthack.com/archives/002165.html#002165">classification types</a> and insight into the development of <i>taxonomy.module</i>, see this <a href="http://www.drupal.org/node/view/55">drupal.org discussion</a>.</p>
<h3>An example taxonomy: food</h3>
- <p>Dairy <br />
- --Milk <br />
- Drink <br />
- --Alchohol <br />
- --Pop <br />
+ <p>Dairy<br />
+ --Milk<br />
+ Drink<br />
+ --Alchohol<br />
+ --Pop<br />
--Milk<br />
- Meat <br />
- --Beef <br />
- --Chicken <br />
- --Lamb <br />
- Spices <br />
+ Meat<br />
+ --Beef<br />
+ --Chicken<br />
+ --Lamb<br />
+ Spices<br />
--Sugar</p>
<p><b>Notes</b></p>
<ul>
@@ -776,10 +779,10 @@ function taxonomy_help() {
<i><a name="synonyms"></a>Synonyms</i><br />Optional. Enter synonyms for this term, one synonym per line. Synonyms can be used for variant spellings, acronyms, and other terms that have the same meaning as the added term, but which are not explicitly listed in this thesaurus (i.e. <i>unauthorized terms</i>).<br />
<h3>Displaying nodes organized by term(s)</h3>
- <p>In order to view the nodes associated with a term or a collection of terms, you should browse to a properly formed URL. For example, see <a href="<?php print path_uri().drupal_url(array("mod" => "node", "or" => "1,2"), "module"); ?>"><?php print path_uri().drupal_url(array("mod" => "node", "or" => "1,2"), "module"); ?></a>. Taxonomy URLs always contain a term ID or list of term IDs at the end of the URL (aka <i>querystring</i>). You may learn the term ID for a given term by hovering over that term in the <?php echo la("taxonomy overview", array("mod" => "taxonomy")) ?> page in the Admin and noting the number after the querystring parameter called <i>tid</i>. If you wish to see nodes from a collection of term IDs, separate each term ID with a comma. Also, the name of the querystring parameter may be <i>or</i> or <i>and</i>: <i>or</i> shows nodes which appear in <b>any</b> of the term IDs while <i>and</i> shows nodes in <b>all</b> the specified term IDs. Thus, <i>or</i> is less specific than <i>and</i>.</p>
+ <p>In order to view the nodes associated with a term or a collection of terms, you should browse to a properly formed URL. For example, see <a href="<?php print path_uri() . url("node", "or=1,2"); ?>"><?php print path_uri() . url("node", "or=1,2"); ?></a>. Taxonomy URLs always contain a term ID or list of term IDs at the end of the URL (aka <i>querystring</i>). You may learn the term ID for a given term by hovering over that term in the <?php echo l("taxonomy overview", "admin/taxonomy") ?> page in the Admin and noting the number after the querystring parameter called <i>tid</i>. If you wish to see nodes from a collection of term IDs, separate each term ID with a comma. Also, the name of the querystring parameter may be <i>or</i> or <i>and</i>: <i>or</i> shows nodes which appear in <b>any</b> of the term IDs while <i>and</i> shows nodes in <b>all</b> the specified term IDs. Thus, <i>or</i> is less specific than <i>and</i>.</p>
<h3>RSS feeds</h3>
- <p>Every term, or collection of terms, provides an <a href="http://backend.userland.com/stories/rss091">RSS</a> feed to which interested users may subscribe. The URL format for an sample RSS feed is <a href="<?php print path_uri().drupal_url(array("mod" => "node", "op" => "feed", "or" => "1,2"), "module"); ?>"><?php print path_uri().drupal_url(array("mod" => "node", "op" => "feed", "or" => "1,2"), "module"); ?></a>.</p>
+ <p>Every term, or collection of terms, provides an <a href="http://backend.userland.com/stories/rss091">RSS</a> feed to which interested users may subscribe. The URL format for an sample RSS feed is <a href="<?php print path_uri() . url("node/feed", "or=1,2"); ?>"><?php print path_uri() . url("node/feed", "or=1,2"); ?></a>.</p>
<?php
}
?> \ No newline at end of file
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 6cb25f59b..e484dad27 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -32,7 +32,7 @@ function taxonomy_feed() {
}
$channel["title"] = variable_get("site_name", "drupal") ." - ". $term->name;
- $channel["link"] = path_uri() ."index.php?or=$or";
+ $channel["link"] = path_uri() ."?or=$or";
$channel["description"] = $term->description;
node_feed($result, $channel);
@@ -48,9 +48,9 @@ function taxonomy_link($type) {
$help["taxonomy"] = "The taxonomy module allows you to classify post into categories and subcategories; it allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically).";
$help["vocabulary"] = "When you create a controlled vocabulary you are creating a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each node of content (blog, story, etc.) using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slashdot.org's or Kuro5hin.org's sections. For more complex implementations, you might create a hierarchical list of categories.";
- menu_add("taxonomy", "admin.php?mod=taxonomy", "Administer taxonomies.", $help["taxonomy"], "content management", 1, 1);
- menu_add("add new vocabulary", "admin.php?mod=taxonomy&op=add&type=vocabulary", "Add a new vocabulary.", $help["vocabulary"], "taxonomy");
- menu_add("help", "admin.php?mod=taxonomy&op=help", "More information about taxonomies.", NULL, "taxonomy", 9);
+ menu_add("taxonomy", url("admin/taxonomy"), "Administer taxonomies.", $help["taxonomy"], "content management", 1, 1);
+ menu_add("add new vocabulary", url("admin/taxonomy/add/vocabulary"), "Add a new vocabulary.", $help["vocabulary"], "taxonomy");
+ menu_add("help", url("admin/taxonomy/help"), "More information about taxonomies.", NULL, "taxonomy", 9);
}
}
@@ -68,8 +68,8 @@ function taxonomy_form_vocabulary($edit = array()) {
$form .= form_textfield(t("Vocabulary name"), "name", $edit["name"], 50, 64, t("Required") . ". " . t("The name for this vocabulary. Example: 'Topic'") . ".");
$form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") . ". " . t("Description of the vocabulary, can be used by modules."));
$form .= form_select(t("Types"), "types", explode(",", $edit["types"]), $nodetypes, t("Required") . ". " . t("A list of node types you want to associate this vocabulary with."), "", 1);
- $form .= form_checkbox(t("Related terms"), "relations", 1, $edit["relations"], t("Optional") . ". " . t("Allows ". la("related terms", array("mod" => "taxonomy", "op" => "help"), "relatedterms") ." in this vocabulary."));
- $form .= form_select(t("Hierarchy"), "hierarchy", $edit["hierarchy"], array(t("Disabled"), t("Single"), t("Multiple")), t("Optional") . ". ". t("Allows ". la("a tree-like hierarchy", array("mod" => "taxonomy", "op" => "help"), "hierarchy") ." between terms of this vocabulary."), "", 0);
+ $form .= form_checkbox(t("Related terms"), "relations", 1, $edit["relations"], t("Optional") . ". " . t("Allows ". l("related terms", "admin/taxonomy/help#relatedterms") ." in this vocabulary."));
+ $form .= form_select(t("Hierarchy"), "hierarchy", $edit["hierarchy"], array(t("Disabled"), t("Single"), t("Multiple")), t("Optional") . ". ". t("Allows ". l("a tree-like hierarchy", "admin/taxonomy/help#hierarchy") ." between terms of this vocabulary."), "", 0);
$form .= form_checkbox(t("Multiple select"), "multiple", 1, $edit["multiple"], t("Optional") . ". " . t("Allows nodes to have more than one term in this vocabulary."));
$form .= form_checkbox(t("Required"), "required", 1, $edit["required"], t("If enabled every node <b>must</b> have at least one term in this vocabulary"));
$form .= form_weight(t("Weight"), "weight", $edit["weight"], 10, t("Optional. In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top."));
@@ -135,7 +135,7 @@ function _taxonomy_confirm_del_vocabulary($vid) {
}
function taxonomy_form_term($edit = array()) {
- global $vocabulary_id;
+ $vocabulary_id = arg(4);
if (!$vocabulary_id) {
$vocabulary_id = $edit["vid"];
@@ -160,14 +160,14 @@ function taxonomy_form_term($edit = array()) {
$exclude[] = $edit["tid"];
if ($vocabulary->hierarchy == 1) {
- $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") . ". " . la(t("Parent term"), array("mod" => "taxonomy", "op" => "help"), "parent") .".", 0, "<" . t("root") . ">", $exclude);
+ $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") . ". " . l(t("Parent term"), "admin/taxonomy/help#parent") .".", 0, "<" . t("root") . ">", $exclude);
}
elseif ($vocabulary->hierarchy == 2) {
- $form .= _taxonomy_term_select(t("Parents"), "parent", $parent, $vocabulary_id, t("Required") . ". ". la(t("Parent terms"), array("mod" => "taxonomy", "op" => "help"), "parent") .".", 1, "<" . t("root") . ">", $exclude);
+ $form .= _taxonomy_term_select(t("Parents"), "parent", $parent, $vocabulary_id, t("Required") . ". ". l(t("Parent terms"), "admin/taxonomy/help#parent") .".", 1, "<" . t("root") . ">", $exclude);
}
}
- $form .= form_textarea(t("Synonyms"), "synonyms", implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, t("Optional") . ". ". t(la("Synonyms", array("mod" => "taxonomy", "op" => "help"), "synonyms") ." of this term, one synonym per line."));
+ $form .= form_textarea(t("Synonyms"), "synonyms", implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, t("Optional") . ". ". t(l("Synonyms", "admin/taxonomy/help#synonyms") ." of this term, one synonym per line."));
$form .= form_weight(t("Weight"), "weight", $edit["weight"], 10, t("Optional. In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top."));
$form .= form_hidden("vid", $vocabulary->vid);
$form .= form_submit(t("Submit"));
@@ -275,13 +275,13 @@ function taxonomy_overview() {
foreach ($vocabularies as $vocabulary) {
$links = array();
- $rows[] = array($vocabulary->name, array("data" => $vocabulary->types, "align" => "center"), la(t("edit vocabulary"), array("mod" => "taxonomy", "type" => "vocabulary", "op" => "edit", "id" => $vocabulary->vid)), la(t("add term"), array("mod" => "taxonomy", "op" => "add", "type" => "leaf", "vocabulary_id" => $vocabulary->vid)), la(t("preview form"), array("mod" => "taxonomy", "type" => "vocabulary", "op" => "preview", "id" => $vocabulary->vid)));
+ $rows[] = array($vocabulary->name, array("data" => $vocabulary->types, "align" => "center"), l(t("edit vocabulary"), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"), l(t("add term"), "admin/taxonomy/add/term/$vocabulary->vid"), l(t("preview form"), "admin/taxonomy/preview/vocabulary/$vocabulary->vid"));
$tree = taxonomy_get_tree($vocabulary->vid);
if ($tree) {
unset($data);
foreach ($tree as $term) {
- $data .= _taxonomy_depth($term->depth) ." ". $term->name ." (". la(t("edit term"), array("mod" => "taxonomy", "op" => "edit", "type" => "term", "id" => $term->tid)) .")<br />";
+ $data .= _taxonomy_depth($term->depth) ." ". $term->name ." (". l(t("edit term"), "admin/taxonomy/edit/term/$term->tid") .")<br />";
}
$rows[] = array(array("data" => $data, "colspan" => 5));
}
@@ -642,9 +642,8 @@ function _prepare_insert($data, $stage) {
}
function taxonomy_page() {
- global $op;
- switch ($op) {
+ switch (arg(1)) {
case "feed":
taxonomy_feed();
break;
@@ -658,12 +657,16 @@ function taxonomy_page() {
*/
function taxonomy_admin() {
- global $edit, $type, $op, $id, $theme;
+ global $op, $edit, $theme;
if (user_access("administer taxonomy")) {
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case "add":
- if ($type == "vocabulary") {
+ if (arg(3) == "vocabulary") {
print taxonomy_form_vocabulary();
}
else {
@@ -671,22 +674,22 @@ function taxonomy_admin() {
}
break;
case "edit":
- if ($type == "vocabulary") {
- print taxonomy_form_vocabulary(object2array(taxonomy_get_vocabulary($id)));
+ if (arg(3) == "vocabulary") {
+ print taxonomy_form_vocabulary(object2array(taxonomy_get_vocabulary(arg(4))));
}
else {
- print taxonomy_form_term(object2array(taxonomy_get_term($id)));
+ print taxonomy_form_term(object2array(taxonomy_get_term(arg(4))));
}
break;
case "preview":
- print taxonomy_form($id);
+ print taxonomy_form(arg(4));
break;
case "help":
print taxonomy_help();
break;
case t("Delete"):
if (!$edit["confirm"]) {
- if ($type == "vocabulary") {
+ if (arg(3) == "vocabulary") {
echo _taxonomy_confirm_del_vocabulary($edit["vid"]);
}
else {
@@ -699,7 +702,7 @@ function taxonomy_admin() {
// fall through:
}
case t("Submit"):
- if ($type == "vocabulary") {
+ if (arg(3) == "vocabulary") {
print status(taxonomy_save_vocabulary($edit));
}
else {
@@ -725,20 +728,20 @@ function taxonomy_help() {
?>
<h3>Background</h3>
- <p>Classifying nodes allows for the organization of content into categories and subcategories of description. These categories can be used to organize and retrieve similarly described content. Drupal's <i>taxonomy.module</i> is an extremely flexible classification system that allows for multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). For details about <a href="http://www.eleganthack.com/archives/002165.html#002165">classification types</a> and insight into the development of <i>taxonomy.module</i>, see this <a href="http://www.drupal.org/node.php?id=55">drupal.org discussion</a>.</p>
+ <p>Classifying nodes allows for the organization of content into categories and subcategories of description. These categories can be used to organize and retrieve similarly described content. Drupal's <i>taxonomy.module</i> is an extremely flexible classification system that allows for multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). For details about <a href="http://www.eleganthack.com/archives/002165.html#002165">classification types</a> and insight into the development of <i>taxonomy.module</i>, see this <a href="http://www.drupal.org/node/view/55">drupal.org discussion</a>.</p>
<h3>An example taxonomy: food</h3>
- <p>Dairy <br />
- --Milk <br />
- Drink <br />
- --Alchohol <br />
- --Pop <br />
+ <p>Dairy<br />
+ --Milk<br />
+ Drink<br />
+ --Alchohol<br />
+ --Pop<br />
--Milk<br />
- Meat <br />
- --Beef <br />
- --Chicken <br />
- --Lamb <br />
- Spices <br />
+ Meat<br />
+ --Beef<br />
+ --Chicken<br />
+ --Lamb<br />
+ Spices<br />
--Sugar</p>
<p><b>Notes</b></p>
<ul>
@@ -776,10 +779,10 @@ function taxonomy_help() {
<i><a name="synonyms"></a>Synonyms</i><br />Optional. Enter synonyms for this term, one synonym per line. Synonyms can be used for variant spellings, acronyms, and other terms that have the same meaning as the added term, but which are not explicitly listed in this thesaurus (i.e. <i>unauthorized terms</i>).<br />
<h3>Displaying nodes organized by term(s)</h3>
- <p>In order to view the nodes associated with a term or a collection of terms, you should browse to a properly formed URL. For example, see <a href="<?php print path_uri().drupal_url(array("mod" => "node", "or" => "1,2"), "module"); ?>"><?php print path_uri().drupal_url(array("mod" => "node", "or" => "1,2"), "module"); ?></a>. Taxonomy URLs always contain a term ID or list of term IDs at the end of the URL (aka <i>querystring</i>). You may learn the term ID for a given term by hovering over that term in the <?php echo la("taxonomy overview", array("mod" => "taxonomy")) ?> page in the Admin and noting the number after the querystring parameter called <i>tid</i>. If you wish to see nodes from a collection of term IDs, separate each term ID with a comma. Also, the name of the querystring parameter may be <i>or</i> or <i>and</i>: <i>or</i> shows nodes which appear in <b>any</b> of the term IDs while <i>and</i> shows nodes in <b>all</b> the specified term IDs. Thus, <i>or</i> is less specific than <i>and</i>.</p>
+ <p>In order to view the nodes associated with a term or a collection of terms, you should browse to a properly formed URL. For example, see <a href="<?php print path_uri() . url("node", "or=1,2"); ?>"><?php print path_uri() . url("node", "or=1,2"); ?></a>. Taxonomy URLs always contain a term ID or list of term IDs at the end of the URL (aka <i>querystring</i>). You may learn the term ID for a given term by hovering over that term in the <?php echo l("taxonomy overview", "admin/taxonomy") ?> page in the Admin and noting the number after the querystring parameter called <i>tid</i>. If you wish to see nodes from a collection of term IDs, separate each term ID with a comma. Also, the name of the querystring parameter may be <i>or</i> or <i>and</i>: <i>or</i> shows nodes which appear in <b>any</b> of the term IDs while <i>and</i> shows nodes in <b>all</b> the specified term IDs. Thus, <i>or</i> is less specific than <i>and</i>.</p>
<h3>RSS feeds</h3>
- <p>Every term, or collection of terms, provides an <a href="http://backend.userland.com/stories/rss091">RSS</a> feed to which interested users may subscribe. The URL format for an sample RSS feed is <a href="<?php print path_uri().drupal_url(array("mod" => "node", "op" => "feed", "or" => "1,2"), "module"); ?>"><?php print path_uri().drupal_url(array("mod" => "node", "op" => "feed", "or" => "1,2"), "module"); ?></a>.</p>
+ <p>Every term, or collection of terms, provides an <a href="http://backend.userland.com/stories/rss091">RSS</a> feed to which interested users may subscribe. The URL format for an sample RSS feed is <a href="<?php print path_uri() . url("node/feed", "or=1,2"); ?>"><?php print path_uri() . url("node/feed", "or=1,2"); ?></a>.</p>
<?php
}
?> \ No newline at end of file
diff --git a/modules/throttle.module b/modules/throttle.module
index b5481824e..4756fb2bc 100644
--- a/modules/throttle.module
+++ b/modules/throttle.module
@@ -28,7 +28,7 @@ function throttle_help() {
<p>The auto-throttle mechanism performs an extra database query in order to determine what the current throttle level should be. Fortunately the throttle can be tuned so these database queries only occur on a fraction of all pages geenrated by your site, reducing the overhead to an insignificant amount. Additionally, when the top-most throttle level is reached, all throttle queries are suspended for a configurable period of time. More detail follows.
- <p>As with any new module, <i>throttle.module</i> needs to be enabled <?php print l("here", array("mod" => "system", "op" => "modules"), "admin"); ?> before you can use it. Also refer to the permissions section below if you wish to access the throttle statistics block.</p>
+ <p>As with any new module, <i>throttle.module</i> needs to be enabled <?php print l("here", "admin/system/modules"); ?> before you can use it. Also refer to the permissions section below if you wish to access the throttle statistics block.</p>
<h3>Configuring the throttle module</h3>
@@ -58,11 +58,11 @@ function throttle_help() {
<p>This block displays some statistics regarding the current throttle and its configuration. It is recommended that only site administrators receive the "access throttle block" permission bit required to view this block. It does not display information that would interest a normal site end-user.</p>
- <p>Don't forget to enable the block <?php print l("here", array("mod" => "block"), "admin"); ?>.</p>
+ <p>Don't forget to enable the block <?php print l("here", "admin/block"); ?>.</p>
<h3>Permissions</h3>
<p>This module has one permission that needs to be configured in
-<?php print l("user permissions", array("mod" => "user", "op" => "permission"), "admin"); ?>.</p>
+<?php print l("user permissions", "admin/user/permission"); ?>.</p>
<ul>
<li><i>access throttle block</i> - enable for user roles that get to view the throttle block.</li>
</ul>
@@ -119,7 +119,7 @@ function throttle_display_throttle_block() {
/* calculate probability limiter's odds of updating throttle */
$probability = substr((($limiter / ($limiter + 1) * 100) - 100) * -1, 0, 4);
- $output .= "Throttle: ". l("Enabled", array("mod" => "system"), "admin", "statistics") ."<br />\n";
+ $output .= "Throttle: ". l("Enabled", "admin/system#statistics") ."<br />\n";
if ($throttle < 5) {
$maximum = (($throttle + 1) * $multiplier) - 1;
$output .= "Current Level: $throttle ($minimum - $maximum)<br />\n";
@@ -135,7 +135,7 @@ function throttle_display_throttle_block() {
}
}
else {
- $output .= "Throttle: ". l("Disabled", array("mod" => "system"), "admin", "statistics") ."<br />\n";
+ $output .= "Throttle: ". l("Disabled", "admin/system#statistics") ."<br />\n";
}
}
return $output;
diff --git a/modules/throttle/throttle.module b/modules/throttle/throttle.module
index b5481824e..4756fb2bc 100644
--- a/modules/throttle/throttle.module
+++ b/modules/throttle/throttle.module
@@ -28,7 +28,7 @@ function throttle_help() {
<p>The auto-throttle mechanism performs an extra database query in order to determine what the current throttle level should be. Fortunately the throttle can be tuned so these database queries only occur on a fraction of all pages geenrated by your site, reducing the overhead to an insignificant amount. Additionally, when the top-most throttle level is reached, all throttle queries are suspended for a configurable period of time. More detail follows.
- <p>As with any new module, <i>throttle.module</i> needs to be enabled <?php print l("here", array("mod" => "system", "op" => "modules"), "admin"); ?> before you can use it. Also refer to the permissions section below if you wish to access the throttle statistics block.</p>
+ <p>As with any new module, <i>throttle.module</i> needs to be enabled <?php print l("here", "admin/system/modules"); ?> before you can use it. Also refer to the permissions section below if you wish to access the throttle statistics block.</p>
<h3>Configuring the throttle module</h3>
@@ -58,11 +58,11 @@ function throttle_help() {
<p>This block displays some statistics regarding the current throttle and its configuration. It is recommended that only site administrators receive the "access throttle block" permission bit required to view this block. It does not display information that would interest a normal site end-user.</p>
- <p>Don't forget to enable the block <?php print l("here", array("mod" => "block"), "admin"); ?>.</p>
+ <p>Don't forget to enable the block <?php print l("here", "admin/block"); ?>.</p>
<h3>Permissions</h3>
<p>This module has one permission that needs to be configured in
-<?php print l("user permissions", array("mod" => "user", "op" => "permission"), "admin"); ?>.</p>
+<?php print l("user permissions", "admin/user/permission"); ?>.</p>
<ul>
<li><i>access throttle block</i> - enable for user roles that get to view the throttle block.</li>
</ul>
@@ -119,7 +119,7 @@ function throttle_display_throttle_block() {
/* calculate probability limiter's odds of updating throttle */
$probability = substr((($limiter / ($limiter + 1) * 100) - 100) * -1, 0, 4);
- $output .= "Throttle: ". l("Enabled", array("mod" => "system"), "admin", "statistics") ."<br />\n";
+ $output .= "Throttle: ". l("Enabled", "admin/system#statistics") ."<br />\n";
if ($throttle < 5) {
$maximum = (($throttle + 1) * $multiplier) - 1;
$output .= "Current Level: $throttle ($minimum - $maximum)<br />\n";
@@ -135,7 +135,7 @@ function throttle_display_throttle_block() {
}
}
else {
- $output .= "Throttle: ". l("Disabled", array("mod" => "system"), "admin", "statistics") ."<br />\n";
+ $output .= "Throttle: ". l("Disabled", "admin/system#statistics") ."<br />\n";
}
}
return $output;
diff --git a/modules/tracker.module b/modules/tracker.module
index 5a2683dd9..065893063 100644
--- a/modules/tracker.module
+++ b/modules/tracker.module
@@ -14,7 +14,7 @@ function tracker_system($field){
function tracker_link($type) {
if ($type == "menu.view" && user_access("access comments")) {
- $links[] = lm(t("view new comments"), array("mod" => "tracker"), "", array("title" => t("Display an overview of the recent comments.")));
+ $links[] = l(t("view new comments"), "tracker", array("title" => t("Display an overview of the recent comments.")));
}
return $links ? $links : array();
@@ -37,7 +37,7 @@ function tracker_comments($id = 0) {
}
while ($node = db_fetch_object($sresult)) {
- $output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." ". l($node->title, array("id" => $node->nid)) .":\n";
+ $output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." ". l($node->title, "node/view/$node->nid") .":\n";
if ($id) {
$cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.timestamp > $period AND c.uid = '%d' AND c.nid = '%d' ORDER BY cid DESC", $id, $node->nid);
@@ -48,7 +48,7 @@ function tracker_comments($id = 0) {
$output .= "<ul>";
while ($comment = db_fetch_object($cresult)) {
- $output .= " <li>". l($comment->subject, array("id" => $node->nid, "cid" => $comment->cid, "pid" => $comment->pid), "node", $comment->cid) ." ". t("by") ." ". format_name($comment) ." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? theme_invoke("theme_mark") : "") ."</li>\n";
+ $output .= " <li>". l($comment->subject, "node/view/$node->nid#$comment->cid") ." ". t("by") ." ". format_name($comment) ." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? theme_invoke("theme_mark") : "") ."</li>\n";
}
$output .= " </ul>\n";
}
@@ -59,28 +59,28 @@ function tracker_comments($id = 0) {
function tracker_menu() {
global $user;
- $links[] = lm(t("your recent comments"), array("mod" => "tracker", "id" => $user->uid), "", array("title" => t("Display an overview of your recent comments.")));
- $links[] = lm(t("all recent comments"), array("mod" => "tracker"), "", array("title" => t("Display an overview of all the recent comments.")));
+ $links[] = l(t("your recent comments"), "tracker/$user->uid", array("title" => t("Display an overview of your recent comments.")));
+ $links[] = l(t("all recent comments"), "tracker", array("title" => t("Display an overview of all the recent comments.")));
return "<div align=\"center\">". implode(" &middot; ", $links) ."</div>";
}
function tracker_page() {
- global $theme, $id, $user;
+ global $theme, $user;
if (user_access("access comments")) {
- if ($id == $user->uid) {
+ if (arg(1) == $user->uid) {
$theme->header(t("Your recent comments"));
$theme->box(t("Tracker"), tracker_menu());
- $theme->box(t("Your recent comments"), tracker_comments($id));
+ $theme->box(t("Your recent comments"), tracker_comments(arg(1)));
$theme->footer();
}
- else if ($id) {
- $account = user_load(array("uid" => $id));
+ else if (arg(1)) {
+ $account = user_load(array("uid" => arg(1)));
$theme->header(t("%u's recent comments", array("%u" => $account->name)));
$theme->box(t("Tracker"), tracker_menu());
- $theme->box(t("%u's recent comments", array("%u" => $account->name)), tracker_comments($id));
+ $theme->box(t("%u's recent comments", array("%u" => $account->name)), tracker_comments(arg(1)));
$theme->footer();
}
else {
@@ -97,7 +97,7 @@ function tracker_user($type, &$edit, &$user) {
case "view_public":
case "view_private":
if (user_access("access comments")) {
- return form_item(t("Comments"), lm(t("view recent comments"), array("mod" => "tracker", "id" => $user->uid), "", array("title" => t("View recent comments."))));
+ return form_item(t("Comments"), l(t("view recent comments"), "tracker/$user->uid", array("title" => t("View recent comments."))));
}
}
}
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index 5a2683dd9..065893063 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -14,7 +14,7 @@ function tracker_system($field){
function tracker_link($type) {
if ($type == "menu.view" && user_access("access comments")) {
- $links[] = lm(t("view new comments"), array("mod" => "tracker"), "", array("title" => t("Display an overview of the recent comments.")));
+ $links[] = l(t("view new comments"), "tracker", array("title" => t("Display an overview of the recent comments.")));
}
return $links ? $links : array();
@@ -37,7 +37,7 @@ function tracker_comments($id = 0) {
}
while ($node = db_fetch_object($sresult)) {
- $output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." ". l($node->title, array("id" => $node->nid)) .":\n";
+ $output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." ". l($node->title, "node/view/$node->nid") .":\n";
if ($id) {
$cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.timestamp > $period AND c.uid = '%d' AND c.nid = '%d' ORDER BY cid DESC", $id, $node->nid);
@@ -48,7 +48,7 @@ function tracker_comments($id = 0) {
$output .= "<ul>";
while ($comment = db_fetch_object($cresult)) {
- $output .= " <li>". l($comment->subject, array("id" => $node->nid, "cid" => $comment->cid, "pid" => $comment->pid), "node", $comment->cid) ." ". t("by") ." ". format_name($comment) ." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? theme_invoke("theme_mark") : "") ."</li>\n";
+ $output .= " <li>". l($comment->subject, "node/view/$node->nid#$comment->cid") ." ". t("by") ." ". format_name($comment) ." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? theme_invoke("theme_mark") : "") ."</li>\n";
}
$output .= " </ul>\n";
}
@@ -59,28 +59,28 @@ function tracker_comments($id = 0) {
function tracker_menu() {
global $user;
- $links[] = lm(t("your recent comments"), array("mod" => "tracker", "id" => $user->uid), "", array("title" => t("Display an overview of your recent comments.")));
- $links[] = lm(t("all recent comments"), array("mod" => "tracker"), "", array("title" => t("Display an overview of all the recent comments.")));
+ $links[] = l(t("your recent comments"), "tracker/$user->uid", array("title" => t("Display an overview of your recent comments.")));
+ $links[] = l(t("all recent comments"), "tracker", array("title" => t("Display an overview of all the recent comments.")));
return "<div align=\"center\">". implode(" &middot; ", $links) ."</div>";
}
function tracker_page() {
- global $theme, $id, $user;
+ global $theme, $user;
if (user_access("access comments")) {
- if ($id == $user->uid) {
+ if (arg(1) == $user->uid) {
$theme->header(t("Your recent comments"));
$theme->box(t("Tracker"), tracker_menu());
- $theme->box(t("Your recent comments"), tracker_comments($id));
+ $theme->box(t("Your recent comments"), tracker_comments(arg(1)));
$theme->footer();
}
- else if ($id) {
- $account = user_load(array("uid" => $id));
+ else if (arg(1)) {
+ $account = user_load(array("uid" => arg(1)));
$theme->header(t("%u's recent comments", array("%u" => $account->name)));
$theme->box(t("Tracker"), tracker_menu());
- $theme->box(t("%u's recent comments", array("%u" => $account->name)), tracker_comments($id));
+ $theme->box(t("%u's recent comments", array("%u" => $account->name)), tracker_comments(arg(1)));
$theme->footer();
}
else {
@@ -97,7 +97,7 @@ function tracker_user($type, &$edit, &$user) {
case "view_public":
case "view_private":
if (user_access("access comments")) {
- return form_item(t("Comments"), lm(t("view recent comments"), array("mod" => "tracker", "id" => $user->uid), "", array("title" => t("View recent comments."))));
+ return form_item(t("Comments"), l(t("view recent comments"), "tracker/$user->uid", array("title" => t("View recent comments."))));
}
}
}
diff --git a/modules/user.module b/modules/user.module
index a788b1dc1..00a4de46f 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -296,7 +296,7 @@ function user_search($keys) {
global $PHP_SELF;
$result = db_query("SELECT * FROM users WHERE name LIKE '%$keys%' LIMIT 20");
while ($account = db_fetch_object($result)) {
- $find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "user", "op" => "edit", "id" => $account->uid), "admin") : drupal_url(array("mod" => "user", "op" => "view", "id" => $account->uid), "module")), "user" => $account->name);
+ $find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin") ? url("admin/user/edit/$account->uid") : url("user/view/$account->uid")), "user" => $account->name);
}
return $find;
}
@@ -315,7 +315,7 @@ function user_block($op = "list", $delta = 0) {
case 0:
if (!$user->uid) {
$output = "<div align=\"center\">\n";
- $output .= "<form action=\"". drupal_url(array("mod" => "user", "op" => "login"), "module") ."\" method=\"post\">\n";
+ $output .= "<form action=\"". url("user/login") ."\" method=\"post\">\n";
// Save the referer. We record where the user came from such that we
// can redirect him after having completed the login form.
if (!$edit["destination"]) $edit["destination"] = request_uri();
@@ -334,9 +334,9 @@ function user_block($op = "list", $delta = 0) {
$output .= "</form></div>\n";
if (variable_get("user_register", 1)) {
- $items[] = lm(t("Create new account"), array("mod" => "user", "op" => "register"), "", array("title" => t("Create a new user account.")));
+ $items[] = l(t("Create new account"), "user/register", array("title" => t("Create a new user account.")));
}
- $items[] = lm(t("Request new password"), array("mod" => "user", "op" => "password"), "", array("title" => t("Request new password via e-mail.")));
+ $items[] = l(t("Request new password"), "user/password", array("title" => t("Request new password via e-mail.")));
$output .= theme_invoke("theme_item_list", $items);
@@ -363,7 +363,7 @@ function user_block($op = "list", $delta = 0) {
$result = db_query("SELECT uid, name FROM users WHERE status != '0' ORDER BY uid DESC LIMIT 5");
while ($account = db_fetch_object($result)) {
- $items[] = lm((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), array("mod" =>user, "op" => "view", "id" => $account->uid));
+ $items[] = l((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), "user/view/$account->uid");
}
$output = theme_invoke("theme_item_list", $items);
@@ -377,19 +377,19 @@ function user_block($op = "list", $delta = 0) {
function user_link($type) {
if ($type == "page") {
- $links[] = lm(t("user account"), array("mod" => "user"), "", array("title" => t("Create a user account, request a new password or edit your account settings.")));
+ $links[] = l(t("user account"), "user", array("title" => t("Create a user account, request a new password or edit your account settings.")));
}
if ($type == "menu.settings") {
- $links[] = lm(t("edit account"), array("mod" => "user", "op" => "edit"), "", array("title" => t("View and edit your account information.")));
+ $links[] = l(t("edit account"), "user/edit", array("title" => t("View and edit your account information.")));
}
if ($type == "menu.misc") {
if (user_access("access administration pages")) {
- $links[] = la(t("administer %a", array("%a" => variable_get("site_name", "drupal"))), array(), "", array("title" => t("Access administration pages.")));
+ $links[] = l(t("administer %a", array("%a" => variable_get("site_name", "drupal"))), "admin", array("title" => t("Access administration pages.")));
}
- $links[] = lm(t("logout"), array("mod" => "user", "op" => "logout"), "", array("title" => t("Logout.")));
+ $links[] = l(t("logout"), "user/logout", array("title" => t("Logout.")));
}
if ($type == "admin" && user_access("administer users")) {
@@ -402,24 +402,24 @@ function user_link($type) {
$help["search"] = "On this page you can query any username. For example, one may search for 'br' and Drupal might return 'brian', 'brad', and 'brenda'.";
$help["setting"] = "Administrators may choose to restrict registration to their site. That restriction may be accomplished on this page. Also, the list of words which may be included in a system generated password is also listed on this page. Drupal generates passwords by joining small words from the password list until the new password is greater than 6 characters.";
- menu_add("user management", "admin.php?mod=user", "User management", $help["user"]);
- menu_add("create new account", "admin.php?mod=user&op=create", "Create a new user account.", $help["create"], "user management", 1);
- menu_add("view user accounts", "admin.php?mod=user&op=account", "Display user account listings.", $help["view"], "user management", 2, 1);
- menu_add("access rules", "admin.php?mod=user&op=access", "Configure access rules.", $help["access"], "user management", 3);
- menu_add("e-mail rules", "admin.php?mod=user&op=access&type=mail", "Allow or deny certain e-mail addresses.", $help["access"], "access rules");
- menu_add("username rules", "admin.php?mod=user&op=access&type=user", "Allow or deny certain usernames.", $help["access"], "access rules");
- menu_add("user roles", "admin.php?mod=user&op=role", "Configure user roles.", $help["role"], "user management", 4);
- menu_add("user permissions", "admin.php?mod=user&op=permission", "Configure user permissions.", $help["permission"], "user management", 5);
- menu_add("search account", "admin.php?mod=user&op=search", "Search a user account.", $help["search"], "user management", 5);
- menu_add("help", "admin.php?mod=user&op=help", "More information about user management.", NULL, "user management", 7);
-
- menu_add("active users", "admin.php?mod=user&op=account&query=0", t("Active users."), $help["view"], "view user accounts", 1);
- menu_add("new users", "admin.php?mod=user&op=account&query=1", t("New users."), $help["view"], "view user accounts", 2);
- menu_add("blocked users", "admin.php?mod=user&op=account&query=2", t("Blocked users."), $help["view"], "view user accounts", 3);
+ menu_add("user management", url("admin/user"), "User management", $help["user"]);
+ menu_add("create new account", url("admin/user/create"), "Create a new user account.", $help["create"], "user management", 1);
+ menu_add("view user accounts", url("admin/user/account"), "Display user account listings.", $help["view"], "user management", 2, 1);
+ menu_add("access rules", url("admin/user/access"), "Configure access rules.", $help["access"], "user management", 3);
+ menu_add("e-mail rules", url("admin/user/access/mail"), "Allow or deny certain e-mail addresses.", $help["access"], "access rules");
+ menu_add("username rules", url("admin/user/access/user"), "Allow or deny certain usernames.", $help["access"], "access rules");
+ menu_add("user roles", url("admin/user/role"), "Configure user roles.", $help["role"], "user management", 4);
+ menu_add("user permissions", url("admin/user/permission"), "Configure user permissions.", $help["permission"], "user management", 5);
+ menu_add("search account", url("admin/user/search"), "Search a user account.", $help["search"], "user management", 5);
+ menu_add("help", url("admin/user/help"), "More information about user management.", NULL, "user management", 7);
+
+ menu_add("active users", url("admin/user/account/0"), t("Active users."), $help["view"], "view user accounts", 1);
+ menu_add("new users", url("admin/user/account/1"), t("New users."), $help["view"], "view user accounts", 2);
+ menu_add("blocked users", url("admin/user/account/2"), t("Blocked users."), $help["view"], "view user accounts", 3);
$i = 3;
foreach (user_roles(1) as $key => $value) {
- menu_add("users with role '$value'", "admin.php?mod=user&op=account&query=". $i++, NULL, $help["view"], "view user accounts", 4);
+ menu_add("users with role '$value'", url("admin/user/account/". $i++), NULL, $help["view"], "view user accounts", 4);
}
}
@@ -481,7 +481,7 @@ function user_auth_help_links() {
$links = array();
foreach (module_list() as $module) {
if (module_hook($module, "auth_help")) {
- $links[] = lm(module_invoke($module, "info", "name"), array("mod" => "user", "op" => "help"), $module);
+ $links[] = l(module_invoke($module, "info", "name"), "user/help#$module");
}
}
return $links;
@@ -497,7 +497,7 @@ function user_login($edit = array(), $msg = "") {
*/
if ($user->uid) {
- drupal_goto(drupal_url(array("mod" => "user"), "module"));
+ drupal_goto(url("user"));
}
if (user_deny("user", $edit["name"])) {
@@ -549,7 +549,7 @@ function user_login($edit = array(), $msg = "") {
if (module_invoke($module, "auth", $name, $pass, $server)) {
if (variable_get("user_register", 1) == 1 && !user_load(array("name" => "$name@$server"))) { //register this new user
$user = user_save("", array("name" => "$name@$server", "pass" => user_password(), "init" => "$name@$server", "status" => 1, "authname_$module" => "$name@$server", "rid" => _user_authenticated_id()));
- watchdog("user", "new user: $name@$server ($module ID)", la("edit user", array("mod" => "user", "op" => "edit", "id" => $user->uid)));
+ watchdog("user", "new user: $name@$server ($module ID)", l("edit user", "admin/user/edit/$user->uid"));
break;
}
}
@@ -586,7 +586,7 @@ function user_login($edit = array(), $msg = "") {
}
else {
if (!$error) {
- $error = t("Sorry. Unrecognized username or password.") ." ". lm(t("Have you forgotten your password?"), array("mod" => "user", "op" => "password"));
+ $error = t("Sorry. Unrecognized username or password.") ." ". l(t("Have you forgotten your password?"), "user/password");
}
if ($server) {
watchdog("user", "failed login for '$name@$server': $error");
@@ -631,13 +631,13 @@ function user_login($edit = array(), $msg = "") {
$output .= form_password(t("Password"), "pass", $pass, 20, 64, t("Enter the password that accompanies your username."));
$output .= form_checkbox(t("Remember me"), "remember_me", 1, 0, 0);
$output .= form_submit(t("Log in"));
- $output .= "<p>&raquo; ". lm(t("Request new password"), array("mod" => "user", "op" => "password")). "<br />";
+ $output .= "<p>&raquo; ". l(t("Request new password"), "user/password"). "<br />";
if (variable_get("user_register", 1)) {
- $output .= "&raquo; ". lm(t("Create new account"), array("mod" => "user", "op" => "register"));
+ $output .= "&raquo; ". l(t("Create new account"), "user/register");
}
$output .= "</p>";
- return form($output, "post", drupal_url(array ("mod" => "user"), "module"));
+ return form($output, "post", url("user"));
}
function _user_authenticated_id() {
@@ -693,7 +693,7 @@ function user_pass($edit = array()) {
$variables = array("%username" => $account->name, "%site" => variable_get("site_name", "drupal"), "%password" => $pass, "%uri" => path_uri(), "%uri_brief" => path_uri(1), "%mailto" => $account->mail, "%date" => format_date(time()));
$subject = strtr(variable_get("user_mail_pass_subject", t("Replacement login information for %username at %site")), $variables);
- $body = strtr(variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". drupal_url(array("mod" => "user", "op" => "edit"), "module") .".\n\nYour new %site membership also enables you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
+ $body = strtr(variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". url("user/edit") .".\n\nYour new %site membership also enables you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
$headers = "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from";
user_mail($account->mail, $subject, $body, $headers);
@@ -716,13 +716,13 @@ function user_pass($edit = array()) {
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64);
$output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64);
$output .= form_submit(t("E-mail new password"));
- $output .= "<p>&raquo; ". lm(t("Log in"), array("mod" =>user, "op" => "login")) ."<br />";
+ $output .= "<p>&raquo; ". l(t("Log in"), "user/login") ."<br />";
if (variable_get("user_register", 1)) {
- $output .= "&raquo; ". lm(t("Create new account"), array("mod" => "user", "op" => "register"));
+ $output .= "&raquo; ". l(t("Create new account"), "user/register");
}
$output .= "</p>";
- return form($output, "post", drupal_url(array ("mod" => "user"), "module"));
+ return form($output, "post", url("user"));
}
}
@@ -734,7 +734,7 @@ function user_register($edit = array()) {
*/
if ($user->uid) {
- drupal_goto(drupal_url(array("mod" => "user", "op" => "edit"), "module"));
+ drupal_goto(url("user/edit"));
}
if ($edit["name"] && $edit["mail"]) {
@@ -788,13 +788,13 @@ function user_register($edit = array()) {
// TODO: is this necessary? Won't session_write replicate this?
unset($edit["session"]);
$account = user_save("", array_merge(array("name" => $edit["name"], "pass" => $pass, "init" => $edit["mail"], "mail" => $edit["mail"], "rid" => _user_authenticated_id(), "rating" => 0, "status" => (variable_get("user_register", 1) == 1 ? 1 : 0)), $data));
- watchdog("user", "new user: '". $edit["name"] ."' &lt;". $edit["mail"] ."&gt;", la("edit user", array("mod" => "user", "op" => "edit", "id" => $account->uid)));
+ watchdog("user", "new user: '". $edit["name"] ."' &lt;". $edit["mail"] ."&gt;", l("edit user", "admin/user/edit/$account->uid"));
$variables = array("%username" => $edit["name"], "%site" => variable_get("site_name", "drupal"), "%password" => $pass, "%uri" => path_uri(), "%uri_brief" => path_uri(1), "%mailto" => $edit["mail"], "%date" => format_date(time()));
//the first user may login immediately, and receives a customized welcome e-mail.
if ($account->uid == 1) {
- user_mail($edit["mail"], t("drupal user account details for %s", array("%s" => $edit["name"])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\nAfter logging in, you may wish to visit the following pages:\n\nAdministration: %uriadmin.php\nEdit user account: %uri". drupal_url(array("mod" => "user", "op" => "edit"), "module") ."\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
+ user_mail($edit["mail"], t("drupal user account details for %s", array("%s" => $edit["name"])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\n%uri". url("user/edit") ."\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
// This should not be t()'ed. No point as its only shown once in the sites lifetime, and it would be bad to store the password
$output .= "<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please configure your e-mail settings using the Administration pages.</p><p> Your password is <b>$pass</b>. You may change your password on the next page.</p><p>Please login below.</p>";
$output .= form_hidden("name", $account->name);
@@ -809,7 +809,7 @@ function user_register($edit = array()) {
*/
$subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables);
- $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
+ $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". url("user/edit") .".\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
return t("Your password and further instructions have been sent to your e-mail address.");
}
@@ -818,9 +818,9 @@ function user_register($edit = array()) {
** Create new user account, administrator approval required:
*/
$subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables);
- $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. Your account will have to be approved by the site administrator. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
+ $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. Your account will have to be approved by the site administrator. You may now login to %uri". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". url("user/edit") .".\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
- user_mail(variable_get("site_mail", ini_get("sendmail_from")), $subject, t("%u has applied for an account.\n\n%uri", array("%u" => $account->name, "%uri" => path_uri() . drupal_url(array("mod" => "user", "op" => "edit", "id" => $account->uid), "admin"))), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
+ user_mail(variable_get("site_mail", ini_get("sendmail_from")), $subject, t("%u has applied for an account.\n\n%uri", array("%u" => $account->name, "%uri" => path_uri() . url("admin/user/edit/$account->uid"))), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
return t("Your password and further instructions have been sent to your e-mail address.");
}
}
@@ -835,7 +835,7 @@ function user_register($edit = array()) {
$affiliates = user_auth_help_links();
if (count($affiliates) > 0) {
$affiliates = implode(", ", $affiliates);
- $output .= "<p>" . t("Note: If you have an account with one of our affiliates (%s), you may ". lm("login now", array("mod" => "user", "op" => "login")) ." instead of registering.", array("%s" => $affiliates)) ."</p>";
+ $output .= "<p>" . t("Note: If you have an account with one of our affiliates (%s), you may ". l("login now", "user/login") ." instead of registering.", array("%s" => $affiliates)) ."</p>";
}
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Your full name or your preferred username: only letters, numbers and spaces are allowed."));
$output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64, t("A password and instructions will be sent to this e-mail address, so make sure it is accurate."));
@@ -845,8 +845,8 @@ function user_register($edit = array()) {
}
}
$output .= form_submit(t("Create new account"));
- $output .= "<p>&raquo; ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "<br />";
- $output .= "&raquo; " .lm(t("Log in"), array("mod" => "user", "op" => "login")). "</p>";
+ $output .= "<p>&raquo; ". l(t("E-mail new password"), "user/password"). "<br />";
+ $output .= "&raquo; ". l(t("Log in"), "user/login") ."</p>";
return form($output);
}
@@ -982,9 +982,9 @@ function user_edit($edit = array()) {
}
function user_menu() {
- $links[] = lm(t("view user information"), array("mod" => "user", "op" => "view"));
- $links[] = lm(t("edit user information"), array("mod" => "user", "op" => "edit"));
- $links[] = lm(t("delete account"), array("mod" => "user", "op" => "delete"));
+ $links[] = l(t("view user information"), "user/view");
+ $links[] = l(t("edit user information"), "user/edit");
+ $links[] = l(t("delete account"), "user/delete");
return "<div align=\"center\">". implode(" &middot; ", $links) ."</div>";
}
@@ -1036,7 +1036,11 @@ function user_view($uid = 0) {
}
function user_page() {
- global $edit, $op, $id, $theme;
+ global $edit, $op, $theme;
+
+ if (empty($op)) {
+ $op = arg(1);
+ }
switch ($op) {
case t("E-mail new password");
@@ -1082,7 +1086,7 @@ function user_page() {
$theme->footer();
break;
case "view":
- user_view($id);
+ user_view(arg(2));
break;
case t("Logout"):
case "logout":
@@ -1106,9 +1110,9 @@ function user_conf_options() {
$output .= form_textfield(t("Password words"), "user_password", variable_get("user_password", "foo,bar,guy,neo,tux,moo,sun,asm,dot,god,axe,geek,nerd,fish,hack,star,mice,warp,moon,hero,cola,girl,fish,java,perl,boss,dark,sith,jedi,drop,mojo"), 55, 256, t("A comma separated list of short words that can be concatenated to generate human-readable passwords."));
$output .= form_select(t("Remember authenticated users"), "user_remember", variable_get("user_remember", 0), array(t("Let the user decide whether he should be logged out when leaving the site."), t("Authenticated users are not logged out upon leaving the site."), t("Authenticated users are logged out upon leaving the site.")));
$output .= form_textfield(t("Subject of welcome e-mail"), "user_mail_welcome_subject", variable_get("user_mail_welcome_subject", "User account details for %username at %site"), 80, 180, t("Customize the subject of your welcome e-mail, which is sent to new members upon registering.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto, %date");
- $output .= form_textarea(t("Body of welcome e-mail"), "user_mail_welcome_body", variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". drupal_url(array("mod" => "user", "op" => "edit"), "module") ."\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, t("Customize the body of the welcome e-mail, which is sent to new members upon registering.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto");
+ $output .= form_textarea(t("Body of welcome e-mail"), "user_mail_welcome_body", variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". url("user/edit") ."\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, t("Customize the body of the welcome e-mail, which is sent to new members upon registering.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto");
$output .= form_textfield(t("Subject of password recovery e-mail"), "user_mail_pass_subject", variable_get("user_mail_pass_subject", t("Replacement login information for %username at %site")), 80, 180, t("Customize the Subject of your forgotten password e-mail.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto, %date");
- $output .= form_textarea(t("Body of password recovery e-mail"), "user_mail_pass_body", variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". drupal_url(array("mod" => "user", "op" => "edit"), "module") ."\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, t("Customize the body of the forgotten password e-mail.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto");
+ $output .= form_textarea(t("Body of password recovery e-mail"), "user_mail_pass_body", variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". url("user/edit") ."\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, t("Customize the body of the forgotten password e-mail.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto");
return $output;
}
@@ -1158,6 +1162,9 @@ function user_admin_create($edit = array()) {
function user_admin_access($edit = array()) {
global $op, $id, $type;
+ $type = arg(3);
+ $id = arg(4);
+
if (empty($type)) {
return;
}
@@ -1190,13 +1197,13 @@ function user_admin_access($edit = array()) {
$result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '1' ORDER BY mask", $type);
while ($rule = db_fetch_object($result)) {
- $rows[] = array(t("Allow"), $rule->mask, array("data" => la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)), "align" => "center"));
+ $rows[] = array(t("Allow"), $rule->mask, array("data" => l(t("delete rule"), "admin/user/access/$type/$rule->aid"), "align" => "center"));
}
$result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '0' ORDER BY mask", $type);
while ($rule = db_fetch_object($result)) {
- $rows[] = array(t("Deny"), $rule->mask, la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)));
+ $rows[] = array(t("Deny"), $rule->mask, l(t("delete rule"), "admin/user/access/$type/$rule->aid"));
}
$rows[] = array("<select name=\"edit[status]\"><option value=\"1\">". t("Allow") ."</option><option value=\"0\">". t("Deny") ."</option></select>", "<input size=\"32\" maxlength=\"64\" name=\"edit[mask]\" />", "<input type=\"submit\" name=\"op\" value=\"" . t("Add rule") . "\" />");
@@ -1301,7 +1308,9 @@ function user_admin_perm($edit = array()) {
}
function user_admin_role($edit = array()) {
- global $op, $id;
+ global $op;
+
+ $id = arg(3);
if ($op == t("Save role")) {
db_query("UPDATE role SET name = '%s' WHERE rid = '%s'", $edit["name"], $id);
@@ -1336,7 +1345,7 @@ function user_admin_role($edit = array()) {
$header = array(t("name"), t("operations"));
while ($role = db_fetch_object($result)) {
- $rows[] = array($role->name, array("data" => la(t("edit role"), array("mod" => "user", "op" => "role", "id" => $role->rid)), "align" => "center"));
+ $rows[] = array($role->name, array("data" => l(t("edit role"), "admin/user/role/$role->rid"), "align" => "center"));
}
$rows[] = array("<input size=\"32\" maxlength=\"64\" name=\"edit[name]\" />", "<input type=\"submit\" name=\"op\" value=\"". t("Add role") ."\" />");
@@ -1348,7 +1357,9 @@ function user_admin_role($edit = array()) {
}
function user_admin_edit($edit = array()) {
- global $op, $id;
+ global $op;
+
+ $id = arg(3);
if ($account = user_load(array("uid" => $id))) {
@@ -1454,7 +1465,7 @@ function user_admin_edit($edit = array()) {
}
function user_admin_account() {
- global $query;
+ $query = arg(3);
$queries = array("ORDER BY timestamp DESC", "ORDER BY u.uid DESC", "WHERE status = 0 ORDER BY u.uid DESC");
foreach (user_roles(1) as $key => $value) {
@@ -1465,7 +1476,7 @@ function user_admin_account() {
$header = array(t("username"), t("last access"), t("operations"));
while ($account = db_fetch_object($result)) {
- $rows[] = array(format_name($account), format_date($account->timestamp, "small"), la(t("edit account"), array("mod" => "user", "op" => "edit", "id" => $account->uid)));
+ $rows[] = array(format_name($account), format_date($account->timestamp, "small"), l(t("edit account"), "admin/user/edit/$account->uid"));
}
if ($pager = pager_display(NULL, 50, 0, "admin")) {
@@ -1488,7 +1499,7 @@ function user_role_init() {
}
function user_admin() {
- global $edit, $id, $op;
+ global $op, $edit;
if (user_access("administer users")) {
/*
@@ -1497,12 +1508,16 @@ function user_admin() {
user_role_init();
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case "help":
print user_help();
break;
case "search":
- print search_type("user", drupal_url(array("mod" => "user", "op" => "search"), "admin"));
+ print search_type("user", url("admin/user/search"));
break;
case t("Add rule"):
case t("Check"):
@@ -1690,7 +1705,7 @@ function user_help_devel_da() {
<pre>function blogger_info($field = NULL) {
$info["name"] = "Blogger";
$info["protocol"] = "XML-RPC";
- $info["link"] = "<a href=\"module.php?mod=user&op=da_help#blogger\">Blogger</a>";
+ $info["link"] = l("Blogger", "user/help#blogger");
$info["maintainer"] = "Moshe Weitzman";
$info["maintaineremail"] = "weitzman at tejasa.com";
@@ -1825,9 +1840,8 @@ function user_help_devel_da() {
want to share it with the world. The best way to do this is to add the module
to the <a href="http://cvs.drupal.org/viewcvs.cgi/contributions/modules/authentication/Blogger/?cvsroot=contrib">Drupal
contributions CVS repository</a>. You'll need to request priveleges in this repository - see <a href="http://cvs.drupal.org/viewcvs.cgi/contributions/README?rev=HEAD&cvsroot=contrib&content-type=text/vnd.viewcvs-markup">README</a>
- for the details. Then you'll want to announce your contribution on the <a href="http://www.drop.org/node.php?title=mailing%2Blists">Drupal_devel
- and Drupal_support mailing lists</a>. You might also want to post a story on
- <a href="http://www.drop.org">Drop.org</a>.<br>
+ for the details. Then you'll want to announce your contribution on the <a href="http://list.drupal.org/>drupal-devel and drupal-support mailing lists</a>. You might also want to post a story on
+ <a href="http://www.drupal.org/">Drupal.org</a>.<br>
</p>
<?php
}
diff --git a/modules/user/user.module b/modules/user/user.module
index a788b1dc1..00a4de46f 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -296,7 +296,7 @@ function user_search($keys) {
global $PHP_SELF;
$result = db_query("SELECT * FROM users WHERE name LIKE '%$keys%' LIMIT 20");
while ($account = db_fetch_object($result)) {
- $find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "user", "op" => "edit", "id" => $account->uid), "admin") : drupal_url(array("mod" => "user", "op" => "view", "id" => $account->uid), "module")), "user" => $account->name);
+ $find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin") ? url("admin/user/edit/$account->uid") : url("user/view/$account->uid")), "user" => $account->name);
}
return $find;
}
@@ -315,7 +315,7 @@ function user_block($op = "list", $delta = 0) {
case 0:
if (!$user->uid) {
$output = "<div align=\"center\">\n";
- $output .= "<form action=\"". drupal_url(array("mod" => "user", "op" => "login"), "module") ."\" method=\"post\">\n";
+ $output .= "<form action=\"". url("user/login") ."\" method=\"post\">\n";
// Save the referer. We record where the user came from such that we
// can redirect him after having completed the login form.
if (!$edit["destination"]) $edit["destination"] = request_uri();
@@ -334,9 +334,9 @@ function user_block($op = "list", $delta = 0) {
$output .= "</form></div>\n";
if (variable_get("user_register", 1)) {
- $items[] = lm(t("Create new account"), array("mod" => "user", "op" => "register"), "", array("title" => t("Create a new user account.")));
+ $items[] = l(t("Create new account"), "user/register", array("title" => t("Create a new user account.")));
}
- $items[] = lm(t("Request new password"), array("mod" => "user", "op" => "password"), "", array("title" => t("Request new password via e-mail.")));
+ $items[] = l(t("Request new password"), "user/password", array("title" => t("Request new password via e-mail.")));
$output .= theme_invoke("theme_item_list", $items);
@@ -363,7 +363,7 @@ function user_block($op = "list", $delta = 0) {
$result = db_query("SELECT uid, name FROM users WHERE status != '0' ORDER BY uid DESC LIMIT 5");
while ($account = db_fetch_object($result)) {
- $items[] = lm((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), array("mod" =>user, "op" => "view", "id" => $account->uid));
+ $items[] = l((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), "user/view/$account->uid");
}
$output = theme_invoke("theme_item_list", $items);
@@ -377,19 +377,19 @@ function user_block($op = "list", $delta = 0) {
function user_link($type) {
if ($type == "page") {
- $links[] = lm(t("user account"), array("mod" => "user"), "", array("title" => t("Create a user account, request a new password or edit your account settings.")));
+ $links[] = l(t("user account"), "user", array("title" => t("Create a user account, request a new password or edit your account settings.")));
}
if ($type == "menu.settings") {
- $links[] = lm(t("edit account"), array("mod" => "user", "op" => "edit"), "", array("title" => t("View and edit your account information.")));
+ $links[] = l(t("edit account"), "user/edit", array("title" => t("View and edit your account information.")));
}
if ($type == "menu.misc") {
if (user_access("access administration pages")) {
- $links[] = la(t("administer %a", array("%a" => variable_get("site_name", "drupal"))), array(), "", array("title" => t("Access administration pages.")));
+ $links[] = l(t("administer %a", array("%a" => variable_get("site_name", "drupal"))), "admin", array("title" => t("Access administration pages.")));
}
- $links[] = lm(t("logout"), array("mod" => "user", "op" => "logout"), "", array("title" => t("Logout.")));
+ $links[] = l(t("logout"), "user/logout", array("title" => t("Logout.")));
}
if ($type == "admin" && user_access("administer users")) {
@@ -402,24 +402,24 @@ function user_link($type) {
$help["search"] = "On this page you can query any username. For example, one may search for 'br' and Drupal might return 'brian', 'brad', and 'brenda'.";
$help["setting"] = "Administrators may choose to restrict registration to their site. That restriction may be accomplished on this page. Also, the list of words which may be included in a system generated password is also listed on this page. Drupal generates passwords by joining small words from the password list until the new password is greater than 6 characters.";
- menu_add("user management", "admin.php?mod=user", "User management", $help["user"]);
- menu_add("create new account", "admin.php?mod=user&op=create", "Create a new user account.", $help["create"], "user management", 1);
- menu_add("view user accounts", "admin.php?mod=user&op=account", "Display user account listings.", $help["view"], "user management", 2, 1);
- menu_add("access rules", "admin.php?mod=user&op=access", "Configure access rules.", $help["access"], "user management", 3);
- menu_add("e-mail rules", "admin.php?mod=user&op=access&type=mail", "Allow or deny certain e-mail addresses.", $help["access"], "access rules");
- menu_add("username rules", "admin.php?mod=user&op=access&type=user", "Allow or deny certain usernames.", $help["access"], "access rules");
- menu_add("user roles", "admin.php?mod=user&op=role", "Configure user roles.", $help["role"], "user management", 4);
- menu_add("user permissions", "admin.php?mod=user&op=permission", "Configure user permissions.", $help["permission"], "user management", 5);
- menu_add("search account", "admin.php?mod=user&op=search", "Search a user account.", $help["search"], "user management", 5);
- menu_add("help", "admin.php?mod=user&op=help", "More information about user management.", NULL, "user management", 7);
-
- menu_add("active users", "admin.php?mod=user&op=account&query=0", t("Active users."), $help["view"], "view user accounts", 1);
- menu_add("new users", "admin.php?mod=user&op=account&query=1", t("New users."), $help["view"], "view user accounts", 2);
- menu_add("blocked users", "admin.php?mod=user&op=account&query=2", t("Blocked users."), $help["view"], "view user accounts", 3);
+ menu_add("user management", url("admin/user"), "User management", $help["user"]);
+ menu_add("create new account", url("admin/user/create"), "Create a new user account.", $help["create"], "user management", 1);
+ menu_add("view user accounts", url("admin/user/account"), "Display user account listings.", $help["view"], "user management", 2, 1);
+ menu_add("access rules", url("admin/user/access"), "Configure access rules.", $help["access"], "user management", 3);
+ menu_add("e-mail rules", url("admin/user/access/mail"), "Allow or deny certain e-mail addresses.", $help["access"], "access rules");
+ menu_add("username rules", url("admin/user/access/user"), "Allow or deny certain usernames.", $help["access"], "access rules");
+ menu_add("user roles", url("admin/user/role"), "Configure user roles.", $help["role"], "user management", 4);
+ menu_add("user permissions", url("admin/user/permission"), "Configure user permissions.", $help["permission"], "user management", 5);
+ menu_add("search account", url("admin/user/search"), "Search a user account.", $help["search"], "user management", 5);
+ menu_add("help", url("admin/user/help"), "More information about user management.", NULL, "user management", 7);
+
+ menu_add("active users", url("admin/user/account/0"), t("Active users."), $help["view"], "view user accounts", 1);
+ menu_add("new users", url("admin/user/account/1"), t("New users."), $help["view"], "view user accounts", 2);
+ menu_add("blocked users", url("admin/user/account/2"), t("Blocked users."), $help["view"], "view user accounts", 3);
$i = 3;
foreach (user_roles(1) as $key => $value) {
- menu_add("users with role '$value'", "admin.php?mod=user&op=account&query=". $i++, NULL, $help["view"], "view user accounts", 4);
+ menu_add("users with role '$value'", url("admin/user/account/". $i++), NULL, $help["view"], "view user accounts", 4);
}
}
@@ -481,7 +481,7 @@ function user_auth_help_links() {
$links = array();
foreach (module_list() as $module) {
if (module_hook($module, "auth_help")) {
- $links[] = lm(module_invoke($module, "info", "name"), array("mod" => "user", "op" => "help"), $module);
+ $links[] = l(module_invoke($module, "info", "name"), "user/help#$module");
}
}
return $links;
@@ -497,7 +497,7 @@ function user_login($edit = array(), $msg = "") {
*/
if ($user->uid) {
- drupal_goto(drupal_url(array("mod" => "user"), "module"));
+ drupal_goto(url("user"));
}
if (user_deny("user", $edit["name"])) {
@@ -549,7 +549,7 @@ function user_login($edit = array(), $msg = "") {
if (module_invoke($module, "auth", $name, $pass, $server)) {
if (variable_get("user_register", 1) == 1 && !user_load(array("name" => "$name@$server"))) { //register this new user
$user = user_save("", array("name" => "$name@$server", "pass" => user_password(), "init" => "$name@$server", "status" => 1, "authname_$module" => "$name@$server", "rid" => _user_authenticated_id()));
- watchdog("user", "new user: $name@$server ($module ID)", la("edit user", array("mod" => "user", "op" => "edit", "id" => $user->uid)));
+ watchdog("user", "new user: $name@$server ($module ID)", l("edit user", "admin/user/edit/$user->uid"));
break;
}
}
@@ -586,7 +586,7 @@ function user_login($edit = array(), $msg = "") {
}
else {
if (!$error) {
- $error = t("Sorry. Unrecognized username or password.") ." ". lm(t("Have you forgotten your password?"), array("mod" => "user", "op" => "password"));
+ $error = t("Sorry. Unrecognized username or password.") ." ". l(t("Have you forgotten your password?"), "user/password");
}
if ($server) {
watchdog("user", "failed login for '$name@$server': $error");
@@ -631,13 +631,13 @@ function user_login($edit = array(), $msg = "") {
$output .= form_password(t("Password"), "pass", $pass, 20, 64, t("Enter the password that accompanies your username."));
$output .= form_checkbox(t("Remember me"), "remember_me", 1, 0, 0);
$output .= form_submit(t("Log in"));
- $output .= "<p>&raquo; ". lm(t("Request new password"), array("mod" => "user", "op" => "password")). "<br />";
+ $output .= "<p>&raquo; ". l(t("Request new password"), "user/password"). "<br />";
if (variable_get("user_register", 1)) {
- $output .= "&raquo; ". lm(t("Create new account"), array("mod" => "user", "op" => "register"));
+ $output .= "&raquo; ". l(t("Create new account"), "user/register");
}
$output .= "</p>";
- return form($output, "post", drupal_url(array ("mod" => "user"), "module"));
+ return form($output, "post", url("user"));
}
function _user_authenticated_id() {
@@ -693,7 +693,7 @@ function user_pass($edit = array()) {
$variables = array("%username" => $account->name, "%site" => variable_get("site_name", "drupal"), "%password" => $pass, "%uri" => path_uri(), "%uri_brief" => path_uri(1), "%mailto" => $account->mail, "%date" => format_date(time()));
$subject = strtr(variable_get("user_mail_pass_subject", t("Replacement login information for %username at %site")), $variables);
- $body = strtr(variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". drupal_url(array("mod" => "user", "op" => "edit"), "module") .".\n\nYour new %site membership also enables you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
+ $body = strtr(variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". url("user/edit") .".\n\nYour new %site membership also enables you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
$headers = "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from";
user_mail($account->mail, $subject, $body, $headers);
@@ -716,13 +716,13 @@ function user_pass($edit = array()) {
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64);
$output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64);
$output .= form_submit(t("E-mail new password"));
- $output .= "<p>&raquo; ". lm(t("Log in"), array("mod" =>user, "op" => "login")) ."<br />";
+ $output .= "<p>&raquo; ". l(t("Log in"), "user/login") ."<br />";
if (variable_get("user_register", 1)) {
- $output .= "&raquo; ". lm(t("Create new account"), array("mod" => "user", "op" => "register"));
+ $output .= "&raquo; ". l(t("Create new account"), "user/register");
}
$output .= "</p>";
- return form($output, "post", drupal_url(array ("mod" => "user"), "module"));
+ return form($output, "post", url("user"));
}
}
@@ -734,7 +734,7 @@ function user_register($edit = array()) {
*/
if ($user->uid) {
- drupal_goto(drupal_url(array("mod" => "user", "op" => "edit"), "module"));
+ drupal_goto(url("user/edit"));
}
if ($edit["name"] && $edit["mail"]) {
@@ -788,13 +788,13 @@ function user_register($edit = array()) {
// TODO: is this necessary? Won't session_write replicate this?
unset($edit["session"]);
$account = user_save("", array_merge(array("name" => $edit["name"], "pass" => $pass, "init" => $edit["mail"], "mail" => $edit["mail"], "rid" => _user_authenticated_id(), "rating" => 0, "status" => (variable_get("user_register", 1) == 1 ? 1 : 0)), $data));
- watchdog("user", "new user: '". $edit["name"] ."' &lt;". $edit["mail"] ."&gt;", la("edit user", array("mod" => "user", "op" => "edit", "id" => $account->uid)));
+ watchdog("user", "new user: '". $edit["name"] ."' &lt;". $edit["mail"] ."&gt;", l("edit user", "admin/user/edit/$account->uid"));
$variables = array("%username" => $edit["name"], "%site" => variable_get("site_name", "drupal"), "%password" => $pass, "%uri" => path_uri(), "%uri_brief" => path_uri(1), "%mailto" => $edit["mail"], "%date" => format_date(time()));
//the first user may login immediately, and receives a customized welcome e-mail.
if ($account->uid == 1) {
- user_mail($edit["mail"], t("drupal user account details for %s", array("%s" => $edit["name"])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\nAfter logging in, you may wish to visit the following pages:\n\nAdministration: %uriadmin.php\nEdit user account: %uri". drupal_url(array("mod" => "user", "op" => "edit"), "module") ."\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
+ user_mail($edit["mail"], t("drupal user account details for %s", array("%s" => $edit["name"])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\n%uri". url("user/edit") ."\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
// This should not be t()'ed. No point as its only shown once in the sites lifetime, and it would be bad to store the password
$output .= "<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please configure your e-mail settings using the Administration pages.</p><p> Your password is <b>$pass</b>. You may change your password on the next page.</p><p>Please login below.</p>";
$output .= form_hidden("name", $account->name);
@@ -809,7 +809,7 @@ function user_register($edit = array()) {
*/
$subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables);
- $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
+ $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". url("user/edit") .".\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
return t("Your password and further instructions have been sent to your e-mail address.");
}
@@ -818,9 +818,9 @@ function user_register($edit = array()) {
** Create new user account, administrator approval required:
*/
$subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables);
- $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. Your account will have to be approved by the site administrator. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
+ $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. Your account will have to be approved by the site administrator. You may now login to %uri". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". url("user/edit") .".\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
- user_mail(variable_get("site_mail", ini_get("sendmail_from")), $subject, t("%u has applied for an account.\n\n%uri", array("%u" => $account->name, "%uri" => path_uri() . drupal_url(array("mod" => "user", "op" => "edit", "id" => $account->uid), "admin"))), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
+ user_mail(variable_get("site_mail", ini_get("sendmail_from")), $subject, t("%u has applied for an account.\n\n%uri", array("%u" => $account->name, "%uri" => path_uri() . url("admin/user/edit/$account->uid"))), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
return t("Your password and further instructions have been sent to your e-mail address.");
}
}
@@ -835,7 +835,7 @@ function user_register($edit = array()) {
$affiliates = user_auth_help_links();
if (count($affiliates) > 0) {
$affiliates = implode(", ", $affiliates);
- $output .= "<p>" . t("Note: If you have an account with one of our affiliates (%s), you may ". lm("login now", array("mod" => "user", "op" => "login")) ." instead of registering.", array("%s" => $affiliates)) ."</p>";
+ $output .= "<p>" . t("Note: If you have an account with one of our affiliates (%s), you may ". l("login now", "user/login") ." instead of registering.", array("%s" => $affiliates)) ."</p>";
}
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Your full name or your preferred username: only letters, numbers and spaces are allowed."));
$output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64, t("A password and instructions will be sent to this e-mail address, so make sure it is accurate."));
@@ -845,8 +845,8 @@ function user_register($edit = array()) {
}
}
$output .= form_submit(t("Create new account"));
- $output .= "<p>&raquo; ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "<br />";
- $output .= "&raquo; " .lm(t("Log in"), array("mod" => "user", "op" => "login")). "</p>";
+ $output .= "<p>&raquo; ". l(t("E-mail new password"), "user/password"). "<br />";
+ $output .= "&raquo; ". l(t("Log in"), "user/login") ."</p>";
return form($output);
}
@@ -982,9 +982,9 @@ function user_edit($edit = array()) {
}
function user_menu() {
- $links[] = lm(t("view user information"), array("mod" => "user", "op" => "view"));
- $links[] = lm(t("edit user information"), array("mod" => "user", "op" => "edit"));
- $links[] = lm(t("delete account"), array("mod" => "user", "op" => "delete"));
+ $links[] = l(t("view user information"), "user/view");
+ $links[] = l(t("edit user information"), "user/edit");
+ $links[] = l(t("delete account"), "user/delete");
return "<div align=\"center\">". implode(" &middot; ", $links) ."</div>";
}
@@ -1036,7 +1036,11 @@ function user_view($uid = 0) {
}
function user_page() {
- global $edit, $op, $id, $theme;
+ global $edit, $op, $theme;
+
+ if (empty($op)) {
+ $op = arg(1);
+ }
switch ($op) {
case t("E-mail new password");
@@ -1082,7 +1086,7 @@ function user_page() {
$theme->footer();
break;
case "view":
- user_view($id);
+ user_view(arg(2));
break;
case t("Logout"):
case "logout":
@@ -1106,9 +1110,9 @@ function user_conf_options() {
$output .= form_textfield(t("Password words"), "user_password", variable_get("user_password", "foo,bar,guy,neo,tux,moo,sun,asm,dot,god,axe,geek,nerd,fish,hack,star,mice,warp,moon,hero,cola,girl,fish,java,perl,boss,dark,sith,jedi,drop,mojo"), 55, 256, t("A comma separated list of short words that can be concatenated to generate human-readable passwords."));
$output .= form_select(t("Remember authenticated users"), "user_remember", variable_get("user_remember", 0), array(t("Let the user decide whether he should be logged out when leaving the site."), t("Authenticated users are not logged out upon leaving the site."), t("Authenticated users are logged out upon leaving the site.")));
$output .= form_textfield(t("Subject of welcome e-mail"), "user_mail_welcome_subject", variable_get("user_mail_welcome_subject", "User account details for %username at %site"), 80, 180, t("Customize the subject of your welcome e-mail, which is sent to new members upon registering.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto, %date");
- $output .= form_textarea(t("Body of welcome e-mail"), "user_mail_welcome_body", variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". drupal_url(array("mod" => "user", "op" => "edit"), "module") ."\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, t("Customize the body of the welcome e-mail, which is sent to new members upon registering.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto");
+ $output .= form_textarea(t("Body of welcome e-mail"), "user_mail_welcome_body", variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". url("user/edit") ."\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, t("Customize the body of the welcome e-mail, which is sent to new members upon registering.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto");
$output .= form_textfield(t("Subject of password recovery e-mail"), "user_mail_pass_subject", variable_get("user_mail_pass_subject", t("Replacement login information for %username at %site")), 80, 180, t("Customize the Subject of your forgotten password e-mail.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto, %date");
- $output .= form_textarea(t("Body of password recovery e-mail"), "user_mail_pass_body", variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". drupal_url(array("mod" => "user", "op" => "edit"), "module") ."\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, t("Customize the body of the forgotten password e-mail.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto");
+ $output .= form_textarea(t("Body of password recovery e-mail"), "user_mail_pass_body", variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri". url("user/login") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". url("user/edit") ."\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, t("Customize the body of the forgotten password e-mail.") . " " . t("Available variables are:") . " " . "%username, %site, %password, %uri, %uri_brief, %mailto");
return $output;
}
@@ -1158,6 +1162,9 @@ function user_admin_create($edit = array()) {
function user_admin_access($edit = array()) {
global $op, $id, $type;
+ $type = arg(3);
+ $id = arg(4);
+
if (empty($type)) {
return;
}
@@ -1190,13 +1197,13 @@ function user_admin_access($edit = array()) {
$result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '1' ORDER BY mask", $type);
while ($rule = db_fetch_object($result)) {
- $rows[] = array(t("Allow"), $rule->mask, array("data" => la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)), "align" => "center"));
+ $rows[] = array(t("Allow"), $rule->mask, array("data" => l(t("delete rule"), "admin/user/access/$type/$rule->aid"), "align" => "center"));
}
$result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '0' ORDER BY mask", $type);
while ($rule = db_fetch_object($result)) {
- $rows[] = array(t("Deny"), $rule->mask, la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)));
+ $rows[] = array(t("Deny"), $rule->mask, l(t("delete rule"), "admin/user/access/$type/$rule->aid"));
}
$rows[] = array("<select name=\"edit[status]\"><option value=\"1\">". t("Allow") ."</option><option value=\"0\">". t("Deny") ."</option></select>", "<input size=\"32\" maxlength=\"64\" name=\"edit[mask]\" />", "<input type=\"submit\" name=\"op\" value=\"" . t("Add rule") . "\" />");
@@ -1301,7 +1308,9 @@ function user_admin_perm($edit = array()) {
}
function user_admin_role($edit = array()) {
- global $op, $id;
+ global $op;
+
+ $id = arg(3);
if ($op == t("Save role")) {
db_query("UPDATE role SET name = '%s' WHERE rid = '%s'", $edit["name"], $id);
@@ -1336,7 +1345,7 @@ function user_admin_role($edit = array()) {
$header = array(t("name"), t("operations"));
while ($role = db_fetch_object($result)) {
- $rows[] = array($role->name, array("data" => la(t("edit role"), array("mod" => "user", "op" => "role", "id" => $role->rid)), "align" => "center"));
+ $rows[] = array($role->name, array("data" => l(t("edit role"), "admin/user/role/$role->rid"), "align" => "center"));
}
$rows[] = array("<input size=\"32\" maxlength=\"64\" name=\"edit[name]\" />", "<input type=\"submit\" name=\"op\" value=\"". t("Add role") ."\" />");
@@ -1348,7 +1357,9 @@ function user_admin_role($edit = array()) {
}
function user_admin_edit($edit = array()) {
- global $op, $id;
+ global $op;
+
+ $id = arg(3);
if ($account = user_load(array("uid" => $id))) {
@@ -1454,7 +1465,7 @@ function user_admin_edit($edit = array()) {
}
function user_admin_account() {
- global $query;
+ $query = arg(3);
$queries = array("ORDER BY timestamp DESC", "ORDER BY u.uid DESC", "WHERE status = 0 ORDER BY u.uid DESC");
foreach (user_roles(1) as $key => $value) {
@@ -1465,7 +1476,7 @@ function user_admin_account() {
$header = array(t("username"), t("last access"), t("operations"));
while ($account = db_fetch_object($result)) {
- $rows[] = array(format_name($account), format_date($account->timestamp, "small"), la(t("edit account"), array("mod" => "user", "op" => "edit", "id" => $account->uid)));
+ $rows[] = array(format_name($account), format_date($account->timestamp, "small"), l(t("edit account"), "admin/user/edit/$account->uid"));
}
if ($pager = pager_display(NULL, 50, 0, "admin")) {
@@ -1488,7 +1499,7 @@ function user_role_init() {
}
function user_admin() {
- global $edit, $id, $op;
+ global $op, $edit;
if (user_access("administer users")) {
/*
@@ -1497,12 +1508,16 @@ function user_admin() {
user_role_init();
+ if (empty($op)) {
+ $op = arg(2);
+ }
+
switch ($op) {
case "help":
print user_help();
break;
case "search":
- print search_type("user", drupal_url(array("mod" => "user", "op" => "search"), "admin"));
+ print search_type("user", url("admin/user/search"));
break;
case t("Add rule"):
case t("Check"):
@@ -1690,7 +1705,7 @@ function user_help_devel_da() {
<pre>function blogger_info($field = NULL) {
$info["name"] = "Blogger";
$info["protocol"] = "XML-RPC";
- $info["link"] = "<a href=\"module.php?mod=user&op=da_help#blogger\">Blogger</a>";
+ $info["link"] = l("Blogger", "user/help#blogger");
$info["maintainer"] = "Moshe Weitzman";
$info["maintaineremail"] = "weitzman at tejasa.com";
@@ -1825,9 +1840,8 @@ function user_help_devel_da() {
want to share it with the world. The best way to do this is to add the module
to the <a href="http://cvs.drupal.org/viewcvs.cgi/contributions/modules/authentication/Blogger/?cvsroot=contrib">Drupal
contributions CVS repository</a>. You'll need to request priveleges in this repository - see <a href="http://cvs.drupal.org/viewcvs.cgi/contributions/README?rev=HEAD&cvsroot=contrib&content-type=text/vnd.viewcvs-markup">README</a>
- for the details. Then you'll want to announce your contribution on the <a href="http://www.drop.org/node.php?title=mailing%2Blists">Drupal_devel
- and Drupal_support mailing lists</a>. You might also want to post a story on
- <a href="http://www.drop.org">Drop.org</a>.<br>
+ for the details. Then you'll want to announce your contribution on the <a href="http://list.drupal.org/>drupal-devel and drupal-support mailing lists</a>. You might also want to post a story on
+ <a href="http://www.drupal.org/">Drupal.org</a>.<br>
</p>
<?php
}
diff --git a/modules/watchdog.module b/modules/watchdog.module
index eeabdd453..e1c9b4167 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -21,14 +21,14 @@ function watchdog_link($type) {
if ($type == "admin" && user_access("administer watchdog")) {
$help = "The watchdog module monitors your website, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains usage data, performance data, errors, warnings and operational information. It is vital to check the watchdog report on a regular basis as it is often the only way to tell what is going on.";
- menu_add("site monitoring", "admin.php?mod=watchdog", "Monitor your site.", NULL, NULL, 2);
- menu_add("watchdog", "admin.php?mod=watchdog&type=all", "Display system events.", $help, "site monitoring", 1, 1);
- menu_add("user messages", "admin.php?mod=watchdog&type=user", "Display system events", $help, "watchdog");
- menu_add("regular messages", "admin.php?mod=watchdog&type=regular", "Display system events", $help, "watchdog");
- menu_add("special messages", "admin.php?mod=watchdog&type=special", "Display system events", $help, "watchdog");
- menu_add("warning messages", "admin.php?mod=watchdog&type=warning", "Display system events", $help, "watchdog");
- menu_add("error messages", "admin.php?mod=watchdog&type=error", "Display system events", $help, "watchdog");
- menu_add("httpd messages", "admin.php?mod=watchdog&type=httpd", "Display system events", $help, "watchdog");
+ menu_add("site monitoring", url("admin/watchdog"), "Monitor your site.", NULL, NULL, 2);
+ menu_add("watchdog", url("admin/watchdog/list/all"), "Display system events.", $help, "site monitoring", 1, 1);
+ menu_add("user messages", url("admin/watchdog/list/user"), "Display system events", $help, "watchdog");
+ menu_add("regular messages", url("admin/watchdog/list/regular"), "Display system events", $help, "watchdog");
+ menu_add("special messages", url("admin/watchdog/list/special"), "Display system events", $help, "watchdog");
+ menu_add("warning messages", url("admin/watchdog/list/warning"), "Display system events", $help, "watchdog");
+ menu_add("error messages", url("admin/watchdog/list/error"), "Display system events", $help, "watchdog");
+ menu_add("httpd messages", url("admin/watchdog/list/httpd"), "Display system events", $help, "watchdog");
}
}
@@ -52,7 +52,7 @@ function watchdog_overview($type) {
$output .= " <tr><th>" . t("date") . "</th><th>" . t("event") . "</th><th>" . t("user") . "</th><th colspan=\"2\">" . t("operations") . "</th></tr>";
while ($watchdog = db_fetch_object($result)) {
if ($background = $color[$watchdog->type]) {
- $output .= " <tr bgcolor=\"$background\"><td nowrap=\"nowrap\">". format_date($watchdog->timestamp, "small") ."</td><td>". substr(strip_tags($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">$watchdog->link</td><td align=\"center\">". la(t("view details"), array("mod" => "watchdog", "op" => "view", "id" => $watchdog->wid)) ."</td></tr>";
+ $output .= " <tr bgcolor=\"$background\"><td nowrap=\"nowrap\">". format_date($watchdog->timestamp, "small") ."</td><td>". substr(strip_tags($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">$watchdog->link</td><td align=\"center\">". l(t("view details"), "admin/watchdog/view/$watchdog->wid") ."</td></tr>";
}
}
@@ -84,18 +84,17 @@ function watchdog_view($id) {
}
function watchdog_admin() {
- global $op, $id, $type, $order;
if (user_access("administer watchdog")) {
- switch ($op) {
+ switch (arg(2)) {
case "help":
watchdog_help();
break;
case "view":
- print watchdog_view(check_input($id));
+ print watchdog_view(check_input(arg(3)));
break;
default:
- print watchdog_overview($type);
+ print watchdog_overview(arg(3));
}
}
else {
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index eeabdd453..e1c9b4167 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -21,14 +21,14 @@ function watchdog_link($type) {
if ($type == "admin" && user_access("administer watchdog")) {
$help = "The watchdog module monitors your website, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains usage data, performance data, errors, warnings and operational information. It is vital to check the watchdog report on a regular basis as it is often the only way to tell what is going on.";
- menu_add("site monitoring", "admin.php?mod=watchdog", "Monitor your site.", NULL, NULL, 2);
- menu_add("watchdog", "admin.php?mod=watchdog&type=all", "Display system events.", $help, "site monitoring", 1, 1);
- menu_add("user messages", "admin.php?mod=watchdog&type=user", "Display system events", $help, "watchdog");
- menu_add("regular messages", "admin.php?mod=watchdog&type=regular", "Display system events", $help, "watchdog");
- menu_add("special messages", "admin.php?mod=watchdog&type=special", "Display system events", $help, "watchdog");
- menu_add("warning messages", "admin.php?mod=watchdog&type=warning", "Display system events", $help, "watchdog");
- menu_add("error messages", "admin.php?mod=watchdog&type=error", "Display system events", $help, "watchdog");
- menu_add("httpd messages", "admin.php?mod=watchdog&type=httpd", "Display system events", $help, "watchdog");
+ menu_add("site monitoring", url("admin/watchdog"), "Monitor your site.", NULL, NULL, 2);
+ menu_add("watchdog", url("admin/watchdog/list/all"), "Display system events.", $help, "site monitoring", 1, 1);
+ menu_add("user messages", url("admin/watchdog/list/user"), "Display system events", $help, "watchdog");
+ menu_add("regular messages", url("admin/watchdog/list/regular"), "Display system events", $help, "watchdog");
+ menu_add("special messages", url("admin/watchdog/list/special"), "Display system events", $help, "watchdog");
+ menu_add("warning messages", url("admin/watchdog/list/warning"), "Display system events", $help, "watchdog");
+ menu_add("error messages", url("admin/watchdog/list/error"), "Display system events", $help, "watchdog");
+ menu_add("httpd messages", url("admin/watchdog/list/httpd"), "Display system events", $help, "watchdog");
}
}
@@ -52,7 +52,7 @@ function watchdog_overview($type) {
$output .= " <tr><th>" . t("date") . "</th><th>" . t("event") . "</th><th>" . t("user") . "</th><th colspan=\"2\">" . t("operations") . "</th></tr>";
while ($watchdog = db_fetch_object($result)) {
if ($background = $color[$watchdog->type]) {
- $output .= " <tr bgcolor=\"$background\"><td nowrap=\"nowrap\">". format_date($watchdog->timestamp, "small") ."</td><td>". substr(strip_tags($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">$watchdog->link</td><td align=\"center\">". la(t("view details"), array("mod" => "watchdog", "op" => "view", "id" => $watchdog->wid)) ."</td></tr>";
+ $output .= " <tr bgcolor=\"$background\"><td nowrap=\"nowrap\">". format_date($watchdog->timestamp, "small") ."</td><td>". substr(strip_tags($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">$watchdog->link</td><td align=\"center\">". l(t("view details"), "admin/watchdog/view/$watchdog->wid") ."</td></tr>";
}
}
@@ -84,18 +84,17 @@ function watchdog_view($id) {
}
function watchdog_admin() {
- global $op, $id, $type, $order;
if (user_access("administer watchdog")) {
- switch ($op) {
+ switch (arg(2)) {
case "help":
watchdog_help();
break;
case "view":
- print watchdog_view(check_input($id));
+ print watchdog_view(check_input(arg(3)));
break;
default:
- print watchdog_overview($type);
+ print watchdog_overview(arg(3));
}
}
else {
diff --git a/node.php b/node.php
deleted file mode 100644
index c64fd6ebf..000000000
--- a/node.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-// $Id$
-
-include_once "includes/common.inc";
-
-page_header();
-
-function node_render($node) {
- global $id, $cid, $op, $moderate, $pid, $edit, $theme, $mode, $order, $threshold, $PHP_SELF;
-
- if (user_access("access content")) {
-
- $theme->header($node->title);
-
- node_view($node);
-
- if (function_exists("comment_render") && $node->comment) {
- comment_render($node, $cid);
- }
-
- $theme->footer();
-
- }
- else {
- $theme->header();
- $theme->box(t("Access denied"), message_access());
- $theme->footer();
- }
-}
-
-function node_failure() {
- global $theme;
- $theme->header();
- $theme->box(t("Not found"), t("The node you are looking for does no longer exist or is not accessible without the proper access rights.") ."\n");
- $theme->footer();
-}
-
-$number = ($title ? db_num_rows(db_query("SELECT nid FROM node WHERE title = '%s' AND status = 1", $title)) : 1);
-
-if ($number > 1) {
- $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.title = '%s' AND n.status = 1 ORDER BY created DESC", $title);
-
- while ($node = db_fetch_object($result)) {
- if (node_access("view", $node)) {
- $output .= "<p><b>". l($node->title, array("id" => $node->nid)) ."</b><br /><small>$node->type - ". format_name($node) ." - ". format_date($node->ccreated, "small") ."</small></p>";
- }
- }
-
- $theme->header();
- $theme->box(t("Result"), $output);
- $theme->footer();
-}
-elseif ($number) {
- $node = ($title ? node_load(array("title" => $title, "status" => 1)) : node_load(array("status" => 1, "nid" => ($edit["id"] ? $edit["id"] : $id))));
-
- if (node_access("view", $node)) {
- if (isset($revision)) {
- $node = $node->revisions[$revision]["node"];
- }
-
- node_render($node);
- }
- else {
- node_failure();
- }
-
-}
-else {
- node_failure();
-}
-
-page_footer();
-
-?> \ No newline at end of file
diff --git a/update.php b/update.php
index a07f641a7..43e36f17d 100644
--- a/update.php
+++ b/update.php
@@ -61,7 +61,8 @@ $mysql_updates = array(
"2002-12-10" => "update_46",
"2002-12-22" => "update_47",
"2002-12-29" => "update_48",
- "2003-01-03" => "update_49"
+ "2003-01-03" => "update_49",
+ "2003-01-05" => "update_50"
);
// Update functions
@@ -667,6 +668,12 @@ function update_49() {
update_sql("ALTER TABLE watchdog ADD link varchar(255) DEFAULT '' NULL");
}
+function update_50() {
+ update_content("%admin.php%");
+ update_content("%module.php%");
+ update_content("%node.php%");
+}
+
function update_upgrade3() {
update_sql("INSERT INTO system VALUES ('archive.module','archive','module','',1)");
update_sql("INSERT INTO system VALUES ('block.module','block','module','',1)");
@@ -788,6 +795,19 @@ function update_page() {
}
}
+function update_content($pattern) {
+
+ $result = db_query("SELECT n.nid, c.cid, c.subject FROM node n LEFT JOIN comments c ON n.nid = c.nid WHERE c.comment LIKE '%s'", $pattern);
+ while ($comment = db_fetch_object($result)) {
+ watchdog("special", "upgrade possibly affects comment '$comment->subject'", "<a href=\"node.php?id=$comment->nid&cid=$comment->cid#$comment->cid\">view post</a>");
+ }
+
+ $result = db_query("SELECT nid, title FROM node WHERE teaser LIKE '%s' OR body LIKE '%s'", $pattern, $pattern);
+ while ($node = db_fetch_object($result)) {
+ watchdog("special", "upgrade possibly affects node '$node->title'", "<a href=\"node.php?id=$node->nid\">view post</a>");
+ }
+}
+
function update_info() {
print "<html><h1>Drupal database update</h1>";