Commit f86a9449 authored by Kjartan's avatar Kjartan

- applied Stevens link patch.

- fixed block permissions.
- fixed user admin page errors: http://www.drupal.org/node.php?id=173.
- cleaned up common.inc a bit: removed format_info, path_img, field_merge.
parent 497ab799
......@@ -35,7 +35,7 @@ function error_handler($errno, $message, $filename, $line, $variables) {
function watchdog($type, $message) {
global $user;
db_query("INSERT INTO watchdog (uid, type, message, location, hostname, timestamp) VALUES ('$user->uid', '%s', '%s', '%s', '%s', '%s')", $type, $message, getenv("PATH_INFO"), getenv("REMOTE_ADDR"), time());
db_query("INSERT INTO watchdog (uid, type, message, location, hostname, timestamp) VALUES ('$user->uid', '%s', '%s', '%s', '%s', '%s')", $type, $message, request_urih(), getenv("REMOTE_ADDR"), time());
}
function throttle($type, $rate) {
......@@ -100,11 +100,6 @@ function request_uri() {
}
}
function path_img() {
// use "http://your-image-server.com/ if you want to host images on a seperate server.
return "./images/";
}
function message_access() {
return t("You are not authorized to access to this page.");
}
......@@ -407,10 +402,6 @@ function check_file($filename) {
}
}
function format_info($body, $block) {
return "<table><tr><td><table align=\"right\" border=\"1\" width=\"180\"><tr><td>$block</td></tr></table>$body</td></tr></table>\n";
}
function format_rss_channel($title, $link, $description, $items, $language = "en", $args = array()) {
// arbitrary elements may be added using the $args associative array
......@@ -509,7 +500,7 @@ function page_get_cache() {
function format_interval($timestamp) {
$units = array("year|years" => 31536000, "week|weeks" => 604800, "day|days" => 86400, "hour|hours" => 3600, "min|min" => 60, "sec|sec" => 1);
foreach ($units as $key => $value) {
foreach ($units as $key=>$value) {
$key = explode("|", $key);
if ($timestamp >= $value) {
$output .= ($output ? " " : "") . format_plural(floor($timestamp / $value), $key[0], $key[1]);
......@@ -543,7 +534,7 @@ function format_date($timestamp, $type = "medium", $format = "") {
$date = date($c, $timestamp).$date;
}
else {
$date = $c . $date;
$date = $c.$date;
}
}
break;
......@@ -571,15 +562,6 @@ function format_name($object) {
return $output;
}
function format_email($address) {
return ($address) ? "<a href=\"mailto:$address\">$address</A>" : message_na();
}
function format_url($address, $description = 0) {
$description = ($description) ? $description : $address;
return ($address) ? "<a href=\"$address\">". check_output($description) ."</a>" : message_na();
}
function format_tag($link, $text) {
return l(($text ? $text : $link), array("title" => $link));
}
......@@ -610,7 +592,7 @@ function form_textarea($title, $name, $value, $cols, $rows, $description = 0) {
function form_select($title, $name, $value, $options, $description = 0, $extra = 0, $multiple = 0) {
if (count($options) > 0) {
foreach ($options as $key => $choice) {
foreach ($options as $key=>$choice) {
$select .= "<option value=\"$key\"". (is_array($value) ? (in_array($key, $value) ? " selected=\"selected\"" : "") : ($key == $value ? " selected=\"selected\"" : "")) .">". check_form($choice) ."</option>";
}
return form_item($title, "<select name=\"edit[$name]". ($multiple ? "[]" : "") ."\"". ($multiple ? " multiple " : "") . ($extra ? " $extra" : "") .">$select</select>", $description);
......@@ -635,13 +617,14 @@ function form_submit($value) {
*
* @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") {
function drupal_url($args = array(), $script = "node", $anchor = "") {
$t = array();
foreach ($args as $key => $value) {
$t[] = "$key=". urlencode($value);
}
return "$script.php?". implode("&", $t);
return "$script.php?". implode("&amp;", $t) . ($anchor != "" ? "#". $anchor : "");
}
/**
......@@ -650,34 +633,34 @@ function drupal_url($args = array(), $script = "node") {
*
* @param $args dictionary of arguments to be passed to the script
* @param $text text of the link
* @param $title optional, popup title
* @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(), $title = "", $script = "node", $attributes = array()) {
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) ."\" title=\"$title\" ". implode($t, " ") .">$text</a>";
return "<a href=\"". drupal_url($args, $script, $anchor) ."\" ". implode($t, " ") .">$text</a>";
}
function la($text, $args = array(), $title = "", $attributes = array()) {
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\"";
}
return "<a href=\"". drupal_url($args, "admin") ."\" title=\"$title\" ". implode($t, " ") .">$text</a>";
return "<a href=\"". drupal_url($args, "admin", $anchor) ."\" ". implode($t, " ") .">$text</a>";
}
function lm($text, $args = array(), $title = "", $attributes = array()) {
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") ."\" title=\"$title\" ". implode($t, " ") .">$text</a>";
return "<a href=\"". drupal_url($args, "module", $anchor) ."\" ". implode($t, " ") .">$text</a>";
}
function field_get($string, $name) {
......@@ -693,14 +676,6 @@ function field_set($string, $name, $value) {
return substr($rval, 1);
}
function field_merge($a, $b) {
foreach (explode(",", $b) as $data) {
$entry = explode("=", $data);
$a = field_set($a, $entry[0], $entry[1]);
}
return $a;
}
function link_page() {
global $custom_links;
......
This diff is collapsed.
This diff is collapsed.
......@@ -109,7 +109,7 @@ function archive_block() {
function archive_link($type) {
if ($type == "page" && user_access("access content")) {
$links[] = lm(t("archives"), array("mod" => "archive"), t("Read the older content in our archive."));
$links[] = lm(t("archives"), array("mod" => "archive"), "", array("title" => t("Read the older content in our archive.")));
}
return $links ? $links : array();
......
......@@ -109,7 +109,7 @@ function archive_block() {
function archive_link($type) {
if ($type == "page" && user_access("access content")) {
$links[] = lm(t("archives"), array("mod" => "archive"), t("Read the older content in our archive."));
$links[] = lm(t("archives"), array("mod" => "archive"), "", array("title" => t("Read the older content in our archive.")));
}
return $links ? $links : array();
......
......@@ -77,9 +77,9 @@ function block_admin_display() {
$weights = array(0 => 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
$output .= '<tr>';
//$output .= '<td>'. la($block->name, array("mod" => "block", "op" => "view", "id" => $block->delta), t("View the block details")) .'</td>';
//$output .= '<td>'. la($block->name, array("mod" => "block", "op" => "view", "id" => $block->delta), "", array("title" => t("View the block details"))) .'</td>';
$output .= "<td>$block->name</td>";
$output .= '<td>'. (module_hook($block->module, "admin") ? la($block->module, array("mod" => $block->module), "Administer module") : $block->module) .'</td>';
$output .= '<td>'. (module_hook($block->module, "admin") ? la($block->module, array("mod" => $block->module), "", array("title" => t("Administer module"))) : $block->module) .'</td>';
$output .= '<td align="center">'. form_checkbox(NULL, "$block->name][status", 1, $block->status) .'</td>';
$output .= '<td align="center">'. form_checkbox(NULL, "$block->name][custom", 1, $block->custom) .'</td>';
$output .= '<td>'. form_select(NULL, "$block->name][weight", $block->weight, $weights) .'</td>';
......@@ -259,13 +259,17 @@ function block_user($type, &$edit, &$user) {
case "edit_form":
$result = db_query("SELECT * FROM blocks WHERE custom = '%d' ORDER BY name", 1);
$form = '<table border="0" cellpadding="2" cellspacing="2">';
while ($block = db_fetch_object($result)) {
$data = module_invoke($block->module, "block");
if ($data[$block->delta]["subject"]) {
$form .= "<tr><td>$block->name</td><td>". form_checkbox(NULL, "block][$block->name", 1, $user->block[$block->name]) ."</td></tr>\n";
}
$form .= '</table>';
}
if (isset($form)) {
return form_item(t("Block configuration"), '<table border="0" cellpadding="2" cellspacing="2">'. $form .'</table>', "Enable the blocks you would like to see displayed in the side bars.");
}
return form_item(t("Block configuration"), $form, "Enable the blocks you would like to see displayed in the side bars.");
}
}
......
......@@ -77,9 +77,9 @@ function block_admin_display() {
$weights = array(0 => 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
$output .= '<tr>';
//$output .= '<td>'. la($block->name, array("mod" => "block", "op" => "view", "id" => $block->delta), t("View the block details")) .'</td>';
//$output .= '<td>'. la($block->name, array("mod" => "block", "op" => "view", "id" => $block->delta), "", array("title" => t("View the block details"))) .'</td>';
$output .= "<td>$block->name</td>";
$output .= '<td>'. (module_hook($block->module, "admin") ? la($block->module, array("mod" => $block->module), "Administer module") : $block->module) .'</td>';
$output .= '<td>'. (module_hook($block->module, "admin") ? la($block->module, array("mod" => $block->module), "", array("title" => t("Administer module"))) : $block->module) .'</td>';
$output .= '<td align="center">'. form_checkbox(NULL, "$block->name][status", 1, $block->status) .'</td>';
$output .= '<td align="center">'. form_checkbox(NULL, "$block->name][custom", 1, $block->custom) .'</td>';
$output .= '<td>'. form_select(NULL, "$block->name][weight", $block->weight, $weights) .'</td>';
......@@ -259,13 +259,17 @@ function block_user($type, &$edit, &$user) {
case "edit_form":
$result = db_query("SELECT * FROM blocks WHERE custom = '%d' ORDER BY name", 1);
$form = '<table border="0" cellpadding="2" cellspacing="2">';
while ($block = db_fetch_object($result)) {
$data = module_invoke($block->module, "block");
if ($data[$block->delta]["subject"]) {
$form .= "<tr><td>$block->name</td><td>". form_checkbox(NULL, "block][$block->name", 1, $user->block[$block->name]) ."</td></tr>\n";
}
$form .= '</table>';
}
if (isset($form)) {
return form_item(t("Block configuration"), '<table border="0" cellpadding="2" cellspacing="2">'. $form .'</table>', "Enable the blocks you would like to see displayed in the side bars.");
}
return form_item(t("Block configuration"), $form, "Enable the blocks you would like to see displayed in the side bars.");
}
}
......
......@@ -168,12 +168,12 @@ function blog_page_user($uid = 0, $date = 0, $all = 0) {
}
$output .= "</table>";
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed", "id" => $account->uid), t("Read the XML version of this page."))."\n";
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed", "id" => $account->uid), "", array("title" => t("Read the XML version of this page."))) ."\n";
if (!$all) {
$output .= lm(t("show all blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid, "all" => 1), t("Show all blogs by this user"));
$output .= lm(t("show all blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid, "all" => 1), "", array("title" => t("Show all blogs by this user")));
}
else {
$output .= lm(t("show recent blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid), t("Show recent blogs by this user"));
$output .= lm(t("show recent blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid), "", array("title" => t("Show recent blogs by this user")));
}
$theme->box(t("%u's blog", array("%u" => $account->name)), $output);
......@@ -197,7 +197,7 @@ function blog_page_last() {
}
$output .= "</table>";
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed"), t("Read the XML version of this page."))."\n";
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed"), "", array("title" => t("Read the XML version of this page."))) ."\n";
$theme->box(t("User blogs"), $output, "main");
}
......@@ -289,24 +289,24 @@ function blog_link($type, $node = 0, $main) {
global $user;
if ($type == "page" && user_access("access content")) {
$links[] = lm(t("user blogs"), array("mod" => "blog"), t("Read the latest blog entries."));
$links[] = lm(t("user blogs"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries.")));
}
if ($type == "menu.create" && user_access("post content")) {
$links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), t("Add a new personal blog entry."));
$links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), "", array("title" => t("Add a new personal blog entry.")));
}
if ($type == "menu.view" && user_access("access content")) {
$links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), t("Read your latest blog entries."));
$links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), "", array("title" => t("Read your latest blog entries.")));
}
if ($type == "node" && $node->type == "blog") {
global $op;
if (blog_access("update", $node)) {
$links[] = lm(t("edit this blog"), array("mod" => "node", "op" => "edit", "id" => $node->nid), t("Edit this blog entry."));
$links[] = lm(t("edit this blog"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Edit this blog entry.")));
}
else {
$links[] = lm(t("%u's blog", array("%u" => $node->name)), array("mod" => "blog", "op" => "view", "id" => $node->uid), t("Read %u's latest blog entries.", array("%u" => $node->name)));
$links[] = lm(t("%u's blog", array("%u" => $node->name)), array("mod" => "blog", "op" => "view", "id" => $node->uid), "", array("title" => t("Read %u's latest blog entries.", array("%u" => $node->name))));
}
}
......@@ -319,7 +319,7 @@ function blog_block() {
$result = 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' ORDER BY n.nid DESC LIMIT 10");
while ($node = db_fetch_object($result)) {
$output .= l(check_output($node->title), array("id" => $node->nid))."<br />\n";
$output .= l(check_output($node->title), array("id" => $node->nid)) ."<br />\n";
}
$output .= "<br /><div align=\"right\">".lm(t("more"), array("mod" => "blog"), t("Read the latest blog entries."))."</div>";
......
......@@ -168,12 +168,12 @@ function blog_page_user($uid = 0, $date = 0, $all = 0) {
}
$output .= "</table>";
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed", "id" => $account->uid), t("Read the XML version of this page."))."\n";
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed", "id" => $account->uid), "", array("title" => t("Read the XML version of this page."))) ."\n";
if (!$all) {
$output .= lm(t("show all blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid, "all" => 1), t("Show all blogs by this user"));
$output .= lm(t("show all blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid, "all" => 1), "", array("title" => t("Show all blogs by this user")));
}
else {
$output .= lm(t("show recent blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid), t("Show recent blogs by this user"));
$output .= lm(t("show recent blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid), "", array("title" => t("Show recent blogs by this user")));
}
$theme->box(t("%u's blog", array("%u" => $account->name)), $output);
......@@ -197,7 +197,7 @@ function blog_page_last() {
}
$output .= "</table>";
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed"), t("Read the XML version of this page."))."\n";
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed"), "", array("title" => t("Read the XML version of this page."))) ."\n";
$theme->box(t("User blogs"), $output, "main");
}
......@@ -289,24 +289,24 @@ function blog_link($type, $node = 0, $main) {
global $user;
if ($type == "page" && user_access("access content")) {
$links[] = lm(t("user blogs"), array("mod" => "blog"), t("Read the latest blog entries."));
$links[] = lm(t("user blogs"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries.")));
}
if ($type == "menu.create" && user_access("post content")) {
$links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), t("Add a new personal blog entry."));
$links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), "", array("title" => t("Add a new personal blog entry.")));
}
if ($type == "menu.view" && user_access("access content")) {
$links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), t("Read your latest blog entries."));
$links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), "", array("title" => t("Read your latest blog entries.")));
}
if ($type == "node" && $node->type == "blog") {
global $op;
if (blog_access("update", $node)) {
$links[] = lm(t("edit this blog"), array("mod" => "node", "op" => "edit", "id" => $node->nid), t("Edit this blog entry."));
$links[] = lm(t("edit this blog"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Edit this blog entry.")));
}
else {
$links[] = lm(t("%u's blog", array("%u" => $node->name)), array("mod" => "blog", "op" => "view", "id" => $node->uid), t("Read %u's latest blog entries.", array("%u" => $node->name)));
$links[] = lm(t("%u's blog", array("%u" => $node->name)), array("mod" => "blog", "op" => "view", "id" => $node->uid), "", array("title" => t("Read %u's latest blog entries.", array("%u" => $node->name))));
}
}
......@@ -319,7 +319,7 @@ function blog_block() {
$result = 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' ORDER BY n.nid DESC LIMIT 10");
while ($node = db_fetch_object($result)) {
$output .= l(check_output($node->title), array("id" => $node->nid))."<br />\n";
$output .= l(check_output($node->title), array("id" => $node->nid)) ."<br />\n";
}
$output .= "<br /><div align=\"right\">".lm(t("more"), array("mod" => "blog"), t("Read the latest blog entries."))."</div>";
......
......@@ -92,11 +92,11 @@ 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"), t("Read and contribute to the collaborative books."));
$links[] = lm(t("collaborative book"), array("mod" => "book"), "", array("title" => t("Read and contribute to the collaborative books.")));
}
if ($type == "menu.create" && user_access("post content")) {
$links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), t("Add a new book page."));
$links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), "", array("title" => t("Add a new book page.")));
}
if ($type == "admin" && user_access("administer nodes")) {
......@@ -104,7 +104,7 @@ function book_link($type, $node = 0, $main = 0) {
}
if ($type == "node" && $node->type == "book" && book_access("update", $node)) {
$links[] = lm(t("edit this page"), array("mod" => "node", "op" => "edit", "id" => $node->nid), t("Suggest an update for this book page."));
$links[] = lm(t("edit this page"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Suggest an update for this book page.")));
}
return $links ? $links : array();
......@@ -406,8 +406,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), t("View the previous page in this book.")) : t("previous")) ."</td><td align=\"center\" width=\"34%\">". lm(t("index"), array("mod" => "book"), t("View this book's table of contents.")) ."</td><td align=\"right\" width=\"33%\">". ($next ? l(t("next"), array("id" => $next->nid), t("View the next page in this book.")) : t("next")) ."</td></tr>";
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<small>". check_output($prev->title) ."</small>" : "&nbsp;") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? l(t("up"), array("id" => $node->parent), t("View this page's parent section.")) : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>". check_output($next->title) ."</small>" : "&nbsp;") ."</td></tr>";
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? l(t("previous"), array("id" => $prev->nid), "", array("title" => t("View the previous page in this book."))) : t("previous")) ."</td><td align=\"center\" width=\"34%\">". lm(t("index"), array("mod" => "book"), t("View this book's table of contents.")) ."</td><td align=\"right\" width=\"33%\">". ($next ? l(t("next"), array("id" => $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>". check_output($prev->title) ."</small>" : "&nbsp;") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? l(t("up"), array("id" => $node->parent), "", array("title" => t("View this page's parent section."))) : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>". check_output($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>";
......@@ -675,7 +675,7 @@ function book_admin_links() {
$links[] = la(t("book") .": <i>". check_output($book->title) ."</i>", array("mod" => "book", "op" => "view", "id" => $book->nid));
}
$links[] = la(t("orphan pages"), array("mod" => "book", "op" => "orphan"));
$links[] = lm(t("export to HTML"), array("mod" => "book", "op" => "feed"), t("display all books in a single HTML page"));
$links[] = lm(t("export to HTML"), array("mod" => "book", "op" => "feed"), "", array("title" => t("display all books in a single HTML page")));
$links[] = la(t("help"), array("mod" => "book", "op" => "help"));
return $links;
}
......
......@@ -92,11 +92,11 @@ 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"), t("Read and contribute to the collaborative books."));
$links[] = lm(t("collaborative book"), array("mod" => "book"), "", array("title" => t("Read and contribute to the collaborative books.")));
}
if ($type == "menu.create" && user_access("post content")) {
$links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), t("Add a new book page."));
$links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), "", array("title" => t("Add a new book page.")));
}
if ($type == "admin" && user_access("administer nodes")) {
......@@ -104,7 +104,7 @@ function book_link($type, $node = 0, $main = 0) {
}
if ($type == "node" && $node->type == "book" && book_access("update", $node)) {
$links[] = lm(t("edit this page"), array("mod" => "node", "op" => "edit", "id" => $node->nid), t("Suggest an update for this book page."));
$links[] = lm(t("edit this page"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Suggest an update for this book page.")));
}
return $links ? $links : array();
......@@ -406,8 +406,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), t("View the previous page in this book.")) : t("previous")) ."</td><td align=\"center\" width=\"34%\">". lm(t("index"), array("mod" => "book"), t("View this book's table of contents.")) ."</td><td align=\"right\" width=\"33%\">". ($next ? l(t("next"), array("id" => $next->nid), t("View the next page in this book.")) : t("next")) ."</td></tr>";
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<small>". check_output($prev->title) ."</small>" : "&nbsp;") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? l(t("up"), array("id" => $node->parent), t("View this page's parent section.")) : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>". check_output($next->title) ."</small>" : "&nbsp;") ."</td></tr>";
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? l(t("previous"), array("id" => $prev->nid), "", array("title" => t("View the previous page in this book."))) : t("previous")) ."</td><td align=\"center\" width=\"34%\">". lm(t("index"), array("mod" => "book"), t("View this book's table of contents.")) ."</td><td align=\"right\" width=\"33%\">". ($next ? l(t("next"), array("id" => $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>". check_output($prev->title) ."</small>" : "&nbsp;") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? l(t("up"), array("id" => $node->parent), "", array("title" => t("View this page's parent section."))) : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>". check_output($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>";
......@@ -675,7 +675,7 @@ function book_admin_links() {
$links[] = la(t("book") .": <i>". check_output($book->title) ."</i>", array("mod" => "book", "op" => "view", "id" => $book->nid));
}
$links[] = la(t("orphan pages"), array("mod" => "book", "op" => "orphan"));
$links[] = lm(t("export to HTML"), array("mod" => "book", "op" => "feed"), t("display all books in a single HTML page"));
$links[] = lm(t("export to HTML"), array("mod" => "book", "op" => "feed"), "", array("title" => t("display all books in a single HTML page")));
$links[] = la(t("help"), array("mod" => "book", "op" => "help"));
return $links;
}
......
......@@ -31,7 +31,7 @@ function cloud_perm() {
function cloud_link($type) {
if ($type == "page" && user_access("access site cloud")) {
$links[] = lm(t("site cloud"), array("mod" => "cloud"), t("Monitor other sites in the cloud."));;
$links[] = lm(t("site cloud"), array("mod" => "cloud"), "", array("title" => t("Monitor other sites in the cloud.")));
}
if ($type == "admin" && user_access("administer site cloud")) {
......@@ -147,7 +147,7 @@ function cloud_list($limit = 10) {
$list = 0;
}
}
$output .= "<div style=\"padding-left: 10px;\">". format_url($site->link, $site->name) ."</div>";
$output .= "<div style=\"padding-left: 10px;\"><a href=\"$site->link\">$site->name</a></div>";
}
return $output;
}
......@@ -164,7 +164,7 @@ function cloud_page() {
function cloud_block() {
$block[0]["subject"] = t("Site cloud");
$block[0]["content"] = cloud_list(20) ."<br /><div align=\"right\">". lm(t("more"), array("mod" => "cloud"), t("Monitor other sites in the cloud.")) ."</div>";
$block[0]["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[0]["info"] = t("Site cloud");
return $block;
}
......
......@@ -381,7 +381,7 @@ function comment_links($comment, $return = 1) {
$links = array();
if ($return) {
$links[] = l("<span style=\"color: $theme->type;\">". t("return") ."</span>", array("id" => $comment->nid ."#". $comment->cid));
$links[] = l("<span style=\"color: $theme->type;\">". t("return") ."</span>", array("id" => $comment->nid), "node", $comment->cid);
}
if (user_access("administer comments")) {
......@@ -398,10 +398,10 @@ function comment_links($comment, $return = 1) {
//if (node_comment_mode($comment->nid)) {
if (user_access("post comments")) {
if (comment_access("edit", $comment)) {
$links[] = lm("<span style=\"color: $theme->type\">". t("edit your comment") ."</span>", array("mod" => "comment", "op" => "edit", "id" => $comment->cid), t("Make changes to your comment."));
$links[] = lm("<span style=\"color: $theme->type\">". t("edit your comment") ."</span>", array("mod" => "comment", "op" => "edit", "id" => $comment->cid), "", array("title" => t("Make changes to your comment.")));
}
else {
$links[] = lm("<span style=\"color: $theme->type;\">". t("reply to this comment") ."</span>", array("mod" => "comment", "op" => "reply", "id" => $comment->nid, "pid" => $comment->cid), t("Reply to this comment."));
$links[] = lm("<span style=\"color: $theme->type;\">". t("reply to this comment") ."</span>", array("mod" => "comment", "op" => "reply", "id" => $comment->nid, "pid" => $comment->cid), "", array("title" => t("Reply to this comment.")));
}
}
//}
......@@ -420,7 +420,7 @@ function comment_view($comment, $folded = 0) {
$theme->comment($comment, $folded);
}
else {
print l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid ."#". $comment->cid)) ." by ". format_name($comment) ."</small><p />";
print l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid), "node", $comment->cid) ." by ". format_name($comment) ."</small><p />";
}
}
......@@ -521,7 +521,7 @@ function comment_render($nid, $cid) {
print " <tr><th>Subject</th><th>Author</th><th>Date</th><th>Score</th></tr>\n";
while ($comment = db_fetch_object($result)) {
if (comment_visible($comment, $threshold)) {
print " <tr><td>". l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid ."#". $comment->cid)) ."</td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>$comment->score</td></tr>\n";
print " <tr><td>". l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid), "node", $comment->cid) ."</td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>$comment->score</td></tr>\n";
}
}
print "</table>\n";
......@@ -624,7 +624,7 @@ function comment_link($type, $node = 0, $main = 0) {
$all = comment_num_all($node->nid);
$new = comment_num_new($node->nid);
$links[] = l(format_plural($all, "comment", "comments") . ($new ? ", $new ". t("new") : ""), array("id" => $node->nid ."#comment"), t("View this posting and all of its comments."));
$links[] = l(format_plural($all, "comment", "comments") . ($new ? ", $new ". t("new") : ""), array("id" => $node->nid), "node", "comment", array("title" => t("View this posting and all of its comments.")));
}
}
else {
......@@ -635,7 +635,7 @@ function comment_link($type, $node = 0, $main = 0) {
if (user_access("post comments")) {
if ($node->comment == 2) {
$links[] = lm(t("add new comment"), array("mod" => "comment", "op" => "reply", "id" => $node->nid ."#comment"), t("Share your thoughts and opinions related to this posting."));
$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.")));
}
else {
$links[] = t("This discussion is closed: you can't post new comments.");
......@@ -662,7 +662,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 ."#". $comment->cid)) ."</td><td>". format_name($comment) ."</td><td>". l(t("view comment"), array("id" => $node->nid, "cid" => $comment->cid ."#". $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, 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 ."#". $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 .= "</table>";
......@@ -729,7 +729,7 @@ function comment_admin_overview() {
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
$output .= " <tr><th>subject</th><th>author</th><th>date</th><th colspan=\"2\">operations</th></tr>\n";
while ($comment = db_fetch_object($result)) {
$output .= " <tr><td>". l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid, "pid" => $comment->pid ."#". $comment->cid)) ."</td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</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>\n";
$output .= " <tr><td>". l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid, "pid" => $comment->pid), "node", $comment->cid) ."</td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</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>\n";
}
$output .= "</table>\n";