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;
......
......@@ -29,7 +29,7 @@ function import_link($type) {
}
if ($type == "page" && user_access("access news feeds")) {
$links[] = lm(t("news feeds"), array("mod" => "import"), t("Read the latest news from syndicated websites."));
$links[] = lm(t("news feeds"), array("mod" => "import"), "", array("title" => t("Read the latest news from syndicated websites.")));
}
return $links ? $links : array();
......@@ -53,7 +53,7 @@ function import_format_item($item, $feed = 0) {
global $theme, $user;
if ($user->uid && user_access("post blogs")) {
$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), t("Comment on this news item in your 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.")));
}
// external link
......@@ -98,7 +98,7 @@ function import_get_bundles($attributes = 0) {
$i = 0;
while ($bundle = db_fetch_object($result)) {
$block[$i]["subject"] = $bundle->title;
$block[$i]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), t("View this bundle's recent news.")) ."</div></p>";
$block[$i]["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[$i]["info"] = "$bundle->title bundle";
$i++;
......@@ -113,7 +113,7 @@ function import_get_feeds($attributes = 0) {
$i = 0;
while ($feed = db_fetch_object($result)) {
$block[$i]["subject"] = $feed->title;
$block[$i]["content"] = import_feed_block($feed) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "feed", "id" => $feed->fid), t("View this feed's recent news.")) ."</div></p>";
$block[$i]["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[$i]["info"] = "$feed->title feed";
$i++;
......@@ -522,10 +522,10 @@ function import_admin() {
function import_page_info() {
global $theme;
$links[] = lm(t("latest news"), array("mod" => "import"), t("Read the latest news from syndicated websites."));
$links[] = lm(t("news by source"), array("mod" => "import", "op" => "feeds"), t("View the latest headlines sorted by source."));
$links[] = lm(t("news by topic"), array("mod" => "import", "op" => "bundles"), t("View the latest headlines sorted by topic."));
$links[] = lm(t("news sources"), array("mod" => "import", "op" => "sources"), t("View a list of all the websites we syndicate from."));
$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.")));
return "<div align=\"center\">". $theme->links($links) ."</div>";
}
......@@ -537,11 +537,11 @@ function import_page_last() {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), t("Read more syndicated news from this feed."));
$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[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
if ($item->link) {
$output .= "<tr><td>". format_url($item->link, $item->title) ." &middot; ". lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), 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; ". 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";
}
if ($item->description) {
......@@ -563,7 +563,7 @@ function import_page_feed($fid) {
$feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%s'", $fid));
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". format_url($feed->link) ."</div></p>";
$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;\">". check_output($feed->description, 1) ."</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";
......@@ -571,11 +571,11 @@ function import_page_feed($fid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your 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[] = "<a href=\"$item->link\">". t("visit") ."</a>";
if ($item->link) {
$output .= "<tr><td>". format_url($item->link, $item->title) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
$output .= "<tr><td><a href=\"$item->link\">$item->title</a></td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
}
if ($item->description) {
$output .= "<tr><td colspan=\"2\"><div style=\"margin-left: 20px;\">". check_output($item->description, 1) ."</div><br /></td></tr>";
......@@ -596,7 +596,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;\">". format_url(drupal_url(array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), "module")) ."</div></p>";
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". lm("", array("mod" => "import", "op" => "bundle", "id" => $bundle->bid)) ."</div></p>";
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". t("A composite news feed about") ." ". check_output($bundle->attributes) .".</div></p>";
$keys = explode(",", $bundle->attributes);
......@@ -605,12 +605,12 @@ function import_page_bundle($bid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), t("Read more syndicated news from this feed."));
$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[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $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>". format_url($item->link, $item->title) ." &middot; ". lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), 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; ". 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";
}
if ($item->description) {
......@@ -634,11 +634,11 @@ function import_page_sources() {
$result = db_query("SELECT * FROM feed ORDER BY title");
while ($feed = db_fetch_object($result)) {
$output .= format_url(drupal_url(array("mod" => "import", "op" => "feed", "id" => $feed->fid), "module"), $feed->title);
$output .= lm("", array("mod" => "import", "op" => "feed", "id" => $feed->fid)));
$output .= "<div style=\"margin-left: 20px;\">". check_output($feed->description, 1) ."</div><br />";
}
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "import", "op" => "fd"), t("View the list of syndicated websites in XML format.")) ."<br />\n";
$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";
$theme->header();
$theme->box(t("News feeds"), import_page_info());
......
......@@ -29,7 +29,7 @@ function import_link($type) {
}
if ($type == "page" && user_access("access news feeds")) {
$links[] = lm(t("news feeds"), array("mod" => "import"), t("Read the latest news from syndicated websites."));
$links[] = lm(t("news feeds"), array("mod" => "import"), "", array("title" => t("Read the latest news from syndicated websites.")));
}
return $links ? $links : array();
......@@ -53,7 +53,7 @@ function import_format_item($item, $feed = 0) {
global $theme, $user;
if ($user->uid && user_access("post blogs")) {
$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), t("Comment on this news item in your 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.")));
}
// external link
......@@ -98,7 +98,7 @@ function import_get_bundles($attributes = 0) {
$i = 0;
while ($bundle = db_fetch_object($result)) {
$block[$i]["subject"] = $bundle->title;
$block[$i]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), t("View this bundle's recent news.")) ."</div></p>";
$block[$i]["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[$i]["info"] = "$bundle->title bundle";
$i++;
......@@ -113,7 +113,7 @@ function import_get_feeds($attributes = 0) {
$i = 0;
while ($feed = db_fetch_object($result)) {
$block[$i]["subject"] = $feed->title;
$block[$i]["content"] = import_feed_block($feed) ."<p><div align=\"right\">". lm(t("more"), array("mod" => "import", "op" => "feed", "id" => $feed->fid), t("View this feed's recent news.")) ."</div></p>";
$block[$i]["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[$i]["info"] = "$feed->title feed";
$i++;
......@@ -522,10 +522,10 @@ function import_admin() {
function import_page_info() {
global $theme;
$links[] = lm(t("latest news"), array("mod" => "import"), t("Read the latest news from syndicated websites."));
$links[] = lm(t("news by source"), array("mod" => "import", "op" => "feeds"), t("View the latest headlines sorted by source."));
$links[] = lm(t("news by topic"), array("mod" => "import", "op" => "bundles"), t("View the latest headlines sorted by topic."));
$links[] = lm(t("news sources"), array("mod" => "import", "op" => "sources"), t("View a list of all the websites we syndicate from."));
$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.")));
return "<div align=\"center\">". $theme->links($links) ."</div>";
}
......@@ -537,11 +537,11 @@ function import_page_last() {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), t("Read more syndicated news from this feed."));
$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[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
if ($item->link) {
$output .= "<tr><td>". format_url($item->link, $item->title) ." &middot; ". lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), 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; ". 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";
}
if ($item->description) {
......@@ -563,7 +563,7 @@ function import_page_feed($fid) {
$feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%s'", $fid));
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". format_url($feed->link) ."</div></p>";
$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;\">". check_output($feed->description, 1) ."</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";
......@@ -571,11 +571,11 @@ function import_page_feed($fid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your 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[] = "<a href=\"$item->link\">". t("visit") ."</a>";
if ($item->link) {
$output .= "<tr><td>". format_url($item->link, $item->title) ."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
$output .= "<tr><td><a href=\"$item->link\">$item->title</a></td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
}
if ($item->description) {
$output .= "<tr><td colspan=\"2\"><div style=\"margin-left: 20px;\">". check_output($item->description, 1) ."</div><br /></td></tr>";
......@@ -596,7 +596,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;\">". format_url(drupal_url(array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), "module")) ."</div></p>";
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". lm("", array("mod" => "import", "op" => "bundle", "id" => $bundle->bid)) ."</div></p>";
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". t("A composite news feed about") ." ". check_output($bundle->attributes) .".</div></p>";
$keys = explode(",", $bundle->attributes);
......@@ -605,12 +605,12 @@ function import_page_bundle($bid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), t("Read more syndicated news from this feed."));
$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[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $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>". format_url($item->link, $item->title) ." &middot; ". lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), 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; ". 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";
}
if ($item->description) {
......@@ -634,11 +634,11 @@ function import_page_sources() {
$result = db_query("SELECT * FROM feed ORDER BY title");
while ($feed = db_fetch_object($result)) {
$output .= format_url(drupal_url(array("mod" => "import", "op" => "feed", "id" => $feed->fid), "module"), $feed->title);
$output .= lm("", array("mod" => "import", "op" => "feed", "id" => $feed->fid)));
$output .= "<div style=\"margin-left: 20px;\">". check_output($feed->description, 1) ."</div><br />";
}
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "import", "op" => "fd"), t("View the list of syndicated websites in XML format.")) ."<br />\n";
$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";
$theme->header();
$theme->box(t("News feeds"), import_page_info());
......
......@@ -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)) {
$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() {
$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)) {
$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) {
}
$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() {