Commit fcc8211a authored by webchick's avatar webchick

#203323 by JirkaRybka, robertgarrigos, thePanz, c960657, and sun: Fix...

#203323 by JirkaRybka, robertgarrigos, thePanz, c960657, and sun: Fix undefined index locale in install.php and clean up crufty code.
parent 0ec23b9b
......@@ -193,6 +193,16 @@
*/
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.
*/
......
......@@ -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'];
......
......@@ -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;
}
}
}
......
......@@ -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();
}
......
......@@ -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)) {
......
......@@ -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
......
......@@ -92,7 +92,7 @@ function garland_get_ie_styles() {
global $language;
$ie_styles = '<link type="text/css" rel="stylesheet" media="all" href="' . base_path() . path_to_theme() . '/fix-ie.css" />'. "\n";
if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) {
if ($language->direction == LANGUAGE_RTL) {
$ie_styles .= ' <style type="text/css" media="all">@import "' . base_path() . path_to_theme() . '/fix-ie-rtl.css";</style>'. "\n";
}
......
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