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) { ...@@ -35,7 +35,7 @@ function error_handler($errno, $message, $filename, $line, $variables) {
function watchdog($type, $message) { function watchdog($type, $message) {
global $user; 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) { function throttle($type, $rate) {
...@@ -100,11 +100,6 @@ function request_uri() { ...@@ -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() { function message_access() {
return t("You are not authorized to access to this page."); return t("You are not authorized to access to this page.");
} }
...@@ -407,10 +402,6 @@ function check_file($filename) { ...@@ -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()) { function format_rss_channel($title, $link, $description, $items, $language = "en", $args = array()) {
// arbitrary elements may be added using the $args associative array // arbitrary elements may be added using the $args associative array
...@@ -509,7 +500,7 @@ function page_get_cache() { ...@@ -509,7 +500,7 @@ function page_get_cache() {
function format_interval($timestamp) { function format_interval($timestamp) {
$units = array("year|years" => 31536000, "week|weeks" => 604800, "day|days" => 86400, "hour|hours" => 3600, "min|min" => 60, "sec|sec" => 1); $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); $key = explode("|", $key);
if ($timestamp >= $value) { if ($timestamp >= $value) {
$output .= ($output ? " " : "") . format_plural(floor($timestamp / $value), $key[0], $key[1]); $output .= ($output ? " " : "") . format_plural(floor($timestamp / $value), $key[0], $key[1]);
...@@ -543,7 +534,7 @@ function format_date($timestamp, $type = "medium", $format = "") { ...@@ -543,7 +534,7 @@ function format_date($timestamp, $type = "medium", $format = "") {
$date = date($c, $timestamp).$date; $date = date($c, $timestamp).$date;
} }
else { else {
$date = $c . $date; $date = $c.$date;
} }
} }
break; break;
...@@ -571,15 +562,6 @@ function format_name($object) { ...@@ -571,15 +562,6 @@ function format_name($object) {
return $output; 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) { function format_tag($link, $text) {
return l(($text ? $text : $link), array("title" => $link)); return l(($text ? $text : $link), array("title" => $link));
} }
...@@ -610,7 +592,7 @@ function form_textarea($title, $name, $value, $cols, $rows, $description = 0) { ...@@ -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) { function form_select($title, $name, $value, $options, $description = 0, $extra = 0, $multiple = 0) {
if (count($options) > 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>"; $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); return form_item($title, "<select name=\"edit[$name]". ($multiple ? "[]" : "") ."\"". ($multiple ? " multiple " : "") . ($extra ? " $extra" : "") .">$select</select>", $description);
...@@ -635,13 +617,14 @@ function form_submit($value) { ...@@ -635,13 +617,14 @@ function form_submit($value) {
* *
* @param $args dictionary of arguments to be passed to the script * @param $args dictionary of arguments to be passed to the script
* @param $script script to be invoked; optional, defaults to node * @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(); $t = array();
foreach ($args as $key => $value) { foreach ($args as $key => $value) {
$t[] = "$key=". urlencode($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") { ...@@ -650,34 +633,34 @@ function drupal_url($args = array(), $script = "node") {
* *
* @param $args dictionary of arguments to be passed to the script * @param $args dictionary of arguments to be passed to the script
* @param $text text of the link * @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 $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. * @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(); $t = array();
foreach ($attributes as $key => $value) { foreach ($attributes as $key => $value) {
$t[] = "$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 // we don't call l() to avoid another duplication of the array
$t = array(); $t = array();
foreach ($attributes as $key => $value) { foreach ($attributes as $key => $value) {
$t[] = "$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 // we don't call l() to avoid another duplication of the array
$t = array(); $t = array();
foreach ($attributes as $key => $value) { foreach ($attributes as $key => $value) {
$t[] = "$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) { function field_get($string, $name) {
...@@ -693,14 +676,6 @@ function field_set($string, $name, $value) { ...@@ -693,14 +676,6 @@ function field_set($string, $name, $value) {
return substr($rval, 1); 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() { function link_page() {
global $custom_links; global $custom_links;
......
This diff is collapsed.
This diff is collapsed.
...@@ -109,7 +109,7 @@ function archive_block() { ...@@ -109,7 +109,7 @@ function archive_block() {
function archive_link($type) { function archive_link($type) {
if ($type == "page" && user_access("access content")) { 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(); return $links ? $links : array();
......
...@@ -109,7 +109,7 @@ function archive_block() { ...@@ -109,7 +109,7 @@ function archive_block() {
function archive_link($type) { function archive_link($type) {
if ($type == "page" && user_access("access content")) { 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(); return $links ? $links : array();
......
...@@ -77,9 +77,9 @@ function block_admin_display() { ...@@ -77,9 +77,9 @@ function block_admin_display() {
$weights = array(0 => 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); $weights = array(0 => 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
$output .= '<tr>'; $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>$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][status", 1, $block->status) .'</td>';
$output .= '<td align="center">'. form_checkbox(NULL, "$block->name][custom", 1, $block->custom) .'</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>'; $output .= '<td>'. form_select(NULL, "$block->name][weight", $block->weight, $weights) .'</td>';
...@@ -259,13 +259,17 @@ function block_user($type, &$edit, &$user) { ...@@ -259,13 +259,17 @@ function block_user($type, &$edit, &$user) {
case "edit_form": case "edit_form":
$result = db_query("SELECT * FROM blocks WHERE custom = '%d' ORDER BY name", 1); $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)) { while ($block = db_fetch_object($result)) {
$form .= "<tr><td>$block->name</td><td>". form_checkbox(NULL, "block][$block->name", 1, $user->block[$block->name]) ."</td></tr>\n"; $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";
}
}
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.");
} }
$form .= '</table>';
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() { ...@@ -77,9 +77,9 @@ function block_admin_display() {
$weights = array(0 => 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); $weights = array(0 => 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
$output .= '<tr>'; $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>$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][status", 1, $block->status) .'</td>';
$output .= '<td align="center">'. form_checkbox(NULL, "$block->name][custom", 1, $block->custom) .'</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>'; $output .= '<td>'. form_select(NULL, "$block->name][weight", $block->weight, $weights) .'</td>';
...@@ -259,13 +259,17 @@ function block_user($type, &$edit, &$user) { ...@@ -259,13 +259,17 @@ function block_user($type, &$edit, &$user) {
case "edit_form": case "edit_form":
$result = db_query("SELECT * FROM blocks WHERE custom = '%d' ORDER BY name", 1); $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)) { while ($block = db_fetch_object($result)) {
$form .= "<tr><td>$block->name</td><td>". form_checkbox(NULL, "block][$block->name", 1, $user->block[$block->name]) ."</td></tr>\n"; $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";
}
}
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.");
} }
$form .= '</table>';
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) { ...@@ -168,12 +168,12 @@ function blog_page_user($uid = 0, $date = 0, $all = 0) {
} }
$output .= "</table>"; $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) { 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 { 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); $theme->box(t("%u's blog", array("%u" => $account->name)), $output);
...@@ -197,7 +197,7 @@ function blog_page_last() { ...@@ -197,7 +197,7 @@ function blog_page_last() {
} }
$output .= "</table>"; $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"); $theme->box(t("User blogs"), $output, "main");
} }
...@@ -289,24 +289,24 @@ function blog_link($type, $node = 0, $main) { ...@@ -289,24 +289,24 @@ function blog_link($type, $node = 0, $main) {
global $user; global $user;
if ($type == "page" && user_access("access content")) { 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")) { 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")) { 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") { if ($type == "node" && $node->type == "blog") {
global $op; global $op;
if (blog_access("update", $node)) { 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 { 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() { ...@@ -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"); $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)) { 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>"; $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) { ...@@ -168,12 +168,12 @@ function blog_page_user($uid = 0, $date = 0, $all = 0) {
} }
$output .= "</table>"; $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) { 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 { 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); $theme->box(t("%u's blog", array("%u" => $account->name)), $output);
...@@ -197,7 +197,7 @@ function blog_page_last() { ...@@ -197,7 +197,7 @@ function blog_page_last() {
} }
$output .= "</table>"; $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"); $theme->box(t("User blogs"), $output, "main");
} }
...@@ -289,24 +289,24 @@ function blog_link($type, $node = 0, $main) { ...@@ -289,24 +289,24 @@ function blog_link($type, $node = 0, $main) {
global $user; global $user;
if ($type == "page" && user_access("access content")) { 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")) { 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")) { 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") { if ($type == "node" && $node->type == "blog") {
global $op; global $op;
if (blog_access("update", $node)) { 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 { 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() { ...@@ -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"); $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)) { 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>"; $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) { ...@@ -92,11 +92,11 @@ function book_save($op, $node) {
function book_link($type, $node = 0, $main = 0) { function book_link($type, $node = 0, $main = 0) {
if ($type == "page" && user_access("access content")) { 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")) { 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")) { if ($type == "admin" && user_access("administer nodes")) {
...@@ -104,7 +104,7 @@ function book_link($type, $node = 0, $main = 0) { ...@@ -104,7 +104,7 @@ function book_link($type, $node = 0, $main = 0) {
} }
if ($type == "node" && $node->type == "book" && book_access("update", $node)) { 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(); return $links ? $links : array();
...@@ -406,8 +406,8 @@ function book_view($node, $main = 0) { ...@@ -406,8 +406,8 @@ function book_view($node, $main = 0) {
} }
$output .= " <tr><td colspan=\"3\"><hr /></td></tr>"; $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 ? 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), 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 ? "<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\"><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>";