summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/theme.inc15
-rw-r--r--modules/locale.module36
-rw-r--r--modules/locale/locale.module36
3 files changed, 67 insertions, 20 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index e1d32fdc2..6950e9712 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -8,6 +8,21 @@ class BaseTheme {
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() {
diff --git a/modules/locale.module b/modules/locale.module
index 05d6d4318..4281ecb6b 100644
--- a/modules/locale.module
+++ b/modules/locale.module
@@ -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");
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 05d6d4318..4281ecb6b 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -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");