From 1e5afb398e3cdd53c221ff0c94ab6d79ceeaae75 Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Wed, 25 Jul 2001 08:31:53 +0000 Subject: 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). --- modules/locale.module | 36 ++++++++++++++++++++++++++---------- modules/locale/locale.module | 36 ++++++++++++++++++++++++++---------- 2 files changed, 52 insertions(+), 20 deletions(-) (limited to 'modules') 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 .= "\n"; $output .= " \n"; @@ -154,12 +170,12 @@ function locale_search() { $output .= " "; } $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."id\">edit localeid\">delete locale
\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 .= "\n"; $output .= " \n"; @@ -154,12 +170,12 @@ function locale_search() { $output .= " "; } $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."id\">edit localeid\">delete locale
\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"); -- cgit v1.2.3