From fcc8211ab1331a4c6fa501d6b1a23e3c82c75423 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Tue, 20 Jan 2009 03:18:41 +0000 Subject: #203323 by JirkaRybka, robertgarrigos, thePanz, c960657, and sun: Fix undefined index locale in install.php and clean up crufty code. --- includes/bootstrap.inc | 10 ++++++++++ includes/common.inc | 2 +- install.php | 8 +++++--- modules/book/book.module | 2 +- modules/color/color.module | 2 +- modules/locale/locale.module | 11 ----------- themes/garland/template.php | 2 +- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 35a53b01d..27cd8400e 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -193,6 +193,16 @@ define('LANGUAGE_NEGOTIATION_PATH', 2); */ define('LANGUAGE_NEGOTIATION_DOMAIN', 3); +/** + * Language written left to right. Possible value of $language->direction. + */ +define('LANGUAGE_LTR', 0); + +/** + * Language written right to left. Possible value of $language->direction. + */ +define('LANGUAGE_RTL', 1); + /** * For convenience, define a short form of the request time global. */ diff --git a/includes/common.inc b/includes/common.inc index a37bbf670..37a90e10a 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -2058,7 +2058,7 @@ function drupal_add_css($path = NULL, $options = NULL, $reset = FALSE) { $css[$media][$type][$path] = $options['preprocess']; // If the current language is RTL, add the CSS file with RTL overrides. - if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) { + if ($language->direction == LANGUAGE_RTL) { $rtl_path = str_replace('.css', '-rtl.css', $path); if (file_exists($rtl_path)) { $css[$media][$type][$rtl_path] = $options['preprocess']; diff --git a/install.php b/install.php index 5a76f1bb4..334648896 100644 --- a/install.php +++ b/install.php @@ -554,9 +554,11 @@ function install_select_locale($profilename) { } } - foreach ($locales as $locale) { - if ($_POST['locale'] == $locale->name) { - return $locale->name; + if (!empty($_POST['locale'])) { + foreach ($locales as $locale) { + if ($_POST['locale'] == $locale->name) { + return $locale->name; + } } } diff --git a/modules/book/book.module b/modules/book/book.module index 64f02c450..e86bd94b1 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -998,7 +998,7 @@ function template_preprocess_book_export_html(&$variables) { $variables['title'] = check_plain($variables['title']); $variables['base_url'] = $base_url; $variables['language'] = $language; - $variables['language_rtl'] = defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL; + $variables['language_rtl'] = ($language->direction == LANGUAGE_RTL); $variables['head'] = drupal_get_html_head(); } diff --git a/modules/color/color.module b/modules/color/color.module index e09145003..50006afb3 100644 --- a/modules/color/color.module +++ b/modules/color/color.module @@ -94,7 +94,7 @@ function _color_page_alter(&$vars) { // If the current language is RTL and the CSS file had an RTL variant, // pull out the non-colored and add rewritten RTL stylesheet. - if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) { + if ($language->direction == LANGUAGE_RTL) { $rtl_old_path = str_replace('.css', '-rtl.css', $old_path); $rtl_color_path = str_replace('.css', '-rtl.css', $color_path); if (file_exists($rtl_color_path)) { diff --git a/modules/locale/locale.module b/modules/locale/locale.module index c44303292..7fa66b38b 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -12,17 +12,6 @@ * Gettext portable object files are supported. */ -/** - * Language written left to right. Possible value of $language->direction. - */ -define('LANGUAGE_LTR', 0); - -/** - * Language written right to left. Possible value of $language->direction. - */ -define('LANGUAGE_RTL', 1); - - // --------------------------------------------------------------------------------- // Hook implementations diff --git a/themes/garland/template.php b/themes/garland/template.php index 016a1e4e7..16b4d2857 100644 --- a/themes/garland/template.php +++ b/themes/garland/template.php @@ -92,7 +92,7 @@ function garland_get_ie_styles() { global $language; $ie_styles = ''. "\n"; - if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) { + if ($language->direction == LANGUAGE_RTL) { $ie_styles .= ' '. "\n"; } -- cgit v1.2.3