comment.inc

- removed comment_controls().
- modified comment_render() to use $theme->comment_controls().

theme.inc
- added BaseTheme->comment_controls().

locale.module
- can now search for status independant of language.
- string is now a regular expression. For wildcard searches do .*text.*.
- can search in modules + pages, all modules or a specific module.

account.php
- fixed viewing other accounts info would show the active users name in the
  real name field.
- now shows users recent contributions and comments (if the user has access to
  them).
3-00
natrak 2001-07-25 08:31:52 +00:00
parent 3894f24f6e
commit 6fbd8403df
2 changed files with 39 additions and 18 deletions

View File

@ -201,17 +201,52 @@ function account_user($uname) {
$theme->footer(); $theme->footer();
} }
elseif ($uname && $account = account_get_user($uname)) { elseif ($uname && $account = account_get_user($uname)) {
$theme->header();
// Display account information:
$output .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n"; $output .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n";
$output .= " <TR><TD ALIGN=\"right\"><B>". t("Username") .":</B></TD><TD>". check_output($account->userid) ."</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>". t("Username") .":</B></TD><TD>". check_output($account->userid) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>". t("Real name") .":</B></TD><TD>". check_output($user->name) ."</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>". t("Real name") .":</B></TD><TD>". check_output($account->name) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>". t("E-mail") .":</B></TD><TD>". format_email($account->fake_email) ."</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>". t("E-mail") .":</B></TD><TD>". format_email($account->fake_email) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>". t("Homepage") .":</B></TD><TD>". format_url($account->url) ."</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>". t("Homepage") .":</B></TD><TD>". format_url($account->url) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>". t("Bio") .":</B></TD><TD>". check_output($account->bio) ."</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>". t("Bio") .":</B></TD><TD>". check_output($account->bio) ."</TD></TR>\n";
$output .= "</TABLE>\n"; $output .= "</TABLE>\n";
// Display account information:
$theme->header();
$theme->box(strtr(t("%a's user information"), array("%a" => $uname)), $output); $theme->box(strtr(t("%a's user information"), array("%a" => $uname)), $output);
// Display contributions:
if (user_access("access contents")) {
$result = db_query("SELECT n.nid, n.type, n.title, n.timestamp, COUNT(c.cid) AS count FROM node n LEFT JOIN comments c ON c.lid = n.nid WHERE n.status = '". node_status("posted") ."' AND n.author = '$account->id' GROUP BY n.nid DESC ORDER BY n.nid DESC LIMIT 25");
while ($node = db_fetch_object($result)) {
$nodes .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n";
$nodes .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>". t("Subject") .":</B></TD><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A> (". format_plural($node->count, "comment", "comments") .")</TD></TR>\n";
$nodes .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>". t("Type") .":</B></TD><TD>". check_output($node->type) ."</A></TD></TR>\n";
$nodes .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>". t("Date") .":</B></TD><TD>". format_date($node->timestamp) ."</TD></TR>\n";
$nodes .= "</TABLE>\n";
$nodes .= "<P>\n";
}
$theme->box(strtr(t("%a's contributions"), array("%a" => $uname)), ($nodes ? $nodes : t("Not posted any nodes.")));
}
if (user_access("access comments")) {
$sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.author = '$account->id' GROUP BY n.nid DESC ORDER BY n.nid DESC LIMIT 5");
while ($node = db_fetch_object($sresult)) {
$comments .= "<LI>". format_plural($node->count, "comment", "comments") ." ". t("attached to node") ." `<A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A>`:</LI>\n";
$comments .= " <UL>\n";
$cresult = db_query("SELECT * FROM comments WHERE author = '$account->id' AND lid = '$node->nid'");
while ($comment = db_fetch_object($cresult)) {
$comments .= " <LI><A HREF=\"node.php?id=$node->nid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A> (". t("replies") .": ". comment_num_replies($comment->cid) .", ". t("votes") .": $comment->votes, ". t("score") .": ". comment_score($comment) .")</LI>\n";
}
$comments .= " </UL>\n";
}
$theme->box(strtr(t("%a's comments"), array("%a" => $uname)), ($comments ? $comments : t("Not posted any comments.")));
}
$theme->footer(); $theme->footer();
} }
else { else {

View File

@ -163,20 +163,6 @@ function comment_moderation($comment) {
return $output; return $output;
} }
function comment_controls($threshold = 1, $mode = 3, $order = 1) {
global $REQUEST_URI, $user;
$output .= "<DIV ALIGN=\"CENTER\">\n";
$output .= "<FORM METHOD=\"post\" ACTION=\"$REQUEST_URI\">\n";
$output .= comment_mode(($user->id ? $user->mode : $mode));
$output .= comment_order(($user->id ? $user->sort : $order));
$output .= comment_threshold(($user->id ? $user->threshold : $threshold));
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Update settings") ."\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Add comment") ."\">\n";
$output .= "</FORM>\n";
$output .= "</DIV>\n";
return $output;
}
function comment_threshold($threshold) { function comment_threshold($threshold) {
for ($i = -1; $i < 6; $i++) $options .= " <OPTION VALUE=\"$i\"". ($threshold == $i ? " SELECTED" : "") .">". t("Filter") ." - $i</OPTION>"; for ($i = -1; $i < 6; $i++) $options .= " <OPTION VALUE=\"$i\"". ($threshold == $i ? " SELECTED" : "") .">". t("Filter") ." - $i</OPTION>";
return "<SELECT NAME=\"threshold\">$options</SELECT>\n"; return "<SELECT NAME=\"threshold\">$options</SELECT>\n";
@ -273,7 +259,7 @@ function comment_render($lid, $cid) {
if ($user->id) { if ($user->id) {
// Comment control: // Comment control:
$theme->box(t("Comment control"), comment_controls($threshold, $mode, $order)); $theme->box(t("Comment control"), $theme->comment_controls($threshold, $mode, $order));
// Print moderation form: // Print moderation form:
print "<FORM METHOD=\"post\" ACTION=\"$REQUEST_URI\">\n"; print "<FORM METHOD=\"post\" ACTION=\"$REQUEST_URI\">\n";