From 2ecc3e4c78d032bf3f05018da6522437ffca3906 Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Mon, 4 Jun 2001 15:17:10 +0000 Subject: - Output disabled message when locale is disabled. - If $languages is empty and locale is enabled output $na instead of script errors. --- modules/locale.module | 34 ++++++++++++++++++++-------------- modules/locale/locale.module | 34 ++++++++++++++++++++-------------- 2 files changed, 40 insertions(+), 28 deletions(-) (limited to 'modules') diff --git a/modules/locale.module b/modules/locale.module index b8dd70fa6..b4f254cc0 100644 --- a/modules/locale.module +++ b/modules/locale.module @@ -53,25 +53,31 @@ function locale_edit($id) { } function locale_languages($translation) { - global $languages; - foreach ($languages as $key=>$value) { - $output .= ($translation->$key) ? "$key " : "$key "; + global $languages, $na; + if (count($languages)) { + foreach ($languages as $key=>$value) { + $output .= ($translation->$key) ? "$key " : "$key "; + } + return $output; } - return $output; + return $na; } function locale_overview() { - $result = db_query("SELECT * FROM locales ORDER BY string"); - - $output .= "\n"; - $output .= " \n"; - while ($locale = db_fetch_object($result)) { - $languages = locale_languages($locale); - $output .= " "; + if (variable_get("locale", 0)) { + $result = db_query("SELECT * FROM locales ORDER BY string"); + + $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
$locale->location
$languagesid\">editid\">delete
\n"; + $output .= " \n"; + while ($locale = db_fetch_object($result)) { + $languages = locale_languages($locale); + $output .= " "; + } + $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
$locale->location
$languagesid\">editid\">delete
\n"; + + return $output; } - $output .= "\n"; - - return $output; + return "Locale disabled."; } function locale_admin() { diff --git a/modules/locale/locale.module b/modules/locale/locale.module index b8dd70fa6..b4f254cc0 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -53,25 +53,31 @@ function locale_edit($id) { } function locale_languages($translation) { - global $languages; - foreach ($languages as $key=>$value) { - $output .= ($translation->$key) ? "$key " : "$key "; + global $languages, $na; + if (count($languages)) { + foreach ($languages as $key=>$value) { + $output .= ($translation->$key) ? "$key " : "$key "; + } + return $output; } - return $output; + return $na; } function locale_overview() { - $result = db_query("SELECT * FROM locales ORDER BY string"); - - $output .= "\n"; - $output .= " \n"; - while ($locale = db_fetch_object($result)) { - $languages = locale_languages($locale); - $output .= " "; + if (variable_get("locale", 0)) { + $result = db_query("SELECT * FROM locales ORDER BY string"); + + $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
$locale->location
$languagesid\">editid\">delete
\n"; + $output .= " \n"; + while ($locale = db_fetch_object($result)) { + $languages = locale_languages($locale); + $output .= " "; + } + $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
$locale->location
$languagesid\">editid\">delete
\n"; + + return $output; } - $output .= "\n"; - - return $output; + return "Locale disabled."; } function locale_admin() { -- cgit v1.2.3