Commit cc381c14 authored by Dries's avatar Dries

- Fixed glitch in block module: the admin links were not composed
  correctly.  Patch by Stefan.

- Added missing t() functions and improved the %x directives for
  better readability and to ease the process of translating your
  site.  Patches by Stefan.

- Made two small additions to the 'code-clean.sh' script; it will
  now remove patch related junk.

NOTES:

- I removed the · related bits.  Let's tackle these later on
  in a separate patch after we got some sort of consensus.

- I removed the 'module_exist("drupal")' check in the user module;
  I *think* it is incomplete and therefore incorrect.

- Stefan, try using quotes in your translations and check whether
  everything still works.  Example: translate the "Create account"
  button to "Create \"haha\" account \'hihi\'" and see if you can
  still create new accounts.  Maybe automate this using a quick
  hack in the locale module ...
parent 74c72250
......@@ -81,7 +81,7 @@ function block_admin_save($edit) {
/**
* update blocks db table with blocks currently exported by modules
*
*
* @param array $order_by php array_multisort() style sort ordering, eg. "weight", SORT_ASC, SORT_STRING. see {@link http://www.php.net/manual/en/function.array-multisort.php}
* @return array blocks currently exported by modules, sorted by $order_by
* @access private
......@@ -116,7 +116,7 @@ function _block_rehash($order_by = array("weight")) {
db_query("INSERT INTO blocks (module, delta, status, weight, region, path, custom) VALUES ('%s', '%d', '%d', '%d', '%d', '%s', '%d')", $block["module"], $block["delta"], $block["status"], $block["weight"], $block["region"], $block["path"], $block["custom"]);
$blocks[] = $block;
// build array to sort on
$order[$order_by[0]][] = $block[$order_by[0]];
}
......@@ -139,7 +139,7 @@ function block_admin_display() {
foreach ($blocks as $block) {
$output .= "<tr>";
$output .= "<td>".$block["info"]."</td>";
$output .= "<td>". (module_hook($block["module"], "admin") ? la($block["module"], array("mod" => $module), "", array("title" => t("Administer module"))) : $block["module"]) ."</td>";
$output .= "<td align=\"center\">". (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["module"]."][".$block["delta"]."][status", 1, $block["status"]) ."</td>";
$output .= "<td align=\"center\">". form_checkbox(NULL, $block["module"]."][".$block["delta"]."][custom", 1, $block["custom"]) ."</td>";
$output .= "<td>". form_weight(NULL, $block["module"]."][".$block["delta"]."][weight", $block["weight"]) ."</td>";
......
......@@ -81,7 +81,7 @@ function block_admin_save($edit) {
/**
* update blocks db table with blocks currently exported by modules
*
*
* @param array $order_by php array_multisort() style sort ordering, eg. "weight", SORT_ASC, SORT_STRING. see {@link http://www.php.net/manual/en/function.array-multisort.php}
* @return array blocks currently exported by modules, sorted by $order_by
* @access private
......@@ -116,7 +116,7 @@ function _block_rehash($order_by = array("weight")) {
db_query("INSERT INTO blocks (module, delta, status, weight, region, path, custom) VALUES ('%s', '%d', '%d', '%d', '%d', '%s', '%d')", $block["module"], $block["delta"], $block["status"], $block["weight"], $block["region"], $block["path"], $block["custom"]);
$blocks[] = $block;
// build array to sort on
$order[$order_by[0]][] = $block[$order_by[0]];
}
......@@ -139,7 +139,7 @@ function block_admin_display() {
foreach ($blocks as $block) {
$output .= "<tr>";
$output .= "<td>".$block["info"]."</td>";
$output .= "<td>". (module_hook($block["module"], "admin") ? la($block["module"], array("mod" => $module), "", array("title" => t("Administer module"))) : $block["module"]) ."</td>";
$output .= "<td align=\"center\">". (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["module"]."][".$block["delta"]."][status", 1, $block["status"]) ."</td>";
$output .= "<td align=\"center\">". form_checkbox(NULL, $block["module"]."][".$block["delta"]."][custom", 1, $block["custom"]) ."</td>";
$output .= "<td>". form_weight(NULL, $block["module"]."][".$block["delta"]."][weight", $block["weight"]) ."</td>";
......
......@@ -8,8 +8,9 @@ function blog_system($field){
function blog_conf_options() {
$output = form_textarea("Explanation or submission guidelines", "blog_help", variable_get("blog_help", ""), 55, 4, "This text is displayed at the top of the blog submission form. It's useful for helping or instructing your users.");
$output .= form_select(t("Minimum number of words in a blog entry"), "minimum_blog_size", variable_get("minimum_blog_size", 0), array(0 => "0 words", 10 => "10 words", 25 => "25 words", 50 => "50 words", 75 => "75 words", 100 => "100 words", 125 => "125 words", 150 => "150 words", 175 => "175 words", 200 => "200 words"), t("The minimum number of words a personal blog entry should contain. This is useful to rule out submissions that do not meet the site's standards, such as short test posts."));
$output = form_textarea(t("Explanation or submission guidelines"), "blog_help", variable_get("blog_help", ""), 55, 4, t("This text is displayed at the top of the blog submission form. It's useful for helping or instructing your users."));
$words = t("words");
$output .= form_select(t("Minimum number of words in a blog entry"), "minimum_blog_size", variable_get("minimum_blog_size", 0), array(0 => "0 $words", 10 => "10 $words", 25 => "25 $words", 50 => "50 $words", 75 => "75 $words", 100 => "100 $words", 125 => "125 $words", 150 => "150 $words", 175 => "175 $words", 200 => "200 $words"), t("The minimum number of words a personal blog entry should contain. This is useful to rule out submissions that do not meet the site's standards, such as short test posts."));
return $output;
}
......@@ -193,7 +194,7 @@ function blog_page_user($uid = 0, $date = 0, $all = 0) {
$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("%username's blog", array("%username" => $account->name)), $output);
}
function blog_page_last() {
......@@ -325,7 +326,7 @@ function blog_link($type, $node = 0, $main) {
$links[] = lm(t("edit this blog"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Edit this blog entry.")));
}
elseif ($op != "view" && !$id) {
$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))));
$links[] = lm(t("%username's blog", array("%username" => $node->name)), array("mod" => "blog", "op" => "view", "id" => $node->uid), "", array("title" => t("Read %username's latest blog entries.", array("%username" => $node->name))));
}
}
......
......@@ -8,8 +8,9 @@ function blog_system($field){
function blog_conf_options() {
$output = form_textarea("Explanation or submission guidelines", "blog_help", variable_get("blog_help", ""), 55, 4, "This text is displayed at the top of the blog submission form. It's useful for helping or instructing your users.");
$output .= form_select(t("Minimum number of words in a blog entry"), "minimum_blog_size", variable_get("minimum_blog_size", 0), array(0 => "0 words", 10 => "10 words", 25 => "25 words", 50 => "50 words", 75 => "75 words", 100 => "100 words", 125 => "125 words", 150 => "150 words", 175 => "175 words", 200 => "200 words"), t("The minimum number of words a personal blog entry should contain. This is useful to rule out submissions that do not meet the site's standards, such as short test posts."));
$output = form_textarea(t("Explanation or submission guidelines"), "blog_help", variable_get("blog_help", ""), 55, 4, t("This text is displayed at the top of the blog submission form. It's useful for helping or instructing your users."));
$words = t("words");
$output .= form_select(t("Minimum number of words in a blog entry"), "minimum_blog_size", variable_get("minimum_blog_size", 0), array(0 => "0 $words", 10 => "10 $words", 25 => "25 $words", 50 => "50 $words", 75 => "75 $words", 100 => "100 $words", 125 => "125 $words", 150 => "150 $words", 175 => "175 $words", 200 => "200 $words"), t("The minimum number of words a personal blog entry should contain. This is useful to rule out submissions that do not meet the site's standards, such as short test posts."));
return $output;
}
......@@ -193,7 +194,7 @@ function blog_page_user($uid = 0, $date = 0, $all = 0) {
$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("%username's blog", array("%username" => $account->name)), $output);
}
function blog_page_last() {
......@@ -325,7 +326,7 @@ function blog_link($type, $node = 0, $main) {
$links[] = lm(t("edit this blog"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Edit this blog entry.")));
}
elseif ($op != "view" && !$id) {
$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))));
$links[] = lm(t("%username's blog", array("%username" => $node->name)), array("mod" => "blog", "op" => "view", "id" => $node->uid), "", array("title" => t("Read %username's latest blog entries.", array("%username" => $node->name))));
}
}
......
......@@ -23,20 +23,20 @@ function comment_system($field) {
function comment_conf_options() {
global $cmodes, $corder;
$output .= form_select("Default display mode", "comment_default_mode", variable_get("comment_default_mode", 4), $cmodes, "The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.");
$output .= form_select("Default display order", "comment_default_order", variable_get("comment_default_order", 1), $corder, "The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.");
$output .= form_textfield("Default comments per page", "comment_default_per_page", variable_get("comment_default_per_page", "50"), 5, 5, "Default number of comments for each page; more comments are distributed in several pages.");
$output .= form_select(t("Default display mode"), "comment_default_mode", variable_get("comment_default_mode", 4), $cmodes, t("The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together."));
$output .= form_select(t("Default display order"), "comment_default_order", variable_get("comment_default_order", 1), $corder, t("The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference."));
$output .= form_textfield(t("Default comments per page"), "comment_default_per_page", variable_get("comment_default_per_page", "50"), 5, 5, t("Default number of comments for each page; more comments are distributed in several pages."));
$result = db_query("SELECT fid, filter FROM moderation_filters");
while ($filter = db_fetch_object($result)) {
$thresholds[$filter->fid] = ($filter->filter);
}
$output .= form_select("Default threshold", "comment_default_threshold", variable_get("comment_default_threshold", 0), $thresholds, "Thresholds are values below which comments are hidden. These threshholds are useful for busy sites which wan tto hide poor comments from most users.");
$output .= form_select(t("Default threshold"), "comment_default_threshold", variable_get("comment_default_threshold", 0), $thresholds, t("Thresholds are values below which comments are hidden. These threshholds are useful for busy sites which wan tto hide poor comments from most users."));
$output .= form_select("Preview comment", "comment_preview", variable_get("comment_preview", 1), array("optional", "required"), "Must users preview comments before submitting?");
$output .= form_select("New comment form", "comment_new_form", variable_get("comment_new_form", 0), array("disabled", "enabled"), "New comment form in the node page?");
$output .= form_select("Comment controls", "comment_controls", variable_get("comment_controls", 0), array("above comments", "below comments", "above and below"), "Position of the comment controls box.");
$output .= form_select(t("Preview comment"), "comment_preview", variable_get("comment_preview", 1), array(t("Optional"), t("Required")), t("Must users preview comments before submitting?"));
$output .= form_select(t("New comment form"), "comment_new_form", variable_get("comment_new_form", 0), array(t("Disabled"), t("Enabled")), t("New comment form in the node page?"));
$output .= form_select(t("Comment controls"), "comment_controls", variable_get("comment_controls", 0), array(t("Above comments"), t("Below comments"), t("Above and below")), t("Position of the comment controls box."));
return $output;
}
......@@ -795,11 +795,11 @@ function comment_admin_overview($status = 0, $comment_page = 0) {
$start = $comment_page * $comments_per_page;
$output .= $status ? "<h3>Non-published comments</h3>\n" : "<h3>Published comments</h3>";
$output .= $status ? "<h3>" . t("Non-published comments") . "</h3>\n" : "<h3>" . t("Published comments") . "</h3>";
$result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON u.uid = c.uid WHERE c.status = '%d' ORDER BY timestamp DESC LIMIT $start, $comments_per_page", $status);
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
$output .= " <tr><th>subject</th><th>author</th><th>date</th><th>published</th><th colspan=\"2\">operations</th></tr>\n";
$output .= " <tr><th>" . t("subject") . "</th><th>" . t("author") . "</th><th>" . t("date") . "</th><th>" . t("published") . "</th><th colspan=\"2\">" . t("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), "node", $comment->cid, array("title" => htmlentities($comment->comment))) ."</td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>". ($comment->status == 0 ? "yes" : "no") ."</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";
}
......@@ -851,7 +851,7 @@ function comment_mod_matrix($edit) {
}
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
$output .= " <tr><th>votes</th><th>". implode("</th><th>", array_values($role_names)) ."</th></tr>";
$output .= " <tr><th>" . t("votes") . "</th><th>". implode("</th><th>", array_values($role_names)) ."</th></tr>";
$result = db_query("SELECT mid, vote FROM moderation_votes ORDER BY weight");
while ($vote = db_fetch_object($result)) {
......@@ -881,7 +881,7 @@ function comment_mod_roles($edit) {
$result = db_query("SELECT r.rid, r.name FROM role r, permission p WHERE r.rid = p.rid AND p.perm LIKE '%post comments%'");
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
$output .= " <tr><th>user role</th><th>initial score</th></tr>";
$output .= " <tr><th>" . t("user role") . "</th><th>" . t("initial score") . "</th></tr>";
while ($role = db_fetch_object($result)) {
$output .= "<tr><td>$role->name</td>";
......@@ -911,9 +911,9 @@ function comment_mod_votes($edit) {
$mid = 0;
}
$output .= "<h3>Moderation votes overview</h3>";
$output .= "<h3>" . t("Moderation votes overview") . "</h3>";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
$output .= " <tr><th>votes</th><th>weight</th><th>operations</th></tr>";
$output .= " <tr><th>" . t("votes") . "</th><th>" . t("weight") . "</th><th>" . t("operations") . "</th></tr>";
$result = db_query("SELECT mid, vote, weight FROM moderation_votes ORDER BY weight");
while ($vote = db_fetch_object($result)) {
......@@ -960,7 +960,7 @@ function comment_mod_filters($edit) {
$output .= "<h3>Comment threshhold overview</h3>";
$output .= "<p><i>Optional</i>. If your site gets lots of comments, you may offer your users threshholds, which are used to hide all comments whose moderation score is lower than the threshhold. This cuts down on clutter while your readers view the site. These threshholds appear in the Comment Control Panel.</p>";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
$output .= " <tr><th>name</th><th>minimum score</th><th>operations</th></tr>";
$output .= " <tr><th>" . t("name") . "</th><th>" . t("minimum score") . "</th><th>" . t("operations") . "</th></tr>";
$result = db_query("SELECT fid, filter, minimum FROM moderation_filters ORDER BY minimum");
while ($filter = db_fetch_object($result)) {
......
......@@ -23,20 +23,20 @@ function comment_system($field) {
function comment_conf_options() {
global $cmodes, $corder;
$output .= form_select("Default display mode", "comment_default_mode", variable_get("comment_default_mode", 4), $cmodes, "The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.");
$output .= form_select("Default display order", "comment_default_order", variable_get("comment_default_order", 1), $corder, "The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.");
$output .= form_textfield("Default comments per page", "comment_default_per_page", variable_get("comment_default_per_page", "50"), 5, 5, "Default number of comments for each page; more comments are distributed in several pages.");
$output .= form_select(t("Default display mode"), "comment_default_mode", variable_get("comment_default_mode", 4), $cmodes, t("The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together."));
$output .= form_select(t("Default display order"), "comment_default_order", variable_get("comment_default_order", 1), $corder, t("The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference."));
$output .= form_textfield(t("Default comments per page"), "comment_default_per_page", variable_get("comment_default_per_page", "50"), 5, 5, t("Default number of comments for each page; more comments are distributed in several pages."));
$result = db_query("SELECT fid, filter FROM moderation_filters");
while ($filter = db_fetch_object($result)) {
$thresholds[$filter->fid] = ($filter->filter);
}
$output .= form_select("Default threshold", "comment_default_threshold", variable_get("comment_default_threshold", 0), $thresholds, "Thresholds are values below which comments are hidden. These threshholds are useful for busy sites which wan tto hide poor comments from most users.");
$output .= form_select(t("Default threshold"), "comment_default_threshold", variable_get("comment_default_threshold", 0), $thresholds, t("Thresholds are values below which comments are hidden. These threshholds are useful for busy sites which wan tto hide poor comments from most users."));
$output .= form_select("Preview comment", "comment_preview", variable_get("comment_preview", 1), array("optional", "required"), "Must users preview comments before submitting?");
$output .= form_select("New comment form", "comment_new_form", variable_get("comment_new_form", 0), array("disabled", "enabled"), "New comment form in the node page?");
$output .= form_select("Comment controls", "comment_controls", variable_get("comment_controls", 0), array("above comments", "below comments", "above and below"), "Position of the comment controls box.");
$output .= form_select(t("Preview comment"), "comment_preview", variable_get("comment_preview", 1), array(t("Optional"), t("Required")), t("Must users preview comments before submitting?"));
$output .= form_select(t("New comment form"), "comment_new_form", variable_get("comment_new_form", 0), array(t("Disabled"), t("Enabled")), t("New comment form in the node page?"));
$output .= form_select(t("Comment controls"), "comment_controls", variable_get("comment_controls", 0), array(t("Above comments"), t("Below comments"), t("Above and below")), t("Position of the comment controls box."));
return $output;
}
......@@ -795,11 +795,11 @@ function comment_admin_overview($status = 0, $comment_page = 0) {
$start = $comment_page * $comments_per_page;
$output .= $status ? "<h3>Non-published comments</h3>\n" : "<h3>Published comments</h3>";
$output .= $status ? "<h3>" . t("Non-published comments") . "</h3>\n" : "<h3>" . t("Published comments") . "</h3>";
$result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON u.uid = c.uid WHERE c.status = '%d' ORDER BY timestamp DESC LIMIT $start, $comments_per_page", $status);
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
$output .= " <tr><th>subject</th><th>author</th><th>date</th><th>published</th><th colspan=\"2\">operations</th></tr>\n";
$output .= " <tr><th>" . t("subject") . "</th><th>" . t("author") . "</th><th>" . t("date") . "</th><th>" . t("published") . "</th><th colspan=\"2\">" . t("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), "node", $comment->cid, array("title" => htmlentities($comment->comment))) ."</td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>". ($comment->status == 0 ? "yes" : "no") ."</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";
}
......@@ -851,7 +851,7 @@ function comment_mod_matrix($edit) {
}
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
$output .= " <tr><th>votes</th><th>". implode("</th><th>", array_values($role_names)) ."</th></tr>";
$output .= " <tr><th>" . t("votes") . "</th><th>". implode("</th><th>", array_values($role_names)) ."</th></tr>";
$result = db_query("SELECT mid, vote FROM moderation_votes ORDER BY weight");
while ($vote = db_fetch_object($result)) {
......@@ -881,7 +881,7 @@ function comment_mod_roles($edit) {
$result = db_query("SELECT r.rid, r.name FROM role r, permission p WHERE r.rid = p.rid AND p.perm LIKE '%post comments%'");
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
$output .= " <tr><th>user role</th><th>initial score</th></tr>";
$output .= " <tr><th>" . t("user role") . "</th><th>" . t("initial score") . "</th></tr>";
while ($role = db_fetch_object($result)) {
$output .= "<tr><td>$role->name</td>";
......@@ -911,9 +911,9 @@ function comment_mod_votes($edit) {
$mid = 0;
}
$output .= "<h3>Moderation votes overview</h3>";
$output .= "<h3>" . t("Moderation votes overview") . "</h3>";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
$output .= " <tr><th>votes</th><th>weight</th><th>operations</th></tr>";
$output .= " <tr><th>" . t("votes") . "</th><th>" . t("weight") . "</th><th>" . t("operations") . "</th></tr>";
$result = db_query("SELECT mid, vote, weight FROM moderation_votes ORDER BY weight");
while ($vote = db_fetch_object($result)) {
......@@ -960,7 +960,7 @@ function comment_mod_filters($edit) {
$output .= "<h3>Comment threshhold overview</h3>";
$output .= "<p><i>Optional</i>. If your site gets lots of comments, you may offer your users threshholds, which are used to hide all comments whose moderation score is lower than the threshhold. This cuts down on clutter while your readers view the site. These threshholds appear in the Comment Control Panel.</p>";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
$output .= " <tr><th>name</th><th>minimum score</th><th>operations</th></tr>";
$output .= " <tr><th>" . t("name") . "</th><th>" . t("minimum score") . "</th><th>" . t("operations") . "</th></tr>";
$result = db_query("SELECT fid, filter, minimum FROM moderation_filters ORDER BY minimum");
while ($filter = db_fetch_object($result)) {
......
......@@ -94,7 +94,7 @@ function forum_block($op = "list", $delta = 0) {
if (variable_get("forum_cache", 0)) {
$content = cache_get("forum:block");
}
if (!$content) {
$content = "<b>". t("Active forum topics:") ."</b><br />";
$result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM node n, forum f LEFT JOIN comments c ON c.nid = n.nid WHERE n.type = 'forum' AND n.nid = f.nid AND f.shadow = 0 AND n.status = 1 GROUP BY n.nid ORDER BY sort DESC LIMIT ". variable_get("forum_block_num", "5"));
......@@ -108,11 +108,11 @@ function forum_block($op = "list", $delta = 0) {
while ($node = db_fetch_object($result)) {
$content .= "- ". l(check_output($node->title), array("id" => $node->nid), "node", "", array("title" => substr(strip_tags($node->body), 0, 100)."...")) ."<br />";
}
if ($content) {
$content .= "<div align=\"right\">". lm(t("more"), array("mod" => "forum")) ."</div>";
}
cache_set("forum:block", $content, time() + 60 * 3);
}
......
......@@ -94,7 +94,7 @@ function forum_block($op = "list", $delta = 0) {
if (variable_get("forum_cache", 0)) {
$content = cache_get("forum:block");
}
if (!$content) {
$content = "<b>". t("Active forum topics:") ."</b><br />";
$result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM node n, forum f LEFT JOIN comments c ON c.nid = n.nid WHERE n.type = 'forum' AND n.nid = f.nid AND f.shadow = 0 AND n.status = 1 GROUP BY n.nid ORDER BY sort DESC LIMIT ". variable_get("forum_block_num", "5"));
......@@ -108,11 +108,11 @@ function forum_block($op = "list", $delta = 0) {
while ($node = db_fetch_object($result)) {
$content .= "- ". l(check_output($node->title), array("id" => $node->nid), "node", "", array("title" => substr(strip_tags($node->body), 0, 100)."...")) ."<br />";
}
if ($content) {
$content .= "<div align=\"right\">". lm(t("more"), array("mod" => "forum")) ."</div>";
}
cache_set("forum:block", $content, time() + 60 * 3);
}
......
......@@ -500,7 +500,7 @@ function node_admin_nodes() {
$output .= "<small>". implode(" :: ", $links) ."</small><hr />";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
$output .= " <tr><th>". t("title") ."</th><th>type</th><th>". t("author") ."</th><th>". t("status") ."</th><th colspan=\"2\">". t("operations") ."</th></tr>\n";
$output .= " <tr><th>". t("title") ."</th><th>". t("type") ."</th><th>". t("author") ."</th><th>". t("status") ."</th><th colspan=\"2\">". t("operations") ."</th></tr>\n";
while ($node = db_fetch_object($result)) {
$output .= "<tr><td>". l(check_output($node->title), array("id" => $node->nid)) ."</td><td>". module_invoke($node->type, "node", "name") ."</td><td nowrap=\"nowrap\">". format_name($node) ."</td><td>". ($node->status ? t("published") : t("not published")) ."</td><td nowrap=\"nowrap\">". la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid)) ."</td><td nowrap=\"nowrap\">". la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid)) ."</td></tr>";
}
......
......@@ -500,7 +500,7 @@ function node_admin_nodes() {
$output .= "<small>". implode(" :: ", $links) ."</small><hr />";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
$output .= " <tr><th>". t("title") ."</th><th>type</th><th>". t("author") ."</th><th>". t("status") ."</th><th colspan=\"2\">". t("operations") ."</th></tr>\n";
$output .= " <tr><th>". t("title") ."</th><th>". t("type") ."</th><th>". t("author") ."</th><th>". t("status") ."</th><th colspan=\"2\">". t("operations") ."</th></tr>\n";
while ($node = db_fetch_object($result)) {
$output .= "<tr><td>". l(check_output($node->title), array("id" => $node->nid)) ."</td><td>". module_invoke($node->type, "node", "name") ."</td><td nowrap=\"nowrap\">". format_name($node) ."</td><td>". ($node->status ? t("published") : t("not published")) ."</td><td nowrap=\"nowrap\">". la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid)) ."</td><td nowrap=\"nowrap\">". la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid)) ."</td></tr>";
}
......
......@@ -952,6 +952,7 @@ function user_edit($edit = array()) {
foreach (theme_list() as $key => $value) {
$options .= "<option value=\"$key\"". (($edit["theme"] == $key) ? " selected=\"selected\"" : "") .">$key - $value->description</option>\n";
}
$output .= form_item(t("Theme"), "<select name=\"edit[theme]\">$options</select>", t("Selecting a different theme will change the look and feel of the site."));
for ($zone = -43200; $zone <= 46800; $zone += 3600) $zones[$zone] = date("l, F dS, Y - h:i A", time() - date("Z") + $zone) ." (GMT ". $zone / 3600 .")";
$output .= form_select(t("Timezone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your timezone settings will be set appropriate."));
......@@ -1096,13 +1097,14 @@ function user_conf_options() {
$output .= form_textarea("Welcome e-mail body", "user_mail_welcome_body", variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". drupal_url(array("mod" => "user", "op" => "edit"), "module") ."\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the body of the welcome e-mail, which is sent to new members upon registering. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
$output .= form_textfield("Forgotten password e-mail subject", "user_mail_pass_subject", variable_get("user_mail_pass_subject", t("Replacement login information for %username at %site")), 80, 180, "Customize the Subject of your forgotten password e-mail. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto, %date");
$output .= form_textarea("Forgotten password e-mail body", "user_mail_pass_body", variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri". drupal_url(array("mod" => "user", "op" => "edit"), "module") ."\n\nYour new %site membership also enables to you to login to other Drupal powered websites (e.g. http://www.drop.org/) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the body of the forgotten password e-mail. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
return $output;
}
function user_admin_settings($edit = array()) {
global $op;
if ($op == "Save configuration") {
if ($op == t("Save configuration")) {
/*
** Save the configuration options:
*/
......@@ -1110,7 +1112,7 @@ function user_admin_settings($edit = array()) {
foreach ($edit as $name => $value) variable_set($name, $value);
}
if ($op == "Reset to defaults") {
if ($op == t("Reset to defaults")) {
/*
** Reset the configuration options to their default value:
*/
......@@ -1119,8 +1121,8 @@ function user_admin_settings($edit = array()) {
}
$output .= user_conf_options();
$output .= form_submit("Save configuration");
$output .= form_submit("Reset to defaults");
$output .= form_submit(t("Save configuration"));
$output .= form_submit(t("Reset to defaults"));
return form($output);
......@@ -1160,10 +1162,10 @@ function user_admin_create($edit = array()) {
$output .= theme_invoke("theme_error", check_output($error));
}
$output .= form_textfield("Username", "name", $edit["name"], 30, 55);
$output .= form_textfield("E-mail address", "mail", $edit["mail"], 30, 55);
$output .= form_textfield("Password", "pass", $edit["pass"], 30, 55);
$output .= form_submit("Create account");
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 55, t("Provide the username of the new account."));
$output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 55, t("Provide the e-mail address associated with the new account."));
$output .= form_textfield(t("Password"), "pass", $edit["pass"], 30, 55, t("Provide a password for the new account."));
$output .= form_submit(t("Create account"));
return form($output);
}
......@@ -1175,17 +1177,17 @@ function user_admin_access($edit = array()) {
$output .= "<small>". la(t("e-mail rules"), array("mod" => "user", "op" => "access", "type" => "mail")) ." :: ". la(t("username rules"), array("mod" => "user", "op" => "access", "type" => "user")) ."</small><hr />"; // irc rules, too!
if ($type != "user") {
$output .= "<h3>E-mail rules</h3>";
$output .= "<h3>" . t("E-mail rules") . "</h3>";
$type = "mail";
}
else {
$output .= "<h3>Username rules</h3>";
$output .= "<h3>" . t("Username rules") . "</h3>";
}
if ($op == "Add rule") {
if ($op == t("Add rule")) {
db_query("INSERT INTO access (mask, type, status) VALUES ('%s', '%s', '%s')", $edit["mask"], $type, $edit["status"]);
}
else if ($op == "Check") {
else if ($op == t("Check")) {
if (user_deny($type, $edit["test"])) {
$message = "<b>'". $edit["test"] ."' is not allowed.</b><p />";
}
......@@ -1198,32 +1200,32 @@ function user_admin_access($edit = array()) {
}
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
$output .= " <tr><th>type</th><th>mask</th><th>operations</th></tr>";
$output .= " <tr><th>" . t("type") . "</th><th>" . t("mask") . "</th><th>" . t("operations") . "</th></tr>";
$result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '1' ORDER BY mask", $type);
while ($rule = db_fetch_object($result)) {
$output .= "<tr><td align=\"center\">allow</td><td>". check_output($rule->mask) ."</td><td>". la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)) ."</td></tr>";
$output .= "<tr><td align=\"center\">" . t("Allow") . "</td><td>". check_output($rule->mask) ."</td><td>". la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)) ."</td></tr>";
}
$result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '0' ORDER BY mask", $type);
while ($rule = db_fetch_object($result)) {
$output .= "<tr><td align=\"center\">deny</td><td>". check_output($rule->mask) ."</td><td>". la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)). "</td></tr>";
$output .= "<tr><td align=\"center\">" . t("Deny") . "</td><td>". check_output($rule->mask) ."</td><td>". la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)). "</td></tr>";
}
$output .= " <tr><td><select name=\"edit[status]\"><option value=\"1\">allow</option><option value=\"0\">deny</option></select></td><td><input size=\"32\" maxlength=\"64\" name=\"edit[mask]\" /></td><td><input type=\"submit\" name=\"op\" value=\"Add rule\" /></td></tr>";
$output .= " <tr><td><select name=\"edit[status]\"><option value=\"1\">" . t("Allow") . "</option><option value=\"0\">" . t("Deny") . "</option></select></td><td><input size=\"32\" maxlength=\"64\" name=\"edit[mask]\" /></td><td><input type=\"submit\" name=\"op\" value=\"" . t("Add rule") . "\" /></td></tr>";
$output .= "</table>";
$output .= "<p><small>%: matches any number of characters, even zero characters.<br />_: matches exactly one character.</small></p>";
$output .= "<p><small>%: " . t("Matches any number of characters, even zero characters") . ".<br />_: " . t("Matches exactly one character.") . "</small></p>";
if ($type != "user") {
$output .= "<h3>Check e-mail address</h3>";
$output .= "<h3>" . t("Check e-mail address") . "</h3>";
}
else {
$output .= "<h3>Check username</h3>";
$output .= "<h3>" . t("Check username") . "</h3>";
}
$output .= "$message<input size=\"32\" maxlength=\"64\" name=\"edit[test]\" value=\"". $edit["test"] ."\" /><input type=\"submit\" name=\"op\" value=\"Check\" />";
$output .= "$message<input size=\"32\" maxlength=\"64\" name=\"edit[test]\" value=\"". $edit["test"] ."\" /><input type=\"submit\" name=\"op\" value=\"" . t("Check") . "\" />";
return form($output);
}
......@@ -1305,7 +1307,7 @@ function user_admin_perm($edit = array()) {
}
$output .= "</table>";
$output .= form_hidden("tid", $tid);
$output .= form_submit("Save permissions");
$output .= form_submit(t("Save permissions"));
return form($output);
......@@ -1314,14 +1316,14 @@ function user_admin_perm($edit = array()) {
function user_admin_role($edit = array()) {
global $op, $id;
if ($op == "Save role") {
if ($op == t("Save role")) {
db_query("UPDATE role SET name = '%s' WHERE rid = '%s'", $edit["name"], $id);
}
else if ($op == "Delete role") {
else if ($op == t("Delete role")) {
db_query("DELETE FROM role WHERE rid = '%s'", $id);
db_query("DELETE FROM permission WHERE rid = '%s'", $id);
}
else if ($op == "Add role") {
else if ($op == t("Add role")) {
db_query("INSERT INTO role (name) VALUES ('%s')", $edit["name"]);
}
else if ($id) {
......@@ -1331,9 +1333,9 @@ function user_admin_role($edit = array()) {
$role = db_fetch_object(db_query("SELECT * FROM role WHERE rid = '%s'", $id));
$output .= form_textfield("Role name", "name", $role->name, 32, 64, "The name for this role. Example: 'moderator', 'editorial board', 'site architect'.");
$output .= form_submit("Save role");
$output .= form_submit("Delete role");
$output .= form_textfield(t("Role name"), "name", $role->name, 32, 64, t("The name for this role. Example: 'moderator', 'editorial board', 'site architect'."));
$output .= form_submit(t("Save role"));
$output .= form_submit(t("Delete role"));
$output = form($output);
}
......@@ -1350,7 +1352,7 @@ function user_admin_role($edit = array()) {
while ($role = db_fetch_object($result)) {
$output .= "<tr><td>". check_output($role->name) ."</td><td>". la(t("edit role"), array("mod" => "user", "op" => "role", "id" => $role->rid)) ."</td></tr>";
}
$output .= " <tr><td><input size=\"32\" maxlength=\"64\" name=\"edit[name]\" /></td><td><input type=\"submit\" name=\"op\" value=\"Add role\" /></td></tr>";
$output .= " <tr><td><input size=\"32\" maxlength=\"64\" name=\"edit[name]\" /></td><td><input type=\"submit\" name=\"op\" value=\"" . t("Add role") . "\" /></td></tr>";
$output .= "</table>";
$output = form($output);
......@@ -1364,7 +1366,7 @@ function user_admin_edit($edit = array()) {
if ($account = user_load(array("uid" => $id))) {
if ($op == "Save account") {
if ($op == t("Save account")) {
foreach (module_list() as $module) {
if (module_hook($module, "user")) {
$result = module_invoke($module, "user", "edit_validate", $edit, $account);
......@@ -1415,7 +1417,7 @@ function user_admin_edit($edit = array()) {
$output .= theme_invoke("theme_error", check_output($error));
}
}
else if ($op == "Delete account") {
else if ($op == t("Delete account")) {
if ($edit["status"] == 0) {
db_query("DELETE FROM users WHERE uid = '$account->uid'");
db_query("DELETE FROM authmap WHERE uid = '$account->uid'");
......@@ -1430,7 +1432,7 @@ function user_admin_edit($edit = array()) {
** Display user form:
*/
$output .= form_item("User ID", check_output($account->uid));
$output .= form_item(t("User ID"), check_output($account->uid));
$output .= form_textfield(t("Username"), "name", $account->name, 30, 55, t("Your full name or your prefered username: only letters, numbers and spaces are allowed."));
$output .= form_textfield(t("E-mail address"), "mail", $account->mail, 30, 55, t("Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail."));
......@@ -1449,11 +1451,11 @@ function user_admin_edit($edit = array()) {
$output .= form_select(t("Timezone"), "timezone", $account->timezone, $zones, t("Select what time you currently have and your timezone settings will be set appropriate."));
$output .= form_select(t("Language"), "language", $account->language, $languages, t("Selecting a different language will change the language of the site."));
$output .= form_item(t("Password"), "<input type=\"password\" name=\"edit[pass1]\" size=\"12\" maxlength=\"24\" /> <input type=\"password\" name=\"edit[pass2]\" size=\"12\" maxlength=\"24\" />", t("Enter a new password twice if you want to change the current password for this user or leave it blank if you are happy with the current password."));
$output .= form_select("Status", "status", $account->status, array("blocked", "active"));
$output .= form_select("Role", "rid", $account->rid, user_roles(1));
$output .= form_select(t("Status"), "status", $account->status, array("blocked", "active"));
$output .= form_select(t("Role"), "rid", $account->rid, user_roles(1));