Commit 1e5afb39 authored by Kjartan's avatar Kjartan

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).
parent 6fbd8403
......@@ -8,6 +8,21 @@ function links($links, $delimiter = " | ") {
function image($name) {
return "misc/$name";
}
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 theme_init() {
......
......@@ -140,13 +140,29 @@ function locale_untranslated($language) {
function locale_search() {
global $edit, $languages, $REQUEST_URI;
if (is_array($edit)) {
if ($edit[language] && $edit[status]) $query[] = check_input($edit[language]) . (check_input($edit[status]) == 1 ? " !=" : " =") ." ''";
if ($edit[module]) $query[] = "location LIKE '%mod=". check_input($edit[module]) ."%'";
if ($edit[string]) $query[] = "string LIKE '%". check_input($edit[string]) ."%'";
if ($edit[status]) {
switch ($edit[language]) {
case "all":
foreach ($languages as $key=>$value) {
$tmp[] = $key . (check_input($edit[status]) == 1 ? " !=" : " =") ." ''";
}
$query[] = implode(" && ", $tmp);
break;
case "any":
foreach ($languages as $key=>$value) {
$tmp[] = $key . (check_input($edit[status]) == 1 ? " !=" : " =") ." ''";
}
$query[] = "(". implode(" || ", $tmp) .")";
break;
default:
$query[] = check_input($edit[language]) . (check_input($edit[status]) == 1 ? " !=" : " =") ." ''";
}
}
if ($edit[module]) $query[] = "location LIKE '%mod=". (check_input($edit[module]) != "all" ? check_input($edit[module]) : "") ."%'";
if ($edit[string]) $query[] = "string RLIKE '". check_input($edit[string]) ."'";
$result = db_query("SELECT * FROM locales". (count($query) ? " WHERE ". @implode(" && ", $query) : ""));
$result = db_query("SELECT * FROM locales". (count($query) ? " WHERE ". implode(" && ", $query) : ""));
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>string</TH><TH>languages</TH><TH COLSPAN=\"2\">operations</TH></TR>\n";
......@@ -154,12 +170,12 @@ function locale_search() {
$output .= " <TR><TD>". check_output($locale->string) ."<BR><SMALL><I>". check_output($locale->location) ."</I></SMALL></TD><TD ALIGN=\"center\">". check_output(locale_languages($locale)) ."</TD><TD NOWRAP><A HREF=\"admin.php?mod=locale&op=edit&id=$locale->id\">edit locale</A></TD><TD NOWRAP><A HREF=\"admin.php?mod=locale&op=delete&id=$locale->id\">delete locale</A></TD></TR>";
}
$output .= "</TABLE>\n";
}
$form .= form_select("Language", "language", $edit[langauge], array_merge(array(0=>"All"), $languages));
$form .= form_select("Status", "status", $edit[status], array("All", "Translated", "Untranslated"), "Only used when a language is selected.");
$form .= form_select("Module", "module", $edit[module], array_merge(array(0=>"All"), module_list()));
$form .= form_textfield("String", "string", $edit[string], 30, 30, "Leave blank to show all strings.");
$form .= form_select("Language", "language", $edit[language], array_merge(array("all" => "All", "any" => "Any"), $languages));
$form .= form_select("Status", "status", $edit[status], array("All", "Translated", "Untranslated"));
$form .= form_select("Module", "module", $edit[module], array_merge(array("0" => "All modules + pages", "all" => "All modules"), module_list()));
$form .= form_textfield("String", "string", $edit[string], 30, 30, "Leave blank to show all strings. This is treated as a regular expression.");
$form .= form_submit("Search");
......
......@@ -140,13 +140,29 @@ function locale_untranslated($language) {
function locale_search() {
global $edit, $languages, $REQUEST_URI;
if (is_array($edit)) {
if ($edit[language] && $edit[status]) $query[] = check_input($edit[language]) . (check_input($edit[status]) == 1 ? " !=" : " =") ." ''";
if ($edit[module]) $query[] = "location LIKE '%mod=". check_input($edit[module]) ."%'";
if ($edit[string]) $query[] = "string LIKE '%". check_input($edit[string]) ."%'";
if ($edit[status]) {
switch ($edit[language]) {
case "all":
foreach ($languages as $key=>$value) {
$tmp[] = $key . (check_input($edit[status]) == 1 ? " !=" : " =") ." ''";
}
$query[] = implode(" && ", $tmp);
break;
case "any":
foreach ($languages as $key=>$value) {
$tmp[] = $key . (check_input($edit[status]) == 1 ? " !=" : " =") ." ''";
}
$query[] = "(". implode(" || ", $tmp) .")";
break;
default:
$query[] = check_input($edit[language]) . (check_input($edit[status]) == 1 ? " !=" : " =") ." ''";
}
}
if ($edit[module]) $query[] = "location LIKE '%mod=". (check_input($edit[module]) != "all" ? check_input($edit[module]) : "") ."%'";
if ($edit[string]) $query[] = "string RLIKE '". check_input($edit[string]) ."'";
$result = db_query("SELECT * FROM locales". (count($query) ? " WHERE ". @implode(" && ", $query) : ""));
$result = db_query("SELECT * FROM locales". (count($query) ? " WHERE ". implode(" && ", $query) : ""));
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>string</TH><TH>languages</TH><TH COLSPAN=\"2\">operations</TH></TR>\n";
......@@ -154,12 +170,12 @@ function locale_search() {
$output .= " <TR><TD>". check_output($locale->string) ."<BR><SMALL><I>". check_output($locale->location) ."</I></SMALL></TD><TD ALIGN=\"center\">". check_output(locale_languages($locale)) ."</TD><TD NOWRAP><A HREF=\"admin.php?mod=locale&op=edit&id=$locale->id\">edit locale</A></TD><TD NOWRAP><A HREF=\"admin.php?mod=locale&op=delete&id=$locale->id\">delete locale</A></TD></TR>";
}
$output .= "</TABLE>\n";
}
$form .= form_select("Language", "language", $edit[langauge], array_merge(array(0=>"All"), $languages));
$form .= form_select("Status", "status", $edit[status], array("All", "Translated", "Untranslated"), "Only used when a language is selected.");
$form .= form_select("Module", "module", $edit[module], array_merge(array(0=>"All"), module_list()));
$form .= form_textfield("String", "string", $edit[string], 30, 30, "Leave blank to show all strings.");
$form .= form_select("Language", "language", $edit[language], array_merge(array("all" => "All", "any" => "Any"), $languages));
$form .= form_select("Status", "status", $edit[status], array("All", "Translated", "Untranslated"));
$form .= form_select("Module", "module", $edit[module], array_merge(array("0" => "All modules + pages", "all" => "All modules"), module_list()));
$form .= form_textfield("String", "string", $edit[string], 30, 30, "Leave blank to show all strings. This is treated as a regular expression.");
$form .= form_submit("Search");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment